Support hierarchical library mapping in ModelSim#775
Support hierarchical library mapping in ModelSim#775ThomasWismer wants to merge 2 commits intoVUnit:masterfrom
Conversation
| write_modelsimini(cfg, self._sim_cfg_file_name) | ||
|
|
||
| def _get_mapped_libraries(self): | ||
| def _get_mapped_libraries(self, cfg_file_name=None): |
There was a problem hiding this comment.
Is the addition of this argument related to the description of the PR? It seems to be a different feature.
There was a problem hiding this comment.
This allows the same method to be used for subordinate INI files, see recursive call below on line 229.
There was a problem hiding this comment.
Ok, I overlooked that the call was recursive.
| if "others" in libraries: | ||
| other_libraries = self._get_mapped_libraries(libraries["others"]) | ||
| # current mappings take precedence over others | ||
| libraries = {**other_libraries, **libraries} |
There was a problem hiding this comment.
Can this be a single line?
libraries = {**(self._get_mapped_libraries(libraries["others"])), **libraries}There was a problem hiding this comment.
Sure. I'd prefer two statements for readability, but I can change this if you like.
There was a problem hiding this comment.
It's ok. Just checking that other_libraries is not used somewhere else (it's local to the if clause).
|
@LarsAsplund this as been reviewed by Umarcor, I suggest to merge and close. |
|
I think we should probably add a test for this. |
|
You are right. I don't mind working on that but I do not understand how the tests work. I guess I need to modify the |
|
@dalex78 The tests create their own ini files. These doesn't have to be real and complete files but just enough to verify that VUnit handles the files as expected. For example, the test setup creates a file containing a single line: vunit/tests/unit/test_modelsim_interface.py Line 328 in fbb46c6 Some tests, i.e. vunit/tests/unit/test_modelsim_interface.py Line 257 in fbb46c6 In this case you would need to create ini files containing the others clause and verify that VUnit collects the information correctly. |
|
As the author of this pull request, I felt obliged to submit a unit test. @dalex78 Thanks anyway for your offer to take on this "burden". |
|
@LarsAsplund This one might be merged aswell |
The library section of the modelsim.ini file allows to refer to a subordinate INI file using an "others" clause (subordinate files may also contain an "others" clause). The current implementation for collecting all mapped libraries ignores the "others" clause. With this change, all library mappings from all subordinate files are included.