Deleted Added
sdiff udiff text old ( 3514:b166ee5dce91 ) new ( 3631:cebd6af96efd )
full compact
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

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

22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Lisa Hsu
28
29from os import getcwd
30import m5
31from m5.objects import *
32m5.AddToPath('../common')
33from Caches import L1Cache
34
35def setCPUClass(options):
36
37 atomic = False

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

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

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

136 cpts.sort(lambda a,b: cmp(long(a), long(b)))
137
138 cpt_num = options.checkpoint_restore
139
140 if cpt_num > len(cpts):
141 m5.panic('Checkpoint %d not found' % cpt_num)
142
143 m5.restoreCheckpoint(root,
144 "/".join([cptdir, "cpt.%s" % cpts[cpt_num - 1]]))
145
146 if options.standard_switch or cpu_class:
147 exit_event = m5.simulate(10000)
148
149 ## when you change to Timing (or Atomic), you halt the system given
150 ## as argument. When you are finished with the system changes
151 ## (including switchCpus), you must resume the system manually.
152 ## You DON'T need to resume after just switching CPUs if you haven't

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

171 when = int(when)
172 period = int(period)
173
174 exit_event = m5.simulate(when)
175 while exit_event.getCause() == "checkpoint":
176 exit_event = m5.simulate(when - m5.curTick())
177
178 if exit_event.getCause() == "simulate() limit reached":
179 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"]))
180 num_checkpoints += 1
181
182 sim_ticks = when
183 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
184 while num_checkpoints < max_checkpoints:
185 if (sim_ticks + period) > maxtick and maxtick != -1:
186 exit_event = m5.simulate(maxtick - sim_ticks)
187 exit_cause = exit_event.getCause()
188 break
189 else:
190 exit_event = m5.simulate(period)
191 sim_ticks += period
192 while exit_event.getCause() == "checkpoint":
193 exit_event = m5.simulate(sim_ticks - m5.curTick())
194 if exit_event.getCause() == "simulate() limit reached":
195 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"]))
196 num_checkpoints += 1
197
198 else: #no checkpoints being taken via this script
199 exit_event = m5.simulate(maxtick)
200
201 while exit_event.getCause() == "checkpoint":
202 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"]))
203 num_checkpoints += 1
204 if num_checkpoints == max_checkpoints:
205 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
206 break
207
208 if maxtick == -1:
209 exit_event = m5.simulate(maxtick)
210 else:
211 exit_event = m5.simulate(maxtick - m5.curTick())
212
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