examples/uart: acknowledging RX data should deassert RX ready.
authorBen Newhouse <newhouseb@gmail.com>
Thu, 16 Dec 2021 13:31:32 +0000 (08:31 -0500)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 20:37:15 +0000 (20:37 +0000)
examples/basic/uart.py

index 2a3b10690bc8ed331905ddf568db0e1eb40cb7a4..74a6c042fdec8dfd89331eda36ce14a28a2e4dd7 100644 (file)
@@ -71,6 +71,8 @@ class UART(Elaboratable):
                     ]
                 with m.Else():
                     m.d.sync += self.rx_ovf.eq(1)
+            with m.If(self.rx_ack):
+                m.d.sync += self.rx_rdy.eq(0)
         with m.Else():
             with m.If(rx_phase != 0):
                 m.d.sync += rx_phase.eq(rx_phase - 1)
@@ -135,6 +137,10 @@ if __name__ == "__main__":
 
             yield uart.rx_ack.eq(1)
             yield
+            yield uart.rx_ack.eq(0)
+            yield
+            assert not (yield uart.rx_rdy)
+
         sim.add_sync_process(transmit_proc)
 
         with sim.write_vcd("uart.vcd", "uart.gtkw"):