aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue1589/ent.vhdl35
-rwxr-xr-xtestsuite/gna/issue1589/testsuite.sh11
2 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/gna/issue1589/ent.vhdl b/testsuite/gna/issue1589/ent.vhdl
new file mode 100644
index 000000000..d4d9882d1
--- /dev/null
+++ b/testsuite/gna/issue1589/ent.vhdl
@@ -0,0 +1,35 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity ent is
+end ent;
+
+architecture ent of ent is
+
+ type integer_array_t is array (natural range <>) of integer;
+ type integer_2d_array_t is array (natural range <>) of integer_array_t;
+ type std_logic_array_t is array (natural range <>) of std_logic_vector;
+
+ constant test0 : integer_array_t := (0, 1, 2, 3); -- OK
+
+ -- array of arrays fail if type declaration has no size whatsoever
+ constant test1 : integer_2d_array_t := ((0, 1, 2, 3), (0, 1, 2, 3)); -- Fails
+ constant test2 : std_logic_array_t := ( x"10", x"11"); -- Fails
+
+ -- Constraining the std_logic_vector but not the array length also fails
+ subtype byte is std_logic_vector(7 downto 0);
+ constant test3 : std_logic_array_t := ( byte'(x"10"), byte'(x"10")); -- Fails
+
+ -- Constraining the std_logic_vector via subtype AND the array length also fails
+ constant test4 : std_logic_array_t(0 to 1) := ( byte'(x"10"), byte'(x"10")); -- Fails
+
+ -- If everything in constrained at the type declaration it works:
+ constant test5 : std_logic_array_t(0 to 1)(7 downto 0) := ( byte'(x"10"), byte'(x"10")); -- Works
+ constant test6 : std_logic_array_t(0 to 1)(byte'range) := ( byte'(x"10"), byte'(x"10")); -- Works
+ constant test7 : std_logic_array_t(0 to 1)(byte'range) := ( x"10", x"10"); -- Works
+
+ -- Interestingly, if array length is left unconstrained but the with not it works:
+ constant test8 : std_logic_array_t(open)(7 downto 0) := ( x"10", x"11"); -- Works
+
+begin
+end ent;
diff --git a/testsuite/gna/issue1589/testsuite.sh b/testsuite/gna/issue1589/testsuite.sh
new file mode 100755
index 000000000..bda8f5d14
--- /dev/null
+++ b/testsuite/gna/issue1589/testsuite.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze ent.vhdl
+elab_simulate ent
+
+clean
+
+echo "Test successful"