1
0
Fork 0

cxp GW: add buffer error csr & read ptr cdc

This commit is contained in:
morgan 2024-10-07 16:42:23 +08:00
parent 11f47debd1
commit feb621d003
1 changed files with 13 additions and 3 deletions

View File

@ -209,16 +209,18 @@ class DownConn_Interface(Module, AutoCSR):
# Priority level 2 packet - data, test packet # Priority level 2 packet - data, test packet
self.submodules.packet_decoder = packet_decoder = cdr(CXP_Data_Packet_Decode()) self.submodules.packet_decoder = packet_decoder = cdr(CXP_Data_Packet_Decode())
self.new_rx_packet = CSR()
self.decoder_error = CSR() self.decoder_error = CSR()
self.test_error = CSR() self.test_error = CSR()
self.buffer_error = CSR()
decode_err_ps = PulseSynchronizer("cxp_gtx_rx", "sys") decode_err_ps = PulseSynchronizer("cxp_gtx_rx", "sys")
test_err_ps = PulseSynchronizer("cxp_gtx_rx", "sys") test_err_ps = PulseSynchronizer("cxp_gtx_rx", "sys")
self.submodules += decode_err_ps, test_err_ps buffer_err_ps = PulseSynchronizer("cxp_gtx_rx", "sys")
self.submodules += decode_err_ps, test_err_ps, buffer_err_ps
self.comb += [ self.comb += [
decode_err_ps.i.eq(packet_decoder.decode_err), decode_err_ps.i.eq(packet_decoder.decode_err),
test_err_ps.i.eq(packet_decoder.test_err), test_err_ps.i.eq(packet_decoder.test_err),
buffer_err_ps.i.eq(packet_decoder.buffer_err),
] ]
self.sync += [ self.sync += [
If(decode_err_ps.o, If(decode_err_ps.o,
@ -231,6 +233,11 @@ class DownConn_Interface(Module, AutoCSR):
).Elif(self.test_error.re, ).Elif(self.test_error.re,
self.test_error.w.eq(0), self.test_error.w.eq(0),
), ),
If(buffer_err_ps.o,
self.buffer_error.w.eq(1),
).Elif(self.test_error.re,
self.buffer_error.w.eq(0),
),
] ]
@ -239,7 +246,10 @@ class DownConn_Interface(Module, AutoCSR):
self.pending_packet = CSR() self.pending_packet = CSR()
self.read_ptr = CSRStatus(log2_int(buffer_count)) self.read_ptr = CSRStatus(log2_int(buffer_count))
self.specials += MultiReg(packet_decoder.packet_type, self.packet_type.status), self.specials += [
MultiReg(packet_decoder.packet_type, self.packet_type.status),
MultiReg(self.read_ptr.status, packet_decoder.read_ptr_rx, odomain="cxp_gtx_rx"),
]
self.sync += [ self.sync += [
self.pending_packet.w.eq(self.read_ptr.status != packet_decoder.write_ptr_sys), self.pending_packet.w.eq(self.read_ptr.status != packet_decoder.write_ptr_sys),
If(self.pending_packet.re & self.pending_packet.w, If(self.pending_packet.re & self.pending_packet.w,