Simulation.py (3445:5c5f90f5506c) Simulation.py (3447:258e3c319f6f)
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

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

130 when = int(when)
131 period = int(period)
132
133 exit_event = m5.simulate(when)
134 while exit_event.getCause() == "checkpoint":
135 exit_event = m5.simulate(when - m5.curTick())
136
137 if exit_event.getCause() == "simulate() limit reached":
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

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

130 when = int(when)
131 period = int(period)
132
133 exit_event = m5.simulate(when)
134 while exit_event.getCause() == "checkpoint":
135 exit_event = m5.simulate(when - m5.curTick())
136
137 if exit_event.getCause() == "simulate() limit reached":
138 m5.checkpoint(root, cptdir + "cpt.%d")
138 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"]))
139 num_checkpoints += 1
140
141 sim_ticks = when
142 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
143 while num_checkpoints < max_checkpoints:
144 if (sim_ticks + period) > maxtick and maxtick != -1:
145 exit_event = m5.simulate(maxtick - sim_ticks)
146 exit_cause = exit_event.getCause()
147 break
148 else:
149 exit_event = m5.simulate(period)
150 sim_ticks += period
151 while exit_event.getCause() == "checkpoint":
152 exit_event = m5.simulate(sim_ticks - m5.curTick())
153 if exit_event.getCause() == "simulate() limit reached":
139 num_checkpoints += 1
140
141 sim_ticks = when
142 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
143 while num_checkpoints < max_checkpoints:
144 if (sim_ticks + period) > maxtick and maxtick != -1:
145 exit_event = m5.simulate(maxtick - sim_ticks)
146 exit_cause = exit_event.getCause()
147 break
148 else:
149 exit_event = m5.simulate(period)
150 sim_ticks += period
151 while exit_event.getCause() == "checkpoint":
152 exit_event = m5.simulate(sim_ticks - m5.curTick())
153 if exit_event.getCause() == "simulate() limit reached":
154 m5.checkpoint(root, cptdir + "cpt.%d")
154 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"]))
155 num_checkpoints += 1
156
157 else: #no checkpoints being taken via this script
158 exit_event = m5.simulate(maxtick)
159
160 while exit_event.getCause() == "checkpoint":
155 num_checkpoints += 1
156
157 else: #no checkpoints being taken via this script
158 exit_event = m5.simulate(maxtick)
159
160 while exit_event.getCause() == "checkpoint":
161 m5.checkpoint(root, cptdir + "cpt.%d")
161 m5.checkpoint(root, "/".join([cptdir,"cpt.%d"]))
162 num_checkpoints += 1
163 if num_checkpoints == max_checkpoints:
164 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
165 break
166
167 if maxtick == -1:
168 exit_event = m5.simulate(maxtick)
169 else:
170 exit_event = m5.simulate(maxtick - m5.curTick())
171
172 exit_cause = exit_event.getCause()
173
174 if exit_cause == '':
175 exit_cause = exit_event.getCause()
176 print 'Exiting @ cycle', m5.curTick(), 'because ', exit_cause
177
162 num_checkpoints += 1
163 if num_checkpoints == max_checkpoints:
164 exit_cause = "maximum %d checkpoints dropped" % max_checkpoints
165 break
166
167 if maxtick == -1:
168 exit_event = m5.simulate(maxtick)
169 else:
170 exit_event = m5.simulate(maxtick - m5.curTick())
171
172 exit_cause = exit_event.getCause()
173
174 if exit_cause == '':
175 exit_cause = exit_event.getCause()
176 print 'Exiting @ cycle', m5.curTick(), 'because ', exit_cause
177