gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
base.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2012, 2015, 2017, 2018 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) 2002-2005 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  * Authors: Steve Reinhardt
42  */
43 
44 #include "cpu/simple/base.hh"
45 
46 #include "arch/stacktrace.hh"
47 #include "arch/utility.hh"
48 #include "arch/vtophys.hh"
49 #include "base/cp_annotate.hh"
50 #include "base/cprintf.hh"
51 #include "base/inifile.hh"
52 #include "base/loader/symtab.hh"
53 #include "base/logging.hh"
54 #include "base/pollevent.hh"
55 #include "base/trace.hh"
56 #include "base/types.hh"
57 #include "config/the_isa.hh"
58 #include "cpu/base.hh"
59 #include "cpu/checker/cpu.hh"
61 #include "cpu/exetrace.hh"
62 #include "cpu/pred/bpred_unit.hh"
63 #include "cpu/profile.hh"
65 #include "cpu/simple_thread.hh"
66 #include "cpu/smt.hh"
67 #include "cpu/static_inst.hh"
68 #include "cpu/thread_context.hh"
69 #include "debug/Decode.hh"
70 #include "debug/Fetch.hh"
71 #include "debug/Quiesce.hh"
72 #include "mem/packet.hh"
73 #include "mem/request.hh"
74 #include "params/BaseSimpleCPU.hh"
75 #include "sim/byteswap.hh"
76 #include "sim/debug.hh"
77 #include "sim/faults.hh"
78 #include "sim/full_system.hh"
79 #include "sim/sim_events.hh"
80 #include "sim/sim_object.hh"
81 #include "sim/stats.hh"
82 #include "sim/system.hh"
83 
84 using namespace std;
85 using namespace TheISA;
86 
87 BaseSimpleCPU::BaseSimpleCPU(BaseSimpleCPUParams *p)
88  : BaseCPU(p),
89  curThread(0),
90  branchPred(p->branchPred),
91  traceData(NULL),
92  inst(),
93  _status(Idle)
94 {
95  SimpleThread *thread;
96 
97  for (unsigned i = 0; i < numThreads; i++) {
98  if (FullSystem) {
99  thread = new SimpleThread(this, i, p->system,
100  p->itb, p->dtb, p->isa[i]);
101  } else {
102  thread = new SimpleThread(this, i, p->system, p->workload[i],
103  p->itb, p->dtb, p->isa[i]);
104  }
105  threadInfo.push_back(new SimpleExecContext(this, thread));
106  ThreadContext *tc = thread->getTC();
107  threadContexts.push_back(tc);
108  }
109 
110  if (p->checker) {
111  if (numThreads != 1)
112  fatal("Checker currently does not support SMT");
113 
114  BaseCPU *temp_checker = p->checker;
115  checker = dynamic_cast<CheckerCPU *>(temp_checker);
116  checker->setSystem(p->system);
117  // Manipulate thread context
118  ThreadContext *cpu_tc = threadContexts[0];
120  } else {
121  checker = NULL;
122  }
123 }
124 
125 void
127 {
128  BaseCPU::init();
129 
130  for (auto tc : threadContexts) {
131  // Initialise the ThreadContext's memory proxies
132  tc->initMemProxies(tc);
133  }
134 }
135 
136 void
138 {
139  Addr oldpc, pc = threadInfo[curThread]->thread->instAddr();
140  do {
141  oldpc = pc;
142  threadInfo[curThread]->thread->pcEventQueue.service(
143  oldpc, threadContexts[curThread]);
144  pc = threadInfo[curThread]->thread->instAddr();
145  } while (oldpc != pc);
146 }
147 
148 void
150 {
151  if (numThreads > 1) {
153  !threadInfo[curThread]->stayAtPC) {
154  // Swap active threads
155  if (!activeThreads.empty()) {
156  curThread = activeThreads.front();
157  activeThreads.pop_front();
158  activeThreads.push_back(curThread);
159  }
160  }
161  }
162 }
163 
164 void
166 {
168 
170  t_info.numInst++;
171  t_info.numInsts++;
172 
174  t_info.thread->funcExeInst++;
175  }
176  t_info.numOp++;
177  t_info.numOps++;
178 }
179 
180 Counter
182 {
183  Counter total_inst = 0;
184  for (auto& t_info : threadInfo) {
185  total_inst += t_info->numInst;
186  }
187 
188  return total_inst;
189 }
190 
191 Counter
193 {
194  Counter total_op = 0;
195  for (auto& t_info : threadInfo) {
196  total_op += t_info->numOp;
197  }
198 
199  return total_op;
200 }
201 
203 {
204 }
205 
206 void
208 {
209  // for now, these are equivalent
210  suspendContext(thread_num);
212 }
213 
214 
215 void
217 {
218  using namespace Stats;
219 
221 
222  for (ThreadID tid = 0; tid < numThreads; tid++) {
223  SimpleExecContext& t_info = *threadInfo[tid];
224 
225  std::string thread_str = name();
226  if (numThreads > 1)
227  thread_str += ".thread" + std::to_string(tid);
228 
229  t_info.numInsts
230  .name(thread_str + ".committedInsts")
231  .desc("Number of instructions committed")
232  ;
233 
234  t_info.numOps
235  .name(thread_str + ".committedOps")
236  .desc("Number of ops (including micro ops) committed")
237  ;
238 
239  t_info.numIntAluAccesses
240  .name(thread_str + ".num_int_alu_accesses")
241  .desc("Number of integer alu accesses")
242  ;
243 
244  t_info.numFpAluAccesses
245  .name(thread_str + ".num_fp_alu_accesses")
246  .desc("Number of float alu accesses")
247  ;
248 
249  t_info.numVecAluAccesses
250  .name(thread_str + ".num_vec_alu_accesses")
251  .desc("Number of vector alu accesses")
252  ;
253 
254  t_info.numCallsReturns
255  .name(thread_str + ".num_func_calls")
256  .desc("number of times a function call or return occured")
257  ;
258 
259  t_info.numCondCtrlInsts
260  .name(thread_str + ".num_conditional_control_insts")
261  .desc("number of instructions that are conditional controls")
262  ;
263 
264  t_info.numIntInsts
265  .name(thread_str + ".num_int_insts")
266  .desc("number of integer instructions")
267  ;
268 
269  t_info.numFpInsts
270  .name(thread_str + ".num_fp_insts")
271  .desc("number of float instructions")
272  ;
273 
274  t_info.numVecInsts
275  .name(thread_str + ".num_vec_insts")
276  .desc("number of vector instructions")
277  ;
278 
279  t_info.numIntRegReads
280  .name(thread_str + ".num_int_register_reads")
281  .desc("number of times the integer registers were read")
282  ;
283 
284  t_info.numIntRegWrites
285  .name(thread_str + ".num_int_register_writes")
286  .desc("number of times the integer registers were written")
287  ;
288 
289  t_info.numFpRegReads
290  .name(thread_str + ".num_fp_register_reads")
291  .desc("number of times the floating registers were read")
292  ;
293 
294  t_info.numFpRegWrites
295  .name(thread_str + ".num_fp_register_writes")
296  .desc("number of times the floating registers were written")
297  ;
298 
299  t_info.numVecRegReads
300  .name(thread_str + ".num_vec_register_reads")
301  .desc("number of times the vector registers were read")
302  ;
303 
304  t_info.numVecRegWrites
305  .name(thread_str + ".num_vec_register_writes")
306  .desc("number of times the vector registers were written")
307  ;
308 
309  t_info.numCCRegReads
310  .name(thread_str + ".num_cc_register_reads")
311  .desc("number of times the CC registers were read")
312  .flags(nozero)
313  ;
314 
315  t_info.numCCRegWrites
316  .name(thread_str + ".num_cc_register_writes")
317  .desc("number of times the CC registers were written")
318  .flags(nozero)
319  ;
320 
321  t_info.numMemRefs
322  .name(thread_str + ".num_mem_refs")
323  .desc("number of memory refs")
324  ;
325 
326  t_info.numStoreInsts
327  .name(thread_str + ".num_store_insts")
328  .desc("Number of store instructions")
329  ;
330 
331  t_info.numLoadInsts
332  .name(thread_str + ".num_load_insts")
333  .desc("Number of load instructions")
334  ;
335 
336  t_info.notIdleFraction
337  .name(thread_str + ".not_idle_fraction")
338  .desc("Percentage of non-idle cycles")
339  ;
340 
341  t_info.idleFraction
342  .name(thread_str + ".idle_fraction")
343  .desc("Percentage of idle cycles")
344  ;
345 
346  t_info.numBusyCycles
347  .name(thread_str + ".num_busy_cycles")
348  .desc("Number of busy cycles")
349  ;
350 
351  t_info.numIdleCycles
352  .name(thread_str + ".num_idle_cycles")
353  .desc("Number of idle cycles")
354  ;
355 
356  t_info.icacheStallCycles
357  .name(thread_str + ".icache_stall_cycles")
358  .desc("ICache total stall cycles")
359  .prereq(t_info.icacheStallCycles)
360  ;
361 
362  t_info.dcacheStallCycles
363  .name(thread_str + ".dcache_stall_cycles")
364  .desc("DCache total stall cycles")
365  .prereq(t_info.dcacheStallCycles)
366  ;
367 
368  t_info.statExecutedInstType
369  .init(Enums::Num_OpClass)
370  .name(thread_str + ".op_class")
371  .desc("Class of executed instruction")
372  .flags(total | pdf | dist)
373  ;
374 
375  for (unsigned i = 0; i < Num_OpClasses; ++i) {
376  t_info.statExecutedInstType.subname(i, Enums::OpClassStrings[i]);
377  }
378 
379  t_info.idleFraction = constant(1.0) - t_info.notIdleFraction;
380  t_info.numIdleCycles = t_info.idleFraction * numCycles;
381  t_info.numBusyCycles = t_info.notIdleFraction * numCycles;
382 
383  t_info.numBranches
384  .name(thread_str + ".Branches")
385  .desc("Number of branches fetched")
386  .prereq(t_info.numBranches);
387 
388  t_info.numPredictedBranches
389  .name(thread_str + ".predictedBranches")
390  .desc("Number of branches predicted as taken")
391  .prereq(t_info.numPredictedBranches);
392 
393  t_info.numBranchMispred
394  .name(thread_str + ".BranchMispred")
395  .desc("Number of branch mispredictions")
396  .prereq(t_info.numBranchMispred);
397  }
398 }
399 
400 void
402 {
403  for (auto &thread_info : threadInfo) {
404  thread_info->notIdleFraction = (_status != Idle);
405  }
406 }
407 
408 void
410 {
411  assert(_status == Idle || _status == Running);
412 
413  threadInfo[tid]->thread->serialize(cp);
414 }
415 
416 void
418 {
419  threadInfo[tid]->thread->unserialize(cp);
420 }
421 
422 void
423 change_thread_state(ThreadID tid, int activate, int priority)
424 {
425 }
426 
427 Addr
429 {
430  return vtophys(threadContexts[curThread], addr);
431 }
432 
433 void
435 {
436  getCpuAddrMonitor(tid)->gotWakeup = true;
437 
438  if (threadInfo[tid]->thread->status() == ThreadContext::Suspended) {
439  DPRINTF(Quiesce,"[tid:%d] Suspended Processor awoke\n", tid);
440  threadInfo[tid]->thread->activate();
441  }
442 }
443 
444 void
446 {
448  SimpleThread* thread = t_info.thread;
449  ThreadContext* tc = thread->getTC();
450 
451  if (checkInterrupts(tc)) {
452  Fault interrupt = interrupts[curThread]->getInterrupt(tc);
453 
454  if (interrupt != NoFault) {
455  t_info.fetchOffset = 0;
456  interrupts[curThread]->updateIntrInfo(tc);
457  interrupt->invoke(tc);
458  thread->decoder.reset();
459  }
460  }
461 }
462 
463 
464 void
466 {
468  SimpleThread* thread = t_info.thread;
469 
470  Addr instAddr = thread->instAddr();
471  Addr fetchPC = (instAddr & PCMask) + t_info.fetchOffset;
472 
473  // set up memory request for instruction fetch
474  DPRINTF(Fetch, "Fetch: Inst PC:%08p, Fetch PC:%08p\n", instAddr, fetchPC);
475 
476  req->setVirt(0, fetchPC, sizeof(MachInst), Request::INST_FETCH,
477  instMasterId(), instAddr);
478 }
479 
480 
481 void
483 {
485  SimpleThread* thread = t_info.thread;
486 
487  // maintain $r0 semantics
488  thread->setIntReg(ZeroReg, 0);
489 #if THE_ISA == ALPHA_ISA
490  thread->setFloatReg(ZeroReg, 0);
491 #endif // ALPHA_ISA
492 
493  // resets predicates
494  t_info.setPredicate(true);
495  t_info.setMemAccPredicate(true);
496 
497  // check for instruction-count-based events
498  thread->comInstEventQueue.serviceEvents(t_info.numInst);
499 
500  // decode the instruction
501  TheISA::PCState pcState = thread->pcState();
502 
503  if (isRomMicroPC(pcState.microPC())) {
504  t_info.stayAtPC = false;
505  curStaticInst = microcodeRom.fetchMicroop(pcState.microPC(),
507  } else if (!curMacroStaticInst) {
508  //We're not in the middle of a macro instruction
509  StaticInstPtr instPtr = NULL;
510 
511  TheISA::Decoder *decoder = &(thread->decoder);
512 
513  //Predecode, ie bundle up an ExtMachInst
514  //If more fetch data is needed, pass it in.
515  Addr fetchPC = (pcState.instAddr() & PCMask) + t_info.fetchOffset;
516  //if (decoder->needMoreBytes())
517  decoder->moreBytes(pcState, fetchPC, inst);
518  //else
519  // decoder->process();
520 
521  //Decode an instruction if one is ready. Otherwise, we'll have to
522  //fetch beyond the MachInst at the current pc.
523  instPtr = decoder->decode(pcState);
524  if (instPtr) {
525  t_info.stayAtPC = false;
526  thread->pcState(pcState);
527  } else {
528  t_info.stayAtPC = true;
529  t_info.fetchOffset += sizeof(MachInst);
530  }
531 
532  //If we decoded an instruction and it's microcoded, start pulling
533  //out micro ops
534  if (instPtr && instPtr->isMacroop()) {
535  curMacroStaticInst = instPtr;
536  curStaticInst =
537  curMacroStaticInst->fetchMicroop(pcState.microPC());
538  } else {
539  curStaticInst = instPtr;
540  }
541  } else {
542  //Read the next micro op from the macro op
543  curStaticInst = curMacroStaticInst->fetchMicroop(pcState.microPC());
544  }
545 
546  //If we decoded an instruction this "tick", record information about it.
547  if (curStaticInst) {
548 #if TRACING_ON
549  traceData = tracer->getInstRecord(curTick(), thread->getTC(),
551 
552  DPRINTF(Decode,"Decode: Decoded %s instruction: %#x\n",
554 #endif // TRACING_ON
555  }
556 
557  if (branchPred && curStaticInst &&
559  // Use a fake sequence number since we only have one
560  // instruction in flight at the same time.
561  const InstSeqNum cur_sn(0);
562  t_info.predPC = thread->pcState();
563  const bool predict_taken(
564  branchPred->predict(curStaticInst, cur_sn, t_info.predPC,
565  curThread));
566 
567  if (predict_taken)
568  ++t_info.numPredictedBranches;
569  }
570 }
571 
572 void
574 {
576  SimpleThread* thread = t_info.thread;
577 
578  assert(curStaticInst);
579 
581  Addr instAddr = pc.instAddr();
582  if (FullSystem && thread->profile) {
583  bool usermode = TheISA::inUserMode(threadContexts[curThread]);
584  thread->profilePC = usermode ? 1 : instAddr;
585  ProfileNode *node = thread->profile->consume(threadContexts[curThread],
586  curStaticInst);
587  if (node)
588  thread->profileNode = node;
589  }
590 
591  if (curStaticInst->isMemRef()) {
592  t_info.numMemRefs++;
593  }
594 
595  if (curStaticInst->isLoad()) {
596  ++t_info.numLoad;
597  }
598 
599  if (CPA::available()) {
600  CPA::cpa()->swAutoBegin(threadContexts[curThread], pc.nextInstAddr());
601  }
602 
603  if (curStaticInst->isControl()) {
604  ++t_info.numBranches;
605  }
606 
607  /* Power model statistics */
608  //integer alu accesses
609  if (curStaticInst->isInteger()){
610  t_info.numIntAluAccesses++;
611  t_info.numIntInsts++;
612  }
613 
614  //float alu accesses
615  if (curStaticInst->isFloating()){
616  t_info.numFpAluAccesses++;
617  t_info.numFpInsts++;
618  }
619 
620  //vector alu accesses
621  if (curStaticInst->isVector()){
622  t_info.numVecAluAccesses++;
623  t_info.numVecInsts++;
624  }
625 
626  //number of function calls/returns to get window accesses
628  t_info.numCallsReturns++;
629  }
630 
631  //the number of branch predictions that will be made
632  if (curStaticInst->isCondCtrl()){
633  t_info.numCondCtrlInsts++;
634  }
635 
636  //result bus acceses
637  if (curStaticInst->isLoad()){
638  t_info.numLoadInsts++;
639  }
640 
642  t_info.numStoreInsts++;
643  }
644  /* End power model statistics */
645 
647 
648  if (FullSystem)
649  traceFunctions(instAddr);
650 
651  if (traceData) {
652  traceData->dump();
653  delete traceData;
654  traceData = NULL;
655  }
656 
657  // Call CPU instruction commit probes
658  probeInstCommit(curStaticInst, instAddr);
659 }
660 
661 void
663 {
665  SimpleThread* thread = t_info.thread;
666 
667  const bool branching(thread->pcState().branching());
668 
669  //Since we're moving to a new pc, zero out the offset
670  t_info.fetchOffset = 0;
671  if (fault != NoFault) {
673  fault->invoke(threadContexts[curThread], curStaticInst);
674  thread->decoder.reset();
675  } else {
676  if (curStaticInst) {
679  TheISA::PCState pcState = thread->pcState();
681  thread->pcState(pcState);
682  }
683  }
684 
686  // Use a fake sequence number since we only have one
687  // instruction in flight at the same time.
688  const InstSeqNum cur_sn(0);
689 
690  if (t_info.predPC == thread->pcState()) {
691  // Correctly predicted branch
692  branchPred->update(cur_sn, curThread);
693  } else {
694  // Mis-predicted branch
695  branchPred->squash(cur_sn, thread->pcState(), branching, curThread);
696  ++t_info.numBranchMispred;
697  }
698  }
699 }
700 
701 void
703 {
705  for (auto& t_info : threadInfo)
706  t_info->thread->startup();
707 }
StaticInstPtr curStaticInst
Definition: base.hh:107
virtual void dump()=0
Counter totalInsts() const override
Definition: base.cc:181
void advancePC(const Fault &fault)
Definition: base.cc:662
#define DPRINTF(x,...)
Definition: trace.hh:229
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:53
bool isStore() const
Definition: static_inst.hh:160
Stats::Scalar numFpAluAccesses
Definition: exec_context.hh:91
ProfileNode * profileNode
virtual void probeInstCommit(const StaticInstPtr &inst, Addr pc)
Helper method to trigger PMU probes for a committed instruction.
Definition: base.cc:370
Defines SMT_MAX_THREADS.
std::list< ThreadID > activeThreads
Definition: base.hh:103
decltype(nullptr) constexpr NoFault
Definition: types.hh:245
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation...
Definition: statistics.hh:379
AddressMonitor * getCpuAddrMonitor(ThreadID tid)
Definition: base.hh:614
static bool available()
Definition: cp_annotate.hh:85
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:175
FunctionProfile * profile
void checkPcEventQueue()
Definition: base.cc:137
Stats::Average notIdleFraction
CheckerCPU class.
Definition: cpu.hh:87
bool isDelayedCommit() const
Definition: static_inst.hh:198
Bitfield< 7 > i
ThreadID numThreads
Number of threads we&#39;re actually simulating (<= SMT_MAX_THREADS).
Definition: base.hh:378
void startup() override
startup() is the final initialization call before simulation.
Definition: base.cc:702
Stats::Scalar numLoadInsts
Stats::Scalar numIntAluAccesses
Definition: exec_context.hh:88
void traceFunctions(Addr pc)
Definition: base.hh:572
Stats::Vector statExecutedInstType
Addr dbg_vtophys(Addr addr)
Definition: base.cc:428
bool isMacroop() const
Definition: static_inst.hh:196
TheISA::Decoder decoder
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
std::vector< BaseInterrupts * > interrupts
Definition: base.hh:222
bool isLoad() const
Definition: static_inst.hh:159
std::shared_ptr< Request > RequestPtr
Definition: request.hh:83
TheISA::MachInst inst
Current instruction.
Definition: base.hh:106
virtual InstRecord * getInstRecord(Tick when, ThreadContext *tc, const StaticInstPtr staticInst, TheISA::PCState pc, const StaticInstPtr macroStaticInst=NULL)=0
ip6_addr_t addr
Definition: inet.hh:335
bool isFloating() const
Definition: static_inst.hh:169
void wakeup(ThreadID tid) override
Definition: base.cc:434
Stats::Scalar numCCRegReads
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:136
Counter funcExeInst
TheISA::PCState pcState() const override
bool isAtomic() const
Definition: static_inst.hh:161
Stats::Scalar numFpRegWrites
Stats::Scalar numIntRegReads
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
std::string getName()
Return name of machine instruction.
Definition: static_inst.hh:336
void checkForInterrupts()
Definition: base.cc:445
void update(const InstSeqNum &done_sn, ThreadID tid)
Tells the branch predictor to commit any updates until the given sequence number. ...
Definition: bpred_unit.cc:345
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:586
Stats::Formula numIdleCycles
System * system
Definition: base.hh:386
ThreadID curThread
Definition: base.hh:87
Definition: cprintf.cc:42
void preExecute()
Definition: base.cc:482
bool gotWakeup
Definition: base.hh:85
bool isReturn() const
Definition: static_inst.hh:175
BaseSimpleCPU(BaseSimpleCPUParams *params)
Definition: base.cc:87
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:336
ThreadContext is the external interface to all thread state for anything outside of the CPU...
void resetStats() override
Callback to reset stats.
Definition: base.cc:401
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1152
uint32_t MachInst
Definition: types.hh:40
bool isMemRef() const
Definition: static_inst.hh:158
void regStats() override
Callback to set stat parameters.
Definition: base.cc:388
void setupFetchRequest(const RequestPtr &req)
Definition: base.cc:465
Derived ThreadContext class for use with the Checker.
void setIntReg(RegIndex reg_idx, RegVal val) override
Stats::Scalar numOps
Definition: exec_context.hh:85
void swapActiveThread()
Definition: base.cc:149
void change_thread_state(ThreadID tid, int activate, int priority)
Changes the status and priority of the thread with the given number.
Definition: base.cc:423
std::vector< ThreadContext * > threadContexts
Definition: base.hh:267
Stats::Scalar icacheStallCycles
void setPredicate(bool val) override
const ExtMachInst machInst
The binary machine instruction.
Definition: static_inst.hh:229
void swAutoBegin(ThreadContext *tc, Addr next_pc)
Definition: cp_annotate.hh:90
Tick curTick()
The current simulated tick.
Definition: core.hh:47
Bitfield< 4 > pc
void countInst()
Definition: base.cc:165
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: base.cc:126
void setFloatReg(RegIndex reg_idx, RegVal val) override
void haltContext(ThreadID thread_num) override
Notify the CPU that the indicated context is now halted.
Definition: base.cc:207
static CPA * cpa()
Definition: cp_annotate.hh:84
Stats::Scalar numPredictedBranches
Number of branches predicted as taken.
void unserializeThread(CheckpointIn &cp, ThreadID tid) override
Unserialize one thread.
Definition: base.cc:417
virtual StaticInstPtr fetchMicroop(MicroPC upc) const
Return the microop that goes with a particular micropc.
Definition: static_inst.cc:100
void setMemAccPredicate(bool val) override
void updateCycleCounters(CPUState state)
base method keeping track of cycle progression
Definition: base.hh:532
Stats::Scalar numVecRegReads
const RegIndex ZeroReg
Definition: registers.hh:75
bool isCondCtrl() const
Definition: static_inst.hh:178
bool checkInterrupts(ThreadContext *tc) const
Definition: base.hh:258
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
Definition: statistics.hh:350
Stats::Scalar dcacheStallCycles
void startup() override
startup() is the final initialization call before simulation.
Definition: base.cc:324
TheISA::MicrocodeRom microcodeRom
Definition: base.hh:219
Stats::Scalar numFpInsts
Stats::Scalar numVecRegWrites
Stats::Scalar numIntRegWrites
bool predict(const StaticInstPtr &inst, const InstSeqNum &seqNum, TheISA::PCState &pc, ThreadID tid)
Predicts whether or not the instruction is a taken branch, and the target of the branch if it is take...
Definition: bpred_unit.cc:172
Temp constant(T val)
Definition: statistics.hh:3332
void serviceEvents(Tick when)
Definition: eventq.hh:636
Stats::Scalar numMemRefs
uint64_t InstSeqNum
Definition: inst_seq.hh:40
bool isCall() const
Definition: static_inst.hh:174
Stats::Scalar numIntInsts
Status _status
Definition: base.hh:125
Stats::Scalar numInsts
Definition: exec_context.hh:83
StaticInstPtr curMacroStaticInst
Definition: base.hh:108
SimpleThread * thread
Definition: exec_context.hh:68
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
ThreadContext * getTC()
Returns the pointer to this SimpleThread&#39;s ThreadContext.
Declaration of IniFile object.
bool inUserMode(ThreadContext *tc)
Definition: utility.hh:56
Stats::Formula numBusyCycles
virtual const std::string name() const
Definition: sim_object.hh:120
void advancePC(PCState &pc, const StaticInstPtr &inst)
Definition: utility.hh:98
int64_t Counter
Statistics counter type.
Definition: types.hh:58
static bool isRomMicroPC(MicroPC upc)
Definition: types.hh:161
bool isInteger() const
Definition: static_inst.hh:168
Stats::Scalar numBranches
Addr instAddr() const override
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
Definition: static_inst.hh:211
The request was an instruction fetch.
Definition: request.hh:105
const FlagsType total
Print the total.
Definition: info.hh:51
CheckerCPU * checker
Definition: base.hh:100
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
Definition: base.cc:409
static const Addr PCMask
Definition: base.hh:279
bool isVector() const
Definition: static_inst.hh:170
Counter numInst
PER-THREAD STATS.
Definition: exec_context.hh:82
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Definition: statistics.hh:279
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
Stats::Scalar numCallsReturns
Definition: exec_context.hh:97
Stats::Scalar numFpRegReads
Addr vtophys(Addr vaddr)
Definition: vtophys.cc:75
Declaration of the Packet class.
Counter totalOps() const override
Definition: base.cc:192
std::ostream CheckpointOut
Definition: serialize.hh:68
bool isControl() const
Definition: static_inst.hh:173
void setSystem(System *system)
Definition: cpu.cc:99
Trace::InstRecord * traceData
Definition: base.hh:99
static const OpClass Num_OpClasses
Definition: op_class.hh:107
GenericISA::SimplePCState< MachInst > PCState
Definition: types.hh:43
TheISA::PCState predPC
Definition: exec_context.hh:77
virtual ~BaseSimpleCPU()
Definition: base.cc:202
Stats::Scalar numCycles
Definition: base.hh:603
std::vector< SimpleExecContext * > threadInfo
Definition: base.hh:102
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: base.cc:281
Stats::Scalar numStoreInsts
Stats::Scalar numVecAluAccesses
Definition: exec_context.hh:94
Trace::InstTracer * tracer
Definition: base.hh:269
void regStats() override
Callback to set stat parameters.
Definition: base.cc:216
void squash(const InstSeqNum &squashed_sn, ThreadID tid)
Squashes all outstanding updates until a given sequence number.
Definition: bpred_unit.cc:368
void postExecute()
Definition: base.cc:573
Stats::Scalar numCCRegWrites
Stats::Formula idleFraction
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Definition: statistics.hh:312
Temporarily inactive.
Stats::Scalar numVecInsts
static StaticInstPtr nullStaticInstPtr
Pointer to a statically allocated "null" instruction object.
Definition: static_inst.hh:223
EventQueue comInstEventQueue
An instruction-based event queue.
ProfileNode * consume(ThreadContext *tc, const StaticInstPtr &inst)
Definition: profile.hh:84
const FlagsType nozero
Don&#39;t print if this is zero.
Definition: info.hh:59
Bitfield< 0 > p
const FlagsType dist
Print the distribution.
Definition: info.hh:57
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
bool isMicroop() const
Definition: static_inst.hh:197
Stats::Scalar numBranchMispred
Number of misprediced branches.
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:60
output decoder
Definition: nop.cc:64
MasterID instMasterId() const
Reads this CPU&#39;s unique instruction requestor ID.
Definition: base.hh:191
Counter totalNumInsts
Definition: system.hh:627
virtual void suspendContext(ThreadID thread_num)
Notify the CPU that the indicated context is now suspended.
Definition: base.cc:505
bool isLastMicroop() const
Definition: static_inst.hh:199
BPredUnit * branchPred
Definition: base.hh:88
Stats::Scalar numCondCtrlInsts

Generated on Fri Feb 28 2020 16:26:59 for gem5 by doxygen 1.8.13