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_wr_addr_fifo_0.vhd,v $ *
00015 --* $Revision: 1.3.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_wr_addr_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 block RAM based FIFO to store the user address
00037 -- and the command information.
00038 -------------------------------------------------------------------------------
00039
00040
00041 library ieee;
00042
00043 use ieee.std_logic_1164.all;
00044
00045 use ieee.std_logic_unsigned.all;
00046 -- pragma translate_off
00047
00048 library unisim;
00049
00050 use unisim.vcomponents.all;
00051 -- pragma translate_on
00052 use work.mem_interface_top_parameters_0.all;
00053
00054 entity mem_interface_top_rd_wr_addr_fifo_0 is
00055 port( clk0 : in ;
00056 clk90 : in ;
00057 rst : in ;
00058 app_af_addr : in (35 downto 0);
00059 app_af_WrEn : in ;
00060 ctrl_af_RdEn : in ;
00061 af_addr : out (35 downto 0);
00062 af_Empty : out ;
00063 af_Almost_Full : out
00064 );
00065 end mem_interface_top_rd_wr_addr_fifo_0;
00066
00067 architecture arch of mem_interface_top_rd_wr_addr_fifo_0 is
00068
00069 component FIFO16
00070 generic( ALMOST_FULL_OFFSET : bit_vector;
00071 ALMOST_EMPTY_OFFSET : bit_vector;
00072 DATA_WIDTH : := 36;
00073 FIRST_WORD_Fall_THROUGH :
00074 );
00075
00076 port( ALMOSTEMPTY : out ;
00077 ALMOSTFULL : out ;
00078 DO : out (31 downto 0);
00079 DOP : out (3 downto 0);
00080 EMPTY : out ;
00081 FULL : out ;
00082 RDCOUNT : out (11 downto 0);
00083 RDERR : out ;
00084 WRCOUNT : out (11 downto 0);
00085 WRERR : out ;
00086 DI : in (31 downto 0);
00087 DIP : in (3 downto 0);
00088 RDCLK : in ;
00089 RDEN : in ;
00090 RST : in ;
00091 WRCLK : in ;
00092 WREN : in
00093 );
00094 end component;
00095
00096 signal fifo_input_write_addr : (35 downto 0);
00097 signal fifo_output_write_addr : (35 downto 0);
00098 signal compare_value_r : (35 downto 0);
00099 signal app_af_addr_r : (35 downto 0);
00100 signal fifo_input_addr_r : (35 downto 0);
00101 signal af_en_r : ;
00102 signal af_en_2r : ;
00103 signal compare_result : ;
00104
00105 signal clk270 : ;
00106 signal af_al_full_0 : ;
00107 signal af_al_full_180 : ;
00108 signal af_al_full_90 : ;
00109 signal af_en_2r_270 : ;
00110 signal fifo_input_270 : (35 downto 0);
00111
00112
00113
00114 begin
00115
00116 fifo_input_write_addr <= compare_result & app_af_addr_r(34 downto 0);
00117 af_addr <= fifo_output_write_addr;
00118 compare_result <= '0' when (compare_value_r((no_of_cs + bank_address + row_address + col_ap_width- 1) downto col_ap_width)
00119 = fifo_input_write_addr((no_of_cs + bank_address + row_address + col_ap_width- 1) downto col_ap_width)) else
00120 '1';
00121 clk270 <= not clk90;
00122
00123 process( clk0)
00124 begin
00125 if(clk0'event and clk0 = '1') then
00126 if(rst = '1') then
00127 compare_value_r <= (others => '0');
00128 app_af_addr_r <= (others => '0');
00129 fifo_input_addr_r <= (others => '0');
00130 af_en_r <= '0';
00131 af_en_2r <= '0';
00132 else
00133 if(af_en_r = '1') then
00134 compare_value_r <= fifo_input_write_addr;
00135 end if;
00136 app_af_addr_r <= app_af_addr;
00137 fifo_input_addr_r <= fifo_input_write_addr;
00138 af_en_r <= app_af_WrEn;
00139 af_en_2r <= af_en_r;
00140 end if;
00141 end if;
00142 end process;
00143
00144 -- A fix for FIFO16 according to answer record #22462
00145
00146 process(clk270)
00147 begin
00148 if (clk270'event and clk270 = '1') then
00149 af_en_2r_270 <= af_en_2r;
00150 fifo_input_270 <= fifo_input_addr_r;
00151 end if;
00152 end process;
00153
00154 -- 3 Filp-flops logic is implemented at output to avoid the timimg errors
00155
00156 process(clk0)
00157 begin
00158 if (clk0'event and clk0 = '0') then
00159 af_al_full_180 <= af_al_full_0;
00160 end if;
00161 end process;
00162
00163 process(clk90)
00164 begin
00165 if (clk90'event and clk90 = '1') then
00166 af_al_full_90 <= af_al_full_180;
00167 end if;
00168 end process;
00169
00170 process(clk0)
00171 begin
00172 if (clk0'event and clk0 = '1') then
00173 af_Almost_Full <= af_al_full_90;
00174 end if;
00175 end process;
00176
00177 -- Read/Write Address FIFO
00178
00179 af_fifo16: FIFO16
00180 generic map
00181 ( ALMOST_FULL_OFFSET => X"00F" ,
00182 ALMOST_EMPTY_OFFSET => X"007",
00183 DATA_WIDTH => 36,
00184 FIRST_WORD_Fall_THROUGH => TRUE
00185 )
00186
00187 port map
00188 ( ALMOSTEMPTY => open,
00189 ALMOSTFULL => af_al_full_0,
00190 DO => fifo_output_write_addr(31 downto 0),
00191 DOP => fifo_output_write_addr(35 downto 32),
00192 EMPTY => af_Empty,
00193 FULL => open ,
00194 RDCOUNT => open,
00195 RDERR => open ,
00196 WRCOUNT => open,
00197 WRERR => open ,
00198 DI => fifo_input_270(31 downto 0),
00199 DIP => fifo_input_270(35 downto 32),
00200 RDCLK => clk0 ,
00201 RDEN => ctrl_af_RdEn ,
00202 RST => rst ,
00203 WRCLK => clk270,
00204 WREN => af_en_2r_270
00205 );
00206
00207 end arch;