aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/sr2903
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2013-12-29 03:27:39 +0100
committerTristan Gingold <tgingold@free.fr>2013-12-29 03:27:39 +0100
commitf4976c9f41903ef09b0225977129660a6391042b (patch)
tree583657b318d1f34375baade33068ab755afb6219 /testsuite/gna/sr2903
parent807135c0ef563a054e4bc042779de1f06c5bc140 (diff)
downloadghdl-f4976c9f41903ef09b0225977129660a6391042b.tar.gz
ghdl-f4976c9f41903ef09b0225977129660a6391042b.tar.bz2
ghdl-f4976c9f41903ef09b0225977129660a6391042b.zip
Add gna tests
Diffstat (limited to 'testsuite/gna/sr2903')
-rw-r--r--testsuite/gna/sr2903/boundcheck.vhdl36
-rwxr-xr-xtestsuite/gna/sr2903/testsuite.sh10
2 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/gna/sr2903/boundcheck.vhdl b/testsuite/gna/sr2903/boundcheck.vhdl
new file mode 100644
index 000000000..ee5b3a66d
--- /dev/null
+++ b/testsuite/gna/sr2903/boundcheck.vhdl
@@ -0,0 +1,36 @@
+library IEEE;
+use IEEE.numeric_std.all;
+
+entity tb is
+end tb;
+
+architecture behavioral of tb is
+
+ subtype int31 is integer range -2**(31-1) to 2**(31-1)-1;
+ type array_7_int31 is array(0 to 6) of int31;
+
+ function ASR(v : integer; n : natural ; nv : natural; nres : natural) return integer is
+ variable tmp : signed(nv downto 0);
+ variable res : signed(nv downto 0);
+ begin
+ tmp := resize(to_signed(v,nv),nv+1);
+ res := shift_right(tmp,n);
+ return to_integer(res(nres-1 downto 0));
+ end;
+
+begin
+
+ software_emulation : process
+ variable test : int31;
+ variable tmp : int31;
+
+ begin
+ report "Start" severity note;
+ tmp := 5965232;
+ -- test := test + ASR(((tmp * 119304647) + 268435456),29,57,31);
+ -- test := test + ASR(((tmp * 178956971) + 268435456),29,57,31);
+ test := test + ASR(((tmp * 59652324) + 268435456),29,57,31);
+ end process;
+
+ end behavioral;
+
diff --git a/testsuite/gna/sr2903/testsuite.sh b/testsuite/gna/sr2903/testsuite.sh
new file mode 100755
index 000000000..347593b6c
--- /dev/null
+++ b/testsuite/gna/sr2903/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze boundcheck.vhdl
+elab_simulate_failure tb
+
+clean
+
+echo "Test successful"