aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/sr2903/boundcheck.vhdl
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/gna/sr2903/boundcheck.vhdl')
-rw-r--r--testsuite/gna/sr2903/boundcheck.vhdl36
1 files changed, 36 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;
+