aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-03-14 07:27:00 +0100
committerTristan Gingold <tgingold@free.fr>2015-03-14 07:27:00 +0100
commitcf2ab2cf781a5c689739d57097d6da7ea6e710a0 (patch)
tree250447e93cb38e3bca1f766bf255c2cbfa1393f6 /testsuite
parentfb10c3db8616f63ed33ba3d2d0f62bc0514ac536 (diff)
downloadghdl-cf2ab2cf781a5c689739d57097d6da7ea6e710a0.tar.gz
ghdl-cf2ab2cf781a5c689739d57097d6da7ea6e710a0.tar.bz2
ghdl-cf2ab2cf781a5c689739d57097d6da7ea6e710a0.zip
Add reproducer for ticket40.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/ticket40/generic_when.vhdl26
-rw-r--r--testsuite/gna/ticket40/generic_when_test1.vhdl37
-rw-r--r--testsuite/gna/ticket40/generic_when_test2.vhdl37
-rwxr-xr-xtestsuite/gna/ticket40/testsuite.sh9
4 files changed, 109 insertions, 0 deletions
diff --git a/testsuite/gna/ticket40/generic_when.vhdl b/testsuite/gna/ticket40/generic_when.vhdl
new file mode 100644
index 000000000..46a9cfaea
--- /dev/null
+++ b/testsuite/gna/ticket40/generic_when.vhdl
@@ -0,0 +1,26 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+use std.textio.all;
+
+entity GENERIC_WHEN is
+ generic( FOO : std_logic_vector(1 downto 0) );
+ port( IN1 : in std_logic_vector(1 downto 0);
+ OUT1 : out std_logic_vector(1 downto 0) );
+end GENERIC_WHEN;
+
+architecture BEHAVIOUR of GENERIC_WHEN is
+begin
+ PR1:
+ process( IN1 )
+ variable l : line;
+ begin
+ case IN1 is
+ when FOO => OUT1 <= FOO; write(l, string'("FOO")); writeline(output, l);
+ --when "00" => write(l, string'("00")); writeline(output, l);
+ when "01" => write(l, string'("01")); writeline(output, l);
+ when others => write(l, string'("other")); writeline(output, l);
+ end case;
+ end process PR1;
+end BEHAVIOUR;
+
diff --git a/testsuite/gna/ticket40/generic_when_test1.vhdl b/testsuite/gna/ticket40/generic_when_test1.vhdl
new file mode 100644
index 000000000..6fcf4843f
--- /dev/null
+++ b/testsuite/gna/ticket40/generic_when_test1.vhdl
@@ -0,0 +1,37 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+use std.textio.all;
+
+--use work.GENERIC_WHEN.all;
+
+entity TEST1 is
+begin
+end entity TEST1;
+
+architecture BEHAVIOUR of TEST1 is
+ component GENERIC_WHEN is
+ generic( FOO : std_logic_vector(1 downto 0) );
+ port( IN1 : in std_logic_vector(1 downto 0);
+ OUT1 : out std_logic_vector(1 downto 0) );
+ end component GENERIC_WHEN;
+
+ signal S1 : std_logic_vector(1 downto 0);
+ signal S2 : std_logic_vector(1 downto 0);
+begin
+
+ GENERIC_WHEN_INST : GENERIC_WHEN
+ generic map ( FOO => "00" )
+ port map ( IN1 => S1,
+ OUT1 => S2 );
+ process
+ variable l : line;
+ begin
+ S1 <= "01";
+ writeline(output, l);
+ wait;
+ end process;
+
+end architecture BEHAVIOUR;
+
diff --git a/testsuite/gna/ticket40/generic_when_test2.vhdl b/testsuite/gna/ticket40/generic_when_test2.vhdl
new file mode 100644
index 000000000..2863bd69e
--- /dev/null
+++ b/testsuite/gna/ticket40/generic_when_test2.vhdl
@@ -0,0 +1,37 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+use std.textio.all;
+
+--use work.GENERIC_WHEN.all;
+
+entity TEST2 is
+begin
+end entity TEST2;
+
+architecture BEHAVIOUR of TEST2 is
+ component GENERIC_WHEN is
+ generic( FOO : std_logic_vector(1 downto 0) );
+ port( IN1 : in std_logic_vector(1 downto 0);
+ OUT1 : out std_logic_vector(1 downto 0) );
+ end component GENERIC_WHEN;
+
+ signal S1 : std_logic_vector(1 downto 0);
+ signal S2 : std_logic_vector(1 downto 0);
+begin
+
+ GENERIC_WHEN_INST : GENERIC_WHEN
+ generic map ( FOO => "0" & "0")
+ port map ( IN1 => S1,
+ OUT1 => S2 );
+ process
+ variable l : line;
+ begin
+ S1 <= "01";
+ writeline(output, l);
+ wait;
+ end process;
+
+end architecture BEHAVIOUR;
+
diff --git a/testsuite/gna/ticket40/testsuite.sh b/testsuite/gna/ticket40/testsuite.sh
new file mode 100755
index 000000000..9368ff366
--- /dev/null
+++ b/testsuite/gna/ticket40/testsuite.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze_failure generic_when.vhdl
+
+clean
+
+echo "Test successful"