Named event triggers can take hierarchical names.

This commit is contained in:
steve 2002-12-07 02:49:24 +00:00
parent c032186133
commit e62e1d89b6
4 changed files with 28 additions and 16 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
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: net_design.cc,v 1.29 2002/11/02 03:27:52 steve Exp $" #ident "$Id: net_design.cc,v 1.30 2002/12/07 02:49:24 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -501,24 +501,27 @@ NetScope* Design::find_task(const hname_t&key)
return 0; return 0;
} }
NetEvent* Design::find_event(NetScope*scope, const hname_t&path) NetEvent* Design::find_event(NetScope*scope, const hname_t&p)
{ {
hname_t path = p;
assert(scope); assert(scope);
char*key = path.remove_tail_name();
if (path.peek_name(0))
scope = find_scope(scope, path);
while (scope) { while (scope) {
if (NetEvent*ev = scope->find_event(path)) { if (NetEvent*ev = scope->find_event(key)) {
delete key;
return ev; return ev;
} }
// If this is a simple name, then do not scan up scopes if (scope->type() == NetScope::MODULE)
// past a module scope. This is a Verilog scoping rule.
if ((path.component_count() == 1)
&& (scope->type() == NetScope::MODULE))
break; break;
scope = scope->parent(); scope = scope->parent();
} }
delete key;
return 0; return 0;
} }
@ -597,6 +600,9 @@ void Design::delete_process(NetProcTop*top)
/* /*
* $Log: net_design.cc,v $ * $Log: net_design.cc,v $
* Revision 1.30 2002/12/07 02:49:24 steve
* Named event triggers can take hierarchical names.
*
* Revision 1.29 2002/11/02 03:27:52 steve * Revision 1.29 2002/11/02 03:27:52 steve
* Allow named events to be referenced by * Allow named events to be referenced by
* hierarchical names. * hierarchical names.

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
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: net_scope.cc,v 1.20 2002/10/19 22:59:49 steve Exp $" #ident "$Id: net_scope.cc,v 1.21 2002/12/07 02:49:24 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -255,10 +255,10 @@ void NetScope::rem_event(NetEvent*ev)
} }
NetEvent* NetScope::find_event(const hname_t&name) NetEvent* NetScope::find_event(const char*name)
{ {
for (NetEvent*cur = events_; cur ; cur = cur->snext_) for (NetEvent*cur = events_; cur ; cur = cur->snext_)
if (strcmp(cur->name(), name.peek_tail_name()) == 0) if (strcmp(cur->name(), name) == 0)
return cur; return cur;
return 0; return 0;
@ -432,6 +432,9 @@ string NetScope::local_hsymbol()
/* /*
* $Log: net_scope.cc,v $ * $Log: net_scope.cc,v $
* Revision 1.21 2002/12/07 02:49:24 steve
* Named event triggers can take hierarchical names.
*
* Revision 1.20 2002/10/19 22:59:49 steve * Revision 1.20 2002/10/19 22:59:49 steve
* Redo the parameter vector support to allow * Redo the parameter vector support to allow
* parameter names in range expressions. * parameter names in range expressions.

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
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: netlist.h,v 1.270 2002/12/05 02:14:33 steve Exp $" #ident "$Id: netlist.h,v 1.271 2002/12/07 02:49:24 steve Exp $"
#endif #endif
/* /*
@ -2795,7 +2795,7 @@ class NetScope {
void add_event(NetEvent*); void add_event(NetEvent*);
void rem_event(NetEvent*); void rem_event(NetEvent*);
NetEvent*find_event(const hname_t&name); NetEvent*find_event(const char*name);
/* These methods manage signals. The add_ and rem_signal /* These methods manage signals. The add_ and rem_signal
@ -3085,6 +3085,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.271 2002/12/07 02:49:24 steve
* Named event triggers can take hierarchical names.
*
* Revision 1.270 2002/12/05 02:14:33 steve * Revision 1.270 2002/12/05 02:14:33 steve
* Support bit select in constant expressions. * Support bit select in constant expressions.
* *

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) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: parse.y,v 1.166 2002/11/26 03:56:10 steve Exp $" #ident "$Id: parse.y,v 1.167 2002/12/07 02:49:24 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -2316,8 +2316,8 @@ statement
delete $2; delete $2;
$$ = tmp; $$ = tmp;
} }
| K_TRIGGER IDENTIFIER ';' | K_TRIGGER identifier ';'
{ PTrigger*tmp = new PTrigger(hname_t($2)); { PTrigger*tmp = new PTrigger(*$2);
tmp->set_file(@2.text); tmp->set_file(@2.text);
tmp->set_lineno(@2.first_line); tmp->set_lineno(@2.first_line);
delete $2; delete $2;