OpenCores
URL https://opencores.org/ocsvn/uart_fpga_slow_control_migrated/uart_fpga_slow_control_migrated/trunk

Subversion Repositories uart_fpga_slow_control_migrated

[/] [uart_fpga_slow_control/] [trunk/] [code/] [library/] [gh_edge_det.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 aborga
-----------------------------------------------------------------------------
2
--      Filename:       gh_edge_det.vhd
3
--
4
--      Description:
5
--              an edge detector - 
6
--                 finds the rising edge and falling edge
7
--
8
--      Copyright (c) 2005 by George Huber 
9
--              an OpenCores.org Project
10
--              free to use, but see documentation for conditions  
11
--
12
--      Revision        History:
13
--      Revision        Date            Author          Comment
14
--      --------        ----------      --------        -----------
15
--      1.0             09/10/05        G Huber         Initial revision
16
--      2.0             09/17/05        h lefevre       name change to avoid conflict
17
--                                                        with other libraries
18
--      2.1             05/21/06        S A Dodd        fix typo's
19
--
20
-----------------------------------------------------------------------------
21
library IEEE;
22
use IEEE.STD_LOGIC_1164.all;
23
 
24
entity gh_edge_det is
25
        port(
26
                clk : in STD_LOGIC;
27
                rst : in STD_LOGIC;
28
                D   : in STD_LOGIC;
29
                re  : out STD_LOGIC; -- rising edge (need sync source at D)
30
                fe  : out STD_LOGIC; -- falling edge (need sync source at D)
31
                sre : out STD_LOGIC; -- sync'd rising edge
32
                sfe : out STD_LOGIC  -- sync'd falling edge
33
                );
34
end gh_edge_det;
35
 
36
 
37
architecture a of gh_edge_det is
38
 
39
        signal Q0, Q1 : std_logic;
40
 
41
begin
42
 
43
        re <= D and (not Q0);
44
        fe <= (not D) and Q0;
45
        sre <= Q0 and (not Q1);
46
        sfe <= (not Q0) and Q1;
47
 
48
process(clk,rst)
49
begin
50
        if (rst = '1') then
51
                Q0 <= '0';
52
                Q1 <= '0';
53
        elsif (rising_edge(clk)) then
54
                Q0 <= D;
55
                Q1 <= Q0;
56
        end if;
57
end process;
58
 
59
end a;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.