gem5
|
#include <timing.hh>
Classes | |
class | DcachePort |
class | FetchTranslation |
class | IcachePort |
struct | IprEvent |
class | SplitFragmentSenderState |
class | SplitMainSenderState |
class | TimingCPUPort |
A TimingCPUPort overrides the default behaviour of the recvTiming and recvRetry and implements events for the scheduling of handling of incoming packets in the following cycle. More... | |
Public Member Functions | |
TimingSimpleCPU (TimingSimpleCPUParams *params) | |
virtual | ~TimingSimpleCPU () |
void | init () override |
DrainState | drain () override |
void | drainResume () override |
void | switchOut () override |
void | takeOverFrom (BaseCPU *oldCPU) override |
void | verifyMemoryMode () const override |
void | activateContext (ThreadID thread_num) override |
void | suspendContext (ThreadID thread_num) override |
Fault | readMem (Addr addr, uint8_t *data, unsigned size, Request::Flags flags) override |
Fault | initiateMemRead (Addr addr, unsigned size, Request::Flags flags) override |
Fault | writeMem (uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res) override |
void | fetch () |
void | sendFetch (const Fault &fault, RequestPtr req, ThreadContext *tc) |
void | completeIfetch (PacketPtr) |
void | completeDataAccess (PacketPtr pkt) |
void | advanceInst (const Fault &fault) |
bool | isSquashed () const |
This function is used by the page table walker to determine if it could translate the a pending request or if the underlying request has been squashed. More... | |
void | printAddr (Addr a) |
Print state of address in memory system via PrintReq (for debugging). More... | |
void | finishTranslation (WholeTranslationState *state) |
Finish a DTB translation. More... | |
Public Member Functions inherited from BaseSimpleCPU | |
BaseSimpleCPU (BaseSimpleCPUParams *params) | |
virtual | ~BaseSimpleCPU () |
void | wakeup (ThreadID tid) override |
void | init () override |
Addr | dbg_vtophys (Addr addr) |
void | checkForInterrupts () |
void | setupFetchRequest (Request *req) |
void | preExecute () |
void | postExecute () |
void | advancePC (const Fault &fault) |
void | haltContext (ThreadID thread_num) override |
void | regStats () override |
void | resetStats () override |
void | startup () override |
void | countInst () |
Counter | totalInsts () const override |
Counter | totalOps () const override |
void | serializeThread (CheckpointOut &cp, ThreadID tid) const override |
void | unserializeThread (CheckpointIn &cp, ThreadID tid) override |
Protected Member Functions | |
MasterPort & | getDataPort () override |
Return a reference to the data port. More... | |
MasterPort & | getInstPort () override |
Return a reference to the instruction port. More... | |
Protected Member Functions inherited from BaseSimpleCPU | |
void | checkPcEventQueue () |
void | swapActiveThread () |
Private Types | |
typedef EventWrapper < TimingSimpleCPU,&TimingSimpleCPU::fetch > | FetchEvent |
Private Member Functions | |
void | threadSnoop (PacketPtr pkt, ThreadID sender) |
void | sendData (RequestPtr req, uint8_t *data, uint64_t *res, bool read) |
void | sendSplitData (RequestPtr req1, RequestPtr req2, RequestPtr req, uint8_t *data, bool read) |
void | translationFault (const Fault &fault) |
PacketPtr | buildPacket (RequestPtr req, bool read) |
void | buildSplitPacket (PacketPtr &pkt1, PacketPtr &pkt2, RequestPtr req1, RequestPtr req2, RequestPtr req, uint8_t *data, bool read) |
bool | handleReadPacket (PacketPtr pkt) |
bool | handleWritePacket () |
void | updateCycleCounts () |
bool | isDrained () |
Check if a system is in a drained state. More... | |
bool | tryCompleteDrain () |
Try to complete a drain request. More... | |
Private Attributes | |
FetchTranslation | fetchTranslation |
IcachePort | icachePort |
DcachePort | dcachePort |
PacketPtr | ifetch_pkt |
PacketPtr | dcache_pkt |
Cycles | previousCycle |
FetchEvent | fetchEvent |
Additional Inherited Members | |
Static Public Member Functions inherited from BaseCPU | |
static int | numSimulatedInsts () |
static int | numSimulatedOps () |
static void | wakeup (ThreadID tid) |
Public Attributes inherited from BaseSimpleCPU | |
Trace::InstRecord * | traceData |
CheckerCPU * | checker |
std::vector< SimpleExecContext * > | threadInfo |
std::list< ThreadID > | activeThreads |
TheISA::MachInst | inst |
Current instruction. More... | |
StaticInstPtr | curStaticInst |
StaticInstPtr | curMacroStaticInst |
Protected Types inherited from BaseSimpleCPU | |
enum | Status { Idle, Running, Faulting, ITBWaitResponse, IcacheRetry, IcacheWaitResponse, IcacheWaitSwitch, DTBWaitResponse, DcacheRetry, DcacheWaitResponse, DcacheWaitSwitch } |
Protected Attributes inherited from BaseSimpleCPU | |
ThreadID | curThread |
BPredUnit * | branchPred |
Status | _status |
|
private |
TimingSimpleCPU::TimingSimpleCPU | ( | TimingSimpleCPUParams * | params | ) |
Definition at line 80 of file timing.cc.
References BaseSimpleCPU::_status, and BaseSimpleCPU::Idle.
|
override |
Definition at line 203 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::activeThreads, DPRINTF, fetchEvent, BaseSimpleCPU::Idle, BaseSimpleCPU::Running, Event::scheduled(), and BaseSimpleCPU::threadInfo.
void TimingSimpleCPU::advanceInst | ( | const Fault & | fault | ) |
Definition at line 665 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::advancePC(), BaseSimpleCPU::curThread, DPRINTF, BaseSimpleCPU::Faulting, fetch(), fetchEvent, NoFault, BaseSimpleCPU::Running, SimpleExecContext::stayAtPC, BaseSimpleCPU::threadInfo, and tryCompleteDrain().
Referenced by completeDataAccess(), completeIfetch(), sendFetch(), and translationFault().
|
private |
Definition at line 373 of file timing.cc.
References Packet::createRead(), and Packet::createWrite().
Referenced by buildSplitPacket(), and sendData().
|
private |
Definition at line 379 of file timing.cc.
References buildPacket(), Packet::cmd, data, Packet::dataDynamic(), Packet::dataStatic(), Request::getFlags(), Request::getSize(), Request::isMmappedIpr(), Flags< T >::isSet(), Request::NO_ACCESS, MemCmd::responseCommand(), and Packet::senderState.
Referenced by sendSplitData().
void TimingSimpleCPU::completeDataAccess | ( | PacketPtr | pkt | ) |
Definition at line 807 of file timing.cc.
References BaseSimpleCPU::_status, advanceInst(), TimingSimpleCPU::SplitFragmentSenderState::bigPkt, StaticInst::completeAcc(), BaseSimpleCPU::countInst(), BaseSimpleCPU::curStaticInst, BaseSimpleCPU::curThread, BaseSimpleCPU::DcacheWaitResponse, BaseSimpleCPU::DTBWaitResponse, Request::getFlags(), Packet::isError(), Flags< T >::isSet(), Request::NO_ACCESS, NoFault, TimingSimpleCPU::SplitMainSenderState::outstanding, BaseSimpleCPU::postExecute(), Packet::req, BaseSimpleCPU::Running, Packet::senderState, Request::setAccessLatency(), BaseSimpleCPU::threadInfo, BaseSimpleCPU::traceData, and updateCycleCounts().
Referenced by TimingSimpleCPU::DcachePort::DTickEvent::process(), sendData(), and sendSplitData().
void TimingSimpleCPU::completeIfetch | ( | PacketPtr | pkt | ) |
Definition at line 703 of file timing.cc.
References BaseSimpleCPU::_status, advanceInst(), BaseSimpleCPU::countInst(), BaseSimpleCPU::curStaticInst, BaseSimpleCPU::curThread, DPRINTF, DTRACE, StaticInst::execute(), Packet::getAddr(), BaseSimpleCPU::IcacheWaitResponse, StaticInst::initiateAcc(), Packet::isError(), StaticInst::isFirstMicroop(), StaticInst::isMemRef(), StaticInst::isMicroop(), NoFault, BaseSimpleCPU::postExecute(), BaseSimpleCPU::preExecute(), Packet::req, BaseSimpleCPU::Running, Request::setAccessLatency(), BaseSimpleCPU::threadInfo, BaseSimpleCPU::traceData, and updateCycleCounts().
Referenced by fetch(), and TimingSimpleCPU::IcachePort::ITickEvent::process().
|
override |
Definition at line 95 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::activeThreads, DPRINTF, Drained, Draining, fetchEvent, BaseSimpleCPU::Idle, isDrained(), BaseSimpleCPU::Running, and Event::scheduled().
|
override |
Definition at line 119 of file timing.cc.
References BaseSimpleCPU::_status, ThreadContext::Active, BaseSimpleCPU::activeThreads, DPRINTF, fetchEvent, BaseSimpleCPU::Idle, BaseSimpleCPU::Running, Event::scheduled(), ArmISA::system, BaseSimpleCPU::threadInfo, and verifyMemoryMode().
void TimingSimpleCPU::fetch | ( | ) |
Definition at line 591 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::checkForInterrupts(), BaseSimpleCPU::checkPcEventQueue(), completeIfetch(), ThreadState::contextId(), BaseSimpleCPU::curMacroStaticInst, BaseSimpleCPU::curStaticInst, BaseSimpleCPU::curThread, DPRINTF, BaseTLB::Execute, fetchTranslation, SimpleThread::getTC(), Request::getVaddr(), BaseSimpleCPU::IcacheWaitResponse, BaseSimpleCPU::Idle, StaticInst::isDelayedCommit(), isRomMicroPC(), SimpleThread::itb, SimpleThread::pcState(), BaseSimpleCPU::Running, Request::setContext(), BaseSimpleCPU::setupFetchRequest(), BaseSimpleCPU::swapActiveThread(), Request::taskId(), SimpleExecContext::thread, BaseSimpleCPU::threadInfo, and updateCycleCounts().
Referenced by advanceInst().
void TimingSimpleCPU::finishTranslation | ( | WholeTranslationState * | state | ) |
Finish a DTB translation.
state | The DTB translation state. |
Definition at line 565 of file timing.cc.
References BaseSimpleCPU::_status, WholeTranslationState::data, WholeTranslationState::deleteReqs(), WholeTranslationState::getFault(), WholeTranslationState::isPrefetch(), WholeTranslationState::isSplit, WholeTranslationState::mainReq, WholeTranslationState::mode, NoFault, BaseTLB::Read, WholeTranslationState::res, BaseSimpleCPU::Running, sendData(), sendSplitData(), WholeTranslationState::setNoFault(), WholeTranslationState::sreqHigh, WholeTranslationState::sreqLow, and translationFault().
|
inlineoverrideprotected |
Return a reference to the data port.
Definition at line 263 of file timing.hh.
References dcachePort.
|
inlineoverrideprotected |
Return a reference to the instruction port.
Definition at line 266 of file timing.hh.
References icachePort.
|
private |
Definition at line 253 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::curThread, dcache_pkt, dcachePort, BaseSimpleCPU::DcacheRetry, BaseSimpleCPU::DcacheWaitResponse, SimpleThread::getTC(), GenericISA::handleIprRead(), AlphaISA::handleLockedRead(), Request::isLLSC(), Request::isMmappedIpr(), Packet::isRead(), Packet::req, MasterPort::sendTimingReq(), SimpleExecContext::thread, and BaseSimpleCPU::threadInfo.
Referenced by TimingSimpleCPU::DcachePort::recvReqRetry(), sendData(), and sendSplitData().
|
private |
Definition at line 470 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::curThread, dcache_pkt, dcachePort, BaseSimpleCPU::DcacheRetry, BaseSimpleCPU::DcacheWaitResponse, SimpleThread::getTC(), GenericISA::handleIprWrite(), Request::isMmappedIpr(), Packet::req, MasterPort::sendTimingReq(), SimpleExecContext::thread, and BaseSimpleCPU::threadInfo.
Referenced by TimingSimpleCPU::DcachePort::recvReqRetry(), sendData(), and sendSplitData().
|
override |
Definition at line 68 of file timing.cc.
References BaseSimpleCPU::init().
|
overridevirtual |
Implements BaseSimpleCPU.
Definition at line 419 of file timing.cc.
References BaseSimpleCPU::_status, ArmISA::asid, ThreadState::contextId(), BaseSimpleCPU::curThread, SimpleThread::dtb, BaseSimpleCPU::DTBWaitResponse, SimpleThread::getTC(), SimpleThread::instAddr(), Request::isLLSC(), Request::isSwap(), ArmISA::mode, NoFault, pc, BaseTLB::Read, roundDown(), Trace::InstRecord::setMem(), Request::splitOnVaddr(), Request::taskId(), SimpleExecContext::thread, BaseSimpleCPU::threadInfo, and BaseSimpleCPU::traceData.
|
inlineprivate |
Check if a system is in a drained state.
We need to drain if:
We are in the middle of a microcode sequence as some CPUs (e.g., HW accelerated CPUs) can't be started in the middle of a gem5 microcode sequence.
Stay at PC is true.
Definition at line 345 of file timing.hh.
References BaseSimpleCPU::curThread, fetchEvent, SimpleThread::microPC(), Event::scheduled(), SimpleExecContext::stayAtPC, SimpleExecContext::thread, and BaseSimpleCPU::threadInfo.
Referenced by drain(), and tryCompleteDrain().
|
inline |
This function is used by the page table walker to determine if it could translate the a pending request or if the underlying request has been squashed.
This always returns false for the simple timing CPU as it never executes any instructions speculatively. @ return Is the current instruction squashed?
void TimingSimpleCPU::printAddr | ( | Addr | a | ) |
Print state of address in memory system via PrintReq (for debugging).
Definition at line 999 of file timing.cc.
References dcachePort, and MasterPort::printAddr().
|
overridevirtual |
|
private |
Definition at line 282 of file timing.cc.
References BaseSimpleCPU::_status, buildPacket(), TimingSimpleCPU::DcachePort::cacheBlockMask, completeDataAccess(), BaseSimpleCPU::curThread, data, Packet::dataDynamic(), dcache_pkt, dcachePort, BaseSimpleCPU::DcacheWaitResponse, Request::getFlags(), AlphaISA::handleLockedWrite(), handleReadPacket(), handleWritePacket(), Request::isCondSwap(), Request::isLLSC(), Flags< T >::isSet(), Packet::makeResponse(), Request::NO_ACCESS, Request::setExtraData(), SimpleExecContext::thread, BaseSimpleCPU::threadInfo, and threadSnoop().
Referenced by finishTranslation().
void TimingSimpleCPU::sendFetch | ( | const Fault & | fault, |
RequestPtr | req, | ||
ThreadContext * | tc | ||
) |
Definition at line 633 of file timing.cc.
References BaseSimpleCPU::_status, advanceInst(), DPRINTF, Request::getPaddr(), Request::getVaddr(), icachePort, BaseSimpleCPU::IcacheRetry, BaseSimpleCPU::IcacheWaitResponse, ifetch_pkt, BaseSimpleCPU::inst, NoFault, MemCmd::ReadReq, BaseSimpleCPU::Running, MasterPort::sendTimingReq(), and updateCycleCounts().
Referenced by TimingSimpleCPU::FetchTranslation::finish().
|
private |
Definition at line 318 of file timing.cc.
References buildSplitPacket(), TimingSimpleCPU::SplitFragmentSenderState::clearFromParent(), completeDataAccess(), dcache_pkt, Request::getFlags(), handleReadPacket(), handleWritePacket(), Flags< T >::isSet(), Packet::makeResponse(), Request::NO_ACCESS, and Packet::senderState.
Referenced by finishTranslation().
|
override |
Definition at line 227 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::activeThreads, DPRINTF, fetchEvent, BaseSimpleCPU::Idle, BaseSimpleCPU::Running, Event::scheduled(), and BaseSimpleCPU::threadInfo.
|
override |
Definition at line 169 of file timing.cc.
References BaseSimpleCPU::_status, BaseSimpleCPU::curThread, fetchEvent, BaseSimpleCPU::Idle, M5_VAR_USED, BaseSimpleCPU::Running, Event::scheduled(), SimpleExecContext::stayAtPC, SimpleExecContext::thread, BaseSimpleCPU::threadInfo, and updateCycleCounts().
|
override |
Definition at line 186 of file timing.cc.
References previousCycle, and takeOverFrom().
Definition at line 551 of file timing.cc.
References TimingSimpleCPU::DcachePort::cacheBlockMask, dcachePort, AlphaISA::handleLockedSnoop(), BaseSimpleCPU::threadInfo, and BaseSimpleCPU::wakeup().
Referenced by sendData().
|
private |
Definition at line 355 of file timing.cc.
References advanceInst(), BaseSimpleCPU::postExecute(), BaseSimpleCPU::traceData, and updateCycleCounts().
Referenced by finishTranslation().
|
private |
Try to complete a drain request.
Definition at line 153 of file timing.cc.
References DPRINTF, Draining, and isDrained().
Referenced by advanceInst().
|
private |
Definition at line 867 of file timing.cc.
References previousCycle.
Referenced by completeDataAccess(), completeIfetch(), fetch(), sendFetch(), switchOut(), and translationFault().
|
override |
Definition at line 194 of file timing.cc.
References fatal, and ArmISA::system.
Referenced by drainResume().
|
overridevirtual |
Implements BaseSimpleCPU.
Definition at line 492 of file timing.cc.
References BaseSimpleCPU::_status, ArmISA::asid, Request::CACHE_BLOCK_ZERO, ThreadState::contextId(), BaseSimpleCPU::curThread, SimpleThread::dtb, BaseSimpleCPU::DTBWaitResponse, SimpleThread::getTC(), SimpleThread::instAddr(), Request::isLLSC(), Request::isSwap(), ArmISA::mode, NoFault, pc, roundDown(), Trace::InstRecord::setMem(), X86ISA::size(), Request::splitOnVaddr(), Request::taskId(), SimpleExecContext::thread, BaseSimpleCPU::threadInfo, BaseSimpleCPU::traceData, and BaseTLB::Write.
|
private |
Definition at line 256 of file timing.hh.
Referenced by handleReadPacket(), handleWritePacket(), TimingSimpleCPU::DcachePort::recvReqRetry(), sendData(), and sendSplitData().
|
private |
Definition at line 253 of file timing.hh.
Referenced by getDataPort(), handleReadPacket(), handleWritePacket(), printAddr(), sendData(), and threadSnoop().
|
private |
Definition at line 319 of file timing.hh.
Referenced by activateContext(), advanceInst(), drain(), drainResume(), isDrained(), suspendContext(), and switchOut().
|
private |
|
private |
Definition at line 252 of file timing.hh.
Referenced by getInstPort(), and sendFetch().
|
private |
Definition at line 255 of file timing.hh.
Referenced by TimingSimpleCPU::IcachePort::recvReqRetry(), and sendFetch().
|
private |
Definition at line 258 of file timing.hh.
Referenced by takeOverFrom(), and updateCycleCounts().