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

From: Francoise Martinolle <fm_at_.....>
Date: Mon Oct 23 2006 - 08:11:52 PDT
 The table 5.9.1 states that the default initial value for the base type
of the enum type should be
returned for a non existing array index.


-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Steven Sharp
Sent: Saturday, October 21, 2006 6:14 PM
To: sv-ec@eda.org; Brad.Pierce@synopsys.com
Subject: Re: [sv-ec] Associative array with enum index


>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 Mon Oct 23 08:11:57 2006

This archive was generated by hypermail 2.1.8 : Mon Oct 23 2006 - 08:12:08 PDT