From fa088f8baa30bd550f25e8a03a158c2ea266dfb4 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 28 Nov 1999 18:05:37 +0000 Subject: [PATCH] Set VPI_MODULE_PATH in the target code, if desired. --- t-vvm.cc | 9 ++++++++- verilog.sh | 10 ++++++---- vvm/vvm_calltf.cc | 13 ++++++++++++- vvm/vvm_calltf.h | 6 +++++- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/t-vvm.cc b/t-vvm.cc index 71904b07c..3e100baaf 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) -#ident "$Id: t-vvm.cc,v 1.82 1999/11/28 01:16:19 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.83 1999/11/28 18:05:37 steve Exp $" #endif # include @@ -696,6 +696,10 @@ void target_vvm::end_design(ostream&os, const Design*mod) os << "main()" << endl << "{" << endl; + string vpi_module_path = mod->get_flag("VPI_MODULE_PATH"); + if (vpi_module_path.length() > 0) + os << " vvm_set_module_path(\"" << vpi_module_path << + "\");" << endl; os << " vvm_load_vpi_module(\"system.vpi\");" << endl; os << " vvm_simulation sim;" << endl; os << " design_init(sim);" << endl; @@ -1975,6 +1979,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.83 1999/11/28 18:05:37 steve + * Set VPI_MODULE_PATH in the target code, if desired. + * * Revision 1.82 1999/11/28 01:16:19 steve * gate outputs need to set signal values. * diff --git a/verilog.sh b/verilog.sh index ba2afb500..43e10a337 100644 --- a/verilog.sh +++ b/verilog.sh @@ -40,10 +40,10 @@ functors="" flags="" # If VPI module path aren't set up, warn at least -if test -z "${VPI_MODULE_PATH}" ; then - echo "Missing environment variable VPI_MODULE_PATH."; - echo "To be able to execute, set VPI_MODULE_PATH to ${VPIModulePath}"; -fi +#if test -z "${VPI_MODULE_PATH}" ; then +# echo "Missing environment variable VPI_MODULE_PATH."; +# echo "To be able to execute, set VPI_MODULE_PATH to ${VPIModulePath}"; +#fi # Try to extract given parameters parameter=`getopt D:I:Xxf:o:s:t: "$@"` @@ -68,6 +68,8 @@ done # The rest is filenames verilogFile=$@; +flags="$flags -fVPI_MODULE_PATH=${VPIModulePath}" + if test -z "${verilogFile}" ; then echo "Missing infile"; echo "verilog [-Dmacro[=defn]] [-Iincludepath] [-X] [-x] [-o outputfilename] [-s topmodule] sourcefile[s]" ; diff --git a/vvm/vvm_calltf.cc b/vvm/vvm_calltf.cc index 190f7badd..af26c462a 100644 --- a/vvm/vvm_calltf.cc +++ b/vvm/vvm_calltf.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvm_calltf.cc,v 1.8 1999/10/28 00:47:25 steve Exp $" +#ident "$Id: vvm_calltf.cc,v 1.9 1999/11/28 18:05:37 steve Exp $" #endif # include "vvm_calltf.h" @@ -34,6 +34,13 @@ # define MAX_PATHLEN 1024 +static char*module_path = 0; + +void vvm_set_module_path(const char*path) +{ + if (module_path) free(module_path); + module_path = strdup(path); +} /* * The load_vpi_module function attempts to locate and load the named @@ -57,6 +64,7 @@ void vvm_load_vpi_module(const char*name) { void*mod = 0; const char*path = getenv("VPI_MODULE_PATH"); + if (path == 0) path = module_path; if ((path == 0) || (strchr(name, '/'))) { mod = dlopen(name, RTLD_NOW); @@ -108,6 +116,9 @@ void vvm_load_vpi_module(const char*name) /* * $Log: vvm_calltf.cc,v $ + * Revision 1.9 1999/11/28 18:05:37 steve + * Set VPI_MODULE_PATH in the target code, if desired. + * * Revision 1.8 1999/10/28 00:47:25 steve * Rewrite vvm VPI support to make objects more * persistent, rewrite the simulation scheduler diff --git a/vvm/vvm_calltf.h b/vvm/vvm_calltf.h index f6d9ce61f..53f53a3fb 100644 --- a/vvm/vvm_calltf.h +++ b/vvm/vvm_calltf.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvm_calltf.h,v 1.3 1999/10/28 00:47:25 steve Exp $" +#ident "$Id: vvm_calltf.h,v 1.4 1999/11/28 18:05:37 steve Exp $" #endif # include "vvm.h" @@ -29,11 +29,15 @@ /* * This function loads a vpi module by name. */ +extern void vvm_set_module_path(const char*path); extern void vvm_load_vpi_module(const char*path); /* * $Log: vvm_calltf.h,v $ + * Revision 1.4 1999/11/28 18:05:37 steve + * Set VPI_MODULE_PATH in the target code, if desired. + * * Revision 1.3 1999/10/28 00:47:25 steve * Rewrite vvm VPI support to make objects more * persistent, rewrite the simulation scheduler