From 72ca120fa071a81acbe0e22df5048eb860878da7 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 15 Feb 2022 17:27:51 +0100 Subject: [PATCH] frontend/axi/LiteDRAMAXI2NativeW: Decouple axi.w from axi.aw and allow buffering in w_buffer without waiting for cmd to be accepted. --- litedram/frontend/axi.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/litedram/frontend/axi.py b/litedram/frontend/axi.py index 9b80778..efcfcf3 100644 --- a/litedram/frontend/axi.py +++ b/litedram/frontend/axi.py @@ -79,24 +79,22 @@ class LiteDRAMAXI2NativeW(Module): # Command ---------------------------------------------------------------------------------- # Accept and send command to the controller only if: # - Address & Data request are *both* valid. - # - Data buffer is not full. + # - Data buffer is not empty. self.comb += [ - self.cmd_request.eq(aw.valid & axi.w.valid & w_buffer.sink.ready), + self.cmd_request.eq(aw.valid & w_buffer.source.valid), If(self.cmd_request & self.cmd_grant, port.cmd.valid.eq(1), port.cmd.we.eq(1), port.cmd.addr.eq((aw.addr - base_address) >> ashift), - aw.ready.eq(port.cmd.ready), - axi.w.connect(w_buffer.sink, omit={"valid", "ready"}), - If(port.cmd.ready, - w_buffer.sink.valid.eq(1), - axi.w.ready.eq(1) + If(port.cmd.valid & port.cmd.ready, + aw.ready.eq(1), ) ) ] # Write Data ------------------------------------------------------------------------------- self.comb += [ + axi.w.connect(w_buffer.sink), w_buffer.source.connect(port.wdata, omit={"strb", "id"}), port.wdata.we.eq(w_buffer.source.strb) ]