Problem simulating with genrics
Why OSVVM™? › Forums › OSVVM › Problem simulating with genrics
- This topic has 6 replies, 2 voices, and was last updated 1 week, 1 day ago by
jon.
-
AuthorPosts
-
March 14, 2026 at 15:41 #2888
jon
MemberI am trying to change a generic in my testbench when I start the simulation (using Questasim base). I am using the following script :-
TestName tb_test1
analyze tb_test1.vhd +acc
simulate tb_test1 [generic USE_ADV_MODE 1]
I get the following output from the simulator
vopt {*}-work dma_mm2s -L dma_mm2s tb_test1 common.glbl -o tb_test1_opt -gUSE_ADV_MODE=1 -designfile C:/hds/hdl/dma/sim/dma_dma_mm2s/reports/JON/tb_test1_USE_ADV_MODE_1_design.bin
Then a bit further down it says
** Warning: (vopt-3040) Command line generic/parameter “USE_ADV_MODE” not found in design.
The simulation runs and I can see the generic is there but it has the default value I set in the testbench.
I am not sure what I am doing wrong.
ThanksMarch 25, 2026 at 14:53 #2889
Jim LewisMemberHi Jon
Is the generic at the top level of the testbench or is it at a lower level?Best Regards,
JimApril 14, 2026 at 16:24 #2899jon
MemberHi Jim
Sorry for the delay.
The genric is in the testbench file where all items are instantiated (DUT, AXI compoents etc).
Thanks
JonApril 14, 2026 at 17:46 #2904
Jim LewisMemberIn VendorScripts_Questa (if version is 2025 or newer) or VendorScripts_Siemens, the generic switch is set by the following:
# ------------------------------------------------- proc vendor_generic {Name Value} { return "-g${Name}=${Value}" }According to the Questa command reference,
-g <Name>=<Value> … (optional) Assigns a value to all specified VHDL generics and Verilog parameters that have not received explicit values in generic maps, instantiations, or from defparams (such as toplevel generics/parameters and generics/parameters that would otherwise receive their default values). . . . -G<Name>=<Value> … (optional) Same as -g (see above) except that -G also overrides generics/parameters that received explicit values in generic maps, instantiations, or from defparams.OSVVM is using lower case g. If you want to override something set on the component, you can switch it to upper case G in the scripts. Perhaps OSVVM can make that a setting in the future.
Alternately you can change how you are giving the generic its default value. Rather than putting it in a generic map, specify it as the default on a component declaration (if using component instances) or on the entity declaration (if using entity instances). The lower case “-g” should override these.
Let me know how it goes.
Best Regards,
JimApril 14, 2026 at 19:23 #2905jon
MemberSetting it to -G solved the problem.
Thanks
JonApril 14, 2026 at 20:20 #2906
Jim LewisMemberBe sure to try setting the generic defaults via the component (if used) or entity (if component not used).
April 15, 2026 at 11:42 #2907jon
MemberIt looks like the problem was that I was defining the generic as a default value in the testbench top. Doing that I needed to use the -G option. If i delete that statement then the -g option works.
-
AuthorPosts
- You must be logged in to reply to this topic.