aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-09-03 08:02:42 +0200
committerTristan Gingold <tgingold@free.fr>2021-09-03 08:06:30 +0200
commit47c2c52eaa76a7729b99c291327b3c662e5d5917 (patch)
treed6b60a5cf55295e8e1824ab8881666affa36cfb0
parentce7148d0631713cacd283e1fc91da1686d2a9d24 (diff)
downloadghdl-47c2c52eaa76a7729b99c291327b3c662e5d5917.tar.gz
ghdl-47c2c52eaa76a7729b99c291327b3c662e5d5917.tar.bz2
ghdl-47c2c52eaa76a7729b99c291327b3c662e5d5917.zip
testsuite/gna: add a test for #1836
-rw-r--r--testsuite/gna/issue1836/test.vhdl26
-rw-r--r--testsuite/gna/issue1836/test2.vhdl25
-rwxr-xr-xtestsuite/gna/issue1836/testsuite.sh14
3 files changed, 65 insertions, 0 deletions
diff --git a/testsuite/gna/issue1836/test.vhdl b/testsuite/gna/issue1836/test.vhdl
new file mode 100644
index 000000000..b2561db50
--- /dev/null
+++ b/testsuite/gna/issue1836/test.vhdl
@@ -0,0 +1,26 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity test is
+end entity test;
+
+architecture beh of test is
+ type t_slv_array is array (natural range <>) of std_logic_vector;
+ constant c_test_val : t_slv_array(0 to 1)(15 downto 0) := (others => x"BBBB");
+begin
+
+ process
+ procedure test_proc(test_val : in t_slv_array) is
+ variable v_val : t_slv_array(0 to test_val'length)(15 downto 0);
+ begin
+ v_val(0) := x"AAAA";
+ v_val(1 to test_val'length) := test_val;
+ assert v_val(0) = x"AAAA" report "Incorrect value, v_val is: " & to_hstring(v_val(0)) & " " & to_hstring(v_val(1)) & " " & to_hstring(v_val(2)) severity failure;
+ end procedure;
+ begin
+ test_proc(c_test_val);
+ wait;
+ end process;
+
+end architecture beh;
diff --git a/testsuite/gna/issue1836/test2.vhdl b/testsuite/gna/issue1836/test2.vhdl
new file mode 100644
index 000000000..0e838f54b
--- /dev/null
+++ b/testsuite/gna/issue1836/test2.vhdl
@@ -0,0 +1,25 @@
+entity test2 is
+end entity test2;
+
+architecture beh of test2 is
+ type t_bv_array is array (natural range <>) of bit_vector;
+ constant c_test_val : t_bv_array(0 to 1)(15 downto 0) := (others => x"BBBB");
+begin
+
+ process
+ procedure test_proc(test_val : in t_bv_array) is
+ variable v_val : t_bv_array(0 to test_val'length)(15 downto 0);
+ begin
+ v_val(0) := x"AAAA";
+ v_val(1 to test_val'length) := test_val;
+-- v_val(1) := test_val(0);
+-- v_val(2) := test_val(1);
+ report "v_val is: " & to_hstring(v_val(0)) & " " & to_hstring(v_val(1)) & " " & to_hstring(v_val(2));
+ assert v_val(0) = x"AAAA" report "Incorrect value" severity failure;
+ end procedure;
+ begin
+ test_proc(c_test_val);
+ wait;
+ end process;
+
+end architecture beh;
diff --git a/testsuite/gna/issue1836/testsuite.sh b/testsuite/gna/issue1836/testsuite.sh
new file mode 100755
index 000000000..1c8c48284
--- /dev/null
+++ b/testsuite/gna/issue1836/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze test2.vhdl
+elab_simulate test2
+
+analyze test.vhdl
+elab_simulate test
+
+clean
+
+echo "Test successful"