aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-11-30 21:27:11 +0100
committerTristan Gingold <tgingold@free.fr>2022-11-30 21:27:11 +0100
commitd99076123a58f4d2a7e93706c5adecbd5b99ff8f (patch)
tree34c8f70f994c6698e7a8ca07cb08b064b8315117
parent844089aa1ab3fa52a0dc363bdd9cd48e3082655a (diff)
downloadghdl-d99076123a58f4d2a7e93706c5adecbd5b99ff8f.tar.gz
ghdl-d99076123a58f4d2a7e93706c5adecbd5b99ff8f.tar.bz2
ghdl-d99076123a58f4d2a7e93706c5adecbd5b99ff8f.zip
testsuite/gna: add a test for #2250
-rw-r--r--testsuite/gna/issue2250/ent.vhdl44
-rwxr-xr-xtestsuite/gna/issue2250/testsuite.sh11
2 files changed, 55 insertions, 0 deletions
diff --git a/testsuite/gna/issue2250/ent.vhdl b/testsuite/gna/issue2250/ent.vhdl
new file mode 100644
index 000000000..c640e4b3a
--- /dev/null
+++ b/testsuite/gna/issue2250/ent.vhdl
@@ -0,0 +1,44 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+package test_pkg is
+ generic (type t_element;
+ function to_string_element(element : t_element) return string
+ );
+end package;
+
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity test is
+end entity test;
+architecture beh of test is
+ type t_record is record
+ address : std_logic_vector(7 downto 0);
+ data : std_logic_vector(7 downto 0);
+ end record t_record;
+
+ function record_to_string(
+ constant rec_data : t_record
+ ) return string is
+ begin
+ return "address: " & to_string(rec_data.address) & ", data: " & to_string(rec_data.data);
+ end function record_to_string;
+
+ package record_pkg is new work.test_pkg
+ generic map (t_element => t_record,
+ to_string_element => record_to_string);
+
+ use record_pkg.all;
+
+begin
+ process
+ variable v_input : t_record := (x"AA", x"BB");
+ begin
+ report "Val is " & to_string_element(v_input) severity note;
+ wait;
+ end process;
+
+end architecture beh;
diff --git a/testsuite/gna/issue2250/testsuite.sh b/testsuite/gna/issue2250/testsuite.sh
new file mode 100755
index 000000000..e9f2d6113
--- /dev/null
+++ b/testsuite/gna/issue2250/testsuite.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze ent.vhdl
+elab_simulate test
+
+clean
+
+echo "Test successful"