AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Variables
amc_gtx5gpd_tx_startup_fsm.vhd
1 --//////////////////////////////////////////////////////////////////////////////
2 -- ____ ____
3 -- / /\/ /
4 -- /___/ \ / Vendor: Xilinx
5 -- \ \ \/ Version : 3.6
6 -- \ \ Application : 7 Series FPGAs Transceivers Wizard
7 -- / / Filename :amc_gtx5gpd_tx_startup_fsm.vhd
8 -- /___/ /\
9 -- \ \ / \
10 -- \___\/\___\
11 --
12 --
13 -- Description : This module performs TX reset and initialization.
14 --
15 --
16 --
17 -- Module amc_gtx5Gpd_tx_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.NUMERIC_STD.ALL;
73 
75  Generic(
76  EXAMPLE_SIMULATION : integer := 0;
77  STABLE_CLOCK_PERIOD : integer range 4 to 250 := 8; --Period of the stable clock driving this state-machine, unit is [ns]
78  RETRY_COUNTER_BITWIDTH : integer range 2 to 8 := 8;
79  TX_QPLL_USED : boolean := False; -- the TX and RX Reset FSMs must
80  RX_QPLL_USED : boolean := False; -- share these two generic values
81  PHASE_ALIGNMENT_MANUAL : boolean := True -- Decision if a manual phase-alignment is necessary or the automatic
82  -- is enough. For single-lane applications the automatic alignment is
83  -- sufficient
84  );
85  Port ( STABLE_CLOCK : in STD_LOGIC; --Stable Clock, either a stable clock from the PCB
86  --or reference-clock present at startup.
87  TXUSERCLK : in STD_LOGIC; --TXUSERCLK as used in the design
88  SOFT_RESET : in STD_LOGIC; --User Reset, can be pulled any time
89  QPLLREFCLKLOST : in STD_LOGIC; --QPLL Reference-clock for the GT is lost
90  CPLLREFCLKLOST : in STD_LOGIC; --CPLL Reference-clock for the GT is lost
91  QPLLLOCK : in STD_LOGIC; --Lock Detect from the QPLL of the GT
92  CPLLLOCK : in STD_LOGIC; --Lock Detect from the CPLL of the GT
93  TXRESETDONE : in STD_LOGIC;
94  MMCM_LOCK : in STD_LOGIC;
95  GTTXRESET : out STD_LOGIC;
96  MMCM_RESET : out STD_LOGIC:='1';
97  QPLL_RESET : out STD_LOGIC:='0'; --Reset QPLL
98  CPLL_RESET : out STD_LOGIC:='0'; --Reset CPLL
99  TX_FSM_RESET_DONE : out STD_LOGIC; --Reset-sequence has sucessfully been finished.
100  TXUSERRDY : out STD_LOGIC:='0';
101  RUN_PHALIGNMENT : out STD_LOGIC:='0';
102  RESET_PHALIGNMENT : out STD_LOGIC:='0';
103  PHALIGNMENT_DONE : in STD_LOGIC;
104 
105  RETRY_COUNTER : out STD_LOGIC_VECTOR (RETRY_COUNTER_BITWIDTH-1 downto 0):=(others=>'0')-- Number of
106  -- Retries it took to get the transceiver up and running
107  );
108 end amc_gtx5Gpd_TX_STARTUP_FSM;
109 
110 --Interdependencies:
111 -- * Timing depends on the frequency of the stable clock. Hence counters-sizes
112 -- are calculated at design-time based on the Generics
113 --
114 -- * if either of PLLs is reset during TX-startup, it does not need to be reset again by RX
115 -- => signal which PLL has been reset
116 -- *
117 
118 
119 
120 architecture RTL of amc_gtx5Gpd_TX_STARTUP_FSM is
121 
122  component amc_gtx5Gpd_sync_block
123  generic (
124  INITIALISE : bit_vector(5 downto 0) := "000000"
125  );
126  port (
127  clk : in std_logic;
128  data_in : in std_logic;
129  data_out : out std_logic
130  );
131  end component;
132 
133  type tx_rst_fsm_type is(
134  INIT, ASSERT_ALL_RESETS, WAIT_FOR_PLL_LOCK, RELEASE_PLL_RESET,
135  WAIT_FOR_TXOUTCLK, RELEASE_MMCM_RESET, WAIT_FOR_TXUSRCLK, WAIT_RESET_DONE, DO_PHASE_ALIGNMENT,
136  RESET_FSM_DONE);
137 
138  signal tx_state : tx_rst_fsm_type := INIT;
139 
140  constant MMCM_LOCK_CNT_MAX : integer := 256;
141  constant STARTUP_DELAY : integer := 500;--AR43482: Transceiver needs to wait for 500 ns after configuration
142  constant WAIT_CYCLES : integer := STARTUP_DELAY / STABLE_CLOCK_PERIOD; -- Number of Clock-Cycles to wait after configuration
143  constant WAIT_MAX : integer := WAIT_CYCLES + 10; -- 500 ns plus some additional margin
144 
145  constant WAIT_TIMEOUT_2ms : integer := 2000000 / STABLE_CLOCK_PERIOD;-- 2 ms time-out
146  constant WAIT_TLOCK_MAX : integer := 100000 / STABLE_CLOCK_PERIOD;--100 us time-out
147  constant WAIT_TIMEOUT_500us : integer := 500000 / STABLE_CLOCK_PERIOD;--100 us time-out
148  constant WAIT_1us_cycles : integer := 1000 / STABLE_CLOCK_PERIOD;--1 us time-out
149  constant WAIT_1us : integer := WAIT_1us_cycles+ 10; -- 1us plus some additional margin
150 
151  signal init_wait_count : integer range 0 to WAIT_MAX:=0;
152  signal init_wait_done : std_logic := '0';
153  signal pll_reset_asserted : std_logic := '0';
154 
155 
156  signal tx_fsm_reset_done_int : std_logic := '0';
157  signal tx_fsm_reset_done_int_s2 : std_logic := '0';
158  signal tx_fsm_reset_done_int_s3 : std_logic := '0';
159 
160  signal txresetdone_s2 : std_logic := '0';
161  signal txresetdone_s3 : std_logic := '0';
162 
163  constant MAX_RETRIES : integer := 2**RETRY_COUNTER_BITWIDTH-1;
164  signal retry_counter_int : integer range 0 to MAX_RETRIES;
165  signal time_out_counter : integer range 0 to WAIT_TIMEOUT_2ms := 0;
166 
167  signal reset_time_out : std_logic := '0';
168  signal time_out_2ms : std_logic := '0';--\Flags that the various time-out points
169  signal time_tlock_max : std_logic := '0';--|have been reached.
170  signal time_out_500us : std_logic := '0';--/
171 
172  signal mmcm_lock_count : integer range 0 to MMCM_LOCK_CNT_MAX-1:=0;
173  signal mmcm_lock_int : std_logic := '0';
174  signal mmcm_lock_i : std_logic := '0';
175  signal mmcm_lock_reclocked : std_logic := '0';
176 
177  signal run_phase_alignment_int : std_logic := '0';
178  signal run_phase_alignment_int_s2 : std_logic := '0';
179  signal run_phase_alignment_int_s3 : std_logic := '0';
180  constant MAX_WAIT_BYPASS : integer := 91648; --110000 TXUSRCLK cycles is the max time for Multi lane designs
181 
182  constant WAIT_TIME_MAX : integer := 100 ; --10 us time-out
183 
184  signal wait_bypass_count : integer range 0 to MAX_WAIT_BYPASS-1;
185  signal time_out_wait_bypass : std_logic := '0';
186  signal time_out_wait_bypass_s2 : std_logic := '0';
187  signal time_out_wait_bypass_s3 : std_logic := '0';
188  signal txuserrdy_i : std_logic := '0';
189  signal refclk_lost : std_logic;
190  signal gttxreset_i : std_logic := '0';
191  signal txpmaresetdone_i : std_logic := '0';
192  signal txpmaresetdone_sync : std_logic ;
193 
194  signal cplllock_sync: std_logic := '0';
195  signal qplllock_sync: std_logic := '0';
196  signal cplllock_prev: std_logic := '0';
197  signal qplllock_prev: std_logic := '0';
198  signal cplllock_ris_edge: std_logic := '0';
199  signal qplllock_ris_edge: std_logic := '0';
200  signal wait_time_cnt : integer range 0 to WAIT_TIME_MAX;
201  signal wait_time_done :std_logic;
202 
203 begin
204  --Alias section, signals used within this module mapped to output ports:
205  RETRY_COUNTER <= STD_LOGIC_VECTOR(TO_UNSIGNED(retry_counter_int,RETRY_COUNTER_BITWIDTH));
206  RUN_PHALIGNMENT <= run_phase_alignment_int;
207  TX_FSM_RESET_DONE <= tx_fsm_reset_done_int;
208  GTTXRESET <= gttxreset_i;
209 
210  process(STABLE_CLOCK,SOFT_RESET)
211  begin
212  if (SOFT_RESET = '1') then
213  init_wait_done <= '0';
214  init_wait_count <= 0 ;
215  elsif rising_edge(STABLE_CLOCK) then
216  -- The counter starts running when configuration has finished and
217  -- the clock is stable. When its maximum count-value has been reached,
218  -- the 500 ns from Answer Record 43482 have been passed.
219  if init_wait_count = WAIT_MAX then
220  init_wait_done <= '1';
221  else
222  init_wait_count <= init_wait_count + 1;
223  end if;
224  end if;
225  end process;
226 
227  timeouts:process(STABLE_CLOCK)
228  begin
229  if rising_edge(STABLE_CLOCK) then
230  -- One common large counter for generating three time-out signals.
231  -- Intermediate time-outs are derived from calculated values, based
232  -- on the period of the provided clock.
233  if reset_time_out = '1' then
234  time_out_counter <= 0;
235  time_out_2ms <= '0';
236  time_tlock_max <= '0';
237  time_out_500us <= '0';
238  else
239  if time_out_counter = WAIT_TIMEOUT_2ms then
240  time_out_2ms <= '1';
241  else
242  time_out_counter <= time_out_counter + 1;
243  end if;
244 
245  if time_out_counter = WAIT_TLOCK_MAX then
246  time_tlock_max <= '1';
247  end if;
248 
249  if time_out_counter = WAIT_TIMEOUT_500us then
250  time_out_500us <= '1';
251  end if;
252  end if;
253  end if;
254  end process;
255 
256  mmcm_lock_wait:process(STABLE_CLOCK)
257  begin
258  if rising_edge(STABLE_CLOCK) then
259  if mmcm_lock_i = '0' then
260  mmcm_lock_count <= 0;
261  mmcm_lock_reclocked <= '0';
262  else
263  if mmcm_lock_count < MMCM_LOCK_CNT_MAX - 1 then
264  mmcm_lock_count <= mmcm_lock_count + 1;
265  else
266  mmcm_lock_reclocked <= '1';
267  end if;
268  end if;
269  end if;
270  end process;
271 
272 
273 
274  -- Clock Domain Crossing
275 
276  sync_run_phase_alignment_int : amc_gtx5Gpd_sync_block
277  port map
278  (
279  clk => TXUSERCLK,
280  data_in => run_phase_alignment_int ,
281  data_out => run_phase_alignment_int_s2
282  );
283 
284  sync_tx_fsm_reset_done_int : amc_gtx5Gpd_sync_block
285  port map
286  (
287  clk => TXUSERCLK,
288  data_in => tx_fsm_reset_done_int,
289  data_out => tx_fsm_reset_done_int_s2
290  );
291 
292  process(TXUSERCLK)
293  begin
294  if rising_edge(TXUSERCLK) then
295  run_phase_alignment_int_s3 <= run_phase_alignment_int_s2;
296 
297  tx_fsm_reset_done_int_s3 <= tx_fsm_reset_done_int_s2;
298  end if;
299  end process;
300 
301  sync_TXRESETDONE : amc_gtx5Gpd_sync_block
302  port map
303  (
304  clk => STABLE_CLOCK,
305  data_in => TXRESETDONE,
306  data_out => txresetdone_s2
307  );
308 
309  sync_time_out_wait_bypass : amc_gtx5Gpd_sync_block
310  port map
311  (
312  clk => STABLE_CLOCK,
313  data_in => time_out_wait_bypass,
314  data_out => time_out_wait_bypass_s2
315  );
316 
317  sync_mmcm_lock_reclocked : amc_gtx5Gpd_sync_block
318  port map
319  (
320  clk => STABLE_CLOCK,
321  data_in => MMCM_LOCK,
322  data_out => mmcm_lock_i
323  );
324 
325  process(STABLE_CLOCK)
326  begin
327  if rising_edge(STABLE_CLOCK) then
328  txresetdone_s3 <= txresetdone_s2;
329 
330  time_out_wait_bypass_s3 <= time_out_wait_bypass_s2;
331 
332  cplllock_prev <= cplllock_sync;
333  qplllock_prev <= qplllock_sync;
334  end if;
335  end process;
336 
337  sync_CPLLLOCK : amc_gtx5Gpd_sync_block
338  port map
339  (
340  clk => STABLE_CLOCK,
341  data_in => CPLLLOCK,
342  data_out => cplllock_sync
343  );
344 
345  sync_QPLLLOCK : amc_gtx5Gpd_sync_block
346  port map
347  (
348  clk => STABLE_CLOCK,
349  data_in => QPLLLOCK,
350  data_out => qplllock_sync
351  );
352 
353 
354  process (STABLE_CLOCK)
355  begin
356  if rising_edge(STABLE_CLOCK) then
357  if(SOFT_RESET = '1' ) then
358  cplllock_ris_edge <= '0';
359  elsif((cplllock_prev = '0') and (cplllock_sync = '1')) then
360  cplllock_ris_edge <= '1';
361  elsif(tx_state = ASSERT_ALL_RESETS or tx_state = RELEASE_PLL_RESET) then
362  cplllock_ris_edge <= cplllock_ris_edge;
363  else
364  cplllock_ris_edge <= '0';
365  end if;
366  end if;
367  end process;
368 
369  process (STABLE_CLOCK)
370  begin
371  if rising_edge(STABLE_CLOCK) then
372  if(SOFT_RESET = '1' ) then
373  qplllock_ris_edge <= '0';
374  elsif((qplllock_prev = '0') and (qplllock_sync = '1')) then
375  qplllock_ris_edge <= '1';
376  elsif(tx_state = ASSERT_ALL_RESETS or tx_state = RELEASE_PLL_RESET) then
377  qplllock_ris_edge <= qplllock_ris_edge;
378  else
379  qplllock_ris_edge <= '0';
380  end if;
381  end if;
382  end process;
383 
384 
385 
386  timeout_buffer_bypass:process(TXUSERCLK)
387  begin
388  if rising_edge(TXUSERCLK) then
389  if run_phase_alignment_int_s3 = '0' then
390  wait_bypass_count <= 0;
391  time_out_wait_bypass <= '0';
392  elsif (run_phase_alignment_int_s3 = '1') and (tx_fsm_reset_done_int_s3 = '0') then
393  if wait_bypass_count = MAX_WAIT_BYPASS - 1 then
394  time_out_wait_bypass <= '1';
395  else
396  wait_bypass_count <= wait_bypass_count + 1;
397  end if;
398  end if;
399  end if;
400  end process;
401 
402  refclk_lost <= '1' when ((TX_QPLL_USED and QPLLREFCLKLOST='1') or (not TX_QPLL_USED and CPLLREFCLKLOST='1')) else '0';
403 
404 
405  timeout_max:process(STABLE_CLOCK)
406  begin
407  if rising_edge(STABLE_CLOCK) then
408  if((tx_state = ASSERT_ALL_RESETS) or
409  (tx_state = RELEASE_PLL_RESET) or
410  (tx_state = RELEASE_MMCM_RESET)) then
411  wait_time_cnt <= WAIT_TIME_MAX;
412  elsif (wait_time_cnt > 0 ) then
413  wait_time_cnt <= wait_time_cnt - 1;
414  end if;
415  end if;
416  end process;
417 
418  wait_time_done <= '1' when (wait_time_cnt = 0) else '0';
419 
420 
421  --FSM for resetting the GTX/GTH/GTP in the 7-series.
422  --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
423  --
424  -- Following steps are performed:
425  -- 1) Only for GTX - After configuration wait for approximately 500 ns as specified in
426  -- answer-record 43482
427  -- 2) Assert all resets on the GT and on an MMCM potentially connected.
428  -- After that wait until a reference-clock has been detected.
429  -- 3) Release the reset to the GT and wait until the GT-PLL has locked.
430  -- 4) Release the MMCM-reset and wait until the MMCM has signalled lock.
431  -- Also signal to the RX-side which PLL has been reset.
432  -- 5) Wait for the RESET_DONE-signal from the GT.
433  -- 6) Signal to start the phase-alignment procedure and wait for it to
434  -- finish.
435  -- 7) Reset-sequence has successfully run through. Signal this to the
436  -- rest of the design by asserting TX_FSM_RESET_DONE.
437 
438  reset_fsm:process(STABLE_CLOCK)
439  begin
440  if rising_edge(STABLE_CLOCK) then
441  if(SOFT_RESET = '1') then
442  --if(SOFT_RESET = '1' or (not(tx_state = INIT) and not(tx_state = ASSERT_ALL_RESETS) and refclk_lost = '1')) then
443  tx_state <= INIT;
444  TXUSERRDY <= '0';
445  gttxreset_i <= '0';
446  MMCM_RESET <= '0';
447  tx_fsm_reset_done_int <= '0';
448  QPLL_RESET <= '0';
449  CPLL_RESET <= '0';
450  pll_reset_asserted <= '0';
451  reset_time_out <= '0';
452  retry_counter_int <= 0;
453  run_phase_alignment_int <= '0';
454  RESET_PHALIGNMENT <= '1';
455  else
456 
457  case tx_state is
458  when INIT =>
459  --Initial state after configuration. This state will be left after
460  --approx. 500 ns and not be re-entered.
461  if init_wait_done = '1' then
462  tx_state <= ASSERT_ALL_RESETS;
463  reset_time_out <= '1';
464  end if;
465 
466  when ASSERT_ALL_RESETS =>
467  --This is the state into which the FSM will always jump back if any
468  --time-outs will occur.
469  --The number of retries is reported on the output RETRY_COUNTER. In
470  --case the transceiver never comes up for some reason, this machine
471  --will still continue its best and rerun until the FPGA is turned off
472  --or the transceivers come up correctly.
473  if TX_QPLL_USED then
474  if (pll_reset_asserted = '0' and refclk_lost = '0') then
475  QPLL_RESET <= '1';
476  pll_reset_asserted <= '1';
477  else
478  QPLL_RESET <= '0';
479  end if;
480  else
481  if (pll_reset_asserted = '0' and refclk_lost = '0') then
482  CPLL_RESET <= '1';
483  pll_reset_asserted <= '1';
484  else
485  CPLL_RESET <= '0';
486  end if;
487  end if;
488  TXUSERRDY <= '0';
489  gttxreset_i <= '1';
490  MMCM_RESET <= '1';
491  reset_time_out <= '1';
492  run_phase_alignment_int <= '0';
493  RESET_PHALIGNMENT <= '1';
494 
495  if (TX_QPLL_USED and (qplllock_sync = '0') and pll_reset_asserted = '1' ) or
496  (not TX_QPLL_USED and (cplllock_sync = '0') and pll_reset_asserted = '1' ) then
497  tx_state <= WAIT_FOR_PLL_LOCK;
498  end if;
499 
500  when WAIT_FOR_PLL_LOCK =>
501  if(wait_time_done = '1') then
502  tx_state <= RELEASE_PLL_RESET;
503  end if;
504 
505  when RELEASE_PLL_RESET =>
506  --PLL-Reset of the GTX gets released and the time-out counter
507  --starts running.
508  pll_reset_asserted <= '0';
509 
510  if (TX_QPLL_USED and (qplllock_sync = '1')) or
511  (not TX_QPLL_USED and (cplllock_sync = '1')) then
512  tx_state <= WAIT_FOR_TXOUTCLK;
513  reset_time_out <= '1';
514  end if;
515 
516  if time_out_2ms = '1' then
517  if retry_counter_int = MAX_RETRIES then
518  -- If too many retries are performed compared to what is specified in
519  -- the generic, the counter simply wraps around.
520  retry_counter_int <= 0;
521  else
522  retry_counter_int <= retry_counter_int + 1;
523  end if;
524  tx_state <= ASSERT_ALL_RESETS;
525  end if;
526 
527  when WAIT_FOR_TXOUTCLK =>
528  gttxreset_i <= '0';
529  if(wait_time_done = '1') then
530  tx_state <= RELEASE_MMCM_RESET;
531  end if;
532 
533  when RELEASE_MMCM_RESET =>
534  --Release of the MMCM-reset. Waiting for the MMCM to lock.
535  MMCM_RESET <= '0';
536  reset_time_out <= '0';
537  if mmcm_lock_reclocked = '1' then
538  tx_state <= WAIT_FOR_TXUSRCLK;
539  reset_time_out <= '1';
540  end if;
541 
542  if (time_tlock_max = '1' and mmcm_lock_reclocked = '0' and reset_time_out = '0') then
543  if retry_counter_int = MAX_RETRIES then
544  -- If too many retries are performed compared to what is specified in
545  -- the generic, the counter simply wraps around.
546  retry_counter_int <= 0;
547  else
548  retry_counter_int <= retry_counter_int + 1;
549  end if;
550  tx_state <= ASSERT_ALL_RESETS;
551  end if;
552 
553  when WAIT_FOR_TXUSRCLK =>
554  if(wait_time_done = '1') then
555  tx_state <= WAIT_RESET_DONE;
556  end if;
557 
558  when WAIT_RESET_DONE =>
559  TXUSERRDY <= '1';
560  reset_time_out <= '0';
561  if txresetdone_s3 = '1' then
562  tx_state <= DO_PHASE_ALIGNMENT;
563  reset_time_out <= '1';
564  end if;
565 
566  if (time_out_500us = '1' and reset_time_out = '0') then
567  if retry_counter_int = MAX_RETRIES then
568  -- If too many retries are performed compared to what is specified in
569  -- the generic, the counter simply wraps around.
570  retry_counter_int <= 0;
571  else
572  retry_counter_int <= retry_counter_int + 1;
573  end if;
574  tx_state <= ASSERT_ALL_RESETS;
575  end if;
576 
577  when DO_PHASE_ALIGNMENT =>
578  --The direct handling of the signals for the Phase Alignment is done outside
579  --this state-machine.
580  RESET_PHALIGNMENT <= '0';
581  run_phase_alignment_int <= '1';
582  reset_time_out <= '0';
583 
584  if PHALIGNMENT_DONE = '1' then
585  tx_state <= RESET_FSM_DONE;
586  end if;
587 
588  if time_out_wait_bypass_s3 = '1' then
589  if retry_counter_int = MAX_RETRIES then
590  -- If too many retries are performed compared to what is specified in
591  -- the generic, the counter simply wraps around.
592  retry_counter_int <= 0;
593  else
594  retry_counter_int <= retry_counter_int + 1;
595  end if;
596  tx_state <= ASSERT_ALL_RESETS;
597  end if;
598 
599  when RESET_FSM_DONE =>
600  reset_time_out <= '1';
601  tx_fsm_reset_done_int <= '1';
602 
603  when OTHERS =>
604  tx_state <= INIT;
605 
606  end case;
607  end if;
608  end if;
609  end process;
610 
611 end RTL;