RE: [sv-ec] A question about randomize and non-rand class handle members

From: Rich, Dave <Dave_Rich_at_.....>
Date: Wed Feb 22 2006 - 18:58:23 PST
I agree with the addition of the word "random"

But the instead of the last bullet, I would add the following

 - Any variable not declared as rand or randc shall be considered a
state variable and not modified by the solver.


Dave


> -----Original Message-----
> From: William Paulsen [mailto:paulsen@cadence.com]
> Sent: Wednesday, February 22, 2006 5:21 PM
> To: Ryan, Ray; Arturo Salz; Rich, Dave; sv-ec@eda.org
> Subject: RE: [sv-ec] A question about randomize and non-rand class
handle
> members
> 
> Thanks Ray & Arturo,
> Would the proposal below be reasonable?
> Bill
> 
> 
> 
> In 13.3, in the second to last item, add the word "random" to specify
> that only the "rand" class variable members will be solved for a rand
> handle. The current LRM text implies that all variables in a class are
> solved.
> Here's the item with "random" inserted:
> 
> - An object handle can be declared rand, in which case all of that
> object's
> >>> random <<< variables and constraints are solved concurrently with
> the
> variables and constraints of the object that contains the handle.
> Objects cannot be declared randc.
> 
> 
> And also in 13.3 add this new item - I don't think this is currently
> clear in the LRM:
> 
> - An object handle or a struct variable that does not have a "rand"
> qualifier will not be randomized.
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Ryan, Ray [mailto:Ray_Ryan@mentor.com]
> Sent: Wednesday, February 22, 2006 8:13 PM
> To: Arturo Salz; William Paulsen; Rich, Dave; sv-ec@eda.org
> Subject: RE: [sv-ec] A question about randomize and non-rand class
> handle members
> 
> Paul,
> 
> I agree with Arturo, structs and classes are similar constructs for
> randomization.
> 
> Therefore, if a struct variable IS declared as rand, but an element of
> the struct is not declared as rand, then that element will not be
> randomized when the struct is randomized. Thus the purpose of the
'rand'
> attribute within a struct declaration.
> 
> Other observations:
> - if none of the elements of struct (or class) are rand, randomizing
the
>   struct variable does nothing.
> - A struct that contains non-integral elements can be randomized as
long
>   as the non-integral elements are also not rand. (same as for a
class).
> 
> Ray
> 
> 
> > -----Original Message-----
> > From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
> > Arturo Salz
> > Sent: Wednesday, February 22, 2006 11:37 AM
> > To: William Paulsen; Rich, Dave; sv-ec@eda.org
> > Subject: RE: [sv-ec] A question about randomize and non-rand class
> > handle members
> >
> > Paul,
> >
> > I believe the LRM needs work in this respect. Your question is not
> > limited to classes, but it also applies to nested structures:
> >
> > typedef struct { rand int a; } s_a;
> >
> > struct {
> >   s_a   a;	// is this randomized
> >   rand int b;
> > }
> >
> > I think the easiest solution would be to treat structures and
classes
> > as orthogonal constructs. Then, a struct that is not declared as
rand
> > will not be randomized, even if it includes rand members. However,
> > when the randomize operator is applied to the struct (which is
itself
> > not declared as a rand member) then all its rand-declared members
are
> > randomized.
> >
> > 	Arturo
> >
> > -----Original Message-----
> > From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
> > William Paulsen
> > Sent: Wednesday, February 22, 2006 7:38 AM
> > To: Rich, Dave; sv-ec@eda.org
> > Subject: RE: [sv-ec] A question about randomize and non-rand class
> > handle members
> >
> > Thanks,
> > But please consider something similar for structs.  If a struct
member
> 
> > is rand, but the struct object in a class is not rand, does the
struct
> 
> > member get randomized?
> >
> > EG, does c1.s1.i1 get randomized in a c1.randomize() call?
> >
> > If so, then I would expect classes to have similar behavior.
> >
> > If not, then what's the purpose of allowing a rand qualifier on a
> > struct member?
> >
> > Bill
> >
> >
> >
> > module top;
> >
> > typedef struct {
> >   rand integer i1;  // Does this get randomized?
> >   integer i2;
> > } struct_t;
> >
> > class class1;
> >   struct_t s1; // Note this is not rand endclass
> >
> > integer r;
> > class1 c1 = new;
> >
> > initial begin
> >   r = c1.randomize();
> > end
> > endmodule
> >
> >
> >
> > -----Original Message-----
> > From: Rich, Dave [mailto:Dave_Rich@mentor.com]
> > Sent: Wednesday, February 22, 2006 10:21 AM
> > To: William Paulsen; sv-ec@eda.org
> > Subject: RE: [sv-ec] A question about randomize and non-rand class
> > handle members
> >
> > No, only if the declaration of c1 was rand.
> >
> > rand class1 c1;
> >
> > See 13.3
> >
> > > -----Original Message-----
> > > From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf
Of
> > > William Paulsen
> > > Sent: Wednesday, February 22, 2006 5:23 AM
> > > To: sv-ec@eda.org
> > > Subject: [sv-ec] A question about randomize and non-rand
> > class handle
> > > members
> > >
> > >
> > > Here's a question about randomization:
> > >
> > > In this example, should c2.c1.i1 be randomized?  Ie, must
randomize
> > > dereference all handle members in a class and solve all rand
members
> > of
> > > those classes? (and also recurse)
> > >
> > > Thanks,
> > > Bill Paulsen
> > >
> > >
> > >
> > > module top;
> > >
> > > class class1;
> > >   rand integer i1;
> > > endclass
> > >
> > > class class2;
> > >   class1 c1;  // Note there's no rand qualifier endclass
> > >
> > > integer r;
> > > class2 c2 = new;
> > >
> > > initial begin
> > >   r = c2.randomize();
> > > end
> > > endmodule
> >
> >
> >
> >
Received on Wed Feb 22 18:58:34 2006

This archive was generated by hypermail 2.1.8 : Wed Feb 22 2006 - 18:59:50 PST