46 #ifndef __CPU_BASE_DYN_INST_HH__
47 #define __CPU_BASE_DYN_INST_HH__
56 #include "arch/utility.hh"
58 #include "config/the_isa.hh"
306 cpu->demapPage(vaddr, asn);
310 cpu->demapPage(vaddr, asn);
314 cpu->demapPage(vaddr, asn);
457 void dump(std::string &outstring);
514 return !(tempPC ==
predPC);
643 setResult<uint64_t>(
val);
649 setResult<uint64_t>(
val);
655 setResult<double>(
val);
661 setResult<uint64_t>(
val);
859 {
return thread->storeCondFailures; }
863 {
thread->storeCondFailures = sc_failures; }
880 instFlags[ReqMade] =
true;
885 if (instFlags[ReqMade] && translationStarted()) {
887 sreqLow = savedSreqLow;
888 sreqHigh = savedSreqHigh;
890 req =
new Request(
asid, addr, size, flags, masterId(), this->
pc.instAddr(),
891 thread->contextId());
893 req->
taskId(cpu->taskId());
897 splitRequest(req, sreqLow, sreqHigh);
899 initiateTranslation(req, sreqLow, sreqHigh, NULL,
BaseTLB::Read);
902 if (translationCompleted()) {
906 instFlags[EffAddrValid] =
true;
909 if (reqToVerify != NULL) {
912 reqToVerify =
new Request(*req);
914 fault = cpu->read(req, sreqLow, sreqHigh, lqIdx);
923 traceData->setMem(addr, size, flags);
934 traceData->setMem(addr, size, flags);
936 instFlags[ReqMade] =
true;
941 if (instFlags[ReqMade] && translationStarted()) {
943 sreqLow = savedSreqLow;
944 sreqHigh = savedSreqHigh;
946 req =
new Request(
asid, addr, size, flags, masterId(), this->
pc.instAddr(),
947 thread->contextId());
949 req->
taskId(cpu->taskId());
953 splitRequest(req, sreqLow, sreqHigh);
958 if (fault ==
NoFault && translationCompleted()) {
961 instFlags[EffAddrValid] =
true;
964 if (reqToVerify != NULL) {
967 reqToVerify =
new Request(*req);
969 fault = cpu->write(req, sreqLow, sreqHigh, data, sqIdx);
981 unsigned block_size = cpu->cacheLineSize();
984 assert(split_addr <= addr || split_addr - addr < block_size);
987 if (split_addr > addr) {
998 translationStarted(
true);
1008 cpu->dtb->translateTiming(req, thread->getTC(), trans,
mode);
1010 if (!translationCompleted()) {
1019 savedSreqLow = state->
sreqLow;
1032 cpu->dtb->translateTiming(sreqLow, thread->getTC(), stransLow,
mode);
1033 cpu->dtb->translateTiming(sreqHigh, thread->getTC(), stransHigh,
mode);
1035 if (!translationCompleted()) {
1043 savedReq = state->mainReq;
1044 savedSreqLow = state->sreqLow;
1045 savedSreqHigh = state->sreqHigh;
1050 template<
class Impl>
1060 physEffAddrLow = state->
getPaddr();
1080 translationCompleted(
true);
1083 #endif // __CPU_BASE_DYN_INST_HH__
Fault getFault() const
Returns the fault type.
uint8_t effSize
The size of the request.
bool isIssued() const
Returns whether or not this instruction has issued.
const TheISA::PCState & readPredTarg()
Instruction has reached commit.
bool isCommitted() const
Returns whether or not this instruction is committed.
bool isSerializing() const
bool isTranslationDelayed() const
Returns true if the DTB address translation is being delayed due to a hw page table walk...
Is a blocking instruction.
PhysRegIndex renamedDestRegIdx(int idx) const
Returns the physical register index of the i'th destination register.
void setSquashed()
Sets this instruction as squashed.
This class represents part of a data address translation.
bool isFirstMicroop() const
unsigned getFlags()
Get the flags associated with this request.
bool isWriteBarrier() const
OpClass opClass() const
Returns the opclass of this instruction.
bool memOpDone() const
Whether or not the memory operation is done.
decltype(nullptr) constexpr NoFault
bool mwait(PacketPtr pkt)
~BaseDynInst()
BaseDynInst destructor.
bool isMicroBranch() const
void demapDataPage(Addr vaddr, uint64_t asn)
void clearCanIssue()
Clears this instruction being able to issue.
bool readyToIssue() const
Returns whether or not this instruction is ready to issue.
void setExecuted()
Sets this instruction as executed.
Whether or not the effective address calculation is completed.
Addr instEffAddr
Instruction effective address.
std::bitset< NumStatus > status
The status of this BaseDynInst.
InstSeqNum seqNum
The sequence number of the instruction.
Serialization has been handled.
bool isDataPrefetch() const
Instruction has its result.
unsigned memReqFlags
The memory request flags (from translation).
Instruction is in the LSQ.
TheISA::PCState branchTarget() const
Returns the branch target address.
bool isSquashAfter() const
uint8_t readyRegs
How many source registers are ready.
void setExtraData(uint64_t extraData)
Accessor function for store conditional return value.
bool isDelayedCommit() const
int16_t lqIdx
Load queue index.
Needs to serialize instructions behind it.
bool isInstPrefetch() const
int8_t numCCDestRegs() const
Number of coprocesor destination regs.
bool isMemBarrier() const
void readResult(T &t)
Read the most recent result stored by this instruction.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
void clearSerializeAfter()
Clears the serializeAfter part of this instruction.
void deleteReqs()
Delete all requests that make up this translation.
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
bool isSquashed() const
Returns whether or not this instruction is squashed.
Fault fault
The kind of fault this instruction has generated.
void setCommitted()
Sets this instruction as committed.
uint8_t * memData
Pointer to the data for the memory access.
void finishTranslation(WholeTranslationState *state)
Finish a DTB address translation.
unsigned int readStCondFailures() const
Returns the number of consecutive store conditional failures.
const bool HasUnalignedMemAcc
RegIndex destRegIdx(int i) const
Return logical index (architectural reg num) of i'th destination reg.
bool isCompleted() const
Returns whether or not this instruction is completed.
std::array< PhysRegIndex, TheISA::MaxInstDestRegs > _destRegIdx
Physical register index of the destination registers of this instruction.
bool possibleLoadViolation() const
True if this address was found to match a previous load and they issued out of order.
void setCCRegOperand(const StaticInst *si, int idx, CCReg val)
Records a CC register being set to a value.
Is a thread synchronization instruction.
bool isCondDelaySlot() const
bool hitExternalSnoop() const
True if the address hit a external snoop while sitting in the LSQ.
void setInIQ()
Sets this instruction as a entry the IQ.
bool isSquashedInLSQ() const
Returns whether or not this instruction is squashed in the LSQ.
bool isMemBarrier() const
short asid
data address space ID, for loads & stores.
void hitExternalSnoop(bool f)
bool isResultReady() const
Returns whether or not the result is ready.
Trace::InstRecord * traceData
InstRecord that tracks this instructions.
void markSrcRegReady()
Records that one of the source registers is ready.
void mwaitAtomic(ThreadContext *tc)
This class captures the state of an address translation.
bool readPredTaken()
Returns whether the instruction was predicted taken or not.
bool isNonSpeculative() const
std::list< DynInstPtr >::iterator ListIt
bool isUncondCtrl() const
bool isNonSpeculative() const
std::array< PhysRegIndex, TheISA::MaxInstDestRegs > _prevDestRegIdx
Physical register index of the previous producers of the architected destinations.
TheISA::RegIndex flattenedDestRegIdx(int idx) const
Returns the flattened register index of the i'th destination register.
uint32_t socketId() const
Read this CPU's Socket ID.
bool isTempSerializeAfter()
Checks if this serializeAfter is only temporarily set.
std::array< TheISA::RegIndex, TheISA::MaxInstDestRegs > _flatDestRegIdx
Flattened register index of the destination registers of this instruction.
void clearSerializeBefore()
Clears the serializeBefore part of this instruction.
void setThreadState(ImplState *state)
Sets the pointer to the thread state.
void clearIssued()
Clears this instruction as being issued.
bool effAddrValid() const
Is the effective virtual address valid.
void setStCondFailures(unsigned int sc_failures)
Sets the number of consecutive store conditional failures.
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...
PhysRegIndex renamedSrcRegIdx(int idx) const
Returns the physical register index of the i'th source register.
void setIntRegOperand(const StaticInst *si, int idx, IntReg val)
Records an integer register being set to a value.
Addr physEffAddrLow
The effective physical address.
bool isSerializing() const
bool hasRequest()
Has this instruction generated a memory request.
std::queue< Result > instResult
The result of the instruction; assumes an instruction can have many destination registers.
int8_t numSrcRegs() const
Returns the number of source registers.
void splitRequest(RequestPtr req, RequestPtr &sreqLow, RequestPtr &sreqHigh)
Splits a request in two if it crosses a dcache block.
bool eaSrcsReady()
Returns whether or not the eff.
Instruction is squashed in the ROB.
void armMonitor(Addr address)
void setPredTarg(const TheISA::PCState &_predPC)
Set the predicted target of this current instruction.
bool translationStarted() const
True if the DTB address translation has started.
void flattenDestReg(int idx, TheISA::RegIndex flattened_dest)
Flattens a destination architectural register index into a logical index.
bool isDirectCtrl() const
Addr nextInstAddr() const
Read the PC of the next instruction.
Fault getFault() const
Determine whether this translation produced a fault.
void setTid(ThreadID tid)
Sets the thread id.
TheISA::FloatReg FloatReg
ListIt instListIt
Iterator pointing to this BaseDynInst in the list of all insts.
bool isDelayedCommit() const
bool isSerializeAfter() const
RegIndex destRegIdx(int i) const
Returns the logical register index of the i'th destination register.
RegIndex srcRegIdx(int i) const
Returns the logical register index of the i'th source register.
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Instruction is in the IQ.
bool isInROB() const
Returns whether or not this instruction is in the ROB.
void setSerializeBefore()
Temporarily sets this instruction as a serialize before instruction.
TheISA::FloatRegBits FloatRegBits
bool isThreadSync() const
Addr predMicroPC()
Returns the predicted micro PC after the branch.
bool isInIQ() const
Returns whether or not this instruction has issued.
bool doneTargCalc()
Checks whether or not this instruction has had its branch target calculated yet.
bool isIndirectCtrl() const
bool isStoreConditional() const
void pcState(const TheISA::PCState &val)
Set the PC state of this instruction.
bool isLastMicroop() const
void demapInstPage(Addr vaddr, uint64_t asn)
ImplCPU::ImplState ImplState
Addr getEA() const
Returns the effective address.
std::bitset< MaxFlags > instFlags
bool isCondDelaySlot() const
AddressMonitor * getAddrMonitor()
bool isFirstMicroop() const
void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2)
Generate two requests as if this request had been split into two pieces.
ContextID contextId() const
Read this context's system-wide ID.
void setPredicate(bool val)
Instruction is squashed in the LSQ.
void setASID(short addr_space_id)
Sets the ASID.
bool mispredicted()
Returns whether the instruction mispredicted.
void setInstListIt(ListIt _instListIt)
Sets iterator for this instruction in the list of all insts.
T roundDown(const T &val, const U &align)
void setPredicate(bool val)
Derive from RefCounted if you want to enable reference counting of this class.
void clearInROB()
Sets this instruction as a entry the ROB.
const StaticInstPtr staticInst
The StaticInst used by this BaseDynInst.
bool isUnverifiable() const
Addr predNextInstAddr()
Returns the predicted PC two instructions after the branch.
void setInLSQ()
Sets this instruction as a entry the LSQ.
Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags)
bool isThreadSync() const
bool isReadySrcRegIdx(int idx) const
Returns if a source register is ready.
bool isInLSQ() const
Returns whether or not this instruction is in the LSQ.
TheISA::RegIndex RegIndex
void renameDestReg(int idx, PhysRegIndex renamed_dest, PhysRegIndex previous_rename)
Renames a destination register to a physical register.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
TheISA::PCState pc
PC state for this instruction.
int8_t numDestRegs() const
Returns the number of destination registers.
std::bitset< MaxInstSrcRegs > _readySrcRegIdx
Whether or not the source register is ready.
int8_t numFPDestRegs() const
Number of floating-point destination regs.
void renameSrcReg(int idx, PhysRegIndex renamed_src)
Renames a source logical register to the physical register which has/will produce that logical regist...
void advancePC(PCState &pc, const StaticInstPtr &inst)
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...
bool isSerializeBefore() const
RegIndex srcRegIdx(int i) const
Return logical index (architectural reg num) of i'th source reg.
Instruction can issue and execute.
ThreadContext * tcBase()
Returns the thread context.
int8_t numSrcRegs() const
Number of source registers.
bool isSquashedInIQ() const
Returns whether or not this instruction is squashed in the IQ.
void popResult(T &t)
Pops a result off the instResult queue.
bool isSquashAfter() const
void setResult(T t)
Pushes a result onto the instResult queue.
ListIt & getInstListIt()
Returns iterator to this instruction in the list of all insts.
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.
bool isDirectCtrl() const
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.
PhysRegIndex prevDestRegIdx(int idx) const
Returns the physical register index of the previous physical register that remapped to the same logic...
void setCompleted()
Sets this instruction as completed.
bool readyToCommit() const
Returns whether or not this instruction is ready to commit.
void initiateTranslation(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, uint64_t *res, BaseTLB::Mode mode)
Initiate a DTB address translation.
void setSquashedInLSQ()
Sets this instruction as squashed in the LSQ.
bool translationCompleted() const
True if the DTB address translation has completed.
BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr ¯oop, TheISA::PCState pc, TheISA::PCState predPC, InstSeqNum seq_num, ImplCPU *cpu)
BaseDynInst constructor given a binary instruction.
Declaration of the Packet class.
ImplCPU * cpu
Pointer to the Impl's CPU object.
void setPredTaken(bool predicted_taken)
bool isUnverifiable() const
Fault writeMem(uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res)
int cpuId() const
Read this CPU's ID.
GenericISA::SimplePCState< MachInst > PCState
void setResultReady()
Marks the result as ready.
Addr instAddr() const
Read the PC of this instruction.
void setSquashedInROB()
Sets this instruction as squashed in the ROB.
void setFloatRegOperandBits(const StaticInst *si, int idx, FloatRegBits val)
Records an fp register being set to an integer value.
Addr physEffAddrHigh
The effective physical address of the second request for a split request.
void setSerializeAfter()
Temporarily sets this instruction as a serialize after instruction.
bool strictlyOrdered() const
Is this instruction's memory access strictly ordered?
std::array< PhysRegIndex, TheISA::MaxInstSrcRegs > _srcRegIdx
Physical register index of the source registers of this instruction.
TheISA::PCState pcState() const
Read the PC state of this instruction.
bool isSerializeBefore() const
Is a recover instruction.
int8_t numIntDestRegs() const
Base, ISA-independent static instruction class.
Addr effAddr
The effective virtual address (lds & stores only).
bool isMicroBranch() const
void translationCompleted(bool f)
Instruction is squashed in the IQ.
int8_t numIntDestRegs() const
Number of integer destination regs.
bool isSerializeAfter() const
void setEA(Addr ea)
Sets the effective address.
bool isSquashedInROB() const
Returns whether or not this instruction is squashed in the ROB.
const StaticInstPtr macroop
The Macroop if one exists.
void initVars()
Function to initialize variables in the constructors.
bool isTempSerializeBefore()
Checks if this serializeBefore is only temporarily set.
void possibleLoadViolation(bool f)
TheISA::PCState predPC
Predicted PC state after this instruction.
bool isIndirectCtrl() const
RequestPtr savedReq
Saved memory requests (needed when the DTB address translation is delayed due to a hw page table walk...
Impl::DynInstPtr DynInstPtr
bool isSerializeHandled()
Checks if the serialization part of this instruction has been handled.
bool isStrictlyOrdered() const
Check if this request is strictly ordered device access.
ThreadID threadNumber
The thread this instruction is from.
void translationStarted(bool f)
bool isExecuted() const
Returns whether or not this instruction has executed.
bool isUncondCtrl() const
void dump()
Dumps out contents of this BaseDynInst.
bool isDataPrefetch() const
void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val)
Records an fp register being set to a value.
int8_t numCCDestRegs() const
Instruction has committed.
void setSquashedInIQ()
Sets this instruction as squashed in the IQ.
Instruction has executed.
bool isLastMicroop() const
void setIssued()
Sets this instruction as issued from the IQ.
bool isInstPrefetch() const
std::shared_ptr< FaultBase > Fault
void setCanIssue()
Sets this instruction as ready to issue.
Addr microPC() const
Read the micro PC of this instruction.
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.
MasterID masterId() const
Read this CPU's data requestor ID.
Instruction has completed.
void setInROB()
Sets this instruction as a entry the ROB.
virtual TheISA::PCState branchTarget(const TheISA::PCState &pc) const
Return the target address for a PC-relative branch.
int8_t numDestRegs() const
Number of destination registers.
Instruction is in the ROB.
Addr getPaddr() const
Get the physical address of this request.
RefCountingPtr< BaseDynInst< Impl > > BaseDynInstPtr
bool isWriteBarrier() const
int8_t numFPDestRegs() const
void recordResult(bool f)
Records changes to result?
bool doneEACalc()
Returns whether or not the eff.
void setSerializeHandled()
Sets the serialization part of this instruction as handled.
bool isStoreConditional() const