Skip to content

Commit

Permalink
soc/integration/soc.py: Fix creation of AHB2Wishbone bridge
Browse files Browse the repository at this point in the history
Don't do bus_addressing_convert as it's being handled in AHB2Wishbone
logic.

Add addressing parameters for AHBInterface constructor as required
by soc code.

Signed-off-by: Jiaxun Yang <[email protected]>
  • Loading branch information
FlyGoat committed Jun 23, 2024
1 parent 22f9c06 commit ccf31af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions litex/soc/integration/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from litex.soc.interconnect import stream
from litex.soc.interconnect import wishbone
from litex.soc.interconnect import axi
from litex.soc.interconnect import ahb


# Helpers ------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -367,6 +368,9 @@ def bus_addressing_convert(interface, direction):
# AXI/AXI-Lite interface, Bus-Addressing conversion already handled in Bus-Standard conversion.
elif isinstance(interface, (axi.AXIInterface, axi.AXILiteInterface)):
return interface
# AHB to Wishbone, Bus-Addressing conversion already handled in Bus-Standard conversion.
elif isinstance(interface, (ahb.AHBInterface, wishbone.Interface)) and direction == "m2s":
return interface
# Different Addressing: Return adapted interface.
else:
interface_cls = type(interface)
Expand Down Expand Up @@ -419,6 +423,7 @@ def bus_standard_convert(interface, direction):
(axi.AXILiteInterface, axi.AXIInterface) : axi.AXILite2AXI,
(axi.AXIInterface, axi.AXILiteInterface): axi.AXI2AXILite,
(axi.AXIInterface, wishbone.Interface) : axi.AXI2Wishbone,
(ahb.AHBInterface, wishbone.Interface) : ahb.AHB2Wishbone,
}[type(master), type(slave)]
bridge = bridge_cls(master, slave)
self.submodules += bridge
Expand All @@ -436,6 +441,7 @@ def bus_standard_convert(interface, direction):
wishbone.Interface: "Wishbone",
axi.AXILiteInterface: "AXI-Lite",
axi.AXIInterface: "AXI",
ahb.AHBInterface: "AHB",
}
self.logger.info(fmt.format(
name = colorer(name),
Expand Down
5 changes: 3 additions & 2 deletions litex/soc/interconnect/ahb.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ def ahb_description(data_width, address_width):
]

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))
self.data_width = data_width
self.address_width = address_width
self.addressing = "byte"
self.addressing = addressing

# AHB to Wishbone ---------------------------------------------------------------------------------

Expand Down

0 comments on commit ccf31af

Please sign in to comment.