If you are already using SystemVerilog, use $urandom_range(32) which gives you better random stability than the Verilog $random and $dist_uniform calls. Every initial/always block gets an independent seed.
If you are already using SystemVerilog, use $urandom_range(32) which gives you better random stability than the Verilog $random and $dist_uniform calls. Every initial/always block gets an independent seed.
Stability is the repeatability of a series of random numbers as you make changes to your testbench.
Suppose you had two always blocks generating random numbers. Then you make a change to the testbench so that the frequency of generating random numbers changes in one of the blocks. Maybe you get two random numbers or skip a random number in one cycle. If all the random number generators share the same seed variable, then the sequence of random numbers in the always block where you did not make a change will be affected. On the other hand, if you give each always block a separate seed variable, you need to make sure each variable begins with a different seed value, otherwise you may wind up with the same series of random values in each always block.
SystemVerilog takes care of this automatically by a specific algorithm that creates a seed variable for each thread as well as giving each variable a unique starting value.
SystemVerilog takes care of this automatically by a specific algorithm that creates a seed variable for each thread as well as giving each variable a unique starting value.
Thank you for the detailed explanation! Got it now. I guess the main new feature is a distinct seed for each seperate threads, which is indeed a good idea. I take it this is standardized behavior over all the simulators?