uio: remove Trampoline (Python 3.3 provides generator delegation instead)
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Wed, 10 Apr 2013 20:15:28 +0000 (22:15 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Wed, 10 Apr 2013 20:15:28 +0000 (22:15 +0200)
migen/uio/ioo.py
migen/uio/trampoline.py [deleted file]

index e618c2c62a7da57a0fdce7ecdda59130fc8a2613..9257ad0b4d3b6d0ff9eea13eadd922e55cc778f4 100644 (file)
@@ -5,7 +5,6 @@ from migen.flow.transactions import *
 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={}):
@@ -20,7 +19,7 @@ class UnifiedIOObject(Module):
 
 class UnifiedIOSimulation(UnifiedIOObject):
        def __init__(self, generator, dataflow=None, buses={}):
-               self.generator = Trampoline(generator)
+               self.generator = generator
                UnifiedIOObject.__init__(self, dataflow, buses)
                
                callers = []
diff --git a/migen/uio/trampoline.py b/migen/uio/trampoline.py
deleted file mode 100644 (file)
index 912427d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-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