RE: [sv-cc] Question on "rand" qualifer on struct elements

From: Chuck Berking <berking_at_.....>
Date: Fri Dec 08 2006 - 09:01:38 PST
Thanks Doug- I did get your last one too.  I had not seen this
before, but in context of 13.3 it makes good sense.  As Dave
mentioned, it would be good to clarify somewhere that rand/randc
is tolerated (ignored) *outside* of class declarations, assuming
this is truly intended.
-CB

-----Original Message-----
From: Warmke, Doug [mailto:doug_warmke@mentor.com] 
Sent: Friday, December 08, 2006 12:53 AM
To: Chuck Berking; Bresticker, Shalom; Rich, Dave; sv-cc@eda.org
Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements

Guys,

You might not have seen my post to SV-CC the other day
that quotes the exact LRM text that permits this in 13.3:

    http://www.eda-stds.org/sv-cc/hm/3133.html

Here it is, repeated again:

   An unpacked structure can be declared rand, in which case all of that
   structure's random members are solved concurrently using one of the
   rules listed in this subclause. Unpacked structures shall not be
   declared randc. A member of a unpacked structure can be made random
   by having a rand or randc modifier in the declaration of its type.
   Members of unpacked structures containing a union as well as members
   of packed structures shall not be allowed to have a random modifier. 

The third sentence clearly allows members of structs to be declared with
the rand or randc modifiers.

Regards,
Doug

> -----Original Message-----
> From: owner-sv-cc@server.eda.org 
> [mailto:owner-sv-cc@server.eda.org] On Behalf Of Chuck Berking
> Sent: Wednesday, December 06, 2006 7:15 AM
> To: Bresticker, Shalom; Rich, Dave; sv-cc@server.eda.org
> Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements
> 
> I agree completely.  There are many cases of "BNF-legal"
> constructs which are specifically disallowed semantically,
> which I believe should apply to this case.
> -Chuck
> 
> -----Original Message-----
> From: owner-sv-cc@eda.org [mailto:owner-sv-cc@eda.org] On Behalf Of
> Bresticker, Shalom
> Sent: Wednesday, December 06, 2006 7:40 AM
> To: Rich, Dave; sv-cc@eda.org
> Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements
> 
> Dave,
> 
> This is not at all clear.
> 
> It is true that the BNF allows declaring any struct member as rand.
> 
> However, many restrictions are expressed in the text of the 
> LRM and not
> in the BNF.
> 
> The text of the LRM certainly seems to imply that rand 
> declarations are
> only allowed within classes.
> 
> (One could say that typedefs are not really a question, because they
> only define types, not actual variables.)
> 
> I did not see anywhere in the LRM that the following is permitted:
> 
> > typedef struct { rand int A;} A_t;
> > 
> > A_t Av; // a regular struct;
> 
> or that  a rand qualifier outside of a class is just ignored.
> Did I miss some text?
> 
> Unless there is some explicit text that I missed, I think a
> clarification in the LRM is called for.
> 
> It would seem strange if I could write outside a class
> 
> struct ( rand int b; } cucu ;
> 
> but not 
> 
> rand int b;
> 
> 
> Thanks,
> Shalom
> 
>  
> > -----Original Message-----
> > From: owner-sv-cc@server.eda.org [mailto:owner-sv-cc@server.eda.org]
> On
> > Behalf Of Rich, Dave
> > Sent: Wednesday, December 06, 2006 12:09 AM
> > To: Bresticker, Shalom; Jim Vellenga; sv-cc@server.eda.org
> > Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements
> > 
> > No that's not correct. The BNF allows you to declare rand 
> or randc on
> a
> > member of any struct or typedef of a struct. It's just that 
> it's only
> > treated as a random variable when declared rand as a member of a
> class.
> > That is, randomize() is a method of a class, not a method 
> of a struct.
> > 
> > typedef struct { rand int A;} A_t;
> > 
> > A_t Av; // a regular struct;
> > 
> > class C;
> > rand A_t m_A;
> > endclass
> > 
> > C C_h = new; // a class with a random variable C_h.m_A.A
> > 
> > > -----Original Message-----
> > > From: owner-sv-cc@server.eda.org 
> [mailto:owner-sv-cc@server.eda.org]
> > On
> > > Behalf Of Bresticker, Shalom
> > > Sent: Tuesday, December 05, 2006 8:52 AM
> > > To: Jim Vellenga; sv-cc@server.eda.org
> > > Subject: RE: [sv-cc] Question on "rand" qualifer on 
> struct elements
> > >
> > > Yes. See 13.3.
> > >
> > > > Clarification:  Does a declaration with rand and randc
> > > > qualifiers have to appear only inside a class declaration?
> > >
> > > Shalom
> 
> 
> 
Received on Fri Dec 8 09:01:42 2006

This archive was generated by hypermail 2.1.8 : Fri Dec 08 2006 - 09:01:55 PST