integration/soc: add add_uartbone method (to add a UARTBone aka UART Wishbone bridge).

This commit is contained in:
Florent Kermarrec 2020-05-08 11:54:51 +02:00
parent 79ee135f56
commit f1a50a2138
2 changed files with 15 additions and 8 deletions

View File

@ -239,11 +239,13 @@ class UART(Module, AutoCSR, UARTInterface):
self.ev.rx.trigger.eq(~rx_fifo.source.valid)
]
class UARTWishboneBridge(WishboneStreamingBridge):
class UARTBone(WishboneStreamingBridge):
def __init__(self, pads, clk_freq, baudrate=115200):
self.submodules.phy = RS232PHY(pads, clk_freq, baudrate)
WishboneStreamingBridge.__init__(self, self.phy, clk_freq)
class UARTWishboneBridge(UARTBone): pass
# UART Multiplexer ---------------------------------------------------------------------------------
class UARTMultiplexer(Module):

View File

@ -926,13 +926,9 @@ class LiteXSoC(SoC):
if name == "stub":
self.comb += self.uart.sink.ready.eq(1)
# Bridge
elif name in ["bridge"]:
self.submodules.uart = uart.UARTWishboneBridge(
pads = self.platform.request("serial"),
clk_freq = self.sys_clk_freq,
baudrate = baudrate)
self.bus.add_master(name="uart_bridge", master=self.uart.wishbone)
# UARTBone / Bridge
elif name in ["uartbone", "bridge"]:
self.add_uartbone(baudrate=baudrate)
# Crossover
elif name in ["crossover"]:
@ -986,6 +982,15 @@ class LiteXSoC(SoC):
else:
self.add_constant("UART_POLLING")
# Add UARTbone ---------------------------------------------------------------------------------
def add_uartbone(self, name="serial", baudrate=115200):
from litex.soc.cores import uart
self.submodules.uartbone = uart.UARTBone(
pads = self.platform.request(name),
clk_freq = self.sys_clk_freq,
baudrate = baudrate)
self.bus.add_master(name="uartbone", master=self.uartbone.wishbone)
# Add SDRAM ------------------------------------------------------------------------------------
def add_sdram(self, name, phy, module, origin, size=None,
l2_cache_size = 8192,