diff --git a/litedram/core/multiplexer.py b/litedram/core/multiplexer.py index beac9b6..25fa6a3 100644 --- a/litedram/core/multiplexer.py +++ b/litedram/core/multiplexer.py @@ -329,7 +329,7 @@ class Multiplexer(Module, AutoCSR): fsm.act("REFRESH", steerer.sel[0].eq(STEER_REFRESH), refresher.cmd.ready.eq(1), - If(~refresher.cmd.valid, + If(refresher.cmd.last, NextState("READ") ) ) diff --git a/litedram/core/refresher.py b/litedram/core/refresher.py index be58b2c..904d671 100644 --- a/litedram/core/refresher.py +++ b/litedram/core/refresher.py @@ -45,16 +45,14 @@ class Refresher(Module): self.comb += self.timer.wait.eq(settings.with_refresh & ~self.timer.done) # Control FSM - cmd_valid = Signal() self.submodules.fsm = fsm = FSM() fsm.act("IDLE", If(self.timer.done, - cmd_valid.eq(1), NextState("WAIT_GRANT") ) ) fsm.act("WAIT_GRANT", - cmd_valid.eq(1), + cmd.valid.eq(1), If(cmd.ready, seq_start.eq(1), NextState("WAIT_SEQ") @@ -62,8 +60,9 @@ class Refresher(Module): ) fsm.act("WAIT_SEQ", If(seq_done, - cmd_valid.eq(0), + cmd.last.eq(1), NextState("IDLE") + ).Else( + cmd.valid.eq(1) ) ) - self.sync += cmd.valid.eq(cmd_valid)