SURF  1.0
Gtp7RxRst.vhd
Go to the documentation of this file.
1 --////////////////////////////////////////////////////////////////////////////////
2 --// ____ ____
3 --// / /\/ /
4 --// /___/ \ / Vendor: Xilinx
5 --// \ \ \/ Version : 3.0
6 --// \ \ Application : 7 Series FPGAs Transceivers Wizard
7 --// / / Filename : gtwizard_0_rx_startup_fsm.vhd
8 --// /___/ /\
9 --// \ \ / \
10 --// \___\/\___\
11 --//
12 --//
13 -- Description : This module performs RX reset and initialization.
14 --
15 --
16 --
17 -- Module gtwizard_0_rx_startup_fsm
18 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
19 --
20 --
21 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
22 --
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
26 -- laws.
27 --
28 -- DISCLAIMER
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.
49 --
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.
63 --
64 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
65 -- PART OF THIS FILE AT ALL TIMES.
66 
67 
68 --*****************************************************************************
69 
70 library ieee;
71 use ieee.std_logic_1164.all;
72 use ieee.std_logic_arith.all;
73 use ieee.std_logic_unsigned.all;
74 
75 --! @see entity
76  --! @ingroup xilinx_7Series_gtp7
77 entity Gtp7RxRst is
78  generic(
79  TPD_G : time := 1 ns;
80  SIMULATION_G : boolean := false;
81  STABLE_CLOCK_PERIOD : integer range 4 to 20 := 8; --Period of the stable clock driving this state-machine, unit is [ns]
82  RETRY_COUNTER_BITWIDTH : integer range 2 to 8 := 8;
83  TX_PLL0_USED : boolean := false; -- the TX and RX Reset FSMs must
84  RX_PLL0_USED : boolean := false -- share these two generic values
85  );
86  port (STABLE_CLOCK : in std_logic; --Stable Clock, either a stable clock from the PCB
87  --or reference-clock present at startup.
88  RXUSERCLK : in std_logic; --RXUSERCLK as used in the design
89  SOFT_RESET : in std_logic; --User Reset, can be pulled any time
90  RXPMARESETDONE : in std_logic;
91  RXOUTCLK : in std_logic;
92  PLL0REFCLKLOST : in std_logic; --PLL0 Reference-clock for the GT is lost
93  PLL1REFCLKLOST : in std_logic; --PLL1 Reference-clock for the GT is lost
94  PLL0LOCK : in std_logic; --Lock Detect from the PLL0 of the GT
95  PLL1LOCK : in std_logic; --Lock Detect from the PLL1 of the GT
96  RXRESETDONE : in std_logic;
97  MMCM_LOCK : in std_logic;
98  RECCLK_STABLE : in std_logic;
99  RECCLK_MONITOR_RESTART : in std_logic := '0';
100  DATA_VALID : in std_logic;
101  TXUSERRDY : in std_logic; --TXUSERRDY from GT
102  DONT_RESET_ON_DATA_ERROR : in std_logic := '0';
103  GTRXRESET : out std_logic := '0';
104  MMCM_RESET : out std_logic := '1';
105  PLL0_RESET : out std_logic := '0'; --Reset PLL0 (only if RX uses PLL0)
106  PLL1_RESET : out std_logic := '0'; --Reset PLL1 (only if RX uses PLL1)
107  RX_FSM_RESET_DONE : out std_logic; --Reset-sequence has sucessfully been finished.
108  RXUSERRDY : out std_logic := '0';
109  RUN_PHALIGNMENT : out std_logic;
110  PHALIGNMENT_DONE : in std_logic;
111  RESET_PHALIGNMENT : out std_logic := '0';
112  RXDFEAGCHOLD : out std_logic := '0';
113  RXDFELFHOLD : out std_logic := '0';
114  RXLPMLFHOLD : out std_logic := '0';
115  RXLPMHFHOLD : out std_logic := '0';
116  RETRY_COUNTER : out std_logic_vector (RETRY_COUNTER_BITWIDTH-1 downto 0) := (others => '0') -- Number of
117  -- Retries it took to get the transceiver up and running
118  );
119 end Gtp7RxRst;
120 
121 --Interdependencies:
122 -- * Timing depends on the frequency of the stable clock. Hence counters-sizes
123 -- are calculated at design-time based on the Generics
124 --
125 -- * if either of the PLLs is reset during TX-startup, it does not need to be reset again by RX
126 -- => signal which PLL has been reset
127 -- *
128 
129 architecture RTL of Gtp7RxRst is
131  INIT, ASSERT_ALL_RESETS, RELEASE_PLL_RESET, VERIFY_RECCLK_STABLE,
132  RELEASE_MMCM_RESET, WAIT_RESET_DONE, DO_PHASE_ALIGNMENT,
133  MONITOR_DATA_VALID, FSM_DONE);
134 
135  signal rx_state : rx_rst_fsm_type := INIT;
136 
137  constant MMCM_LOCK_CNT_MAX : integer := 1024;
138  constant STARTUP_DELAY : integer := 500; --AR43482: Transceiver needs to wait for 500 ns after configuration
139  constant WAIT_CYCLES : integer := STARTUP_DELAY / STABLE_CLOCK_PERIOD; -- Number of Clock-Cycles to wait after configuration
140  constant WAIT_MAX : integer := WAIT_CYCLES + 10; -- 500 ns plus some additional margin
141  constant WAIT_TIMEOUT_2ms : integer := 3000000 / STABLE_CLOCK_PERIOD; -- 2 ms time-out
142  constant WAIT_TLOCK_MAX : integer := 100000 / STABLE_CLOCK_PERIOD; --100 us time-out
143  constant WAIT_TIMEOUT_500us : integer := 500000 / STABLE_CLOCK_PERIOD; --500 us time-out
144  constant WAIT_TIMEOUT_1us : integer := 1000 / STABLE_CLOCK_PERIOD; --1 us time-out
145  constant WAIT_TIMEOUT_100us : integer := 100000 / STABLE_CLOCK_PERIOD; --100 us time-out
146  constant WAIT_TIME_ADAPT : integer := (37000000 /integer(3.125))/STABLE_CLOCK_PERIOD;
147 
148  signal soft_reset_sync : std_logic;
149  signal soft_reset_rise : std_logic;
150  signal soft_reset_fall : std_logic;
151 
152  signal init_wait_count : integer range 0 to WAIT_MAX := 0;
153  signal init_wait_done : std_logic := '0';
154  signal pll_reset_asserted : std_logic := '0';
155  signal rx_fsm_reset_done_int : std_logic := '0';
156  signal rx_fsm_reset_done_int_s2 : std_logic := '0';
157  signal rx_fsm_reset_done_int_s3 : std_logic := '0';
158 
159  signal rxresetdone_s2 : std_logic := '0';
160  signal rxresetdone_s3 : std_logic := '0';
161 
162  constant MAX_RETRIES : integer := 2**RETRY_COUNTER_BITWIDTH-1;
163  signal retry_counter_int : integer range 0 to MAX_RETRIES := 0;
164  signal time_out_counter : integer range 0 to WAIT_TIMEOUT_2ms := 0;
165  signal recclk_mon_restart_count : integer range 0 to 3 := 0;
166  signal recclk_mon_count_reset : std_logic := '0';
167 
168  signal reset_time_out : std_logic := '0';
169  signal time_out_2ms : std_logic := '0'; --\Flags that the various time-out points
170  signal time_tlock_max : std_logic := '0'; --|have been reached.
171  signal time_out_500us : std_logic := '0'; --|
172  signal time_out_1us : std_logic := '0'; --/
173  signal time_out_100us : std_logic := '0'; --/
174  signal check_tlock_max : std_logic := '0';
175 
176  signal mmcm_lock_count : integer range 0 to MMCM_LOCK_CNT_MAX-1 := 0;
177  signal mmcm_lock_int : std_logic := '0';
178  signal mmcm_lock_i : std_logic := '0';
179  signal mmcm_lock_reclocked : std_logic := '0';
180  signal gtrxreset_i : std_logic := '0';
181  signal mmcm_reset_i : std_logic := '1';
182  signal rxpmaresetdone_i : std_logic := '0';
183  signal rxpmaresetdone_ss : std_logic := '0';
184  signal rxpmaresetdone_sync : std_logic;
186 
187  signal run_phase_alignment_int : std_logic := '0';
188  signal run_phase_alignment_int_s2 : std_logic := '0';
189  signal run_phase_alignment_int_s3 : std_logic := '0';
190 
191  constant MAX_WAIT_BYPASS : integer := 5000; --5000 RXUSRCLK cycles is the max time for Multi lanes designs
192  signal wait_bypass_count : integer range 0 to MAX_WAIT_BYPASS-1;
193  signal time_out_wait_bypass : std_logic := '0';
194  signal time_out_wait_bypass_s2 : std_logic := '0';
195  signal time_out_wait_bypass_s3 : std_logic := '0';
196 
197  signal refclk_lost : std_logic;
198 
199  signal data_valid_sync : std_logic := '0';
200  signal pll0lock_sync : std_logic := '0';
201  signal pll1lock_sync : std_logic := '0';
202  signal pll0lock_prev : std_logic := '0';
203  signal pll1lock_prev : std_logic := '0';
204  signal pll0lock_ris_edge : std_logic := '0';
205  signal pll1lock_ris_edge : std_logic := '0';
206  signal phalignment_done_sync : std_logic := '0';
207 
208  signal fsmCnt : std_logic_vector(15 downto 0) := (others => '0');
209 
210 begin
211 
212  --Alias section, signals used within this module mapped to output ports:
213  RETRY_COUNTER <= conv_std_logic_vector(retry_counter_int, RETRY_COUNTER_BITWIDTH);
218 
219  process(STABLE_CLOCK)
220  begin
221  if rising_edge(STABLE_CLOCK) then
222  -- The counter starts running when configuration has finished and
223  -- the clock is stable. When its maximum count-value has been reached,
224  -- the 500 ns from Answer Record 43482 have been passed.
225  if init_wait_count = WAIT_MAX then
226  init_wait_done <= '1';
227  else
229  end if;
230  end if;
231  end process;
232 
233  -- Synchronize PMARESETDONE to STABLE_CLOCK
234  sync2_rxpmaresetdone : entity work.SynchronizerEdge
235  port map (
236  clk => STABLE_CLOCK,
240 
242  begin
243  if (gtrxreset_i = '1') then
245  elsif (rising_edge(STABLE_CLOCK)) then
246  if(rxpmaresetdone_ss = '1') then
248  else
250  end if;
251  end if;
252  end process;
253 
254  retries_recclk_monitor : process(STABLE_CLOCK)
255  begin
256  --This counter monitors, how many retries the RECCLK monitor
257  --runs. If during startup too many retries are necessary, the whole
258  --initialisation-process of the transceivers gets restarted.
259  if rising_edge(STABLE_CLOCK) then
260  if recclk_mon_count_reset = '1' then
262  elsif RECCLK_MONITOR_RESTART = '1' then
263  if recclk_mon_restart_count = 3 then
265  else
267  end if;
268  end if;
269  end if;
270  end process;
271 
272  timeouts : process(STABLE_CLOCK)
273  begin
274  if rising_edge(STABLE_CLOCK) then
275  -- One common large counter for generating three time-out signals.
276  -- Intermediate time-outs are derived from calculated values, based
277  -- on the period of the provided clock.
278  if reset_time_out = '1' then
279  time_out_counter <= 0;
280  time_out_2ms <= '0';
281  time_tlock_max <= '0';
282  time_out_500us <= '0';
283  time_out_1us <= '0';
284  time_out_100us <= '0';
285  else
287  time_out_2ms <= '1';
288  else
290  end if;
291 
292  if (time_out_counter > WAIT_TLOCK_MAX) and (check_tlock_max = '1') then
293  time_tlock_max <= '1';
294  end if;
295 
297  time_out_500us <= '1';
298  end if;
299 
301  time_out_1us <= '1';
302  end if;
303 
305  time_out_100us <= '1';
306  end if;
307 
308  end if;
309  end if;
310  end process;
311 
312 
313 
314  mmcm_lock_wait : process(STABLE_CLOCK)
315  begin
316  --The lock-signal from the MMCM is not immediately used but
317  --enabling a counter. Only when the counter hits its maximum,
318  --the MMCM is considered as "really" locked.
319  --The counter avoids that the FSM already starts on only a
320  --coarse lock of the MMCM (=toggling of the LOCK-signal).
321  if rising_edge(STABLE_CLOCK) then
322  if mmcm_lock_i = '0' then
323  mmcm_lock_count <= 0;
324  mmcm_lock_reclocked <= '0';
325  else
326  if mmcm_lock_count < MMCM_LOCK_CNT_MAX - 1 then
328  else
329  mmcm_lock_reclocked <= '1';
330  end if;
331  end if;
332  end if;
333  end process;
334 
335 
336  -- Clock Domain Crossing
337 
338  sync_run_phase_alignment_int : entity work.Synchronizer
339  generic map (
340  TPD_G => TPD_G,
341  STAGES_G => 3)
342  port map (
343  clk => RXUSERCLK,
346 
347  sync_rx_fsm_reset_done_int : entity work.Synchronizer
348  generic map (
349  TPD_G => TPD_G,
350  STAGES_G => 3)
351  port map (
352  clk => RXUSERCLK,
355 
356  Synchronizer_SOFT_RESET : entity work.SynchronizerEdge
357  generic map (
358  TPD_G => TPD_G)
359  port map (
360  clk => STABLE_CLOCK,
361  dataIn => SOFT_RESET,
365 
366  sync_RXRESETDONE : entity work.Synchronizer
367  generic map (
368  TPD_G => TPD_G)
369  port map (
370  clk => STABLE_CLOCK,
371  dataIn => RXRESETDONE,
373 
374  sync_time_out_wait_bypass : entity work.Synchronizer
375  generic map (
376  TPD_G => TPD_G)
377  port map (
378  clk => STABLE_CLOCK,
381 
382  sync_mmcm_lock_reclocked : entity work.Synchronizer
383  generic map (
384  TPD_G => TPD_G)
385  port map (
386  clk => STABLE_CLOCK,
387  dataIn => MMCM_LOCK,
388  dataOut => mmcm_lock_i);
389 
390  sync_data_valid : entity work.Synchronizer
391  generic map (
392  TPD_G => TPD_G)
393  port map (
394  clk => STABLE_CLOCK,
395  dataIn => DATA_VALID,
397 
398  process(STABLE_CLOCK)
399  begin
400  if rising_edge(STABLE_CLOCK) then
402 
406  end if;
407  end process;
408 
409 
410 
411  sync_PLL0LOCK : entity work.Synchronizer
412  generic map (
413  TPD_G => TPD_G)
414  port map (
415  clk => STABLE_CLOCK,
416  dataIn => PLL0LOCK,
418 
419  sync_PLL1LOCK : entity work.Synchronizer
420  generic map (
421  TPD_G => TPD_G)
422  port map (
423  clk => STABLE_CLOCK,
424  dataIn => PLL1LOCK,
426 
427 
428 
429  process (STABLE_CLOCK)
430  begin
431  if rising_edge(STABLE_CLOCK) then
432  if(soft_reset_sync = '1') then
433  pll0lock_ris_edge <= '0';
434  elsif((pll0lock_prev = '0') and (pll0lock_sync = '1')) then
435  pll0lock_ris_edge <= '1';
436  elsif(rx_state = ASSERT_ALL_RESETS or rx_state = RELEASE_PLL_RESET) then
438  else
439  pll0lock_ris_edge <= '0';
440  end if;
441  end if;
442  end process;
443 
444  process (STABLE_CLOCK)
445  begin
446  if rising_edge(STABLE_CLOCK) then
447  if(soft_reset_sync = '1') then
448  pll1lock_ris_edge <= '0';
449  elsif((pll1lock_prev = '0') and (pll1lock_sync = '1')) then
450  pll1lock_ris_edge <= '1';
451  elsif(rx_state = ASSERT_ALL_RESETS or rx_state = RELEASE_PLL_RESET) then
453  else
454  pll1lock_ris_edge <= '0';
455  end if;
456  end if;
457  end process;
458 
459  -- Phase aligner might run on rxusrclk in some cases
460  -- Synchronize it just in case
461  Synchronizer_PHALIGNMENT_DONE : entity work.Synchronizer
462  generic map (
463  TPD_G => TPD_G)
464  port map (
465  clk => STABLE_CLOCK,
468 
469 
470  timeout_buffer_bypass : process(RXUSERCLK)
471  begin
472  if rising_edge(RXUSERCLK) then
473  if run_phase_alignment_int_s3 = '0' then
474  wait_bypass_count <= 0;
475  time_out_wait_bypass <= '0';
476  elsif (run_phase_alignment_int_s3 = '1') and (rx_fsm_reset_done_int_s3 = '0') then
477  if wait_bypass_count = MAX_WAIT_BYPASS - 1 then
478  time_out_wait_bypass <= '1';
479  else
481  end if;
482  end if;
483  end if;
484  end process;
485 
486 
487  refclk_lost <= '1' when ((RX_PLL0_USED and PLL0REFCLKLOST = '1') or (not RX_PLL0_USED and PLL1REFCLKLOST = '1')) else '0';
488 
489 
490  --FSM for resetting the GTX/GTH/GTP in the 7-series.
491  --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
492  --
493  -- Following steps are performed:
494  -- 1) After configuration wait for approximately 500 ns as specified in
495  -- answer-record 43482
496  -- 2) Assert all resets on the GT and on an MMCM potentially connected.
497  -- After that wait until a reference-clock has been detected.
498  -- 3) Release the reset to the GT and wait until the GT-PLL has locked.
499  -- 4) Release the MMCM-reset and wait until the MMCM has signalled lock.
500  -- Also get info from the TX-side which PLL has been reset.
501  -- 5) Wait for the RESET_DONE-signal from the GT.
502  -- 6) Signal to start the phase-alignment procedure and wait for it to
503  -- finish.
504  -- 7) Reset-sequence has successfully run through. Signal this to the
505  -- rest of the design by asserting RX_FSM_RESET_DONE.
506 
507  reset_fsm : process(STABLE_CLOCK)
508  begin
509  if rising_edge(STABLE_CLOCK) then
510  if (soft_reset_sync = '1' or (not(rx_state = INIT) and not(rx_state = ASSERT_ALL_RESETS) and refclk_lost = '1')) then
511  rx_state <= INIT;
512  RXUSERRDY <= '0';
513  gtrxreset_i <= '0';
514  mmcm_reset_i <= '1';
515  rx_fsm_reset_done_int <= '0';
516  PLL0_RESET <= '0';
517  PLL1_RESET <= '0';
518  pll_reset_asserted <= '0';
519  reset_time_out <= '1';
520  retry_counter_int <= 0;
522  check_tlock_max <= '0';
523  RESET_PHALIGNMENT <= '1';
524  recclk_mon_count_reset <= '1';
525  RXDFEAGCHOLD <= '0';
526  RXDFELFHOLD <= '0';
527  RXLPMLFHOLD <= '0';
528  RXLPMHFHOLD <= '0';
529  fsmCnt <= (others => '0');
530 
531  else
532 
533  case rx_state is
534  when INIT =>
535  --Initial state after configuration. This state will be left after
536  --approx. 500 ns and not be re-entered.
537  if init_wait_done = '1' then
538  rx_state <= ASSERT_ALL_RESETS;
539  end if;
540 
541  when ASSERT_ALL_RESETS =>
542  --This is the state into which the FSM will always jump back if any
543  --time-outs will occur.
544  --The number of retries is reported on the output RETRY_COUNTER. In
545  --case the transceiver never comes up for some reason, this machine
546  --will still continue its best and rerun until the FPGA is turned off
547  --or the transceivers come up correctly.
548  if RX_PLL0_USED and not TX_PLL0_USED then
549  if pll_reset_asserted = '0' then
550  PLL0_RESET <= '1';
551  pll_reset_asserted <= '1';
552  else
553  PLL0_RESET <= '0';
554  end if;
555  elsif not RX_PLL0_USED and TX_PLL0_USED then
556  if pll_reset_asserted = '0' then
557  PLL1_RESET <= '1';
558  pll_reset_asserted <= '1';
559  else
560  PLL1_RESET <= '0';
561  end if;
562  end if;
563 
564  RXUSERRDY <= '0';
565  gtrxreset_i <= '1';
566  mmcm_reset_i <= '1';
568  RESET_PHALIGNMENT <= '1';
569  check_tlock_max <= '0';
570  recclk_mon_count_reset <= '1';
571  if (RX_PLL0_USED and not TX_PLL0_USED and (PLL0REFCLKLOST = '0') and pll_reset_asserted = '1') or
572  (not RX_PLL0_USED and TX_PLL0_USED and (PLL1REFCLKLOST = '0') and pll_reset_asserted = '1') or
573  (RX_PLL0_USED and TX_PLL0_USED and (PLL0REFCLKLOST = '0')) or
574  (not RX_PLL0_USED and not TX_PLL0_USED and (PLL1REFCLKLOST = '0')) then
575  rx_state <= RELEASE_PLL_RESET;
576  reset_time_out <= '1';
577  end if;
578 
579  when RELEASE_PLL_RESET =>
580  --PLL-Reset of the GTX gets released and the time-out counter
581  --starts running.
582  pll_reset_asserted <= '0';
583  reset_time_out <= '0';
584 
585  if (RX_PLL0_USED and not TX_PLL0_USED and (pll0lock_ris_edge = '1')) or
586  (not RX_PLL0_USED and TX_PLL0_USED and (pll1lock_ris_edge = '1')) then
587  rx_state <= VERIFY_RECCLK_STABLE;
588  reset_time_out <= '1';
589  recclk_mon_count_reset <= '0';
590  elsif (RX_PLL0_USED and (pll0lock_sync = '1')) or
591  (not RX_PLL0_USED and (pll1lock_sync = '1')) then
592  rx_state <= VERIFY_RECCLK_STABLE;
593  reset_time_out <= '1';
594  recclk_mon_count_reset <= '0';
595  end if;
596 
597  if time_out_2ms = '1' then
599  -- If too many retries are performed compared to what is specified in
600  -- the generic, the counter simply wraps around.
601  retry_counter_int <= 0;
602  else
604  end if;
605  rx_state <= ASSERT_ALL_RESETS;
606  end if;
607 
608  when VERIFY_RECCLK_STABLE =>
609  --reset_time_out <= '0';
610  --Time-out counter is not released in this state as here the FSM
611  --does not wait for a certain period of time but checks on the number
612  --of retries in the RECCLK monitor
613  gtrxreset_i <= '0';
614  if RECCLK_STABLE = '1' then
615  rx_state <= RELEASE_MMCM_RESET;
616  reset_time_out <= '1';
617 
618  end if;
619 
620  if recclk_mon_restart_count = 2 then
621  --If two retries are performed in the RECCLK monitor
622  --the whole initialisation-sequence gets restarted.
624  -- If too many retries are performed compared to what is specified in
625  -- the generic, the counter simply wraps around.
626  retry_counter_int <= 0;
627  else
629  end if;
630  rx_state <= ASSERT_ALL_RESETS;
631  end if;
632 
633  when RELEASE_MMCM_RESET =>
634  --Release of the MMCM-reset. Waiting for the MMCM to lock.
635  check_tlock_max <= '1';
636 
638  mmcm_reset_i <= '0';
639  reset_time_out <= '0';
640  end if;
641 
642  if mmcm_lock_reclocked = '1' then
643  rx_state <= WAIT_RESET_DONE;
644  reset_time_out <= '1';
645  end if;
646 
647  if (time_tlock_max = '1' and reset_time_out = '0')then
649  -- If too many retries are performed compared to what is specified in
650  -- the generic, the counter simply wraps around.
651  retry_counter_int <= 0;
652  else
654  end if;
655  rx_state <= ASSERT_ALL_RESETS;
656  end if;
657 
658  when WAIT_RESET_DONE =>
659  --When TXOUTCLK is the source for RXUSRCLK, RXUSERRDY depends on TXUSERRDY
660  --If RXOUTCLK is the source for RXUSRCLK, TXUSERRDY can be tied to '1'
661  if TXUSERRDY = '1' then
662  RXUSERRDY <= '1';
663  end if;
664  reset_time_out <= '0';
665  if rxresetdone_s3 = '1' then
666  rx_state <= DO_PHASE_ALIGNMENT;
667  reset_time_out <= '1';
668  end if;
669 
670  if time_out_2ms = '1' and reset_time_out = '0' then
672  -- If too many retries are performed compared to what is specified in
673  -- the generic, the counter simply wraps around.
674  retry_counter_int <= 0;
675  else
677  end if;
678  rx_state <= ASSERT_ALL_RESETS;
679  end if;
680 
681  when DO_PHASE_ALIGNMENT =>
682  --The direct handling of the signals for the Phase Alignment is done outside
683  --this state-machine.
684  RESET_PHALIGNMENT <= '0';
686  reset_time_out <= '0';
687 
688  if phalignment_done_sync = '1' then
689  rx_state <= MONITOR_DATA_VALID;
690  reset_time_out <= '1';
691  end if;
692 
693  if time_out_wait_bypass_s3 = '1' then
695  -- If too many retries are performed compared to what is specified in
696  -- the generic, the counter simply wraps around.
697  retry_counter_int <= 0;
698  else
700  end if;
701  rx_state <= ASSERT_ALL_RESETS;
702  end if;
703 
704  when MONITOR_DATA_VALID =>
705  reset_time_out <= '0';
706  if(time_out_100us = '1' and data_valid_sync = '0' and DONT_RESET_ON_DATA_ERROR = '0' and reset_time_out = '0') then
707  fsmCnt <= (others => '0');
708  rx_state <= ASSERT_ALL_RESETS;
709  rx_fsm_reset_done_int <= '0';
710  elsif fsmCnt = x"FFFF" then
711  fsmCnt <= (others => '0');
712  rx_state <= ASSERT_ALL_RESETS;
713  rx_fsm_reset_done_int <= '0';
714  elsif (data_valid_sync = '1') then
715  fsmCnt <= fsmCnt + 1;
716  rx_state <= FSM_DONE;
717  rx_fsm_reset_done_int <= '0';
718  reset_time_out <= '1';
719  end if;
720 
721  when FSM_DONE =>
722  reset_time_out <= '0';
723  if data_valid_sync = '0' then
724  rx_fsm_reset_done_int <= '0';
725  reset_time_out <= '1';
726  rx_state <= MONITOR_DATA_VALID;
727  elsif(time_out_1us = '1' and reset_time_out = '0') then
728  rx_fsm_reset_done_int <= '1';
729  end if;
730 
731  when others =>
732  rx_state <= INIT;
733  end case;
734  end if;
735  end if;
736  end process;
737 
738 end RTL;
739 
in TXUSERRDYstd_logic
Definition: Gtp7RxRst.vhd:101
integer := 100000/ STABLE_CLOCK_PERIOD WAIT_TIMEOUT_100us
Definition: Gtp7RxRst.vhd:145
out RXDFEAGCHOLDstd_logic := '0'
Definition: Gtp7RxRst.vhd:112
std_logic := '0' time_out_500us
Definition: Gtp7RxRst.vhd:171
std_logic := '0' time_out_1us
Definition: Gtp7RxRst.vhd:172
std_logic := '0' rxpmaresetdone_ss
Definition: Gtp7RxRst.vhd:183
in RXUSERCLKstd_logic
Definition: Gtp7RxRst.vhd:88
in DONT_RESET_ON_DATA_ERRORstd_logic := '0'
Definition: Gtp7RxRst.vhd:102
std_logic := '0' rxresetdone_s2
Definition: Gtp7RxRst.vhd:159
std_logic pmaresetdone_fallingedge_detect
Definition: Gtp7RxRst.vhd:185
in PLL1LOCKstd_logic
Definition: Gtp7RxRst.vhd:95
integer range 0 to 3:= 0 recclk_mon_restart_count
Definition: Gtp7RxRst.vhd:165
std_logic := '0' mmcm_lock_int
Definition: Gtp7RxRst.vhd:177
std_logic := '0' rx_fsm_reset_done_int_s3
Definition: Gtp7RxRst.vhd:157
std_logic := '0' run_phase_alignment_int_s3
Definition: Gtp7RxRst.vhd:189
integer range 0 to WAIT_MAX:= 0 init_wait_count
Definition: Gtp7RxRst.vhd:152
STAGES_Gpositive := 2
integer :=( 37000000/ integer( 3.125))/ STABLE_CLOCK_PERIOD WAIT_TIME_ADAPT
Definition: Gtp7RxRst.vhd:146
out GTRXRESETstd_logic := '0'
Definition: Gtp7RxRst.vhd:103
std_logic := '0' run_phase_alignment_int
Definition: Gtp7RxRst.vhd:187
integer := 500000/ STABLE_CLOCK_PERIOD WAIT_TIMEOUT_500us
Definition: Gtp7RxRst.vhd:143
std_logic rxpmaresetdone_sync
Definition: Gtp7RxRst.vhd:184
std_logic := '1' mmcm_reset_i
Definition: Gtp7RxRst.vhd:181
std_logic := '0' time_out_wait_bypass
Definition: Gtp7RxRst.vhd:193
integer := 5000 MAX_WAIT_BYPASS
Definition: Gtp7RxRst.vhd:191
std_logic := '0' rxpmaresetdone_i
Definition: Gtp7RxRst.vhd:182
in PLL0REFCLKLOSTstd_logic
Definition: Gtp7RxRst.vhd:92
integer range 0 to MAX_RETRIES:= 0 retry_counter_int
Definition: Gtp7RxRst.vhd:163
integer := 100000/ STABLE_CLOCK_PERIOD WAIT_TLOCK_MAX
Definition: Gtp7RxRst.vhd:142
out dataOutsl
out RESET_PHALIGNMENTstd_logic := '0'
Definition: Gtp7RxRst.vhd:111
std_logic := '0' init_wait_done
Definition: Gtp7RxRst.vhd:153
std_logic := '0' pll0lock_prev
Definition: Gtp7RxRst.vhd:202
std_logic := '0' time_out_100us
Definition: Gtp7RxRst.vhd:173
std_logic := '0' run_phase_alignment_int_s2
Definition: Gtp7RxRst.vhd:188
TX_PLL0_USEDboolean := false
Definition: Gtp7RxRst.vhd:83
out MMCM_RESETstd_logic := '1'
Definition: Gtp7RxRst.vhd:104
std_logic := '0' reset_time_out
Definition: Gtp7RxRst.vhd:168
integer := 500 STARTUP_DELAY
Definition: Gtp7RxRst.vhd:138
std_logic := '0' pll_reset_asserted
Definition: Gtp7RxRst.vhd:154
std_logic := '0' mmcm_lock_i
Definition: Gtp7RxRst.vhd:178
std_logic refclk_lost
Definition: Gtp7RxRst.vhd:197
in RXOUTCLKstd_logic
Definition: Gtp7RxRst.vhd:91
out RX_FSM_RESET_DONEstd_logic
Definition: Gtp7RxRst.vhd:107
in PHALIGNMENT_DONEstd_logic
Definition: Gtp7RxRst.vhd:110
std_logic := '0' recclk_mon_count_reset
Definition: Gtp7RxRst.vhd:166
TPD_Gtime := 1 ns
Definition: Gtp7RxRst.vhd:79
integer := 2** RETRY_COUNTER_BITWIDTH- 1 MAX_RETRIES
Definition: Gtp7RxRst.vhd:162
integer := 1000/ STABLE_CLOCK_PERIOD WAIT_TIMEOUT_1us
Definition: Gtp7RxRst.vhd:144
integer := 3000000/ STABLE_CLOCK_PERIOD WAIT_TIMEOUT_2ms
Definition: Gtp7RxRst.vhd:141
std_logic_vector( 15 downto 0) :=( others => '0') fsmCnt
Definition: Gtp7RxRst.vhd:208
in DATA_VALIDstd_logic
Definition: Gtp7RxRst.vhd:100
std_logic soft_reset_fall
Definition: Gtp7RxRst.vhd:150
integer := 1024 MMCM_LOCK_CNT_MAX
Definition: Gtp7RxRst.vhd:137
integer := WAIT_CYCLES+ 10 WAIT_MAX
Definition: Gtp7RxRst.vhd:140
TPD_Gtime := 1 ns
std_logic := '0' rxresetdone_s3
Definition: Gtp7RxRst.vhd:160
integer range 0 to MAX_WAIT_BYPASS- 1 wait_bypass_count
Definition: Gtp7RxRst.vhd:192
std_logic := '0' gtrxreset_i
Definition: Gtp7RxRst.vhd:180
out RXLPMHFHOLDstd_logic := '0'
Definition: Gtp7RxRst.vhd:115
std_logic := '0' pll1lock_sync
Definition: Gtp7RxRst.vhd:201
std_logic := '0' rx_fsm_reset_done_int
Definition: Gtp7RxRst.vhd:155
RX_PLL0_USEDboolean := false
Definition: Gtp7RxRst.vhd:85
out RXUSERRDYstd_logic := '0'
Definition: Gtp7RxRst.vhd:108
std_logic := '0' time_tlock_max
Definition: Gtp7RxRst.vhd:170
std_logic := '0' pll0lock_ris_edge
Definition: Gtp7RxRst.vhd:204
std_logic := '0' check_tlock_max
Definition: Gtp7RxRst.vhd:174
rx_rst_fsm_type := INIT rx_state
Definition: Gtp7RxRst.vhd:135
RETRY_COUNTER_BITWIDTHinteger range 2 to 8:= 8
Definition: Gtp7RxRst.vhd:82
std_logic := '0' time_out_2ms
Definition: Gtp7RxRst.vhd:169
out PLL1_RESETstd_logic := '0'
Definition: Gtp7RxRst.vhd:106
std_logic := '0' mmcm_lock_reclocked
Definition: Gtp7RxRst.vhd:179
std_logic := '0' rx_fsm_reset_done_int_s2
Definition: Gtp7RxRst.vhd:156
out RUN_PHALIGNMENTstd_logic
Definition: Gtp7RxRst.vhd:109
in RXRESETDONEstd_logic
Definition: Gtp7RxRst.vhd:96
std_logic := '0' phalignment_done_sync
Definition: Gtp7RxRst.vhd:206
std_logic soft_reset_rise
Definition: Gtp7RxRst.vhd:149
in PLL0LOCKstd_logic
Definition: Gtp7RxRst.vhd:94
integer := STARTUP_DELAY/ STABLE_CLOCK_PERIOD WAIT_CYCLES
Definition: Gtp7RxRst.vhd:139
out RETRY_COUNTERstd_logic_vector( RETRY_COUNTER_BITWIDTH- 1 downto 0) :=( others => '0')
Definition: Gtp7RxRst.vhd:118
out RXLPMLFHOLDstd_logic := '0'
Definition: Gtp7RxRst.vhd:114
std_logic soft_reset_sync
Definition: Gtp7RxRst.vhd:148
in RECCLK_STABLEstd_logic
Definition: Gtp7RxRst.vhd:98
STABLE_CLOCK_PERIODinteger range 4 to 20:= 8
Definition: Gtp7RxRst.vhd:81
in PLL1REFCLKLOSTstd_logic
Definition: Gtp7RxRst.vhd:93
out PLL0_RESETstd_logic := '0'
Definition: Gtp7RxRst.vhd:105
in SOFT_RESETstd_logic
Definition: Gtp7RxRst.vhd:89
SIMULATION_Gboolean := false
Definition: Gtp7RxRst.vhd:80
in RECCLK_MONITOR_RESTARTstd_logic := '0'
Definition: Gtp7RxRst.vhd:99
in STABLE_CLOCKstd_logic
Definition: Gtp7RxRst.vhd:86
(INIT,ASSERT_ALL_RESETS,RELEASE_PLL_RESET,VERIFY_RECCLK_STABLE,RELEASE_MMCM_RESET,WAIT_RESET_DONE,DO_PHASE_ALIGNMENT,MONITOR_DATA_VALID,FSM_DONE) rx_rst_fsm_type
Definition: Gtp7RxRst.vhd:130
std_logic := '0' pll1lock_ris_edge
Definition: Gtp7RxRst.vhd:205
integer range 0 to WAIT_TIMEOUT_2ms:= 0 time_out_counter
Definition: Gtp7RxRst.vhd:164
std_logic := '0' pll0lock_sync
Definition: Gtp7RxRst.vhd:200
std_logic := '0' data_valid_sync
Definition: Gtp7RxRst.vhd:199
integer range 0 to MMCM_LOCK_CNT_MAX- 1:= 0 mmcm_lock_count
Definition: Gtp7RxRst.vhd:176
in MMCM_LOCKstd_logic
Definition: Gtp7RxRst.vhd:97
std_logic := '0' pll1lock_prev
Definition: Gtp7RxRst.vhd:203
out RXDFELFHOLDstd_logic := '0'
Definition: Gtp7RxRst.vhd:113
std_logic := '0' time_out_wait_bypass_s3
Definition: Gtp7RxRst.vhd:195
std_logic := '0' time_out_wait_bypass_s2
Definition: Gtp7RxRst.vhd:194
in RXPMARESETDONEstd_logic
Definition: Gtp7RxRst.vhd:90