From a1ad6d4b51a5e505ce938c4a3a58a202b4f94831 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Sun, 28 Oct 2018 12:44:09 -0700 Subject: [PATCH] Support IVERILOG_VPI_MODULE_PATH environment variable --- vvp/main.cc | 22 ++++++++++++++++++++++ vvp/vvp.man.in | 7 +++++++ 2 files changed, 29 insertions(+) diff --git a/vvp/main.cc b/vvp/main.cc index acde2cb88..b0a5bb633 100644 --- a/vvp/main.cc +++ b/vvp/main.cc @@ -336,6 +336,28 @@ int main(int argc, char*argv[]) flag_errors += 1; } + if (char *var = ::getenv("IVERILOG_VPI_MODULE_PATH")) { + char *ptr = var; + char *end = var+strlen(var); + int len = 0; + while (ptr <= end) { + if (*ptr == 0 || *ptr == ':' || *ptr == ';') { + if (len > 0) { + if (vpip_module_path_cnt >= VPIP_MODULE_PATH_MAX) { + fprintf(stderr, "Too many paths specified\n"); + return -1; + } + vpip_module_path[vpip_module_path_cnt++] = strndup(var, len); + } + len = 0; + var = ptr+1; + } else { + len++; + } + ptr++; + } + } + #ifdef __MINGW32__ /* Calculate the module path from the path to the command. This is necessary because of the installation process on diff --git a/vvp/vvp.man.in b/vvp/vvp.man.in index d08b937d0..add5faf4e 100644 --- a/vvp/vvp.man.in +++ b/vvp/vvp.man.in @@ -166,6 +166,13 @@ select lxt format, which is far more compact, though limited to GTKWave or compatible viewers. It can also be used to suppress VCD output, a time-saver for regression tests. +.TP 8 +.B IVERILOG_VPI_MODULE_PATH=\fI/some/path:/some/other/path\fP +This adds additional components to the VPI module search path. Paths +specified in this way are searched after paths specified with \-M, but +before the default search path. Multiple paths can be separated with +colons or semicolons. + .SH INTERACTIVE MODE .PP The simulation engine supports an interactive mode. The user may