aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/vpi/vpi005/mydesign.vhdl9
-rwxr-xr-xtestsuite/vpi/vpi005/testsuite.sh35
-rw-r--r--testsuite/vpi/vpi005/vpi1.c13
-rw-r--r--testsuite/vpi/vpi005/vpi2.c13
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
+};