gem5  [DEVELOP-FOR-23.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) 2011-2012,2016-2017, 2019-2020 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2002-2005 The Regents of The University of Michigan
15  * Copyright (c) 2011 Regents of the University of California
16  * Copyright (c) 2013 Advanced Micro Devices, Inc.
17  * Copyright (c) 2013 Mark D. Hill and David A. Wood
18  * All rights reserved.
19  *
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions are
22  * met: redistributions of source code must retain the above copyright
23  * notice, this list of conditions and the following disclaimer;
24  * redistributions in binary form must reproduce the above copyright
25  * notice, this list of conditions and the following disclaimer in the
26  * documentation and/or other materials provided with the distribution;
27  * neither the name of the copyright holders nor the names of its
28  * contributors may be used to endorse or promote products derived from
29  * this software without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  */
43 
44 #include "cpu/base.hh"
45 
46 #include <iostream>
47 #include <sstream>
48 #include <string>
49 
50 #include "arch/generic/decoder.hh"
51 #include "arch/generic/isa.hh"
52 #include "arch/generic/tlb.hh"
53 #include "base/cprintf.hh"
54 #include "base/loader/symtab.hh"
55 #include "base/logging.hh"
56 #include "base/output.hh"
57 #include "base/trace.hh"
58 #include "cpu/checker/cpu.hh"
59 #include "cpu/thread_context.hh"
60 #include "debug/Mwait.hh"
61 #include "debug/SyscallVerbose.hh"
62 #include "debug/Thread.hh"
63 #include "mem/page_table.hh"
64 #include "params/BaseCPU.hh"
65 #include "sim/clocked_object.hh"
66 #include "sim/full_system.hh"
67 #include "sim/process.hh"
68 #include "sim/root.hh"
69 #include "sim/sim_events.hh"
70 #include "sim/sim_exit.hh"
71 #include "sim/system.hh"
72 
73 // Hack
74 #include "sim/stat_control.hh"
75 
76 namespace gem5
77 {
78 
79 std::unique_ptr<BaseCPU::GlobalStats> BaseCPU::globalStats;
80 
82 
83 // This variable reflects the max number of threads in any CPU. Be
84 // careful to only use it once all the CPUs that you care about have
85 // been initialized
87 
89  : Event(Event::Progress_Event_Pri), _interval(ival), lastNumInst(0),
90  cpu(_cpu), _repeatEvent(true)
91 {
92  if (_interval)
93  cpu->schedule(this, curTick() + _interval);
94 }
95 
96 void
98 {
99  Counter temp = cpu->totalOps();
100 
101  if (_repeatEvent)
102  cpu->schedule(this, curTick() + _interval);
103 
104  if (cpu->switchedOut()) {
105  return;
106  }
107 
108 #ifndef NDEBUG
109  double ipc = double(temp - lastNumInst) / (_interval / cpu->clockPeriod());
110 
111  DPRINTFN("%s progress event, total committed:%i, progress insts committed: "
112  "%lli, IPC: %0.8d\n", cpu->name(), temp, temp - lastNumInst,
113  ipc);
114  ipc = 0.0;
115 #else
116  cprintf("%lli: %s progress event, total committed:%i, progress insts "
117  "committed: %lli\n", curTick(), cpu->name(), temp,
118  temp - lastNumInst);
119 #endif
120  lastNumInst = temp;
121 }
122 
123 const char *
125 {
126  return "CPU Progress";
127 }
128 
129 BaseCPU::BaseCPU(const Params &p, bool is_checker)
130  : ClockedObject(p), instCnt(0), _cpuId(p.cpu_id), _socketId(p.socket_id),
131  _instRequestorId(p.system->getRequestorId(this, "inst")),
132  _dataRequestorId(p.system->getRequestorId(this, "data")),
133  _taskId(context_switch_task_id::Unknown), _pid(invldPid),
134  _switchedOut(p.switched_out), _cacheLineSize(p.system->cacheLineSize()),
135  modelResetPort(p.name + ".model_reset"),
136  interrupts(p.interrupts), numThreads(p.numThreads), system(p.system),
137  previousCycle(0), previousState(CPU_STATE_SLEEP),
138  functionTraceStream(nullptr), currentFunctionStart(0),
139  currentFunctionEnd(0), functionEntryTick(0),
140  baseStats(this),
141  addressMonitor(p.numThreads),
142  syscallRetryLatency(p.syscallRetryLatency),
143  pwrGatingLatency(p.pwr_gating_latency),
144  powerGatingOnIdle(p.power_gating_on_idle),
145  enterPwrGatingEvent([this]{ enterPwrGating(); }, name())
146 {
147  // if Python did not provide a valid ID, do it here
148  if (_cpuId == -1 ) {
149  _cpuId = cpuList.size();
150  }
151 
152  // add self to global list of CPUs
153  cpuList.push_back(this);
154 
155  DPRINTF(SyscallVerbose, "Constructing CPU with id %d, socket id %d\n",
156  _cpuId, _socketId);
157 
158  if (numThreads > maxThreadsPerCPU)
159  maxThreadsPerCPU = numThreads;
160 
161  functionTracingEnabled = false;
162  if (p.function_trace) {
163  const std::string fname = csprintf("ftrace.%s", name());
164  functionTraceStream = simout.findOrCreate(fname)->stream();
165 
166  currentFunctionStart = currentFunctionEnd = 0;
167  functionEntryTick = p.function_trace_start;
168 
169  if (p.function_trace_start == 0) {
170  functionTracingEnabled = true;
171  } else {
172  Event *event = new EventFunctionWrapper(
173  [this]{ enableFunctionTrace(); }, name(), true);
174  schedule(event, p.function_trace_start);
175  }
176  }
177 
178  tracer = params().tracer;
179 
180  if (params().isa.size() != numThreads) {
181  fatal("Number of ISAs (%i) assigned to the CPU does not equal number "
182  "of threads (%i).\n", params().isa.size(), numThreads);
183  }
184 
185  if (!FullSystem && params().workload.size() != numThreads) {
186  fatal("Number of processes (cpu.workload) (%i) assigned to the CPU "
187  "does not equal number of threads (%i).\n",
188  params().workload.size(), numThreads);
189  }
190 
191  modelResetPort.onChange([this](const bool &new_val) {
192  setReset(new_val);
193  });
194  // create a stat group object for each thread on this core
195  fetchStats.reserve(numThreads);
196  executeStats.reserve(numThreads);
197  commitStats.reserve(numThreads);
198  for (int i = 0; i < numThreads; i++) {
199  // create fetchStat object for thread i and set rate formulas
200  FetchCPUStats* fetchStatptr = new FetchCPUStats(this, i);
201  fetchStatptr->fetchRate = fetchStatptr->numInsts / baseStats.numCycles;
202  fetchStatptr->branchRate = fetchStatptr->numBranches /
203  baseStats.numCycles;
204  fetchStats.emplace_back(fetchStatptr);
205 
206  // create executeStat object for thread i and set rate formulas
207  ExecuteCPUStats* executeStatptr = new ExecuteCPUStats(this, i);
208  executeStatptr->instRate = executeStatptr->numInsts /
209  baseStats.numCycles;
210  executeStats.emplace_back(executeStatptr);
211 
212  // create commitStat object for thread i and set ipc, cpi formulas
213  CommitCPUStats* commitStatptr = new CommitCPUStats(this, i);
214  commitStatptr->ipc = commitStatptr->numInsts / baseStats.numCycles;
215  commitStatptr->cpi = baseStats.numCycles / commitStatptr->numInsts;
216  commitStats.emplace_back(commitStatptr);
217  }
218 }
219 
220 void
222 {
223  functionTracingEnabled = true;
224 }
225 
227 {
228 }
229 
230 void
231 BaseCPU::postInterrupt(ThreadID tid, int int_num, int index)
232 {
233  interrupts[tid]->post(int_num, index);
234  // Only wake up syscall emulation if it is not waiting on a futex.
235  // This is to model the fact that instructions such as ARM SEV
236  // should wake up a WFE sleep, but not a futex syscall WAIT.
238  wakeup(tid);
239 }
240 
241 void
243 {
244  assert(tid < numThreads);
245  AddressMonitor &monitor = addressMonitor[tid];
246 
247  monitor.armed = true;
248  monitor.vAddr = address;
249  monitor.pAddr = 0x0;
250  DPRINTF(Mwait, "[tid:%d] Armed monitor (vAddr=0x%lx)\n", tid, address);
251 }
252 
253 bool
255 {
256  assert(tid < numThreads);
257  AddressMonitor &monitor = addressMonitor[tid];
258 
259  if (!monitor.gotWakeup) {
260  int block_size = cacheLineSize();
261  uint64_t mask = ~((uint64_t)(block_size - 1));
262 
263  assert(pkt->req->hasPaddr());
264  monitor.pAddr = pkt->getAddr() & mask;
265  monitor.waiting = true;
266 
267  DPRINTF(Mwait, "[tid:%d] mwait called (vAddr=0x%lx, "
268  "line's paddr=0x%lx)\n", tid, monitor.vAddr, monitor.pAddr);
269  return true;
270  } else {
271  monitor.gotWakeup = false;
272  return false;
273  }
274 }
275 
276 void
278 {
279  assert(tid < numThreads);
280  AddressMonitor &monitor = addressMonitor[tid];
281 
282  RequestPtr req = std::make_shared<Request>();
283 
284  Addr addr = monitor.vAddr;
285  int block_size = cacheLineSize();
286  uint64_t mask = ~((uint64_t)(block_size - 1));
287  int size = block_size;
288 
289  //The address of the next line if it crosses a cache line boundary.
290  Addr secondAddr = roundDown(addr + size - 1, block_size);
291 
292  if (secondAddr > addr)
293  size = secondAddr - addr;
294 
295  req->setVirt(addr, size, 0x0, dataRequestorId(),
296  tc->pcState().instAddr());
297 
298  // translate to physical address
299  Fault fault = mmu->translateAtomic(req, tc, BaseMMU::Read);
300  assert(fault == NoFault);
301 
302  monitor.pAddr = req->getPaddr() & mask;
303  monitor.waiting = true;
304 
305  DPRINTF(Mwait, "[tid:%d] mwait called (vAddr=0x%lx, line's paddr=0x%lx)\n",
306  tid, monitor.vAddr, monitor.pAddr);
307 }
308 
309 void
311 {
312  // Set up instruction-count-based termination events, if any. This needs
313  // to happen after threadContexts has been constructed.
314  if (params().max_insts_any_thread != 0) {
315  scheduleInstStopAnyThread(params().max_insts_any_thread);
316  }
317 
318  // Set up instruction-count-based termination events for SimPoints
319  // Typically, there are more than one action points.
320  // Simulation.py is responsible to take the necessary actions upon
321  // exitting the simulation loop.
322  if (!params().simpoint_start_insts.empty()) {
323  scheduleSimpointsInstStop(params().simpoint_start_insts);
324  }
325 
326  if (params().max_insts_all_threads != 0) {
327  std::string cause = "all threads reached the max instruction count";
328 
329  // allocate & initialize shared downcounter: each event will
330  // decrement this when triggered; simulation will terminate
331  // when counter reaches 0
332  int *counter = new int;
333  *counter = numThreads;
334  for (ThreadID tid = 0; tid < numThreads; ++tid) {
335  Event *event = new CountedExitEvent(cause, *counter);
336  threadContexts[tid]->scheduleInstCountEvent(
337  event, params().max_insts_all_threads);
338  }
339  }
340 
341  if (!params().switched_out) {
343 
345  }
346 }
347 
348 void
350 {
351  if (params().progress_interval) {
352  new CPUProgressEvent(this, params().progress_interval);
353  }
354 
355  if (_switchedOut)
357 
358  // Assumption CPU start to operate instantaneously without any latency
359  if (powerState->get() == enums::PwrState::UNDEFINED)
360  powerState->set(enums::PwrState::ON);
361 
362 }
363 
366 {
367  probing::PMUUPtr ptr;
368  ptr.reset(new probing::PMU(getProbeManager(), name));
369 
370  return ptr;
371 }
372 
373 void
375 {
376  ppAllCycles = pmuProbePoint("Cycles");
377  ppActiveCycles = pmuProbePoint("ActiveCycles");
378 
379  ppRetiredInsts = pmuProbePoint("RetiredInsts");
380  ppRetiredInstsPC = pmuProbePoint("RetiredInstsPC");
381  ppRetiredLoads = pmuProbePoint("RetiredLoads");
382  ppRetiredStores = pmuProbePoint("RetiredStores");
383  ppRetiredBranches = pmuProbePoint("RetiredBranches");
384 
386  "Sleeping");
387 }
388 
389 void
391 {
392  if (!inst->isMicroop() || inst->isLastMicroop()) {
393  ppRetiredInsts->notify(1);
394  ppRetiredInstsPC->notify(pc);
395  }
396 
397  if (inst->isLoad())
398  ppRetiredLoads->notify(1);
399 
400  if (inst->isStore() || inst->isAtomic())
401  ppRetiredStores->notify(1);
402 
403  if (inst->isControl())
404  ppRetiredBranches->notify(1);
405 }
406 
407 BaseCPU::
409  : statistics::Group(parent),
410  ADD_STAT(numCycles, statistics::units::Cycle::get(),
411  "Number of cpu cycles simulated"),
412  ADD_STAT(cpi, statistics::units::Rate<
413  statistics::units::Cycle, statistics::units::Count>::get(),
414  "CPI: cycles per instruction (core level)"),
415  ADD_STAT(ipc, statistics::units::Rate<
416  statistics::units::Count, statistics::units::Cycle>::get(),
417  "IPC: instructions per cycle (core level)"),
418  ADD_STAT(numWorkItemsStarted, statistics::units::Count::get(),
419  "Number of work items this cpu started"),
420  ADD_STAT(numWorkItemsCompleted, statistics::units::Count::get(),
421  "Number of work items this cpu completed")
422 {
423  cpi.precision(6);
424  cpi = numCycles / numInsts;
425 
426  ipc.precision(6);
427  ipc = numInsts / numCycles;
428 }
429 
430 void
432 {
434 
435  if (!globalStats) {
436  /* We need to construct the global CPU stat structure here
437  * since it needs a pointer to the Root object. */
438  globalStats.reset(new GlobalStats(Root::root()));
439  }
440 
441  using namespace statistics;
442 
443  int size = threadContexts.size();
444  if (size > 1) {
445  for (int i = 0; i < size; ++i) {
446  std::stringstream namestr;
447  ccprintf(namestr, "%s.ctx%d", name(), i);
448  threadContexts[i]->regStats(namestr.str());
449  }
450  } else if (size == 1)
451  threadContexts[0]->regStats(name());
452 }
453 
454 Port &
455 BaseCPU::getPort(const std::string &if_name, PortID idx)
456 {
457  // Get the right port based on name. This applies to all the
458  // subclasses of the base CPU and relies on their implementation
459  // of getDataPort and getInstPort.
460  if (if_name == "dcache_port")
461  return getDataPort();
462  else if (if_name == "icache_port")
463  return getInstPort();
464  else if (if_name == "model_reset")
465  return modelResetPort;
466  else
467  return ClockedObject::getPort(if_name, idx);
468 }
469 
470 void
472 {
473  assert(system->multiThread || numThreads == 1);
474 
475  fatal_if(interrupts.size() != numThreads,
476  "CPU %s has %i interrupt controllers, but is expecting one "
477  "per thread (%i)\n",
478  name(), interrupts.size(), numThreads);
479 
480  for (ThreadID tid = 0; tid < threadContexts.size(); ++tid) {
481  ThreadContext *tc = threadContexts[tid];
482 
484 
485  if (!FullSystem)
487 
488  interrupts[tid]->setThreadContext(tc);
489  tc->getIsaPtr()->setThreadContext(tc);
490  }
491 }
492 
493 void
495 {
498  }
499 }
500 
501 void
503 {
504  for (auto tc : threadContexts) {
505  if (tc->status() == ThreadContext::Active)
506  return;
507  }
508 
509  if (powerState->get() == enums::PwrState::CLK_GATED &&
511  assert(!enterPwrGatingEvent.scheduled());
512  // Schedule a power gating event when clock gated for the specified
513  // amount of time
515  }
516 }
517 
518 int
520 {
521  ThreadID size = threadContexts.size();
522  for (ThreadID tid = 0; tid < size; ++tid) {
523  if (tc == threadContexts[tid])
524  return tid;
525  }
526  return 0;
527 }
528 
529 void
531 {
532  if (modelResetPort.state()) {
533  DPRINTF(Thread, "CPU in reset, not activating context %d\n",
534  threadContexts[thread_num]->contextId());
535  return;
536  }
537 
538  DPRINTF(Thread, "activate contextId %d\n",
539  threadContexts[thread_num]->contextId());
540  // Squash enter power gating event while cpu gets activated
543  // For any active thread running, update CPU power state to active (ON)
544  powerState->set(enums::PwrState::ON);
545 
547 }
548 
549 void
551 {
552  DPRINTF(Thread, "suspend contextId %d\n",
553  threadContexts[thread_num]->contextId());
554  // Check if all threads are suspended
555  for (auto t : threadContexts) {
556  if (t->status() != ThreadContext::Suspended) {
557  return;
558  }
559  }
560 
561  // All CPU thread are suspended, update cycle count
563 
564  // All CPU threads suspended, enter lower power state for the CPU
565  powerState->set(enums::PwrState::CLK_GATED);
566 
567  // If pwrGatingLatency is set to 0 then this mechanism is disabled
568  if (powerGatingOnIdle) {
569  // Schedule power gating event when clock gated for pwrGatingLatency
570  // cycles
572  }
573 }
574 
575 void
577 {
579 }
580 
581 void
583 {
585 }
586 
587 void
589 {
590  assert(!_switchedOut);
591  _switchedOut = true;
592 
593  // Flush all TLBs in the CPU to avoid having stale translations if
594  // it gets switched in later.
595  flushTLBs();
596 
597  // Go to the power gating state
599 }
600 
601 void
603 {
604  assert(threadContexts.size() == oldCPU->threadContexts.size());
605  assert(_cpuId == oldCPU->cpuId());
606  assert(_switchedOut);
607  assert(oldCPU != this);
608  _pid = oldCPU->getPid();
609  _taskId = oldCPU->taskId();
610  // Take over the power state of the switchedOut CPU
611  powerState->set(oldCPU->powerState->get());
612 
613  previousState = oldCPU->previousState;
614  previousCycle = oldCPU->previousCycle;
615 
616  _switchedOut = false;
617 
618  ThreadID size = threadContexts.size();
619  for (ThreadID i = 0; i < size; ++i) {
620  ThreadContext *newTC = threadContexts[i];
621  ThreadContext *oldTC = oldCPU->threadContexts[i];
622 
623  newTC->getIsaPtr()->setThreadContext(newTC);
624 
625  newTC->takeOverFrom(oldTC);
626 
627  assert(newTC->contextId() == oldTC->contextId());
628  assert(newTC->threadId() == oldTC->threadId());
629  system->replaceThreadContext(newTC, newTC->contextId());
630 
631  /* This code no longer works since the zero register (e.g.,
632  * r31 on Alpha) doesn't necessarily contain zero at this
633  * point.
634  if (debug::Context)
635  ThreadContext::compare(oldTC, newTC);
636  */
637 
638  newTC->getMMUPtr()->takeOverFrom(oldTC->getMMUPtr());
639 
640  // Checker whether or not we have to transfer CheckerCPU
641  // objects over in the switch
642  CheckerCPU *old_checker = oldTC->getCheckerCpuPtr();
643  CheckerCPU *new_checker = newTC->getCheckerCpuPtr();
644  if (old_checker && new_checker) {
645  new_checker->getMMUPtr()->takeOverFrom(old_checker->getMMUPtr());
646  }
647  }
648 
649  interrupts = oldCPU->interrupts;
650  for (ThreadID tid = 0; tid < numThreads; tid++) {
651  interrupts[tid]->setThreadContext(threadContexts[tid]);
652  }
653  oldCPU->interrupts.clear();
654 
655  // All CPUs have an instruction and a data port, and the new CPU's
656  // ports are dangling while the old CPU has its ports connected
657  // already. Unbind the old CPU and then bind the ports of the one
658  // we are switching to.
659  getInstPort().takeOverFrom(&oldCPU->getInstPort());
660  getDataPort().takeOverFrom(&oldCPU->getDataPort());
661 
662  // Switch over the reset line as well, if necessary.
663  if (oldCPU->modelResetPort.isConnected())
665 }
666 
667 void
669 {
670  for (auto tc: threadContexts) {
671  if (state) {
672  // As we enter reset, stop execution.
673  tc->quiesce();
674  } else {
675  // As we leave reset, first reset thread state,
676  tc->getIsaPtr()->resetThread();
677  // reset the decoder in case it had partially decoded something,
678  tc->getDecoderPtr()->reset();
679  // flush the TLBs,
680  tc->getMMUPtr()->flushAll();
681  // Clear any interrupts,
682  interrupts[tc->threadId()]->clearAll();
683  // and finally reenable execution.
684  tc->activate();
685  }
686  }
687 }
688 
689 void
691 {
692  for (ThreadID i = 0; i < threadContexts.size(); ++i) {
694  CheckerCPU *checker(tc.getCheckerCpuPtr());
695 
696  tc.getMMUPtr()->flushAll();
697  if (checker) {
698  checker->getMMUPtr()->flushAll();
699  }
700  }
701 }
702 
703 void
705 {
707 
708  if (!_switchedOut) {
709  /* Unlike _pid, _taskId is not serialized, as they are dynamically
710  * assigned unique ids that are only meaningful for the duration of
711  * a specific run. We will need to serialize the entire taskMap in
712  * system. */
714 
715  // Serialize the threads, this is done by the CPU implementation.
716  for (ThreadID i = 0; i < numThreads; ++i) {
717  ScopedCheckpointSection sec(cp, csprintf("xc.%i", i));
718  interrupts[i]->serialize(cp);
719  serializeThread(cp, i);
720  }
721  }
722 }
723 
724 void
726 {
728 
729  if (!_switchedOut) {
731 
732  // Unserialize the threads, this is done by the CPU implementation.
733  for (ThreadID i = 0; i < numThreads; ++i) {
734  ScopedCheckpointSection sec(cp, csprintf("xc.%i", i));
735  interrupts[i]->unserialize(cp);
736  unserializeThread(cp, i);
737  }
738  }
739 }
740 
741 void
742 BaseCPU::scheduleInstStop(ThreadID tid, Counter insts, std::string cause)
743 {
744  const Tick now(getCurrentInstCount(tid));
745  Event *event(new LocalSimLoopExitEvent(cause, 0));
746 
747  threadContexts[tid]->scheduleInstCountEvent(event, now + insts);
748 }
749 
750 Tick
752 {
753  return threadContexts[tid]->getCurrentInstCount();
754 }
755 
757 {
758  armed = false;
759  waiting = false;
760  gotWakeup = false;
761 }
762 
763 bool
765 {
766  assert(pkt->req->hasPaddr());
767  if (armed && waiting) {
768  if (pAddr == pkt->getAddr()) {
769  DPRINTF(Mwait, "pAddr=0x%lx invalidated: waking up core\n",
770  pkt->getAddr());
771  waiting = false;
772  return true;
773  }
774  }
775  return false;
776 }
777 
778 
779 void
781 {
782  if (loader::debugSymbolTable.empty())
783  return;
784 
785  // if pc enters different function, print new function symbol and
786  // update saved range. Otherwise do nothing.
787  if (pc < currentFunctionStart || pc >= currentFunctionEnd) {
790 
791  std::string sym_str;
792  if (it == loader::debugSymbolTable.end()) {
793  // no symbol found: use addr as label
794  sym_str = csprintf("%#x", pc);
796  currentFunctionEnd = pc + 1;
797  } else {
798  sym_str = it->name;
799  currentFunctionStart = it->address;
800  }
801 
802  ccprintf(*functionTraceStream, " (%d)\n%d: %s",
803  curTick() - functionEntryTick, curTick(), sym_str);
805  }
806 }
807 
808 void
810 {
811  std::string cause = "simpoint starting point found";
812  for (size_t i = 0; i < inst_starts.size(); ++i) {
813  scheduleInstStop(0, inst_starts[i], cause);
814  }
815 }
816 
817 void
819 {
820  std::string cause = "a thread reached the max instruction count";
821  for (ThreadID tid = 0; tid < numThreads; ++tid) {
822  scheduleInstStop(tid, max_insts, cause);
823  }
824 }
825 
827  : statistics::Group(parent),
828  ADD_STAT(simInsts, statistics::units::Count::get(),
829  "Number of instructions simulated"),
830  ADD_STAT(simOps, statistics::units::Count::get(),
831  "Number of ops (including micro ops) simulated"),
832  ADD_STAT(hostInstRate, statistics::units::Rate<
833  statistics::units::Count, statistics::units::Second>::get(),
834  "Simulator instruction rate (inst/s)"),
835  ADD_STAT(hostOpRate, statistics::units::Rate<
836  statistics::units::Count, statistics::units::Second>::get(),
837  "Simulator op (including micro ops) rate (op/s)")
838 {
839  simInsts
841  .precision(0)
842  .prereq(simInsts)
843  ;
844 
845  simOps
847  .precision(0)
848  .prereq(simOps)
849  ;
850 
852  .precision(0)
853  .prereq(simInsts)
854  ;
855 
856  hostOpRate
857  .precision(0)
858  .prereq(simOps)
859  ;
860 
863 }
864 
865 BaseCPU::
867  : statistics::Group(parent, csprintf("fetchStats%i", thread_id).c_str()),
868  ADD_STAT(numInsts, statistics::units::Count::get(),
869  "Number of instructions fetched (thread level)"),
870  ADD_STAT(numOps, statistics::units::Count::get(),
871  "Number of ops (including micro ops) fetched (thread level)"),
872  ADD_STAT(fetchRate, statistics::units::Rate<
873  statistics::units::Count, statistics::units::Cycle>::get(),
874  "Number of inst fetches per cycle"),
875  ADD_STAT(numBranches, statistics::units::Count::get(),
876  "Number of branches fetched"),
877  ADD_STAT(branchRate, statistics::units::Ratio::get(),
878  "Number of branch fetches per cycle"),
879  ADD_STAT(icacheStallCycles, statistics::units::Cycle::get(),
880  "ICache total stall cycles"),
881  ADD_STAT(numFetchSuspends, statistics::units::Count::get(),
882  "Number of times Execute suspended instruction fetching")
883 
884 {
885  fetchRate
887 
890 
891  branchRate
893 
896 
897 }
898 
899 // means it is incremented in a vector indexing and not directly
900 BaseCPU::
902  : statistics::Group(parent, csprintf("executeStats%i", thread_id).c_str()),
903  ADD_STAT(numInsts, statistics::units::Count::get(),
904  "Number of executed instructions"),
905  ADD_STAT(numNop, statistics::units::Count::get(),
906  "Number of nop insts executed"),
907  ADD_STAT(numBranches, statistics::units::Count::get(),
908  "Number of branches executed"),
909  ADD_STAT(numLoadInsts, statistics::units::Count::get(),
910  "Number of load instructions executed"),
911  ADD_STAT(numStoreInsts, statistics::units::Count::get(),
912  "Number of stores executed"),
913  ADD_STAT(instRate, statistics::units::Rate<
914  statistics::units::Count, statistics::units::Cycle>::get(),
915  "Inst execution rate"),
916  ADD_STAT(dcacheStallCycles, statistics::units::Cycle::get(),
917  "DCache total stall cycles"),
918  ADD_STAT(numCCRegReads, statistics::units::Count::get(),
919  "Number of times the CC registers were read"),
920  ADD_STAT(numCCRegWrites, statistics::units::Count::get(),
921  "Number of times the CC registers were written"),
922  ADD_STAT(numFpAluAccesses, statistics::units::Count::get(),
923  "Number of float alu accesses"),
924  ADD_STAT(numFpRegReads, statistics::units::Count::get(),
925  "Number of times the floating registers were read"),
926  ADD_STAT(numFpRegWrites, statistics::units::Count::get(),
927  "Number of times the floating registers were written"),
928  ADD_STAT(numIntAluAccesses, statistics::units::Count::get(),
929  "Number of integer alu accesses"),
930  ADD_STAT(numIntRegReads, statistics::units::Count::get(),
931  "Number of times the integer registers were read"),
932  ADD_STAT(numIntRegWrites, statistics::units::Count::get(),
933  "Number of times the integer registers were written"),
934  ADD_STAT(numMemRefs, statistics::units::Count::get(),
935  "Number of memory refs"),
936  ADD_STAT(numMiscRegReads, statistics::units::Count::get(),
937  "Number of times the Misc registers were read"),
938  ADD_STAT(numMiscRegWrites, statistics::units::Count::get(),
939  "Number of times the Misc registers were written"),
940  ADD_STAT(numVecAluAccesses, statistics::units::Count::get(),
941  "Number of vector alu accesses"),
942  ADD_STAT(numVecPredRegReads, statistics::units::Count::get(),
943  "Number of times the predicate registers were read"),
944  ADD_STAT(numVecPredRegWrites, statistics::units::Count::get(),
945  "Number of times the predicate registers were written"),
946  ADD_STAT(numVecRegReads, statistics::units::Count::get(),
947  "Number of times the vector registers were read"),
948  ADD_STAT(numVecRegWrites, statistics::units::Count::get(),
949  "Number of times the vector registers were written"),
950  ADD_STAT(numDiscardedOps, statistics::units::Count::get(),
951  "Number of ops (including micro ops) which were discarded before "
952  "commit")
953 {
955 
986 }
987 
988 BaseCPU::
990  : statistics::Group(parent, csprintf("commitStats%i", thread_id).c_str()),
991  ADD_STAT(numInsts, statistics::units::Count::get(),
992  "Number of instructions committed (thread level)"),
993  ADD_STAT(numOps, statistics::units::Count::get(),
994  "Number of ops (including micro ops) committed (thread level)"),
995  ADD_STAT(numInstsNotNOP, statistics::units::Count::get(),
996  "Number of instructions committed excluding NOPs or prefetches"),
997  ADD_STAT(numOpsNotNOP, statistics::units::Count::get(),
998  "Number of Ops (including micro ops) Simulated"),
999  ADD_STAT(cpi, statistics::units::Rate<
1000  statistics::units::Cycle, statistics::units::Count>::get(),
1001  "CPI: cycles per instruction (thread level)"),
1002  ADD_STAT(ipc, statistics::units::Rate<
1003  statistics::units::Count, statistics::units::Cycle>::get(),
1004  "IPC: instructions per cycle (thread level)"),
1005  ADD_STAT(numMemRefs, statistics::units::Count::get(),
1006  "Number of memory references committed"),
1007  ADD_STAT(numFpInsts, statistics::units::Count::get(),
1008  "Number of float instructions"),
1009  ADD_STAT(numIntInsts, statistics::units::Count::get(),
1010  "Number of integer instructions"),
1011  ADD_STAT(numLoadInsts, statistics::units::Count::get(),
1012  "Number of load instructions"),
1013  ADD_STAT(numStoreInsts, statistics::units::Count::get(),
1014  "Number of store instructions"),
1015  ADD_STAT(numVecInsts, statistics::units::Count::get(),
1016  "Number of vector instructions"),
1017  ADD_STAT(committedInstType, statistics::units::Count::get(),
1018  "Class of committed instruction."),
1019  ADD_STAT(committedControl, statistics::units::Count::get(),
1020  "Class of control type instructions committed")
1021 {
1022  numInsts
1023  .prereq(numInsts);
1024 
1025  cpi.precision(6);
1026  ipc.precision(6);
1027 
1029  .init(enums::Num_OpClass)
1031 
1032  for (unsigned i = 0; i < Num_OpClasses; ++i) {
1033  committedInstType.subname(i, enums::OpClassStrings[i]);
1034  }
1035 
1037  .init(StaticInstFlags::Flags::Num_Flags)
1039 
1040  for (unsigned i = 0; i < StaticInstFlags::Flags::Num_Flags; i++) {
1041  committedControl.subname(i, StaticInstFlags::FlagsStrings[i]);
1042  }
1043 }
1044 
1045 
1046 void
1047 BaseCPU::
1049 {
1050  /* Add a count for every control instruction type */
1051  if (staticInst->isControl()) {
1052  if (staticInst->isReturn()) {
1053  committedControl[gem5::StaticInstFlags::Flags::IsReturn]++;
1054  }
1055  if (staticInst->isCall()) {
1056  committedControl[gem5::StaticInstFlags::Flags::IsCall]++;
1057  }
1058  if (staticInst->isDirectCtrl()) {
1059  committedControl[gem5::StaticInstFlags::Flags::IsDirectControl]++;
1060  }
1061  if (staticInst->isIndirectCtrl()) {
1062  committedControl
1063  [gem5::StaticInstFlags::Flags::IsIndirectControl]++;
1064  }
1065  if (staticInst->isCondCtrl()) {
1066  committedControl[gem5::StaticInstFlags::Flags::IsCondControl]++;
1067  }
1068  if (staticInst->isUncondCtrl()) {
1069  committedControl[gem5::StaticInstFlags::Flags::IsUncondControl]++;
1070  }
1071  committedControl[gem5::StaticInstFlags::Flags::IsControl]++;
1072  }
1073 }
1074 
1075 } // namespace gem5
gem5::BaseCPU::FetchCPUStats::numBranches
statistics::Scalar numBranches
Definition: base.hh:703
gem5::BaseCPU::BaseCPUStats::cpi
statistics::Formula cpi
Definition: base.hh:642
gem5::CPUProgressEvent::CPUProgressEvent
CPUProgressEvent(BaseCPU *_cpu, Tick ival=0)
Definition: base.cc:88
gem5::BaseCPU::CommitCPUStats::numInsts
statistics::Scalar numInsts
Definition: base.hh:781
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:200
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
gem5::Process::assignThreadContext
void assignThreadContext(ContextID context_id)
Definition: process.hh:130
gem5::BaseCPU::ExecuteCPUStats::numVecRegReads
statistics::Scalar numVecRegReads
Definition: base.hh:769
gem5::SimObject::getPort
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Definition: sim_object.cc:123
gem5::CPUProgressEvent::lastNumInst
Counter lastNumInst
Definition: base.hh:87
gem5::BaseCPU::currentFunctionStart
Addr currentFunctionStart
Definition: base.hh:590
gem5::PCStateBase::instAddr
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
Definition: pcstate.hh:107
gem5::BaseMMU::Read
@ Read
Definition: mmu.hh:56
gem5::maxThreadsPerCPU
int maxThreadsPerCPU
The maximum number of active threads across all cpus.
Definition: base.cc:86
gem5::SignalSinkPort::state
const State & state() const
Definition: signal.hh:73
gem5::BaseCPU::armMonitor
void armMonitor(ThreadID tid, Addr address)
Definition: base.cc:242
gem5::BaseCPU::ExecuteCPUStats::dcacheStallCycles
statistics::Scalar dcacheStallCycles
Definition: base.hh:734
gem5::BaseCPU::functionTraceStream
std::ostream * functionTraceStream
Definition: base.hh:589
gem5::NoFault
constexpr decltype(nullptr) NoFault
Definition: types.hh:253
gem5::ThreadContext::Active
@ Active
Running.
Definition: thread_context.hh:103
gem5::BaseCPU::switchedOut
bool switchedOut() const
Determine if the CPU is switched out.
Definition: base.hh:373
gem5::StaticInst::isMicroop
bool isMicroop() const
Definition: static_inst.hh:186
gem5::BaseCPU::interrupts
std::vector< BaseInterrupts * > interrupts
Definition: base.hh:224
gem5::BaseCPU::getInstPort
virtual Port & getInstPort()=0
Purely virtual method that returns a reference to the instruction port.
gem5::BaseCPU::scheduleInstStop
void scheduleInstStop(ThreadID tid, Counter insts, std::string cause)
Schedule an event that exits the simulation loops after a predefined number of instructions.
Definition: base.cc:742
gem5::cprintf
void cprintf(const char *format, const Args &...args)
Definition: cprintf.hh:155
gem5::BaseCPU::ExecuteCPUStats::numCCRegWrites
statistics::Scalar numCCRegWrites
Definition: base.hh:738
gem5::BaseCPU::mwaitAtomic
void mwaitAtomic(ThreadID tid, ThreadContext *tc, BaseMMU *mmu)
Definition: base.cc:277
system.hh
gem5::BaseCPU::ppSleeping
ProbePointArg< bool > * ppSleeping
ProbePoint that signals transitions of threadContexts sets.
Definition: base.hh:546
gem5::MipsISA::misc_reg::Count
@ Count
Definition: misc.hh:94
gem5::BaseCPU::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: base.cc:349
gem5::CheckerCPU::getMMUPtr
BaseMMU * getMMUPtr()
Definition: cpu.hh:152
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:575
gem5::BaseCPU::BaseCPUStats::BaseCPUStats
BaseCPUStats(statistics::Group *parent)
Definition: base.cc:408
gem5::RiscvISA::Unknown
Static instruction class for unknown (illegal) instructions.
Definition: unknown.hh:52
gem5::BaseCPU::enableFunctionTrace
void enableFunctionTrace()
Definition: base.cc:221
gem5::BaseCPU::ExecuteCPUStats::numMemRefs
statistics::Scalar numMemRefs
Definition: base.hh:755
gem5::StaticInst::isIndirectCtrl
bool isIndirectCtrl() const
Definition: static_inst.hh:164
gem5::BaseCPU::unserializeThread
virtual void unserializeThread(CheckpointIn &cp, ThreadID tid)
Unserialize one thread.
Definition: base.hh:437
gem5::CPUProgressEvent::process
void process()
Definition: base.cc:97
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
sim_events.hh
gem5::BaseCPU::ExecuteCPUStats::numFpRegReads
statistics::Scalar numFpRegReads
Definition: base.hh:744
gem5::BaseCPU::GlobalStats::hostOpRate
statistics::Formula hostOpRate
Definition: base.hh:157
gem5::BaseCPU::unserialize
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
Definition: base.cc:725
gem5::Packet::req
RequestPtr req
A pointer to the original request.
Definition: packet.hh:377
gem5::BaseCPU::ExecuteCPUStats::numStoreInsts
statistics::Formula numStoreInsts
Definition: base.hh:729
gem5::BaseCPU::ExecuteCPUStats::numMiscRegReads
statistics::Scalar numMiscRegReads
Definition: base.hh:758
gem5::BaseCPU::ppRetiredInsts
probing::PMUUPtr ppRetiredInsts
Instruction commit probe point.
Definition: base.hh:521
gem5::System::futexMap
FutexMap futexMap
Definition: system.hh:598
gem5::BaseCPU::pmuProbePoint
probing::PMUUPtr pmuProbePoint(const char *name)
Helper method to instantiate probe points belonging to this object.
Definition: base.cc:365
gem5::BaseCPU::cacheLineSize
unsigned int cacheLineSize() const
Get the cache line size of the system.
Definition: base.hh:397
gem5::ThreadContext::getMMUPtr
virtual BaseMMU * getMMUPtr()=0
gem5::StaticInst::isControl
bool isControl() const
Definition: static_inst.hh:160
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::ThreadContext::pcState
virtual const PCStateBase & pcState() const =0
gem5::AddressMonitor::AddressMonitor
AddressMonitor()
Definition: base.cc:756
gem5::AddressMonitor::doMonitor
bool doMonitor(PacketPtr pkt)
Definition: base.cc:764
gem5::MipsISA::event
Bitfield< 10, 5 > event
Definition: pra_constants.hh:300
gem5::BaseCPU::updateCycleCounters
void updateCycleCounters(CPUState state)
base method keeping track of cycle progression
Definition: base.hh:561
gem5::BaseCPU::GlobalStats
Global CPU statistics that are merged into the Root object.
Definition: base.hh:149
gem5::statistics::nozero
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:67
gem5::BaseCPU::BaseCPU
BaseCPU(const Params &params, bool is_checker=false)
Definition: base.cc:129
tlb.hh
gem5::BaseCPU::CommitCPUStats::cpi
statistics::Formula cpi
Definition: base.hh:789
gem5::BaseCPU::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: base.cc:310
gem5::BaseCPU::ExecuteCPUStats::numIntAluAccesses
statistics::Scalar numIntAluAccesses
Definition: base.hh:748
gem5::PowerState::get
enums::PwrState get() const
Definition: power_state.hh:84
gem5::simout
OutputDirectory simout
Definition: output.cc:62
gem5::statistics::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:401
gem5::StaticInst::isCondCtrl
bool isCondCtrl() const
Definition: static_inst.hh:165
gem5::ThreadContext::contextId
virtual ContextID contextId() const =0
gem5::BaseCPU::system
System * system
Definition: base.hh:392
gem5::BaseCPU::ExecuteCPUStats::ExecuteCPUStats
ExecuteCPUStats(statistics::Group *parent, int thread_id)
Definition: base.cc:901
gem5::BaseCPU::enterPwrGating
void enterPwrGating()
Definition: base.cc:582
gem5::X86ISA::system
Bitfield< 15 > system
Definition: misc.hh:1004
gem5::AddressMonitor::vAddr
Addr vAddr
Definition: base.hh:76
gem5::BaseCPU::cpuList
static std::vector< BaseCPU * > cpuList
Static global cpu list.
Definition: base.hh:597
gem5::BaseCPU::numSimulatedOps
static Counter numSimulatedOps()
Definition: base.hh:621
gem5::EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1012
std::vector
STL vector class.
Definition: stl.hh:37
gem5::System::registerThreadContext
void registerThreadContext(ThreadContext *tc)
Definition: system.cc:237
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
gem5::BaseCPU::CommitCPUStats::committedInstType
statistics::Vector committedInstType
Definition: base.hh:811
gem5::BaseCPU::previousCycle
Cycles previousCycle
Definition: base.hh:556
gem5::BaseCPU::getPid
uint32_t getPid() const
Definition: base.hh:215
gem5::Port::takeOverFrom
void takeOverFrom(Port *old)
A utility function to make it easier to swap out ports.
Definition: port.hh:137
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
gem5::BaseCPU::schedulePowerGatingEvent
void schedulePowerGatingEvent()
Definition: base.cc:502
sim_exit.hh
gem5::OutputDirectory::findOrCreate
OutputStream * findOrCreate(const std::string &name, bool binary=false)
Definition: output.cc:262
output.hh
gem5::BaseCPU::modelResetPort
SignalSinkPort< bool > modelResetPort
Definition: base.hh:166
gem5::ccprintf
void ccprintf(cp::Print &print)
Definition: cprintf.hh:130
gem5::BaseCPU::_taskId
uint32_t _taskId
An intrenal representation of a task identifier within gem5.
Definition: base.hh:136
gem5::statistics::dist
const FlagsType dist
Print the distribution.
Definition: info.hh:65
root.hh
gem5::RefCountingPtr< StaticInst >
gem5::BaseMMU
Definition: mmu.hh:53
gem5::mask
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
gem5::BaseCPU::ppAllCycles
probing::PMUUPtr ppAllCycles
CPU cycle counter even if any thread Context is suspended.
Definition: base.hh:533
gem5::AddressMonitor
Definition: base.hh:70
gem5::statistics::pdf
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:61
gem5::BaseCPU::numThreads
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
Definition: base.hh:384
gem5::BaseCPU::serializeThread
virtual void serializeThread(CheckpointOut &cp, ThreadID tid) const
Serialize a single thread.
Definition: base.hh:429
gem5::BaseCPU::_cpuId
int _cpuId
Definition: base.hh:116
gem5::BaseCPU::regStats
void regStats() override
Callback to set stat parameters.
Definition: base.cc:431
gem5::BaseCPU::ppRetiredInstsPC
probing::PMUUPtr ppRetiredInstsPC
Definition: base.hh:522
gem5::BaseCPU::wakeup
virtual void wakeup(ThreadID tid)=0
gem5::BaseCPU::getDataPort
virtual Port & getDataPort()=0
Purely virtual method that returns a reference to the data port.
gem5::BaseCPU::deschedulePowerGatingEvent
void deschedulePowerGatingEvent()
Definition: base.cc:494
gem5::BaseCPU::ExecuteCPUStats::numVecPredRegReads
statistics::Scalar numVecPredRegReads
Definition: base.hh:765
gem5::OutputStream::stream
std::ostream * stream() const
Get the output underlying output stream.
Definition: output.hh:62
gem5::StaticInst::isReturn
bool isReturn() const
Definition: static_inst.hh:162
gem5::CPUProgressEvent::description
virtual const char * description() const
Return a C string describing the event.
Definition: base.cc:124
gem5::BaseCPU::suspendContext
virtual void suspendContext(ThreadID thread_num)
Notify the CPU that the indicated context is now suspended.
Definition: base.cc:550
gem5::BaseCPU::CommitCPUStats::CommitCPUStats
CommitCPUStats(statistics::Group *parent, int thread_id)
Definition: base.cc:989
gem5::BaseCPU::registerThreadContexts
void registerThreadContexts()
Definition: base.cc:471
gem5::BaseCPU::ExecuteCPUStats::numIntRegWrites
statistics::Scalar numIntRegWrites
Definition: base.hh:752
decoder.hh
gem5::BaseCPU::FetchCPUStats::fetchRate
statistics::Formula fetchRate
Definition: base.hh:700
gem5::BaseCPU::taskId
uint32_t taskId() const
Get cpu task id.
Definition: base.hh:211
gem5::BaseCPU::GlobalStats::simInsts
statistics::Value simInsts
Definition: base.hh:153
gem5::BaseCPU::ppRetiredStores
probing::PMUUPtr ppRetiredStores
Retired store instructions.
Definition: base.hh:527
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
gem5::VegaISA::t
Bitfield< 51 > t
Definition: pagetable.hh:56
gem5::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::BaseCPU::flushTLBs
void flushTLBs()
Flush all TLBs in the CPU.
Definition: base.cc:690
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::probing::PMUUPtr
std::unique_ptr< PMU > PMUUPtr
Definition: pmu.hh:60
gem5::StaticInst::isAtomic
bool isAtomic() const
Definition: static_inst.hh:148
gem5::BaseCPU::pwrGatingLatency
const Cycles pwrGatingLatency
Definition: base.hh:683
gem5::BaseCPU::ExecuteCPUStats::numCCRegReads
statistics::Scalar numCCRegReads
Definition: base.hh:737
gem5::ThreadContext::Suspended
@ Suspended
Temporarily inactive.
Definition: thread_context.hh:107
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:210
gem5::Event
Definition: eventq.hh:254
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:75
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::BaseCPU::BaseCPUStats::numCycles
statistics::Scalar numCycles
Definition: base.hh:640
gem5::BaseCPU::CPU_STATE_WAKEUP
@ CPU_STATE_WAKEUP
Definition: base.hh:553
gem5::BaseCPU::ExecuteCPUStats::numIntRegReads
statistics::Scalar numIntRegReads
Definition: base.hh:751
gem5::BaseCPU::CommitCPUStats::committedControl
statistics::Vector committedControl
Definition: base.hh:814
gem5::BaseCPU::FetchCPUStats::FetchCPUStats
FetchCPUStats(statistics::Group *parent, int thread_id)
Definition: base.cc:866
gem5::BaseCPU::scheduleSimpointsInstStop
void scheduleSimpointsInstStop(std::vector< Counter > inst_starts)
Schedule simpoint events using the scheduleInstStop function.
Definition: base.cc:809
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::CheckerCPU
CheckerCPU class.
Definition: cpu.hh:84
gem5::BaseCPU::haltContext
virtual void haltContext(ThreadID thread_num)
Notify the CPU that the indicated context is now halted.
Definition: base.cc:576
gem5::BaseCPU::GlobalStats::hostInstRate
statistics::Formula hostInstRate
Definition: base.hh:156
cpu.hh
gem5::BaseCPU::functionEntryTick
Tick functionEntryTick
Definition: base.hh:592
gem5::BaseCPU::scheduleInstStopAnyThread
void scheduleInstStopAnyThread(Counter max_insts)
Schedule an exit event when any threads in the core reach the max_insts instructions using the schedu...
Definition: base.cc:818
gem5::RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:92
gem5::BaseCPU::BaseCPUStats::ipc
statistics::Formula ipc
Definition: base.hh:643
process.hh
gem5::BaseCPU::regProbePoints
void regProbePoints() override
Register probe points for this object.
Definition: base.cc:374
gem5::BaseISA::setThreadContext
virtual void setThreadContext(ThreadContext *_tc)
Definition: isa.hh:82
gem5::BaseCPU::CommitCPUStats::ipc
statistics::Formula ipc
Definition: base.hh:790
gem5::BaseCPU::serialize
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
Definition: base.cc:704
gem5::loader::SymbolTable::findNearest
const_iterator findNearest(Addr addr, Addr &next_addr) const
Find the nearest symbol equal to or less than the supplied address (e.g., the label for the enclosing...
Definition: symtab.hh:360
gem5::StaticInst::isLoad
bool isLoad() const
Definition: static_inst.hh:146
gem5::BaseCPU::previousState
CPUState previousState
Definition: base.hh:557
gem5::StaticInst::isStore
bool isStore() const
Definition: static_inst.hh:147
gem5::BaseCPU::setReset
virtual void setReset(bool state)
Set the reset of the CPU to be either asserted or deasserted.
Definition: base.cc:668
gem5::BaseCPU
Definition: base.hh:104
gem5::Port::isConnected
bool isConnected() const
Is this port currently connected to a peer?
Definition: port.hh:133
gem5::BaseCPU::totalOps
virtual Counter totalOps() const =0
gem5::BaseCPU::findContext
int findContext(ThreadContext *tc)
Given a Thread Context pointer return the thread num.
Definition: base.cc:519
cprintf.hh
gem5::statistics::ValueBase::functor
Derived & functor(const T &func)
Definition: statistics.hh:740
gem5::ThreadContext::takeOverFrom
virtual void takeOverFrom(ThreadContext *old_context)=0
gem5::roundDown
static constexpr T roundDown(const T &val, const U &align)
This function is used to align addresses in memory.
Definition: intmath.hh:279
gem5::BaseCPU::numSimulatedInsts
static Counter numSimulatedInsts()
Definition: base.hh:609
gem5::StaticInst::isDirectCtrl
bool isDirectCtrl() const
Definition: static_inst.hh:163
gem5::BaseCPU::functionTracingEnabled
bool functionTracingEnabled
Definition: base.hh:588
gem5::BaseCPU::~BaseCPU
virtual ~BaseCPU()
Definition: base.cc:226
gem5::statistics::DataWrap::precision
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
Definition: statistics.hh:345
gem5::BaseCPU::postInterrupt
void postInterrupt(ThreadID tid, int int_num, int index)
Definition: base.cc:231
gem5::CountedExitEvent
Definition: sim_events.hh:107
gem5::BaseCPU::enterPwrGatingEvent
EventFunctionWrapper enterPwrGatingEvent
Definition: base.hh:685
gem5::BaseCPU::probeInstCommit
virtual void probeInstCommit(const StaticInstPtr &inst, Addr pc)
Helper method to trigger PMU probes for a committed instruction.
Definition: base.cc:390
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::AddressMonitor::gotWakeup
bool gotWakeup
Definition: base.hh:80
name
const std::string & name()
Definition: trace.cc:48
gem5::StaticInst::isLastMicroop
bool isLastMicroop() const
Definition: static_inst.hh:188
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:568
gem5::statistics::Group::regStats
virtual void regStats()
Callback to set stat parameters.
Definition: group.cc:68
gem5::BaseCPU::instCnt
Tick instCnt
Instruction count used for SPARC misc register.
Definition: base.hh:110
gem5::BaseCPU::ExecuteCPUStats::numVecPredRegWrites
statistics::Scalar numVecPredRegWrites
Definition: base.hh:766
gem5::BaseCPU::GlobalStats::GlobalStats
GlobalStats(statistics::Group *parent)
Definition: base.cc:826
gem5::FutexMap::is_waiting
bool is_waiting(ThreadContext *tc)
Determine if the given thread context is currently waiting on a futex wait operation on any of the fu...
Definition: futex_map.cc:185
gem5::CPUProgressEvent::_repeatEvent
bool _repeatEvent
Definition: base.hh:89
gem5::ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:234
gem5::BaseCPU::_switchedOut
bool _switchedOut
Is the CPU switched out or active?
Definition: base.hh:143
gem5::Clocked::clockEdge
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Definition: clocked_object.hh:177
gem5::ClockedObject::powerState
PowerState * powerState
Definition: clocked_object.hh:245
gem5::LocalSimLoopExitEvent
Definition: sim_events.hh:79
gem5::EventManager::deschedule
void deschedule(Event &event)
Definition: eventq.hh:1021
full_system.hh
gem5::BaseCPU::ExecuteCPUStats::numLoadInsts
statistics::Scalar numLoadInsts
Definition: base.hh:727
gem5::BaseCPU::CPU_STATE_SLEEP
@ CPU_STATE_SLEEP
Definition: base.hh:552
gem5::ProbePointArg
ProbePointArg generates a point for the class of Arg.
Definition: thermal_domain.hh:54
gem5::BaseCPU::currentFunctionEnd
Addr currentFunctionEnd
Definition: base.hh:591
gem5::ThreadContext::getProcessPtr
virtual Process * getProcessPtr()=0
gem5::System::multiThread
const bool multiThread
Definition: system.hh:312
gem5::FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:220
gem5::SimObject::getProbeManager
ProbeManager * getProbeManager()
Get the probe manager for this object.
Definition: sim_object.cc:117
isa.hh
stat_control.hh
state
atomic_var_t state
Definition: helpers.cc:188
gem5::BaseCPU::threadContexts
std::vector< ThreadContext * > threadContexts
Definition: base.hh:260
gem5::BaseCPU::takeOverFrom
virtual void takeOverFrom(BaseCPU *cpu)
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be sw...
Definition: base.cc:602
gem5::BaseCPU::activateContext
virtual void activateContext(ThreadID thread_num)
Notify the CPU that the indicated context is now active.
Definition: base.cc:530
base.hh
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::statistics::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:371
gem5::BaseCPU::ExecuteCPUStats::numMiscRegWrites
statistics::Scalar numMiscRegWrites
Definition: base.hh:759
gem5::BaseCPU::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port on this CPU.
Definition: base.cc:455
gem5::BaseCPU::cpuId
int cpuId() const
Reads this CPU's ID.
Definition: base.hh:187
clocked_object.hh
gem5::BaseCPU::BaseCPUStats::numInsts
statistics::Scalar numInsts
Definition: base.hh:637
gem5::BaseCPU::verifyMemoryMode
virtual void verifyMemoryMode() const
Verify that the system is in a memory mode supported by the CPU.
Definition: base.hh:384
gem5::BaseCPU::ppRetiredLoads
probing::PMUUPtr ppRetiredLoads
Retired load instructions.
Definition: base.hh:525
gem5::MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:243
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:46
gem5::BaseCPU::traceFunctionsInternal
void traceFunctionsInternal(Addr pc)
Definition: base.cc:780
gem5::BaseCPU::switchOut
virtual void switchOut()
Prepare for another CPU to take over execution.
Definition: base.cc:588
gem5::BaseMMU::flushAll
virtual void flushAll()
Definition: mmu.cc:81
logging.hh
gem5::statistics::Group
Statistics container.
Definition: group.hh:92
gem5::StaticInst::isCall
bool isCall() const
Definition: static_inst.hh:161
gem5::BaseCPU::GlobalStats::simOps
statistics::Value simOps
Definition: base.hh:154
gem5::BaseCPU::getCurrentInstCount
uint64_t getCurrentInstCount(ThreadID tid)
Get the number of instructions executed by the specified thread on this CPU.
Definition: base.cc:751
gem5::BaseCPU::ExecuteCPUStats::numFpAluAccesses
statistics::Scalar numFpAluAccesses
Definition: base.hh:741
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::System::replaceThreadContext
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
Definition: system.cc:268
gem5::AddressMonitor::pAddr
Addr pAddr
Definition: base.hh:77
gem5::Num_OpClasses
static const OpClass Num_OpClasses
Definition: op_class.hh:137
gem5::ThreadContext::threadId
virtual int threadId() const =0
gem5::BaseCPU::dataRequestorId
RequestorID dataRequestorId() const
Reads this CPU's unique data requestor ID.
Definition: base.hh:193
trace.hh
gem5::BaseCPU::ExecuteCPUStats::numVecRegWrites
statistics::Scalar numVecRegWrites
Definition: base.hh:770
symtab.hh
gem5::ClockedObject::Params
ClockedObjectParams Params
Parameters of ClockedObject.
Definition: clocked_object.hh:240
gem5::StaticInst::isUncondCtrl
bool isUncondCtrl() const
Definition: static_inst.hh:166
DPRINTFN
#define DPRINTFN(...)
Definition: trace.hh:238
gem5::AddressMonitor::waiting
bool waiting
Definition: base.hh:79
gem5::statistics::DataWrap::flags
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:357
gem5::BaseCPU::mwait
bool mwait(ThreadID tid, PacketPtr pkt)
Definition: base.cc:254
gem5::loader::debugSymbolTable
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
Definition: symtab.cc:43
gem5::ThreadContext::getIsaPtr
virtual BaseISA * getIsaPtr() const =0
gem5::BaseCPU::ppActiveCycles
probing::PMUUPtr ppActiveCycles
CPU cycle counter, only counts if any thread contexts is active.
Definition: base.hh:536
gem5::CPUProgressEvent::cpu
BaseCPU * cpu
Definition: base.hh:88
gem5::Packet::getAddr
Addr getAddr() const
Definition: packet.hh:807
gem5::RiscvISA::OFF
@ OFF
Definition: isa.hh:64
gem5::BaseMMU::translateAtomic
virtual Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode)
Definition: mmu.cc:104
fatal_if
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition: logging.hh:236
page_table.hh
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::statistics::total
const FlagsType total
Print the total.
Definition: info.hh:59
gem5::statistics::VectorBase::init
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1039
gem5::PowerState::set
void set(enums::PwrState p)
Change the power state of this object to the power state p.
Definition: power_state.cc:96
gem5::hostSeconds
statistics::Value & hostSeconds
Definition: stats.cc:48
gem5::BaseCPU::FetchCPUStats::icacheStallCycles
statistics::Scalar icacheStallCycles
Definition: base.hh:709
gem5::BaseMMU::takeOverFrom
virtual void takeOverFrom(BaseMMU *old_mmu)
Definition: mmu.cc:157
gem5::Serializable::ScopedCheckpointSection
Definition: serialize.hh:172
gem5::BaseCPU::ppRetiredBranches
probing::PMUUPtr ppRetiredBranches
Retired branches (any type)
Definition: base.hh:530
gem5::CPUProgressEvent
Definition: base.hh:83
gem5::ThreadContext::getCheckerCpuPtr
virtual CheckerCPU * getCheckerCpuPtr()=0
gem5::BaseCPU::_pid
uint32_t _pid
The current OS process ID that is executing on this processor.
Definition: base.hh:140
thread_context.hh
gem5::Root::root
static Root * root()
Use this function to get a pointer to the single Root object in the simulation.
Definition: root.hh:93
gem5::AddressMonitor::armed
bool armed
Definition: base.hh:75
gem5::BaseCPU::powerGatingOnIdle
const bool powerGatingOnIdle
Definition: base.hh:684
gem5::BaseCPU::globalStats
static std::unique_ptr< GlobalStats > globalStats
Pointer to the global stat structure.
Definition: base.hh:164
gem5::BaseCPU::CommitCPUStats::updateComCtrlStats
void updateComCtrlStats(const StaticInstPtr staticInst)
Definition: base.cc:1048
gem5::Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:458
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:235
gem5::BaseCPU::addressMonitor
std::vector< AddressMonitor > addressMonitor
Definition: base.hh:649
gem5::Clocked::clockPeriod
Tick clockPeriod() const
Definition: clocked_object.hh:217
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::CPUProgressEvent::_interval
Tick _interval
Definition: base.hh:86
gem5::BaseCPU::FetchCPUStats::branchRate
statistics::Formula branchRate
Definition: base.hh:706

Generated on Sun Jul 30 2023 01:56:52 for gem5 by doxygen 1.8.17