Raise ValueError if anti-starvation timeout is unsupported (fixing #48)
authorJean THOMAS <git0@pub.jeanthomas.me>
Tue, 4 Aug 2020 13:45:37 +0000 (15:45 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Tue, 4 Aug 2020 13:45:37 +0000 (15:45 +0200)
gram/core/multiplexer.py

index 37114dca207922f5fcf1db1586373a673a17c65f..9de4b2baf8476d80891c525a554a39202d481127 100644 (file)
@@ -206,6 +206,9 @@ class _Steerer(Elaboratable):
 
 class _AntiStarvation(Elaboratable):
     def __init__(self, timeout):
+        if timeout <= 2:
+            raise ValueError("Timeout values under 2 are not currently supported")
+
         self.en = Signal()
         self.max_time = Signal(reset=1)
         self._timeout = timeout
@@ -213,9 +216,6 @@ class _AntiStarvation(Elaboratable):
     def elaborate(self, platform):
         m = Module()
 
-        # TODO: timeout=1 fails formal checks
-        assert self._timeout != 1
-
         if self._timeout > 0:
             time = Signal(range(self._timeout))
             with m.If(~self.en):