Simulation.py (5347:f15b21a5bd2e) Simulation.py (5353:487d6f3291d7)
1# Copyright (c) 2006-2008 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

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

90 if not m5.build_env['FULL_SYSTEM']:
91 switch_cpus[i].workload = testsys.cpu[i].workload
92 switch_cpus[i].clock = testsys.cpu[0].clock
93
94 testsys.switch_cpus = switch_cpus
95 switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
96
97 if options.standard_switch:
1# Copyright (c) 2006-2008 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

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

90 if not m5.build_env['FULL_SYSTEM']:
91 switch_cpus[i].workload = testsys.cpu[i].workload
92 switch_cpus[i].clock = testsys.cpu[0].clock
93
94 testsys.switch_cpus = switch_cpus
95 switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
96
97 if options.standard_switch:
98 if (options.fast_forward and options.warmup):
99 m5.panic("Must specify either warmup OR fast-forward with -s!")
100
98 switch_cpus = [TimingSimpleCPU(defer_registration=True, cpu_id=(np+i))
99 for i in xrange(np)]
100 switch_cpus_1 = [DerivO3CPU(defer_registration=True, cpu_id=(2*np+i))
101 for i in xrange(np)]
102
103 for i in xrange(np):
104 switch_cpus[i].system = testsys
105 switch_cpus_1[i].system = testsys
106 if not m5.build_env['FULL_SYSTEM']:
107 switch_cpus[i].workload = testsys.cpu[i].workload
108 switch_cpus_1[i].workload = testsys.cpu[i].workload
109 switch_cpus[i].clock = testsys.cpu[0].clock
110 switch_cpus_1[i].clock = testsys.cpu[0].clock
111
101 switch_cpus = [TimingSimpleCPU(defer_registration=True, cpu_id=(np+i))
102 for i in xrange(np)]
103 switch_cpus_1 = [DerivO3CPU(defer_registration=True, cpu_id=(2*np+i))
104 for i in xrange(np)]
105
106 for i in xrange(np):
107 switch_cpus[i].system = testsys
108 switch_cpus_1[i].system = testsys
109 if not m5.build_env['FULL_SYSTEM']:
110 switch_cpus[i].workload = testsys.cpu[i].workload
111 switch_cpus_1[i].workload = testsys.cpu[i].workload
112 switch_cpus[i].clock = testsys.cpu[0].clock
113 switch_cpus_1[i].clock = testsys.cpu[0].clock
114
115 if options.fast_forward:
116 switch_cpus[i].max_insts_any_thread = options.fast_forward
117 if options.max_inst:
118 switch_cpus_1[i].max_insts_any_thread = options.max_inst
119
112 if not options.caches:
113 # O3 CPU must have a cache to work.
114 switch_cpus_1[i].addPrivateSplitL1Caches(L1Cache(size = '32kB'),
115 L1Cache(size = '64kB'))
116 switch_cpus_1[i].connectMemPorts(testsys.membus)
117
118
119 testsys.switch_cpus = switch_cpus
120 testsys.switch_cpus_1 = switch_cpus_1
121 switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
122 switch_cpu_list1 = [(switch_cpus[i], switch_cpus_1[i]) for i in xrange(np)]
123
120 if not options.caches:
121 # O3 CPU must have a cache to work.
122 switch_cpus_1[i].addPrivateSplitL1Caches(L1Cache(size = '32kB'),
123 L1Cache(size = '64kB'))
124 switch_cpus_1[i].connectMemPorts(testsys.membus)
125
126
127 testsys.switch_cpus = switch_cpus
128 testsys.switch_cpus_1 = switch_cpus_1
129 switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
130 switch_cpu_list1 = [(switch_cpus[i], switch_cpus_1[i]) for i in xrange(np)]
131
132 elif options.fast_forward:
133 for i in xrange(np):
134 testsys.cpu[i].max_insts_any_thread = options.fast_forward
135
124 m5.instantiate(root)
125
126 if options.checkpoint_restore:
127 from os.path import isdir
128 from os import listdir
129 import re
130
131 if not isdir(cptdir):

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

162 ## You DON'T need to resume after just switching CPUs if you haven't
163 ## changed anything on the system level.
164
165 m5.changeToTiming(testsys)
166 m5.switchCpus(switch_cpu_list)
167 m5.resume(testsys)
168
169 if options.standard_switch:
136 m5.instantiate(root)
137
138 if options.checkpoint_restore:
139 from os.path import isdir
140 from os import listdir
141 import re
142
143 if not isdir(cptdir):

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

174 ## You DON'T need to resume after just switching CPUs if you haven't
175 ## changed anything on the system level.
176
177 m5.changeToTiming(testsys)
178 m5.switchCpus(switch_cpu_list)
179 m5.resume(testsys)
180
181 if options.standard_switch:
170 exit_event = m5.simulate(options.warmup)
182 if (options.warmup):
183 exit_event = m5.simulate(options.warmup)
184 if options.fast_forward:
185 exit_event = m5.simulate()
171 m5.drain(testsys)
172 m5.switchCpus(switch_cpu_list1)
173 m5.resume(testsys)
174
186 m5.drain(testsys)
187 m5.switchCpus(switch_cpu_list1)
188 m5.resume(testsys)
189
190 # This should *only* be used by itself to take a checkpoint!
191 # Otherwise, use standard_switch
192 elif options.fast_forward:
193 exit_event = m5.simulate()
194
195 while exit_event.getCause() != "a thread reached the max instruction count":
196 if exit_event.getCause() == "user interrupt received":
197 print "User interrupt! Switching to simulation mode"
198 break
199 else:
200 m5.simulate(True)
201
202 if exit_event.getCause() == "a thread reached the max instruction count":
203 print "Reached fast_forward count %d; starting simulation at cycle %d" % (options.fast_forward, m5.curTick())
204
205 m5.checkpoint(root, joinpath(cptdir, "cpt.%d"))
206 return
207
175 num_checkpoints = 0
176 exit_cause = ''
177
178 ## Checkpoints being taken via the command line at <when> and at subsequent
179 ## periods of <period>. Checkpoint instructions received from the benchmark running
180 ## are ignored and skipped in favor of command line checkpoint instructions.
181 if options.take_checkpoints:
182 [when, period] = options.take_checkpoints.split(",", 1)

--- 49 unchanged lines hidden ---
208 num_checkpoints = 0
209 exit_cause = ''
210
211 ## Checkpoints being taken via the command line at <when> and at subsequent
212 ## periods of <period>. Checkpoint instructions received from the benchmark running
213 ## are ignored and skipped in favor of command line checkpoint instructions.
214 if options.take_checkpoints:
215 [when, period] = options.take_checkpoints.split(",", 1)

--- 49 unchanged lines hidden ---