gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::minor::Execute Class Reference

Execute stage. More...

#include <execute.hh>

Inheritance diagram for gem5::minor::Execute:
gem5::Named

Classes

struct  ExecuteThreadInfo
 

Public Member Functions

 Execute (const std::string &name_, MinorCPU &cpu_, const BaseMinorCPUParams &params, Latch< ForwardInstData >::Output inp_, Latch< BranchData >::Input out_)
 
 ~Execute ()
 
MinorCPU::MinorCPUPortgetDcachePort ()
 Returns the DcachePort owned by this Execute to pass upwards.
 
LSQgetLSQ ()
 To allow ExecContext to find the LSQ.
 
bool instIsRightStream (MinorDynInstPtr inst)
 Does the given instruction have the right stream sequence number to be committed?
 
bool instIsHeadInst (MinorDynInstPtr inst)
 Returns true if the given instruction is at the head of the inFlightInsts instruction queue.
 
void evaluate ()
 Pass on input/buffer data to the output if you can.
 
void minorTrace () const
 
bool isDrained ()
 After thread suspension, has Execute been drained of in-flight instructions and memory accesses.
 
unsigned int drain ()
 Like the drain interface on SimObject.
 
void drainResume ()
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 

Public Attributes

std::vector< InputBuffer< ForwardInstData > > inputBuffer
 

Protected Types

enum  DrainState { NotDraining , DrainCurrentInst , DrainHaltFetch , DrainAllInsts }
 Stage cycle-by-cycle state. More...
 

Protected Member Functions

const ForwardInstDatagetInput (ThreadID tid)
 Get a piece of data to work on from the inputBuffer, or 0 if there is no data.
 
void popInput (ThreadID tid)
 Pop an element off the input buffer, if there are any.
 
void tryToBranch (MinorDynInstPtr inst, Fault fault, BranchData &branch)
 Generate Branch data based (into branch) on an observed (or not) change in PC while executing an instruction.
 
void updateBranchData (ThreadID tid, BranchData::Reason reason, MinorDynInstPtr inst, const PCStateBase &target, BranchData &branch)
 Actually create a branch to communicate to Fetch1/Fetch2 and, if that is a stream-changing branch update the streamSeqNum.
 
void handleMemResponse (MinorDynInstPtr inst, LSQ::LSQRequestPtr response, BranchData &branch, Fault &fault)
 Handle extracting mem ref responses from the memory queues and completing the associated instructions.
 
bool executeMemRefInst (MinorDynInstPtr inst, BranchData &branch, bool &failed_predicate, Fault &fault)
 Execute a memory reference instruction.
 
bool isInterrupted (ThreadID thread_id) const
 Has an interrupt been raised.
 
bool isInbetweenInsts (ThreadID thread_id) const
 Are we between instructions? Can we be interrupted?
 
bool takeInterrupt (ThreadID thread_id, BranchData &branch)
 Act on an interrupt.
 
unsigned int issue (ThreadID thread_id)
 Try and issue instructions from the inputBuffer.
 
bool tryPCEvents (ThreadID thread_id)
 Try to act on PC-related events.
 
void doInstCommitAccounting (MinorDynInstPtr inst)
 Do the stats handling and instruction count and PC event events related to the new instruction/op counts.
 
ThreadID checkInterrupts (BranchData &branch, bool &interrupted)
 Check all threads for possible interrupts.
 
bool hasInterrupt (ThreadID thread_id)
 Checks if a specific thread has an interrupt.
 
bool commitInst (MinorDynInstPtr inst, bool early_memory_issue, BranchData &branch, Fault &fault, bool &committed, bool &completed_mem_issue)
 Commit a single instruction.
 
void commit (ThreadID thread_id, bool only_commit_microops, bool discard, BranchData &branch)
 Try and commit instructions from the ends of the functional unit pipelines.
 
void setDrainState (ThreadID thread_id, DrainState state)
 Set the drain state (with useful debugging messages)
 
ThreadID getCommittingThread ()
 Use the current threading policy to determine the next thread to decode from.
 
ThreadID getIssuingThread ()
 

Protected Attributes

Latch< ForwardInstData >::Output inp
 Input port carrying instructions from Decode.
 
Latch< BranchData >::Input out
 Input port carrying stream changes to Fetch1.
 
MinorCPUcpu
 Pointer back to the containing CPU.
 
unsigned int issueLimit
 Number of instructions that can be issued per cycle.
 
unsigned int memoryIssueLimit
 Number of memory ops that can be issued per cycle.
 
unsigned int commitLimit
 Number of instructions that can be committed per cycle.
 
unsigned int memoryCommitLimit
 Number of memory instructions that can be committed per cycle.
 
bool processMoreThanOneInput
 If true, more than one input line can be processed each cycle if there is room to execute more instructions than taken from the first line.
 
MinorFUPoolfuDescriptions
 Descriptions of the functional units we want to generate.
 
unsigned int numFuncUnits
 Number of functional units to produce.
 
Cycles longestFuLatency
 Longest latency of any FU, useful for setting up the activity recoder.
 
bool setTraceTimeOnCommit
 Modify instruction trace times on commit.
 
bool setTraceTimeOnIssue
 Modify instruction trace times on issue.
 
bool allowEarlyMemIssue
 Allow mem refs to leave their FUs before reaching the head of the in flight insts queue if their dependencies are met.
 
unsigned int noCostFUIndex
 The FU index of the non-existent costless FU for instructions which pass the MinorDynInst::isNoCostInst test.
 
LSQ lsq
 Dcache port to pass on to the CPU.
 
std::vector< Scoreboardscoreboard
 Scoreboard of instruction dependencies.
 
std::vector< FUPipeline * > funcUnits
 The execution functional units.
 
std::vector< ExecuteThreadInfoexecuteInfo
 
ThreadID interruptPriority
 
ThreadID issuePriority
 
ThreadID commitPriority
 

Friends

std::ostream & operator<< (std::ostream &os, Execute::DrainState state)
 

Detailed Description

Execute stage.

Everything apart from fetching and decoding instructions. The LSQ lives here too.

Definition at line 67 of file execute.hh.

Member Enumeration Documentation

◆ DrainState

Stage cycle-by-cycle state.

State that drain passes through (in order). On a drain request, Execute transitions into either DrainCurrentInst (if between microops) or DrainHaltFetch.

Note that Execute doesn't actually have * a 'Drained' state, only an indication that it's currently draining and isDrained that can't tell if there are insts still in the pipeline leading up to Execute

Enumerator
NotDraining 
DrainCurrentInst 
DrainHaltFetch 
DrainAllInsts 

Definition at line 144 of file execute.hh.

Constructor & Destructor Documentation

◆ Execute()

gem5::minor::Execute::Execute ( const std::string & name_,
MinorCPU & cpu_,
const BaseMinorCPUParams & params,
Latch< ForwardInstData >::Output inp_,
Latch< BranchData >::Input out_ )

◆ ~Execute()

gem5::minor::Execute::~Execute ( )

Member Function Documentation

◆ checkInterrupts()

ThreadID gem5::minor::Execute::checkInterrupts ( BranchData & branch,
bool & interrupted )
protected

Check all threads for possible interrupts.

If interrupt is taken, returns the tid of the thread. interrupted is set if any thread has an interrupt, irrespective of if it is taken

Definition at line 1608 of file execute.cc.

References cpu, DPRINTF, executeInfo, gem5::FullSystem, gem5::BaseCPU::getInterruptController(), interruptPriority, gem5::InvalidThreadID, isInbetweenInsts(), isInterrupted(), NotDraining, gem5::BaseCPU::numThreads, and takeInterrupt().

Referenced by evaluate().

◆ commit()

void gem5::minor::Execute::commit ( ThreadID thread_id,
bool only_commit_microops,
bool discard,
BranchData & branch )
protected

Try and commit instructions from the ends of the functional unit pipelines.

If only_commit_microops is true then only commit upto the end of the currect full instruction. If discard is true then discard all instructions rather than committing. branch is set to any branch raised during commit.

Try and execute as many instructions from the end of FU pipelines as possible. This doesn't include actually advancing the pipelines.

We do this by looping on the front of the inFlightInsts queue for as long as we can find the desired instruction at the end of the functional unit it was issued to without seeing a branch or a fault. In this function, these terms are used: complete – The instruction has finished its passage through its functional unit and its fate has been decided (committed, discarded, issued to the memory system) commit – The instruction is complete(d), not discarded and has its effects applied to the CPU state discard(ed) – The instruction is complete but not committed as its streamSeqNum disagrees with the current Execute::streamSeqNum

Commits are also possible from two other places:

1) Responses returning from the LSQ 2) Mem ops issued to the LSQ ('committed' from the FUs) earlier than their position in the inFlightInsts queue, but after all their dependencies are resolved.

Definition at line 1030 of file execute.cc.

References gem5::minor::MinorDynInst::bubble(), gem5::minor::LSQ::canRequest(), commitInst(), commitLimit, gem5::minor::LSQ::completeMemBarrierInst(), cpu, gem5::Clocked::curCycle(), gem5::curTick(), DPRINTF, executeInfo, gem5::BaseCPU::executeStats, gem5::minor::LSQ::findResponse(), gem5::PowerISA::fu, funcUnits, gem5::BaseCPU::getContext(), gem5::minor::LSQ::getLastMemBarrier(), handleMemResponse(), gem5::minor::Execute::ExecuteThreadInfo::inFlightInsts, gem5::minor::Execute::ExecuteThreadInfo::inFUMemInsts, gem5::minor::QueuedInst::inst, gem5::minor::ForwardInstData::insts, gem5::minor::Execute::ExecuteThreadInfo::instsBeingCommitted, isInbetweenInsts(), gem5::minor::BranchData::isStreamChange(), gem5::minor::Execute::ExecuteThreadInfo::lastCommitWasEndOfMacroop, gem5::minor::Execute::ExecuteThreadInfo::lastPredictionSeqNum, lsq, memoryCommitLimit, noCostFUIndex, gem5::NoFault, gem5::ThreadContext::pcState(), gem5::minor::LSQ::popResponse(), scoreboard, setTraceTimeOnCommit, gem5::minor::Execute::ExecuteThreadInfo::streamSeqNum, tryPCEvents(), gem5::minor::BranchData::UnpredictedBranch, and updateBranchData().

Referenced by evaluate().

◆ commitInst()

bool gem5::minor::Execute::commitInst ( MinorDynInstPtr inst,
bool early_memory_issue,
BranchData & branch,
Fault & fault,
bool & committed,
bool & completed_mem_issue )
protected

Commit a single instruction.

Returns true if the instruction being examined was completed (fully executed, discarded, or initiated a memory access), false if there is still some processing to do. fu_index is the index of the functional unit this instruction is being executed in into for funcUnits If early_memory_issue is true then this is an early execution of a mem ref and so faults will not be processed. If the return value is true: fault is set if a fault happened, branch is set to indicate any branch that occurs committed is set to true if this instruction is committed (and so needs to be traced and accounted for) completed_mem_issue is set if the instruction was a memory access that was issued

Definition at line 888 of file execute.cc.

References gem5::minor::LSQ::canPushIntoStoreBuffer(), cpu, doInstCommitAccounting(), DPRINTF, executeInfo, executeMemRefInst(), gem5::BaseCPU::fetchStats, gem5::BaseCPU::getContext(), gem5::minor::BranchData::isBubble(), isInterrupted(), lsq, gem5::NoFault, panic, gem5::ThreadContext::pcState(), gem5::minor::ExecContext::readPredicate(), gem5::ThreadContext::status(), gem5::ThreadContext::Suspended, gem5::minor::BranchData::SuspendThread, gem5::MinorCPU::threads, tryToBranch(), and updateBranchData().

Referenced by commit().

◆ doInstCommitAccounting()

◆ drain()

◆ drainResume()

◆ evaluate()

◆ executeMemRefInst()

bool gem5::minor::Execute::executeMemRefInst ( MinorDynInstPtr inst,
BranchData & branch,
bool & failed_predicate,
Fault & fault )
protected

Execute a memory reference instruction.

This calls initiateAcc on the instruction which will then call writeMem or readMem to issue a memory access to the LSQ. Returns true if the instruction was executed rather than stalled because of a lack of LSQ resources and false otherwise. branch is set to any branch raised by the instruction. failed_predicate is set to false if the instruction passed its predicate and so will access memory or true if the instruction failed its predicate and is now complete. fault is set if any non-NoFault fault is raised. Any faults raised are actually invoke-d by this function.

Definition at line 450 of file execute.cc.

References gem5::minor::LSQ::canRequest(), gem5::PCStateBase::clone(), cpu, DPRINTF, gem5::BaseCPU::getContext(), lsq, gem5::NoFault, gem5::ThreadContext::pcState(), gem5::minor::LSQ::pushFailedRequest(), gem5::minor::ExecContext::readMemAccPredicate(), gem5::minor::ExecContext::readPredicate(), and gem5::MinorCPU::threads.

Referenced by commitInst().

◆ getCommittingThread()

◆ getDcachePort()

MinorCPU::MinorCPUPort & gem5::minor::Execute::getDcachePort ( )

Returns the DcachePort owned by this Execute to pass upwards.

Definition at line 1890 of file execute.cc.

References gem5::minor::LSQ::getDcachePort(), and lsq.

Referenced by gem5::minor::Pipeline::getDataPort().

◆ getInput()

const ForwardInstData * gem5::minor::Execute::getInput ( ThreadID tid)
protected

Get a piece of data to work on from the inputBuffer, or 0 if there is no data.

Definition at line 198 of file execute.cc.

References inputBuffer, and gem5::minor::ForwardInstData::isBubble().

Referenced by evaluate(), getIssuingThread(), and issue().

◆ getIssuingThread()

ThreadID gem5::minor::Execute::getIssuingThread ( )
inlineprotected

◆ getLSQ()

LSQ & gem5::minor::Execute::getLSQ ( )
inline

◆ handleMemResponse()

void gem5::minor::Execute::handleMemResponse ( MinorDynInstPtr inst,
LSQ::LSQRequestPtr response,
BranchData & branch,
Fault & fault )
protected

Handle extracting mem ref responses from the memory queues and completing the associated instructions.

Fault is an output and will contain any fault caused (and already invoked by the function) Sets branch to any branch generated by the instruction.

Definition at line 325 of file execute.cc.

References cpu, doInstCommitAccounting(), DPRINTF, fatal, gem5::Packet::getAddr(), gem5::Packet::getConstPtr(), gem5::BaseCPU::getContext(), gem5::Packet::getSize(), gem5::Packet::isError(), lsq, gem5::minor::LSQ::LSQRequest::needsToBeSentToStoreBuffer(), gem5::NoFault, gem5::minor::LSQ::LSQRequest::packet, gem5::minor::LSQ::popResponse(), gem5::minor::ExecContext::readMemAccPredicate(), gem5::minor::ExecContext::readPredicate(), gem5::minor::LSQ::sendStoreToStoreBuffer(), gem5::MinorCPU::threads, and tryToBranch().

Referenced by commit().

◆ hasInterrupt()

bool gem5::minor::Execute::hasInterrupt ( ThreadID thread_id)
protected

Checks if a specific thread has an interrupt.

No action is taken. this is used for determining if a thread should only commit microops

Definition at line 1643 of file execute.cc.

References cpu, executeInfo, gem5::FullSystem, gem5::BaseCPU::getInterruptController(), isInterrupted(), and NotDraining.

Referenced by evaluate().

◆ instIsHeadInst()

bool gem5::minor::Execute::instIsHeadInst ( MinorDynInstPtr inst)

Returns true if the given instruction is at the head of the inFlightInsts instruction queue.

Definition at line 1879 of file execute.cc.

References executeInfo.

Referenced by gem5::minor::LSQ::tryToSendToTransfers().

◆ instIsRightStream()

bool gem5::minor::Execute::instIsRightStream ( MinorDynInstPtr inst)

Does the given instruction have the right stream sequence number to be committed?

Definition at line 1873 of file execute.cc.

References executeInfo.

Referenced by gem5::minor::LSQ::tryToSendToTransfers().

◆ isDrained()

bool gem5::minor::Execute::isDrained ( )

After thread suspension, has Execute been drained of in-flight instructions and memory accesses.

Definition at line 1847 of file execute.cc.

References cpu, executeInfo, inputBuffer, gem5::minor::LSQ::isDrained(), lsq, and gem5::BaseCPU::numThreads.

Referenced by drain(), and gem5::minor::Pipeline::isDrained().

◆ isInbetweenInsts()

bool gem5::minor::Execute::isInbetweenInsts ( ThreadID thread_id) const
protected

Are we between instructions? Can we be interrupted?

Definition at line 1414 of file execute.cc.

References gem5::minor::LSQ::accessesInFlight(), executeInfo, and lsq.

Referenced by checkInterrupts(), commit(), drain(), evaluate(), and minorTrace().

◆ isInterrupted()

bool gem5::minor::Execute::isInterrupted ( ThreadID thread_id) const
protected

Has an interrupt been raised.

Definition at line 416 of file execute.cc.

References gem5::BaseCPU::checkInterrupts(), and cpu.

Referenced by checkInterrupts(), commitInst(), and hasInterrupt().

◆ issue()

◆ minorTrace()

◆ popInput()

void gem5::minor::Execute::popInput ( ThreadID tid)
protected

Pop an element off the input buffer, if there are any.

Definition at line 211 of file execute.cc.

References executeInfo, and inputBuffer.

Referenced by evaluate(), and issue().

◆ setDrainState()

void gem5::minor::Execute::setDrainState ( ThreadID thread_id,
DrainState state )
protected

Set the drain state (with useful debugging messages)

Definition at line 1818 of file execute.cc.

References DPRINTF, executeInfo, and state.

Referenced by drain(), drainResume(), and evaluate().

◆ takeInterrupt()

bool gem5::minor::Execute::takeInterrupt ( ThreadID thread_id,
BranchData & branch )
protected

◆ tryPCEvents()

bool gem5::minor::Execute::tryPCEvents ( ThreadID thread_id)
protected

Try to act on PC-related events.

Returns true if any were executed

Definition at line 834 of file execute.cc.

References cpu, DPRINTF, gem5::BaseCPU::getContext(), gem5::PCStateBase::instAddr(), gem5::ThreadContext::pcState(), and gem5::MinorCPU::threads.

Referenced by commit().

◆ tryToBranch()

void gem5::minor::Execute::tryToBranch ( MinorDynInstPtr inst,
Fault fault,
BranchData & branch )
protected

◆ updateBranchData()

void gem5::minor::Execute::updateBranchData ( ThreadID tid,
BranchData::Reason reason,
MinorDynInstPtr inst,
const PCStateBase & target,
BranchData & branch )
protected

Actually create a branch to communicate to Fetch1/Fetch2 and, if that is a stream-changing branch update the streamSeqNum.

Definition at line 299 of file execute.cc.

References DPRINTF, executeInfo, gem5::minor::BranchData::isStreamChange(), and gem5::minor::BranchData::NoBranch.

Referenced by commit(), commitInst(), evaluate(), takeInterrupt(), and tryToBranch().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
Execute::DrainState state )
friend

Definition at line 1793 of file execute.cc.

Member Data Documentation

◆ allowEarlyMemIssue

bool gem5::minor::Execute::allowEarlyMemIssue
protected

Allow mem refs to leave their FUs before reaching the head of the in flight insts queue if their dependencies are met.

Definition at line 115 of file execute.hh.

Referenced by issue().

◆ commitLimit

unsigned int gem5::minor::Execute::commitLimit
protected

Number of instructions that can be committed per cycle.

Definition at line 87 of file execute.hh.

Referenced by commit(), and Execute().

◆ commitPriority

ThreadID gem5::minor::Execute::commitPriority
protected

Definition at line 211 of file execute.hh.

Referenced by getCommittingThread().

◆ cpu

◆ executeInfo

◆ fuDescriptions

MinorFUPool& gem5::minor::Execute::fuDescriptions
protected

Descriptions of the functional units we want to generate.

Definition at line 98 of file execute.hh.

Referenced by Execute().

◆ funcUnits

std::vector<FUPipeline *> gem5::minor::Execute::funcUnits
protected

The execution functional units.

Definition at line 128 of file execute.hh.

Referenced by commit(), evaluate(), Execute(), getCommittingThread(), issue(), minorTrace(), and ~Execute().

◆ inp

Latch<ForwardInstData>::Output gem5::minor::Execute::inp
protected

Input port carrying instructions from Decode.

Definition at line 72 of file execute.hh.

Referenced by evaluate().

◆ inputBuffer

std::vector<InputBuffer<ForwardInstData> > gem5::minor::Execute::inputBuffer

Definition at line 131 of file execute.hh.

Referenced by evaluate(), Execute(), getInput(), isDrained(), minorTrace(), and popInput().

◆ interruptPriority

ThreadID gem5::minor::Execute::interruptPriority
protected

Definition at line 209 of file execute.hh.

Referenced by checkInterrupts().

◆ issueLimit

unsigned int gem5::minor::Execute::issueLimit
protected

Number of instructions that can be issued per cycle.

Definition at line 81 of file execute.hh.

Referenced by Execute(), and issue().

◆ issuePriority

ThreadID gem5::minor::Execute::issuePriority
protected

Definition at line 210 of file execute.hh.

Referenced by getIssuingThread().

◆ longestFuLatency

Cycles gem5::minor::Execute::longestFuLatency
protected

Longest latency of any FU, useful for setting up the activity recoder.

Definition at line 105 of file execute.hh.

◆ lsq

LSQ gem5::minor::Execute::lsq
protected

◆ memoryCommitLimit

unsigned int gem5::minor::Execute::memoryCommitLimit
protected

Number of memory instructions that can be committed per cycle.

Definition at line 90 of file execute.hh.

Referenced by commit(), and Execute().

◆ memoryIssueLimit

unsigned int gem5::minor::Execute::memoryIssueLimit
protected

Number of memory ops that can be issued per cycle.

Definition at line 84 of file execute.hh.

Referenced by Execute(), and issue().

◆ noCostFUIndex

unsigned int gem5::minor::Execute::noCostFUIndex
protected

The FU index of the non-existent costless FU for instructions which pass the MinorDynInst::isNoCostInst test.

Definition at line 119 of file execute.hh.

Referenced by commit(), getCommittingThread(), and issue().

◆ numFuncUnits

unsigned int gem5::minor::Execute::numFuncUnits
protected

Number of functional units to produce.

Definition at line 101 of file execute.hh.

Referenced by evaluate(), Execute(), issue(), minorTrace(), and ~Execute().

◆ out

Latch<BranchData>::Input gem5::minor::Execute::out
protected

Input port carrying stream changes to Fetch1.

Definition at line 75 of file execute.hh.

Referenced by evaluate().

◆ processMoreThanOneInput

bool gem5::minor::Execute::processMoreThanOneInput
protected

If true, more than one input line can be processed each cycle if there is room to execute more instructions than taken from the first line.

Definition at line 95 of file execute.hh.

Referenced by issue().

◆ scoreboard

std::vector<Scoreboard> gem5::minor::Execute::scoreboard
protected

Scoreboard of instruction dependencies.

Definition at line 125 of file execute.hh.

Referenced by commit(), evaluate(), Execute(), issue(), and minorTrace().

◆ setTraceTimeOnCommit

bool gem5::minor::Execute::setTraceTimeOnCommit
protected

Modify instruction trace times on commit.

Definition at line 108 of file execute.hh.

Referenced by commit().

◆ setTraceTimeOnIssue

bool gem5::minor::Execute::setTraceTimeOnIssue
protected

Modify instruction trace times on issue.

Definition at line 111 of file execute.hh.

Referenced by issue().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:20 for gem5 by doxygen 1.11.0