gem5
v22.0.0.1
|
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buffers between stages. More...
#include <cpu.hh>
Classes | |
struct | CPUStats |
Public Types | |
enum | Status { Running, Idle, Halted, Blocked, SwitchedOut } |
enum | StageIdx { FetchIdx, DecodeIdx, RenameIdx, IEWIdx, CommitIdx, NumStages } |
Enum to give each stage a specific index, so when calling activateStage() or deactivateStage(), they can specify which stage is being activated/deactivated. More... | |
typedef std::list< DynInstPtr >::iterator | ListIt |
using | LSQRequest = LSQ::LSQRequest |
Public Member Functions | |
CPU (const BaseO3CPUParams ¶ms) | |
Constructs a CPU with the given parameters. More... | |
void | regProbePoints () override |
Register probe points. More... | |
void | demapPage (Addr vaddr, uint64_t asn) |
void | tick () |
Ticks CPU, calling tick() on each stage, and checking the overall activity to see if the CPU should deschedule itself. More... | |
void | init () override |
Initialize the CPU. More... | |
void | startup () override |
int | numActiveThreads () |
Returns the Number of Active Threads in the CPU. More... | |
void | activateThread (ThreadID tid) |
Add Thread to Active Threads List. More... | |
void | deactivateThread (ThreadID tid) |
Remove Thread from Active Threads List. More... | |
void | insertThread (ThreadID tid) |
Setup CPU to insert a thread's context. More... | |
void | removeThread (ThreadID tid) |
Remove all of a thread's context from CPU. More... | |
Counter | totalInsts () const override |
Count the Total Instructions Committed in the CPU. More... | |
Counter | totalOps () const override |
Count the Total Ops (including micro ops) committed in the CPU. More... | |
void | activateContext (ThreadID tid) override |
Add Thread to Active Threads List. More... | |
void | suspendContext (ThreadID tid) override |
Remove Thread from Active Threads List. More... | |
void | haltContext (ThreadID tid) override |
Remove Thread from Active Threads List && Remove Thread Context from CPU. More... | |
void | updateThreadPriority () |
Update The Order In Which We Process Threads. More... | |
bool | isDraining () const |
Is the CPU draining? More... | |
void | serializeThread (CheckpointOut &cp, ThreadID tid) const override |
void | unserializeThread (CheckpointIn &cp, ThreadID tid) override |
void | addThreadToExitingList (ThreadID tid) |
Insert tid to the list of threads trying to exit. More... | |
bool | isThreadExiting (ThreadID tid) const |
Is the thread trying to exit? More... | |
void | scheduleThreadExitEvent (ThreadID tid) |
If a thread is trying to exit and its corresponding trap event has been completed, schedule an event to terminate the thread. More... | |
void | exitThreads () |
Terminate all threads that are ready to exit. More... | |
DrainState | drain () override |
Starts draining the CPU's pipeline of all instructions in order to stop all memory accesses. More... | |
void | drainResume () override |
Resumes execution after a drain. More... | |
void | commitDrained (ThreadID tid) |
Commit has reached a safe point to drain a thread. More... | |
void | switchOut () override |
Switches out this CPU. More... | |
void | takeOverFrom (BaseCPU *oldCPU) override |
Takes over from another CPU. More... | |
void | verifyMemoryMode () const override |
InstSeqNum | getAndIncrementInstSeq () |
Get the current instruction sequence number, and increment it. More... | |
void | trap (const Fault &fault, ThreadID tid, const StaticInstPtr &inst) |
Traps to handle given fault. More... | |
Fault | getInterrupts () |
Returns the Fault for any valid interrupt. More... | |
void | processInterrupts (const Fault &interrupt) |
Processes any an interrupt fault. More... | |
void | halt () |
Halts the CPU. More... | |
RegVal | readMiscRegNoEffect (int misc_reg, ThreadID tid) const |
Register accessors. More... | |
RegVal | readMiscReg (int misc_reg, ThreadID tid) |
Reads a misc. More... | |
void | setMiscRegNoEffect (int misc_reg, RegVal val, ThreadID tid) |
Sets a miscellaneous register. More... | |
void | setMiscReg (int misc_reg, RegVal val, ThreadID tid) |
Sets a misc. More... | |
RegVal | getReg (PhysRegIdPtr phys_reg) |
void | getReg (PhysRegIdPtr phys_reg, void *val) |
void * | getWritableReg (PhysRegIdPtr phys_reg) |
void | setReg (PhysRegIdPtr phys_reg, RegVal val) |
void | setReg (PhysRegIdPtr phys_reg, const void *val) |
RegVal | getArchReg (const RegId ®, ThreadID tid) |
Architectural register accessors. More... | |
void | getArchReg (const RegId ®, void *val, ThreadID tid) |
void * | getWritableArchReg (const RegId ®, ThreadID tid) |
void | setArchReg (const RegId ®, RegVal val, ThreadID tid) |
void | setArchReg (const RegId ®, const void *val, ThreadID tid) |
void | pcState (const PCStateBase &new_pc_state, ThreadID tid) |
Sets the commit PC state of a specific thread. More... | |
const PCStateBase & | pcState (ThreadID tid) |
Reads the commit PC state of a specific thread. More... | |
void | squashFromTC (ThreadID tid) |
Initiates a squash of all in-flight instructions for a given thread. More... | |
ListIt | addInst (const DynInstPtr &inst) |
Function to add instruction onto the head of the list of the instructions. More... | |
void | instDone (ThreadID tid, const DynInstPtr &inst) |
Function to tell the CPU that an instruction has completed. More... | |
void | removeFrontInst (const DynInstPtr &inst) |
Remove an instruction from the front end of the list. More... | |
void | removeInstsNotInROB (ThreadID tid) |
Remove all instructions that are not currently in the ROB. More... | |
void | removeInstsUntil (const InstSeqNum &seq_num, ThreadID tid) |
Remove all instructions younger than the given sequence number. More... | |
void | squashInstIt (const ListIt &instIt, ThreadID tid) |
Removes the instruction pointed to by the iterator. More... | |
void | cleanUpRemovedInsts () |
Cleans up all instructions on the remove list. More... | |
void | dumpInsts () |
Debug function to print all instructions on the list. More... | |
void | activityThisCycle () |
Records that there was time buffer activity this cycle. More... | |
void | activateStage (const StageIdx idx) |
Changes a stage's status to active within the activity recorder. More... | |
void | deactivateStage (const StageIdx idx) |
Changes a stage's status to inactive within the activity recorder. More... | |
void | wakeCPU () |
Wakes the CPU, rescheduling the CPU if it's not already active. More... | |
virtual void | wakeup (ThreadID tid) override |
ThreadID | getFreeTid () |
Gets a free thread id. More... | |
gem5::ThreadContext * | tcBase (ThreadID tid) |
Returns a pointer to a thread context. More... | |
Fault | pushRequest (const DynInstPtr &inst, bool isLoad, uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res, AtomicOpFunctorPtr amo_op=nullptr, const std::vector< bool > &byte_enable=std::vector< bool >()) |
CPU pushRequest function, forwards request to LSQ. More... | |
Port & | getInstPort () override |
Used by the fetch unit to get a hold of the instruction port. More... | |
Port & | getDataPort () override |
Get the dcache port (used to find block size for translations). More... | |
void | htmSendAbortSignal (ThreadID tid, uint64_t htm_uid, HtmFailureFaultCause cause) override |
Public Attributes | |
BaseMMU * | mmu |
Status | _status |
Overall CPU status. More... | |
ProbePointArg< PacketPtr > * | ppInstAccessComplete |
ProbePointArg< std::pair< DynInstPtr, PacketPtr > > * | ppDataAccessComplete |
int | instcount |
Count of total number of dynamic instructions in flight. More... | |
std::list< DynInstPtr > | instList |
List of all the instructions in flight. More... | |
std::queue< ListIt > | removeList |
List of all the instructions that will be removed at the end of this cycle. More... | |
bool | removeInstsThisCycle |
Records if instructions need to be removed this cycle due to being retired or squashed. More... | |
TimeBuffer< TimeStruct > | timeBuffer |
The main time buffer to do backwards communication. More... | |
TimeBuffer< FetchStruct > | fetchQueue |
The fetch stage's instruction queue. More... | |
TimeBuffer< DecodeStruct > | decodeQueue |
The decode stage's instruction queue. More... | |
TimeBuffer< RenameStruct > | renameQueue |
The rename stage's instruction queue. More... | |
TimeBuffer< IEWStruct > | iewQueue |
The IEW stage's instruction queue. More... | |
InstSeqNum | globalSeqNum |
The global sequence number counter. More... | |
gem5::Checker< DynInstPtr > * | checker |
Pointer to the checker, which can dynamically verify instruction results at run time. More... | |
System * | system |
Pointer to the system. More... | |
std::vector< ThreadState * > | thread |
Pointers to all of the threads in the CPU. More... | |
std::list< int > | cpuWaitList |
Threads Scheduled to Enter CPU. More... | |
Cycles | lastRunningCycle |
The cycle that the CPU was last running, used for statistics. More... | |
Tick | lastActivatedCycle |
The cycle that the CPU was last activated by a new thread. More... | |
std::map< ThreadID, unsigned > | threadMap |
Mapping for system thread id to cpu id. More... | |
std::vector< ThreadID > | tids |
Available thread ids in the cpu. More... | |
gem5::o3::CPU::CPUStats | cpuStats |
Protected Attributes | |
Fetch | fetch |
The fetch stage. More... | |
Decode | decode |
The decode stage. More... | |
Rename | rename |
The dispatch stage. More... | |
IEW | iew |
The issue/execute/writeback stages. More... | |
Commit | commit |
The commit stage. More... | |
PhysRegFile | regFile |
The register file. More... | |
UnifiedFreeList | freeList |
The free list. More... | |
UnifiedRenameMap | renameMap [MaxThreads] |
The rename map. More... | |
UnifiedRenameMap | commitRenameMap [MaxThreads] |
The commit rename map. More... | |
ROB | rob |
The re-order buffer. More... | |
std::list< ThreadID > | activeThreads |
Active Threads List. More... | |
std::unordered_map< ThreadID, bool > | exitingThreads |
This is a list of threads that are trying to exit. More... | |
Scoreboard | scoreboard |
Integer Register Scoreboard. More... | |
std::vector< TheISA::ISA * > | isa |
Private Member Functions | |
void | scheduleTickEvent (Cycles delay) |
Schedule tick event, regardless of its current state. More... | |
void | unscheduleTickEvent () |
Unschedule tick event, regardless of its current state. More... | |
bool | tryDrain () |
Check if the pipeline has drained and signal drain done. More... | |
void | drainSanityCheck () const |
Perform sanity checks after a drain. More... | |
bool | isCpuDrained () const |
Check if a system is in a drained state. More... | |
Private Attributes | |
EventFunctionWrapper | tickEvent |
The tick event used for scheduling CPU ticks. More... | |
EventFunctionWrapper | threadExitEvent |
The exit event used for terminating all ready-to-exit threads. More... | |
ActivityRecorder | activityRec |
The activity recorder; used to tell if the CPU has any activity remaining or if it can go to idle and deschedule itself. More... | |
Friends | |
class | ThreadContext |
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buffers between stages.
typedef std::list<DynInstPtr>::iterator gem5::o3::CPU::ListIt |
Enum to give each stage a specific index, so when calling activateStage() or deactivateStage(), they can specify which stage is being activated/deactivated.
Enumerator | |
---|---|
FetchIdx | |
DecodeIdx | |
RenameIdx | |
IEWIdx | |
CommitIdx | |
NumStages |
gem5::o3::CPU::CPU | ( | const BaseO3CPUParams & | params | ) |
|
override |
Add Thread to Active Threads List.
Definition at line 601 of file cpu.cc.
References _status, activateThread(), gem5::ActivityRecorder::activity(), activityRec, cpuStats, gem5::curTick(), gem5::Drained, fetch, lastActivatedCycle, lastRunningCycle, gem5::o3::CPU::CPUStats::quiesceCycles, Running, scheduleTickEvent(), and gem5::o3::Fetch::wakeFromQuiesce().
Referenced by gem5::o3::ThreadContext::activate(), drain(), and insertThread().
|
inline |
Changes a stage's status to active within the activity recorder.
Definition at line 490 of file cpu.hh.
References gem5::ActivityRecorder::activateStage(), and activityRec.
Referenced by gem5::o3::IEW::activateStage(), gem5::o3::IEW::startupStage(), gem5::o3::Commit::startupStage(), gem5::o3::Fetch::switchToActive(), gem5::o3::Fetch::updateFetchStatus(), gem5::o3::Decode::updateStatus(), gem5::o3::Commit::updateStatus(), and gem5::o3::Rename::updateStatus().
void gem5::o3::CPU::activateThread | ( | ThreadID | tid | ) |
Add Thread to Active Threads List.
Definition at line 537 of file cpu.cc.
References activeThreads, and DPRINTF.
Referenced by activateContext(), and drainResume().
|
inline |
Records that there was time buffer activity this cycle.
Definition at line 486 of file cpu.hh.
References gem5::ActivityRecorder::activity(), and activityRec.
Referenced by gem5::o3::IEW::activityThisCycle(), gem5::o3::LSQUnit::completeStore(), gem5::o3::IEW::executeInsts(), gem5::o3::Fetch::finishTranslation(), gem5::o3::InstructionQueue::scheduleReadyInsts(), gem5::o3::Commit::squashFromSquashAfter(), gem5::o3::Commit::squashFromTC(), gem5::o3::Commit::squashFromTrap(), gem5::o3::Commit::startupStage(), gem5::o3::IEW::takeOverFrom(), gem5::o3::Decode::tick(), gem5::o3::Rename::tick(), gem5::o3::Commit::tick(), gem5::o3::IEW::tick(), and gem5::o3::Fetch::tick().
CPU::ListIt gem5::o3::CPU::addInst | ( | const DynInstPtr & | inst | ) |
Function to add instruction onto the head of the list of the instructions.
Used when new instructions are fetched.
Definition at line 1214 of file cpu.cc.
References instList.
Referenced by gem5::o3::Fetch::buildInst().
void gem5::o3::CPU::addThreadToExitingList | ( | ThreadID | tid | ) |
Insert tid to the list of threads trying to exit.
Definition at line 1459 of file cpu.cc.
References DPRINTF, exitingThreads, gem5::ThreadContext::Halted, gem5::ArmISA::status, and tcBase().
Referenced by gem5::o3::ThreadContext::halt().
void gem5::o3::CPU::cleanUpRemovedInsts | ( | ) |
Cleans up all instructions on the remove list.
Definition at line 1346 of file cpu.cc.
References DPRINTF, instList, removeInstsThisCycle, and removeList.
Referenced by tick().
void gem5::o3::CPU::commitDrained | ( | ThreadID | tid | ) |
Commit has reached a safe point to drain a thread.
Commit calls this method to inform the pipeline that it has reached a point where it is not executed microcode and is about to squash uncommitted instructions to fully drain the pipeline.
Definition at line 938 of file cpu.cc.
References gem5::o3::Fetch::drainStall(), and fetch.
Referenced by gem5::o3::Commit::commitInsts().
|
inline |
Changes a stage's status to inactive within the activity recorder.
Definition at line 497 of file cpu.hh.
References activityRec, and gem5::ActivityRecorder::deactivateStage().
Referenced by gem5::o3::IEW::deactivateStage(), gem5::o3::Fetch::switchToInactive(), gem5::o3::Fetch::updateFetchStatus(), gem5::o3::Decode::updateStatus(), gem5::o3::Commit::updateStatus(), and gem5::o3::Rename::updateStatus().
void gem5::o3::CPU::deactivateThread | ( | ThreadID | tid | ) |
Remove Thread from Active Threads List.
Definition at line 553 of file cpu.cc.
References activeThreads, commit, gem5::o3::Commit::deactivateThread(), gem5::o3::Fetch::deactivateThread(), DPRINTF, gem5::o3::Commit::executingHtmTransaction(), and fetch.
Referenced by haltContext(), and suspendContext().
|
inline |
Definition at line 181 of file cpu.hh.
References gem5::BaseMMU::demapPage(), mmu, and gem5::MipsISA::vaddr.
Referenced by gem5::o3::DynInst::demapPage().
|
override |
Starts draining the CPU's pipeline of all instructions in order to stop all memory accesses.
Definition at line 813 of file cpu.cc.
References activateContext(), gem5::ActivityRecorder::activity(), activityRec, commit, decodeQueue, DPRINTF, gem5::o3::Commit::drain(), gem5::Drained, gem5::Draining, drainSanityCheck(), fetchQueue, gem5::ArmISA::i, iewQueue, isCpuDrained(), renameQueue, gem5::Event::scheduled(), gem5::ThreadContext::Suspended, gem5::VegaISA::t, tickEvent, timeBuffer, and wakeCPU().
|
override |
Resumes execution after a drain.
Definition at line 941 of file cpu.cc.
References _status, activateThread(), gem5::ThreadContext::Active, commit, DPRINTF, gem5::o3::Commit::drainResume(), gem5::o3::Fetch::drainResume(), fetch, gem5::ArmISA::i, Idle, Running, gem5::Event::scheduled(), gem5::ArmISA::status, thread, tickEvent, and verifyMemoryMode().
|
private |
Perform sanity checks after a drain.
This method is called from drain() when it has determined that the CPU is fully drained when gem5 is compiled with the NDEBUG macro undefined. The intention of this method is to do more extensive tests than the isDrained() method to weed out any draining bugs.
Definition at line 890 of file cpu.cc.
References commit, decode, gem5::o3::Decode::drainSanityCheck(), gem5::o3::IEW::drainSanityCheck(), gem5::o3::Rename::drainSanityCheck(), gem5::o3::Commit::drainSanityCheck(), gem5::o3::Fetch::drainSanityCheck(), fetch, iew, isCpuDrained(), and rename.
Referenced by drain().
void gem5::o3::CPU::dumpInsts | ( | ) |
Debug function to print all instructions on the list.
Definition at line 1370 of file cpu.cc.
References gem5::cprintf(), and instList.
Referenced by gem5::o3::DynInst::DynInst().
void gem5::o3::CPU::exitThreads | ( | ) |
Terminate all threads that are ready to exit.
Definition at line 1504 of file cpu.cc.
References DPRINTF, exitingThreads, haltContext(), gem5::ThreadContext::Halted, gem5::ThreadContext::setStatus(), and tcBase().
|
inline |
Get the current instruction sequence number, and increment it.
Definition at line 282 of file cpu.hh.
References globalSeqNum.
Referenced by gem5::o3::Fetch::buildInst().
Architectural register accessors.
Looks up in the commit rename table to obtain the true physical index of the architected register first, then accesses that physical register.
Definition at line 1160 of file cpu.cc.
References commitRenameMap, gem5::o3::PhysRegFile::getReg(), gem5::o3::UnifiedRenameMap::lookup(), gem5::X86ISA::reg, and regFile.
Referenced by gem5::o3::ThreadContext::getRegFlat().
Definition at line 1167 of file cpu.cc.
References commitRenameMap, gem5::o3::PhysRegFile::getReg(), gem5::o3::UnifiedRenameMap::lookup(), gem5::X86ISA::reg, regFile, and gem5::X86ISA::val.
|
inlineoverride |
Get the dcache port (used to find block size for translations).
Definition at line 569 of file cpu.hh.
References gem5::o3::LSQ::getDataPort(), iew, and gem5::o3::IEW::ldstQueue.
ThreadID gem5::o3::CPU::getFreeTid | ( | ) |
Gets a free thread id.
Use if thread ids change across system.
Definition at line 1430 of file cpu.cc.
References gem5::InvalidThreadID, and tids.
|
inlineoverride |
Used by the fetch unit to get a hold of the instruction port.
Definition at line 562 of file cpu.hh.
References fetch, and gem5::o3::Fetch::getInstPort().
Referenced by gem5::o3::Fetch::takeOverFrom().
Fault gem5::o3::CPU::getInterrupts | ( | ) |
Returns the Fault for any valid interrupt.
Definition at line 771 of file cpu.cc.
Referenced by gem5::o3::Commit::handleInterrupt(), and gem5::o3::Commit::propagateInterrupt().
RegVal gem5::o3::CPU::getReg | ( | PhysRegIdPtr | phys_reg | ) |
Definition at line 1040 of file cpu.cc.
References gem5::CCRegClass, gem5::o3::CPU::CPUStats::ccRegfileReads, gem5::PhysRegId::classValue(), cpuStats, gem5::FloatRegClass, gem5::o3::CPU::CPUStats::fpRegfileReads, gem5::o3::PhysRegFile::getReg(), gem5::IntRegClass, gem5::o3::CPU::CPUStats::intRegfileReads, regFile, gem5::VecElemClass, gem5::VecPredRegClass, gem5::o3::CPU::CPUStats::vecPredRegfileReads, gem5::VecRegClass, and gem5::o3::CPU::CPUStats::vecRegfileReads.
Referenced by gem5::o3::DynInst::forwardOldRegs(), and gem5::o3::DynInst::getRegOperand().
void gem5::o3::CPU::getReg | ( | PhysRegIdPtr | phys_reg, |
void * | val | ||
) |
Definition at line 1066 of file cpu.cc.
References gem5::CCRegClass, gem5::o3::CPU::CPUStats::ccRegfileReads, gem5::PhysRegId::classValue(), cpuStats, gem5::FloatRegClass, gem5::o3::CPU::CPUStats::fpRegfileReads, gem5::o3::PhysRegFile::getReg(), gem5::IntRegClass, gem5::o3::CPU::CPUStats::intRegfileReads, regFile, gem5::X86ISA::val, gem5::VecElemClass, gem5::VecPredRegClass, gem5::o3::CPU::CPUStats::vecPredRegfileReads, gem5::VecRegClass, and gem5::o3::CPU::CPUStats::vecRegfileReads.
Definition at line 1174 of file cpu.cc.
References commitRenameMap, gem5::o3::PhysRegFile::getWritableReg(), gem5::o3::UnifiedRenameMap::lookup(), gem5::X86ISA::reg, and regFile.
Referenced by gem5::o3::ThreadContext::getWritableRegFlat().
void * gem5::o3::CPU::getWritableReg | ( | PhysRegIdPtr | phys_reg | ) |
Definition at line 1092 of file cpu.cc.
References gem5::PhysRegId::classValue(), cpuStats, gem5::o3::PhysRegFile::getWritableReg(), regFile, gem5::VecPredRegClass, gem5::o3::CPU::CPUStats::vecPredRegfileReads, gem5::VecRegClass, and gem5::o3::CPU::CPUStats::vecRegfileReads.
Referenced by gem5::o3::DynInst::getWritableRegOperand().
|
inline |
|
override |
Remove Thread from Active Threads List && Remove Thread Context from CPU.
Definition at line 659 of file cpu.cc.
References _status, activeThreads, deactivateThread(), DPRINTF, Idle, lastRunningCycle, removeThread(), gem5::Event::scheduled(), tickEvent, and unscheduleTickEvent().
Referenced by exitThreads().
|
override |
Definition at line 1527 of file cpu.cc.
References gem5::X86ISA::addr, commit, gem5::Packet::createRead(), gem5::Packet::dataStatic(), flags, gem5::o3::LSQ::getDataPort(), gem5::Request::HTM_ABORT, iew, gem5::o3::IEW::ldstQueue, panic, gem5::Request::PHYSICAL, gem5::o3::Commit::resetHtmStartsStops(), gem5::o3::LSQ::resetHtmStartsStops(), gem5::RequestPort::sendTimingReq(), gem5::Packet::setHtmTransactional(), gem5::Request::STRICT_ORDER, and thread.
Referenced by gem5::o3::ThreadContext::htmAbortTransaction().
|
override |
Initialize the CPU.
Definition at line 507 of file cpu.cc.
References commit, gem5::statistics::init, gem5::o3::Commit::setThreads(), and thread.
void gem5::o3::CPU::insertThread | ( | ThreadID | tid | ) |
Setup CPU to insert a thread's context.
Definition at line 681 of file cpu.cc.
References activateContext(), gem5::ThreadContext::Active, gem5::CCRegClass, commit, DPRINTF, freeList, gem5::FullSystem, gem5::o3::UnifiedFreeList::getReg(), isa, gem5::ThreadContext::pcState(), pcState(), renameMap, gem5::o3::ROB::resetEntries(), gem5::o3::Commit::rob, scoreboard, gem5::o3::UnifiedRenameMap::setEntry(), gem5::o3::Scoreboard::setReg(), gem5::ThreadContext::setStatus(), system, tcBase(), gem5::System::threads, and gem5::X86ISA::type.
void gem5::o3::CPU::instDone | ( | ThreadID | tid, |
const DynInstPtr & | inst | ||
) |
Function to tell the CPU that an instruction has completed.
Definition at line 1222 of file cpu.cc.
References gem5::o3::CPU::CPUStats::committedInsts, gem5::o3::CPU::CPUStats::committedOps, cpuStats, and thread.
Referenced by gem5::o3::Commit::updateComInstStats().
|
private |
Check if a system is in a drained state.
Definition at line 901 of file cpu.cc.
References commit, decode, DPRINTF, fetch, iew, instList, gem5::o3::Decode::isDrained(), gem5::o3::IEW::isDrained(), gem5::o3::Rename::isDrained(), gem5::o3::Commit::isDrained(), gem5::o3::Fetch::isDrained(), removeList, and rename.
Referenced by drain(), drainSanityCheck(), and tryDrain().
|
inline |
Is the CPU draining?
Definition at line 236 of file cpu.hh.
References gem5::Draining.
Referenced by gem5::o3::Fetch::checkStall(), gem5::o3::Fetch::drainStall(), and gem5::o3::ThreadContext::suspend().
bool gem5::o3::CPU::isThreadExiting | ( | ThreadID | tid | ) | const |
Is the thread trying to exit?
Definition at line 1478 of file cpu.cc.
References exitingThreads.
Referenced by gem5::o3::Commit::commit(), and gem5::o3::ROB::doSquash().
|
inline |
Returns the Number of Active Threads in the CPU.
Definition at line 198 of file cpu.hh.
References activeThreads.
void gem5::o3::CPU::pcState | ( | const PCStateBase & | new_pc_state, |
ThreadID | tid | ||
) |
Sets the commit PC state of a specific thread.
Definition at line 1201 of file cpu.cc.
References commit, gem5::o3::Commit::pcState(), and gem5::X86ISA::val.
Referenced by gem5::o3::Fetch::clearStates(), insertThread(), gem5::o3::ThreadContext::pcState(), gem5::o3::ThreadContext::pcStateNoRecord(), and gem5::o3::Fetch::resetStage().
const PCStateBase & gem5::o3::CPU::pcState | ( | ThreadID | tid | ) |
Reads the commit PC state of a specific thread.
Definition at line 1195 of file cpu.cc.
References commit, and gem5::o3::Commit::pcState().
void gem5::o3::CPU::processInterrupts | ( | const Fault & | interrupt | ) |
Processes any an interrupt fault.
Definition at line 778 of file cpu.cc.
References DPRINTF, gem5::NoFault, and trap().
Referenced by gem5::o3::Commit::handleInterrupt().
|
inline |
CPU pushRequest function, forwards request to LSQ.
Definition at line 550 of file cpu.hh.
References gem5::X86ISA::addr, data, flags, iew, gem5::o3::IEW::ldstQueue, and gem5::o3::LSQ::pushRequest().
Referenced by gem5::o3::DynInst::initiateMemAMO(), gem5::o3::DynInst::initiateMemMgmtCmd(), gem5::o3::DynInst::initiateMemRead(), and gem5::o3::DynInst::writeMem().
Reads a misc.
register, including any side effects the read might have as defined by the architecture.
Definition at line 1020 of file cpu.cc.
References cpuStats, isa, and gem5::o3::CPU::CPUStats::miscRegfileReads.
Referenced by gem5::o3::ThreadContext::readMiscReg(), gem5::o3::DynInst::readMiscReg(), and gem5::o3::DynInst::readMiscRegOperand().
Register accessors.
Index refers to the physical register index. Reads a miscellaneous register.
Definition at line 1014 of file cpu.cc.
References isa.
Referenced by gem5::o3::ThreadContext::readMiscRegNoEffect().
|
override |
Register probe points.
Definition at line 305 of file cpu.cc.
References commit, fetch, iew, ppDataAccessComplete, ppInstAccessComplete, gem5::o3::Rename::regProbePoints(), gem5::o3::IEW::regProbePoints(), gem5::o3::Commit::regProbePoints(), gem5::o3::Fetch::regProbePoints(), and rename.
void gem5::o3::CPU::removeFrontInst | ( | const DynInstPtr & | inst | ) |
Remove an instruction from the front end of the list.
There's no restriction on location of the instruction.
Definition at line 1241 of file cpu.cc.
References DPRINTF, removeInstsThisCycle, and removeList.
Referenced by gem5::o3::ROB::retireHead().
void gem5::o3::CPU::removeInstsNotInROB | ( | ThreadID | tid | ) |
Remove all instructions that are not currently in the ROB.
There's also an option to not squash delay slot instructions.
Definition at line 1254 of file cpu.cc.
References DPRINTF, instList, gem5::o3::ROB::isEmpty(), gem5::o3::ROB::readTailInst(), removeInstsThisCycle, rob, and squashInstIt().
Referenced by gem5::o3::Fetch::squash().
void gem5::o3::CPU::removeInstsUntil | ( | const InstSeqNum & | seq_num, |
ThreadID | tid | ||
) |
Remove all instructions younger than the given sequence number.
Definition at line 1298 of file cpu.cc.
References DPRINTF, instList, removeInstsThisCycle, and squashInstIt().
Referenced by gem5::o3::Decode::squash(), and gem5::o3::Fetch::squashFromDecode().
void gem5::o3::CPU::removeThread | ( | ThreadID | tid | ) |
Remove all of a thread's context from CPU.
Definition at line 719 of file cpu.cc.
References gem5::o3::Decode::clearStates(), gem5::o3::IEW::clearStates(), gem5::o3::Rename::clearStates(), gem5::o3::Commit::clearStates(), gem5::o3::Fetch::clearStates(), commit, decode, decodeQueue, DPRINTF, fetch, fetchQueue, gem5::o3::InstructionQueue::getCount(), gem5::o3::LSQ::getCount(), gem5::ArmISA::i, iew, iewQueue, gem5::o3::IEW::instQueue, gem5::o3::ROB::isEmpty(), gem5::o3::IEW::ldstQueue, rename, renameQueue, gem5::o3::Commit::rob, and timeBuffer.
Referenced by haltContext().
void gem5::o3::CPU::scheduleThreadExitEvent | ( | ThreadID | tid | ) |
If a thread is trying to exit and its corresponding trap event has been completed, schedule an event to terminate the thread.
Definition at line 1484 of file cpu.cc.
References exitingThreads, gem5::Event::scheduled(), and threadExitEvent.
Referenced by gem5::o3::Commit::commit().
|
inlineprivate |
Schedule tick event, regardless of its current state.
Definition at line 127 of file cpu.hh.
References gem5::Event::scheduled(), gem5::Event::squashed(), and tickEvent.
Referenced by activateContext().
|
override |
Definition at line 1188 of file cpu.cc.
References commitRenameMap, gem5::o3::UnifiedRenameMap::lookup(), gem5::X86ISA::reg, regFile, gem5::o3::PhysRegFile::setReg(), and gem5::X86ISA::val.
Definition at line 1181 of file cpu.cc.
References commitRenameMap, gem5::o3::UnifiedRenameMap::lookup(), gem5::X86ISA::reg, regFile, gem5::o3::PhysRegFile::setReg(), and gem5::X86ISA::val.
Referenced by gem5::o3::ThreadContext::setRegFlat().
Sets a misc.
register, including any side effects the write might have as defined by the architecture.
Definition at line 1033 of file cpu.cc.
References cpuStats, isa, gem5::o3::CPU::CPUStats::miscRegfileWrites, and gem5::X86ISA::val.
Referenced by gem5::o3::ThreadContext::setMiscReg(), and gem5::o3::DynInst::updateMiscRegs().
Sets a miscellaneous register.
Definition at line 1027 of file cpu.cc.
References isa, and gem5::X86ISA::val.
Referenced by gem5::o3::ThreadContext::setMiscRegNoEffect().
void gem5::o3::CPU::setReg | ( | PhysRegIdPtr | phys_reg, |
const void * | val | ||
) |
Definition at line 1134 of file cpu.cc.
References gem5::CCRegClass, gem5::o3::CPU::CPUStats::ccRegfileWrites, gem5::PhysRegId::classValue(), cpuStats, gem5::FloatRegClass, gem5::o3::CPU::CPUStats::fpRegfileWrites, gem5::IntRegClass, gem5::o3::CPU::CPUStats::intRegfileWrites, regFile, gem5::o3::PhysRegFile::setReg(), gem5::X86ISA::val, gem5::VecElemClass, gem5::VecPredRegClass, gem5::o3::CPU::CPUStats::vecPredRegfileWrites, gem5::VecRegClass, and gem5::o3::CPU::CPUStats::vecRegfileWrites.
void gem5::o3::CPU::setReg | ( | PhysRegIdPtr | phys_reg, |
RegVal | val | ||
) |
Definition at line 1108 of file cpu.cc.
References gem5::CCRegClass, gem5::o3::CPU::CPUStats::ccRegfileWrites, gem5::PhysRegId::classValue(), cpuStats, gem5::FloatRegClass, gem5::o3::CPU::CPUStats::fpRegfileWrites, gem5::IntRegClass, gem5::o3::CPU::CPUStats::intRegfileWrites, regFile, gem5::o3::PhysRegFile::setReg(), gem5::X86ISA::val, gem5::VecElemClass, gem5::VecPredRegClass, gem5::o3::CPU::CPUStats::vecPredRegfileWrites, gem5::VecRegClass, and gem5::o3::CPU::CPUStats::vecRegfileWrites.
Referenced by gem5::o3::DynInst::setRegOperand().
void gem5::o3::CPU::squashFromTC | ( | ThreadID | tid | ) |
Initiates a squash of all in-flight instructions for a given thread.
The source of the squash is an external update of state through the TC.
Definition at line 1207 of file cpu.cc.
References commit, gem5::o3::Commit::generateTCEvent(), and thread.
Referenced by gem5::o3::ThreadContext::conditionalSquash().
Removes the instruction pointed to by the iterator.
Definition at line 1326 of file cpu.cc.
References DPRINTF, and removeList.
Referenced by removeInstsNotInROB(), and removeInstsUntil().
|
override |
Definition at line 525 of file cpu.cc.
References commit, decode, fetch, iew, rename, gem5::o3::Decode::startupStage(), gem5::o3::IEW::startupStage(), gem5::o3::Rename::startupStage(), gem5::o3::Commit::startupStage(), and gem5::o3::Fetch::startupStage().
|
override |
Remove Thread from Active Threads List.
Definition at line 639 of file cpu.cc.
References _status, activeThreads, deactivateThread(), DPRINTF, Idle, lastRunningCycle, and unscheduleTickEvent().
Referenced by gem5::o3::ThreadContext::suspend().
|
override |
Switches out this CPU.
Definition at line 970 of file cpu.cc.
References _status, activityRec, checker, DPRINTF, gem5::ActivityRecorder::reset(), and SwitchedOut.
|
override |
Takes over from another CPU.
Definition at line 984 of file cpu.cc.
References _status, commit, decode, fetch, globalSeqNum, Idle, iew, lastRunningCycle, rename, gem5::Event::scheduled(), gem5::o3::Decode::takeOverFrom(), gem5::o3::IEW::takeOverFrom(), gem5::o3::Rename::takeOverFrom(), gem5::o3::Commit::takeOverFrom(), gem5::o3::Fetch::takeOverFrom(), gem5::takeOverFrom(), and tickEvent.
|
inline |
Returns a pointer to a thread context.
Definition at line 513 of file cpu.hh.
References thread.
Referenced by addThreadToExitingList(), gem5::o3::Fetch::buildInst(), gem5::o3::Commit::clearStates(), exitThreads(), gem5::o3::LSQUnit::getLatestHtmUid(), gem5::o3::LSQUnit::insertLoad(), insertThread(), gem5::o3::LSQUnit::read(), gem5::o3::LSQUnit::squash(), and gem5::o3::LSQUnit::writebackStores().
void gem5::o3::CPU::tick | ( | ) |
Ticks CPU, calling tick() on each stage, and checking the overall activity to see if the CPU should deschedule itself.
Definition at line 449 of file cpu.cc.
References _status, gem5::ActivityRecorder::active(), activityRec, gem5::ActivityRecorder::advance(), cleanUpRemovedInsts(), commit, cpuStats, decode, decodeQueue, DPRINTF, gem5::Drained, fetch, fetchQueue, gem5::FullSystem, Idle, iew, iewQueue, lastRunningCycle, removeInstsThisCycle, rename, renameQueue, gem5::Event::scheduled(), SwitchedOut, gem5::o3::Decode::tick(), gem5::o3::Rename::tick(), gem5::o3::Commit::tick(), gem5::o3::IEW::tick(), gem5::o3::Fetch::tick(), tickEvent, timeBuffer, gem5::o3::CPU::CPUStats::timesIdled, tryDrain(), and updateThreadPriority().
Referenced by CPU().
|
override |
Count the Total Instructions Committed in the CPU.
Definition at line 577 of file cpu.cc.
References gem5::ArmISA::i, thread, and gem5::statistics::total.
|
override |
Count the Total Ops (including micro ops) committed in the CPU.
Definition at line 589 of file cpu.cc.
References gem5::ArmISA::i, thread, and gem5::statistics::total.
void gem5::o3::CPU::trap | ( | const Fault & | fault, |
ThreadID | tid, | ||
const StaticInstPtr & | inst | ||
) |
Traps to handle given fault.
Definition at line 794 of file cpu.cc.
Referenced by gem5::o3::Commit::commitHead(), processInterrupts(), and gem5::o3::DynInst::trap().
|
private |
Check if the pipeline has drained and signal drain done.
This method checks if a drain has been requested and if the CPU has drained successfully (i.e., there are no instructions in the pipeline). If the CPU has drained, it deschedules the tick event and signals the drain manager.
Definition at line 875 of file cpu.cc.
References DPRINTF, gem5::Draining, isCpuDrained(), gem5::Event::scheduled(), and tickEvent.
Referenced by tick().
|
inlineprivate |
Unschedule tick event, regardless of its current state.
Definition at line 137 of file cpu.hh.
References gem5::Event::scheduled(), gem5::Event::squash(), and tickEvent.
Referenced by haltContext(), and suspendContext().
|
override |
void gem5::o3::CPU::updateThreadPriority | ( | ) |
Update The Order In Which We Process Threads.
Definition at line 1443 of file cpu.cc.
References activeThreads.
Referenced by tick().
|
override |
Definition at line 1005 of file cpu.cc.
References fatal, gem5::System::isTimingMode(), and system.
Referenced by drainResume().
void gem5::o3::CPU::wakeCPU | ( | ) |
Wakes the CPU, rescheduling the CPU if it's not already active.
Definition at line 1397 of file cpu.cc.
References gem5::ActivityRecorder::active(), activityRec, cpuStats, DPRINTF, gem5::o3::CPU::CPUStats::idleCycles, lastRunningCycle, gem5::Event::scheduled(), and tickEvent.
Referenced by gem5::o3::InstructionQueue::cacheUnblocked(), gem5::o3::LSQUnit::completeStore(), drain(), gem5::o3::Fetch::finishTranslation(), gem5::o3::Fetch::processCacheCompletion(), gem5::o3::IEW::wakeCPU(), and wakeup().
|
overridevirtual |
Definition at line 1418 of file cpu.cc.
References DPRINTF, gem5::ArmISA::status, gem5::ThreadContext::Suspended, thread, and wakeCPU().
Referenced by gem5::o3::LSQ::DcachePort::recvTimingSnoopReq().
|
friend |
Status gem5::o3::CPU::_status |
Overall CPU status.
Definition at line 115 of file cpu.hh.
Referenced by activateContext(), drainResume(), haltContext(), suspendContext(), switchOut(), takeOverFrom(), and tick().
Active Threads List.
Definition at line 433 of file cpu.hh.
Referenced by activateThread(), deactivateThread(), haltContext(), numActiveThreads(), suspendContext(), and updateThreadPriority().
|
private |
The activity recorder; used to tell if the CPU has any activity remaining or if it can go to idle and deschedule itself.
Definition at line 482 of file cpu.hh.
Referenced by activateContext(), activateStage(), activityThisCycle(), deactivateStage(), drain(), switchOut(), tick(), and wakeCPU().
gem5::Checker<DynInstPtr>* gem5::o3::CPU::checker |
Pointer to the checker, which can dynamically verify instruction results at run time.
This can be set to NULL if it is not being used.
Definition at line 525 of file cpu.hh.
Referenced by gem5::o3::Commit::commitHead(), gem5::o3::Commit::commitInsts(), gem5::o3::DynInst::completeAcc(), gem5::o3::LSQUnit::completeStore(), gem5::o3::Commit::handleInterrupt(), gem5::o3::LSQ::pushRequest(), gem5::o3::IEW::startupStage(), gem5::o3::LSQUnit::storePostSend(), and switchOut().
|
protected |
The commit stage.
Definition at line 415 of file cpu.hh.
Referenced by deactivateThread(), drain(), drainResume(), drainSanityCheck(), htmSendAbortSignal(), init(), insertThread(), isCpuDrained(), pcState(), regProbePoints(), removeThread(), squashFromTC(), startup(), takeOverFrom(), and tick().
|
protected |
The commit rename map.
Definition at line 427 of file cpu.hh.
Referenced by getArchReg(), getWritableArchReg(), and setArchReg().
gem5::o3::CPU::CPUStats gem5::o3::CPU::cpuStats |
Referenced by activateContext(), getReg(), getWritableReg(), instDone(), readMiscReg(), setMiscReg(), setReg(), tick(), and wakeCPU().
std::list<int> gem5::o3::CPU::cpuWaitList |
|
protected |
The decode stage.
Definition at line 406 of file cpu.hh.
Referenced by drainSanityCheck(), isCpuDrained(), removeThread(), startup(), takeOverFrom(), and tick().
TimeBuffer<DecodeStruct> gem5::o3::CPU::decodeQueue |
The decode stage's instruction queue.
Definition at line 469 of file cpu.hh.
Referenced by drain(), removeThread(), and tick().
|
protected |
This is a list of threads that are trying to exit.
Each thread id is mapped to a boolean value denoting whether the thread is ready to exit.
Definition at line 440 of file cpu.hh.
Referenced by addThreadToExitingList(), exitThreads(), isThreadExiting(), and scheduleThreadExitEvent().
|
protected |
The fetch stage.
Definition at line 403 of file cpu.hh.
Referenced by activateContext(), commitDrained(), deactivateThread(), drainResume(), drainSanityCheck(), gem5::o3::ThreadContext::getDecoderPtr(), getInstPort(), isCpuDrained(), regProbePoints(), removeThread(), startup(), takeOverFrom(), and tick().
TimeBuffer<FetchStruct> gem5::o3::CPU::fetchQueue |
The fetch stage's instruction queue.
Definition at line 466 of file cpu.hh.
Referenced by drain(), removeThread(), and tick().
|
protected |
InstSeqNum gem5::o3::CPU::globalSeqNum |
The global sequence number counter.
Definition at line 519 of file cpu.hh.
Referenced by getAndIncrementInstSeq(), and takeOverFrom().
|
protected |
The issue/execute/writeback stages.
Definition at line 412 of file cpu.hh.
Referenced by drainSanityCheck(), getDataPort(), htmSendAbortSignal(), isCpuDrained(), pushRequest(), regProbePoints(), removeThread(), startup(), takeOverFrom(), and tick().
TimeBuffer<IEWStruct> gem5::o3::CPU::iewQueue |
int gem5::o3::CPU::instcount |
Count of total number of dynamic instructions in flight.
Definition at line 378 of file cpu.hh.
Referenced by gem5::o3::DynInst::DynInst(), and gem5::o3::DynInst::~DynInst().
std::list<DynInstPtr> gem5::o3::CPU::instList |
List of all the instructions in flight.
Definition at line 382 of file cpu.hh.
Referenced by addInst(), cleanUpRemovedInsts(), dumpInsts(), gem5::o3::Commit::handleInterrupt(), isCpuDrained(), removeInstsNotInROB(), and removeInstsUntil().
|
protected |
Definition at line 445 of file cpu.hh.
Referenced by gem5::o3::ThreadContext::clearArchRegs(), gem5::o3::ThreadContext::flattenRegId(), gem5::o3::ThreadContext::getIsaPtr(), insertThread(), readMiscReg(), readMiscRegNoEffect(), setMiscReg(), and setMiscRegNoEffect().
Tick gem5::o3::CPU::lastActivatedCycle |
The cycle that the CPU was last activated by a new thread.
Definition at line 540 of file cpu.hh.
Referenced by activateContext().
Cycles gem5::o3::CPU::lastRunningCycle |
The cycle that the CPU was last running, used for statistics.
Definition at line 537 of file cpu.hh.
Referenced by activateContext(), haltContext(), suspendContext(), takeOverFrom(), tick(), and wakeCPU().
BaseMMU* gem5::o3::CPU::mmu |
Definition at line 111 of file cpu.hh.
Referenced by demapPage(), gem5::o3::Fetch::fetchCacheLine(), gem5::o3::ThreadContext::getMMUPtr(), gem5::o3::LSQUnit::getMMUPtr(), and gem5::o3::DynInst::mwaitAtomic().
ProbePointArg<std::pair<DynInstPtr, PacketPtr> >* gem5::o3::CPU::ppDataAccessComplete |
Definition at line 175 of file cpu.hh.
Referenced by gem5::o3::LSQUnit::completeDataAccess(), and regProbePoints().
ProbePointArg<PacketPtr>* gem5::o3::CPU::ppInstAccessComplete |
Definition at line 174 of file cpu.hh.
Referenced by gem5::o3::Fetch::processCacheCompletion(), and regProbePoints().
|
protected |
The register file.
Definition at line 418 of file cpu.hh.
Referenced by getArchReg(), getReg(), getWritableArchReg(), getWritableReg(), setArchReg(), and setReg().
bool gem5::o3::CPU::removeInstsThisCycle |
Records if instructions need to be removed this cycle due to being retired or squashed.
Definition at line 399 of file cpu.hh.
Referenced by cleanUpRemovedInsts(), removeFrontInst(), removeInstsNotInROB(), removeInstsUntil(), and tick().
std::queue<ListIt> gem5::o3::CPU::removeList |
List of all the instructions that will be removed at the end of this cycle.
Definition at line 387 of file cpu.hh.
Referenced by cleanUpRemovedInsts(), isCpuDrained(), removeFrontInst(), and squashInstIt().
|
protected |
The dispatch stage.
Definition at line 409 of file cpu.hh.
Referenced by drainSanityCheck(), isCpuDrained(), regProbePoints(), removeThread(), startup(), takeOverFrom(), and tick().
|
protected |
TimeBuffer<RenameStruct> gem5::o3::CPU::renameQueue |
The rename stage's instruction queue.
Definition at line 472 of file cpu.hh.
Referenced by drain(), removeThread(), and tick().
|
protected |
|
protected |
System* gem5::o3::CPU::system |
Pointer to the system.
Definition at line 528 of file cpu.hh.
Referenced by gem5::o3::Fetch::finishTranslation(), gem5::o3::ThreadContext::getSystemPtr(), insertThread(), and verifyMemoryMode().
std::vector<ThreadState *> gem5::o3::CPU::thread |
Pointers to all of the threads in the CPU.
Definition at line 531 of file cpu.hh.
Referenced by gem5::o3::Fetch::buildInst(), gem5::o3::LSQUnit::checkSnoop(), drainResume(), gem5::o3::Fetch::fetchCacheLine(), htmSendAbortSignal(), init(), instDone(), serializeThread(), squashFromTC(), tcBase(), totalInsts(), totalOps(), unserializeThread(), and wakeup().
|
private |
The exit event used for terminating all ready-to-exit threads.
Definition at line 123 of file cpu.hh.
Referenced by scheduleThreadExitEvent().
std::map<ThreadID, unsigned> gem5::o3::CPU::threadMap |
|
private |
The tick event used for scheduling CPU ticks.
Definition at line 120 of file cpu.hh.
Referenced by drain(), drainResume(), haltContext(), scheduleTickEvent(), takeOverFrom(), tick(), tryDrain(), unscheduleTickEvent(), and wakeCPU().
std::vector<ThreadID> gem5::o3::CPU::tids |
TimeBuffer<TimeStruct> gem5::o3::CPU::timeBuffer |
The main time buffer to do backwards communication.
Definition at line 463 of file cpu.hh.
Referenced by drain(), removeThread(), and tick().