Remove dead init values from NetNet and Link objects.
It turns out that although there was all kinds of code to manage these members, there were no uses anywhere. It must have been a legacy from a previous era. So remove the dead code so that it doesn't confuse me again.
This commit is contained in:
parent
1985bc5821
commit
4622f304d5
21
cprop.cc
21
cprop.cc
|
|
@ -195,27 +195,6 @@ void cprop_dc_functor::lpm_const(Design*des, NetConst*obj)
|
|||
nexus_info[idx].out = outputs;
|
||||
}
|
||||
|
||||
// For each bit, if this is the only driver, then set the
|
||||
// initial value of all the signals to this value.
|
||||
for (unsigned idx = 0 ; idx < obj->pin_count() ; idx += 1) {
|
||||
if (nexus_info[idx].out > 1)
|
||||
continue;
|
||||
|
||||
for (Link*clnk = nexus_info[idx].nex->first_nlink()
|
||||
; clnk ; clnk = clnk->next_nlink()) {
|
||||
|
||||
NetPins*cur;
|
||||
unsigned pin;
|
||||
clnk->cur_link(cur, pin);
|
||||
|
||||
NetNet*tmp = dynamic_cast<NetNet*>(cur);
|
||||
if (tmp == 0)
|
||||
continue;
|
||||
|
||||
tmp->pin(pin).set_init(obj->value(idx));
|
||||
}
|
||||
}
|
||||
|
||||
// If there are any links that take input, the constant is
|
||||
// used structurally somewhere.
|
||||
for (unsigned idx = 0 ; idx < obj->pin_count() ; idx += 1)
|
||||
|
|
|
|||
|
|
@ -213,17 +213,7 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
|
|||
o << " pins_are_virtual" << endl;
|
||||
return;
|
||||
}
|
||||
o << " init=";
|
||||
for (unsigned idx = pin_count() ; idx > 0 ; idx -= 1)
|
||||
o << pin(idx-1).get_init();
|
||||
|
||||
o << " (";
|
||||
for (unsigned idx = pin_count() ; idx > 0 ; idx -= 1)
|
||||
if (const Nexus*tmp = pin(idx-1).nexus())
|
||||
o << tmp->get_init();
|
||||
else
|
||||
o << ".";
|
||||
o << ")" << endl;
|
||||
o << endl;
|
||||
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
if (! pin(idx).is_linked())
|
||||
|
|
|
|||
28
net_link.cc
28
net_link.cc
|
|
@ -105,7 +105,7 @@ void connect(Link&l, Link&r)
|
|||
}
|
||||
|
||||
Link::Link()
|
||||
: dir_(PASSIVE), drive0_(STRONG), drive1_(STRONG), init_(verinum::Vx),
|
||||
: dir_(PASSIVE), drive0_(STRONG), drive1_(STRONG),
|
||||
next_(0), nexus_(0)
|
||||
{
|
||||
}
|
||||
|
|
@ -187,16 +187,6 @@ Link::strength_t Link::drive1() const
|
|||
return drive1_;
|
||||
}
|
||||
|
||||
void Link::set_init(verinum::V val)
|
||||
{
|
||||
init_ = val;
|
||||
}
|
||||
|
||||
verinum::V Link::get_init() const
|
||||
{
|
||||
return init_;
|
||||
}
|
||||
|
||||
|
||||
void Link::cur_link(NetPins*&net, unsigned &pin)
|
||||
{
|
||||
|
|
@ -281,20 +271,6 @@ Nexus::~Nexus()
|
|||
delete[]name_;
|
||||
}
|
||||
|
||||
verinum::V Nexus::get_init() const
|
||||
{
|
||||
for (const Link*cur = first_nlink() ; cur ; cur = cur->next_nlink()) {
|
||||
if (cur->get_dir() == Link::OUTPUT)
|
||||
return verinum::Vx;
|
||||
|
||||
if ((cur->get_dir() == Link::PASSIVE)
|
||||
&& (cur->get_init() != verinum::Vz))
|
||||
return cur->get_init();
|
||||
}
|
||||
|
||||
return verinum::Vz;
|
||||
}
|
||||
|
||||
bool Nexus::assign_lval() const
|
||||
{
|
||||
for (const Link*cur = first_nlink() ; cur ; cur = cur->next_nlink()) {
|
||||
|
|
@ -323,6 +299,8 @@ void Nexus::count_io(unsigned&inp, unsigned&out) const
|
|||
case Link::OUTPUT:
|
||||
out += 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
netlist.cc
30
netlist.cc
|
|
@ -152,13 +152,11 @@ void NetPins::devirtualize_pins(void)
|
|||
pins_[0].pin_zero_ = true;
|
||||
pins_[0].node_ = this;
|
||||
pins_[0].dir_ = default_dir_;
|
||||
pins_[0].init_ = default_init_;
|
||||
|
||||
for (unsigned idx = 1 ; idx < npins_ ; idx += 1) {
|
||||
pins_[idx].pin_zero_ = false;
|
||||
pins_[idx].pin_ = idx;
|
||||
pins_[idx].dir_ = default_dir_;
|
||||
pins_[idx].init_ = default_init_;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,11 +211,6 @@ void NetPins::set_default_dir(Link::DIR d)
|
|||
default_dir_ = d;
|
||||
}
|
||||
|
||||
void NetPins::set_default_init(verinum::V val)
|
||||
{
|
||||
default_init_ = val;
|
||||
}
|
||||
|
||||
bool NetPins::is_linked(void)
|
||||
{
|
||||
bool linked_flag = false;
|
||||
|
|
@ -463,22 +456,18 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t, unsigned npins)
|
|||
assert(s);
|
||||
assert(npins>0);
|
||||
|
||||
verinum::V init_value = verinum::Vz;
|
||||
Link::DIR dir = Link::PASSIVE;
|
||||
|
||||
switch (t) {
|
||||
case REG:
|
||||
case INTEGER:
|
||||
case IMPLICIT_REG:
|
||||
init_value = verinum::Vx;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY0:
|
||||
init_value = verinum::V0;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY1:
|
||||
init_value = verinum::V1;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -486,21 +475,18 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t, unsigned npins)
|
|||
}
|
||||
|
||||
pin(0).set_dir(dir);
|
||||
pin(0).set_init(init_value);
|
||||
|
||||
s->add_signal(this);
|
||||
}
|
||||
|
||||
void NetNet::initialize_value_and_dir(verinum::V init_value, Link::DIR dir)
|
||||
void NetNet::initialize_dir_(Link::DIR dir)
|
||||
{
|
||||
if (pins_are_virtual()) {
|
||||
if (0) cerr << "NetNet setting Link default value and dir" << endl;
|
||||
set_default_init(init_value);
|
||||
if (0) cerr << "NetNet setting Link default dir" << endl;
|
||||
set_default_dir(dir);
|
||||
} else {
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
pin(idx).set_dir(dir);
|
||||
pin(idx).set_init(init_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -516,28 +502,24 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t,
|
|||
{
|
||||
assert(s);
|
||||
|
||||
verinum::V init_value = verinum::Vz;
|
||||
Link::DIR dir = Link::PASSIVE;
|
||||
|
||||
switch (t) {
|
||||
case REG:
|
||||
case IMPLICIT_REG:
|
||||
init_value = verinum::Vx;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY0:
|
||||
init_value = verinum::V0;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY1:
|
||||
init_value = verinum::V1;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
initialize_value_and_dir(init_value, dir);
|
||||
initialize_dir_(dir);
|
||||
|
||||
s->add_signal(this);
|
||||
}
|
||||
|
|
@ -572,28 +554,24 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t,
|
|||
ivl_assert(*this, 0);
|
||||
}
|
||||
|
||||
verinum::V init_value = verinum::Vz;
|
||||
Link::DIR dir = Link::PASSIVE;
|
||||
|
||||
switch (t) {
|
||||
case REG:
|
||||
case IMPLICIT_REG:
|
||||
init_value = verinum::Vx;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY0:
|
||||
init_value = verinum::V0;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY1:
|
||||
init_value = verinum::V1;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
initialize_value_and_dir(init_value, dir);
|
||||
initialize_dir_(dir);
|
||||
|
||||
s->add_signal(this);
|
||||
}
|
||||
|
|
|
|||
15
netlist.h
15
netlist.h
|
|
@ -114,13 +114,6 @@ class Link {
|
|||
strength_t drive0() const;
|
||||
strength_t drive1() const;
|
||||
|
||||
// A link has an initial value that is used by the nexus to
|
||||
// figure out its initial value. Normally, only the object
|
||||
// that contains the link sets the initial value, and only the
|
||||
// attached Nexus gets it. The default link value is Vx.
|
||||
void set_init(verinum::V val);
|
||||
verinum::V get_init() const;
|
||||
|
||||
void cur_link(NetPins*&net, unsigned &pin);
|
||||
void cur_link(const NetPins*&net, unsigned &pin) const;
|
||||
|
||||
|
|
@ -165,7 +158,6 @@ class Link {
|
|||
DIR dir_ : 2;
|
||||
strength_t drive0_ : 3;
|
||||
strength_t drive1_ : 3;
|
||||
verinum::V init_ : 2;
|
||||
|
||||
private:
|
||||
Nexus* find_nexus_() const;
|
||||
|
|
@ -196,7 +188,7 @@ class NetPins : public LineInfo {
|
|||
|
||||
void dump_node_pins(ostream&, unsigned, const char**pin_names =0) const;
|
||||
void set_default_dir(Link::DIR d);
|
||||
void set_default_init(verinum::V val);
|
||||
|
||||
bool is_linked();
|
||||
bool pins_are_virtual(void) const;
|
||||
void devirtualize_pins(void);
|
||||
|
|
@ -205,7 +197,6 @@ class NetPins : public LineInfo {
|
|||
Link*pins_;
|
||||
const unsigned npins_;
|
||||
Link::DIR default_dir_;
|
||||
verinum::V default_init_;
|
||||
};
|
||||
|
||||
/* =========
|
||||
|
|
@ -344,7 +335,6 @@ class Nexus {
|
|||
void connect(Link&r);
|
||||
|
||||
const char* name() const;
|
||||
verinum::V get_init() const;
|
||||
|
||||
void drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay);
|
||||
void drivers_drive(Link::strength_t d0, Link::strength_t d1);
|
||||
|
|
@ -668,7 +658,8 @@ class NetNet : public NetObj {
|
|||
|
||||
virtual void dump_net(ostream&, unsigned) const;
|
||||
|
||||
void initialize_value_and_dir(verinum::V init_value, Link::DIR dir);
|
||||
private:
|
||||
void initialize_dir_(Link::DIR dir);
|
||||
|
||||
private:
|
||||
Type type_ : 5;
|
||||
|
|
|
|||
32
syn-rules.y
32
syn-rules.y
|
|
@ -55,7 +55,6 @@ static Design*des_;
|
|||
|
||||
static void make_DFF_CE(Design*des, NetProcTop*top, NetEvWait*wclk,
|
||||
NetEvent*eclk, NetExpr*cexp, NetAssignBase*asn);
|
||||
static void make_initializer(Design*des, NetProcTop*top, NetAssignBase*asn);
|
||||
|
||||
%}
|
||||
|
||||
|
|
@ -93,10 +92,6 @@ start
|
|||
/* Unconditional assignments in initial blocks should be made into
|
||||
initializers wherever possible. */
|
||||
|
||||
| S_INITIAL S_ASSIGN
|
||||
{ make_initializer(des_, $1->top, $2->assign);
|
||||
}
|
||||
|
||||
;
|
||||
%%
|
||||
|
||||
|
|
@ -175,33 +170,6 @@ static void make_DFF_CE(Design*des, NetProcTop*top, NetEvWait*wclk,
|
|||
des->delete_process(top);
|
||||
}
|
||||
|
||||
/*
|
||||
* An assignment in an initial statement is the same as giving the
|
||||
* nexus an initial value. For synthesized netlists, we can just set
|
||||
* the initial value for the link and get rid of the assignment
|
||||
* process.
|
||||
*/
|
||||
static void make_initializer(Design*des, NetProcTop*top, NetAssignBase*asn)
|
||||
{
|
||||
NetESignal*rsig = dynamic_cast<NetESignal*> (asn->rval());
|
||||
assert(rsig);
|
||||
|
||||
for (unsigned idx = 0 ; idx < asn->l_val(0)->lwidth() ; idx += 1) {
|
||||
|
||||
verinum::V bit = rsig->sig()->pin(idx).nexus()->driven_value();
|
||||
|
||||
Nexus*nex = asn->l_val(0)->sig()->pin(idx).nexus();
|
||||
for (Link*cur = nex->first_nlink()
|
||||
; cur ; cur = cur->next_nlink()) {
|
||||
|
||||
if (dynamic_cast<NetNet*> (cur->get_obj()))
|
||||
cur->set_init(bit);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
des->delete_process(top);
|
||||
}
|
||||
|
||||
static syn_token_t*first_ = 0;
|
||||
static syn_token_t*last_ = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue