gem5
|
DefaultDecode class handles both single threaded and SMT decode. More...
#include <decode.hh>
Classes | |
struct | Stalls |
Source of possible stalls. More... | |
Public Types | |
enum | DecodeStatus { Active, Inactive } |
Overall decode stage status. More... | |
enum | ThreadStatus { Running, Idle, StartSquash, Squashing, Blocked, Unblocking } |
Individual thread status. More... | |
Public Member Functions | |
DefaultDecode (O3CPU *_cpu, DerivO3CPUParams *params) | |
DefaultDecode constructor. More... | |
void | startupStage () |
void | resetStage () |
std::string | name () const |
Returns the name of decode. More... | |
void | regStats () |
Registers statistics. More... | |
void | setTimeBuffer (TimeBuffer< TimeStruct > *tb_ptr) |
Sets the main backwards communication time buffer pointer. More... | |
void | setDecodeQueue (TimeBuffer< DecodeStruct > *dq_ptr) |
Sets pointer to time buffer used to communicate to the next stage. More... | |
void | setFetchQueue (TimeBuffer< FetchStruct > *fq_ptr) |
Sets pointer to time buffer coming from fetch. More... | |
void | setActiveThreads (std::list< ThreadID > *at_ptr) |
Sets pointer to list of active threads. More... | |
void | drainSanityCheck () const |
Perform sanity checks after a drain. More... | |
bool | isDrained () const |
Has the stage drained? More... | |
void | takeOverFrom () |
Takes over from another CPU's thread. More... | |
void | tick () |
Ticks decode, processing all input signals and decoding as many instructions as possible. More... | |
void | decode (bool &status_change, ThreadID tid) |
Determines what to do based on decode's current status. More... | |
void | decodeInsts (ThreadID tid) |
Processes instructions from fetch and passes them on to rename. More... | |
unsigned | squash (ThreadID tid) |
Squashes due to commit signalling a squash. More... | |
Private Types | |
typedef Impl::O3CPU | O3CPU |
typedef Impl::DynInstPtr | DynInstPtr |
typedef Impl::CPUPol | CPUPol |
typedef CPUPol::FetchStruct | FetchStruct |
typedef CPUPol::DecodeStruct | DecodeStruct |
typedef CPUPol::TimeStruct | TimeStruct |
Private Member Functions | |
void | skidInsert (ThreadID tid) |
Inserts a thread's instructions into the skid buffer, to be decoded once decode unblocks. More... | |
bool | skidsEmpty () |
Returns if all of the skid buffers are empty. More... | |
void | updateStatus () |
Updates overall decode status based on all of the threads' statuses. More... | |
void | sortInsts () |
Separates instructions from fetch into individual lists of instructions sorted by thread. More... | |
void | readStallSignals (ThreadID tid) |
Reads all stall signals from the backwards communication timebuffer. More... | |
bool | checkSignalsAndUpdate (ThreadID tid) |
Checks all input signals and updates decode's status appropriately. More... | |
bool | checkStall (ThreadID tid) const |
Checks all stall signals, and returns if any are true. More... | |
bool | fetchInstsValid () |
Returns if there any instructions from fetch on this cycle. More... | |
bool | block (ThreadID tid) |
Switches decode to blocking, and signals back that decode has become blocked. More... | |
bool | unblock (ThreadID tid) |
Switches decode to unblocking if the skid buffer is empty, and signals back that decode has unblocked. More... | |
void | squash (DynInstPtr &inst, ThreadID tid) |
Squashes if there is a PC-relative branch that was predicted incorrectly. More... | |
Private Attributes | |
DecodeStatus | _status |
Decode status. More... | |
ThreadStatus | decodeStatus [Impl::MaxThreads] |
Per-thread status. More... | |
O3CPU * | cpu |
CPU interface. More... | |
TimeBuffer< TimeStruct > * | timeBuffer |
Time buffer interface. More... | |
TimeBuffer< TimeStruct >::wire | fromRename |
Wire to get rename's output from backwards time buffer. More... | |
TimeBuffer< TimeStruct >::wire | fromIEW |
Wire to get iew's information from backwards time buffer. More... | |
TimeBuffer< TimeStruct >::wire | fromCommit |
Wire to get commit's information from backwards time buffer. More... | |
TimeBuffer< TimeStruct >::wire | toFetch |
Wire to write information heading to previous stages. More... | |
TimeBuffer< DecodeStruct > * | decodeQueue |
Decode instruction queue. More... | |
TimeBuffer< DecodeStruct >::wire | toRename |
Wire used to write any information heading to rename. More... | |
TimeBuffer< FetchStruct > * | fetchQueue |
Fetch instruction queue interface. More... | |
TimeBuffer< FetchStruct >::wire | fromFetch |
Wire to get fetch's output from fetch queue. More... | |
std::queue< DynInstPtr > | insts [Impl::MaxThreads] |
Queue of all instructions coming from fetch this cycle. More... | |
std::queue< DynInstPtr > | skidBuffer [Impl::MaxThreads] |
Skid buffer between fetch and decode. More... | |
bool | wroteToTimeBuffer |
Variable that tracks if decode has written to the time buffer this cycle. More... | |
Stalls | stalls [Impl::MaxThreads] |
Tracks which stages are telling decode to stall. More... | |
Cycles | renameToDecodeDelay |
Rename to decode delay. More... | |
Cycles | iewToDecodeDelay |
IEW to decode delay. More... | |
Cycles | commitToDecodeDelay |
Commit to decode delay. More... | |
Cycles | fetchToDecodeDelay |
Fetch to decode delay. More... | |
unsigned | decodeWidth |
The width of decode, in instructions. More... | |
unsigned | toRenameIndex |
Index of instructions being sent to rename. More... | |
ThreadID | numThreads |
number of Active Threads More... | |
std::list< ThreadID > * | activeThreads |
List of active thread ids. More... | |
unsigned | skidBufferMax |
Maximum size of the skid buffer. More... | |
Addr | bdelayDoneSeqNum [Impl::MaxThreads] |
SeqNum of Squashing Branch Delay Instruction (used for MIPS) More... | |
DynInstPtr | squashInst [Impl::MaxThreads] |
Instruction used for squashing branch (used for MIPS) More... | |
bool | squashAfterDelaySlot [Impl::MaxThreads] |
Tells when their is a pending delay slot inst. More... | |
Stats::Scalar | decodeIdleCycles |
Stat for total number of idle cycles. More... | |
Stats::Scalar | decodeBlockedCycles |
Stat for total number of blocked cycles. More... | |
Stats::Scalar | decodeRunCycles |
Stat for total number of normal running cycles. More... | |
Stats::Scalar | decodeUnblockCycles |
Stat for total number of unblocking cycles. More... | |
Stats::Scalar | decodeSquashCycles |
Stat for total number of squashing cycles. More... | |
Stats::Scalar | decodeBranchResolved |
Stat for number of times a branch is resolved at decode. More... | |
Stats::Scalar | decodeBranchMispred |
Stat for number of times a branch mispredict is detected. More... | |
Stats::Scalar | decodeControlMispred |
Stat for number of times decode detected a non-control instruction incorrectly predicted as a branch. More... | |
Stats::Scalar | decodeDecodedInsts |
Stat for total number of decoded instructions. More... | |
Stats::Scalar | decodeSquashedInsts |
Stat for total number of squashed instructions. More... | |
DefaultDecode class handles both single threaded and SMT decode.
Its width is specified by the parameters; each cycles it tries to decode that many instructions. Because instructions are actually decoded when the StaticInst is created, this stage does not do much other than check any PC-relative branches.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
enum DefaultDecode::DecodeStatus |
enum DefaultDecode::ThreadStatus |
DefaultDecode< Impl >::DefaultDecode | ( | O3CPU * | _cpu, |
DerivO3CPUParams * | params | ||
) |
DefaultDecode constructor.
Definition at line 62 of file decode_impl.hh.
References DefaultDecode< Impl >::decodeWidth, fatal, DefaultDecode< Impl >::fetchToDecodeDelay, and DefaultDecode< Impl >::skidBufferMax.
|
private |
Switches decode to blocking, and signals back that decode has become blocked.
Definition at line 242 of file decode_impl.hh.
References DPRINTF.
|
private |
Checks all input signals and updates decode's status appropriately.
Definition at line 494 of file decode_impl.hh.
|
private |
Checks all stall signals, and returns if any are true.
Definition at line 221 of file decode_impl.hh.
References DPRINTF.
void DefaultDecode< Impl >::decode | ( | bool & | status_change, |
ThreadID | tid | ||
) |
Determines what to do based on decode's current status.
status_change | decode() sets this variable if there was a status change (ie switching from from blocking to unblocking). |
tid | Thread id to decode instructions from. |
Definition at line 587 of file decode_impl.hh.
void DefaultDecode< Impl >::decodeInsts | ( | ThreadID | tid | ) |
Processes instructions from fetch and passes them on to rename.
Decoding of instructions actually happens when they are created in fetch, so this function mostly checks if PC-relative branches are correct.
Definition at line 632 of file decode_impl.hh.
void DefaultDecode< Impl >::drainSanityCheck | ( | ) | const |
Perform sanity checks after a drain.
Definition at line 199 of file decode_impl.hh.
|
inlineprivate |
Returns if there any instructions from fetch on this cycle.
Definition at line 235 of file decode_impl.hh.
bool DefaultDecode< Impl >::isDrained | ( | ) | const |
std::string DefaultDecode< Impl >::name | ( | ) | const |
Returns the name of decode.
Definition at line 103 of file decode_impl.hh.
|
private |
Reads all stall signals from the backwards communication timebuffer.
Definition at line 480 of file decode_impl.hh.
void DefaultDecode< Impl >::regStats | ( | ) |
void DefaultDecode< Impl >::resetStage | ( | ) |
Definition at line 89 of file decode_impl.hh.
Referenced by DefaultDecode< Impl >::takeOverFrom().
void DefaultDecode< Impl >::setActiveThreads | ( | std::list< ThreadID > * | at_ptr | ) |
Sets pointer to list of active threads.
Definition at line 192 of file decode_impl.hh.
void DefaultDecode< Impl >::setDecodeQueue | ( | TimeBuffer< DecodeStruct > * | dq_ptr | ) |
Sets pointer to time buffer used to communicate to the next stage.
Definition at line 172 of file decode_impl.hh.
References TimeBuffer< T >::getWire().
void DefaultDecode< Impl >::setFetchQueue | ( | TimeBuffer< FetchStruct > * | fq_ptr | ) |
Sets pointer to time buffer coming from fetch.
Definition at line 182 of file decode_impl.hh.
References TimeBuffer< T >::getWire().
void DefaultDecode< Impl >::setTimeBuffer | ( | TimeBuffer< TimeStruct > * | tb_ptr | ) |
Sets the main backwards communication time buffer pointer.
Definition at line 157 of file decode_impl.hh.
References TimeBuffer< T >::getWire().
|
private |
Inserts a thread's instructions into the skid buffer, to be decoded once decode unblocks.
Definition at line 391 of file decode_impl.hh.
References DPRINTF, and X86ISA::size().
|
private |
Returns if all of the skid buffers are empty.
Definition at line 415 of file decode_impl.hh.
|
private |
Separates instructions from fetch into individual lists of instructions sorted by thread.
Definition at line 470 of file decode_impl.hh.
References ArmISA::i.
|
private |
Squashes if there is a PC-relative branch that was predicted incorrectly.
Sends squash information back to fetch.
Definition at line 291 of file decode_impl.hh.
unsigned DefaultDecode< Impl >::squash | ( | ThreadID | tid | ) |
Squashes due to commit signalling a squash.
Changes status to squashing and clears block/unblock signals as needed.
Definition at line 343 of file decode_impl.hh.
References DPRINTF, FullSystem, and ArmISA::i.
void DefaultDecode< Impl >::startupStage | ( | ) |
Definition at line 82 of file decode_impl.hh.
|
inline |
Takes over from another CPU's thread.
Definition at line 132 of file decode.hh.
References DefaultDecode< Impl >::resetStage().
void DefaultDecode< Impl >::tick | ( | ) |
Ticks decode, processing all input signals and decoding as many instructions as possible.
Definition at line 551 of file decode_impl.hh.
References DPRINTF.
|
private |
Switches decode to unblocking if the skid buffer is empty, and signals back that decode has unblocked.
Definition at line 272 of file decode_impl.hh.
|
private |
Updates overall decode status based on all of the threads' statuses.
Definition at line 431 of file decode_impl.hh.
References DPRINTF.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The width of decode, in instructions.
Definition at line 270 of file decode.hh.
Referenced by DefaultDecode< Impl >::DefaultDecode().
|
private |
|
private |
Fetch to decode delay.
Definition at line 267 of file decode.hh.
Referenced by DefaultDecode< Impl >::DefaultDecode().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Maximum size of the skid buffer.
Definition at line 282 of file decode.hh.
Referenced by DefaultDecode< Impl >::DefaultDecode().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |