1
0
Fork 0

cxp upconn: fix word count issue

This commit is contained in:
morgan 2024-06-28 12:46:35 +08:00
parent 481162430c
commit 8ba7793b24
1 changed files with 16 additions and 13 deletions

View File

@ -10,12 +10,9 @@ from misoc.interconnect.csr import *
IDLE_CHARS = [ IDLE_CHARS = [
#[data, k] #[data, k]
[0b10111100, 1], #K28.5 [0b10111100, 1], #K28.5
[0b10111100, 1], #K28.5 [0b00111100, 1], #K28.1
[0b10111100, 1], #K28.5 [0b00111100, 1], #K28.1
[0b10111100, 1], #K28.5 [0b10111100, 0], #D28.5
# [0b00111100, 1], #K28.1
# [0b00111100, 1], #K28.1
# [0b10111100, 0], #D28.5
] ]
@ -82,7 +79,7 @@ class CXP_UpConn(Module, AutoCSR):
NextValue(self.encoder.d, IDLE_CHARS[0][0]), NextValue(self.encoder.d, IDLE_CHARS[0][0]),
NextValue(self.encoder.k, IDLE_CHARS[0][1]), NextValue(self.encoder.k, IDLE_CHARS[0][1]),
NextValue(self.encoder.disp_in, 0), NextValue(self.encoder.disp_in, 0),
NextValue(tx_wordcount, 0), NextValue(tx_wordcount, 1),
NextValue(tx_bitcount, 0), NextValue(tx_bitcount, 0),
NextState("LOAD_CHAR") NextState("LOAD_CHAR")
) )
@ -103,6 +100,9 @@ class CXP_UpConn(Module, AutoCSR):
) )
# CXP 2.1 section 9.2.4 # CXP 2.1 section 9.2.4
# Higher priority packet can be inserted into a lower priority packet during transmission
# Priority lv 0 can be inserted in char boundary of the packet
# Priority lv 1-2 need to be inserted in word boundary of the packet
self.sync.cxp_upconn += [ self.sync.cxp_upconn += [
self.tx_fifos.disp_in.eq(disp), self.tx_fifos.disp_in.eq(disp),
self.encoder.disp_in.eq(disp), self.encoder.disp_in.eq(disp),
@ -122,10 +122,15 @@ class CXP_UpConn(Module, AutoCSR):
self.tx_fifos.source_ack[0].eq(1), self.tx_fifos.source_ack[0].eq(1),
disp.eq(self.tx_fifos.disp_out[0]), disp.eq(self.tx_fifos.disp_out[0]),
).Else( ).Else(
# at word boundary # priority zero doesn't contribute to word count
If(tx_wordcount == 3, If(tx_wordcount != 3,
tx_wordcount.eq(tx_wordcount + 1),
).Else(
tx_wordcount.eq(0), tx_wordcount.eq(0),
# at word boundary ),
# word boundary
If(tx_wordcount == 0,
If(~self.tx_fifos.pe.n, If(~self.tx_fifos.pe.n,
idling.eq(0), idling.eq(0),
priority.eq(self.tx_fifos.pe.o), priority.eq(self.tx_fifos.pe.o),
@ -138,8 +143,6 @@ class CXP_UpConn(Module, AutoCSR):
disp.eq(self.encoder.disp_out), disp.eq(self.encoder.disp_out),
) )
).Else( ).Else(
# priority zero doesn't contribute to word count
tx_wordcount.eq(tx_wordcount + 1),
If(~idling, If(~idling,
self.tx_fifos.source_ack[priority].eq(1), self.tx_fifos.source_ack[priority].eq(1),
tx_reg.eq(self.tx_fifos.source_data[priority]), tx_reg.eq(self.tx_fifos.source_data[priority]),
@ -171,7 +174,7 @@ class CXP_UpConn(Module, AutoCSR):
p2 = Signal() p2 = Signal()
self.comb += [ self.comb += [
ninth_bit.eq(tx_bitcount == 9), ninth_bit.eq(tx_bitcount == 9),
word_bound.eq(tx_wordcount == 3), word_bound.eq(tx_wordcount == 0),
p1.eq(priority == 1), p1.eq(priority == 1),
p2.eq(priority == 2), p2.eq(priority == 2),
] ]