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

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

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

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

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