Get rid of useless next_link method.

This commit is contained in:
steve 2000-06-24 22:55:19 +00:00
parent f3384c7da5
commit e52ada617e
4 changed files with 69 additions and 85 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: cprop.cc,v 1.10 2000/05/14 17:55:04 steve Exp $"
#ident "$Id: cprop.cc,v 1.11 2000/06/24 22:55:19 steve Exp $"
#endif
# include "netlist.h"
@ -249,15 +249,17 @@ void cprop_dc_functor::lpm_const(Design*des, NetConst*obj)
// them. If I find any, this this constant is used by a
// behavioral expression somewhere.
for (unsigned idx = 0 ; idx < obj->pin_count() ; idx += 1) {
NetObj*cur;
unsigned pin;
obj->pin(idx).next_link(cur, pin);
while (cur != obj) {
Link*clnk = obj->pin(idx).next_link();
while (clnk != &obj->pin(idx)) {
NetObj*cur;
unsigned pin;
clnk->cur_link(cur, pin);
NetNet*tmp = dynamic_cast<NetNet*>(cur);
if (tmp && tmp->get_eref() > 0)
return;
cur->pin(pin).next_link(cur, pin);
clnk = clnk->next_link();
}
}
@ -283,6 +285,9 @@ void cprop(Design*des)
/*
* $Log: cprop.cc,v $
* Revision 1.11 2000/06/24 22:55:19 steve
* Get rid of useless next_link method.
*
* Revision 1.10 2000/05/14 17:55:04 steve
* Support initialization of FF Q value.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: design_dump.cc,v 1.86 2000/06/13 03:24:48 steve Exp $"
#ident "$Id: design_dump.cc,v 1.87 2000/06/24 22:55:19 steve Exp $"
#endif
/*
@ -88,12 +88,13 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
o << setw(ind+4) << "" << "[" << idx << "]:";
unsigned cpin;
const NetObj*cur;
for (pin(idx).next_link(cur, cpin)
; (cur != this) || (cpin != idx)
; cur->pin(cpin).next_link(cur, cpin)) {
for (const Link*clnk = pin(idx).next_link()
; clnk != &pin(idx)
; clnk = clnk->next_link()) {
unsigned cpin;
const NetObj*cur;
clnk->cur_link(cur, cpin);
o << " " << cur->name() << "[" << cpin << "]";
}
o << endl;
@ -146,12 +147,13 @@ void NetObj::dump_node_pins(ostream&o, unsigned ind) const
o << " (" << pin(idx).drive0() << "0 "
<< pin(idx).drive1() << "1):";
unsigned cpin;
const NetObj*cur;
for (pin(idx).next_link(cur, cpin)
; (cur != this) || (cpin != idx)
; cur->pin(cpin).next_link(cur, cpin)) {
for (const Link*clnk = pin(idx).next_link()
; clnk != &pin(idx)
; clnk = clnk->next_link()) {
unsigned cpin;
const NetObj*cur;
clnk->cur_link(cur, cpin);
const NetNet*sig = dynamic_cast<const NetNet*>(cur);
if (sig) o << " " << sig->name() << "[" << cpin << "]";
}
@ -979,6 +981,9 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
* Revision 1.87 2000/06/24 22:55:19 steve
* Get rid of useless next_link method.
*
* Revision 1.86 2000/06/13 03:24:48 steve
* Index in memory assign should be a NetExpr.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.cc,v 1.129 2000/06/13 03:24:48 steve Exp $"
#ident "$Id: netlist.cc,v 1.130 2000/06/24 22:55:19 steve Exp $"
#endif
# include <cassert>
@ -158,6 +158,12 @@ void Link::cur_link(NetObj*&net, unsigned &pin)
pin = pin_;
}
void Link::cur_link(const NetObj*&net, unsigned &pin) const
{
net = node_;
pin = pin_;
}
void Link::unlink()
{
next_->prev_ = prev_;
@ -175,15 +181,6 @@ bool Link::is_linked() const
return next_ != this;
}
bool Link::is_linked(const NetObj&that) const
{
for (const Link*idx = next_ ; this != idx ; idx = idx->next_)
if (idx->node_ == &that)
return true;
return false;
}
bool Link::is_linked(const Link&that) const
{
for (const Link*idx = next_ ; this != idx ; idx = idx->next_)
@ -193,22 +190,6 @@ bool Link::is_linked(const Link&that) const
return false;
}
void Link::next_link(NetObj*&net, unsigned&pin)
{
assert(next_->prev_ == this);
assert(prev_->next_ == this);
net = next_->node_;
pin = next_->pin_;
}
void Link::next_link(const NetObj*&net, unsigned&pin) const
{
assert(next_->prev_ == this);
assert(prev_->next_ == this);
net = next_->node_;
pin = next_->pin_;
}
Link* Link::next_link()
{
assert(next_->prev_ == this);
@ -254,25 +235,18 @@ unsigned Link::get_inst() const
return inst_;
}
bool connected(const NetObj&l, const NetObj&r)
{
for (unsigned idx = 0 ; idx < l.pin_count() ; idx += 1)
if (! l.pin(idx).is_linked(r))
return false;
return true;
}
unsigned count_inputs(const Link&pin)
{
unsigned count = (pin.get_dir() == Link::INPUT)? 1 : 0;
const NetObj*cur;
unsigned cpin;
pin.next_link(cur, cpin);
while (cur->pin(cpin) != pin) {
for (const Link*clnk = pin.next_link()
; clnk != &pin
; clnk = clnk->next_link()) {
const NetObj*cur;
unsigned cpin;
clnk->cur_link(cur, cpin);
if (cur->pin(cpin).get_dir() == Link::INPUT)
count += 1;
cur->pin(cpin).next_link(cur, cpin);
}
return count;
@ -281,13 +255,15 @@ unsigned count_inputs(const Link&pin)
unsigned count_outputs(const Link&pin)
{
unsigned count = (pin.get_dir() == Link::OUTPUT)? 1 : 0;
const NetObj*cur;
unsigned cpin;
pin.next_link(cur, cpin);
while (cur->pin(cpin) != pin) {
for (const Link*clnk = pin.next_link()
; clnk != &pin
; clnk = clnk->next_link()) {
const NetObj*cur;
unsigned cpin;
clnk->cur_link(cur, cpin);
if (cur->pin(cpin).get_dir() == Link::OUTPUT)
count += 1;
cur->pin(cpin).next_link(cur, cpin);
}
return count;
@ -299,14 +275,14 @@ unsigned count_signals(const Link&pin)
if (dynamic_cast<const NetNet*>(pin.get_obj()))
count += 1;
const NetObj*cur;
unsigned cpin;
pin.next_link(cur, cpin);
while (cur->pin(cpin) != pin) {
for (const Link*clnk = pin.next_link()
; clnk != &pin
; clnk = clnk->next_link()) {
const NetObj*cur;
unsigned cpin;
clnk->cur_link(cur, cpin);
if (dynamic_cast<const NetNet*>(cur))
count += 1;
cur->pin(cpin).next_link(cur, cpin);
}
return count;
@ -314,17 +290,19 @@ unsigned count_signals(const Link&pin)
const NetNet* find_link_signal(const NetObj*net, unsigned pin, unsigned&bidx)
{
const NetObj*cur;
unsigned cpin;
net->pin(pin).next_link(cur, cpin);
for (const Link*clnk = net->pin(pin).next_link()
; clnk->get_obj() != net
; clnk = clnk->next_link()) {
const NetObj*cur;
unsigned cpin;
clnk->cur_link(cur, cpin);
while (cur != net) {
const NetNet*sig = dynamic_cast<const NetNet*>(cur);
if (sig) {
bidx = cpin;
return sig;
}
cur->pin(cpin).next_link(cur, cpin);
}
return 0;
@ -2634,6 +2612,9 @@ bool NetUDP::sequ_glob_(string input, char output)
/*
* $Log: netlist.cc,v $
* Revision 1.130 2000/06/24 22:55:19 steve
* Get rid of useless next_link method.
*
* Revision 1.129 2000/06/13 03:24:48 steve
* Index in memory assign should be a NetExpr.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.141 2000/06/13 03:24:48 steve Exp $"
#ident "$Id: netlist.h,v 1.142 2000/06/24 22:55:20 steve Exp $"
#endif
/*
@ -140,9 +140,7 @@ class Link {
strength_t drive1() const;
void cur_link(NetObj*&net, unsigned &pin);
void next_link(NetObj*&net, unsigned&pin);
void next_link(const NetObj*&net, unsigned&pin) const;
void cur_link(const NetObj*&net, unsigned &pin) const;
Link* next_link();
const Link* next_link() const;
@ -157,9 +155,6 @@ class Link {
// Return true if these pins are connected.
bool is_linked(const Link&that) const;
// Return true if this link is connected to any pin of r.
bool is_linked(const NetObj&r) const;
// Return true if this is the same pin of the same object of
// that link.
bool is_equal(const Link&that) const;
@ -2568,11 +2563,6 @@ extern void connect(Link&, Link&);
inline bool connected(const Link&l, const Link&r)
{ return l.is_linked(r); }
/* Return true if l is fully connected to r. This means, every pin in
l is connected to a pin in r. This is expecially useful for
checking signal vectors. */
extern bool connected(const NetObj&l, const NetObj&r);
/* return the number of links in the ring that are of the specified
type. */
extern unsigned count_inputs(const Link&pin);
@ -2595,6 +2585,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.142 2000/06/24 22:55:20 steve
* Get rid of useless next_link method.
*
* Revision 1.141 2000/06/13 03:24:48 steve
* Index in memory assign should be a NetExpr.
*