diff options
author | Marlon James <marlon.james@gmail.com> | 2021-03-03 12:06:53 -0800 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2021-03-04 07:49:28 +0100 |
commit | 062ff5b6a41caf93e03c417e31a8a6471993abf1 (patch) | |
tree | fcc773b7c6a153e911120ee611945bb3347e91c2 /testsuite/vhpi/002load_entrypoint | |
parent | 783cbac7ba4c14aa7e27f28755dccd7e4ee4d54e (diff) | |
download | ghdl-062ff5b6a41caf93e03c417e31a8a6471993abf1.tar.gz ghdl-062ff5b6a41caf93e03c417e31a8a6471993abf1.tar.bz2 ghdl-062ff5b6a41caf93e03c417e31a8a6471993abf1.zip |
VHPI: add tests for loading libraries
Diffstat (limited to 'testsuite/vhpi/002load_entrypoint')
-rw-r--r-- | testsuite/vhpi/002load_entrypoint/mydesign.vhdl | 9 | ||||
-rwxr-xr-x | testsuite/vhpi/002load_entrypoint/testsuite.sh | 32 | ||||
-rw-r--r-- | testsuite/vhpi/002load_entrypoint/vhpi_lib.c | 7 |
3 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/vhpi/002load_entrypoint/mydesign.vhdl b/testsuite/vhpi/002load_entrypoint/mydesign.vhdl new file mode 100644 index 000000000..38fdfda98 --- /dev/null +++ b/testsuite/vhpi/002load_entrypoint/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/vhpi/002load_entrypoint/testsuite.sh b/testsuite/vhpi/002load_entrypoint/testsuite.sh new file mode 100755 index 000000000..bdc2e8a6a --- /dev/null +++ b/testsuite/vhpi/002load_entrypoint/testsuite.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze mydesign.vhdl +elab myentity + +if c_compiler_is_available && ghdl_has_feature myentity vhpi; then + $GHDL --vpi-compile -v gcc -c vhpi_lib.c + $GHDL --vpi-link -v gcc -o vhpi_lib.vhpi vhpi_lib.o + + add_vpi_path + + simulate myentity --vhpi=./vhpi_lib.vhpi:my_startup | tee myentity.out + if grep -q Error myentity.out; then + echo "Error in output" + exit 1; + fi + if grep -q error myentity.out; then + echo "error in output" + exit 1; + fi + if ! grep -q "VHPI lib" myentity.out; then + echo "VHPI Library not loaded" + exit 1; + fi + + rm -f vhpi_lib.vhpi vhpi_lib.o myentity.out +fi +clean + +echo "Test successful" diff --git a/testsuite/vhpi/002load_entrypoint/vhpi_lib.c b/testsuite/vhpi/002load_entrypoint/vhpi_lib.c new file mode 100644 index 000000000..414eac731 --- /dev/null +++ b/testsuite/vhpi/002load_entrypoint/vhpi_lib.c @@ -0,0 +1,7 @@ +#include <stdio.h> +#include <vpi_user.h> + +void my_startup() +{ + printf ("VHPI lib\n"); +} |