44 #ifndef __CPU_O3_IEW_IMPL_IMPL_HH__ 45 #define __CPU_O3_IEW_IMPL_IMPL_HH__ 53 #include "arch/utility.hh" 54 #include "config/the_isa.hh" 59 #include "debug/Activity.hh" 60 #include "debug/Drain.hh" 61 #include "debug/IEW.hh" 62 #include "debug/O3PipeView.hh" 63 #include "params/DerivO3CPU.hh" 69 : issueToExecQueue(params->backComSize, params->forwardComSize),
71 instQueue(_cpu, this, params),
72 ldstQueue(_cpu, this, params),
73 fuPool(params->fuPool),
74 commitToIEWDelay(params->commitToIEWDelay),
75 renameToIEWDelay(params->renameToIEWDelay),
76 issueToExecuteDelay(params->issueToExecuteDelay),
77 dispatchWidth(params->dispatchWidth),
78 issueWidth(params->issueWidth),
81 wbWidth(params->wbWidth),
82 numThreads(params->numThreads)
85 fatal(
"dispatchWidth (%d) is larger than compiled limit (%d),\n" 86 "\tincrease MaxWidth in src/cpu/o3/impl.hh\n",
89 fatal(
"issueWidth (%d) is larger than compiled limit (%d),\n" 90 "\tincrease MaxWidth in src/cpu/o3/impl.hh\n",
93 fatal(
"wbWidth (%d) is larger than compiled limit (%d),\n" 94 "\tincrease MaxWidth in src/cpu/o3/impl.hh\n",
95 wbWidth, static_cast<int>(Impl::MaxWidth));
107 for (
ThreadID tid = 0; tid < Impl::MaxThreads; tid++) {
117 template <
class Impl>
121 return cpu->name() +
".iew";
124 template <
class Impl>
144 template <
class Impl>
148 using namespace Stats;
155 .
desc(
"Number of cycles IEW is idle");
159 .
desc(
"Number of cycles IEW is squashing");
163 .
desc(
"Number of cycles IEW is blocking");
167 .
desc(
"Number of cycles IEW is unblocking");
170 .
name(
name() +
".iewDispatchedInsts")
171 .
desc(
"Number of instructions dispatched to IQ");
174 .
name(
name() +
".iewDispSquashedInsts")
175 .
desc(
"Number of squashed instructions skipped by dispatch");
179 .
desc(
"Number of dispatched load instructions");
182 .
name(
name() +
".iewDispStoreInsts")
183 .
desc(
"Number of dispatched store instructions");
186 .
name(
name() +
".iewDispNonSpecInsts")
187 .
desc(
"Number of dispatched non-speculative instructions");
191 .
desc(
"Number of times the IQ has become full, causing a stall");
195 .
desc(
"Number of times the LSQ has become full, causing a stall");
198 .
name(
name() +
".memOrderViolationEvents")
199 .
desc(
"Number of memory order violations");
202 .
name(
name() +
".predictedTakenIncorrect")
203 .
desc(
"Number of branches that were predicted taken incorrectly");
206 .
name(
name() +
".predictedNotTakenIncorrect")
207 .
desc(
"Number of branches that were predicted not taken incorrectly");
210 .
name(
name() +
".branchMispredicts")
211 .
desc(
"Number of branch mispredicts detected at execute");
217 .
desc(
"Number of executed instructions");
222 .
desc(
"Number of load instructions executed")
226 .
name(
name() +
".iewExecSquashedInsts")
227 .
desc(
"Number of squashed instructions skipped in execute");
232 .
desc(
"number of swp insts executed")
238 .
desc(
"number of nop insts executed")
244 .
desc(
"number of memory reference insts executed")
250 .
desc(
"Number of branches executed")
255 .
desc(
"Number of stores executed")
261 .
desc(
"Inst execution rate")
269 .
desc(
"cumulative count of insts sent to commit")
275 .
desc(
"cumulative count of insts written-back")
281 .
desc(
"num instructions producing a value")
287 .
desc(
"num instructions consuming a value")
292 .
desc(
"average fanout of values written-back")
299 .
desc(
"insts written-back per cycle")
309 toRename->iewInfo[tid].usedIQ =
true;
310 toRename->iewInfo[tid].freeIQEntries =
313 toRename->iewInfo[tid].usedLSQ =
true;
323 cpu->activateStage(O3CPU::IEWIdx);
330 toRename->iewInfo[tid].usedIQ =
true;
331 toRename->iewInfo[tid].freeIQEntries =
334 toRename->iewInfo[tid].usedLSQ =
true;
394 template <
class Impl>
401 if (!
insts[tid].empty()) {
402 DPRINTF(Drain,
"%i: Insts not empty.\n", tid);
406 DPRINTF(Drain,
"%i: Skid buffer not empty.\n", tid);
416 DPRINTF(Drain,
"FU pool still busy.\n");
423 template <
class Impl>
433 template <
class Impl>
447 cpu->activityThisCycle();
465 DPRINTF(IEW,
"[tid:%i] Squashing all instructions.\n", tid);
476 "Removing skidbuffer instructions until " 477 "[sn:%llu] [tid:%i]\n",
482 toRename->iewInfo[tid].dispatchedToLQ++;
486 toRename->iewInfo[tid].dispatchedToSQ++;
489 toRename->iewInfo[tid].dispatched++;
501 DPRINTF(IEW,
"[tid:%i] [sn:%llu] Squashing from a specific instruction," 503 "\n", tid, inst->seqNum, inst->pcState() );
506 inst->seqNum <
toCommit->squashedSeqNum[tid]) {
508 toCommit->squashedSeqNum[tid] = inst->seqNum;
509 toCommit->branchTaken[tid] = inst->pcState().branching();
515 toCommit->mispredictInst[tid] = inst;
516 toCommit->includeSquashInst[tid] =
false;
527 DPRINTF(IEW,
"[tid:%i] Memory violation, squashing violator and younger " 528 "insts, PC: %s [sn:%llu].\n", tid, inst->pcState(), inst->seqNum);
536 inst->seqNum <=
toCommit->squashedSeqNum[tid]) {
539 toCommit->squashedSeqNum[tid] = inst->seqNum;
540 toCommit->pc[tid] = inst->pcState();
541 toCommit->mispredictInst[tid] = NULL;
544 toCommit->includeSquashInst[tid] =
true;
554 DPRINTF(IEW,
"[tid:%i] Blocking.\n", tid);
573 DPRINTF(IEW,
"[tid:%i] Reading instructions out of the skid " 574 "buffer %u.\n",tid, tid);
581 DPRINTF(IEW,
"[tid:%i] Done unblocking.\n",tid);
643 DPRINTF(IEW,
"Current wb cycle: %i, width: %i, numInst: %i\nwbActual:%i\n",
650 template <
class Impl>
654 unsigned inst_count = 0;
670 while (!
insts[tid].empty()) {
671 inst =
insts[tid].front();
675 DPRINTF(IEW,
"[tid:%i] Inserting [sn:%lli] PC:%s into " 676 "dispatch skidBuffer %i\n",tid, inst->seqNum,
677 inst->pcState(),tid);
683 "Skidbuffer Exceeded Max Size");
695 while (threads != end) {
697 unsigned thread_count =
skidBuffer[tid].size();
698 if (max < thread_count)
712 while (threads != end) {
722 template <
class Impl>
726 bool any_unblocking =
false;
731 while (threads != end) {
735 any_unblocking =
true;
746 DPRINTF(IEW,
"IEW switching to idle\n");
755 DPRINTF(IEW,
"IEW switching to active\n");
763 template <
class Impl>
769 if (
fromCommit->commitInfo[tid].robSquashing) {
770 DPRINTF(IEW,
"[tid:%i] Stall from Commit stage detected.\n",tid);
773 DPRINTF(IEW,
"[tid:%i] Stall: IQ is full.\n",tid);
780 template <
class Impl>
805 if (
fromCommit->commitInfo[tid].robSquashing) {
806 DPRINTF(IEW,
"[tid:%i] ROB is still squashing.\n", tid);
822 DPRINTF(IEW,
"[tid:%i] Done blocking, switching to unblocking.\n",
835 DPRINTF(IEW,
"[tid:%i] Done squashing, switching to running.\n",
844 template <
class Impl>
851 assert(
insts[tid].empty());
853 for (
int i = 0;
i < insts_from_rename; ++
i) {
858 template <
class Impl>
862 DPRINTF(IEW,
"[tid:%i] Removing incoming rename instructions\n", tid);
864 while (!
insts[tid].empty()) {
866 if (
insts[tid].front()->isLoad()) {
867 toRename->iewInfo[tid].dispatchedToLQ++;
869 if (
insts[tid].front()->isStore() ||
870 insts[tid].front()->isAtomic()) {
871 toRename->iewInfo[tid].dispatchedToSQ++;
874 toRename->iewInfo[tid].dispatched++;
880 template <
class Impl>
887 template <
class Impl>
891 DPRINTF(Activity,
"Activity this cycle.\n");
892 cpu->activityThisCycle();
895 template <
class Impl>
899 DPRINTF(Activity,
"Activating stage.\n");
900 cpu->activateStage(O3CPU::IEWIdx);
903 template <
class Impl>
907 DPRINTF(Activity,
"Deactivating stage.\n");
908 cpu->deactivateStage(O3CPU::IEWIdx);
933 DPRINTF(IEW,
"[tid:%i] Not blocked, so attempting to run " 959 template <
class Impl>
965 std::queue<DynInstPtr> &insts_to_dispatch =
969 int insts_to_add = insts_to_dispatch.size();
972 bool add_to_iq =
false;
973 int dis_num_inst = 0;
977 for ( ; dis_num_inst < insts_to_add &&
981 inst = insts_to_dispatch.front();
984 DPRINTF(IEW,
"[tid:%i] Issue: Examining instruction from skid " 991 DPRINTF(IEW,
"[tid:%i] Issue: Adding PC %s [sn:%lli] [tid:%i] to " 993 tid, inst->pcState(), inst->seqNum, inst->threadNumber);
1000 if (inst->isSquashed()) {
1001 DPRINTF(IEW,
"[tid:%i] Issue: Squashed instruction encountered, " 1002 "not adding to IQ.\n", tid);
1006 insts_to_dispatch.pop();
1009 if (inst->isLoad()) {
1010 toRename->iewInfo[tid].dispatchedToLQ++;
1012 if (inst->isStore() || inst->isAtomic()) {
1013 toRename->iewInfo[tid].dispatchedToSQ++;
1016 toRename->iewInfo[tid].dispatched++;
1023 DPRINTF(IEW,
"[tid:%i] Issue: IQ has become full.\n", tid);
1041 DPRINTF(IEW,
"[tid:%i] Issue: %s has become full.\n",tid,
1042 inst->isLoad() ?
"LQ" :
"SQ");
1057 if (inst->isAtomic()) {
1058 DPRINTF(IEW,
"[tid:%i] Issue: Memory instruction " 1059 "encountered, adding to LSQ.\n", tid);
1068 inst->setCanCommit();
1074 toRename->iewInfo[tid].dispatchedToSQ++;
1075 }
else if (inst->isLoad()) {
1076 DPRINTF(IEW,
"[tid:%i] Issue: Memory instruction " 1077 "encountered, adding to LSQ.\n", tid);
1087 toRename->iewInfo[tid].dispatchedToLQ++;
1088 }
else if (inst->isStore()) {
1089 DPRINTF(IEW,
"[tid:%i] Issue: Memory instruction " 1090 "encountered, adding to LSQ.\n", tid);
1096 if (inst->isStoreConditional()) {
1101 inst->setCanCommit();
1110 toRename->iewInfo[tid].dispatchedToSQ++;
1111 }
else if (inst->isMemBarrier() || inst->isWriteBarrier()) {
1113 inst->setCanCommit();
1116 }
else if (inst->isNop()) {
1117 DPRINTF(IEW,
"[tid:%i] Issue: Nop instruction encountered, " 1118 "skipping.\n", tid);
1121 inst->setExecuted();
1122 inst->setCanCommit();
1130 assert(!inst->isExecuted());
1134 if (add_to_iq && inst->isNonSpeculative()) {
1135 DPRINTF(IEW,
"[tid:%i] Issue: Nonspeculative instruction " 1136 "encountered, skipping.\n", tid);
1139 inst->setCanCommit();
1155 insts_to_dispatch.pop();
1157 toRename->iewInfo[tid].dispatched++;
1162 inst->dispatchTick =
curTick() - inst->fetchTick;
1167 if (!insts_to_dispatch.empty()) {
1168 DPRINTF(IEW,
"[tid:%i] Issue: Bandwidth Full. Blocking.\n", tid);
1182 template <
class Impl>
1188 std::cout <<
"Available Instructions: ";
1192 if (inst%3==0) std::cout <<
"\n\t";
1194 std::cout <<
"PC: " <<
fromIssue->insts[inst]->pcState()
1195 <<
" TN: " <<
fromIssue->insts[inst]->threadNumber
1196 <<
" SN: " <<
fromIssue->insts[inst]->seqNum <<
" | ";
1205 template <
class Impl>
1215 while (threads != end) {
1227 for (; inst_num < insts_to_execute;
1230 DPRINTF(IEW,
"Execute: Executing instructions from IQ.\n");
1234 DPRINTF(IEW,
"Execute: Processing PC %s, [tid:%i] [sn:%llu].\n",
1235 inst->pcState(), inst->threadNumber,inst->seqNum);
1242 if (inst->isSquashed()) {
1243 DPRINTF(IEW,
"Execute: Instruction was squashed. PC: %s, [tid:%i]" 1244 " [sn:%llu]\n", inst->pcState(), inst->threadNumber,
1249 inst->setExecuted();
1253 inst->setCanCommit();
1265 if (inst->isMemRef()) {
1266 DPRINTF(IEW,
"Execute: Calculating address for memory " 1270 if (inst->isAtomic()) {
1274 if (inst->isTranslationDelayed() &&
1278 DPRINTF(IEW,
"Execute: Delayed translation, deferring " 1283 }
else if (inst->isLoad()) {
1288 if (inst->isTranslationDelayed() &&
1292 DPRINTF(IEW,
"Execute: Delayed translation, deferring " 1298 if (inst->isDataPrefetch() || inst->isInstPrefetch()) {
1301 }
else if (inst->isStore()) {
1304 if (inst->isTranslationDelayed() &&
1308 DPRINTF(IEW,
"Execute: Delayed translation, deferring " 1315 if (fault !=
NoFault || !inst->readPredicate() ||
1316 !inst->isStoreConditional()) {
1321 inst->setExecuted();
1330 panic(
"Unexpected memory type!\n");
1338 if (inst->getFault() ==
NoFault) {
1340 if (!inst->readPredicate())
1341 inst->forwardOldRegs();
1344 inst->setExecuted();
1363 toCommit->squashedSeqNum[tid] > inst->seqNum) {
1367 bool loadNotExecuted = !inst->isExecuted() && inst->isLoad();
1369 if (inst->mispredicted() && !loadNotExecuted) {
1372 DPRINTF(IEW,
"[tid:%i] [sn:%llu] Execute: " 1373 "Branch mispredict detected.\n",
1375 DPRINTF(IEW,
"[tid:%i] [sn:%llu] " 1376 "Predicted target was PC: %s\n",
1377 tid,inst->seqNum,inst->readPredTarg());
1378 DPRINTF(IEW,
"[tid:%i] [sn:%llu] Execute: " 1379 "Redirecting fetch to PC: %s\n",
1380 tid,inst->seqNum,inst->pcState());
1386 if (inst->readPredTaken()) {
1392 assert(inst->isMemRef());
1399 DPRINTF(IEW,
"LDSTQ detected a violation. Violator PC: %s " 1400 "[sn:%lli], inst PC: %s [sn:%lli]. Addr is: %#x.\n",
1401 violator->pcState(), violator->seqNum,
1402 inst->pcState(), inst->seqNum, inst->physEffAddr);
1418 assert(inst->isMemRef());
1422 DPRINTF(IEW,
"LDSTQ detected a violation. Violator PC: " 1423 "%s, inst PC: %s. Addr is: %#x.\n",
1424 violator->pcState(), inst->pcState(),
1426 DPRINTF(IEW,
"Violation will not be handled because " 1427 "already squashing\n");
1442 cpu->activityThisCycle();
1452 template <
class Impl>
1461 for (
int inst_num = 0; inst_num <
wbWidth &&
1462 toCommit->insts[inst_num]; inst_num++) {
1466 DPRINTF(IEW,
"Sending instructions to commit, [sn:%lli] PC %s.\n",
1467 inst->seqNum, inst->pcState());
1479 if (!inst->isSquashed() && inst->isExecuted() && inst->getFault() ==
NoFault) {
1480 int dependents =
instQueue.wakeDependents(inst);
1482 for (
int i = 0;
i < inst->numDestRegs();
i++) {
1484 if (inst->renamedDestRegIdx(
i)->
1485 getNumPinnedWritesToComplete() == 0) {
1486 DPRINTF(IEW,
"Setting Destination Register %i (%s)\n",
1487 inst->renamedDestRegIdx(
i)->index(),
1488 inst->renamedDestRegIdx(
i)->className());
1502 template<
class Impl>
1523 while (threads != end) {
1526 DPRINTF(IEW,
"Issue: Processing [tid:%i]\n",tid);
1547 bool broadcast_free_entries =
false;
1553 broadcast_free_entries =
true;
1565 while (threads != end) {
1568 DPRINTF(IEW,
"Processing [tid:%i]\n",tid);
1571 if (
fromCommit->commitInfo[tid].doneSeqNum != 0 &&
1583 if (
fromCommit->commitInfo[tid].nonSpecSeqNum != 0) {
1586 if (
fromCommit->commitInfo[tid].strictlyOrdered) {
1588 fromCommit->commitInfo[tid].strictlyOrderedLoad);
1589 fromCommit->commitInfo[tid].strictlyOrderedLoad->setAtCommit();
1596 if (broadcast_free_entries) {
1597 toFetch->iewInfo[tid].iqCount =
1599 toFetch->iewInfo[tid].ldstqCount =
1602 toRename->iewInfo[tid].usedIQ =
true;
1603 toRename->iewInfo[tid].freeIQEntries =
1605 toRename->iewInfo[tid].usedLSQ =
true;
1607 toRename->iewInfo[tid].freeLQEntries =
1609 toRename->iewInfo[tid].freeSQEntries =
1615 DPRINTF(IEW,
"[tid:%i], Dispatch dispatched %i instructions.\n",
1616 tid,
toRename->iewInfo[tid].dispatched);
1619 DPRINTF(IEW,
"IQ has %i free entries (Can schedule: %i). " 1620 "LQ has %i free entries. SQ has %i free entries.\n",
1627 DPRINTF(Activity,
"Activity this cycle.\n");
1628 cpu->activityThisCycle();
1632 template <
class Impl>
1641 if (
DTRACE(O3PipeView)) {
1642 inst->completeTick =
curTick() - inst->fetchTick;
1649 if (inst->isControl())
1655 if (inst->isMemRef()) {
1658 if (inst->isLoad()) {
1664 template <
class Impl>
1672 toCommit->squashedSeqNum[tid] > inst->seqNum) {
1674 if (inst->mispredicted()) {
1677 DPRINTF(IEW,
"[tid:%i] [sn:%llu] Execute: " 1678 "Branch mispredict detected.\n",
1680 DPRINTF(IEW,
"[tid:%i] [sn:%llu] Predicted target " 1681 "was PC:%#x, NPC:%#x\n",
1683 inst->predInstAddr(), inst->predNextInstAddr());
1684 DPRINTF(IEW,
"[tid:%i] [sn:%llu] Execute: " 1685 "Redirecting fetch to PC: %#x, " 1688 inst->nextInstAddr(),
1689 inst->nextInstAddr());
1693 if (inst->readPredTaken()) {
1702 #endif//__CPU_O3_IEW_IMPL_IMPL_HH__ Cycles renameToIEWDelay
Rename to IEW delay.
#define panic(...)
This implements a cprintf based panic() function.
Stats::Vector iewExecutedBranches
Number of executed branches.
void setTimeBuffer(TimeBuffer< TimeStruct > *tb_ptr)
Sets main time buffer used for backwards communication.
unsigned issueWidth
Width of issue, in instructions.
void takeOverFrom()
Takes over execution from another CPU's thread.
Scoreboard * scoreboard
Scoreboard pointer.
bool fetchRedirect[Impl::MaxThreads]
Records if there is a fetch redirect on this cycle for each thread.
StageStatus exeStatus
Execute status.
void takeOverFrom()
Takes over from another CPU's thread.
Stats::Scalar iewDispStoreInsts
Stat for total number of dispatched store instructions.
Stats::Scalar iewExecutedInsts
Stat for total number of executed instructions.
decltype(nullptr) constexpr NoFault
void setIEWQueue(TimeBuffer< IEWStruct > *iq_ptr)
Sets time buffer to pass on instructions to commit.
#define fatal(...)
This implements a cprintf based fatal() function.
void rescheduleMemInst(const DynInstPtr &inst)
Tells memory dependence unit that a memory instruction needs to be rescheduled.
Stats::Scalar iewIdleCycles
Stat for total number of idle cycles.
bool willWB()
Returns if the LSQ will write back to memory this cycle.
bool updatedQueues
Records if the queues have been changed (inserted or issued insts), so that IEW knows to broadcast th...
void setRenameQueue(TimeBuffer< RenameStruct > *rq_ptr)
Sets time buffer for getting instructions coming from rename.
Stats::Scalar iewUnblockCycles
Stat for total number of unblocking cycles.
Stats::Scalar iewSquashCycles
Stat for total number of squashing cycles.
void startupStage()
Initializes stage; sends back the number of free IQ and LSQ entries.
Stats::Formula iewExecRate
Number of instructions executed per cycle.
void unblock(ThreadID tid)
Unblocks Dispatch if the skid buffer is empty, and signals back to other stages to unblock...
Stats::Scalar iewLSQFullEvents
Stat for number of times the LSQ becomes full.
Stats::Scalar iewIQFullEvents
Stat for number of times the IQ becomes full.
void tick()
Ticks the LSQ.
ThreadID numThreads
Number of active threads.
void notify(const Arg &arg)
called at the ProbePoint call site, passes arg to each listener.
void printAvailableInsts()
Debug function to print instructions that are issued this cycle.
bool sqFull()
Returns if any of the SQs are full.
Cycles issueToExecuteDelay
Issue to execute delay.
TimeBuffer< TimeStruct > * timeBuffer
Pointer to main time buffer used for backwards communication.
bool violation()
Returns whether or not there was a memory ordering violation.
Stats::Vector iewExecutedRefs
Number of executed meomory references.
DefaultIEW(O3CPU *_cpu, DerivO3CPUParams *params)
Constructs a DefaultIEW with the given parameters.
void squash(ThreadID tid)
Squashes instructions in IEW for a specific thread.
bool isDrained() const
Have all the FUs drained?
std::queue< DynInstPtr > insts[Impl::MaxThreads]
Queue of all instructions coming from rename this cycle.
Overload hash function for BasicBlockRange type.
bool checkStall(ThreadID tid)
Checks if any of the stall conditions are currently true.
Fault executeLoad(const DynInstPtr &inst)
Executes a load.
std::list< ThreadID > * activeThreads
Pointer to list of active threads.
unsigned wbNumInst
Index into queue of instructions being written back.
unsigned dispatchWidth
Width of dispatch, in instructions.
TimeBuffer< TimeStruct >::wire toFetch
Wire to write information heading to previous stages.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
void writebackStores()
Attempts to write back stores until all cache ports are used or the interface becomes blocked...
StageStatus wbStatus
Writeback status.
Derived & init(size_type size)
Set this vector to have the given size.
void instToCommit(const DynInstPtr &inst)
Sends an instruction to commit through the time buffer.
unsigned validInstsFromRename()
Returns the number of valid, non-squashed instructions coming from rename to dispatch.
TimeBuffer< IEWStruct > * iewQueue
IEW stage time buffer.
Stats::Vector iewExecutedSwp
Number of executed software prefetches.
ProbePointArg< DynInstPtr > * ppToCommit
To probe when instruction execution is complete.
Stats::Vector writebackCount
Number of instructions that writeback.
Stats::Scalar iewDispNonSpecInsts
Stat for total number of dispatched non speculative instructions.
Implements a simple scoreboard to track which registers are ready.
void cacheUnblocked()
Notifies that the cache has become unblocked.
IQ instQueue
Instruction queue.
TimeBuffer< IssueStruct >::wire fromIssue
Wire to read information from the issue stage time queue.
Tick curTick()
The current simulated tick.
void insertLoad(const DynInstPtr &load_inst)
Inserts a load into the LSQ.
bool isDrained() const
Has the LSQ drained?
void activateStage()
Tells CPU that the IEW stage is active and running.
unsigned numFreeStoreEntries()
Returns the number of free store entries.
void dispatchInsts(ThreadID tid)
Dispatches instructions to IQ and LSQ.
std::queue< DynInstPtr > skidBuffer[Impl::MaxThreads]
Skid buffer between rename and IEW.
void drainSanityCheck() const
Perform sanity checks after a drain.
Status _status
Overall stage status.
TimeBuffer< IssueStruct > issueToExecQueue
Issue stage queue.
ProbePointArg< DynInstPtr > * ppDispatch
Stats::Scalar iewExecSquashedInsts
Stat for total number of executed store instructions.
void setReg(PhysRegIdPtr phys_reg)
Sets the register as ready.
TimeBuffer< TimeStruct >::wire fromCommit
Wire to get commit's output from backwards time buffer.
Stats::Scalar iewDispLoadInsts
Stat for total number of dispatched load instructions.
void takeOverFrom()
Takes over from another CPU's thread.
Stats::Formula wbRate
Number of instructions per cycle written back.
Stats::Scalar iewDispatchedInsts
Stat for total number of instructions dispatched.
void tick()
Ticks IEW stage, causing Dispatch, the IQ, the LSQ, Execute, and Writeback to run for one cycle...
void emptyRenameInsts(ThreadID tid)
Removes instructions from rename from a thread's instruction list.
void checkSignalsAndUpdate(ThreadID tid)
Processes inputs and changes state accordingly.
unsigned wbWidth
Writeback width.
Fault executeStore(const DynInstPtr &inst)
Executes a store.
void replayMemInst(const DynInstPtr &inst)
Re-executes all rescheduled memory instructions.
void wakeCPU()
Tells the CPU to wakeup if it has descheduled itself due to no activity.
unsigned wbCycle
Cycle number within the queue of instructions being written back.
Stats::Vector iewExecutedNop
Number of executed nops.
void advancePC(PCState &pc, const StaticInstPtr &inst)
Cycles commitToIEWDelay
Commit to IEW delay.
Stats::Scalar iewDispSquashedInsts
Stat for total number of squashed instructions dispatch skips.
bool updateLSQNextCycle
Records if the LSQ needs to be updated on the next cycle, so that IEW knows if there will be activity...
void insertStore(const DynInstPtr &store_inst)
Inserts a store into the LSQ.
const FlagsType total
Print the total.
Stats::Vector producerInst
Number of instructions that wake consumers.
bool isDrained() const
Has the stage drained?
int getCount()
Returns the number of instructions in all of the queues.
Stats::Scalar predictedTakenIncorrect
Stat for total number of incorrect predicted taken branches.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
void activityThisCycle()
Reports to the CPU that there is activity this cycle.
int16_t ThreadID
Thread index/ID type.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to list of active threads.
Stats::Scalar memOrderViolationEvents
Stat for total number of memory ordering violation events.
void regStats()
Registers statistics.
void updateExeInstStats(const DynInstPtr &inst)
Updates execution stats based on the instruction.
void commitStores(InstSeqNum &youngest_inst, ThreadID tid)
Commits stores up until the given sequence number for a specific thread.
int skidCount()
Returns the max of the number of entries in all of the skid buffers.
void setScoreboard(Scoreboard *sb_ptr)
Sets pointer to the scoreboard.
bool wroteToTimeBuffer
Records if IEW has written to the time buffer this cycle, so that the CPU can deschedule itself if th...
Stats::Formula iewExecStoreInsts
Number of executed store instructions.
unsigned numFreeLoadEntries()
Returns the number of free load entries.
void squashDueToBranch(const DynInstPtr &inst, ThreadID tid)
Sends commit proper information for a squash due to a branch mispredict.
void executeInsts()
Executes instructions.
TimeBuffer< RenameStruct > * renameQueue
Rename instruction queue interface.
GenericISA::SimplePCState< MachInst > PCState
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets the pointer to the list of active threads.
void writebackInsts()
Writebacks instructions.
void blockMemInst(const DynInstPtr &inst)
Moves memory instruction onto the list of cache blocked instructions.
void wakeDependents(const DynInstPtr &inst)
Wakes all dependents of a completed instruction.
std::string name() const
Returns the name of the DefaultIEW stage.
void sortInsts()
Sorts instructions coming from rename into lists separated by thread.
void checkMisprediction(const DynInstPtr &inst)
Check misprediction.
Stats::Vector iewInstsToCommit
Number of instructions sent to commit.
void dispatch(ThreadID tid)
Determines proper actions to take given Dispatch's status.
void skidInsert(ThreadID tid)
Inserts unused instructions of a thread into the skid buffer.
TimeBuffer< RenameStruct >::wire fromRename
Wire to get rename's output from rename queue.
LSQ ldstQueue
Load / store queue.
TimeBuffer< IEWStruct >::wire toCommit
Wire to write infromation heading to commit.
Stats::Formula branchMispredicts
Stat for total number of mispredicted branches detected at execute.
void deactivateStage()
Tells CPU that the IEW stage is inactive and idle.
bool skidsEmpty()
Returns if all of the skid buffers are empty.
unsigned skidBufferMax
Maximum size of the skid buffer.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
void regStats()
Registers statistics of each LSQ unit.
Impl::DynInstPtr DynInstPtr
void squash(const InstSeqNum &squashed_num, ThreadID tid)
Squash instructions from a thread until the specified sequence number.
ProbePointArg< DynInstPtr > * ppExecute
To probe when instruction execution begins.
void squashDueToMemOrder(const DynInstPtr &inst, ThreadID tid)
Sends commit proper information for a squash due to a memory order violation.
TimeBuffer< TimeStruct >::wire toRename
Wire to write information heading to previous stages.
StageStatus dispatchStatus[Impl::MaxThreads]
Dispatch status.
ProbePointArg< DynInstPtr > * ppMispredict
Probe points.
void clearStates(ThreadID tid)
Clear all thread-specific states.
MasterPort & getDataPort()
void block(ThreadID tid)
Sets Dispatch to blocked, and signals back to other stages to block.
Stats::Scalar predictedNotTakenIncorrect
Stat for total number of incorrect predicted not taken branches.
Stats::Vector iewExecLoadInsts
Stat for total number of executed load instructions.
DynInstPtr getMemDepViolator(ThreadID tid)
Gets the instruction that caused the memory ordering violation.
Stats::Vector consumerInst
Number of instructions that wake up from producers.
std::shared_ptr< FaultBase > Fault
void regProbePoints()
Registers probes.
void processFreeUnits()
Frees all FUs on the list.
void commitLoads(InstSeqNum &youngest_inst, ThreadID tid)
Commits loads up until the given sequence number for a specific thread.
Stats::Scalar iewBlockCycles
Stat for total number of blocking cycles.
void updateStatus()
Updates overall IEW status based on all of the stages' statuses.
FUPool * fuPool
Pointer to the functional unit pool.
bool lqFull()
Returns if any of the LQs are full.
Stats::Formula wbFanout
Average number of woken instructions per writeback.
void drainSanityCheck() const
Perform sanity checks after a drain.