parray_type_t: Check if base type is packed after elaboration

Packed arrays are only allowed of packed base types. Currently whether the
base type is packed is checked before elaborating the base type.

This works as long as the actual type is known before elaboration. But for
example with type parameters the actual type is only known after
elaboration. In order to be able to support type parameters move the check
for whether the type is packed after elaboration.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-03-17 10:31:33 +01:00
parent 8f78590bd2
commit d6337a5bc5
1 changed files with 2 additions and 2 deletions

View File

@ -168,7 +168,8 @@ ivl_type_t parray_type_t::elaborate_type_raw(Design*des, NetScope*scope) const
if (dims.get())
evaluate_ranges(des, scope, this, packed, *dims);
if (base_type->figure_packed_base_type() == IVL_VT_NO_TYPE) {
ivl_type_t etype = base_type->elaborate_type(des, scope);
if (!etype->packed()) {
cerr << this->get_fileline() << " error: Packed array ";
if (!name.nil())
cerr << "`" << name << "` ";
@ -180,7 +181,6 @@ ivl_type_t parray_type_t::elaborate_type_raw(Design*des, NetScope*scope) const
cerr << "` is not packed." << endl;
des->errors++;
}
ivl_type_t etype = base_type->elaborate_type(des, scope);
return new netparray_t(packed, etype);
}