Commit 504a169a authored by Sébastien Bourdeauducq's avatar Sébastien Bourdeauducq
Browse files

Merge pull request #2 from larsclausen/master

migen patches
parents 3143608e 8380318e
...@@ -17,9 +17,9 @@ class For(Actor): ...@@ -17,9 +17,9 @@ class For(Actor):
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(bits_for(dimension)) for dimension in maxima]
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 zip(range(len(self.d_bv)), 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)
for n, bv in zip(range(len(self.d_bv)), self.d_bv)] for n, bv in enumerate(self.d_bv)]
Actor.__init__(self, SchedulingModel(SchedulingModel.DYNAMIC), Actor.__init__(self, SchedulingModel(SchedulingModel.DYNAMIC),
("sink", Sink, l_sink), ("sink", Sink, l_sink),
("source", Source, l_source)) ("source", Source, l_source))
......
...@@ -5,7 +5,7 @@ class FSM: ...@@ -5,7 +5,7 @@ class FSM:
self._state_bv = BV(bits_for(len(states)-1)) self._state_bv = BV(bits_for(len(states)-1))
self._state = Signal(self._state_bv) self._state = Signal(self._state_bv)
self._next_state = Signal(self._state_bv) self._next_state = Signal(self._state_bv)
for state, n in zip(states, range(len(states))): for n, state in enumerate(states):
setattr(self, state, Constant(n, self._state_bv)) setattr(self, state, Constant(n, self._state_bv))
self.actions = [[] for i in range(len(states))] self.actions = [[] for i in range(len(states))]
...@@ -20,7 +20,7 @@ class FSM: ...@@ -20,7 +20,7 @@ class FSM:
def get_fragment(self): def get_fragment(self):
cases = [[Constant(s, self._state_bv)] + a cases = [[Constant(s, self._state_bv)] + a
for s, a in zip(range(len(self.actions)), self.actions) if a] for s, a in enumerate(self.actions) if a]
comb = [ comb = [
self._next_state.eq(self._state), self._next_state.eq(self._state),
Case(self._state, *cases) Case(self._state, *cases)
......
...@@ -16,6 +16,9 @@ def get_var_name(frame): ...@@ -16,6 +16,9 @@ def get_var_name(frame):
elif opc == "STORE_FAST": elif opc == "STORE_FAST":
name_index = int(code.co_code[index+1]) name_index = int(code.co_code[index+1])
return code.co_varnames[name_index] return code.co_varnames[name_index]
elif opc == "STORE_DEREF":
name_index = int(code.co_code[index+1])
return code.co_cellvars[name_index]
elif opc == "LOAD_GLOBAL" or opc == "LOAD_ATTR" or opc == "LOAD_FAST": elif opc == "LOAD_GLOBAL" or opc == "LOAD_ATTR" or opc == "LOAD_FAST":
index += 3 index += 3
elif opc == "DUP_TOP": elif opc == "DUP_TOP":
......
...@@ -19,8 +19,8 @@ class Combinator(Actor): ...@@ -19,8 +19,8 @@ class Combinator(Actor):
def __init__(self, layout, *subrecords): def __init__(self, layout, *subrecords):
source = Record(layout) source = Record(layout)
subrecords = [source.subrecord(*subr) for subr in subrecords] subrecords = [source.subrecord(*subr) for subr in subrecords]
eps = [("sink{0}".format(x[0]), Sink, x[1]) eps = [("sink{0}".format(n), Sink, r)
for x in zip(range(len(subrecords)), subrecords)] for x in enumerate(subrecords)]
ep_source = ("source", Source, source) ep_source = ("source", Source, source)
eps.append(ep_source) eps.append(ep_source)
Actor.__init__(self, Actor.__init__(self,
...@@ -39,8 +39,8 @@ class Splitter(Actor): ...@@ -39,8 +39,8 @@ class Splitter(Actor):
def __init__(self, layout, *subrecords): def __init__(self, layout, *subrecords):
sink = Record(layout) sink = Record(layout)
subrecords = [sink.subrecord(*subr) for subr in subrecords] subrecords = [sink.subrecord(*subr) for subr in subrecords]
eps = [("source{0}".format(x[0]), Source, x[1]) eps = [("source{0}".format(n), Source, r)
for x in zip(range(len(subrecords)), subrecords)] for n, r in enumerate(subrecords)]
ep_sink = ("sink", Sink, sink) ep_sink = ("sink", Sink, sink)
eps.append(ep_sink) eps.append(ep_sink)
Actor.__init__(self, Actor.__init__(self,
......
#!/usr/bin/env python3.2 #!/usr/bin/env python3
# vim: noexpandtab:tabstop=8:softtabstop=8 # vim: noexpandtab:tabstop=8:softtabstop=8
""" Migen's distutils distribution and installation script. """ """ Migen's distutils distribution and installation script. """
...@@ -8,7 +8,7 @@ from distutils.core import setup ...@@ -8,7 +8,7 @@ from distutils.core import setup
here = os.path.abspath(os.path.dirname(__file__)) here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, "README")).read() README = open(os.path.join(here, "README")).read()
required_version = (3, 2) required_version = (3, 1)
if sys.version_info < required_version: if sys.version_info < required_version:
raise SystemExit("migen requires python {0} or greater".format( raise SystemExit("migen requires python {0} or greater".format(
".".join(map(str, required_version)))) ".".join(map(str, required_version))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment