Use non-array `NetNet` constructor where appropriate

There are two `NetNet` constructors, one for arrays and one for non-arrays.
There are a few places where the array constructor is used for non-arrays,
but with an empty unpacked dimensions list. Switch this over to using the
non-array constructor.

This slightly reduces boiler-plate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-04-27 10:48:13 +02:00
parent bdbe74252c
commit d6d95c7c49
4 changed files with 8 additions and 14 deletions

View File

@ -403,9 +403,8 @@ void netclass_t::elaborate_sig(Design*des, PClass*pclass)
<< "." << endl;
}
list<netrange_t> nil_list;
/* NetNet*sig = */ new NetNet(class_scope_, cur->first, NetNet::REG,
nil_list, use_type);
use_type);
}
for (map<perm_string,PFunction*>::iterator cur = pclass->funcs.begin()
@ -672,8 +671,7 @@ void PFunction::elaborate_sig(Design*des, NetScope*scope) const
if (return_type_)
return_type_->pform_dump(cerr, 8);
}
list<netrange_t> ret_unpacked;
ret_sig = new NetNet(scope, fname, NetNet::REG, ret_unpacked, ret_type);
ret_sig = new NetNet(scope, fname, NetNet::REG, ret_type);
ret_sig->set_line(*this);
ret_sig->port_type(NetNet::POUTPUT);

View File

@ -563,8 +563,6 @@ void NetNet::calculate_slice_widths_from_packed_dims_(void)
}
}
const list<netrange_t> NetNet::not_an_array;
NetNet::NetNet(NetScope*s, perm_string n, Type t,
const list<netrange_t>&unpacked, ivl_type_t use_net_type)
: NetObj(s, n, calculate_count(unpacked)),

View File

@ -673,8 +673,6 @@ class NetNet : public NetObj, public PortType {
typedef PortType::Enum PortType;
static const std::list<netrange_t>not_an_array;
public:
// This form is the more generic form of the constructor. For
// now, the unpacked type is not buried into an ivl_type_s object.

View File

@ -431,7 +431,7 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope,
netvector_t*tmp_type = new netvector_t(tmp_data_type, lsig_width-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, NetNet::not_an_array, tmp_type);
NetNet::WIRE, tmp_type);
tmp->local_flag(true);
tmp->set_line(*this);
@ -465,7 +465,7 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope,
netvector_t*tmp_type = new netvector_t(tmp_data_type, lsig_width-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, NetNet::not_an_array, tmp_type);
NetNet::WIRE, tmp_type);
tmp->local_flag(true);
tmp->set_line(*this);
@ -482,7 +482,7 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope,
<< " Found no isig, resorting to lsig." << endl;
}
isig = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, NetNet::not_an_array, tmp_type);
NetNet::WIRE, tmp_type);
isig->local_flag(true);
isig->set_line(*this);
connect(isig->pin(0), nex_out.pin(ptr));
@ -1397,7 +1397,7 @@ bool NetCondit::synth_async(Design*des, NetScope*scope,
// Bind some temporary signals to carry pin type.
NetNet*otmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, NetNet::not_an_array, tmp_type);
NetNet::WIRE, tmp_type);
otmp->local_flag(true);
otmp->set_line(*this);
connect(mux->pin_Result(),otmp->pin(0));
@ -1415,14 +1415,14 @@ bool NetCondit::synth_async(Design*des, NetScope*scope,
NetNet*itmp = statement_input.pin(idx).nexus()->pick_any_net();
if (itmp == 0) {
itmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, NetNet::not_an_array, tmp_type);
NetNet::WIRE, tmp_type);
itmp->local_flag(true);
itmp->set_line(*this);
connect(itmp->pin(0), statement_input.pin(idx));
}
NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, NetNet::not_an_array, tmp_type);
NetNet::WIRE, tmp_type);
tmp->local_flag(true);
tmp->set_line(*this);
NetSubstitute*ps = new NetSubstitute(itmp, otmp, mux_lwidth, mux_off);