aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue412/generic_pkg.vhdl
blob: 3a97c29618369108d9f494dd6e706d6789f6b14a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;