Go to the documentation of this file.
42 #ifndef __CPU_O3_FETCH_IMPL_HH__
43 #define __CPU_O3_FETCH_IMPL_HH__
52 #include "arch/utility.hh"
55 #include "config/the_isa.hh"
61 #include "debug/Activity.hh"
62 #include "debug/Drain.hh"
63 #include "debug/Fetch.hh"
64 #include "debug/O3CPU.hh"
65 #include "debug/O3PipeView.hh"
67 #include "params/DerivO3CPU.hh"
79 : fetchPolicy(params->smtFetchPolicy),
82 decodeToFetchDelay(params->decodeToFetchDelay),
83 renameToFetchDelay(params->renameToFetchDelay),
84 iewToFetchDelay(params->iewToFetchDelay),
85 commitToFetchDelay(params->commitToFetchDelay),
86 fetchWidth(params->fetchWidth),
87 decodeWidth(params->decodeWidth),
90 cacheBlkSize(cpu->cacheLineSize()),
91 fetchBufferSize(params->fetchBufferSize),
92 fetchBufferMask(fetchBufferSize - 1),
93 fetchQueueSize(params->fetchQueueSize),
94 numThreads(params->numThreads),
95 numFetchingThreads(params->smtNumFetchingThreads),
96 icachePort(this, _cpu),
97 finishTranslationEvent(this), fetchStats(_cpu, this)
100 fatal(
"numThreads (%d) is larger than compiled limit (%d),\n"
101 "\tincrease MaxThreads in src/cpu/o3/impl.hh\n",
102 numThreads,
static_cast<int>(Impl::MaxThreads));
104 fatal(
"fetchWidth (%d) is larger than compiled limit (%d),\n"
105 "\tincrease MaxWidth in src/cpu/o3/impl.hh\n",
106 fetchWidth,
static_cast<int>(Impl::MaxWidth));
108 fatal(
"fetch buffer size (%u bytes) is greater than the cache "
111 fatal(
"cache block (%u bytes) is not a multiple of the "
116 "Invalid Fetch Policy for a SMT workload.");
121 for (
int i = 0;
i < Impl::MaxThreads;
i++) {
140 decoder[tid] =
new TheISA::Decoder(
141 dynamic_cast<TheISA::ISA *
>(params->isa[tid]));
148 template <
class Impl>
152 return cpu->name() +
".fetch";
155 template <
class Impl>
165 template <
class Impl>
168 :
Stats::Group(cpu,
"fetch"),
170 "Number of cycles fetch is stalled on an Icache miss"),
171 ADD_STAT(insts,
"Number of instructions fetch has processed"),
172 ADD_STAT(branches,
"Number of branches that fetch encountered"),
174 "Number of branches that fetch has predicted taken"),
176 "Number of cycles fetch has run and was not squashing or blocked"),
177 ADD_STAT(squashCycles,
"Number of cycles fetch has spent squashing"),
179 "Number of cycles fetch has spent waiting for tlb"),
180 ADD_STAT(idleCycles,
"Number of cycles fetch was idle"),
181 ADD_STAT(blockedCycles,
"Number of cycles fetch has spent blocked"),
183 "Number of cycles fetch has spent waiting on interrupts,"
184 "or bad addresses, or out of MSHRs"),
186 "Number of cycles fetch has spent waiting on pipes to drain"),
188 "Number of stall cycles due to no active thread to fetch from"),
190 "Number of stall cycles due to pending traps"),
192 "Number of stall cycles due to pending quiesce instructions"),
193 ADD_STAT(icacheWaitRetryStallCycles,
194 "Number of stall cycles due to full MSHR"),
195 ADD_STAT(cacheLines,
"Number of cache lines fetched"),
197 "Number of outstanding Icache misses that were squashed"),
199 "Number of outstanding ITLB misses that were squashed"),
201 "Number of instructions fetched each cycle (Total)"),
202 ADD_STAT(idleRate,
"Percent of cycles fetch was idle",
203 idleCycles * 100 / cpu->numCycles),
204 ADD_STAT(branchRate,
"Number of branch fetches per cycle",
205 branches / cpu->numCycles),
206 ADD_STAT(rate,
"Number of inst fetches per cycle",
207 insts / cpu->numCycles)
302 pc[tid] =
cpu->pcState(tid);
330 pc[tid] =
cpu->pcState(tid);
358 DPRINTF(Fetch,
"[tid:%i] Waking up from cache miss.\n", tid);
359 assert(!
cpu->switchedOut());
377 DPRINTF(Activity,
"[tid:%i] Activating fetch due to cache completion\n",
389 pkt->
req->setAccessLatency();
390 cpu->ppInstAccessComplete->notify(pkt);
396 template <
class Impl>
406 template <
class Impl>
424 template <
class Impl>
455 template <
class Impl>
459 assert(
cpu->getInstPort().isConnected());
464 template <
class Impl>
468 assert(
cpu->isDraining());
469 assert(!
stalls[tid].drain);
470 DPRINTF(Drain,
"%i: Thread drained.\n", tid);
474 template <
class Impl>
478 DPRINTF(Fetch,
"Waking up from quiesce\n");
484 template <
class Impl>
489 DPRINTF(Activity,
"Activating stage.\n");
491 cpu->activateStage(O3CPU::FetchIdx);
497 template <
class Impl>
502 DPRINTF(Activity,
"Deactivating stage.\n");
504 cpu->deactivateStage(O3CPU::FetchIdx);
510 template <
class Impl>
521 template <
class Impl>
531 if (!inst->isControl()) {
533 inst->setPredTarg(nextPC);
534 inst->setPredTaken(
false);
543 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Branch at PC %#x "
544 "predicted to be taken to %s\n",
545 tid, inst->seqNum, inst->pcState().instAddr(), nextPC);
547 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Branch at PC %#x "
548 "predicted to be not taken\n",
549 tid, inst->seqNum, inst->pcState().instAddr());
552 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Branch at PC %#x "
553 "predicted to go to %s\n",
554 tid, inst->seqNum, inst->pcState().instAddr(), nextPC);
555 inst->setPredTarg(nextPC);
556 inst->setPredTaken(predict_taken);
564 return predict_taken;
567 template <
class Impl>
573 assert(!
cpu->switchedOut());
578 DPRINTF(Fetch,
"[tid:%i] Can't fetch cache line, cache blocked\n",
586 DPRINTF(Fetch,
"[tid:%i] Can't fetch cache line, interrupt pending\n",
594 DPRINTF(Fetch,
"[tid:%i] Fetching cache line %#x for addr %#x\n",
595 tid, fetchBufferBlockPC,
vaddr);
600 RequestPtr mem_req = std::make_shared<Request>(
603 cpu->thread[tid]->contextId());
605 mem_req->taskId(
cpu->taskId());
612 cpu->itb->translateTiming(mem_req,
cpu->thread[tid]->getTC(),
617 template <
class Impl>
622 ThreadID tid =
cpu->contextToThread(mem_req->contextId());
623 Addr fetchBufferBlockPC = mem_req->getVaddr();
625 assert(!
cpu->switchedOut());
631 mem_req->getVaddr() !=
memReq[tid]->getVaddr()) {
632 DPRINTF(Fetch,
"[tid:%i] Ignoring itlb completed after squash\n",
644 if (!
cpu->system->isMemAddr(mem_req->getPaddr())) {
645 warn(
"Address %#x is outside of physical memory, stopping fetch\n",
646 mem_req->getPaddr());
658 DPRINTF(Fetch,
"Fetch: Doing instruction read.\n");
666 DPRINTF(Fetch,
"[tid:%i] Out of MSHRs!\n", tid);
673 DPRINTF(Fetch,
"[tid:%i] Doing Icache access.\n", tid);
674 DPRINTF(Activity,
"[tid:%i] Activity: Waiting on I-cache "
692 DPRINTF(Fetch,
"[tid:%i] Got back req with addr %#x but expected %#x\n",
693 tid, mem_req->getVaddr(),
memReq[tid]->getVaddr());
702 DPRINTF(Fetch,
"[tid:%i] Translation faulted, building noop.\n", tid);
705 NULL, fetchPC, fetchPC,
false);
706 instruction->setNotAnInst();
708 instruction->setPredTarg(fetchPC);
709 instruction->fault = fault;
712 DPRINTF(Activity,
"Activity this cycle.\n");
713 cpu->activityThisCycle();
717 DPRINTF(Fetch,
"[tid:%i] Blocked, need to handle the trap.\n", tid);
718 DPRINTF(Fetch,
"[tid:%i] fault (%s) detected @ PC %s.\n",
719 tid, fault->name(),
pc[tid]);
724 template <
class Impl>
729 DPRINTF(Fetch,
"[tid:%i] Squashing, setting PC to: %s.\n",
734 if (squashInst && squashInst->pcState().instAddr() == newPC.instAddr())
735 macroop[tid] = squashInst->macroop;
742 DPRINTF(Fetch,
"[tid:%i] Squashing outstanding Icache miss.\n",
746 DPRINTF(Fetch,
"[tid:%i] Squashing outstanding ITLB miss.\n",
782 DPRINTF(Fetch,
"[tid:%i] Squashing from decode.\n", tid);
788 cpu->removeInstsUntil(seq_num, tid);
795 bool ret_val =
false;
798 assert(
cpu->isDraining());
799 DPRINTF(Fetch,
"[tid:%i] Drain stall detected.\n",tid);
814 while (threads != end) {
822 DPRINTF(Activity,
"[tid:%i] Activating stage.\n",tid);
825 DPRINTF(Activity,
"[tid:%i] Activating fetch due to cache"
829 cpu->activateStage(O3CPU::FetchIdx);
838 DPRINTF(Activity,
"Deactivating stage.\n");
840 cpu->deactivateStage(O3CPU::FetchIdx);
846 template <
class Impl>
852 DPRINTF(Fetch,
"[tid:%i] Squash from commit.\n", tid);
857 cpu->removeInstsNotInROB(tid);
860 template <
class Impl>
866 bool status_change =
false;
874 while (threads != end) {
880 status_change = status_change || updated_status;
883 DPRINTF(Fetch,
"Running stage.\n");
886 if (
fromCommit->commitInfo[0].interruptPending) {
890 if (
fromCommit->commitInfo[0].clearInterrupt) {
898 fetch(status_change);
918 unsigned insts_to_decode = 0;
919 unsigned available_insts = 0;
922 if (!
stalls[tid].decode) {
931 while (available_insts != 0 && insts_to_decode <
decodeWidth) {
936 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Sending instruction to decode "
937 "from fetch queue. Fetch queue size: %i.\n",
954 DPRINTF(Activity,
"Activity this cycle.\n");
955 cpu->activityThisCycle();
962 template <
class Impl>
972 assert(
stalls[tid].decode);
980 DPRINTF(Fetch,
"[tid:%i] Squashing instructions due to squash "
981 "from commit.\n",tid);
990 if (
fromCommit->commitInfo[tid].mispredictInst &&
991 fromCommit->commitInfo[tid].mispredictInst->isControl()) {
1002 }
else if (
fromCommit->commitInfo[tid].doneSeqNum) {
1010 DPRINTF(Fetch,
"[tid:%i] Squashing instructions due to squash "
1011 "from decode.\n",tid);
1014 if (
fromDecode->decodeInfo[tid].branchMispredict) {
1026 DPRINTF(Fetch,
"Squashing from decode with PC = %s\n",
1043 DPRINTF(Fetch,
"[tid:%i] Setting to blocked\n",tid);
1054 DPRINTF(Fetch,
"[tid:%i] Done squashing, switching to running.\n",
1067 template<
class Impl>
1068 typename Impl::DynInstPtr
1078 new DynInst(staticInst, curMacroop, thisPC, nextPC, seq,
cpu);
1079 instruction->setTid(tid);
1081 instruction->setThreadState(
cpu->thread[tid]);
1083 DPRINTF(Fetch,
"[tid:%i] Instruction PC %#x (%d) created "
1084 "[sn:%lli].\n", tid, thisPC.instAddr(),
1085 thisPC.microPC(), seq);
1087 DPRINTF(Fetch,
"[tid:%i] Instruction is: %s\n", tid,
1088 instruction->staticInst->
1089 disassemble(thisPC.instAddr()));
1093 instruction->traceData =
1094 cpu->getTracer()->getInstRecord(
curTick(),
cpu->tcBase(tid),
1095 instruction->staticInst, thisPC, curMacroop);
1098 instruction->traceData = NULL;
1102 instruction->setInstListIt(
cpu->addInst(instruction));
1109 DPRINTF(Fetch,
"[tid:%i] Fetch queue entry created (%i/%i).\n",
1119 template<
class Impl>
1128 assert(!
cpu->switchedOut());
1141 DPRINTF(Fetch,
"Attempting to fetch from [tid:%i]\n", tid);
1155 DPRINTF(Fetch,
"[tid:%i] Icache miss is complete.\n", tid);
1158 status_change =
true;
1168 DPRINTF(Fetch,
"[tid:%i] Attempting to translate and read "
1169 "instruction, starting at PC %s.\n", tid, thisPC);
1185 DPRINTF(Fetch,
"[tid:%i] Fetch is stalled!\n", tid);
1191 DPRINTF(Fetch,
"[tid:%i] Fetch is idle!\n", tid);
1209 DPRINTF(Fetch,
"[tid:%i] Adding instructions to queue to "
1214 bool predictedBranch =
false;
1229 && !predictedBranch && !
quiesce) {
1233 bool needMem = !inRom && !curMacroop &&
1245 if (blkOffset >= numInsts) {
1251 decoder[tid]->moreBytes(thisPC, fetchAddr, cacheInsts[blkOffset]);
1253 if (
decoder[tid]->needMoreBytes()) {
1263 if (!(curMacroop || inRom)) {
1264 if (
decoder[tid]->instReady()) {
1265 staticInst =
decoder[tid]->decode(thisPC);
1271 curMacroop = staticInst;
1284 bool newMacro =
false;
1285 if (curMacroop || inRom) {
1287 staticInst =
decoder[tid]->fetchRomMicroop(
1288 thisPC.microPC(), curMacroop);
1290 staticInst = curMacroop->
fetchMicroop(thisPC.microPC());
1297 thisPC, nextPC,
true);
1303 if (
DTRACE(O3PipeView)) {
1304 instruction->fetchTick =
curTick();
1312 predictedBranch |= thisPC.branching();
1315 if (predictedBranch) {
1316 DPRINTF(Fetch,
"Branch detected with PC = %s\n", thisPC);
1319 newMacro |= thisPC.instAddr() != nextPC.instAddr();
1332 if (instruction->isQuiesce()) {
1334 "Quiesce instruction encountered, halting fetch!\n");
1336 status_change =
true;
1340 }
while ((curMacroop ||
decoder[tid]->instReady()) &&
1349 if (predictedBranch) {
1350 DPRINTF(Fetch,
"[tid:%i] Done fetching, predicted branch "
1351 "instruction encountered.\n", tid);
1353 DPRINTF(Fetch,
"[tid:%i] Done fetching, reached fetch bandwidth "
1354 "for this cycle.\n", tid);
1356 DPRINTF(Fetch,
"[tid:%i] Done fetching, reached the end of the"
1357 "fetch buffer.\n", tid);
1381 template<
class Impl>
1412 template<
class Impl>
1418 case FetchPolicy::RoundRobin:
1420 case FetchPolicy::IQCount:
1422 case FetchPolicy::LSQCount:
1424 case FetchPolicy::Branch:
1448 template<
class Impl>
1457 while (pri_iter != end) {
1458 high_pri = *pri_iter;
1478 template<
class Impl>
1483 std::priority_queue<unsigned,vector<unsigned>,
1484 std::greater<unsigned> > PQ;
1485 std::map<unsigned, ThreadID> threadMap;
1490 while (threads != end) {
1500 while (!PQ.empty()) {
1501 ThreadID high_pri = threadMap[PQ.top()];
1515 template<
class Impl>
1520 std::priority_queue<unsigned,vector<unsigned>,
1521 std::greater<unsigned> > PQ;
1522 std::map<unsigned, ThreadID> threadMap;
1527 while (threads != end) {
1529 unsigned ldstqCount =
fromIEW->iewInfo[tid].ldstqCount;
1533 PQ.push(ldstqCount);
1534 threadMap[ldstqCount] = tid;
1537 while (!PQ.empty()) {
1538 ThreadID high_pri = threadMap[PQ.top()];
1551 template<
class Impl>
1555 panic(
"Branch Count Fetch policy unimplemented\n");
1559 template<
class Impl>
1582 DPRINTF(Fetch,
"[tid:%i] Issuing a pipelined I-cache access, "
1583 "starting at PC %s.\n", tid, thisPC);
1589 template<
class Impl>
1592 DPRINTF(Fetch,
"There are no more threads available to fetch from.\n");
1598 DPRINTF(Fetch,
"Fetch is waiting for a drain!\n");
1601 DPRINTF(Fetch,
"Fetch has no active thread!\n");
1604 DPRINTF(Fetch,
"[tid:%i] Fetch is blocked!\n", tid);
1607 DPRINTF(Fetch,
"[tid:%i] Fetch is squashing!\n", tid);
1610 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting cache response!\n",
1614 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting ITLB walk to "
1618 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting for a pending trap!\n",
1622 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting for a pending quiesce "
1623 "instruction!\n", tid);
1626 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting for an I-cache retry!\n",
1629 DPRINTF(Fetch,
"[tid:%i] Fetch predicted non-executable address\n",
1632 DPRINTF(Fetch,
"[tid:%i] Unexpected fetch stall reason "
1638 template<
class Impl>
1644 assert(pkt->
req->isUncacheable() ||
1646 fetch->processCacheCompletion(pkt);
1651 template<
class Impl>
1655 fetch->recvReqRetry();
1658 #endif//__CPU_O3_FETCH_IMPL_HH__
Stats::Scalar cycles
Stat for total number of cycles spent fetching.
const ThreadID InvalidThreadID
void switchToActive()
Changes the status of this stage to active, and indicates this to the CPU.
#define fatal(...)
This implements a cprintf based fatal() function.
bool scheduled() const
Determine if the current event is scheduled.
Stats::Scalar pendingQuiesceStallCycles
Total number of stall cycles caused by pending quiesce instructions.
StaticInstPtr macroop[Impl::MaxThreads]
void setReq(const RequestPtr &_req)
ThreadID getFetchingThread()
Returns the appropriate thread to fetch, given the fetch policy.
Cycles commitToFetchDelay
Commit to fetch delay.
bool cacheResponding() const
Addr fetchBufferAlignPC(Addr addr)
Align a PC to the start of a fetch buffer block.
Stats::Scalar tlbSquashes
Total number of outstanding tlb accesses that were dropped due to a squash.
void switchToInactive()
Changes the status of this stage to inactive, and indicates this to the CPU.
FinishTranslationEvent finishTranslationEvent
Event used to delay fault generation of translation faults.
Stats::Scalar predictedBranches
Stat for total number of predicted branches.
int16_t ThreadID
Thread index/ID type.
Addr fetchOffset[Impl::MaxThreads]
FetchStatus
Overall fetch status.
void takeOverFrom()
Takes over from another CPU's thread.
Stats::Scalar pendingTrapStallCycles
Total number of stall cycles caused by pending traps.
void regProbePoints()
Registers probes.
DefaultFetch::FetchStatGroup fetchStats
FetchPolicy fetchPolicy
Fetch policy.
void squashFromDecode(const TheISA::PCState &newPC, const DynInstPtr squashInst, const InstSeqNum seq_num, ThreadID tid)
Squashes a specific thread and resets the PC.
unsigned decodeWidth
The width of decode in instructions.
std::shared_ptr< Request > RequestPtr
bool fetchBufferValid[Impl::MaxThreads]
Whether or not the fetch buffer data is valid.
RequestPtr req
A pointer to the original request.
void drainSanityCheck() const
Perform sanity checks after a drain.
unsigned int cacheBlkSize
Cache block size.
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
Addr fetchBufferPC[Impl::MaxThreads]
The PC of the first instruction loaded into the fetch buffer.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Stats::Scalar cacheLines
Stat for total number of fetched cache lines.
Stats::Formula branchRate
Number of branch fetches per cycle.
void notify(const Arg &arg)
called at the ProbePoint call site, passes arg to each listener.
TimeBuffer< TimeStruct >::wire fromIEW
Wire to get iew's information from backwards time buffer.
void deactivateThread(ThreadID tid)
For priority-based fetch policies, need to keep update priorityList.
ThreadID numFetchingThreads
Number of threads that are actively fetching.
void update(const InstSeqNum &done_sn, ThreadID tid)
Tells the branch predictor to commit any updates until the given sequence number.
Stats::Scalar noActiveThreadStallCycles
Total number of stall cycles caused by no active threads to run.
void advancePC(PCState &pc, const StaticInstPtr &inst)
void tick()
Ticks the fetch stage, processing all inputs signals and fetching as many instructions as possible.
TheISA::Decoder * decoder[Impl::MaxThreads]
The decoder.
ThreadID roundRobin()
Returns the appropriate thread to fetch using a round robin policy.
bool wroteToTimeBuffer
Variable that tracks if fetch has written to the time buffer this cycle.
@ INST_FETCH
The request was an instruction fetch.
int instSize
Size of instructions.
void wakeFromQuiesce()
Tells fetch to wake up from a quiesce instruction.
void pipelineIcacheAccesses(ThreadID tid)
Pipeline the next I-cache access to the current one.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
void resetStage()
Reset this pipeline stage.
RequestPtr memReq[Impl::MaxThreads]
Memory request used to access cache.
Stats::Scalar squashCycles
Stat for total number of cycles spent squashing.
ThreadID retryTid
The thread that is waiting on the cache to tell fetch to retry.
void doSquash(const TheISA::PCState &newPC, const DynInstPtr squashInst, ThreadID tid)
Squashes a specific thread and resets the PC.
ThreadID lsqCount()
Returns the appropriate thread to fetch using the LSQ count policy.
bool isDrained() const
Has the stage drained?
IcachePort icachePort
Instruction port.
TimeBuffer< TimeStruct >::wire fromDecode
Wire to get decode's information from backwards time buffer.
Stats::Scalar insts
Stat for total number of fetched instructions.
bool fetchCacheLine(Addr vaddr, ThreadID tid, Addr pc)
Fetches the cache line that contains the fetch PC.
Stats::Scalar miscStallCycles
Total number of cycles spent in any other state.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to list of active threads.
ThreadID branchCount()
Returns the appropriate thread to fetch using the branch count policy.
std::string name() const
Returns the name of fetch.
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
bool issuePipelinedIfetch[Impl::MaxThreads]
Set to true if a pipelined I-cache request should be issued.
void recvReqRetry()
Handles retrying the fetch access.
Cycles decodeToFetchDelay
Decode to fetch delay.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
std::shared_ptr< FaultBase > Fault
void setFetchQueue(TimeBuffer< FetchStruct > *fq_ptr)
Sets pointer to time buffer used to communicate to the next stage.
Cycles iewToFetchDelay
IEW to fetch delay.
void startupStage()
Initialize stage.
TimeBuffer< TimeStruct > * timeBuffer
Time buffer interface.
Cycles renameToFetchDelay
Rename to fetch delay.
bool cacheBlocked
Is the cache blocked? If so no threads can access it.
bool checkSignalsAndUpdate(ThreadID tid)
Checks all input signals and updates the status as necessary.
Stats::Scalar branches
Total number of fetched branches.
void drainSanityCheck() const
Perform sanity checks after a drain.
Stats::Scalar blockedCycles
Total number of cycles spent blocked.
Stats::Formula rate
Number of instruction fetched per cycle.
constexpr decltype(nullptr) NoFault
DynInstPtr buildInst(ThreadID tid, StaticInstPtr staticInst, StaticInstPtr curMacroop, TheISA::PCState thisPC, TheISA::PCState nextPC, bool trace)
Stats::Distribution nisnDist
Distribution of number of instructions fetched each cycle.
void drainStall(ThreadID tid)
Stall the fetch stage after reaching a safe drain point.
ProbePointArg< PacketInfo > Packet
Packet probe point.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
FetchStatus updateFetchStatus()
Updates overall fetch stage status; to be called at the end of each cycle.
ProbePointArg< RequestPtr > * ppFetchRequestSent
To probe when a fetch request is successfully sent.
DefaultFetch class handles both single threaded and SMT fetch.
bool delayedCommit[Impl::MaxThreads]
Can the fetch stage redirect from an interrupt on this instruction?
static bool isRomMicroPC(MicroPC upc)
Stats::Scalar pendingDrainCycles
Total number of cycles spent in waiting for drains.
ProbePointArg< DynInstPtr > * ppFetch
Probe points.
bool lookupAndUpdateNextPC(const DynInstPtr &inst, TheISA::PCState &pc)
Looks up in the branch predictor to see if the next PC should be either next PC+=MachInst or a branch...
TimeBuffer< FetchStruct >::wire toDecode
Wire used to write any information heading to decode.
unsigned fetchWidth
The width of fetch in instructions.
void setFault(Fault _fault)
Stats::Scalar idleCycles
Stat for total number of cycles spent blocked due to other stages in the pipeline.
FetchStatGroup(O3CPU *cpu, DefaultFetch *fetch)
std::list< ThreadID > priorityList
List that has the threads organized by priority.
bool interruptPending
Checks if there is an interrupt pending.
void fetch(bool &status_change)
Does the actual fetching of instructions and passing them on to the next stage.
bool isLastMicroop() const
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
virtual void recvReqRetry()
Handles doing a retry of a failed fetch.
void quiesce(ThreadContext *tc)
void profileStall(ThreadID tid)
Profile the reasons of fetch stall.
virtual StaticInstPtr fetchMicroop(MicroPC upc) const
Return the microop that goes with a particular micropc.
ThreadID numThreads
Number of threads.
void clearStates(ThreadID tid)
Clear all thread-specific states.
Overload hash function for BasicBlockRange type.
GenericISA::DelaySlotPCState< MachInst > PCState
void drainResume()
Resume after a drain.
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
const FlagsType pdf
Print the percent of the total that this entry represents.
void finishTranslation(const Fault &fault, const RequestPtr &mem_req)
unsigned fetchQueueSize
The size of the fetch queue in micro-ops.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Stats::Scalar tlbCycles
Stat for total number of cycles spent waiting for translation.
Stats::Scalar icacheSquashes
Total number of outstanding icache accesses that were dropped due to a squash.
Stats::Formula idleRate
Rate of how often fetch was idle.
TimeBuffer< TimeStruct >::wire fromRename
Wire to get rename's information from backwards time buffer.
bool predict(const StaticInstPtr &inst, const InstSeqNum &seqNum, TheISA::PCState &pc, ThreadID tid)
Predicts whether or not the instruction is a taken branch, and the target of the branch if it is take...
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Cycles is a wrapper class for representing cycle counts, i.e.
void setTimeBuffer(TimeBuffer< TimeStruct > *time_buffer)
Sets the main backwards communication time buffer pointer.
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
ThreadID threadFetched
Thread ID being fetched.
Stats::Scalar icacheWaitRetryStallCycles
Total number of stall cycles caused by I-cache wait retrys.
void processCacheCompletion(PacketPtr pkt)
Processes cache completion event.
TheISA::PCState pc[Impl::MaxThreads]
std::deque< DynInstPtr > fetchQueue[Impl::MaxThreads]
Queue of fetched instructions.
ThreadID iqCount()
Returns the appropriate thread to fetch using the IQ count policy.
O3CPU * cpu
Pointer to the O3CPU.
DefaultFetch(O3CPU *_cpu, DerivO3CPUParams *params)
DefaultFetch constructor.
BPredUnit * branchPred
BPredUnit.
int numInst
Tracks how many instructions has been fetched this cycle.
uint8_t * fetchBuffer[Impl::MaxThreads]
The fetch data that is being fetched and buffered.
FetchStatus _status
Fetch status.
virtual bool recvTimingResp(PacketPtr pkt)
Timing version of receive.
static StaticInstPtr nopStaticInstPtr
Pointer to a statically allocated generic "nop" instruction object.
Stalls stalls[Impl::MaxThreads]
Tracks which stages are telling fetch to stall.
PacketPtr retryPkt
The packet that is waiting to be retried.
const FlagsType total
Print the total.
bool checkStall(ThreadID tid) const
Checks if a thread is stalled.
void squash(const InstSeqNum &squashed_sn, ThreadID tid)
Squashes all outstanding updates until a given sequence number.
Stats::Scalar icacheStallCycles
Stat for total number of cycles stalled due to an icache miss.
Counter lastIcacheStall[Impl::MaxThreads]
Icache stall statistics.
const T * getConstPtr() const
bool checkInterrupt(Addr pc)
Check if an interrupt is pending and that we need to handle.
ThreadStatus fetchStatus[Impl::MaxThreads]
Per-thread status.
std::list< ThreadID > * activeThreads
List of Active Threads.
void squash(const TheISA::PCState &newPC, const InstSeqNum seq_num, DynInstPtr squashInst, ThreadID tid)
Squashes a specific thread and resets the PC.
#define panic(...)
This implements a cprintf based panic() function.
unsigned fetchBufferSize
The size of the fetch buffer in bytes.
TimeBuffer< TimeStruct >::wire fromCommit
Wire to get commit's information from backwards time buffer.
Tick curTick()
The current simulated tick.
Impl::DynInstPtr DynInstPtr
Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17