From b17220a36d0728ed4ec9bafd0ed7bef3428b9770 Mon Sep 17 00:00:00 2001 From: Fischer Moseley <42497969+fischermoseley@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:25:54 -0700 Subject: [PATCH] ethernet: fix bug where single-length write request does not send response --- src/manta/ethernet/bridge.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/manta/ethernet/bridge.py b/src/manta/ethernet/bridge.py index 223780e..2aab2cb 100644 --- a/src/manta/ethernet/bridge.py +++ b/src/manta/ethernet/bridge.py @@ -138,13 +138,14 @@ class EthernetBridge(Elaboratable): m.d.sync += self.bus_o.last.eq(self.last_i) with m.If(self.last_i): - m.next = "IDLE" # TODO: could save a cycle by checking valid_i to see if there's more work to do + m.d.sync += self.ready_o.eq(0) + m.next = "WRITE_WAIT_FOR_LAST" with m.Else(): m.next = "WRITE" with m.State("WRITE"): - with m.If(self.valid_i & self.ready_o): + with m.If(self.valid_i): m.d.sync += self.bus_o.addr.eq(self.bus_o.addr + 1) m.d.sync += self.bus_o.data.eq(self.data_i) m.d.sync += self.bus_o.rw.eq(1) @@ -153,9 +154,16 @@ class EthernetBridge(Elaboratable): with m.If(self.last_i): m.d.sync += self.ready_o.eq(0) + m.next = "WRITE_WAIT_FOR_LAST" + + with m.Else(): + m.next = "WRITE" with m.Else(): - m.d.sync += self.bus_o.eq(0) + m.next = "WRITE" + + with m.State("WRITE_WAIT_FOR_LAST"): + m.d.sync += self.bus_o.eq(0) with m.If(self.bus_i.last): m.d.sync += seq_num_expected.eq(seq_num_expected + 1) @@ -171,9 +179,6 @@ class EthernetBridge(Elaboratable): m.d.sync += self.last_o.eq(1) m.next = "IDLE" # TODO: could save a cycle by checking valid_i to see if there's more work to do - with m.Else(): - m.next = "WRITE" - with m.State("NACK_WAIT_FOR_LAST"): with m.If(self.last_i): m.d.sync += self.data_o.eq(