Random number generation in testbench

Back ground info : Using Modelsim in Windows environment, using Verilog.

I'm trying to generate a random number that's different each time $random is called. Not knowing much about DOS/windows environment, I need help passing in wallclock information from the command line (in a does batch file).


dos prompt> vsim +SEED='time' ...

and using in the testbench

if (!($value$plusargs("SEED=%d", rand_seed)) ...

doesn't work because the wallclock time isn't passed in correctly. I don't want to use the same starting seed each time the simulation is run, either. I'll, of course, save the seed so that I can reproduce the bugs.

How do I get around this problem? How do you use random data pattern in your test bench?

I don't have an option of using unix (or unix-like shell in windows)...

Thanks in advance.

Reply to
Loading thread data ...

You can always find some sort of Perl or Python for Windows to convert wallclock time to a number and then launch vsim from it.

Best regards,


Reply to
Ben Twijnstra

there is a uniform(seed1,seed2,rand_v); in ieee It will generate a random number each time it is called. the seed values we keep in a small text file, and using standard io calls, read, increment, and save the numbers each time the simulation is started. This gives a random stream of data each time a restart is done.

Reply to
Simon Peacock

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.