Before SystemVerilog, in the Verilog world, I used $random(seed) to
create random numbers and seed used is written to a file called seed.txt
to reproduce the Bugs.
How is it done in SystemVerilog world using $urandom.
Do we still need to store the seed in text file during simulation.
The seed argument to $urandom is an input only, and should never be used.
Seeding in SystemVerilog is controlled by concept called “Random Stability” (1800-2017 LRM section 18.14) where a master seed serves to initialize a global random number generator (RNG) and that RNG propagates to all the random constructs. You can set the master seed on the command line when running your simulation.
In Verilog I used currenttime as an input seed to $random
$random(currenttime); That is why I have to save the currenttime as seed.txt
In SystemVerilog if we pass a constant seed as runtime to $urandom(constant seed)
everytime when we run the simulation, only same set of random numbers are generated
Whereas if we use currenttime as seed, different random numbers are generated
at different runs. If we want this way even in SystemVerilog we have to
save the currenttime as seed.txt
Is there any better way to manage the seed, other than saving the seed as seed.txt
in simulation ?
We may need to pass different seed value as runtime argument if we want different random numbers.