frontend: simplify wdata/wdata_we on user side (implement the mux in the crossbar)

This commit is contained in:
Florent Kermarrec 2016-05-12 15:34:39 +02:00
parent 9d2c8bf1cf
commit 8b98dd3c8a
3 changed files with 15 additions and 17 deletions

View File

@ -26,7 +26,6 @@ class LiteDRAMWishboneBridge(Module):
)
fsm.act("WRITE_DATA",
If(port.wdata_ready,
port.wdata_we.eq(wishbone.sel),
wishbone.ack.eq(1),
NextState("IDLE")
)
@ -41,8 +40,7 @@ class LiteDRAMWishboneBridge(Module):
# Address / Datapath
self.comb += [
port.adr.eq(wishbone.adr),
If(port.wdata_ready,
port.wdata.eq(wishbone.dat_w),
),
port.wdata_we.eq(wishbone.sel),
port.wdata.eq(wishbone.dat_w),
wishbone.dat_r.eq(port.rdata)
]

View File

@ -101,15 +101,17 @@ class LiteDRAMCrossbar(Module):
self.comb += master.rdata_valid.eq(master_rdata_valid)
# route data writes
wdata_maskselect = []
wdata_we_maskselect = []
for master in self.masters:
wdata_maskselect.append(master.wdata)
wdata_we_maskselect.append(master.wdata_we)
self.comb += [
controller.wdata.eq(reduce(or_, wdata_maskselect)),
controller.wdata_we.eq(reduce(or_, wdata_we_maskselect))
wdata_cases = {}
for nm, master in enumerate(self.masters):
wdata_cases[2**nm] = [
controller.wdata.eq(master.wdata),
controller.wdata_we.eq(master.wdata_we)
]
wdata_cases["default"] = [
controller.wdata.eq(0),
controller.wdata_we.eq(0)
]
self.comb += Case(Cat(*master_wdata_readys), wdata_cases)
# route data reads
for master in self.masters:

View File

@ -72,9 +72,7 @@ class LiteDRAMDMAWriter(Module):
]
self.comb += [
If(port.wdata_ready,
fifo.re.eq(1),
port.wdata_we.eq(2**(port.dw//8)-1),
port.wdata.eq(fifo.dout)
)
fifo.re.eq(port.wdata_ready),
port.wdata_we.eq(2**(port.dw//8)-1),
port.wdata.eq(fifo.dout)
]