DS_DMA
pcie_src/pcie_core64_m1/source_virtex6/gtx_drp_chanalign_fix_3752_v6.vhd
00001 
00002 -------------------------------------------------------------------------------
00003 --
00004 -- (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
00005 --
00006 -- This file contains confidential and proprietary information
00007 -- of Xilinx, Inc. and is protected under U.S. and
00008 -- international copyright and other intellectual property
00009 -- laws.
00010 --
00011 -- DISCLAIMER
00012 -- This disclaimer is not a license and does not grant any
00013 -- rights to the materials distributed herewith. Except as
00014 -- otherwise provided in a valid license issued to you by
00015 -- Xilinx, and to the maximum extent permitted by applicable
00016 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
00017 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
00018 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
00019 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
00020 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
00021 -- (2) Xilinx shall not be liable (whether in contract or tort,
00022 -- including negligence, or under any other theory of
00023 -- liability) for any loss or damage of any kind or nature
00024 -- related to, arising under or in connection with these
00025 -- materials, including for any direct, or any indirect,
00026 -- special, incidental, or consequential loss or damage
00027 -- (including loss of data, profits, goodwill, or any type of
00028 -- loss or damage suffered as a result of any action brought
00029 -- by a third party) even if such damage or loss was
00030 -- reasonably foreseeable or Xilinx had been advised of the
00031 -- possibility of the same.
00032 --
00033 -- CRITICAL APPLICATIONS
00034 -- Xilinx products are not designed or intended to be fail-
00035 -- safe, or for use in any application requiring fail-safe
00036 -- performance, such as life-support or safety devices or
00037 -- systems, Class III medical devices, nuclear facilities,
00038 -- applications related to the deployment of airbags, or any
00039 -- other applications that could lead to death, personal
00040 -- injury, or severe property or environmental damage
00041 -- (individually and collectively, "Critical
00042 -- Applications"). Customer assumes the sole risk and
00043 -- liability of any use of Xilinx products in Critical
00044 -- Applications, subject only to applicable laws and
00045 -- regulations governing limitations on product liability.
00046 --
00047 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
00048 -- PART OF THIS FILE AT ALL TIMES.
00049 --
00050 -------------------------------------------------------------------------------
00051 -- Project    : Virtex-6 Integrated Block for PCI Express
00052 -- File       : gtx_drp_chanalign_fix_3752_v6.vhd
00053 -- Version    : 2.3
00054 ---- Description: Virtex6 Workaround for deadlock due lane-lane skew Bug
00055 ----
00056 ----
00057 ----
00058 ----------------------------------------------------------------------------------
00059 
00060 library ieee;
00061    use ieee.std_logic_1164.all;
00062    use ieee.std_logic_unsigned.all;
00063 
00064 entity GTX_DRP_CHANALIGN_FIX_3752_V6 is
00065    generic (
00066       C_SIMULATION                              : integer := 0    -- Set to 1 for simulation
00067 
00068    );
00069    port (
00070       dwe                                       : out std_logic;
00071       din                                       : out std_logic_vector(15 downto 0);      --THIS IS THE INPUT TO THE DRP
00072       den                                       : out std_logic;
00073       daddr                                     : out std_logic_vector(7 downto 0);
00074       drpstate                                  : out std_logic_vector(3 downto 0);      --DEBUG
00075       write_ts1                                 : in std_logic;
00076       write_fts                                 : in std_logic;
00077       dout                                      : in std_logic_vector(15 downto 0);      --THIS IS THE OUTPUT OF THE DRP
00078       drdy                                      : in std_logic;
00079       Reset_n                                   : in std_logic;
00080       drp_clk                                   : in std_logic
00081    );
00082 end GTX_DRP_CHANALIGN_FIX_3752_V6;
00083 
00084 architecture v6_pcie of GTX_DRP_CHANALIGN_FIX_3752_V6 is
00085 
00086    constant TCQ                      : integer := 1;
00087    constant DRP_IDLE_FTS             : std_logic_vector(3 downto 0) := "0001";
00088    constant DRP_IDLE_TS1             : std_logic_vector(3 downto 0) := "0010";
00089    constant DRP_RESET                : std_logic_vector(3 downto 0) := "0011";
00090    constant DRP_WRITE_FTS            : std_logic_vector(3 downto 0) := "0110";
00091    constant DRP_WRITE_DONE_FTS       : std_logic_vector(3 downto 0) := "0111";
00092    constant DRP_WRITE_TS1            : std_logic_vector(3 downto 0) := "1000";
00093    constant DRP_WRITE_DONE_TS1       : std_logic_vector(3 downto 0) := "1001";
00094    constant DRP_COM                  : std_logic_vector(9 downto 0) := "0110111100";
00095    constant DRP_FTS                  : std_logic_vector(9 downto 0) := "0100111100";
00096    constant DRP_TS1                  : std_logic_vector(9 downto 0) := "0001001010";
00097 
00098    signal next_daddr                              : std_logic_vector(7 downto 0);
00099    signal next_drpstate                           : std_logic_vector(3 downto 0);
00100    signal write_ts1_gated                         : std_logic;
00101    signal write_fts_gated                         : std_logic;
00102 
00103    -- Declare intermediate signals for referenced outputs
00104    signal daddr_v6pcie                           : std_logic_vector(7 downto 0);
00105    signal drpstate_v6pcie                        : std_logic_vector(3 downto 0);
00106 
00107 begin
00108    -- Drive referenced outputs
00109    daddr <= daddr_v6pcie;
00110    drpstate <= drpstate_v6pcie;
00111 
00112    process (drp_clk)
00113    begin
00114       if (drp_clk'event and drp_clk = '1') then
00115 
00116          if ((not(Reset_n)) = '1') then
00117 
00118             daddr_v6pcie <= X"08" after (TCQ)*1 ps;
00119             drpstate_v6pcie <= DRP_RESET after (TCQ)*1 ps;
00120 
00121             write_ts1_gated <= '0' after (TCQ)*1 ps;
00122             write_fts_gated <= '0' after (TCQ)*1 ps;
00123 
00124          else
00125 
00126             daddr_v6pcie <= next_daddr after (TCQ)*1 ps;
00127             drpstate_v6pcie <= next_drpstate after (TCQ)*1 ps;
00128 
00129             write_ts1_gated <= write_ts1 after (TCQ)*1 ps;
00130             write_fts_gated <= write_fts after (TCQ)*1 ps;
00131 
00132          end if;
00133 
00134       end if;
00135 
00136    end process;
00137 
00138 
00139    process (drpstate_v6pcie, daddr_v6pcie, drdy, write_ts1_gated, write_fts_gated)
00140    begin
00141 
00142       -- DEFAULT CONDITIONS
00143       next_drpstate <= drpstate_v6pcie;
00144       next_daddr <= daddr_v6pcie;
00145       den <= '0';
00146       din <= (others => '0');
00147       dwe <= '0';
00148 
00149       case drpstate_v6pcie is
00150 
00151          -- RESET CONDITION, WE NEED TO READ THE TOP 6 BITS OF THE DRP REGISTER WHEN WE GET THE WRITE FTS TRIGGER
00152          when DRP_RESET =>
00153             next_drpstate <= DRP_WRITE_TS1;
00154             next_daddr <= X"08";
00155 
00156          -- WRITE FTS SEQUENCE
00157          when DRP_WRITE_FTS =>
00158             den <= '1';
00159             dwe <= '1';
00160             if (daddr_v6pcie = X"08") then
00161                din <= X"FD3C";
00162             elsif (daddr_v6pcie = X"09") then
00163                din <= X"C53C";
00164             elsif (daddr_v6pcie = X"0A") then
00165                din <= X"FDBC";
00166             elsif (daddr_v6pcie = X"0B") then
00167                din <= X"853C";
00168             end if;
00169             next_drpstate <= DRP_WRITE_DONE_FTS;
00170 
00171          -- WAIT FOR FTS SEQUENCE WRITE TO FINISH, ONCE WE FINISH ALL WRITES GO TO FTS IDLE
00172          when DRP_WRITE_DONE_FTS =>
00173             if (drdy = '1') then
00174                if (daddr_v6pcie = X"0B") then
00175                   next_drpstate <= DRP_IDLE_FTS;
00176                   next_daddr <= X"08";
00177                else
00178                   next_drpstate <= DRP_WRITE_FTS;
00179                   next_daddr <= daddr_v6pcie + X"01";
00180                end if;
00181             end if;
00182 
00183          -- FTS IDLE: WAIT HERE UNTIL WE NEED TO WRITE TS1
00184          when DRP_IDLE_FTS =>
00185             if (write_ts1_gated = '1') then
00186                next_drpstate <= DRP_WRITE_TS1;
00187                next_daddr <= X"08";
00188             end if;
00189 
00190          -- WRITE TS1 SEQUENCE
00191          when DRP_WRITE_TS1 =>
00192             den <= '1';
00193             dwe <= '1';
00194             if (daddr_v6pcie = X"08") then
00195                din <= X"FC4A";
00196             elsif (daddr_v6pcie = X"09") then
00197                din <= X"DC4A";
00198             elsif (daddr_v6pcie = X"0A") then
00199                din <= X"C04A";
00200             elsif (daddr_v6pcie = X"0B") then
00201                din <= X"85BC";
00202             end if;
00203             next_drpstate <= DRP_WRITE_DONE_TS1;
00204 
00205          -- WAIT FOR TS1 SEQUENCE WRITE TO FINISH, ONCE WE FINISH ALL WRITES GO TO TS1 IDLE
00206          when DRP_WRITE_DONE_TS1 =>
00207             if (drdy = '1') then
00208                if (daddr_v6pcie = X"0B") then
00209                   next_drpstate <= DRP_IDLE_TS1;
00210                   next_daddr <= X"08";
00211                else
00212                   next_drpstate <= DRP_WRITE_TS1;
00213                   next_daddr <= daddr_v6pcie + X"01";
00214                end if;
00215             end if;
00216 
00217          -- TS1 IDLE: WAIT HERE UNTIL WE NEED TO WRITE FTS
00218          when DRP_IDLE_TS1 =>
00219             if (write_fts_gated = '1') then
00220                next_drpstate <= DRP_WRITE_FTS;
00221                next_daddr <= X"08";
00222             end if;
00223         when others =>
00224                next_drpstate <= DRP_RESET;
00225                next_daddr <= X"00";
00226       end case;
00227    end process;
00228 
00229 
00230 end v6_pcie;
00231 
00232 
00233