frontend/wishbone: split control/data paths (to avoid data muxes)
This commit is contained in:
parent
6497343fc0
commit
b6a0eff2d9
|
@ -11,10 +11,10 @@ class LiteDRAMWishbone2Native(Module):
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
# Control
|
||||||
self.submodules.fsm = fsm = FSM(reset_state="CMD")
|
self.submodules.fsm = fsm = FSM(reset_state="CMD")
|
||||||
fsm.act("CMD",
|
fsm.act("CMD",
|
||||||
port.cmd.valid.eq(wishbone.cyc & wishbone.stb),
|
port.cmd.valid.eq(wishbone.cyc & wishbone.stb),
|
||||||
port.cmd.addr.eq(wishbone.adr),
|
|
||||||
port.cmd.we.eq(wishbone.we),
|
port.cmd.we.eq(wishbone.we),
|
||||||
If(port.cmd.valid & port.cmd.ready,
|
If(port.cmd.valid & port.cmd.ready,
|
||||||
If(wishbone.we,
|
If(wishbone.we,
|
||||||
|
@ -26,8 +26,6 @@ class LiteDRAMWishbone2Native(Module):
|
||||||
)
|
)
|
||||||
fsm.act("WRITE",
|
fsm.act("WRITE",
|
||||||
port.wdata.valid.eq(1),
|
port.wdata.valid.eq(1),
|
||||||
port.wdata.we.eq(wishbone.sel),
|
|
||||||
port.wdata.data.eq(wishbone.dat_w),
|
|
||||||
If(port.wdata.ready,
|
If(port.wdata.ready,
|
||||||
wishbone.ack.eq(1),
|
wishbone.ack.eq(1),
|
||||||
NextState("CMD")
|
NextState("CMD")
|
||||||
|
@ -36,12 +34,22 @@ class LiteDRAMWishbone2Native(Module):
|
||||||
fsm.act("READ",
|
fsm.act("READ",
|
||||||
port.rdata.ready.eq(1),
|
port.rdata.ready.eq(1),
|
||||||
If(port.rdata.valid,
|
If(port.rdata.valid,
|
||||||
wishbone.dat_r.eq(port.rdata.data),
|
|
||||||
wishbone.ack.eq(1),
|
wishbone.ack.eq(1),
|
||||||
NextState("CMD")
|
NextState("CMD")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Datapath
|
||||||
|
self.comb += [
|
||||||
|
# cmd
|
||||||
|
port.cmd.addr.eq(wishbone.adr),
|
||||||
|
# write
|
||||||
|
port.wdata.we.eq(wishbone.sel),
|
||||||
|
port.wdata.data.eq(wishbone.dat_w),
|
||||||
|
# read
|
||||||
|
wishbone.dat_r.eq(port.rdata.data),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class LiteDRAMWishbone2AXI(Module):
|
class LiteDRAMWishbone2AXI(Module):
|
||||||
def __init__(self, wishbone, port):
|
def __init__(self, wishbone, port):
|
||||||
|
|
Loading…
Reference in New Issue