From 324403d7af16ac7b72f478080cd0447f902e4255 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 14 Sep 2021 05:16:37 +0200 Subject: testsuite/gna: add a test and close #913 Also close #926 (looks similar, but without a proper reproducer) --- testsuite/gna/issue913/apackage.vhdl | 29 +++++++++++++++++++++++++++++ testsuite/gna/issue913/repro.vhdl | 11 +++++++++++ testsuite/gna/issue913/testsuite.sh | 11 +++++++++++ 3 files changed, 51 insertions(+) create mode 100644 testsuite/gna/issue913/apackage.vhdl create mode 100644 testsuite/gna/issue913/repro.vhdl create mode 100755 testsuite/gna/issue913/testsuite.sh (limited to 'testsuite') 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" -- cgit v1.2.3