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",
steerer.sel[0].eq(STEER_REFRESH),
refresher.cmd.ready.eq(1),
If(refresher.cmd.last,
If(~refresher.cmd.valid,
NextState("READ")
)
)

View File

@ -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)