RE: [sv-ec] Question about seeding $urandom

From: Clifford E. Cummings <cliffc_at_.....>
Date: Wed Jun 10 2009 - 17:22:40 PDT
Thanks, Dave -

So I added to the portion of the code:

`ifdef RUN6
process p = process::self();
seed = 145;
p.srandom(seed);
repeat (20) #1 a = $urandom();

And saw the results I wanted.

To be clear, because I had read up on processes and the srandom 
method, but could not figure out how to make them work, the code Dave 
showed does the following(??):
Declares a process "p" and assigns  a handle to the current process 
(this initial block) to "p."
Now that I have a handle to the current process (this initial block), 
I can use the built-in srandom() method to set a new seed.
Is this correct?

 From the LRM, I could not figure out how to use the srandom() method 
on the thread/process that is this initial block. I was wondering if 
I had to name the block and then use the block-name with the srandom 
method, but that did not seem right.

Might be nice to add this simple example to a future version of the 
LRM in clause 18.13.3 srandom().

Thanks again Dave, I could have spent a lot of time trying to figure 
this one out. Brownie points for Dave :-)

Regards - Cliff

At 05:01 PM 6/10/2009, you wrote:
>Cliff,
>
>You need to seed the process using the srandom(seed) method
>
>
>initial begin
>             process p = process::self();
>             p.srandom(seed);
>             repeat (20) #1 a = $urandom;
>
>Dave

----------------------------------------------------
Cliff Cummings - Sunburst Design, Inc.
14314 SW Allen Blvd., PMB 501, Beaverton, OR 97005
Phone: 503-641-8446 / FAX: 503-641-8486
cliffc@sunburst-design.com / www.sunburst-design.com
Expert Verilog, SystemVerilog, Synthesis and Verification Training


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jun 10 17:24:11 2009

This archive was generated by hypermail 2.1.8 : Wed Jun 10 2009 - 17:24:49 PDT