|
21 | 21 | from vunit.ostools import renew_path, write_file, read_file |
22 | 22 | from vunit.test.bench import Configuration |
23 | 23 | from vunit.vhdl_standard import VHDL |
| 24 | +from tests.common import create_tempdir |
| 25 | +from tests.unit.test_test_bench import Entity |
24 | 26 |
|
25 | 27 |
|
26 | 28 | class TestIncisiveInterface(unittest.TestCase): |
@@ -956,6 +958,21 @@ def test_simulate_gui(self, run_command, find_cds_root_irun, find_cds_root_virtu |
956 | 958 | ], |
957 | 959 | ) |
958 | 960 |
|
| 961 | + @mock.patch("vunit.sim_if.incisive.IncisiveInterface.find_cds_root_virtuoso") |
| 962 | + @mock.patch("vunit.sim_if.incisive.IncisiveInterface.find_cds_root_irun") |
| 963 | + def test_configuration_and_entity_selection(self, find_cds_root_irun, find_cds_root_virtuoso): |
| 964 | + find_cds_root_irun.return_value = "cds_root_irun" |
| 965 | + find_cds_root_virtuoso.return_value = None |
| 966 | + |
| 967 | + with create_tempdir() as tempdir: |
| 968 | + design_unit = Entity("tb_entity", file_name=str(Path(tempdir) / "file.vhd")) |
| 969 | + design_unit.generic_names = ["runner_cfg"] |
| 970 | + config = Configuration("name", design_unit, vhdl_configuration_name="cfg") |
| 971 | + simif = IncisiveInterface(prefix="prefix", output_path=self.output_path) |
| 972 | + self.assertEqual(simif._select_vhdl_top(config), "cfg") # pylint: disable=protected-access |
| 973 | + config = Configuration("name", design_unit) |
| 974 | + self.assertEqual(simif._select_vhdl_top(config), "lib.tb_entity:arch") # pylint: disable=protected-access |
| 975 | + |
959 | 976 | def setUp(self): |
960 | 977 | self.output_path = str(Path(__file__).parent / "test_incisive_out") |
961 | 978 | renew_path(self.output_path) |
@@ -985,4 +1002,5 @@ def make_config(sim_options=None, generics=None, verilog=False): |
985 | 1002 |
|
986 | 1003 | cfg.sim_options = {} if sim_options is None else sim_options |
987 | 1004 | cfg.generics = {} if generics is None else generics |
| 1005 | + cfg.vhdl_configuration_name = None |
988 | 1006 | return cfg |
0 commit comments