-
Notifications
You must be signed in to change notification settings - Fork 290
Description
When using third party hooks such as VHPI/VPI interfaces, information is often communicated in environment variables. When using vunit's multi-threading functionality this introduces the possibility of a collision or race condition. For example if thread 1 sets environment variables, then thread 2 preempts and set it's own environment variables and then thread 1 runs the simulator. Thread 1's simulator is running with the incorrect environment variables and may fail as a result. There is some awareness of this as in the GHDL simulator interface the environment is copied (https://github.com/VUnit/vunit/blob/master/vunit/sim_if/ghdl.py#L371) and then the coverage variables updated. I propose the simulator interface be updated to accept an environment argument that defaults to None. If None is specified it immediately makes a local copy of the environment and uses that. There's likely an argument for this to somehow be exposed to the pre-simulation hooks as well.
For context, I'm working on a project to combine VUnit and Cocotb. I'm not trying to propose specific changes for either project, just generally useful changes. I believe this qualifies.