wishbone.bus: borrow & re-design Arbiter from 'jfng/wishbone-arbiter'
[nmigen-soc.git] / nmigen_soc / scheduler.py
index 7af3b107f4dd12347798f4769e5a866f11507665..779e95c893ba0c4f53992ebc88005dff488f240c 100644 (file)
@@ -34,12 +34,11 @@ class RoundRobin(Elaboratable):
             with m.Switch(self.grant):
                 for i in range(self.n):
                     with m.Case(i):
-                        with m.If(~self.request[i]):
-                            for j in reversed(range(i+1, i+self.n)):
-                                # If i+1 <= j < n, then t == j;     (after i)
-                                # If n <= j < i+n, then t == j - n  (before i)
-                                t = j % self.n
-                                with m.If(self.request[t]):
-                                    m.d.sync += self.grant.eq(t)
+                        for j in reversed(range(i+1, i+self.n)):
+                            # If i+1 <= j < n, then t == j;     (after i)
+                            # If n <= j < i+n, then t == j - n  (before i)
+                            t = j % self.n
+                            with m.If(self.request[t]):
+                                m.d.sync += self.grant.eq(t)
 
         return m
\ No newline at end of file