Go to the documentation of this file.
42 #ifndef __CPU_SIMPLE_THREAD_HH__
43 #define __CPU_SIMPLE_THREAD_HH__
47 #include "arch/decoder.hh"
50 #include "arch/isa.hh"
51 #include "arch/registers.hh"
52 #include "arch/types.hh"
54 #include "config/the_isa.hh"
57 #include "debug/CCRegs.hh"
58 #include "debug/FloatRegs.hh"
59 #include "debug/IntRegs.hh"
60 #include "debug/VecPredRegs.hh"
61 #include "debug/VecRegs.hh"
101 std::array<RegVal, TheISA::NumIntRegs>
intRegs;
102 std::array<VecRegContainer, TheISA::NumVecRegs>
vecRegs;
103 std::array<VecPredRegContainer, TheISA::NumVecPredRegs>
vecPredRegs;
104 std::array<RegVal, TheISA::NumCCRegs>
ccRegs;
253 void halt()
override;
288 int flatIndex =
isa->flattenIntIndex(reg_idx);
291 DPRINTF(IntRegs,
"Reading int reg %d (%d) as %#x.\n",
292 reg_idx, flatIndex, regVal);
299 int flatIndex =
isa->flattenFloatIndex(reg_idx);
302 DPRINTF(FloatRegs,
"Reading float reg %d (%d) bits as %#x.\n",
303 reg_idx, flatIndex, regVal);
310 int flatIndex =
isa->flattenVecIndex(
reg.index());
313 DPRINTF(VecRegs,
"Reading vector reg %d (%d) as %s.\n",
314 reg.index(), flatIndex, regVal.
print());
321 int flatIndex =
isa->flattenVecIndex(
reg.index());
324 DPRINTF(VecRegs,
"Reading vector reg %d (%d) as %s for modify.\n",
325 reg.index(), flatIndex, regVal.
print());
332 template <
typename T>
336 int flatIndex =
isa->flattenVecIndex(
reg.index());
338 auto regVal = readVecLaneFlat<T>(flatIndex,
reg.elemIndex());
339 DPRINTF(VecRegs,
"Reading vector lane %d (%d)[%d] as %lx.\n",
340 reg.index(), flatIndex,
reg.elemIndex(), regVal);
348 return readVecLane<uint8_t>(
reg);
355 return readVecLane<uint16_t>(
reg);
362 return readVecLane<uint32_t>(
reg);
369 return readVecLane<uint64_t>(
reg);
373 template <
typename LD>
377 int flatIndex =
isa->flattenVecIndex(
reg.index());
380 DPRINTF(VecRegs,
"Reading vector lane %d (%d)[%d] to %lx.\n",
381 reg.index(), flatIndex,
reg.elemIndex(),
val);
411 int flatIndex =
isa->flattenVecElemIndex(
reg.index());
414 DPRINTF(VecRegs,
"Reading element %d of vector reg %d (%d) as"
415 " %#x.\n",
reg.elemIndex(),
reg.index(), flatIndex, regVal);
422 int flatIndex =
isa->flattenVecPredIndex(
reg.index());
425 DPRINTF(VecPredRegs,
"Reading predicate reg %d (%d) as %s.\n",
426 reg.index(), flatIndex, regVal.
print());
433 int flatIndex =
isa->flattenVecPredIndex(
reg.index());
437 "Reading predicate reg %d (%d) as %s for modify.\n",
438 reg.index(), flatIndex, regVal.
print());
445 int flatIndex =
isa->flattenCCIndex(reg_idx);
446 assert(0 <= flatIndex);
449 DPRINTF(CCRegs,
"Reading CC reg %d (%d) as %#x.\n",
450 reg_idx, flatIndex, regVal);
457 int flatIndex =
isa->flattenIntIndex(reg_idx);
459 DPRINTF(IntRegs,
"Setting int reg %d (%d) to %#x.\n",
460 reg_idx, flatIndex,
val);
467 int flatIndex =
isa->flattenFloatIndex(reg_idx);
473 DPRINTF(FloatRegs,
"Setting float reg %d (%d) bits to %#x.\n",
474 reg_idx, flatIndex,
val);
480 int flatIndex =
isa->flattenVecIndex(
reg.index());
483 DPRINTF(VecRegs,
"Setting vector reg %d (%d) to %s.\n",
484 reg.index(), flatIndex,
val.print());
490 int flatIndex =
isa->flattenVecElemIndex(
reg.index());
493 DPRINTF(VecRegs,
"Setting element %d of vector reg %d (%d) to"
494 " %#x.\n",
reg.elemIndex(),
reg.index(), flatIndex,
val);
500 int flatIndex =
isa->flattenVecPredIndex(
reg.index());
503 DPRINTF(VecPredRegs,
"Setting predicate reg %d (%d) to %s.\n",
504 reg.index(), flatIndex,
val.print());
510 int flatIndex =
isa->flattenCCIndex(reg_idx);
512 DPRINTF(CCRegs,
"Setting CC reg %d (%d) to %#x.\n",
513 reg_idx, flatIndex,
val);
535 return isa->readMiscRegNoEffect(misc_reg);
541 return isa->readMiscReg(misc_reg);
547 return isa->setMiscRegNoEffect(misc_reg,
val);
553 return isa->setMiscReg(misc_reg,
val);
559 return isa->flattenRegId(regId);
626 template <
typename T>
633 template <
typename LD>
637 vecRegs[
reg].laneView<
typename LD::UnderlyingType>(lId) =
val;
683 #endif // __CPU_CPU_EXEC_CONTEXT_HH__
void clearArchRegs() override
void setThreadId(int id) override
void serialize(CheckpointOut &cp) const override
Serialize an object.
void htmAbortTransaction(uint64_t htm_uid, HtmFailureFaultCause cause) override
void setProcessPtr(Process *p)
ContextID contextId() const override
ThreadContext::Status Status
int cpuId() const override
virtual void setVecLane(const RegId ®, const LaneData< LaneSize::TwoByte > &val) override
Process * getProcessPtr()
void setVecLaneFlat(RegIndex reg, int lId, const LD &val)
TheISA::PCState pcState() const override
BaseHTMCheckpointPtr & getHtmCheckpointPtr() override
void setMemAccPredicate(bool val)
Tick readLastSuspend() override
Generic predicate register container.
void setVecReg(const RegId ®, const VecRegContainer &val) override
VecReg::Container VecRegContainer
const VecRegContainer & readVecReg(const RegId ®) const override
BaseTLB * getITBPtr() override
RegVal readFloatRegFlat(RegIndex idx) const override
VecLaneT< T, true > readVecLaneFlat(RegIndex reg, int lId) const
virtual ConstVecLane8 readVec8BitLaneReg(const RegId ®) const override
Reads source vector 8bit operand.
void setProcessPtr(Process *p) override
TheISA::Decoder * getDecoderPtr() override
void setFloatRegFlat(RegIndex idx, RegVal val) override
Tick readLastActivate() override
int ContextID
Globally unique thread context ID.
VecRegContainer & getWritableVecReg(const RegId ®) override
std::array< VecPredRegContainer, TheISA::NumVecPredRegs > vecPredRegs
RegVal readMiscRegNoEffect(RegIndex misc_reg) const override
uint32_t socketId() const
void setPredicate(bool val)
virtual ConstVecLane16 readVec16BitLaneReg(const RegId ®) const override
Reads source vector 16bit operand.
const std::string print() const
Returns a string representation of the register content.
uint64_t Tick
Tick count type.
VecPredReg::Container VecPredRegContainer
void setIntReg(RegIndex reg_idx, RegVal val) override
void suspend() override
Set the status to Suspended.
void setCCReg(RegIndex reg_idx, RegVal val) override
PCEventQueue pcEventQueue
void unserialize(CheckpointIn &cp) override
Unserialize an object.
virtual ConstVecLane64 readVec64BitLaneReg(const RegId ®) const override
Reads source vector 64bit operand.
void pcStateNoRecord(const TheISA::PCState &val) override
void setHtmCheckpointPtr(BaseHTMCheckpointPtr new_cpt) override
void setThreadId(ThreadID id)
Status status() const override
const VecElem & readVecElemFlat(RegIndex reg, const ElemIndex &elemIndex) const override
RegVal readCCReg(RegIndex reg_idx) const override
virtual void syscall(ThreadContext *tc)
VecPredRegContainer & getWritableVecPredRegFlat(RegIndex reg) override
void scheduleInstCountEvent(Event *event, Tick count) override
unsigned readStCondFailures() const override
void setMiscRegNoEffect(RegIndex misc_reg, RegVal val) override
Register ID: describe an architectural register with its class and index.
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
Tick getCurTick() const
While curTick() is useful for any object assigned to this event queue, if an object that is assigned ...
void setMiscReg(RegIndex misc_reg, RegVal val) override
void demapPage(Addr vaddr, uint64_t asn)
std::unique_ptr< BaseHTMCheckpoint > _htmCheckpoint
Struct for holding general thread state that is needed across CPU models.
ThreadContext::Status _status
int64_t Counter
Statistics counter type.
void pcState(const TheISA::PCState &val) override
std::array< RegVal, TheISA::NumFloatRegs > floatRegs
VecRegContainer & getWritableVecRegFlat(RegIndex reg) override
System * getSystemPtr() override
void demapInstPage(Addr vaddr, uint64_t asn)
void setVecRegFlat(RegIndex reg, const VecRegContainer &val) override
int64_t htmTransactionStops
Addr instAddr() const override
ThreadContext is the external interface to all thread state for anything outside of the CPU.
void takeOverFrom(ThreadContext *oldContext) override
void setStatus(Status newStatus) override
ThreadContext * getTC()
Returns the pointer to this SimpleThread's ThreadContext.
Vector Lane abstraction Another view of a container.
void descheduleInstCountEvent(Event *event) override
bool predicate
Did this instruction execute or is it predicated false.
void setIntRegFlat(RegIndex idx, RegVal val) override
VecPredRegContainer & getWritableVecPredReg(const RegId ®) override
void setStCondFailures(unsigned sc_failures) override
BaseCPU * getCpuPtr() override
const std::string print() const
PortProxy & getPhysProxy()
bool memAccPredicate
True if the memory access should be skipped for this instruction.
PortProxy & getPhysProxy() override
virtual void setVecLane(const RegId ®, const LaneData< LaneSize::EightByte > &val) override
void setCCRegFlat(RegIndex idx, RegVal val) override
SimpleThread(BaseCPU *_cpu, int _thread_num, System *_system, BaseTLB *_itb, BaseTLB *_dtb, BaseISA *_isa)
RegVal readMiscReg(RegIndex misc_reg) override
virtual ConstVecLane32 readVec32BitLaneReg(const RegId ®) const override
Reads source vector 32bit operand.
void copyState(ThreadContext *oldContext)
TheISA::MachInst MachInst
bool schedule(PCEvent *event) override
VecLaneT< T, true > readVecLane(const RegId ®) const
Vector Register Lane Interfaces.
PortProxy & getVirtProxy() override
void setVecElem(const RegId ®, const VecElem &val) override
void copyArchRegs(ThreadContext *tc) override
bool readMemAccPredicate()
bool remove(PCEvent *e) override
RegVal readIntReg(RegIndex reg_idx) const override
void setContextId(ContextID id)
void setVecElemFlat(RegIndex reg, const ElemIndex &elemIndex, const VecElem &val) override
Counter readFuncExeInst() const override
Addr nextInstAddr() const override
void setVecPredReg(const RegId ®, const VecPredRegContainer &val) override
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
RegVal readFloatReg(RegIndex reg_idx) const override
std::unique_ptr< BaseHTMCheckpoint > BaseHTMCheckpointPtr
MicroPC microPC() const override
void setFloatReg(RegIndex reg_idx, RegVal val) override
const VecPredRegContainer & readVecPredReg(const RegId ®) const override
void activate() override
Set the status to Active.
std::array< RegVal, TheISA::NumCCRegs > ccRegs
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
void initMemProxies(ThreadContext *tc) override
Initialise the physical and virtual port proxies and tie them to the data port of the CPU.
EventQueue comInstEventQueue
An instruction-based event queue.
virtual void demapPage(Addr vaddr, uint64_t asn)=0
BaseTLB * getDTBPtr() override
std::array< VecRegContainer, TheISA::NumVecRegs > vecRegs
This object is a proxy for a port or other object which implements the functional response protocol,...
void initMemProxies(ThreadContext *tc)
Initialise the physical and virtual port proxies and tie them to the data port of the CPU.
int64_t htmTransactionStarts
GenericISA::DelaySlotPCState< MachInst > PCState
bool remove(PCEvent *event) override
const VecPredRegContainer & readVecPredRegFlat(RegIndex reg) const override
PortProxy & getVirtProxy()
unsigned storeCondFailures
RegVal readCCRegFlat(RegIndex idx) const override
void demapDataPage(Addr vaddr, uint64_t asn)
void deschedule(Event *event)
Deschedule the specified event.
uint16_t ElemIndex
Logical vector register elem index type.
int threadId() const override
Tick readLastSuspend() const
void setVecPredRegFlat(RegIndex reg, const VecPredRegContainer &val) override
std::ostream CheckpointOut
Tick getCurrentInstCount() override
BaseISA * getIsaPtr() override
RegVal readIntRegFlat(RegIndex idx) const override
Flat register interfaces.
const VecRegContainer & readVecRegFlat(RegIndex reg) const override
void setVecLaneT(const RegId ®, const LD &val)
Write a lane of the destination vector register.
void halt() override
Set the status to Halted.
uint32_t socketId() const override
Queue of events sorted in time order.
virtual void setVecLane(const RegId ®, const LaneData< LaneSize::Byte > &val) override
Write a lane of the destination vector register.
ThreadID threadId() const
Process * getProcessPtr() override
Tick readLastActivate() const
bool schedule(PCEvent *e) override
const VecElem & readVecElem(const RegId ®) const override
virtual void setVecLane(const RegId ®, const LaneData< LaneSize::FourByte > &val) override
RegId flattenRegId(const RegId ®Id) const override
std::array< RegVal, TheISA::NumIntRegs > intRegs
void setContextId(ContextID id) override
std::string csprintf(const char *format, const Args &...args)
LaneSize is an abstraction of a LS byte value for the execution and thread contexts to handle values ...
ContextID contextId() const
bool readPredicate() const
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
CheckerCPU * getCheckerCpuPtr() override
Counter readFuncExeInst() const
Reads the number of instructions functionally executed and committed.
Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17