aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2013-12-29 11:52:07 +0100
committerTristan Gingold <tgingold@free.fr>2013-12-29 11:52:07 +0100
commitc2a20bfff0896a33abed1cf2c4d4f1551457e710 (patch)
tree3371081eb726060a81dc87a00188576628a4aaff /testsuite/gna
parentc8ec04b7ddb029a08bb065cb96902c2fcbfde335 (diff)
downloadghdl-c2a20bfff0896a33abed1cf2c4d4f1551457e710.tar.gz
ghdl-c2a20bfff0896a33abed1cf2c4d4f1551457e710.tar.bz2
ghdl-c2a20bfff0896a33abed1cf2c4d4f1551457e710.zip
Fix crash in bug21078.
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/bug21078/foo.vhdl68
-rwxr-xr-xtestsuite/gna/bug21078/testsuite.sh9
2 files changed, 77 insertions, 0 deletions
diff --git a/testsuite/gna/bug21078/foo.vhdl b/testsuite/gna/bug21078/foo.vhdl
new file mode 100644
index 000000000..c490c8f4b
--- /dev/null
+++ b/testsuite/gna/bug21078/foo.vhdl
@@ -0,0 +1,68 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity foo is
+end entity;
+
+architecture fum of foo is
+
+ signal ia: std_logic_vector(15 downto 0);
+ signal clock: std_logic:='0';
+ signal cw: unsigned(15 downto 0):=(others => '0');
+begin
+
+ -- counter and cw are converted to UNSIGNED to use numeric_std "+"
+
+
+CTR: process (clock)
+
+ variable counter : unsigned (15 downto 0) := x"0000";
+ variable op : std_logic_vector (7 downto 0);
+
+ begin
+
+ if clock'event and clock='1' then
+
+ op := std_logic_vector(cw (15 downto 8));
+
+ -- This if statement is misbehaving
+ if (op = x"20") then
+ counter := counter + cw (7 downto 0);
+ end if;
+
+ counter := counter + 2;
+
+ ia <= std_logic_vector(counter);
+
+ end if;
+
+ end process;
+
+CLK: process
+ begin
+ if Now <= 200 ns then
+ wait for 10 ns;
+ clock <= not clock;
+ else
+ wait;
+ end if;
+
+ end process;
+
+STIMULUS:
+ process (clock)
+ begin
+ if clk'event and clock = '1' then
+ if Now = 110 ns then
+ cw <= X"200F";
+ else
+ cw <= (others => '0');
+ end if;
+ end if;
+ end process;
+
+end architecture;
+
+
+
diff --git a/testsuite/gna/bug21078/testsuite.sh b/testsuite/gna/bug21078/testsuite.sh
new file mode 100755
index 000000000..88cd64e80
--- /dev/null
+++ b/testsuite/gna/bug21078/testsuite.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze_failure foo.vhdl
+
+clean
+
+echo "Test successful"