Merge pull request #539 from dayjaby/pr-fix_uart_startbit
Fix UART startbit: 1 cycle later
This commit is contained in:
commit
370e46529d
|
@ -99,8 +99,7 @@ class RS232PHYTX(Module):
|
||||||
If(self.sink.valid & ~tx_busy & ~self.sink.ready,
|
If(self.sink.valid & ~tx_busy & ~self.sink.ready,
|
||||||
tx_reg.eq(self.sink.data),
|
tx_reg.eq(self.sink.data),
|
||||||
tx_bitcount.eq(0),
|
tx_bitcount.eq(0),
|
||||||
tx_busy.eq(1),
|
tx_busy.eq(1)
|
||||||
pads.tx.eq(0)
|
|
||||||
).Elif(uart_clk_txen & tx_busy,
|
).Elif(uart_clk_txen & tx_busy,
|
||||||
tx_bitcount.eq(tx_bitcount + 1),
|
tx_bitcount.eq(tx_bitcount + 1),
|
||||||
If(tx_bitcount == 8,
|
If(tx_bitcount == 8,
|
||||||
|
@ -113,6 +112,10 @@ class RS232PHYTX(Module):
|
||||||
pads.tx.eq(tx_reg[0]),
|
pads.tx.eq(tx_reg[0]),
|
||||||
tx_reg.eq(Cat(tx_reg[1:], 0))
|
tx_reg.eq(Cat(tx_reg[1:], 0))
|
||||||
)
|
)
|
||||||
|
).Elif(tx_busy,
|
||||||
|
If(tx_bitcount == 0,
|
||||||
|
pads.tx.eq(0)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
self.sync += [
|
self.sync += [
|
||||||
|
@ -235,7 +238,7 @@ class UART(Module, AutoCSR, UARTInterface):
|
||||||
self._rxempty.status.eq(~rx_fifo.source.valid),
|
self._rxempty.status.eq(~rx_fifo.source.valid),
|
||||||
self._rxtx.w.eq(rx_fifo.source.data),
|
self._rxtx.w.eq(rx_fifo.source.data),
|
||||||
rx_fifo.source.ready.eq(self.ev.rx.clear | (rx_fifo_rx_we & self._rxtx.we)),
|
rx_fifo.source.ready.eq(self.ev.rx.clear | (rx_fifo_rx_we & self._rxtx.we)),
|
||||||
# Generate RX IRQ when tx_fifo becomes non-empty
|
# Generate RX IRQ when rx_fifo becomes non-empty
|
||||||
self.ev.rx.trigger.eq(~rx_fifo.source.valid)
|
self.ev.rx.trigger.eq(~rx_fifo.source.valid)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue