Belle II KLM Scint Firmware  1
aurora_lane.vhd
1 ------------------------------------------------------------------------------
2 -- (c) Copyright 2008 Xilinx, Inc. All rights reserved.
3 --
4 -- This file contains confidential and proprietary information
5 -- of Xilinx, Inc. and is protected under U.S. and
6 -- international copyright and other intellectual property
7 -- laws.
8 --
9 -- DISCLAIMER
10 -- This disclaimer is not a license and does not grant any
11 -- rights to the materials distributed herewith. Except as
12 -- otherwise provided in a valid license issued to you by
13 -- Xilinx, and to the maximum extent permitted by applicable
14 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
15 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
16 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
17 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
18 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
19 -- (2) Xilinx shall not be liable (whether in contract or tort,
20 -- including negligence, or under any other theory of
21 -- liability) for any loss or damage of any kind or nature
22 -- related to, arising under or in connection with these
23 -- materials, including for any direct, or any indirect,
24 -- special, incidental, or consequential loss or damage
25 -- (including loss of data, profits, goodwill, or any type of
26 -- loss or damage suffered as a result of any action brought
27 -- by a third party) even if such damage or loss was
28 -- reasonably foreseeable or Xilinx had been advised of the
29 -- possibility of the same.
30 --
31 -- CRITICAL APPLICATIONS
32 -- Xilinx products are not designed or intended to be fail-
33 -- safe, or for use in any application requiring fail-safe
34 -- performance, such as life-support or safety devices or
35 -- systems, Class III medical devices, nuclear facilities,
36 -- applications related to the deployment of airbags, or any
37 -- other applications that could lead to death, personal
38 -- injury, or severe property or environmental damage
39 -- (individually and collectively, "Critical
40 -- Applications"). Customer assumes the sole risk and
41 -- liability of any use of Xilinx products in Critical
42 -- Applications, subject only to applicable laws and
43 -- regulations governing limitations on product liability.
44 --
45 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
46 -- PART OF THIS FILE AT ALL TIMES.
47 --
48 --
49 
50 --
51 -- AURORA_LANE
52 --
53 --
54 --
55 -- Description: The AURORA_LANE module provides a full duplex 2-byte aurora
56 -- lane connection using a single GTP. The module handles lane
57 -- initialization, symbol generation and decoding as well as
58 -- error detection. It also decodes some of the channel bonding
59 -- indicator signals needed by the Global logic.
60 --
61 -- * Supports GTP
62 --
63 
64 library IEEE;
65 use IEEE.STD_LOGIC_1164.all;
66 
67 entity AURORA_LANE is
68  port (
69  -- GTP Interface
70  RX_DATA : in std_logic_vector(15 downto 0); -- 2-byte data bus from the GTP.
71  RX_NOT_IN_TABLE : in std_logic_vector(1 downto 0); -- Invalid 10-bit code was recieved.
72  RX_DISP_ERR : in std_logic_vector(1 downto 0); -- Disparity error detected on RX interface.
73  RX_CHAR_IS_K : in std_logic_vector(1 downto 0); -- Indicates which bytes of RX_DATA are control.
74  RX_CHAR_IS_COMMA : in std_logic_vector(1 downto 0); -- Comma received on given byte.
75  -- RX_STATUS : in std_logic_vector(5 downto 0); -- Part of GTP status and error bus.
76  RX_BUF_ERR : in std_logic; -- Overflow/Underflow of RX buffer detected.
77  TX_BUF_ERR : in std_logic; -- Overflow/Underflow of TX buffer detected.
78  RX_REALIGN : in std_logic; -- SERDES was realigned because of a new comma.
79  RX_POLARITY : out std_logic; -- Controls interpreted polarity of serial data inputs.
80  RX_RESET : out std_logic; -- Reset RX side of GTP logic.
81  TX_CHAR_IS_K : out std_logic_vector(1 downto 0); -- TX_DATA byte is a control character.
82  TX_DATA : out std_logic_vector(15 downto 0); -- 2-byte data bus to the GTP.
83  TX_RESET : out std_logic; -- Reset TX side of GTP logic.
84  -- Comma Detect Phase Align Interface
85  ENA_COMMA_ALIGN : out std_logic; -- Request comma alignment.
86  -- TX_LL Interface
87  GEN_SCP : in std_logic; -- SCP generation request from TX_LL.
88  GEN_ECP : in std_logic; -- ECP generation request from TX_LL.
89  GEN_PAD : in std_logic; -- PAD generation request from TX_LL.
90  TX_PE_DATA : in std_logic_vector(0 to 15); -- Data from TX_LL to send over lane.
91  TX_PE_DATA_V : in std_logic; -- Indicates TX_PE_DATA is Valid.
92  GEN_CC : in std_logic; -- CC generation request from TX_LL.
93  -- RX_LL Interface
94  RX_PAD : out std_logic; -- Indicates lane received PAD.
95  RX_PE_DATA : out std_logic_vector(0 to 15); -- RX data from lane to RX_LL.
96  RX_PE_DATA_V : out std_logic; -- RX_PE_DATA is data, not control symbol.
97  RX_SCP : out std_logic; -- Indicates lane received SCP.
98  RX_ECP : out std_logic; -- Indicates lane received ECP.
99  -- Global Logic Interface
100  GEN_A : in std_logic; -- 'A character' generation request from Global Logic.
101  GEN_K : in std_logic_vector(0 to 1); -- 'K character' generation request from Global Logic.
102  GEN_R : in std_logic_vector(0 to 1); -- 'R character' generation request from Global Logic.
103  GEN_V : in std_logic_vector(0 to 1); -- Verification data generation request.
104  LANE_UP : out std_logic; -- Lane is ready for bonding and verification.
105  SOFT_ERR : out std_logic; -- Soft error detected.
106  HARD_ERR : out std_logic; -- Hard error detected.
107  CHANNEL_BOND_LOAD : out std_logic; -- Channel Bonding done code received.
108  GOT_A : out std_logic_vector(0 to 1); -- Indicates lane recieved 'A character' bytes.
109  GOT_V : out std_logic; -- Verification symbols received.
110  -- System Interface
111  USER_CLK : in std_logic; -- System clock for all non-GTP Aurora Logic.
112  RESET_SYMGEN : in std_logic; -- Reset the SYM_GEN module.
113  RESET : in std_logic); -- Reset the lane.
114 end AURORA_LANE;
115 
116 architecture MAPPED of AURORA_LANE is
117 
118 -- External Register Declarations --
119 
120  signal RX_POLARITY_Buffer : std_logic;
121  signal RX_RESET_Buffer : std_logic;
122  signal TX_CHAR_IS_K_Buffer : std_logic_vector(1 downto 0);
123  signal TX_DATA_Buffer : std_logic_vector(15 downto 0);
124  signal TX_RESET_Buffer : std_logic;
125  signal ENA_COMMA_ALIGN_Buffer : std_logic;
126  signal RX_PAD_Buffer : std_logic;
127  signal RX_PE_DATA_Buffer : std_logic_vector(0 to 15);
128  signal RX_PE_DATA_V_Buffer : std_logic;
129  signal RX_SCP_Buffer : std_logic;
130  signal RX_ECP_Buffer : std_logic;
131  signal LANE_UP_Buffer : std_logic;
132  signal SOFT_ERR_Buffer : std_logic;
133  signal HARD_ERR_Buffer : std_logic;
134  -- signal CHANNEL_BOND_LOAD_Buffer : std_logic;
135  signal GOT_A_Buffer : std_logic_vector(0 to 1);
136  signal GOT_V_Buffer : std_logic;
137 
138 -- Wire Declarations --
139 
140  signal rx_cc_i : std_logic;
141  signal gen_k_i : std_logic;
142  signal gen_sp_data_i : std_logic_vector(0 to 1);
143  signal gen_spa_data_i : std_logic_vector(0 to 1);
144  signal rx_sp_i : std_logic;
145  signal rx_spa_i : std_logic;
146  signal rx_neg_i : std_logic;
147  signal enable_err_detect_i : std_logic;
148  signal do_word_align_i : std_logic;
149  signal hard_err_reset_i : std_logic;
150 
151  signal tx_char_is_k_i : std_logic_vector(1 downto 0);
152  signal tx_data_buffer_i : std_logic_vector(15 downto 0);
153  signal rx_data_i : std_logic_vector(15 downto 0);
154  signal rx_char_is_k_i : std_logic_vector(1 downto 0);
155  signal rx_char_is_comma_i : std_logic_vector(1 downto 0);
156  signal rx_disp_err_i : std_logic_vector(1 downto 0);
157  signal rx_not_in_table_i : std_logic_vector(1 downto 0);
158 
159 -- Component Declarations --
160 
161  component LANE_INIT_SM
162 
163  port (
164 
165  -- GTP Interface
166 
167  RX_NOT_IN_TABLE : in std_logic_vector(1 downto 0); -- GTP received invalid 10b code.
168  RX_DISP_ERR : in std_logic_vector(1 downto 0); -- GTP received 10b code w/ wrong disparity.
169  RX_CHAR_IS_COMMA : in std_logic_vector(1 downto 0); -- GTP received a Comma.
170  RX_REALIGN : in std_logic; -- GTP had to change alignment due to new comma.
171  RX_RESET : out std_logic; -- Reset the RX side of the GTP.
172  TX_RESET : out std_logic; -- Reset the TX side of the GTP.
173  RX_POLARITY : out std_logic; -- Sets polarity used to interpet rx'ed symbols.
174 
175  -- Comma Detect Phase Alignment Interface
176 
177  ENA_COMMA_ALIGN : out std_logic; -- Turn on SERDES Alignment in GTP.
178 
179  -- Symbol Generator Interface
180 
181  GEN_K : out std_logic; -- Generate a comma on the MSByte of the Lane.
182  GEN_SP_DATA : out std_logic_vector(0 to 1); -- Generate SP data symbol on selected byte(s).
183  GEN_SPA_DATA : out std_logic_vector(0 to 1); -- Generate SPA data symbol on selected byte(s).
184 
185  -- Symbol Decoder Interface
186 
187  RX_SP : in std_logic; -- Lane rx'ed SP sequence w/ + or - data.
188  RX_SPA : in std_logic; -- Lane rx'ed SPA sequence.
189  RX_NEG : in std_logic; -- Lane rx'ed inverted SP or SPA data.
190  DO_WORD_ALIGN : out std_logic; -- Enable word alignment.
191 
192  -- Error Detection Logic Interface
193 
194  ENABLE_ERR_DETECT : out std_logic; -- Turn on Soft Error detection.
195  HARD_ERR_RESET : in std_logic; -- Reset lane due to hard error.
196 
197  -- Global Logic Interface
198 
199  LANE_UP : out std_logic; -- Lane is initialized.
200 
201  -- System Interface
202 
203  USER_CLK : in std_logic; -- Clock for all non-GTP Aurora logic.
204  RESET : in std_logic -- Reset Aurora Lane.
205 
206  );
207 
208  end component;
209 
210 
211  -- component CHBOND_COUNT_DEC
212  --
213  -- port (
214  --
215  -- RX_STATUS : in std_logic_vector(5 downto 0);
216  -- CHANNEL_BOND_LOAD : out std_logic;
217  -- USER_CLK : in std_logic
218  --
219  -- );
220  --
221  -- end component;
222 
223 
224  component SYM_GEN
225 
226  port (
227 
228  -- TX_LL Interface -- See description for info about GEN_PAD and TX_PE_DATA_V.
229 
230  GEN_SCP : in std_logic; -- Generate SCP.
231  GEN_ECP : in std_logic; -- Generate ECP.
232  GEN_PAD : in std_logic; -- Replace LSB with Pad character.
233  TX_PE_DATA : in std_logic_vector(0 to 15); -- Data. Transmitted when TX_PE_DATA_V is asserted.
234  TX_PE_DATA_V : in std_logic; -- Transmit data.
235  GEN_CC : in std_logic; -- Generate Clock Correction symbols.
236 
237  -- Global Logic Interface -- See description for info about GEN_K,GEN_R and GEN_A.
238 
239  GEN_A : in std_logic; -- Generate A character for selected bytes.
240  GEN_K : in std_logic_vector(0 to 1); -- Generate K character for selected bytes.
241  GEN_R : in std_logic_vector(0 to 1); -- Generate R character for selected bytes.
242  GEN_V : in std_logic_vector(0 to 1); -- Generate Ver data character on selected bytes.
243 
244  -- Lane Init SM Interface
245 
246  GEN_K_FSM : in std_logic; -- Generate K character on byte 0.
247  GEN_SP_DATA : in std_logic_vector(0 to 1); -- Generate SP data character on selected bytes.
248  GEN_SPA_DATA : in std_logic_vector(0 to 1); -- Generate SPA data character on selected bytes.
249 
250  -- GTP Interface
251 
252  TX_CHAR_IS_K : out std_logic_vector(1 downto 0); -- Transmit TX_DATA as a control character.
253  TX_DATA : out std_logic_vector(15 downto 0); -- Data to GTP for transmission to channel partner.
254 
255  -- System Interface
256 
257  USER_CLK : in std_logic -- Clock for all non-GTP Aurora Logic.
258  );
259 
260  end component;
261 
262 
263  component SYM_DEC
264 
265  port (
266 
267  -- RX_LL Interface
268 
269  RX_PAD : out std_logic; -- LSByte is PAD.
270  RX_PE_DATA : out std_logic_vector(0 to 15); -- Word aligned data from channel partner.
271  RX_PE_DATA_V : out std_logic; -- Data is valid data and not a control character.
272  RX_SCP : out std_logic; -- SCP symbol received.
273  RX_ECP : out std_logic; -- ECP symbol received.
274 
275  -- Lane Init SM Interface
276 
277  DO_WORD_ALIGN : in std_logic; -- Word alignment is allowed.
278  RX_SP : out std_logic; -- SP sequence received with positive or negative data.
279  RX_SPA : out std_logic; -- SPA sequence received.
280  RX_NEG : out std_logic; -- Intverted data for SP or SPA received.
281 
282  -- Global Logic Interface
283 
284  GOT_A : out std_logic_vector(0 to 1); -- A character received on indicated byte(s).
285  GOT_V : out std_logic; -- V sequence received.
286 
287  -- GTP Interface
288 
289  RX_DATA : in std_logic_vector(15 downto 0); -- Raw RX data from GTP.
290  RX_CHAR_IS_K : in std_logic_vector(1 downto 0); -- Bits indicating which bytes are control characters.
291  RX_CHAR_IS_COMMA : in std_logic_vector(1 downto 0); -- Rx'ed a comma.
292  RX_CC : out std_logic; -- CC sequence received.
293 
294  -- System Interface
295 
296  USER_CLK : in std_logic; -- System clock for all non-GTP Aurora Logic.
297  RESET : in std_logic
298 
299  );
300 
301  end component;
302 
303 
304  component ERR_DETECT
305 
306  port (
307 
308  -- Lane Init SM Interface
309 
310  ENABLE_ERR_DETECT : in std_logic;
311  HARD_ERR_RESET : out std_logic;
312 
313  -- Global Logic Interface
314 
315  SOFT_ERR : out std_logic;
316  HARD_ERR : out std_logic;
317 
318  -- GTP Interface
319 
320  RX_DISP_ERR : in std_logic_vector(1 downto 0);
321  RX_NOT_IN_TABLE : in std_logic_vector(1 downto 0);
322  RX_BUF_ERR : in std_logic;
323  TX_BUF_ERR : in std_logic;
324  RX_REALIGN : in std_logic;
325 
326  -- System Interface
327 
328  USER_CLK : in std_logic
329 
330  );
331 
332  end component;
333 
334 
335 begin
336 
337  RX_POLARITY <= RX_POLARITY_Buffer;
338  RX_RESET <= RX_RESET_Buffer;
339  TX_CHAR_IS_K <= TX_CHAR_IS_K_Buffer;
340  TX_DATA <= TX_DATA_Buffer;
341  TX_RESET <= TX_RESET_Buffer;
342  ENA_COMMA_ALIGN <= ENA_COMMA_ALIGN_Buffer;
343  RX_PAD <= RX_PAD_Buffer;
344  RX_PE_DATA <= RX_PE_DATA_Buffer;
345  RX_PE_DATA_V <= RX_PE_DATA_V_Buffer;
346  RX_SCP <= RX_SCP_Buffer;
347  RX_ECP <= RX_ECP_Buffer;
348  LANE_UP <= LANE_UP_Buffer;
349  SOFT_ERR <= SOFT_ERR_Buffer;
350  HARD_ERR <= HARD_ERR_Buffer;
351  -- CHANNEL_BOND_LOAD <= CHANNEL_BOND_LOAD_Buffer;
352  GOT_A <= GOT_A_Buffer;
353  GOT_V <= GOT_V_Buffer;
354 
355 
356 -- Main Body of Code --
357 
358  -- Buffers for twisting data from ProX --
359 
360  -- GTP GTPs order their data in the opposite direction from Pro GTPs. To reuse the
361  -- Pro Aurora logic, we twist the data to make it compatible.
362 
363  TX_CHAR_IS_K_Buffer(0) <= tx_char_is_k_i(1);
364  TX_CHAR_IS_K_Buffer(1) <= tx_char_is_k_i(0);
365  TX_DATA_Buffer(7 downto 0) <= tx_data_buffer_i(15 downto 8);
366  TX_DATA_Buffer(15 downto 8) <= tx_data_buffer_i(7 downto 0);
367 
368  rx_data_i <= RX_DATA(7 downto 0) & RX_DATA(15 downto 8);
369  rx_char_is_k_i <= RX_CHAR_IS_K(0) & RX_CHAR_IS_K(1);
370  rx_char_is_comma_i <= RX_CHAR_IS_COMMA(0) & RX_CHAR_IS_COMMA(1);
371  rx_disp_err_i <= RX_DISP_ERR(0) & RX_DISP_ERR(1);
372  rx_not_in_table_i <= RX_NOT_IN_TABLE(0) & RX_NOT_IN_TABLE(1);
373 
374 
375  -- Lane Initialization state machine
376 
377  lane_init_sm_i : LANE_INIT_SM
378 
379  port map (
380 
381  -- GTP Interface
382 
383  RX_NOT_IN_TABLE => RX_NOT_IN_TABLE,
384  RX_DISP_ERR => RX_DISP_ERR,
385  RX_CHAR_IS_COMMA => RX_CHAR_IS_COMMA,
386  RX_REALIGN => RX_REALIGN,
387 
388  RX_RESET => RX_RESET_Buffer,
389  TX_RESET => TX_RESET_Buffer,
390  RX_POLARITY => RX_POLARITY_Buffer,
391 
392  -- Comma Detect Phase Alignment Interface
393 
394  ENA_COMMA_ALIGN => ENA_COMMA_ALIGN_Buffer,
395 
396  -- Symbol Generator Interface
397 
398  GEN_K => gen_k_i,
399  GEN_SP_DATA => gen_sp_data_i,
400  GEN_SPA_DATA => gen_spa_data_i,
401 
402  -- Symbol Decoder Interface
403 
404  RX_SP => rx_sp_i,
405  RX_SPA => rx_spa_i,
406  RX_NEG => rx_neg_i,
407 
408  DO_WORD_ALIGN => do_word_align_i,
409 
410  -- Error Detection Logic Interface
411 
412  HARD_ERR_RESET => hard_err_reset_i,
413  ENABLE_ERR_DETECT => enable_err_detect_i,
414 
415  -- Global Logic Interface
416 
417  LANE_UP => LANE_UP_Buffer,
418 
419  -- System Interface
420 
421  USER_CLK => USER_CLK,
422  RESET => RESET
423 
424  );
425 
426 
427  -- Channel Bonding Count Decode module
428 
429  -- chbond_count_dec_i : CHBOND_COUNT_DEC
430  --
431  -- port map (
432  --
433  -- RX_STATUS => RX_STATUS,
434  -- CHANNEL_BOND_LOAD => CHANNEL_BOND_LOAD_Buffer,
435  -- USER_CLK => USER_CLK
436  --
437  -- );
438 
439 
440  -- Symbol Generation module
441 
442  sym_gen_i : SYM_GEN
443 
444  port map (
445 
446  -- TX_LL Interface
447 
448  GEN_SCP => GEN_SCP,
449  GEN_ECP => GEN_ECP,
450  GEN_PAD => GEN_PAD,
451  TX_PE_DATA => TX_PE_DATA,
452  TX_PE_DATA_V => TX_PE_DATA_V,
453  GEN_CC => GEN_CC,
454 
455  -- Global Logic Interface
456 
457  GEN_A => GEN_A,
458  GEN_K => GEN_K,
459  GEN_R => GEN_R,
460  GEN_V => GEN_V,
461 
462  -- Lane Init SM Interface
463 
464  GEN_K_FSM => gen_k_i,
465  GEN_SP_DATA => gen_sp_data_i,
466  GEN_SPA_DATA => gen_spa_data_i,
467 
468  -- GTP Interface
469 
470  TX_CHAR_IS_K => tx_char_is_k_i,
471  TX_DATA => tx_data_buffer_i,
472 
473  -- System Interface
474 
475  USER_CLK => USER_CLK
476  );
477 
478 
479  -- Symbol Decode module
480 
481  sym_dec_i : SYM_DEC
482 
483  port map (
484 
485  -- RX_LL Interface
486 
487  RX_PAD => RX_PAD_Buffer,
488  RX_PE_DATA => RX_PE_DATA_Buffer,
489  RX_PE_DATA_V => RX_PE_DATA_V_Buffer,
490  RX_SCP => RX_SCP_Buffer,
491  RX_ECP => RX_ECP_Buffer,
492 
493  -- Lane Init SM Interface
494 
495  DO_WORD_ALIGN => do_word_align_i,
496  RX_SP => rx_sp_i,
497  RX_SPA => rx_spa_i,
498  RX_NEG => rx_neg_i,
499 
500  -- Global Logic Interface
501 
502  GOT_A => GOT_A_Buffer,
503  GOT_V => GOT_V_Buffer,
504 
505  -- GTP Interface
506 
507  RX_DATA => rx_data_i,
508  RX_CHAR_IS_K => rx_char_is_k_i,
509  RX_CHAR_IS_COMMA => rx_char_is_comma_i,
510  RX_CC => OPEN,
511 
512  -- System Interface
513 
514  USER_CLK => USER_CLK,
515  RESET => RESET
516 
517  );
518 
519 
520  -- Error Detection module
521 
522  err_detect_i : ERR_DETECT
523 
524  port map (
525 
526  -- Lane Init SM Interface
527 
528  ENABLE_ERR_DETECT => enable_err_detect_i,
529  HARD_ERR_RESET => hard_err_reset_i,
530 
531  -- Global Logic Interface
532 
533  SOFT_ERR => SOFT_ERR_Buffer,
534  HARD_ERR => HARD_ERR_Buffer,
535 
536  -- GTP Interface
537 
538  RX_DISP_ERR => rx_disp_err_i,
539  RX_NOT_IN_TABLE => rx_not_in_table_i,
540  RX_BUF_ERR => RX_BUF_ERR,
541  TX_BUF_ERR => TX_BUF_ERR,
542  RX_REALIGN => RX_REALIGN,
543 
544  -- System Interface
545 
546  USER_CLK => USER_CLK
547 
548  );
549 
550 
551 end MAPPED;