RE: [sv-ec] A question about mixing rand and non-rand handles to the same object

From: Rich, Dave <Dave_Rich_at_.....>
Date: Sat Sep 30 2006 - 16:10:08 PDT
Bill,

And what would that mantis issue be? There's always room for more
examples, but normative text is best.

Dave


> -----Original Message-----
> From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org]
On
> Behalf Of William Paulsen
> Sent: Saturday, September 30, 2006 6:00 AM
> To: Ryan, Ray; sv-ec@server.eda-stds.org
> Subject: RE: [sv-ec] A question about mixing rand and non-rand handles
to
> the same object
> 
> 
> OK, Thanks
> Should there be a new mantis issue for this?
> Bill
> 
> -----Original Message-----
> From: Ryan, Ray [mailto:Ray_Ryan@mentor.com]
> Sent: Friday, September 29, 2006 6:45 PM
> To: Ryan, Ray; William Paulsen; sv-ec@eda-stds.org
> Subject: RE: [sv-ec] A question about mixing rand and non-rand handles
> to the same object
> 
> A had a couple people point out that I missed that
> ch2.ch1 and ch2.rch1 both refer the same class instance.
> 
> In this case, since the variable (refered to by either
"ch2.rch1.rint1"
> or "ch2.ch1.rint1") is included in the set of active random variables
it
> should be treated as such (and not treated as a reference to a state
> variable).
> 
> This is an important part of constraint composition with classes.
> Possibly we need to add something like:
> 
> If an object is include in the set of active random variables, then in
a
> constraint any variable reference that resolves to that object
> constrains the generated random value for the object.
> 
> 
> That is, the final set of random variables and constraints looks like:
>     Random variables:
>  	<randVar1>   "ch2.rint2"
>  	<randVar2>   "ch2.rch1.rint1"
>     Constraints:
>  	ch2.rch1.con1 { <randVar2> == 10; }
>  	ch2.con2 {<randVar2> == <randVar1>;}
> 
> So there is only 1 solution. IE. both random variables must be 10.
> 
> Ray
> 
> > -----Original Message-----
> > From: owner-sv-ec@server.eda.org
> > [mailto:owner-sv-ec@server.eda.org] On Behalf Of Ryan, Ray
> > Sent: Friday, September 29, 2006 2:34 PM
> > To: William Paulsen; sv-ec@server.eda-stds.org
> > Subject: RE: [sv-ec] A question about mixing rand and non-rand
handles
> 
> > to the same object
> >
> >  When ch2.randomize() is called, the set of random objects and
> > constraints initially consists of all the random members and
> > constraints of ch2. These are:
> >    Random variables:
> >   	ch2.rint2
> > 	ch2.rch1
> >    Constraints:
> > 	ch2.con2 {ch2.rint2 == ch2.ch1.rint1;}
> >
> > Because ch2.rch1 is random and is a class handle, its random members
> > and constraints are added to the randomization.
> > So the random variable and constraints become:
> >    Random variables:
> > 	ch2.rint2
> > 	ch2.rch1.rint1
> >    Constraints:
> > 	ch2.rch1.con1 { ch2.rch1.rint1 == 10; }
> > 	ch2.con2 {ch2.rint2 == ch2.ch1.rint1;)
> >
> > A reference to a variable in a constaint does not make it 'rand'. So
> > yes, for this randomization, ch2.ch1.rint1 is a state value.
> >
> > Ray
> >
> > > -----Original Message-----
> > > From: owner-sv-ec@server.eda.org
> > > [mailto:owner-sv-ec@server.eda.org] On Behalf Of William Paulsen
> > > Sent: Friday, September 29, 2006 1:29 PM
> > > To: sv-ec@server.eda-stds.org
> > > Subject: [sv-ec] A question about mixing rand and non-rand
> > handles to
> > > the same object
> > >
> > >
> > > Section 13.4.8 of the LRM is not clear (to me) about the following
> > > scenario.
> > > Does there need to be an explanation or clarification added
> > to the LRM
> > > for this?
> > >
> > > Thanks,
> > > Bill
> > >
> > >
> > > In the example below, two constraint expressions contain
> > references to
> > > the same property (rint1) of the same class
> > > (class1) object instance.
> > >
> > >   In class2, constraint "con2" has the reference "ch1.rint1",
where
> > > "ch1"
> > >   is not a rand handle.
> > >
> > >   In class1, constraint "con1" has the reference "rint1", where
> > > "rint1"
> > > is rand.
> > >
> > > Is "ch1.rint1" in constraint "con2" considered a state
> > variable, or is
> > > it one of the "active random objects?"
> > >
> > > One possibility is that in constraint "con2", "rint1" is a state
> > > variable, whose value is not subject to generation, since
> > "ch1" is not
> > > rand.
> > >
> > > The other possibility is that since "ch2.ch1.rint1" is the same
> > > property as "ch2.rch1.rint1", then it should be considered
> > rand even
> > > in the context of constraint "con2".
> > >
> > > module top;
> > >
> > > class class1;
> > >   rand int rint1;
> > >   constraint con1 { rint1 == 10;}
> > > endclass
> > >
> > > class class2;
> > >   rand int rint2;
> > >   class1 ch1;
> > >   rand class1 rch1;
> > >   constraint con2 { rint2 == ch1.rint1; } // What value is
> > > rint2 set to?
> > > endclass
> > >
> > > class2 ch2 = new;
> > > int res;
> > >
> > > initial begin
> > >   ch2.ch1 = new;
> > >   ch2.rch1 = ch2.ch1;  // The same object
> > >
> > >   ch2.ch1.rint1 = 20;
> > >
> > >   res = ch2.randomize();
> > >
> > >   if (ch2.rint2 == 20) $display("ch2.ch1 is considered non-rand");
> > >   if (ch2.rint2 == 10) $display("ch2.ch1 is considered rand"); end
> > > endmodule
> > >
> > >
> > >
> >
> >
Received on Sat Sep 30 16:10:19 2006

This archive was generated by hypermail 2.1.8 : Sat Sep 30 2006 - 16:10:45 PDT