core/refresher: synchronize valid

This commit is contained in:
Florent Kermarrec 2018-08-14 15:30:24 +02:00
parent b2f1f29384
commit 6620a91a22
2 changed files with 6 additions and 5 deletions

View File

@ -325,7 +325,7 @@ class Multiplexer(Module, AutoCSR):
fsm.act("REFRESH", fsm.act("REFRESH",
steerer.sel[0].eq(STEER_REFRESH), steerer.sel[0].eq(STEER_REFRESH),
refresher.cmd.ready.eq(1), refresher.cmd.ready.eq(1),
If(refresher.cmd.last, If(~refresher.cmd.valid,
NextState("READ") NextState("READ")
) )
) )

View File

@ -45,14 +45,16 @@ class Refresher(Module):
self.comb += self.timer.wait.eq(settings.with_refresh & ~self.timer.done) self.comb += self.timer.wait.eq(settings.with_refresh & ~self.timer.done)
# Control FSM # Control FSM
cmd_valid = Signal()
self.submodules.fsm = fsm = FSM() self.submodules.fsm = fsm = FSM()
fsm.act("IDLE", fsm.act("IDLE",
If(self.timer.done, If(self.timer.done,
cmd_valid.eq(1),
NextState("WAIT_GRANT") NextState("WAIT_GRANT")
) )
) )
fsm.act("WAIT_GRANT", fsm.act("WAIT_GRANT",
cmd.valid.eq(1), cmd_valid.eq(1),
If(cmd.ready, If(cmd.ready,
seq_start.eq(1), seq_start.eq(1),
NextState("WAIT_SEQ") NextState("WAIT_SEQ")
@ -60,9 +62,8 @@ class Refresher(Module):
) )
fsm.act("WAIT_SEQ", fsm.act("WAIT_SEQ",
If(seq_done, If(seq_done,
cmd.last.eq(1), cmd_valid.eq(0),
NextState("IDLE") NextState("IDLE")
).Else(
cmd.valid.eq(1)
) )
) )
self.sync += cmd.valid.eq(cmd_valid)