RE: [sv-bc] proposal regarding enumeration types - update


Subject: RE: [sv-bc] proposal regarding enumeration types - update
From: Jacobi, Dan (dan.jacobi@intel.com)
Date: Thu Jan 08 2004 - 05:52:01 PST


Hello All,

Attached is an updated proposal, after adding brads segestions

 

 

Motivation

=======

Due to the following BNF from A.2.2.1 Net and variable types

data_type_common_item ::=

...

| enum [ enum_base_type ] { enum_name_declaration { ,
enum_name_declaration } }

...

 

enum_base_type ::=

integer_atom_type [ signing ]

| integer_vector_type [ signing ] [ packed_dimension ]

 

The following RTL is considered legal

typedef enum logic [1:0] {a,b,c,d} myenumtype1;

typedef enum bit {on,off} myenumtype2;

 

However the following RTL should yield on a syntax error

  typedef logic[1:0] logicarray;

  typedef enum logicarray {a,b,c,d} myenumtype1;

 

  typedef bit mybit;

  typedef enum mybit {on,off} myenumtype2;

 

typedef bit mybit;

typedef enum mybit [1:0] {on,off} myenumtype3;

 

 

Proposal

=======

Under Section A.2.2.1 Net and variable types

REPLACE

enum_base_type ::=

integer_atom_type [ signing ]

| integer_vector_type [ signing ] [ packed_dimension ]

WITH (adding the last rule)

            enum_base_type ::=

integer_atom_type [ signing ]

| integer_vector_type [ signing ] [ packed_dimension ]

| type_identifier [ packed_dimension ] 23

 

(23 is in superscript indicating a foot note index)

 

Under Appendix A in the note section

ADD the corresponding foot note

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.

 

 

Please note that Brad's donation enabled MULTIPLE packed dimensions for
typedef type enumerations and this propsal doesn't (due to the fact that
the previous integer vector type didn't permit in either). However if
desired, I would be happy to adjust the proposal to enable multiple
packed dimensions for typedef AND integer-vector types as well.

 

Dan Jacobi, Intel Corporation

Tel : +(972)-4-8655855

 

 

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Maidment, Matthew R
Sent: Wednesday, January 07, 2004 9:19 PM
To: Brad.Pierce@synopsys.com; sv-bc@eda.org
Cc: mark.hartoog@synopsys.com
Subject: RE: [sv-bc] proposal regarding enumeration types

 

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 : Thu Jan 08 2004 - 05:53:14 PST