From 3f1cd14f6c7f5fae143b7711311618d83de577ed Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 3 Jul 2002 05:34:59 +0000 Subject: [PATCH] Fix scope search for events. --- elaborate.cc | 11 +++++++---- net_design.cc | 22 +++++++++++++++++++++- netlist.h | 8 +++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index c274c9b48..8c9ffdbc9 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elaborate.cc,v 1.254 2002/06/19 04:20:03 steve Exp $" +#ident "$Id: elaborate.cc,v 1.255 2002/07/03 05:34:59 steve Exp $" #endif # include "config.h" @@ -1813,7 +1813,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope, assert(expr_[0]->expr()); PEIdent*id = dynamic_cast(expr_[0]->expr()); NetEvent*ev; - if (id && (ev = scope->find_event(id->path()))) { + if (id && (ev = des->find_event(scope, id->path()))) { NetEvWait*pr = new NetEvWait(enet); pr->add_event(ev); pr->set_line(*this); @@ -1873,7 +1873,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope, skip the rest of the expression handling. */ if (PEIdent*id = dynamic_cast(expr_[idx]->expr())) { - NetEvent*tmp = scope->find_event(id->path()); + NetEvent*tmp = des->find_event(scope, id->path()); if (tmp) { wa->add_event(tmp); continue; @@ -2247,7 +2247,7 @@ NetProc* PTrigger::elaborate(Design*des, NetScope*scope) const { assert(scope); - NetEvent*ev = scope->find_event(event_); + NetEvent*ev = des->find_event(scope, event_); if (ev == 0) { cerr << get_line() << ": error: event <" << event_ << ">" << " not found." << endl; @@ -2464,6 +2464,9 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.255 2002/07/03 05:34:59 steve + * Fix scope search for events. + * * Revision 1.254 2002/06/19 04:20:03 steve * Remove NetTmp and add NetSubnet class. * diff --git a/net_design.cc b/net_design.cc index e1603b28d..672ea54a3 100644 --- a/net_design.cc +++ b/net_design.cc @@ -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.24 2002/06/25 02:39:34 steve Exp $" +#ident "$Id: net_design.cc,v 1.25 2002/07/03 05:34:59 steve Exp $" #endif # include "config.h" @@ -406,6 +406,23 @@ NetScope* Design::find_task(const hname_t&key) return 0; } +NetEvent* Design::find_event(NetScope*scope, hname_t path) +{ + assert(scope); + + while (scope) { + if (NetEvent*ev = scope->find_event(path)) { + return ev; + } + + if (scope->type() == NetScope::MODULE) + break; + scope = scope->parent(); + } + + return 0; +} + void Design::add_node(NetNode*net) { assert(net->design_ == 0); @@ -468,6 +485,9 @@ void Design::delete_process(NetProcTop*top) /* * $Log: net_design.cc,v $ + * Revision 1.25 2002/07/03 05:34:59 steve + * Fix scope search for events. + * * Revision 1.24 2002/06/25 02:39:34 steve * Fix mishandling of incorect defparam error message. * diff --git a/netlist.h b/netlist.h index 4e4ff7c25..a53e93dcf 100644 --- a/netlist.h +++ b/netlist.h @@ -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.250 2002/07/02 03:02:57 steve Exp $" +#ident "$Id: netlist.h,v 1.251 2002/07/03 05:35:00 steve Exp $" #endif /* @@ -2911,6 +2911,9 @@ class Design { NetScope* find_task(NetScope*scope, const hname_t&name); NetScope* find_task(const hname_t&key); + // Events + NetEvent* find_event(NetScope*scope, const hname_t path); + // NODES void add_node(NetNode*); void del_node(NetNode*); @@ -2994,6 +2997,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.251 2002/07/03 05:35:00 steve + * Fix scope search for events. + * * Revision 1.250 2002/07/02 03:02:57 steve * Change the signal to a net when assignments go away. *