[sv-bc] RE: [sv-ec] Is instance constant allowed outside class?

From: Rich, Dave <Dave_Rich@mentor.com>
Date: Wed Mar 31 2010 - 07:51:05 PDT

Yes, see section 6.20. There is no requirement to have an user specified
initialization.

The name global constant is a misnomer. It behaves like any other const,
which means it can take on different values each time the variable comes
into existence because the initialization expression may evaluate
differently.

The only thing special about a class instance constant is that it is
allowing a "write" to the const variable in the constructor instead of
the declaration initialization.

> -----Original Message-----
> From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Surya
> Pratik Saha
> Sent: Wednesday, March 31, 2010 7:19 AM
> To: sv-ec@eda.org; sv-bc@eda.org
> Cc: Bijoy Gopal Nandy
> Subject: [sv-ec] Is instance constant allowed outside class?
>
> Hi,
> "8.18 Constant class properties" of SV 2009 LRM defines two types of
> constants - global constant (initialization is must) and instance
> constant (initialization is missing). Is it allowed to use that
instance
> constant syntax in non-class scope? For e.g.:
> module top;
> const int x; // Is it allowed?
> endmodule
>
> OR
> module top;
> class C;
> function f;
> const int x; // Is it allowed
> endfunction
> endclass
> endmodule
>
> Some standard tools pass both the cases. Also OVM 2.1.1 has 2nd type
of
> syntax usage in its source. Please let me know.
>
> --
> Regards
> Surya
>
>
>
>
> --
> 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 Wed Mar 31 07:52:03 2010

This archive was generated by hypermail 2.1.8 : Wed Mar 31 2010 - 07:52:09 PDT