handle duplicate connect to a nexus.

This commit is contained in:
steve 1999-11-19 05:02:37 +00:00
parent 28149e73e3
commit fae40cf380
2 changed files with 57 additions and 13 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: netlist.cc,v 1.88 1999/11/19 03:02:25 steve Exp $" #ident "$Id: netlist.cc,v 1.89 1999/11/19 05:02:37 steve Exp $"
#endif #endif
# include <cassert> # include <cassert>
@ -78,9 +78,19 @@ ostream& operator<< (ostream&o, NetNet::Type t)
void connect(NetObj::Link&l, NetObj::Link&r) void connect(NetObj::Link&l, NetObj::Link&r)
{ {
assert(&l != &r); assert(&l != &r);
assert(l.next_->prev_ == &l);
assert(l.prev_->next_ == &l);
assert(r.next_->prev_ == &r);
assert(r.prev_->next_ == &r);
NetObj::Link* cur = &l; NetObj::Link* cur = &l;
do { do {
NetObj::Link*tmp = cur->next_; NetObj::Link*tmp = cur->next_;
// If I stumble on r in the nexus, then stop now because
// we are already connected.
if (tmp == &r) break;
// Pull cur out of left list... // Pull cur out of left list...
cur->prev_->next_ = cur->next_; cur->prev_->next_ = cur->next_;
cur->next_->prev_ = cur->prev_; cur->next_->prev_ = cur->prev_;
@ -94,6 +104,11 @@ void connect(NetObj::Link&l, NetObj::Link&r)
// Go to the next item in the left list. // Go to the next item in the left list.
cur = tmp; cur = tmp;
} while (cur != &l); } while (cur != &l);
assert(l.next_->prev_ == &l);
assert(l.prev_->next_ == &l);
assert(r.next_->prev_ == &r);
assert(r.prev_->next_ == &r);
} }
NetObj::Link::Link() NetObj::Link::Link()
@ -136,6 +151,36 @@ bool NetObj::Link::is_linked(const NetObj::Link&that) const
return false; return false;
} }
void NetObj::Link::next_link(NetObj*&net, unsigned&pin)
{
assert(next_->prev_ == this);
assert(prev_->next_ == this);
net = next_->node_;
pin = next_->pin_;
}
void NetObj::Link::next_link(const NetObj*&net, unsigned&pin) const
{
assert(next_->prev_ == this);
assert(prev_->next_ == this);
net = next_->node_;
pin = next_->pin_;
}
NetObj::Link* NetObj::Link::next_link()
{
assert(next_->prev_ == this);
assert(prev_->next_ == this);
return next_;
}
const NetObj::Link* NetObj::Link::next_link() const
{
assert(next_->prev_ == this);
assert(prev_->next_ == this);
return next_;
}
const NetObj*NetObj::Link::get_obj() const const NetObj*NetObj::Link::get_obj() const
{ {
return node_; return node_;
@ -2359,6 +2404,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
/* /*
* $Log: netlist.cc,v $ * $Log: netlist.cc,v $
* Revision 1.89 1999/11/19 05:02:37 steve
* handle duplicate connect to a nexus.
*
* Revision 1.88 1999/11/19 03:02:25 steve * Revision 1.88 1999/11/19 03:02:25 steve
* Detect flip-flops connected to opads and turn * Detect flip-flops connected to opads and turn
* them into OUTFF devices. Inprove support for * them into OUTFF devices. Inprove support for

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: netlist.h,v 1.90 1999/11/19 03:02:25 steve Exp $" #ident "$Id: netlist.h,v 1.91 1999/11/19 05:02:37 steve Exp $"
#endif #endif
/* /*
@ -88,18 +88,11 @@ class NetObj {
pin = pin_; pin = pin_;
} }
void next_link(NetObj*&net, unsigned&pin) void next_link(NetObj*&net, unsigned&pin);
{ net = next_->node_; void next_link(const NetObj*&net, unsigned&pin) const;
pin = next_->pin_;
}
void next_link(const NetObj*&net, unsigned&pin) const Link* next_link();
{ net = next_->node_; const Link* next_link() const;
pin = next_->pin_;
}
Link* next_link() { return next_; }
const Link* next_link() const { return next_; }
// Remove this link from the set of connected pins. The // Remove this link from the set of connected pins. The
// destructor will automatically do this if needed. // destructor will automatically do this if needed.
@ -1940,6 +1933,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.91 1999/11/19 05:02:37 steve
* handle duplicate connect to a nexus.
*
* Revision 1.90 1999/11/19 03:02:25 steve * Revision 1.90 1999/11/19 03:02:25 steve
* Detect flip-flops connected to opads and turn * Detect flip-flops connected to opads and turn
* them into OUTFF devices. Inprove support for * them into OUTFF devices. Inprove support for