Skip to content

Commit dfb63e4

Browse files
committed
feat(ghdl_interface): save runtime args to txt file
1 parent 0f00d74 commit dfb63e4

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

vunit/ghdl_interface.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,23 +211,36 @@ def _get_command(self, config, output_path, ghdl_e):
211211
cmd += ['--work=%s' % config.library_name]
212212
cmd += ['--workdir=%s' % self._project.get_library(config.library_name).directory]
213213
cmd += ['-P%s' % lib.directory for lib in self._project.get_libraries()]
214+
215+
bin_path = join(
216+
output_path,
217+
"%s-%s" % (config.entity_name, config.architecture_name)
218+
)
214219
if self._has_output_flag():
215-
cmd += ['-o', join(output_path, "%s-%s" % (config.entity_name,
216-
config.architecture_name))]
220+
cmd += ['-o', bin_path]
217221
cmd += config.sim_options.get("ghdl.elab_flags", [])
218222
objs = config.sim_options.get("objects", [])
219223
if objs:
220224
cmd += ["-Wl," + " ".join(objs)]
221-
222225
cmd += [config.entity_name, config.architecture_name]
223226

227+
sim = config.sim_options.get("ghdl.sim_flags", [])
228+
for name, value in config.generics.items():
229+
sim += ['-g%s=%s' % (name, value)]
230+
sim += ['--assert-level=%s' % config.vhdl_assert_stop_level]
231+
if config.sim_options.get("disable_ieee_warnings", False):
232+
sim += ["--ieee-asserts=disable"]
233+
224234
if not ghdl_e:
225-
cmd += config.sim_options.get("ghdl.sim_flags", [])
226-
for name, value in config.generics.items():
227-
cmd += ['-g%s=%s' % (name, value)]
228-
cmd += ['--assert-level=%s' % config.vhdl_assert_stop_level]
229-
if config.sim_options.get("disable_ieee_warnings", False):
230-
cmd += ["--ieee-asserts=disable"]
235+
cmd += sim
236+
else:
237+
try:
238+
os.makedirs(output_path, mode=0o777)
239+
except OSError:
240+
pass
241+
with open(join(output_path, 'args.txt'), 'w') as fname:
242+
for item in [bin_path] + sim:
243+
fname.write("%s\n" % item)
231244

232245
return cmd
233246

0 commit comments

Comments
 (0)