Associative array declaration

Is it valid to declare an associative array with index bit[5:0] ?

trans aa[bit[5:0]];

Thanks.

In reply to UVM_learner6:

Looks like the LRM is a bit murky on that one. It states:

7.8.4 Integral index

For example:
  int array_name1 [ integer ];
  typedef bit signed [4:1] SNibble;
  int array_name2 [ SNibble ];
  typedef bit [4:1] UNibble;
  int array_name3 [ UNibble ];

So it looks like


typedef bit [5:0] my_type;
trans aa[my_type]; 

is legal.

But is your example illegal? I don’t think the LRM says yes or no for that one.

In reply to sbellock:

The LRM says the index “can be of any type”, and the BNF allows [data_type] as part of the syntax. data_type allows any type syntax except for unpacked arrays. You would need a typedef name to index an associative array with an unpacked array type. The same restriction exists for function return types.