Home > Community > Forums > Functional Verification > Why $random is not controlled by seed?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Why $random is not controlled by seed? 

Last post Tue, Feb 25 2014 7:39 AM by TAM1. 1 replies.
Started by monkeyking 24 Feb 2014 10:55 PM. Topic has 1 replies and 1093 views
Page 1 of 1 (2 items)
Sort Posts:
  • Mon, Feb 24 2014 10:55 PM

    • monkeyking
    • Not Ranked
    • Joined on Thu, Jul 11 2013
    • Posts 8
    • Points 145
    Why $random is not controlled by seed? Reply

    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.

    Filed under:
    • Post Points: 20
  • Tue, Feb 25 2014 7:39 AM

    • TAM1
    • Top 75 Contributor
    • Joined on Thu, Jul 17 2008
    • HOME, PA
    • Posts 83
    • Points 1,105
    Re: Why $random is not controlled by seed? Reply

    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.

    • Post Points: 5
Page 1 of 1 (2 items)
Sort Posts:
Started by monkeyking at 24 Feb 2014 10:55 PM. Topic has 1 replies.