Skip to content

Commit

Permalink
Handle some edge cases during node scans.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Jul 16, 2000
1 parent 2a08824 commit 741b172
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
25 changes: 23 additions & 2 deletions functor.cc
Expand Up @@ -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"
Expand Down Expand Up @@ -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));
}
}

Expand Down Expand Up @@ -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.
*
Expand Down
12 changes: 11 additions & 1 deletion functor.h
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down
6 changes: 5 additions & 1 deletion net_design.cc
Expand Up @@ -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

/*
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion netlist.h
Expand Up @@ -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

/*
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 741b172

Please sign in to comment.