aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-09-14 05:16:37 +0200
committerTristan Gingold <tgingold@free.fr>2021-09-14 05:17:31 +0200
commit324403d7af16ac7b72f478080cd0447f902e4255 (patch)
tree48750655a04b765575f1460d738ef812b2f93fbe /testsuite
parentf3e31e109de89db26550e94e913ec0a4e1f1c7c4 (diff)
downloadghdl-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)
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue913/apackage.vhdl29
-rw-r--r--testsuite/gna/issue913/repro.vhdl11
-rwxr-xr-xtestsuite/gna/issue913/testsuite.sh11
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"