from migen.actorlib.sim import TokenExchanger
from migen.bus import wishbone, memory
from migen.bus.transactions import *
-from migen.uio.trampoline import Trampoline
class UnifiedIOObject(Module):
def __init__(self, dataflow=None, buses={}):
class UnifiedIOSimulation(UnifiedIOObject):
def __init__(self, generator, dataflow=None, buses={}):
- self.generator = Trampoline(generator)
+ self.generator = generator
UnifiedIOObject.__init__(self, dataflow, buses)
callers = []
+++ /dev/null
-import types
-
-class Trampoline:
- def __init__(self, g):
- self.stack = [g]
-
- def __iter__(self):
- return self
-
- def __next__(self):
- while True:
- while True:
- try:
- r = next(self.stack[-1])
- break
- except StopIteration:
- self.stack.pop()
- if not self.stack:
- raise
- if isinstance(r, types.GeneratorType):
- self.stack.append(r)
- else:
- return r