Simulation.py (3481:14362d3b0756) | Simulation.py (3509:ff94a3eda992) |
---|---|
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 | 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 |
30from os.path import join as joinpath |
|
30import m5 31from m5.objects import * 32m5.AddToPath('../common') 33from Caches import L1Cache 34 35def setCPUClass(options): 36 37 atomic = False --- 106 unchanged lines hidden (view full) --- 144 cpts.sort(lambda a,b: cmp(long(a), long(b))) 145 146 cpt_num = options.checkpoint_restore 147 148 if cpt_num > len(cpts): 149 m5.panic('Checkpoint %d not found' % cpt_num) 150 151 m5.restoreCheckpoint(root, | 31import m5 32from m5.objects import * 33m5.AddToPath('../common') 34from Caches import L1Cache 35 36def setCPUClass(options): 37 38 atomic = False --- 106 unchanged lines hidden (view full) --- 145 cpts.sort(lambda a,b: cmp(long(a), long(b))) 146 147 cpt_num = options.checkpoint_restore 148 149 if cpt_num > len(cpts): 150 m5.panic('Checkpoint %d not found' % cpt_num) 151 152 m5.restoreCheckpoint(root, |
152 "/".join([cptdir, "cpt.%s" % cpts[cpt_num - 1]])) | 153 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 159 ## (including switchCpus), you must resume the system manually. 160 ## You DON'T need to resume after just switching CPUs if you haven't --- 18 unchanged lines hidden (view full) --- 179 when = int(when) 180 period = int(period) 181 182 exit_event = m5.simulate(when) 183 while exit_event.getCause() == "checkpoint": 184 exit_event = m5.simulate(when - m5.curTick()) 185 186 if exit_event.getCause() == "simulate() limit reached": | 154 155 if options.standard_switch or cpu_class: 156 exit_event = m5.simulate(10000) 157 158 ## when you change to Timing (or Atomic), you halt the system given 159 ## as argument. When you are finished with the system changes 160 ## (including switchCpus), you must resume the system manually. 161 ## You DON'T need to resume after just switching CPUs if you haven't --- 18 unchanged lines hidden (view full) --- 180 when = int(when) 181 period = int(period) 182 183 exit_event = m5.simulate(when) 184 while exit_event.getCause() == "checkpoint": 185 exit_event = m5.simulate(when - m5.curTick()) 186 187 if exit_event.getCause() == "simulate() limit reached": |
187 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"])) | 188 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 192 while num_checkpoints < max_checkpoints: 193 if (sim_ticks + period) > maxtick and maxtick != -1: 194 exit_event = m5.simulate(maxtick - sim_ticks) 195 exit_cause = exit_event.getCause() 196 break 197 else: 198 exit_event = m5.simulate(period) 199 sim_ticks += period 200 while exit_event.getCause() == "checkpoint": 201 exit_event = m5.simulate(sim_ticks - m5.curTick()) 202 if exit_event.getCause() == "simulate() limit reached": | 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: 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": |
203 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"])) | 204 m5.checkpoint(root, joinpath(cptdir, "cpt.%d")) |
204 num_checkpoints += 1 205 206 else: #no checkpoints being taken via this script 207 exit_event = m5.simulate(maxtick) 208 209 while exit_event.getCause() == "checkpoint": | 205 num_checkpoints += 1 206 207 else: #no checkpoints being taken via this script 208 exit_event = m5.simulate(maxtick) 209 210 while exit_event.getCause() == "checkpoint": |
210 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"])) | 211 m5.checkpoint(root, joinpath(cptdir, "cpt.%d")) |
211 num_checkpoints += 1 212 if num_checkpoints == max_checkpoints: 213 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints 214 break 215 216 if maxtick == -1: 217 exit_event = m5.simulate(maxtick) 218 else: 219 exit_event = m5.simulate(maxtick - m5.curTick()) 220 221 exit_cause = exit_event.getCause() 222 223 if exit_cause == '': 224 exit_cause = exit_event.getCause() 225 print 'Exiting @ cycle', m5.curTick(), 'because ', exit_cause 226 | 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 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 |