Clean up some NetNet variable type handling.

This commit is contained in:
Stephen Williams 2013-09-28 18:31:22 -07:00
parent 5494c9ae09
commit 2355e1ed8e
4 changed files with 12 additions and 12 deletions

View File

@ -759,17 +759,13 @@ void NetNet::set_module_port_index(unsigned idx)
ivl_variable_type_t NetNet::data_type() const ivl_variable_type_t NetNet::data_type() const
{ {
if (net_type_==0) ivl_assert(*this, net_type_);
return IVL_VT_LOGIC;
else
return net_type_->base_type(); return net_type_->base_type();
} }
bool NetNet::get_signed() const bool NetNet::get_signed() const
{ {
if (net_type_==0) ivl_assert(*this, net_type_);
return false;
else
return net_type_->get_signed(); return net_type_->get_signed();
} }

View File

@ -627,7 +627,7 @@ class NetNet : public NetObj, public PortType {
// now, the unpacked type is not burried into an ivl_type_s object. // now, the unpacked type is not burried into an ivl_type_s object.
explicit NetNet(NetScope*s, perm_string n, Type t, explicit NetNet(NetScope*s, perm_string n, Type t,
const std::list<netrange_t>&unpacked, const std::list<netrange_t>&unpacked,
ivl_type_t type =0); ivl_type_t type);
// This form builds a NetNet from its record/enum/darray // This form builds a NetNet from its record/enum/darray
// definition. They should probably be replaced with a single // definition. They should probably be replaced with a single

View File

@ -751,13 +751,15 @@ NetExpr* elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
expr_width = context_width; expr_width = context_width;
if (debug_elaborate) { if (debug_elaborate) {
cerr << pe->get_fileline() << ": debug: test_width of " cerr << pe->get_fileline() << ": elab_and_eval: test_width of "
<< *pe << endl; << *pe << endl;
cerr << pe->get_fileline() << ": " cerr << pe->get_fileline() << ": : "
<< "returns type=" << pe->expr_type() << "returns type=" << pe->expr_type()
<< ", width=" << expr_width << ", width=" << expr_width
<< ", signed=" << pe->has_sign() << ", signed=" << pe->has_sign()
<< ", mode=" << PExpr::width_mode_name(mode) << endl; << ", 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 // If we can get the same result using a smaller expression

View File

@ -38,7 +38,9 @@ class ivl_type_s {
virtual long packed_width(void) const; virtual long packed_width(void) const;
virtual std::vector<netrange_t> slice_dimensions() const; virtual std::vector<netrange_t> 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 ivl_variable_type_t base_type() const;
virtual bool get_signed() const; virtual bool get_signed() const;