to run a tiny perl script that does
$x=int(rand(2**32)); print "parameter randseed=$x;\n";
outputting to a one-line file which is then `include 'ed
The TB prints the seed, so I can repeat when required.
the testbench does integer seed; `include "random.v"
execute in an initial
seed = randseed;
then maybe something like
err = {$random(seed)} % `errorrate ;
apart from managable issues with signed and unsigned integers, this runs in all sorts of verilog simulators for me. john
James Bird wrote:
Hi All,
I see that this topic has been covered a lot on comp.lang.verilog, but not specific to icarus verilog as far as I could see.
When using $random without an argument one gets the same list of "random" numbers each time they run the simulation. I've seen that to avoid this, you may initialize the seed variable as equal to the system clock or date for the first time you execute $random, and subsequently execute without arguments.
To repeat with the same random number set you write the seed value to a file and use that to initialize seed to repeat a past simulation.
But using icarus, how do you set the seed variable to the system clock, or some other changing variable? Are there better ways of getting a non-deterministic set of random values on successive simulations?
James.
