diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-04-27 15:31:02 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-04-27 15:31:02 +0200 |
commit | 8a88fdfc881ba6c57759065bd8fe9ebcaf922e9e (patch) | |
tree | 9a03e0d597bc1f3d713cf388a0fe7fe319854456 | |
parent | e857941acd16e3a678296b26e34b4bf330d5239c (diff) | |
download | ghdl-8a88fdfc881ba6c57759065bd8fe9ebcaf922e9e.tar.gz ghdl-8a88fdfc881ba6c57759065bd8fe9ebcaf922e9e.tar.bz2 ghdl-8a88fdfc881ba6c57759065bd8fe9ebcaf922e9e.zip |
Add testcase for vhpidirect.
-rw-r--r-- | testsuite/gna/bug097/getrand.c | 7 | ||||
-rw-r--r-- | testsuite/gna/bug097/tb.vhdl | 14 | ||||
-rwxr-xr-x | testsuite/gna/bug097/testsuite.sh | 14 |
3 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/gna/bug097/getrand.c b/testsuite/gna/bug097/getrand.c new file mode 100644 index 000000000..f0d7cd885 --- /dev/null +++ b/testsuite/gna/bug097/getrand.c @@ -0,0 +1,7 @@ +#include <stdlib.h> + +int +get_rand (void) +{ + return rand(); +} diff --git a/testsuite/gna/bug097/tb.vhdl b/testsuite/gna/bug097/tb.vhdl new file mode 100644 index 000000000..d58580da8 --- /dev/null +++ b/testsuite/gna/bug097/tb.vhdl @@ -0,0 +1,14 @@ +entity tb is +end tb; + +architecture behav of tb is + function get_rand return integer; + attribute foreign of get_rand: function is "VHPIDIRECT ./getrand.so get_rand"; + + function get_rand return integer is + begin + assert false severity failure; + end get_rand; +begin + assert get_rand >= 0 severity note; +end behav; diff --git a/testsuite/gna/bug097/testsuite.sh b/testsuite/gna/bug097/testsuite.sh new file mode 100755 index 000000000..126e39c03 --- /dev/null +++ b/testsuite/gna/bug097/testsuite.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +. ../../testenv.sh + +gcc -c -fPIC getrand.c +gcc -o getrand.so --shared getrand.o + +analyze tb.vhdl +elab_simulate tb + +clean +rm -f getrand.o getrand.so + +echo "Test successful" |