diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 90eb1ea18..8e11d676e 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_priv.cc,v 1.10 2001/10/31 04:27:47 steve Exp $" +#ident "$Id: vpi_priv.cc,v 1.11 2002/01/06 00:48:39 steve Exp $" #endif # include "vpi_priv.h" @@ -122,8 +122,24 @@ vpiHandle vpi_handle(int type, vpiHandle ref) * the specified reference. It is up to the iterate_ method to * allocate a properly formed iterator. */ +static vpiHandle vpi_iterate_global(int type) +{ + switch (type) { + case vpiModule: + return vpip_make_root_iterator(); + + default: + assert(0); + } + + return 0; +} + vpiHandle vpi_iterate(int type, vpiHandle ref) { + if (ref == 0) + return vpi_iterate_global(type); + assert(ref->vpi_type->iterate_); return (ref->vpi_type->iterate_)(type, ref); } @@ -154,6 +170,9 @@ extern "C" void vpi_sim_vcontrol(int operation, va_list ap) /* * $Log: vpi_priv.cc,v $ + * Revision 1.11 2002/01/06 00:48:39 steve + * VPI access to root module scopes. + * * Revision 1.10 2001/10/31 04:27:47 steve * Rewrite the functor type to have fewer functor modes, * and use objects to manage the different types. diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 5a4268806..daeccaf35 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_priv.h,v 1.24 2001/10/31 04:27:47 steve Exp $" +#ident "$Id: vpi_priv.h,v 1.25 2002/01/06 00:48:39 steve Exp $" #endif # include "vpi_user.h" @@ -93,6 +93,7 @@ struct __vpiScope { extern struct __vpiScope* vpip_peek_current_scope(void); extern void vpip_attach_to_current_scope(vpiHandle obj); +extern vpiHandle vpip_make_root_iterator(void); /* * Signals include the variable types (reg, integer, time) and are @@ -241,6 +242,9 @@ extern void vpip_set_time_precision(int pres); /* * $Log: vpi_priv.h,v $ + * Revision 1.25 2002/01/06 00:48:39 steve + * VPI access to root module scopes. + * * Revision 1.24 2001/10/31 04:27:47 steve * Rewrite the functor type to have fewer functor modes, * and use objects to manage the different types. diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index fe0075aaf..3e3021814 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_scope.cc,v 1.10 2001/11/02 05:43:11 steve Exp $" +#ident "$Id: vpi_scope.cc,v 1.11 2002/01/06 00:48:39 steve Exp $" #endif # include "compile.h" @@ -29,6 +29,14 @@ # include # include +static vpiHandle *vpip_root_table_ptr = 0; +static unsigned vpip_root_table_cnt = 0; + +vpiHandle vpip_make_root_iterator(void) +{ + return vpip_make_iterator(vpip_root_table_cnt, vpip_root_table_ptr); +} + static char* scope_get_str(int code, vpiHandle obj) { struct __vpiScope*ref = (struct __vpiScope*)obj; @@ -216,6 +224,12 @@ void compile_scope_decl(char*label, char*type, char*name, char*parent) scope->scope = (struct __vpiScope*)obj; } else { scope->scope = 0x0; + + unsigned cnt = vpip_root_table_cnt + 1; + vpip_root_table_ptr = (vpiHandle*) + realloc(vpip_root_table_ptr, cnt * sizeof(vpiHandle)); + vpip_root_table_ptr[vpip_root_table_cnt] = &scope->base; + vpip_root_table_cnt = cnt; } } @@ -238,6 +252,9 @@ void vpip_attach_to_current_scope(vpiHandle obj) /* * $Log: vpi_scope.cc,v $ + * Revision 1.11 2002/01/06 00:48:39 steve + * VPI access to root module scopes. + * * Revision 1.10 2001/11/02 05:43:11 steve * Comment the scope type parser. * @@ -252,22 +269,5 @@ void vpip_attach_to_current_scope(vpiHandle obj) * * Revision 1.6 2001/07/11 04:43:57 steve * support postpone of $systask parameters. (Stephan Boettcher) - * - * Revision 1.5 2001/06/10 16:47:49 steve - * support scan of scope from VPI. - * - * Revision 1.4 2001/04/18 04:21:23 steve - * Put threads into scopes. - * - * Revision 1.3 2001/04/03 03:46:14 steve - * VPI access time as a decimal string, and - * stub vpi access to the scopes. - * - * Revision 1.2 2001/03/21 05:13:03 steve - * Allow var objects as vpiHandle arguments to %vpi_call. - * - * Revision 1.1 2001/03/18 00:37:55 steve - * Add support for vpi scopes. - * */