[Libre-soc-bugs] [Bug 510] check for combinatorial path through DIV FSM

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Oct 4 23:29:15 BST 2020


https://bugs.libre-soc.org/show_bug.cgi?id=510

--- Comment #2 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
neat trick, i love it! :)

diff --git a/src/soc/fu/div/fsm.py b/src/soc/fu/div/fsm.py
index 9083d6b9..2a78b19a 100644
--- a/src/soc/fu/div/fsm.py
+++ b/src/soc/fu/div/fsm.py
@@ -106,7 +106,14 @@ class DivState:

     @property
     def done(self):
-        return self.q_bits_known == self.quotient_width
+        return self.will_be_done_after(steps=0)
+
+    def will_be_done_after(self, steps):
+        """ Returns 1 if this state will be done after
+            another `steps` passes through DivStateNext."""
+        assert isinstance(steps, int), "steps must be an integer"
+        assert steps >= 0
+        return self.q_bits_known >= max(0, self.quotient_width - steps)

     @property
     def quotient(self):

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list