Add unit test for tXXDController
authorJean THOMAS <git0@pub.jeanthomas.me>
Wed, 5 Aug 2020 12:54:30 +0000 (14:54 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Wed, 5 Aug 2020 12:54:30 +0000 (14:54 +0200)
gram/test/test_common.py

index 720547809d9cbb7064708791925bf1d5f1c11c1c..f775ea1d1b669fcf3b2be7dde109b1fda6256df3 100644 (file)
@@ -17,6 +17,28 @@ class tXXDControllerTestCase(FHDLTestCase):
         generic_test(5)
         generic_test(10)
 
+    def test_delay(self):
+        def generic_test(txxd):
+            dut = tXXDController(txxd)
+
+            yield dut.valid.eq(1)
+            yield; yield Delay(1e-8)
+            self.assertFalse((yield dut.ready))
+
+            yield dut.valid.eq(0)
+
+            for i in range(txxd):
+                self.assertFalse((yield dut.ready))
+                yield
+
+            self.assertTrue((yield dut.ready))
+
+            runSimulation(dut, process, "test_common_txxdcontroller.vcd")
+
+        generic_test(1)
+        generic_test(5)
+        generic_test(10)
+
 class tFAWControllerTestCase(FHDLTestCase):
     def test_strobe_3(self):
         dut = tFAWController(10)