Fix base type for nested types with enum or atom2 sub-types
To determine the base type structs and packed arrays call the
figure_packed_base_type() for their sub-types.
This method is not defined for enum or atom2 types and the default
implementation returns IVL_VT_NO_TYPE.
As a result packed arrays of enum or atom2 types and packed structs with
members of enum or atom2 types get elaborated with IVL_VT_NO_TYPE
as the base type.
For example
```
struct packed {
bit signed [31:0] x;
} s1;
```
gets elaborated with a base type of IVL_VT_BOOL, while
```
struct packed {
int x;
} s2;
```
gets elaborated with a base type of IVL_VT_NONE.
To fix this define the figure_packed_base_type() for enum_type_t and
atom2_type_t.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
52925ce9ff
commit
adf64f3cc8
|
|
@ -48,6 +48,16 @@ ivl_variable_type_t vector_type_t::figure_packed_base_type(void) const
|
||||||
return base_type;
|
return base_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ivl_variable_type_t enum_type_t::figure_packed_base_type() const
|
||||||
|
{
|
||||||
|
return base_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
ivl_variable_type_t atom2_type_t::figure_packed_base_type() const
|
||||||
|
{
|
||||||
|
return IVL_VT_BOOL;
|
||||||
|
}
|
||||||
|
|
||||||
atom2_type_t size_type (32, true);
|
atom2_type_t size_type (32, true);
|
||||||
|
|
||||||
PNamedItem::SymbolType enum_type_t::symbol_type() const
|
PNamedItem::SymbolType enum_type_t::symbol_type() const
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,8 @@ struct enum_type_t : public data_type_t {
|
||||||
// Return the elaborated version of the type.
|
// Return the elaborated version of the type.
|
||||||
virtual ivl_type_s*elaborate_type_raw(Design*des, NetScope*scope) const;
|
virtual ivl_type_s*elaborate_type_raw(Design*des, NetScope*scope) const;
|
||||||
|
|
||||||
|
ivl_variable_type_t figure_packed_base_type() const;
|
||||||
|
|
||||||
SymbolType symbol_type() const;
|
SymbolType symbol_type() const;
|
||||||
|
|
||||||
ivl_variable_type_t base_type;
|
ivl_variable_type_t base_type;
|
||||||
|
|
@ -217,6 +219,8 @@ struct atom2_type_t : public data_type_t {
|
||||||
virtual std::ostream& debug_dump(std::ostream&out) const;
|
virtual std::ostream& debug_dump(std::ostream&out) const;
|
||||||
|
|
||||||
ivl_type_s* elaborate_type_raw(Design*des, NetScope*scope) const;
|
ivl_type_s* elaborate_type_raw(Design*des, NetScope*scope) const;
|
||||||
|
|
||||||
|
ivl_variable_type_t figure_packed_base_type() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern atom2_type_t size_type;
|
extern atom2_type_t size_type;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue