Project

General

Profile

Download (1.02 KB) Statistics
| Branch: | Tag: | Revision:
1
library ieee;
2
use ieee.std_logic_1164.all;
3

    
4
entity ppg is
5
  port (
6
    LoadDelay : in integer;
7
    LoadLength : in integer;
8
    Data : in std_logic_vector (0 to 7);
9
    reset : in std_logic;
10
    clk : in std_logic;
11
    pulse : out std_logic
12
  );
13
end ppg;
14

    
15
architecture ppg1 of ppg is
16
  signal out_pulse : std_logic := '0';
17
  signal in_delay : integer := LoadDelay;
18
  signal in_length : integer := LoadLength;
19
begin
20
  p : process (reset, clk)
21
  begin
22
    if (clk'event and clk = '1') 
23
    then
24
      if (reset = '1')
25
      then
26
        out_pulse <= '0';
27
        in_delay <= LoadDelay;
28
        in_length <= LoadLength;
29
      else
30
        if (in_delay = 0)
31
        then
32
          if (in_length > 0) then
33
            in_length <= in_length - 1;
34
            out_pulse <= '1';
35
          else
36
            in_length <= LoadLength;
37
            in_delay <= LoadDelay;
38
            out_pulse <= '0';
39
          end if;
40
        else
41
          in_delay <= in_delay - 1;
42
        end if;
43
      end if;
44
    end if;
45
  end process p;
46

    
47
  pulse <= out_pulse;
48
end ppg1;
(38-38/45)