RE: [sv-bc] Query regarding constant class property

From: Rich, Dave <Dave_Rich_at_.....>
Date: Tue Dec 30 2008 - 10:48:46 PST
"static" is a very overloaded term, especially around classes. Here are
some notes on this topic:

A typedef is not a variable and has no lifetime in the sense of static
versus automatic variables. We talk about "Statically typed" versus
"dynamically typed" when referring to class inheritance hierarchy and
virtual methods, which are dynamically typed. All other types in SV are
statically typed.

By statically typed, I mean that the elaboration process (or code
generation process) has fixed the meaning of an identifier before
execution begins. A dynamically typed thing usually means some form of
lookup needs to occur during execution.

A static class property is just like a static variable - it has the
lifetime of the entire execution of the simulation. A non-static class
property is dynamically allocated. It is not like an automatic variable
that implicitly allocates by procedurally entering a procedural block
where the variable is declared. Instead, it is allocated by explicitly
calling the class constructor.

A static method of a class is used when the implicit "this" handle to
class object is unavailable or irrelevant to the purpose of that method.
Without a handle to a class object, a static method can only access
other static methods or properties of that class.

The enum labels of an enumerated type behave very much like Verilog
parameters, which are also "static". So there is no restriction that
would disallow accessing an enum label from a static method.

Happy New Year,

Dave





> -----Original Message-----
> From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org]
On
> Behalf Of Bresticker, Shalom
> Sent: Tuesday, December 30, 2008 4:38 AM
> To: Ishita Ghosh; sv-bc@eda.org
> Cc: sv-ec@server.eda.org
> Subject: RE: [sv-bc] Query regarding constant class property
> 
> The enum *variable* is not static, the enum type values *are*.
> jan, feb, and mar are static, but month is not.
> 
> Shalom
> 
> > -----Original Message-----
> > From: Ishita Ghosh [mailto:ighosh@cal.interrasystems.com]
> > Sent: Tuesday, December 30, 2008 1:40 PM
> > To: Bresticker, Shalom; sv-bc@eda.org
> > Subject: Re: [sv-bc] Query regarding constant class property
> >
> >
> >  According to LRM 1800-2005 Sec 7.9
> > "Access to nonstatic members or to the special this handle
> > within the body of a static method is illegal"
> >
> > So, if the use of enum element in a static method, as in the
> > given testcase, is allowed then it implies that the enum
> > variable though explicitly not declared as 'static'
> > is being implicitly considered as 'static'. Correct me if I am
wrong.
> >
> > Regards,
> > Ishita
> >
> > Bresticker, Shalom wrote:
> >
> > >Why not?
> > >
> > >Shalom
> > >
> > >
> > >
> > >>-----Original Message-----
> > >>From: Ishita Ghosh [mailto:ighosh@cal.interrasystems.com]
> > >>Sent: Tuesday, December 30, 2008 12:07 PM
> > >>To: Bresticker, Shalom; sv-bc@eda.org
> > >>Subject: Re: [sv-bc] Query regarding constant class property
> > >>
> > >>Is the use of enum element legal in a static method of a class?
> > >>
> > >>Rgards,
> > >>Ishita
> > >>
> > >>Bresticker, Shalom wrote:
> > >>
> > >>
> > >>
> > >>>What is the problem?
> > >>>
> > >>>Shalom
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>>-----Original Message-----
> > >>>>From: owner-sv-bc@server.eda.org
> > >>>>[mailto:owner-sv-bc@server.eda.org] On Behalf Of Ishita Ghosh
> > >>>>Sent: Tuesday, December 30, 2008 11:25 AM
> > >>>>To: sv-bc@server.eda.org
> > >>>>Subject: RE: [sv-bc] Query regarding constant class property
> > >>>>
> > >>>>Hi,
> > >>>>
> > >>>>   Please suggest on the behaviour of the following testcase :
> > >>>>
> > >>>>module top;
> > >>>>
> > >>>>   class C;
> > >>>>       typedef enum {jan, feb, mar} month;
> > >>>>       static int y;
> > >>>>       static function void f();
> > >>>>           y =jan;      // legal or illegal ??
> > >>>>       endfunction
> > >>>>   endclass
> > >>>>
> > >>>>   C c = new;
> > >>>>endmodule
> > >>>>
> > >>>>   The standard simulators are generating no error message.
> > >>>>
> > >>>>Thanks and Regards,
> > >>>>Ishita
> > >>>>
> > >>>>
> >
>---------------------------------------------------------------------
> > >Intel Israel (74) Limited
> > >
> > >This e-mail and any attachments may contain confidential
> > material for
> > >the sole use of the intended recipient(s). Any review or
> > distribution
> > >by others is strictly prohibited. If you are not the intended
> > >recipient, please contact the sender and delete all copies.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> 
> 
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Dec 30 10:49:50 2008

This archive was generated by hypermail 2.1.8 : Tue Dec 30 2008 - 10:52:02 PST