dx = 5
dy = 5
-x = Signal(bits_for(dx-1))
-y = Signal(bits_for(dy-1))
+x = Signal(max=dx)
+y = Signal(max=dy)
out = Signal()
my_2d_array = Array(Array(Signal() for a in range(dx)) for b in range(dy))
("source", Source, layout_to))
def get_fragment(self):
- muxbits = bits_for(self.n-1)
- mux = Signal(muxbits)
+ mux = Signal(max=self.n)
last = Signal()
comb = [
last.eq(mux == (self.n-1)),
("source", Source, pack_layout(layout_from, n)))
def get_fragment(self):
- demuxbits = bits_for(self.n-1)
- demux = Signal(demuxbits)
+ demux = Signal(max=self.n)
load_part = Signal()
strobe_all = Signal()
self.adr = Signal(aw)
self.time = time
if self.time:
- self._counter = Signal(bits_for(time))
+ self._counter = Signal(max=time+1)
self.mature = Signal()
self.allocate = Signal()
self.base = base
nslots = len(self.slots)
if nslots > 1:
- self.tag_issue = Signal(bits_for(nslots-1))
+ self.tag_issue = Signal(max=nslots)
self.tag_call = Signal(tagbits)
def get_call_expression(self, slotn=0):
w = self.w
qr = Signal(2*w)
- counter = Signal(bits_for(w))
+ counter = Signal(max=w+1)
divisor_r = Signal(w)
diff = Signal(w+1)
def timeline(trigger, events):
lastevent = max([e[0] for e in events])
- counter = Signal(bits_for(lastevent))
+ counter = Signal(max=lastevent+1)
counterlogic = If(counter != 0,
counter.eq(counter + 1)
class RoundRobin:
def __init__(self, n, switch_policy=SP_WITHDRAW):
self.n = n
- self.bn = bits_for(self.n-1)
- self.request = Signal(self.n)
+ self.request = Signal(max=self.n)
self.grant = Signal(self.bn)
self.switch_policy = switch_policy
if self.switch_policy == SP_CE:
def get_binary_control_fragment(self, stb_i, ack_o, stb_o, ack_i):
ready = Signal()
- timer = Signal(bits_for(self.delay))
+ timer = Signal(max=self.delay+1)
comb = [ready.eq(timer == 0)]
sync = [
If(self.trigger,