DS_DMA
pcie_src/pcie_core64_m1/source_virtex6/pcie_reset_delay_v6.vhd
00001 -------------------------------------------------------------------------------
00002 --
00003 -- (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
00004 --
00005 -- This file contains confidential and proprietary information
00006 -- of Xilinx, Inc. and is protected under U.S. and
00007 -- international copyright and other intellectual property
00008 -- laws.
00009 --
00010 -- DISCLAIMER
00011 -- This disclaimer is not a license and does not grant any
00012 -- rights to the materials distributed herewith. Except as
00013 -- otherwise provided in a valid license issued to you by
00014 -- Xilinx, and to the maximum extent permitted by applicable
00015 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
00016 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
00017 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
00018 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
00019 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
00020 -- (2) Xilinx shall not be liable (whether in contract or tort,
00021 -- including negligence, or under any other theory of
00022 -- liability) for any loss or damage of any kind or nature
00023 -- related to, arising under or in connection with these
00024 -- materials, including for any direct, or any indirect,
00025 -- special, incidental, or consequential loss or damage
00026 -- (including loss of data, profits, goodwill, or any type of
00027 -- loss or damage suffered as a result of any action brought
00028 -- by a third party) even if such damage or loss was
00029 -- reasonably foreseeable or Xilinx had been advised of the
00030 -- possibility of the same.
00031 --
00032 -- CRITICAL APPLICATIONS
00033 -- Xilinx products are not designed or intended to be fail-
00034 -- safe, or for use in any application requiring fail-safe
00035 -- performance, such as life-support or safety devices or
00036 -- systems, Class III medical devices, nuclear facilities,
00037 -- applications related to the deployment of airbags, or any
00038 -- other applications that could lead to death, personal
00039 -- injury, or severe property or environmental damage
00040 -- (individually and collectively, "Critical
00041 -- Applications"). Customer assumes the sole risk and
00042 -- liability of any use of Xilinx products in Critical
00043 -- Applications, subject only to applicable laws and
00044 -- regulations governing limitations on product liability.
00045 --
00046 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
00047 -- PART OF THIS FILE AT ALL TIMES.
00048 --
00049 -------------------------------------------------------------------------------
00050 -- Project    : Virtex-6 Integrated Block for PCI Express
00051 -- File       : pcie_reset_delay_v6.vhd
00052 -- Version    : 2.3
00053 -- Description: sys_reset_n delay (20ms) for Virtex6 PCIe Block
00054 --
00055 --
00056 --
00057 --------------------------------------------------------------------------------
00058 
00059 library ieee;
00060    use ieee.std_logic_1164.all;
00061    use ieee.std_logic_unsigned.all;
00062 
00063 entity pcie_reset_delay_v6 is
00064    generic (
00065       
00066       PL_FAST_TRAIN                                : boolean := FALSE;
00067       REF_CLK_FREQ                                 : integer := 0               -- 0 - 100 MHz, 1 - 125 MHz, 2 - 250 MHz
00068    );
00069    port (
00070       ref_clk                                      : in std_logic;
00071       sys_reset_n                                  : in std_logic;
00072       delayed_sys_reset_n                          : out std_logic
00073    );
00074 end pcie_reset_delay_v6;
00075 
00076 architecture v6_pcie of pcie_reset_delay_v6 is
00077    
00078    constant TCQ                                    : integer := 1;
00079       
00080   function t_bit(
00081     constant PL_FAST_TRAIN    : boolean;
00082     constant REF_CLK_FREQ     : integer)
00083     return integer is
00084      variable tbit_out : integer := 2;
00085   begin  -- t_bit
00086 
00087     if (PL_FAST_TRAIN) then
00088       tbit_out := 2;
00089     else
00090      if (REF_CLK_FREQ = 0) then
00091       tbit_out := 20;
00092      elsif (REF_CLK_FREQ = 1) then
00093       tbit_out := 20;
00094      else
00095       tbit_out := 21;
00096      end if;
00097     end if;
00098     return tbit_out;
00099   end t_bit;
00100 
00101    constant TBIT                                   : integer := t_bit(PL_FAST_TRAIN, REF_CLK_FREQ);
00102 
00103    signal reg_count_7_0                            : std_logic_vector(7 downto 0);
00104    signal reg_count_15_8                           : std_logic_vector(7 downto 0);
00105    signal reg_count_23_16                          : std_logic_vector(7 downto 0);
00106    signal concat_count                             : std_logic_vector(23 downto 0);
00107 
00108    -- X-HDL generated signals
00109 
00110    signal v6pcie1 : std_logic_vector(7 downto 0);
00111    signal v6pcie2 : std_logic_vector(7 downto 0);
00112    
00113    -- Declare intermediate signals for referenced outputs
00114    signal delayed_sys_reset_n_v6pcie0                  : std_logic;
00115 
00116 begin
00117    -- Drive referenced outputs
00118    delayed_sys_reset_n <= delayed_sys_reset_n_v6pcie0;
00119    
00120    concat_count <= (reg_count_23_16 & reg_count_15_8 & reg_count_7_0);
00121    
00122    
00123    v6pcie1 <= reg_count_15_8 + "00000001" when (reg_count_7_0 = "11111111") else
00124               reg_count_15_8;
00125 
00126    v6pcie2 <= reg_count_23_16 + "00000001" when ((reg_count_15_8 = "11111111") and (reg_count_7_0 = "11111111")) else
00127               reg_count_23_16;
00128 
00129    process (ref_clk, sys_reset_n)
00130    begin
00131      if ((not(sys_reset_n)) = '1') then
00132 
00133         reg_count_7_0 <= "00000000" after (TCQ)*1 ps;
00134         reg_count_15_8 <= "00000000" after (TCQ)*1 ps;
00135         reg_count_23_16 <= "00000000" after (TCQ)*1 ps;
00136 
00137      elsif (ref_clk'event and ref_clk = '1') then
00138 
00139        if (delayed_sys_reset_n_v6pcie0 /= '1') then
00140 
00141          reg_count_7_0 <= reg_count_7_0 + "00000001" after (TCQ)*1 ps;
00142          reg_count_15_8 <= v6pcie1 after (TCQ)*1 ps;
00143          reg_count_23_16 <= v6pcie2 after (TCQ)*1 ps;
00144 
00145        end if;
00146 
00147      end if;
00148    end process;
00149    
00150    
00151    delayed_sys_reset_n_v6pcie0 <= concat_count(TBIT);
00152    
00153 end v6_pcie;
00154 
00155