Deleted Added
sdiff udiff text old ( 10034:f2ce7114b137 ) new ( 10319:4207f9bfcceb )
full compact
1/*
2 * Copyright (c) 2011 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

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

47#include <list>
48#include <map>
49#include <queue>
50
51#include "arch/types.hh"
52#include "base/statistics.hh"
53#include "cpu/base.hh"
54#include "cpu/base_dyn_inst.hh"
55#include "cpu/pc_event.hh"
56#include "cpu/simple_thread.hh"
57#include "cpu/static_inst.hh"
58#include "debug/Checker.hh"
59#include "params/CheckerCPU.hh"
60#include "sim/eventq.hh"
61
62// forward declarations

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

81 * instructions marked as "IsUnverifiable", the checker assumes that
82 * the value from the main CPU's execution is correct and simply
83 * copies that value. It provides a CheckerThreadContext (see
84 * checker/thread_context.hh) that provides hooks for updating the
85 * Checker's state through any ThreadContext accesses. This allows the
86 * checker to be able to correctly verify instructions, even with
87 * external accesses to the ThreadContext that change state.
88 */
89class CheckerCPU : public BaseCPU
90{
91 protected:
92 typedef TheISA::MachInst MachInst;
93 typedef TheISA::FloatReg FloatReg;
94 typedef TheISA::FloatRegBits FloatRegBits;
95 typedef TheISA::MiscReg MiscReg;
96
97 /** id attached to all issued requests */

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

189 Counter startNumLoad;
190
191 virtual void serialize(std::ostream &os);
192 virtual void unserialize(Checkpoint *cp, const std::string &section);
193
194 // These functions are only used in CPU models that split
195 // effective address computation from the actual memory access.
196 void setEA(Addr EA) { panic("SimpleCPU::setEA() not implemented\n"); }
197 Addr getEA() { panic("SimpleCPU::getEA() not implemented\n"); }
198
199 // The register accessor methods provide the index of the
200 // instruction's operand (e.g., 0 or 1), not the architectural
201 // register index, to simplify the implementation of register
202 // renaming. We find the architectural register index by indexing
203 // into the instruction's own operand index table. Note that a
204 // raw pointer to the StaticInst is provided instead of a
205 // ref-counted StaticInstPtr to redice overhead. This is fine as
206 // long as these methods don't copy the pointer into any long-term
207 // storage (which is pretty hard to imagine they would have reason
208 // to do).
209
210 uint64_t readIntRegOperand(const StaticInst *si, int idx)
211 {
212 return thread->readIntReg(si->srcRegIdx(idx));
213 }
214
215 FloatReg readFloatRegOperand(const StaticInst *si, int idx)
216 {
217 int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
218 return thread->readFloatReg(reg_idx);
219 }
220
221 FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx)
222 {
223 int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
224 return thread->readFloatRegBits(reg_idx);
225 }
226
227 uint64_t readCCRegOperand(const StaticInst *si, int idx)
228 {
229 int reg_idx = si->srcRegIdx(idx) - TheISA::CC_Reg_Base;
230 return thread->readCCReg(reg_idx);
231 }
232
233 template <class T>
234 void setResult(T t)
235 {
236 Result instRes;
237 instRes.set(t);
238 result.push(instRes);
239 }
240
241 void setIntRegOperand(const StaticInst *si, int idx, uint64_t val)
242 {
243 thread->setIntReg(si->destRegIdx(idx), val);
244 setResult<uint64_t>(val);
245 }
246
247 void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val)
248 {
249 int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;

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

254 void setFloatRegOperandBits(const StaticInst *si, int idx,
255 FloatRegBits val)
256 {
257 int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;
258 thread->setFloatRegBits(reg_idx, val);
259 setResult<uint64_t>(val);
260 }
261
262 void setCCRegOperand(const StaticInst *si, int idx, uint64_t val)
263 {
264 int reg_idx = si->destRegIdx(idx) - TheISA::CC_Reg_Base;
265 thread->setCCReg(reg_idx, val);
266 setResult<uint64_t>(val);
267 }
268
269 bool readPredicate() { return thread->readPredicate(); }
270 void setPredicate(bool val)
271 {
272 thread->setPredicate(val);
273 }
274
275 TheISA::PCState pcState() { return thread->pcState(); }
276 void pcState(const TheISA::PCState &val)
277 {
278 DPRINTF(Checker, "Changing PC to %s, old PC %s.\n",
279 val, thread->pcState());
280 thread->pcState(val);
281 }
282 Addr instAddr() { return thread->instAddr(); }
283 Addr nextInstAddr() { return thread->nextInstAddr(); }

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

317 void setMiscRegOperand(
318 const StaticInst *si, int idx, const MiscReg &val)
319 {
320 int reg_idx = si->destRegIdx(idx) - TheISA::Misc_Reg_Base;
321 return this->setMiscReg(reg_idx, val);
322 }
323
324#if THE_ISA == MIPS_ISA
325 uint64_t readRegOtherThread(int misc_reg)
326 {
327 panic("MIPS MT not defined for CheckerCPU.\n");
328 return 0;
329 }
330
331 void setRegOtherThread(int misc_reg, const TheISA::MiscReg &val)
332 {
333 panic("MIPS MT not defined for CheckerCPU.\n");
334 }
335#endif
336
337 /////////////////////////////////////////
338
339 void recordPCChange(const TheISA::PCState &val)

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

357 {
358 this->dtb->demapPage(vaddr, asn);
359 }
360
361 Fault readMem(Addr addr, uint8_t *data, unsigned size, unsigned flags);
362 Fault writeMem(uint8_t *data, unsigned size,
363 Addr addr, unsigned flags, uint64_t *res);
364
365 void setStCondFailures(unsigned sc_failures)
366 {}
367 /////////////////////////////////////////////////////
368
369 Fault hwrei() { return thread->hwrei(); }
370 bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); }
371 void wakeup() { }
372 // Assume that the normal CPU's call to syscall was successful.
373 // The checker's state would have already been updated by the syscall.
374 void syscall(uint64_t callnum) { }
375
376 void handleError()
377 {
378 if (exitOnError)
379 dumpAndExit();
380 }
381
382 bool checkFlags(Request *unverified_req, Addr vAddr,

--- 74 unchanged lines hidden ---