Simulation.py (3681:129a68314264) Simulation.py (3999:ba54519a7a92)
1# Copyright (c) 2006 The Regents of The University of Michigan
1# Copyright (c) 2006-2007 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
9# notice, this list of conditions and the following disclaimer in the

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

139
140 cpts.sort(lambda a,b: cmp(long(a), long(b)))
141
142 cpt_num = options.checkpoint_restore
143
144 if cpt_num > len(cpts):
145 m5.panic('Checkpoint %d not found' % cpt_num)
146
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
9# notice, this list of conditions and the following disclaimer in the

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

139
140 cpts.sort(lambda a,b: cmp(long(a), long(b)))
141
142 cpt_num = options.checkpoint_restore
143
144 if cpt_num > len(cpts):
145 m5.panic('Checkpoint %d not found' % cpt_num)
146
147 ## Adjust max tick based on our starting tick
148 maxtick = maxtick - int(cpts[cpt_num - 1])
149
150 ## Restore the checkpoint
147 m5.restoreCheckpoint(root,
148 joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1]))
149
150 if options.standard_switch or cpu_class:
151 exit_event = m5.simulate(10000)
152
153 ## when you change to Timing (or Atomic), you halt the system given
154 ## as argument. When you are finished with the system changes

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

180 exit_event = m5.simulate(when - m5.curTick())
181
182 if exit_event.getCause() == "simulate() limit reached":
183 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
184 num_checkpoints += 1
185
186 sim_ticks = when
187 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
151 m5.restoreCheckpoint(root,
152 joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1]))
153
154 if options.standard_switch or cpu_class:
155 exit_event = m5.simulate(10000)
156
157 ## when you change to Timing (or Atomic), you halt the system given
158 ## as argument. When you are finished with the system changes

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

184 exit_event = m5.simulate(when - m5.curTick())
185
186 if exit_event.getCause() == "simulate() limit reached":
187 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
188 num_checkpoints += 1
189
190 sim_ticks = when
191 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
188 while num_checkpoints < max_checkpoints:
192 while num_checkpoints < max_checkpoints and \
193 exit_event.getCause() != "user interrupt received":
189 if (sim_ticks + period) > maxtick:
190 exit_event = m5.simulate(maxtick - sim_ticks)
191 exit_cause = exit_event.getCause()
192 break
193 else:
194 exit_event = m5.simulate(period)
195 sim_ticks += period
196 while exit_event.getCause() == "checkpoint":
197 exit_event = m5.simulate(sim_ticks - m5.curTick())
198 if exit_event.getCause() == "simulate() limit reached":
199 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
200 num_checkpoints += 1
201
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())
203 if exit_event.getCause() == "simulate() limit reached":
204 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
205 num_checkpoints += 1
206
207 if exit_event.getCause() == "user interrupt received":
208 exit_cause = exit_event.getCause();
209
210
202 else: #no checkpoints being taken via this script
203 exit_event = m5.simulate(maxtick)
204
205 while exit_event.getCause() == "checkpoint":
206 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
207 num_checkpoints += 1
208 if num_checkpoints == max_checkpoints:
209 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
210 break
211
212 exit_event = m5.simulate(maxtick - m5.curTick())
213 exit_cause = exit_event.getCause()
214
215 if exit_cause == '':
216 exit_cause = exit_event.getCause()
217 print 'Exiting @ cycle %i because %s' % (m5.curTick(), exit_cause)
218
211 else: #no checkpoints being taken via this script
212 exit_event = m5.simulate(maxtick)
213
214 while exit_event.getCause() == "checkpoint":
215 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
216 num_checkpoints += 1
217 if num_checkpoints == max_checkpoints:
218 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
219 break
220
221 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 %i because %s' % (m5.curTick(), exit_cause)
227