Multiple local variables with the same name ( __Vtable1_valid ) generated in a header file when using SystemVerilog interfaces in a certain situation
I've stumbled upon a situation where verilator generates invalid C++ code, i.e. it generates multiple local variables with the same name: __Vtable1_valid.
Please find attached the minimal code I could come up with to reproduce the issue. The code models a demultiplexer in SystemVerilog (wrap_demux.sv), with 3 outputs with handshaking interface for each one. If I remove one output, the issue is gone.
If you take a look at "obj_dir/Vwrap_demux.h", you will see the following erroneous code:
static VL_ST_SIG8(__Vtable1_valid,0,0); static VL_ST_SIG8(__Vtable1_valid,0,0); static VL_ST_SIG8(__Vtable1_valid,0,0);
Internally, "wrap_demux.sv" uses interfaces which are defined in "dti.sv". If I remove the interfaces, the issue is gone.
Also available in: Atom