00001 --**************************************************************
00002 --* *
00003 --* The source code for the ATLAS BCM "AAA" FPGA is made *
00004 --* available via the GNU General Public License (GPL) *
00005 --* unless otherwise stated below. *
00006 --* *
00007 --* In case of problems/questions/bug reports etc. please *
00008 --* contact michael.niegl@cern.ch *
00009 --* *
00010 --**************************************************************
00011
00012 --**************************************************************
00013 --* *
00014 --* $Source: /local/reps/bcmfpga/bcm_aaa/bcm_aaa/ddr/mem_interface_top_rd_data_fifo_0.vhd,v $ *
00015 --* $Revision: 1.2.2.3 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:44 $ *
00019 --* *
00020 --**************************************************************
00021 -------------------------------------------------------------------------------
00022 -- Copyright (c) 2005 Xilinx, Inc.
00023 -- This design is confidential and proprietary of Xilinx, All Rights Reserved.
00024 -------------------------------------------------------------------------------
00025 -- ____ ____
00026 -- / /\/ /
00027 -- /___/ \ / Vendor: Xilinx
00028 -- \ \ \/ Version: 1.6
00029 -- \ \ Application : MIG
00030 -- / / Filename: mem_interface_top_rd_data_fifo_0.vhd
00031 -- /___/ /\ Date Last Modified: Wed Jun 1 2005
00032 -- \ \ / \Date Created: Mon May 2 2005
00033 -- \___\/\___\
00034 -- Device: Virtex-4
00035 -- Design Name: DDR1_SDRAM
00036 -- Description: Instantiates the distributed RAM which stores the read data from the
00037 -- memory.
00038 -------------------------------------------------------------------------------
00039
00040
00041 library ieee;
00042
00043 use ieee.std_logic_1164.all;
00044
00045 use ieee.std_logic_unsigned.all;
00046
00047 library unisim;
00048
00049 use unisim.vcomponents.all;
00050 use work.mem_interface_top_parameters_0.all;
00051
00052 entity mem_interface_top_rd_data_fifo_0 is
00053 port( CLK : in ;
00054 RESET : in ;
00055 READ_EN_DELAYED_RISE : in ;
00056 READ_EN_DELAYED_Fall : in ;
00057 FIRST_RISING : in ;
00058 READ_DATA_RISE : in (memory_width-1 downto 0);
00059 READ_DATA_Fall : in (memory_width-1 downto 0);
00060 fifo_rd_enable : in ;
00061 READ_DATA_FIFO_RISE : out (memory_width-1 downto 0);
00062 READ_DATA_FIFO_Fall : out (memory_width-1 downto 0);
00063 READ_DATA_VALID : out
00064 );
00065 end mem_interface_top_rd_data_fifo_0;
00066
00067 architecture arch of mem_interface_top_rd_data_fifo_0 is
00068
00069 component mem_interface_top_RAM_D_0
00070 port( DPO : out (memory_width-1 downto 0);
00071 A0 : in ;
00072 A1 : in ;
00073 A2 : in ;
00074 A3 : in ;
00075 D : in (memory_width-1 downto 0);
00076 DPRA0 : in ;
00077 DPRA1 : in ;
00078 DPRA2 : in ;
00079 DPRA3 : in ;
00080 WCLK : in ;
00081 WE : in
00082 );
00083 end component;
00084
00085 signal fifos_data_out1 : ((memory_width*2 -1) downto 0);
00086 signal fifo_rd_addr : (3 downto 0);
00087 signal rise0_wr_addr : (3 downto 0);
00088 signal fall0_wr_addr : (3 downto 0);
00089 signal fifo_rd_en : ;
00090 signal fifo_rd_en_r1 : ;
00091 signal fifo_rd_en_r2 : ;
00092 signal rise_fifo_data : ((memory_width -1) downto 0);
00093 signal fall_fifo_data : ((memory_width -1) downto 0);
00094 signal rise_fifo_out : ((memory_width -1) downto 0);
00095 signal fall_fifo_out : ((memory_width -1) downto 0);
00096
00097 begin
00098
00099 READ_DATA_VALID <= fifo_rd_en_r2;
00100 READ_DATA_FIFO_Fall <= fifos_data_out1(memory_width-1 downto 0);
00101 READ_DATA_FIFO_RISE <= fifos_data_out1((memory_width*2 -1) downto memory_width);
00102
00103 -- Read Pointer and fifo data output sequencing
00104
00105 -- Read Enable generation for fifos based on write enable
00106
00107 process ( CLK)
00108 begin
00109 if(CLK'event and CLK = '1') then
00110 if (RESET = '1') then
00111 fifo_rd_en <= '0';
00112 fifo_rd_en_r1 <= '0';
00113 fifo_rd_en_r2 <= '0';
00114 else
00115 fifo_rd_en <= fifo_rd_enable;
00116 fifo_rd_en_r1 <= fifo_rd_en;
00117 fifo_rd_en_r2 <= fifo_rd_en_r1;
00118 end if;
00119 end if;
00120 end process;
00121
00122 -- Write Pointer increment for FIFOs
00123
00124 process ( CLK)
00125 begin
00126 if(CLK'event and CLK = '1') then
00127 if (RESET = '1') then
00128 rise0_wr_addr <= "0000";
00129 elsif (READ_EN_DELAYED_RISE = '1') then
00130 rise0_wr_addr <= rise0_wr_addr + '1';
00131 end if;
00132 end if;
00133 end process;
00134
00135 process ( CLK)
00136 begin
00137 if(CLK'event and CLK = '1') then
00138 if (RESET = '1') then
00139 fall0_wr_addr <= "0000";
00140 elsif (READ_EN_DELAYED_Fall = '1') then
00141 fall0_wr_addr <= fall0_wr_addr + '1';
00142 end if;
00143 end if;
00144 end process;
00145
00146 --**************************************** FIFO Data Output Sequencing ************************************************
00147
00148 process ( CLK)
00149 begin
00150 if(CLK'event and CLK = '1') then
00151 if (RESET = '1') then
00152 rise_fifo_data <= (others => '0');
00153 fall_fifo_data <= (others => '0');
00154 fifo_rd_addr <= "0000";
00155 elsif (fifo_rd_en = '1') then
00156 rise_fifo_data(memory_width-1 downto 0) <= rise_fifo_out(memory_width-1 downto 0);
00157 fall_fifo_data(memory_width-1 downto 0) <= fall_fifo_out(memory_width-1 downto 0);
00158 fifo_rd_addr(3 downto 0) <= fifo_rd_addr(3 downto 0) + '1';
00159 end if;
00160 end if;
00161 end process;
00162
00163 process ( CLK)
00164 begin
00165 if(CLK'event and CLK = '1') then
00166 if (RESET = '1') then
00167 fifos_data_out1((memory_width*2 -1) downto 0) <= (others => '0');
00168 elsif (fifo_rd_en_r1 = '1') then
00169 if (FIRST_RISING = '1') then
00170 fifos_data_out1((memory_width*2 -1) downto 0) <= fall_fifo_data((memory_width -1) downto 0) & rise_fifo_data((memory_width -1) downto 0);
00171 else
00172 fifos_data_out1((memory_width*2 -1) downto 0) <= rise_fifo_data((memory_width -1) downto 0) & fall_fifo_data((memory_width -1) downto 0);
00173 end if;
00174 end if;
00175 end if;
00176 end process;
00177
00178
00179
00180 --*************************************************************************************************************************
00181 -- Distributed RAM 4 bit wide FIFO instantiations (2 FIFOs per strobe, rising edge data fifo and falling edge data fifo)
00182 --*************************************************************************************************************************
00183 -- FIFOs associated with DQS(0)
00184
00185 ram_rise0: mem_interface_top_RAM_D_0 port map
00186 ( DPO => rise_fifo_out(memory_width -1 downto 0),
00187 A0 => rise0_wr_addr(0),
00188 A1 => rise0_wr_addr(1),
00189 A2 => rise0_wr_addr(2),
00190 A3 => rise0_wr_addr(3),
00191 D => READ_DATA_RISE(memory_width -1 downto 0),
00192 DPRA0 => fifo_rd_addr (0),
00193 DPRA1 => fifo_rd_addr (1),
00194 DPRA2 => fifo_rd_addr (2),
00195 DPRA3 => fifo_rd_addr (3),
00196 WCLK => CLK ,
00197 WE => READ_EN_DELAYED_RISE
00198 );
00199
00200 ram_fall0: mem_interface_top_RAM_D_0 port map
00201 ( DPO => fall_fifo_out(memory_width -1 downto 0),
00202 A0 => fall0_wr_addr(0),
00203 A1 => fall0_wr_addr(1),
00204 A2 => fall0_wr_addr(2),
00205 A3 => fall0_wr_addr(3),
00206 D => READ_DATA_Fall(memory_width -1 downto 0),
00207 DPRA0 => fifo_rd_addr (0),
00208 DPRA1 => fifo_rd_addr (1),
00209 DPRA2 => fifo_rd_addr (2),
00210 DPRA3 => fifo_rd_addr (3),
00211 WCLK => CLK ,
00212 WE => READ_EN_DELAYED_Fall
00213 );
00214
00215 end arch;