sim/generic: support implicit get_fragment
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 12 Mar 2013 15:54:01 +0000 (16:54 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 12 Mar 2013 15:54:01 +0000 (16:54 +0100)
migen/sim/generic.py

index 178366128e358883e0331bb0e21e84a49ce081be..b553dc7b5c9a75a8f25d926504493a027109cb4e 100644 (file)
@@ -76,6 +76,8 @@ end
 
 class Simulator:
        def __init__(self, fragment, top_level=None, sim_runner=None, sockaddr="simsocket", **vopts):
+               if not isinstance(fragment, Fragment):
+                       fragment = fragment.get_fragment()
                if top_level is None:
                        top_level = TopLevel()
                if sim_runner is None: