mercredi 1 avril 2020

can we use $random in system verilog with seed argument?

can I use $random(seed) in order to generate same value for a variable in system verilog?

module test();
logic[1:0] a,b:
integer seed;
initial begin
repeat (3)
begin
seed = 20;
a = $random(seed);
b=$random;
$display("a=%h,b=%h",a,b):
end
end
endmodule

For the above code I ma always getting value of 'a' as '0'. Cant we use $random with seed? Because when I changed it to $urandom(seed) it works as expected. I read in so many places that I can use $random with seed argument. can someone please help on this




Aucun commentaire:

Enregistrer un commentaire