diff options
-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" |