Skip to content

Commit

Permalink
integration/soc/bus_addressing_converter: Handle missing cases.
Browse files Browse the repository at this point in the history
- m2s: byte to word/word to byte.
- s2m: byte to word/word to byte.
  • Loading branch information
enjoy-digital committed Nov 9, 2023
1 parent 1282708 commit f9dc8e8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions litex/soc/integration/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,15 @@ def bus_addressing_convert(interface, direction):
address_shift = log2_int(interface.data_width//8)
self.comb += adapted_interface.connect(interface, omit={"adr"})
if direction == "m2s":
self.comb += adapted_interface.adr.eq(interface.adr[address_shift:])
if (interface.addressing == "word") and (self.addressing == "byte"):
self.comb += adapted_interface.adr[address_shift:].eq(interface.adr)
if (interface.addressing == "byte") and (self.addressing == "word"):
self.comb += adapted_interface.adr.eq(interface.adr[address_shift:])
if direction == "s2m":
self.comb += interface.adr.eq(adapted_interface.adr[address_shift:])
if (interface.addressing == "word") and (self.addressing == "byte"):
self.comb += interface.adr[address_shift:].eq(adapted_interface.adr)
if (interface.addressing == "byte") and (self.addressing == "word"):
self.comb += interface.adr.eq(adapted_interface.adr[address_shift:])
return adapted_interface

# Bus-Standard conversion helper.
Expand Down

0 comments on commit f9dc8e8

Please sign in to comment.