Simulation.py (9521:1cd02decbfd3) Simulation.py (9606:0a4b702628bd)
1# Copyright (c) 2012 ARM Limited
2# All rights reserved
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 198 unchanged lines hidden (view full) ---

207 exit_cause = exit_event.getCause()
208 sim_ticks += period
209 while exit_event.getCause() == "checkpoint":
210 exit_event = m5.simulate(sim_ticks - m5.curTick())
211 if exit_event.getCause() == "simulate() limit reached":
212 m5.checkpoint(joinpath(cptdir, "cpt.%d"))
213 num_checkpoints += 1
214
1# Copyright (c) 2012 ARM Limited
2# All rights reserved
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 198 unchanged lines hidden (view full) ---

207 exit_cause = exit_event.getCause()
208 sim_ticks += period
209 while exit_event.getCause() == "checkpoint":
210 exit_event = m5.simulate(sim_ticks - m5.curTick())
211 if exit_event.getCause() == "simulate() limit reached":
212 m5.checkpoint(joinpath(cptdir, "cpt.%d"))
213 num_checkpoints += 1
214
215 return exit_cause
215 return exit_event
216
217def benchCheckpoints(options, maxtick, cptdir):
218 exit_event = m5.simulate(maxtick)
219 exit_cause = exit_event.getCause()
220
221 num_checkpoints = 0
222 max_checkpoints = options.max_checkpoints
223

--- 235 unchanged lines hidden (view full) ---

459 else:
460 cptdir = getcwd()
461
462 if options.take_checkpoints != None :
463 # Checkpoints being taken via the command line at <when> and at
464 # subsequent periods of <period>. Checkpoint instructions
465 # received from the benchmark running are ignored and skipped in
466 # favor of command line checkpoint instructions.
216
217def benchCheckpoints(options, maxtick, cptdir):
218 exit_event = m5.simulate(maxtick)
219 exit_cause = exit_event.getCause()
220
221 num_checkpoints = 0
222 max_checkpoints = options.max_checkpoints
223

--- 235 unchanged lines hidden (view full) ---

459 else:
460 cptdir = getcwd()
461
462 if options.take_checkpoints != None :
463 # Checkpoints being taken via the command line at <when> and at
464 # subsequent periods of <period>. Checkpoint instructions
465 # received from the benchmark running are ignored and skipped in
466 # favor of command line checkpoint instructions.
467 exit_cause = scriptCheckpoints(options, maxtick, cptdir)
467 exit_event = scriptCheckpoints(options, maxtick, cptdir)
468 else:
469 if options.fast_forward:
470 m5.stats.reset()
471 print "**** REAL SIMULATION ****"
472
473 # If checkpoints are being taken, then the checkpoint instruction
474 # will occur in the benchmark code it self.
475 if options.repeat_switch and maxtick > options.repeat_switch:
476 exit_event = repeatSwitch(testsys, repeat_switch_cpu_list,
477 maxtick, options.repeat_switch)
478 else:
479 exit_event = benchCheckpoints(options, maxtick, cptdir)
480
481 print 'Exiting @ tick %i because %s' % (m5.curTick(), exit_event.getCause())
482 if options.checkpoint_at_end:
483 m5.checkpoint(joinpath(cptdir, "cpt.%d"))
484
485 if not m5.options.interactive:
486 sys.exit(exit_event.getCode())
468 else:
469 if options.fast_forward:
470 m5.stats.reset()
471 print "**** REAL SIMULATION ****"
472
473 # If checkpoints are being taken, then the checkpoint instruction
474 # will occur in the benchmark code it self.
475 if options.repeat_switch and maxtick > options.repeat_switch:
476 exit_event = repeatSwitch(testsys, repeat_switch_cpu_list,
477 maxtick, options.repeat_switch)
478 else:
479 exit_event = benchCheckpoints(options, maxtick, cptdir)
480
481 print 'Exiting @ tick %i because %s' % (m5.curTick(), exit_event.getCause())
482 if options.checkpoint_at_end:
483 m5.checkpoint(joinpath(cptdir, "cpt.%d"))
484
485 if not m5.options.interactive:
486 sys.exit(exit_event.getCode())