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_0.vhd,v $ *
00015 --* $Revision: 1.3.2.3 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:43 $ *
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_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: The delay between the read data with respect to the command issued is
00037 -- calculted in terms of no. of clocks. This data is then stored into the FIFOs
00038 -- and then read back and given as the ouput for comparison.
00039 -------------------------------------------------------------------------------
00040
00041
00042 library ieee;
00043
00044 use ieee.std_logic_1164.all;
00045
00046 library unisim;
00047
00048 use unisim.vcomponents.all;
00049 use work.mem_interface_top_parameters_0.all;
00050
00051 entity mem_interface_top_rd_data_0 is
00052 port( CLK : in ;
00053 RESET : in ;
00054 ctrl_rden : in ;
00055 READ_DATA_RISE : in (data_width-1 downto 0);
00056 READ_DATA_Fall : in (data_width-1 downto 0);
00057 READ_DATA_FIFO_RISE : out (data_width-1 downto 0);
00058 READ_DATA_FIFO_Fall : out (data_width-1 downto 0);
00059 comp_done : out ;
00060 READ_DATA_VALID : out
00061 );
00062 end mem_interface_top_rd_data_0;
00063
00064 architecture arch of mem_interface_top_rd_data_0 is
00065
00066 component mem_interface_top_rd_data_fifo_0
00067 port( CLK : in ;
00068 RESET : in ;
00069 READ_EN_DELAYED_RISE : in ;
00070 READ_EN_DELAYED_Fall : in ;
00071 FIRST_RISING : in ;
00072 READ_DATA_RISE : in (memory_width-1 downto 0);
00073 READ_DATA_Fall : in (memory_width-1 downto 0);
00074 fifo_rd_enable : in ;
00075 READ_DATA_FIFO_RISE : out (memory_width-1 downto 0);
00076 READ_DATA_FIFO_Fall : out (memory_width-1 downto 0);
00077 READ_DATA_VALID : out
00078 );
00079 end component;
00080
00081 component mem_interface_top_pattern_compare8
00082 port( clk : in ;
00083 rst : in ;
00084 ctrl_rden : in ;
00085 rd_data_rise : in (7 downto 0);
00086 rd_data_fall : in (7 downto 0);
00087 comp_done : out ;
00088 first_rising : out ;
00089 rise_clk_count : out (2 downto 0);
00090 fall_clk_count : out (2 downto 0)
00091 );
00092 end component;
00093
00094 component mem_interface_top_pattern_compare4
00095 port( clk : in ;
00096 rst : in ;
00097 ctrl_rden : in ;
00098 rd_data_rise : in (3 downto 0);
00099 rd_data_fall : in (3 downto 0);
00100 comp_done : out ;
00101 first_rising : out ;
00102 rise_clk_count : out (2 downto 0);
00103 fall_clk_count : out (2 downto 0)
00104 );
00105 end component;
00106
00107 signal rd_en_r1 : (ReadEnable-1 downto 0);
00108 signal rd_en_r2 : (ReadEnable-1 downto 0);
00109 signal rd_en_r3 : (ReadEnable-1 downto 0);
00110 signal rd_en_r4 : (ReadEnable-1 downto 0);
00111 signal rd_en_r5 : (ReadEnable-1 downto 0);
00112 signal rd_en_r6 : (ReadEnable-1 downto 0);
00113 signal rd_en_r7 : (ReadEnable-1 downto 0);
00114 signal comp_done_r : ;
00115 signal comp_done_r1 : ;
00116 signal comp_done_r2 : ;
00117
00118 signal rd_en_rise : (data_strobe_width-1 downto 0);
00119 signal rd_en_fall : (data_strobe_width-1 downto 0);
00120 signal ctrl_rden1 : (ReadEnable-1 downto 0);
00121 signal first_rising_rden : (ReadEnable-1 downto 0);
00122 signal fifo_rd_enable1 : ;
00123 signal fifo_rd_enable : ;
00124
00125
00126 signal read_data_valid0 : ;
00127
00128
00129 signal read_data_valid1 : ;
00130
00131
00132 signal read_data_valid2 : ;
00133
00134
00135 signal read_data_valid3 : ;
00136
00137 signal comp_done_0 : ;
00138 signal rise_clk_count0 : (2 downto 0);
00139 signal fall_clk_count0 : (2 downto 0);
00140
00141
00142 begin
00143
00144 ctrl_rden1(0) <= ctrl_rden;
00145
00146 READ_DATA_VALID <= read_data_valid0;
00147
00148 pattern_0 : mem_interface_top_pattern_compare8 port map
00149 ( clk => CLK,
00150 rst => RESET,
00151 ctrl_rden => ctrl_rden1(0),
00152 rd_data_rise => READ_DATA_RISE(31 downto 24),
00153 rd_data_fall => READ_DATA_Fall(31 downto 24),
00154 comp_done => comp_done_0,
00155 first_rising => first_rising_rden(0),
00156 rise_clk_count => rise_clk_count0,
00157 fall_clk_count => fall_clk_count0
00158 );
00159
00160
00161 process(CLK)
00162 begin
00163 if(CLK'event and CLK = '1') then
00164 if(RESET = '1') then
00165 rd_en_r1 <= (others => '0');
00166 rd_en_r2 <= (others => '0');
00167 rd_en_r3 <= (others => '0');
00168 rd_en_r4 <= (others => '0');
00169 rd_en_r5 <= (others => '0');
00170 rd_en_r6 <= (others => '0');
00171 rd_en_r7 <= (others => '0');
00172 else
00173 rd_en_r1 <= ctrl_rden1;
00174 rd_en_r2 <= rd_en_r1;
00175 rd_en_r3 <= rd_en_r2;
00176 rd_en_r4 <= rd_en_r3;
00177 rd_en_r5 <= rd_en_r4;
00178 rd_en_r6 <= rd_en_r5;
00179 rd_en_r7 <= rd_en_r6;
00180 end if;
00181 end if;
00182 end process;
00183
00184 process(CLK)
00185 begin
00186 if(CLK'event and CLK = '1') then
00187 if(RESET = '1') then
00188 comp_done_r <= '0';
00189 comp_done_r1 <= '0';
00190 comp_done_r2 <= '0';
00191 else
00192 comp_done_r <= comp_done_0 ;
00193 comp_done_r1 <= comp_done_r;
00194 comp_done_r2 <= comp_done_r1;
00195 end if;
00196 end if;
00197 end process;
00198
00199 comp_done <= comp_done_0 ;
00200
00201
00202 process(CLK)
00203 begin
00204 if(CLK'event and CLK = '1') then
00205 if(RESET = '1') then
00206 rd_en_rise(0) <= '0';
00207 elsif(comp_done_r2 = '1') then
00208 case rise_clk_count0 is
00209 when "011" =>
00210 rd_en_rise(0) <= rd_en_r3(0);
00211
00212 when "100" =>
00213 rd_en_rise(0) <= rd_en_r4(0);
00214
00215 when "101" =>
00216 rd_en_rise(0) <= rd_en_r5(0);
00217
00218 when "110" =>
00219 rd_en_rise(0) <= rd_en_r6(0);
00220
00221 when "111" =>
00222 rd_en_rise(0) <= rd_en_r7(0);
00223
00224 when others =>
00225 rd_en_rise(0) <= '0';
00226 end case;
00227 end if;
00228 end if;
00229 end process;
00230
00231 process(CLK)
00232 begin
00233 if(CLK'event and CLK = '1') then
00234 if(RESET = '1') then
00235 rd_en_fall(0) <= '0';
00236 elsif(comp_done_r2 = '1') then
00237 case fall_clk_count0 is
00238 when "011" =>
00239 rd_en_fall(0) <= rd_en_r3(0);
00240
00241 when "100" =>
00242 rd_en_fall(0) <= rd_en_r4(0);
00243
00244 when "101" =>
00245 rd_en_fall(0) <= rd_en_r5(0);
00246
00247 when "110" =>
00248 rd_en_fall(0) <= rd_en_r6(0);
00249
00250 when "111" =>
00251 rd_en_fall(0) <= rd_en_r7(0);
00252
00253 when others =>
00254 rd_en_fall(0) <= '0';
00255 end case;
00256 end if;
00257 end if;
00258 end process;
00259
00260
00261 process(CLK)
00262 begin
00263 if(CLK'event and CLK = '1') then
00264 if(RESET = '1') then
00265 rd_en_rise(1) <= '0';
00266 elsif(comp_done_r2 = '1') then
00267 case rise_clk_count0 is
00268 when "011" =>
00269 rd_en_rise(1) <= rd_en_r3(0);
00270
00271 when "100" =>
00272 rd_en_rise(1) <= rd_en_r4(0);
00273
00274 when "101" =>
00275 rd_en_rise(1) <= rd_en_r5(0);
00276
00277 when "110" =>
00278 rd_en_rise(1) <= rd_en_r6(0);
00279
00280 when "111" =>
00281 rd_en_rise(1) <= rd_en_r7(0);
00282
00283 when others =>
00284 rd_en_rise(1) <= '0';
00285 end case;
00286 end if;
00287 end if;
00288 end process;
00289
00290 process(CLK)
00291 begin
00292 if(CLK'event and CLK = '1') then
00293 if(RESET = '1') then
00294 rd_en_fall(1) <= '0';
00295 elsif(comp_done_r2 = '1') then
00296 case fall_clk_count0 is
00297 when "011" =>
00298 rd_en_fall(1) <= rd_en_r3(0);
00299
00300 when "100" =>
00301 rd_en_fall(1) <= rd_en_r4(0);
00302
00303 when "101" =>
00304 rd_en_fall(1) <= rd_en_r5(0);
00305
00306 when "110" =>
00307 rd_en_fall(1) <= rd_en_r6(0);
00308
00309 when "111" =>
00310 rd_en_fall(1) <= rd_en_r7(0);
00311
00312 when others =>
00313 rd_en_fall(1) <= '0';
00314 end case;
00315 end if;
00316 end if;
00317 end process;
00318
00319
00320 process(CLK)
00321 begin
00322 if(CLK'event and CLK = '1') then
00323 if(RESET = '1') then
00324 rd_en_rise(2) <= '0';
00325 elsif(comp_done_r2 = '1') then
00326 case rise_clk_count0 is
00327 when "011" =>
00328 rd_en_rise(2) <= rd_en_r3(0);
00329
00330 when "100" =>
00331 rd_en_rise(2) <= rd_en_r4(0);
00332
00333 when "101" =>
00334 rd_en_rise(2) <= rd_en_r5(0);
00335
00336 when "110" =>
00337 rd_en_rise(2) <= rd_en_r6(0);
00338
00339 when "111" =>
00340 rd_en_rise(2) <= rd_en_r7(0);
00341
00342 when others =>
00343 rd_en_rise(2) <= '0';
00344 end case;
00345 end if;
00346 end if;
00347 end process;
00348
00349 process(CLK)
00350 begin
00351 if(CLK'event and CLK = '1') then
00352 if(RESET = '1') then
00353 rd_en_fall(2) <= '0';
00354 elsif(comp_done_r2 = '1') then
00355 case fall_clk_count0 is
00356 when "011" =>
00357 rd_en_fall(2) <= rd_en_r3(0);
00358
00359 when "100" =>
00360 rd_en_fall(2) <= rd_en_r4(0);
00361
00362 when "101" =>
00363 rd_en_fall(2) <= rd_en_r5(0);
00364
00365 when "110" =>
00366 rd_en_fall(2) <= rd_en_r6(0);
00367
00368 when "111" =>
00369 rd_en_fall(2) <= rd_en_r7(0);
00370
00371 when others =>
00372 rd_en_fall(2) <= '0';
00373 end case;
00374 end if;
00375 end if;
00376 end process;
00377
00378
00379 process(CLK)
00380 begin
00381 if(CLK'event and CLK = '1') then
00382 if(RESET = '1') then
00383 rd_en_rise(3) <= '0';
00384 elsif(comp_done_r2 = '1') then
00385 case rise_clk_count0 is
00386 when "011" =>
00387 rd_en_rise(3) <= rd_en_r3(0);
00388
00389 when "100" =>
00390 rd_en_rise(3) <= rd_en_r4(0);
00391
00392 when "101" =>
00393 rd_en_rise(3) <= rd_en_r5(0);
00394
00395 when "110" =>
00396 rd_en_rise(3) <= rd_en_r6(0);
00397
00398 when "111" =>
00399 rd_en_rise(3) <= rd_en_r7(0);
00400
00401 when others =>
00402 rd_en_rise(3) <= '0';
00403 end case;
00404 end if;
00405 end if;
00406 end process;
00407
00408 process(CLK)
00409 begin
00410 if(CLK'event and CLK = '1') then
00411 if(RESET = '1') then
00412 rd_en_fall(3) <= '0';
00413 elsif(comp_done_r2 = '1') then
00414 case fall_clk_count0 is
00415 when "011" =>
00416 rd_en_fall(3) <= rd_en_r3(0);
00417
00418 when "100" =>
00419 rd_en_fall(3) <= rd_en_r4(0);
00420
00421 when "101" =>
00422 rd_en_fall(3) <= rd_en_r5(0);
00423
00424 when "110" =>
00425 rd_en_fall(3) <= rd_en_r6(0);
00426
00427 when "111" =>
00428 rd_en_fall(3) <= rd_en_r7(0);
00429
00430 when others =>
00431 rd_en_fall(3) <= '0';
00432 end case;
00433 end if;
00434 end if;
00435 end process;
00436
00437
00438 process(CLK)
00439 begin
00440 if(CLK'event and CLK = '1') then
00441 if(RESET = '1') then
00442 fifo_rd_enable1 <= '0';
00443 fifo_rd_enable <= '0';
00444 else
00445 fifo_rd_enable1 <= rd_en_rise(0);
00446 fifo_rd_enable <= fifo_rd_enable1;
00447 end if;
00448 end if;
00449 end process;
00450
00451
00452 rd_data_fifo0: mem_interface_top_rd_data_fifo_0 port map
00453 ( CLK => CLK,
00454 RESET => RESET,
00455 READ_EN_DELAYED_RISE => rd_en_rise(0),
00456 READ_EN_DELAYED_Fall => rd_en_fall(0),
00457 FIRST_RISING => first_rising_rden (0),
00458 READ_DATA_RISE => READ_DATA_RISE(7 downto 0),
00459 READ_DATA_Fall => READ_DATA_Fall(7 downto 0),
00460 fifo_rd_enable => fifo_rd_enable,
00461 READ_DATA_FIFO_RISE => READ_DATA_FIFO_RISE(7 downto 0),
00462 READ_DATA_FIFO_Fall => READ_DATA_FIFO_Fall(7 downto 0),
00463 READ_DATA_VALID => read_data_valid0
00464 );
00465
00466
00467 rd_data_fifo1: mem_interface_top_rd_data_fifo_0 port map
00468 ( CLK => CLK,
00469 RESET => RESET,
00470 READ_EN_DELAYED_RISE => rd_en_rise(1),
00471 READ_EN_DELAYED_Fall => rd_en_fall(1),
00472 FIRST_RISING => first_rising_rden (0),
00473 READ_DATA_RISE => READ_DATA_RISE(15 downto 8),
00474 READ_DATA_Fall => READ_DATA_Fall(15 downto 8),
00475 fifo_rd_enable => fifo_rd_enable,
00476 READ_DATA_FIFO_RISE => READ_DATA_FIFO_RISE(15 downto 8),
00477 READ_DATA_FIFO_Fall => READ_DATA_FIFO_Fall(15 downto 8),
00478 READ_DATA_VALID => read_data_valid1
00479 );
00480
00481
00482 rd_data_fifo2: mem_interface_top_rd_data_fifo_0 port map
00483 ( CLK => CLK,
00484 RESET => RESET,
00485 READ_EN_DELAYED_RISE => rd_en_rise(2),
00486 READ_EN_DELAYED_Fall => rd_en_fall(2),
00487 FIRST_RISING => first_rising_rden (0),
00488 READ_DATA_RISE => READ_DATA_RISE(23 downto 16),
00489 READ_DATA_Fall => READ_DATA_Fall(23 downto 16),
00490 fifo_rd_enable => fifo_rd_enable,
00491 READ_DATA_FIFO_RISE => READ_DATA_FIFO_RISE(23 downto 16),
00492 READ_DATA_FIFO_Fall => READ_DATA_FIFO_Fall(23 downto 16),
00493 READ_DATA_VALID => read_data_valid2
00494 );
00495
00496
00497 rd_data_fifo3: mem_interface_top_rd_data_fifo_0 port map
00498 ( CLK => CLK,
00499 RESET => RESET,
00500 READ_EN_DELAYED_RISE => rd_en_rise(3),
00501 READ_EN_DELAYED_Fall => rd_en_fall(3),
00502 FIRST_RISING => first_rising_rden (0),
00503 READ_DATA_RISE => READ_DATA_RISE(31 downto 24),
00504 READ_DATA_Fall => READ_DATA_Fall(31 downto 24),
00505 fifo_rd_enable => fifo_rd_enable,
00506 READ_DATA_FIFO_RISE => READ_DATA_FIFO_RISE(31 downto 24),
00507 READ_DATA_FIFO_Fall => READ_DATA_FIFO_Fall(31 downto 24),
00508 READ_DATA_VALID => read_data_valid3
00509 );
00510
00511
00512 end arch;