Re: [sv-bc] Enum value question

From: Greg Jaxon <Greg.Jaxon@synopsys.com>
Date: Mon Jun 14 2004 - 18:44:14 PDT

Section 3.10.2 says:

> Any enumeration encoding value that is outside the representable range of the enum shall be an error. If any of
> the enum members are defined with a different sized constant, this shall be a syntax error.

It gives one example error: a one-bit wide enum having three tags.

Mark Hartoog wrote:
> I don't see any text in the LRM that addresses this. I would favor making
> it an error. For a signed base type, we should also define what happens when
> a positive values wraps around to a negative. Is that an error?
>
> Andy Tsay wrote:
>
>>What is the value of 'yellow' in the following example?
>>module test(output [1:0] out);
>> typedef enum bit [1:0] { red=2'b01, green=2'b11, yellow} Colors;
>> assign out = red;
>>endmodule
>>
>>The section '3.10 Enumerations' seems to say 'yellow' is assigned
>>with an automatically incremented value after 'green'.
>>Does 'yellow' get 2'b00 without error
>>or 3'b100 with error?
>>
>>Thanks,
>>Andy Tsay
>>
>
>
>
Received on Mon Jun 14 18:44:21 2004

This archive was generated by hypermail 2.1.8 : Mon Jun 14 2004 - 18:44:31 PDT