X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=nmigen_soc%2Fscheduler.py;h=779e95c893ba0c4f53992ebc88005dff488f240c;hb=7d36906b4f721114ac28dd4e9cc151d3e389fc15;hp=7af3b107f4dd12347798f4769e5a866f11507665;hpb=976cef46fd5c2661eb22262dc135ebfa38097883;p=nmigen-soc.git diff --git a/nmigen_soc/scheduler.py b/nmigen_soc/scheduler.py index 7af3b10..779e95c 100644 --- a/nmigen_soc/scheduler.py +++ b/nmigen_soc/scheduler.py @@ -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