From 6620a91a224b7a9fbc4cf4089c80be39763eb9b8 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 14 Aug 2018 15:30:24 +0200 Subject: [PATCH] core/refresher: synchronize valid --- litedram/core/multiplexer.py | 2 +- litedram/core/refresher.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/litedram/core/multiplexer.py b/litedram/core/multiplexer.py index b019304..70c3738 100644 --- a/litedram/core/multiplexer.py +++ b/litedram/core/multiplexer.py @@ -325,7 +325,7 @@ class Multiplexer(Module, AutoCSR): fsm.act("REFRESH", steerer.sel[0].eq(STEER_REFRESH), refresher.cmd.ready.eq(1), - If(refresher.cmd.last, + If(~refresher.cmd.valid, NextState("READ") ) ) diff --git a/litedram/core/refresher.py b/litedram/core/refresher.py index 904d671..be58b2c 100644 --- a/litedram/core/refresher.py +++ b/litedram/core/refresher.py @@ -45,14 +45,16 @@ 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") @@ -60,9 +62,8 @@ class Refresher(Module): ) fsm.act("WAIT_SEQ", If(seq_done, - cmd.last.eq(1), + cmd_valid.eq(0), NextState("IDLE") - ).Else( - cmd.valid.eq(1) ) ) + self.sync += cmd.valid.eq(cmd_valid)