aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue2141/test3.vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-28 07:45:46 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-28 08:06:14 +0200
commit9e589aa557334c56af0b180341ce490da96980b3 (patch)
tree5d9dba817896a61d882eefab54963b63f107eeab /testsuite/gna/issue2141/test3.vhdl
parentc46da99e4230131af5a52700740d6f79f034b775 (diff)
downloadghdl-9e589aa557334c56af0b180341ce490da96980b3.tar.gz
ghdl-9e589aa557334c56af0b180341ce490da96980b3.tar.bz2
ghdl-9e589aa557334c56af0b180341ce490da96980b3.zip
testsuite/gna: add a test for #2141
Diffstat (limited to 'testsuite/gna/issue2141/test3.vhdl')
-rw-r--r--testsuite/gna/issue2141/test3.vhdl35
1 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/gna/issue2141/test3.vhdl b/testsuite/gna/issue2141/test3.vhdl
new file mode 100644
index 000000000..61519d9e8
--- /dev/null
+++ b/testsuite/gna/issue2141/test3.vhdl
@@ -0,0 +1,35 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity test3 is
+end;
+
+architecture BHV of test3 is
+ type array_t is array( natural range <> ) of bit_vector;
+ type arry_arry_t is array( natural range <> ) of array_t;
+
+ function get_min( a : arry_arry_t) return bit_vector is
+ variable res : a'element'element; -- fail@AHDL
+ --variable res : bit_vector(a'element'element'range); -- success@AHDL
+ --variable res : bit_vector(7 downto 0); -- success@GHDL
+ begin
+ res:=a(a'left)(a'element'left);
+ for i in a'range loop
+ for j in a'element'range loop
+ if (a(i)(j)<res) then
+ res:=a(i)(j);
+ end if;
+ end loop;
+ end loop;
+ return res;
+ end function get_min;
+
+ signal m2x2 : arry_arry_t(0 to 1)(0 to 1)(7 downto 0):=((x"01",x"02"),(x"80",x"10"));
+ signal m_min : m2x2'element'element; -- success@AHDL
+ --signal m_min : bit_vector(7 downto 0); -- success@GHDL
+
+begin
+
+ m_min <= get_min(m2x2);
+
+end;