Handle some edge cases during node scans.
This commit is contained in:
parent
2a08824ae9
commit
741b17245d
25
functor.cc
25
functor.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: functor.cc,v 1.19 2000/07/15 05:13:43 steve Exp $"
|
||||
#ident "$Id: functor.cc,v 1.20 2000/07/16 04:56:07 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "functor.h"
|
||||
|
|
@ -110,12 +110,30 @@ void Design::functor(functor_t*fun)
|
|||
|
||||
// apply to nodes
|
||||
if (nodes_) {
|
||||
/* Scan the circular list of nodes, starting with the
|
||||
front of the list. (nodes_ points to the *end* of the
|
||||
list.) The bar is the end point. At the end of the
|
||||
do-while loop, I know that the bar has been
|
||||
processed or (if bar == 0) no undeleted node has been
|
||||
processed. */
|
||||
NetNode*cur = nodes_->node_next_;
|
||||
NetNode*bar = 0;
|
||||
do {
|
||||
NetNode*tmp = cur->node_next_;
|
||||
cur->functor_node(this, fun);
|
||||
|
||||
/* Detect the case that cur has been deleted by
|
||||
noticing if tmp->node_prev_ no longer points to
|
||||
cur. If that's the case, clear the bar. */
|
||||
if (tmp->node_prev_ != cur) {
|
||||
if (cur == bar)
|
||||
bar = 0;
|
||||
} else if (bar == 0) {
|
||||
bar = cur;
|
||||
}
|
||||
cur = tmp;
|
||||
} while (nodes_ && cur != nodes_->node_next_);
|
||||
|
||||
} while (nodes_ && (cur != bar));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,6 +245,9 @@ int proc_match_t::event_wait(NetEvWait*)
|
|||
|
||||
/*
|
||||
* $Log: functor.cc,v $
|
||||
* Revision 1.20 2000/07/16 04:56:07 steve
|
||||
* Handle some edge cases during node scans.
|
||||
*
|
||||
* Revision 1.19 2000/07/15 05:13:43 steve
|
||||
* Detect muxing Vz as a bufufN.
|
||||
*
|
||||
|
|
|
|||
12
functor.h
12
functor.h
|
|
@ -19,13 +19,20 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: functor.h,v 1.14 2000/07/15 05:13:44 steve Exp $"
|
||||
#ident "$Id: functor.h,v 1.15 2000/07/16 04:56:07 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The functor is an object that can be applied to a design to
|
||||
* transform it. This is different from the target_t, which can only
|
||||
* scan the design but not transform it in any way.
|
||||
*
|
||||
* When a functor it scanning a process, signal or node, the functor
|
||||
* is free to manipulate the list by deleting items, including the
|
||||
* node being scanned. The Design class scanner knows how to handle
|
||||
* the situation. However, if objects are added to the netlist, there
|
||||
* is no guarantee that object will be scanned unless the functor is
|
||||
* rerun.
|
||||
*/
|
||||
|
||||
class Design;
|
||||
|
|
@ -82,6 +89,9 @@ struct proc_match_t {
|
|||
|
||||
/*
|
||||
* $Log: functor.h,v $
|
||||
* Revision 1.15 2000/07/16 04:56:07 steve
|
||||
* Handle some edge cases during node scans.
|
||||
*
|
||||
* Revision 1.14 2000/07/15 05:13:44 steve
|
||||
* Detect muxing Vz as a bufufN.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: net_design.cc,v 1.9 2000/07/14 06:12:57 steve Exp $"
|
||||
#ident "$Id: net_design.cc,v 1.10 2000/07/16 04:56:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -46,6 +46,7 @@ static string parse_last_name(string&path)
|
|||
Design:: Design()
|
||||
: errors(0), root_scope_(0), nodes_(0), procs_(0), lcounter_(0)
|
||||
{
|
||||
procs_idx_ = 0;
|
||||
}
|
||||
|
||||
Design::~Design()
|
||||
|
|
@ -470,6 +471,9 @@ void Design::delete_process(NetProcTop*top)
|
|||
|
||||
/*
|
||||
* $Log: net_design.cc,v $
|
||||
* Revision 1.10 2000/07/16 04:56:08 steve
|
||||
* Handle some edge cases during node scans.
|
||||
*
|
||||
* Revision 1.9 2000/07/14 06:12:57 steve
|
||||
* Move inital value handling from NetNet to Nexus
|
||||
* objects. This allows better propogation of inital
|
||||
|
|
|
|||
|
|
@ -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.146 2000/07/15 05:13:44 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.147 2000/07/16 04:56:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -266,6 +266,7 @@ class NetNode : public NetObj {
|
|||
virtual void emit_node(ostream&, struct target_t*) const;
|
||||
virtual void dump_node(ostream&, unsigned) const;
|
||||
|
||||
// This is used to scan a modifiable netlist, one node at a time.
|
||||
virtual void functor_node(Design*, functor_t*);
|
||||
|
||||
private:
|
||||
|
|
@ -2659,6 +2660,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.147 2000/07/16 04:56:08 steve
|
||||
* Handle some edge cases during node scans.
|
||||
*
|
||||
* Revision 1.146 2000/07/15 05:13:44 steve
|
||||
* Detect muxing Vz as a bufufN.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue