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