43 #ifndef __CPU_BASE_DYN_INST_HH__ 44 #define __CPU_BASE_DYN_INST_HH__ 53 #include "arch/utility.hh" 55 #include "config/the_isa.hh" 84 using LQIterator =
typename Impl::CPUPol::LSQUnit::LQIterator;
85 using SQIterator =
typename Impl::CPUPol::LSQUnit::SQIterator;
289 cpu->demapPage(vaddr, asn);
293 cpu->demapPage(vaddr, asn);
297 cpu->demapPage(vaddr, asn);
352 return _destRegIdx[idx];
359 return _srcRegIdx[idx];
367 return _flatDestRegIdx[idx];
375 return _prevDestRegIdx[idx];
385 _destRegIdx[idx] = renamed_dest;
386 _prevDestRegIdx[idx] = previous_rename;
397 _srcRegIdx[idx] = renamed_src;
405 _flatDestRegIdx[idx] = flattened_dest;
435 void dump(std::string &outstring);
438 int cpuId()
const {
return cpu->cpuId(); }
441 uint32_t
socketId()
const {
return cpu->socketId(); }
495 return !(tempPC ==
predPC);
613 if (!instResult.empty()) {
712 return this->_readySrcRegIdx[idx];
861 status.set(PinnedRegsSquashDone);
936 {
return thread->storeCondFailures; }
940 { thread->storeCondFailures = sc_failures; }
947 {
return cpu->mwaitAtomic(threadNumber, tc, cpu->dtb); }
949 {
return cpu->getCpuAddrMonitor(threadNumber); }
958 assert(byte_enable.empty() || byte_enable.size() == size);
959 return cpu->pushRequest(
960 dynamic_cast<typename DynInstPtr::PtrType>(
this),
961 true,
nullptr, size, addr, flags,
nullptr,
nullptr,
971 assert(byte_enable.empty() || byte_enable.size() == size);
972 return cpu->pushRequest(
973 dynamic_cast<typename DynInstPtr::PtrType>(
this),
974 false, data, size, addr, flags, res,
nullptr,
989 return cpu->pushRequest(
990 dynamic_cast<typename DynInstPtr::PtrType>(
this),
991 false,
nullptr, size, addr, flags,
nullptr,
995 #endif // __CPU_BASE_DYN_INST_HH__
bool isInLSQ() const
Returns whether or not this instruction is in the LSQ.
const TheISA::PCState & readPredTarg()
Instruction has reached commit.
bool isCondDelaySlot() const
Is a blocking instruction.
void setFloatRegOperandBits(const StaticInst *si, int idx, RegVal val)
Records an fp register being set to an integer value.
void setSquashed()
Sets this instruction as squashed.
bool isSquashedInROB() const
Returns whether or not this instruction is squashed in the ROB.
void renameSrcReg(int idx, PhysRegIdPtr renamed_src)
Renames a source logical register to the physical register which has/will produce that logical regist...
int8_t numSrcRegs() const
Number of source registers.
uint32_t socketId() const
Read this CPU's Socket ID.
bool mwait(PacketPtr pkt)
~BaseDynInst()
BaseDynInst destructor.
void demapDataPage(Addr vaddr, uint64_t asn)
void clearCanIssue()
Clears this instruction being able to issue.
void setExecuted()
Sets this instruction as executed.
Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags, const std::vector< bool > &byte_enable=std::vector< bool >())
bool isDelayedCommit() const
std::bitset< NumStatus > status
The status of this BaseDynInst.
InstSeqNum seqNum
The sequence number of the instruction.
Serialization has been handled.
Instruction has its result.
int8_t numCCDestRegs() const
unsigned memReqFlags
The memory request flags (from translation).
Instruction is in the LSQ.
Vector Register Abstraction This generic class is the model in a particularization of MVC...
bool isInIQ() const
Returns whether or not this instruction has issued.
bool isUnverifiable() const
bool isInstPrefetch() const
uint8_t readyRegs
How many source registers are ready.
MasterID masterId() const
Read this CPU's data requestor ID.
bool hitExternalSnoop() const
True if the address hit a external snoop while sitting in the LSQ.
int16_t lqIdx
Load queue index.
Needs to serialize instructions behind it.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
bool isSerializeAfter() const
void clearSerializeAfter()
Clears the serializeAfter part of this instruction.
std::shared_ptr< Request > RequestPtr
int8_t numVecElemDestRegs() const
Number of vector element destination regs.
int8_t numVecPredDestRegs() const
Number of predicate destination regs.
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Fault fault
The kind of fault this instruction has generated.
void setCommitted()
Sets this instruction as committed.
void setVecPredRegOperand(const StaticInst *si, int idx, const VecPredRegContainer &val)
Record a vector register being set to a value.
bool readMemAccPredicate() const
uint8_t * memData
Pointer to the data for the memory access.
int8_t numDestRegs() const
Number of destination registers.
int8_t numIntDestRegs() const
bool isUnverifiable() const
LSQRequestPtr savedReq
Saved memory request (needed when the DTB address translation is delayed due to a hw page table walk)...
Addr nextInstAddr() const
Read the PC of the next instruction.
Is a thread synchronization instruction.
void setInIQ()
Sets this instruction as a entry the IQ.
void setVecPredResult(T &&t)
Predicate result.
std::array< PhysRegIdPtr, TheISA::MaxInstDestRegs > _destRegIdx
Physical register index of the destination registers of this instruction.
void hitExternalSnoop(bool f)
Trace::InstRecord * traceData
InstRecord that tracks this instructions.
bool isDataPrefetch() const
bool isIndirectCtrl() const
void markSrcRegReady()
Records that one of the source registers is ready.
const RegId & srcRegIdx(int i) const
Return logical index (architectural reg num) of i'th source reg.
bool isSerializeBefore() const
bool isSquashed() const
Returns whether or not this instruction is squashed.
void mwaitAtomic(ThreadContext *tc)
bool isSerializeBefore() const
bool readPredTaken()
Returns whether the instruction was predicted taken or not.
std::list< DynInstPtr >::iterator ListIt
Fault & getFault()
TODO: This I added for the LSQRequest side to be able to modify the fault.
bool isTempSerializeAfter()
Checks if this serializeAfter is only temporarily set.
void clearSerializeBefore()
Clears the serializeBefore part of this instruction.
void setThreadState(ImplState *state)
Sets the pointer to the thread state.
int8_t numFPDestRegs() const
Number of floating-point destination regs.
void clearIssued()
Clears this instruction as being issued.
void setStCondFailures(unsigned int sc_failures)
Sets the number of consecutive store conditional failures.
void setPinnedRegsWritten()
Sets destination registers as written.
void setVecResult(T &&t)
Full vector result.
If you want a reference counting pointer to a mutable object, create it like this: ...
ThreadContext is the external interface to all thread state for anything outside of the CPU...
bool isIndirectCtrl() const
void setPinnedRegsRenamed()
Sets the destination registers as renamed.
bool isMicroBranch() const
bool isDirectCtrl() const
bool isUncondCtrl() const
void setScalarResult(T &&t)
Pushes a result onto the instResult queue.
bool isMemBarrier() const
PhysRegIdPtr renamedDestRegIdx(int idx) const
Returns the physical register index of the i'th destination register.
void setVecElemOperand(const StaticInst *si, int idx, const VecElem val)
Record a vector register being set to a value.
Regs pinning status updated after squash.
void armMonitor(Addr address)
uint8_t resultSize()
Return the size of the instResult queue.
void setPredTarg(const TheISA::PCState &_predPC)
Set the predicted target of this current instruction.
void setVecElemResult(T &&t)
Vector element result.
bool translationStarted() const
True if the DTB address translation has started.
bool hasRequest() const
Has this instruction generated a memory request.
int8_t numSrcRegs() const
Returns the number of source registers.
ContextID contextId() const
Read this context's system-wide ID.
bool possibleLoadViolation() const
True if this address was found to match a previous load and they issued out of order.
void setTid(ThreadID tid)
Sets the thread id.
PhysRegIdPtr renamedSrcRegIdx(int idx) const
Returns the physical register index of the i'th source register.
const RegId & destRegIdx(int i) const
Returns the logical register index of the i'th destination register.
bool isFirstMicroop() const
int8_t numVecDestRegs() const
Number of vector destination regs.
ListIt instListIt
Iterator pointing to this BaseDynInst in the list of all insts.
bool isSquashedInIQ() const
Returns whether or not this instruction is squashed in the IQ.
bool isSerializing() const
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Instruction is in the IQ.
bool isUncondCtrl() const
bool isDataPrefetch() const
std::queue< InstResult > instResult
The result of the instruction; assumes an instruction can have many destination registers.
bool isWriteBarrier() const
void setSerializeBefore()
Temporarily sets this instruction as a serialize before instruction.
void strictlyOrdered(bool so)
bool isPinnedRegsRenamed() const
Returns whether pinned registers are renamed.
Addr predMicroPC()
Returns the predicted micro PC after the branch.
bool doneTargCalc()
Checks whether or not this instruction has had its branch target calculated yet.
bool isPinnedRegsWritten() const
Returns whether destination registers are written.
bool isResultReady() const
Returns whether or not the result is ready.
bool translationCompleted() const
True if the DTB address translation has completed.
bool isStoreConditional() const
std::array< PhysRegIdPtr, TheISA::MaxInstSrcRegs > _srcRegIdx
Physical register index of the source registers of this instruction.
void pcState(const TheISA::PCState &val)
Set the PC state of this instruction.
unsigned effSize
The size of the request.
void demapInstPage(Addr vaddr, uint64_t asn)
ImplCPU::ImplState ImplState
bool readyToIssue() const
Returns whether or not this instruction is ready to issue.
bool isSquashedInLSQ() const
Returns whether or not this instruction is squashed in the LSQ.
std::bitset< MaxFlags > instFlags
AddressMonitor * getAddrMonitor()
bool isDelayedCommit() const
void setPredicate(bool val)
Instruction is squashed in the LSQ.
bool isThreadSync() const
bool mispredicted()
Returns whether the instruction mispredicted.
void setInstListIt(ListIt _instListIt)
Sets iterator for this instruction in the list of all insts.
void setPredicate(bool val)
const RegId & flattenedDestRegIdx(int idx) const
Returns the flattened register index of the i'th destination register.
Derive from RefCounted if you want to enable reference counting of this class.
void setMemAccPredicate(bool val)
void clearInROB()
Sets this instruction as a entry the ROB.
void advancePC(PCState &pc, const StaticInstPtr &inst)
bool isNonSpeculative() const
const StaticInstPtr staticInst
The StaticInst used by this BaseDynInst.
int cpuId() const
Read this CPU's ID.
Addr predNextInstAddr()
Returns the predicted PC two instructions after the branch.
void setPinnedRegsSquashDone()
Sets dest registers' status updated after squash.
void setInLSQ()
Sets this instruction as a entry the LSQ.
Instruction is squashed in the ROB.
bool isCondDelaySlot() const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
TheISA::PCState pc
PC state for this instruction.
TheISA::PCState branchTarget() const
Returns the branch target address.
std::bitset< MaxInstSrcRegs > _readySrcRegIdx
Whether or not the source register is ready.
Pinned registers are renamed.
void demapPage(Addr vaddr, uint64_t asn)
Invalidate a page in the DTLB and ITLB.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Instruction can issue and execute.
bool eaSrcsReady() const
Returns whether or not the eff.
std::array< PhysRegIdPtr, TheISA::MaxInstDestRegs > _prevDestRegIdx
Physical register index of the previous producers of the architected destinations.
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
bool isStoreConditional() const
int8_t numFPDestRegs() const
bool isFirstMicroop() const
void effAddrValid(bool b)
bool isDirectCtrl() const
ListIt & getInstListIt()
Returns iterator to this instruction in the list of all insts.
void setIntRegOperand(const StaticInst *si, int idx, RegVal val)
Records an integer register being set to a value.
int16_t sqIdx
Store queue index.
void clearInIQ()
Sets this instruction as a entry the IQ.
Addr predInstAddr()
Returns the predicted PC immediately after the branch.
PhysRegIdPtr prevDestRegIdx(int idx) const
Returns the physical register index of the previous physical register that remapped to the same logic...
void clearCanCommit()
Clears this instruction as being ready to commit.
void setCanCommit()
Sets this instruction as ready to commit.
int16_t ThreadID
Thread index/ID type.
bool memOpDone() const
Whether or not the memory operation is done.
virtual TheISA::PCState branchTarget(const TheISA::PCState &pc) const
Return the target address for a PC-relative branch.
bool isLastMicroop() const
void setCompleted()
Sets this instruction as completed.
Addr microPC() const
Read the micro PC of this instruction.
void setSquashedInLSQ()
Sets this instruction as squashed in the LSQ.
bool strictlyOrdered() const
Is this instruction's memory access strictly ordered?
BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr ¯oop, TheISA::PCState pc, TheISA::PCState predPC, InstSeqNum seq_num, ImplCPU *cpu)
BaseDynInst constructor given a binary instruction.
InstResult popResult(InstResult dflt=InstResult())
Pops a result off the instResult queue.
int8_t numVecPredDestRegs() const
Declaration of the Packet class.
ImplCPU * cpu
Pointer to the Impl's CPU object.
VecReg::Container VecRegContainer
bool effAddrValid() const
Is the effective virtual address valid.
void setPredTaken(bool predicted_taken)
bool isExecuted() const
Returns whether or not this instruction has executed.
Addr instAddr() const
Read the PC of this instruction.
bool isTranslationDelayed() const
Returns true if the DTB address translation is being delayed due to a hw page table walk...
void setResultReady()
Marks the result as ready.
const RegId & srcRegIdx(int i) const
Returns the logical register index of the i'th source register.
void setSquashedInROB()
Sets this instruction as squashed in the ROB.
bool isSerializing() const
Generic predicate register container.
int8_t numDestRegs() const
Returns the number of destination registers.
void setSerializeAfter()
Temporarily sets this instruction as a serialize after instruction.
Fault getFault() const
Returns the fault type.
typename Impl::CPUPol::LSQ::LSQRequest * LSQRequestPtr
int8_t numCCDestRegs() const
Number of coprocesor destination regs.
bool isNonSpeculative() const
Is a recover instruction.
Fault writeMem(uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable=std::vector< bool >())
Base, ISA-independent static instruction class.
Addr effAddr
The effective virtual address (lds & stores only).
unsigned int readStCondFailures() const
Returns the number of consecutive store conditional failures.
void translationCompleted(bool f)
Instruction is squashed in the IQ.
Fault initiateMemAMO(Addr addr, unsigned size, Request::Flags flags, AtomicOpFunctorPtr amo_op)
bool isCommitted() const
Returns whether or not this instruction is committed.
const RegId & destRegIdx(int i) const
Return logical index (architectural reg num) of i'th destination reg.
OpClass opClass() const
Returns the opclass of this instruction.
const StaticInstPtr macroop
The Macroop if one exists.
bool isSquashAfter() const
Register ID: describe an architectural register with its class and index.
void setRequest()
Assert this instruction has generated a memory request.
void initVars()
Function to initialize variables in the constructors.
bool isTempSerializeBefore()
Checks if this serializeBefore is only temporarily set.
typename Impl::CPUPol::LSQUnit::SQIterator SQIterator
bool isMicroBranch() const
bool isMemBarrier() const
TheISA::PCState pcState() const
Read the PC state of this instruction.
void possibleLoadViolation(bool f)
TheISA::PCState predPC
Predicted PC state after this instruction.
void setCCRegOperand(const StaticInst *si, int idx, RegVal val)
Records a CC register being set to a value.
bool isPinnedRegsSquashDone() const
Return whether dest registers' pinning status updated after squash.
Impl::DynInstPtr DynInstPtr
bool isSerializeHandled()
Checks if the serialization part of this instruction has been handled.
bool isSquashAfter() const
bool isIssued() const
Returns whether or not this instruction has issued.
ThreadID threadNumber
The thread this instruction is from.
void translationStarted(bool f)
void setVecRegOperand(const StaticInst *si, int idx, const VecRegContainer &val)
Record a vector register being set to a value.
void dump()
Dumps out contents of this BaseDynInst.
GenericISA::DelaySlotPCState< MachInst > PCState
bool isWriteBarrier() const
Instruction has committed.
void setSquashedInIQ()
Sets this instruction as squashed in the IQ.
Instruction has executed.
Addr physEffAddr
The effective physical address.
void setIssued()
Sets this instruction as issued from the IQ.
bool isSerializeAfter() const
std::shared_ptr< FaultBase > Fault
int8_t numIntDestRegs() const
Number of integer destination regs.
void renameDestReg(int idx, PhysRegIdPtr renamed_dest, PhysRegIdPtr previous_rename)
Renames a destination register to a physical register.
void setCanIssue()
Sets this instruction as ready to issue.
int8_t numVecElemDestRegs() const
typename Impl::CPUPol::LSQUnit::LQIterator LQIterator
ImplState * thread
Pointer to the thread state.
void removeInLSQ()
Sets this instruction as a entry the LSQ.
Needs to serialize on instructions ahead of it.
int ContextID
Globally unique thread context ID.
bool isThreadSync() const
Instruction has completed.
bool isInstPrefetch() const
void setInROB()
Sets this instruction as a entry the ROB.
bool isInROB() const
Returns whether or not this instruction is in the ROB.
bool readPredicate() const
Pinned registers are written back.
ThreadContext * tcBase() const
Returns the thread context.
bool isLastMicroop() const
void flattenDestReg(int idx, const RegId &flattened_dest)
Flattens a destination architectural register index into a logical index.
Instruction is in the ROB.
std::array< RegId, TheISA::MaxInstDestRegs > _flatDestRegIdx
Flattened register index of the destination registers of this instruction.
RefCountingPtr< BaseDynInst< Impl > > BaseDynInstPtr
bool readyToCommit() const
Returns whether or not this instruction is ready to commit.
bool isCompleted() const
Returns whether or not this instruction is completed.
void recordResult(bool f)
Records changes to result?
int8_t numVecDestRegs() const
void setSerializeHandled()
Sets the serialization part of this instruction as handled.
bool isReadySrcRegIdx(int idx) const
Returns if a source register is ready.