RE: [sv-bc] proposal regarding enumeration types


Subject: RE: [sv-bc] proposal regarding enumeration types
From: Maidment, Matthew R (matthew.r.maidment@intel.com)
Date: Wed Jan 07 2004 - 11:19:07 PST


Hi Brad.

Agree with both you and Mark regarding the signed/unsigned comment.
To answer your first question, in practice this is needed in order
to better facilitate convenient control of 2-value/4-value simulation.

The ideal situation is to typedef the integer types into custom typedefs

such as:

`ifdef 2VALUE
typedef bit net;
typedef int int32;
`else
typedef logic net;
typedef integer int32;
`endif

And use these as the basis for all other type declarations:

net [3:0] myvar;
typedef net [5:0] myvec;
typedef enum net [1:0] {A,B,C,D} myenum;

If enums are excluded then a second mechanism for controlling
the simulation value is required:

`ifdef 2VALUE
typedef bit net;
`define NET bit
typedef int int32;
`else
typedef logic net;
`define NET logic
typedef integer int32;
`endif

typedef enum `NET [1:0] {A,B,C,D} myenum;
enum `NET [1:0] {W,X,Y,Z} enumvar;

or worse

`ifdef 2VALUE
enum bit [1:0] {W,X,Y,Z} enumvar;
`else
enum logic [1:0] {W,X,Y,Z} enumvar;
`endif

Makes for a very lumpy methodology when enums are excluded from all
other types and require this exception.

Regaring your second question, I do not agree that a type identifier
must be limited to an integer_atom_type. It should include vector
types. How about something like...

enum_base_type ::=
integer_atom_type [ signing ]
| integer_vector_type [ signing ] [ packed_dimension ]
| type_identifier {[packed_dimension]} 23

23) A type_identifier shall be legal as an enum_base_type if it denotes
an integer_atom_type, with which additional packed dimensions are not
permitted, or an integer_vector_type.

or this...

enum_base_type ::=
integer_atom_type [ signing ]
| integer_vector_type [ signing ] [ packed_dimension ]
| type_identifier 23
| type_identifier {[packed_dimension]} 24

23) A type_identifier in this context shall be legal as an
enum_base_type
if it denotes an integer_atom_type
24) A type identifier in this context shall be legal as an
enum_base_type
if it denotes an integer_vector_type.

I'm no BNF expert, just trying to be constructive.

Matt

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On
> Behalf Of Brad Pierce
> Sent: Wednesday, January 07, 2004 9:33 AM
> To: sv-bc@eda.org
> Subject: Re: [sv-bc] proposal regarding enumeration types
>
>
> Dan and Matt,
>
> I don't think that type_identifiers can be qualified with
> signed/unsigned. Also, it seems rare that that one would
> wish to typedef bit/logic/reg, which are the only types
> for which a packed dimension could be used in an enum
> base type. For that matter, it seems rare that one would
> even with to typedef one of the integer atom types for
> use as an enum base type.
>
> So, two questions --
>
> 1) Is this capability really needed in practice?
>
> 2) If so, how about the following?
>
> | type_identifier 23
>
> 23) A type_identifier shall be legal as an enum_base_type
> only if it denotes an integer_atom_type.
>
> -- Brad
>
>
>



This archive was generated by hypermail 2b28 : Wed Jan 07 2004 - 11:20:06 PST