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/] [gray_fifo/] [1.0/] [vhd/] [cdc_fifo.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : Gray counter based mixed clock FIFO
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : cdc_fifo.vhd
6
-- Author     : 
7
-- Created    : 19.12.2006
8
-- Last update: 19.12.2006
9
-- Description: 
10
-------------------------------------------------------------------------------
11
-- Copyright (c) 2006 
12
-------------------------------------------------------------------------------
13
-- Revisions  :
14
-- Date        Version  Author          Description
15
-- 2006         1.0     Timo Alho       Created
16
-- 19.12.2006           Ari Kulmala     Comments. header. one p and one d
17
-------------------------------------------------------------------------------
18
 
19
library ieee;
20
use ieee.std_logic_1164.all;
21
use ieee.std_logic_arith.all;
22
use ieee.std_logic_unsigned.all;
23
library ieee;
24
use ieee.std_logic_1164.all;
25
use ieee.numeric_std.all;
26
 
27
entity cdc_fifo is
28
 
29
  generic (
30
    READ_AHEAD_g  : integer := 0;
31
    SYNC_CLOCKS_g : integer := 0; -- 0 two flop synch, otherwise 1 flop synch
32
    depth_log2_g  : integer := 5;
33
    dataw_g       : integer := 32);
34
 
35
  port (
36
    rst_n        : in  std_logic;
37
    rd_clk       : in  std_logic;
38
    rd_en_in     : in  std_logic;
39
    rd_empty_out : out std_logic;
40
    rd_one_d_out : out std_logic;
41
    rd_data_out  : out std_logic_vector(dataw_g-1 downto 0);
42
 
43
 
44
    wr_clk      : in  std_logic;
45
    wr_en_in    : in  std_logic;
46
    wr_full_out : out std_logic;
47
    wr_one_p_out : out std_logic;
48
    wr_data_in  : in  std_logic_vector(dataw_g-1 downto 0)
49
    );
50
 
51
end entity cdc_fifo;
52
 
53
architecture rtl of cdc_fifo is
54
 
55
  signal wr_en, rd_en     : std_logic;
56
  signal rd_addr, wr_addr : std_logic_vector(depth_log2_g-1 downto 0);
57
 
58
  signal wr_full, rd_empty : std_logic;
59
begin  -- architecture rtl
60
 
61
  wr_full_out  <= wr_full;
62
  rd_empty_out <= rd_empty;
63
  -- write cannot be '1' when full,
64
  wr_en        <= wr_en_in and (not wr_full);
65
  -- read cannot be asserted wen empty
66
  rd_en        <= rd_en_in and (not rd_empty);
67
 
68
  fifo_ram_storage : entity work.async_dpram
69
    generic map (
70
      addrw_g => depth_log2_g,
71
      dataw_g => dataw_g)
72
    port map (
73
      rd_clk     => rd_clk,
74
      wr_clk     => wr_clk,
75
      wr_en_in   => wr_en,
76
      data_in    => wr_data_in,
77
      data_out   => rd_data_out,
78
      rd_addr_in => rd_addr,
79
      wr_addr_in => wr_addr);
80
 
81
  cdc_fifo_ctrl_2 : entity work.cdc_fifo_ctrl
82
    generic map (
83
      READ_AHEAD_g  => READ_AHEAD_g,
84
      SYNC_CLOCKS_g => SYNC_CLOCKS_g,
85
      depth_log2_g  => depth_log2_g)
86
    port map (
87
      rst_n        => rst_n,
88
      rd_clk       => rd_clk,
89
      rd_en_in     => rd_en,
90
      rd_empty_out => rd_empty,
91
      rd_addr_out  => rd_addr,
92
      rd_one_d_out => rd_one_d_out,
93
      wr_clk       => wr_clk,
94
      wr_en_in     => wr_en,
95
      wr_full_out  => wr_full,
96
      wr_one_p_out => wr_one_p_out,
97
      wr_addr_out  => wr_addr
98
      );
99
 
100
end architecture rtl;

powered by: WebSVN 2.1.0

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