Subject: [sv-bc] Are const unpacked arrays allowed?
From: Mark Hartoog (Mark.Hartoog@synopsys.com)
Date: Wed Oct 29 2003 - 23:48:01 PST
I thought they were, then someone pointed out to me that the
BNF does not allow const unpacked arrays.
constant_declaration ::= const data_type const_assignment ;
const_assignment ::= const_identifier = constant_expression
const_identifier ::= identifier
There are no unpacked dimensions allowed in these rules.
Actually, you can slip an unpacked array in with something like:
typedef logic [7:0] mylogic [0:3];
const mylogic x = {0,0,0,0};
This leads me to believe this was an oversight in the BNF.
Note that this BNF does not allow multiple const variable decls
like:
const int x =1, y =2;
It also does not allow lifetimes on const variables, which means you
cannot declare a static const variable in a automatic task or function.
In section 5.3 on constants, it says:
<quote>
An instance of a class (an object handle) can also be declared with the
const keyword.
const class_name object = new(5,3);
<quote>
Here 'new(5,3)' would not usually be considered a constant_expression.
I think the BNF for constant_declaration should be reworked along the
lines of the variable_declaration.
Mark Hartoog
700 E. Middlefield Road
Mountain View, CA 94043
650 584-5404
markh@synopsys.com
This archive was generated by hypermail 2b28 : Wed Oct 29 2003 - 23:51:53 PST