From: Jean THOMAS Date: Fri, 17 Jul 2020 15:22:27 +0000 (+0200) Subject: Add test for _AntiStarvation timer duration X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e4c06880e9076d400f5b56e833d5f0c824f42dd;p=gram.git Add test for _AntiStarvation timer duration --- diff --git a/gram/test/test_core_multiplexer.py b/gram/test/test_core_multiplexer.py index 1076bb9..4cbfe50 100644 --- a/gram/test/test_core_multiplexer.py +++ b/gram/test/test_core_multiplexer.py @@ -4,6 +4,25 @@ from gram.core.multiplexer import _AntiStarvation from utils import * class AntiStarvationTestCase(FHDLTestCase): + def test_duration(self): + def generic_test(timeout): + m = Module() + m.submodules = dut = _AntiStarvation(timeout) + + def process(): + yield dut.en.eq(1) + yield + yield dut.en.eq(0) + yield + + for i in range(timeout): + self.assertFalse((yield dut.max_time)) + yield + + self.assertTrue((yield dut.max_time)) + + runSimulation(m, process, "test_core_multiplexer_antistarvation.vcd") + def test_formal(self): def generic_test(timeout): dut = _AntiStarvation(timeout) @@ -13,3 +32,4 @@ class AntiStarvationTestCase(FHDLTestCase): #generic_test(1) generic_test(5) generic_test(10) + generic_test(0x20)