aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testsuite/gna/issue620/test_tb.vhd31
-rwxr-xr-xtestsuite/gna/issue620/testsuite.sh14
-rw-r--r--testsuite/gna/issue620/type_declaration_pkg.vhd19
-rw-r--r--testsuite/gna/issue620/type_user_pkg.vhd22
4 files changed, 86 insertions, 0 deletions
diff --git a/testsuite/gna/issue620/test_tb.vhd b/testsuite/gna/issue620/test_tb.vhd
new file mode 100644
index 000000000..6be137009
--- /dev/null
+++ b/testsuite/gna/issue620/test_tb.vhd
@@ -0,0 +1,31 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity test_tb is
+ package inst is new work.type_declaration_pkg generic map(2);
+ use inst.all;
+
+ package userInst is new work.type_user_pkg generic map(inst.myType, inst.unity);
+ use userInst.all;
+end entity test_tb;
+
+architecture behavioral of test_tb is
+ signal thisThing : inst.myType := (others => 0);
+ signal thatThing : inst.myType;
+ signal clk : std_ulogic := '0';
+begin
+ process
+ begin
+ for i in 1 to 5 loop
+ wait for 5 ns;
+ clk <= '0';
+ wait for 5 ns;
+ clk <= '1';
+ end loop;
+ wait;
+ end process;
+ process
+ begin
+ unity_proc(clk, thisThing, thatThing);
+ end process;
+end architecture behavioral;
diff --git a/testsuite/gna/issue620/testsuite.sh b/testsuite/gna/issue620/testsuite.sh
new file mode 100755
index 000000000..55b3759b4
--- /dev/null
+++ b/testsuite/gna/issue620/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+
+analyze type_declaration_pkg.vhd
+analyze type_user_pkg.vhd
+analyze test_tb.vhd
+elab_simulate test_tb
+
+clean
+
+echo "Test successful"
diff --git a/testsuite/gna/issue620/type_declaration_pkg.vhd b/testsuite/gna/issue620/type_declaration_pkg.vhd
new file mode 100644
index 000000000..6b03f47da
--- /dev/null
+++ b/testsuite/gna/issue620/type_declaration_pkg.vhd
@@ -0,0 +1,19 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+package type_declaration_pkg is
+ generic (
+ constant numElem : natural
+ );
+ type myType is array(numElem - 1 downto 0) of natural;
+ function unity(val : myType) return myType;
+
+end package type_declaration_pkg;
+
+package body type_declaration_pkg is
+ function unity(val : myType) return myType is
+ begin
+ return val;
+ end function unity;
+
+end package body type_declaration_pkg;
diff --git a/testsuite/gna/issue620/type_user_pkg.vhd b/testsuite/gna/issue620/type_user_pkg.vhd
new file mode 100644
index 000000000..edbdee79b
--- /dev/null
+++ b/testsuite/gna/issue620/type_user_pkg.vhd
@@ -0,0 +1,22 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+package type_user_pkg is
+ generic (
+ type thetype;
+ function transition(val : thetype) return thetype
+
+ );
+
+ procedure unity_proc(signal clk : in std_ulogic; signal inVal : in thetype; signal outVal : out theType);
+end package type_user_pkg;
+
+package body type_user_pkg is
+
+ procedure unity_proc(signal clk : in std_ulogic; signal inVal : in thetype; signal outVal : out theType) is
+ begin
+ wait until rising_edge(clk);
+ outVal <= transition(inVal);
+ end procedure unity_proc;
+
+end package body;