diff options
author | Tristan Gingold <tgingold@free.fr> | 2013-12-29 03:27:39 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2013-12-29 03:27:39 +0100 |
commit | f4976c9f41903ef09b0225977129660a6391042b (patch) | |
tree | 583657b318d1f34375baade33068ab755afb6219 /testsuite/gna/sr2903 | |
parent | 807135c0ef563a054e4bc042779de1f06c5bc140 (diff) | |
download | ghdl-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.vhdl | 36 | ||||
-rwxr-xr-x | testsuite/gna/sr2903/testsuite.sh | 10 |
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" |