From fe4aeece8f88401ba58a39d45899830d7a359835 Mon Sep 17 00:00:00 2001 From: Lars Asplund Date: Mon, 17 Jul 2023 22:44:09 +0200 Subject: [PATCH] Added configuration support to NVC. --- vunit/sim_if/nvc.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vunit/sim_if/nvc.py b/vunit/sim_if/nvc.py index bb7165af7..39a3fab03 100644 --- a/vunit/sim_if/nvc.py +++ b/vunit/sim_if/nvc.py @@ -235,7 +235,9 @@ def compile_vhdl_file_command(self, source_file): cmd += [source_file.name] return cmd - def simulate(self, output_path, test_suite_name, config, elaborate_only): + def simulate( + self, output_path, simulator_output_path, test_suite_name, config, elaborate_only + ): # pylint: disable=too-many-branches """ Simulate with entity as top level using generics """ @@ -261,7 +263,10 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only): cmd += ["-e"] cmd += config.sim_options.get("nvc.elab_flags", []) - cmd += [f"{config.entity_name}-{config.architecture_name}"] + if config.vhdl_config_name is not None: + cmd += [config.vhdl_config_name] + else: + cmd += [f"{config.entity_name}-{config.architecture_name}"] for name, value in config.generics.items(): cmd += [f"-g{name}={value}"] @@ -285,7 +290,7 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only): status = True try: - proc = Process(cmd) + proc = Process(cmd, cwd=simulator_output_path) proc.consume_output() except Process.NonZeroExitCode: status = False @@ -298,6 +303,6 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only): cmd += ["--script", str(Path(init_file).resolve())] stdout.write(f'{" ".join(cmd)}\n') - subprocess.call(cmd) + subprocess.call(cmd, cwd=simulator_output_path) return status