diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-01-19 04:23:32 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-01-19 04:23:32 +0100 |
commit | b329c6823455e151fa85c42393973809729a1f88 (patch) | |
tree | 788b7d252706fa42474c8511af23aef16f370df0 /testsuite/gna | |
parent | 097cce34b39f2817d8f3d19b66f5b5aee1d41868 (diff) | |
download | ghdl-b329c6823455e151fa85c42393973809729a1f88.tar.gz ghdl-b329c6823455e151fa85c42393973809729a1f88.tar.bz2 ghdl-b329c6823455e151fa85c42393973809729a1f88.zip |
Add testcase for #258
Diffstat (limited to 'testsuite/gna')
-rw-r--r-- | testsuite/gna/issue258/length_tb1.vhdl | 16 | ||||
-rw-r--r-- | testsuite/gna/issue258/range_tb.vhdl | 24 | ||||
-rw-r--r-- | testsuite/gna/issue258/range_tb1.vhdl | 18 | ||||
-rwxr-xr-x | testsuite/gna/issue258/testsuite.sh | 13 |
4 files changed, 71 insertions, 0 deletions
diff --git a/testsuite/gna/issue258/length_tb1.vhdl b/testsuite/gna/issue258/length_tb1.vhdl new file mode 100644 index 000000000..af2a08a8f --- /dev/null +++ b/testsuite/gna/issue258/length_tb1.vhdl @@ -0,0 +1,16 @@ +entity length_tb1 is +end length_tb1; + +architecture tb of length_tb1 is +begin + process + variable s : string (1 to 4); + constant c : string := "hello"; + begin + + -- Behaves like 32-bit arithmetic with modular truncation + s := c; + + wait; -- forever + end process; +end tb; diff --git a/testsuite/gna/issue258/range_tb.vhdl b/testsuite/gna/issue258/range_tb.vhdl new file mode 100644 index 000000000..ceb8cc8cb --- /dev/null +++ b/testsuite/gna/issue258/range_tb.vhdl @@ -0,0 +1,24 @@ +entity range_tb is +end range_tb; + +architecture tb of range_tb is +begin + process + variable i : integer; + begin + + -- Behaves like 32-bit arithmetic with modular truncation + i := integer'low; + report integer'image(i); + i := integer'low-1; + report integer'image(i); + + -- Produces the error "overflow detected" + i := integer'low; + report integer'image(i); + i := i-1; + report integer'image(i); + + wait; -- forever + end process; +end tb; diff --git a/testsuite/gna/issue258/range_tb1.vhdl b/testsuite/gna/issue258/range_tb1.vhdl new file mode 100644 index 000000000..6d67d8c42 --- /dev/null +++ b/testsuite/gna/issue258/range_tb1.vhdl @@ -0,0 +1,18 @@ +entity range_tb1 is +end range_tb1; + +architecture tb of range_tb1 is +begin + process + variable i : integer; + begin + + -- Behaves like 32-bit arithmetic with modular truncation + i := integer'low; + report integer'image(i); + i := integer'low-1; + report integer'image(i); + + wait; -- forever + end process; +end tb; diff --git a/testsuite/gna/issue258/testsuite.sh b/testsuite/gna/issue258/testsuite.sh new file mode 100755 index 000000000..9adbbdc66 --- /dev/null +++ b/testsuite/gna/issue258/testsuite.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze range_tb1.vhdl +elab_simulate_failure range_tb1 + +analyze range_tb.vhdl +elab_simulate_failure range_tb + +clean + +echo "Test successful" |