1
0

use $urandom as seed for $random

This commit is contained in:
Yunsup Lee 2016-10-03 16:57:23 -07:00 committed by Yunsup Lee
parent 62954d543e
commit 23c8b06d4a

View File

@ -19,16 +19,23 @@ module TestDriver;
reg [63:0] trace_count = 0; reg [63:0] trace_count = 0;
reg [1023:0] vcdplusfile = 0; reg [1023:0] vcdplusfile = 0;
reg [1023:0] vcdfile = 0; reg [1023:0] vcdfile = 0;
int unsigned rand_value;
initial initial
begin begin
// do not delete the line below
// $random function needs to be called with the seed once
// to affect all the downstream $random functions within the
// Chisel-generated Verilog code
$fdisplay(stderr, "seed %0d, testing $random %0x", unsigned'($get_initial_random_seed), $random($get_initial_random_seed));
$value$plusargs("max-cycles=%d", max_cycles); $value$plusargs("max-cycles=%d", max_cycles);
verbose = $test$plusargs("verbose"); verbose = $test$plusargs("verbose");
// do not delete the line below.
// $random function needs to be called with the seed once to affect all
// the downstream $random functions within the Chisel-generated Verilog
// code.
// $urandom is seeded via cmdline (+ntb_random_seed in VCS) but that
// doesn't seed $random.
rand_value = $random($urandom);
if (verbose) begin
$fdisplay(stderr, "testing $random %0x", rand_value);
end
`ifdef DEBUG `ifdef DEBUG
if ($value$plusargs("vcdplusfile=%s", vcdplusfile)) if ($value$plusargs("vcdplusfile=%s", vcdplusfile))
begin begin