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"
60 #include "debug/Activity.hh"
61 #include "debug/Drain.hh"
62 #include "debug/Fetch.hh"
63 #include "debug/O3CPU.hh"
64 #include "debug/O3PipeView.hh"
66 #include "params/DerivO3CPU.hh"
76 : fetchPolicy(params.smtFetchPolicy),
79 decodeToFetchDelay(params.decodeToFetchDelay),
80 renameToFetchDelay(params.renameToFetchDelay),
81 iewToFetchDelay(params.iewToFetchDelay),
82 commitToFetchDelay(params.commitToFetchDelay),
83 fetchWidth(params.fetchWidth),
84 decodeWidth(params.decodeWidth),
87 cacheBlkSize(cpu->cacheLineSize()),
88 fetchBufferSize(params.fetchBufferSize),
89 fetchBufferMask(fetchBufferSize - 1),
90 fetchQueueSize(params.fetchQueueSize),
91 numThreads(params.numThreads),
92 numFetchingThreads(params.smtNumFetchingThreads),
93 icachePort(this, _cpu),
94 finishTranslationEvent(this), fetchStats(_cpu, this)
97 fatal(
"numThreads (%d) is larger than compiled limit (%d),\n"
98 "\tincrease MaxThreads in src/cpu/o3/impl.hh\n",
99 numThreads,
static_cast<int>(Impl::MaxThreads));
101 fatal(
"fetchWidth (%d) is larger than compiled limit (%d),\n"
102 "\tincrease MaxWidth in src/cpu/o3/impl.hh\n",
103 fetchWidth,
static_cast<int>(Impl::MaxWidth));
105 fatal(
"fetch buffer size (%u bytes) is greater than the cache "
108 fatal(
"cache block (%u bytes) is not a multiple of the "
114 for (
int i = 0;
i < Impl::MaxThreads;
i++) {
133 decoder[tid] =
new TheISA::Decoder(
134 dynamic_cast<TheISA::ISA *
>(params.isa[tid]));
141 template <
class Impl>
145 return cpu->name() +
".fetch";
148 template <
class Impl>
158 template <
class Impl>
161 :
Stats::Group(cpu,
"fetch"),
163 "Number of cycles fetch is stalled on an Icache miss"),
166 "Number of branches that fetch encountered"),
168 "Number of branches that fetch has predicted taken"),
170 "Number of cycles fetch has run and was not squashing or "
173 "Number of cycles fetch has spent squashing"),
175 "Number of cycles fetch has spent waiting for tlb"),
178 "Number of cycles fetch has spent blocked"),
180 "Number of cycles fetch has spent waiting on interrupts, or bad "
181 "addresses, or out of MSHRs"),
183 "Number of cycles fetch has spent waiting on pipes to drain"),
185 "Number of stall cycles due to no active thread to fetch from"),
187 "Number of stall cycles due to pending traps"),
189 "Number of stall cycles due to pending quiesce instructions"),
191 "Number of stall cycles due to full MSHR"),
194 "Number of outstanding Icache misses that were squashed"),
196 "Number of outstanding ITLB misses that were squashed"),
198 "Number of instructions fetched each cycle (Total)"),
200 idleCycles / cpu->baseStats.numCycles),
202 branches / cpu->baseStats.numCycles),
204 "Number of inst fetches per cycle",
205 insts / cpu->baseStats.numCycles)
300 pc[tid] =
cpu->pcState(tid);
328 pc[tid] =
cpu->pcState(tid);
356 DPRINTF(Fetch,
"[tid:%i] Waking up from cache miss.\n", tid);
357 assert(!
cpu->switchedOut());
375 DPRINTF(Activity,
"[tid:%i] Activating fetch due to cache completion\n",
387 pkt->
req->setAccessLatency();
388 cpu->ppInstAccessComplete->notify(pkt);
394 template <
class Impl>
404 template <
class Impl>
422 template <
class Impl>
453 template <
class Impl>
457 assert(
cpu->getInstPort().isConnected());
462 template <
class Impl>
466 assert(
cpu->isDraining());
467 assert(!
stalls[tid].drain);
468 DPRINTF(Drain,
"%i: Thread drained.\n", tid);
472 template <
class Impl>
476 DPRINTF(Fetch,
"Waking up from quiesce\n");
482 template <
class Impl>
487 DPRINTF(Activity,
"Activating stage.\n");
489 cpu->activateStage(O3CPU::FetchIdx);
495 template <
class Impl>
500 DPRINTF(Activity,
"Deactivating stage.\n");
502 cpu->deactivateStage(O3CPU::FetchIdx);
508 template <
class Impl>
519 template <
class Impl>
529 if (!inst->isControl()) {
531 inst->setPredTarg(nextPC);
532 inst->setPredTaken(
false);
541 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Branch at PC %#x "
542 "predicted to be taken to %s\n",
543 tid, inst->seqNum, inst->pcState().instAddr(), nextPC);
545 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Branch at PC %#x "
546 "predicted to be not taken\n",
547 tid, inst->seqNum, inst->pcState().instAddr());
550 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Branch at PC %#x "
551 "predicted to go to %s\n",
552 tid, inst->seqNum, inst->pcState().instAddr(), nextPC);
553 inst->setPredTarg(nextPC);
554 inst->setPredTaken(predict_taken);
562 return predict_taken;
565 template <
class Impl>
571 assert(!
cpu->switchedOut());
576 DPRINTF(Fetch,
"[tid:%i] Can't fetch cache line, cache blocked\n",
584 DPRINTF(Fetch,
"[tid:%i] Can't fetch cache line, interrupt pending\n",
592 DPRINTF(Fetch,
"[tid:%i] Fetching cache line %#x for addr %#x\n",
593 tid, fetchBufferBlockPC,
vaddr);
598 RequestPtr mem_req = std::make_shared<Request>(
601 cpu->thread[tid]->contextId());
603 mem_req->taskId(
cpu->taskId());
610 cpu->mmu->translateTiming(mem_req,
cpu->thread[tid]->getTC(),
615 template <
class Impl>
620 ThreadID tid =
cpu->contextToThread(mem_req->contextId());
621 Addr fetchBufferBlockPC = mem_req->getVaddr();
623 assert(!
cpu->switchedOut());
629 mem_req->getVaddr() !=
memReq[tid]->getVaddr()) {
630 DPRINTF(Fetch,
"[tid:%i] Ignoring itlb completed after squash\n",
642 if (!
cpu->system->isMemAddr(mem_req->getPaddr())) {
643 warn(
"Address %#x is outside of physical memory, stopping fetch\n",
644 mem_req->getPaddr());
656 DPRINTF(Fetch,
"Fetch: Doing instruction read.\n");
664 DPRINTF(Fetch,
"[tid:%i] Out of MSHRs!\n", tid);
671 DPRINTF(Fetch,
"[tid:%i] Doing Icache access.\n", tid);
672 DPRINTF(Activity,
"[tid:%i] Activity: Waiting on I-cache "
690 DPRINTF(Fetch,
"[tid:%i] Got back req with addr %#x but expected %#x\n",
691 tid, mem_req->getVaddr(),
memReq[tid]->getVaddr());
700 DPRINTF(Fetch,
"[tid:%i] Translation faulted, building noop.\n", tid);
703 NULL, fetchPC, fetchPC,
false);
704 instruction->setNotAnInst();
706 instruction->setPredTarg(fetchPC);
707 instruction->fault = fault;
710 DPRINTF(Activity,
"Activity this cycle.\n");
711 cpu->activityThisCycle();
715 DPRINTF(Fetch,
"[tid:%i] Blocked, need to handle the trap.\n", tid);
716 DPRINTF(Fetch,
"[tid:%i] fault (%s) detected @ PC %s.\n",
717 tid, fault->name(),
pc[tid]);
722 template <
class Impl>
727 DPRINTF(Fetch,
"[tid:%i] Squashing, setting PC to: %s.\n",
732 if (squashInst && squashInst->pcState().instAddr() == newPC.instAddr())
733 macroop[tid] = squashInst->macroop;
740 DPRINTF(Fetch,
"[tid:%i] Squashing outstanding Icache miss.\n",
744 DPRINTF(Fetch,
"[tid:%i] Squashing outstanding ITLB miss.\n",
780 DPRINTF(Fetch,
"[tid:%i] Squashing from decode.\n", tid);
786 cpu->removeInstsUntil(seq_num, tid);
793 bool ret_val =
false;
796 assert(
cpu->isDraining());
797 DPRINTF(Fetch,
"[tid:%i] Drain stall detected.\n",tid);
812 while (threads != end) {
820 DPRINTF(Activity,
"[tid:%i] Activating stage.\n",tid);
823 DPRINTF(Activity,
"[tid:%i] Activating fetch due to cache"
827 cpu->activateStage(O3CPU::FetchIdx);
836 DPRINTF(Activity,
"Deactivating stage.\n");
838 cpu->deactivateStage(O3CPU::FetchIdx);
844 template <
class Impl>
850 DPRINTF(Fetch,
"[tid:%i] Squash from commit.\n", tid);
855 cpu->removeInstsNotInROB(tid);
858 template <
class Impl>
864 bool status_change =
false;
872 while (threads != end) {
878 status_change = status_change || updated_status;
881 DPRINTF(Fetch,
"Running stage.\n");
884 if (
fromCommit->commitInfo[0].interruptPending) {
888 if (
fromCommit->commitInfo[0].clearInterrupt) {
896 fetch(status_change);
916 unsigned insts_to_decode = 0;
917 unsigned available_insts = 0;
920 if (!
stalls[tid].decode) {
929 while (available_insts != 0 && insts_to_decode <
decodeWidth) {
934 DPRINTF(Fetch,
"[tid:%i] [sn:%llu] Sending instruction to decode "
935 "from fetch queue. Fetch queue size: %i.\n",
952 DPRINTF(Activity,
"Activity this cycle.\n");
953 cpu->activityThisCycle();
960 template <
class Impl>
970 assert(
stalls[tid].decode);
978 DPRINTF(Fetch,
"[tid:%i] Squashing instructions due to squash "
979 "from commit.\n",tid);
988 if (
fromCommit->commitInfo[tid].mispredictInst &&
989 fromCommit->commitInfo[tid].mispredictInst->isControl()) {
1000 }
else if (
fromCommit->commitInfo[tid].doneSeqNum) {
1008 DPRINTF(Fetch,
"[tid:%i] Squashing instructions due to squash "
1009 "from decode.\n",tid);
1012 if (
fromDecode->decodeInfo[tid].branchMispredict) {
1024 DPRINTF(Fetch,
"Squashing from decode with PC = %s\n",
1041 DPRINTF(Fetch,
"[tid:%i] Setting to blocked\n",tid);
1052 DPRINTF(Fetch,
"[tid:%i] Done squashing, switching to running.\n",
1065 template<
class Impl>
1066 typename Impl::DynInstPtr
1076 new DynInst(staticInst, curMacroop, thisPC, nextPC, seq,
cpu);
1077 instruction->setTid(tid);
1079 instruction->setThreadState(
cpu->thread[tid]);
1081 DPRINTF(Fetch,
"[tid:%i] Instruction PC %#x (%d) created "
1082 "[sn:%lli].\n", tid, thisPC.instAddr(),
1083 thisPC.microPC(), seq);
1085 DPRINTF(Fetch,
"[tid:%i] Instruction is: %s\n", tid,
1086 instruction->staticInst->
1087 disassemble(thisPC.instAddr()));
1091 instruction->traceData =
1092 cpu->getTracer()->getInstRecord(
curTick(),
cpu->tcBase(tid),
1093 instruction->staticInst, thisPC, curMacroop);
1096 instruction->traceData = NULL;
1100 instruction->setInstListIt(
cpu->addInst(instruction));
1107 DPRINTF(Fetch,
"[tid:%i] Fetch queue entry created (%i/%i).\n",
1117 template<
class Impl>
1126 assert(!
cpu->switchedOut());
1139 DPRINTF(Fetch,
"Attempting to fetch from [tid:%i]\n", tid);
1153 DPRINTF(Fetch,
"[tid:%i] Icache miss is complete.\n", tid);
1156 status_change =
true;
1166 DPRINTF(Fetch,
"[tid:%i] Attempting to translate and read "
1167 "instruction, starting at PC %s.\n", tid, thisPC);
1183 DPRINTF(Fetch,
"[tid:%i] Fetch is stalled!\n", tid);
1189 DPRINTF(Fetch,
"[tid:%i] Fetch is idle!\n", tid);
1207 DPRINTF(Fetch,
"[tid:%i] Adding instructions to queue to "
1212 bool predictedBranch =
false;
1227 && !predictedBranch && !
quiesce) {
1231 bool needMem = !inRom && !curMacroop &&
1243 if (blkOffset >= numInsts) {
1249 decoder[tid]->moreBytes(thisPC, fetchAddr, cacheInsts[blkOffset]);
1251 if (
decoder[tid]->needMoreBytes()) {
1261 if (!(curMacroop || inRom)) {
1262 if (
decoder[tid]->instReady()) {
1263 staticInst =
decoder[tid]->decode(thisPC);
1269 curMacroop = staticInst;
1282 bool newMacro =
false;
1283 if (curMacroop || inRom) {
1285 staticInst =
decoder[tid]->fetchRomMicroop(
1286 thisPC.microPC(), curMacroop);
1288 staticInst = curMacroop->
fetchMicroop(thisPC.microPC());
1295 thisPC, nextPC,
true);
1301 if (
DTRACE(O3PipeView)) {
1302 instruction->fetchTick =
curTick();
1310 predictedBranch |= thisPC.branching();
1313 if (predictedBranch) {
1314 DPRINTF(Fetch,
"Branch detected with PC = %s\n", thisPC);
1317 newMacro |= thisPC.instAddr() != nextPC.instAddr();
1330 if (instruction->isQuiesce()) {
1332 "Quiesce instruction encountered, halting fetch!\n");
1334 status_change =
true;
1338 }
while ((curMacroop ||
decoder[tid]->instReady()) &&
1347 if (predictedBranch) {
1348 DPRINTF(Fetch,
"[tid:%i] Done fetching, predicted branch "
1349 "instruction encountered.\n", tid);
1351 DPRINTF(Fetch,
"[tid:%i] Done fetching, reached fetch bandwidth "
1352 "for this cycle.\n", tid);
1354 DPRINTF(Fetch,
"[tid:%i] Done fetching, reached the end of the"
1355 "fetch buffer.\n", tid);
1379 template<
class Impl>
1410 template<
class Impl>
1416 case SMTFetchPolicy::RoundRobin:
1418 case SMTFetchPolicy::IQCount:
1420 case SMTFetchPolicy::LSQCount:
1422 case SMTFetchPolicy::Branch:
1446 template<
class Impl>
1455 while (pri_iter != end) {
1456 high_pri = *pri_iter;
1476 template<
class Impl>
1481 std::priority_queue<unsigned, std::vector<unsigned>,
1482 std::greater<unsigned> > PQ;
1483 std::map<unsigned, ThreadID> threadMap;
1488 while (threads != end) {
1498 while (!PQ.empty()) {
1499 ThreadID high_pri = threadMap[PQ.top()];
1513 template<
class Impl>
1518 std::priority_queue<unsigned, std::vector<unsigned>,
1519 std::greater<unsigned> > PQ;
1520 std::map<unsigned, ThreadID> threadMap;
1525 while (threads != end) {
1527 unsigned ldstqCount =
fromIEW->iewInfo[tid].ldstqCount;
1531 PQ.push(ldstqCount);
1532 threadMap[ldstqCount] = tid;
1535 while (!PQ.empty()) {
1536 ThreadID high_pri = threadMap[PQ.top()];
1549 template<
class Impl>
1553 panic(
"Branch Count Fetch policy unimplemented\n");
1557 template<
class Impl>
1580 DPRINTF(Fetch,
"[tid:%i] Issuing a pipelined I-cache access, "
1581 "starting at PC %s.\n", tid, thisPC);
1587 template<
class Impl>
1590 DPRINTF(Fetch,
"There are no more threads available to fetch from.\n");
1596 DPRINTF(Fetch,
"Fetch is waiting for a drain!\n");
1599 DPRINTF(Fetch,
"Fetch has no active thread!\n");
1602 DPRINTF(Fetch,
"[tid:%i] Fetch is blocked!\n", tid);
1605 DPRINTF(Fetch,
"[tid:%i] Fetch is squashing!\n", tid);
1608 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting cache response!\n",
1612 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting ITLB walk to "
1616 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting for a pending trap!\n",
1620 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting for a pending quiesce "
1621 "instruction!\n", tid);
1624 DPRINTF(Fetch,
"[tid:%i] Fetch is waiting for an I-cache retry!\n",
1627 DPRINTF(Fetch,
"[tid:%i] Fetch predicted non-executable address\n",
1630 DPRINTF(Fetch,
"[tid:%i] Unexpected fetch stall reason "
1636 template<
class Impl>
1642 assert(pkt->
req->isUncacheable() ||
1644 fetch->processCacheCompletion(pkt);
1649 template<
class Impl>
1653 fetch->recvReqRetry();
1656 #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.
DefaultFetch(O3CPU *_cpu, const DerivO3CPUParams ¶ms)
DefaultFetch constructor.
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.
SMTFetchPolicy fetchPolicy
Fetch policy.
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
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.
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.
std::enable_if_t< std::is_integral< T >::value, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
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)
@ INST_FETCH
The request was an instruction fetch.
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.
#define UNIT_RATE(T1, T2)
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
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.
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.
#define UNIT_CYCLE
Convenience macros to declare the unit of a stat.
void setTimeBuffer(TimeBuffer< TimeStruct > *time_buffer)
Sets the main backwards communication time buffer pointer.
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]
Tick curTick()
The universal simulation clock.
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.
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.
Impl::DynInstPtr DynInstPtr
Generated on Tue Mar 23 2021 19:41:25 for gem5 by doxygen 1.8.17