asmicon: remove uses of multimux
This commit is contained in:
parent
99b889a551
commit
809cd99205
|
@ -2,7 +2,7 @@ from migen.fhdl.structure import *
|
||||||
from migen.bus.asmibus import *
|
from migen.bus.asmibus import *
|
||||||
from migen.corelogic.roundrobin import *
|
from migen.corelogic.roundrobin import *
|
||||||
from migen.corelogic.fsm import FSM
|
from migen.corelogic.fsm import FSM
|
||||||
from migen.corelogic.misc import multimux, optree
|
from migen.corelogic.misc import optree
|
||||||
|
|
||||||
from milkymist.asmicon.multiplexer import *
|
from milkymist.asmicon.multiplexer import *
|
||||||
|
|
||||||
|
@ -114,11 +114,10 @@ class _Selector:
|
||||||
|
|
||||||
# Multiplex
|
# Multiplex
|
||||||
state = Signal(BV(2))
|
state = Signal(BV(2))
|
||||||
mux_outputs = [state, self.adr, self.we]
|
|
||||||
mux_inputs = [[slot.state, slot.adr, slot.we]
|
|
||||||
for slot in self.slots]
|
|
||||||
comb += multimux(rr.grant, mux_inputs, mux_outputs)
|
|
||||||
comb += [
|
comb += [
|
||||||
|
state.eq(Array(slot.state for slot in self.slots)[rr.grant]),
|
||||||
|
self.adr.eq(Array(slot.adr for slot in self.slots)[rr.grant]),
|
||||||
|
self.we.eq(Array(slot.we for slot in self.slots)[rr.grant]),
|
||||||
self.stb.eq(
|
self.stb.eq(
|
||||||
(self.slicer.bank(self.adr) == self.bankn) \
|
(self.slicer.bank(self.adr) == self.bankn) \
|
||||||
& (state == SLOT_PENDING)),
|
& (state == SLOT_PENDING)),
|
||||||
|
|
|
@ -2,7 +2,7 @@ import math
|
||||||
|
|
||||||
from migen.fhdl.structure import *
|
from migen.fhdl.structure import *
|
||||||
from migen.corelogic.roundrobin import *
|
from migen.corelogic.roundrobin import *
|
||||||
from migen.corelogic.misc import multimux, optree
|
from migen.corelogic.misc import optree
|
||||||
from migen.corelogic.fsm import FSM
|
from migen.corelogic.fsm import FSM
|
||||||
|
|
||||||
class CommandRequest:
|
class CommandRequest:
|
||||||
|
@ -41,21 +41,17 @@ class _CommandChooser:
|
||||||
for i, req in enumerate(self.requests)]
|
for i, req in enumerate(self.requests)]
|
||||||
|
|
||||||
stb = Signal()
|
stb = Signal()
|
||||||
inputs_perm = [[req.stb,
|
comb.append(stb.eq(Array(req.stb for req in self.requests)[rr.grant]))
|
||||||
req.a, req.ba,
|
for name in ["a", "ba", "is_read", "is_write", "tag"]:
|
||||||
req.is_read, req.is_write, req.tag] for req in self.requests]
|
choices = Array(getattr(req, name) for req in self.requests)
|
||||||
outputs_perm = [stb,
|
comb.append(getattr(self.cmd, name).eq(choices[rr.grant]))
|
||||||
self.cmd.a, self.cmd.ba,
|
for name in ["cas_n", "ras_n", "we_n"]:
|
||||||
self.cmd.is_read, self.cmd.is_write, self.cmd.tag]
|
# we should only assert those signals when stb is 1
|
||||||
comb += multimux(rr.grant, inputs_perm, outputs_perm)
|
choices = Array(getattr(req, name) for req in self.requests)
|
||||||
|
comb.append(If(self.cmd.stb, getattr(self.cmd, name).eq(choices[rr.grant])))
|
||||||
inputs_filtered = [[req.cas_n, req.ras_n, req.we_n] for req in self.requests]
|
comb.append(self.cmd.stb.eq(stb \
|
||||||
outputs_filtered = [self.cmd.cas_n, self.cmd.ras_n, self.cmd.we_n]
|
& (self.cmd.is_read == self.want_reads) \
|
||||||
ms = multimux(rr.grant, inputs_filtered, outputs_filtered)
|
& (self.cmd.is_write == self.want_writes)))
|
||||||
comb += [
|
|
||||||
self.cmd.stb.eq(stb & (self.cmd.is_read == self.want_reads) & (self.cmd.is_write == self.want_writes)),
|
|
||||||
If(self.cmd.stb, *ms)
|
|
||||||
]
|
|
||||||
|
|
||||||
comb += [If(self.cmd.stb & self.cmd.ack & (rr.grant == i), req.ack.eq(1))
|
comb += [If(self.cmd.stb & self.cmd.ack & (rr.grant == i), req.ack.eq(1))
|
||||||
for i, req in enumerate(self.requests)]
|
for i, req in enumerate(self.requests)]
|
||||||
|
@ -80,19 +76,20 @@ class _Steerer:
|
||||||
return Constant(0)
|
return Constant(0)
|
||||||
else:
|
else:
|
||||||
return cmd.stb & getattr(cmd, attr)
|
return cmd.stb & getattr(cmd, attr)
|
||||||
inputs = [[cmd.a, cmd.ba,
|
|
||||||
cmd.cas_n, cmd.ras_n,
|
|
||||||
cmd.we_n, stb_and(cmd, "is_read"), stb_and(cmd, "is_write")]
|
|
||||||
for cmd in self.commands]
|
|
||||||
for phase, sel in zip(self.dfi.phases, self.sel):
|
for phase, sel in zip(self.dfi.phases, self.sel):
|
||||||
comb += [
|
comb += [
|
||||||
phase.cke.eq(1),
|
phase.cke.eq(1),
|
||||||
phase.cs_n.eq(0)
|
phase.cs_n.eq(0)
|
||||||
]
|
]
|
||||||
outputs = [phase.address, phase.bank,
|
sync += [
|
||||||
phase.cas_n, phase.ras_n, phase.we_n,
|
phase.address.eq(Array(cmd.a for cmd in self.commands)[sel]),
|
||||||
phase.rddata_en, phase.wrdata_en]
|
phase.bank.eq(Array(cmd.ba for cmd in self.commands)[sel]),
|
||||||
sync += multimux(sel, inputs, outputs)
|
phase.cas_n.eq(Array(cmd.cas_n for cmd in self.commands)[sel]),
|
||||||
|
phase.ras_n.eq(Array(cmd.ras_n for cmd in self.commands)[sel]),
|
||||||
|
phase.we_n.eq(Array(cmd.we_n for cmd in self.commands)[sel]),
|
||||||
|
phase.rddata_en.eq(Array(stb_and(cmd, "is_read") for cmd in self.commands)[sel]),
|
||||||
|
phase.wrdata_en.eq(Array(stb_and(cmd, "is_write") for cmd in self.commands)[sel])
|
||||||
|
]
|
||||||
return Fragment(comb, sync)
|
return Fragment(comb, sync)
|
||||||
|
|
||||||
class _Datapath:
|
class _Datapath:
|
||||||
|
|
Loading…
Reference in New Issue