Closed alexgomp closed 1 year ago
I would do this instead by extension
Something like (not tested):
class QCustom(Questa):
def __init__(self, tcl_sources, *argv, **kwargs):
self.tcl_sources= tcl_sources
super().__init__(*argv, **kwargs)
def do_script(self):
return = f"source {self.tcl_sources};" + super().do_script()
def test_abc():
QCustom(
...
tcl_sources="abc.tcl"
).run()
Would this work for you ?
Sorry for the slow reply, I've just returned from a long holiday. I'll be quicker now :)
Unfortunately, I don't think that this would work for my problem
1.
Ideally, in the case of IP which is compiled by script, these compile scripts can be called before the vcom
and vlog
commands generated for the vhdl_sources
and verilog_sources
arguments. This is because in almost all cases, IP is instantiated by user HDL sources and the IP must therefore be compiled first. Unfortunately, the do_script
generated command is appended to the end of the cmd
list. One could work around this issue by including the full compilation process in a prewritten script instead of using the vhdl_sources
and verilog_sources
arguments. But, it would be a shame to lose the advantages and flexibility provided by using these arguments.
For Questa, the do_script
generated command is appended only if not self.compile_only:
(simulator.py:562).
And something like this (not tested):
class QCustom(Questa):
def __init__(self, tcl_sources, *argv, **kwargs):
self.tcl_sources= tcl_sources
super().__init__(*argv, **kwargs)
def build_command(self):
cms = super().build_command()
cmd.insert(0, ['vsim', '-do', self.tcl_sources]
return cmd
def test_abc():
QCustom(
...
tcl_sources="abc.tcl"
).run()
Yep, that should do the trick. Thank you!
Problem:
Proposed Solution Add a parameter to the Simulator block,
tcl_sources
:I've written a solution for Questa/Modelsim: