42#ifndef __CPU_O3_RENAME_HH__
43#define __CPU_O3_RENAME_HH__
61struct BaseO3CPUParams;
128 Rename(
CPU *_cpu,
const BaseO3CPUParams ¶ms);
131 std::string
name()
const;
ProbePointArg generates a point for the class of Arg.
Register ID: describe an architectural register with its class and index.
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
Commit handles single threaded and SMT commit.
IEW handles both single threaded and SMT IEW (issue/execute/writeback).
Rename handles both single threaded and SMT rename.
DynInstPtr serializeInst[MaxThreads]
The serialize instruction that rename has stalled on.
void incrFullStat(const FullSource &source)
Function used to increment the stat that corresponds to the source of the stall.
ThreadID numThreads
The number of threads active in rename.
TimeBuffer< RenameStruct >::wire toIEW
Wire to write any information heading to IEW.
void sortInsts()
Separates instructions from decode into individual lists of instructions sorted by thread.
void setCommitStage(Commit *commit_stage)
Sets pointer to commit stage.
ThreadStatus renameStatus[MaxThreads]
Per-thread status.
Rename(CPU *_cpu, const BaseO3CPUParams ¶ms)
Rename constructor.
TimeBuffer< TimeStruct >::wire toDecode
Wire to write infromation heading to previous stages.
TimeBuffer< RenameStruct > * renameQueue
Rename instruction queue.
unsigned commitToRenameDelay
Delay between commit and rename, in ticks.
int storesInProgress[MaxThreads]
Count of Store instructions in progress that have been sent off to the IQ and ROB,...
ThreadStatus
Individual thread status.
int instsInProgress[MaxThreads]
Count of instructions in progress that have been sent off to the IQ and ROB, but are not yet included...
int calcFreeIQEntries(ThreadID tid)
Calculates the number of free IQ entries for a specific thread.
void startupStage()
Initializes variables for the stage.
ProbePointArg< DynInstPtr > * ppRename
To probe when register renaming for an instruction is complete.
bool blockThisCycle
Whether or not rename needs to block this cycle.
void renameSrcRegs(const DynInstPtr &inst, ThreadID tid)
Renames the source registers of an instruction.
void doSquash(const InstSeqNum &squash_seq_num, ThreadID tid)
Executes actual squash, removing squashed instructions.
void renameDestRegs(const DynInstPtr &inst, ThreadID tid)
Renames the destination registers of an instruction.
unsigned skidBufferMax
The maximum skid buffer size.
std::list< ThreadID > * activeThreads
Pointer to the list of active threads.
UnifiedFreeList * freeList
Free list interface.
void tick()
Ticks rename, which processes all input signals and attempts to rename as many instructions as possib...
void readFreeEntries(ThreadID tid)
Gets the number of free entries for a specific thread.
std::deque< DynInstPtr > InstQueue
int calcFreeROBEntries(ThreadID tid)
Calculates the number of free ROB entries for a specific thread.
int iewToRenameDelay
Delay between iew and rename, in ticks.
RenameStatus _status
Rename status.
void renameInsts(ThreadID tid)
Renames instructions for the given thread.
void setFreeList(UnifiedFreeList *fl_ptr)
Sets pointer to the free list.
std::pair< InstSeqNum, PhysRegIdPtr > SeqNumRegPair
Probe points.
bool emptyROB[MaxThreads]
Records if the ROB is empty.
void rename(bool &status_change, ThreadID tid)
Determines what to do based on rename's current status.
TimeBuffer< TimeStruct >::wire fromIEW
Wire to get IEW's output from backwards time buffer.
std::vector< PhysRegIdPtr > freeingInProgress[MaxThreads]
Hold phys regs to be released after squash finish.
std::string name() const
Returns the name of rename.
std::list< RenameHistory > historyBuffer[MaxThreads]
A per-thread list of all destination register renames, used to either undo rename mappings or free ol...
TimeBuffer< DecodeStruct >::wire fromDecode
Wire to get decode's output from decode queue.
void serializeAfter(InstQueue &inst_list, ThreadID tid)
Either serializes on the next instruction available in the InstQueue, or records that it must seriali...
gem5::o3::Rename::RenameStats stats
TimeBuffer< DecodeStruct > * decodeQueue
Decode instruction queue interface.
unsigned renameWidth
Rename width, in instructions.
void setRenameMap(UnifiedRenameMap::PerThreadUnifiedRenameMap &rm_ptr)
Sets pointer to rename maps (per-thread structures).
void setIEWStage(IEW *iew_stage)
Sets pointer to IEW stage.
bool resumeUnblocking
Whether or not rename needs to resume clearing out the skidbuffer after squashing.
InstQueue skidBuffer[MaxThreads]
Skid buffer between rename and decode.
Scoreboard * scoreboard
Pointer to the scoreboard.
void drainSanityCheck() const
Perform sanity checks after a drain.
bool skidsEmpty()
Returns if all of the skid buffers are empty.
IEW * iew_ptr
Pointer to IEW stage.
int calcFreeSQEntries(ThreadID tid)
Calculates the number of free SQ entries for a specific thread.
void dumpHistory()
Debugging function used to dump history buffer of renamings.
FullSource
Enum to record the source of a structure full stall.
UnifiedRenameMap * renameMap[MaxThreads]
Rename map interface.
bool block(ThreadID tid)
Switches rename to blocking, and signals back that rename has become blocked.
int loadsInProgress[MaxThreads]
Count of Load instructions in progress that have been sent off to the IQ and ROB, but are not yet inc...
TimeBuffer< TimeStruct >::wire fromCommit
Wire to get commit's output from backwards time buffer.
bool unblock(ThreadID tid)
Switches rename to unblocking if the skid buffer is empty, and signals back that rename has unblocked...
TimeBuffer< TimeStruct > * timeBuffer
Pointer to main time buffer used for backwards communication.
unsigned toIEWIndex
The index of the instruction in the time buffer to IEW that rename is currently using.
RenameStatus
Overall rename status.
void removeFromHistory(InstSeqNum inst_seq_num, ThreadID tid)
Removes a committed instruction's rename history.
void setTimeBuffer(TimeBuffer< TimeStruct > *tb_ptr)
Sets the main backwards communication time buffer pointer.
void takeOverFrom()
Takes over from another CPU's thread.
Stalls stalls[MaxThreads]
Tracks which stages are telling decode to stall.
void regProbePoints()
Registers probes.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to list of active threads.
void resetStage()
Reset this pipeline stage.
bool checkStall(ThreadID tid)
Checks if any stages are telling rename to block.
InstQueue insts[MaxThreads]
Queue of all instructions coming from decode this cycle.
void skidInsert(ThreadID tid)
Inserts unused instructions from a given thread into the skid buffer, to be renamed once rename unblo...
void readStallSignals(ThreadID tid)
Reads signals telling rename to block/unblock.
void updateStatus()
Updates overall rename status based on all of the threads' statuses.
bool checkSignalsAndUpdate(ThreadID tid)
Checks the signals and updates the status.
void squash(const InstSeqNum &squash_seq_num, ThreadID tid)
Squashes all instructions in a thread.
bool isDrained() const
Has the stage drained?
void setScoreboard(Scoreboard *_scoreboard)
Sets pointer to the scoreboard.
FreeEntries freeEntries[MaxThreads]
Per-thread tracking of the number of free entries of back-end structures.
int calcFreeLQEntries(ThreadID tid)
Calculates the number of free LQ entries for a specific thread.
Commit * commit_ptr
Pointer to commit stage.
bool serializeOnNextInst[MaxThreads]
Records if rename needs to serialize on the next instruction for any thread.
ProbePointArg< SeqNumRegPair > * ppSquashInRename
To probe when an instruction is squashed and the register mapping for it needs to be undone.
int decodeToRenameDelay
Delay between decode and rename, in ticks.
void clearStates(ThreadID tid)
Clear all thread-specific states.
bool wroteToTimeBuffer
Variable that tracks if decode has written to the time buffer this cycle.
void setDecodeQueue(TimeBuffer< DecodeStruct > *dq_ptr)
Sets pointer to time buffer coming from decode.
bool resumeSerialize
Whether or not rename needs to resume a serialize instruction after squashing.
void setRenameQueue(TimeBuffer< RenameStruct > *rq_ptr)
Sets pointer to time buffer used to communicate to the next stage.
unsigned validInsts()
Returns the number of valid instructions coming from decode.
Implements a simple scoreboard to track which registers are ready.
FreeList class that simply holds the list of free integer and floating point registers.
Unified register rename map for all classes of registers.
std::array< UnifiedRenameMap, MaxThreads > PerThreadUnifiedRenameMap
This is a simple scalar statistic, like a counter.
static constexpr int MaxThreads
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
int16_t ThreadID
Thread index/ID type.
Declaration of Statistics objects.
Structures whose free entries impact the amount of instructions that can be renamed.
Holds the information for each destination register rename.
RenameHistory(InstSeqNum _instSeqNum, const RegId &_archReg, PhysRegIdPtr _newPhysReg, PhysRegIdPtr _prevPhysReg)
InstSeqNum instSeqNum
The sequence number of the instruction that renamed.
RegId archReg
The architectural register index that was renamed.
PhysRegIdPtr newPhysReg
The new physical register that the arch.
PhysRegIdPtr prevPhysReg
The old physical register that the arch.
statistics::Scalar blockCycles
Stat for total number of cycles spent blocking.
statistics::Scalar matLookups
statistics::Scalar ROBFullEvents
Stat for total number of times that the ROB starts a stall in rename.
statistics::Scalar renamedOperands
Stat for total number of renamed destination registers.
statistics::Scalar fpLookups
statistics::Scalar fullRegistersEvents
Stat for total number of times that rename runs out of free registers to use to rename.
statistics::Scalar squashedInsts
Stat for total number of squashed instructions that rename discards.
statistics::Scalar IQFullEvents
Stat for total number of times that the IQ starts a stall in rename.
statistics::Scalar vecPredLookups
statistics::Scalar squashCycles
Stat for total number of cycles spent squashing.
statistics::Scalar renamedInsts
Stat for total number of renamed instructions.
statistics::Scalar LQFullEvents
Stat for total number of times that the LQ starts a stall in rename.
statistics::Scalar lookups
Stat for total number of source register rename lookups.
statistics::Scalar vecLookups
statistics::Scalar tempSerializing
Number of instructions marked as temporarily serializing.
statistics::Scalar serializing
Number of serialize instructions handled.
statistics::Scalar undoneMaps
Stat for total number of mappings that were undone due to a squash.
statistics::Scalar runCycles
Stat for total number of cycles spent running normally.
statistics::Scalar committedMaps
Stat for total number of committed renaming mappings.
statistics::Scalar intLookups
statistics::Scalar unblockCycles
Stat for total number of cycles spent unblocking.
statistics::Scalar idleCycles
Stat for total number of cycles spent idle.
RenameStats(statistics::Group *parent)
statistics::Scalar SQFullEvents
Stat for total number of times that the SQ starts a stall in rename.
statistics::Scalar skidInsts
Number of instructions inserted into skid buffers.
statistics::Scalar serializeStallCycles
Stat for total number of cycles spent stalling for a serializing inst.
Source of possible stalls.