There is also $urandom_range: "The $urandom_range() function returns an unsigned integer within a specified range. The syntax for $urandom_range() is as follows: function int unsigned $urandom_range( int unsigned maxval, int unsigned minval = 0 ); The function shall return an unsigned integer in the range of maxval ... minval. Example: val = $urandom_range(7,0); If minval is omitted, the function shall return a value in the range of maxval ... 0. Example: val = $urandom_range(7); If maxval is less than minval, the arguments are automatically reversed so that the first argument is larger than the second argument. Example: val = $urandom_range(0,7); All of the three previous examples produce a value in the range of 0 to 7, inclusive. $urandom_range() is automatically thread stable." Shalom > -----Original Message----- > From: Bresticker, Shalom > Sent: Monday, February 11, 2008 5:54 PM > To: Sri Chandra > Cc: Geoffrey.Coram; Verilog-AMS LRM Committee; Neil.Korpusik@Sun.COM > Subject: RE: [Fwd: Minutes of Verilog-AMS meeting - 31 Jan 2008] > > This is the description of $urandom: > > The system function $urandom provides a mechanism for > generating pseudo-random numbers. The function returns a new > 32-bit random number each time it is called. The number shall > be unsigned. > > The syntax for $urandom is as follows: > function int unsigned $urandom [ (int seed ) ] ; > > The seed is an optional argument that determines the sequence > of random numbers generated. The seed can be any integral > expression. The random number generator (RNG) shall generate > the same sequence of random numbers every time the same seed is used. > The RNG is deterministic. Each time the program executes, it > cycles through the same random sequence. > This sequence can be made nondeterministic by seeding the > $urandom function with an extrinsic random variable, such as > the time of day. > > For example: > > bit [64:1] addr; > bit [ 3:0] number; > addr[32:1] = $urandom( 254 ); // Initialize the generator, > // get 32-bit random number > addr = {$urandom, $urandom }; // 64-bit random number number > = $urandom & 15; // 4-bit random number > > Shalom > > > Option #3: Have an equivalent function for the distribution > functions > > amsrand or absrand which extends the current distribution > function to > > take in parameter and constant expressions and we can keep > the current > > random and distribution functions the same as the system verilog > > counterpart. Apparently SV has already done this by having > urand (?) > > as an extension to 1364 which will return an unsigned number. > --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Feb 11 08:00:55 2008
This archive was generated by hypermail 2.1.8 : Mon Feb 11 2008 - 08:01:09 PST