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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.storage/] [fifos/] [synchronizer/] [1.0/] [vhd/] [synch_fifo_pulse.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : Synchronizes two clock domains to a single clock FIFO
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : synch_fifo_pulse.vhd
6
-- Author     : kulmala3
7
-- Created    : 01.07.2005
8
-- Last update: 01.07.2005
9
-- Description: Generates a narrower pulse from a broader one, to read only one
10
-- data from a faster FIFO.
11
-- Should work at least when clk_fast is at least 2x clk_slow
12
-- tested on FPGA with clk_slow 50 and clk_fast 200 MHz
13
-- ASYNCHRONOUS INPUT/OUTPUT SIGNALS!
14
-- clk_slow: ____----____----____----
15
-- clk_fast: -_-_-_-_-_-_-_-_-_-_-_-_
16
-- re_in:    __---------------------
17
-- re_out:   ____--________--______--
18
-------------------------------------------------------------------------------
19
-- Copyright (c) 2005 
20
-------------------------------------------------------------------------------
21
-- Revisions  :
22
-- Date        Version  Author  Description
23
-- 01.07.2005  1.0      AK      Created
24
-------------------------------------------------------------------------------
25
 
26
 
27
library ieee;
28
use ieee.std_logic_1164.all;
29
use ieee.std_logic_arith.all;
30
use ieee.std_logic_unsigned.all;
31
 
32
entity synch_fifo_pulse is
33
 
34
  port (
35
    clk_slow : in  std_logic;
36
    clk_fast : in  std_logic;
37
    rst_n    : in  std_logic;
38
    re_in    : in  std_logic;
39
    re_out   : out std_logic);
40
 
41
end synch_fifo_pulse;
42
 
43
architecture rtl of synch_fifo_pulse is
44
  signal pulse_slow_r : std_logic;
45
  signal pulse_fast_r : std_logic;
46
 
47
begin  -- rtl
48
 
49
  process (clk_slow, rst_n)
50
  begin  -- process
51
    if rst_n = '0' then                 -- asynchronous reset (active low)
52
      pulse_slow_r <= '0';
53
 
54
    elsif clk_slow'event and clk_slow = '1' then  -- rising clock edge
55
      pulse_slow_r <= not pulse_slow_r;
56
    end if;
57
  end process;
58
 
59
  process (clk_fast, rst_n)
60
  begin  -- process
61
    if rst_n = '0' then                 -- asynchronous reset (active low)
62
      pulse_fast_r <= '0';
63
 
64
    elsif clk_fast'event and clk_fast = '1' then  -- rising clock edge
65
      pulse_fast_r <= pulse_slow_r;
66
    end if;
67
  end process;
68
 
69
  re_out <= (pulse_fast_r xor pulse_slow_r) and re_in;
70
 
71
end rtl;

powered by: WebSVN 2.1.0

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