1 from migen
.fhdl
.std
import *
2 from migen
.genlib
.misc
import timeline
3 from migen
.genlib
.fsm
import FSM
5 from misoclib
.lasmicon
.multiplexer
import *
7 class Refresher(Module
):
8 def __init__(self
, a
, ba
, tRP
, tREFI
, tRFC
):
10 self
.ack
= Signal() # 1st command 1 cycle after assertion of ack
11 self
.cmd
= CommandRequest(a
, ba
)
15 # Refresh sequence generator:
16 # PRECHARGE ALL --(tRP)--> AUTO REFRESH --(tRFC)--> done
27 self
.sync
+= timeline(seq_start
, [
41 # Periodic refresh counter
42 counter
= Signal(max=tREFI
)
50 counter
.eq(counter
- 1)
56 self
.submodules
+= fsm
57 fsm
.act("IDLE", If(start
, NextState("WAIT_GRANT")))
67 If(seq_done
, NextState("IDLE"))