Record the actual data type when a module port has an enum type.
This fixes assignment compatibility problems (issue #498).
(cherry picked from commit cf0bf4d9aa)
This commit is contained in:
parent
ada3067899
commit
0bd51dbfb8
8
pform.cc
8
pform.cc
|
|
@ -2535,6 +2535,7 @@ void pform_module_define_port(const struct vlltype&li,
|
|||
bool keep_attr)
|
||||
{
|
||||
struct_type_t*struct_type = 0;
|
||||
enum_type_t*enum_type = 0;
|
||||
ivl_variable_type_t data_type = IVL_VT_NO_TYPE;
|
||||
bool signed_flag = false;
|
||||
|
||||
|
|
@ -2587,10 +2588,10 @@ void pform_module_define_port(const struct vlltype&li,
|
|||
signed_flag = false;
|
||||
prange = 0;
|
||||
|
||||
} else if (enum_type_t*enum_type = dynamic_cast<enum_type_t*>(vtype)) {
|
||||
} else if ((enum_type = dynamic_cast<enum_type_t*>(vtype))) {
|
||||
data_type = enum_type->base_type;
|
||||
signed_flag = enum_type->signed_flag;
|
||||
prange = enum_type->range.get();
|
||||
prange = 0;
|
||||
|
||||
} else if (vtype) {
|
||||
VLerror(li, "sorry: Given type %s not supported here (%s:%d).",
|
||||
|
|
@ -2610,6 +2611,9 @@ void pform_module_define_port(const struct vlltype&li,
|
|||
if (struct_type) {
|
||||
cur->set_data_type(struct_type);
|
||||
|
||||
} else if (enum_type) {
|
||||
cur->set_data_type(enum_type);
|
||||
|
||||
} else if (prange == 0) {
|
||||
cur->set_range_scalar((type == NetNet::IMPLICIT) ? SR_PORT : SR_BOTH);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue