diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-08-04 08:51:48 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-08-04 08:51:48 +0200 |
commit | f9e7eba918f5026fde6af557e574e7731bb73d8c (patch) | |
tree | 6a198d8a66ffd32411f0f6a47859879b04af185c /testsuite/gna | |
parent | cf22e6dd1fc0fd7fea72252f8c1ae9d4a3c431cd (diff) | |
download | ghdl-f9e7eba918f5026fde6af557e574e7731bb73d8c.tar.gz ghdl-f9e7eba918f5026fde6af557e574e7731bb73d8c.tar.bz2 ghdl-f9e7eba918f5026fde6af557e574e7731bb73d8c.zip |
testsuite/gna: add test and close #1589
Diffstat (limited to 'testsuite/gna')
-rw-r--r-- | testsuite/gna/issue1589/ent.vhdl | 35 | ||||
-rwxr-xr-x | testsuite/gna/issue1589/testsuite.sh | 11 |
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" |