roundrobin: use nmigen zero-width signals
This commit is contained in:
parent
e14031fba6
commit
2bd819fcbe
@ -9,16 +9,12 @@ class RoundRobin:
|
|||||||
|
|
||||||
def elaborate(self, platform):
|
def elaborate(self, platform):
|
||||||
m = Module()
|
m = Module()
|
||||||
n = self.n
|
|
||||||
if n > 1:
|
|
||||||
with m.Switch(self.grant):
|
with m.Switch(self.grant):
|
||||||
for i in range(n):
|
for i in range(self.n):
|
||||||
with m.Case(i):
|
with m.Case(i):
|
||||||
with m.If(~self.request[i]):
|
with m.If(~self.request[i]):
|
||||||
for j in reversed(range(i+1, i+n)):
|
for j in reversed(range(i+1, i+self.n)):
|
||||||
t = j % n
|
t = j % self.n
|
||||||
with m.If(self.request[t]):
|
with m.If(self.request[t]):
|
||||||
m.d.sync += self.grant.eq(t)
|
m.d.sync += self.grant.eq(t)
|
||||||
else:
|
|
||||||
m.d.comb += self.grant.eq(0)
|
|
||||||
return m
|
return m
|
||||||
|
Loading…
Reference in New Issue
Block a user