Skip to content

Commit fe4aeec

Browse files
committed
Added configuration support to NVC.
1 parent 92bd927 commit fe4aeec

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

vunit/sim_if/nvc.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ def compile_vhdl_file_command(self, source_file):
235235
cmd += [source_file.name]
236236
return cmd
237237

238-
def simulate(self, output_path, test_suite_name, config, elaborate_only):
238+
def simulate(
239+
self, output_path, simulator_output_path, test_suite_name, config, elaborate_only
240+
): # pylint: disable=too-many-branches
239241
"""
240242
Simulate with entity as top level using generics
241243
"""
@@ -261,7 +263,10 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only):
261263
cmd += ["-e"]
262264

263265
cmd += config.sim_options.get("nvc.elab_flags", [])
264-
cmd += [f"{config.entity_name}-{config.architecture_name}"]
266+
if config.vhdl_config_name is not None:
267+
cmd += [config.vhdl_config_name]
268+
else:
269+
cmd += [f"{config.entity_name}-{config.architecture_name}"]
265270

266271
for name, value in config.generics.items():
267272
cmd += [f"-g{name}={value}"]
@@ -285,7 +290,7 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only):
285290
status = True
286291

287292
try:
288-
proc = Process(cmd)
293+
proc = Process(cmd, cwd=simulator_output_path)
289294
proc.consume_output()
290295
except Process.NonZeroExitCode:
291296
status = False
@@ -298,6 +303,6 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only):
298303
cmd += ["--script", str(Path(init_file).resolve())]
299304

300305
stdout.write(f'{" ".join(cmd)}\n')
301-
subprocess.call(cmd)
306+
subprocess.call(cmd, cwd=simulator_output_path)
302307

303308
return status

0 commit comments

Comments
 (0)