1 -------------------------------------------------------------------------------
4 -- /___/ \ / Vendor: Xilinx
5 -- \ \ \/ Version : 2.
3
6 -- \ \ Application : 7 Series FPGAs Transceivers Wizard
7 -- / / Filename : sfp3_v2_3_block_sync_sm.vhd
13 -- Module BLOCK_SYNC_SM
14 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
17 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
19 -- This file contains confidential and proprietary information
20 -- of Xilinx, Inc. and is protected under U.S. and
21 -- international copyright and other intellectual property
25 -- This disclaimer is not a license and does not grant any
26 -- rights to the materials distributed herewith. Except as
27 -- otherwise provided in a valid license issued to you by
28 -- Xilinx, and to the maximum extent permitted by applicable
29 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS"
AND
30 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
31 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
32 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
33 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
34 -- (2) Xilinx shall
not be liable (whether
in contract
or tort,
35 -- including negligence, or under any other theory of
36 -- liability) for any loss or damage of any kind or nature
37 -- related to, arising under or in connection with these
38 -- materials, including for any direct, or any indirect,
39 -- special, incidental, or consequential loss or damage
40 -- (including loss of data, profits, goodwill, or any type of
41 -- loss or damage suffered as a result of any action brought
42 -- by a third party) even if such damage or loss was
43 -- reasonably foreseeable or Xilinx had been advised of the
44 -- possibility of the same.
46 -- CRITICAL APPLICATIONS
47 -- Xilinx products are not designed or intended to be fail-
48 -- safe, or for use in any application requiring fail-safe
49 -- performance, such as life-support or safety devices or
50 -- systems, Class III medical devices, nuclear facilities,
51 -- applications related to the deployment of airbags, or any
52 -- other applications that could lead to death, personal
53 -- injury, or severe property or environmental damage
54 -- (individually and collectively, "Critical
55 -- Applications"). Customer assumes the sole risk and
56 -- liability of any use of Xilinx products in Critical
57 -- Applications, subject only to applicable laws and
58 -- regulations governing limitations on product liability.
60 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
61 -- PART OF THIS FILE AT ALL TIMES.
65 use ieee.std_logic_1164.
all;
66 use ieee.numeric_std.
all;
68 use UNISIM.VCOMPONENTS.
ALL;
74 SH_INVALID_CNT_MAX : := 16
80 RXGEARBOXSLIP_OUT : out ;
81 RXHEADER_IN : in (2 downto 0);
82 RXHEADERVALID_IN : in ;
94 --***********************************Parameter Declarations********************
96 constant DLY : := 10 ps;
98 --********************************* Wire Declarations**************************
100 signal next_begin_c : ;
101 signal next_sh_invalid_c : ;
102 signal next_sh_valid_c : ;
103 signal next_slip_c : ;
104 signal next_sync_done_c : ;
105 signal next_test_sh_c : ;
106 signal sh_count_equals_max_i : ;
107 signal sh_invalid_cnt_equals_max_i : ;
108 signal sh_invalid_cnt_equals_zero_i : ;
109 signal slip_done_i : ;
110 signal slip_pulse_i : ;
111 signal sync_found_i : ;
113 ---***************************Internal Register Declarations***************************
116 signal blocksync_out_i : ;
117 signal rxgearboxslip_out_i : ;
118 signal sh_invalid_r : ;
119 signal sh_valid_r : ;
120 signal slip_count_i : (31 downto 0);
122 signal sync_done_r : ;
123 signal sync_header_count_i : (9 downto 0);
124 signal sync_header_invalid_count_i : (9 downto 0);
127 ---**************************** Main Body of Code *******************************
131 sync_found_i <= '1' when ((RXHEADER_IN(1 downto 0) = "01") or (RXHEADER_IN(1 downto 0) = "10")) else '0';
133 ---________________________________ State machine __________________________
138 if(USER_CLK'event and USER_CLK = '1') then
139 if(SYSTEM_RESET = '1') then
140 begin_r <= '1' after DLY;
141 test_sh_r <= '0' after DLY;
142 sh_valid_r <= '0' after DLY;
143 sh_invalid_r <= '0' after DLY;
144 slip_r <= '0' after DLY;
145 sync_done_r <= '0' after DLY;
147 begin_r <= next_begin_c after DLY;
148 test_sh_r <= next_test_sh_c after DLY;
149 sh_valid_r <= next_sh_valid_c after DLY;
150 sh_invalid_r <= next_sh_invalid_c after DLY;
151 slip_r <= next_slip_c after DLY;
152 sync_done_r <= next_sync_done_c after DLY;
158 next_begin_c <= sync_done_r
159 or (slip_r and slip_done_i)
160 or (sh_valid_r and sh_count_equals_max_i and not sh_invalid_cnt_equals_max_i)
161 or (sh_invalid_r and sh_count_equals_max_i and not sh_invalid_cnt_equals_max_i and blocksync_out_i);
163 next_test_sh_c <= begin_r
164 or (test_sh_r and not RXHEADERVALID_IN)
165 or (sh_valid_r and not sh_count_equals_max_i)
166 or (sh_invalid_r and not sh_count_equals_max_i and not sh_invalid_cnt_equals_max_i and blocksync_out_i);
169 next_sh_valid_c <= (test_sh_r and RXHEADERVALID_IN and sync_found_i);
171 next_sh_invalid_c <= (test_sh_r and RXHEADERVALID_IN and not sync_found_i);
173 next_slip_c <= (sh_invalid_r and (sh_invalid_cnt_equals_max_i or not blocksync_out_i))
174 or (slip_r and not slip_done_i);
176 next_sync_done_c <= (sh_valid_r and sh_count_equals_max_i and sh_invalid_cnt_equals_zero_i);
178 ---________________ Counter keep track of sync headers counted _____________
182 if(USER_CLK'event and USER_CLK = '1') then
183 if(begin_r = '1') then
184 sync_header_count_i <= (others => '0') after DLY;
185 elsif ((sh_valid_r= '1') or (sh_invalid_r = '1')) then
186 sync_header_count_i <= sync_header_count_i + 1 after DLY;
191 sh_count_equals_max_i <= '1' when (sync_header_count_i=SH_CNT_MAX) else '0';
193 ---________________ Counter keep track of invalid sync headers ____________
197 if(USER_CLK'event and USER_CLK = '1') then
198 if(begin_r = '1') then
199 sync_header_invalid_count_i <= (others => '0') after DLY;
200 elsif (sh_invalid_r = '1') then
201 sync_header_invalid_count_i <= sync_header_invalid_count_i + 1 after DLY;
206 --- signal to indicate max number of invalid sync headers has been reached
207 sh_invalid_cnt_equals_max_i <= '1' when (sync_header_invalid_count_i=SH_INVALID_CNT_MAX)
210 --- signal to indicate no invalid sync headers
211 sh_invalid_cnt_equals_zero_i <= '1' when (sync_header_invalid_count_i=0) else '0';
213 ---_______ Counter wait for 16 cycles
to ensure that slip
is complete _______
215 slip_pulse_i <= next_slip_c and not slip_r;
219 if(USER_CLK'event and USER_CLK = '1') then
220 rxgearboxslip_out_i <= slip_pulse_i after DLY;
224 ---_____________ Ouput assignment to indicate block sync complete _________
228 if(USER_CLK'event and USER_CLK = '1') then
229 if(slip_r = '0') then
230 slip_count_i <= (others => '0') after DLY;
232 slip_count_i <= (slip_count_i(30 downto 0) & rxgearboxslip_out_i) after DLY;
237 slip_done_i <= slip_count_i(31);
240 ---_____________ Pulse GEARBOXSLIP port to slip the data by 1 _________
244 if(USER_CLK'event and USER_CLK = '1') then
245 if((SYSTEM_RESET='1') or (slip_r= '1')) then
246 blocksync_out_i <= '0' after DLY;
247 elsif (sync_done_r = '1') then
248 blocksync_out_i <= '1' after DLY;
254 --__________________________ Ouput Port Assignment ________________________
256 BLOCKSYNC_OUT <= blocksync_out_i;
257 RXGEARBOXSLIP_OUT <= rxgearboxslip_out_i;