RE: [sv-bc] Queries regarding packed dimension for enum type

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Tue Feb 24 2009 - 22:13:21 PST
Hi,

typedef enum bit [1:0] {VIOLET, INDIGO, BLUE, GREEN, YELLOW, ORANGE, RED} [1:0] eType;

Will this be correct? For this case what will be the base type width of the enum type - 4 or 2.

[SB] This declares eType as a packed array of 2 elements, 1 and 0, where each element is an enum type. It would be the same as

typedef enum bit [1:0] {VIOLET, INDIGO, BLUE, GREEN, YELLOW, ORANGE, RED} eType_element;
typedef eType_element [1:0] eType;
As such, the base type width of the enum has only 2 bits and this specifies too many values.
The base type of the enum can have only 1 packed dimension, and it is specified before the list of enum values.

 -- What will be the processing order of indexes for bit/part select case on enum?

Lets consider the following example ::

typedef enum bit [1:0] {VIOLET, INDIGO, BLUE} [3:0] eType;
                                ^                                                   ^
                                a                                                    b

eType [5:0] var [7:0];
            ^           ^
             c          d

For an expression like var[i][j][k][l] in which order the dimensions will be processed ?Will it be (d -> c -> b -> a) or something different.

[SB] Yes, it would be d,c,b,a.

-- For the above example are both the following statements correct ?
   assign var[0][0][0][0] = BLUE;
[SB]  This is not correct, as the last index selects a single bit of the enum, not an entire enum value.
[SB] Mantis 1483 is open on clarifying whether it is legal to do an assignment to a bit/part-select of an enum variable.
   assign var[0][0][0] = BLUE;
[SB] This is correct.

Regards,
Shalom
---------------------------------------------------------------------
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 Feb 24 22:15:49 2009

This archive was generated by hypermail 2.1.8 : Tue Feb 24 2009 - 22:16:28 PST