[sv-ec] should shallow copy of a class instance copy the rand_mode settings?

From: Dickol, John <john.dickol_at_.....>
Date: Sat Mar 11 2006 - 22:02:36 PST
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?

John
Received on Sat Mar 11 22:02:45 2006

This archive was generated by hypermail 2.1.8 : Sat Mar 11 2006 - 22:04:51 PST