Simulation.py (3509:ff94a3eda992) Simulation.py (3511:8cb26619b6ec)
1# Copyright (c) 2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

60def run(options, root, testsys, cpu_class):
61 if options.maxtick:
62 maxtick = options.maxtick
63 elif options.maxtime:
64 simtime = int(options.maxtime * root.clock.value)
65 print "simulating for: ", simtime
66 maxtick = simtime
67 else:
1# Copyright (c) 2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

60def run(options, root, testsys, cpu_class):
61 if options.maxtick:
62 maxtick = options.maxtick
63 elif options.maxtime:
64 simtime = int(options.maxtime * root.clock.value)
65 print "simulating for: ", simtime
66 maxtick = simtime
67 else:
68 maxtick = -1
68 maxtick = m5.MaxTick
69
70 if options.checkpoint_dir:
71 cptdir = options.checkpoint_dir
72 else:
73 cptdir = getcwd()
74
75 np = options.num_cpus
76 max_checkpoints = options.max_checkpoints

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

186
187 if exit_event.getCause() == "simulate() limit reached":
188 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
189 num_checkpoints += 1
190
191 sim_ticks = when
192 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
193 while num_checkpoints < max_checkpoints:
69
70 if options.checkpoint_dir:
71 cptdir = options.checkpoint_dir
72 else:
73 cptdir = getcwd()
74
75 np = options.num_cpus
76 max_checkpoints = options.max_checkpoints

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

186
187 if exit_event.getCause() == "simulate() limit reached":
188 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
189 num_checkpoints += 1
190
191 sim_ticks = when
192 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
193 while num_checkpoints < max_checkpoints:
194 if (sim_ticks + period) > maxtick and maxtick != -1:
194 if (sim_ticks + period) > maxtick:
195 exit_event = m5.simulate(maxtick - sim_ticks)
196 exit_cause = exit_event.getCause()
197 break
198 else:
199 exit_event = m5.simulate(period)
200 sim_ticks += period
201 while exit_event.getCause() == "checkpoint":
202 exit_event = m5.simulate(sim_ticks - m5.curTick())

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

209
210 while exit_event.getCause() == "checkpoint":
211 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
212 num_checkpoints += 1
213 if num_checkpoints == max_checkpoints:
214 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
215 break
216
195 exit_event = m5.simulate(maxtick - sim_ticks)
196 exit_cause = exit_event.getCause()
197 break
198 else:
199 exit_event = m5.simulate(period)
200 sim_ticks += period
201 while exit_event.getCause() == "checkpoint":
202 exit_event = m5.simulate(sim_ticks - m5.curTick())

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

209
210 while exit_event.getCause() == "checkpoint":
211 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
212 num_checkpoints += 1
213 if num_checkpoints == max_checkpoints:
214 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
215 break
216
217 if maxtick == -1:
218 exit_event = m5.simulate(maxtick)
219 else:
220 exit_event = m5.simulate(maxtick - m5.curTick())
221
217 exit_event = m5.simulate(maxtick - m5.curTick())
222 exit_cause = exit_event.getCause()
223
224 if exit_cause == '':
225 exit_cause = exit_event.getCause()
226 print 'Exiting @ cycle', m5.curTick(), 'because ', exit_cause
227
218 exit_cause = exit_event.getCause()
219
220 if exit_cause == '':
221 exit_cause = exit_event.getCause()
222 print 'Exiting @ cycle', m5.curTick(), 'because ', exit_cause
223