diff --git a/netlist.cc b/netlist.cc index f715d842c..6bbd88241 100644 --- a/netlist.cc +++ b/netlist.cc @@ -759,18 +759,14 @@ void NetNet::set_module_port_index(unsigned idx) ivl_variable_type_t NetNet::data_type() const { - if (net_type_==0) - return IVL_VT_LOGIC; - else - return net_type_->base_type(); + ivl_assert(*this, net_type_); + return net_type_->base_type(); } bool NetNet::get_signed() const { - if (net_type_==0) - return false; - else - return net_type_->get_signed(); + ivl_assert(*this, net_type_); + return net_type_->get_signed(); } bool NetNet::get_isint() const diff --git a/netlist.h b/netlist.h index 2f87bf56b..4e9586fc3 100644 --- a/netlist.h +++ b/netlist.h @@ -627,7 +627,7 @@ class NetNet : public NetObj, public PortType { // now, the unpacked type is not burried into an ivl_type_s object. explicit NetNet(NetScope*s, perm_string n, Type t, const std::list&unpacked, - ivl_type_t type =0); + ivl_type_t type); // This form builds a NetNet from its record/enum/darray // definition. They should probably be replaced with a single diff --git a/netmisc.cc b/netmisc.cc index 782f637f5..6d4ccda27 100644 --- a/netmisc.cc +++ b/netmisc.cc @@ -751,13 +751,15 @@ NetExpr* elab_and_eval(Design*des, NetScope*scope, PExpr*pe, expr_width = context_width; if (debug_elaborate) { - cerr << pe->get_fileline() << ": debug: test_width of " + cerr << pe->get_fileline() << ": elab_and_eval: test_width of " << *pe << endl; - cerr << pe->get_fileline() << ": " + cerr << pe->get_fileline() << ": : " << "returns type=" << pe->expr_type() << ", width=" << expr_width << ", signed=" << pe->has_sign() << ", mode=" << PExpr::width_mode_name(mode) << endl; + cerr << pe->get_fileline() << ": : " + << "cast_type=" << cast_type << endl; } // If we can get the same result using a smaller expression diff --git a/nettypes.h b/nettypes.h index df7779edb..4f6db4199 100644 --- a/nettypes.h +++ b/nettypes.h @@ -38,7 +38,9 @@ class ivl_type_s { virtual long packed_width(void) const; virtual std::vector slice_dimensions() const; - // Some types have a base variable type. + // Some types have a base variable type. This is the bit type + // for packed data types, or IVL_VT_DARRAY or IVL_VT_CLASS for + // those specific types. virtual ivl_variable_type_t base_type() const; virtual bool get_signed() const;