frontend/dma: Add default CSR values to add_csr. (Allow initializing DMA after reset without software intervention).
This commit is contained in:
parent
25b64c3374
commit
e9d5128811
|
@ -108,12 +108,12 @@ class LiteDRAMDMAReader(Module, AutoCSR):
|
||||||
data_dequeued.eq(source.valid & source.ready)
|
data_dequeued.eq(source.valid & source.ready)
|
||||||
]
|
]
|
||||||
|
|
||||||
def add_csr(self):
|
def add_csr(self, default_base=0, default_length=0, default_start=0, default_loop=0):
|
||||||
self._base = CSRStorage(32)
|
self._base = CSRStorage(32, reset=default_base)
|
||||||
self._length = CSRStorage(32)
|
self._length = CSRStorage(32, reset=default_length)
|
||||||
self._start = CSR()
|
self._start = CSRStorage(reset=default_start)
|
||||||
self._done = CSRStatus()
|
self._done = CSRStatus()
|
||||||
self._loop = CSRStorage()
|
self._loop = CSRStorage(reset=default_loop)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class LiteDRAMDMAReader(Module, AutoCSR):
|
||||||
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
|
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
|
||||||
fsm.act("IDLE",
|
fsm.act("IDLE",
|
||||||
self._done.status.eq(1),
|
self._done.status.eq(1),
|
||||||
If(self._start.re,
|
If(self._start.storage & (default_start != 0 | self._start.re),
|
||||||
NextValue(offset, 0),
|
NextValue(offset, 0),
|
||||||
NextState("RUN"),
|
NextState("RUN"),
|
||||||
)
|
)
|
||||||
|
@ -215,15 +215,15 @@ class LiteDRAMDMAWriter(Module, AutoCSR):
|
||||||
wdata.data.eq(fifo.source.data)
|
wdata.data.eq(fifo.source.data)
|
||||||
]
|
]
|
||||||
|
|
||||||
def add_csr(self):
|
def add_csr(self, default_base=0, default_length=0, default_start=0, default_loop=0):
|
||||||
self._sink = self.sink
|
self._sink = self.sink
|
||||||
self.sink = stream.Endpoint([("data", self.port.data_width)])
|
self.sink = stream.Endpoint([("data", self.port.data_width)])
|
||||||
|
|
||||||
self._base = CSRStorage(32)
|
self._base = CSRStorage(32, reset=default_base)
|
||||||
self._length = CSRStorage(32)
|
self._length = CSRStorage(32, reset=default_length)
|
||||||
self._start = CSR()
|
self._start = CSRStorage(reset=default_start)
|
||||||
self._done = CSRStatus()
|
self._done = CSRStatus()
|
||||||
self._loop = CSRStorage()
|
self._loop = CSRStorage(reset=default_loop)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ class LiteDRAMDMAWriter(Module, AutoCSR):
|
||||||
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
|
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
|
||||||
fsm.act("IDLE",
|
fsm.act("IDLE",
|
||||||
self._done.status.eq(1),
|
self._done.status.eq(1),
|
||||||
If(self._start.re,
|
If(self._start.storage & (default_start != 0 | self._start.re),
|
||||||
NextValue(offset, 0),
|
NextValue(offset, 0),
|
||||||
NextState("RUN"),
|
NextState("RUN"),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue