Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gtxe2_gpl
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
gtxe2_gpl
Commits
886f1771
Commit
886f1771
authored
Jul 03, 2015
by
Alexey Grebenkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial v0.1 files
parent
10d25413
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
4207 additions
and
0 deletions
+4207
-0
GTXE2_CHANNEL.v
gtxe2_channel/GTXE2_CHANNEL.v
+752
-0
clock_divider.v
gtxe2_channel/clock_divider.v
+41
-0
gtxe2_chnl.v
gtxe2_channel/gtxe2_chnl.v
+310
-0
gtxe2_chnl_clocking.v
gtxe2_channel/gtxe2_chnl_clocking.v
+257
-0
gtxe2_chnl_cpll.v
gtxe2_channel/gtxe2_chnl_cpll.v
+122
-0
gtxe2_chnl_cpll_def.v
gtxe2_channel/gtxe2_chnl_cpll_def.v
+1
-0
gtxe2_chnl_cpll_inmux.v
gtxe2_channel/gtxe2_chnl_cpll_inmux.v
+24
-0
gtxe2_chnl_outclk_mux.v
gtxe2_channel/gtxe2_chnl_outclk_mux.v
+16
-0
gtxe2_chnl_rx.v
gtxe2_channel/gtxe2_chnl_rx.v
+168
-0
gtxe2_chnl_rx_10x8dec.v
gtxe2_channel/gtxe2_chnl_rx_10x8dec.v
+192
-0
gtxe2_chnl_rx_align.v
gtxe2_channel/gtxe2_chnl_rx_align.v
+117
-0
gtxe2_chnl_rx_des.v
gtxe2_channel/gtxe2_chnl_rx_des.v
+67
-0
gtxe2_chnl_rx_oob.v
gtxe2_channel/gtxe2_chnl_rx_oob.v
+114
-0
gtxe2_chnl_tx.v
gtxe2_channel/gtxe2_chnl_tx.v
+178
-0
gtxe2_chnl_tx_8x10enc.v
gtxe2_channel/gtxe2_chnl_tx_8x10enc.v
+98
-0
gtxe2_chnl_tx_oob.v
gtxe2_channel/gtxe2_chnl_tx_oob.v
+100
-0
gtxe2_chnl_tx_ser.v
gtxe2_channel/gtxe2_chnl_tx_ser.v
+51
-0
resync_fifo_nonsynt.v
gtxe2_channel/resync_fifo_nonsynt.v
+61
-0
gtxe2_comm_clocking.v
gtxe2_common/gtxe2_comm_clocking.v
+72
-0
gtxe2_comm_qpll.v
gtxe2_common/gtxe2_comm_qpll.v
+110
-0
gtxe2_comm_qpll_def.v
gtxe2_common/gtxe2_comm_qpll_def.v
+1
-0
gtxe2_comm_qpll_inmux.v
gtxe2_common/gtxe2_comm_qpll_inmux.v
+24
-0
tb.v
tb/tb.v
+981
-0
test.v
tb/test.v
+350
-0
No files found.
gtxe2_channel/GTXE2_CHANNEL.v
0 → 100644
View file @
886f1771
`include
"gtxe2_chnl.v"
module
GTXE2_CHANNEL
(
//------------------------------- CPLL Ports -------------------------------
output
CPLLFBCLKLOST
,
//(cpllfbclklost_out),
output
CPLLLOCK
,
//(cplllock_out),
input
CPLLLOCKDETCLK
,
//(cplllockdetclk_in),
input
CPLLLOCKEN
,
//(tied_to_vcc_i),
input
CPLLPD
,
//(cpll_pd_i),
output
CPLLREFCLKLOST
,
//(cpllrefclklost_out),
input
[
2
:
0
]
CPLLREFCLKSEL
,
//(3'b001),
input
CPLLRESET
,
//(cpll_reset_i),
input
[
15
:
0
]
GTRSVD
,
//(16'b0000000000000000),
input
[
15
:
0
]
PCSRSVDIN
,
//(16'b0000000000000000),
input
[
4
:
0
]
PCSRSVDIN2
,
//(5'b00000),
input
[
4
:
0
]
PMARSVDIN
,
//(5'b00000),
input
[
4
:
0
]
PMARSVDIN2
,
//(5'b00000),
input
[
19
:
0
]
TSTIN
,
//(20'b11111111111111111111),
output
[
9
:
0
]
TSTOUT
,
//(),
//-------------------------------- Channel ---------------------------------
input
[
3
:
0
]
CLKRSVD
,
//(4'b0000),
//------------------------ Channel - Clocking Ports ------------------------
input
GTGREFCLK
,
//(tied_to_ground_i),
input
GTNORTHREFCLK0
,
//(tied_to_ground_i),
input
GTNORTHREFCLK1
,
//(tied_to_ground_i),
input
GTREFCLK0
,
//(gtrefclk0_in),
input
GTREFCLK1
,
//(tied_to_ground_i),
input
GTSOUTHREFCLK0
,
//(tied_to_ground_i),
input
GTSOUTHREFCLK1
,
//(tied_to_ground_i),
//-------------------------- Channel - DRP Ports --------------------------
input
[
8
:
0
]
DRPADDR
,
//(drpaddr_in),
input
DRPCLK
,
//(drpclk_in),
input
[
15
:
0
]
DRPDI
,
//(drpdi_in),
output
[
15
:
0
]
DRPDO
,
//(drpdo_out),
input
DRPEN
,
//(drpen_in),
output
DRPRDY
,
//(drprdy_out),
input
DRPWE
,
//(drpwe_in),
//----------------------------- Clocking Ports -----------------------------
output
GTREFCLKMONITOR
,
//(),
input
QPLLCLK
,
//(qpllclk_in),
input
QPLLREFCLK
,
//(qpllrefclk_in),
input
[
1
:
0
]
RXSYSCLKSEL
,
//(2'b00),
input
[
1
:
0
]
TXSYSCLKSEL
,
//(2'b00),
//------------------------- Digital Monitor Ports --------------------------
output
[
7
:
0
]
DMONITOROUT
,
//(dmonitorout_out),
//--------------- FPGA TX Interface Datapath Configuration ----------------
input
TX8B10BEN
,
//(tied_to_vcc_i),
//----------------------------- Loopback Ports -----------------------------
input
[
2
:
0
]
LOOPBACK
,
//(tied_to_ground_vec_i[2:0]),
//--------------------------- PCI Express Ports ----------------------------
output
PHYSTATUS
,
//(),
input
[
2
:
0
]
RXRATE
,
//(tied_to_ground_vec_i[2:0]),
output
RXVALID
,
//(),
//---------------------------- Power-Down Ports ----------------------------
input
[
1
:
0
]
RXPD
,
//(2'b00),
input
[
1
:
0
]
TXPD
,
//(2'b00),
//------------------------ RX 8B/10B Decoder Ports -------------------------
input
SETERRSTATUS
,
//(tied_to_ground_i),
//------------------- RX Initialization and Reset Ports --------------------
input
EYESCANRESET
,
//(eyescanreset_in),
input
RXUSERRDY
,
//(rxuserrdy_in),
//------------------------ RX Margin Analysis Ports ------------------------
output
EYESCANDATAERROR
,
//(eyescandataerror_out),
input
EYESCANMODE
,
//(tied_to_ground_i),
input
EYESCANTRIGGER
,
//(eyescantrigger_in),
//----------------------- Receive Ports - CDR Ports ------------------------
input
RXCDRFREQRESET
,
//(tied_to_ground_i),
input
RXCDRHOLD
,
//(tied_to_ground_i),
output
RXCDRLOCK
,
//(),
input
RXCDROVRDEN
,
//(tied_to_ground_i),
input
RXCDRRESET
,
//(tied_to_ground_i),
input
RXCDRRESETRSV
,
//(tied_to_ground_i),
//----------------- Receive Ports - Clock Correction Ports -----------------
output
[
1
:
0
]
RXCLKCORCNT
,
//(),
//-------- Receive Ports - FPGA RX Interface Datapath Configuration --------
input
RX8B10BEN
,
//(tied_to_vcc_i),
//---------------- Receive Ports - FPGA RX Interface Ports -----------------
input
RXUSRCLK
,
//(rxusrclk_in),
input
RXUSRCLK2
,
//(rxusrclk2_in),
//---------------- Receive Ports - FPGA RX interface Ports -----------------
output
[
63
:
0
]
RXDATA
,
//(rxdata_i),
//----------------- Receive Ports - Pattern Checker Ports ------------------
output
RXPRBSERR
,
//(),
input
[
2
:
0
]
RXPRBSSEL
,
//(tied_to_ground_vec_i[2:0]),
//----------------- Receive Ports - Pattern Checker ports ------------------
input
RXPRBSCNTRESET
,
//(tied_to_ground_i),
//------------------ Receive Ports - RX Equalizer Ports -------------------
input
RXDFEXYDEN
,
//(tied_to_vcc_i),
input
RXDFEXYDHOLD
,
//(tied_to_ground_i),
input
RXDFEXYDOVRDEN
,
//(tied_to_ground_i),
//---------------- Receive Ports - RX 8B/10B Decoder Ports -----------------
output
[
7
:
0
]
RXDISPERR
,
//({rxdisperr_float_i,rxdisperr_out}),
output
[
7
:
0
]
RXNOTINTABLE
,
//({rxnotintable_float_i,rxnotintable_out}),
//------------------------- Receive Ports - RX AFE -------------------------
input
GTXRXP
,
//(gtxrxp_in),
//---------------------- Receive Ports - RX AFE Ports ----------------------
input
GTXRXN
,
//(gtxrxn_in),
//----------------- Receive Ports - RX Buffer Bypass Ports -----------------
input
RXBUFRESET
,
//(tied_to_ground_i),
output
[
2
:
0
]
RXBUFSTATUS
,
//(),
input
RXDDIEN
,
//(tied_to_ground_i),
input
RXDLYBYPASS
,
//(tied_to_vcc_i),
input
RXDLYEN
,
//(tied_to_ground_i),
input
RXDLYOVRDEN
,
//(tied_to_ground_i),
input
RXDLYSRESET
,
//(tied_to_ground_i),
output
RXDLYSRESETDONE
,
//(),
input
RXPHALIGN
,
//(tied_to_ground_i),
output
RXPHALIGNDONE
,
//(),
input
RXPHALIGNEN
,
//(tied_to_ground_i),
input
RXPHDLYPD
,
//(tied_to_ground_i),
input
RXPHDLYRESET
,
//(tied_to_ground_i),
output
[
4
:
0
]
RXPHMONITOR
,
//(),
input
RXPHOVRDEN
,
//(tied_to_ground_i),
output
[
4
:
0
]
RXPHSLIPMONITOR
,
//(),
output
[
2
:
0
]
RXSTATUS
,
//(rxstatus_out),
//------------ Receive Ports - RX Byte and Word Alignment Ports ------------
output
RXBYTEISALIGNED
,
//(rxbyteisaligned_out),
output
RXBYTEREALIGN
,
//(),
output
RXCOMMADET
,
//(),
input
RXCOMMADETEN
,
//(tied_to_vcc_i),
input
RXMCOMMAALIGNEN
,
//(tied_to_vcc_i),
input
RXPCOMMAALIGNEN
,
//(tied_to_vcc_i),
//---------------- Receive Ports - RX Channel Bonding Ports ----------------
output
RXCHANBONDSEQ
,
//(),
input
RXCHBONDEN
,
//(tied_to_ground_i),
input
[
2
:
0
]
RXCHBONDLEVEL
,
//(tied_to_ground_vec_i[2:0]),
input
RXCHBONDMASTER
,
//(tied_to_ground_i),
output
[
4
:
0
]
RXCHBONDO
,
//(),
input
RXCHBONDSLAVE
,
//(tied_to_ground_i),
//--------------- Receive Ports - RX Channel Bonding Ports ----------------
output
RXCHANISALIGNED
,
//(),
output
RXCHANREALIGN
,
//(),
//------------------ Receive Ports - RX Equailizer Ports -------------------
input
RXLPMHFHOLD
,
//(tied_to_ground_i),
input
RXLPMHFOVRDEN
,
//(tied_to_ground_i),
input
RXLPMLFHOLD
,
//(tied_to_ground_i),
//------------------- Receive Ports - RX Equalizer Ports -------------------
input
RXDFEAGCHOLD
,
//(rxdfeagchold_in),
input
RXDFEAGCOVRDEN
,
//(tied_to_ground_i),
input
RXDFECM1EN
,
//(tied_to_ground_i),
input
RXDFELFHOLD
,
//(rxdfelfhold_in),
input
RXDFELFOVRDEN
,
//(tied_to_vcc_i),
input
RXDFELPMRESET
,
//(rxdfelpmreset_in),
input
RXDFETAP2HOLD
,
//(tied_to_ground_i),
input
RXDFETAP2OVRDEN
,
//(tied_to_ground_i),
input
RXDFETAP3HOLD
,
//(tied_to_ground_i),
input
RXDFETAP3OVRDEN
,
//(tied_to_ground_i),
input
RXDFETAP4HOLD
,
//(tied_to_ground_i),
input
RXDFETAP4OVRDEN
,
//(tied_to_ground_i),
input
RXDFETAP5HOLD
,
//(tied_to_ground_i),
input
RXDFETAP5OVRDEN
,
//(tied_to_ground_i),
input
RXDFEUTHOLD
,
//(tied_to_ground_i),
input
RXDFEUTOVRDEN
,
//(tied_to_ground_i),
input
RXDFEVPHOLD
,
//(tied_to_ground_i),
input
RXDFEVPOVRDEN
,
//(tied_to_ground_i),
input
RXDFEVSEN
,
//(tied_to_ground_i),
input
RXLPMLFKLOVRDEN
,
//(tied_to_ground_i),
output
[
6
:
0
]
RXMONITOROUT
,
//(rxmonitorout_out),
input
[
1
:
0
]
RXMONITORSEL
,
//(rxmonitorsel_in),
input
RXOSHOLD
,
//(tied_to_ground_i),
input
RXOSOVRDEN
,
//(tied_to_ground_i),
//---------- Receive Ports - RX Fabric ClocK Output Control Ports ----------
output
RXRATEDONE
,
//(),
//------------- Receive Ports - RX Fabric Output Control Ports -------------
output
RXOUTCLK
,
//(rxoutclk_out),
output
RXOUTCLKFABRIC
,
//(),
output
RXOUTCLKPCS
,
//(),
input
[
2
:
0
]
RXOUTCLKSEL
,
//(3'b010),
//-------------------- Receive Ports - RX Gearbox Ports --------------------
output
RXDATAVALID
,
//(),
output
[
2
:
0
]
RXHEADER
,
//(),
output
RXHEADERVALID
,
//(),
output
RXSTARTOFSEQ
,
//(),
//------------------- Receive Ports - RX Gearbox Ports --------------------
input
RXGEARBOXSLIP
,
//(tied_to_ground_i),
//----------- Receive Ports - RX Initialization and Reset Ports ------------
input
GTRXRESET
,
//(gtrxreset_in),
input
RXOOBRESET
,
//(tied_to_ground_i),
input
RXPCSRESET
,
//(tied_to_ground_i),
input
RXPMARESET
,
//(rxpmareset_in),
//---------------- Receive Ports - RX Margin Analysis ports ----------------
input
RXLPMEN
,
//(tied_to_ground_i),
//----------------- Receive Ports - RX OOB Signaling ports -----------------
output
RXCOMSASDET
,
//(),
output
RXCOMWAKEDET
,
//(rxcomwakedet_out),
//---------------- Receive Ports - RX OOB Signaling ports -----------------
output
RXCOMINITDET
,
//(rxcominitdet_out),
//---------------- Receive Ports - RX OOB signalling Ports -----------------
output
RXELECIDLE
,
//(rxelecidle_out),
input
[
1
:
0
]
RXELECIDLEMODE
,
//(2'b00),
//--------------- Receive Ports - RX Polarity Control Ports ----------------
input
RXPOLARITY
,
//(tied_to_ground_i),
//-------------------- Receive Ports - RX gearbox ports --------------------
input
RXSLIDE
,
//(tied_to_ground_i),
//----------------- Receive Ports - RX8B/10B Decoder Ports -----------------
output
[
7
:
0
]
RXCHARISCOMMA
,
//(),
output
[
7
:
0
]
RXCHARISK
,
//({rxcharisk_float_i,rxcharisk_out}),
//---------------- Receive Ports - Rx Channel Bonding Ports ----------------
input
[
4
:
0
]
RXCHBONDI
,
//(5'b00000),
//------------ Receive Ports -RX Initialization and Reset Ports ------------
output
RXRESETDONE
,
//(rxresetdone_out),
//------------------------------ Rx AFE Ports ------------------------------
input
RXQPIEN
,
//(tied_to_ground_i),
output
RXQPISENN
,
//(),
output
RXQPISENP
,
//(),
//------------------------- TX Buffer Bypass Ports -------------------------
input
TXPHDLYTSTCLK
,
//(tied_to_ground_i),
//---------------------- TX Configurable Driver Ports ----------------------
input
[
4
:
0
]
TXPOSTCURSOR
,
//(5'b00000),
input
TXPOSTCURSORINV
,
//(tied_to_ground_i),
input
[
4
:
0
]
TXPRECURSOR
,
//(tied_to_ground_vec_i[4:0]),
input
TXPRECURSORINV
,
//(tied_to_ground_i),
input
TXQPIBIASEN
,
//(tied_to_ground_i),
input
TXQPISTRONGPDOWN
,
//(tied_to_ground_i),
input
TXQPIWEAKPUP
,
//(tied_to_ground_i),
//------------------- TX Initialization and Reset Ports --------------------
input
CFGRESET
,
//(tied_to_ground_i),
input
GTTXRESET
,
//(gttxreset_in),
output
[
15
:
0
]
PCSRSVDOUT
,
//(),
input
TXUSERRDY
,
//(txuserrdy_in),
//-------------------- Transceiver Reset Mode Operation --------------------
input
GTRESETSEL
,
//(tied_to_ground_i),
input
RESETOVRD
,
//(tied_to_ground_i),
//-------------- Transmit Ports - 8b10b Encoder Control Ports --------------
input
[
7
:
0
]
TXCHARDISPMODE
,
//(tied_to_ground_vec_i[7:0]),
input
[
7
:
0
]
TXCHARDISPVAL
,
//(tied_to_ground_vec_i[7:0]),
//---------------- Transmit Ports - FPGA TX Interface Ports ----------------
input
TXUSRCLK
,
//(txusrclk_in),
input
TXUSRCLK2
,
//(txusrclk2_in),
//------------------- Transmit Ports - PCI Express Ports -------------------
input
TXELECIDLE
,
//(txelecidle_in),
input
[
2
:
0
]
TXMARGIN
,
//(tied_to_ground_vec_i[2:0]),
input
[
2
:
0
]
TXRATE
,
//(tied_to_ground_vec_i[2:0]),
input
TXSWING
,
//(tied_to_ground_i),
//---------------- Transmit Ports - Pattern Generator Ports ----------------
input
TXPRBSFORCEERR
,
//(tied_to_ground_i),
//---------------- Transmit Ports - TX Buffer Bypass Ports -----------------
input
TXDLYBYPASS
,
//(tied_to_vcc_i),
input
TXDLYEN
,
//(tied_to_ground_i),
input
TXDLYHOLD
,
//(tied_to_ground_i),
input
TXDLYOVRDEN
,
//(tied_to_ground_i),
input
TXDLYSRESET
,
//(tied_to_ground_i),
output
TXDLYSRESETDONE
,
//(),
input
TXDLYUPDOWN
,
//(tied_to_ground_i),
input
TXPHALIGN
,
//(tied_to_ground_i),
output
TXPHALIGNDONE
,
//(),
input
TXPHALIGNEN
,
//(tied_to_ground_i),
input
TXPHDLYPD
,
//(tied_to_ground_i),
input
TXPHDLYRESET
,
//(tied_to_ground_i),
input
TXPHINIT
,
//(tied_to_ground_i),
output
TXPHINITDONE
,
//(),
input
TXPHOVRDEN
,
//(tied_to_ground_i),
//-------------------- Transmit Ports - TX Buffer Ports --------------------
output
[
1
:
0
]
TXBUFSTATUS
,
//(),
//------------- Transmit Ports - TX Configurable Driver Ports --------------
input
[
2
:
0
]
TXBUFDIFFCTRL
,
//(3'b100),
input
TXDEEMPH
,
//(tied_to_ground_i),
input
[
3
:
0
]
TXDIFFCTRL
,
//(4'b1000),
input
TXDIFFPD
,
//(tied_to_ground_i),
input
TXINHIBIT
,
//(tied_to_ground_i),
input
[
6
:
0
]
TXMAINCURSOR
,
//(7'b0000000),
input
TXPISOPD
,
//(tied_to_ground_i),
//---------------- Transmit Ports - TX Data Path interface -----------------
input
[
63
:
0
]
TXDATA
,
//(txdata_i),
//-------------- Transmit Ports - TX Driver and OOB signaling --------------
output
GTXTXN
,
//(gtxtxn_out),
output
GTXTXP
,
//(gtxtxp_out),
//--------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
output
TXOUTCLK
,
//(txoutclk_out),
output
TXOUTCLKFABRIC
,
//(txoutclkfabric_out),
output
TXOUTCLKPCS
,
//(txoutclkpcs_out),
input
[
2
:
0
]
TXOUTCLKSEL
,
//(3'b010),
output
TXRATEDONE
,
//(),
//------------------- Transmit Ports - TX Gearbox Ports --------------------
input
[
7
:
0
]
TXCHARISK
,
//({tied_to_ground_vec_i[5:0],txcharisk_in}),
output
TXGEARBOXREADY
,
//(),
input
[
2
:
0
]
TXHEADER
,
//(tied_to_ground_vec_i[2:0]),
input
[
6
:
0
]
TXSEQUENCE
,
//(tied_to_ground_vec_i[6:0]),
input
TXSTARTSEQ
,
//(tied_to_ground_i),
//----------- Transmit Ports - TX Initialization and Reset Ports -----------
input
TXPCSRESET
,
//(tied_to_ground_i),
input
TXPMARESET
,
//(tied_to_ground_i),
output
TXRESETDONE
,
//(txresetdone_out),
//---------------- Transmit Ports - TX OOB signalling Ports ----------------
output
TXCOMFINISH
,
//(txcomfinish_out),
input
TXCOMINIT
,
//(tied_to_ground_i),
input
TXCOMSAS
,
//(tied_to_ground_i),
input
TXCOMWAKE
,
//(txcomwake_in),
input
TXPDELECIDLEMODE
,
//(tied_to_ground_i),
//--------------- Transmit Ports - TX Polarity Control Ports ---------------
input
TXPOLARITY
,
//(tied_to_ground_i),
//------------- Transmit Ports - TX Receiver Detection Ports --------------
input
TXDETECTRX
,
//(tied_to_ground_i),
//---------------- Transmit Ports - TX8b/10b Encoder Ports -----------------
input
[
7
:
0
]
TX8B10BBYPASS
,
//(tied_to_ground_vec_i[7:0]),
//---------------- Transmit Ports - pattern Generator Ports ----------------
input
[
2
:
0
]
TXPRBSSEL
,
//(tied_to_ground_vec_i[2:0]),
//--------------------- Tx Configurable Driver Ports ----------------------
output
TXQPISENN
,
//(),
output
TXQPISENP
//()
)
;
//_______________________ Simulation-Only Attributes __________________
parameter
SIM_RECEIVER_DETECT_PASS
=
"TRUE"
;
parameter
SIM_TX_EIDLE_DRIVE_LEVEL
=
"X"
;
parameter
SIM_RESET_SPEEDUP
=
"FALSE"
;
parameter
SIM_CPLLREFCLK_SEL
=
3'b001
;
parameter
SIM_VERSION
=
"4.0"
;
//----------------RX Byte and Word Alignment Attributes---------------
parameter
ALIGN_COMMA_DOUBLE
=
"FALSE"
;
parameter
ALIGN_COMMA_ENABLE
=
10'b1111111111
;
parameter
ALIGN_COMMA_WORD
=
1
;
parameter
ALIGN_MCOMMA_DET
=
"TRUE"
;
parameter
ALIGN_MCOMMA_VALUE
=
10'b1010000011
;
parameter
ALIGN_PCOMMA_DET
=
"TRUE"
;
parameter
ALIGN_PCOMMA_VALUE
=
10'b0101111100
;
parameter
SHOW_REALIGN_COMMA
=
"TRUE"
;
parameter
RXSLIDE_AUTO_WAIT
=
7
;
parameter
RXSLIDE_MODE
=
"OFF"
;
parameter
RX_SIG_VALID_DLY
=
10
;
//----------------RX 8B/10B Decoder Attributes---------------
parameter
RX_DISPERR_SEQ_MATCH
=
"TRUE"
;
parameter
DEC_MCOMMA_DETECT
=
"TRUE"
;
parameter
DEC_PCOMMA_DETECT
=
"TRUE"
;
parameter
DEC_VALID_COMMA_ONLY
=
"FALSE"
;
//----------------------RX Clock Correction Attributes----------------------
parameter
CBCC_DATA_SOURCE_SEL
=
"DECODED"
;
parameter
CLK_COR_SEQ_2_USE
=
"FALSE"
;
parameter
CLK_COR_KEEP_IDLE
=
"FALSE"
;
parameter
CLK_COR_MAX_LAT
=
9
;
parameter
CLK_COR_MIN_LAT
=
7
;
parameter
CLK_COR_PRECEDENCE
=
"TRUE"
;
parameter
CLK_COR_REPEAT_WAIT
=
0
;
parameter
CLK_COR_SEQ_LEN
=
1
;
parameter
CLK_COR_SEQ_1_ENABLE
=
4'b1111
;
parameter
CLK_COR_SEQ_1_1
=
10'b0100000000
;
parameter
CLK_COR_SEQ_1_2
=
10'b0000000000
;
parameter
CLK_COR_SEQ_1_3
=
10'b0000000000
;
parameter
CLK_COR_SEQ_1_4
=
10'b0000000000
;
parameter
CLK_CORRECT_USE
=
"FALSE"
;
parameter
CLK_COR_SEQ_2_ENABLE
=
4'b1111
;
parameter
CLK_COR_SEQ_2_1
=
10'b0100000000
;
parameter
CLK_COR_SEQ_2_2
=
10'b0000000000
;
parameter
CLK_COR_SEQ_2_3
=
10'b0000000000
;
parameter
CLK_COR_SEQ_2_4
=
10'b0000000000
;
//----------------------RX Channel Bonding Attributes----------------------
parameter
CHAN_BOND_KEEP_ALIGN
=
"FALSE"
;
parameter
CHAN_BOND_MAX_SKEW
=
1
;
parameter
CHAN_BOND_SEQ_LEN
=
1
;
parameter
CHAN_BOND_SEQ_1_1
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_1_2
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_1_3
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_1_4
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_1_ENABLE
=
4'b1111
;
parameter
CHAN_BOND_SEQ_2_1
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_2_2
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_2_3
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_2_4
=
10'b0000000000
;
parameter
CHAN_BOND_SEQ_2_ENABLE
=
4'b1111
;
parameter
CHAN_BOND_SEQ_2_USE
=
"FALSE"
;
parameter
FTS_DESKEW_SEQ_ENABLE
=
4'b1111
;
parameter
FTS_LANE_DESKEW_CFG
=
4'b1111
;
parameter
FTS_LANE_DESKEW_EN
=
"FALSE"
;
//-------------------------RX Margin Analysis Attributes----------------------------
parameter
ES_CONTROL
=
6'b000000
;
parameter
ES_ERRDET_EN
=
"FALSE"
;
parameter
ES_EYE_SCAN_EN
=
"TRUE"
;
parameter
ES_HORZ_OFFSET
=
12'h000
;
parameter
ES_PMA_CFG
=
10'b0000000000
;
parameter
ES_PRESCALE
=
5'b00000
;
parameter
ES_QUALIFIER
=
80'h00000000000000000000
;
parameter
ES_QUAL_MASK
=
80'h00000000000000000000
;
parameter
ES_SDATA_MASK
=
80'h00000000000000000000
;
parameter
ES_VERT_OFFSET
=
9'b000000000
;
//-----------------------FPGA RX Interface Attributes-------------------------
parameter
RX_DATA_WIDTH
=
20
;
//-------------------------PMA Attributes----------------------------
parameter
OUTREFCLK_SEL_INV
=
2'b11
;
parameter
PMA_RSV
=
32'h00018480
;
parameter
PMA_RSV2
=
16'h2050
;
parameter
PMA_RSV3
=
2'b00
;
parameter
PMA_RSV4
=
32'h00000000
;
parameter
RX_BIAS_CFG
=
12'b000000000100
;
parameter
DMONITOR_CFG
=
24'h000A00
;
parameter
RX_CM_SEL
=
2'b11
;
parameter
RX_CM_TRIM
=
3'b010
;
parameter
RX_DEBUG_CFG
=
12'b000000000000
;
parameter
RX_OS_CFG
=
13'b0000010000000
;
parameter
TERM_RCAL_CFG
=
5'b10000
;
parameter
TERM_RCAL_OVRD
=
1'b0
;
parameter
TST_RSV
=
32'h00000000
;
parameter
RX_CLK25_DIV
=
6
;
parameter
TX_CLK25_DIV
=
6
;
parameter
UCODEER_CLR
=
1'b0
;
//-------------------------PCI Express Attributes----------------------------
parameter
PCS_PCIE_EN
=
"FALSE"
;
//-------------------------PCS Attributes----------------------------
parameter
PCS_RSVD_ATTR
=
48'h0100
;
//-----------RX Buffer Attributes------------
parameter
RXBUF_ADDR_MODE
=
"FAST"
;
parameter
RXBUF_EIDLE_HI_CNT
=
4'b1000
;
parameter
RXBUF_EIDLE_LO_CNT
=
4'b0000
;
parameter
RXBUF_EN
=
"TRUE"
;
parameter
RX_BUFFER_CFG
=
6'b000000
;
parameter
RXBUF_RESET_ON_CB_CHANGE
=
"TRUE"
;
parameter
RXBUF_RESET_ON_COMMAALIGN
=
"FALSE"
;
parameter
RXBUF_RESET_ON_EIDLE
=
"FALSE"
;
parameter
RXBUF_RESET_ON_RATE_CHANGE
=
"TRUE"
;
parameter
RXBUFRESET_TIME
=
5'b00001
;
parameter
RXBUF_THRESH_OVFLW
=
61
;
parameter
RXBUF_THRESH_OVRD
=
"FALSE"
;
parameter
RXBUF_THRESH_UNDFLW
=
4
;
parameter
RXDLY_CFG
=
16'h001F
;
parameter
RXDLY_LCFG
=
9'h030
;
parameter
RXDLY_TAP_CFG
=
16'h0000
;
parameter
RXPH_CFG
=
24'h000000
;
parameter
RXPHDLY_CFG
=
24'h084020
;
parameter
RXPH_MONITOR_SEL
=
5'b00000
;
parameter
RX_XCLK_SEL
=
"RXREC"
;
parameter
RX_DDI_SEL
=
6'b000000
;
parameter
RX_DEFER_RESET_BUF_EN
=
"TRUE"
;
//---------------------CDR Attributes-------------------------
//For Display Port, HBR/RBR- set RXCDR_CFG=72'h0380008bff40200008
//For Display Port, HBR2 - set RXCDR_CFG=72'h038c008bff20200010
//For SATA Gen1 GTX- set RXCDR_CFG=72'h03_8000_8BFF_4010_0008
//For SATA Gen2 GTX- set RXCDR_CFG=72'h03_8800_8BFF_4020_0008
//For SATA Gen3 GTX- set RXCDR_CFG=72'h03_8000_8BFF_1020_0010
//For SATA Gen3 GTP- set RXCDR_CFG=83'h0_0000_87FE_2060_2444_1010
//For SATA Gen2 GTP- set RXCDR_CFG=83'h0_0000_47FE_2060_2448_1010
//For SATA Gen1 GTP- set RXCDR_CFG=83'h0_0000_47FE_1060_2448_1010
parameter
RXCDR_CFG
=
72'h03000023ff10200020
;
parameter
RXCDR_FR_RESET_ON_EIDLE
=
1'b0
;
parameter
RXCDR_HOLD_DURING_EIDLE
=
1'b0
;
parameter
RXCDR_PH_RESET_ON_EIDLE
=
1'b0
;
parameter
RXCDR_LOCK_CFG
=
6'b010101
;
//-----------------RX Initialization and Reset Attributes-------------------
parameter
RXCDRFREQRESET_TIME
=
5'b00001
;
parameter
RXCDRPHRESET_TIME
=
5'b00001
;
parameter
RXISCANRESET_TIME
=
5'b00001
;
parameter
RXPCSRESET_TIME
=
5'b00001
;
parameter
RXPMARESET_TIME
=
5'b00011
;
//-----------------RX OOB Signaling Attributes-------------------
parameter
RXOOB_CFG
=
7'b0000110
;
//-----------------------RX Gearbox Attributes---------------------------
parameter
RXGEARBOX_EN
=
"FALSE"
;
parameter
GEARBOX_MODE
=
3'b000
;
//-----------------------PRBS Detection Attribute-----------------------
parameter
RXPRBS_ERR_LOOPBACK
=
1'b0
;
//-----------Power-Down Attributes----------
parameter
PD_TRANS_TIME_FROM_P2
=
12'h03c
;
parameter
PD_TRANS_TIME_NONE_P2
=
8'h3c
;
parameter
PD_TRANS_TIME_TO_P2
=
8'h64
;
//-----------RX OOB Signaling Attributes----------
parameter
SAS_MAX_COM
=
64
;
parameter
SAS_MIN_COM
=
36
;
parameter
SATA_BURST_SEQ_LEN
=
4'b0101
;
parameter
SATA_BURST_VAL
=
3'b110
;
parameter
SATA_EIDLE_VAL
=
3'b110
;
parameter
SATA_MAX_BURST
=
8
;
parameter
SATA_MAX_INIT
=
21
;
parameter
SATA_MAX_WAKE
=
7
;
parameter
SATA_MIN_BURST
=
4
;
parameter
SATA_MIN_INIT
=
12
;
parameter
SATA_MIN_WAKE
=
4
;
//-----------RX Fabric Clock Output Control Attributes----------
parameter
TRANS_TIME_RATE
=
8'h0E
;
//------------TX Buffer Attributes----------------
parameter
TXBUF_EN
=
"TRUE"
;
parameter
TXBUF_RESET_ON_RATE_CHANGE
=
"TRUE"
;
parameter
TXDLY_CFG
=
16'h001F
;
parameter
TXDLY_LCFG
=
9'h030
;
parameter
TXDLY_TAP_CFG
=
16'h0000
;
parameter
TXPH_CFG
=
16'h0780
;
parameter
TXPHDLY_CFG
=
24'h084020
;
parameter
TXPH_MONITOR_SEL
=
5'b00000
;
parameter
TX_XCLK_SEL
=
"TXOUT"
;
//-----------------------FPGA TX Interface Attributes-------------------------
parameter
TX_DATA_WIDTH
=
20
;
//-----------------------TX Configurable Driver Attributes-------------------------
parameter
TX_DEEMPH0
=
5'b00000
;
parameter
TX_DEEMPH1
=
5'b00000
;
parameter
TX_EIDLE_ASSERT_DELAY
=
3'b110
;
parameter
TX_EIDLE_DEASSERT_DELAY
=
3'b100
;
parameter
TX_LOOPBACK_DRIVE_HIZ
=
"FALSE"
;
parameter
TX_MAINCURSOR_SEL
=
1'b0
;
parameter
TX_DRIVE_MODE
=
"DIRECT"
;
parameter
TX_MARGIN_FULL_0
=
7'b1001110
;
parameter
TX_MARGIN_FULL_1
=
7'b1001001
;
parameter
TX_MARGIN_FULL_2
=
7'b1000101
;
parameter
TX_MARGIN_FULL_3
=
7'b1000010
;
parameter
TX_MARGIN_FULL_4
=
7'b1000000
;
parameter
TX_MARGIN_LOW_0
=
7'b1000110
;
parameter
TX_MARGIN_LOW_1
=
7'b1000100
;
parameter
TX_MARGIN_LOW_2
=
7'b1000010
;
parameter
TX_MARGIN_LOW_3
=
7'b1000000
;
parameter
TX_MARGIN_LOW_4
=
7'b1000000
;
//-----------------------TX Gearbox Attributes--------------------------
parameter
TXGEARBOX_EN
=
"FALSE"
;
//-----------------------TX Initialization and Reset Attributes--------------------------
parameter
TXPCSRESET_TIME
=
5'b00001
;
parameter
TXPMARESET_TIME
=
5'b00001
;
//-----------------------TX Receiver Detection Attributes--------------------------
parameter
TX_RXDETECT_CFG
=
14'h1832
;
parameter
TX_RXDETECT_REF
=
3'b100
;
//--------------------------CPLL Attributes----------------------------
parameter
CPLL_CFG
=
24'hBC07DC
;
parameter
CPLL_FBDIV
=
4
;
parameter
CPLL_FBDIV_45
=
5
;
parameter
CPLL_INIT_CFG
=
24'h00001E
;
parameter
CPLL_LOCK_CFG
=
16'h01E8
;
parameter
CPLL_REFCLK_DIV
=
1
;
parameter
RXOUT_DIV
=
2
;
parameter
TXOUT_DIV
=
2
;
parameter
SATA_CPLL_CFG
=
"VCO_3000MHZ"
;
//------------RX Initialization and Reset Attributes-------------
parameter
RXDFELPMRESET_TIME
=
7'b0001111
;
//------------RX Equalizer Attributes-------------
parameter
RXLPM_HF_CFG
=
14'b00000011110000
;
parameter
RXLPM_LF_CFG
=
14'b00000011110000
;
parameter
RX_DFE_GAIN_CFG
=
23'h020FEA
;
parameter
RX_DFE_H2_CFG
=
12'b000000000000
;
parameter
RX_DFE_H3_CFG
=
12'b000001000000
;
parameter
RX_DFE_H4_CFG
=
11'b00011110000
;
parameter
RX_DFE_H5_CFG
=
11'b00011100000
;
parameter
RX_DFE_KL_CFG
=
13'b0000011111110
;
parameter
RX_DFE_LPM_CFG
=
16'h0954
;
parameter
RX_DFE_LPM_HOLD_DURING_EIDLE
=
1'b0
;
parameter
RX_DFE_UT_CFG
=
17'b10001111000000000
;
parameter
RX_DFE_VP_CFG
=
17'b00011111100000011
;
//-----------------------Power-Down Attributes-------------------------
parameter
RX_CLKMUX_PD
=
1'b1
;
parameter
TX_CLKMUX_PD
=
1'b1
;
//-----------------------FPGA RX Interface Attribute-------------------------
parameter
RX_INT_DATAWIDTH
=
0
;
//-----------------------FPGA TX Interface Attribute-------------------------
parameter
TX_INT_DATAWIDTH
=
0
;
//----------------TX Configurable Driver Attributes---------------
parameter
TX_QPI_STATUS_EN
=
1'b0
;
//-----------------------RX Equalizer Attributes--------------------------
parameter
RX_DFE_KL_CFG2
=
0
;
parameter
RX_DFE_XYD_CFG
=
13'b0000000000000
;
//-----------------------TX Configurable Driver Attributes--------------------------
parameter
TX_PREDRIVER_MODE
=
1'b0
;
wire
reset
=
EYESCANRESET
|
RXCDRFREQRESET
|
RXCDRRESET
|
RXCDRRESETRSV
|
RXPRBSCNTRESET
|
RXBUFRESET
|
RXDLYSRESET
|
RXPHDLYRESET
|
RXDFELPMRESET
|
GTRXRESET
|
RXOOBRESET
|
RXPCSRESET
|
RXPMARESET
|
CFGRESET
|
GTTXRESET
|
GTRESETSEL
|
RESETOVRD
|
TXDLYSRESET
|
TXPHDLYRESET
|
TXPCSRESET
|
TXPMARESET
;
reg
rx_rst_done
=
1'b0
;
reg
tx_rst_done
=
1'b0
;
assign
RXRESETDONE
=
rx_rst_done
;
assign
TXRESETDONE
=
tx_rst_done
;
initial
forever
@
(
posedge
reset
)
begin
tx_rst_done
<=
1'b0
;
@
(
negedge
reset
)
;
repeat
(
80
)
@
(
posedge
GTREFCLK0
)
;
tx_rst_done
<=
1'b1
;
end
initial
forever
@
(
posedge
reset
)
begin
rx_rst_done
<=
1'b0
;
@
(
negedge
reset
)
;
repeat
(
100
)
@
(
posedge
GTREFCLK0
)
;
rx_rst_done
<=
1'b1
;
end
gtxe2_chnl
#(
.
CPLL_CFG
(
CPLL_CFG
)
,
.
CPLL_FBDIV
(
CPLL_FBDIV
)
,
.
CPLL_FBDIV_45
(
CPLL_FBDIV_45
)
,
.
CPLL_INIT_CFG
(
CPLL_INIT_CFG
)
,
.
CPLL_LOCK_CFG
(
CPLL_LOCK_CFG
)
,
.
CPLL_REFCLK_DIV
(
CPLL_REFCLK_DIV
)
,
.
RXOUT_DIV
(
RXOUT_DIV
)
,
.
TXOUT_DIV
(
TXOUT_DIV
)
,
.
SATA_CPLL_CFG
(
SATA_CPLL_CFG
)
,
.
PMA_RSV3
(
PMA_RSV3
)
,
.
TXOUT_DIV
(
TXOUT_DIV
)
,
// .TXRATE (TXRATE),
.
RXOUT_DIV
(
RXOUT_DIV
)
,
// .RXRATE (RXRATE),
.
TX_INT_DATAWIDTH
(
TX_INT_DATAWIDTH
)
,
.
TX_DATA_WIDTH
(
TX_DATA_WIDTH
)
,
.
RX_DATA_WIDTH
(
RX_DATA_WIDTH
)
,
.
RX_INT_DATAWIDTH
(
RX_INT_DATAWIDTH
)
,
.
PRX8B10BEN
(
1
)
,
.
DEC_MCOMMA_DETECT
(
DEC_MCOMMA_DETECT
)
,
.
DEC_PCOMMA_DETECT
(
DEC_PCOMMA_DETECT
)
,
.
ALIGN_MCOMMA_VALUE
(
ALIGN_MCOMMA_VALUE
)
,
.
ALIGN_MCOMMA_DET
(
ALIGN_MCOMMA_DET
)
,
.
ALIGN_PCOMMA_VALUE
(
ALIGN_PCOMMA_VALUE
)
,
.
ALIGN_PCOMMA_DET
(
ALIGN_PCOMMA_DET
)
,
.
ALIGN_COMMA_ENABLE
(
ALIGN_COMMA_ENABLE
)
,
.
ALIGN_COMMA_DOUBLE
(
ALIGN_COMMA_DOUBLE
)
,
.
TX_DATA_WIDTH
(
TX_DATA_WIDTH
)
,
.
TX_INT_DATAWIDTH
(
TX_INT_DATAWIDTH
)
,
.
PTX8B10BEN
(
1
)
,
.
SATA_BURST_SEQ_LEN
(
SATA_BURST_SEQ_LEN
)
,
.
SATA_CPLL_CFG
(
SATA_CPLL_CFG
)
)
channel
(
.
reset
(
reset
)
,
.
TXP
(
GTXTXP
)
,
.
TXN
(
GTXTXN
)
,
.
TXDATA
(
TXDATA
)
,
.
TXUSRCLK
(
TXUSRCLK
)
,
.
TXUSRCLK2
(
TXUSRCLK2
)
,
.
TX8B10BBYPASS
(
TX8B10BBYPASS
)
,
.
TX8B10BEN
(
TX8B10BEN
)
,
.
TXCHARDISPMODE
(
TXCHARDISPMODE
)
,
.
TXCHARDISPVAL
(
TXCHARDISPVAL
)
,
.
TXCHARISK
(
TXCHARISK
)
,
.
TXBUFSTATUS
(
TXBUFSTATUS
)
,
.
TXPOLARITY
(
TXPOLARITY
)
,
.
TXRATE
(
TXRATE
)
,
.
RXRATE
(
RXRATE
)
,
.
TXRATEDONE
(
TXRATEDONE
)
,
.
TXCOMINIT
(
TXCOMINIT
)
,
.
TXCOMWAKE
(
TXCOMWAKE
)
,
.
TXCOMFINISH
(
TXCOMFINISH
)
,
.
TXELECIDLE
(
TXELECIDLE
)
,
.
RXP
(
GTXRXP
)
,
.
RXN
(
GTXRXN
)
,
.
RXUSRCLK
(
RXUSRCLK
)
,
.
RXUSRCLK2
(
RXUSRCLK2
)
,
.
RXDATA
(
RXDATA
)
,
.
RXELECIDLEMODE
(
RXELECIDLEMODE
)
,
.
RXELECIDLE
(
RXELECIDLE
)
,
.
RXCOMINITDET
(
RXCOMINITDET
)
,
.
RXCOMWAKEDET
(
RXCOMWAKEDET
)
,
.
RXPOLARITY
(
RXPOLARITY
)
,
.
RXBYTEISALIGNED
(
RXBYTEISALIGNED
)
,
.
RXBYTEREALIGN
(
RXBYTEREALIGN
)
,
.
RXCOMMADET
(
RXCOMMADET
)
,
.
RXCOMMADETEN
(
RXCOMMADETEN
)
,
.
RXPCOMMAALIGNEN
(
RXPCOMMAALIGNEN
)
,
.
RXMCOMMAALIGNEN
(
RXMCOMMAALIGNEN
)
,
.
RX8B10BEN
(
RX8B10BEN
)
,
.
RXCHARISCOMMA
(
RXCHARISCOMMA
)
,
.
RXCHARISK
(
RXCHARISK
)
,
.
RXDISPERR
(
RXDISPERR
)
,
.
RXNOTINTABLE
(
RXNOTINTABLE
)
,
.
CPLLREFCLKSEL
(
CPLLREFCLKSEL
)
,
.
GTREFCLK0
(
GTREFCLK0
)
,
.
GTREFCLK1
(
GTREFCLK1
)
,
.
GTNORTHREFCLK0
(
GTNORTHREFCLK0
)
,
.
GTNORTHREFCLK1
(
GTNORTHREFCLK1
)
,
.
GTSOUTHREFCLK0
(
GTSOUTHREFCLK0
)
,
.
GTSOUTHREFCLK1
(
GTSOUTHREFCLK1
)
,
.
GTGREFCLK
(
GTGREFCLK
)
,
.
QPLLCLK
(
QPLLCLK
)
,
.
QPLLREFCLK
(
QPLLREFCLK
)
,
.
RXSYSCLKSEL
(
RXSYSCLKSEL
)
,
.
TXSYSCLKSEL
(
TXSYSCLKSEL
)
,
.
TXOUTCLKSEL
(
TXOUTCLKSEL
)
,
.
RXOUTCLKSEL
(
RXOUTCLKSEL
)
,
.
TXDLYBYPASS
(
TXDLYBYPASS
)
,
.
GTREFCLKMONITOR
(
GTREFCLKMONITOR
)
,
.
CPLLLOCKDETCLK
(
CPLLLOCKDETCLK
)
,
.
CPLLLOCKEN
(
CPLLLOCKEN
)
,
.
CPLLPD
(
CPLLPD
)
,
.
CPLLRESET
(
CPLLRESET
)
,
.
CPLLFBCLKLOST
(
CPLLFBCLKLOST
)
,
.
CPLLLOCK
(
CPLLLOCK
)
,
.
CPLLREFCLKLOST
(
CPLLREFCLKLOST
)
,
.
TXOUTCLKPMA
(
TXOUTCLKPMA
)
,
.
TXOUTCLKPCS
(
TXOUTCLKPCS
)
,
.
TXOUTCLK
(
TXOUTCLK
)
,
.
TXOUTCLKFABRIC
(
TXOUTCLKFABRIC
)
,
.
tx_serial_clk
()
,
.
RXOUTCLKPMA
(
RXOUTCLKPMA
)
,
.
RXOUTCLKPCS
(
RXOUTCLKPCS
)
,
.
RXOUTCLK
(
RXOUTCLK
)
,
.
RXOUTCLKFABRIC
(
RXOUTCLKFABRIC
)
,
.
rx_serial_clk
()
)
;
endmodule
gtxe2_channel/clock_divider.v
0 → 100644
View file @
886f1771
`ifndef
CLOCK_DIVIDER_V
`define
CLOCK_DIVIDER_V
// non synthesisable!
module
clock_divider
(
input
wire
clk_in
,
output
reg
clk_out
,
input
wire
[
31
:
0
]
div
)
;
parameter
divide_by
=
1
;
parameter
divide_by_param
=
1
;
reg
[
31
:
0
]
cnt
=
0
;
reg
[
31
:
0
]
div_r
;
initial
begin
cnt
=
0
;
clk_out
=
1'b1
;
forever
begin
if
(
divide_by_param
==
0
)
begin
if
(
div
>
32'h0
)
div_r
=
div
;
else
div_r
=
1
;
repeat
(
div_r
)
@
(
clk_in
)
;
end
else
begin
repeat
(
divide_by
)
@
(
clk_in
)
;
end
clk_out
=
~
clk_out
;
end
end
endmodule
`endif
gtxe2_channel/gtxe2_chnl.v
0 → 100644
View file @
886f1771
`include
"gtxe2_chnl_clocking.v"
`include
"gtxe2_chnl_tx.v"
`include
"gtxe2_chnl_rx.v"
module
gtxe2_chnl
(
input
wire
reset
,
/*
* TX
*/
output
wire
TXP
,
output
wire
TXN
,
input
wire
[
63
:
0
]
TXDATA
,
input
wire
TXUSRCLK
,
input
wire
TXUSRCLK2
,
// 8/10 encoder
input
wire
[
7
:
0
]
TX8B10BBYPASS
,
input
wire
TX8B10BEN
,
input
wire
[
7
:
0
]
TXCHARDISPMODE
,
input
wire
[
7
:
0
]
TXCHARDISPVAL
,
input
wire
[
7
:
0
]
TXCHARISK
,
// TX Buffer
output
wire
[
1
:
0
]
TXBUFSTATUS
,
// TX Polarity
input
wire
TXPOLARITY
,
// TX Fabric Clock Control
input
wire
[
2
:
0
]
TXRATE
,
output
wire
TXRATEDONE
,
// TX OOB
input
wire
TXCOMINIT
,
input
wire
TXCOMWAKE
,
output
wire
TXCOMFINISH
,
// TX Driver Control
input
wire
TXELECIDLE
,
/*
* RX
*/
input
wire
RXP
,
input
wire
RXN
,
input
wire
RXUSRCLK
,
input
wire
RXUSRCLK2
,
output
wire
[
63
:
0
]
RXDATA
,
input
wire
[
2
:
0
]
RXRATE
,
// oob
input
wire
[
1
:
0
]
RXELECIDLEMODE
,
output
wire
RXELECIDLE
,
output
wire
RXCOMINITDET
,
output
wire
RXCOMWAKEDET
,
// polarity
input
wire
RXPOLARITY
,
// aligner
output
wire
RXBYTEISALIGNED
,
output
wire
RXBYTEREALIGN
,
output
wire
RXCOMMADET
,
input
wire
RXCOMMADETEN
,
input
wire
RXPCOMMAALIGNEN
,
input
wire
RXMCOMMAALIGNEN
,
// 10/8 decoder
input
wire
RX8B10BEN
,
output
wire
[
7
:
0
]
RXCHARISCOMMA
,
output
wire
[
7
:
0
]
RXCHARISK
,
output
wire
[
7
:
0
]
RXDISPERR
,
output
wire
[
7
:
0
]
RXNOTINTABLE
,
/*
* Clocking
*/
// top-level interfaces
input
wire
[
2
:
0
]
CPLLREFCLKSEL
,
input
wire
GTREFCLK0
,
input
wire
GTREFCLK1
,
input
wire
GTNORTHREFCLK0
,
input
wire
GTNORTHREFCLK1
,
input
wire
GTSOUTHREFCLK0
,
input
wire
GTSOUTHREFCLK1
,
input
wire
GTGREFCLK
,
input
wire
QPLLCLK
,
input
wire
QPLLREFCLK
,
input
wire
[
1
:
0
]
RXSYSCLKSEL
,
input
wire
[
1
:
0
]
TXSYSCLKSEL
,
input
wire
[
2
:
0
]
TXOUTCLKSEL
,
input
wire
[
2
:
0
]
RXOUTCLKSEL
,
input
wire
TXDLYBYPASS
,
output
wire
GTREFCLKMONITOR
,
input
wire
CPLLLOCKDETCLK
,
input
wire
CPLLLOCKEN
,
input
wire
CPLLPD
,
input
wire
CPLLRESET
,
output
wire
CPLLFBCLKLOST
,
output
wire
CPLLLOCK
,
output
wire
CPLLREFCLKLOST
,
// phy-level interfaces
output
wire
TXOUTCLKPMA
,
output
wire
TXOUTCLKPCS
,
output
wire
TXOUTCLK
,
output
wire
TXOUTCLKFABRIC
,
output
wire
tx_serial_clk
,
output
wire
RXOUTCLKPMA
,
output
wire
RXOUTCLKPCS
,
output
wire
RXOUTCLK
,
output
wire
RXOUTCLKFABRIC
,
output
wire
rx_serial_clk
)
;
parameter
[
23
:
0
]
CPLL_CFG
=
29'h00BC07DC
;
parameter
integer
CPLL_FBDIV
=
4
;
parameter
integer
CPLL_FBDIV_45
=
5
;
parameter
[
23
:
0
]
CPLL_INIT_CFG
=
24'h00001E
;
parameter
[
15
:
0
]
CPLL_LOCK_CFG
=
16'h01E8
;
parameter
integer
CPLL_REFCLK_DIV
=
1
;
parameter
[
1
:
0
]
PMA_RSV3
=
1
;
parameter
TXOUT_DIV
=
2
;
//parameter TXRATE = 3'b000;
parameter
RXOUT_DIV
=
2
;
//parameter RXRATE = 3'b000;
parameter
integer
TX_INT_DATAWIDTH
=
0
;
parameter
integer
TX_DATA_WIDTH
=
20
;
parameter
integer
PTX8B10BEN
=
1
;
parameter
integer
RX_DATA_WIDTH
=
20
;
parameter
integer
RX_INT_DATAWIDTH
=
0
;
parameter
integer
PRX8B10BEN
=
1
;
parameter
DEC_MCOMMA_DETECT
=
"TRUE"
;
parameter
DEC_PCOMMA_DETECT
=
"TRUE"
;
parameter
[
9
:
0
]
ALIGN_MCOMMA_VALUE
=
10'b1010000011
;
parameter
ALIGN_MCOMMA_DET
=
"TRUE"
;
parameter
[
9
:
0
]
ALIGN_PCOMMA_VALUE
=
10'b0101111100
;
parameter
ALIGN_PCOMMA_DET
=
"TRUE"
;
parameter
[
9
:
0
]
ALIGN_COMMA_ENABLE
=
10'b1111111111
;
parameter
ALIGN_COMMA_DOUBLE
=
"FALSE"
;
parameter
[
3
:
0
]
SATA_BURST_SEQ_LEN
=
4'b1111
;
parameter
SATA_CPLL_CFG
=
"VCO_3000MHZ"
;
gtxe2_chnl_tx
#(
.
TX_DATA_WIDTH
(
TX_DATA_WIDTH
)
,
.
TX_INT_DATAWIDTH
(
TX_INT_DATAWIDTH
)
,
.
PTX8B10BEN
(
PTX8B10BEN
)
,
.
SATA_BURST_SEQ_LEN
(
SATA_BURST_SEQ_LEN
)
,
.
SATA_CPLL_CFG
(
SATA_CPLL_CFG
)
)
tx
(
.
reset
(
reset
)
,
.
TXP
(
TXP
)
,
.
TXN
(
TXN
)
,
.
TXDATA
(
TXDATA
)
,
.
TXUSRCLK
(
TXUSRCLK
)
,
.
TXUSRCLK2
(
TXUSRCLK2
)
,
.
TX8B10BBYPASS
(
TX8B10BBYPASS
)
,
.
TX8B10BEN
(
TX8B10BEN
)
,
.
TXCHARDISPMODE
(
TXCHARDISPMODE
)
,
.
TXCHARDISPVAL
(
TXCHARDISPVAL
)
,
.
TXCHARISK
(
TXCHARISK
)
,
.
TXBUFSTATUS
(
TXBUFSTATUS
)
,
.
TXPOLARITY
(
TXPOLARITY
)
,
.
TXRATE
(
TXRATE
)
,
.
TXRATEDONE
(
TXRATEDONE
)
,
.
TXCOMINIT
(
TXCOMINIT
)
,
.
TXCOMWAKE
(
TXCOMWAKE
)
,
.
TXCOMFINISH
(
TXCOMFINISH
)
,
.
TXELECIDLE
(
TXELECIDLE
)
,
.
serial_clk
(
tx_serial_clk
)
)
;
gtxe2_chnl_rx
#(
.
RX_DATA_WIDTH
(
RX_DATA_WIDTH
)
,
.
RX_INT_DATAWIDTH
(
RX_INT_DATAWIDTH
)
,
.
PRX8B10BEN
(
PRX8B10BEN
)
,
.
DEC_MCOMMA_DETECT
(
DEC_MCOMMA_DETECT
)
,
.
DEC_PCOMMA_DETECT
(
DEC_PCOMMA_DETECT
)
,
.
ALIGN_MCOMMA_VALUE
(
ALIGN_MCOMMA_VALUE
)
,
.
ALIGN_MCOMMA_DET
(
ALIGN_MCOMMA_DET
)
,
.
ALIGN_PCOMMA_VALUE
(
ALIGN_PCOMMA_VALUE
)
,
.
ALIGN_PCOMMA_DET
(
ALIGN_PCOMMA_DET
)
,
.
ALIGN_COMMA_ENABLE
(
ALIGN_COMMA_ENABLE
)
,
.
ALIGN_COMMA_DOUBLE
(
ALIGN_COMMA_DOUBLE
)
)
rx
(
.
reset
(
reset
)
,
.
RXP
(
RXP
)
,
.
RXN
(
RXN
)
,
.
RXUSRCLK
(
RXUSRCLK
)
,
.
RXUSRCLK2
(
RXUSRCLK2
)
,
.
RXDATA
(
RXDATA
)
,
.
RXELECIDLEMODE
(
RXELECIDLEMODE
)
,
.
RXELECIDLE
(
RXELECIDLE
)
,
.
RXCOMINITDET
(
RXCOMINITDET
)
,
.
RXCOMWAKEDET
(
RXCOMWAKEDET
)
,
.
RXPOLARITY
(
RXPOLARITY
)
,
.
RXBYTEISALIGNED
(
RXBYTEISALIGNED
)
,
.
RXBYTEREALIGN
(
RXBYTEREALIGN
)
,
.
RXCOMMADET
(
RXCOMMADET
)
,
.
RXCOMMADETEN
(
RXCOMMADETEN
)
,
.
RXPCOMMAALIGNEN
(
RXPCOMMAALIGNEN
)
,
.
RXMCOMMAALIGNEN
(
RXMCOMMAALIGNEN
)
,
.
RX8B10BEN
(
RX8B10BEN
)
,
.
RXCHARISCOMMA
(
RXCHARISCOMMA
)
,
.
RXCHARISK
(
RXCHARISK
)
,
.
RXDISPERR
(
RXDISPERR
)
,
.
RXNOTINTABLE
(
RXNOTINTABLE
)
,
.
serial_clk
(
rx_serial_clk
)
)
;
gtxe2_chnl_clocking
#(
.
CPLL_CFG
(
CPLL_CFG
)
,
.
CPLL_FBDIV
(
CPLL_FBDIV
)
,
.
CPLL_FBDIV_45
(
CPLL_FBDIV_45
)
,
.
CPLL_INIT_CFG
(
CPLL_INIT_CFG
)
,
.
CPLL_LOCK_CFG
(
CPLL_LOCK_CFG
)
,
.
CPLL_REFCLK_DIV
(
CPLL_REFCLK_DIV
)
,
.
RXOUT_DIV
(
RXOUT_DIV
)
,
.
TXOUT_DIV
(
TXOUT_DIV
)
,
.
SATA_CPLL_CFG
(
SATA_CPLL_CFG
)
,
.
PMA_RSV3
(
PMA_RSV3
)
,
.
TXOUT_DIV
(
TXOUT_DIV
)
,
// .TXRATE (TXRATE),
.
RXOUT_DIV
(
RXOUT_DIV
)
,
// .RXRATE (RXRATE),
.
TX_INT_DATAWIDTH
(
TX_INT_DATAWIDTH
)
,
.
TX_DATA_WIDTH
(
TX_DATA_WIDTH
)
,
.
RX_INT_DATAWIDTH
(
RX_INT_DATAWIDTH
)
,
.
RX_DATA_WIDTH
(
RX_DATA_WIDTH
)
)
clocking
(
.
CPLLREFCLKSEL
(
CPLLREFCLKSEL
)
,
.
GTREFCLK0
(
GTREFCLK0
)
,
.
GTREFCLK1
(
GTREFCLK1
)
,
.
GTNORTHREFCLK0
(
GTNORTHREFCLK0
)
,
.
GTNORTHREFCLK1
(
GTNORTHREFCLK1
)
,
.
GTSOUTHREFCLK0
(
GTSOUTHREFCLK0
)
,
.
GTSOUTHREFCLK1
(
GTSOUTHREFCLK1
)
,
.
GTGREFCLK
(
GTGREFCLK
)
,
.
QPLLCLK
(
QPLLCLK
)
,
.
QPLLREFCLK
(
QPLLREFCLK
)
,
.
RXSYSCLKSEL
(
RXSYSCLKSEL
)
,
.
TXSYSCLKSEL
(
TXSYSCLKSEL
)
,
.
TXOUTCLKSEL
(
TXOUTCLKSEL
)
,
.
RXOUTCLKSEL
(
RXOUTCLKSEL
)
,
.
TXDLYBYPASS
(
TXDLYBYPASS
)
,
.
GTREFCLKMONITOR
(
GTREFCLKMONITOR
)
,
.
CPLLLOCKDETCLK
(
CPLLLOCKDETCLK
)
,
.
CPLLLOCKEN
(
CPLLLOCKEN
)
,
.
CPLLPD
(
CPLLPD
)
,
.
CPLLRESET
(
CPLLRESET
)
,
.
CPLLFBCLKLOST
(
CPLLFBCLKLOST
)
,
.
CPLLLOCK
(
CPLLLOCK
)
,
.
CPLLREFCLKLOST
(
CPLLREFCLKLOST
)
,
.
TXRATE
(
TXRATE
)
,
.
RXRATE
(
RXRATE
)
,
.
TXOUTCLKPMA
(
TXOUTCLKPMA
)
,
.
TXOUTCLKPCS
(
TXOUTCLKPCS
)
,
.
TXOUTCLK
(
TXOUTCLK
)
,
.
TXOUTCLKFABRIC
(
TXOUTCLKFABRIC
)
,
.
tx_serial_clk
(
tx_serial_clk
)
,
.
RXOUTCLKPMA
(
RXOUTCLKPMA
)
,
.
RXOUTCLKPCS
(
RXOUTCLKPCS
)
,
.
RXOUTCLK
(
RXOUTCLK
)
,
.
RXOUTCLKFABRIC
(
RXOUTCLKFABRIC
)
,
.
rx_serial_clk
(
rx_serial_clk
)
)
;
endmodule
gtxe2_channel/gtxe2_chnl_clocking.v
0 → 100644
View file @
886f1771
`include
"gtxe2_chnl_cpll_inmux.v"
`include
"gtxe2_chnl_outclk_mux.v"
`include
"gtxe2_chnl_cpll.v"
`include
"clock_divider.v"
module
gtxe2_chnl_clocking
(
// top-level interfaces
input
wire
[
2
:
0
]
CPLLREFCLKSEL
,
input
wire
GTREFCLK0
,
input
wire
GTREFCLK1
,
input
wire
GTNORTHREFCLK0
,
input
wire
GTNORTHREFCLK1
,
input
wire
GTSOUTHREFCLK0
,
input
wire
GTSOUTHREFCLK1
,
input
wire
GTGREFCLK
,
input
wire
QPLLCLK
,
input
wire
QPLLREFCLK
,
input
wire
[
1
:
0
]
RXSYSCLKSEL
,
input
wire
[
1
:
0
]
TXSYSCLKSEL
,
input
wire
[
2
:
0
]
TXOUTCLKSEL
,
input
wire
[
2
:
0
]
RXOUTCLKSEL
,
input
wire
TXDLYBYPASS
,
output
wire
GTREFCLKMONITOR
,
input
wire
CPLLLOCKDETCLK
,
input
wire
CPLLLOCKEN
,
input
wire
CPLLPD
,
input
wire
CPLLRESET
,
output
wire
CPLLFBCLKLOST
,
output
wire
CPLLLOCK
,
output
wire
CPLLREFCLKLOST
,
input
wire
[
2
:
0
]
TXRATE
,
input
wire
[
2
:
0
]
RXRATE
,
// phy-level interfaces
output
wire
TXOUTCLKPMA
,
output
wire
TXOUTCLKPCS
,
output
wire
TXOUTCLK
,
output
wire
TXOUTCLKFABRIC
,
output
wire
tx_serial_clk
,
output
wire
tx_piso_clk
,
output
wire
RXOUTCLKPMA
,
output
wire
RXOUTCLKPCS
,
output
wire
RXOUTCLK
,
output
wire
RXOUTCLKFABRIC
,
output
wire
rx_serial_clk
,
output
wire
tx_sipo_clk
)
;
// CPLL
parameter
[
23
:
0
]
CPLL_CFG
=
29'h00BC07DC
;
parameter
integer
CPLL_FBDIV
=
4
;
parameter
integer
CPLL_FBDIV_45
=
5
;
parameter
[
23
:
0
]
CPLL_INIT_CFG
=
24'h00001E
;
parameter
[
15
:
0
]
CPLL_LOCK_CFG
=
16'h01E8
;
parameter
integer
CPLL_REFCLK_DIV
=
1
;
parameter
SATA_CPLL_CFG
=
"VCO_3000MHZ"
;
parameter
[
1
:
0
]
PMA_RSV3
=
1
;
parameter
TXOUT_DIV
=
2
;
//parameter TXRATE = 3'b000;
parameter
RXOUT_DIV
=
2
;
//parameter RXRATE = 3'b000;
parameter
TX_INT_DATAWIDTH
=
0
;
parameter
TX_DATA_WIDTH
=
20
;
parameter
RX_INT_DATAWIDTH
=
0
;
parameter
RX_DATA_WIDTH
=
20
;
/*
localparam tx_serial_divider = TXRATE == 3'b001 ? 1
: TXRATE == 3'b010 ? 2
: TXRATE == 3'b011 ? 4
: TXRATE == 3'b100 ? 8
: TXRATE == 3'b101 ? 16 : TXOUT_DIV ;
localparam rx_serial_divider = RXRATE == 3'b001 ? 1
: RXRATE == 3'b010 ? 2
: RXRATE == 3'b011 ? 4
: RXRATE == 3'b100 ? 8
: RXRATE == 3'b101 ? 16 : RXOUT_DIV ;
*/
localparam
tx_pma_divider1
=
TX_INT_DATAWIDTH
==
1
?
4
:
2
;
localparam
tx_pcs_divider1
=
tx_pma_divider1
;
localparam
tx_pma_divider2
=
TX_DATA_WIDTH
==
20
|
TX_DATA_WIDTH
==
40
|
TX_DATA_WIDTH
==
80
?
5
:
4
;
localparam
tx_pcs_divider2
=
tx_pma_divider2
;
localparam
rx_pma_divider1
=
RX_INT_DATAWIDTH
==
1
?
4
:
2
;
localparam
rx_pma_divider2
=
RX_DATA_WIDTH
==
20
|
RX_DATA_WIDTH
==
40
|
RX_DATA_WIDTH
==
80
?
5
:
4
;
wire
clk_mux_out
;
wire
cpll_clk_out
;
wire
tx_phy_clk
;
wire
rx_phy_clk
;
wire
TXPLLREFCLK_DIV1
;
wire
TXPLLREFCLK_DIV2
;
wire
RXPLLREFCLK_DIV1
;
wire
RXPLLREFCLK_DIV2
;
assign
tx_phy_clk
=
TXSYSCLKSEL
[
0
]
?
QPLLCLK
:
cpll_clk_out
;
assign
TXPLLREFCLK_DIV1
=
TXSYSCLKSEL
[
1
]
?
QPLLREFCLK
:
clk_mux_out
;
assign
rx_phy_clk
=
RXSYSCLKSEL
[
0
]
?
QPLLCLK
:
cpll_clk_out
;
assign
RXPLLREFCLK_DIV1
=
RXSYSCLKSEL
[
1
]
?
QPLLREFCLK
:
clk_mux_out
;
assign
tx_serial_clk
=
tx_phy_clk
;
assign
rx_serial_clk
=
rx_phy_clk
;
// piso and sipo clocks
// are not used in the design - no need to use ddr mode during simulation. much easier just multi serial clk by 2
wire
[
31
:
0
]
tx_serial_divider
;
wire
[
31
:
0
]
rx_serial_divider
;
assign
tx_serial_divider
=
TXRATE
==
3'b001
?
1
:
TXRATE
==
3'b010
?
2
:
TXRATE
==
3'b011
?
4
:
TXRATE
==
3'b100
?
8
:
TXRATE
==
3'b101
?
16
:
TXOUT_DIV
;
assign
rx_serial_divider
=
RXRATE
==
3'b001
?
1
:
RXRATE
==
3'b010
?
2
:
RXRATE
==
3'b011
?
4
:
RXRATE
==
3'b100
?
8
:
RXRATE
==
3'b101
?
16
:
RXOUT_DIV
;
clock_divider
#(
// .divide_by (tx_serial_divider),
.
divide_by_param
(
0
)
)
tx_toserialclk_div
(
.
clk_in
(
tx_phy_clk
)
,
.
clk_out
(
tx_piso_clk
)
,
.
div
(
tx_serial_divider
)
)
;
clock_divider
#(
// .divide_by (rx_serial_divider),
.
divide_by_param
(
0
)
)
rx_toserialclk_div
(
.
clk_in
(
rx_phy_clk
)
,
.
clk_out
(
rx_sipo_clk
)
,
.
div
(
rx_serial_divider
)
)
;
// TXOUTCLKPCS/TXOUTCLKPMA generation
wire
tx_pma_div1_clk
;
assign
TXOUTCLKPCS
=
TXOUTCLKPMA
;
clock_divider
#(
.
divide_by
(
tx_pma_divider1
)
)
tx_pma_div1
(
.
clk_in
(
tx_piso_clk
)
,
.
clk_out
(
tx_pma_div1_clk
)
)
;
clock_divider
#(
.
divide_by
(
tx_pma_divider2
)
)
tx_pma_div2
(
.
clk_in
(
tx_pma_div1_clk
)
,
.
clk_out
(
TXOUTCLKPMA
)
)
;
// RXOUTCLKPCS/RXOUTCLKPMA generation
wire
rx_pma_div1_clk
;
assign
RXOUTCLKPCS
=
RXOUTCLKPMA
;
clock_divider
#(
.
divide_by
(
rx_pma_divider1
)
)
rx_pma_div1
(
.
clk_in
(
rx_sipo_clk
)
,
.
clk_out
(
rx_pma_div1_clk
)
)
;
clock_divider
#(
.
divide_by
(
rx_pma_divider2
)
)
rx_pma_div2
(
.
clk_in
(
rx_pma_div1_clk
)
,
.
clk_out
(
RXOUTCLKPMA
)
)
;
//
clock_divider
#(
.
divide_by
(
2
)
)
txpllrefclk_div2
(
.
clk_in
(
TXPLLREFCLK_DIV1
)
,
.
clk_out
(
TXPLLREFCLK_DIV2
)
)
;
clock_divider
#(
.
divide_by
(
2
)
)
rxpllrefclk_div2
(
.
clk_in
(
RXPLLREFCLK_DIV1
)
,
.
clk_out
(
RXPLLREFCLK_DIV2
)
)
;
gtxe2_chnl_outclk_mux
tx_out_mux
(
.
TXPLLREFCLK_DIV1
(
TXPLLREFCLK_DIV1
)
,
.
TXPLLREFCLK_DIV2
(
TXPLLREFCLK_DIV2
)
,
.
TXOUTCLKPMA
(
TXOUTCLKPMA
)
,
.
TXOUTCLKPCS
(
TXOUTCLKPCS
)
,
.
TXOUTCLKSEL
(
TXOUTCLKSEL
)
,
.
TXDLYBYPASS
(
TXDLYBYPASS
)
,
.
TXOUTCLK
(
TXOUTCLK
)
)
;
gtxe2_chnl_outclk_mux
rx_out_mux
(
.
TXPLLREFCLK_DIV1
(
RXPLLREFCLK_DIV1
)
,
.
TXPLLREFCLK_DIV2
(
RXPLLREFCLK_DIV2
)
,
.
TXOUTCLKPMA
(
RXOUTCLKPMA
)
,
.
TXOUTCLKPCS
(
RXOUTCLKPCS
)
,
.
TXOUTCLKSEL
(
RXOUTCLKSEL
)
,
.
TXDLYBYPASS
(
RXDLYBYPASS
)
,
.
TXOUTCLK
(
RXOUTCLK
)
)
;
gtxe2_chnl_cpll_inmux
clk_mux
(
.
CPLLREFCLKSEL
(
CPLLREFCLKSEL
)
,
.
GTREFCLK0
(
GTREFCLK0
)
,
.
GTREFCLK1
(
GTREFCLK1
)
,
.
GTNORTHREFCLK0
(
GTNORTHREFCLK0
)
,
.
GTNORTHREFCLK1
(
GTNORTHREFCLK1
)
,
.
GTSOUTHREFCLK0
(
GTSOUTHREFCLK0
)
,
.
GTSOUTHREFCLK1
(
GTSOUTHREFCLK1
)
,
.
GTGREFCLK
(
GTGREFCLK
)
,
.
CPLL_MUX_CLK_OUT
(
clk_mux_out
)
)
;
gtxe2_chnl_cpll
#(
.
CPLL_FBDIV
(
4
)
,
.
CPLL_FBDIV_45
(
5
)
,
.
CPLL_REFCLK_DIV
(
1
)
)
cpll
(
.
CPLLLOCKDETCLK
(
CPLLLOCKDETCLK
)
,
.
CPLLLOCKEN
(
CPLLLOCKEN
)
,
.
CPLLPD
(
CPLLPD
)
,
.
CPLLRESET
(
CPLLRESET
)
,
.
CPLLFBCLKLOST
(
CPLLFBCLKLOST
)
,
.
CPLLLOCK
(
CPLLLOCK
)
,
.
CPLLREFCLKLOST
(
CPLLREFCLKLOST
)
,
.
GTRSVD
(
GTRSVD
)
,
.
PCSRSVDIN
(
PCSRSVDIN
)
,
.
PCSRSVDIN2
(
PCSRSVDIN2
)
,
.
PMARSVDIN
(
PMARSVDIN
)
,
.
PMARSVDIN2
(
PMARSVDIN2
)
,
.
TSTIN
(
TSTIN
)
,
.
TSTOUT
(
TSTOUT
)
,
.
ref_clk
(
clk_mux_out
)
,
.
clk_out
(
cpll_clk_out
)
,
.
pll_locked
(
pll_locked
)
)
;
endmodule
gtxe2_channel/gtxe2_chnl_cpll.v
0 → 100644
View file @
886f1771
`include
"gtxe2_chnl_cpll_def.v"
module
gtxe2_chnl_cpll
(
// top-level interfaces
input
wire
CPLLLOCKDETCLK
,
input
wire
CPLLLOCKEN
,
input
wire
CPLLPD
,
input
wire
CPLLRESET
,
// active high
output
wire
CPLLFBCLKLOST
,
output
wire
CPLLLOCK
,
output
wire
CPLLREFCLKLOST
,
input
wire
GTRSVD
,
input
wire
PCSRSVDIN
,
input
wire
PCSRSVDIN2
,
input
wire
PMARSVDIN
,
input
wire
PMARSVDIN2
,
input
wire
TSTIN
,
output
wire
TSTOUT
,
// internal
input
wire
ref_clk
,
output
wire
clk_out
,
output
wire
pll_locked
// equals CPLLLOCK
)
;
parameter
[
23
:
0
]
CPLL_CFG
=
29'h00BC07DC
;
parameter
integer
CPLL_FBDIV
=
4
;
parameter
integer
CPLL_FBDIV_45
=
5
;
parameter
[
23
:
0
]
CPLL_INIT_CFG
=
24'h00001E
;
parameter
[
15
:
0
]
CPLL_LOCK_CFG
=
16'h01E8
;
parameter
integer
CPLL_REFCLK_DIV
=
1
;
parameter
integer
RXOUT_DIV
=
2
;
parameter
integer
TXOUT_DIV
=
2
;
parameter
SATA_CPLL_CFG
=
"VCO_3000MHZ"
;
parameter
[
1
:
0
]
PMA_RSV3
=
1
;
localparam
multiplier
=
CPLL_FBDIV
*
CPLL_FBDIV_45
;
localparam
divider
=
CPLL_REFCLK_DIV
;
assign
pll_locked
=
locked
;
assign
CPLLLOCK
=
pll_locked
;
wire
fb_clk_out
;
wire
reset
;
reg
mult_clk
;
reg
mult_dev_clk
;
assign
clk_out
=
mult_dev_clk
;
// generate internal async reset
assign
reset
=
CPLLPD
|
CPLLRESET
;
// apply multipliers
time
last_edge
;
// reference clock edge's absolute time
time
period
;
// reference clock's period
integer
locked_f
;
reg
locked
;
initial
begin
last_edge
=
0
;
period
=
0
;
forever
@
(
posedge
ref_clk
or
posedge
reset
)
begin
period
=
reset
?
0
:
$
time
-
(
last_edge
==
0
?
$
time
:
last_edge
)
;
last_edge
=
reset
?
0
:
$
time
;
end
end
reg
tmp
=
0
;
initial
begin
@
(
posedge
reset
)
;
forever
@
(
posedge
ref_clk
)
begin
tmp
=
~
tmp
;
if
(
period
>
0
)
begin
locked_f
=
1
;
mult_clk
=
1'b1
;
repeat
(
multiplier
*
2
-
1
)
begin
#(
period
/
multiplier
/
2
)
mult_clk
=
~
mult_clk
;
end
end
else
locked_f
=
0
;
end
end
// apply dividers
initial
begin
mult_dev_clk
=
1'b1
;
forever
begin
repeat
(
divider
)
@
(
mult_clk
)
;
mult_dev_clk
=
~
mult_dev_clk
;
end
end
// show if 'pll' is locked
reg
[
31
:
0
]
counter
;
always
@
(
posedge
ref_clk
or
posedge
reset
)
counter
<=
reset
|
locked_f
==
0
?
0
:
counter
==
`GTXE2_CHNL_CPLL_LOCK_TIME
?
counter
:
counter
+
1
;
always
@
(
posedge
ref_clk
)
locked
<=
counter
==
`GTXE2_CHNL_CPLL_LOCK_TIME
;
/*
always @ (posedge ref_clk or posedge reset)
begin
if (locked_f == 1 && ~reset)
begin
repeat (`GTXE2_CHNL_CPLL_LOCK_TIME) @ (posedge ref_clk);
locked <= 1'b1;
end
else
locked <= 1'b0;
end*/
endmodule
gtxe2_channel/gtxe2_chnl_cpll_def.v
0 → 100644
View file @
886f1771
`define
GTXE2_CHNL_CPLL_LOCK_TIME
60
gtxe2_channel/gtxe2_chnl_cpll_inmux.v
0 → 100644
View file @
886f1771
// cpll reference clock mux
module
gtxe2_chnl_cpll_inmux
(
input
wire
[
2
:
0
]
CPLLREFCLKSEL
,
input
wire
GTREFCLK0
,
input
wire
GTREFCLK1
,
input
wire
GTNORTHREFCLK0
,
input
wire
GTNORTHREFCLK1
,
input
wire
GTSOUTHREFCLK0
,
input
wire
GTSOUTHREFCLK1
,
input
wire
GTGREFCLK
,
output
wire
CPLL_MUX_CLK_OUT
)
;
// clock multiplexer - pre-syntesis simulation only
assign
CPLL_MUX_CLK_OUT
=
CPLLREFCLKSEL
==
3'b000
?
1'b0
// reserved
:
CPLLREFCLKSEL
==
3'b001
?
GTREFCLK0
:
CPLLREFCLKSEL
==
3'b010
?
GTREFCLK1
:
CPLLREFCLKSEL
==
3'b011
?
GTNORTHREFCLK0
:
CPLLREFCLKSEL
==
3'b100
?
GTNORTHREFCLK1
:
CPLLREFCLKSEL
==
3'b101
?
GTSOUTHREFCLK0
:
CPLLREFCLKSEL
==
3'b110
?
GTSOUTHREFCLK1
:
/*CPLLREFCLKSEL == 3'b111 ?*/
GTGREFCLK
;
endmodule
gtxe2_channel/gtxe2_chnl_outclk_mux.v
0 → 100644
View file @
886f1771
module
gtxe2_chnl_outclk_mux
(
input
wire
TXPLLREFCLK_DIV1
,
input
wire
TXPLLREFCLK_DIV2
,
input
wire
TXOUTCLKPMA
,
input
wire
TXOUTCLKPCS
,
input
wire
[
2
:
0
]
TXOUTCLKSEL
,
input
wire
TXDLYBYPASS
,
output
wire
TXOUTCLK
)
;
assign
TXOUTCLK
=
TXOUTCLKSEL
==
3'b001
?
TXOUTCLKPCS
:
TXOUTCLKSEL
==
3'b010
?
TXOUTCLKPMA
:
TXOUTCLKSEL
==
3'b011
?
TXPLLREFCLK_DIV1
:
TXOUTCLKSEL
==
3'b100
?
TXPLLREFCLK_DIV2
:
/* 3'b000 */
1'b1
;
endmodule
gtxe2_channel/gtxe2_chnl_rx.v
0 → 100644
View file @
886f1771
`include
"gtxe2_chnl_rx_des.v"
`include
"gtxe2_chnl_rx_oob.v"
`include
"gtxe2_chnl_rx_10x8dec.v"
`include
"gtxe2_chnl_rx_align.v"
module
gtxe2_chnl_rx
(
input
wire
reset
,
input
wire
RXP
,
input
wire
RXN
,
input
wire
RXUSRCLK
,
input
wire
RXUSRCLK2
,
output
wire
[
63
:
0
]
RXDATA
,
// oob
input
wire
[
1
:
0
]
RXELECIDLEMODE
,
output
wire
RXELECIDLE
,
output
wire
RXCOMINITDET
,
output
wire
RXCOMWAKEDET
,
// polarity
input
wire
RXPOLARITY
,
// aligner
output
wire
RXBYTEISALIGNED
,
output
wire
RXBYTEREALIGN
,
output
wire
RXCOMMADET
,
input
wire
RXCOMMADETEN
,
input
wire
RXPCOMMAALIGNEN
,
input
wire
RXMCOMMAALIGNEN
,
// 10/8 decoder
input
wire
RX8B10BEN
,
output
wire
[
7
:
0
]
RXCHARISCOMMA
,
output
wire
[
7
:
0
]
RXCHARISK
,
output
wire
[
7
:
0
]
RXDISPERR
,
output
wire
[
7
:
0
]
RXNOTINTABLE
,
// internal
input
wire
serial_clk
)
;
parameter
integer
RX_DATA_WIDTH
=
20
;
parameter
integer
RX_INT_DATAWIDTH
=
0
;
parameter
integer
PRX8B10BEN
=
1
;
parameter
DEC_MCOMMA_DETECT
=
"TRUE"
;
parameter
DEC_PCOMMA_DETECT
=
"TRUE"
;
parameter
[
9
:
0
]
ALIGN_MCOMMA_VALUE
=
10'b1010000011
;
parameter
ALIGN_MCOMMA_DET
=
"TRUE"
;
parameter
[
9
:
0
]
ALIGN_PCOMMA_VALUE
=
10'b0101111100
;
parameter
ALIGN_PCOMMA_DET
=
"TRUE"
;
parameter
[
9
:
0
]
ALIGN_COMMA_ENABLE
=
10'b1111111111
;
parameter
ALIGN_COMMA_DOUBLE
=
"FALSE"
;
function
integer
calc_idw
;
input
RX8B10BEN
;
input
RX_INT_DATAWIDTH
;
input
RX_DATA_WIDTH
;
begin
if
(
RX8B10BEN
==
1
)
calc_idw
=
RX_INT_DATAWIDTH
==
1
?
40
:
20
;
else
begin
if
(
RX_INT_DATAWIDTH
==
1
)
calc_idw
=
RX_DATA_WIDTH
==
32
?
32
:
RX_DATA_WIDTH
==
40
?
40
:
RX_DATA_WIDTH
==
64
?
32
:
40
;
else
calc_idw
=
RX_DATA_WIDTH
==
16
?
16
:
RX_DATA_WIDTH
==
20
?
20
:
RX_DATA_WIDTH
==
32
?
16
:
20
;
end
end
endfunction
localparam
internal_data_width
=
calc_idw
(
PRX8B10BEN
,
RX_INT_DATAWIDTH
,
RX_DATA_WIDTH
)
;
// OOB
gtxe2_chnl_rx_oob
#(
.
width
(
internal_data_width
)
)
rx_oob
(
.
reset
(
reset
)
,
.
clk
(
serial_clk
)
,
.
RXN
(
RXN
)
,
.
RXP
(
RXP
)
,
.
RXELECIDLEMODE
(
RXELECIDLEMODE
)
,
.
RXELECIDLE
(
RXELECIDLE
)
,
.
RXCOMINITDET
(
RXCOMINITDET
)
,
.
RXCOMWAKEDET
(
RXCOMWAKEDET
)
)
;
// Polarity
// no need to invert data after a deserializer, no need to resync or make a buffer trigger for simulation
wire
indata_ser
;
assign
indata_ser
=
RXPOLARITY
^
RXP
;
// due to non-syntasisable usage, CDR is missing
// deserializer
wire
[
internal_data_width
-
1
:
0
]
parallel_data
;
gtxe2_chnl_rx_des
#(
.
width
(
internal_data_width
)
)
des
(
.
reset
(
reset
)
,
.
inclk
(
serial_clk
)
,
.
outclk
(
RXUSRCLK
)
,
.
indata
(
indata_ser
)
,
.
outdata
(
parallel_data
)
)
;
// aligner
wire
[
internal_data_width
-
1
:
0
]
aligned_data
;
gtxe2_chnl_rx_align
#(
.
width
(
internal_data_width
)
,
.
ALIGN_MCOMMA_VALUE
(
ALIGN_MCOMMA_VALUE
)
,
.
ALIGN_MCOMMA_DET
(
ALIGN_MCOMMA_DET
)
,
.
ALIGN_PCOMMA_VALUE
(
ALIGN_PCOMMA_VALUE
)
,
.
ALIGN_PCOMMA_DET
(
ALIGN_PCOMMA_DET
)
,
.
ALIGN_COMMA_ENABLE
(
ALIGN_COMMA_ENABLE
)
,
.
ALIGN_COMMA_DOUBLE
(
ALIGN_COMMA_DOUBLE
)
)
aligner
(
.
clk
(
RXUSRCLK
)
,
.
rst
(
reset
)
,
.
indata
(
parallel_data
)
,
.
outdata
(
aligned_data
)
,
.
RXBYTEISALIGNED
(
RXBYTEISALIGNED
)
,
.
RXBYTEREALIGN
(
RXBYTEREALIGN
)
,
.
RXCOMMADET
(
RXCOMMADET
)
,
.
RXCOMMADETEN
(
RXCOMMADETEN
)
,
.
RXPCOMMAALIGNEN
(
RXPCOMMAALIGNEN
)
,
.
RXMCOMMAALIGNEN
(
RXMCOMMAALIGNEN
)
)
;
gtxe2_chnl_rx_10x8dec
#(
.
iwidth
(
internal_data_width
)
,
.
owidth
(
RX_DATA_WIDTH
)
,
.
DEC_MCOMMA_DETECT
(
DEC_MCOMMA_DETECT
)
,
.
DEC_PCOMMA_DETECT
(
DEC_PCOMMA_DETECT
)
)
decoder_10x8
(
.
clk
(
RXUSRCLK
)
,
.
rst
(
reset
)
,
.
indata
(
aligned_data
)
,
.
RX8B10BEN
(
RX8B10BEN
)
,
.
RXCHARISCOMMA
(
RXCHARISCOMMA
)
,
.
RXCHARISK
(
RXCHARISK
)
,
.
RXDISPERR
(
RXDISPERR
)
,
.
RXNOTINTABLE
(
RXNOTINTABLE
)
,
.
outdata
()
,
.
RXDATA
(
RXDATA
)
)
;
endmodule
gtxe2_channel/gtxe2_chnl_rx_10x8dec.v
0 → 100644
View file @
886f1771
// always enabled
module
gtxe2_chnl_rx_10x8dec
#(
parameter
iwidth
=
20
,
parameter
owidth
=
20
,
parameter
DEC_MCOMMA_DETECT
=
"TRUE"
,
parameter
DEC_PCOMMA_DETECT
=
"TRUE"
)
(
input
wire
clk
,
input
wire
rst
,
input
wire
[
iwidth
-
1
:
0
]
indata
,
input
wire
RX8B10BEN
,
output
wire
[
7
:
0
]
RXCHARISCOMMA
,
output
wire
[
7
:
0
]
RXCHARISK
,
output
wire
[
7
:
0
]
RXDISPERR
,
output
wire
[
7
:
0
]
RXNOTINTABLE
,
output
wire
[
owidth
-
1
:
0
]
outdata
,
output
wire
[
63
:
0
]
RXDATA
)
;
localparam
word_count
=
iwidth
/
10
;
localparam
add_2out_bits
=
owidth
==
20
|
owidth
==
40
|
owidth
==
80
?
"TRUE"
:
"FALSE"
;
wire
[
iwidth
-
2
*
word_count
-
1
:
0
]
pure_data
;
wire
[
iwidth
-
1
:
0
]
data
;
wire
[
word_count
-
1
:
0
]
disp
;
//consecutive disparity calculations;
wire
[
word_count
-
1
:
0
]
disp_word
;
// 0 - negative, 1 - positive
wire
[
word_count
-
1
:
0
]
no_disp_word
;
// ignore disp_word, '1's and '0's have equal count
wire
[
word_count
-
1
:
0
]
disp_err
;
reg
disp_init
;
// disparity after last clock's portion of data
always
@
(
posedge
clk
)
disp_init
<=
rst
?
1'b0
:
disp
[
word_count
-
1
]
;
genvar
ii
;
generate
for
(
ii
=
0
;
ii
<
word_count
;
ii
=
ii
+
1
)
begin:
asdf
//data = {1'(is in table) + 3'(decoded 4/3) + 1'(is in table) + 5'(decoded 6/5)}
//6/5 decoding
assign
data
[
ii
*
10
+
5
:
ii
*
10
]
=
RXCHARISK
[
ii
]
?
(
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0010111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1101000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1001111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0110000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1010111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0101000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1100111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0011000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0100111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1011000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0101111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1010000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0110111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1001000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110000011
?
6'b011100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001010111
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110101000
?
6'b010111
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100100
?
6'b011011
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011101
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100010
?
6'b011101
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011110
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100001
?
6'b011110
:
6'b100000
)
:
(
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b111001
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b000110
?
6'b000000
:
// Data VVV
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101110
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010001
?
6'b000001
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101101
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010010
?
6'b000010
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100011
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100011
?
6'b000011
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101011
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010100
?
6'b000100
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100101
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100101
?
6'b000101
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100110
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100110
?
6'b000110
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b000111
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b111000
?
6'b000111
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100111
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011000
?
6'b001000
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101001
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101001
?
6'b001001
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101010
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101010
?
6'b001010
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001011
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001011
?
6'b001011
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101100
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101100
?
6'b001100
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001101
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001101
?
6'b001101
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001110
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001110
?
6'b001110
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b111010
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b000101
?
6'b001111
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110110
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001001
?
6'b010000
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110001
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110001
?
6'b010001
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110010
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110010
?
6'b010010
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010011
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010011
?
6'b010011
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110100
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110100
?
6'b010100
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010101
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010101
?
6'b010101
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010110
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010110
?
6'b010110
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b010111
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b101000
?
6'b010111
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110011
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001100
?
6'b011000
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011001
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011001
?
6'b011001
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011010
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011010
?
6'b011010
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011011
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100100
?
6'b011011
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011100
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011100
?
6'b011100
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011101
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100010
?
6'b011101
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b011110
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b100001
?
6'b011110
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b110101
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b001010
?
6'b011111
:
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b111100
|
indata
[
ii
*
10
+
5
:
ii
*
10
]
==
6'b000011
?
6'b011100
:
// Controls VVV
/* indata[ii*10 + 5:ii*10] == 6'b111100 | indata[ii*10 + 5:ii*10] == 6'b000011 ? 6'b011100 :
indata[ii*10 + 5:ii*10] == 6'b111100 | indata[ii*10 + 5:ii*10] == 6'b000011 ? 6'b011100 :
indata[ii*10 + 5:ii*10] == 6'b111100 | indata[ii*10 + 5:ii*10] == 6'b000011 ? 6'b011100 :
indata[ii*10 + 5:ii*10] == 6'b111100 | indata[ii*10 + 5:ii*10] == 6'b000011 ? 6'b011100 :
indata[ii*10 + 5:ii*10] == 6'b111100 | indata[ii*10 + 5:ii*10] == 6'b000011 ? 6'b011100 :
indata[ii*10 + 5:ii*10] == 6'b111100 | indata[ii*10 + 5:ii*10] == 6'b000011 ? 6'b011100 :
indata[ii*10 + 5:ii*10] == 6'b111100 | indata[ii*10 + 5:ii*10] == 6'b000011 ? 6'b011100 :
indata[ii*10 + 5:ii*10] == 6'b010111 | indata[ii*10 + 5:ii*10] == 6'b101000 ? 6'b010111 :
indata[ii*10 + 5:ii*10] == 6'b011011 | indata[ii*10 + 5:ii*10] == 6'b100100 ? 6'b011011 :
indata[ii*10 + 5:ii*10] == 6'b011101 | indata[ii*10 + 5:ii*10] == 6'b100010 ? 6'b011101 :
indata[ii*10 + 5:ii*10] == 6'b011110 | indata[ii*10 + 5:ii*10] == 6'b100001 ? 6'b011110 :*/
6'b100000
)
;
// not in a table
//4/3 decoding
assign
data
[
ii
*
10
+
9
:
ii
*
10
+
6
]
=
RXCHARISK
[
ii
]
?
(
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0010111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1101000011
?
4'b0000
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1001111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0110000011
?
4'b0001
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1010111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0101000011
?
4'b0010
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1100111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0011000011
?
4'b0011
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0100111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1011000011
?
4'b0100
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0101111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1010000011
?
4'b0101
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0110111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1001000011
?
4'b0110
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110000011
?
4'b0111
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001010111
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110101000
?
4'b0111
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100100
?
4'b0111
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011101
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100010
?
4'b0111
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011110
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100001
?
4'b0111
:
4'b1000
)
:
(
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1101
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0010
?
4'b0000
:
// Data VVV
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1001
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1001
?
4'b0001
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1010
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1010
?
4'b0010
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0011
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1100
?
4'b0011
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1011
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0100
?
4'b0100
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0101
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0101
?
4'b0101
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0110
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0110
?
4'b0110
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0111
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1110
?
4'b0111
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0001
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1000
?
4'b0111
:
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b0010
|
indata
[
ii
*
10
+
9
:
ii
*
10
+
6
]
==
4'b1101
?
4'b0000
:
// Control VVV
/* indata[ii*10 + 9:ii*10 + 6] == 4'b1001 | indata[ii*10 + 9:ii*10 + 6] == 4'b0110 ? 4'b0001 :
indata[ii*10 + 9:ii*10 + 6] == 4'b1010 | indata[ii*10 + 9:ii*10 + 6] == 4'b0101 ? 4'b0010 :
indata[ii*10 + 9:ii*10 + 6] == 4'b1100 | indata[ii*10 + 9:ii*10 + 6] == 4'b0011 ? 4'b0011 :
indata[ii*10 + 9:ii*10 + 6] == 4'b0100 | indata[ii*10 + 9:ii*10 + 6] == 4'b1011 ? 4'b0100 :
indata[ii*10 + 9:ii*10 + 6] == 4'b0101 | indata[ii*10 + 9:ii*10 + 6] == 4'b1010 ? 4'b0101 :
indata[ii*10 + 9:ii*10 + 6] == 4'b0110 | indata[ii*10 + 9:ii*10 + 6] == 4'b1001 ? 4'b0110 :
indata[ii*10 + 9:ii*10 + 6] == 4'b0001 | indata[ii*10 + 9:ii*10 + 6] == 4'b1110 ? 4'b0111 :*/
4'b1000
)
;
// not in a table
assign
disp_word
[
ii
]
=
(
4'd0
+
indata
[
ii
*
10
]
+
indata
[
ii
*
10
+
1
]
+
indata
[
ii
*
10
+
2
]
+
indata
[
ii
*
10
+
3
]
+
indata
[
ii
*
10
+
4
]
+
indata
[
ii
*
10
+
5
]
+
indata
[
ii
*
10
+
6
]
+
indata
[
ii
*
10
+
7
]
+
indata
[
ii
*
10
+
8
]
+
indata
[
ii
*
10
+
9
])
>
5
;
assign
no_disp_word
[
ii
]
=
(
4'd0
+
indata
[
ii
*
10
]
+
indata
[
ii
*
10
+
1
]
+
indata
[
ii
*
10
+
2
]
+
indata
[
ii
*
10
+
3
]
+
indata
[
ii
*
10
+
4
]
+
indata
[
ii
*
10
+
5
]
+
indata
[
ii
*
10
+
6
]
+
indata
[
ii
*
10
+
7
]
+
indata
[
ii
*
10
+
8
]
+
indata
[
ii
*
10
+
9
])
==
5
;
assign
pure_data
[
ii
*
8
+
7
:
ii
*
8
]
=
{
data
[
ii
*
10
+
8
:
ii
*
10
+
6
]
,
data
[
ii
*
10
+
4
:
ii
*
10
]
};
if
(
add_2out_bits
==
"TRUE"
)
assign
outdata
[
ii
*
10
+
9
:
ii
*
10
]
=
{
RXDISPERR
[
ii
]
,
RXCHARISK
[
ii
]
,
pure_data
[
ii
*
8
+
7
:
ii
*
8
]
};
else
assign
outdata
[
ii
*
8
+
7
:
ii
*
8
]
=
pure_data
[
ii
*
8
+
7
:
ii
*
8
]
;
end
endgenerate
//disperr[ii] = no_disp_word[ii] ? 1'b0 : ~disp_word[ii] ^ disp[ii-1];
//disp[ii] = no_disp_word[ii] ? disp[ii-1] : disp_word[ii]
assign
disp_err
=
~
no_disp_word
&
(
~
disp_word
^
{
disp
[
word_count
-
2
:
0
]
,
disp_init
}
)
;
assign
disp
=
~
no_disp_word
&
disp_word
|
no_disp_word
&
{
disp
[
word_count
-
2
:
0
]
,
disp_init
};
generate
for
(
ii
=
0
;
ii
<
8
;
ii
=
ii
+
1
)
begin:
dfsga
assign
RXDATA
[
ii
*
8
+
7
:
ii
*
8
]
=
ii
>=
word_count
?
8'h0
:
pure_data
[
ii
*
8
+
7
:
ii
*
8
]
;
assign
RXNOTINTABLE
[
ii
]
=
ii
>=
word_count
?
1'b0
:
data
[
ii
*
10
+
9
]
|
data
[
ii
*
10
+
5
]
;
assign
RXDISPERR
[
ii
]
=
ii
>=
word_count
?
1'b0
:
disp_err
[
ii
]
;
assign
RXCHARISK
[
ii
]
=
ii
>=
word_count
?
1'b0
:
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0010111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1101000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1001111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0110000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1010111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0101000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1100111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0011000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0100111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1011000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0101111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1010000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0110111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1001000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001010111
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110101000
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011101
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100010
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001011110
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110100001
;
assign
RXCHARISCOMMA
[
ii
]
=
ii
>=
word_count
?
1'b0
:
(
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1001111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0101111100
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0001111100
)
&
DEC_PCOMMA_DETECT
|
(
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b0110000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1010000011
|
indata
[
ii
*
10
+
9
:
ii
*
10
]
==
10'b1110000011
)
&
DEC_MCOMMA_DETECT
;
end
endgenerate
endmodule
gtxe2_channel/gtxe2_chnl_rx_align.v
0 → 100644
View file @
886f1771
module
gtxe2_chnl_rx_align
#(
parameter
width
=
20
,
parameter
[
9
:
0
]
ALIGN_MCOMMA_VALUE
=
10'b1010000011
,
parameter
ALIGN_MCOMMA_DET
=
"TRUE"
,
parameter
[
9
:
0
]
ALIGN_PCOMMA_VALUE
=
10'b0101111100
,
parameter
ALIGN_PCOMMA_DET
=
"TRUE"
,
parameter
[
9
:
0
]
ALIGN_COMMA_ENABLE
=
10'b1111111111
,
parameter
ALIGN_COMMA_DOUBLE
=
"FALSE"
,
parameter
ALIGN_COMMA_WORD
=
1
)
(
input
wire
clk
,
input
wire
rst
,
input
wire
[
width
-
1
:
0
]
indata
,
output
wire
[
width
-
1
:
0
]
outdata
,
output
wire
RXBYTEISALIGNED
,
output
wire
RXBYTEREALIGN
,
output
wire
RXCOMMADET
,
input
wire
RXCOMMADETEN
,
input
wire
RXPCOMMAALIGNEN
,
input
wire
RXMCOMMAALIGNEN
)
;
localparam
comma_width
=
ALIGN_COMMA_DOUBLE
==
"FALSE"
?
10
:
20
;
localparam
window_size
=
width
;
//comma_width + width;
// prepare a buffer to be scanned on comma matches
reg
[
width
-
1
:
0
]
indata_r
;
wire
[
width
*
2
-
1
:
0
]
data
;
assign
data
=
{
indata
,
indata_r
};
//{indata_r, indata};
always
@
(
posedge
clk
)
indata_r
<=
indata
;
// finding matches
wire
[
comma_width
-
1
:
0
]
comma_window
[
window_size
-
1
:
0
]
;
wire
[
window_size
-
1
:
0
]
comma_match
;
// shows all matches
wire
[
window_size
-
1
:
0
]
comma_pos
;
// shows the first match
wire
[
window_size
-
1
:
0
]
pcomma_match
;
wire
[
window_size
-
1
:
0
]
mcomma_match
;
genvar
ii
;
generate
for
(
ii
=
0
;
ii
<
window_size
;
ii
=
ii
+
1
)
begin:
filter
assign
comma_window
[
ii
]
=
data
[
comma_width
+
ii
-
1
:
ii
]
;
assign
pcomma_match
[
ii
]
=
(
comma_window
[
ii
]
&
ALIGN_COMMA_ENABLE
)
==
(
ALIGN_PCOMMA_VALUE
&
ALIGN_COMMA_ENABLE
)
;
assign
mcomma_match
[
ii
]
=
(
comma_window
[
ii
]
&
ALIGN_COMMA_ENABLE
)
==
(
ALIGN_MCOMMA_VALUE
&
ALIGN_COMMA_ENABLE
)
;
assign
comma_match
[
ii
]
=
pcomma_match
[
ii
]
&
RXPCOMMAALIGNEN
|
mcomma_match
[
ii
]
&
RXMCOMMAALIGNEN
;
end
endgenerate
// so, comma_match indicates bits, from whose comma/doublecomma (or commas) occurs in the window buffer
// all we need from now is to get one of these bits = [x] and say [x+width-1:x] is an aligned data
// doing it in a hard way
generate
for
(
ii
=
1
;
ii
<
window_size
;
ii
=
ii
+
1
)
begin:
filter_comma_pos
assign
comma_pos
[
ii
]
=
comma_match
[
ii
]
&
~|
comma_match
[
ii
-
1
:
0
]
;
end
endgenerate
assign
comma_pos
[
0
]
=
comma_match
[
0
]
;
function
integer
clogb2
;
input
[
31
:
0
]
value
;
begin
value
=
value
-
1
;
for
(
clogb2
=
0
;
value
>
0
;
clogb2
=
clogb2
+
1
)
begin
value
=
value
>>
1
;
end
end
endfunction
function
integer
powerof2
;
input
[
31
:
0
]
value
;
begin
value
=
1
<<
value
;
end
endfunction
localparam
pwidth
=
clogb2
(
width
*
2
-
1
)
;
wire
[
pwidth
-
1
:
0
]
pointer
;
reg
[
pwidth
-
1
:
0
]
pointer_latched
;
wire
pointer_set
;
wire
[
window_size
-
1
:
0
]
pbits
[
pwidth
-
1
:
0
]
;
genvar
jj
;
generate
for
(
ii
=
0
;
ii
<
pwidth
;
ii
=
ii
+
1
)
begin:
for_each_pointers_bit
for
(
jj
=
0
;
jj
<
window_size
;
jj
=
jj
+
1
)
begin:
calculate_encoder_mask
assign
pbits
[
ii
][
jj
]
=
jj
[
ii
]
;
end
assign
pointer
[
ii
]
=
|
(
pbits
[
ii
]
&
comma_pos
)
;
end
endgenerate
//here we are: pointer = index of a beginning of the required output data
reg
is_aligned
;
assign
outdata
=
~
RXCOMMADETEN
?
indata
:
pointer_set
?
data
[
pointer
+
width
-
1
-:
width
]
:
data
[
pointer_latched
+
width
-
1
-:
width
]
;
assign
pointer_set
=
|
comma_pos
;
assign
RXCOMMADET
=
RXCOMMADETEN
&
pointer_set
&
(
|
pcomma_match
&
ALIGN_PCOMMA_DET
==
"TRUE"
|
|
mcomma_match
&
ALIGN_MCOMMA_DET
==
"TRUE"
)
;
assign
RXBYTEISALIGNED
=
RXCOMMADETEN
&
is_aligned
;
assign
RXBYTEREALIGN
=
RXCOMMADETEN
&
is_aligned
&
pointer_set
;
always
@
(
posedge
clk
)
begin
is_aligned
<=
rst
?
1'b0
:
~
is_aligned
&
pointer_set
|
is_aligned
;
pointer_latched
<=
rst
?
1'b0
:
pointer_set
?
pointer
:
pointer_latched
;
end
endmodule
gtxe2_channel/gtxe2_chnl_rx_des.v
0 → 100644
View file @
886f1771
// 20-bit width only, for now
// assuming inclk and outclk are completely aligned (have the same source)
`include
"resync_fifo_nonsynt.v"
module
gtxe2_chnl_rx_des
#(
parameter
[
31
:
0
]
width
=
20
)
(
input
wire
reset
,
input
wire
inclk
,
input
wire
outclk
,
input
wire
indata
,
// input wire idle_in,
output
wire
[
width
-
1
:
0
]
outdata
// output wire idle_out
)
;
reg
[
31
:
0
]
bitcounter
;
reg
[
width
-
1
:
0
]
inbuffer
;
wire
empty_rd
;
wire
full_wr
;
wire
val_wr
;
wire
val_rd
;
always
@
(
posedge
inclk
)
bitcounter
<=
reset
|
bitcounter
==
(
width
-
1
)
?
32'h0
:
bitcounter
+
1'b1
;
genvar
ii
;
generate
for
(
ii
=
0
;
ii
<
width
;
ii
=
ii
+
1
)
begin:
splicing
always
@
(
posedge
inclk
)
inbuffer
[
ii
]
<=
reset
?
1'b0
:
(
bitcounter
==
ii
)
?
indata
:
inbuffer
[
ii
]
;
end
endgenerate
assign
val_rd
=
~
empty_rd
&
~
almost_empty_rd
;
assign
val_wr
=
~
full_wr
&
bitcounter
==
(
width
-
1
)
;
always
@
(
posedge
inclk
)
if
(
full_wr
)
begin
$
display
(
"FIFO in %m is full, that is not an appropriate behaviour"
)
;
$
finish
;
end
resync_fifo_nonsynt
#(
.
width
(
width
)
,
.
log_depth
(
3
)
)
fifo
(
.
rst_rd
(
reset
)
,
.
rst_wr
(
reset
)
,
.
clk_wr
(
inclk
)
,
.
val_wr
(
val_wr
)
,
.
data_wr
(
{
indata
,
inbuffer
[
width
-
2
:
0
]
}
)
,
.
clk_rd
(
outclk
)
,
.
val_rd
(
val_rd
)
,
.
data_rd
(
outdata
)
,
.
empty_rd
(
empty_rd
)
,
.
full_wr
(
full_wr
)
,
.
almost_empty_rd
(
almost_empty_rd
)
)
;
endmodule
gtxe2_channel/gtxe2_chnl_rx_oob.v
0 → 100644
View file @
886f1771
module
gtxe2_chnl_rx_oob
#(
parameter
width
=
20
,
parameter
[
2
:
0
]
SATA_BURST_VAL
=
3'b100
,
parameter
[
2
:
0
]
SATA_EIDLE_VAL
=
3'b100
,
parameter
SATA_MIN_INIT
=
12
,
parameter
SATA_MIN_WAKE
=
4
,
parameter
SATA_MAX_BURST
=
8
,
parameter
SATA_MIN_BURST
=
4
,
parameter
SATA_MAX_INIT
=
21
,
parameter
SATA_MAX_WAKE
=
7
)
(
input
wire
reset
,
input
wire
clk
,
input
wire
RXN
,
input
wire
RXP
,
input
wire
[
1
:
0
]
RXELECIDLEMODE
,
output
wire
RXELECIDLE
,
output
wire
RXCOMINITDET
,
output
wire
RXCOMWAKEDET
)
;
// parameters are not used for now
localparam
burst_min_len
=
150
;
localparam
burst_max_len
=
340
;
localparam
wake_idle_min_len
=
150
;
localparam
wake_idle_max_len
=
340
;
localparam
init_idle_min_len
=
450
;
localparam
init_idle_max_len
=
990
;
localparam
wake_bursts_cnt
=
5
;
localparam
init_bursts_cnt
=
5
;
wire
idle
;
assign
idle
=
RXN
==
RXP
;
wire
state_notrans
;
wire
state_error
;
//nostrans substate
wire
state_done
;
//notrans substate
reg
state_idle
;
reg
state_burst
;
wire
set_notrans
;
wire
set_done
;
wire
set_error
;
wire
set_idle
;
wire
set_burst
;
wire
clr_idle
;
wire
clr_burst
;
assign
state_notrans
=
~
state_idle
&
~
state_burst
;
always
@
(
posedge
clk
)
begin
state_idle
<=
(
state_idle
|
set_idle
)
&
~
reset
&
~
clr_idle
;
state_burst
<=
(
state_burst
|
set_burst
)
&
~
reset
&
~
clr_burst
;
end
assign
set_notrans
=
set_done
|
set_error
;
assign
set_idle
=
state_burst
&
clr_burst
&
idle
;
assign
set_burst
=
state_notrans
&
~
idle
|
state_idle
&
clr_idle
&
~
idle
;
assign
clr_idle
=
~
idle
|
set_notrans
;
assign
clr_burst
=
idle
|
set_notrans
;
reg
[
31
:
0
]
burst_len
;
reg
[
31
:
0
]
idle_len
;
reg
[
31
:
0
]
bursts_cnt
;
always
@
(
posedge
clk
)
begin
burst_len
<=
reset
|
~
state_burst
?
0
:
burst_len
+
1
;
idle_len
<=
reset
|
~
state_idle
?
0
:
idle_len
+
1
;
bursts_cnt
<=
reset
|
state_notrans
?
0
:
state_burst
&
clr_burst
?
bursts_cnt
+
1
:
bursts_cnt
;
end
wire
burst_len_violation
;
wire
idle_len_violation
;
wire
wake_idle_violation
;
wire
init_idle_violation
;
//reg burst_len_ok;
reg
wake_idle_ok
;
reg
init_idle_ok
;
reg
burst_len_curr_ok
;
reg
init_idle_curr_ok
;
reg
wake_idle_curr_ok
;
wire
done_wake
;
wire
done_init
;
always
@
(
posedge
clk
)
begin
wake_idle_ok
<=
reset
|
state_notrans
?
1'b1
:
wake_idle_violation
?
1'b0
:
wake_idle_ok
;
init_idle_ok
<=
reset
|
state_notrans
?
1'b1
:
init_idle_violation
?
1'b0
:
init_idle_ok
;
// burst_len_ok <= reset | state_notrans ? 1'b1 : burst_len_violation ? 1'b0 : burst_len_ok;
wake_idle_curr_ok
<=
reset
|
~
state_idle
?
1'b0
:
idle_len
==
wake_idle_min_len
?
1'b1
:
wake_idle_curr_ok
;
init_idle_curr_ok
<=
reset
|
~
state_idle
?
1'b0
:
idle_len
==
init_idle_min_len
?
1'b1
:
init_idle_curr_ok
;
burst_len_curr_ok
<=
reset
|
~
state_burst
?
1'b0
:
burst_len
==
burst_min_len
?
1'b1
:
burst_len_curr_ok
;
end
assign
burst_len_violation
=
state_burst
&
set_idle
&
~
burst_len_curr_ok
|
state_burst
&
burst_len
==
burst_max_len
;
assign
wake_idle_violation
=
state_idle
&
set_burst
&
~
wake_idle_curr_ok
|
state_idle
&
idle_len
==
wake_idle_max_len
;
assign
init_idle_violation
=
state_idle
&
set_burst
&
~
init_idle_curr_ok
|
state_idle
&
idle_len
==
init_idle_max_len
;
assign
idle_len_violation
=
(
~
wake_idle_ok
|
wake_idle_violation
)
&
init_idle_violation
|
wake_idle_violation
&
(
~
init_idle_ok
|
init_idle_violation
)
;
assign
done_wake
=
state_burst
&
~
idle
&
bursts_cnt
==
(
wake_bursts_cnt
-
1
)
&
wake_idle_ok
;
assign
done_init
=
state_burst
&
~
idle
&
bursts_cnt
==
(
init_bursts_cnt
-
1
)
&
init_idle_ok
;
assign
set_error
=
idle_len_violation
|
burst_len_violation
;
assign
set_done
=
~
set_error
&
(
done_wake
|
done_init
)
;
assign
RXCOMINITDET
=
done_init
;
assign
RXCOMWAKEDET
=
done_wake
;
endmodule
gtxe2_channel/gtxe2_chnl_tx.v
0 → 100644
View file @
886f1771
`include
"gtxe2_chnl_tx_ser.v"
`include
"gtxe2_chnl_tx_8x10enc.v"
`include
"gtxe2_chnl_tx_oob.v"
module
gtxe2_chnl_tx
(
input
wire
reset
,
output
wire
TXP
,
output
wire
TXN
,
input
wire
[
63
:
0
]
TXDATA
,
input
wire
TXUSRCLK
,
input
wire
TXUSRCLK2
,
// 8/10 encoder
input
wire
[
7
:
0
]
TX8B10BBYPASS
,
input
wire
TX8B10BEN
,
input
wire
[
7
:
0
]
TXCHARDISPMODE
,
input
wire
[
7
:
0
]
TXCHARDISPVAL
,
input
wire
[
7
:
0
]
TXCHARISK
,
// TX Buffer
output
wire
[
1
:
0
]
TXBUFSTATUS
,
// TX Polarity
input
wire
TXPOLARITY
,
// TX Fabric Clock Control
input
wire
[
2
:
0
]
TXRATE
,
output
wire
TXRATEDONE
,
// TX OOB
input
wire
TXCOMINIT
,
input
wire
TXCOMWAKE
,
output
wire
TXCOMFINISH
,
// TX Driver Control
input
wire
TXELECIDLE
,
// internal
input
wire
serial_clk
)
;
parameter
TX_DATA_WIDTH
=
20
;
parameter
TX_INT_DATAWIDTH
=
0
;
parameter
PTX8B10BEN
=
1
;
parameter
[
3
:
0
]
SATA_BURST_SEQ_LEN
=
4'b1111
;
parameter
SATA_CPLL_CFG
=
"VCO_3000MHZ"
;
function
integer
calc_idw
;
input
TX8B10BEN
;
// input TX_INT_DATAWIDTH;
// input TX_DATA_WIDTH;
begin
if
(
TX8B10BEN
==
1
)
calc_idw
=
TX_INT_DATAWIDTH
==
1
?
40
:
20
;
else
begin
if
(
TX_INT_DATAWIDTH
==
1
)
calc_idw
=
TX_DATA_WIDTH
==
32
?
32
:
TX_DATA_WIDTH
==
40
?
40
:
TX_DATA_WIDTH
==
64
?
32
:
40
;
else
calc_idw
=
TX_DATA_WIDTH
==
16
?
16
:
TX_DATA_WIDTH
==
20
?
20
:
TX_DATA_WIDTH
==
32
?
16
:
20
;
end
end
endfunction
localparam
internal_data_width
=
calc_idw
(
PTX8B10BEN
)
;
//, TX_INT_DATAWIDTH, TX_DATA_WIDTH);
// TX PMA
// serializer
wire
serial_data
;
wire
line_idle
;
wire
line_idle_pcs
;
// line_idle in pcs clock domain
wire
[
internal_data_width
-
1
:
0
]
ser_input
;
wire
oob_active
;
assign
TXP
=
~
line_idle
&
serial_data
;
assign
TXN
=
~
line_idle
&
~
serial_data
;
assign
line_idle_pcs
=
TXELECIDLE
&
~
oob_active
|
reset
;
// Serializer
wire
[
internal_data_width
-
1
:
0
]
parallel_data
;
wire
[
internal_data_width
-
1
:
0
]
inv_parallel_data
;
gtxe2_chnl_tx_ser
#(
.
width
(
internal_data_width
)
)
ser
(
.
reset
(
reset
)
,
.
inclk
(
TXUSRCLK
)
,
.
outclk
(
serial_clk
)
,
.
indata
(
inv_parallel_data
)
,
.
idle_in
(
line_idle_pcs
)
,
.
outdata
(
serial_data
)
,
.
idle_out
(
line_idle
)
)
;
// TX PCS
// invert data (get words as [abdceifghj] after 8/10, each word shall be transmitter in a reverse bit order)
genvar
ii
;
genvar
jj
;
generate
for
(
ii
=
0
;
ii
<
internal_data_width
;
ii
=
ii
+
10
)
begin:
select_each_word
for
(
jj
=
0
;
jj
<
10
;
jj
=
jj
+
1
)
begin:
reverse_bits
assign
inv_parallel_data
[
ii
+
jj
]
=
polarized_data
[
ii
+
9
-
jj
]
;
end
end
endgenerate
// Polarity:
wire
[
internal_data_width
-
1
:
0
]
polarized_data
;
assign
ser_input
=
polarized_data
;
generate
for
(
ii
=
0
;
ii
<
internal_data_width
;
ii
=
ii
+
1
)
begin:
invert_dataword
assign
polarized_data
[
ii
]
=
TXPOLARITY
==
1'b1
?
~
parallel_data
[
ii
]
:
parallel_data
[
ii
]
;
end
endgenerate
// SATA OOB
reg
disparity
;
wire
[
internal_data_width
-
1
:
0
]
oob_data
;
wire
oob_val
;
assign
oob_active
=
oob_val
;
gtxe2_chnl_tx_oob
#(
.
width
(
internal_data_width
)
)
tx_oob
(
.
TXCOMINIT
(
TXCOMINIT
)
,
.
TXCOMWAKE
(
TXCOMWAKE
)
,
.
TXCOMFINISH
(
TXCOMFINISH
)
,
.
clk
(
TXUSRCLK
)
,
.
reset
(
reset
)
,
.
disparity
(
disparity
)
,
.
outdata
(
oob_data
)
,
.
outval
(
oob_val
)
)
;
// Disparity control
wire
next_disparity
;
always
@
(
posedge
TXUSRCLK
)
disparity
<=
reset
|
line_idle_pcs
?
1'b0
:
oob_val
?
~
disparity
:
next_disparity
;
// 8/10 endoding
wire
[
internal_data_width
-
1
:
0
]
encoded_data
;
gtxe2_chnl_tx_8x10enc
#(
.
iwidth
(
16
)
,
//TX_DATA_WIDTH),
.
owidth
(
internal_data_width
)
)
encoder_8x10
(
.
TX8B10BBYPASS
(
TX8B10BBYPASS
)
,
.
TX8B10BEN
(
TX8B10BEN
)
,
.
TXCHARDISPMODE
(
TXCHARDISPMODE
)
,
.
TXCHARDISPVAL
(
TXCHARDISPVAL
)
,
.
TXCHARISK
(
TXCHARISK
)
,
.
disparity
(
disparity
)
,
.
data_in
(
TXDATA
[
15
:
0
])
,
.
data_out
(
encoded_data
)
,
.
next_disparity
(
next_disparity
)
)
;
// OOB-OrdinaryData Arbiter
assign
parallel_data
=
oob_val
?
oob_data
:
encoded_data
;
endmodule
gtxe2_channel/gtxe2_chnl_tx_8x10enc.v
0 → 100644
View file @
886f1771
module
gtxe2_chnl_tx_8x10enc
#(
parameter
iwidth
=
16
,
parameter
owidth
=
20
)
(
input
wire
[
7
:
0
]
TX8B10BBYPASS
,
input
wire
TX8B10BEN
,
input
wire
[
7
:
0
]
TXCHARDISPMODE
,
input
wire
[
7
:
0
]
TXCHARDISPVAL
,
input
wire
[
7
:
0
]
TXCHARISK
,
input
wire
disparity
,
input
wire
[
iwidth
-
1
:
0
]
data_in
,
output
wire
[
owidth
-
1
:
0
]
data_out
,
output
wire
next_disparity
)
;
// only full 8/10 encoding and width=20 case is implemented
localparam
word_count
=
owidth
/
10
;
wire
[
word_count
-
1
:
0
]
word_disparity
;
wire
[
word_count
-
1
:
0
]
interm_disparity
;
wire
[
5
:
0
]
six
[
word_count
-
1
:
0
]
;
wire
[
3
:
0
]
four
[
word_count
-
1
:
0
]
;
wire
[
owidth
-
1
:
0
]
oword
[
word_count
-
1
:
0
]
;
wire
[
iwidth
-
1
:
0
]
iword
[
word_count
-
1
:
0
]
;
wire
[
word_count
-
1
:
0
]
is_control
;
genvar
ii
;
generate
for
(
ii
=
0
;
ii
<
2
;
ii
=
ii
+
1
)
begin:
encode_by_word
assign
is_control
[
ii
]
=
TXCHARISK
[
ii
]
;
assign
iword
[
ii
]
=
data_in
[
ii
*
8
+
7
:
ii
*
8
]
;
assign
interm_disparity
[
ii
]
=
^
six
[
ii
]
?
word_disparity
[
ii
]
:
~
word_disparity
[
ii
]
;
assign
word_disparity
[
ii
]
=
(
ii
==
0
)
?
disparity
:
(
^
oword
[
ii
-
1
]
?
~
word_disparity
[
ii
-
1
]
:
word_disparity
[
ii
-
1
])
;
assign
six
[
ii
]
=
iword
[
ii
][
4
:
0
]
==
5'b00000
?
(
~
word_disparity
[
ii
]
?
6'b100111
:
6'b011000
)
:
iword
[
ii
][
4
:
0
]
==
5'b00001
?
(
~
word_disparity
[
ii
]
?
6'b011101
:
6'b100010
)
:
iword
[
ii
][
4
:
0
]
==
5'b00010
?
(
~
word_disparity
[
ii
]
?
6'b101101
:
6'b010010
)
:
iword
[
ii
][
4
:
0
]
==
5'b00011
?
(
~
word_disparity
[
ii
]
?
6'b110001
:
6'b110001
)
:
iword
[
ii
][
4
:
0
]
==
5'b00100
?
(
~
word_disparity
[
ii
]
?
6'b110101
:
6'b001010
)
:
iword
[
ii
][
4
:
0
]
==
5'b00101
?
(
~
word_disparity
[
ii
]
?
6'b101001
:
6'b101001
)
:
iword
[
ii
][
4
:
0
]
==
5'b00110
?
(
~
word_disparity
[
ii
]
?
6'b011001
:
6'b011001
)
:
iword
[
ii
][
4
:
0
]
==
5'b00111
?
(
~
word_disparity
[
ii
]
?
6'b111000
:
6'b000111
)
:
iword
[
ii
][
4
:
0
]
==
5'b01000
?
(
~
word_disparity
[
ii
]
?
6'b111001
:
6'b000110
)
:
iword
[
ii
][
4
:
0
]
==
5'b01001
?
(
~
word_disparity
[
ii
]
?
6'b100101
:
6'b100101
)
:
iword
[
ii
][
4
:
0
]
==
5'b01010
?
(
~
word_disparity
[
ii
]
?
6'b010101
:
6'b010101
)
:
iword
[
ii
][
4
:
0
]
==
5'b01011
?
(
~
word_disparity
[
ii
]
?
6'b110100
:
6'b110100
)
:
iword
[
ii
][
4
:
0
]
==
5'b01100
?
(
~
word_disparity
[
ii
]
?
6'b001101
:
6'b001101
)
:
iword
[
ii
][
4
:
0
]
==
5'b01101
?
(
~
word_disparity
[
ii
]
?
6'b101100
:
6'b101100
)
:
iword
[
ii
][
4
:
0
]
==
5'b01110
?
(
~
word_disparity
[
ii
]
?
6'b011100
:
6'b011100
)
:
iword
[
ii
][
4
:
0
]
==
5'b01111
?
(
~
word_disparity
[
ii
]
?
6'b010111
:
6'b101000
)
:
iword
[
ii
][
4
:
0
]
==
5'b10000
?
(
~
word_disparity
[
ii
]
?
6'b011011
:
6'b100100
)
:
iword
[
ii
][
4
:
0
]
==
5'b10001
?
(
~
word_disparity
[
ii
]
?
6'b100011
:
6'b100011
)
:
iword
[
ii
][
4
:
0
]
==
5'b10010
?
(
~
word_disparity
[
ii
]
?
6'b010011
:
6'b010011
)
:
iword
[
ii
][
4
:
0
]
==
5'b10011
?
(
~
word_disparity
[
ii
]
?
6'b110010
:
6'b110010
)
:
iword
[
ii
][
4
:
0
]
==
5'b10100
?
(
~
word_disparity
[
ii
]
?
6'b001011
:
6'b001011
)
:
iword
[
ii
][
4
:
0
]
==
5'b10101
?
(
~
word_disparity
[
ii
]
?
6'b101010
:
6'b101010
)
:
iword
[
ii
][
4
:
0
]
==
5'b10110
?
(
~
word_disparity
[
ii
]
?
6'b011010
:
6'b011010
)
:
iword
[
ii
][
4
:
0
]
==
5'b10111
?
(
~
word_disparity
[
ii
]
?
6'b111010
:
6'b000101
)
:
iword
[
ii
][
4
:
0
]
==
5'b11000
?
(
~
word_disparity
[
ii
]
?
6'b110011
:
6'b001100
)
:
iword
[
ii
][
4
:
0
]
==
5'b11001
?
(
~
word_disparity
[
ii
]
?
6'b100110
:
6'b100110
)
:
iword
[
ii
][
4
:
0
]
==
5'b11010
?
(
~
word_disparity
[
ii
]
?
6'b010110
:
6'b010110
)
:
iword
[
ii
][
4
:
0
]
==
5'b11011
?
(
~
word_disparity
[
ii
]
?
6'b110110
:
6'b001001
)
:
iword
[
ii
][
4
:
0
]
==
5'b11100
?
(
~
word_disparity
[
ii
]
?
6'b001110
:
6'b001110
)
:
iword
[
ii
][
4
:
0
]
==
5'b11101
?
(
~
word_disparity
[
ii
]
?
6'b101110
:
6'b010001
)
:
iword
[
ii
][
4
:
0
]
==
5'b11110
?
(
~
word_disparity
[
ii
]
?
6'b011110
:
6'b100001
)
:
/*iword[ii][4:0] == 5'b11111*/
(
~
word_disparity
[
ii
]
?
6'b101011
:
6'b010100
)
;
assign
four
[
ii
]
=
iword
[
ii
][
7
:
5
]
==
3'd0
?
(
~
interm_disparity
[
ii
]
?
4'b1011
:
4'b0100
)
:
iword
[
ii
][
7
:
5
]
==
3'd1
?
(
~
interm_disparity
[
ii
]
?
4'b1001
:
4'b1001
)
:
iword
[
ii
][
7
:
5
]
==
3'd2
?
(
~
interm_disparity
[
ii
]
?
4'b0101
:
4'b0101
)
:
iword
[
ii
][
7
:
5
]
==
3'd3
?
(
~
interm_disparity
[
ii
]
?
4'b1100
:
4'b0011
)
:
iword
[
ii
][
7
:
5
]
==
3'd4
?
(
~
interm_disparity
[
ii
]
?
4'b1101
:
4'b0010
)
:
iword
[
ii
][
7
:
5
]
==
3'd5
?
(
~
interm_disparity
[
ii
]
?
4'b1010
:
4'b1010
)
:
iword
[
ii
][
7
:
5
]
==
3'd6
?
(
~
interm_disparity
[
ii
]
?
4'b0110
:
4'b0110
)
:
/*iword[ii][7:5] == 3'd7*/
(
~
interm_disparity
[
ii
]
?
(
six
[
ii
][
1
:
0
]
==
2'b00
?
4'b1110
:
4'b0111
)
:
(
six
[
ii
][
1
:
0
]
==
2'b00
?
4'b1000
:
4'b0001
))
;
assign
oword
[
ii
]
=
~
is_control
[
ii
]
?
{
six
[
ii
]
,
four
[
ii
]
}
:
iword
[
ii
][
7
:
0
]
==
8'b00011100
?
(
~
word_disparity
[
ii
]
?
10'b0011110100
:
10'b1100001011
)
:
iword
[
ii
][
7
:
0
]
==
8'b00111100
?
(
~
word_disparity
[
ii
]
?
10'b0011111001
:
10'b1100000110
)
:
iword
[
ii
][
7
:
0
]
==
8'b01011100
?
(
~
word_disparity
[
ii
]
?
10'b0011110101
:
10'b1100001010
)
:
iword
[
ii
][
7
:
0
]
==
8'b01111100
?
(
~
word_disparity
[
ii
]
?
10'b0011110011
:
10'b1100001100
)
:
iword
[
ii
][
7
:
0
]
==
8'b10011100
?
(
~
word_disparity
[
ii
]
?
10'b0011110010
:
10'b1100001101
)
:
iword
[
ii
][
7
:
0
]
==
8'b10111100
?
(
~
word_disparity
[
ii
]
?
10'b0011111010
:
10'b1100000101
)
:
iword
[
ii
][
7
:
0
]
==
8'b11011100
?
(
~
word_disparity
[
ii
]
?
10'b0011110110
:
10'b1100001001
)
:
iword
[
ii
][
7
:
0
]
==
8'b11111100
?
(
~
word_disparity
[
ii
]
?
10'b0011111000
:
10'b1100000111
)
:
iword
[
ii
][
7
:
0
]
==
8'b11110111
?
(
~
word_disparity
[
ii
]
?
10'b1110101000
:
10'b0001010111
)
:
iword
[
ii
][
7
:
0
]
==
8'b11111011
?
(
~
word_disparity
[
ii
]
?
10'b1101101000
:
10'b0010010111
)
:
iword
[
ii
][
7
:
0
]
==
8'b11111101
?
(
~
word_disparity
[
ii
]
?
10'b1011101000
:
10'b0100010111
)
:
/*iword[ii][7:0] == 8'b11111110*/
(
~
word_disparity
[
ii
]
?
10'b0111101000
:
10'b1000010111
)
;
assign
data_out
[
ii
*
10
+
9
:
ii
*
10
]
=
oword
[
ii
]
;
end
endgenerate
assign
next_disparity
=
^
oword
[
word_count
-
1
]
?
~
word_disparity
[
word_count
-
1
]
:
word_disparity
[
word_count
-
1
]
;
endmodule
gtxe2_channel/gtxe2_chnl_tx_oob.v
0 → 100644
View file @
886f1771
module
gtxe2_chnl_tx_oob
#(
parameter
width
=
20
)
(
// top-level ifaces
input
wire
TXCOMINIT
,
input
wire
TXCOMWAKE
,
output
wire
TXCOMFINISH
,
// internal ifaces
input
wire
clk
,
input
wire
reset
,
input
wire
disparity
,
output
wire
[
width
-
1
:
0
]
outdata
,
output
wire
outval
)
;
parameter
[
3
:
0
]
SATA_BURST_SEQ_LEN
=
4'b0101
;
parameter
SATA_CPLL_CFG
=
"VCO_3000MHZ"
;
localparam
burst_len_mult
=
SATA_CPLL_CFG
==
"VCO_3000MHZ"
?
4
:
SATA_CPLL_CFG
==
"VCO_1500MHZ"
?
2
:
/* VCO_750MHZ */
1
;
localparam
burst_len
=
burst_len_mult
*
8
;
// = 106.7ns; each burst contains 16 SATA Gen1 words
localparam
quiet_len_init
=
burst_len
*
3
;
// = 320ns
localparam
quiet_len_wake
=
burst_len
;
// = 106.7ns
localparam
init_bursts_cnt
=
SATA_BURST_SEQ_LEN
;
//3;
localparam
wake_bursts_cnt
=
SATA_BURST_SEQ_LEN
;
//5;
reg
[
31
:
0
]
bursts_cnt
;
reg
[
31
:
0
]
stopwatch
;
wire
stopwatch_clr
;
wire
bursts_cnt_inc
;
wire
bursts_cnt_clr
;
wire
[
31
:
0
]
quiet_len
;
// FSM Declarations
reg
state_burst
;
reg
state_quiet
;
wire
state_idle
;
wire
set_burst
;
wire
set_quiet
;
wire
clr_burst
;
wire
clr_quiet
;
// remember what command was issued
reg
issued_init
;
reg
issued_wake
;
always
@
(
posedge
clk
)
begin
issued_init
<=
reset
|
TXCOMFINISH
|
issued_wake
?
1'b0
:
TXCOMINIT
?
1'b1
:
state_idle
?
1'b0
:
issued_init
;
issued_wake
<=
reset
|
TXCOMFINISH
|
issued_init
?
1'b0
:
TXCOMWAKE
?
1'b1
:
state_idle
?
1'b0
:
issued_wake
;
end
wire
[
31
:
0
]
bursts_cnt_togo
;
assign
bursts_cnt_togo
=
issued_wake
?
wake_bursts_cnt
:
init_bursts_cnt
;
// FSM
assign
state_idle
=
~
state_burst
&
~
state_quiet
;
always
@
(
posedge
clk
)
begin
state_burst
<=
(
state_burst
|
set_burst
)
&
~
reset
&
~
clr_burst
;
state_quiet
<=
(
state_quiet
|
set_quiet
)
&
~
reset
&
~
clr_quiet
;
end
assign
set_burst
=
state_idle
&
(
TXCOMINIT
|
TXCOMWAKE
)
|
state_quiet
&
clr_quiet
&
~
TXCOMFINISH
;
assign
set_quiet
=
state_burst
&
(
bursts_cnt
<
bursts_cnt_togo
-
1
)
&
clr_burst
;
assign
clr_burst
=
state_burst
&
stopwatch
==
burst_len
;
assign
clr_quiet
=
state_quiet
&
stopwatch
==
quiet_len
;
// bursts timing
assign
quiet_len
=
issued_wake
?
quiet_len_wake
:
quiet_len_init
;
assign
stopwatch_clr
=
set_burst
|
set_quiet
|
state_idle
;
always
@
(
posedge
clk
)
stopwatch
<=
reset
|
stopwatch_clr
?
0
:
stopwatch
+
burst_len_mult
;
// total bursts count
assign
bursts_cnt_clr
=
state_idle
;
assign
bursts_cnt_inc
=
state_burst
&
clr_burst
;
always
@
(
posedge
clk
)
bursts_cnt
<=
reset
|
bursts_cnt_clr
?
0
:
bursts_cnt_inc
?
bursts_cnt
+
1
:
bursts_cnt
;
// data to serializer
// only datawidth = 20 is supported for now
wire
[
width
-
1
:
0
]
outdata_pos
;
wire
[
width
-
1
:
0
]
outdata_neg
;
// outdata = {Align2 + Align1}, disparity always flips
assign
outdata_pos
=
stopwatch
[
0
]
==
1'b0
?
{
10'b0101010101
,
10'b1100000101
}
:
{
10'b1101100011
,
10'b0101010101
};
assign
outdata_neg
=
stopwatch
[
0
]
==
1'b0
?
{
10'b0101010101
,
10'b0011111010
}
:
{
10'b0010011100
,
10'b0101010101
};
assign
outdata
=
disparity
?
outdata_pos
:
outdata_neg
;
assign
outval
=
state_burst
;
assign
TXCOMFINISH
=
bursts_cnt_clr
&
bursts_cnt
==
bursts_cnt_togo
;
endmodule
gtxe2_channel/gtxe2_chnl_tx_ser.v
0 → 100644
View file @
886f1771
// 20-bit width only, for now
// assuming inclk and outclk are completely aligned (have the same source)
`include
"resync_fifo_nonsynt.v"
module
gtxe2_chnl_tx_ser
#(
parameter
[
31
:
0
]
width
=
20
)
(
input
wire
reset
,
input
wire
inclk
,
input
wire
outclk
,
input
wire
[
width
-
1
:
0
]
indata
,
input
wire
idle_in
,
output
wire
outdata
,
output
wire
idle_out
)
;
reg
[
31
:
0
]
bitcounter
;
wire
[
width
-
1
:
0
]
data_resynced
;
wire
almost_empty_rd
;
wire
empty_rd
;
wire
full_wr
;
wire
val_rd
;
always
@
(
posedge
outclk
)
bitcounter
<=
reset
|
bitcounter
==
(
width
-
1
)
?
32'h0
:
bitcounter
+
1'b1
;
assign
outdata
=
data_resynced
[
bitcounter
]
;
assign
val_rd
=
~
almost_empty_rd
&
~
empty_rd
&
bitcounter
==
(
width
-
1
)
;
resync_fifo_nonsynt
#(
.
width
(
width
+
1
)
,
// +1 is for a flag of an idle line (both TXP and TXN = 0)
.
log_depth
(
3
)
)
fifo
(
.
rst_rd
(
reset
)
,
.
rst_wr
(
reset
)
,
.
clk_wr
(
inclk
)
,
.
val_wr
(
1'b1
)
,
.
data_wr
(
{
idle_in
,
indata
}
)
,
.
clk_rd
(
outclk
)
,
.
val_rd
(
val_rd
)
,
.
data_rd
(
{
idle_out
,
data_resynced
}
)
,
.
empty_rd
(
empty_rd
)
,
.
full_wr
(
full_wr
)
,
.
almost_empty_rd
(
almost_empty_rd
)
)
;
endmodule
gtxe2_channel/resync_fifo_nonsynt.v
0 → 100644
View file @
886f1771
// simplified resynchronisation fifo, could cause metastability
// because of that shall not be syntesisable
// TODO add shift registers and gray code to fix that
`ifndef
RESYNC_FIFO_NOSYNT_V
`define
RESYNC_FIFO_NOSYNT_V
module
resync_fifo_nonsynt
#(
parameter
[
31
:
0
]
width
=
20
,
//parameter [31:0] depth = 7
parameter
[
31
:
0
]
log_depth
=
3
)
(
input
wire
rst_rd
,
input
wire
rst_wr
,
input
wire
clk_wr
,
input
wire
val_wr
,
input
wire
[
width
-
1
:
0
]
data_wr
,
input
wire
clk_rd
,
input
wire
val_rd
,
output
wire
[
width
-
1
:
0
]
data_rd
,
output
wire
empty_rd
,
output
wire
almost_empty_rd
,
output
wire
full_wr
)
;
/*
function integer clogb2;
input [31:0] value;
begin
value = value - 1;
for (clogb2 = 0; value > 0; clogb2 = clogb2 + 1) begin
value = value >> 1;
end
end
endfunction
localparam log_depth = clogb2(depth);
*/
localparam
depth
=
1
<<
log_depth
;
reg
[
width
-
1
:
0
]
fifo
[
depth
-
1
:
0
]
;
// wr_clk domain
reg
[
log_depth
-
1
:
0
]
cnt_wr
;
// rd_clk domain
reg
[
log_depth
-
1
:
0
]
cnt_rd
;
assign
data_rd
=
fifo
[
cnt_rd
]
;
assign
empty_rd
=
cnt_wr
==
cnt_rd
;
assign
full_wr
=
(
cnt_wr
+
1'b1
)
==
cnt_rd
;
assign
almost_empty_rd
=
(
cnt_rd
+
1'b1
)
==
cnt_wr
;
always
@
(
posedge
clk_wr
)
fifo
[
cnt_wr
]
<=
val_wr
?
data_wr
:
fifo
[
cnt_wr
]
;
always
@
(
posedge
clk_wr
)
cnt_wr
<=
rst_wr
?
0
:
val_wr
?
cnt_wr
+
1'b1
:
cnt_wr
;
always
@
(
posedge
clk_rd
)
cnt_rd
<=
rst_rd
?
0
:
val_rd
?
cnt_rd
+
1'b1
:
cnt_rd
;
endmodule
`endif
gtxe2_common/gtxe2_comm_clocking.v
0 → 100644
View file @
886f1771
`include
"gtxe2_comm_qpll_inmux.v"
`include
"gtxe2_comm_qpll.v"
module
gtxe2_comm_clocking
(
// top-level interfaces
input
wire
[
2
:
0
]
QPLLREFCLKSEL
,
input
wire
GTREFCLK0
,
input
wire
GTREFCLK1
,
input
wire
GTNORTHREFCLK0
,
input
wire
GTNORTHREFCLK1
,
input
wire
GTSOUTHREFCLK0
,
input
wire
GTSOUTHREFCLK1
,
input
wire
GTGREFCLK
,
output
wire
QPLLOUTCLK
,
output
wire
QPLLOUTREFCLK
,
output
wire
REFCLKOUTMONITOR
,
input
wire
QPLLLOCKDETCLK
,
input
wire
QPLLLOCKEN
,
input
wire
QPLLPD
,
input
wire
QPLLRESET
,
output
wire
QPLLFBCLKLOST
,
output
wire
QPLLLOCK
,
output
wire
QPLLREFCLKLOST
)
;
wire
clk_mux_out
;
wire
qpll_clk_out
;
//TODO
assign
REFCLKOUTMONITOR
=
clk_mux_out
;
assign
QPLLOUTREFCLK
=
clk_mux_out
;
assign
QPLLOUTCLK
=
qpll_clk_out
;
gtxe2_comm_qpll_inmux
clk_mux
(
.
QPLLREFCLKSEL
(
QPLLREFCLKSEL
)
,
.
GTREFCLK0
(
GTREFCLK0
)
,
.
GTREFCLK1
(
GTREFCLK1
)
,
.
GTNORTHREFCLK0
(
GTNORTHREFCLK0
)
,
.
GTNORTHREFCLK1
(
GTNORTHREFCLK1
)
,
.
GTSOUTHREFCLK0
(
GTSOUTHREFCLK0
)
,
.
GTSOUTHREFCLK1
(
GTSOUTHREFCLK1
)
,
.
GTGREFCLK
(
GTGREFCLK
)
,
.
QPLL_MUX_CLK_OUT
(
clk_mux_out
)
)
;
gtxe2_comm_qpll
qpll
(
.
QPLLLOCKDETCLK
(
QPLLLOCKDETCLK
)
,
.
QPLLLOCKEN
(
QPLLLOCKEN
)
,
.
QPLLPD
(
QPLLPD
)
,
.
QPLLRESET
(
QPLLRESET
)
,
.
QPLLFBCLKLOST
(
QPLLFBCLKLOST
)
,
.
QPLLLOCK
(
QPLLLOCK
)
,
.
QPLLREFCLKLOST
(
QPLLREFCLKLOST
)
,
.
GTRSVD
(
GTRSVD
)
,
.
PCSRSVDIN
(
PCSRSVDIN
)
,
.
PCSRSVDIN2
(
PCSRSVDIN2
)
,
.
PMARSVDIN
(
PMARSVDIN
)
,
.
PMARSVDIN2
(
PMARSVDIN2
)
,
.
TSTIN
(
TSTIN
)
,
.
TSTOUT
(
TSTOUT
)
,
.
ref_clk
(
clk_mux_out
)
,
.
clk_out
(
qpll_clk_out
)
,
.
pll_locked
(
pll_locked
)
)
;
endmodule
gtxe2_common/gtxe2_comm_qpll.v
0 → 100644
View file @
886f1771
`include
"gtxe2_comm_qpll_def.v"
module
gtxe2_comm_qpll
(
// top-level interfaces
input
wire
QPLLLOCKDETCLK
,
// shall not be used here
input
wire
QPLLLOCKEN
,
input
wire
QPLLPD
,
input
wire
QPLLRESET
,
// active high
output
wire
QPLLFBCLKLOST
,
output
wire
QPLLLOCK
,
output
wire
QPLLREFCLKLOST
,
input
wire
GTRSVD
,
input
wire
PCSRSVDIN
,
input
wire
PCSRSVDIN2
,
input
wire
PMARSVDIN
,
input
wire
PMARSVDIN2
,
input
wire
TSTIN
,
output
wire
TSTOUT
,
// internal
input
wire
ref_clk
,
output
wire
clk_out
,
output
wire
pll_locked
// equals QPLLLOCK
)
;
parameter
[
23
:
0
]
QPLL_CFG
=
27'h04801C7
;
parameter
integer
QPLL_FBDIV
=
10'b0000100000
;
parameter
integer
QPLL_FBDIV_45
=
1
;
parameter
[
23
:
0
]
QPLL_INIT_CFG
=
24'h000006
;
parameter
[
15
:
0
]
QPLL_LOCK_CFG
=
16'h05E8
;
parameter
integer
QPLL_REFCLK_DIV
=
1
;
parameter
integer
RXOUT_DIV
=
1
;
parameter
integer
TXOUT_DIV
=
1
;
parameter
SATA_QPLL_CFG
=
"VCO_3000MHZ"
;
parameter
[
1
:
0
]
PMA_RSV3
=
1
;
localparam
multiplier
=
QPLL_FBDIV
*
QPLL_FBDIV_45
;
localparam
divider
=
QPLL_REFCLK_DIV
;
assign
QPLLLOCK
=
pll_locked
;
wire
fb_clk_out
;
wire
reset
;
reg
mult_clk
;
reg
mult_dev_clk
;
assign
clk_out
=
mult_dev_clk
;
// generate internal async reset
assign
reset
=
QPLLPD
|
QPLLRESET
;
// apply multipliers
time
last_edge
;
// reference clock edge's absolute time
time
period
;
// reference clock's period
integer
locked_f
;
reg
locked
;
initial
begin
last_edge
=
0
;
period
=
0
;
forever
@
(
posedge
ref_clk
or
posedge
reset
)
begin
period
=
reset
?
0
:
$
time
-
last_edge
;
last_edge
=
reset
?
0
:
$
time
;
end
end
initial
forever
@
(
posedge
ref_clk
)
begin
if
(
period
>
0
)
begin
locked_f
=
1
;
mult_clk
=
1'b1
;
repeat
(
multiplier
*
2
-
1
)
begin
#(
period
/
multiplier
/
2
)
mult_clk
=
~
mult_clk
;
end
end
else
locked_f
=
0
;
end
// apply dividers
initial
begin
mult_dev_clk
=
1'b1
;
forever
begin
repeat
(
divider
)
@
(
mult_clk
)
;
mult_dev_clk
=
~
mult_dev_clk
;
end
end
// show if 'pll' is locked
always
@
(
posedge
ref_clk
or
posedge
reset
)
begin
if
(
locked_f
==
1
&&
~
reset
)
begin
#
`GTXE2_COMM_QPLL_LOCK_TIME
;
locked
<=
1'b1
;
end
else
locked
<=
1'b0
;
end
endmodule
gtxe2_common/gtxe2_comm_qpll_def.v
0 → 100644
View file @
886f1771
`define
GTXE2_COMM_QPLL_LOCK_TIME
100
gtxe2_common/gtxe2_comm_qpll_inmux.v
0 → 100644
View file @
886f1771
module
gtxe2_comm_qpll_inmux
(
input
wire
[
2
:
0
]
QPLLREFCLKSEL
,
input
wire
GTREFCLK0
,
input
wire
GTREFCLK1
,
input
wire
GTNORTHREFCLK0
,
input
wire
GTNORTHREFCLK1
,
input
wire
GTSOUTHREFCLK0
,
input
wire
GTSOUTHREFCLK1
,
input
wire
GTGREFCLK
,
output
wire
QPLL_MUX_CLK_OUT
)
;
// clock multiplexer - pre-syntesis simulation only
assign
QPLL_MUX_CLK_OUT
=
QPLLREFCLKSEL
==
3'b000
?
1'b0
// reserved
:
QPLLREFCLKSEL
==
3'b001
?
GTREFCLK0
:
QPLLREFCLKSEL
==
3'b010
?
GTREFCLK1
:
QPLLREFCLKSEL
==
3'b011
?
GTNORTHREFCLK0
:
QPLLREFCLKSEL
==
3'b100
?
GTNORTHREFCLK1
:
QPLLREFCLKSEL
==
3'b101
?
GTSOUTHREFCLK0
:
QPLLREFCLKSEL
==
3'b110
?
GTSOUTHREFCLK1
:
/*CPLLREFCLKSEL == 3'b111 ?*/
GTGREFCLK
;
endmodule
tb/tb.v
0 → 100644
View file @
886f1771
`timescale
1
ps
/
1
ps
//`include "gtxe2_top.v"
//`include "gtx_sata_2.v"
`include
"GTXE2_CHANNEL.v"
`include
"test.v"
module
tb
()
;
wire
reset
;
wire
TXP
;
wire
TXN
;
wire
[
63
:
0
]
TXDATA
;
wire
TXUSRCLK
;
wire
TXUSRCLK2
;
wire
[
7
:
0
]
TX8B10BBYPASS
;
wire
TX8B10BEN
;
wire
[
7
:
0
]
TXCHARDISPMODE
;
wire
[
7
:
0
]
TXCHARDISPVAL
;
wire
[
7
:
0
]
TXCHARISK
;
wire
[
1
:
0
]
TXBUFSTATUS
;
wire
TXPOLARITY
;
wire
[
2
:
0
]
TXRATE
;
wire
[
2
:
0
]
RXRATE
;
wire
TXRATEDONE
;
wire
TXCOMINIT
;
wire
TXCOMWAKE
;
wire
TXCOMFINISH
;
wire
TXELECIDLE
;
wire
RXP
;
wire
RXN
;
wire
RXUSRCLK
;
wire
RXUSRCLK2
;
wire
[
63
:
0
]
RXDATA
;
wire
[
1
:
0
]
RXELECIDLEMODE
;
wire
RXELECIDLE
;
wire
RXCOMINITDET
;
wire
RXCOMWAKEDET
;
wire
RXPOLARITY
;
wire
RXBYTEISALIGNED
;
wire
RXBYTEREALIGN
;
wire
RXCOMMADET
;
wire
RXCOMMADETEN
;
wire
RXPCOMMAALIGNEN
;
wire
RXMCOMMAALIGNEN
;
wire
RX8B10BEN
;
wire
[
7
:
0
]
RXCHARISCOMMA
;
wire
[
7
:
0
]
RXCHARISK
;
wire
[
7
:
0
]
RXDISPERR
;
wire
[
7
:
0
]
RXNOTINTABLE
;
wire
[
2
:
0
]
CPLLREFCLKSEL
;
wire
GTREFCLK0
;
wire
GTREFCLK1
;
wire
GTNORTHREFCLK0
;
wire
GTNORTHREFCLK1
;
wire
GTSOUTHREFCLK0
;
wire
GTSOUTHREFCLK1
;
wire
GTGREFCLK
;
wire
[
1
:
0
]
RXSYSCLKSEL
;
wire
[
1
:
0
]
TXSYSCLKSEL
;
wire
[
2
:
0
]
TXOUTCLKSEL
;
wire
[
2
:
0
]
RXOUTCLKSEL
;
wire
TXDLYBYPASS
;
wire
GTREFCLKMONITOR
;
wire
CPLLLOCKDETCLK
;
wire
CPLLLOCKEN
;
wire
CPLLPD
;
wire
CPLLRESET
;
wire
CPLLFBCLKLOST
;
wire
CPLLLOCK
;
wire
CPLLREFCLKLOST
;
wire
TXOUTCLKPMA
;
wire
TXOUTCLKPCS
;
wire
TXOUTCLK
;
wire
TXOUTCLKFABRIC
;
wire
tx_serial_clk
;
wire
RXOUTCLKPMA
;
wire
RXOUTCLKPCS
;
wire
RXOUTCLK
;
wire
RXOUTCLKFABRIC
;
wire
rx_serial_clk
;
wire
[
2
:
0
]
QPLLREFCLKSEL
;
wire
QPLLOUTCLK
;
wire
QPLLOUTREFCLK
;
wire
QPLLLOCKDETCLK
;
wire
QPLLLOCKEN
;
wire
QPLLPD
;
wire
QPLLRESET
;
wire
QPLLFBCLKLOST
;
wire
QPLLLOCK
;
wire
QPLLREFCLKLOST
;
wire
TXUSERRDY
;
wire
RXUSERRDY
;
wire
RXDFELFHOLD
;
wire
RXDFEAGCHOLD
;
wire
RXRESETDONE
;
wire
TXRESETDONE
;
test
test
(
.
reset
(
reset
)
,
.
TXP
(
TXP
)
,
.
TXN
(
TXN
)
,
.
TXDATA
(
TXDATA
)
,
.
TXUSRCLK
(
TXUSRCLK
)
,
.
TXUSRCLK2
(
TXUSRCLK2
)
,
.
TX8B10BBYPASS
(
TX8B10BBYPASS
)
,
.
TX8B10BEN
(
TX8B10BEN
)
,
.
TXCHARDISPMODE
(
TXCHARDISPMODE
)
,
.
TXCHARDISPVAL
(
TXCHARDISPVAL
)
,
.
TXCHARISK
(
TXCHARISK
)
,
.
TXBUFSTATUS
(
TXBUFSTATUS
)
,
.
TXPOLARITY
(
TXPOLARITY
)
,
.
TXRATE
(
TXRATE
)
,
.
RXRATE
(
RXRATE
)
,
.
TXRATEDONE
(
TXRATEDONE
)
,
.
TXCOMINIT
(
TXCOMINIT
)
,
.
TXCOMWAKE
(
TXCOMWAKE
)
,
.
TXCOMFINISH
(
TXCOMFINISH
)
,
.
TXELECIDLE
(
TXELECIDLE
)
,
.
RXP
(
RXP
)
,
.
RXN
(
RXN
)
,
.
RXUSRCLK
(
RXUSRCLK
)
,
.
RXUSRCLK2
(
RXUSRCLK2
)
,
.
RXDATA
(
RXDATA
)
,
.
RXELECIDLEMODE
(
RXELECIDLEMODE
)
,
.
RXELECIDLE
(
RXELECIDLE
)
,
.
RXCOMINITDET
(
RXCOMINITDET
)
,
.
RXCOMWAKEDET
(
RXCOMWAKEDET
)
,
.
RXPOLARITY
(
RXPOLARITY
)
,
.
RXBYTEISALIGNED
(
RXBYTEISALIGNED
)
,
.
RXBYTEREALIGN
(
RXBYTEREALIGN
)
,
.
RXCOMMADET
(
RXCOMMADET
)
,
.
RXCOMMADETEN
(
RXCOMMADETEN
)
,
.
RXPCOMMAALIGNEN
(
RXPCOMMAALIGNEN
)
,
.
RXMCOMMAALIGNEN
(
RXMCOMMAALIGNEN
)
,
.
RX8B10BEN
(
RX8B10BEN
)
,
.
RXCHARISCOMMA
(
RXCHARISCOMMA
)
,
.
RXCHARISK
(
RXCHARISK
)
,
.
RXDISPERR
(
RXDISPERR
)
,
.
RXNOTINTABLE
(
RXNOTINTABLE
)
,
.
RXUSERRDY
(
RXUSERRDY
)
,
.
TXUSERRDY
(
TXUSERRDY
)
,
.
CPLLREFCLKSEL
(
CPLLREFCLKSEL
)
,
.
GTREFCLK0
(
GTREFCLK0
)
,
.
GTREFCLK1
(
GTREFCLK1
)
,
.
GTNORTHREFCLK0
(
GTNORTHREFCLK0
)
,
.
GTNORTHREFCLK1
(
GTNORTHREFCLK1
)
,
.
GTSOUTHREFCLK0
(
GTSOUTHREFCLK0
)
,
.
GTSOUTHREFCLK1
(
GTSOUTHREFCLK1
)
,
.
GTGREFCLK
(
GTGREFCLK
)
,
.
RXSYSCLKSEL
(
RXSYSCLKSEL
)
,
.
TXSYSCLKSEL
(
TXSYSCLKSEL
)
,
.
TXOUTCLKSEL
(
TXOUTCLKSEL
)
,
.
RXOUTCLKSEL
(
RXOUTCLKSEL
)
,
.
TXDLYBYPASS
(
TXDLYBYPASS
)
,
.
GTREFCLKMONITOR
(
GTREFCLKMONITOR
)
,
.
CPLLLOCKDETCLK
(
CPLLLOCKDETCLK
)
,
.
CPLLLOCKEN
(
CPLLLOCKEN
)
,
.
CPLLPD
(
CPLLPD
)
,
.
CPLLRESET
(
CPLLRESET
)
,
.
CPLLFBCLKLOST
(
CPLLFBCLKLOST
)
,
.
CPLLLOCK
(
CPLLLOCK
)
,
.
CPLLREFCLKLOST
(
CPLLREFCLKLOST
)
,
.
TXOUTCLKPMA
(
TXOUTCLKPMA
)
,
.
TXOUTCLKPCS
(
TXOUTCLKPCS
)
,
.
TXOUTCLK
(
TXOUTCLK
)
,
.
TXOUTCLKFABRIC
(
TXOUTCLKFABRIC
)
,
.
tx_serial_clk
(
tx_serial_clk
)
,
.
RXOUTCLKPMA
(
RXOUTCLKPMA
)
,
.
RXOUTCLKPCS
(
RXOUTCLKPCS
)
,
.
RXOUTCLK
(
RXOUTCLK
)
,
.
RXOUTCLKFABRIC
(
RXOUTCLKFABRIC
)
,
.
rx_serial_clk
(
rx_serial_clk
)
,
.
QPLLREFCLKSEL
(
QPLLREFCLKSEL
)
,
.
QPLLOUTCLK
(
QPLLOUTCLK
)
,
.
QPLLOUTREFCLK
(
QPLLOUTREFCLK
)
,
.
QPLLLOCKDETCLK
(
QPLLLOCKDETCLK
)
,
.
QPLLLOCKEN
(
QPLLLOCKEN
)
,
.
QPLLPD
(
QPLLPD
)
,
.
QPLLRESET
(
QPLLRESET
)
,
.
QPLLFBCLKLOST
(
QPLLFBCLKLOST
)
,
.
QPLLLOCK
(
QPLLLOCK
)
,
.
QPLLREFCLKLOST
(
QPLLREFCLKLOST
)
,
.
RXDFELFHOLD
(
RXDFELFHOLD
)
,
.
RXDFEAGCHOLD
(
RXDFEAGCHOLD
)
,
.
TXRESETDONE
(
TXRESETDONE
)
,
.
RXRESETDONE
(
RXRESETDONE
)
)
;
/*
gtxe2_top dut(
.reset (reset),
.TXP (TXP),
.TXN (TXN),
.TXDATA (TXDATA),
.TXUSRCLK (TXUSRCLK),
.TXUSRCLK2 (TXUSRCLK2),
.TX8B10BBYPASS (TX8B10BBYPASS),
.TX8B10BEN (TX8B10BEN),
.TXCHARDISPMODE (TXCHARDISPMODE),
.TXCHARDISPVAL (TXCHARDISPVAL),
.TXCHARISK (TXCHARISK),
.TXBUFSTATUS (TXBUFSTATUS),
.TXPOLARITY (TXPOLARITY),
.TXRATE (TXRATE),
.RXRATE (RXRATE),
.TXRATEDONE (TXRATEDONE),
.TXCOMINIT (TXCOMINIT),
.TXCOMWAKE (TXCOMWAKE),
.TXCOMFINISH (TXCOMFINISH),
.TXELECIDLE (TXELECIDLE),
.RXP (RXP),
.RXN (RXN),
.RXUSRCLK (RXUSRCLK),
.RXUSRCLK2 (RXUSRCLK2),
.RXDATA (RXDATA),
.RXELECIDLEMODE (RXELECIDLEMODE),
.RXELECIDLE (RXELECIDLE),
.RXCOMINITDET (RXCOMINITDET),
.RXCOMWAKEDET (RXCOMWAKEDET),
.RXPOLARITY (RXPOLARITY),
.RXBYTEISALIGNED (RXBYTEISALIGNED),
.RXBYTEREALIGN (RXBYTEREALIGN),
.RXCOMMADET (RXCOMMADET),
.RXCOMMADETEN (RXCOMMADETEN),
.RXPCOMMAALIGNEN (RXPCOMMAALIGNEN),
.RXMCOMMAALIGNEN (RXMCOMMAALIGNEN),
.RX8B10BEN (RX8B10BEN),
.RXCHARISCOMMA (RXCHARISCOMMA),
.RXCHARISK (RXCHARISK),
.RXDISPERR (RXDISPERR),
.RXNOTINTABLE (RXNOTINTABLE),
.CPLLREFCLKSEL (CPLLREFCLKSEL),
.GTREFCLK0 (GTREFCLK0),
.GTREFCLK1 (GTREFCLK1),
.GTNORTHREFCLK0 (GTNORTHREFCLK0),
.GTNORTHREFCLK1 (GTNORTHREFCLK1),
.GTSOUTHREFCLK0 (GTSOUTHREFCLK0),
.GTSOUTHREFCLK1 (GTSOUTHREFCLK1),
.GTGREFCLK (GTGREFCLK),
.RXSYSCLKSEL (RXSYSCLKSEL),
.TXSYSCLKSEL (TXSYSCLKSEL),
.TXOUTCLKSEL (TXOUTCLKSEL),
.RXOUTCLKSEL (RXOUTCLKSEL),
.TXDLYBYPASS (TXDLYBYPASS),
.GTREFCLKMONITOR (GTREFCLKMONITOR),
.CPLLLOCKDETCLK (CPLLLOCKDETCLK ),
.CPLLLOCKEN (CPLLLOCKEN),
.CPLLPD (CPLLPD),
.CPLLRESET (CPLLRESET),
.CPLLFBCLKLOST (CPLLFBCLKLOST),
.CPLLLOCK (CPLLLOCK),
.CPLLREFCLKLOST (CPLLREFCLKLOST),
.TXOUTCLKPMA (TXOUTCLKPMA),
.TXOUTCLKPCS (TXOUTCLKPCS),
.TXOUTCLK (TXOUTCLK),
.TXOUTCLKFABRIC (TXOUTCLKFABRIC),
.tx_serial_clk (tx_serial_clk),
.RXOUTCLKPMA (RXOUTCLKPMA),
.RXOUTCLKPCS (RXOUTCLKPCS),
.RXOUTCLK (RXOUTCLK),
.RXOUTCLKFABRIC (RXOUTCLKFABRIC),
.rx_serial_clk (rx_serial_clk),
.QPLLREFCLKSEL (QPLLREFCLKSEL),
.QPLLOUTCLK (QPLLOUTCLK),
.QPLLOUTREFCLK (QPLLOUTREFCLK),
.QPLLLOCKDETCLK (QPLLLOCKDETCLK ),
.QPLLLOCKEN (QPLLLOCKEN),
.QPLLPD (QPLLPD),
.QPLLRESET (QPLLRESET),
.QPLLFBCLKLOST (QPLLFBCLKLOST),
.QPLLLOCK (QPLLLOCK),
.QPLLREFCLKLOST (QPLLREFCLKLOST)
);
*/
wire
tied_to_vcc_i
=
1'b1
;
wire
tied_to_ground_i
=
1'b0
;
wire
[
31
:
0
]
tied_to_ground_vec_i
=
32'h00000000
;
GTXE2_CHANNEL
#
(
//_______________________ Simulation-Only Attributes __________________
.
SIM_RECEIVER_DETECT_PASS
(
"TRUE"
)
,
.
SIM_TX_EIDLE_DRIVE_LEVEL
(
"X"
)
,
.
SIM_RESET_SPEEDUP
(
"FALSE"
)
,
.
SIM_CPLLREFCLK_SEL
(
3'b001
)
,
.
SIM_VERSION
(
"4.0"
)
,
//----------------RX Byte and Word Alignment Attributes---------------
.
ALIGN_COMMA_DOUBLE
(
"FALSE"
)
,
.
ALIGN_COMMA_ENABLE
(
10'b1111111111
)
,
.
ALIGN_COMMA_WORD
(
1
)
,
.
ALIGN_MCOMMA_DET
(
"TRUE"
)
,
.
ALIGN_MCOMMA_VALUE
(
10'b1010000011
)
,
.
ALIGN_PCOMMA_DET
(
"TRUE"
)
,
.
ALIGN_PCOMMA_VALUE
(
10'b0101111100
)
,
.
SHOW_REALIGN_COMMA
(
"TRUE"
)
,
.
RXSLIDE_AUTO_WAIT
(
7
)
,
.
RXSLIDE_MODE
(
"OFF"
)
,
.
RX_SIG_VALID_DLY
(
10
)
,
//----------------RX 8B/10B Decoder Attributes---------------
.
RX_DISPERR_SEQ_MATCH
(
"TRUE"
)
,
.
DEC_MCOMMA_DETECT
(
"TRUE"
)
,
.
DEC_PCOMMA_DETECT
(
"TRUE"
)
,
.
DEC_VALID_COMMA_ONLY
(
"FALSE"
)
,
//----------------------RX Clock Correction Attributes----------------------
.
CBCC_DATA_SOURCE_SEL
(
"DECODED"
)
,
.
CLK_COR_SEQ_2_USE
(
"FALSE"
)
,
.
CLK_COR_KEEP_IDLE
(
"FALSE"
)
,
.
CLK_COR_MAX_LAT
(
9
)
,
.
CLK_COR_MIN_LAT
(
7
)
,
.
CLK_COR_PRECEDENCE
(
"TRUE"
)
,
.
CLK_COR_REPEAT_WAIT
(
0
)
,
.
CLK_COR_SEQ_LEN
(
1
)
,
.
CLK_COR_SEQ_1_ENABLE
(
4'b1111
)
,
.
CLK_COR_SEQ_1_1
(
10'b0100000000
)
,
.
CLK_COR_SEQ_1_2
(
10'b0000000000
)
,
.
CLK_COR_SEQ_1_3
(
10'b0000000000
)
,
.
CLK_COR_SEQ_1_4
(
10'b0000000000
)
,
.
CLK_CORRECT_USE
(
"FALSE"
)
,
.
CLK_COR_SEQ_2_ENABLE
(
4'b1111
)
,
.
CLK_COR_SEQ_2_1
(
10'b0100000000
)
,
.
CLK_COR_SEQ_2_2
(
10'b0000000000
)
,
.
CLK_COR_SEQ_2_3
(
10'b0000000000
)
,
.
CLK_COR_SEQ_2_4
(
10'b0000000000
)
,
//----------------------RX Channel Bonding Attributes----------------------
.
CHAN_BOND_KEEP_ALIGN
(
"FALSE"
)
,
.
CHAN_BOND_MAX_SKEW
(
1
)
,
.
CHAN_BOND_SEQ_LEN
(
1
)
,
.
CHAN_BOND_SEQ_1_1
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_1_2
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_1_3
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_1_4
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_1_ENABLE
(
4'b1111
)
,
.
CHAN_BOND_SEQ_2_1
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_2_2
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_2_3
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_2_4
(
10'b0000000000
)
,
.
CHAN_BOND_SEQ_2_ENABLE
(
4'b1111
)
,
.
CHAN_BOND_SEQ_2_USE
(
"FALSE"
)
,
.
FTS_DESKEW_SEQ_ENABLE
(
4'b1111
)
,
.
FTS_LANE_DESKEW_CFG
(
4'b1111
)
,
.
FTS_LANE_DESKEW_EN
(
"FALSE"
)
,
//-------------------------RX Margin Analysis Attributes----------------------------
.
ES_CONTROL
(
6'b000000
)
,
.
ES_ERRDET_EN
(
"FALSE"
)
,
.
ES_EYE_SCAN_EN
(
"TRUE"
)
,
.
ES_HORZ_OFFSET
(
12'h000
)
,
.
ES_PMA_CFG
(
10'b0000000000
)
,
.
ES_PRESCALE
(
5'b00000
)
,
.
ES_QUALIFIER
(
80'h00000000000000000000
)
,
.
ES_QUAL_MASK
(
80'h00000000000000000000
)
,
.
ES_SDATA_MASK
(
80'h00000000000000000000
)
,
.
ES_VERT_OFFSET
(
9'b000000000
)
,
//-----------------------FPGA RX Interface Attributes-------------------------
.
RX_DATA_WIDTH
(
20
)
,
//-------------------------PMA Attributes----------------------------
.
OUTREFCLK_SEL_INV
(
2'b11
)
,
.
PMA_RSV
(
32'h00018480
)
,
.
PMA_RSV2
(
16'h2050
)
,
.
PMA_RSV3
(
2'b00
)
,
.
PMA_RSV4
(
32'h00000000
)
,
.
RX_BIAS_CFG
(
12'b000000000100
)
,
.
DMONITOR_CFG
(
24'h000A00
)
,
.
RX_CM_SEL
(
2'b11
)
,
.
RX_CM_TRIM
(
3'b010
)
,
.
RX_DEBUG_CFG
(
12'b000000000000
)
,
.
RX_OS_CFG
(
13'b0000010000000
)
,
.
TERM_RCAL_CFG
(
5'b10000
)
,
.
TERM_RCAL_OVRD
(
1'b0
)
,
.
TST_RSV
(
32'h00000000
)
,
.
RX_CLK25_DIV
(
6
)
,
.
TX_CLK25_DIV
(
6
)
,
.
UCODEER_CLR
(
1'b0
)
,
//-------------------------PCI Express Attributes----------------------------
.
PCS_PCIE_EN
(
"FALSE"
)
,
//-------------------------PCS Attributes----------------------------
.
PCS_RSVD_ATTR
(
48'h0100
)
,
//-----------RX Buffer Attributes------------
.
RXBUF_ADDR_MODE
(
"FAST"
)
,
.
RXBUF_EIDLE_HI_CNT
(
4'b1000
)
,
.
RXBUF_EIDLE_LO_CNT
(
4'b0000
)
,
.
RXBUF_EN
(
"TRUE"
)
,
.
RX_BUFFER_CFG
(
6'b000000
)
,
.
RXBUF_RESET_ON_CB_CHANGE
(
"TRUE"
)
,
.
RXBUF_RESET_ON_COMMAALIGN
(
"FALSE"
)
,
.
RXBUF_RESET_ON_EIDLE
(
"FALSE"
)
,
.
RXBUF_RESET_ON_RATE_CHANGE
(
"TRUE"
)
,
.
RXBUFRESET_TIME
(
5'b00001
)
,
.
RXBUF_THRESH_OVFLW
(
61
)
,
.
RXBUF_THRESH_OVRD
(
"FALSE"
)
,
.
RXBUF_THRESH_UNDFLW
(
4
)
,
.
RXDLY_CFG
(
16'h001F
)
,
.
RXDLY_LCFG
(
9'h030
)
,
.
RXDLY_TAP_CFG
(
16'h0000
)
,
.
RXPH_CFG
(
24'h000000
)
,
.
RXPHDLY_CFG
(
24'h084020
)
,
.
RXPH_MONITOR_SEL
(
5'b00000
)
,
.
RX_XCLK_SEL
(
"RXREC"
)
,
.
RX_DDI_SEL
(
6'b000000
)
,
.
RX_DEFER_RESET_BUF_EN
(
"TRUE"
)
,
//---------------------CDR Attributes-------------------------
//For Display Port, HBR/RBR- set RXCDR_CFG=72'h0380008bff40200008
//For Display Port, HBR2 - set RXCDR_CFG=72'h038c008bff20200010
//For SATA Gen1 GTX- set RXCDR_CFG=72'h03_8000_8BFF_4010_0008
//For SATA Gen2 GTX- set RXCDR_CFG=72'h03_8800_8BFF_4020_0008
//For SATA Gen3 GTX- set RXCDR_CFG=72'h03_8000_8BFF_1020_0010
//For SATA Gen3 GTP- set RXCDR_CFG=83'h0_0000_87FE_2060_2444_1010
//For SATA Gen2 GTP- set RXCDR_CFG=83'h0_0000_47FE_2060_2448_1010
//For SATA Gen1 GTP- set RXCDR_CFG=83'h0_0000_47FE_1060_2448_1010
.
RXCDR_CFG
(
72'h03000023ff10200020
)
,
.
RXCDR_FR_RESET_ON_EIDLE
(
1'b0
)
,
.
RXCDR_HOLD_DURING_EIDLE
(
1'b0
)
,
.
RXCDR_PH_RESET_ON_EIDLE
(
1'b0
)
,
.
RXCDR_LOCK_CFG
(
6'b010101
)
,
//-----------------RX Initialization and Reset Attributes-------------------
.
RXCDRFREQRESET_TIME
(
5'b00001
)
,
.
RXCDRPHRESET_TIME
(
5'b00001
)
,
.
RXISCANRESET_TIME
(
5'b00001
)
,
.
RXPCSRESET_TIME
(
5'b00001
)
,
.
RXPMARESET_TIME
(
5'b00011
)
,
//-----------------RX OOB Signaling Attributes-------------------
.
RXOOB_CFG
(
7'b0000110
)
,
//-----------------------RX Gearbox Attributes---------------------------
.
RXGEARBOX_EN
(
"FALSE"
)
,
.
GEARBOX_MODE
(
3'b000
)
,
//-----------------------PRBS Detection Attribute-----------------------
.
RXPRBS_ERR_LOOPBACK
(
1'b0
)
,
//-----------Power-Down Attributes----------
.
PD_TRANS_TIME_FROM_P2
(
12'h03c
)
,
.
PD_TRANS_TIME_NONE_P2
(
8'h3c
)
,
.
PD_TRANS_TIME_TO_P2
(
8'h64
)
,
//-----------RX OOB Signaling Attributes----------
.
SAS_MAX_COM
(
64
)
,
.
SAS_MIN_COM
(
36
)
,
.
SATA_BURST_SEQ_LEN
(
4'b0111
)
,
.
SATA_BURST_VAL
(
3'b110
)
,
.
SATA_EIDLE_VAL
(
3'b110
)
,
.
SATA_MAX_BURST
(
8
)
,
.
SATA_MAX_INIT
(
21
)
,
.
SATA_MAX_WAKE
(
7
)
,
.
SATA_MIN_BURST
(
4
)
,
.
SATA_MIN_INIT
(
12
)
,
.
SATA_MIN_WAKE
(
4
)
,
//-----------RX Fabric Clock Output Control Attributes----------
.
TRANS_TIME_RATE
(
8'h0E
)
,
//------------TX Buffer Attributes----------------
.
TXBUF_EN
(
"TRUE"
)
,
.
TXBUF_RESET_ON_RATE_CHANGE
(
"TRUE"
)
,
.
TXDLY_CFG
(
16'h001F
)
,
.
TXDLY_LCFG
(
9'h030
)
,
.
TXDLY_TAP_CFG
(
16'h0000
)
,
.
TXPH_CFG
(
16'h0780
)
,
.
TXPHDLY_CFG
(
24'h084020
)
,
.
TXPH_MONITOR_SEL
(
5'b00000
)
,
.
TX_XCLK_SEL
(
"TXOUT"
)
,
//-----------------------FPGA TX Interface Attributes-------------------------
.
TX_DATA_WIDTH
(
20
)
,
//-----------------------TX Configurable Driver Attributes-------------------------
.
TX_DEEMPH0
(
5'b00000
)
,
.
TX_DEEMPH1
(
5'b00000
)
,
.
TX_EIDLE_ASSERT_DELAY
(
3'b110
)
,
.
TX_EIDLE_DEASSERT_DELAY
(
3'b100
)
,
.
TX_LOOPBACK_DRIVE_HIZ
(
"FALSE"
)
,
.
TX_MAINCURSOR_SEL
(
1'b0
)
,
.
TX_DRIVE_MODE
(
"DIRECT"
)
,
.
TX_MARGIN_FULL_0
(
7'b1001110
)
,
.
TX_MARGIN_FULL_1
(
7'b1001001
)
,
.
TX_MARGIN_FULL_2
(
7'b1000101
)
,
.
TX_MARGIN_FULL_3
(
7'b1000010
)
,
.
TX_MARGIN_FULL_4
(
7'b1000000
)
,
.
TX_MARGIN_LOW_0
(
7'b1000110
)
,
.
TX_MARGIN_LOW_1
(
7'b1000100
)
,
.
TX_MARGIN_LOW_2
(
7'b1000010
)
,
.
TX_MARGIN_LOW_3
(
7'b1000000
)
,
.
TX_MARGIN_LOW_4
(
7'b1000000
)
,
//-----------------------TX Gearbox Attributes--------------------------
.
TXGEARBOX_EN
(
"FALSE"
)
,
//-----------------------TX Initialization and Reset Attributes--------------------------
.
TXPCSRESET_TIME
(
5'b00001
)
,
.
TXPMARESET_TIME
(
5'b00001
)
,
//-----------------------TX Receiver Detection Attributes--------------------------
.
TX_RXDETECT_CFG
(
14'h1832
)
,
.
TX_RXDETECT_REF
(
3'b100
)
,
//--------------------------CPLL Attributes----------------------------
.
CPLL_CFG
(
24'hBC07DC
)
,
.
CPLL_FBDIV
(
4
)
,
.
CPLL_FBDIV_45
(
5
)
,
.
CPLL_INIT_CFG
(
24'h00001E
)
,
.
CPLL_LOCK_CFG
(
16'h01E8
)
,
.
CPLL_REFCLK_DIV
(
1
)
,
.
RXOUT_DIV
(
2
)
,
.
TXOUT_DIV
(
2
)
,
.
SATA_CPLL_CFG
(
"VCO_3000MHZ"
)
,
//------------RX Initialization and Reset Attributes-------------
.
RXDFELPMRESET_TIME
(
7'b0001111
)
,
//------------RX Equalizer Attributes-------------
.
RXLPM_HF_CFG
(
14'b00000011110000
)
,
.
RXLPM_LF_CFG
(
14'b00000011110000
)
,
.
RX_DFE_GAIN_CFG
(
23'h020FEA
)
,
.
RX_DFE_H2_CFG
(
12'b000000000000
)
,
.
RX_DFE_H3_CFG
(
12'b000001000000
)
,
.
RX_DFE_H4_CFG
(
11'b00011110000
)
,
.
RX_DFE_H5_CFG
(
11'b00011100000
)
,
.
RX_DFE_KL_CFG
(
13'b0000011111110
)
,
.
RX_DFE_LPM_CFG
(
16'h0954
)
,
.
RX_DFE_LPM_HOLD_DURING_EIDLE
(
1'b0
)
,
.
RX_DFE_UT_CFG
(
17'b10001111000000000
)
,
.
RX_DFE_VP_CFG
(
17'b00011111100000011
)
,
//-----------------------Power-Down Attributes-------------------------
.
RX_CLKMUX_PD
(
1'b1
)
,
.
TX_CLKMUX_PD
(
1'b1
)
,
//-----------------------FPGA RX Interface Attribute-------------------------
.
RX_INT_DATAWIDTH
(
0
)
,
//-----------------------FPGA TX Interface Attribute-------------------------
.
TX_INT_DATAWIDTH
(
0
)
,
//----------------TX Configurable Driver Attributes---------------
.
TX_QPI_STATUS_EN
(
1'b0
)
,
//-----------------------RX Equalizer Attributes--------------------------
.
RX_DFE_KL_CFG2
(
32'h301148AC
)
,
.
RX_DFE_XYD_CFG
(
13'b0000000000000
)
,
//-----------------------TX Configurable Driver Attributes--------------------------
.
TX_PREDRIVER_MODE
(
1'b0
)
)
dut
(
//------------------------------- CPLL Ports -------------------------------
.
CPLLFBCLKLOST
(
CPLLFBCLKLOST
)
,
.
CPLLLOCK
(
CPLLLOCK
)
,
.
CPLLLOCKDETCLK
(
CPLLLOCKDETCLK
)
,
.
CPLLLOCKEN
(
tied_to_vcc_i
)
,
.
CPLLPD
(
CPLLPD
)
,
.
CPLLREFCLKLOST
(
CPLLREFCLKLOST
)
,
.
CPLLREFCLKSEL
(
3'b001
)
,
.
CPLLRESET
(
CPLLRESET
)
,
.
GTRSVD
(
16'b0000000000000000
)
,
.
PCSRSVDIN
(
16'b0000000000000000
)
,
.
PCSRSVDIN2
(
5'b00000
)
,
.
PMARSVDIN
(
5'b00000
)
,
.
PMARSVDIN2
(
5'b00000
)
,
.
TSTIN
(
20'b11111111111111111111
)
,
.
TSTOUT
()
,
//-------------------------------- Channel ---------------------------------
.
CLKRSVD
(
4'b0000
)
,
//------------------------ Channel - Clocking Ports ------------------------
.
GTGREFCLK
(
tied_to_ground_i
)
,
.
GTNORTHREFCLK0
(
tied_to_ground_i
)
,
.
GTNORTHREFCLK1
(
tied_to_ground_i
)
,
.
GTREFCLK0
(
GTREFCLK0
)
,
.
GTREFCLK1
(
tied_to_ground_i
)
,
.
GTSOUTHREFCLK0
(
tied_to_ground_i
)
,
.
GTSOUTHREFCLK1
(
tied_to_ground_i
)
,
//-------------------------- Channel - DRP Ports --------------------------
.
DRPADDR
(
1'b0
)
,
.
DRPCLK
(
CPLLLOCKDETCKL
)
,
.
DRPDI
(
1'b0
)
,
.
DRPDO
()
,
.
DRPEN
(
1'b0
)
,
.
DRPRDY
()
,
.
DRPWE
(
1'b0
)
,
//----------------------------- Clocking Ports -----------------------------
.
GTREFCLKMONITOR
()
,
.
QPLLCLK
(
GTREFCLK0
)
,
.
QPLLREFCLK
(
GTREFCLK0
)
,
.
RXSYSCLKSEL
(
2'b00
)
,
.
TXSYSCLKSEL
(
2'b00
)
,
//------------------------- Digital Monitor Ports --------------------------
.
DMONITOROUT
(
DMONITOROUT
)
,
//--------------- FPGA TX Interface Datapath Configuration ----------------
.
TX8B10BEN
(
tied_to_vcc_i
)
,
//----------------------------- Loopback Ports -----------------------------
.
LOOPBACK
(
tied_to_ground_vec_i
[
2
:
0
])
,
//--------------------------- PCI Express Ports ----------------------------
.
PHYSTATUS
()
,
.
RXRATE
(
tied_to_ground_vec_i
[
2
:
0
])
,
.
RXVALID
()
,
//---------------------------- Power-Down Ports ----------------------------
.
RXPD
(
2'b00
)
,
.
TXPD
(
2'b00
)
,
//------------------------ RX 8B/10B Decoder Ports -------------------------
.
SETERRSTATUS
(
tied_to_ground_i
)
,
//------------------- RX Initialization and Reset Ports --------------------
.
EYESCANRESET
(
reset
)
,
.
RXUSERRDY
(
RXUSERRDY
)
,
//------------------------ RX Margin Analysis Ports ------------------------
.
EYESCANDATAERROR
(
EYESCANDATAERROR
)
,
.
EYESCANMODE
(
tied_to_ground_i
)
,
.
EYESCANTRIGGER
(
1'b0
)
,
//----------------------- Receive Ports - CDR Ports ------------------------
.
RXCDRFREQRESET
(
tied_to_ground_i
)
,
.
RXCDRHOLD
(
tied_to_ground_i
)
,
.
RXCDRLOCK
()
,
.
RXCDROVRDEN
(
tied_to_ground_i
)
,
.
RXCDRRESET
(
tied_to_ground_i
)
,
.
RXCDRRESETRSV
(
tied_to_ground_i
)
,
//----------------- Receive Ports - Clock Correction Ports -----------------
.
RXCLKCORCNT
()
,
//-------- Receive Ports - FPGA RX Interface Datapath Configuration --------
.
RX8B10BEN
(
tied_to_vcc_i
)
,
//---------------- Receive Ports - FPGA RX Interface Ports -----------------
.
RXUSRCLK
(
RXUSRCLK
)
,
.
RXUSRCLK2
(
RXUSRCLK2
)
,
//---------------- Receive Ports - FPGA RX interface Ports -----------------
.
RXDATA
(
RXDATA
)
,
//----------------- Receive Ports - Pattern Checker Ports ------------------
.
RXPRBSERR
()
,
.
RXPRBSSEL
(
tied_to_ground_vec_i
[
2
:
0
])
,
//----------------- Receive Ports - Pattern Checker ports ------------------
.
RXPRBSCNTRESET
(
tied_to_ground_i
)
,
//------------------ Receive Ports - RX Equalizer Ports -------------------
.
RXDFEXYDEN
(
tied_to_vcc_i
)
,
.
RXDFEXYDHOLD
(
tied_to_ground_i
)
,
.
RXDFEXYDOVRDEN
(
tied_to_ground_i
)
,
//---------------- Receive Ports - RX 8B/10B Decoder Ports -----------------
.
RXDISPERR
(
RXDISPERR
)
,
.
RXNOTINTABLE
(
RXNOTINTABLE
)
,
//------------------------- Receive Ports - RX AFE -------------------------
.
GTXRXP
(
RXP
)
,
//---------------------- Receive Ports - RX AFE Ports ----------------------
.
GTXRXN
(
RXN
)
,
//----------------- Receive Ports - RX Buffer Bypass Ports -----------------
.
RXBUFRESET
(
tied_to_ground_i
)
,
.
RXBUFSTATUS
()
,
.
RXDDIEN
(
tied_to_ground_i
)
,
.
RXDLYBYPASS
(
tied_to_vcc_i
)
,
.
RXDLYEN
(
tied_to_ground_i
)
,
.
RXDLYOVRDEN
(
tied_to_ground_i
)
,
.
RXDLYSRESET
(
tied_to_ground_i
)
,
.
RXDLYSRESETDONE
()
,
.
RXPHALIGN
(
tied_to_ground_i
)
,
.
RXPHALIGNDONE
()
,
.
RXPHALIGNEN
(
tied_to_ground_i
)
,
.
RXPHDLYPD
(
tied_to_ground_i
)
,
.
RXPHDLYRESET
(
tied_to_ground_i
)
,
.
RXPHMONITOR
()
,
.
RXPHOVRDEN
(
tied_to_ground_i
)
,
.
RXPHSLIPMONITOR
()
,
.
RXSTATUS
(
RXSTATUS
)
,
//------------ Receive Ports - RX Byte and Word Alignment Ports ------------
.
RXBYTEISALIGNED
(
RXBYTEISALIGNED
)
,
.
RXBYTEREALIGN
()
,
.
RXCOMMADET
()
,
.
RXCOMMADETEN
(
tied_to_vcc_i
)
,
.
RXMCOMMAALIGNEN
(
tied_to_vcc_i
)
,
.
RXPCOMMAALIGNEN
(
tied_to_vcc_i
)
,
//---------------- Receive Ports - RX Channel Bonding Ports ----------------
.
RXCHANBONDSEQ
()
,
.
RXCHBONDEN
(
tied_to_ground_i
)
,
.
RXCHBONDLEVEL
(
tied_to_ground_vec_i
[
2
:
0
])
,
.
RXCHBONDMASTER
(
tied_to_ground_i
)
,
.
RXCHBONDO
()
,
.
RXCHBONDSLAVE
(
tied_to_ground_i
)
,
//--------------- Receive Ports - RX Channel Bonding Ports ----------------
.
RXCHANISALIGNED
()
,
.
RXCHANREALIGN
()
,
//------------------ Receive Ports - RX Equailizer Ports -------------------
.
RXLPMHFHOLD
(
tied_to_ground_i
)
,
.
RXLPMHFOVRDEN
(
tied_to_ground_i
)
,
.
RXLPMLFHOLD
(
tied_to_ground_i
)
,
//------------------- Receive Ports - RX Equalizer Ports -------------------
.
RXDFEAGCHOLD
(
RXDFEAGCHOLD
)
,
.
RXDFEAGCOVRDEN
(
tied_to_ground_i
)
,
.
RXDFECM1EN
(
tied_to_ground_i
)
,
.
RXDFELFHOLD
(
RXDFELFHOLD
)
,
.
RXDFELFOVRDEN
(
tied_to_vcc_i
)
,
.
RXDFELPMRESET
(
reset
)
,
.
RXDFETAP2HOLD
(
tied_to_ground_i
)
,
.
RXDFETAP2OVRDEN
(
tied_to_ground_i
)
,
.
RXDFETAP3HOLD
(
tied_to_ground_i
)
,
.
RXDFETAP3OVRDEN
(
tied_to_ground_i
)
,
.
RXDFETAP4HOLD
(
tied_to_ground_i
)
,
.
RXDFETAP4OVRDEN
(
tied_to_ground_i
)
,
.
RXDFETAP5HOLD
(
tied_to_ground_i
)
,
.
RXDFETAP5OVRDEN
(
tied_to_ground_i
)
,
.
RXDFEUTHOLD
(
tied_to_ground_i
)
,
.
RXDFEUTOVRDEN
(
tied_to_ground_i
)
,
.
RXDFEVPHOLD
(
tied_to_ground_i
)
,
.
RXDFEVPOVRDEN
(
tied_to_ground_i
)
,
.
RXDFEVSEN
(
tied_to_ground_i
)
,
.
RXLPMLFKLOVRDEN
(
tied_to_ground_i
)
,
.
RXMONITOROUT
(
RXMONITOROUT
)
,
.
RXMONITORSEL
(
RXMONITORSEL
)
,
.
RXOSHOLD
(
tied_to_ground_i
)
,
.
RXOSOVRDEN
(
tied_to_ground_i
)
,
//---------- Receive Ports - RX Fabric ClocK Output Control Ports ----------
.
RXRATEDONE
()
,
//------------- Receive Ports - RX Fabric Output Control Ports -------------
.
RXOUTCLK
(
RXOUTCLK
)
,
.
RXOUTCLKFABRIC
()
,
.
RXOUTCLKPCS
()
,
.
RXOUTCLKSEL
(
3'b010
)
,
//-------------------- Receive Ports - RX Gearbox Ports --------------------
.
RXDATAVALID
()
,
.
RXHEADER
()
,
.
RXHEADERVALID
()
,
.
RXSTARTOFSEQ
()
,
//------------------- Receive Ports - RX Gearbox Ports --------------------
.
RXGEARBOXSLIP
(
tied_to_ground_i
)
,
//----------- Receive Ports - RX Initialization and Reset Ports ------------
.
GTRXRESET
(
reset
)
,
.
RXOOBRESET
(
tied_to_ground_i
)
,
.
RXPCSRESET
(
tied_to_ground_i
)
,
.
RXPMARESET
(
reset
)
,
//---------------- Receive Ports - RX Margin Analysis ports ----------------
.
RXLPMEN
(
tied_to_ground_i
)
,
//----------------- Receive Ports - RX OOB Signaling ports -----------------
.
RXCOMSASDET
()
,
.
RXCOMWAKEDET
(
RXCOMWAKEDET
)
,
//---------------- Receive Ports - RX OOB Signaling ports -----------------
.
RXCOMINITDET
(
RXCOMINITDET
)
,
//---------------- Receive Ports - RX OOB signalling Ports -----------------
.
RXELECIDLE
(
RXELECIDLE
)
,
.
RXELECIDLEMODE
(
2'b00
)
,
//--------------- Receive Ports - RX Polarity Control Ports ----------------
.
RXPOLARITY
(
tied_to_ground_i
)
,
//-------------------- Receive Ports - RX gearbox ports --------------------
.
RXSLIDE
(
tied_to_ground_i
)
,
//----------------- Receive Ports - RX8B/10B Decoder Ports -----------------
.
RXCHARISCOMMA
()
,
.
RXCHARISK
(
RXCHARISK
)
,
//---------------- Receive Ports - Rx Channel Bonding Ports ----------------
.
RXCHBONDI
(
5'b00000
)
,
//------------ Receive Ports -RX Initialization and Reset Ports ------------
.
RXRESETDONE
(
RXRESETDONE
)
,
//------------------------------ Rx AFE Ports ------------------------------
.
RXQPIEN
(
tied_to_ground_i
)
,
.
RXQPISENN
()
,
.
RXQPISENP
()
,
//------------------------- TX Buffer Bypass Ports -------------------------
.
TXPHDLYTSTCLK
(
tied_to_ground_i
)
,
//---------------------- TX Configurable Driver Ports ----------------------
.
TXPOSTCURSOR
(
5'b00000
)
,
.
TXPOSTCURSORINV
(
tied_to_ground_i
)
,
.
TXPRECURSOR
(
tied_to_ground_vec_i
[
4
:
0
])
,
.
TXPRECURSORINV
(
tied_to_ground_i
)
,
.
TXQPIBIASEN
(
tied_to_ground_i
)
,
.
TXQPISTRONGPDOWN
(
tied_to_ground_i
)
,
.
TXQPIWEAKPUP
(
tied_to_ground_i
)
,
//------------------- TX Initialization and Reset Ports --------------------
.
CFGRESET
(
tied_to_ground_i
)
,
.
GTTXRESET
(
reset
)
,
.
PCSRSVDOUT
()
,
.
TXUSERRDY
(
TXUSERRDY
)
,
//-------------------- Transceiver Reset Mode Operation --------------------
.
GTRESETSEL
(
tied_to_ground_i
)
,
.
RESETOVRD
(
tied_to_ground_i
)
,
//-------------- Transmit Ports - 8b10b Encoder Control Ports --------------
.
TXCHARDISPMODE
(
tied_to_ground_vec_i
[
7
:
0
])
,
.
TXCHARDISPVAL
(
tied_to_ground_vec_i
[
7
:
0
])
,
//---------------- Transmit Ports - FPGA TX Interface Ports ----------------
.
TXUSRCLK
(
TXUSRCLK
)
,
.
TXUSRCLK2
(
TXUSRCLK2
)
,
//------------------- Transmit Ports - PCI Express Ports -------------------
.
TXELECIDLE
(
TXELECIDLE
)
,
.
TXMARGIN
(
tied_to_ground_vec_i
[
2
:
0
])
,
.
TXRATE
(
tied_to_ground_vec_i
[
2
:
0
])
,
.
TXSWING
(
tied_to_ground_i
)
,
//---------------- Transmit Ports - Pattern Generator Ports ----------------
.
TXPRBSFORCEERR
(
tied_to_ground_i
)
,
//---------------- Transmit Ports - TX Buffer Bypass Ports -----------------
.
TXDLYBYPASS
(
tied_to_vcc_i
)
,
.
TXDLYEN
(
tied_to_ground_i
)
,
.
TXDLYHOLD
(
tied_to_ground_i
)
,
.
TXDLYOVRDEN
(
tied_to_ground_i
)
,
.
TXDLYSRESET
(
tied_to_ground_i
)
,
.
TXDLYSRESETDONE
()
,
.
TXDLYUPDOWN
(
tied_to_ground_i
)
,
.
TXPHALIGN
(
tied_to_ground_i
)
,
.
TXPHALIGNDONE
()
,
.
TXPHALIGNEN
(
tied_to_ground_i
)
,
.
TXPHDLYPD
(
tied_to_ground_i
)
,
.
TXPHDLYRESET
(
tied_to_ground_i
)
,
.
TXPHINIT
(
tied_to_ground_i
)
,
.
TXPHINITDONE
()
,
.
TXPHOVRDEN
(
tied_to_ground_i
)
,
//-------------------- Transmit Ports - TX Buffer Ports --------------------
.
TXBUFSTATUS
()
,
//------------- Transmit Ports - TX Configurable Driver Ports --------------
.
TXBUFDIFFCTRL
(
3'b100
)
,
.
TXDEEMPH
(
tied_to_ground_i
)
,
.
TXDIFFCTRL
(
4'b1000
)
,
.
TXDIFFPD
(
tied_to_ground_i
)
,
.
TXINHIBIT
(
tied_to_ground_i
)
,
.
TXMAINCURSOR
(
7'b0000000
)
,
.
TXPISOPD
(
tied_to_ground_i
)
,
//---------------- Transmit Ports - TX Data Path interface -----------------
.
TXDATA
(
TXDATA
)
,
//-------------- Transmit Ports - TX Driver and OOB signaling --------------
.
GTXTXN
(
TXN
)
,
.
GTXTXP
(
TXP
)
,
//--------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
.
TXOUTCLK
(
TXOUTCLK
)
,
.
TXOUTCLKFABRIC
(
TXOUTCLKFABRIC
)
,
.
TXOUTCLKPCS
(
TXOUTCLKPCS
)
,
.
TXOUTCLKSEL
(
3'b010
)
,
.
TXRATEDONE
()
,
//------------------- Transmit Ports - TX Gearbox Ports --------------------
.
TXCHARISK
(
TXCHARISK
)
,
.
TXGEARBOXREADY
()
,
.
TXHEADER
(
tied_to_ground_vec_i
[
2
:
0
])
,
.
TXSEQUENCE
(
tied_to_ground_vec_i
[
6
:
0
])
,
.
TXSTARTSEQ
(
tied_to_ground_i
)
,
//----------- Transmit Ports - TX Initialization and Reset Ports -----------
.
TXPCSRESET
(
tied_to_ground_i
)
,
.
TXPMARESET
(
tied_to_ground_i
)
,
.
TXRESETDONE
(
TXRESETDONE
)
,
//---------------- Transmit Ports - TX OOB signalling Ports ----------------
.
TXCOMFINISH
(
TXCOMFINISH
)
,
.
TXCOMINIT
(
TXCOMINIT
)
,
.
TXCOMSAS
(
tied_to_ground_i
)
,
.
TXCOMWAKE
(
TXCOMWAKE
)
,
.
TXPDELECIDLEMODE
(
tied_to_ground_i
)
,
//--------------- Transmit Ports - TX Polarity Control Ports ---------------
.
TXPOLARITY
(
tied_to_ground_i
)
,
//------------- Transmit Ports - TX Receiver Detection Ports --------------
.
TXDETECTRX
(
tied_to_ground_i
)
,
//---------------- Transmit Ports - TX8b/10b Encoder Ports -----------------
.
TX8B10BBYPASS
(
tied_to_ground_vec_i
[
7
:
0
])
,
//---------------- Transmit Ports - pattern Generator Ports ----------------
.
TXPRBSSEL
(
tied_to_ground_vec_i
[
2
:
0
])
,
//--------------------- Tx Configurable Driver Ports ----------------------
.
TXQPISENN
()
,
.
TXQPISENP
()
)
;
/*
gtx_sata_2 dut
(
.sysclk_in (GTREFCLK0),
.soft_reset_in (reset),
.dont_reset_on_data_error_in (1'b1),
.gt0_tx_fsm_reset_done_out (),
.gt0_rx_fsm_reset_done_out (),
.gt0_data_valid_in (1'b1),
//_________________________________________________________________________
//GT0 (X1Y0)
//____________________________CHANNEL PORTS________________________________
//------------------------------- CPLL Ports -------------------------------
.gt0_cpllfbclklost_out (CPLLFBCLKLOST),
.gt0_cplllock_out (CPLLLOCK),
.gt0_cplllockdetclk_in (CPLLLOCKDETCLK),
.gt0_cpllreset_in (CPLLRESET),
//------------------------ Channel - Clocking Ports ------------------------
.gt0_gtrefclk0_in (GTREFCLK0),
//-------------------------- Channel - DRP Ports --------------------------
.gt0_drpaddr_in (1'b0),
.gt0_drpclk_in (CPLLLOCKDETCLK),
.gt0_drpdi_in (1'b0),
.gt0_drpdo_out (),
.gt0_drpen_in (1'b0),
.gt0_drprdy_out (),
.gt0_drpwe_in (1'b0),
//------------------------- Digital Monitor Ports --------------------------
.gt0_dmonitorout_out (),
//--------------------------- PCI Express Ports ----------------------------
.gt0_rxrate_in (RXRATE),
//------------------- RX Initialization and Reset Ports --------------------
.gt0_eyescanreset_in (reset),
.gt0_rxuserrdy_in (RXUSERRDY),
//------------------------ RX Margin Analysis Ports ------------------------
.gt0_eyescandataerror_out (),
.gt0_eyescantrigger_in (1'b0),
//---------------- Receive Ports - FPGA RX Interface Ports -----------------
.gt0_rxusrclk_in (RXUSRCLK),
.gt0_rxusrclk2_in (RXUSRCLK2),
//---------------- Receive Ports - FPGA RX interface Ports -----------------
.gt0_rxdata_out (RXDATA),
//---------------- Receive Ports - RX 8B/10B Decoder Ports -----------------
.gt0_rxdisperr_out (RXDISPERR),
.gt0_rxnotintable_out (RXNOTINTABLE),
//------------------------- Receive Ports - RX AFE -------------------------
.gt0_gtxrxp_in (RXP),
//---------------------- Receive Ports - RX AFE Ports ----------------------
.gt0_gtxrxn_in (RXN),
//----------------- Receive Ports - RX Buffer Bypass Ports -----------------
.gt0_rxphmonitor_out (RXPHMONITOR),
.gt0_rxphslipmonitor_out (RXPHSLIPMONITOR),
//------------ Receive Ports - RX Byte and Word Alignment Ports ------------
.gt0_rxbyteisaligned_out (RXBYTEISALIGNED),
.gt0_rxbyterealign_out (RXBYTEREALIGN),
.gt0_rxcommadet_out (RXCOMMADET),
//------------------- Receive Ports - RX Equalizer Ports -------------------
.gt0_rxdfelpmreset_in (reset),
.gt0_rxmonitorout_out (RXMONITOROUT),
.gt0_rxmonitorsel_in (1'b0),
//---------- Receive Ports - RX Fabric ClocK Output Control Ports ----------
.gt0_rxratedone_out (RXRATEDONE),
//------------- Receive Ports - RX Fabric Output Control Ports -------------
.gt0_rxoutclk_out (RXOUTCLK),
//----------- Receive Ports - RX Initialization and Reset Ports ------------
.gt0_gtrxreset_in (reset),
.gt0_rxpmareset_in (reset),
//----------------- Receive Ports - RX OOB Signaling ports -----------------
.gt0_rxcomwakedet_out (RXCOMWAKEDET),
//---------------- Receive Ports - RX OOB Signaling ports -----------------
.gt0_rxcominitdet_out (RXCOMINITDET),
//---------------- Receive Ports - RX OOB signalling Ports -----------------
.gt0_rxelecidle_out (RXELECIDLE),
//----------------- Receive Ports - RX8B/10B Decoder Ports -----------------
.gt0_rxchariscomma_out (RXCHARISCOMMA),
.gt0_rxcharisk_out (RXCHARISK),
//------------ Receive Ports -RX Initialization and Reset Ports ------------
.gt0_rxresetdone_out (RXRESETDONE),
//------------------- TX Initialization and Reset Ports --------------------
.gt0_gttxreset_in (reset),
.gt0_txuserrdy_in (TXUSERRDY),
//---------------- Transmit Ports - FPGA TX Interface Ports ----------------
.gt0_txusrclk_in (TXUSRCLK),
.gt0_txusrclk2_in (TXUSRCLK2),
//------------------- Transmit Ports - PCI Express Ports -------------------
.gt0_txelecidle_in (TXELECIDLE),
.gt0_txrate_in (TXRATE),
//---------------- Transmit Ports - TX Data Path interface -----------------
.gt0_txdata_in (TXDATA),
//-------------- Transmit Ports - TX Driver and OOB signaling --------------
.gt0_gtxtxn_out (TXN),
.gt0_gtxtxp_out (TXP),
//--------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
.gt0_txoutclk_out (TXOUTCLK),
.gt0_txoutclkfabric_out (TXOUTCLKFABRIC),
.gt0_txoutclkpcs_out (TXOUTCLKPCS),
.gt0_txratedone_out (TXRATEDONE),
//------------------- Transmit Ports - TX Gearbox Ports --------------------
.gt0_txcharisk_in (TXCHARISK),
//----------- Transmit Ports - TX Initialization and Reset Ports -----------
.gt0_txresetdone_out (TXRESETDONE),
//---------------- Transmit Ports - TX OOB signalling Ports ----------------
.gt0_txcomfinish_out (TXCOMFINISH),
.gt0_txcominit_in (TXCOMINIT),
.gt0_txcomwake_in (TXCOMWAKE),
//____________________________COMMON PORTS________________________________
.gt0_qplloutclk_in (GTREFCLK0),
.gt0_qplloutrefclk_in (GTREFCLK0)
);*/
endmodule
tb/test.v
0 → 100644
View file @
886f1771
/*
* simple align test
*/
module
test
(
output
wire
reset
,
output
wire
rx_early_reset
,
input
wire
TXRESETDONE
,
input
wire
RXRESETDONE
,
/*
* TX
*/
input
wire
TXP
,
input
wire
TXN
,
output
wire
[
63
:
0
]
TXDATA
,
output
wire
TXUSRCLK
,
output
wire
TXUSRCLK2
,
output
wire
TXUSERRDY
,
// 8/10 encoder
output
wire
[
7
:
0
]
TX8B10BBYPASS
,
output
wire
TX8B10BEN
,
output
wire
[
7
:
0
]
TXCHARDISPMODE
,
output
wire
[
7
:
0
]
TXCHARDISPVAL
,
output
wire
[
7
:
0
]
TXCHARISK
,
// TX Buffer
input
wire
[
1
:
0
]
TXBUFSTATUS
,
// TX Polarity
output
wire
TXPOLARITY
,
// TX Fabric Clock Control
output
wire
[
2
:
0
]
TXRATE
,
input
wire
TXRATEDONE
,
// TX OOB
output
wire
TXCOMINIT
,
output
wire
TXCOMWAKE
,
input
wire
TXCOMFINISH
,
// TX Driver Control
output
wire
TXELECIDLE
,
/*
* RX
*/
output
wire
RXP
,
output
wire
RXN
,
output
wire
RXUSRCLK
,
output
wire
RXUSRCLK2
,
output
wire
RXUSERRDY
,
input
wire
[
63
:
0
]
RXDATA
,
output
wire
[
2
:
0
]
RXRATE
,
// oob
output
wire
[
1
:
0
]
RXELECIDLEMODE
,
input
wire
RXELECIDLE
,
input
wire
RXCOMINITDET
,
input
wire
RXCOMWAKEDET
,
// polarity
output
wire
RXPOLARITY
,
// aligner
input
wire
RXBYTEISALIGNED
,
input
wire
RXBYTEREALIGN
,
input
wire
RXCOMMADET
,
output
wire
RXCOMMADETEN
,
output
wire
RXPCOMMAALIGNEN
,
output
wire
RXMCOMMAALIGNEN
,
// 10/8 decoder
output
wire
RX8B10BEN
,
input
wire
[
7
:
0
]
RXCHARISCOMMA
,
input
wire
[
7
:
0
]
RXCHARISK
,
input
wire
[
7
:
0
]
RXDISPERR
,
input
wire
[
7
:
0
]
RXNOTINTABLE
,
/*
* Clocking
*/
// top-level interfaces
output
wire
[
2
:
0
]
CPLLREFCLKSEL
,
output
wire
GTREFCLK0
,
output
wire
GTREFCLK1
,
output
wire
GTNORTHREFCLK0
,
output
wire
GTNORTHREFCLK1
,
output
wire
GTSOUTHREFCLK0
,
output
wire
GTSOUTHREFCLK1
,
output
wire
GTGREFCLK
,
output
wire
[
1
:
0
]
RXSYSCLKSEL
,
output
wire
[
1
:
0
]
TXSYSCLKSEL
,
output
wire
[
2
:
0
]
TXOUTCLKSEL
,
output
wire
[
2
:
0
]
RXOUTCLKSEL
,
output
wire
TXDLYBYPASS
,
input
wire
GTREFCLKMONITOR
,
output
wire
CPLLLOCKDETCLK
,
output
wire
CPLLLOCKEN
,
output
wire
CPLLPD
,
output
wire
CPLLRESET
,
input
wire
CPLLFBCLKLOST
,
input
wire
CPLLLOCK
,
input
wire
CPLLREFCLKLOST
,
// phy-level interfaces
input
wire
TXOUTCLKPMA
,
input
wire
TXOUTCLKPCS
,
input
wire
TXOUTCLK
,
input
wire
TXOUTCLKFABRIC
,
input
wire
tx_serial_clk
,
input
wire
RXOUTCLKPMA
,
input
wire
RXOUTCLKPCS
,
input
wire
RXOUTCLK
,
input
wire
RXOUTCLKFABRIC
,
input
wire
rx_serial_clk
,
output
wire
RXDFELFHOLD
,
output
wire
RXDFEAGCHOLD
,
/*
* GTXE2_COMMON
*/
output
wire
[
2
:
0
]
QPLLREFCLKSEL
,
input
wire
QPLLOUTCLK
,
input
wire
QPLLOUTREFCLK
,
output
wire
QPLLLOCKDETCLK
,
output
wire
QPLLLOCKEN
,
output
wire
QPLLPD
,
output
wire
QPLLRESET
,
input
wire
QPLLFBCLKLOST
,
input
wire
QPLLLOCK
,
input
wire
QPLLREFCLKLOST
)
;
reg
gtxreset
;
reg
hard_rst
;
initial
#
1
$
display
(
"HI THERE"
)
;
initial
begin
$
dumpfile
(
"test.vcd"
)
;
$
dumpvars
(
0
,
tb
)
;
end
// simulation stop condition
initial
// #10000 $stop;
#
100000000
$
finish
;
// ref clock
reg
clk
=
1'b0
;
always
#
3000
clk
=
~
clk
;
// reset
initial
begin
hard_rst
=
1'b0
;
#
1000000
;
hard_rst
<=
1'b1
;
#
1000000
;
hard_rst
<=
1'b0
;
end
initial
begin
gtxreset
=
1'b0
;
@
(
negedge
hard_rst
)
;
gtxreset
<=
1'b1
;
#
1000000
;
gtxreset
<=
1'b0
;
end
// data
reg
[
15
:
0
]
data
;
reg
align_switch
=
0
;
reg
[
7
:
0
]
control
=
0
;
assign
TXDATA
=
{
47'h0
,
data
};
initial
begin
data
=
16'h0
;
@
(
negedge
reset
)
;
// @ (negedge reset);
//#2000000;
@
(
posedge
RXCOMWAKEDET
or
posedge
TXCOMFINISH
)
;
@
(
posedge
RXCOMWAKEDET
or
posedge
TXCOMFINISH
)
;
/* repeat (30)
@ (posedge clk);
@ (posedge clk) data <= 16'hde;
@ (posedge clk) data <= 16'had;
@ (posedge clk) data <= 16'hbe;
@ (posedge clk) data <= 16'hef;*/
repeat
(
30
)
@
(
posedge
clk
)
;
align_switch
<=
1'b1
;
@
(
posedge
clk
)
data
<=
16'hde
;
@
(
posedge
clk
)
data
<=
16'had
;
@
(
posedge
clk
)
data
<=
16'hbe
;
@
(
posedge
clk
)
data
<=
16'hef
;
@
(
posedge
clk
)
data
<=
16'hbc
;
//comma
control
<=
8'b01
;
@
(
posedge
clk
)
data
<=
16'hde
;
control
<=
8'b00
;
@
(
posedge
clk
)
data
<=
16'had
;
@
(
posedge
clk
)
data
<=
16'hbe
;
@
(
posedge
clk
)
data
<=
16'hef
;
@
(
posedge
clk
)
data
<=
16'hbc
;
//comma
control
<=
8'b01
;
@
(
posedge
clk
)
data
<=
16'hde
;
control
<=
8'b00
;
@
(
posedge
clk
)
data
<=
16'had
;
@
(
posedge
clk
)
data
<=
16'hbe
;
@
(
posedge
clk
)
data
<=
16'hef
;
end
assign
TXCHARISK
=
control
;
// oob
reg
oob_idle
;
reg
oob_init
;
reg
oob_wake
;
assign
TXELECIDLE
=
oob_idle
;
assign
TXCOMINIT
=
oob_init
;
assign
TXCOMWAKE
=
oob_wake
;
initial
begin
oob_idle
=
0
;
oob_init
=
0
;
oob_wake
=
0
;
#
1000000
;
// @ (negedge reset);
// @ (negedge reset);
@
(
posedge
RXRESETDONE
or
TXRESETDONE
)
;
@
(
posedge
RXRESETDONE
or
TXRESETDONE
)
;
#
2000000
;
repeat
(
10
)
@
(
posedge
clk
)
;
@
(
posedge
clk
)
oob_idle
<=
1'b1
;
@
(
posedge
clk
)
oob_init
<=
1'b1
;
@
(
posedge
clk
)
oob_init
<=
1'b0
;
@
(
posedge
RXCOMINITDET
or
posedge
TXCOMFINISH
)
;
@
(
posedge
RXCOMINITDET
or
posedge
TXCOMFINISH
)
;
@
(
posedge
clk
)
;
@
(
posedge
clk
)
oob_wake
<=
1'b1
;
@
(
posedge
clk
)
oob_wake
<=
1'b0
;
@
(
posedge
RXCOMWAKEDET
or
posedge
TXCOMFINISH
)
;
@
(
posedge
RXCOMWAKEDET
or
posedge
TXCOMFINISH
)
;
repeat
(
5
)
@
(
posedge
clk
)
;
@
(
posedge
clk
)
oob_idle
<=
1'b0
;
end
/*
* TXUSERRDY/RXUSERRDY
*/
reg
rx_userrdy
=
1'b0
;
reg
tx_userrdy
=
1'b0
;
initial
begin
@
(
negedge
gtxreset
)
;
repeat
(
100
)
@
(
posedge
RXUSRCLK
)
;
rx_userrdy
<=
1'b1
;
end
initial
begin
@
(
negedge
gtxreset
)
;
repeat
(
100
)
@
(
posedge
TXUSRCLK
)
;
tx_userrdy
<=
1'b1
;
end
/*
* Make some disalignments
*/
/*reg xn;
reg xp;
always @ (posedge rx_serial_clk)
begin
xp <= TXP;
xn <= TXN;
end*/
reg
[
10
:
0
]
xn
;
reg
[
10
:
0
]
xp
;
always
#
300
//every serial clk
begin
xn
[
0
]
<=
TXN
;
xp
[
0
]
<=
TXP
;
xp
[
10
:
1
]
<=
xp
[
9
:
0
]
;
xn
[
10
:
1
]
<=
xn
[
9
:
0
]
;
end
assign
RXN
=
align_switch
?
xn
[
10
]
:
TXN
;
assign
RXP
=
align_switch
?
xp
[
10
]
:
TXP
;
/*
* loopbacks
*/
assign
CPLLRESET
=
hard_rst
;
assign
QPLLRESET
=
hard_rst
;
assign
reset
=
~
CPLLLOCK
|
gtxreset
|
hard_rst
;
assign
TXUSERRDY
=
tx_userrdy
;
assign
RXUSERRDY
=
rx_userrdy
;
assign
CPLLPD
=
1'b0
;
assign
QPLLPD
=
1'b0
;
assign
GTREFCLK0
=
clk
;
// 150Mhz
assign
TXUSRCLK
=
TXOUTCLK
;
assign
TXUSRCLK2
=
TXOUTCLK
;
assign
RXUSRCLK
=
TXOUTCLK
;
assign
RXUSRCLK2
=
TXOUTCLK
;
assign
TXSYSCLKSEL
=
2'b00
;
assign
RXSYSCLKSEL
=
2'b00
;
assign
CPLLREFCLKSEL
=
3'b001
;
assign
RXOUTCLKSEL
=
3'b011
;
assign
TXOUTCLKSEL
=
3'b011
;
assign
TXPOLARITY
=
1'b0
;
assign
RXPOLARITY
=
1'b0
;
assign
RXPCOMMAALIGNEN
=
1'b1
;
assign
RXMCOMMAALIGNEN
=
1'b1
;
assign
RXCOMMADETEN
=
1'b1
;
assign
TXRATE
=
3'b010
;
assign
RXRATE
=
3'b010
;
assign
RXDFELFHOLD
=
1'b0
;
assign
RXDFEAGCHOLD
=
1'b0
;
/*
* IP only : cplllockdetclk
*/
reg
cplldetclk
=
0
;
assign
CPLLLOCKDETCLK
=
cplldetclk
;
always
#
8000
cplldetclk
=
~
cplldetclk
;
endmodule
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment