1
0
Fork 0

pipeline GW: rename variable

pipeline GW: cleanup
This commit is contained in:
morgan 2024-10-03 10:27:27 +08:00
parent 5eadc9b49e
commit 6e98d8952a
1 changed files with 11 additions and 13 deletions

View File

@ -300,16 +300,14 @@ class RX_Debug_Buffer(Module,AutoCSR):
@FullMemoryWE() @FullMemoryWE()
class CXP_Data_Packet_Decode(Module): class CXP_Data_Packet_Decode(Module):
def __init__(self): def __init__(self):
self.sink = stream.Endpoint(word_layout) self.packet_type = Signal(8)
# This is where data stream comes out self.decode_err = Signal()
self.source = stream.Endpoint(word_layout)
self.packet_type_rx = Signal(8) self.test_err = Signal()
self.decode_err_rx = Signal()
self.test_err_rx = Signal()
# # # # # #
# DEBUG: remove debug
# TODO: decode all packet type here
# TODO: data&event -> memory # TODO: data&event -> memory
# TODO: heartbeat # TODO: heartbeat
type = { type = {
@ -323,6 +321,9 @@ class CXP_Data_Packet_Decode(Module):
"debug" : 0x02, "debug" : 0x02,
} }
self.sink = stream.Endpoint(word_layout)
self.source = stream.Endpoint(word_layout)
self.submodules.fsm = fsm = FSM(reset_state="IDLE") self.submodules.fsm = fsm = FSM(reset_state="IDLE")
fsm.act("IDLE", fsm.act("IDLE",
@ -333,14 +334,11 @@ class CXP_Data_Packet_Decode(Module):
) )
) )
# TODO: decode all packet type here
cnt = Signal(max=0x100) cnt = Signal(max=0x100)
fsm.act("DECODE", fsm.act("DECODE",
self.sink.ack.eq(1), self.sink.ack.eq(1),
If(self.sink.stb, If(self.sink.stb,
NextValue(self.packet_type_rx, self.sink.data[:8]), NextValue(self.packet_type, self.sink.data[:8]),
Case(self.sink.data[:8],{ Case(self.sink.data[:8],{
type["data_stream"]: NextState("STREAMING"), type["data_stream"]: NextState("STREAMING"),
@ -354,7 +352,7 @@ class CXP_Data_Packet_Decode(Module):
type["debug"]: NextState("LOAD_BUFFER"), type["debug"]: NextState("LOAD_BUFFER"),
"default": [ "default": [
self.decode_err_rx.eq(1), self.decode_err.eq(1),
# wait till next valid packet # wait till next valid packet
NextState("IDLE"), NextState("IDLE"),
], ],
@ -372,7 +370,7 @@ class CXP_Data_Packet_Decode(Module):
NextState("IDLE"), NextState("IDLE"),
).Else( ).Else(
If(((self.sink.data != Cat(cnt, cnt+1, cnt+2, cnt+3))), If(((self.sink.data != Cat(cnt, cnt+1, cnt+2, cnt+3))),
self.test_err_rx.eq(1), self.test_err.eq(1),
), ),
If(cnt == 0xFC, If(cnt == 0xFC,
NextValue(cnt, cnt.reset), NextValue(cnt, cnt.reset),