From 8ba1facb667f741b69df11f4e97764b83c8eb368 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 6 Oct 2000 23:11:39 +0000 Subject: [PATCH] Replace data references with function calls. (Venkat) --- t-vvm.cc | 7 +++++-- vpi/Makefile.in | 6 ++++-- vvm/Makefile.in | 4 ++-- vvm/vpi_null.c | 12 ++++++++++-- vvm/vpi_priv.c | 11 +++++++---- vvm/vpi_priv.h | 14 +++++++++----- vvm/vpi_simulation.c | 14 ++++++++++++-- vvm/vpi_systask.c | 19 ++++++++++++++++--- vvm/vpip.def | 8 ++++---- 9 files changed, 69 insertions(+), 26 deletions(-) diff --git a/t-vvm.cc b/t-vvm.cc index 7ff420cfe..b9f2f2054 100644 --- a/t-vvm.cc +++ b/t-vvm.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-vvm.cc,v 1.178 2000/10/06 02:21:35 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.179 2000/10/06 23:11:39 steve Exp $" #endif # include @@ -3170,7 +3170,7 @@ void target_vvm::proc_stask(const NetSTask*net) val = emit_parm_rval(this, net->parm(idx)); } else { - val = string("&vpip_null.base"); + val = string("&(vpip_get_null()->base)"); } defn << " " << ptmp << "[" << idx << "] = " << val << ";" @@ -3385,6 +3385,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.179 2000/10/06 23:11:39 steve + * Replace data references with function calls. (Venkat) + * * Revision 1.178 2000/10/06 02:21:35 steve * sfuncs are char* and are compared with strcmp * diff --git a/vpi/Makefile.in b/vpi/Makefile.in index 40006c695..8db8c8e33 100644 --- a/vpi/Makefile.in +++ b/vpi/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.16 2000/10/04 17:08:31 steve Exp $" +#ident "$Id: Makefile.in,v 1.17 2000/10/06 23:11:39 steve Exp $" # # SHELL = /bin/sh @@ -58,11 +58,13 @@ sys_readmem.o sys_readmem_lex.o sys_vcd.o ifeq (@CYGWIN@,yes) SYSTEM_VPI_LDFLAGS=-Wl,--enable-auto-image-base -L../vvm -lvvm -lvpip + VPI_DEPLIBS=../vvm/libvpip.a else SYSTEM_VPI_LDFLAGS= + VPI_DEPLIBS= endif -system.vpi: $O +system.vpi: $O $(VPI_DEPLIBS) $(CC) -shared -o $@ $O $(SYSTEM_VPI_LDFLAGS) sys_readmem_lex.c: sys_readmem_lex.lex diff --git a/vvm/Makefile.in b/vvm/Makefile.in index a81e47978..1a46be162 100644 --- a/vvm/Makefile.in +++ b/vvm/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.36 2000/10/04 17:08:31 steve Exp $" +#ident "$Id: Makefile.in,v 1.37 2000/10/06 23:11:39 steve Exp $" # # SHELL = /bin/sh @@ -67,7 +67,7 @@ libvvm.a: $O rm -f $@ ar cvq $@ $O -libvpip.a vpip.dll: $P +libvpip.a vpip.dll: $P vpip.def $(CC) -shared -Wl,--enable-auto-image-base,--out-implib,libvpip.a -o vpip.dll vpip.def $P else diff --git a/vvm/vpi_null.c b/vvm/vpi_null.c index bc42bd327..02be3b40b 100644 --- a/vvm/vpi_null.c +++ b/vvm/vpi_null.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_null.c,v 1.3 2000/02/23 02:56:56 steve Exp $" +#ident "$Id: vpi_null.c,v 1.4 2000/10/06 23:11:39 steve Exp $" #endif # include "vpi_priv.h" @@ -32,12 +32,20 @@ static const struct __vpirt vpip_null_rt = { 0 }; -struct __vpiNull vpip_null = { +static struct __vpiNull vpip_null = { { &vpip_null_rt } }; +extern struct __vpiNull *vpip_get_null(void) +{ + return &vpip_null; +} + /* * $Log: vpi_null.c,v $ + * Revision 1.4 2000/10/06 23:11:39 steve + * Replace data references with function calls. (Venkat) + * * Revision 1.3 2000/02/23 02:56:56 steve * Macintosh compilers do not support ident. * diff --git a/vvm/vpi_priv.c b/vvm/vpi_priv.c index 00aee1dd1..786ee4f0d 100644 --- a/vvm/vpi_priv.c +++ b/vvm/vpi_priv.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_priv.c,v 1.9 2000/08/20 17:49:05 steve Exp $" +#ident "$Id: vpi_priv.c,v 1.10 2000/10/06 23:11:39 steve Exp $" #endif # include "vpi_priv.h" @@ -48,7 +48,7 @@ void vpip_calltask(const char*fname, unsigned nparms, vpiHandle*parms) { struct systf_entry*idx; struct __vpiSysTaskCall cur_task; - cur_task.base.vpi_type = &vpip_systask_rt; + cur_task.base.vpi_type = vpip_get_systask_rt(); cur_task.args = parms; cur_task.nargs = nparms; cur_task.res = 0; @@ -80,7 +80,7 @@ void vpip_callfunc(const char*fname, unsigned nres, vpip_bit_t*res, { struct systf_entry*idx; struct __vpiSysTaskCall cur_task; - cur_task.base.vpi_type = &vpip_sysfunc_rt; + cur_task.base.vpi_type = vpip_get_sysfunc_rt(); cur_task.args = parms; cur_task.nargs = nparms; cur_task.res = res; @@ -114,7 +114,7 @@ static int vpip_get_global(int property) { switch (property) { case vpiTimePrecision: - return vpip_simulation_obj.time_precision; + return vpip_get_simulation_obj()->time_precision; default: assert(0); @@ -233,6 +233,9 @@ void vpi_register_systf(const struct t_vpi_systf_data*systf) /* * $Log: vpi_priv.c,v $ + * Revision 1.10 2000/10/06 23:11:39 steve + * Replace data references with function calls. (Venkat) + * * Revision 1.9 2000/08/20 17:49:05 steve * Clean up warnings and portability issues. * diff --git a/vvm/vpi_priv.h b/vvm/vpi_priv.h index d409643e3..034ffcdba 100644 --- a/vvm/vpi_priv.h +++ b/vvm/vpi_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_priv.h,v 1.27 2000/10/04 02:37:44 steve Exp $" +#ident "$Id: vpi_priv.h,v 1.28 2000/10/06 23:11:39 steve Exp $" #endif /* @@ -203,7 +203,7 @@ struct __vpiNull { struct __vpiHandle base; }; -extern struct __vpiNull vpip_null; +extern struct __vpiNull *vpip_get_null(void); /* * This type represents the handle to a Verilog scope. These include @@ -241,8 +241,9 @@ struct __vpiSignal { }; -extern const struct __vpirt vpip_systask_rt; -extern const struct __vpirt vpip_sysfunc_rt; +extern const struct __vpirt *vpip_get_systask_rt(void); +extern const struct __vpirt *vpip_get_sysfunc_rt(void); + struct __vpiSysTaskCall { struct __vpiHandle base; @@ -347,7 +348,7 @@ struct vpip_simulation { short time_precision; }; -extern struct vpip_simulation vpip_simulation_obj; +extern struct vpip_simulation *vpip_get_simulation_obj(void); extern void vpip_set_vlog_info(int argc, char**argv); extern void vpip_init_simulation(); @@ -388,6 +389,9 @@ extern int vpip_finished(); /* * $Log: vpi_priv.h,v $ + * Revision 1.28 2000/10/06 23:11:39 steve + * Replace data references with function calls. (Venkat) + * * Revision 1.27 2000/10/04 02:37:44 steve * Use .def file instead of _dllexport. * diff --git a/vvm/vpi_simulation.c b/vvm/vpi_simulation.c index e8e4a3a2e..3b37472ee 100644 --- a/vvm/vpi_simulation.c +++ b/vvm/vpi_simulation.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_simulation.c,v 1.4 2000/08/20 17:49:05 steve Exp $" +#ident "$Id: vpi_simulation.c,v 1.5 2000/10/06 23:11:39 steve Exp $" #endif # include "vpi_priv.h" @@ -30,7 +30,14 @@ struct vpip_event { struct vpip_event*next; }; -struct vpip_simulation vpip_simulation_obj; +static struct vpip_simulation vpip_simulation_obj; + +struct vpip_simulation *vpip_get_simulation_obj(void) +{ + return &vpip_simulation_obj; +} + + void vpi_sim_control(int func, ...) { @@ -203,6 +210,9 @@ void vpip_simulation_run() /* * $Log: vpi_simulation.c,v $ + * Revision 1.5 2000/10/06 23:11:39 steve + * Replace data references with function calls. (Venkat) + * * Revision 1.4 2000/08/20 17:49:05 steve * Clean up warnings and portability issues. * diff --git a/vvm/vpi_systask.c b/vvm/vpi_systask.c index 82ec7eabf..189a693ff 100644 --- a/vvm/vpi_systask.c +++ b/vvm/vpi_systask.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_systask.c,v 1.6 2000/09/30 03:20:48 steve Exp $" +#ident "$Id: vpi_systask.c,v 1.7 2000/10/06 23:11:39 steve Exp $" #endif # include "vpi_priv.h" @@ -40,7 +40,7 @@ static vpiHandle systask_iter(int type, vpiHandle ref) return vpip_make_iterator(rfp->nargs, rfp->args); } -const struct __vpirt vpip_systask_rt = { +static const struct __vpirt vpip_systask_rt = { vpiSysTaskCall, 0, 0, @@ -50,6 +50,11 @@ const struct __vpirt vpip_systask_rt = { systask_iter }; +const struct __vpirt *vpip_get_systask_rt(void) +{ + return &vpip_systask_rt; +} + /* * A value *can* be put to a vpiSysFuncCall object. This is how the * return value is set. The value that is given should be converted to @@ -81,7 +86,7 @@ static vpiHandle sysfunc_put_value(vpiHandle ref, p_vpi_value val, return 0; } -const struct __vpirt vpip_sysfunc_rt = { +static const struct __vpirt vpip_sysfunc_rt = { vpiSysFuncCall, 0, 0, @@ -91,6 +96,11 @@ const struct __vpirt vpip_sysfunc_rt = { systask_iter }; +const struct __vpirt *vpip_get_sysfunc_rt(void) +{ + return &vpip_sysfunc_rt; +} + #ifdef __CYGWIN32__ #include DECLARE_CYGWIN_DLL(DllMain); @@ -98,6 +108,9 @@ DECLARE_CYGWIN_DLL(DllMain); /* * $Log: vpi_systask.c,v $ + * Revision 1.7 2000/10/06 23:11:39 steve + * Replace data references with function calls. (Venkat) + * * Revision 1.6 2000/09/30 03:20:48 steve * Cygwin port changes from Venkat * diff --git a/vvm/vpip.def b/vvm/vpip.def index 44c14ad29..8eda88fa9 100644 --- a/vvm/vpip.def +++ b/vvm/vpip.def @@ -38,15 +38,15 @@ EXPORTS vpip_make_scope vpip_make_string_const vpip_make_time_var - vpip_null DATA + vpip_get_null vpip_pair_resolve vpip_run_value_changes vpip_set_vlog_info vpip_sim_cancel_event vpip_sim_insert_event vpip_sim_time - vpip_simulation_obj DATA + vpip_get_simulation_obj vpip_simulation_run - vpip_sysfunc_rt DATA - vpip_systask_rt DATA + vpip_get_sysfunc_rt + vpip_get_systask_rt vpip_time_scale