RE: [sv-bc] Data_declaration bnf

From: Steven Sharp <sharp_at_.....>
Date: Mon Aug 25 2008 - 15:54:08 PDT
Daniel,

I agree that the English terms "constant" and "variable" seem
contradictory, since constants do not vary.  But "const" and
"var" are Verilog keywords with defined meanings, not English
words.  The concept of a "const variable" was borrowed from C.

It would have been possible to define a "const" as a different
kind of object from a variable, net or parameter.  However, they
behave like a variable that cannot be assigned after initialization,
so it is simpler to make "const" a qualifier on a variable, as
in C.  A variable declaration can have the keyword "var" in it.

>There are also other issues in class property declaration:
> class C;
>  static /*class item qualifier*/ var static/*lifetime*/ int i2; //bfn
>allows that but what should static occurence of static key word mean?
>footnote needed for restriction?

Footnote 7 in A.10 of the 2005 LRM already says that "static" can appear
only once.  The BNF is presumably simpler if a semantic restriction is
used, instead of trying to restrict it in the BNF itself.

>  static const  int i1;//bfn allows this but also defines special syntax for
>declaring class const see below. Should it be legal, both syntaxes should be
>semanticallly the same?
>  const  static int i1=1;

I agree that this is strange.

I don't know why there is a special syntax for a const class property.  It
may have been intended to allow the "const" to appear before the class
property qualifiers, since the other production only allows it afterwards.
Oddly, "const" can appear after the random_qualifier, but not before.

I doubt that this BNF captures the intent properly, and implementations may
not be following it.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Aug 25 15:54:51 2008

This archive was generated by hypermail 2.1.8 : Mon Aug 25 2008 - 15:55:34 PDT