Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (24 sloc) 641 Bytes
from migen.fhdl.structure import *
class Inst:
def __init__(self, n):
self.n = n = bits_for(self.n-1)
declare_signal(self, "request", BV(self.n))
declare_signal(self, "grant", BV(
def get_fragment(self):
cases = []
for i in range(self.n):
switch = []
for j in reversed(range(i+1,i+self.n)):
t = j % self.n
switch = [
self.grant.eq(Constant(t, BV(
case = If(~self.request[i], *switch)
cases.append([Constant(i, BV(, case])
statement = Case(self.grant, *cases)
return Fragment(sync=[statement])
Jump to Line
Something went wrong with that request. Please try again.