From de0014ddf3d2920aa7d4a4e8fe9d05ed2eebc4a4 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 20 Apr 2020 18:01:26 +0200 Subject: testsuite/gna: add a test for #1246 --- testsuite/gna/issue1246/pkg_a.vhdl | 22 ++++++++++++++++++++++ testsuite/gna/issue1246/pkg_b.vhdl | 12 ++++++++++++ testsuite/gna/issue1246/tb.vhdl | 24 ++++++++++++++++++++++++ testsuite/gna/issue1246/testsuite.sh | 11 +++++++++++ 4 files changed, 69 insertions(+) create mode 100644 testsuite/gna/issue1246/pkg_a.vhdl create mode 100644 testsuite/gna/issue1246/pkg_b.vhdl create mode 100644 testsuite/gna/issue1246/tb.vhdl create mode 100755 testsuite/gna/issue1246/testsuite.sh (limited to 'testsuite') diff --git a/testsuite/gna/issue1246/pkg_a.vhdl b/testsuite/gna/issue1246/pkg_a.vhdl new file mode 100644 index 000000000..75009ad43 --- /dev/null +++ b/testsuite/gna/issue1246/pkg_a.vhdl @@ -0,0 +1,22 @@ +package pkg_A is + -------------------------------------- + generic ( + A: integer := 1 + ); + -------------------------------------- + -- constant A: integer := 1; + -------------------------------------- + package pkgB is new work.pkg_B + generic map( + B => A+1 + ); + procedure showA; +end pkg_A; +package body pkg_A is + procedure showA is + use pkgB.showB; + begin + report "A:" & integer'image(A); + showB; + end procedure showA; +end package body pkg_A; diff --git a/testsuite/gna/issue1246/pkg_b.vhdl b/testsuite/gna/issue1246/pkg_b.vhdl new file mode 100644 index 000000000..30bb6e19a --- /dev/null +++ b/testsuite/gna/issue1246/pkg_b.vhdl @@ -0,0 +1,12 @@ +package pkg_B is + generic ( + B: integer := 2 + ); + procedure showB; +end pkg_B; +package body pkg_B is + procedure showB is + begin + report "B:" & integer'image(B); + end procedure showB; +end package body pkg_B; diff --git a/testsuite/gna/issue1246/tb.vhdl b/testsuite/gna/issue1246/tb.vhdl new file mode 100644 index 000000000..fee70d79a --- /dev/null +++ b/testsuite/gna/issue1246/tb.vhdl @@ -0,0 +1,24 @@ +-------------------------------------- +-- use work.pkg_A.all; +-------------------------------------- + +entity tb is +end tb; + +architecture arch of tb is + -------------------------------------- + package pkgA is new work.pkg_A + generic map ( + A => 0 + ); + -------------------------------------- +begin + process + -------------------------------------- + use pkgA.all; + -------------------------------------- + begin + showA; + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue1246/testsuite.sh b/testsuite/gna/issue1246/testsuite.sh new file mode 100755 index 000000000..8a5f2c132 --- /dev/null +++ b/testsuite/gna/issue1246/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze pkg_b.vhdl pkg_a.vhdl tb.vhdl +elab_simulate tb + +clean + +echo "Test successful" -- cgit v1.2.3