From e5f4e784e01bc1033cb06a7e7c6ee4c665396822 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Wed, 5 Aug 2020 14:54:30 +0200 Subject: [PATCH] Add unit test for tXXDController --- gram/test/test_common.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gram/test/test_common.py b/gram/test/test_common.py index 7205478..f775ea1 100644 --- a/gram/test/test_common.py +++ b/gram/test/test_common.py @@ -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) -- 2.30.2