Support nested unpacked array types

It is currently possible to declare an unpacked array with multiple
dimensions. But trying to declare an unpacked array that has another
unpacked array as a base type will result in undefined behavior. E.g.

```
typedef int T1[1:0];
typedef T1 T2[3:0];
T2 x[7:0];
```

To support this recursively unwrap the data type and add the unpacked
dimensions to the signal until the base type no longer is a unpacked array
type.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-03-20 16:25:51 +01:00
parent bcc0730b6b
commit b19a6a7518
1 changed files with 1 additions and 1 deletions

View File

@ -1155,7 +1155,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
list<netrange_t> unpacked_dimensions;
// If this is an unpacked array extract the base type and unpacked
// dimensions as these are separate properties of the NetNet.
if (const netuarray_t *atype = dynamic_cast<const netuarray_t*>(type)) {
while (const netuarray_t *atype = dynamic_cast<const netuarray_t*>(type)) {
unpacked_dimensions.insert(unpacked_dimensions.begin(),
atype->static_dimensions().begin(),
atype->static_dimensions().end());