Merge pull request #1998 from FlyGoat/ahb-fixes

soc/integration/soc.py: Fix creation of AHB2Wishbone bridge
This commit is contained in:
enjoy-digital 2024-06-24 09:04:33 +02:00 committed by GitHub
commit 21674ee29c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -30,6 +30,7 @@ from litex.soc.interconnect import csr_bus
from litex.soc.interconnect import stream from litex.soc.interconnect import stream
from litex.soc.interconnect import wishbone from litex.soc.interconnect import wishbone
from litex.soc.interconnect import axi from litex.soc.interconnect import axi
from litex.soc.interconnect import ahb
# Helpers ------------------------------------------------------------------------------------------ # Helpers ------------------------------------------------------------------------------------------
@ -377,8 +378,8 @@ class SoCBusHandler(LiteXModule):
# Same Addressing, return un-modified interface. # Same Addressing, return un-modified interface.
if interface.addressing == self.addressing: if interface.addressing == self.addressing:
return interface return interface
# AXI/AXI-Lite interface, Bus-Addressing conversion already handled in Bus-Standard conversion. # AXI/AXI-Lite/AHB interface, Bus-Addressing conversion already handled in Bus-Standard conversion.
elif isinstance(interface, (axi.AXIInterface, axi.AXILiteInterface)): elif isinstance(interface, (axi.AXIInterface, axi.AXILiteInterface, ahb.AHBInterface)):
return interface return interface
# Different Addressing: Return adapted interface. # Different Addressing: Return adapted interface.
else: else:
@ -432,6 +433,7 @@ class SoCBusHandler(LiteXModule):
(axi.AXILiteInterface, axi.AXIInterface) : axi.AXILite2AXI, (axi.AXILiteInterface, axi.AXIInterface) : axi.AXILite2AXI,
(axi.AXIInterface, axi.AXILiteInterface): axi.AXI2AXILite, (axi.AXIInterface, axi.AXILiteInterface): axi.AXI2AXILite,
(axi.AXIInterface, wishbone.Interface) : axi.AXI2Wishbone, (axi.AXIInterface, wishbone.Interface) : axi.AXI2Wishbone,
(ahb.AHBInterface, wishbone.Interface) : ahb.AHB2Wishbone,
}[type(master), type(slave)] }[type(master), type(slave)]
bridge = bridge_cls(master, slave) bridge = bridge_cls(master, slave)
self.submodules += bridge self.submodules += bridge
@ -449,6 +451,7 @@ class SoCBusHandler(LiteXModule):
wishbone.Interface: "Wishbone", wishbone.Interface: "Wishbone",
axi.AXILiteInterface: "AXI-Lite", axi.AXILiteInterface: "AXI-Lite",
axi.AXIInterface: "AXI", axi.AXIInterface: "AXI",
ahb.AHBInterface: "AHB",
} }
self.logger.info(fmt.format( self.logger.info(fmt.format(
name = colorer(name), name = colorer(name),

View File

@ -41,11 +41,12 @@ def ahb_description(data_width, address_width):
] ]
class AHBInterface(Record): class AHBInterface(Record):
def __init__(self, data_width=32, address_width=32): def __init__(self, data_width=32, address_width=32, addressing="byte"):
assert addressing == "byte"
Record.__init__(self, ahb_description(data_width, address_width)) Record.__init__(self, ahb_description(data_width, address_width))
self.data_width = data_width self.data_width = data_width
self.address_width = address_width self.address_width = address_width
self.addressing = "byte" self.addressing = addressing
# AHB to Wishbone --------------------------------------------------------------------------------- # AHB to Wishbone ---------------------------------------------------------------------------------