aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-02-11 04:07:00 +0100
committerTristan Gingold <tgingold@free.fr>2020-02-11 04:07:00 +0100
commit91516ee5a7b0910d6728d22936e3f669a877e7b8 (patch)
treec91759d7d85c929654f980ba0de307fdf0e15a60 /testsuite
parent03150800332a179319bfa8937b19766f2582cb36 (diff)
downloadghdl-91516ee5a7b0910d6728d22936e3f669a877e7b8.tar.gz
ghdl-91516ee5a7b0910d6728d22936e3f669a877e7b8.tar.bz2
ghdl-91516ee5a7b0910d6728d22936e3f669a877e7b8.zip
testsuite/gna: add a test for #1125
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue1125/etest.vhdl29
-rwxr-xr-xtestsuite/gna/issue1125/testsuite.sh13
2 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/gna/issue1125/etest.vhdl b/testsuite/gna/issue1125/etest.vhdl
new file mode 100644
index 000000000..dd09ef250
--- /dev/null
+++ b/testsuite/gna/issue1125/etest.vhdl
@@ -0,0 +1,29 @@
+library IEEE;
+ use IEEE.std_logic_1164.all;
+ use IEEE.numeric_std.all;
+
+entity etest is
+end;
+
+architecture atest of etest is
+
+function foo(a : std_logic_vector) return unsigned is
+variable v : unsigned(3 downto 0):=(others=>'0') ;
+begin
+ v := v + unsigned(a(1 downto 1));
+ return v;
+end;
+
+begin
+
+ test : process
+ variable v : std_logic_vector(3 downto 0) ;
+ variable w : std_logic_vector(0 to 3);
+ variable x : unsigned(3 downto 0) ;
+ begin
+ x := foo(w);
+ -- x := x + unsigned(w(0 downto 0)) ;
+ wait;
+ end process ; -- test
+
+end;
diff --git a/testsuite/gna/issue1125/testsuite.sh b/testsuite/gna/issue1125/testsuite.sh
new file mode 100755
index 000000000..a58160e59
--- /dev/null
+++ b/testsuite/gna/issue1125/testsuite.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze etest.vhdl
+elab_simulate_failure etest > etest.err
+grep "slice direction" etest.err
+
+clean
+rm -f etest.err
+
+echo "Test successful"