I am now working on a verilog testbench file and I want to get a random value in my code, but I have found that Questa Sim uses the same seed again and again. I have read through $random in Verilog doesn't seem to be working and tried typing -sv_seed random in the transcript window, but the program doesn't understand my command. Can anyone give me some hints?
Asked
Active
Viewed 396 times
0
-
Reminds me Apple II’s faulty RAND function so we used time of day for a seed – Tony Stewart EE75 Oct 05 '18 at 04:00
-
1Just to be sure that you are doing nothing wrong, can you show us some code? – Oldfart Oct 05 '18 at 04:07
-
I have one line: #0 random_out_delay = $urandom_range(31,0); but the problem is that I don't know where to input the "-sv_seed random" command – eric yau Oct 05 '18 at 04:33
1 Answers
1
The -sv_seed random
is an option the to vsim
command line. By the time you get to vsim's transcript window, it's too late to change the seed.
When invoking Questa from the shell command
vsim -sv_seed random ...
When starting Questa simulation using the GUI, look for form to fill in vsim options.

dave_59
- 7,557
- 1
- 14
- 26
-
Thanks for your help. If it's too late, what should I do if I want to change the seed before simulation? Where should I type the command "sv_seed random"? – eric yau Oct 05 '18 at 05:44
-
`vsim -sv_seed random
. If you are using the Questa GUI, when you go to "Start Simulation" there is an Other Vsim Options form – dave_59 Oct 05 '18 at 05:52