diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-12-31 11:45:00 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-12-31 13:54:50 +0100 |
commit | b1542388032e3a1e4bdfdfe0ff42a2c8caad4e33 (patch) | |
tree | dbf7874b86498c3d83543ba8ccd0be9fac3219db | |
parent | 3285adae041350b00930bf203565d7f153df8895 (diff) | |
download | ghdl-b1542388032e3a1e4bdfdfe0ff42a2c8caad4e33.tar.gz ghdl-b1542388032e3a1e4bdfdfe0ff42a2c8caad4e33.tar.bz2 ghdl-b1542388032e3a1e4bdfdfe0ff42a2c8caad4e33.zip |
testsuite/gna: add a test for #2288
-rw-r--r-- | testsuite/gna/issue2288/tb_minimal.vhdl | 34 | ||||
-rwxr-xr-x | testsuite/gna/issue2288/testsuite.sh | 11 |
2 files changed, 45 insertions, 0 deletions
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" |