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

From: Chuck Berking <berking_at_.....>
Date: Wed Dec 06 2006 - 08:20:25 PST
If it should effectively be a No-OP case, then maybe it
should be specifically allowed.  However I can already
think of several cases where "datatypes" as such preclude
being shared between objects, e.g. 2-state types cannot be shared
between variables and nets, and "event" types are even more
restrictive.

I recall in the past actually having to *distinguish* stuff that
applies to actual hardware vs. the stuff used to create stimulus
being applied to it :-).  
-CB

-----Original Message-----
From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: Wednesday, December 06, 2006 10:52 AM
To: Chuck Berking; Bresticker, Shalom; sv-cc@eda.org
Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements

Hi Chuck,

And this is not one of those cases because the LRM does not specifically
restrict it. It's in syntax box 4-4. and there's no rule or footnote in
the BNF that says you can't put it there if it's not in a clase, nor
should there be.

The whole point of adding rand qualifiers to structs was so that the
design and testbench could share typedefs. The rand qualifier just
doesn't do anything when used outside of a class. Perhaps that needs to
be explicitly stated.

Dave


> -----Original Message-----
> From: Chuck Berking [mailto:berking@cadence.com]
> Sent: Wednesday, December 06, 2006 7:15 AM
> To: Bresticker, Shalom; Rich, Dave; sv-cc@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 Wed Dec 6 08:20:33 2006

This archive was generated by hypermail 2.1.8 : Wed Dec 06 2006 - 08:20:38 PST