From 9c1ad5419d8c6c8114e8695a804de2df56ab6bf1 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Thu, 9 Jul 2020 14:53:53 +0200 Subject: [PATCH] Fix counter reset condition bug --- gram/frontend/wishbone.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gram/frontend/wishbone.py b/gram/frontend/wishbone.py index ccfdec1..04502ce 100644 --- a/gram/frontend/wishbone.py +++ b/gram/frontend/wishbone.py @@ -17,6 +17,7 @@ class gramWishbone(Peripheral, Elaboratable): self.dw = data_width self._port = core.crossbar.get_native_port() + #self._port = core.crossbar.get_port(data_width=8, mode="read") dram_size = core.size//4 dram_addr_width = log2_int(dram_size) @@ -57,7 +58,7 @@ class gramWishbone(Peripheral, Elaboratable): ] with m.If(self._port.cmd.valid & self._port.cmd.ready): m.d.sync += count.eq(count+1) - with m.If(count == (ratio-1)): + with m.If(count == (max(ratio, 2)-1)): m.d.sync += count.eq(0) with m.If(self.bus.we): m.next = "Wait-Write" -- 2.30.2