Skip to content

Commit 87ee8a5

Browse files
committed
wishbone: fix Decoder.add() check to support flipped interfaces.
1 parent 622c7ac commit 87ee8a5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

amaranth_soc/wishbone/bus.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,13 @@ def add(self, sub_bus, *, addr=None, sparse=False):
341341
342342
See :meth:`MemoryMap.add_resource` for details.
343343
"""
344-
if not isinstance(sub_bus, Interface):
344+
if isinstance(sub_bus, wiring.FlippedInterface):
345+
sub_bus_unflipped = flipped(sub_bus)
346+
else:
347+
sub_bus_unflipped = sub_bus
348+
if not isinstance(sub_bus_unflipped, Interface):
345349
raise TypeError(f"Subordinate bus must be an instance of wishbone.Interface, not "
346-
f"{sub_bus!r}")
350+
f"{sub_bus_unflipped!r}")
347351
if sub_bus.granularity > self.bus.granularity:
348352
raise ValueError(f"Subordinate bus has granularity {sub_bus.granularity}, which is "
349353
f"greater than the decoder granularity {self.bus.granularity}")

0 commit comments

Comments
 (0)