summaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
Diffstat (limited to 'configs')
-rw-r--r--configs/common/Options.py6
-rw-r--r--configs/common/Simulation.py35
2 files changed, 39 insertions, 2 deletions
diff --git a/configs/common/Options.py b/configs/common/Options.py
index 225916840..3cd3342b8 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2006-2007 The Regents of The University of Michigan
+# Copyright (c) 2006-2008 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -60,3 +60,7 @@ parser.add_option("-s", "--standard_switch", action="store_true",
parser.add_option("-w", "--warmup", action="store", type="int",
help="if -s, then this is the warmup period. else, this is ignored",
default=5000000000)
+parser.add_option("-f", "--fast_forward", type="int", action="store",
+ help="fast_forward count in instructions: use alone to checkpoint or with -s and -max_inst")
+parser.add_option("--max_inst", type="int", action="store",
+ help="max_insts_any_thread value")
diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py
index cea391c5d..f6b289fb5 100644
--- a/configs/common/Simulation.py
+++ b/configs/common/Simulation.py
@@ -95,6 +95,9 @@ def run(options, root, testsys, cpu_class):
switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
if options.standard_switch:
+ if (options.fast_forward and options.warmup):
+ m5.panic("Must specify either warmup OR fast-forward with -s!")
+
switch_cpus = [TimingSimpleCPU(defer_registration=True, cpu_id=(np+i))
for i in xrange(np)]
switch_cpus_1 = [DerivO3CPU(defer_registration=True, cpu_id=(2*np+i))
@@ -109,6 +112,11 @@ def run(options, root, testsys, cpu_class):
switch_cpus[i].clock = testsys.cpu[0].clock
switch_cpus_1[i].clock = testsys.cpu[0].clock
+ if options.fast_forward:
+ switch_cpus[i].max_insts_any_thread = options.fast_forward
+ if options.max_inst:
+ switch_cpus_1[i].max_insts_any_thread = options.max_inst
+
if not options.caches:
# O3 CPU must have a cache to work.
switch_cpus_1[i].addPrivateSplitL1Caches(L1Cache(size = '32kB'),
@@ -121,6 +129,10 @@ def run(options, root, testsys, cpu_class):
switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
switch_cpu_list1 = [(switch_cpus[i], switch_cpus_1[i]) for i in xrange(np)]
+ elif options.fast_forward:
+ for i in xrange(np):
+ testsys.cpu[i].max_insts_any_thread = options.fast_forward
+
m5.instantiate(root)
if options.checkpoint_restore:
@@ -167,11 +179,32 @@ def run(options, root, testsys, cpu_class):
m5.resume(testsys)
if options.standard_switch:
- exit_event = m5.simulate(options.warmup)
+ if (options.warmup):
+ exit_event = m5.simulate(options.warmup)
+ if options.fast_forward:
+ exit_event = m5.simulate()
m5.drain(testsys)
m5.switchCpus(switch_cpu_list1)
m5.resume(testsys)
+ # This should *only* be used by itself to take a checkpoint!
+ # Otherwise, use standard_switch
+ elif options.fast_forward:
+ exit_event = m5.simulate()
+
+ while exit_event.getCause() != "a thread reached the max instruction count":
+ if exit_event.getCause() == "user interrupt received":
+ print "User interrupt! Switching to simulation mode"
+ break
+ else:
+ m5.simulate(True)
+
+ if exit_event.getCause() == "a thread reached the max instruction count":
+ print "Reached fast_forward count %d; starting simulation at cycle %d" % (options.fast_forward, m5.curTick())
+
+ m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
+ return
+
num_checkpoints = 0
exit_cause = ''