It is possible to set RNG seed for each process in a module (always_.., initial, etc.). To do this it is necessary to have a process handler:
module dut();
int i;
process P1;
initial begin
P1 = process::self();
#2;
i = $urandom_range(0, 500);
$display("The value of i is %1d", i);
end
endmodule // dut
Now you can set seed for each process individually:
module top_tb;
initial begin
#1; // Wait process handlers to be created
// Set seeds
dut_a.P1.srandom($urandom);
dut_b.P1.srandom($urandom);
dut_c.P1.srandom($urandom);
end
dut dut_a();
dut dut_b();
dut dut_c();
endmodule
Randomization in an initial block
in UVM SystemVerilog Discussions
Posted
It is possible to set RNG seed for each process in a module (always_.., initial, etc.). To do this it is necessary to have a process handler:
module dut(); int i; process P1; initial begin P1 = process::self(); #2; i = $urandom_range(0, 500); $display("The value of i is %1d", i); end endmodule // dut
Now you can set seed for each process individually:
module top_tb; initial begin #1; // Wait process handlers to be created // Set seeds dut_a.P1.srandom($urandom); dut_b.P1.srandom($urandom); dut_c.P1.srandom($urandom); end dut dut_a(); dut dut_b(); dut dut_c(); endmodule