diff --git a/PWire.cc b/PWire.cc index 524f18b44..e2dc5570e 100644 --- a/PWire.cc +++ b/PWire.cc @@ -29,7 +29,7 @@ PWire::PWire(perm_string n, : name_(n), type_(t), port_type_(pt), data_type_(dt), signed_(false), isint_(false), port_set_(false), net_set_(false), is_scalar_(false), - error_cnt_(0), set_data_type_(0), + error_cnt_(0), uarray_type_(0), set_data_type_(0), discipline_(0) { if (t == NetNet::INTEGER) { diff --git a/PWire.h b/PWire.h index a588797f8..b93338b12 100644 --- a/PWire.h +++ b/PWire.h @@ -80,6 +80,7 @@ class PWire : public PNamedItem { void set_range(const std::list&ranges, PWSRType type); void set_unpacked_idx(const std::list&ranges); + void set_uarray_type(uarray_type_t*type) { uarray_type_ = type; } void set_data_type(data_type_t*type); @@ -119,6 +120,7 @@ class PWire : public PNamedItem { // If this wire is actually a memory, these indices will give // me the size and address ranges of the memory. std::listunpacked_; + uarray_type_t*uarray_type_; // This is the complex type of the wire. the data_type_ may // modify how this is interpreted. diff --git a/pform.cc b/pform.cc index 18b391f50..0632729ec 100644 --- a/pform.cc +++ b/pform.cc @@ -3474,7 +3474,6 @@ template static void pform_set2_data_type(const struct vlltype&li, T*d PWire*net = pform_get_make_wire_in_scope(li, name, net_type, NetNet::NOT_A_PORT, base_type); assert(net); - net->set_data_type(data_type); pform_bind_attributes(net->attributes, attr, true); } @@ -3498,7 +3497,6 @@ static void pform_set_enum(const struct vlltype&li, enum_type_t*enum_type, assert(enum_type->range.get() != 0); assert(enum_type->range->size() == 1); //XXXXcur->set_range(*enum_type->range, SR_NET); - cur->set_data_type(enum_type); // If this is an integer enumeration switch the wire to an integer. if (enum_type->integer_flag) { bool res = cur->set_wire_type(NetNet::INTEGER); @@ -3540,17 +3538,14 @@ static void pform_set_enum(const struct vlltype&li, enum_type_t*enum_type, */ void pform_set_data_type(const struct vlltype&li, data_type_t*data_type, list*names, NetNet::Type net_type, list*attr) { - const std::list*unpacked_dims = NULL; - if (data_type == 0) { VLerror(li, "internal error: data_type==0."); assert(0); } - if(uarray_type_t*uarray_type = dynamic_cast (data_type)) { - unpacked_dims = uarray_type->dims.get(); + uarray_type_t*uarray_type = dynamic_cast (data_type); + if (uarray_type) data_type = uarray_type->base_type; - } if (atom2_type_t*atom2_type = dynamic_cast (data_type)) { pform_set_integer_2atom(li, atom2_type->type_code, atom2_type->signed_flag, names, net_type, attr); @@ -3593,12 +3588,14 @@ void pform_set_data_type(const struct vlltype&li, data_type_t*data_type, list::iterator cur = names->begin() - ; cur != names->end() ; ++ cur ) { - PWire*wire = pform_get_wire_in_scope(*cur); - wire->set_unpacked_idx(*unpacked_dims); + for (list::iterator cur = names->begin() + ; cur != names->end() ; ++ cur ) { + PWire*wire = pform_get_wire_in_scope(*cur); + if (uarray_type) { + wire->set_unpacked_idx(*uarray_type->dims.get()); + wire->set_uarray_type(uarray_type); } + wire->set_data_type(data_type); } delete names; diff --git a/pform_class_type.cc b/pform_class_type.cc index 9c1b7354e..84b78a83c 100644 --- a/pform_class_type.cc +++ b/pform_class_type.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014 Picture Elements, Inc. + * Copyright (c) 2012-2019 Picture Elements, Inc. * Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -22,11 +22,10 @@ # include "parse_misc.h" # include "ivl_assert.h" -static void pform_set_class_type(const struct vlltype&li, class_type_t*class_type, perm_string name, NetNet::Type net_type, list*attr) +static void pform_set_class_type(const struct vlltype&li, class_type_t*, perm_string name, NetNet::Type net_type, list*attr) { PWire*net = pform_get_make_wire_in_scope(li, name, net_type, NetNet::NOT_A_PORT, IVL_VT_CLASS); assert(net); - net->set_data_type(class_type); pform_bind_attributes(net->attributes, attr, true); } diff --git a/pform_struct_type.cc b/pform_struct_type.cc index d4ef9e7c9..4dcf4886f 100644 --- a/pform_struct_type.cc +++ b/pform_struct_type.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2011-2019 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -68,7 +68,6 @@ static void pform_set_packed_struct(const struct vlltype&li, struct_type_t*struc PWire*net = pform_get_make_wire_in_scope(li, name, net_type, NetNet::NOT_A_PORT, base_type); assert(net); - net->set_data_type(struct_type); pform_bind_attributes(net->attributes, attr, true); }