六,基于FPGA的高速串行通信GTX知识梳理
對于XILINX,7系列FPGA,關(guān)于GTX核對配置見PG168,了解GTX內(nèi)部結(jié)構(gòu)及更多的知識見ug476。
? ? ? ? 以7系列XC7k325t-ffg900為例,見各ug476,351頁。可看到該芯片共有4個高速bank,分別為115 116 117 118;每個bank又有4組收發(fā)模塊和兩組時鐘模塊。
1,GTX時鐘和復(fù)位
? ? ? (1)時鐘源:
? ? ?GTX輸入?yún)⒖紩r鐘通過2組時鐘模塊的任意一組輸入.后通過 IBUFDS_GTE2源于得到參考時鐘輸入給GT模塊.。此處有兩種PLL由Xilinx提供給用戶使用。一種為CPLL,一種為QPLL,其中主要區(qū)別為CPLL一個bank中共有4個,一個收發(fā)模塊一個;而QPLL只有兩個,一個時鐘模塊對應(yīng)一個。從GTX速率而言,CPLL主要用低于6.25G速率的收發(fā)設(shè)計;而QPLL主要支持高于6.25G低于10.3025G速率的收發(fā)器設(shè)計。
? ? (2)發(fā)送端初始化復(fù)位:
? ? ?在時鐘CPLL或QPLL時鐘locked拉高(表示時鐘穩(wěn)定,可以正常工作)。通過GTTXRESET復(fù)位GT發(fā)送器,發(fā)送器收到復(fù)位信號從底層PMA到PCS依次復(fù)位。在PMA層,待TXPMAREAET從高變成低通過PMA層,待TXUSERRDY為高,到達PCS層;在PCS層,待TXPCSREAET從高變成低通過PCS層,則TXREAETDONE拉高,發(fā)送器復(fù)位完成。之后發(fā)送復(fù)位狀態(tài)機完成復(fù)位,輸出發(fā)送狀態(tài)機復(fù)位完成信號。復(fù)位關(guān)系和時序如圖所示:
? ? ? ?(3)接收端初始化復(fù)位:
???在時鐘CPLL或QPLL時鐘locked拉高(表示時鐘穩(wěn)定,可以正常工作)。通過GTRXRESET復(fù)位GT接收器,接收器收到復(fù)位信號從底層PMA到到DFE,LPM到EYESCAN到PCS到BUF依次復(fù)位。在PMA層,待RXPMAREAET從高變成低通過PMA層,RXPMARESETDONE拉高;到達DFELPM層,待RXDFELPMRESET從高變成低通過DFE LPM層,RXDFE LPMRESETDONE拉高;到達EYECAN層,待RXEYECANRESET從高變成低通過EYECAN層,RXEYECANRESETDONE拉高;待RXUSERRDY為高;到達PCS層;在PCS層,待RXPCSREAET從高變成低通過PCS層,則RXPCSREAETDONE拉高;到達BUF層,待RXBUFRESET從高變成低通過BUF層,RXBUFRESETDONE拉高;最后RXRESETDONE拉高;接收器復(fù)位完成。之后接收復(fù)位狀態(tài)機完成復(fù)位,輸出接收狀態(tài)機復(fù)位完成信號。復(fù)位關(guān)系和時序如圖所示:
?2,GTX發(fā)送器
? ? ? FPGA內(nèi)部每一個收發(fā)器都有一個獨立的發(fā)送端,發(fā)送端由PMA,PCS組成;由圖可以看出PMA層包括并串轉(zhuǎn)換,預(yù)加重,均衡,時鐘發(fā)生器等;PCS層包括 8B/10B編碼,數(shù)據(jù)緩沖區(qū)等。具體如圖所示:
? ? ? ?interface用戶接口:使能8B/10B,數(shù)據(jù)位寬可以為:16,32,64;不使能8B/10B,數(shù)據(jù)位寬可以為:16,20,32,40,64,80;時鐘=線速率/(8B/10B編碼后的數(shù)據(jù)位寬);
? ? ? ?8B/10B編碼:保證時鐘恢復(fù),提供數(shù)據(jù)對齊,保持良好的直流平衡;
? ? ? ?tx buffer :主要用戶消除兩個時鐘直接的相位差;也可以不用;?
? ? ? ?tx pattern generator : 通過偽隨機數(shù)來擴頻;
? ? ? ?tx polarity control : 如果P N接反,則通過配置該為矯正;
?3,GTX接收器
? ? ? ? ?接收器和發(fā)送器的數(shù)據(jù)流相反,接收器需要恢復(fù)時鐘,補償數(shù)據(jù),恢復(fù)數(shù)據(jù),串并轉(zhuǎn)換,再8B/10B解碼;最后輸出數(shù)據(jù)給用戶接口;如圖:
? ? ?DFE和LPM : 數(shù)據(jù)到達接收器后,先經(jīng)過RX均衡器,均衡器主要用于補償信號在信道傳輸過程中的高頻損失;DFE和LPM是接收器中的兩種均衡器,LPM功耗較低,DFE能提供更精準的濾波參數(shù)。
? ? ?RX,CDR : 時鐘恢復(fù)電路, 接收端需要恢復(fù)時鐘和數(shù)據(jù),主要通過這個模塊實現(xiàn)時鐘,數(shù)據(jù)恢復(fù)。
? ? ?其余模塊都與發(fā)送端類似。
4,IP配置(以XC7K325T-FFG900為例)
? ? ?(1) IP配置有兩種方式選擇。 有兩種方式: 一種完成集成與IP核,只需要列化一個模塊就能可以,但是這種種方式不太靈活,如果多通道并用,可能不好處理,還有一種核心模塊為IP,其余使用例程,參考例程設(shè)計。具體選擇可根據(jù)具體需求來實現(xiàn):(我的設(shè)計中采用了只使用核心IP,其余參考例程設(shè)計)
? ?(2)主要配置頁
? ? ? ? ? ?protocol : 協(xié)議選擇,GTX是高速串行收發(fā)器,在他的基礎(chǔ)上可以很多的協(xié)議如SDI ,10Gbase,aurora,hdmi,sata等;
? ? ? ? ? ?line rate? :線速率配置,當前芯片最大支持10.3125G;
? ? ? ? ? ?reference clock : 參考時鐘,由外部輸入,根據(jù)線速率選擇合適的參考時鐘輸入;
? ? ? ? ? ?pll selection :PLL選擇;
? ? ? ? ? ?transceiver selection:收發(fā)器選擇,一個bank有4個收發(fā)器,根據(jù)項目需求,原理設(shè)計選擇。
? ? (3)8B/10B使能,BUF配置,por選擇
? ? ? ? ?8B/10B : 根據(jù)設(shè)計選擇8B/10B是否使能,配置數(shù)據(jù)位寬為16,32,64;
? ? ? ? ?drpclk/sysclk : 系統(tǒng)時鐘輸入,復(fù)位信號等由該時鐘產(chǎn)生;可輸入0-175m時鐘;
? ? ? ? ?synchronization and clocking : 配置接收時鐘,配置時鐘源,是否使用buf;
? ? ? ? ?optional port : 可以根據(jù)需求引出相關(guān)端口,以幫助IP核配置,控制使用。
? ?(4)K碼,均衡配置
? ? ? ? ? ?rx comma detection : 接收端對齊數(shù)據(jù)選擇,可配置為2byte, 4byte 等。具體根據(jù)數(shù)據(jù)位寬決定;
? ? ? ? ? termination and equalization : 均衡器配置,可配合ibert核使用,得到最合理的參數(shù)然后配置給IP核。
? ? ? (5) 后面暫時不用管,直接下一步到最后完成配置。
? 5, 附上一個簡單GT口配置邏輯,以便今后回顧。
// ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : 3.6 // \ \ Application : 7 Series FPGAs Transceivers Wizard // / / Filename : gtwizard_0_support.v // /___/ /\ // \ \ / \ // \___\/\___\ // // // Module gtwizard_0_support // Generated by Xilinx 7 Series FPGAs Transceivers Wizard // // // (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. `timescale 1ns / 1ps module gt_wrap (input sysclk_in,input sysreset_in,input clk1_gtrefclk_n,input clk1_gtrefclk_p, input [1:0] gtxrxp_in,input [1:0] gtxrxn_in,output [1:0] gtxtxn_out,output [1:0] gtxtxp_out,output qpll_locked,output [1:0] rx_resetdone,output [1:0] tx_resetdone,output [1:0] tx_fsm_reset_done,output [1:0] rx_fsm_reset_done,output tx_clk,output rx_clk,output [7:0] rx_charisk,output [63:0] rx_data,input [7:0] tx_charisk, input [63:0] tx_data, input ctrl_loppback,output [7:0] rx_disperr,output [7:0] rx_notintable,output [5:0] rx_bufstatus );genvar i ;//qpllwire commonreset_i;wire gt0_qplllock_i;wire gt0_qpllrefclklost_i ;wire [1:0] gt0_qpllreset_i ;wire gt0_qpllreset_t ;wire gt0_qplloutclk_i ;wire gt0_qplloutrefclk_i ;//Reference Clockswire q0_clk1_refclk_i;//User Clocks wire [1:0] gt0_rxoutclk_i;wire [1:0] gt0_txoutclk_i;wire gt0_txusrclk_i; wire gt0_rxusrclk_i; wire gt0_txusrclk2_i; wire gt0_rxusrclk2_i; //**************************** Main Body of Code *******************************assign qpll_locked = gt0_qplllock_i;assign tx_clk = gt0_txusrclk2_i; assign rx_clk = gt0_rxusrclk2_i;gtwizard_0_GT_USRCLK_SOURCE gtwizard_0_GT_USRCLK_SOURCE (.GT0_TXUSRCLK_OUT (gt0_txusrclk_i),.GT0_TXUSRCLK2_OUT (gt0_txusrclk2_i ),.GT0_TXOUTCLK_IN (gt0_txoutclk_i[0]),.GT0_RXUSRCLK_OUT (gt0_rxusrclk_i),.GT0_RXUSRCLK2_OUT (gt0_rxusrclk2_i ),.GT0_RXOUTCLK_IN (gt0_rxoutclk_i[0]),.Q0_CLK1_GTREFCLK_PAD_N_IN (clk1_gtrefclk_n),.Q0_CLK1_GTREFCLK_PAD_P_IN (clk1_gtrefclk_p),.Q0_CLK1_GTREFCLK_OUT (q0_clk1_refclk_i));gtwizard_0_common #(.WRAPPER_SIM_GTRESET_SPEEDUP("TRUE"),.SIM_QPLLREFCLK_SEL(3'b010))gtwizard_0_common (.QPLLREFCLKSEL_IN(3'b010),.GTREFCLK0_IN(1'b0),.GTREFCLK1_IN(q0_clk1_refclk_i),.QPLLLOCK_OUT(gt0_qplllock_i),.QPLLLOCKDETCLK_IN(sysclk_in),.QPLLOUTCLK_OUT(gt0_qplloutclk_i),.QPLLOUTREFCLK_OUT(gt0_qplloutrefclk_i),.QPLLREFCLKLOST_OUT(gt0_qpllrefclklost_i), .QPLLRESET_IN(gt0_qpllreset_t));assign gt0_qpllreset_t = commonreset_i | >0_qpllreset_i;gtwizard_0_common_reset #(.STABLE_CLOCK_PERIOD (8) // Period of the stable clock driving this state-machine, unit is [ns])gtwizard_0_common_reset ( .STABLE_CLOCK(sysclk_in), //Stable Clock, either a stable clock from the PCB.SOFT_RESET(sysreset_in), //User Reset, can be pulled any time.COMMON_RESET(commonreset_i) //Reset QPLL); generatefor (i=0;i<2;i=i+1)begin : gt_gengtwizard_0 gtwizard_0_init_i (.sysclk_in (sysclk_in),.soft_reset_tx_in (sysreset_in),.soft_reset_rx_in (sysreset_in),.dont_reset_on_data_error_in (1'b0),.gt0_tx_fsm_reset_done_out (tx_fsm_reset_done[i]),.gt0_rx_fsm_reset_done_out (rx_fsm_reset_done[i]),.gt0_data_valid_in (1'b1),//_____________________________________________________________________//_____________________________________________________________________//GT0 (X1Y0)//-------------------------- Channel - DRP Ports --------------------------.gt0_drpaddr_in (9'd0), // input wire [8:0] gt0_drpaddr_in.gt0_drpclk_in (sysclk_in), // input wire sysclk_in_i.gt0_drpdi_in (16'd0), // input wire [15:0] gt0_drpdi_in.gt0_drpdo_out ( ), // output wire [15:0] gt0_drpdo_out.gt0_drpen_in (1'b0), // input wire gt0_drpen_in.gt0_drprdy_out ( ), // output wire gt0_drprdy_out.gt0_drpwe_in (1'b0), // input wire gt0_drpwe_in//------------------------- Digital Monitor Ports --------------------------.gt0_dmonitorout_out ( ), // output wire [7:0] gt0_dmonitorout_out//----------------------------- Loopback Ports -----------------------------.gt0_loopback_in ({2'd0,ctrl_loppback }), // input wire [2:0] gt0_loopback_in//------------------- RX Initialization and Reset Ports --------------------.gt0_eyescanreset_in (1'b0), // input wire gt0_eyescanreset_in.gt0_rxuserrdy_in (1'b0), // input wire gt0_rxuserrdy_in//------------------------ RX Margin Analysis Ports ------------------------.gt0_eyescandataerror_out ( ), // output wire gt0_eyescandataerror_out.gt0_eyescantrigger_in (1'b0), // input wire gt0_eyescantrigger_in//---------------- Receive Ports - FPGA RX Interface Ports -----------------.gt0_rxusrclk_in (gt0_rxusrclk_i), // input wire gt0_rxusrclk_i.gt0_rxusrclk2_in (gt0_rxusrclk_i), // input wire gt0_rxusrclk2_i//---------------- Receive Ports - FPGA RX interface Ports -----------------.gt0_rxdata_out (rx_data[32*i+:32]), // output wire [31:0] gt0_rxdata_out//---------------- Receive Ports - RX 8B/10B Decoder Ports -----------------.gt0_rxdisperr_out (rx_disperr[4*i+:4]), // output wire [3:0] gt0_rxdisperr_out.gt0_rxnotintable_out (rx_notintable[4*i+:4]), // output wire [3:0] gt0_rxnotintable_out//------------------------- Receive Ports - RX AFE -------------------------.gt0_gtxrxp_in (gtxrxp_in[i]), // input wire gt0_gtxrxp_in//---------------------- Receive Ports - RX AFE Ports ----------------------.gt0_gtxrxn_in (gtxrxn_in[i]), // input wire gt0_gtxrxn_in//----------------- Receive Ports - RX Buffer Bypass Ports -----------------.gt0_rxbufstatus_out (rx_bufstatus[3*i+:3]), // output wire [2:0] gt0_rxbufstatus_out//------------------- Receive Ports - RX Equalizer Ports -------------------.gt0_rxdfelpmreset_in (1'b0), // input wire gt0_rxdfelpmreset_in.gt0_rxmonitorout_out ( ), // output wire [6:0] gt0_rxmonitorout_out.gt0_rxmonitorsel_in (1'b0), // input wire [1:0] gt0_rxmonitorsel_in//------------- Receive Ports - RX Fabric Output Control Ports -------------.gt0_rxoutclk_out (gt0_rxoutclk_i[i]), // output wire gt0_rxoutclk_i.gt0_rxoutclkfabric_out ( ), // output wire gt0_rxoutclkfabric_out//----------- Receive Ports - RX Initialization and Reset Ports ------------.gt0_gtrxreset_in (1'b0), // input wire gt0_gtrxreset_in.gt0_rxpmareset_in (1'b0), // input wire gt0_rxpmareset_in//----------------- Receive Ports - RX8B/10B Decoder Ports -----------------.gt0_rxcharisk_out (rx_charisk[4*i+:4]), // output wire [3:0] gt0_rxcharisk_out//------------ Receive Ports -RX Initialization and Reset Ports ------------.gt0_rxresetdone_out (rx_resetdone[i]), // output wire gt0_rxresetdone_out//------------------- TX Initialization and Reset Ports --------------------.gt0_gttxreset_in (1'b0), // input wire gt0_gttxreset_in.gt0_txuserrdy_in (1'b0), // input wire gt0_txuserrdy_in//---------------- Transmit Ports - FPGA TX Interface Ports ----------------.gt0_txusrclk_in (gt0_txusrclk_i), // input wire gt0_txusrclk_i.gt0_txusrclk2_in (gt0_txusrclk_i), // input wire gt0_txusrclk2_i//---------------- Transmit Ports - TX Data Path interface -----------------.gt0_txdata_in (tx_data[32*i+:32]), // input wire [31:0] gt0_txdata_in//-------------- Transmit Ports - TX Driver and OOB signaling --------------.gt0_gtxtxn_out (gtxtxn_out[i]), // output wire gt0_gtxtxn_out.gt0_gtxtxp_out (gtxtxp_out[i]), // output wire gt0_gtxtxp_out//--------- Transmit Ports - TX Fabric Clock Output Control Ports ----------.gt0_txoutclk_out (gt0_txoutclk_i[i]), // output wire gt0_txoutclk_i.gt0_txoutclkfabric_out ( ), // output wire gt0_txoutclkfabric_out.gt0_txoutclkpcs_out ( ), // output wire gt0_txoutclkpcs_out//------------------- Transmit Ports - TX Gearbox Ports --------------------.gt0_txcharisk_in (tx_charisk[4*i+:4]), // input wire [3:0] gt0_txcharisk_in//----------- Transmit Ports - TX Initialization and Reset Ports -----------.gt0_txresetdone_out (tx_resetdone[i]), // output wire gt0_txresetdone_out.gt0_qplllock_in(gt0_qplllock_i),.gt0_qpllrefclklost_in(gt0_qpllrefclklost_i),.gt0_qpllreset_out(gt0_qpllreset_i[i]),.gt0_qplloutclk_in(gt0_qplloutclk_i),.gt0_qplloutrefclk_in(gt0_qplloutrefclk_i));end endgenerateendmodule相關(guān)問題記錄:
1,GTX時鐘專用buf原語? ?:
IBUFDS_GTE2 ?IBUFDS_GTE2_inst (
? ? ? ? .O(gtx_clk_out),
? ? ? ? .ODIV2(),?
? ? ? ? .I(gtx_clk_in_p),
? ? ? ? .CEB(1'b0),?
? ? ? ? .IB(gtx_clk_in_n)
? ? ?);
2 ,光口接收時鐘源配置一般有兩種,使用RXOUTCLK,也可用RXOUTCLK;如果速率較高建議選擇RXOUTCLK,保證數(shù)據(jù)和時鐘同步,能更有效的保證數(shù)據(jù)采集。
?
3,data_valid_in端口外部配置1,改信號主要影響接收復(fù)位狀態(tài)機。
?
4,?gtx數(shù)據(jù)接口為isk和dat;isk和dat按字節(jié)對應(yīng)。
?
?
總結(jié)
以上是生活随笔為你收集整理的六,基于FPGA的高速串行通信GTX知识梳理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js计算5的倍数和
- 下一篇: Kafka集群的安全认证机构 SASL_