Re: multidimensional arrays and instance arrays

From: Steven Sharp (sharp@cadence.com)
Date: Mon Aug 06 2001 - 13:50:16 PDT


>So, what's the matter with the example I gave?
>
> wire x[3:0];
> wire [7:0] y[3:0];
>
> m u[3:0] (x, y);
>
>There's only one range. But it's a "word" range, not a bit range.

Oops, sorry. Didn't look at the example closely enough. It still
isn't allowed by the standard, based on the rules in 7.1.6.

They state that "the bit length of each port expression ... shall be
compared...". The identifier y is not an expression and does not have
a bit length. The terminal connections are not stated to be a pattern
to be extended by adding subscripts; they are required to be legal
expressions with bit lengths (e.g. 16'hffff would be legal, even though
it can't be indexed, while y is not legal because it isn't an expression).

It is also stated elsewhere in the 2001 standard that incomplete array
references are not legal expressions.

>Also, what happens in this case:
>
> wire [3:0] x[3:0];
> wire [3:0] y[7:0];
>
> m u[7:0] (x, y);

It isn't legal, so it doesn't mean anything. If it were made legal,
the meaning would have to be defined. I see two reasonable definitions.
Each array could be treated as a concatenation of the elements and then
that could be treated as a vector expression for connection by the existing
rules. Alternately, elements of multi-dimensional arrays could be required
to match corresponding elements of the instance array. Note that the
existing rules require that the port expression width match exactly one
instance or the entire instance array. Requiring each element in an
array connection to exactly match one instance would follow that intended
width-checking. That would make this example still be illegal, since
x does not match u.

>But since the 1995 LRM defines instance arrays, and since the 2001 LRM
>doesn't add anything to the description of the instance arrays, it's not
>clear that the LRM intends to allow instance arrays with multidimensional
>array arguments.

There were 2-dimensional arrays of regs (AKA memories) in the 1995 LRM
and there was no allowance for attaching those to instance arrays "en masse".
There are reasons why that would not have been considered reasonable. But
it could have been allowed and wasn't, so it isn't necessarily an oversight.

Steven Sharp
sharp@cadence.com



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:54:43 PDT and
sponsored by Boyd Technology, Inc.