From 6e98d8952a58e8285d74efedd25be49d1abcafb3 Mon Sep 17 00:00:00 2001 From: morgan Date: Thu, 3 Oct 2024 10:27:27 +0800 Subject: [PATCH] pipeline GW: rename variable pipeline GW: cleanup --- src/gateware/cxp_pipeline.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/gateware/cxp_pipeline.py b/src/gateware/cxp_pipeline.py index 882cd80..c0665d9 100644 --- a/src/gateware/cxp_pipeline.py +++ b/src/gateware/cxp_pipeline.py @@ -300,16 +300,14 @@ class RX_Debug_Buffer(Module,AutoCSR): @FullMemoryWE() class CXP_Data_Packet_Decode(Module): def __init__(self): - self.sink = stream.Endpoint(word_layout) - # This is where data stream comes out - self.source = stream.Endpoint(word_layout) + self.packet_type = Signal(8) + self.decode_err = Signal() - self.packet_type_rx = Signal(8) - self.decode_err_rx = Signal() - - self.test_err_rx = Signal() + self.test_err = Signal() # # # + # DEBUG: remove debug + # TODO: decode all packet type here # TODO: data&event -> memory # TODO: heartbeat type = { @@ -323,6 +321,9 @@ class CXP_Data_Packet_Decode(Module): "debug" : 0x02, } + self.sink = stream.Endpoint(word_layout) + self.source = stream.Endpoint(word_layout) + self.submodules.fsm = fsm = FSM(reset_state="IDLE") fsm.act("IDLE", @@ -333,14 +334,11 @@ class CXP_Data_Packet_Decode(Module): ) ) - # TODO: decode all packet type here - cnt = Signal(max=0x100) - fsm.act("DECODE", self.sink.ack.eq(1), 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],{ type["data_stream"]: NextState("STREAMING"), @@ -354,7 +352,7 @@ class CXP_Data_Packet_Decode(Module): type["debug"]: NextState("LOAD_BUFFER"), "default": [ - self.decode_err_rx.eq(1), + self.decode_err.eq(1), # wait till next valid packet NextState("IDLE"), ], @@ -372,7 +370,7 @@ class CXP_Data_Packet_Decode(Module): NextState("IDLE"), ).Else( 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, NextValue(cnt, cnt.reset),