From 3afd617455cbd500e898e503260d7e67a23396d1 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 24 Sep 2021 19:34:55 +0200 Subject: [PATCH] frontend/fifo: Simplify level on _LiteDRAMFIFOCtrl, fix ctrl.write on _LiteDRAMFIFOWriter. --- litedram/frontend/fifo.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/litedram/frontend/fifo.py b/litedram/frontend/fifo.py index d9dc921..4a15ec8 100644 --- a/litedram/frontend/fifo.py +++ b/litedram/frontend/fifo.py @@ -62,11 +62,7 @@ class _LiteDRAMFIFOCtrl(Module): If(self.read, _inc(consume, depth) ), - If(self.write & ~self.read, - self.level.eq(self.level + 1), - ).Elif(self.read & ~self.write, - self.level.eq(self.level - 1) - ) + self.level.eq(self.level + self.write - self.read), ] self.comb += [ @@ -88,9 +84,7 @@ class _LiteDRAMFIFOWriter(Module): writer.sink.address.eq(ctrl.base + ctrl.write_address), writer.sink.data.eq(sink.data), If(writer.sink.valid & writer.sink.ready, - sink.ready.eq(1) - ), - If(port.wdata.valid & port.wdata.ready, + sink.ready.eq(1), ctrl.write.eq(1) ), ]