Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UARTBone addr width #1821

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions litex/soc/cores/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def __init__(self, phy=None, clk_freq=None, data_width=32, address_width=32):

# # #
assert data_width in [8, 16, 32]
assert address_width in [8, 16, 32]
assert address_width in [8, 16, 32, 64]

cmd = Signal(8, reset_less=True)
incr = Signal()
Expand Down Expand Up @@ -431,17 +431,17 @@ def __init__(self, phy=None, clk_freq=None, data_width=32, address_width=32):


class UARTBone(Stream2Wishbone):
def __init__(self, phy, clk_freq, cd="sys"):
def __init__(self, phy, clk_freq, cd="sys", address_width=32):
if cd == "sys":
self.phy = phy
Stream2Wishbone.__init__(self, self.phy, clk_freq=clk_freq)
Stream2Wishbone.__init__(self, self.phy, clk_freq=clk_freq, address_width=address_width)
else:
self.phy = ClockDomainsRenamer(cd)(phy)
self.tx_cdc = stream.ClockDomainCrossing([("data", 8)], cd_from="sys", cd_to=cd)
self.rx_cdc = stream.ClockDomainCrossing([("data", 8)], cd_from=cd, cd_to="sys")
self.comb += self.phy.source.connect(self.rx_cdc.sink)
self.comb += self.tx_cdc.source.connect(self.phy.sink)
Stream2Wishbone.__init__(self, clk_freq=clk_freq)
Stream2Wishbone.__init__(self, clk_freq=clk_freq, address_width=address_width)
self.comb += self.rx_cdc.source.connect(self.sink)
self.comb += self.source.connect(self.tx_cdc.sink)

Expand Down
6 changes: 5 additions & 1 deletion litex/soc/integration/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,11 @@ def add_uartbone(self, name="uartbone", uart_name="serial", clk_freq=None, baudr
clk_freq = self.sys_clk_freq
self.check_if_exists(name)
uartbone_phy = uart.UARTPHY(self.platform.request(uart_name), clk_freq, baudrate)
uartbone = uart.UARTBone(phy=uartbone_phy, clk_freq=clk_freq, cd=cd)
uartbone = uart.UARTBone(
phy = uartbone_phy,
clk_freq = clk_freq,
cd = cd,
addr_width = self.bus.address_width)
self.add_module(name=f"{name}_phy", module=uartbone_phy)
self.add_module(name=name, module=uartbone)
self.bus.add_master(name=name, master=uartbone.wishbone)
Expand Down