Subject: Re: Enumerated Types Proposals
From: Peter Flake (flake@co-design.com)
Date: Mon Apr 08 2002 - 04:05:45 PDT
Peter Flake wrote:
Cliff,What values get assigned if a value (or part of it) is not specified?
We have considered your proposals, and we have a counter-proposal which we think should satisfy your requirements.
We propose an optional data type with the enum. The default data type is int
enum [data_type] { enum_member {, enum_member} }
The data type is limited to integer data types, 2 state or 4 state. The 4 state data types can have constant values containing X or Z.
For example:
enum logic [1:0] { S0=2'b00, S1=2'b01, S2=2'b11, XX='x } state, next;
Peter.
Maybe want a default:
enum [data_type] [ = <default value>] { enum_member {, enum_member} }
e.g.:
enum logic [1:0] = 2'b00 { S0=1'b0, S1=1'b1, S2=2'b11, XX=2'bxx } state, next;
which extends as:
enum logic [2:0] = 3'b100 { S0=1'b0, S1=1'b1, S2=2'b11, XX=2'bxx, BAD } state, next;
// BAD takes default ==3'b100
Note: since enums in C always allocate specific numbers (regardless of the compiler)
mixing code from different compilers does not cause a problem (wrt enums). The
same should (IMO) be true for SystemVerilog enums.
Kev.
This archive was generated by hypermail 2b28 : Mon Apr 08 2002 - 06:50:17 PDT