Subject: Re: [sv-bc] Are enum identifiers elaboration time constants
From: Francoise Martinolle (fm@cadence.com)
Date: Fri Oct 31 2003 - 10:01:53 PST
I think that enumeration constants should be elaboration time constants.
At 09:35 AM 10/31/2003 -0800, Mark Hartoog wrote:
>Section 3.10 says "An enumerated type declares a set of
>integral named constants". At the end of the first paragraph
>in section 3.10.3 it says "The enumeration values can still
>be used as constants in expressions, and the results can
>be assigned to any variable of a compatible integral type."
>
>My question is are these elaboration time constants or run
>time constants?
>
>Section 5.3 on constants does not discuss enum identifiers. It
>says parameters, local parameters, spec parameters, genvars and
>constant functions of these are elaboration time constants, while
>'const' variables are run time constants.
>
>In the BNF section A.8.4 there is the rule constant_primary, which
>does not include enum identifiers. (It does include parameter,
>specparm and genvar identifiers). I believe this rule is suppose
>to describe elaboration time constants.
>
>This appears to indicate that enum identifiers are not elaboration
>time constants. However, note that if they are not elaboration
>time constants, then the following is illegal:
>
>typedef enum {false, true} bool;
>
>module m #(parameter bool P = false) ();
>endmodule
>
>module top();
>m #(true) u1();
>endmodule
>
>The value of a parameter must be an elaboration time constant. You would
>have to write this as:
>
>typedef enum {false, true} bool;
>
>module m #(parameter bool P = bool'(0)) ();
>endmodule
>
>module top();
>m #(bool'(1)) u1();
>endmodule
>
>This defeats the purpose of having parameters of type enum.
>
>I feel that enum identifiers should be elaboration time constants,
>and the LRM should be updated to indicate this. Section 5.3 will need some
>changes, and enum identifiers need to be added to the constant_primary.
>
>Mark Hartoog
>700 E. Middlefield Road
>Mountain View, CA 94043
>650 584-5404
>markh@synopsys.com
This archive was generated by hypermail 2b28 : Fri Oct 31 2003 - 10:05:13 PST