diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-09-14 05:16:37 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-09-14 05:17:31 +0200 |
commit | 324403d7af16ac7b72f478080cd0447f902e4255 (patch) | |
tree | 48750655a04b765575f1460d738ef812b2f93fbe | |
parent | f3e31e109de89db26550e94e913ec0a4e1f1c7c4 (diff) | |
download | ghdl-324403d7af16ac7b72f478080cd0447f902e4255.tar.gz ghdl-324403d7af16ac7b72f478080cd0447f902e4255.tar.bz2 ghdl-324403d7af16ac7b72f478080cd0447f902e4255.zip |
testsuite/gna: add a test and close #913
Also close #926 (looks similar, but without a proper reproducer)
-rw-r--r-- | testsuite/gna/issue913/apackage.vhdl | 29 | ||||
-rw-r--r-- | testsuite/gna/issue913/repro.vhdl | 11 | ||||
-rwxr-xr-x | testsuite/gna/issue913/testsuite.sh | 11 |
3 files changed, 51 insertions, 0 deletions
diff --git a/testsuite/gna/issue913/apackage.vhdl b/testsuite/gna/issue913/apackage.vhdl new file mode 100644 index 000000000..bd55d2ca2 --- /dev/null +++ b/testsuite/gna/issue913/apackage.vhdl @@ -0,0 +1,29 @@ +library IEEE; + +use IEEE.Std_logic_1164.all; +use IEEE.Numeric_std.all; +package aPackage is + + subtype T_DBYTE is std_logic_vector(7 downto 0); + type T_RECORD is record + flgA : std_logic; + flgB : std_logic; + flgC : std_logic; + flgD : std_logic; + counter : unsigned(3 downto 0); + end record T_RECORD; + + function to_HKBYTE(inVal : T_RECORD) return T_DBYTE; +end package aPackage; + +package body aPackage is + + function to_HKBYTE(inVal : T_RECORD) return T_DBYTE is + begin + return (7 downto 4 => std_logic_vector(inVal.counter), + 3 => inVal.flgB, 2 => inVal.flgD, + 1=> inVal.flgC, 0 => inVal.flgA, + others => '0'); + end to_HKBYTE; + +end package body aPackage; diff --git a/testsuite/gna/issue913/repro.vhdl b/testsuite/gna/issue913/repro.vhdl new file mode 100644 index 000000000..4f116cebf --- /dev/null +++ b/testsuite/gna/issue913/repro.vhdl @@ -0,0 +1,11 @@ +entity repro is +end; + +use work.apackage.all; + +architecture arch of repro is + signal r : t_record; + signal v : t_dbyte; +begin + v <= to_hkbyte(r); +end arch; diff --git a/testsuite/gna/issue913/testsuite.sh b/testsuite/gna/issue913/testsuite.sh new file mode 100755 index 000000000..72668e232 --- /dev/null +++ b/testsuite/gna/issue913/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze apackage.vhdl repro.vhdl +elab_simulate repro + +clean + +echo "Test successful" |