diff --git a/HName.cc b/HName.cc index 84bc27529..7342b7aa4 100644 --- a/HName.cc +++ b/HName.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: HName.cc,v 1.4 2002/08/12 01:34:58 steve Exp $" +#ident "$Id: HName.cc,v 1.5 2002/11/02 03:27:52 steve Exp $" #endif # include "config.h" @@ -75,6 +75,11 @@ hname_t::~hname_t() } } +unsigned hname_t::component_count() const +{ + return count_; +} + void hname_t::append(const char*text) { char**tmp; @@ -253,6 +258,10 @@ ostream& operator<< (ostream&out, const hname_t&that) /* * $Log: HName.cc,v $ + * Revision 1.5 2002/11/02 03:27:52 steve + * Allow named events to be referenced by + * hierarchical names. + * * Revision 1.4 2002/08/12 01:34:58 steve * conditional ident string using autoconfig. * diff --git a/HName.h b/HName.h index 89b867dd2..8b6d480c4 100644 --- a/HName.h +++ b/HName.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: HName.h,v 1.3 2002/08/12 01:34:58 steve Exp $" +#ident "$Id: HName.h,v 1.4 2002/11/02 03:27:51 steve Exp $" #endif # include @@ -61,6 +61,10 @@ class hname_t { const char*peek_name(unsigned idx) const; const char*peek_tail_name() const; + // Return the number of components in the hierarchical + // name. If this is a simple name, this will return 1. + unsigned component_count() const; + friend ostream& operator<< (ostream&, const hname_t&); private: @@ -79,6 +83,10 @@ extern bool operator == (const hname_t&, const hname_t&); /* * $Log: HName.h,v $ + * Revision 1.4 2002/11/02 03:27:51 steve + * Allow named events to be referenced by + * hierarchical names. + * * Revision 1.3 2002/08/12 01:34:58 steve * conditional ident string using autoconfig. * diff --git a/net_design.cc b/net_design.cc index db716b0d1..b1ff3adc8 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: net_design.cc,v 1.28 2002/10/19 22:59:49 steve Exp $" +#ident "$Id: net_design.cc,v 1.29 2002/11/02 03:27:52 steve Exp $" #endif # include "config.h" @@ -501,7 +501,7 @@ NetScope* Design::find_task(const hname_t&key) return 0; } -NetEvent* Design::find_event(NetScope*scope, hname_t path) +NetEvent* Design::find_event(NetScope*scope, const hname_t&path) { assert(scope); @@ -510,8 +510,12 @@ NetEvent* Design::find_event(NetScope*scope, hname_t path) return ev; } - if (scope->type() == NetScope::MODULE) + // If this is a simple name, then do not scan up scopes + // past a module scope. This is a Verilog scoping rule. + if ((path.component_count() == 1) + && (scope->type() == NetScope::MODULE)) break; + scope = scope->parent(); } @@ -593,6 +597,10 @@ void Design::delete_process(NetProcTop*top) /* * $Log: net_design.cc,v $ + * Revision 1.29 2002/11/02 03:27:52 steve + * Allow named events to be referenced by + * hierarchical names. + * * Revision 1.28 2002/10/19 22:59:49 steve * Redo the parameter vector support to allow * parameter names in range expressions. diff --git a/netlist.h b/netlist.h index 04cc25212..db7acdb60 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: netlist.h,v 1.267 2002/10/23 01:47:17 steve Exp $" +#ident "$Id: netlist.h,v 1.268 2002/11/02 03:27:52 steve Exp $" #endif /* @@ -2995,7 +2995,7 @@ class Design { NetScope* find_task(const hname_t&key); // Events - NetEvent* find_event(NetScope*scope, const hname_t path); + NetEvent* find_event(NetScope*scope, const hname_t&path); // NODES void add_node(NetNode*); @@ -3083,6 +3083,10 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.268 2002/11/02 03:27:52 steve + * Allow named events to be referenced by + * hierarchical names. + * * Revision 1.267 2002/10/23 01:47:17 steve * Fix synth2 handling of aset/aclr signals where * flip-flops are split by begin-end blocks. diff --git a/parse.y b/parse.y index 0d97b1bf3..25ec87628 100644 --- a/parse.y +++ b/parse.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: parse.y,v 1.162 2002/10/13 05:01:44 steve Exp $" +#ident "$Id: parse.y,v 1.163 2002/11/02 03:27:52 steve Exp $" #endif # include "config.h" @@ -551,11 +551,11 @@ dr_strength1 ; event_control - : '@' IDENTIFIER - { PEIdent*tmpi = new PEIdent(hname_t($2)); + : '@' identifier + { PEIdent*tmpi = new PEIdent(*$2); tmpi->set_file(@2.text); tmpi->set_lineno(@2.first_line); - delete[]$2; + delete $2; PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi); PEventStatement*tmps = new PEventStatement(tmpe); tmps->set_file(@1.text);