frontend/wishbone: fix wb2native missing wdata.ready when wb/port data widths differ

This commit is contained in:
Jędrzej Boczar 2020-05-13 10:14:00 +02:00
parent 79314f9549
commit b0bde294c0
1 changed files with 6 additions and 6 deletions

View File

@ -28,16 +28,16 @@ class LiteDRAMWishbone2Native(Module):
[("data", port_data_width), ("we", port_data_width//8)],
)
self.submodules += wdata_converter
wdata_lock = Signal()
wdata_complete = Signal()
self.comb += [
wdata_converter.sink.valid.eq(wishbone.cyc & wishbone.stb & wishbone.we & ~wdata_lock),
wdata_converter.sink.valid.eq(wishbone.cyc & wishbone.stb & wishbone.we & ~wdata_complete),
wdata_converter.sink.data.eq(wishbone.dat_w),
wdata_converter.sink.we.eq(wishbone.sel),
wdata_converter.source.connect(port.wdata)
]
self.sync += [
If(wdata_converter.sink.valid & wdata_converter.sink.ready,
wdata_lock.eq(1)
wdata_complete.eq(1)
)
]
@ -75,9 +75,9 @@ class LiteDRAMWishbone2Native(Module):
)
)
fsm.act("WAIT-WRITE",
If(wdata_converter.sink.ready,
NextValue(wdata_lock, 0),
wishbone.ack.eq(1),
If(wdata_complete,
wishbone.ack.eq(1),
NextValue(wdata_complete, 0),
NextState("CMD")
)
)