SURF  1.0
Gtp7AutoPhaseAligner.vhd
Go to the documentation of this file.
1 --////////////////////////////////////////////////////////////////////////////////
2 --// ____ ____
3 --// / /\/ /
4 --// /___/ \ / Vendor: Xilinx
5 --// \ \ \/ Version : 2.5
6 --// \ \ Application : 7 Series FPGAs Transceivers Wizard
7 --// / / Filename : gtwizard_v2_5_auto_phase_align.vhd
8 --// /___/ /\
9 --// \ \ / \
10 --// \___\/\___\
11 --//
12 --//
13 -- Description : The logic below implements the procedure to do automatic phase-alignment
14 -- on the 7-series GTX as described in ug476pdf, version 1.3,
15 -- Chapters "Using the TX Phase Alignment to Bypass the TX Buffer"
16 -- and "Using the RX Phase Alignment to Bypass the RX Elastic Buffer"
17 -- Should the logic below differ from what is described in a later version
18 -- of the user-guide, you are using an auto-alignment block, which is
19 -- out of date and needs to be updated for safe operation.
20 --
21 --
22 --
23 -- Module gtwizard_v2_5_AUTO_PHASE_ALIGN
24 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
25 --
26 --
27 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
28 --
29 -- This file contains confidential and proprietary information
30 -- of Xilinx, Inc. and is protected under U.S. and
31 -- international copyright and other intellectual property
32 -- laws.
33 --
34 -- DISCLAIMER
35 -- This disclaimer is not a license and does not grant any
36 -- rights to the materials distributed herewith. Except as
37 -- otherwise provided in a valid license issued to you by
38 -- Xilinx, and to the maximum extent permitted by applicable
39 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
40 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
41 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
42 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
43 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
44 -- (2) Xilinx shall not be liable (whether in contract or tort,
45 -- including negligence, or under any other theory of
46 -- liability) for any loss or damage of any kind or nature
47 -- related to, arising under or in connection with these
48 -- materials, including for any direct, or any indirect,
49 -- special, incidental, or consequential loss or damage
50 -- (including loss of data, profits, goodwill, or any type of
51 -- loss or damage suffered as a result of any action brought
52 -- by a third party) even if such damage or loss was
53 -- reasonably foreseeable or Xilinx had been advised of the
54 -- possibility of the same.
55 --
56 -- CRITICAL APPLICATIONS
57 -- Xilinx products are not designed or intended to be fail-
58 -- safe, or for use in any application requiring fail-safe
59 -- performance, such as life-support or safety devices or
60 -- systems, Class III medical devices, nuclear facilities,
61 -- applications related to the deployment of airbags, or any
62 -- other applications that could lead to death, personal
63 -- injury, or severe property or environmental damage
64 -- (individually and collectively, "Critical
65 -- Applications"). Customer assumes the sole risk and
66 -- liability of any use of Xilinx products in Critical
67 -- Applications, subject only to applicable laws and
68 -- regulations governing limitations on product liability.
69 --
70 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
71 -- PART OF THIS FILE AT ALL TIMES.
72 
73 
74 --*****************************************************************************
75 
76 library IEEE;
77 use IEEE.STD_LOGIC_1164.all;
78 use IEEE.NUMERIC_STD.all;
79 
80 --! @see entity
81  --! @ingroup xilinx_7Series_gtp7
83  generic(
84  GT_TYPE : string := "GTX"
85  );
86 
87  port (STABLE_CLOCK : in std_logic; --Stable Clock, either a stable clock from the PCB
88  --or reference-clock present at startup.
89  RUN_PHALIGNMENT : in std_logic; --Signal from the main Reset-FSM to run the auto phase-alignment procedure
90  PHASE_ALIGNMENT_DONE : out std_logic := '0'; -- Auto phase-alignment performed sucessfully
91  PHALIGNDONE : in std_logic; --\ Phase-alignment signals from and to the
92  DLYSRESET : out std_logic; -- |transceiver.
93  DLYSRESETDONE : in std_logic; --/
94  RECCLKSTABLE : in std_logic --/on the RX-side.
95 
96  );
97 end Gtp7AutoPhaseAligner;
98 
99 architecture RTL of Gtp7AutoPhaseAligner is
100 
101 -- component gtwizard_v2_5_sync_block
102 -- generic (
103 -- INITIALISE : bit_vector(1 downto 0) := "00"
104 -- );
105 -- port (
106 -- clk : in std_logic;
107 -- data_in : in std_logic;
108 -- data_out : out std_logic
109 -- );
110 -- end component;
111 
113  INIT, WAIT_PHRST_DONE, COUNT_PHALIGN_DONE, PHALIGN_DONE
114  );
115 
117  signal phaligndone_prev : std_logic := '0';
118  signal phaligndone_ris_edge : std_logic;
119 
120  signal count_phalign_edges : integer range 0 to 3 := 0;
121  signal phaligndone_sync : std_logic := '0';
122  signal dlysresetdone_sync : std_logic := '0';
123 
124 begin
125 
126  sync_PHALIGNDONE : entity work.Synchronizer
127  port map
128  (
129  clk => STABLE_CLOCK,
130  dataIn => PHALIGNDONE,
132  );
133 
134  sync_DLYSRESETDONE : entity work.Synchronizer
135  port map
136  (
137  clk => STABLE_CLOCK,
140  );
141 
142 
143  process(STABLE_CLOCK)
144  begin
145  if rising_edge(STABLE_CLOCK) then
147  end if;
148  end process;
149  phaligndone_ris_edge <= '1' when (phaligndone_prev = '0') and (phaligndone_sync = '1') else '0';
150 
151  process(STABLE_CLOCK)
152  begin
153  if rising_edge(STABLE_CLOCK) then
154  if RUN_PHALIGNMENT = '0' or RECCLKSTABLE = '0' then
155  DLYSRESET <= '0';
156  count_phalign_edges <= 0;
157  PHASE_ALIGNMENT_DONE <= '0';
158  phalign_state <= INIT;
159  else
160  if phaligndone_ris_edge = '1' then
161  if count_phalign_edges < 3 then
163  end if;
164  end if;
165 
166  DLYSRESET <= '0';
167 
168  case phalign_state is
169  when INIT =>
170  PHASE_ALIGNMENT_DONE <= '0';
171  if RUN_PHALIGNMENT = '1' and RECCLKSTABLE = '1' then
172  --DLYSRESET is toggled to '1'
173  DLYSRESET <= '1';
174  phalign_state <= WAIT_PHRST_DONE;
175  end if;
176 
177  when WAIT_PHRST_DONE =>
178  if dlysresetdone_sync = '1' then
179  phalign_state <= COUNT_PHALIGN_DONE;
180  end if;
181  --No timeout-check here as that is done in the main FSM
182 
183  when COUNT_PHALIGN_DONE =>
184  if ((GT_TYPE = "GTX" and count_phalign_edges = 2) or ((GT_TYPE = "GTH" or GT_TYPE = "GTP") and phaligndone_ris_edge = '1')) then
185  --For GTX: Only on the second edge of the PHALIGNDONE-signal the
186  -- phase-alignment is completed
187  --For GTH, GTP: TXSYNCDONE indicates the completion of Phase Alignment
188 
189  phalign_state <= PHALIGN_DONE;
190  end if;
191 
192  when PHALIGN_DONE =>
193  PHASE_ALIGNMENT_DONE <= '1';
194 
195  when others =>
196  phalign_state <= INIT;
197 
198  end case;
199  end if;
200  end if;
201  end process;
202 
203 end RTL;
204 
integer range 0 to 3:= 0 count_phalign_edges
(INIT,WAIT_PHRST_DONE,COUNT_PHALIGN_DONE,PHALIGN_DONE) phase_align_auto_fsm
phase_align_auto_fsm := INIT phalign_state
out dataOutsl
_library_ IEEEIEEE
Definition: Gth7TxRst.vhd:70
out PHASE_ALIGNMENT_DONEstd_logic := '0'