util.isa (3766:c220c2bdd06c) util.isa (3792:dae368e56d0e)
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

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

157 if(fault == NoFault)
158 {
159 //Write the resulting state to the execution context
160 %(op_wb)s;
161 }
162
163 return fault;
164 }
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

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

157 if(fault == NoFault)
158 {
159 //Write the resulting state to the execution context
160 %(op_wb)s;
161 }
162
163 return fault;
164 }
165}};
165
166
167def template LoadInitiateAcc {{
166 Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s * xc,
167 Trace::InstRecord * traceData) const
168 {
169 Fault fault = NoFault;
170 Addr EA;
171 uint%(mem_acc_size)s_t Mem;
168 Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s * xc,
169 Trace::InstRecord * traceData) const
170 {
171 Fault fault = NoFault;
172 Addr EA;
173 uint%(mem_acc_size)s_t Mem;
172 %(ea_decl)s;
173 %(ea_rd)s;
174 %(op_decl)s;
175 %(op_rd)s;
174 %(ea_code)s;
175 DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
176 %(fault_check)s;
177 if(fault == NoFault)
178 {
179 fault = xc->read(EA, (uint%(mem_acc_size)s_t&)Mem, 0);
180 }
181 return fault;
182 }
176 %(ea_code)s;
177 DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
178 %(fault_check)s;
179 if(fault == NoFault)
180 {
181 fault = xc->read(EA, (uint%(mem_acc_size)s_t&)Mem, 0);
182 }
183 return fault;
184 }
185}};
183
186
187def template LoadCompleteAcc {{
184 Fault %(class_name)s::completeAcc(PacketPtr pkt, %(CPU_exec_context)s * xc,
185 Trace::InstRecord * traceData) const
186 {
187 Fault fault = NoFault;
188 Fault %(class_name)s::completeAcc(PacketPtr pkt, %(CPU_exec_context)s * xc,
189 Trace::InstRecord * traceData) const
190 {
191 Fault fault = NoFault;
188 %(code_decl)s;
189 %(code_rd)s;
192 %(op_decl)s;
193 %(op_rd)s;
190 Mem = pkt->get<typeof(Mem)>();
191 %(code)s;
192 if(fault == NoFault)
193 {
194 Mem = pkt->get<typeof(Mem)>();
195 %(code)s;
196 if(fault == NoFault)
197 {
194 %(code_wb)s;
198 %(op_wb)s;
195 }
196 return fault;
197 }
198}};
199
200//This template provides the execute functions for a store
201def template StoreExecute {{
202 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,

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

223 if(fault == NoFault)
224 {
225 //Write the resulting state to the execution context
226 %(op_wb)s;
227 }
228
229 return fault;
230 }
199 }
200 return fault;
201 }
202}};
203
204//This template provides the execute functions for a store
205def template StoreExecute {{
206 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,

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

227 if(fault == NoFault)
228 {
229 //Write the resulting state to the execution context
230 %(op_wb)s;
231 }
232
233 return fault;
234 }
235}};
231
236
237def template StoreInitiateAcc {{
232 Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s * xc,
233 Trace::InstRecord * traceData) const
234 {
235 Fault fault = NoFault;
236 bool storeCond = true;
237 Addr EA;
238 %(op_decl)s;
239 %(op_rd)s;

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

250 }
251 if(fault == NoFault)
252 {
253 //Write the resulting state to the execution context
254 %(op_wb)s;
255 }
256 return fault;
257 }
238 Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s * xc,
239 Trace::InstRecord * traceData) const
240 {
241 Fault fault = NoFault;
242 bool storeCond = true;
243 Addr EA;
244 %(op_decl)s;
245 %(op_rd)s;

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

256 }
257 if(fault == NoFault)
258 {
259 //Write the resulting state to the execution context
260 %(op_wb)s;
261 }
262 return fault;
263 }
264}};
258
265
266def template StoreCompleteAcc {{
259 Fault %(class_name)s::completeAcc(PacketPtr, %(CPU_exec_context)s * xc,
260 Trace::InstRecord * traceData) const
261 {
262 return NoFault;
263 }
264}};
265
266//This delcares the initiateAcc function in memory operations
267def template InitiateAccDeclare {{
268 Fault initiateAcc(%(CPU_exec_context)s *, Trace::InstRecord *) const;
269}};
270
271//This declares the completeAcc function in memory operations
272def template CompleteAccDeclare {{
273 Fault completeAcc(PacketPtr, %(CPU_exec_context)s *, Trace::InstRecord *) const;
274}};
275
276//Here are some code snippets which check for various fault conditions
277let {{
267 Fault %(class_name)s::completeAcc(PacketPtr, %(CPU_exec_context)s * xc,
268 Trace::InstRecord * traceData) const
269 {
270 return NoFault;
271 }
272}};
273
274//This delcares the initiateAcc function in memory operations
275def template InitiateAccDeclare {{
276 Fault initiateAcc(%(CPU_exec_context)s *, Trace::InstRecord *) const;
277}};
278
279//This declares the completeAcc function in memory operations
280def template CompleteAccDeclare {{
281 Fault completeAcc(PacketPtr, %(CPU_exec_context)s *, Trace::InstRecord *) const;
282}};
283
284//Here are some code snippets which check for various fault conditions
285let {{
286 LoadFuncs = [LoadExecute, LoadInitiateAcc, LoadCompleteAcc]
287 StoreFuncs = [StoreExecute, StoreInitiateAcc, StoreCompleteAcc]
278 # The LSB can be zero, since it's really the MSB in doubles and quads
279 # and we're dealing with doubles
280 BlockAlignmentFaultCheck = '''
281 if(RD & 0xe)
282 fault = new IllegalInstruction;
283 else if(EA & 0x3f)
284 fault = new MemAddressNotAligned;
285 '''

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

303}};
304
305//This function properly generates the execute functions for one of the
306//templates above. This is needed because in one case, ea computation,
307//fault checks and the actual code all occur in the same function,
308//and in the other they're distributed across two. Also note that for
309//execute functions, the name of the base class doesn't matter.
310let {{
288 # The LSB can be zero, since it's really the MSB in doubles and quads
289 # and we're dealing with doubles
290 BlockAlignmentFaultCheck = '''
291 if(RD & 0xe)
292 fault = new IllegalInstruction;
293 else if(EA & 0x3f)
294 fault = new MemAddressNotAligned;
295 '''

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

313}};
314
315//This function properly generates the execute functions for one of the
316//templates above. This is needed because in one case, ea computation,
317//fault checks and the actual code all occur in the same function,
318//and in the other they're distributed across two. Also note that for
319//execute functions, the name of the base class doesn't matter.
320let {{
311 def doSplitExecute(code, execute, name, Name, opt_flags, microParam):
312 codeParam = microParam.copy()
313 codeParam["ea_code"] = ''
314 codeIop = InstObjParams(name, Name, '', code, opt_flags, codeParam)
315 eaIop = InstObjParams(name, Name, '', microParam["ea_code"],
316 opt_flags, microParam)
317 iop = InstObjParams(name, Name, '', code, opt_flags, microParam)
318 (iop.ea_decl,
319 iop.ea_rd,
320 iop.ea_wb) = (eaIop.op_decl, eaIop.op_rd, eaIop.op_wb)
321 (iop.code_decl,
322 iop.code_rd,
323 iop.code_wb) = (codeIop.op_decl, codeIop.op_rd, codeIop.op_wb)
324 return execute.subst(iop)
321 def doSplitExecute(execute, name, Name, opt_flags, microParam):
322 iop = InstObjParams(name, Name, '', microParam, opt_flags)
323 (execf, initf, compf) = execute
324 return execf.subst(iop) + initf.subst(iop) + compf.subst(iop)
325
326
327 def doDualSplitExecute(code, eaRegCode, eaImmCode, execute,
328 faultCode, nameReg, nameImm, NameReg, NameImm, opt_flags):
329 executeCode = ''
330 for (eaCode, name, Name) in (
331 (eaRegCode, nameReg, NameReg),
332 (eaImmCode, nameImm, NameImm)):
325
326
327 def doDualSplitExecute(code, eaRegCode, eaImmCode, execute,
328 faultCode, nameReg, nameImm, NameReg, NameImm, opt_flags):
329 executeCode = ''
330 for (eaCode, name, Name) in (
331 (eaRegCode, nameReg, NameReg),
332 (eaImmCode, nameImm, NameImm)):
333 microParams = {"ea_code" : eaCode, "fault_check": faultCode}
334 executeCode += doSplitExecute(code, execute, name, Name,
333 microParams = {"code": code, "ea_code": eaCode,
334 "fault_check": faultCode}
335 executeCode += doSplitExecute(execute, name, Name,
335 opt_flags, microParams)
336 return executeCode
337}};
336 opt_flags, microParams)
337 return executeCode
338}};