diff --git a/src/gateware/cxp_downconn.py b/src/gateware/cxp_downconn.py index 4b1a203..95c1177 100644 --- a/src/gateware/cxp_downconn.py +++ b/src/gateware/cxp_downconn.py @@ -286,8 +286,8 @@ class QPLL(Module): # Warning: Xilinx transceivers are LSB first, and comma needs to be flipped # compared to the usual 8b10b binary representation. class Comma_Detector(Module): - def __init__(self, comma, check_period=100_000, width=20): - self.data = Signal(width) + def __init__(self, comma, check_period=100_000): + self.data = Signal(20) self.rxinit_done = Signal() self.aligner_en_rxclk = Signal() @@ -296,6 +296,12 @@ class Comma_Detector(Module): # # # + + + # The built-in RXBYTEISALIGNED can be falsely asserted at linerate higher than 5Gbps + # - UG476 (v1.12.1) p.228 + + # The validity of data & comma are checked externally aligned = Signal() valid_data = Signal() aligned_rxclk = Signal() @@ -308,7 +314,6 @@ class Comma_Detector(Module): self.submodules.check_ps = check_ps = PulseSynchronizer("sys", "cxp_gtx_rx") comma_n = ~comma & 0b1111111111 - self.sync.cxp_gtx_rx += [ If(check_ps.o, aligned_rxclk.eq(0), @@ -327,7 +332,6 @@ class Comma_Detector(Module): check_counter = Signal(reset=check_period-1, max=check_period) check = Signal() - self.sync += [ check.eq(0), If(check_counter == 0, @@ -338,12 +342,11 @@ class Comma_Detector(Module): ) ] - self.submodules.fsm = fsm = FSM(reset_state="IDLE") + self.submodules.fsm = fsm = FSM(reset_state="WAIT_COMMA_ALIGN") aligner_en = Signal() self.specials += MultiReg(aligner_en, self.aligner_en_rxclk, odomain="cxp_gtx_rx") - - fsm.act("IDLE", + fsm.act("WAIT_COMMA_ALIGN", aligner_en.eq(1), If(check, check_ps.i.eq(1), @@ -363,7 +366,7 @@ class Comma_Detector(Module): NextState("READY"), ).Else( self.restart.eq(1), - NextState("IDLE"), + NextState("WAIT_COMMA_ALIGN"), ) ) ) @@ -374,7 +377,7 @@ class Comma_Detector(Module): check_ps.i.eq(1), If(~(aligned & valid_data), self.restart.eq(1), - NextState("IDLE"), + NextState("WAIT_COMMA_ALIGN"), ) ) ) @@ -564,7 +567,7 @@ class GTX(Module): # RX Byte and Word Alignment Attributes p_ALIGN_COMMA_DOUBLE="FALSE", p_ALIGN_COMMA_ENABLE=0b1111111111, - p_ALIGN_COMMA_WORD=2, # allow rxslide to shift 20 times + p_ALIGN_COMMA_WORD=2, # align comma to rxdata[:10] only p_ALIGN_MCOMMA_DET="TRUE", p_ALIGN_MCOMMA_VALUE=0b1010000011, p_ALIGN_PCOMMA_DET="TRUE", @@ -575,7 +578,7 @@ class GTX(Module): p_RX_SIG_VALID_DLY=10, i_RXPCOMMAALIGNEN=comma_aligner_en, i_RXMCOMMAALIGNEN=comma_aligner_en, - i_RXCOMMADETEN=1, # enable auto word alignment + i_RXCOMMADETEN=1, # RX 8B/10B Decoder Attributes p_RX_DISPERR_SEQ_MATCH="FALSE",