-
Notifications
You must be signed in to change notification settings - Fork 279
Description
Coming from #465.
@umarcor:
If I executepython3 run.py -v --elaborate
, the application (main
) is executed, but GHDL is skipped, so the check fails. I would expect the binary not to be executed at all.
@kraigher:
Regarding '--elaborate' the GHDL binary must be called for elaboration to be performed.
I'm not sure about this. This might be true for the mcode backend, since elaboration and run are merged in a single stage. This is because mcode
does not save a binary to disk; it is created and executed in memory. However, it should not be true for GCC and LLVM backends, where elaboration generates a binary file and run does actually execute it. Precisely, with GCC and LLVM backends ghdl -r
is equivalent to calling the binary directly.
- See hints at https://ghdl.readthedocs.io/en/latest/using/QuickStartGuide.html#the-hello-world-program
- https://ghdl.readthedocs.io/en/latest/using/InvokingGHDL.html#design-building-commands
- https://ghdl.readthedocs.io/en/latest/using/Simulation.html#cmdoption-ghdl-no-run
@kraigher:
I guess in this example since you are wrapping the GHDL main function with data generation and checking you need to check the ARGV and skip data generation and checking unless the run flag was given.
I would expect --elaborate
to be equivalent to GHDL's own -e
, but this is not the case. VUnit assumes that elaboration is part of execution, so --elab-run
is used instead of -e
: https://github.com/VUnit/vunit/blob/master/vunit/ghdl_interface.py#L189. As a result: --elaborate
== --elab-run --no-run
.
Overall, yes, I can work around this by adding some logic to the main function. But I think it is sensible to improve VUnit, so that it is possible to use it as a build tool for GHDL design that outputs a binary.
The fix I suggest is to modify https://github.com/VUnit/vunit/blob/master/vunit/ghdl_interface.py#L227 so that --elab-run
is replaced with -e
, instead of adding --no-run
. This will probably require to modify _get_sim_command
too, in order to ignore sim arguments if elaborate_only
.