vhdlpp: Handle multidimensional arrays based on typedefs.

This commit is contained in:
Maciej Suminski 2016-02-02 17:06:43 +01:00
parent f584b4ea50
commit 78bd9a389d
1 changed files with 15 additions and 3 deletions

View File

@ -98,9 +98,21 @@ int VTypeArray::emit_with_dims_(std::ostream&out, bool packed, perm_string name)
list<const VTypeArray*> dims; list<const VTypeArray*> dims;
const VTypeArray*cur = this; const VTypeArray*cur = this;
while (const VTypeArray*sub = dynamic_cast<const VTypeArray*> (cur->element_type())) { bool added_dim = true;
dims.push_back(cur);
cur = sub; while(added_dim) {
added_dim = false;
const VType*el_type = cur->element_type();
while(const VTypeDef*tdef = dynamic_cast<const VTypeDef*>(el_type)) {
el_type = tdef->peek_definition();
}
if(const VTypeArray*sub = dynamic_cast<const VTypeArray*>(el_type)) {
dims.push_back(cur);
cur = sub;
added_dim = true;
}
} }
dims.push_back(cur); dims.push_back(cur);