From b1542388032e3a1e4bdfdfe0ff42a2c8caad4e33 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 31 Dec 2022 11:45:00 +0100 Subject: testsuite/gna: add a test for #2288 --- testsuite/gna/issue2288/tb_minimal.vhdl | 34 +++++++++++++++++++++++++++++++++ testsuite/gna/issue2288/testsuite.sh | 11 +++++++++++ 2 files changed, 45 insertions(+) create mode 100644 testsuite/gna/issue2288/tb_minimal.vhdl create mode 100755 testsuite/gna/issue2288/testsuite.sh (limited to 'testsuite/gna/issue2288') diff --git a/testsuite/gna/issue2288/tb_minimal.vhdl b/testsuite/gna/issue2288/tb_minimal.vhdl new file mode 100644 index 000000000..e241c2560 --- /dev/null +++ b/testsuite/gna/issue2288/tb_minimal.vhdl @@ -0,0 +1,34 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity tb_minimal is +end tb_minimal; + +architecture rtl of tb_minimal is +begin + MAIN_PROC : process + + function fun return std_ulogic_vector is + variable v_return : std_ulogic_vector(0 to 3) := x"A"; + begin + return v_return; + end function fun; + + variable v_result : std_ulogic_vector(0 to 7); + variable v_some_data : std_ulogic_vector(0 to 3) := x"B"; + variable v_fun_result : std_ulogic_vector(0 to 3); + begin + + -- working: + -- v_fun_result := fun; + -- v_result := std_ulogic_vector'(v_some_data, v_fun_result); + + -- not working: + v_result := std_ulogic_vector'(v_some_data, fun); + + report "result= 0x" & to_hstring(v_result); + assert v_result = x"BA" severity failure; + wait; + end process; + +end architecture; diff --git a/testsuite/gna/issue2288/testsuite.sh b/testsuite/gna/issue2288/testsuite.sh new file mode 100755 index 000000000..59be83369 --- /dev/null +++ b/testsuite/gna/issue2288/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze tb_minimal.vhdl +elab_simulate tb_minimal + +clean + +echo "Test successful" -- cgit v1.2.3