For variable assignment, I would expect that the rand_mode would NOT be copied. For example: class myclass rand int x, y; function void swap(); int tmp; tmp = x; x = y; // y.rand_mode is NOT copied ? y = tmp; endfunction endclass I would expect the swap function would exchange the VALUES of x,y, but would not change the rand_mode setting for x or y. Ray > -----Original Message----- > From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On > Behalf Of Arturo Salz > Sent: Saturday, March 11, 2006 10:38 PM > To: Dickol, John; sv-ec@eda.org > Subject: RE: [sv-ec] should shallow copy of a class instance > copy the rand_mode settings? > > 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? > > John > > >Received on Mon Mar 13 11:08:01 2006
This archive was generated by hypermail 2.1.8 : Mon Mar 13 2006 - 11:08:22 PST