• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Why $random is not controlled by seed?

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 64
  • Views 14700
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why $random is not controlled by seed?

archive
archive over 11 years ago

There is a segment of code below:

for(int i=0;i<10;i++)begin

$display("current random value: %0d", $random);

end

I use Cadence irun to compile and simulate this code. Although I add option " -seed random" to irun, but each time the result is same. It seems that $random is not controlled by -seed.

If I change $random to $urandom, it works! Each time I run, the result is not different.

So, my question is that, why $random is not controlled by -seed ???

Thanks.

  • Cancel
  • TAM1
    TAM1 over 11 years ago

    The $random call matches the behavior from the older Verilog standard. You adjust its seed by passing in a signed integer value in the HDL.The behavior of that function (including its default seed) is strongly defined and hasn't changed for 20+ years.

     

    The $urandom call was added for the new SystemVerilog language. It was explicitly defined by the language to allow its initial seed to be  implementation dependent, which frees the various simulators to allow it to be set from the command line.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information