SURF  1.0
Gth7AutoPhaseAligner.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_gth7
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 Gth7AutoPhaseAligner;
98 
99 architecture RTL of Gth7AutoPhaseAligner 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  attribute KEEP_HIERARCHY : string;
125  attribute KEEP_HIERARCHY of
126  sync_PHALIGNDONE,
127  sync_DLYSRESETDONE : label is "TRUE";
128 
129 begin
130 
131  sync_PHALIGNDONE : entity work.Synchronizer
132  port map
133  (
134  clk => STABLE_CLOCK,
135  dataIn => PHALIGNDONE,
137  );
138 
139  sync_DLYSRESETDONE : entity work.Synchronizer
140  port map
141  (
142  clk => STABLE_CLOCK,
145  );
146 
147 
148  process(STABLE_CLOCK)
149  begin
150  if rising_edge(STABLE_CLOCK) then
152  end if;
153  end process;
154  phaligndone_ris_edge <= '1' when (phaligndone_prev = '0') and (phaligndone_sync = '1') else '0';
155 
156  process(STABLE_CLOCK)
157  begin
158  if rising_edge(STABLE_CLOCK) then
159  if RUN_PHALIGNMENT = '0' or RECCLKSTABLE = '0' then
160  DLYSRESET <= '0';
161  count_phalign_edges <= 0;
162  PHASE_ALIGNMENT_DONE <= '0';
163  phalign_state <= INIT;
164  else
165  if phaligndone_ris_edge = '1' then
166  if count_phalign_edges < 3 then
168  end if;
169  end if;
170 
171  DLYSRESET <= '0';
172 
173  case phalign_state is
174  when INIT =>
175  PHASE_ALIGNMENT_DONE <= '0';
176  if RUN_PHALIGNMENT = '1' and RECCLKSTABLE = '1' then
177  --DLYSRESET is toggled to '1'
178  DLYSRESET <= '1';
179  phalign_state <= WAIT_PHRST_DONE;
180  end if;
181 
182  when WAIT_PHRST_DONE =>
183  if dlysresetdone_sync = '1' then
184  phalign_state <= COUNT_PHALIGN_DONE;
185  end if;
186  --No timeout-check here as that is done in the main FSM
187 
188  when COUNT_PHALIGN_DONE =>
189  if ((GT_TYPE = "GTX" and count_phalign_edges = 2) or ((GT_TYPE = "GTH" or GT_TYPE = "GTP") and phaligndone_ris_edge = '1')) then
190  --For GTX: Only on the second edge of the PHALIGNDONE-signal the
191  -- phase-alignment is completed
192  --For GTH, GTP: TXSYNCDONE indicates the completion of Phase Alignment
193 
194  phalign_state <= PHALIGN_DONE;
195  end if;
196 
197  when PHALIGN_DONE =>
198  PHASE_ALIGNMENT_DONE <= '1';
199 
200  when OTHERS =>
201  phalign_state <= INIT;
202 
203  end case;
204  end if;
205  end if;
206  end process;
207 
208 end RTL;
209 
out PHASE_ALIGNMENT_DONESTD_LOGIC := '0'
_library_ IEEEIEEE
Definition: StdRtlPkg.vhd:18
out dataOutsl
integer range 0 to 3:= 0 count_phalign_edges
phase_align_auto_fsm := INIT phalign_state
(INIT,WAIT_PHRST_DONE,COUNT_PHALIGN_DONE,PHALIGN_DONE) phase_align_auto_fsm