Go to the documentation of this file.
43 #ifndef __CPU_BASE_DYN_INST_HH__
44 #define __CPU_BASE_DYN_INST_HH__
54 #include "arch/utility.hh"
56 #include "config/the_isa.hh"
65 #include "debug/HtmCpu.hh"
85 using LQIterator =
typename Impl::CPUPol::LSQUnit::LQIterator;
86 using SQIterator =
typename Impl::CPUPol::LSQUnit::SQIterator;
232 sizeof(uint8_t) * ((num + 7) / 8);
239 ptr =
new (cur) T[
count];
240 cur +=
sizeof(T) *
count;
329 return bits(
byte, idx % 8);
538 void dump(std::string &outstring);
594 return !(tempPC ==
predPC);
659 panic(
"Not yet implemented\n");
691 "clearing instuction's transactional state htmUid=%u\n",
1100 return thread->storeCondFailures;
1107 thread->storeCondFailures = sc_failures;
1134 template<
class Impl>
1140 assert(byte_enable.size() == size);
1141 return cpu->pushRequest(
1142 dynamic_cast<typename DynInstPtr::PtrType
>(
this),
1143 true,
nullptr, size,
addr, flags,
nullptr,
nullptr,
1147 template<
class Impl>
1151 return cpu->pushRequest(
1152 dynamic_cast<typename DynInstPtr::PtrType
>(
this),
1153 true,
nullptr, 8, 0x0ul, flags,
nullptr,
nullptr);
1156 template<
class Impl>
1162 assert(byte_enable.size() == size);
1163 return cpu->pushRequest(
1164 dynamic_cast<typename DynInstPtr::PtrType
>(
this),
1165 false,
data, size,
addr, flags, res,
nullptr,
1169 template<
class Impl>
1180 return cpu->pushRequest(
1181 dynamic_cast<typename DynInstPtr::PtrType
>(
this),
1182 false,
nullptr, size,
addr, flags,
nullptr,
1186 #endif // __CPU_BASE_DYN_INST_HH__
void setCCRegOperand(const StaticInst *si, int idx, RegVal val) override
Records a CC register being set to a value.
bool isSerializeAfter() const
bool isInROB() const
Returns whether or not this instruction is in the ROB.
TheISA::PCState predPC
Predicted PC state after this instruction.
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
ThreadContext * tcBase() const override
Returns the thread context.
@ AtCommit
Instruction can commit.
int8_t numCCDestRegs() const
Number of coprocesor destination regs.
@ Squashed
Instruction has committed.
int8_t numIntDestRegs() const
@ CanCommit
Instruction has executed.
@ SquashedInIQ
Instruction is squashed.
@ BlockingInst
Is a recover instruction.
bool isDirectCtrl() const
void translationStarted(bool f)
InstSeqNum seqNum
The sequence number of the instruction.
void setStCondFailures(unsigned int sc_failures) override
Sets the number of consecutive store conditional failures.
LSQRequestPtr savedReq
Saved memory request (needed when the DTB address translation is delayed due to a hw page table walk)...
void setVecPredResult(T &&t)
Predicate result.
bool isUnverifiable() const
void hitExternalSnoop(bool f)
const RegId & destRegIdx(int i) const
Return logical index (architectural reg num) of i'th destination reg.
void renamedDestIdx(int idx, PhysRegIdPtr phys_reg_id)
void renameDestReg(int idx, PhysRegIdPtr renamed_dest, PhysRegIdPtr previous_rename)
Renames a destination register to a physical register.
bool isSquashed() const
Returns whether or not this instruction is squashed.
VecReg::Container VecRegContainer
ImplState * thread
Pointer to the thread state.
Fault & getFault()
TODO: This I added for the LSQRequest side to be able to modify the fault.
void clearSerializeBefore()
Clears the serializeBefore part of this instruction.
void clearIssued()
Clears this instruction as being issued.
Base, ISA-independent static instruction class.
void setExecuted()
Sets this instruction as executed.
bool isSerializing() const
int16_t ThreadID
Thread index/ID type.
Fault fault
The kind of fault this instruction has generated.
uint8_t * memData
Pointer to the data for the memory access.
bool readyToCommit() const
Returns whether or not this instruction is ready to commit.
Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags, const std::vector< bool > &byte_enable) override
const RegId & flattenedDestIdx(int idx) const
Wrapper that groups a few flag bits under the same undelying container.
Addr nextInstAddr() const
Read the PC of the next instruction.
int8_t numCCDestRegs() const
void pcState(const TheISA::PCState &val) override
Set the PC state of this instruction.
uint64_t newHtmTransactionUid() const override
void mwaitAtomic(ThreadContext *tc) override
int ContextID
Globally unique thread context ID.
@ ThreadsyncWait
Is a blocking instruction.
void setSquashed()
Sets this instruction as squashed.
bool isInstPrefetch() const
int8_t numIntDestRegs() const
Number of integer destination regs.
void renameSrcReg(int idx, PhysRegIdPtr renamed_src)
Renames a source logical register to the physical register which has/will produce that logical regist...
void setPredTarg(const TheISA::PCState &_predPC)
Set the predicted target of this current instruction.
bool hitExternalSnoop() const
True if the address hit a external snoop while sitting in the LSQ.
void setVecElemResult(T &&t)
Vector element result.
bool readPredTaken()
Returns whether the instruction was predicted taken or not.
bool hasRequest() const
Has this instruction generated a memory request.
VecPredReg::Container VecPredRegContainer
unsigned int readStCondFailures() const override
Returns the number of consecutive store conditional failures.
bool possibleLoadViolation() const
True if this address was found to match a previous load and they issued out of order.
~BaseDynInst()
BaseDynInst destructor.
std::shared_ptr< Request > RequestPtr
bool isSquashedInIQ() const
Returns whether or not this instruction is squashed in the IQ.
bool isReadBarrier() const
std::bitset< NumStatus > status
The status of this BaseDynInst.
bool isIndirectCtrl() const
unsigned memReqFlags
The memory request flags (from translation).
Trace::InstRecord * traceData
InstRecord that tracks this instructions.
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
bool isSerializeAfter() const
uint8_t readyRegs
How many source registers are ready.
bool isPinnedRegsRenamed() const
Returns whether pinned registers are renamed.
@ RobEntry
Instruction is in the IQ.
bool isSerializeBefore() const
bool isFullMemBarrier() const
std::list< DynInstPtr >::iterator ListIt
void advancePC(PCState &pc, const StaticInstPtr &inst)
void clearSerializeAfter()
Clears the serializeAfter part of this instruction.
bool isTempSerializeAfter()
Checks if this serializeAfter is only temporarily set.
void setTid(ThreadID tid)
Sets the thread id.
bool doneTargCalc()
Checks whether or not this instruction has had its branch target calculated yet.
void setThreadState(ImplState *state)
Sets the pointer to the thread state.
@ SerializeBefore
Is a thread synchronization instruction.
const RegId & destRegIdx(int i) const
Returns the logical register index of the i'th destination register.
Register ID: describe an architectural register with its class and index.
void flattenedDestIdx(int idx, const RegId ®_id)
void setHtmTransactionalState(uint64_t htm_uid, uint64_t htm_depth)
void setCommitted()
Sets this instruction as committed.
Fault writeMem(uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable) override
void setPinnedRegsWritten()
Sets destination registers as written.
static void allocate(T *&ptr, BufCursor &cur, size_t count)
@ CanIssue
Instruction has its result.
bool readyToIssue() const
Returns whether or not this instruction is ready to issue.
PhysRegIdPtr * _prevDestIdx
void setInIQ()
Sets this instruction as a entry the IQ.
void setIntRegOperand(const StaticInst *si, int idx, RegVal val) override
Records an integer register being set to a value.
bool isUncondCtrl() const
bool isSquashedInLSQ() const
Returns whether or not this instruction is squashed in the LSQ.
bool isDataPrefetch() const
std::queue< InstResult > instResult
The result of the instruction; assumes an instruction can have many destination registers.
void markSrcRegReady()
Records that one of the source registers is ready.
void strictlyOrdered(bool so)
bool isFirstMicroop() const
void setVecRegOperand(const StaticInst *si, int idx, const TheISA::VecRegContainer &val) override
Record a vector register being set to a value.
uint8_t resultSize()
Return the size of the instResult queue.
@ SerializeHandled
Needs to serialize instructions behind it.
bool translationStarted() const
True if the DTB address translation has started.
Regs(size_t srcs, size_t dests)
int cpuId() const
Read this CPU's ID.
void renamedSrcIdx(int idx, PhysRegIdPtr phys_reg_id)
uint64_t getHtmTransactionUid() const override
ThreadContext is the external interface to all thread state for anything outside of the CPU.
bool isDelayedCommit() const
bool isFirstMicroop() const
virtual TheISA::PCState branchTarget(const TheISA::PCState &pc) const
Return the target address for a PC-relative branch.
TheISA::PCState pc
PC state for this instruction.
TheISA::PCState branchTarget() const
Returns the branch target address.
void setVecResult(T &&t)
Full vector result.
void setPinnedRegsRenamed()
Sets the destination registers as renamed.
RequestorID requestorId() const
Read this CPU's data requestor ID.
AddressMonitor * getAddrMonitor() override
void setScalarResult(T &&t)
Pushes a result onto the instResult queue.
std::shared_ptr< FaultBase > Fault
bool isSerializeBefore() const
@ PinnedRegsWritten
Pinned registers are renamed.
void setSerializeBefore()
Temporarily sets this instruction as a serialize before instruction.
bool mispredicted()
Returns whether the instruction mispredicted.
bool isSquashAfter() const
bool isDataPrefetch() const
void prevDestIdx(int idx, PhysRegIdPtr phys_reg_id)
Addr predMicroPC()
Returns the predicted micro PC after the branch.
ListIt & getInstListIt()
Returns iterator to this instruction in the list of all insts.
void setMemAccPredicate(bool val) override
ContextID contextId() const
Read this context's system-wide ID.
Addr predInstAddr()
Returns the predicted PC immediately after the branch.
bool isNonSpeculative() const
@ SquashedInROB
Instruction is squashed in the LSQ.
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
void setInLSQ()
Sets this instruction as a entry the LSQ.
void clearCanCommit()
Clears this instruction as being ready to commit.
void setCanCommit()
Sets this instruction as ready to commit.
bool isPinnedRegsWritten() const
Returns whether destination registers are written.
bool isResultReady() const
Returns whether or not the result is ready.
bool isNonSpeculative() const
ListIt instListIt
Iterator pointing to this BaseDynInst in the list of all insts.
size_t numSrcRegs() const
Returns the number of source registers.
static size_t bytesForDests(size_t num)
bool isStoreConditional() const
unsigned effSize
The size of the request.
ssize_t sqIdx
Store queue index.
ImplCPU::ImplState ImplState
bool strictlyOrdered() const
Is this instruction's memory access strictly ordered?
InstResult popResult(InstResult dflt=InstResult())
Pops a result off the instResult queue.
ImplCPU * cpu
Pointer to the Impl's CPU object.
PhysRegIdPtr renamedSrcIdx(int idx) const
PhysRegIdPtr renamedDestIdx(int idx) const
void setFloatRegOperandBits(const StaticInst *si, int idx, RegVal val) override
Records an fp register being set to an integer value.
int8_t numFPDestRegs() const
@ Executed
Instruction has issued.
bool isDelayedCommit() const
bool isExecuted() const
Returns whether or not this instruction has executed.
bool isIndirectCtrl() const
const RegId & srcRegIdx(int i) const
Return logical index (architectural reg num) of i'th source reg.
@ RecoverInst
Regs pinning status updated after squash.
void effAddrValid(bool b)
size_t numDestRegs() const
Returns the number of destination registers.
bool readPredicate() const override
void setInstListIt(ListIt _instListIt)
Sets iterator for this instruction in the list of all insts.
void clearInIQ()
Sets this instruction as a entry the IQ.
void clearInROB()
Sets this instruction as a entry the ROB.
bool isSerializing() const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Fault initiateHtmCmd(Request::Flags flags) override
Initiate an HTM command, e.g.
bool translationCompleted() const
True if the DTB address translation has completed.
@ Issued
Instruction can issue and execute.
bool isFullMemBarrier() const
Addr microPC() const
Read the micro PC of this instruction.
@ SquashedInLSQ
Instruction is squashed in the IQ.
void setSquashedInLSQ()
Sets this instruction as squashed in the LSQ.
BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr ¯oop, TheISA::PCState pc, TheISA::PCState predPC, InstSeqNum seq_num, ImplCPU *cpu)
BaseDynInst constructor given a binary instruction.
bool isWriteBarrier() const
std::bitset< MaxFlags > instFlags
bool eaSrcsReady() const
Returns whether or not the eff.
bool mwait(PacketPtr pkt) override
bool effAddrValid() const
Is the effective virtual address valid.
@ SerializeAfter
Needs to serialize on instructions ahead of it.
bool isTempSerializeBefore()
Checks if this serializeBefore is only temporarily set.
bool isInstPrefetch() const
@ ResultReady
Instruction has completed.
bool inHtmTransactionalState() const override
bool isLastMicroop() const
bool isTranslationDelayed() const
Returns true if the DTB address translation is being delayed due to a hw page table walk.
PhysRegIdPtr prevDestIdx(int idx) const
TheISA::PCState pcState() const override
Read the PC state of this instruction.
void possibleLoadViolation(bool f)
void setSquashedInROB()
Sets this instruction as squashed in the ROB.
Derive from RefCounted if you want to enable reference counting of this class.
Impl::DynInstPtr DynInstPtr
typename Impl::CPUPol::LSQ::LSQRequest * LSQRequestPtr
int8_t numVecDestRegs() const
Number of vector destination regs.
bool isSquashAfter() const
const StaticInstPtr staticInst
The StaticInst used by this BaseDynInst.
void setPinnedRegsSquashDone()
Sets dest registers' status updated after squash.
void setVecPredRegOperand(const StaticInst *si, int idx, const TheISA::VecPredRegContainer &val) override
Record a vector register being set to a value.
Addr predNextInstAddr()
Returns the predicted PC two instructions after the branch.
bool memOpDone() const
Whether or not the memory operation is done.
void clearHtmTransactionalState()
bool isLastMicroop() const
GenericISA::DelaySlotPCState< MachInst > PCState
@ Committed
Instruction has reached commit.
void setCompleted()
Sets this instruction as completed.
bool isWriteBarrier() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
bool isCommitted() const
Returns whether or not this instruction is committed.
int8_t numVecPredDestRegs() const
void setIssued()
Sets this instruction as issued from the IQ.
void setCanIssue()
Sets this instruction as ready to issue.
OpClass opClass() const
Returns the opclass of this instruction.
void armMonitor(Addr address) override
int8_t numVecElemDestRegs() const
typename Impl::CPUPol::LSQUnit::LQIterator LQIterator
std::unique_ptr< uint8_t[]> BackingStorePtr
void setRequest()
Assert this instruction has generated a memory request.
bool isReadBarrier() const
void demapPage(Addr vaddr, uint64_t asn) override
Invalidate a page in the DTLB and ITLB.
typename Impl::CPUPol::LSQUnit::SQIterator SQIterator
bool readMemAccPredicate() const override
Addr instAddr() const
Read the PC of this instruction.
void readySrcIdx(int idx, bool ready)
bool isDirectCtrl() const
const RegId & srcRegIdx(int i) const
Returns the logical register index of the i'th source register.
@ LsqEntry
Instruction is in the ROB.
Collect register related information into a single struct.
bool isPinnedRegsSquashDone() const
Return whether dest registers' pinning status updated after squash.
bool isSerializeHandled()
Checks if the serialization part of this instruction has been handled.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
bool isCompleted() const
Returns whether or not this instruction is completed.
bool isUnverifiable() const
void setPredicate(bool val)
bool isIssued() const
Returns whether or not this instruction has issued.
@ PinnedRegsRenamed
Instruction is squashed in the ROB.
void recordResult(bool f)
Records changes to result?
ThreadID threadNumber
The thread this instruction is from.
int8_t numVecDestRegs() const
If you want a reference counting pointer to a mutable object, create it like this:
void setPredicate(bool val) override
@ Completed
Instruction is in the LSQ.
void translationCompleted(bool f)
void dump()
Dumps out contents of this BaseDynInst.
Fault initiateMemAMO(Addr addr, unsigned size, Request::Flags flags, AtomicOpFunctorPtr amo_op) override
void setSquashedInIQ()
Sets this instruction as squashed in the IQ.
bool readySrcIdx(int idx) const
Addr physEffAddr
The effective physical address.
bool isSquashedInROB() const
Returns whether or not this instruction is squashed in the ROB.
const StaticInstPtr macroop
The Macroop if one exists.
void setPredTaken(bool predicted_taken)
ssize_t lqIdx
Load queue index.
uint64_t getHtmTransactionalDepth() const override
static size_t bytesForSources(size_t num)
void initVars()
Function to initialize variables in the constructors.
BackingStorePtr::pointer BufCursor
uint32_t socketId() const
Read this CPU's Socket ID.
void setInROB()
Sets this instruction as a entry the ROB.
void setResultReady()
Marks the result as ready.
void clearCanIssue()
Clears this instruction being able to issue.
int8_t numFPDestRegs() const
Number of floating-point destination regs.
int8_t numVecElemDestRegs() const
Number of vector element destination regs.
int8_t numVecPredDestRegs() const
Number of predicate destination regs.
Fault getFault() const
Returns the fault type.
RefCountingPtr< BaseDynInst< Impl > > BaseDynInstPtr
void setSerializeAfter()
Temporarily sets this instruction as a serialize after instruction.
void setSerializeHandled()
Sets the serialization part of this instruction as handled.
@ NumStatus
Serialization has been handled.
@ PinnedRegsSquashDone
Pinned registers are written back.
const TheISA::PCState & readPredTarg()
constexpr void replaceBits(T &val, unsigned first, unsigned last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
bool isInLSQ() const
Returns whether or not this instruction is in the LSQ.
Addr effAddr
The effective virtual address (lds & stores only).
bool isUncondCtrl() const
bool isInIQ() const
Returns whether or not this instruction has issued.
void setVecElemOperand(const StaticInst *si, int idx, const TheISA::VecElem val) override
Record a vector register being set to a value.
#define panic(...)
This implements a cprintf based panic() function.
bool isStoreConditional() const
void removeInLSQ()
Sets this instruction as a entry the LSQ.
Generated on Tue Mar 23 2021 19:41:24 for gem5 by doxygen 1.8.17