3
\$\begingroup\$

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?

\$\endgroup\$
8
  • \$\begingroup\$ For a simulation run you can pass svseed as an argument to the tool. Which tool you use? \$\endgroup\$
    – Mitu Raj
    Commented May 24, 2021 at 14:17
  • \$\begingroup\$ @MituRaj Cadence Xcelium, how do I get that value? \$\endgroup\$
    – Carter
    Commented May 24, 2021 at 14:18
  • \$\begingroup\$ 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. \$\endgroup\$
    – Mitu Raj
    Commented May 24, 2021 at 14:21
  • \$\begingroup\$ 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. \$\endgroup\$
    – Carter
    Commented May 24, 2021 at 14:25
  • 2
    \$\begingroup\$ FYI, you have VCS and Questa switches swapped. \$\endgroup\$
    – dave_59
    Commented May 24, 2021 at 17:06

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.