diff options
author | Marlon James <marlon.james@gmail.com> | 2021-03-01 12:44:02 -0800 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2021-03-02 07:50:54 +0100 |
commit | a03aedddf650f923b06ebacb441a713930cd63e1 (patch) | |
tree | 13056350de2379e39802cda292c7bc023779c67f /testsuite/vpi | |
parent | f5e3ef10265440a3efc95281fef295cba6aab8a9 (diff) | |
download | ghdl-a03aedddf650f923b06ebacb441a713930cd63e1.tar.gz ghdl-a03aedddf650f923b06ebacb441a713930cd63e1.tar.bz2 ghdl-a03aedddf650f923b06ebacb441a713930cd63e1.zip |
VPI: support loading multiple libraries
Diffstat (limited to 'testsuite/vpi')
-rw-r--r-- | testsuite/vpi/vpi005/mydesign.vhdl | 9 | ||||
-rwxr-xr-x | testsuite/vpi/vpi005/testsuite.sh | 35 | ||||
-rw-r--r-- | testsuite/vpi/vpi005/vpi1.c | 13 | ||||
-rw-r--r-- | testsuite/vpi/vpi005/vpi2.c | 13 |
4 files changed, 70 insertions, 0 deletions
diff --git a/testsuite/vpi/vpi005/mydesign.vhdl b/testsuite/vpi/vpi005/mydesign.vhdl new file mode 100644 index 000000000..38fdfda98 --- /dev/null +++ b/testsuite/vpi/vpi005/mydesign.vhdl @@ -0,0 +1,9 @@ +library ieee ; +use ieee.std_logic_1164.all; + +entity myentity is +end myentity; + +architecture arch of myentity is +begin +end arch; diff --git a/testsuite/vpi/vpi005/testsuite.sh b/testsuite/vpi/vpi005/testsuite.sh new file mode 100755 index 000000000..b692167c9 --- /dev/null +++ b/testsuite/vpi/vpi005/testsuite.sh @@ -0,0 +1,35 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze mydesign.vhdl +elab myentity + +if c_compiler_is_available && ghdl_has_feature myentity vpi; then + $GHDL --vpi-compile -v gcc -c vpi1.c + $GHDL --vpi-link -v gcc -o vpi1.vpi vpi1.o + + $GHDL --vpi-compile -v gcc -c vpi2.c + $GHDL --vpi-link -v gcc -o vpi2.vpi vpi2.o + + add_vpi_path + + simulate myentity --vpi=./vpi1.vpi --vpi=./vpi2.vpi | tee myentity.out + if grep -q error myentity.out; then + echo "error in output" + exit 1; + fi + if ! grep -q "VPI lib 1" myentity.out; then + echo "VPI Library 1 not loaded" + exit 1; + fi + if ! grep -q "VPI lib 2" myentity.out; then + echo "VPI Library 2 not loaded" + exit 1; + fi + + rm -f vpi1.vpi vpi1.o vpi2.vpi vpi2.o myentity.out +fi +clean + +echo "Test successful" diff --git a/testsuite/vpi/vpi005/vpi1.c b/testsuite/vpi/vpi005/vpi1.c new file mode 100644 index 000000000..f2cccd286 --- /dev/null +++ b/testsuite/vpi/vpi005/vpi1.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <vpi_user.h> + +void my_startup() +{ + printf ("VPI lib 1\n"); +} + +void (*vlog_startup_routines[]) () = +{ + my_startup, + 0 +}; diff --git a/testsuite/vpi/vpi005/vpi2.c b/testsuite/vpi/vpi005/vpi2.c new file mode 100644 index 000000000..e41469b82 --- /dev/null +++ b/testsuite/vpi/vpi005/vpi2.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <vpi_user.h> + +void my_startup() +{ + printf ("VPI lib 2\n"); +} + +void (*vlog_startup_routines[]) () = +{ + my_startup, + 0 +}; |