44 #ifndef __CPU_O3_THREAD_CONTEXT_HH__ 45 #define __CPU_O3_THREAD_CONTEXT_HH__ 47 #include "config/the_isa.hh" 73 typedef typename Impl::O3CPU
O3CPU;
81 return thread->pcEventQueue.schedule(e);
86 return thread->pcEventQueue.remove(
e);
92 thread->comInstEventQueue.schedule(event, count);
97 thread->comInstEventQueue.deschedule(event);
102 return thread->comInstEventQueue.getCurTick();
119 return cpu->isa[thread->
threadId()];
125 return cpu->fetch.decoder[thread->
threadId()];
132 int cpuId()
const override {
return cpu->cpuId(); }
135 uint32_t
socketId()
const override {
return cpu->socketId(); }
181 void activate()
override;
184 void suspend()
override;
187 void halt()
override;
192 void dumpFuncProfile()
override;
198 void regStats(
const std::string &
name)
override;
201 Tick readLastActivate()
override;
203 Tick readLastSuspend()
override;
206 void profileClear()
override;
208 void profileSample()
override;
214 void clearArchRegs()
override;
240 return readVecRegFlat(flattenRegId(
id).
index());
249 return getWritableVecRegFlat(flattenRegId(
id).
index());
258 return readVecLaneFlat<uint8_t>(flattenRegId(
id).index(),
266 return readVecLaneFlat<uint16_t>(flattenRegId(
id).index(),
274 return readVecLaneFlat<uint32_t>(flattenRegId(
id).index(),
282 return readVecLaneFlat<uint64_t>(flattenRegId(
id).index(),
316 return readVecElemFlat(flattenRegId(reg).
index(), reg.
elemIndex());
322 return readVecPredRegFlat(flattenRegId(
id).
index());
328 return getWritableVecPredRegFlat(flattenRegId(
id).
index());
349 reg_idx)).
index(), val);
355 setVecRegFlat(flattenRegId(reg).
index(), val);
368 setVecPredRegFlat(flattenRegId(reg).
index(), val);
381 return cpu->pcState(thread->
threadId());
393 return cpu->instAddr(thread->
threadId());
400 return cpu->nextInstAddr(thread->
threadId());
407 return cpu->microPC(thread->
threadId());
414 return cpu->readMiscRegNoEffect(misc_reg, thread->
threadId());
422 return cpu->readMiscReg(misc_reg, thread->
threadId());
432 RegId flattenRegId(
const RegId& regId)
const override;
453 return cpu->syscall(thread->
threadId(), fault);
474 cpu->squashFromTC(thread->
threadId());
488 template <
typename VecElem>
492 return cpu->template readArchVecLane<VecElem>(idx, lId,
496 template <
typename LD>
500 cpu->template setArchVecLane(idx, lId, thread->
threadId(),
val);
504 const ElemIndex& elemIndex)
const override;
510 void setVecPredRegFlat(
RegIndex idx,
bool trapPending
Whether or not the thread is currently waiting on a trap, and thus able to be externally updated with...
ContextID contextId() const override
RegVal readMiscReg(RegIndex misc_reg) override
Reads a misc.
void setContextId(ContextID id)
const VecPredRegContainer & readVecPredReg(const RegId &id) const override
CheckerCPU * getCheckerCpuPtr() override
const std::string & name()
Class that has various thread state, such as the status, the current instruction being processed...
BaseTLB * getDTBPtr() override
Returns a pointer to the DTB.
void setVecLane(const RegId ®, const LaneData< LaneSize::EightByte > &val) override
PortProxy & getPhysProxy()
Vector Register Abstraction This generic class is the model in a particularization of MVC...
Status status() const override
Returns this thread's status.
void setIntReg(RegIndex reg_idx, RegVal val) override
Sets an integer register to a value.
RegVal readFloatReg(RegIndex reg_idx) const override
::Kernel::Statistics * getKernelStats() override
Returns a pointer to this thread's kernel statistics.
void setThreadId(ThreadID id)
Counter readFuncExeInst() const override
Reads the funcExeInst counter.
void setCCReg(RegIndex reg_idx, RegVal val) override
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Event for timing out quiesce instruction.
EndQuiesceEvent * quiesceEvent
Process * getProcessPtr() override
Returns a pointer to this thread's process.
void setVecLane(const RegId ®, const LaneData< LaneSize::Byte > &val) override
Write a lane of the destination vector register.
int cpuId() const override
Reads this CPU's ID.
PortProxy & getPhysProxy() override
void setStatus(Status new_status)
Sets the status of this thread.
RegVal readCCReg(RegIndex reg_idx) const override
const RegIndex & elemIndex() const
Elem accessor.
void setThreadId(int id) override
bool schedule(PCEvent *e) override
void setFloatReg(RegIndex reg_idx, RegVal val) override
LaneSize is an abstraction of a LS byte value for the execution and thread contexts to handle values ...
ConstVecLane16 readVec16BitLaneReg(const RegId &id) const override
Reads source vector 16bit operand.
ContextID contextId() const
void setProcessPtr(Process *p)
VecLaneT< VecElem, true > readVecLaneFlat(RegIndex idx, int lId) const
uint64_t Tick
Tick count type.
Addr instAddr() const override
Reads this thread's PC.
const VecElem & readVecElem(const RegId ®) const override
void setStCondFailures(unsigned sc_failures) override
Sets the number of consecutive store conditional failures.
TheISA::PCState pcState() const override
Reads this thread's PC state.
Kernel::Statistics * kernelStats
void setStatus(Status new_status) override
Sets this thread's status.
const VecRegContainer & readVecReg(const RegId &id) const override
ConstVecLane8 readVec8BitLaneReg(const RegId &id) const override
Vector Register Lane Interfaces.
TheISA::Decoder * getDecoderPtr() override
ConstVecLane64 readVec64BitLaneReg(const RegId &id) const override
Reads source vector 64bit operand.
ThreadID threadId() const
void descheduleInstCountEvent(Event *event) override
EndQuiesceEvent * getQuiesceEvent() override
Returns pointer to the quiesce event.
void setVecElem(const RegId ®, const VecElem &val) override
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void scheduleInstCountEvent(Event *event, Tick count) override
System * getSystemPtr() override
Returns a pointer to the system.
void setVecLane(const RegId ®, const LaneData< LaneSize::FourByte > &val) override
uint32_t socketId() const override
Reads this CPU's Socket ID.
int64_t Counter
Statistics counter type.
MicroPC microPC() const override
Reads this thread's next PC.
RegVal readMiscRegNoEffect(RegIndex misc_reg) const override
Reads a miscellaneous register.
void takeOverFrom(ThreadContext &new_tc, ThreadContext &old_tc)
Copy state between thread contexts in preparation for CPU handover.
void initMemProxies(ThreadContext *tc)
Initialise the physical and virtual port proxies and tie them to the data port of the CPU...
void setVecLaneFlat(int idx, int lId, const LD &val)
unsigned readStCondFailures() const override
Returns the number of consecutive store conditional failures.
This object is a proxy for a port or other object which implements the functional response protocol...
RegVal readReg(RegIndex reg_idx)
Reads an integer register.
void setVecPredReg(const RegId ®, const VecPredRegContainer &val) override
O3CPU * cpu
Pointer to the CPU.
void syscall(Fault *fault) override
Executes a syscall in SE mode.
BaseISA * getIsaPtr() override
VecRegContainer & getWritableVecReg(const RegId &id) override
Read vector register operand for modification, hierarchical indexing.
Process * getProcessPtr()
uint16_t ElemIndex
Logical vector register elem index type.
void setVecReg(const RegId ®, const VecRegContainer &val) override
BaseTLB * getITBPtr() override
Returns a pointer to the ITB.
GenericISA::SimplePCState< MachInst > PCState
Generic predicate register container.
Tick getCurrentInstCount() override
void setContextId(ContextID id) override
int threadId() const override
Returns this thread's ID number.
Derived ThreadContext class for use with the O3CPU.
Register ID: describe an architectural register with its class and index.
unsigned storeCondFailures
void conditionalSquash()
check if the cpu is currently in state update mode and squash if not.
void initMemProxies(ThreadContext *tc) override
Initialise the physical and virtual port proxies and tie them to the data port of the CPU...
Vector Lane abstraction Another view of a container.
void setVecLane(const RegId ®, const LaneData< LaneSize::TwoByte > &val) override
Status status() const
Returns the status of this thread.
O3ThreadState< Impl > * thread
Pointer to the thread state that this TC corrseponds to.
std::shared_ptr< FaultBase > Fault
Addr nextInstAddr() const override
Reads this thread's next PC.
BaseCPU * getCpuPtr() override
Returns a pointer to this CPU.
int ContextID
Globally unique thread context ID.
RegVal readIntReg(RegIndex reg_idx) const override
ConstVecLane32 readVec32BitLaneReg(const RegId &id) const override
Reads source vector 32bit operand.
void setProcessPtr(Process *p) override
VecPredRegContainer & getWritableVecPredReg(const RegId &id) override