Chuck, *** From LRM 13.3 *** 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. *** END of LRM Part *** This allows one to declare a class that contains a struct member, and when the class "randomize()" is called, only the elements of the struct declared "rand" will be randomized. Jim, When "rand" is associated with a struct element, it does imply some extra state must be stored in the simulator for that struct. Thus the SV representation of the struct is pretty far removed from a C equivalent (due to the metadata). It's not quite as far removed as say a SV class object is from a C struct, but it's in that direction. The biggest issue I see revolves around what should happen when such a struct is passed from C to SV. e.g. as a DPI import's output arg. What should the initial values of that meta data be? Is it OK just to leave that unspecified, and allow simulator vendors to initialize it in whatever way they deem prudent? Thanks guys! Regards, Doug > -----Original Message----- > From: Chuck Berking [mailto:berking@cadence.com] > Sent: Tuesday, December 05, 2006 1:12 PM > To: Jim Vellenga; Warmke, Doug; sv-cc@eda.org > Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements > > I can't see how "rand" decls should be considered legal in structs. > In my opinion, structs are not sufficiently scope or class-like to > warrant such an extension either. I.e. would we ever want to allow > "S.randomize()" to set their values ? > -Chuck Berking > > -----Original Message----- > From: owner-sv-cc@eda.org [mailto:owner-sv-cc@eda.org] On > Behalf Of Jim > Vellenga > Sent: Tuesday, December 05, 2006 11:46 AM > To: Warmke, Doug; sv-cc@eda.org > Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements > > I don't see any reason why they couldn't be treated > in DPI just as ordinary struct members are -- i.e., > struct members without the rand and randc qualifiers. > The C side wouldn't be able to detect the qualifiers, > of course -- but then the client could always use > VPI if they need that particular info. > > To my mind, the rand and randc qualifiers simply > connect the struct members with the built-in functions > such as randomize() (and the mode setting functions). > Conceptually, one can look at randomize() as a function > that does some calculations and then sets the values > of certain data values. Since any other function > can do the same thing, I don't think that DPI should > handle these struct members any differently. > > Clarification: Does a declaration with rand and randc > qualifiers have to appear only inside a class declaration? > If so, is there any limitation on how DPI handles objects > declared inside classes? > > Regards, > Jim > > --------------------------------------------------------- > James H. Vellenga 978-262-6381 > Engineering Director (FAX) 978-262-6636 > Cadence Design Systems, Inc. vellenga@cadence.com > 270 Billerica Rd > Chelmsford, MA 01824-4179 > "We all work with partial information." > ---------------------------------------------------------- > > ]-----Original Message----- > ]From: owner-sv-cc@eda.org [mailto:owner-sv-cc@eda.org] On > ]Behalf Of Warmke, Doug > ]Sent: Wednesday, November 29, 2006 2:47 PM > ]To: sv-cc@eda.org > ]Subject: [sv-cc] Question on "rand" qualifer on struct elements > ] > ]Hello SV-CC, > ] > ]I have a nice DPI question for everyone to ponder. > ] > ]In SV, it is possible to declare struct elements > ]as "rand" or "randc": > ] > ]struct { > ] int I; > ] rand int J; > ] randc int K; > ]} S; > ] > ]Should structs with these element datatype qualifiers > ]be allowed as DPI arguments? > ] > ]Are there any other similar qualifiers we should watch > ]out for? > ] > ]Thanks, > ]Doug > ] > ] > >Received on Wed Dec 6 08:24:05 2006
This archive was generated by hypermail 2.1.8 : Wed Dec 06 2006 - 08:24:13 PST