1 --////////////////////////////////////////////////////////////////////////////// 4 -- /___/ \ / Vendor: Xilinx 5 -- \ \ \/ Version : 3.0 6 -- \ \ Application : 7 Series FPGAs Transceivers Wizard 7 -- / / Filename :gtwizard_0_tx_startup_fsm.vhd 13 -- Description : This module performs TX reset and initialization. 17 -- Module gtwizard_0_tx_startup_fsm 18 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard 21 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved. 23 -- This file contains confidential and proprietary information 24 -- of Xilinx, Inc. and is protected under U.S. and 25 -- international copyright and other intellectual property 29 -- This disclaimer is not a license and does not grant any 30 -- rights to the materials distributed herewith. Except as 31 -- otherwise provided in a valid license issued to you by 32 -- Xilinx, and to the maximum extent permitted by applicable 33 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND 34 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES 35 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING 36 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- 37 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and 38 -- (2) Xilinx shall not be liable (whether in contract or tort, 39 -- including negligence, or under any other theory of 40 -- liability) for any loss or damage of any kind or nature 41 -- related to, arising under or in connection with these 42 -- materials, including for any direct, or any indirect, 43 -- special, incidental, or consequential loss or damage 44 -- (including loss of data, profits, goodwill, or any type of 45 -- loss or damage suffered as a result of any action brought 46 -- by a third party) even if such damage or loss was 47 -- reasonably foreseeable or Xilinx had been advised of the 48 -- possibility of the same. 50 -- CRITICAL APPLICATIONS 51 -- Xilinx products are not designed or intended to be fail- 52 -- safe, or for use in any application requiring fail-safe 53 -- performance, such as life-support or safety devices or 54 -- systems, Class III medical devices, nuclear facilities, 55 -- applications related to the deployment of airbags, or any 56 -- other applications that could lead to death, personal 57 -- injury, or severe property or environmental damage 58 -- (individually and collectively, "Critical 59 -- Applications"). Customer assumes the sole risk and 60 -- liability of any use of Xilinx products in Critical 61 -- Applications, subject only to applicable laws and 62 -- regulations governing limitations on product liability. 64 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS 65 -- PART OF THIS FILE AT ALL TIMES. 68 --***************************************************************************** 71 use IEEE.STD_LOGIC_1164.
all;
75 --! @ingroup xilinx_7Series_gtp7 79 STABLE_CLOCK_PERIOD : range 4 to 20 := 8;
--Period of the stable clock driving this state-machine, unit is [ns] 84 STABLE_CLOCK : in ;
--Stable Clock, either a stable clock from the PCB 85 --or reference-clock present at startup. 92 PLL0LOCK : in ;
--Lock Detect from the PLL0 of the GT 93 PLL1LOCK : in ;
--Lock Detect from the PLL1 of the GT 107 -- Retries it took to get the transceiver up and running 112 -- * Timing depends on the frequency of the stable clock. Hence counters-sizes 113 -- are calculated at design-time based on the Generics 115 -- * if either of PLLs is reset during TX-startup, it does not need to be reset again by RX 116 -- => signal which PLL has been reset 122 INIT, ASSERT_ALL_RESETS, RELEASE_PLL_RESET, 123 RELEASE_MMCM_RESET, WAIT_RESET_DONE, DO_PHASE_ALIGNMENT, 129 constant STARTUP_DELAY : := 500;
--AR43482: Transceiver needs to wait for 500 ns after configuration 159 signal time_out_2ms : := '0';
--\Flags that the various time-out points 171 constant MAX_WAIT_BYPASS : := 45824;
--110000 TXUSRCLK cycles is the max time for Multi lane designs 191 --Alias section, signals used within this module mapped to output ports: 199 -- The counter starts running when configuration has finished and 200 -- the clock is stable. When its maximum count-value has been reached, 201 -- the 500 ns from Answer Record 43482 have been passed. 225 -- One common large counter for generating three time-out signals. 226 -- Intermediate time-outs are derived from calculated values, based 227 -- on the period of the provided clock. 269 -- Clock Domain Crossing 391 --FSM for resetting the GTX/GTH/GTP in the 7-series. 392 --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 -- Following steps are performed: 395 -- 1) Only for GTX - After configuration wait for approximately 500 ns as specified in 396 -- answer-record 43482 397 -- 2) Assert all resets on the GT and on an MMCM potentially connected. 398 -- After that wait until a reference-clock has been detected. 399 -- 3) Release the reset to the GT and wait until the GT-PLL has locked. 400 -- 4) Release the MMCM-reset and wait until the MMCM has signalled lock. 401 -- Also signal to the RX-side which PLL has been reset. 402 -- 5) Wait for the RESET_DONE-signal from the GT. 403 -- 6) Signal to start the phase-alignment procedure and wait for it to 405 -- 7) Reset-sequence has successfully run through. Signal this to the 406 -- rest of the design by asserting TX_FSM_RESET_DONE. 428 --Initial state after configuration. This state will be left after 429 --approx. 500 ns and not be re-entered. 435 when ASSERT_ALL_RESETS => 436 --This is the state into which the FSM will always jump back if any 437 --time-outs will occur. 438 --The number of retries is reported on the output RETRY_COUNTER. In 439 --case the transceiver never comes up for some reason, this machine 440 --will still continue its best and rerun until the FPGA is turned off 441 --or the transceivers come up correctly. 469 when RELEASE_PLL_RESET => 470 --PLL-Reset of the GTX gets released and the time-out counter 482 -- If too many retries are performed compared to what is specified in 483 -- the generic, the counter simply wraps around. 488 reset_time_out <= '1';
-- Need to reset time outs again or we'll always end up back here 492 when RELEASE_MMCM_RESET => 494 --Release of the MMCM-reset. Waiting for the MMCM to lock. 507 -- If too many retries are performed compared to what is specified in 508 -- the generic, the counter simply wraps around. 516 when WAIT_RESET_DONE => 526 -- If too many retries are performed compared to what is specified in 527 -- the generic, the counter simply wraps around. 535 when DO_PHASE_ALIGNMENT => 536 --The direct handling of the signals for the Phase Alignment is done outside 537 --this state-machine. 548 -- If too many retries are performed compared to what is specified in 549 -- the generic, the counter simply wraps around. 557 when RESET_FSM_DONE =>
integer := 500000/ STABLE_CLOCK_PERIOD WAIT_TIMEOUT_500us
std_logic := '0' init_wait_done
std_logic soft_reset_sync
std_logic := '0' pll0lock_prev
(INIT,ASSERT_ALL_RESETS,RELEASE_PLL_RESET,RELEASE_MMCM_RESET,WAIT_RESET_DONE,DO_PHASE_ALIGNMENT,RESET_FSM_DONE) tx_rst_fsm_type
integer range 0 to MMCM_LOCK_CNT_MAX- 1:= 0 mmcm_lock_count
std_logic := '0' mmcm_lock_i
std_logic := '0' mmcm_lock_int
integer := 45824 MAX_WAIT_BYPASS
std_logic := '0' pll1lock_ris_edge
integer range 0 to WAIT_MAX:= 0 init_wait_count
out TX_FSM_RESET_DONEstd_logic
std_logic := '0' pll_reset_asserted
out RUN_PHALIGNMENTstd_logic := '0'
std_logic := '0' run_phase_alignment_int_s3
std_logic := '0' tx_fsm_reset_done_int
integer := 1000/ STABLE_CLOCK_PERIOD WAIT_1us_cycles
std_logic := '0' reset_time_out
std_logic := '0' pll1lock_prev
std_logic := '0' count_1us_done
in PLL0REFCLKLOSTstd_logic
std_logic := '0' time_out_wait_bypass_s3
std_logic := '0' time_out_wait_bypass_s2
integer range 0 to MAX_RETRIES retry_counter_int
integer := WAIT_1us_cycles+ 10 WAIT_1us
out RESET_PHALIGNMENTstd_logic := '0'
std_logic := '0' run_phase_alignment_int_s2
std_logic := '0' tx_fsm_reset_done_int_s3
integer := 500 STARTUP_DELAY
std_logic := '0' time_tlock_max
std_logic := '0' gttxreset_i
TX_PLL0_USEDboolean := false
out MMCM_RESETstd_logic := '1'
std_logic := '0' txresetdone_s3
std_logic := '0' time_out_wait_bypass
std_logic := '0' mmcm_lock_reclocked
integer := 2000000/ STABLE_CLOCK_PERIOD WAIT_TIMEOUT_2ms
out GTTXRESETstd_logic := '0'
integer range 0 to WAIT_1us:= 0 count_1us
integer := STARTUP_DELAY/ STABLE_CLOCK_PERIOD WAIT_CYCLES
std_logic := '0' run_phase_alignment_int
std_logic txpmaresetdone_sync
in PHALIGNMENT_DONEstd_logic
integer := 1024 MMCM_LOCK_CNT_MAX
std_logic := '0' time_out_2ms
std_logic := '0' pll1lock_sync
out TXUSERRDYstd_logic := '0'
in TXPMARESETDONEstd_logic
integer := 100000/ STABLE_CLOCK_PERIOD WAIT_TLOCK_MAX
std_logic := '0' txpmaresetdone_i
RETRY_COUNTER_BITWIDTHinteger range 2 to 8:= 8
integer := 2** RETRY_COUNTER_BITWIDTH- 1 MAX_RETRIES
std_logic := '0' time_out_500us
out PLL1_RESETstd_logic := '0'
out RETRY_COUNTERstd_logic_vector( RETRY_COUNTER_BITWIDTH- 1 downto 0) :=( others => '0')
STABLE_CLOCK_PERIODinteger range 4 to 20:= 8
in PLL1REFCLKLOSTstd_logic
out PLL0_RESETstd_logic := '0'
tx_rst_fsm_type := INIT tx_state
std_logic := '0' txresetdone_s2
std_logic := '0' txuserrdy_i
std_logic := '0' pll0lock_ris_edge
integer := WAIT_CYCLES+ 10 WAIT_MAX
integer range 0 to WAIT_TIMEOUT_2ms:= 0 time_out_counter
integer range 0 to MAX_WAIT_BYPASS- 1 wait_bypass_count
std_logic := '0' pll0lock_sync
std_logic := '0' tx_fsm_reset_done_int_s2