aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1081
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-01-12 15:34:46 +0100
committerTristan Gingold <tgingold@free.fr>2020-01-12 15:34:46 +0100
commitbd4c31c595f3d26d63883f9734a818d25ffd664a (patch)
treeea9203f4aa1f67646b3fab63bd1ff9e1633ed2a7 /testsuite/synth/issue1081
parentabed55fed7722b0a22bffe59ef70c4d8e0b8a76a (diff)
downloadghdl-bd4c31c595f3d26d63883f9734a818d25ffd664a.tar.gz
ghdl-bd4c31c595f3d26d63883f9734a818d25ffd664a.tar.bz2
ghdl-bd4c31c595f3d26d63883f9734a818d25ffd664a.zip
testsuite/synth: add a test for #1081
Diffstat (limited to 'testsuite/synth/issue1081')
-rw-r--r--testsuite/synth/issue1081/test.vhdl33
-rwxr-xr-xtestsuite/synth/issue1081/testsuite.sh11
2 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/synth/issue1081/test.vhdl b/testsuite/synth/issue1081/test.vhdl
new file mode 100644
index 000000000..b946f9f82
--- /dev/null
+++ b/testsuite/synth/issue1081/test.vhdl
@@ -0,0 +1,33 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity test is
+ port(
+ clk: in std_ulogic;
+ a_in : in std_ulogic_vector(1 downto 0);
+ b_out : out std_ulogic_vector(2 downto 0)
+ );
+end test;
+
+architecture rtl of test is
+ function test_fn(a: std_ulogic_vector(1 downto 0)) return std_ulogic_vector is
+ variable n : integer range 0 to 3;
+ begin
+ case a is
+ when "11" =>
+ n := 0;
+ when "10" =>
+ n:= 1;
+ when others =>
+ --n := 0;
+ return "000";
+ end case;
+ return "1" & std_ulogic_vector(to_unsigned(n, 2));
+ end;
+begin
+ process(clk)
+ begin
+ b_out <= test_fn(a_in);
+ end process;
+end;
diff --git a/testsuite/synth/issue1081/testsuite.sh b/testsuite/synth/issue1081/testsuite.sh
new file mode 100755
index 000000000..a4c28bcd4
--- /dev/null
+++ b/testsuite/synth/issue1081/testsuite.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+for t in test; do
+ synth $t.vhdl -e $t > syn_$t.vhdl
+ analyze syn_$t.vhdl
+ clean
+done
+
+echo "Test successful"