structure: remove Fragment.call_sim
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 15 Mar 2013 18:15:48 +0000 (19:15 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 15 Mar 2013 18:15:48 +0000 (19:15 +0100)
migen/fhdl/structure.py
migen/sim/generic.py

index 056d602d8c86dc5e2e744e66812491e5c6f07a9a..ce128019c7624d3a033a38d4bff298219e906ceb 100644 (file)
@@ -293,8 +293,3 @@ class Fragment:
                        pass
                else:
                        cd.rename(new)
-       
-       def call_sim(self, simulator):
-               for s in self.sim:
-                       if simulator.cycle_counter >= 0 or (hasattr(s, "initialize") and s.initialize):
-                               s(simulator)
index 0f56423e70bfbdaccad54718cb10dd89ff535d8e..ff47e6568de86aa639d4541869c5e76f1fb63d7d 100644 (file)
@@ -73,6 +73,11 @@ end
                r += "\nendmodule"
                return r
 
+def _call_sim(fragment, simulator):
+       for s in fragment.sim:
+               if simulator.cycle_counter >= 0 or (hasattr(s, "initialize") and s.initialize):
+                       s(simulator)
+
 class Simulator:
        def __init__(self, fragment, top_level=None, sim_runner=None, sockaddr="simsocket", **vopts):
                if not isinstance(fragment, Fragment):
@@ -102,7 +107,7 @@ class Simulator:
                self.ipc.accept()
                reply = self.ipc.recv()
                assert(isinstance(reply, MessageTick))
-               self.fragment.call_sim(self)
+               _call_sim(self.fragment, self)
        
        def run(self, ncycles=-1):
                self.interrupt = False
@@ -113,7 +118,7 @@ class Simulator:
                        self.ipc.send(MessageGo())
                        reply = self.ipc.recv()
                        assert(isinstance(reply, MessageTick))
-                       self.fragment.call_sim(self)
+                       _call_sim(self.fragment, self)
 
        def rd(self, item, index=0):
                name = self.top_level.top_name + "." \