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_data_tap_inc.vhd,v $ *
00015 --* $Revision: 1.2.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_data_tap_inc.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 tap logic for calibration of the memory data with respect to FPGA
00037 -- clock is provided here. According to the edge detection or not the taps in the
00038 -- IDELAY element of the Virtex4 devices are either increased or decreased.
00039 -------------------------------------------------------------------------------
00040
00041
00042 library ieee;
00043
00044 use ieee.std_logic_1164.all;
00045
00046 use ieee.std_logic_unsigned.all;
00047
00048 library unisim;
00049
00050 use unisim.vcomponents.all;
00051
00052 entity mem_interface_top_data_tap_inc is
00053 port(
00054 CLK : in ;
00055 RESET : in ;
00056 DATA_DLYINC : out ;
00057 DATA_DLYCE : out ;
00058 DATA_DLYRST : out ;
00059 DATA_TAP_SEL_DONE : out ;
00060 DQS_sel_done : in ;
00061 VALID_DATA_TAP_COUNT : in ;
00062 DATA_TAP_COUNT : in (5 downto 0)
00063 );
00064 end mem_interface_top_data_tap_inc;
00065
00066 architecture arch of mem_interface_top_data_tap_inc is
00067
00068 signal data_dlyinc_clk0 : ;
00069 signal data_dlyce_clk0 : ;
00070 signal data_dlyrst_clk0 : ;
00071 signal data_tap_inc_counter : (5 downto 0) := "000000";
00072 signal data_tap_sel_clk : ;
00073 signal data_tap_sel_r1 : ;
00074 signal DQS_sel_done_r : ;
00075 signal VALID_DATA_TAP_COUNT_r : ;
00076
00077 begin
00078
00079 DATA_TAP_SEL_DONE <= data_tap_sel_r1;
00080 DATA_DLYINC <= data_dlyinc_clk0;
00081 DATA_DLYCE <= data_dlyce_clk0;
00082 DATA_DLYRST <= data_dlyrst_clk0;
00083
00084 process(CLK)
00085 begin
00086 if(CLK'event and CLK = '1') then
00087 if(RESET = '1') then
00088 data_tap_sel_clk <= '0';
00089 elsif(data_tap_inc_counter = "000001") then
00090 data_tap_sel_clk <= '1';
00091 end if;
00092 end if;
00093 end process;
00094
00095 process(CLK)
00096 begin
00097 if(CLK'event and CLK = '1') then
00098 if(RESET = '1') then
00099 data_tap_sel_r1 <= '0';
00100 else
00101 data_tap_sel_r1 <= data_tap_sel_clk;
00102 end if;
00103 end if;
00104 end process;
00105
00106 process(CLK)
00107 begin
00108 if(CLK'event and CLK = '1') then
00109 if(RESET = '1') then
00110 DQS_sel_done_r <= '0';
00111 elsif(DQS_sel_done = '1') then
00112 DQS_sel_done_r <= '1';
00113 end if;
00114 end if;
00115 end process;
00116
00117 process(CLK)
00118 begin
00119 if(CLK'event and CLK = '1') then
00120 if(RESET = '1') then
00121 VALID_DATA_TAP_COUNT_r <= '0';
00122 else
00123 VALID_DATA_TAP_COUNT_r <= VALID_DATA_TAP_COUNT;
00124 end if;
00125 end if;
00126 end process;
00127
00128 process(CLK)
00129 begin
00130 if(CLK'event and CLK = '1') then
00131 if(RESET = '1' or DQS_sel_done_r = '0') then
00132 data_dlyinc_clk0 <= '0';
00133 data_dlyce_clk0 <= '0';
00134 data_dlyrst_clk0 <= '1';
00135 data_tap_inc_counter <= "000000";
00136 elsif(VALID_DATA_TAP_COUNT_r = '1') then
00137 data_dlyinc_clk0 <= '0';
00138 data_dlyce_clk0 <= '0';
00139 data_dlyrst_clk0 <= '0';
00140 data_tap_inc_counter <= DATA_TAP_COUNT;
00141 elsif(data_tap_inc_counter /= "000000") then -- Data IDELAY incremented
00142 data_dlyinc_clk0 <= '1';
00143 data_dlyce_clk0 <= '1';
00144 data_dlyrst_clk0 <= '0';
00145 data_tap_inc_counter <= data_tap_inc_counter - '1';
00146 else -- Data IDELAY no change mode
00147 data_dlyinc_clk0 <= '0';
00148 data_dlyce_clk0 <= '0';
00149 data_dlyrst_clk0 <= '0';
00150 data_tap_inc_counter <= "000000";
00151 end if;
00152 end if;
00153 end process;
00154
00155 end arch;