# Node ID 3cc618608259f28ad97f59dfc95ae7e582c35bb0 # Parent e77f25583997bb414dd468ddc8299ce62660d9eb diff --git a/configs/common/Options.py b/configs/common/Options.py --- a/configs/common/Options.py +++ b/configs/common/Options.py @@ -148,6 +148,9 @@ parser.add_option("--init-param", action="store", type="int", default=0, help="""Parameter available in simulation with m5 initparam""") + parser.add_option("--initialize-only", action="store_true", default=False, + help="""Exit after initialization. Do not simulate time. + Useful when gem5 is run as a library.""") # Simpoint options parser.add_option("--simpoint-profile", action="store_true", diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py --- a/configs/common/Simulation.py +++ b/configs/common/Simulation.py @@ -581,6 +581,13 @@ cpt_starttick, checkpoint_dir = findCptDir(options, cptdir, testsys) m5.instantiate(checkpoint_dir) + # Initialization is complete. If we're not in control of simulation + # (that is, if we're a slave simulator acting as a component in another + # 'master' simulator) then we're done here. The other simulator will + # call simulate() directly. --initialize-only is used to indicate this. + if options.initialize_only: + return + # Handle the max tick settings now that tick frequency was resolved # during system instantiation # NOTE: the maxtick variable here is in absolute ticks, so it must