Re: Associative arrays proposal submitted


Subject: Re: Associative arrays proposal submitted
From: Stephen Bailey (stephen@srbailey.com)
Date: Fri Apr 18 2003 - 16:44:14 PDT


A couple of comments:

1. You are using unconstrained arrays as the (syntactic) basis for an associative array declaration. For arrays (constrained and unconstrained), the index subtype must be a discrete subtype. This requirement needs to be relaxed for associative arrays. At a minimum, it is necessary to support unconstrained string as an index type. It would also be desirable to support bit vector and std_[u]logic_vector (with some kind of semantics for the required ordering) as index subtypes. The ordering operations would need to be verified to ensure they cover comparison of operands of unequal length (for bit vectors, inferred 0 extension in the proper direction along with inferred unsigned intepretation).

Of course, if we provide some recognition in VHDL for bit vector and (un)signed integer equivalence, then some of the heavy lifting is handled for bit vector index subtypes.

2. Relatedly, what is needed for any associative array index type is either a known ordering operator (< or >) -- this is easy for the predefined types including bit_vector and string as these operations are predefined -- or a semantic that states the ordering is arbitrary if there's no defined ordering operator. (But the arbitrary ordering is deterministic -- repeatable -- so designs can be debugged.) This would allow multi-dimensional arrays and records as index subtypes.

3. It would be nice to provide a way to specify the ordering direction of an unconstrained scalar index type in the declaration. By default:

  type myaaT is array associative(INTEGER range <>) of BIT;

would result in an ascending ordering (to be consistent with current VHDL semantics). Users may want a descending ordering. So there could be a need for something like:

  type myaaT is array associative(INTEGER descending range <>) of BIT;

Alternatively, the ability to specify a range such as: INTEGER(Integer'Right downto Integer'Left) would suffice (see next item).

4. Does not the keyword associative imply "range <>"? Therefore, can we simplify the syntax to:

  type myaaT is array associative(NATURAL) of BIT;

If the user wants to further constrain the associative index via an anonymous index subtype, they could write:

  type myaaT is array associative(NATURAL(255 downto 0)) of BIT;

This would also be consistent with the alternative suggestion above for allowing users to change the default ordering direction. Of course, such a constraint would be legal only for discrete types.

5. To continue on the syntax simplification crusade, "associative" implies "array". Are both keywords required?

  type myaaT is associative(NATURAL) of BIT;

(We could even abbreviate associative to assoc or aarray. But that might be going too far.)

-Steve Bailey
  ----- Original Message -----
  From: Jayaram Bhasker
  To: vhdl-200x-tbv@server.eda.org
  Sent: Friday, April 18, 2003 8:34 AM
  Subject: TBV2: Associative arrays proposal submitted

  A proposal for the associative arrays (TBV2) has been submitted.
  Click "Proposals" under http://www.eda-twiki.org/vhdl-200x/vhdl-200x-tbv

  Post your feedback on the reflector.

  If you are interested in formulating a proposal for any other listed feature, send an email
  to me directly (jbhasker@esilicon.com).

  - bhasker



This archive was generated by hypermail 2b28 : Fri Apr 18 2003 - 16:37:11 PDT