From 1e4c06880e9076d400f5b56e833d5f0c824f42dd Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Fri, 17 Jul 2020 17:22:27 +0200 Subject: [PATCH] Add test for _AntiStarvation timer duration --- gram/test/test_core_multiplexer.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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) -- 2.30.2