3

I know 3 EDA companies handle with SVSEED as the below image, enter image description here For reproducibility and random stability, I'd like to generate a random value by using "+svseed random" in SystemVerilog Cadence simulation as the below example snippet code,

class const_c;
rand bit [7:0] a;
...
endclass

module test; ... const_c cons; cons = new();

initial begin

for(...) begin
   cons.randomize();
   printf("Current SVSEED: %0d", ?);
end

end endmodule

How do we know "svseed" value when "-svseed random" used. it's value in SystemVerilog?

Mitu Raj
  • 10,946
  • 6
  • 24
  • 48
Carter
  • 607
  • 2
  • 8
  • 25
  • For a simulation run you can pass svseed as an argument to the tool. Which tool you use? – Mitu Raj May 24 '21 at 14:17
  • @MituRaj Cadence Xcelium, how do I get that value? – Carter May 24 '21 at 14:18
  • If you used svseed flag, the value of seed should be the simulation log file. The default is value is 1 in some tools if you don't mention to the simulator. – Mitu Raj May 24 '21 at 14:21
  • Is that only available in the simulation log file to get the value? because I'd like to make a directory each simulation by SVSEED value. and If I can get a SVSEED value in simulation time, it will be handy. – Carter May 24 '21 at 14:25
  • Are you using svseed random? – Mitu Raj May 24 '21 at 14:25
  • @MituRaj Yes. I am using svseed random – Carter May 24 '21 at 14:26
  • I normally use svseed (random number), where this random number is generated by a Linux shell and passed as argument to the simulation command to the tool. In this way I know which root seed was used for the run. Not sure whether we can access this seed value anywhere inside SV modules, cz they use derived seeds. – Mitu Raj May 24 '21 at 14:33
  • 2
    FYI, you have VCS and Questa switches swapped. – dave_59 May 24 '21 at 17:06

1 Answers1

2

As far as I know, at least there is no direct method to find the root seed set by the simulator ahead of the simulation run. The value set by sv_seed flag is usually found in the log generated by the simulation. If not used, it's defaulted to 1 in some tools.

Because I'd like to make a directory each simulation by SVSEED value. and If I can get a SVSEED value in simulation time, it will be handy.

A work-around I have done in Questa-Sim in the past is generating a random root seed \$ R \$ in a script/makefile, and then create necessary simulation folders corresponding to this generated seed. Finally, invoke the simulation command from the script, and pass \$R\$ as argument using -sv_seed R flag.

Mitu Raj
  • 10,946
  • 6
  • 24
  • 48