actorlib/control: use numbers of bits instead of maxima

This commit is contained in:
Sebastien Bourdeauducq 2012-06-17 18:29:57 +02:00
parent 4873cfe1a7
commit 75d569a12c

View file

@ -8,14 +8,14 @@ from migen.flow.actor import *
# Generates integers from start to maximum-1 # Generates integers from start to maximum-1
class For(Actor): class For(Actor):
def __init__(self, *maxima, start=False, step=False): def __init__(self, *nbits, start=False, step=False):
self.dimensions = len(maxima) self.dimensions = len(nbits)
self.start = start self.start = start
self.step = step self.step = step
params = ["end"] params = ["end"]
if start: params.append("start") if start: params.append("start")
if step: params.append("step") if step: params.append("step")
self.d_bv = [BV(bits_for(dimension)) for dimension in maxima] self.d_bv = [BV(dimension) for dimension in nbits]
l_sink = [("d{0}".format(n), [(p, bv) for p in params]) l_sink = [("d{0}".format(n), [(p, bv) for p in params])
for n, bv in enumerate(self.d_bv)] for n, bv in enumerate(self.d_bv)]
l_source = [("d{0}".format(n), bv) l_source = [("d{0}".format(n), bv)