Re: [sv-bc] Can enum base type be struct or multidim array?

From: Paul Graham <pgraham@oasys-ds.com>
Date: Tue Mar 09 2010 - 06:42:04 PST

Shalom,

No, you didn't miss anything -- I did. Thanks for the reply.

I have to say, the names "integer_atom_type" and "integer_vector_type" are a bit confusing. I understand that integer_atom_type is an "atomic" integer type. Yet integer_atom_type is a vector of bits, while integer_vector_type is a single bit, not a vector.

Paul
----- Original Message -----
From: "Shalom Bresticker" <shalom.bresticker@intel.com>
To: "Paul Graham" <pgraham@oasys-ds.com>, "sv-bc" <sv-bc@eda.org>
Sent: Tuesday, March 9, 2010 9:36:03 AM
Subject: RE: [sv-bc] Can enum base type be struct or multidim array?

Paul,

This is the BNF:

enum_base_type ::=
        integer_atom_type [ signing ]
   | integer_vector_type [ signing ] [ packed_dimension ]
   | type_identifier [ packed_dimension ] 14

14) A type_identifier shall be legal as an enum_base_type if it denotes an integer_atom_type, with which an additional
packed dimension is not permitted, or an integer_vector_type.

integer_atom_type ::= byte | shortint | int | longint | integer | time
integer_vector_type ::= bit | logic | reg

So I don't see that the types you mention are legal.

Did I miss something?

Regards,
Shalom

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On
> Behalf Of Paul Graham
> Sent: Tuesday, March 09, 2010 4:28 PM
> To: sv-bc
> Subject: [sv-bc] Can enum base type be struct or multidim array?
>
> It appears that an enum type can be declared with a base type
> which is a packed struct or multidimensional array. That is,
> I don't see any rule prohibiting the following:
>
> typedef struct packed {logic f1, f2, f3;} t1;
> enum t1 {red, blue, green} color1;
>
> typedef logic [1:0][1:0] t2;
> enum t2 {orange, yellow, violet} color2;
>
> If this is legal, then is it legal to access an enum value as
> if it were of the base type? Can
> you do:
>
> logic x = color1.f1;
> logic y = color2[1][0];
>
> Paul
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Mar 9 06:42:13 2010

This archive was generated by hypermail 2.1.8 : Tue Mar 09 2010 - 06:42:17 PST