summaryrefslogtreecommitdiffstats
path: root/fpga/hp_lcd_driver/edge_det.vhdl
blob: 2a592a51ad860b50257a02d1c76a9747968155ed (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
library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity edge_det is
    port (clk : in  std_logic;
          sig : in  std_logic;
          pe  : out std_logic;
          ne  : out std_logic;
          e   : out std_logic
          );
end edge_det;

architecture Behavioral of edge_det is
    signal last : std_logic := '0';
begin

    process(clk, last, sig)
    begin
        if rising_edge(clk) then
            last <= sig;
        end if;
    end process;

    pe <= '1' when sig = '1' and last = '0' else '0';
    ne <= '1' when sig = '0' and last = '1' else '0';

    e <= sig xor last;
end Behavioral;