aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue412/generic_pkg.vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-12-15 08:18:46 +0100
committerTristan Gingold <tgingold@free.fr>2021-12-15 08:18:46 +0100
commitf32d77707a2639fed94978965b3a9690c2bf7904 (patch)
tree6b8bf4e593676a2e9c3fefdd51d60c4d9905c8fa /testsuite/synth/issue412/generic_pkg.vhdl
parent9df3cb21ad765f38561fff0a568ce94359d4d977 (diff)
downloadghdl-f32d77707a2639fed94978965b3a9690c2bf7904.tar.gz
ghdl-f32d77707a2639fed94978965b3a9690c2bf7904.tar.bz2
ghdl-f32d77707a2639fed94978965b3a9690c2bf7904.zip
testsuite/synth: provide a testcase for #412
Diffstat (limited to 'testsuite/synth/issue412/generic_pkg.vhdl')
-rw-r--r--testsuite/synth/issue412/generic_pkg.vhdl42
1 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/synth/issue412/generic_pkg.vhdl b/testsuite/synth/issue412/generic_pkg.vhdl
new file mode 100644
index 000000000..3a97c2961
--- /dev/null
+++ b/testsuite/synth/issue412/generic_pkg.vhdl
@@ -0,0 +1,42 @@
+-- package containing a type-generic D Flip Flop
+-- may not be 100% valid VHDL code, contact ktbarrett on gitter
+-- non-generic version does synthesize correctly
+package generic_pkg is
+
+ procedure generic_FF
+ generic (
+ constant T: type)
+ paramater (
+ signal q : out T;
+ signal d : in T;
+ signal clk : in std_logic;
+ signal rst : in std_logic;
+ constant INIT : in T;
+ signal en : in std_logic := '1');
+
+end package generic_pkg;
+
+package body generic_pkg is
+
+ procedure generic_FF
+ generic (
+ constant T: type)
+ paramater (
+ signal q : out T;
+ signal d : in T;
+ signal clk : in std_logic;
+ signal rst : in std_logic;
+ constant INIT : in T;
+ signal en : in std_logic := '1')
+ is
+ begin
+ if (rising_edge(clk)) then
+ if (rst /= '0') then
+ q <= INIT;
+ elsif (en = '1') then
+ q <= d;
+ end if;
+ end if;
+ end procedure generic_FF;
+
+end package body generic_pkg;