From 79d140f39eb30e78655ecf448df8be48d22f6af3 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 21 Jul 2022 21:35:27 +0200 Subject: testsuite/gna: add a test for #2136 --- testsuite/gna/issue2136/repro1.vhdl | 24 ++++++++++++++++++++++++ testsuite/gna/issue2136/test.vhdl | 32 ++++++++++++++++++++++++++++++++ testsuite/gna/issue2136/testsuite.sh | 14 ++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 testsuite/gna/issue2136/repro1.vhdl create mode 100644 testsuite/gna/issue2136/test.vhdl create mode 100755 testsuite/gna/issue2136/testsuite.sh (limited to 'testsuite') diff --git a/testsuite/gna/issue2136/repro1.vhdl b/testsuite/gna/issue2136/repro1.vhdl new file mode 100644 index 000000000..7c7867b53 --- /dev/null +++ b/testsuite/gna/issue2136/repro1.vhdl @@ -0,0 +1,24 @@ +entity repro1 is +end; + +architecture BHV of repro1 is + type matrixType is array(natural range <>) of bit_vector; + + function get_min( a : matrixType) return bit_vector is + variable res : a'element; + begin + res:=a(a'left); + return res; + end function get_min; + + signal matrix1 : matrixType(0 to 1)(7 downto 0):=(x"80",x"10"); +begin + + process + variable min1 : bit_vector (7 downto 0); + begin + min1 := get_min(matrix1); + assert min1 = x"80" severity failure; + wait; + end process; +end; diff --git a/testsuite/gna/issue2136/test.vhdl b/testsuite/gna/issue2136/test.vhdl new file mode 100644 index 000000000..12560eaaa --- /dev/null +++ b/testsuite/gna/issue2136/test.vhdl @@ -0,0 +1,32 @@ +library ieee; +use ieee.std_logic_1164.all; +--use ieee.std_logic_arith.all; +--use ieee.std_logic_unsigned.all; + +entity test is +end; + +architecture BHV of test is + type matrixType is array(natural range <>) of std_logic_vector; + + function get_min( a : matrixType) return std_logic_vector is + variable res : a'element; + begin + report "a: " & natural'image(a'left) & natural'image (a'right); + res:=a(a'left); + for i in a'range loop + if (a(i)