interconnect:axi/axi_lite/interconnect: Cosmetic cleanups.

This commit is contained in:
Florent Kermarrec 2022-06-20 19:07:27 +02:00
parent bb1702e6d5
commit 573479b395
1 changed files with 28 additions and 17 deletions

View File

@ -568,7 +568,7 @@ class AXILiteTimeout(Module):
)
])
# AXI-Lite Interconnect ----------------------------------------------------------------------------
# AXI-Lite Interconnect Components -----------------------------------------------------------------
class _AXILiteRequestCounter(Module):
def __init__(self, request, response, max_requests=256):
@ -594,10 +594,6 @@ class _AXILiteRequestCounter(Module):
),
]
class AXILiteInterconnectPointToPoint(Module):
def __init__(self, master, slave):
self.comb += master.connect(slave)
class AXILiteArbiter(Module):
"""AXI Lite arbiter
@ -633,9 +629,13 @@ class AXILiteArbiter(Module):
# Allow to change rr.grant only after all requests from a master have been responded to.
self.submodules.wr_lock = wr_lock = _AXILiteRequestCounter(
request=target.aw.valid & target.aw.ready, response=target.b.valid & target.b.ready)
request = target.aw.valid & target.aw.ready,
response = target.b.valid & target.b.ready
)
self.submodules.rd_lock = rd_lock = _AXILiteRequestCounter(
request=target.ar.valid & target.ar.ready, response=target.r.valid & target.r.ready)
request = target.ar.valid & target.ar.ready,
response = target.r.valid & target.r.ready
)
# Switch to next request only if there are no responses pending.
self.comb += [
@ -681,11 +681,13 @@ class AXILiteDecoder(Module):
# TODO: we could reuse arbiter counters
locks = {
"write": _AXILiteRequestCounter(
request=master.aw.valid & master.aw.ready,
response=master.b.valid & master.b.ready),
request = master.aw.valid & master.aw.ready,
response = master.b.valid & master.b.ready,
),
"read": _AXILiteRequestCounter(
request=master.ar.valid & master.ar.ready,
response=master.r.valid & master.r.ready),
request = master.ar.valid & master.ar.ready,
response = master.r.valid & master.r.ready
),
}
self.submodules += locks.values()
@ -701,16 +703,18 @@ class AXILiteDecoder(Module):
slave_sel_dec["read"][i].eq(decoder(master.ar.addr[addr_shift:])),
]
# Dhange the current selection only when we've got all responses.
# Change the current selection only when we've got all responses.
for channel in locks.keys():
self.sync += If(locks[channel].ready, slave_sel_reg[channel].eq(slave_sel_dec[channel]))
# We have to cut the delaying select.
for ch, final in slave_sel.items():
self.comb += If(locks[ch].ready,
final.eq(slave_sel_dec[ch])
).Else(
final.eq(slave_sel_reg[ch])
)
self.comb += [
If(locks[ch].ready,
final.eq(slave_sel_dec[ch])
).Else(
final.eq(slave_sel_reg[ch])
)
]
# Connect master->slaves signals except valid/ready.
for i, (_, slave) in enumerate(slaves):
@ -735,6 +739,13 @@ class AXILiteDecoder(Module):
masked.append(src & mask)
self.comb += dst.eq(reduce(or_, masked))
# AXI-Lite Interconnect ----------------------------------------------------------------------------
class AXILiteInterconnectPointToPoint(Module):
"""AXI Lite point to point interconnect"""
def __init__(self, master, slave):
self.comb += master.connect(slave)
class AXILiteInterconnectShared(Module):
"""AXI Lite shared interconnect"""
def __init__(self, masters, slaves, register=False, timeout_cycles=1e6):