This is a very good point. The LRM does not specify what happens to the random settings. I think users would expect the rand_mode and constraint_mode to be copied. The other alternative would be to reset these settings to their default state in the new object. Either way, the LRM needs to be specific. Arturo -----Original Message----- From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Dickol, John Sent: Saturday, March 11, 2006 10:03 PM To: sv-ec@eda.org Subject: [sv-ec] should shallow copy of a class instance copy the rand_mode settings? If randomization is disabled for a random variable in a class instance, and subsequently a shallow copy is made of that class instance, should randomization also be disabled in the copy? For example, in the following code fragment, should I expect randomization to be disabled for c2.num? class C; rand int num; endclass C c1,c2; initial begin c1 = new; c1.num.rand_mode(0); // disable randomization of c1.num c2 = new c1; // shallow copy c1 to c2. assert(c2.randomize); // should c2.num be randomized? end The LRM, section 7.11, says that class properties are copied, but it's not clear if rand_mode is considered to be a class property. Similarly, should constraint_mode settings be copied? JohnReceived on Sat Mar 11 22:38:36 2006
This archive was generated by hypermail 2.1.8 : Sat Mar 11 2006 - 22:39:00 PST