diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2010-08-17 05:06:22 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2010-08-17 05:06:22 -0700 |
commit | 1fbe466345b43caabece9730c1f0456f1b57b82f (patch) | |
tree | 8285f10d6ab642649d74ae79909508679f264d54 /configs | |
parent | 0f8b5afd7ad82fda05c3ad42cda4f9046992428d (diff) | |
download | gem5-1fbe466345b43caabece9730c1f0456f1b57b82f.tar.xz |
sim: make Python Root object a singleton
Enforce that the Python Root SimObject is instantiated only
once. The C++ Root object already panics if more than one is
created. This change avoids the need to track what the root
object is, since it's available from Root.getInstance() (if it
exists). It's now redundant to have the user pass the root
object to functions like instantiate(), checkpoint(), and
restoreCheckpoint(), so that arg is gone. Users who use
configs/common/Simulate.py should not notice.
Diffstat (limited to 'configs')
-rw-r--r-- | configs/common/Simulation.py | 20 | ||||
-rw-r--r-- | configs/example/memtest-ruby.py | 2 | ||||
-rw-r--r-- | configs/example/memtest.py | 2 | ||||
-rw-r--r-- | configs/example/rubytest.py | 2 | ||||
-rw-r--r-- | configs/splash2/cluster.py | 2 | ||||
-rw-r--r-- | configs/splash2/run.py | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py index 905e435d3..0393b0dfa 100644 --- a/configs/common/Simulation.py +++ b/configs/common/Simulation.py @@ -190,7 +190,7 @@ def run(options, root, testsys, cpu_class): for i in xrange(np): testsys.cpu[i].max_insts_any_thread = offset - m5.instantiate(root) + m5.instantiate() if options.checkpoint_restore != None: from os.path import isdir, exists @@ -207,7 +207,7 @@ def run(options, root, testsys, cpu_class): fatal("Unable to find checkpoint directory %s", checkpoint_dir) print "Restoring checkpoint ..." - m5.restoreCheckpoint(root, checkpoint_dir) + m5.restoreCheckpoint(checkpoint_dir) print "Done." elif options.simpoint: # assume workload 0 has the simpoint @@ -224,7 +224,7 @@ def run(options, root, testsys, cpu_class): options.bench, options.checkpoint_restore) print "Restoring checkpoint ..." - m5.restoreCheckpoint(root,checkpoint_dir) + m5.restoreCheckpoint(checkpoint_dir) print "Done." else: dirs = listdir(cptdir) @@ -246,8 +246,8 @@ def run(options, root, testsys, cpu_class): maxtick = maxtick - int(cpts[cpt_num - 1]) ## Restore the checkpoint - m5.restoreCheckpoint(root, - joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1])) + m5.restoreCheckpoint(joinpath(cptdir, + "cpt.%s" % cpts[cpt_num - 1])) if options.standard_switch or cpu_class: if options.standard_switch: @@ -324,7 +324,7 @@ def run(options, root, testsys, cpu_class): if exit_event.getCause() == \ "a thread reached the max instruction count": - m5.checkpoint(root, joinpath(cptdir, "cpt.%s.%d" % \ + m5.checkpoint(joinpath(cptdir, "cpt.%s.%d" % \ (options.bench, checkpoint_inst))) print "Checkpoint written." num_checkpoints += 1 @@ -341,7 +341,7 @@ def run(options, root, testsys, cpu_class): exit_event = m5.simulate(when - m5.curTick()) if exit_event.getCause() == "simulate() limit reached": - m5.checkpoint(root, joinpath(cptdir, "cpt.%d")) + m5.checkpoint(joinpath(cptdir, "cpt.%d")) num_checkpoints += 1 sim_ticks = when @@ -358,7 +358,7 @@ def run(options, root, testsys, cpu_class): while exit_event.getCause() == "checkpoint": exit_event = m5.simulate(sim_ticks - m5.curTick()) if exit_event.getCause() == "simulate() limit reached": - m5.checkpoint(root, joinpath(cptdir, "cpt.%d")) + m5.checkpoint(joinpath(cptdir, "cpt.%d")) num_checkpoints += 1 if exit_event.getCause() != "simulate() limit reached": @@ -371,7 +371,7 @@ def run(options, root, testsys, cpu_class): exit_event = m5.simulate(maxtick) while exit_event.getCause() == "checkpoint": - m5.checkpoint(root, joinpath(cptdir, "cpt.%d")) + m5.checkpoint(joinpath(cptdir, "cpt.%d")) num_checkpoints += 1 if num_checkpoints == max_checkpoints: exit_cause = "maximum %d checkpoints dropped" % max_checkpoints @@ -385,5 +385,5 @@ def run(options, root, testsys, cpu_class): print 'Exiting @ cycle %i because %s' % (m5.curTick(), exit_cause) if options.checkpoint_at_end: - m5.checkpoint(root, joinpath(cptdir, "cpt.%d")) + m5.checkpoint(joinpath(cptdir, "cpt.%d")) diff --git a/configs/example/memtest-ruby.py b/configs/example/memtest-ruby.py index 709d31844..16d86f0bc 100644 --- a/configs/example/memtest-ruby.py +++ b/configs/example/memtest-ruby.py @@ -129,7 +129,7 @@ else: m5.ticks.setGlobalFrequency('1ns') # instantiate configuration -m5.instantiate(root) +m5.instantiate() # simulate until program terminates exit_event = m5.simulate(options.maxtick) diff --git a/configs/example/memtest.py b/configs/example/memtest.py index d4497092b..0713dd241 100644 --- a/configs/example/memtest.py +++ b/configs/example/memtest.py @@ -181,7 +181,7 @@ else: m5.ticks.setGlobalFrequency('1ns') # instantiate configuration -m5.instantiate(root) +m5.instantiate() # simulate until program terminates exit_event = m5.simulate(options.maxtick) diff --git a/configs/example/rubytest.py b/configs/example/rubytest.py index 13b862756..c9cf0aba4 100644 --- a/configs/example/rubytest.py +++ b/configs/example/rubytest.py @@ -118,7 +118,7 @@ root.system.mem_mode = 'timing' m5.ticks.setGlobalFrequency('1ns') # instantiate configuration -m5.instantiate(root) +m5.instantiate() # simulate until program terminates exit_event = m5.simulate(options.maxtick) diff --git a/configs/splash2/cluster.py b/configs/splash2/cluster.py index 45c9ede82..77591dc62 100644 --- a/configs/splash2/cluster.py +++ b/configs/splash2/cluster.py @@ -292,7 +292,7 @@ if options.timing or options.detailed: root.system.mem_mode = 'timing' # instantiate configuration -m5.instantiate(root) +m5.instantiate() # simulate until program terminates if options.maxtick: diff --git a/configs/splash2/run.py b/configs/splash2/run.py index 95ec790ba..24faade17 100644 --- a/configs/splash2/run.py +++ b/configs/splash2/run.py @@ -276,7 +276,7 @@ if options.timing or options.detailed: root.system.mem_mode = 'timing' # instantiate configuration -m5.instantiate(root) +m5.instantiate() # simulate until program terminates if options.maxtick: |