41#ifndef __CPU_O3_DECODE_HH__
42#define __CPU_O3_DECODE_HH__
55struct BaseO3CPUParams;
101 Decode(
CPU *_cpu,
const BaseO3CPUParams ¶ms);
111 std::string
name()
const;
Cycles is a wrapper class for representing cycle counts, i.e.
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
Decode class handles both single threaded and SMT decode.
DecodeStatus _status
Decode status.
std::queue< DynInstPtr > skidBuffer[MaxThreads]
Skid buffer between fetch and decode.
bool wroteToTimeBuffer
Variable that tracks if decode has written to the time buffer this cycle.
bool unblock(ThreadID tid)
Switches decode to unblocking if the skid buffer is empty, and signals back that decode has unblocked...
bool squashAfterDelaySlot[MaxThreads]
Tells when their is a pending delay slot inst.
void readStallSignals(ThreadID tid)
Reads all stall signals from the backwards communication timebuffer.
gem5::o3::Decode::DecodeStats stats
DynInstPtr squashInst[MaxThreads]
Instruction used for squashing branch (used for MIPS)
Cycles iewToDecodeDelay
IEW to decode delay.
void decodeInsts(ThreadID tid)
Processes instructions from fetch and passes them on to rename.
Stalls stalls[MaxThreads]
Tracks which stages are telling decode to stall.
TimeBuffer< TimeStruct >::wire toFetch
Wire to write information heading to previous stages.
unsigned skidBufferMax
Maximum size of the skid buffer.
Cycles commitToDecodeDelay
Commit to decode delay.
void decode(bool &status_change, ThreadID tid)
Determines what to do based on decode's current status.
bool fetchInstsValid()
Returns if there any instructions from fetch on this cycle.
bool checkSignalsAndUpdate(ThreadID tid)
Checks all input signals and updates decode's status appropriately.
TimeBuffer< DecodeStruct >::wire toRename
Wire used to write any information heading to rename.
Cycles renameToDecodeDelay
Rename to decode delay.
Cycles fetchToDecodeDelay
Fetch to decode delay.
std::queue< DynInstPtr > insts[MaxThreads]
Queue of all instructions coming from fetch this cycle.
void setFetchQueue(TimeBuffer< FetchStruct > *fq_ptr)
Sets pointer to time buffer coming from fetch.
void takeOverFrom()
Takes over from another CPU's thread.
void setTimeBuffer(TimeBuffer< TimeStruct > *tb_ptr)
Sets the main backwards communication time buffer pointer.
ThreadStatus decodeStatus[MaxThreads]
Per-thread status.
void sortInsts()
Separates instructions from fetch into individual lists of instructions sorted by thread.
ThreadStatus
Individual thread status.
unsigned toRenameIndex
Index of instructions being sent to rename.
void setDecodeQueue(TimeBuffer< DecodeStruct > *dq_ptr)
Sets pointer to time buffer used to communicate to the next stage.
TimeBuffer< DecodeStruct > * decodeQueue
Decode instruction queue.
void squash(const DynInstPtr &inst, ThreadID tid)
Squashes if there is a PC-relative branch that was predicted incorrectly.
void updateStatus()
Updates overall decode status based on all of the threads' statuses.
bool skidsEmpty()
Returns if all of the skid buffers are empty.
unsigned decodeWidth
The width of decode, in instructions.
bool isDrained() const
Has the stage drained?
TimeBuffer< TimeStruct >::wire fromCommit
Wire to get commit's information from backwards time buffer.
ThreadID numThreads
number of Active Threads
TimeBuffer< TimeStruct > * timeBuffer
Time buffer interface.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to list of active threads.
TimeBuffer< FetchStruct >::wire fromFetch
Wire to get fetch's output from fetch queue.
TimeBuffer< TimeStruct >::wire fromRename
Wire to get rename's output from backwards time buffer.
Addr bdelayDoneSeqNum[MaxThreads]
SeqNum of Squashing Branch Delay Instruction (used for MIPS)
DecodeStatus
Overall decode stage status.
TimeBuffer< TimeStruct >::wire fromIEW
Wire to get iew's information from backwards time buffer.
void clearStates(ThreadID tid)
Clear all thread-specific states.
void drainSanityCheck() const
Perform sanity checks after a drain.
std::list< ThreadID > * activeThreads
List of active thread ids.
void tick()
Ticks decode, processing all input signals and decoding as many instructions as possible.
Decode(CPU *_cpu, const BaseO3CPUParams ¶ms)
Decode constructor.
bool block(ThreadID tid)
Switches decode to blocking, and signals back that decode has become blocked.
std::string name() const
Returns the name of decode.
void skidInsert(ThreadID tid)
Inserts a thread's instructions into the skid buffer, to be decoded once decode unblocks.
TimeBuffer< FetchStruct > * fetchQueue
Fetch instruction queue interface.
bool checkStall(ThreadID tid) const
Checks all stall signals, and returns if any are true.
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.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of Statistics objects.
statistics::Scalar branchResolved
Stat for number of times a branch is resolved at decode.
statistics::Scalar squashCycles
Stat for total number of squashing cycles.
statistics::Scalar runCycles
Stat for total number of normal running cycles.
statistics::Scalar squashedInsts
Stat for total number of squashed instructions.
statistics::Scalar idleCycles
Stat for total number of idle cycles.
statistics::Scalar branchMispred
Stat for number of times a branch mispredict is detected.
statistics::Scalar decodedInsts
Stat for total number of decoded instructions.
statistics::Scalar blockedCycles
Stat for total number of blocked cycles.
statistics::Scalar controlMispred
Stat for number of times decode detected a non-control instruction incorrectly predicted as a branch.
statistics::Scalar unblockCycles
Stat for total number of unblocking cycles.
Source of possible stalls.