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

From: Surya Pratik Saha <spsaha@cal.interrasystems.com>
Date: Wed Mar 31 2010 - 21:11:02 PDT
Hi Dave,
I could not find anything in "6.20.6" where it allows const declaration without initialization. Please let me know if there is any LRM specification.

Also, it is not clear what is the value of using a const declared variable which does not have initialization, will it take default value (like for 4 state, it will be all 'x', and for 2 state it will be all '0')?

And if 'global constant' can be declared without initialization, then I think some rewriting is required in "8.18 Constant class properties", otherwise it is very confusing.
Regards
Surya


-------- Original Message  --------
Subject: [sv-bc] RE: [sv-ec] Is instance constant allowed outside class?
From: Rich, Dave <Dave_Rich@mentor.com>
To: Surya Pratik Saha <spsaha@cal.interrasystems.com>, sv-ec@eda.org, sv-bc@eda.org
Cc: "Bijoy Gopal Nandy" <bijoy@cal.interrasystems.com>
Date: Wednesday, March 31, 2010 8:21:05 PM
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 21:12:19 2010

This archive was generated by hypermail 2.1.8 : Wed Mar 31 2010 - 21:12:27 PDT