aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-08-25 20:21:25 +0200
committerTristan Gingold <tgingold@free.fr>2020-08-26 04:48:18 +0200
commit85f04269f83e6ecfbd0301bdbdb574f388cac6e2 (patch)
tree3d1ece09b0a9a0a8d1b97b58c6e8183928cf5cb4 /testsuite
parent2559d822bce164556652e616611a93590fd241c6 (diff)
downloadghdl-85f04269f83e6ecfbd0301bdbdb574f388cac6e2.tar.gz
ghdl-85f04269f83e6ecfbd0301bdbdb574f388cac6e2.tar.bz2
ghdl-85f04269f83e6ecfbd0301bdbdb574f388cac6e2.zip
testsuite/gna: add a test for #1440
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue1440/tb2.vhdl39
-rwxr-xr-xtestsuite/gna/issue1440/testsuite.sh11
2 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/gna/issue1440/tb2.vhdl b/testsuite/gna/issue1440/tb2.vhdl
new file mode 100644
index 000000000..9d656bfa9
--- /dev/null
+++ b/testsuite/gna/issue1440/tb2.vhdl
@@ -0,0 +1,39 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity tb2 is
+end;
+
+architecture tb of tb2 is
+ signal cnt, prev : std_logic_vector(3 downto 0) := (others=>'0');
+
+ function tostr (v : std_logic_vector) return string
+ is
+ alias av : std_logic_vector (1 to v'length) is v;
+ variable res : string (1 to v'length);
+ begin
+ for i in av'range loop
+ case av (i) is
+ when '0' => res (i) := '0';
+ when '1' => res (i) := '1';
+ when others => res (i) := '?';
+ end case;
+ end loop;
+ return res;
+ end tostr;
+begin
+ process
+ begin
+ for i in 0 to 20 loop
+ wait for 1 ns;
+ cnt <= std_logic_vector(unsigned(cnt) + 1);
+ prev <= cnt;
+ assert false
+ report "value=" & tostr(cnt) & " last_value=" & tostr(cnt'last_value)
+ severity note;
+ assert prev = cnt'last_value severity failure;
+ end loop;
+ wait;
+ end process;
+end;
diff --git a/testsuite/gna/issue1440/testsuite.sh b/testsuite/gna/issue1440/testsuite.sh
index fdbd32d58..1c1885460 100755
--- a/testsuite/gna/issue1440/testsuite.sh
+++ b/testsuite/gna/issue1440/testsuite.sh
@@ -6,6 +6,17 @@ export GHDL_STD_FLAGS=--std=08
analyze tb_last_value_bug.vhdl
elab_simulate tb_last_value_bug --stop-time=50ns
+analyze tb2.vhdl
+elab_simulate tb2
+
+clean
+
+export GHDL_STD_FLAGS=--std=87
+
+analyze tb2.vhdl
+elab_simulate_failure tb2
+
clean
+
echo "Test successful"