soc/cores/uart: rename UARTMultiplexer to RS232PHYMultiplexer. UARTMultiplexer now acts on serial signals (tx/rx)
This commit is contained in:
parent
ef1c778446
commit
7dbd85a842
|
@ -118,6 +118,24 @@ class RS232PHY(Module, AutoCSR):
|
||||||
self.sink, self.source = self.tx.sink, self.rx.source
|
self.sink, self.source = self.tx.sink, self.rx.source
|
||||||
|
|
||||||
|
|
||||||
|
class RS232PHYMultiplexer(Module):
|
||||||
|
def __init__(self, phys, phy):
|
||||||
|
self.sel = Signal(max=len(phys))
|
||||||
|
|
||||||
|
# # #
|
||||||
|
|
||||||
|
cases = {}
|
||||||
|
for n in range(len(phys)):
|
||||||
|
# don't stall uarts when not selected
|
||||||
|
self.comb += phys[n].sink.ready.eq(1)
|
||||||
|
# connect core to phy
|
||||||
|
cases[n] = [
|
||||||
|
phy.source.connect(phys[n].source),
|
||||||
|
phys[n].sink.connect(phy.sink)
|
||||||
|
]
|
||||||
|
self.comb += Case(self.sel, cases)
|
||||||
|
|
||||||
|
|
||||||
class RS232PHYModel(Module):
|
class RS232PHYModel(Module):
|
||||||
def __init__(self, pads):
|
def __init__(self, pads):
|
||||||
self.sink = stream.Endpoint([("data", 8)])
|
self.sink = stream.Endpoint([("data", 8)])
|
||||||
|
@ -211,19 +229,20 @@ class UARTWishboneBridge(WishboneStreamingBridge):
|
||||||
WishboneStreamingBridge.__init__(self, self.phy, clk_freq)
|
WishboneStreamingBridge.__init__(self, self.phy, clk_freq)
|
||||||
|
|
||||||
|
|
||||||
|
def UARTPads():
|
||||||
|
return Record([("tx", 1), ("rx", 1)])
|
||||||
|
|
||||||
|
|
||||||
class UARTMultiplexer(Module):
|
class UARTMultiplexer(Module):
|
||||||
def __init__(self, uarts, phy):
|
def __init__(self, uarts, uart):
|
||||||
self.sel = Signal(max=len(uarts))
|
self.sel = Signal(max=len(uarts))
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
cases = {}
|
cases = {}
|
||||||
for n in range(len(uarts)):
|
for n in range(len(uarts)):
|
||||||
# don't stall uarts when not selected
|
|
||||||
self.comb += uarts[n].sink.ready.eq(1)
|
|
||||||
# connect core to phy
|
|
||||||
cases[n] = [
|
cases[n] = [
|
||||||
phy.source.connect(uarts[n].source),
|
uart.tx.eq(uarts[n].tx),
|
||||||
uarts[n].sink.connect(phy.sink)
|
uarts[n].rx.eq(uart.rx)
|
||||||
]
|
]
|
||||||
self.comb += Case(self.sel, cases)
|
self.comb += Case(self.sel, cases)
|
||||||
|
|
Loading…
Reference in New Issue