42#ifndef __CPU_O3_DYN_INST_HH__
43#define __CPU_O3_DYN_INST_HH__
65#include "debug/HtmCpu.hh"
97 static void *
operator new(
size_t count,
Arrays &arrays);
98 static void operator delete(
void* ptr);
207 std::unique_ptr<PCStateBase>
pc;
306 return bits(
byte, idx % 8);
486 void dump(std::string &outstring);
531 std::unique_ptr<PCStateBase> next_pc(
pc->clone());
533 return *next_pc != *
predPC;
598 panic(
"Not yet implemented\n");
630 "clearing instuction's transactional state htmUid=%u\n",
671 std::unique_ptr<PCStateBase>
991 int32_t decodeTick = -1;
992 int32_t renameTick = -1;
993 int32_t dispatchTick = -1;
994 int32_t issueTick = -1;
995 int32_t completeTick = -1;
996 int32_t commitTick = -1;
997 int32_t storeTick = -1;
1026 if (idx == misc_reg)
1087 if (bytes ==
sizeof(
RegVal)) {
RequestorID dataRequestorId() const
Reads this CPU's unique data requestor ID.
uint32_t socketId() const
Reads this CPU's Socket ID.
void mwaitAtomic(ThreadID tid, ThreadContext *tc, BaseMMU *mmu)
AddressMonitor * getCpuAddrMonitor(ThreadID tid)
bool mwait(ThreadID tid, PacketPtr pkt)
int cpuId() const
Reads this CPU's ID.
void armMonitor(ThreadID tid, Addr address)
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Derive from RefCounted if you want to enable reference counting of this class.
T * get() const
Directly access the pointer itself without taking a reference.
constexpr size_t regBytes() const
Register ID: describe an architectural register with its class and index.
constexpr bool isRenameable() const
Return true if this register can be renamed.
constexpr const RegClass & regClass() const
Class accessor.
Base, ISA-independent static instruction class.
bool isUnverifiable() const
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
bool isStoreConditional() const
bool isFirstMicroop() const
bool isDirectCtrl() const
bool isUncondCtrl() const
bool isSerializeBefore() const
virtual std::unique_ptr< PCStateBase > branchTarget(const PCStateBase &pc) const
Return the target address for a PC-relative branch.
bool isSquashAfter() const
uint8_t numDestRegs() const
Number of destination registers.
virtual void advancePC(PCStateBase &pc_state) const =0
bool isWriteBarrier() const
bool isReadBarrier() const
bool isNonSpeculative() const
const RegId & destRegIdx(int i) const
Return logical index (architectural reg num) of i'th destination reg.
bool isDataPrefetch() const
bool isIndirectCtrl() const
bool isLastMicroop() const
bool isFullMemBarrier() const
bool isInstPrefetch() const
bool isSerializing() const
const RegId & srcRegIdx(int i) const
Return logical index (architectural reg num) of i'th source reg.
bool isDelayedCommit() const
bool isSerializeAfter() const
ThreadContext is the external interface to all thread state for anything outside of the CPU.
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
RegVal getReg(PhysRegIdPtr phys_reg, ThreadID tid)
void setMiscReg(int misc_reg, RegVal val, ThreadID tid)
Sets a misc.
void demapPage(Addr vaddr, uint64_t asn)
void setReg(PhysRegIdPtr phys_reg, RegVal val, ThreadID tid)
RegVal readMiscReg(int misc_reg, ThreadID tid)
Reads a misc.
void * getWritableReg(PhysRegIdPtr phys_reg, ThreadID tid)
bool hasRequest() const
Has this instruction generated a memory request.
std::list< DynInstPtr >::iterator ListIt
bool isCompleted() const
Returns whether or not this instruction is completed.
const RegId & flattenedDestIdx(int idx) const
uint8_t readyRegs
How many source registers are ready.
uint8_t * memData
Pointer to the data for the memory access.
RequestorID requestorId() const
Read this CPU's data requestor ID.
bool isStoreConditional() const
unsigned memReqFlags
The memory request flags (from translation).
bool isDirectCtrl() const
size_t numDestRegs(RegClassType type) const
RegVal readMiscRegOperand(const StaticInst *si, int idx) override
Reads a misc.
bool isSquashAfter() const
bool doneTargCalc()
Checks whether or not this instruction has had its branch target calculated yet.
void setIssued()
Sets this instruction as issued from the IQ.
ThreadState * thread
Pointer to the thread state.
bool isIndirectCtrl() const
void clearCanIssue()
Clears this instruction being able to issue.
void clearSerializeAfter()
Clears the serializeAfter part of this instruction.
PhysRegIdPtr * _prevDestIdx
std::unique_ptr< PCStateBase > predPC
Predicted PC state after this instruction.
bool isUncondCtrl() const
unsigned effSize
The size of the request.
Fault writeMem(uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable) override
void clearInIQ()
Sets this instruction as a entry the IQ.
void setSerializeBefore()
Temporarily sets this instruction as a serialize before instruction.
void clearHtmTransactionalState()
void setTid(ThreadID tid)
Sets the thread id.
bool readyToIssue() const
Returns whether or not this instruction is ready to issue.
void translationCompleted(bool f)
@ LsqEntry
Instruction is in the ROB.
@ ThreadsyncWait
Is a blocking instruction.
@ Committed
Instruction has reached commit.
@ Completed
Instruction is in the LSQ.
@ SerializeHandled
Needs to serialize instructions behind it.
@ PinnedRegsRenamed
Instruction is squashed in the ROB.
@ NumStatus
Serialization has been handled.
@ Squashed
Instruction has committed.
@ PinnedRegsWritten
Pinned registers are renamed.
@ Executed
Instruction has issued.
@ SerializeBefore
Is a thread synchronization instruction.
@ SerializeAfter
Needs to serialize on instructions ahead of it.
@ PinnedRegsSquashDone
Pinned registers are written back.
@ CanCommit
Instruction has executed.
@ Issued
Instruction can issue and execute.
@ BlockingInst
Is a recover instruction.
@ SquashedInLSQ
Instruction is squashed in the IQ.
@ AtCommit
Instruction can commit.
@ SquashedInIQ
Instruction is squashed.
@ CanIssue
Instruction has its result.
@ SquashedInROB
Instruction is squashed in the LSQ.
@ RecoverInst
Regs pinning status updated after squash.
@ RobEntry
Instruction is in the IQ.
@ ResultReady
Instruction has completed.
void renamedSrcIdx(int idx, PhysRegIdPtr phys_reg_id)
Fault completeAcc(PacketPtr pkt)
Completes the access.
Fault fault
The kind of fault this instruction has generated.
std::vector< short > _destMiscRegIdx
Indexes of the destination misc.
void setResult(const RegClass ®_class, T &&t)
Pushes a result onto the instResult queue.
ssize_t lqIdx
Load queue index.
bool strictlyOrdered() const
Is this instruction's memory access strictly ordered?
bool readPredicate() const override
void getRegOperand(const StaticInst *si, int idx, void *val) override
bool isFirstMicroop() const
bool isInstPrefetch() const
std::unique_ptr< PCStateBase > pc
PC state for this instruction.
ThreadID threadNumber
The thread this instruction is from.
std::bitset< MaxFlags > instFlags
void setThreadState(ThreadState *state)
Sets the pointer to the thread state.
bool readySrcIdx(int idx) const
LSQ::LSQRequest * savedRequest
Saved memory request (needed when the DTB address translation is delayed due to a hw page table walk)...
void setRegOperand(const StaticInst *si, int idx, const void *val) override
bool isDataPrefetch() const
bool isSquashedInROB() const
Returns whether or not this instruction is squashed in the ROB.
RegVal readMiscReg(int misc_reg) override
Reads a misc.
void updateMiscRegs()
Called at the commit stage to update the misc.
bool isPinnedRegsRenamed() const
Returns whether pinned registers are renamed.
void setStCondFailures(unsigned int sc_failures) override
Sets the number of consecutive store conditional failures.
bool isReadBarrier() const
void strictlyOrdered(bool so)
bool isLastMicroop() const
Fault initiateMemAMO(Addr addr, unsigned size, Request::Flags flags, AtomicOpFunctorPtr amo_op) override
RegVal getRegOperand(const StaticInst *si, int idx) override
ListIt & getInstListIt()
Returns iterator to this instruction in the list of all insts.
ContextID contextId() const
Read this context's system-wide ID.
PhysRegIdPtr renamedSrcIdx(int idx) const
void mwaitAtomic(gem5::ThreadContext *tc) override
size_t numDestRegs() const
Returns the number of destination registers.
std::queue< InstResult > instResult
The result of the instruction; assumes an instruction can have many destination registers.
void setSerializeHandled()
Sets the serialization part of this instruction as handled.
void setExecuted()
Sets this instruction as executed.
bool isUnverifiable() const
uint64_t newHtmTransactionUid() const override
Fault & getFault()
TODO: This I added for the LSQRequest side to be able to modify the fault.
void renameDestReg(int idx, PhysRegIdPtr renamed_dest, PhysRegIdPtr previous_rename)
Renames a destination register to a physical register.
bool isFullMemBarrier() const
bool possibleLoadViolation() const
True if this address was found to match a previous load and they issued out of order.
uint8_t resultSize()
Return the size of the instResult queue.
void dump()
Dumps out contents of this BaseDynInst.
void setInROB()
Sets this instruction as a entry the ROB.
bool isSquashedInIQ() const
Returns whether or not this instruction is squashed in the IQ.
void setResultReady()
Marks the result as ready.
const StaticInstPtr staticInst
The StaticInst used by this BaseDynInst.
bool isTranslationDelayed() const
Returns true if the DTB address translation is being delayed due to a hw page table walk.
void setSerializeAfter()
Temporarily sets this instruction as a serialize after instruction.
void setSquashedInROB()
Sets this instruction as squashed in the ROB.
void setPinnedRegsWritten()
Sets destination registers as written.
bool effAddrValid() const
Is the effective virtual address valid.
bool isSerializing() const
void setRegOperand(const StaticInst *si, int idx, RegVal val) override
void setSquashed()
Sets this instruction as squashed.
gem5::ThreadContext * tcBase() const override
Returns the thread context.
bool isSerializeAfter() const
uint64_t getHtmTransactionalDepth() const override
Fault getFault() const
Returns the fault type.
void translationStarted(bool f)
bool isTempSerializeBefore()
Checks if this serializeBefore is only temporarily set.
bool isSerializeHandled()
Checks if the serialization part of this instruction has been handled.
bool isInROB() const
Returns whether or not this instruction is in the ROB.
bool isWriteBarrier() const
bool isInIQ() const
Returns whether or not this instruction has issued.
bool hitExternalSnoop() const
True if the address hit a external snoop while sitting in the LSQ.
void recordResult(bool f)
Records changes to result?
void effAddrValid(bool b)
void setPredicate(bool val) override
void setMiscRegOperand(const StaticInst *si, int idx, RegVal val) override
Sets a misc.
void setSquashedInIQ()
Sets this instruction as squashed in the IQ.
void pcState(const PCStateBase &val) override
Set the PC state of this instruction.
Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags, const std::vector< bool > &byte_enable) override
bool isResultReady() const
Returns whether or not the result is ready.
void armMonitor(Addr address) override
CPU * cpu
Pointer to the Impl's CPU object.
void trap(const Fault &fault)
Traps to handle specified fault.
void hitExternalSnoop(bool f)
bool isInLSQ() const
Returns whether or not this instruction is in the LSQ.
Addr physEffAddr
The effective physical address.
int cpuId() const
Read this CPU's ID.
void demapPage(Addr vaddr, uint64_t asn) override
Invalidate a page in the DTLB and ITLB.
void possibleLoadViolation(bool f)
bool isIssued() const
Returns whether or not this instruction has issued.
trace::InstRecord * traceData
InstRecord that tracks this instructions.
bool isSquashedInLSQ() const
Returns whether or not this instruction is squashed in the LSQ.
void setCompleted()
Sets this instruction as completed.
Fault execute()
Executes the instruction.
ListIt instListIt
Iterator pointing to this BaseDynInst in the list of all insts.
bool isPinnedRegsSquashDone() const
Return whether dest registers' pinning status updated after squash.
PhysRegIdPtr renamedDestIdx(int idx) const
void setCanCommit()
Sets this instruction as ready to commit.
unsigned int readStCondFailures() const override
Returns the number of consecutive store conditional failures.
bool isTempSerializeAfter()
Checks if this serializeAfter is only temporarily set.
void clearIssued()
Clears this instruction as being issued.
bool isSerializeBefore() const
uint64_t getHtmTransactionUid() const override
bool readyToCommit() const
Returns whether or not this instruction is ready to commit.
std::bitset< NumStatus > status
The status of this BaseDynInst.
void setPredTaken(bool predicted_taken)
const PCStateBase & readPredTarg()
void setPinnedRegsRenamed()
Sets the destination registers as renamed.
void setInstListIt(ListIt _instListIt)
Sets iterator for this instruction in the list of all insts.
const PCStateBase & pcState() const override
Read the PC state of this instruction.
void prevDestIdx(int idx, PhysRegIdPtr phys_reg_id)
bool isDelayedCommit() const
std::unique_ptr< PCStateBase > branchTarget() const
Returns the branch target address.
void setPinnedRegsSquashDone()
Sets dest registers' status updated after squash.
DynInst(const StaticInstPtr &staticInst, const StaticInstPtr ¯oop, InstSeqNum seq_num, CPU *cpu)
bool isCommitted() const
Returns whether or not this instruction is committed.
bool isSquashed() const
Returns whether or not this instruction is squashed.
bool isExecuted() const
Returns whether or not this instruction has executed.
bool mispredicted()
Returns whether the instruction mispredicted.
Fault initiateMemMgmtCmd(Request::Flags flags) override
Initiate a memory management command with no valid address.
bool isPinnedRegsWritten() const
Returns whether destination registers are written.
void clearCanCommit()
Clears this instruction as being ready to commit.
bool memOpDone() const
Whether or not the memory operation is done.
void setRequest()
Assert this instruction has generated a memory request.
void setSquashedInLSQ()
Sets this instruction as squashed in the LSQ.
bool isNonSpeculative() const
PhysRegIdPtr prevDestIdx(int idx) const
void setPredTarg(const PCStateBase &pred_pc)
Set the predicted target of this current instruction.
InstSeqNum seqNum
The sequence number of the instruction.
void clearInROB()
Sets this instruction as a entry the ROB.
void markSrcRegReady()
Records that one of the source registers is ready.
void * getWritableRegOperand(const StaticInst *si, int idx) override
size_t numSrcRegs() const
Returns the number of source registers.
void removeInLSQ()
Sets this instruction as a entry the LSQ.
void flattenedDestIdx(int idx, const RegId ®_id)
ssize_t sqIdx
Store queue index.
void renameSrcReg(int idx, PhysRegIdPtr renamed_src)
Renames a source logical register to the physical register which has/will produce that logical regist...
const StaticInstPtr macroop
The Macroop if one exists.
bool translationStarted() const
True if the DTB address translation has started.
void setMiscReg(int misc_reg, RegVal val) override
Sets a misc.
void setInLSQ()
Sets this instruction as a entry the LSQ.
bool readPredTaken()
Returns whether the instruction was predicted taken or not.
const RegId & srcRegIdx(int i) const
Returns the logical register index of the i'th source register.
bool mwait(PacketPtr pkt) override
void renamedDestIdx(int idx, PhysRegIdPtr phys_reg_id)
void readySrcIdx(int idx, bool ready)
void setMemAccPredicate(bool val) override
Fault initiateAcc()
Initiates the access.
bool readMemAccPredicate() const override
void clearSerializeBefore()
Clears the serializeBefore part of this instruction.
void setInIQ()
Sets this instruction as a entry the IQ.
AddressMonitor * getAddrMonitor() override
bool inHtmTransactionalState() const override
bool translationCompleted() const
True if the DTB address translation has completed.
void setCanIssue()
Sets this instruction as ready to issue.
void setHtmTransactionalState(uint64_t htm_uid, uint64_t htm_depth)
void setCommitted()
Sets this instruction as committed.
const RegId & destRegIdx(int i) const
Returns the logical register index of the i'th destination register.
std::vector< RegVal > _destMiscRegVal
Values to be written to the destination misc.
OpClass opClass() const
Returns the opclass of this instruction.
Addr effAddr
The effective virtual address (lds & stores only).
InstResult popResult(InstResult dflt=InstResult())
Pops a result off the instResult queue.
uint32_t socketId() const
Read this CPU's Socket ID.
Memory operation metadata.
Class that has various thread state, such as the status, the current instruction being processed,...
gem5::ThreadContext * getTC()
Returns a pointer to the TC of this thread.
void setPredicate(bool val)
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
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.
#define panic(...)
This implements a cprintf based panic() function.
ProbePointArg< PacketInfo > Packet
Packet probe point.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
int16_t ThreadID
Thread index/ID type.
std::shared_ptr< Request > RequestPtr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
int ContextID
Globally unique thread context ID.
constexpr decltype(nullptr) NoFault
RegClassType
Enumerate the classes of registers.
@ MiscRegClass
Control (misc) register.
Classes for managing reference counted objects.
Iterator to the circular queue.
unsigned storeCondFailures
ContextID contextId() const
PhysRegIdPtr * prevDestIdx