1 --////////////////////////////////////////////////////////////////////////////////
4 --// /___/ \ / Vendor: Xilinx
5 --// \ \ \/ Version : 2.
5
6 --// \ \ Application : 7 Series FPGAs Transceivers Wizard
7 --// / / Filename :s6link_adapt_top_dfe.vhd
13 -- Description : This module performs TX reset and initialization.
17 -- Module S6Link_adapt_top_dfe
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;
72 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
73 use IEEE.STD_LOGIC_ARITH.
ALL;
74 use IEEE.NUMERIC_STD.
ALL;
77 use unisim.vcomponents.
all;
81 AGC_TIMER : range 0 to 4095:= 150
90 DO : in (15 downto 0);
92 DADDR : out (8 downto 0);
93 DI : out (15 downto 0);
96 RXMONITOR : in (6 downto 0);
97 RXMONITORSEL : out (1 downto 0);
102 DEBUG : out (53 downto 0)
104 end S6Link_ADAPT_TOP_DFE;
110 WAIT_CYC :
range 0 to 16 :=
10
115 DO :
in (
15 downto 0);
117 DADDR :
out (
8 downto 0);
121 curr_state_debug :
out (
3 downto 0);
122 counter_debug :
out (
2 downto 0);
129 AGC_TIMER:
range 0 to 4095 :=
150
132 RST :
in ;
--RST low starts state machine
133 DONE :
out ;
--DONE asserted when complete, deasserted with RST high
134 DRDY :
in ;
--Connect to Channel DRP
135 DO :
in (
15 downto 0);
--Connect to Channel DRP
136 DCLK :
in ;
--Connect to same clk as Channel DRP DCLK
137 DADDR :
out (
8 downto 0);
--Connect to Channel DRP
138 DI :
out (
15 downto 0);
--Connect to Channel DRP
139 DEN :
out ;
--Connect to Channel DRP
140 DWE :
out ;
--Connect to Channel DRP
141 RXMONITOR :
in (
6 downto 0);
--Connect to RXMONITOR port
142 RXMONITORSEL :
out (
1 downto 0);
--Connect to RXMONITORSEL port
143 curr_state :
out (
3 downto 0);
150 usr_clk :
range 0 to 4095 :=
150
153 DCLK,reset,DRDY :
in ;
154 D0 :
in (
15 downto 0);
155 DI :
out (
15 downto 0);
156 holds :
out (
3 downto 0);
158 DADDR :
out (
8 downto 0);
160 state :
out (
3 downto 0);
161 count_lock_out :
out (
31 downto 0);
162 lock0,lock1,lock2,lock3 :
out
167 signal start_done : ;
170 signal ctle3_done : ;
174 signal daddr_starter : (8 downto 0);
175 signal den_starter : ;
176 signal dwe_starter : ;
178 signal daddr_lock : (8 downto 0);
181 signal di_lock : (15 downto 0);
183 signal daddr_ctle : (8 downto 0);
186 signal di_ctle : (15 downto 0);
188 signal holds : (3 downto 0);
192 signal rst_ctle_b : ;
193 signal rst_ctle_pre : ;
195 signal lock_done_r : ;
196 signal lock_done_r2 : ;
199 signal lock_state : (3 downto 0);
200 signal lock_count : (31 downto 0);
205 signal starter_state : (3 downto 0);
206 signal starter_count : (2 downto 0);
207 signal starter_rst_int : ;
208 signal ctle_state : (3 downto 0);
209 signal lock_done_rise : ;
213 ------------------------------------------------------------/
214 rst <= ((GTRXRESET or RXPMARESET or RXDFELPMRESET) and EN);
216 --assign rst_lock = ~start_done | en_b;
217 --assign rst_ctle = ~lock_done | ~CTLE3_COMP_EN | en_b;
218 rst_lock <= not(start_done);
219 rst_ctle_pre <= (not(lock_done) or not(CTLE3_COMP_EN));
220 rst_ctle <= not(rst_ctle_b);
221 done_pre <= ctle3_done when CTLE3_COMP_EN='1' else lock_done;
223 done_reg <= (done_pre and start_done);
--So that DONE goes low immediately after any of RESET's is asserted
225 --Start CTLE only after lock was just done. Don't want to start if user just asserted CTLE3_COMP_EN while lock_done already high.
226 rst_ctle_rise_sr_ff : FDCE
227 generic map ( INIT => '0'
233 CE => lock_done_rise ,
239 if rising_edge(DCLK) then
240 lock_done_r <= lock_done;
241 lock_done_r2 <= lock_done_r;
245 lock_done_rise <= (
not(lock_done_r2)
and lock_done_r);
247 DEBUG <= lock_state(3 downto 0) & lock_count(31 downto 0) & lock0 & lock1 & lock2 & lock3 & starter_state(3 downto 0) & starter_count(2 downto 0) & starter_rst_int & ctle_state(3 downto 0) & rst_lock & rst_ctle;
252 --When a block is not active, it will hold DADDR,DI,DEN,DWE low
253 DADDR <= (others => '0') when en_b='1' else (daddr_starter or daddr_lock or daddr_ctle);
254 DI <= (others => '0') when en_b='1' else (di_lock or di_ctle);
255 DEN <= '0' when en_b='1' else (den_starter or den_lock or den_ctle);
256 DWE <= '0' when en_b='1' else (dwe_starter or dwe_lock or dwe_ctle);
258 ----------------------------------------
259 ---- Sequence of operation:
260 ---- adapt_starter -> triggered by any of above resets to deassert then waits for DFE LPM reset to complete
261 ---- agc_loop_fsm -> triggered by adapt_starter completion then waits for all loops to lock
262 ---- ctle_agc_comp -> triggered by agc_loop_fsmm done and adjusts CTLE3 until AGC not railing or CTLE3 at max/min.
263 ----------------------------------------
273 DADDR => daddr_starter,
277 curr_state_debug => starter_state
(3 downto 0),
278 counter_debug => starter_count
(2 downto 0),
279 rst_int_debug => starter_rst_int
295 holds => holds,
--RXAGCHOLD,NC,KLHOLD,KHHOLD
297 state => lock_state
(3 downto 0),
298 count_lock_out => lock_count
(31 downto 0),
307 AGC_TIMER => AGC_TIMER
310 RST => rst_ctle,
--RST low starts state machine
311 DONE => ctle3_done,
--DONE asserted when complete, deasserted with RST high
312 DRDY => DRDY,
--Connect to Channel DRP
313 DO => DO,
--Connect to Channel DRP
314 DCLK => DCLK,
--Connect to same clk as Channel DRP DCLK
315 DADDR => daddr_ctle,
--Connect to Channel DRP
316 DI => di_ctle,
--Connect to Channel DRP
317 DEN => den_ctle,
--Connect to Channel DRP
318 DWE => dwe_ctle,
--Connect to Channel DRP
319 RXMONITOR => RXMONITOR,
--Connect to RXMONITOR port
320 RXMONITORSEL => RXMONITORSEL,
--Connect to RXMONITORSEL port
321 curr_state => ctle_state
(3 downto 0),