Arturo,
The LRM says "The scope randomize function behaves exactly the same as a
class randomize method, except that it operates on the variables of the
current scope instead of class member variables."
The LRM does not anything about randomizing null class handles except
that randomize() will never modify the handle, and will never call a
constructor. I think the intent was that randomizing a class variable
with a null class handle should not produce an error unless an unguarded
constraint tries to reference a member of that class.
Dave
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Arturo Salz
Sent: Monday, February 22, 2010 12:10 PM
To: Ryan, Ray; sv-ec@eda.org; Daniel Mlynek
Subject: RE: [sv-ec] rand modifier on handle to null
I agree that the first scenario - using c.randomize() - is explicitly
covered by the LRM. But, the second one - std::randomize(c0) - is not
covered and I can think of good reasons for either behavior.
Arturo
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Ryan, Ray
Sent: Monday, February 22, 2010 11:35 AM
To: sv-ec@eda.org; Daniel Mlynek
Subject: RE: [sv-ec] rand modifier on handle to null
In section 18.4 Random variables, the 5th bullet contains:
"-- ... When a dynamic array is resized by randomize, ... If the new
size is greater than the
original size, each of the additional elements has a null value
requiring no randomization."
This implies that a random variable with a null value does not cause an
error.
I do agree the LRM could be more explicit.
Ray
________________________________
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf
Of Daniel Mlynek
Sent: Monday, February 22, 2010 5:41 AM
To: sv-ec@eda.org
Subject: [sv-ec] rand modifier on handle to null
LRM does not say explicitly what should happened if handle
pointing to null is randomized.
See below case - there are 2 calls to randomize (1 to method 1
to function).
In both calls handle to null is randomized.
Should it be "null pointer reference" fatal error or randomize
function (method) should automatically ignore null references?
IMHO LRM should explicitly describe proper behaviour.
class A;
rand int i ;
endclass
class C;
rand A a = null;
endclass
module top;
C c = new;
C c0;
initial begin
c.randomize(); //
randomize(c0); //c is null
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 <http://www.mailscanner.info/> , and is believed to be clean. -- 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 Mon Feb 22 23:12:09 2010
This archive was generated by hypermail 2.1.8 : Mon Feb 22 2010 - 23:12:22 PST