Re: [sv-ec] Associative array with enum index

From: Steven Sharp <sharp_at_.....>
Date: Sat Oct 21 2006 - 15:13:40 PDT
>From: "Brad Pierce" <Brad.Pierce@synopsys.com>

>If the index type of an associative array is an enumeration type, and an
>expression not equivalent to the enum type is used instead, such as
>integer, is that an error?  I hope so and that the expression would need
>to be cast.

I would assume so.  It says that indices larger or smaller than the
index type get truncated or extended, but that is the normal implicit
conversion for integral types.  There is not an implicit conversion
from an integer to an enum, so I agree that that should be an error.


>If an expression is cast to the enumeration type, but does not have a
>valid value for that enumeration type, is this treated as in 5.9.6?
>That is, return default initial value on read and do nothing on write?

That is one possible way it could be defined.  A simpler way would be
to just use the value given, and do reads and writes normally.  Your
suggestion would require an extra run-time value check before every
access to the AA.

What would be the most likely uses of an AA with an enum index?  That
might tell us what the desired behavior would be, and whether the
extra cost is justified.

Steven Sharp
sharp@cadence.com
Received on Sat Oct 21 15:13:44 2006

This archive was generated by hypermail 2.1.8 : Sat Oct 21 2006 - 15:13:50 PDT