Go to the documentation of this file.
45 #include "config/the_isa.hh"
54 #include "debug/Activity.hh"
55 #include "debug/Drain.hh"
56 #include "debug/O3CPU.hh"
57 #include "debug/Quiesce.hh"
58 #include "enums/MemoryMode.hh"
76 tickEvent([this]{
tick(); },
"O3CPU tick",
78 threadExitEvent([
this]{ exitThreads(); },
"O3CPU exit threads",
83 removeInstsThisCycle(
false),
92 vecMode(params.isa[0]->initVecRegRenameMode()),
93 regFile(params.numPhysIntRegs,
94 params.numPhysFloatRegs,
95 params.numPhysVecRegs,
96 params.numPhysVecPredRegs,
98 params.isa[0]->regClasses(),
101 freeList(
name() +
".freelist", ®File),
105 scoreboard(
name() +
".scoreboard", regFile.totalNumPhysRegs(),
106 params.isa[0]->regClasses().at(
IntRegClass).zeroReg()),
108 isa(numThreads, NULL),
110 timeBuffer(params.backComSize, params.forwardComSize),
111 fetchQueue(params.backComSize, params.forwardComSize),
112 decodeQueue(params.backComSize, params.forwardComSize),
113 renameQueue(params.backComSize, params.forwardComSize),
114 iewQueue(params.backComSize, params.forwardComSize),
115 activityRec(
name(), NumStages,
116 params.backComSize + params.forwardComSize,
121 lastRunningCycle(curCycle()),
125 "SMT is not supported in O3 in full system mode currently.");
128 "More workload items (%d) than threads (%d) on CPU %s.",
129 params.workload.size(), params.numThreads,
name());
131 if (!params.switched_out) {
134 _status = SwitchedOut;
137 if (params.checker) {
138 BaseCPU *temp_checker = params.checker;
139 checker =
dynamic_cast<Checker<DynInstPtr> *
>(temp_checker);
140 checker->setIcachePort(&fetch.getInstPort());
141 checker->setSystem(params.system);
147 thread.resize(numThreads);
148 tids.resize(numThreads);
156 fetch.setActiveThreads(&activeThreads);
157 decode.setActiveThreads(&activeThreads);
158 rename.setActiveThreads(&activeThreads);
159 iew.setActiveThreads(&activeThreads);
160 commit.setActiveThreads(&activeThreads);
163 fetch.setTimeBuffer(&timeBuffer);
164 decode.setTimeBuffer(&timeBuffer);
165 rename.setTimeBuffer(&timeBuffer);
166 iew.setTimeBuffer(&timeBuffer);
167 commit.setTimeBuffer(&timeBuffer);
170 fetch.setFetchQueue(&fetchQueue);
171 decode.setFetchQueue(&fetchQueue);
172 commit.setFetchQueue(&fetchQueue);
173 decode.setDecodeQueue(&decodeQueue);
174 rename.setDecodeQueue(&decodeQueue);
175 rename.setRenameQueue(&renameQueue);
176 iew.setRenameQueue(&renameQueue);
177 iew.setIEWQueue(&iewQueue);
178 commit.setIEWQueue(&iewQueue);
179 commit.setRenameQueue(&renameQueue);
181 commit.setIEWStage(&iew);
182 rename.setIEWStage(&iew);
183 rename.setCommitStage(&commit);
189 active_threads = params.workload.size();
192 panic(
"Workload Size too large. Increase the 'MaxThreads' "
193 "constant in cpu/o3/limits.hh or edit your workload size.");
199 const auto ®Classes = params.isa[0]->regClasses();
201 assert(params.numPhysIntRegs >=
203 assert(params.numPhysFloatRegs >=
205 assert(params.numPhysVecRegs >=
207 assert(params.numPhysVecPredRegs >=
209 assert(params.numPhysCCRegs >=
210 numThreads * regClasses.at(
CCRegClass).size());
215 "Non-zero number of physical CC regs specified, even though\n"
216 " ISA does not use them.");
218 rename.setScoreboard(&scoreboard);
219 iew.setScoreboard(&scoreboard);
222 for (
ThreadID tid = 0; tid < numThreads; tid++) {
223 isa[tid] =
dynamic_cast<TheISA::ISA *
>(params.isa[tid]);
225 assert(isa[tid]->initVecRegRenameMode() ==
226 isa[0]->initVecRegRenameMode());
228 commitRenameMap[tid].init(regClasses, ®File, &freeList, vecMode);
229 renameMap[tid].init(regClasses, ®File, &freeList, vecMode);
234 for (
ThreadID tid = 0; tid < active_threads; tid++) {
240 renameMap[tid].setEntry(RegId(
IntRegClass, ridx), phys_reg);
241 commitRenameMap[tid].setEntry(RegId(
IntRegClass, ridx), phys_reg);
247 renameMap[tid].setEntry(RegId(
FloatRegClass, ridx), phys_reg);
248 commitRenameMap[tid].setEntry(
255 const size_t numVecs = regClasses.at(
VecRegClass).size();
256 if (vecMode == enums::Full) {
258 for (
RegIndex ridx = 0; ridx < numVecs; ++ridx) {
261 renameMap[tid].setEntry(rid, phys_reg);
262 commitRenameMap[tid].setEntry(rid, phys_reg);
266 const size_t numElems = regClasses.at(
VecElemClass).size();
267 const size_t elemsPerVec = numElems / numVecs;
268 for (
RegIndex ridx = 0; ridx < numVecs; ++ridx) {
269 for (
ElemIndex ldx = 0; ldx < elemsPerVec; ++ldx) {
272 renameMap[tid].setEntry(lrid, phys_elem);
273 commitRenameMap[tid].setEntry(lrid, phys_elem);
282 commitRenameMap[tid].setEntry(
289 renameMap[tid].setEntry(RegId(
CCRegClass, ridx), phys_reg);
290 commitRenameMap[tid].setEntry(RegId(
CCRegClass, ridx), phys_reg);
294 rename.setRenameMap(renameMap);
295 commit.setRenameMap(commitRenameMap);
296 rename.setFreeList(&freeList);
301 lastActivatedCycle = 0;
303 DPRINTF(O3CPU,
"Creating O3CPU object.\n");
306 thread.resize(numThreads);
308 for (
ThreadID tid = 0; tid < numThreads; ++tid) {
311 assert(numThreads == 1);
312 thread[tid] =
new ThreadState(
this, 0, NULL);
314 if (tid < params.workload.size()) {
315 DPRINTF(O3CPU,
"Workload[%i] process is %#x", tid,
317 thread[tid] =
new ThreadState(
this, tid, params.workload[tid]);
321 Process* dummy_proc = NULL;
323 thread[tid] =
new ThreadState(
this, tid, dummy_proc);
330 auto *o3_tc =
new ThreadContext;
336 if (params.checker) {
337 tc =
new CheckerThreadContext<ThreadContext>(o3_tc, checker);
341 o3_tc->thread = thread[tid];
344 thread[tid]->tc = tc;
347 threadContexts.push_back(tc);
351 if (!params.switched_out && interrupts.empty()) {
352 fatal(
"O3CPU %s has no interrupt controller.\n"
353 "Ensure createInterruptController() is called.\n",
name());
375 : statistics::
Group(cpu),
376 ADD_STAT(timesIdled, statistics::units::Count::get(),
377 "Number of times that the entire CPU went into an idle state "
378 "and unscheduled itself"),
379 ADD_STAT(idleCycles, statistics::units::Cycle::get(),
380 "Total number of cycles that the CPU has spent unscheduled due "
383 "Total number of cycles that CPU has spent quiesced or waiting "
385 ADD_STAT(committedInsts, statistics::units::Count::get(),
386 "Number of Instructions Simulated"),
387 ADD_STAT(committedOps, statistics::units::Count::get(),
388 "Number of Ops (including micro ops) Simulated"),
389 ADD_STAT(cpi, statistics::units::Rate<
390 statistics::units::Cycle, statistics::units::Count>::get(),
391 "CPI: Cycles Per Instruction"),
392 ADD_STAT(totalCpi, statistics::units::Rate<
393 statistics::units::Cycle, statistics::units::Count>::get(),
394 "CPI: Total CPI of All Threads"),
395 ADD_STAT(ipc, statistics::units::Rate<
396 statistics::units::Count, statistics::units::Cycle>::get(),
397 "IPC: Instructions Per Cycle"),
398 ADD_STAT(totalIpc, statistics::units::Rate<
399 statistics::units::Count, statistics::units::Cycle>::get(),
400 "IPC: Total IPC of All Threads"),
401 ADD_STAT(intRegfileReads, statistics::units::Count::get(),
402 "Number of integer regfile reads"),
403 ADD_STAT(intRegfileWrites, statistics::units::Count::get(),
404 "Number of integer regfile writes"),
405 ADD_STAT(fpRegfileReads, statistics::units::Count::get(),
406 "Number of floating regfile reads"),
407 ADD_STAT(fpRegfileWrites, statistics::units::Count::get(),
408 "Number of floating regfile writes"),
409 ADD_STAT(vecRegfileReads, statistics::units::Count::get(),
410 "number of vector regfile reads"),
411 ADD_STAT(vecRegfileWrites, statistics::units::Count::get(),
412 "number of vector regfile writes"),
413 ADD_STAT(vecPredRegfileReads, statistics::units::Count::get(),
414 "number of predicate regfile reads"),
415 ADD_STAT(vecPredRegfileWrites, statistics::units::Count::get(),
416 "number of predicate regfile writes"),
417 ADD_STAT(ccRegfileReads, statistics::units::Count::get(),
418 "number of cc regfile reads"),
419 ADD_STAT(ccRegfileWrites, statistics::units::Count::get(),
420 "number of cc regfile writes"),
421 ADD_STAT(miscRegfileReads, statistics::units::Count::get(),
422 "number of misc regfile reads"),
423 ADD_STAT(miscRegfileWrites, statistics::units::Count::get(),
424 "number of misc regfile writes")
504 DPRINTF(O3CPU,
"\n\nO3CPU: Ticking main, O3CPU.\n");
540 DPRINTF(O3CPU,
"Switched out!\n");
549 DPRINTF(O3CPU,
"Scheduling next tick!\n");
567 thread[tid]->noSquashFromTC =
true;
574 thread[tid]->noSquashFromTC =
false;
597 DPRINTF(O3CPU,
"[tid:%i] Calling activate thread.\n", tid);
601 DPRINTF(O3CPU,
"[tid:%i] Adding to active threads list\n", tid);
618 DPRINTF(O3CPU,
"[tid:%i] Calling deactivate thread.\n", tid);
622 DPRINTF(O3CPU,
"[tid:%i] Removing from active threads list\n",
696 DPRINTF(O3CPU,
"[tid:%i] Suspending Thread Context.\n", tid);
708 DPRINTF(Quiesce,
"Suspending Context\n");
717 DPRINTF(O3CPU,
"[tid:%i] Halt Context called. Deallocating\n", tid);
738 DPRINTF(O3CPU,
"[tid:%i] Initializing thread into CPU");
748 const auto ®Classes =
isa[tid]->regClasses();
787 DPRINTF(O3CPU,
"[tid:%i] Removing thread context from CPU.\n", tid);
839 const auto ®Classes =
isa[tid]->regClasses();
841 const size_t numVecs = regClasses.at(
VecRegClass).size();
843 const size_t numElems = regClasses.at(
VecElemClass).size();
844 const size_t elemsPerVec = numElems / numVecs;
845 for (
auto v = 0;
v < numVecs;
v++) {
846 for (
auto e = 0;
e < elemsPerVec;
e++) {
851 }
else if (
vecMode == enums::Full) {
852 for (
auto v = 0;
v < numVecs;
v++) {
865 auto new_mode =
isa[tid]->vecRegRenameMode(
thread[tid]->getTC());
897 DPRINTF(O3CPU,
"Interrupt %s being handled\n", interrupt->name());
898 trap(interrupt, 0,
nullptr);
911 thread[tid]->serialize(cp);
917 thread[tid]->unserialize(cp);
930 DPRINTF(Drain,
"Draining...\n");
946 DPRINTF(Drain,
"Currently suspended so activate %i \n",
957 DPRINTF(Drain,
"CPU not drained\n");
961 DPRINTF(Drain,
"CPU is already drained\n");
991 DPRINTF(Drain,
"CPU done draining, processing drain event\n");
1014 DPRINTF(Drain,
"Main CPU structures not drained.\n");
1019 DPRINTF(Drain,
"Fetch not drained.\n");
1024 DPRINTF(Drain,
"Decode not drained.\n");
1029 DPRINTF(Drain,
"Rename not drained.\n");
1034 DPRINTF(Drain,
"IEW not drained.\n");
1039 DPRINTF(Drain,
"Commit not drained.\n");
1054 DPRINTF(Drain,
"Resuming...\n");
1063 DPRINTF(Drain,
"Activating thread: %i\n",
i);
1080 DPRINTF(O3CPU,
"Switching out\n");
1104 auto *oldO3CPU =
dynamic_cast<CPU *
>(oldCPU);
1116 fatal(
"The O3 CPU requires the memory system to be in "
1117 "'timing' mode.\n");
1124 return isa[tid]->readMiscRegNoEffect(misc_reg);
1131 return isa[tid]->readMiscReg(misc_reg);
1137 isa[tid]->setMiscRegNoEffect(misc_reg,
val);
1144 isa[tid]->setMiscReg(misc_reg,
val);
1407 thread[tid]->noSquashFromTC =
true;
1423 if (!inst->isMicroop() || inst->isLastMicroop()) {
1425 thread[tid]->threadStats.numInsts++;
1429 thread[tid]->comInstEventQueue.serviceEvents(
thread[tid]->numInst);
1432 thread[tid]->threadStats.numOps++;
1441 DPRINTF(O3CPU,
"Removing committed instruction [tid:%i] PC %s "
1443 inst->threadNumber, inst->pcState(), inst->seqNum);
1454 DPRINTF(O3CPU,
"Thread %i: Deleting instructions from instruction"
1459 bool rob_empty =
false;
1464 DPRINTF(O3CPU,
"ROB is empty, squashing all insts.\n");
1469 DPRINTF(O3CPU,
"ROB is not empty, squashing insts not in ROB.\n");
1480 while (inst_it != end_it) {
1506 DPRINTF(O3CPU,
"Deleting instructions from instruction "
1507 "list that are from [tid:%i] and above [sn:%lli] (end=%lli).\n",
1508 tid, seq_num, (*inst_iter)->seqNum);
1510 while ((*inst_iter)->seqNum > seq_num) {
1512 bool break_loop = (inst_iter ==
instList.begin());
1526 if ((*instIt)->threadNumber == tid) {
1527 DPRINTF(O3CPU,
"Squashing instruction, "
1528 "[tid:%i] [sn:%lli] PC %s\n",
1529 (*instIt)->threadNumber,
1531 (*instIt)->pcState());
1534 (*instIt)->setSquashed();
1547 DPRINTF(O3CPU,
"Removing instruction, "
1548 "[tid:%i] [sn:%lli] PC %s\n",
1574 cprintf(
"Dumping Instruction List\n");
1576 while (inst_list_it !=
instList.end()) {
1577 cprintf(
"Instruction:%i\nPC:%#x\n[tid:%i]\n[sn:%lli]\nIssued:%i\n"
1579 num, (*inst_list_it)->instAddr(), (*inst_list_it)->threadNumber,
1580 (*inst_list_it)->seqNum, (*inst_list_it)->isIssued(),
1581 (*inst_list_it)->isSquashed());
1597 DPRINTF(Activity,
"CPU already running.\n");
1601 DPRINTF(Activity,
"Waking up CPU\n");
1622 DPRINTF(Quiesce,
"Suspended Processor woken\n");
1647 unsigned high_thread = *list_begin;
1658 DPRINTF(O3CPU,
"Thread %d is inserted to exitingThreads list\n", tid);
1710 bool readyToExit = it->second;
1713 DPRINTF(O3CPU,
"Exiting thread %d\n", thread_id);
1741 req->setContext(
thread[tid]->contextId());
1742 req->setHtmAbortCause(cause);
1744 assert(req->isHTMAbort());
1747 uint8_t *memData =
new uint8_t[8];
1754 panic(
"HTM abort signal was not sent to the memory subsystem.");
bool isDrained() const
Has the stage drained?
enums::VecRegRenameMode vecMode
The rename mode of the vector registers.
Tick curTick()
The universal simulation clock.
void setArchIntReg(int reg_idx, RegVal val, ThreadID tid)
Architectural register accessors.
void switchMode(VecMode newVecMode)
Set vector mode to Full or Elem.
#define fatal(...)
This implements a cprintf based fatal() function.
void setCCReg(PhysRegIdPtr phys_reg, RegVal val)
Sets a condition-code register to the given value.
void addThreadToExitingList(ThreadID tid)
Insert tid to the list of threads trying to exit.
@ VecElemClass
Vector Register Native Elem lane.
TheISA::VecRegContainer & getWritableVecReg(PhysRegIdPtr phys_reg)
Reads a vector register for modification.
void takeOverFrom()
Takes over from another CPU's thread.
void dumpInsts()
Debug function to print all instructions on the list.
ProbePointArg< std::pair< DynInstPtr, PacketPtr > > * ppDataAccessComplete
@ CCRegClass
Condition-code register.
const TheISA::VecElem & readVecElem(PhysRegIdPtr reg_idx) const
bool isCpuDrained() const
Check if a system is in a drained state.
std::vector< ThreadID > tids
Available thread ids in the cpu.
void setArchVecElem(const RegIndex ®_idx, const ElemIndex &ldx, const TheISA::VecElem &val, ThreadID tid)
statistics::Scalar miscRegfileWrites
constexpr decltype(nullptr) NoFault
bool switchedOut() const
Determine if the CPU is switched out.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
std::queue< ListIt > removeList
List of all the instructions that will be removed at the end of this cycle.
void tick()
Ticks rename, which processes all input signals and attempts to rename as many instructions as possib...
void setVecElem(PhysRegIdPtr reg_idx, const TheISA::VecElem &val)
std::vector< BaseInterrupts * > interrupts
void regProbePoints()
Registers probes.
void drainSanityCheck() const
Perform sanity checks after a drain.
statistics::Scalar fpRegfileWrites
RegVal readCCReg(PhysRegIdPtr phys_reg)
bool removeInstsThisCycle
Records if instructions need to be removed this cycle due to being retired or squashed.
const TheISA::VecRegContainer & readVecReg(PhysRegIdPtr phys_reg) const
Reads a vector register.
std::list< DynInstPtr >::iterator ListIt
gem5::o3::CPU::CPUStats cpuStats
@ STRICT_ORDER
The request is required to be strictly ordered by CPU models and is non-speculative.
void cprintf(const char *format, const Args &...args)
InstSeqNum globalSeqNum
The global sequence number counter.
void removeInstsUntil(const InstSeqNum &seq_num, ThreadID tid)
Remove all instructions younger than the given sequence number.
DynInstPtr readTailInst(ThreadID tid)
Returns pointer to the tail instruction within the ROB.
VecPredReg::Container VecPredRegContainer
CPU(const O3CPUParams ¶ms)
Constructs a CPU with the given parameters.
void drain()
Initializes the draining of commit.
const TheISA::VecElem & readVecElem(PhysRegIdPtr phys_reg) const
Reads a vector element.
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
@ Halted
Permanently shut down.
void startup() override
startup() is the final initialization call before simulation.
void setVecPredReg(PhysRegIdPtr phys_reg, const TheISA::VecPredRegContainer &val)
Sets a predicate register to the given value.
PhysRegFile regFile
The register file.
DrainState drainState() const
Return the current drain state of an object.
RegVal readFloatReg(PhysRegIdPtr phys_reg) const
int getCount()
Returns the number of instructions in all of the queues.
Decode decode
The decode stage.
statistics::Scalar ccRegfileWrites
std::list< ThreadID > activeThreads
Active Threads List.
void setThreads(std::vector< ThreadState * > &threads)
Sets the list of threads.
@ HTM_ABORT
The request aborts a HTM transaction.
UnifiedFreeList freeList
The free list.
RegVal readIntReg(PhysRegIdPtr phys_reg) const
Reads an integer register.
void processInterrupts(const Fault &interrupt)
Processes any an interrupt fault.
void clearStates(ThreadID tid)
Clear all thread-specific states.
void drainStall(ThreadID tid)
Stall the fetch stage after reaching a safe drain point.
RegVal readArchFloatReg(int reg_idx, ThreadID tid)
statistics::Scalar quiesceCycles
Stat for total number of cycles the CPU spends descheduled due to a quiesce operation or waiting for ...
Fault getInterrupts()
Returns the Fault for any valid interrupt.
void squashInstIt(const ListIt &instIt, ThreadID tid)
Removes the instruction pointed to by the iterator.
void updateCycleCounters(CPUState state)
base method keeping track of cycle progression
void wakeFromQuiesce()
Tells fetch to wake up from a quiesce instruction.
@ FloatRegClass
Floating-point register.
void takeOverFrom()
Takes over from another CPU's thread.
RegVal readArchCCReg(int reg_idx, ThreadID tid)
statistics::Scalar miscRegfileReads
void startupStage()
Initializes stage by sending back the number of free entries.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
statistics::Scalar intRegfileReads
void clearStates(ThreadID tid)
Clear all thread-specific states.
Status _status
Overall CPU status.
void setHtmTransactional(uint64_t val)
Stipulates that this packet/request originates in the CPU executing in transactional mode,...
TimeBuffer< TimeStruct > timeBuffer
The main time buffer to do backwards communication.
virtual void setStatus(Status new_status)=0
void advance()
Advances the activity buffer, decrementing the activityCount if active communication just left the ti...
void removeThread(ThreadID tid)
Remove all of a thread's context from CPU.
@ PHYSICAL
The virtual address is also the physical address.
FreeList class that simply holds the list of free integer and floating point registers.
void htmSendAbortSignal(ThreadID tid, uint64_t htm_uid, HtmFailureFaultCause cause)
void setVecReg(PhysRegIdPtr reg_idx, const TheISA::VecRegContainer &val)
void schedule(Event &event, Tick when)
void setMiscReg(int misc_reg, RegVal val, ThreadID tid)
Sets a misc.
statistics::Formula totalIpc
Stat for the total IPC.
TheISA::VecPredRegContainer & getWritableVecPredReg(PhysRegIdPtr reg_idx)
UnifiedRenameMap renameMap[MaxThreads]
The rename map.
void clearStates(ThreadID tid)
Clear all thread-specific states.
std::list< DynInstPtr > instList
List of all the instructions in flight.
TheISA::VecPredRegContainer & getWritableVecPredReg(PhysRegIdPtr phys_reg)
bool isDrained() const
Has the stage drained?
void verifyMemoryMode() const override
Verify that the system is in a memory mode supported by the CPU.
void deactivateThread(ThreadID tid)
Remove Thread from Active Threads List.
statistics::Scalar intRegfileWrites
void unserializeThread(CheckpointIn &cp, ThreadID tid) override
Unserialize one thread.
static const Priority CPU_Exit_Pri
If we want to exit a thread in a CPU, it comes after CPU_Tick_Pri.
void schedulePowerGatingEvent()
RegVal readFloatReg(PhysRegIdPtr phys_reg)
statistics::Formula cpi
Stat for the CPI per thread.
void drainSanityCheck() const
Perform sanity checks after a drain.
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
void cleanUpRemovedInsts()
Cleans up all instructions on the remove list.
void deactivateThread(ThreadID tid)
Deschedules a thread from scheduling.
void resetEntries()
Re-adjust ROB partitioning.
TimeBuffer< IEWStruct > iewQueue
The IEW stage's instruction queue.
ProbePointArg< PacketPtr > * ppInstAccessComplete
void startupStage()
Initializes stage; sends back the number of free IQ and LSQ entries.
void setVecElem(PhysRegIdPtr phys_reg, const TheISA::VecElem val)
Sets a vector register to the given value.
void resetHtmStartsStops(ThreadID tid)
gem5::Checker< DynInstPtr > * checker
Pointer to the checker, which can dynamically verify instruction results at run time.
void unscheduleTickEvent()
Unschedule tick event, regardless of its current state.
Cycles is a wrapper class for representing cycle counts, i.e.
Counter totalInsts() const override
Count the Total Instructions Committed in the CPU.
void drainSanityCheck() const
Perform sanity checks after a drain.
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
statistics::Vector committedInsts
Stat for the number of committed instructions per thread.
statistics::Scalar idleCycles
Stat for total number of cycles the CPU spends descheduled.
void setArchFloatReg(int reg_idx, RegVal val, ThreadID tid)
InstructionQueue instQueue
Instruction queue.
TimeBuffer< DecodeStruct > decodeQueue
The decode stage's instruction queue.
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
void drainResume()
Resume after a drain.
statistics::Formula totalCpi
Stat for the total CPI.
void setArchCCReg(int reg_idx, RegVal val, ThreadID tid)
void deschedulePowerGatingEvent()
void clearStates(ThreadID tid)
Clear all thread-specific states.
TheISA::VecRegContainer & getWritableVecReg(PhysRegIdPtr reg_idx)
Read physical vector register for modification.
DrainState
Object drain/handover states.
void generateTCEvent(ThreadID tid)
Records that commit needs to initiate a squash due to an external state update through the TC.
void setArchVecReg(int reg_idx, const TheISA::VecRegContainer &val, ThreadID tid)
virtual void suspendContext(ThreadID thread_num)
Notify the CPU that the indicated context is now suspended.
gem5::BaseCPU::BaseCPUStats baseStats
void takeOverFrom()
Takes over from another CPU's thread.
void tick()
Ticks decode, processing all input signals and decoding as many instructions as possible.
const TheISA::VecPredRegContainer & readArchVecPredReg(int reg_idx, ThreadID tid) const
uint32_t taskId() const
Get cpu task id.
RequestorID _dataRequestorId
data side request id that must be placed in all requests
bool tryDrain()
Check if the pipeline has drained and signal drain done.
virtual void wakeup(ThreadID tid) override
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
void insertThread(ThreadID tid)
Setup CPU to insert a thread's context.
bool isDrained() const
Has the stage drained?
void setCCReg(PhysRegIdPtr phys_reg, RegVal val)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
statistics::Scalar vecPredRegfileReads
void setIntReg(PhysRegIdPtr phys_reg, RegVal val)
std::shared_ptr< FaultBase > Fault
void scheduleTickEvent(Cycles delay)
Schedule tick event, regardless of its current state.
Counter totalOps() const override
Count the Total Ops (including micro ops) committed in the CPU.
void suspendContext(ThreadID tid) override
Remove Thread from Active Threads List.
bool isDrained() const
Has the stage drained?
const TheISA::VecElem & readArchVecElem(const RegIndex ®_idx, const ElemIndex &ldx, ThreadID tid) const
@ Suspended
Temporarily inactive.
void setVectorsAsReady(ThreadID tid)
Mark vector fields in scoreboard as ready right after switching vector mode, since software may read ...
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
void setReg(PhysRegIdPtr phys_reg)
Sets the register as ready.
Fetch fetch
The fetch stage.
Addr microPC(ThreadID tid)
Reads the micro PC of a specific thread.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
statistics::Scalar numCycles
void scheduleThreadExitEvent(ThreadID tid)
If a thread is trying to exit and its corresponding trap event has been completed,...
GenericISA::DelaySlotPCState< 4 > PCState
void switchFreeList(UnifiedFreeList *freeList)
Switch freeList of registers from Full to Elem or vicevers depending on vecMode (vector renaming mode...
bool isDrained() const
Has the stage drained?
std::shared_ptr< Request > RequestPtr
void squashFromTC(ThreadID tid)
Initiates a squash of all in-flight instructions for a given thread.
statistics::Scalar vecPredRegfileWrites
RegVal readIntReg(PhysRegIdPtr phys_reg)
RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid) const
Register accessors.
void resetHtmStartsStops(ThreadID)
gem5::ThreadContext * tcBase(ThreadID tid)
Returns a pointer to a thread context.
void activateThread(ThreadID tid)
Add Thread to Active Threads List.
void regProbePoints() override
Register probe points for this object.
std::vector< ThreadState * > thread
Pointers to all of the threads in the CPU.
void deactivateThread(ThreadID tid)
For priority-based fetch policies, need to keep update priorityList.
void setArchVecPredReg(int reg_idx, const TheISA::VecPredRegContainer &val, ThreadID tid)
void clearStates(ThreadID tid)
Clear all thread-specific states.
statistics::Scalar ccRegfileReads
statistics::Scalar timesIdled
Stat for total number of times the CPU is descheduled.
const ThreadID InvalidThreadID
DrainState drain() override
Starts draining the CPU's pipeline of all instructions in order to stop all memory accesses.
void wakeCPU()
Wakes the CPU, rescheduling the CPU if it's not already active.
const TheISA::VecRegContainer & readVecReg(PhysRegIdPtr reg_idx) const
EventFunctionWrapper tickEvent
The tick event used for scheduling CPU ticks.
void switchOut() override
Switches out this CPU.
gem5::VecRegContainer< NumVecElemPerVecReg *sizeof(VecElem)> VecRegContainer
@ Drained
Buffers drained, ready for serialization/handover.
bool isTimingMode() const
Is the system in timing mode?
virtual TheISA::PCState pcState() const =0
void setMiscRegNoEffect(int misc_reg, RegVal val, ThreadID tid)
Sets a miscellaneous register.
TimeBuffer< RenameStruct > renameQueue
The rename stage's instruction queue.
ROB rob
The re-order buffer.
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
void tick()
Ticks IEW stage, causing Dispatch, the IQ, the LSQ, Execute, and Writeback to run for one cycle.
void tick()
Ticks the fetch stage, processing all inputs signals and fetching as many instructions as possible.
virtual void probeInstCommit(const StaticInstPtr &inst, Addr pc)
Helper method to trigger PMU probes for a committed instruction.
statistics::Scalar vecRegfileWrites
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
statistics::Scalar vecRegfileReads
Addr instAddr(ThreadID tid)
Returns the PC of a specific thread.
statistics::Vector committedOps
Stat for the number of committed ops (including micro ops) per thread.
uint16_t ElemIndex
Logical vector register elem index type.
const std::string & name()
Addr instAddr(ThreadID tid)
Reads the commit PC of a specific thread.
PhysRegIdPtr getCCReg()
Gets a free cc register.
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...
void deschedule(Event &event)
TheISA::VecRegContainer & getWritableArchVecReg(int reg_idx, ThreadID tid)
Read architectural vector register for modification.
void activity()
Records that there is activity this cycle.
void setFloatReg(PhysRegIdPtr phys_reg, RegVal val)
void setVecPredReg(PhysRegIdPtr reg_idx, const TheISA::VecPredRegContainer &val)
void startupStage()
Initialize stage.
ProbePointArg generates a point for the class of Arg.
void regProbePoints() override
Register probe points.
System * system
Pointer to the system.
void signalDrainDone() const
Signal that an object is drained.
Tick nextCycle() const
Based on the clock of the object, determine the start tick of the first cycle that is at least one cy...
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
void reset()
Clears the time buffer and the activity count.
ProbeManager * getProbeManager()
Get the probe manager for this object.
Cycles lastRunningCycle
The cycle that the CPU was last running, used for statistics.
void updateThreadPriority()
Update The Order In Which We Process Threads.
static constexpr int MaxThreads
TheISA::VecPredRegContainer & getWritableArchVecPredReg(int reg_idx, ThreadID tid)
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
@ VecRegClass
Vector Register.
statistics::Formula ipc
Stat for the IPC per thread.
Rename rename
The dispatch stage.
TimeBuffer< FetchStruct > fetchQueue
The fetch stage's instruction queue.
void takeOverFrom(BaseCPU *oldCPU) override
Takes over from another CPU.
std::vector< ThreadContext * > threadContexts
PhysRegIdPtr getFloatReg()
Gets a free fp register.
IEW iew
The issue/execute/writeback stages.
void removeInstsNotInROB(ThreadID tid)
Remove all instructions that are not currently in the ROB.
void drainSanityCheck() const
Perform sanity checks after a drain.
void exitThreads()
Terminate all threads that are ready to exit.
Tick lastActivatedCycle
The cycle that the CPU was last activated by a new thread.
void drainResume()
Resumes execution after draining.
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...
virtual void activateContext(ThreadID thread_num)
Notify the CPU that the indicated context is now active.
bool executingHtmTransaction(ThreadID) const
Is the CPU currently processing a HTM transaction?
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
void commitDrained(ThreadID tid)
Commit has reached a safe point to drain a thread.
void quiesceCycles(ThreadContext *tc, uint64_t cycles)
void switchRenameMode(ThreadID tid, UnifiedFreeList *freelist)
Check if a change in renaming is needed for vector registers.
void takeOverFrom()
Takes over from another CPU's thread.
MicroPC microPC(ThreadID tid)
Reads the commit micro PC of a specific thread.
const TheISA::VecPredRegContainer & readVecPredReg(PhysRegIdPtr phys_reg) const
Reads a predicate register.
UnifiedRenameMap commitRenameMap[MaxThreads]
The commit rename map.
void trap(const Fault &fault, ThreadID tid, const StaticInstPtr &inst)
Traps to handle given fault.
void drainResume() override
Resumes execution after a drain.
ThreadID getFreeTid()
Gets a free thread id.
ListIt addInst(const DynInstPtr &inst)
Function to add instruction onto the head of the list of the instructions.
bool isEmpty() const
Returns if the ROB is empty.
bool isThreadExiting(ThreadID tid) const
Is the thread trying to exit?
void drainSanityCheck() const
Perform sanity checks after a drain.
EventFunctionWrapper threadExitEvent
The exit event used for terminating all ready-to-exit threads.
PhysRegIdPtr lookup(const RegId &arch_reg) const
Look up the physical register mapped to an architectural register.
double Counter
All counters are of 64-bit values.
virtual void switchOut()
Prepare for another CPU to take over execution.
TheISA::PCState pcState(ThreadID tid)
Reads the PC of a specific thread.
RegVal readMiscReg(int misc_reg, ThreadID tid)
Reads a misc.
void setFloatReg(PhysRegIdPtr phys_reg, RegVal val)
void startupStage()
Initializes variables for the stage.
void setIntReg(PhysRegIdPtr phys_reg, RegVal val)
Sets an integer register to the given value.
std::ostream CheckpointOut
std::unordered_map< ThreadID, bool > exitingThreads
This is a list of threads that are trying to exit.
statistics::Scalar fpRegfileReads
RegVal readArchIntReg(int reg_idx, ThreadID tid)
void regProbePoints()
Registers probes.
RequestPort & getDataPort()
bool active()
Returns if the CPU should be active.
void tick()
Ticks the commit stage, which tries to commit instructions.
void regProbePoints()
Registers probes.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Scoreboard scoreboard
Integer Register Scoreboard.
@ Running
Running normally.
LSQ ldstQueue
Load / store queue.
Commit commit
The commit stage.
void haltContext(ThreadID tid) override
Remove Thread from Active Threads List && Remove Thread Context from CPU.
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
void setVecReg(PhysRegIdPtr phys_reg, const TheISA::VecRegContainer &val)
Sets a vector register to the given value.
ActivityRecorder activityRec
The activity recorder; used to tell if the CPU has any activity remaining or if it can go to idle and...
void pcState(const TheISA::PCState &newPCState, ThreadID tid)
Sets the commit PC state of a specific thread.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
@ IntRegClass
Integer register.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
const TheISA::VecPredRegContainer & readVecPredReg(PhysRegIdPtr reg_idx) const
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
const FlagsType total
Print the total.
void activateContext(ThreadID tid) override
Add Thread to Active Threads List.
Derived & init(size_type size)
Set this vector to have the given size.
void takeOverFrom()
Takes over from another CPU's thread.
PhysRegIdPtr getIntReg()
Gets a free integer register.
Addr nextInstAddr(ThreadID tid)
Reads the next PC of a specific thread.
void tick()
Ticks CPU, calling tick() on each stage, and checking the overall activity to see if the CPU should d...
RegVal readCCReg(PhysRegIdPtr phys_reg)
Reads a condition-code register.
void startup() override
startup() is the final initialization call before simulation.
std::vector< TheISA::ISA * > isa
void drainSanityCheck() const
Perform sanity checks after a drain.
@ Draining
Draining buffers pending serialization/handover.
void instDone(ThreadID tid, const DynInstPtr &inst)
Function to tell the CPU that an instruction has completed.
bool scheduled() const
Determine if the current event is scheduled.
int16_t ThreadID
Thread index/ID type.
Addr nextInstAddr(ThreadID tid)
Returns the next PC of a specific thread.
void init() override
Initialize the CPU.
Register ID: describe an architectural register with its class and index.
#define panic(...)
This implements a cprintf based panic() function.
void setEntry(const RegId &arch_reg, PhysRegIdPtr phys_reg)
Update rename map with a specific mapping.
void removeFrontInst(const DynInstPtr &inst)
Remove an instruction from the front end of the list.
const TheISA::VecRegContainer & readArchVecReg(int reg_idx, ThreadID tid) const
void regProbePoints()
Registers probes.
unsigned getCount(ThreadID tid)
Returns the number of used entries for a thread.
Generated on Tue Sep 7 2021 14:53:39 for gem5 by doxygen 1.8.17