1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

97 {
98#if FULL_SYSTEM
99 AlphaITB *itb;
100 AlphaDTB *dtb;
101#else
102 Process *process;
103#endif
104 bool exitOnError;
105 bool updateOnError;
106 bool warnOnlyOnLoadError;
107 };
108
109 public:
110 CheckerCPU(Params *p);
111 virtual ~CheckerCPU();
112
113 Process *process;

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

144 AlphaDTB *dtb;
145
146#if FULL_SYSTEM
147 Addr dbg_vtophys(Addr addr);
148#endif
149
150 union Result {
151 uint64_t integer;
151 float fp;
152// float fp;
153 double dbl;
154 };
155
156 Result result;
157
158 // current instruction
159 MachInst machInst;
160

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

265 break;
266 };
267 }
268
269 void setFloatReg(const StaticInst *si, int idx, FloatReg val)
270 {
271 int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag;
272 thread->setFloatReg(reg_idx, val);
272 result.fp = val;
273 result.dbl = (double)val;
274 }
275
276 void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val,
277 int width)
278 {
279 int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag;
280 thread->setFloatRegBits(reg_idx, val, width);
281 result.integer = val;

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

314 }
315
316 Fault setMiscRegWithEffect(int misc_reg, const MiscReg &val)
317 {
318 miscRegIdxs.push(misc_reg);
319 return thread->setMiscRegWithEffect(misc_reg, val);
320 }
321
321 void recordPCChange(uint64_t val) { changedPC = true; }
322 void recordPCChange(uint64_t val) { changedPC = true; newPC = val; }
323 void recordNextPCChange(uint64_t val) { changedNextPC = true; }
324
325 bool translateInstReq(Request *req);
326 void translateDataWriteReq(Request *req);
327 void translateDataReadReq(Request *req);
328
329#if FULL_SYSTEM
330 Fault hwrei() { return thread->hwrei(); }

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

356 Request *unverifiedReq;
357 uint8_t *unverifiedMemData;
358
359 bool changedPC;
360 bool willChangePC;
361 uint64_t newPC;
362 bool changedNextPC;
363 bool exitOnError;
364 bool updateOnError;
365 bool warnOnlyOnLoadError;
366
367 InstSeqNum youngestSN;
368};
369
370/**
371 * Templated Checker class. This Checker class is templated on the
372 * DynInstPtr of the instruction type that will be verified. Proper
373 * template instantiations of the Checker must be placed at the bottom
374 * of checker/cpu.cc.
375 */
376template <class DynInstPtr>
377class Checker : public CheckerCPU
378{
379 public:
380 Checker(Params *p)
379 : CheckerCPU(p)
381 : CheckerCPU(p), updateThisCycle(false), unverifiedInst(NULL)
382 { }
383
384 void switchOut();
385 void takeOverFrom(BaseCPU *oldCPU);
386
387 void verify(DynInstPtr &inst);
388
389 void validateInst(DynInstPtr &inst);
390 void validateExecution(DynInstPtr &inst);
391 void validateState();
392
393 void copyResult(DynInstPtr &inst);
394
395 private:
396 void handleError(DynInstPtr &inst)
397 {
396 if (exitOnError)
398 if (exitOnError) {
399 dumpAndExit(inst);
400 } else if (updateOnError) {
401 updateThisCycle = true;
402 }
403 }
404
405 void dumpAndExit(DynInstPtr &inst);
406
407 bool updateThisCycle;
408
409 DynInstPtr unverifiedInst;
410
411 std::list<DynInstPtr> instList;
412 typedef typename std::list<DynInstPtr>::iterator InstListIt;
413 void dumpInsts();
414};
415
416#endif // __CPU_CHECKER_CPU_HH__