From 91a0c4363cbd62ff506bcaad2ee7f57d42b28c7d Mon Sep 17 00:00:00 2001 From: Raptor Engineering Development Team Date: Mon, 11 Apr 2022 12:43:52 -0500 Subject: [PATCH] WB64to32Convert: Obey STALL in burst mode (#807) --- src/ls2.py | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/ls2.py b/src/ls2.py index 3909b8a..00c1853 100644 --- a/src/ls2.py +++ b/src/ls2.py @@ -123,7 +123,7 @@ class WB64to32Convert(Elaboratable): sync += has_top_r.eq(0) # Do we have a cycle ? - with m.If(master.cyc & master.stb): + with m.If(master.cyc & master.stb & ~master.ack): # Stall master until we are done, we are't (yet) pipelining # this, it's all slow IOs. sync += master.stall.eq(1) @@ -198,12 +198,17 @@ class WB64to32Convert(Elaboratable): sync += slave.stb.eq(0) # And ack & unstall upstream - sync += master.ack.eq(1) - if hasattr(master , "stall"): - sync += master.stall.eq(0) - - # Wait for next one - m.next = "IDLE" + # but only if upstream is ready + with m.If(master.stb): + sync += master.ack.eq(1) + if hasattr(master , "stall"): + sync += master.stall.eq(0) + + # Wait for next one + m.next = "IDLE" + with m.Else(): + # Wait for upstream to become ready + m.next = "WAIT_ACK_MASTER_STALL" with m.State("WAIT_ACK_TOP"): # If we aren't stalled by the device, clear stb @@ -221,7 +226,22 @@ class WB64to32Convert(Elaboratable): sync += slave.cyc.eq(0) sync += slave.stb.eq(0) - # And ack & unstall upstream + # And ack & unstall upstream, + # but only if upstream is ready + with m.If(master.stb): + sync += master.ack.eq(1) + if hasattr(master, "stall"): + sync += master.stall.eq(0) + + # Wait for next one + m.next = "IDLE" + with m.Else(): + # Wait for upstream to become ready + m.next = "WAIT_ACK_MASTER_STALL" + + with m.State("WAIT_ACK_MASTER_STALL"): + with m.If(master.stb): + # Ack & unstall upstream sync += master.ack.eq(1) if hasattr(master, "stall"): sync += master.stall.eq(0) -- 2.30.2