In my opinion, the LRM statement (at the end of 18.14.3): "An object's seed can be set from any thread. However, a thread's seed can only be set from within the thread itself." is incorrect and should be removed. 1) Objects and threads do not have a "seed", they have a RNG state. The RNG state is seeded (initialized. 2) Section 18.14.1 constains the bullet: - Manual seeding. All noninitialization RNGs can be manually seeded. ... 3) 'srandom' and 'set_randstate' are methods of the process class and can be used to seed the RNG of the process (thread). There should not be a restriction that the call must be made from the thread. Due to timing issues, it is more predictable - but not required. Regards, Ray ________________________________ From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On Behalf Of Daniel Mlynek Sent: Tuesday, December 22, 2009 12:58 AM To: sv-ec@server.eda.org Subject: [sv-ec] srandom, set_randstate restrictions LRM says: An object's seed can be set from any thread. However, a thread's seed can only be set from within the thread itself. From the syntax point of view setting seed of the thread from another thread is possible - I assume that this is semantic restriction and below code should fail on runtime. My question is should LRM restriction be valid for both srandom and set_randstate ? module top; process p,p1; string str; initial begin p = process::self(); #10; $display($urandom()); end initial begin p1 = process::self(); #10; $display($urandom()); end initial #1 p.srandom(1); //illegal because seeding of another thread????? initial begin #2; str= p.get_randstate(); $display(str); str= p1.get_randstate(); $display(str); p1.set_randstate(str); //illegal because seeding of another thread????? end endmodule DANiel -- This message has been scanned for viruses and dangerous content by MailScanner <http://www.mailscanner.info/> , and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Tue Dec 22 08:28:47 2009
This archive was generated by hypermail 2.1.8 : Tue Dec 22 2009 - 08:30:10 PST