Skip to content

Commit

Permalink
Added configuration support to NVC.
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsAsplund committed Jul 17, 2023
1 parent 92bd927 commit fe4aeec
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions vunit/sim_if/nvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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}"]
Expand All @@ -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
Expand All @@ -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

0 comments on commit fe4aeec

Please sign in to comment.