Record the actual data type when a module port has an enum type.
This fixes assignment compatibility problems (issue #498).
This commit is contained in:
parent
a7cb93842e
commit
cf0bf4d9aa
8
pform.cc
8
pform.cc
|
|
@ -2571,6 +2571,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;
|
||||
|
||||
|
|
@ -2623,10 +2624,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).",
|
||||
|
|
@ -2646,6 +2647,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