frontend/avalon: Consider single access as a 1 word burst and simplify.
This commit is contained in:
parent
e0b144eddd
commit
8b790b79d9
|
@ -51,8 +51,8 @@ class LiteDRAMAvalonMM2Native(LiteXModule):
|
|||
|
||||
# Internal Signals.
|
||||
burst_count = Signal(9)
|
||||
burst_write = Signal()
|
||||
address = Signal(port.address_width)
|
||||
burst_read = Signal()
|
||||
burst_address = Signal(port.address_width)
|
||||
address_offset = Signal(port.address_width)
|
||||
self.comb += address_offset.eq(base_address >> log2_int(port.data_width//8))
|
||||
|
||||
|
@ -81,47 +81,36 @@ class LiteDRAMAvalonMM2Native(LiteXModule):
|
|||
]
|
||||
|
||||
# Control-Path.
|
||||
self.fsm = fsm = FSM(reset_state="IDLE")
|
||||
fsm.act("IDLE",
|
||||
self.fsm = fsm = FSM(reset_state="SINGLE-ACCESS")
|
||||
fsm.act("SINGLE-ACCESS",
|
||||
avalon.waitrequest.eq(1),
|
||||
# Start of Access.
|
||||
If(avalon.read | avalon.write,
|
||||
NextValue(burst_count, avalon.burstcount),
|
||||
NextValue(burst_write, avalon.write),
|
||||
NextValue(address, avalon.address - address_offset),
|
||||
# Burst Access.
|
||||
If(avalon.burstcount > 1,
|
||||
If(avalon.read,
|
||||
avalon.waitrequest.eq(0)
|
||||
),
|
||||
NextState("BURST")
|
||||
# Single Access.
|
||||
).Else(
|
||||
port.cmd.addr.eq(avalon.address - address_offset),
|
||||
port.cmd.we.eq(avalon.write),
|
||||
port.cmd.valid.eq(avalon.read | (avalon.write & wdata_fifo.sink.ready)),
|
||||
port.cmd.last.eq(1),
|
||||
port.cmd.last.eq(avalon.burstcount <= 1),
|
||||
If(port.cmd.valid & port.cmd.ready,
|
||||
avalon.waitrequest.eq(0),
|
||||
# If access is a burst, continue it in BURST-ACCESS.
|
||||
If(~port.cmd.last,
|
||||
NextValue(burst_count, avalon.burstcount - 1),
|
||||
NextValue(burst_read, avalon.read),
|
||||
NextValue(burst_address, port.cmd.addr + burst_increment),
|
||||
NextState("BURST-ACCESS")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
fsm.act("BURST",
|
||||
fsm.act("BURST-ACCESS",
|
||||
avalon.waitrequest.eq(1),
|
||||
port.cmd.addr.eq(address),
|
||||
port.cmd.addr.eq(burst_address),
|
||||
port.cmd.we.eq(avalon.write),
|
||||
port.cmd.valid.eq(~burst_write | (avalon.write & wdata_fifo.sink.ready)),
|
||||
port.cmd.valid.eq(burst_read | (avalon.write & wdata_fifo.sink.ready)),
|
||||
port.cmd.last.eq(burst_count == 1),
|
||||
If(port.cmd.valid & port.cmd.ready,
|
||||
If(burst_write,
|
||||
avalon.waitrequest.eq(0)
|
||||
),
|
||||
If(port.cmd.last,
|
||||
NextState("IDLE")
|
||||
).Else(
|
||||
avalon.waitrequest.eq(~avalon.write),
|
||||
NextValue(burst_count, burst_count - 1),
|
||||
NextValue(address, address + burst_increment)
|
||||
NextValue(burst_address, burst_address + burst_increment),
|
||||
If(port.cmd.last,
|
||||
NextState("SINGLE-ACCESS")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue