add baud arg to UartDemo so that sim can run it at 9600
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 23 Apr 2022 13:59:57 +0000 (14:59 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 23 Apr 2022 13:59:57 +0000 (14:59 +0100)
uart_demo.py

index 22eecaf428a911f518902ba6603520edf5b6a998..cf318d507b23d94032b05822db7f4ab790faf030 100755 (executable)
@@ -100,8 +100,8 @@ class SimpleUART(Elaboratable):
 
 
 class UartDemo(Elaboratable):
-    def __init__(self, text):
-        self.simple_uart = SimpleUART()
+    def __init__(self, text, baud=115200):
+        self.simple_uart = SimpleUART(baud_rate=baud)
         self.text = str(text)
         self.text_bytes = list(self.text.encode())
 
@@ -152,7 +152,7 @@ class TestUartDemo(unittest.TestCase):
             STOP = enum.auto()
 
         m = Module()
-        dut = UartDemo("test text")
+        dut = UartDemo("test text", baud=9600)
         sample_event = Signal()
         expected_state = Signal(ExpectedState)
         m.submodules.dut = dut