Skip to content

[GHDL] run.py --elaborate should not execute the design #466

@umarcor

Description

@umarcor

Coming from #465.

@umarcor:
If I execute python3 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.

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions