$urandom seed

Hello,

I have a Question on $urandom ( seed ).

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.

How do we know what seed is used in $urandom ?

Thanks
JeffD

In reply to dvuvmsv:

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.

A good DVCon paper to read about it is UVM Random Stability Don’t leave it to chance. It’s worth reading parts of it even if you aren’t using UVM.

Thank you Dave.

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.

Thanks
JeffD

In reply to dvuvmsv:

Do not use the seed argument to $urandom and instead pass the seed to the simulation command line. Check your user manual.

Thanks Dave. Most of the tools it is -svseed

-sv_seed random
-sv_seed integer

Thanks
JeffD