mirror of https://github.com/m-labs/artiq.git
rtio: support single-master CRI arbiter
This commit is contained in:
parent
a318243083
commit
6c97a97d8c
|
@ -160,30 +160,33 @@ class CRIArbiter(Module):
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
selected = Signal(max=len(masters))
|
if len(masters) == 1:
|
||||||
|
self.comb += masters[0].connect(slave)
|
||||||
|
else:
|
||||||
|
selected = Signal(max=len(masters))
|
||||||
|
|
||||||
# mux master->slave signals
|
# mux master->slave signals
|
||||||
for name, size, direction in layout:
|
for name, size, direction in layout:
|
||||||
if direction == DIR_M_TO_S:
|
if direction == DIR_M_TO_S:
|
||||||
choices = Array(getattr(m, name) for m in masters)
|
choices = Array(getattr(m, name) for m in masters)
|
||||||
self.comb += getattr(slave, name).eq(choices[selected])
|
self.comb += getattr(slave, name).eq(choices[selected])
|
||||||
|
|
||||||
# connect slave->master signals
|
# connect slave->master signals
|
||||||
for name, size, direction in layout:
|
for name, size, direction in layout:
|
||||||
if direction == DIR_S_TO_M:
|
if direction == DIR_S_TO_M:
|
||||||
source = getattr(slave, name)
|
source = getattr(slave, name)
|
||||||
for i, m in enumerate(masters):
|
for i, m in enumerate(masters):
|
||||||
dest = getattr(m, name)
|
dest = getattr(m, name)
|
||||||
if name == "arb_gnt":
|
if name == "arb_gnt":
|
||||||
self.comb += dest.eq(source & (selected == i))
|
self.comb += dest.eq(source & (selected == i))
|
||||||
else:
|
else:
|
||||||
self.comb += dest.eq(source)
|
self.comb += dest.eq(source)
|
||||||
|
|
||||||
# select master
|
# select master
|
||||||
self.sync += \
|
self.sync += \
|
||||||
If(~slave.arb_req,
|
If(~slave.arb_req,
|
||||||
[If(m.arb_req, selected.eq(i)) for i, m in enumerate(masters)]
|
[If(m.arb_req, selected.eq(i)) for i, m in enumerate(masters)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CRIInterconnectShared(Module):
|
class CRIInterconnectShared(Module):
|
||||||
|
|
Loading…
Reference in New Issue