From 814e70f888f65ed93859cd4ad58904e285d246e2 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Fri, 24 Jul 2020 14:36:32 +0200 Subject: [PATCH] Fix AntiStarvation --- gram/core/multiplexer.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gram/core/multiplexer.py b/gram/core/multiplexer.py index 62bc7b2..789a07b 100644 --- a/gram/core/multiplexer.py +++ b/gram/core/multiplexer.py @@ -220,16 +220,18 @@ class _AntiStarvation(Elaboratable): if self._timeout > 0: time = Signal(range(self._timeout)) with m.If(~self.en): - m.d.sync += time.eq(self._timeout-1) + m.d.sync += [ + time.eq(self._timeout-1), + self.max_time.eq(0), + ] + with m.Elif(time != 0): + m.d.sync += [ + time.eq(time-1) + ] with m.If(time == 1): m.d.sync += self.max_time.eq(1) with m.Else(): m.d.sync += self.max_time.eq(0) - with m.Elif(time != 0): - m.d.sync += [ - time.eq(time-1), - self.max_time.eq(0), - ] else: m.d.comb += self.max_time.eq(0) -- 2.30.2