From 72b350891178c4abed92112b6fc987a083323e08 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 9 Apr 2000 17:44:30 +0000 Subject: [PATCH] Catch event declarations during scope elaborate. --- PEvent.h | 7 +++++-- elab_scope.cc | 29 ++++++++++++++++++++++++++++- elaborate.cc | 19 ++++--------------- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/PEvent.h b/PEvent.h index 661b98021..800de59f5 100644 --- a/PEvent.h +++ b/PEvent.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: PEvent.h,v 1.2 2000/04/04 03:20:15 steve Exp $" +#ident "$Id: PEvent.h,v 1.3 2000/04/09 17:44:30 steve Exp $" #endif # include "LineInfo.h" @@ -40,7 +40,7 @@ class PEvent : public LineInfo { string name() const; - void elaborate(Design*des, NetScope*scope) const; + void elaborate_scope(Design*des, NetScope*scope) const; private: string name_; @@ -52,6 +52,9 @@ class PEvent : public LineInfo { /* * $Log: PEvent.h,v $ + * Revision 1.3 2000/04/09 17:44:30 steve + * Catch event declarations during scope elaborate. + * * Revision 1.2 2000/04/04 03:20:15 steve * Simulate named event trigger and waits. * diff --git a/elab_scope.cc b/elab_scope.cc index c72949848..8c1aeb307 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elab_scope.cc,v 1.3 2000/03/12 17:09:41 steve Exp $" +#ident "$Id: elab_scope.cc,v 1.4 2000/04/09 17:44:30 steve Exp $" #endif /* @@ -28,6 +28,7 @@ */ # include "Module.h" +# include "PEvent.h" # include "PExpr.h" # include "PGate.h" # include "PTask.h" @@ -173,6 +174,17 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const (*cur) -> statement() -> elaborate_scope(des, scope); } + // Scan through all the named events in this scope. We do not + // need anything more then the current scope to do this + // elaboration, so do it now. This allows for normal + // elaboration to reference these events. + + for (map::const_iterator et = events.begin() + ; et != events.end() ; et ++ ) { + + (*et).second->elaborate_scope(des, scope); + } + return des->errors == 0; } @@ -254,6 +266,18 @@ void PGModule::elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const } } +/* + * The isn't really able to create new scopes, but it does create the + * event name in the current scope, so can be done during the + * elaborate_scope scan. + */ +void PEvent::elaborate_scope(Design*des, NetScope*scope) const +{ + NetEvent*ev = new NetEvent(name_); + ev->set_line(*this); + scope->add_event(ev); +} + void PFunction::elaborate_scope(Design*des, NetScope*scope) const { } @@ -391,6 +415,9 @@ void PWhile::elaborate_scope(Design*des, NetScope*scope) const /* * $Log: elab_scope.cc,v $ + * Revision 1.4 2000/04/09 17:44:30 steve + * Catch event declarations during scope elaborate. + * * Revision 1.3 2000/03/12 17:09:41 steve * Support localparam. * diff --git a/elaborate.cc b/elaborate.cc index 84dc03eb0..a0bfb953d 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.155 2000/04/09 16:43:50 steve Exp $" +#ident "$Id: elaborate.cc,v 1.156 2000/04/09 17:44:30 steve Exp $" #endif /* @@ -48,13 +48,6 @@ string Design::local_symbol(const string&path) static const map* modlist = 0; static const map* udplist = 0; -void PEvent::elaborate(Design*des, NetScope*scope) const -{ - NetEvent*ev = new NetEvent(name_); - ev->set_line(*this); - scope->add_event(ev); -} - /* * Elaborate a source wire. The "wire" is the declaration of wires, * registers, ports and memories. The parser has already merged the @@ -1928,13 +1921,6 @@ bool Module::elaborate(Design*des, NetScope*scope) const const string path = scope->name(); bool result_flag = true; - // Scan through the named events and elaborate them. - for (map::const_iterator et = events.begin() - ; et != events.end() ; et ++ ) { - - (*et).second->elaborate(des, scope); - - } // Get all the explicitly declared wires of the module and // start the signals list with them. @@ -2092,6 +2078,9 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.156 2000/04/09 17:44:30 steve + * Catch event declarations during scope elaborate. + * * Revision 1.155 2000/04/09 16:43:50 steve * Catch event names in parentheses. *