1 | library ieee; |
---|
2 | use ieee.std_logic_1164.all; |
---|
3 | use ieee.std_logic_arith.all; |
---|
4 | use ieee.std_logic_unsigned.all; |
---|
5 | |
---|
6 | Library XilinxCoreLib; |
---|
7 | use XilinxCoreLib.all; |
---|
8 | |
---|
9 | library unisim ; |
---|
10 | use unisim.vcomponents.all ; |
---|
11 | |
---|
12 | |
---|
13 | entity linkport is |
---|
14 | port( |
---|
15 | -- TX port |
---|
16 | tx_data :in std_logic_vector(15 downto 0); |
---|
17 | tx_clk :in std_logic; |
---|
18 | tx_wr :in std_logic; |
---|
19 | tx_first :in std_logic; |
---|
20 | tx_last :in std_logic; |
---|
21 | tx_rdy :out std_logic; |
---|
22 | link_en :in std_logic; |
---|
23 | |
---|
24 | -- RX port |
---|
25 | rx_clk :in std_logic; |
---|
26 | rx_drdy :out std_logic; |
---|
27 | rx_first :out std_logic; |
---|
28 | rx_last :out std_logic; |
---|
29 | rx_data :out std_logic_vector(15 downto 0); |
---|
30 | |
---|
31 | -- Flow control port |
---|
32 | fc_req :in std_logic; |
---|
33 | fc_nb :in std_logic_vector(3 downto 0); |
---|
34 | fc_ack :out std_logic; |
---|
35 | |
---|
36 | -- MGT clk source |
---|
37 | top_ref_clk_i :in std_logic; |
---|
38 | user_clk_i :in std_logic; |
---|
39 | |
---|
40 | -- MGT port |
---|
41 | mgt_rxp :in std_logic; |
---|
42 | mgt_rxn :in std_logic; |
---|
43 | mgt_txp :out std_logic; |
---|
44 | mgt_txn :out std_logic; |
---|
45 | |
---|
46 | -- System input |
---|
47 | grst :in std_logic; |
---|
48 | mgt_pwdn :in std_logic); |
---|
49 | End Entity; |
---|
50 | |
---|
51 | |
---|
52 | architecture linkport_b1 of linkport is |
---|
53 | |
---|
54 | -- Native Flow Control Interface |
---|
55 | signal nfc_req_n_i :std_logic; |
---|
56 | signal nfc_nb_i :std_logic_vector(3 downto 0); |
---|
57 | signal nfc_ack_n_i :std_logic; |
---|
58 | |
---|
59 | -- MGT Reference Clock Interface |
---|
60 | |
---|
61 | |
---|
62 | -- Error Detection Interface |
---|
63 | signal hard_error_i :std_logic; |
---|
64 | signal soft_error_i :std_logic; |
---|
65 | signal frame_error_i :std_logic; |
---|
66 | |
---|
67 | -- Status |
---|
68 | signal channel_up_i :std_logic; |
---|
69 | signal lane_up_i :std_logic; |
---|
70 | |
---|
71 | -- Clock Compensation Control Interface |
---|
72 | signal warn_cc_i :std_logic; |
---|
73 | signal do_cc_i :std_logic; |
---|
74 | |
---|
75 | -- System Interface |
---|
76 | signal dcm_not_locked_i:std_logic; |
---|
77 | |
---|
78 | signal power_down_i:std_logic; |
---|
79 | signal loopback_i:std_logic_vector(1 downto 0); |
---|
80 | |
---|
81 | signal tx_ff_rd:std_logic ; |
---|
82 | signal tx_ff_wr :std_logic; |
---|
83 | signal tx_ff_almost_empty:std_logic ; |
---|
84 | signal tx_ff_almost_full :std_logic; |
---|
85 | signal tx_ff_wdata:std_logic_vector(17 downto 0) ; |
---|
86 | signal tx_ff_rdata:std_logic_vector(17 downto 0) ; |
---|
87 | signal tx_ff_empty:std_logic ; |
---|
88 | signal tx_ff_full :std_logic; |
---|
89 | |
---|
90 | signal rx_ff_wdata:std_logic_vector(17 downto 0) ; |
---|
91 | signal rx_ff_rdata:std_logic_vector(17 downto 0) ; |
---|
92 | signal rx_ff_wr :std_logic; |
---|
93 | signal rx_ff_rd:std_logic ; |
---|
94 | signal rx_ff_almost_empty:std_logic ; |
---|
95 | signal rx_ff_almost_full:std_logic ; |
---|
96 | signal rx_ff_empty:std_logic ; |
---|
97 | signal rx_ff_full:std_logic ; |
---|
98 | |
---|
99 | signal mgt_reset:std_logic ; |
---|
100 | signal tx_reset:std_logic; |
---|
101 | |
---|
102 | signal aur_tx_sof_1:std_logic; |
---|
103 | signal aur_tx_eof_1:std_logic ; |
---|
104 | signal aur_tx_data:std_logic_vector(15 downto 0) ; |
---|
105 | signal aur_tx_rem:std_logic ; |
---|
106 | signal aur_tx_src_rdy_1:std_logic ; |
---|
107 | signal aur_tx_dst_rdy_1:std_logic ; |
---|
108 | |
---|
109 | signal aur_rx_data :std_logic_vector(15 downto 0); |
---|
110 | signal aur_rx_sof_1:std_logic ; |
---|
111 | signal aur_rx_eof_1 :std_logic; |
---|
112 | signal aur_rx_src_rdy_1:std_logic ; |
---|
113 | signal aur_rx_rem:std_logic ; |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | component fifo_64x18 IS |
---|
118 | port ( |
---|
119 | din: IN std_logic_VECTOR(17 downto 0); |
---|
120 | rd_clk: IN std_logic; |
---|
121 | rd_en: IN std_logic; |
---|
122 | rst: IN std_logic; |
---|
123 | wr_clk: IN std_logic; |
---|
124 | wr_en: IN std_logic; |
---|
125 | almost_empty: OUT std_logic; |
---|
126 | almost_full: OUT std_logic; |
---|
127 | dout: OUT std_logic_VECTOR(17 downto 0); |
---|
128 | empty: OUT std_logic; |
---|
129 | full: OUT std_logic); |
---|
130 | END component; |
---|
131 | |
---|
132 | component tx_ff_ctrl is |
---|
133 | port ( |
---|
134 | tx_wr : in std_logic; |
---|
135 | tx_wdata :in std_logic_vector(15 downto 0); |
---|
136 | tx_rdy :out std_logic ; |
---|
137 | tx_first :in std_logic; |
---|
138 | tx_last :in std_logic ; |
---|
139 | tx_en :in std_logic ; |
---|
140 | |
---|
141 | tx_ff_wr :out std_logic; |
---|
142 | tx_ff_full :in std_logic ; |
---|
143 | tx_ff_wdata :out std_logic_vector(17 downto 0) ; |
---|
144 | tx_ff_almost_full : in std_logic; |
---|
145 | aur_lane_up :in std_logic |
---|
146 | ); |
---|
147 | end component; |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | component rx_ff_ctrl is |
---|
152 | port ( |
---|
153 | |
---|
154 | rx_en : in std_logic; |
---|
155 | aur_rx_src_rdy_1 : in std_logic; |
---|
156 | aur_rx_data :in std_logic_vector(15 downto 0); |
---|
157 | aur_rx_sof_1 :in std_logic; |
---|
158 | aur_rx_eof_1:in std_logic; |
---|
159 | rx_ff_wr :out std_logic; |
---|
160 | rx_ff_wdata :out std_logic_vector(17 downto 0); |
---|
161 | |
---|
162 | rx_ff_empty :in std_logic; |
---|
163 | rx_ff_rdata :in std_logic_vector(17 downto 0); |
---|
164 | rx_drdy :out std_logic; |
---|
165 | rx_first :out std_logic; |
---|
166 | rx_last :out std_logic; |
---|
167 | rx_data : out std_logic_vector(15 downto 0); |
---|
168 | rx_ff_rd :out std_logic |
---|
169 | ); |
---|
170 | end component; |
---|
171 | |
---|
172 | |
---|
173 | component aurora_tx_ctrl is |
---|
174 | port ( |
---|
175 | tx_ff_empty: in std_logic; |
---|
176 | tx_ff_rd :out std_logic; |
---|
177 | tx_ff_rdata : in std_logic_vector(17 downto 0); |
---|
178 | |
---|
179 | aur_tx_sof_1 : out std_logic; |
---|
180 | aur_tx_eof_1: out std_logic ; |
---|
181 | aur_tx_data : out std_logic_vector(15 downto 0); |
---|
182 | aur_tx_rem: out std_logic ; |
---|
183 | aur_tx_src_rdy_1: out std_logic ; |
---|
184 | aur_tx_dst_rdy_1: in std_logic |
---|
185 | |
---|
186 | ); |
---|
187 | end component; |
---|
188 | |
---|
189 | |
---|
190 | component aurora_16b is |
---|
191 | generic ( |
---|
192 | EXTEND_WATCHDOGS : boolean := FALSE |
---|
193 | ); |
---|
194 | port ( |
---|
195 | |
---|
196 | -- LocalLink TX Interface |
---|
197 | |
---|
198 | TX_D : in std_logic_vector(0 to 15); |
---|
199 | TX_REM : in std_logic; |
---|
200 | TX_SRC_RDY_N : in std_logic; |
---|
201 | TX_SOF_N : in std_logic; |
---|
202 | TX_EOF_N : in std_logic; |
---|
203 | TX_DST_RDY_N : out std_logic; |
---|
204 | |
---|
205 | -- LocalLink RX Interface |
---|
206 | |
---|
207 | RX_D : out std_logic_vector(0 to 15); |
---|
208 | RX_REM : out std_logic; |
---|
209 | RX_SRC_RDY_N : out std_logic; |
---|
210 | RX_SOF_N : out std_logic; |
---|
211 | RX_EOF_N : out std_logic; |
---|
212 | |
---|
213 | -- Native Flow Control Interface |
---|
214 | |
---|
215 | NFC_REQ_N : in std_logic; |
---|
216 | NFC_NB : in std_logic_vector(0 to 3); |
---|
217 | NFC_ACK_N : out std_logic; |
---|
218 | |
---|
219 | -- MGT Serial I/O |
---|
220 | |
---|
221 | RXP : in std_logic; |
---|
222 | RXN : in std_logic; |
---|
223 | |
---|
224 | TXP : out std_logic; |
---|
225 | TXN : out std_logic; |
---|
226 | |
---|
227 | -- MGT Reference Clock Interface |
---|
228 | |
---|
229 | TOP_BREF_CLK : in std_logic; |
---|
230 | |
---|
231 | -- Error Detection Interface |
---|
232 | |
---|
233 | HARD_ERROR : out std_logic; |
---|
234 | SOFT_ERROR : out std_logic; |
---|
235 | FRAME_ERROR : out std_logic; |
---|
236 | |
---|
237 | -- Status |
---|
238 | |
---|
239 | CHANNEL_UP : out std_logic; |
---|
240 | LANE_UP : out std_logic; |
---|
241 | |
---|
242 | -- Clock Compensation Control Interface |
---|
243 | |
---|
244 | WARN_CC : in std_logic; |
---|
245 | DO_CC : in std_logic; |
---|
246 | |
---|
247 | -- System Interface |
---|
248 | |
---|
249 | DCM_NOT_LOCKED : in std_logic; |
---|
250 | USER_CLK : in std_logic; |
---|
251 | RESET : in std_logic; |
---|
252 | POWER_DOWN : in std_logic; |
---|
253 | LOOPBACK : in std_logic_vector(1 downto 0) |
---|
254 | |
---|
255 | ); |
---|
256 | |
---|
257 | end component; |
---|
258 | |
---|
259 | |
---|
260 | component reset_gen is |
---|
261 | port ( |
---|
262 | |
---|
263 | reset_in : in std_logic; |
---|
264 | clk : in std_logic; |
---|
265 | reset_out : out std_logic |
---|
266 | |
---|
267 | ); |
---|
268 | end component; |
---|
269 | |
---|
270 | |
---|
271 | component STANDARD_CC_MODULE is |
---|
272 | port |
---|
273 | ( |
---|
274 | -- Clock Compensation Control Interface |
---|
275 | WARN_CC : out std_logic; |
---|
276 | DO_CC : out std_logic; |
---|
277 | |
---|
278 | |
---|
279 | -- System Interface |
---|
280 | DCM_NOT_LOCKED : in std_logic; |
---|
281 | USER_CLK : in std_logic; |
---|
282 | CHANNEL_UP : in std_logic |
---|
283 | |
---|
284 | ); |
---|
285 | end component; |
---|
286 | |
---|
287 | component aurora_ctrl is |
---|
288 | port ( |
---|
289 | pwdn_in : in std_logic ; |
---|
290 | user_clk : in std_logic ; |
---|
291 | dcm_not_locked : out std_logic; |
---|
292 | loopback : out std_logic_vector(1 downto 0); |
---|
293 | power_down : out std_logic; |
---|
294 | nfc_req_1 : out std_logic ; |
---|
295 | nfc_nb : out std_logic_vector(3 downto 0) |
---|
296 | ); |
---|
297 | end component; |
---|
298 | |
---|
299 | begin |
---|
300 | |
---|
301 | |
---|
302 | |
---|
303 | -- TX FIFO 64x18 bit |
---|
304 | TX_FIFO_64x18_I : fifo_64x18 |
---|
305 | port map |
---|
306 | ( |
---|
307 | |
---|
308 | -- write port |
---|
309 | wr_clk => tx_clk , --IN |
---|
310 | wr_en => tx_ff_wr , --IN |
---|
311 | din => tx_ff_wdata , --IN[17:0] |
---|
312 | -- read port |
---|
313 | rd_clk => user_clk_i , --IN |
---|
314 | rd_en => tx_ff_rd , --IN |
---|
315 | dout => tx_ff_rdata , --OUT[17:0] |
---|
316 | -- flag |
---|
317 | almost_empty => tx_ff_almost_empty , --OUT |
---|
318 | almost_full => tx_ff_almost_full , --OUT |
---|
319 | empty => tx_ff_empty , --OUT |
---|
320 | full =>tx_ff_full , --OUT |
---|
321 | -- reset |
---|
322 | rst =>grst --IN |
---|
323 | ); |
---|
324 | |
---|
325 | |
---|
326 | |
---|
327 | |
---|
328 | -- TX FIFO control |
---|
329 | TX_FF_CTRL_I : tx_ff_ctrl |
---|
330 | port map( |
---|
331 | tx_wr =>tx_wr , --IN |
---|
332 | tx_wdata =>tx_data , --IN[15:0] |
---|
333 | tx_rdy =>tx_rdy , --OUT |
---|
334 | tx_first =>tx_first , --IN |
---|
335 | tx_last =>tx_last , --IN |
---|
336 | tx_en =>link_en , --IN |
---|
337 | |
---|
338 | tx_ff_wr =>tx_ff_wr , --IN |
---|
339 | tx_ff_full =>tx_ff_full , --IN |
---|
340 | tx_ff_almost_full =>tx_ff_almost_full , --IN |
---|
341 | tx_ff_wdata =>tx_ff_wdata , --OUT[17:0] |
---|
342 | aur_lane_up =>lane_up_i --IN |
---|
343 | ) ; |
---|
344 | |
---|
345 | -- RX FIFO 64x18 bit |
---|
346 | RX_FIFO_64x18_I: fifo_64x18 |
---|
347 | port map ( |
---|
348 | -- write port |
---|
349 | wr_clk => user_clk_i , --IN |
---|
350 | wr_en => rx_ff_wr , --IN |
---|
351 | din => rx_ff_wdata , --IN[17:0] |
---|
352 | -- read port |
---|
353 | rd_clk => rx_clk , --IN |
---|
354 | rd_en => rx_ff_rd , --IN |
---|
355 | dout =>rx_ff_rdata , --OUT[17:0] |
---|
356 | -- flag |
---|
357 | almost_empty =>rx_ff_almost_empty , --OUT |
---|
358 | almost_full =>rx_ff_almost_full , --OUT |
---|
359 | empty =>rx_ff_empty , --OUT |
---|
360 | full =>rx_ff_full , --OUT |
---|
361 | -- reset |
---|
362 | rst =>grst --IN |
---|
363 | ); |
---|
364 | |
---|
365 | -- RX FIFO control |
---|
366 | RX_FF_CTRL_I : rx_ff_ctrl |
---|
367 | port map( |
---|
368 | rx_en =>link_en , --IN |
---|
369 | aur_rx_src_rdy_1=>aur_rx_src_rdy_1, --IN |
---|
370 | aur_rx_sof_1 =>aur_rx_sof_1 , --IN |
---|
371 | aur_rx_eof_1 =>aur_rx_eof_1 , --IN |
---|
372 | aur_rx_data =>aur_rx_data , --IN[15:0] |
---|
373 | rx_ff_wdata =>rx_ff_wdata , --OUT[17:0] |
---|
374 | rx_ff_wr =>rx_ff_wr , --OUT |
---|
375 | |
---|
376 | rx_drdy =>rx_drdy , --OUT |
---|
377 | rx_data =>rx_data , --OUT[15:0] |
---|
378 | rx_first =>rx_first , --OUT |
---|
379 | rx_last =>rx_last , --OUT |
---|
380 | rx_ff_rd =>rx_ff_rd , --OUT |
---|
381 | rx_ff_empty =>rx_ff_empty , --IN |
---|
382 | rx_ff_rdata =>rx_ff_rdata --IN[17:0] |
---|
383 | ) ; |
---|
384 | |
---|
385 | |
---|
386 | -- Aurora TX ctrl |
---|
387 | AURORA_TX_CTRL_I : aurora_tx_ctrl |
---|
388 | port map( |
---|
389 | tx_ff_rd =>tx_ff_rd , --IN |
---|
390 | tx_ff_rdata =>tx_ff_rdata , --IN[17:0] |
---|
391 | tx_ff_empty =>tx_ff_empty , --IN |
---|
392 | |
---|
393 | aur_tx_sof_1 =>aur_tx_sof_1 , --OUT |
---|
394 | aur_tx_eof_1 =>aur_tx_eof_1 , --OUT |
---|
395 | aur_tx_data =>aur_tx_data , --OUT[15:0] |
---|
396 | aur_tx_rem =>aur_tx_rem , --OUT |
---|
397 | aur_tx_src_rdy_1=>aur_tx_src_rdy_1, --OUT |
---|
398 | aur_tx_dst_rdy_1=>aur_tx_dst_rdy_1 --IN |
---|
399 | ) ; |
---|
400 | |
---|
401 | AURORA_16B_I : aurora_16b |
---|
402 | generic map( |
---|
403 | EXTEND_WATCHDOGS => FALSE |
---|
404 | ) |
---|
405 | port map( |
---|
406 | -- LocalLink TX Interface |
---|
407 | TX_D =>aur_tx_data , --IN[15:0] |
---|
408 | TX_REM =>aur_tx_rem , --IN |
---|
409 | TX_SRC_RDY_N =>aur_tx_src_rdy_1 , --IN |
---|
410 | TX_SOF_N =>aur_tx_sof_1 , --IN |
---|
411 | TX_EOF_N =>aur_tx_eof_1 , --IN |
---|
412 | |
---|
413 | TX_DST_RDY_N =>aur_tx_dst_rdy_1 , --OUT |
---|
414 | |
---|
415 | |
---|
416 | -- LocalLink RX Interface |
---|
417 | RX_D =>aur_rx_data , --OUT[15:0] |
---|
418 | RX_REM =>aur_rx_rem , --OUT |
---|
419 | RX_SRC_RDY_N =>aur_rx_src_rdy_1 , --OUT |
---|
420 | RX_SOF_N =>aur_rx_sof_1 , --OUT |
---|
421 | RX_EOF_N =>aur_rx_eof_1 , --OUT |
---|
422 | |
---|
423 | -- Native Flow Control Interface |
---|
424 | nfc_req_N =>nfc_req_n_i , --IN |
---|
425 | NFC_NB =>nfc_nb_i , --IN[3:0] |
---|
426 | NFC_ACK_N =>nfc_ack_n_i , --OUT |
---|
427 | |
---|
428 | -- MGT Serial I/O |
---|
429 | RXP =>mgt_rxp , --OUT |
---|
430 | RXN =>mgt_rxn , --OUT |
---|
431 | |
---|
432 | TXP =>mgt_txp , --IN |
---|
433 | TXN =>mgt_txn , --IN |
---|
434 | |
---|
435 | -- MGT Reference Clock Interface |
---|
436 | TOP_BREF_CLK =>top_ref_clk_i , --IN |
---|
437 | |
---|
438 | -- Error Detection Interface |
---|
439 | HARD_ERROR =>hard_error_i , --OUT |
---|
440 | SOFT_ERROR =>soft_error_i , --OUT |
---|
441 | FRAME_ERROR =>frame_error_i , --OUT |
---|
442 | |
---|
443 | -- Status |
---|
444 | CHANNEL_UP =>channel_up_i , --OUT |
---|
445 | LANE_UP =>lane_up_i , --OUT |
---|
446 | |
---|
447 | -- Clock Compensation Control Interface |
---|
448 | WARN_CC =>warn_cc_i , --IN |
---|
449 | DO_CC =>do_cc_i , --IN |
---|
450 | |
---|
451 | -- System Interface |
---|
452 | DCM_NOT_LOCKED =>dcm_not_locked_i , --IN |
---|
453 | USER_CLK =>user_clk_i , --IN |
---|
454 | RESET =>mgt_reset , --IN |
---|
455 | POWER_DOWN =>power_down_i , --IN |
---|
456 | LOOPBACK =>loopback_i --IN |
---|
457 | ); |
---|
458 | |
---|
459 | STANDARD_CC_MODULE_I :STANDARD_CC_MODULE |
---|
460 | port map( |
---|
461 | -- Clock Compensation Control Interface |
---|
462 | WARN_CC =>warn_cc_i , --OUT |
---|
463 | DO_CC =>do_cc_i , --OUT |
---|
464 | |
---|
465 | -- System Interface |
---|
466 | DCM_NOT_LOCKED =>dcm_not_locked_i , --IN |
---|
467 | USER_CLK =>user_clk_i , --IN |
---|
468 | CHANNEL_UP =>channel_up_i --IN |
---|
469 | ); |
---|
470 | |
---|
471 | -- Reset generation |
---|
472 | RESET_GEN_I1 : reset_gen |
---|
473 | port map( |
---|
474 | reset_in =>grst , --IN |
---|
475 | reset_out =>mgt_reset , --OUT |
---|
476 | clk =>user_clk_i --IN |
---|
477 | ) ; |
---|
478 | |
---|
479 | -- Reset generation |
---|
480 | RESET_GEN_TXCLK : reset_gen |
---|
481 | port map( |
---|
482 | reset_in =>grst , --IN |
---|
483 | reset_out =>tx_reset , --OUT |
---|
484 | clk =>tx_clk --IN |
---|
485 | ) ; |
---|
486 | |
---|
487 | |
---|
488 | AURORA_CTRL_I: aurora_ctrl |
---|
489 | port map( |
---|
490 | user_clk =>user_clk_i , --IN |
---|
491 | pwdn_in =>mgt_pwdn , --IN |
---|
492 | power_down =>power_down_i , --OUT |
---|
493 | dcm_not_locked =>dcm_not_locked_i , --OUT |
---|
494 | loopback =>loopback_i , --OUT |
---|
495 | nfc_req_1 =>nfc_req_n_i , --OUT |
---|
496 | nfc_nb =>nfc_nb_i --OUT[3:0] |
---|
497 | ) ; |
---|
498 | |
---|
499 | end linkport_b1; |
---|