diff --git a/ivl_target.h b/ivl_target.h index abd932313..8da258a14 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.34 2001/01/15 22:05:14 steve Exp $" +#ident "$Id: ivl_target.h,v 1.35 2001/03/20 01:44:13 steve Exp $" #endif #ifdef __cplusplus @@ -593,12 +593,18 @@ extern const char* ivl_signal_attr(ivl_signal_t net, const char*key); * The ivl_process_type function gets the type of the process, * an "inital" or "always" statement. * + * A process is placed in a scope. The statement within the process + * operates within the scope of the process unless there are calls + * outside the scope. + * * The ivl_process_stmt function gets the statement that forms the * process. See the statement related functions for how to manipulate * statements. */ extern ivl_process_type_t ivl_process_type(ivl_process_t net); +extern ivl_scope_t ivl_process_scope(ivl_process_t net); + extern ivl_statement_t ivl_process_stmt(ivl_process_t net); /* @@ -667,6 +673,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.35 2001/03/20 01:44:13 steve + * Put processes in the proper scope. + * * Revision 1.34 2001/01/15 22:05:14 steve * Declare ivl_scope_type functions. * diff --git a/t-dll-api.cc b/t-dll-api.cc index 3471ef934..88994dfec 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-api.cc,v 1.21 2001/01/15 00:47:02 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.22 2001/03/20 01:44:13 steve Exp $" #endif # include "t-dll.h" @@ -362,6 +362,11 @@ extern "C" ivl_process_type_t ivl_process_type(ivl_process_t net) return net->type_; } +extern "C" ivl_scope_t ivl_process_scope(ivl_process_t net) +{ + return net->scope_; +} + extern "C" ivl_statement_t ivl_process_stmt(ivl_process_t net) { return net->stmt_; @@ -646,6 +651,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.22 2001/03/20 01:44:13 steve + * Put processes in the proper scope. + * * Revision 1.21 2001/01/15 00:47:02 steve * Pass scope type information to the target module. * diff --git a/t-dll-proc.cc b/t-dll-proc.cc index 1610fd997..3bfd66eec 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-proc.cc,v 1.10 2000/10/18 20:04:39 steve Exp $" +#ident "$Id: t-dll-proc.cc,v 1.11 2001/03/20 01:44:14 steve Exp $" #endif # include "target.h" @@ -44,6 +44,10 @@ bool dll_target::process(const NetProcTop*net) assert(0); } + /* Save the scope of the process. */ + obj->scope_ = lookup_scope_(net->scope()); + + /* This little bit causes the process to be completely generated so that it can be passed to the DLL. The stmt_cur_ member us used to hold a pointer to the current @@ -301,6 +305,9 @@ void dll_target::proc_while(const NetWhile*net) /* * $Log: t-dll-proc.cc,v $ + * Revision 1.11 2001/03/20 01:44:14 steve + * Put processes in the proper scope. + * * Revision 1.10 2000/10/18 20:04:39 steve * Add ivl_lval_t and support for assignment l-values. * diff --git a/t-dll.cc b/t-dll.cc index 61ed03717..87f5d5039 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.cc,v 1.27 2001/01/15 22:08:32 steve Exp $" +#ident "$Id: t-dll.cc,v 1.28 2001/03/20 01:44:14 steve Exp $" #endif # include "compiler.h" @@ -78,6 +78,11 @@ static ivl_scope_t find_scope(ivl_scope_t root, const NetScope*cur) return 0; } +ivl_scope_t dll_target::lookup_scope_(const NetScope*cur) +{ + return find_scope(des_.root_, cur); +} + static ivl_nexus_t nexus_sig_make(ivl_signal_t net, unsigned pin) { ivl_nexus_t tmp = new struct ivl_nexus_s; @@ -685,6 +690,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.28 2001/03/20 01:44:14 steve + * Put processes in the proper scope. + * * Revision 1.27 2001/01/15 22:08:32 steve * Add missing NetLogic gate types to ::logic method. * diff --git a/t-dll.h b/t-dll.h index a1dc88a5e..3e979c2d5 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.21 2001/01/15 00:47:02 steve Exp $" +#ident "$Id: t-dll.h,v 1.22 2001/03/20 01:44:14 steve Exp $" #endif # include "target.h" @@ -92,6 +92,8 @@ struct dll_target : public target_t, public expr_scan_t { void expr_const(const NetEConst*); void expr_sfunc(const NetESFunc*); void expr_signal(const NetESignal*); + + ivl_scope_t lookup_scope_(const NetScope*scope); }; /* @@ -247,10 +249,12 @@ struct ivl_nexus_s { /* * All we know about a process it its type (initial or always) and the - * single statement that is it. + * single statement that is it. A process also has a scope, although + * that generally only matters for VPI calls. */ struct ivl_process_s { ivl_process_type_t type_; + ivl_scope_t scope_; ivl_statement_t stmt_; ivl_process_t next_; @@ -365,6 +369,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.22 2001/03/20 01:44:14 steve + * Put processes in the proper scope. + * * Revision 1.21 2001/01/15 00:47:02 steve * Pass scope type information to the target module. * diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index a4baec7b3..30701bccc 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvp_process.c,v 1.1 2001/03/19 01:20:46 steve Exp $" +#ident "$Id: vvp_process.c,v 1.2 2001/03/20 01:44:14 steve Exp $" #endif # include "vvp_priv.h" @@ -98,9 +98,13 @@ static void show_statement(ivl_statement_t net) int draw_process(ivl_process_t net, void*x) { + static unsigned thread_count = 0; + ivl_scope_t scope = ivl_process_scope(net); + + fprintf(vvp_out, " .scope S_%s;\n", ivl_scope_name(scope)); + /* Generate the entry label. Just give the thread a number so that we ar certain the label is unique. */ - static unsigned thread_count = 0; fprintf(vvp_out, "T_%05d\n", thread_count); /* Draw the contents of the thread. */ @@ -132,6 +136,9 @@ int draw_process(ivl_process_t net, void*x) /* * $Log: vvp_process.c,v $ + * Revision 1.2 2001/03/20 01:44:14 steve + * Put processes in the proper scope. + * * Revision 1.1 2001/03/19 01:20:46 steve * Add the tgt-vvp code generator target. *