gem5  v20.1.0.0
cpu_impl.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, 2016 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
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Copyright (c) 2006 The Regents of The University of Michigan
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #ifndef __CPU_CHECKER_CPU_IMPL_HH__
43 #define __CPU_CHECKER_CPU_IMPL_HH__
44 
45 #include <list>
46 #include <string>
47 
48 #include "base/refcnt.hh"
49 #include "config/the_isa.hh"
50 #include "cpu/base_dyn_inst.hh"
51 #include "cpu/exetrace.hh"
52 #include "cpu/reg_class.hh"
53 #include "cpu/simple_thread.hh"
54 #include "cpu/static_inst.hh"
55 #include "cpu/thread_context.hh"
56 #include "cpu/checker/cpu.hh"
57 #include "debug/Checker.hh"
58 #include "sim/full_system.hh"
59 #include "sim/sim_object.hh"
60 #include "sim/stats.hh"
61 
62 using namespace std;
63 using namespace TheISA;
64 
65 template <class Impl>
66 void
68 {
69  if (fault != NoFault) {
70  curMacroStaticInst = StaticInst::nullStaticInstPtr;
71  fault->invoke(tc, curStaticInst);
72  thread->decoder.reset();
73  } else {
74  if (curStaticInst) {
75  if (curStaticInst->isLastMicroop())
76  curMacroStaticInst = StaticInst::nullStaticInstPtr;
77  TheISA::PCState pcState = thread->pcState();
78  TheISA::advancePC(pcState, curStaticInst);
79  thread->pcState(pcState);
80  DPRINTF(Checker, "Advancing PC to %s.\n", thread->pcState());
81  }
82  }
83 }
85 
86 template <class Impl>
87 void
89 {
90  DPRINTF(Checker, "IRQ detected at PC: %s with %d insts in buffer\n",
91  thread->pcState(), instList.size());
92  DynInstPtr boundaryInst = NULL;
93  if (!instList.empty()) {
94  // Set the instructions as completed and verify as much as possible.
95  DynInstPtr inst;
97 
98  for (itr = instList.begin(); itr != instList.end(); itr++) {
99  (*itr)->setCompleted();
100  }
101 
102  inst = instList.front();
103  boundaryInst = instList.back();
104  verify(inst); // verify the instructions
105  inst = NULL;
106  }
107  if ((!boundaryInst && curMacroStaticInst &&
108  curStaticInst->isDelayedCommit() &&
109  !curStaticInst->isLastMicroop()) ||
110  (boundaryInst && boundaryInst->isDelayedCommit() &&
111  !boundaryInst->isLastMicroop())) {
112  panic("%lli: Trying to take an interrupt in middle of "
113  "a non-interuptable instruction!", curTick());
114  }
115  boundaryInst = NULL;
116  thread->decoder.reset();
117  curMacroStaticInst = StaticInst::nullStaticInstPtr;
118 }
119 
120 template <class Impl>
121 void
122 Checker<Impl>::verify(const DynInstPtr &completed_inst)
123 {
124  DynInstPtr inst;
125 
126  // Make sure serializing instructions are actually
127  // seen as serializing to commit. instList should be
128  // empty in these cases.
129  if ((completed_inst->isSerializing() ||
130  completed_inst->isSerializeBefore()) &&
131  (!instList.empty() ?
132  (instList.front()->seqNum != completed_inst->seqNum) : 0)) {
133  panic("%lli: Instruction sn:%lli at PC %s is serializing before but is"
134  " entering instList with other instructions\n", curTick(),
135  completed_inst->seqNum, completed_inst->pcState());
136  }
137 
138  // Either check this instruction, or add it to a list of
139  // instructions waiting to be checked. Instructions must be
140  // checked in program order, so if a store has committed yet not
141  // completed, there may be some instructions that are waiting
142  // behind it that have completed and must be checked.
143  if (!instList.empty()) {
144  if (youngestSN < completed_inst->seqNum) {
145  DPRINTF(Checker, "Adding instruction [sn:%lli] PC:%s to list\n",
146  completed_inst->seqNum, completed_inst->pcState());
147  instList.push_back(completed_inst);
148  youngestSN = completed_inst->seqNum;
149  }
150 
151  if (!instList.front()->isCompleted()) {
152  return;
153  } else {
154  inst = instList.front();
155  instList.pop_front();
156  }
157  } else {
158  if (!completed_inst->isCompleted()) {
159  if (youngestSN < completed_inst->seqNum) {
160  DPRINTF(Checker, "Adding instruction [sn:%lli] PC:%s to list\n",
161  completed_inst->seqNum, completed_inst->pcState());
162  instList.push_back(completed_inst);
163  youngestSN = completed_inst->seqNum;
164  }
165  return;
166  } else {
167  if (youngestSN < completed_inst->seqNum) {
168  inst = completed_inst;
169  youngestSN = completed_inst->seqNum;
170  } else {
171  return;
172  }
173  }
174  }
175 
176  // Make sure a serializing instruction is actually seen as
177  // serializing. instList should be empty here
178  if (inst->isSerializeAfter() && !instList.empty()) {
179  panic("%lli: Instruction sn:%lli at PC %s is serializing after but is"
180  " exiting instList with other instructions\n", curTick(),
181  completed_inst->seqNum, completed_inst->pcState());
182  }
183  unverifiedInst = inst;
184  inst = NULL;
185 
186  // Try to check all instructions that are completed, ending if we
187  // run out of instructions to check or if an instruction is not
188  // yet completed.
189  while (1) {
190  DPRINTF(Checker, "Processing instruction [sn:%lli] PC:%s.\n",
191  unverifiedInst->seqNum, unverifiedInst->pcState());
192  unverifiedReq = NULL;
193  unverifiedReq = unverifiedInst->reqToVerify;
194  unverifiedMemData = unverifiedInst->memData;
195  // Make sure results queue is empty
196  while (!result.empty()) {
197  result.pop();
198  }
199  numCycles++;
200 
201  Fault fault = NoFault;
202 
203  // maintain $r0 semantics
204  thread->setIntReg(ZeroReg, 0);
205 
206  // Check if any recent PC changes match up with anything we
207  // expect to happen. This is mostly to check if traps or
208  // PC-based events have occurred in both the checker and CPU.
209  if (changedPC) {
210  DPRINTF(Checker, "Changed PC recently to %s\n",
211  thread->pcState());
212  if (willChangePC) {
213  if (newPCState == thread->pcState()) {
214  DPRINTF(Checker, "Changed PC matches expected PC\n");
215  } else {
216  warn("%lli: Changed PC does not match expected PC, "
217  "changed: %s, expected: %s",
218  curTick(), thread->pcState(), newPCState);
220  }
221  willChangePC = false;
222  }
223  changedPC = false;
224  }
225 
226  // Try to fetch the instruction
227  uint64_t fetchOffset = 0;
228  bool fetchDone = false;
229 
230  while (!fetchDone) {
231  Addr fetch_PC = thread->instAddr();
232  fetch_PC = (fetch_PC & PCMask) + fetchOffset;
233 
234  MachInst machInst;
235 
236  // If not in the middle of a macro instruction
237  if (!curMacroStaticInst) {
238  // set up memory request for instruction fetch
239  auto mem_req = std::make_shared<Request>(
240  fetch_PC, sizeof(MachInst), 0, requestorId, fetch_PC,
241  thread->contextId());
242 
243  mem_req->setVirt(fetch_PC, sizeof(MachInst),
244  Request::INST_FETCH, requestorId,
245  thread->instAddr());
246 
247  fault = itb->translateFunctional(
248  mem_req, tc, BaseTLB::Execute);
249 
250  if (fault != NoFault) {
251  if (unverifiedInst->getFault() == NoFault) {
252  // In this case the instruction was not a dummy
253  // instruction carrying an ITB fault. In the single
254  // threaded case the ITB should still be able to
255  // translate this instruction; in the SMT case it's
256  // possible that its ITB entry was kicked out.
257  warn("%lli: Instruction PC %s was not found in the "
258  "ITB!", curTick(), thread->pcState());
259  handleError(unverifiedInst);
260 
261  // go to the next instruction
263 
264  // Give up on an ITB fault..
265  unverifiedInst = NULL;
266  return;
267  } else {
268  // The instruction is carrying an ITB fault. Handle
269  // the fault and see if our results match the CPU on
270  // the next tick().
271  fault = unverifiedInst->getFault();
272  break;
273  }
274  } else {
275  PacketPtr pkt = new Packet(mem_req, MemCmd::ReadReq);
276 
277  pkt->dataStatic(&machInst);
278  icachePort->sendFunctional(pkt);
279 
280  delete pkt;
281  }
282  }
283 
284  if (fault == NoFault) {
285  TheISA::PCState pcState = thread->pcState();
286 
287  if (isRomMicroPC(pcState.microPC())) {
288  fetchDone = true;
289  curStaticInst = thread->decoder.fetchRomMicroop(
290  pcState.microPC(), nullptr);
291  } else if (!curMacroStaticInst) {
292  //We're not in the middle of a macro instruction
293  StaticInstPtr instPtr = nullptr;
294 
295  //Predecode, ie bundle up an ExtMachInst
296  //If more fetch data is needed, pass it in.
297  Addr fetchPC = (pcState.instAddr() & PCMask) + fetchOffset;
298  thread->decoder.moreBytes(pcState, fetchPC, machInst);
299 
300  //If an instruction is ready, decode it.
301  //Otherwise, we'll have to fetch beyond the
302  //MachInst at the current pc.
303  if (thread->decoder.instReady()) {
304  fetchDone = true;
305  instPtr = thread->decoder.decode(pcState);
306  thread->pcState(pcState);
307  } else {
308  fetchDone = false;
309  fetchOffset += sizeof(TheISA::MachInst);
310  }
311 
312  //If we decoded an instruction and it's microcoded,
313  //start pulling out micro ops
314  if (instPtr && instPtr->isMacroop()) {
315  curMacroStaticInst = instPtr;
316  curStaticInst =
317  instPtr->fetchMicroop(pcState.microPC());
318  } else {
319  curStaticInst = instPtr;
320  }
321  } else {
322  // Read the next micro op from the macro-op
323  curStaticInst =
324  curMacroStaticInst->fetchMicroop(pcState.microPC());
325  fetchDone = true;
326  }
327  }
328  }
329  // reset decoder on Checker
330  thread->decoder.reset();
331 
332  // Check Checker and CPU get same instruction, and record
333  // any faults the CPU may have had.
334  Fault unverifiedFault;
335  if (fault == NoFault) {
336  unverifiedFault = unverifiedInst->getFault();
337 
338  // Checks that the instruction matches what we expected it to be.
339  // Checks both the machine instruction and the PC.
340  validateInst(unverifiedInst);
341  }
342 
343  // keep an instruction count
344  numInst++;
345 
346 
347  // Either the instruction was a fault and we should process the fault,
348  // or we should just go ahead execute the instruction. This assumes
349  // that the instruction is properly marked as a fault.
350  if (fault == NoFault) {
351  // Execute Checker instruction and trace
352  if (!unverifiedInst->isUnverifiable()) {
353  Trace::InstRecord *traceData = tracer->getInstRecord(curTick(),
354  tc,
355  curStaticInst,
356  pcState(),
357  curMacroStaticInst);
358  fault = curStaticInst->execute(this, traceData);
359  if (traceData) {
360  traceData->dump();
361  delete traceData;
362  }
363  }
364 
365  if (fault == NoFault && unverifiedFault == NoFault) {
366  thread->funcExeInst++;
367  // Checks to make sure instrution results are correct.
368  validateExecution(unverifiedInst);
369 
370  if (curStaticInst->isLoad()) {
371  ++numLoad;
372  }
373  } else if (fault != NoFault && unverifiedFault == NoFault) {
374  panic("%lli: sn: %lli at PC: %s took a fault in checker "
375  "but not in driver CPU\n", curTick(),
376  unverifiedInst->seqNum, unverifiedInst->pcState());
377  } else if (fault == NoFault && unverifiedFault != NoFault) {
378  panic("%lli: sn: %lli at PC: %s took a fault in driver "
379  "CPU but not in checker\n", curTick(),
380  unverifiedInst->seqNum, unverifiedInst->pcState());
381  }
382  }
383 
384  // Take any faults here
385  if (fault != NoFault) {
386  if (FullSystem) {
387  fault->invoke(tc, curStaticInst);
388  willChangePC = true;
389  newPCState = thread->pcState();
390  DPRINTF(Checker, "Fault, PC is now %s\n", newPCState);
391  curMacroStaticInst = StaticInst::nullStaticInstPtr;
392  }
393  } else {
394  advancePC(fault);
395  }
396 
397  if (FullSystem) {
398  // @todo: Determine if these should happen only if the
399  // instruction hasn't faulted. In the SimpleCPU case this may
400  // not be true, but in the O3 case this may be true.
401  Addr oldpc;
402  int count = 0;
403  do {
404  oldpc = thread->instAddr();
405  thread->pcEventQueue.service(oldpc, tc);
406  count++;
407  } while (oldpc != thread->instAddr());
408  if (count > 1) {
409  willChangePC = true;
410  newPCState = thread->pcState();
411  DPRINTF(Checker, "PC Event, PC is now %s\n", newPCState);
412  }
413  }
414 
415  // @todo: Optionally can check all registers. (Or just those
416  // that have been modified).
417  validateState();
418 
419  // Continue verifying instructions if there's another completed
420  // instruction waiting to be verified.
421  if (instList.empty()) {
422  break;
423  } else if (instList.front()->isCompleted()) {
424  unverifiedInst = NULL;
425  unverifiedInst = instList.front();
426  instList.pop_front();
427  } else {
428  break;
429  }
430  }
431  unverifiedInst = NULL;
432 }
433 
434 template <class Impl>
435 void
437 {
438  instList.clear();
439 }
440 
441 template <class Impl>
442 void
444 {
445 }
446 
447 template <class Impl>
448 void
450 {
451  if (inst->instAddr() != thread->instAddr()) {
452  warn("%lli: PCs do not match! Inst: %s, checker: %s",
453  curTick(), inst->pcState(), thread->pcState());
454  if (changedPC) {
455  warn("%lli: Changed PCs recently, may not be an error",
456  curTick());
457  } else {
458  handleError(inst);
459  }
460  }
461 
462  if (curStaticInst != inst->staticInst) {
463  warn("%lli: StaticInstPtrs don't match. (%s, %s).\n", curTick(),
464  curStaticInst->getName(), inst->staticInst->getName());
465  }
466 }
467 
468 template <class Impl>
469 void
471 {
472  InstResult checker_val;
473  InstResult inst_val;
474  int idx = -1;
475  bool result_mismatch = false;
476  bool scalar_mismatch = false;
477  bool vector_mismatch = false;
478 
479  if (inst->isUnverifiable()) {
480  // Unverifiable instructions assume they were executed
481  // properly by the CPU. Grab the result from the
482  // instruction and write it to the register.
483  copyResult(inst, InstResult(0ul, InstResult::ResultType::Scalar), idx);
484  } else if (inst->numDestRegs() > 0 && !result.empty()) {
485  DPRINTF(Checker, "Dest regs %d, number of checker dest regs %d\n",
486  inst->numDestRegs(), result.size());
487  for (int i = 0; i < inst->numDestRegs() && !result.empty(); i++) {
488  checker_val = result.front();
489  result.pop();
490  inst_val = inst->popResult(
492  if (checker_val != inst_val) {
493  result_mismatch = true;
494  idx = i;
495  scalar_mismatch = checker_val.isScalar();
496  vector_mismatch = checker_val.isVector();
497  panic_if(!(scalar_mismatch || vector_mismatch),
498  "Unknown type of result\n");
499  }
500  }
501  } // Checker CPU checks all the saved results in the dyninst passed by
502  // the cpu model being checked against the saved results present in
503  // the static inst executed in the Checker. Sometimes the number
504  // of saved results differs between the dyninst and static inst, but
505  // this is ok and not a bug. May be worthwhile to try and correct this.
506 
507  if (result_mismatch) {
508  if (scalar_mismatch) {
509  warn("%lli: Instruction results (%i) do not match! (Values may"
510  " not actually be integers) Inst: %#x, checker: %#x",
511  curTick(), idx, inst_val.asIntegerNoAssert(),
512  checker_val.asInteger());
513  }
514 
515  // It's useful to verify load values from memory, but in MP
516  // systems the value obtained at execute may be different than
517  // the value obtained at completion. Similarly DMA can
518  // present the same problem on even UP systems. Thus there is
519  // the option to only warn on loads having a result error.
520  // The load/store queue in Detailed CPU can also cause problems
521  // if load/store forwarding is allowed.
522  if (inst->isLoad() && warnOnlyOnLoadError) {
523  copyResult(inst, inst_val, idx);
524  } else {
525  handleError(inst);
526  }
527  }
528 
529  if (inst->nextInstAddr() != thread->nextInstAddr()) {
530  warn("%lli: Instruction next PCs do not match! Inst: %#x, "
531  "checker: %#x",
532  curTick(), inst->nextInstAddr(), thread->nextInstAddr());
533  handleError(inst);
534  }
535 
536  // Checking side effect registers can be difficult if they are not
537  // checked simultaneously with the execution of the instruction.
538  // This is because other valid instructions may have modified
539  // these registers in the meantime, and their values are not
540  // stored within the DynInst.
541  while (!miscRegIdxs.empty()) {
542  int misc_reg_idx = miscRegIdxs.front();
543  miscRegIdxs.pop();
544 
545  if (inst->tcBase()->readMiscRegNoEffect(misc_reg_idx) !=
546  thread->readMiscRegNoEffect(misc_reg_idx)) {
547  warn("%lli: Misc reg idx %i (side effect) does not match! "
548  "Inst: %#x, checker: %#x",
549  curTick(), misc_reg_idx,
550  inst->tcBase()->readMiscRegNoEffect(misc_reg_idx),
551  thread->readMiscRegNoEffect(misc_reg_idx));
552  handleError(inst);
553  }
554  }
555 }
556 
557 
558 // This function is weird, if it is called it means the Checker and
559 // O3 have diverged, so panic is called for now. It may be useful
560 // to resynch states and continue if the divergence is a false positive
561 template <class Impl>
562 void
564 {
565  if (updateThisCycle) {
566  // Change this back to warn if divergences end up being false positives
567  panic("%lli: Instruction PC %#x results didn't match up, copying all "
568  "registers from main CPU", curTick(), unverifiedInst->instAddr());
569 
570  // Terribly convoluted way to make sure O3 model does not implode
571  bool no_squash_from_TC = unverifiedInst->thread->noSquashFromTC;
572  unverifiedInst->thread->noSquashFromTC = true;
573 
574  // Heavy-weight copying of all registers
575  thread->copyArchRegs(unverifiedInst->tcBase());
576  unverifiedInst->thread->noSquashFromTC = no_squash_from_TC;
577 
578  // Set curStaticInst to unverifiedInst->staticInst
579  curStaticInst = unverifiedInst->staticInst;
580  // Also advance the PC. Hopefully no PC-based events happened.
582  updateThisCycle = false;
583  }
584 }
585 
586 template <class Impl>
587 void
589  const InstResult& mismatch_val, int start_idx)
590 {
591  // We've already popped one dest off the queue,
592  // so do the fix-up then start with the next dest reg;
593  if (start_idx >= 0) {
594  const RegId& idx = inst->destRegIdx(start_idx);
595  switch (idx.classValue()) {
596  case IntRegClass:
597  panic_if(!mismatch_val.isScalar(), "Unexpected type of result");
598  thread->setIntReg(idx.index(), mismatch_val.asInteger());
599  break;
600  case FloatRegClass:
601  panic_if(!mismatch_val.isScalar(), "Unexpected type of result");
602  thread->setFloatReg(idx.index(), mismatch_val.asInteger());
603  break;
604  case VecRegClass:
605  panic_if(!mismatch_val.isVector(), "Unexpected type of result");
606  thread->setVecReg(idx, mismatch_val.asVector());
607  break;
608  case VecElemClass:
609  panic_if(!mismatch_val.isVecElem(),
610  "Unexpected type of result");
611  thread->setVecElem(idx, mismatch_val.asVectorElem());
612  break;
613  case CCRegClass:
614  panic_if(!mismatch_val.isScalar(), "Unexpected type of result");
615  thread->setCCReg(idx.index(), mismatch_val.asInteger());
616  break;
617  case MiscRegClass:
618  panic_if(!mismatch_val.isScalar(), "Unexpected type of result");
619  thread->setMiscReg(idx.index(), mismatch_val.asInteger());
620  break;
621  default:
622  panic("Unknown register class: %d", (int)idx.classValue());
623  }
624  }
625  start_idx++;
626  InstResult res;
627  for (int i = start_idx; i < inst->numDestRegs(); i++) {
628  const RegId& idx = inst->destRegIdx(i);
629  res = inst->popResult();
630  switch (idx.classValue()) {
631  case IntRegClass:
632  panic_if(!res.isScalar(), "Unexpected type of result");
633  thread->setIntReg(idx.index(), res.asInteger());
634  break;
635  case FloatRegClass:
636  panic_if(!res.isScalar(), "Unexpected type of result");
637  thread->setFloatReg(idx.index(), res.asInteger());
638  break;
639  case VecRegClass:
640  panic_if(!res.isVector(), "Unexpected type of result");
641  thread->setVecReg(idx, res.asVector());
642  break;
643  case VecElemClass:
644  panic_if(!res.isVecElem(), "Unexpected type of result");
645  thread->setVecElem(idx, res.asVectorElem());
646  break;
647  case CCRegClass:
648  panic_if(!res.isScalar(), "Unexpected type of result");
649  thread->setCCReg(idx.index(), res.asInteger());
650  break;
651  case MiscRegClass:
652  panic_if(res.isValid(), "MiscReg expecting invalid result");
653  // Try to get the proper misc register index for ARM here...
654  thread->setMiscReg(idx.index(), 0);
655  break;
656  // else Register is out of range...
657  default:
658  panic("Unknown register class: %d", (int)idx.classValue());
659  }
660  }
661 }
662 
663 template <class Impl>
664 void
666 {
667  cprintf("Error detected, instruction information:\n");
668  cprintf("PC:%s, nextPC:%#x\n[sn:%lli]\n[tid:%i]\n"
669  "Completed:%i\n",
670  inst->pcState(),
671  inst->nextInstAddr(),
672  inst->seqNum,
673  inst->threadNumber,
674  inst->isCompleted());
675  inst->dump();
677 }
678 
679 template <class Impl>
680 void
682 {
683  int num = 0;
684 
685  InstListIt inst_list_it = --(instList.end());
686 
687  cprintf("Inst list size: %i\n", instList.size());
688 
689  while (inst_list_it != instList.end())
690  {
691  cprintf("Instruction:%i\n",
692  num);
693 
694  cprintf("PC:%s\n[sn:%lli]\n[tid:%i]\n"
695  "Completed:%i\n",
696  (*inst_list_it)->pcState(),
697  (*inst_list_it)->seqNum,
698  (*inst_list_it)->threadNumber,
699  (*inst_list_it)->isCompleted());
700 
701  cprintf("\n");
702 
703  inst_list_it--;
704  ++num;
705  }
706 
707 }
708 
709 #endif//__CPU_CHECKER_CPU_IMPL_HH__
InstResult
Definition: inst_res.hh:46
refcnt.hh
InstResult::isScalar
bool isScalar() const
Checks.
Definition: inst_res.hh:152
warn
#define warn(...)
Definition: logging.hh:239
VecElemClass
@ VecElemClass
Vector Register Native Elem lane.
Definition: reg_class.hh:58
InstResult::asVector
const VecRegContainer & asVector() const
Definition: inst_res.hh:182
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
ArmISA::MachInst
uint32_t MachInst
Definition: types.hh:52
TheISA
Definition: decode_cache.hh:37
base_dyn_inst.hh
MemCmd::ReadReq
@ ReadReq
Definition: packet.hh:82
exetrace.hh
Checker
Templated Checker class.
Definition: cpu.hh:653
Trace::InstRecord
Definition: insttracer.hh:55
FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:132
Checker::validateInst
void validateInst(const DynInstPtr &inst)
Definition: cpu_impl.hh:449
X86ISA::count
count
Definition: misc.hh:703
InstResult::isVecElem
bool isVecElem() const
Is this a vector element result?.
Definition: inst_res.hh:156
Checker::validateExecution
void validateExecution(const DynInstPtr &inst)
Definition: cpu_impl.hh:470
ArmISA::advancePC
void advancePC(PCState &pc, const StaticInstPtr &inst)
Definition: utility.hh:405
Trace::InstRecord::dump
virtual void dump()=0
Checker::validateState
void validateState()
Definition: cpu_impl.hh:563
Request::INST_FETCH
@ INST_FETCH
The request was an instruction fetch.
Definition: request.hh:104
RegId
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:75
Checker::switchOut
void switchOut()
Prepare for another CPU to take over execution.
Definition: cpu_impl.hh:436
Checker::dumpInsts
void dumpInsts()
Definition: cpu_impl.hh:681
stats.hh
CheckerCPU::MachInst
TheISA::MachInst MachInst
Definition: cpu.hh:88
FloatRegClass
@ FloatRegClass
Floating-point register.
Definition: reg_class.hh:54
CheckerCPU::handleError
void handleError()
Definition: cpu.hh:618
CheckerCPU::dumpAndExit
void dumpAndExit()
Definition: cpu.cc:377
InstResult::isValid
bool isValid() const
Is this a valid result?.
Definition: inst_res.hh:160
sim_object.hh
cprintf
void cprintf(const char *format, const Args &...args)
Definition: cprintf.hh:152
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:234
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
StaticInst::isMacroop
bool isMacroop() const
Definition: static_inst.hh:198
cpu.hh
InstResult::ResultType::Scalar
@ Scalar
ArmISA::ZeroReg
const int ZeroReg
Definition: registers.hh:118
Checker::advancePC
void advancePC(const Fault &fault)
Definition: cpu_impl.hh:67
InstResult::asIntegerNoAssert
const uint64_t & asIntegerNoAssert() const
Cast to integer without checking type.
Definition: inst_res.hh:177
InstResult::asInteger
const uint64_t & asInteger() const
Explicit cast-like operations.
Definition: inst_res.hh:166
InstResult::asVectorElem
const VecElem & asVectorElem() const
Definition: inst_res.hh:188
static_inst.hh
Checker< O3CPUImpl >::DynInstPtr
O3CPUImpl ::DynInstPtr DynInstPtr
Definition: cpu.hh:656
NoFault
constexpr decltype(nullptr) NoFault
Definition: types.hh:245
ProbePoints::Packet
ProbePointArg< PacketInfo > Packet
Packet probe point.
Definition: mem.hh:103
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
StaticInst::nullStaticInstPtr
static StaticInstPtr nullStaticInstPtr
Pointer to a statically allocated "null" instruction object.
Definition: static_inst.hh:237
IntRegClass
@ IntRegClass
Integer register.
Definition: reg_class.hh:53
isRomMicroPC
static bool isRomMicroPC(MicroPC upc)
Definition: types.hh:161
Checker::takeOverFrom
void takeOverFrom(BaseCPU *oldCPU)
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be sw...
Definition: cpu_impl.hh:443
Checker::verify
void verify(const DynInstPtr &inst)
Definition: cpu_impl.hh:122
full_system.hh
CCRegClass
@ CCRegClass
Condition-code register.
Definition: reg_class.hh:60
BaseCPU
Definition: cpu_dummy.hh:43
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:197
MiscRegClass
@ MiscRegClass
Control (misc) register.
Definition: reg_class.hh:61
VecRegClass
@ VecRegClass
Vector Register.
Definition: reg_class.hh:56
simple_thread.hh
StaticInst::fetchMicroop
virtual StaticInstPtr fetchMicroop(MicroPC upc) const
Return the microop that goes with a particular micropc.
Definition: static_inst.cc:98
std
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
MipsISA::PCState
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
Packet::dataStatic
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
Definition: packet.hh:1107
Checker::copyResult
void copyResult(const DynInstPtr &inst, const InstResult &mismatch_val, int start_idx)
Definition: cpu_impl.hh:588
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
Checker< O3CPUImpl >::InstListIt
std::list< DynInstPtr >::iterator InstListIt
Definition: cpu.hh:695
reg_class.hh
RefCountingPtr< StaticInst >
RegId::index
const RegIndex & index() const
Index accessors.
Definition: reg_class.hh:173
std::list
STL list class.
Definition: stl.hh:51
InstResult::isVector
bool isVector() const
Is this a vector result?.
Definition: inst_res.hh:154
BaseTLB::Execute
@ Execute
Definition: tlb.hh:57
RegId::classValue
const RegClass & classValue() const
Class accessor.
Definition: reg_class.hh:200
thread_context.hh
Checker::handlePendingInt
void handlePendingInt()
Definition: cpu_impl.hh:88
CheckerCPU::pcState
TheISA::PCState pcState() const override
Definition: cpu.hh:472
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
curTick
Tick curTick()
The current simulated tick.
Definition: core.hh:45

Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17