gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::SimpleThread Class Reference

The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interface. More...

#include <simple_thread.hh>

Inheritance diagram for gem5::SimpleThread:
gem5::ThreadState gem5::ThreadContext gem5::Serializable gem5::PCEventScope

Public Types

typedef ThreadContext::Status Status
 
- Public Types inherited from gem5::ThreadState
typedef ThreadContext::Status Status
 
- Public Types inherited from gem5::ThreadContext
enum  Status { Active , Suspended , Halting , Halted }
 

Public Member Functions

std::string name () const
 
 SimpleThread (BaseCPU *_cpu, int _thread_num, System *_system, BaseMMU *_mmu, BaseISA *_isa, InstDecoder *_decoder)
 
 SimpleThread (BaseCPU *_cpu, int _thread_num, System *_system, Process *_process, BaseMMU *_mmu, BaseISA *_isa, InstDecoder *_decoder)
 
virtual ~SimpleThread ()
 
void takeOverFrom (ThreadContext *oldContext) override
 
void copyState (ThreadContext *oldContext)
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
ThreadContextgetTC ()
 Returns the pointer to this SimpleThread's ThreadContext.
 
void demapPage (Addr vaddr, uint64_t asn)
 
bool schedule (PCEvent *e) override
 
bool remove (PCEvent *e) override
 
void scheduleInstCountEvent (Event *event, Tick count) override
 
void descheduleInstCountEvent (Event *event) override
 
Tick getCurrentInstCount () override
 
BaseCPUgetCpuPtr () override
 
int cpuId () const override
 
uint32_t socketId () const override
 
int threadId () const override
 
void setThreadId (int id) override
 
ContextID contextId () const override
 
void setContextId (ContextID id) override
 
BaseMMUgetMMUPtr () override
 
CheckerCPUgetCheckerCpuPtr () override
 
BaseISAgetIsaPtr () const override
 
InstDecodergetDecoderPtr () override
 
SystemgetSystemPtr () override
 
ProcessgetProcessPtr () override
 
void setProcessPtr (Process *p) override
 
Status status () const override
 
void setStatus (Status newStatus) override
 
void activate () override
 Set the status to Active.
 
void suspend () override
 Set the status to Suspended.
 
void halt () override
 Set the status to Halted.
 
Tick readLastActivate () override
 
Tick readLastSuspend () override
 
void copyArchRegs (ThreadContext *tc) override
 
void clearArchRegs () override
 
const PCStateBasepcState () const override
 
void pcState (const PCStateBase &val) override
 
void pcStateNoRecord (const PCStateBase &val) override
 
bool readPredicate () const
 
void setPredicate (bool val)
 
RegVal readMiscRegNoEffect (RegIndex misc_reg) const override
 
RegVal readMiscReg (RegIndex misc_reg) override
 
void setMiscRegNoEffect (RegIndex misc_reg, RegVal val) override
 
void setMiscReg (RegIndex misc_reg, RegVal val) override
 
unsigned readStCondFailures () const override
 
bool readMemAccPredicate ()
 
void setMemAccPredicate (bool val)
 
void setStCondFailures (unsigned sc_failures) override
 
RegVal getReg (const RegId &arch_reg) const override
 
void getReg (const RegId &arch_reg, void *val) const override
 
void * getWritableReg (const RegId &arch_reg) override
 
void setReg (const RegId &arch_reg, RegVal val) override
 
void setReg (const RegId &arch_reg, const void *val) override
 
void htmAbortTransaction (uint64_t htm_uid, HtmFailureFaultCause cause) override
 
BaseHTMCheckpointPtrgetHtmCheckpointPtr () override
 
void setHtmCheckpointPtr (BaseHTMCheckpointPtr new_cpt) override
 
- Public Member Functions inherited from gem5::ThreadState
 ThreadState (BaseCPU *cpu, ThreadID _tid, Process *_process)
 
virtual ~ThreadState ()=default
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
int cpuId () const
 
uint32_t socketId () const
 
ContextID contextId () const
 
void setContextId (ContextID id)
 
void setThreadId (ThreadID id)
 
ThreadID threadId () const
 
Tick readLastActivate () const
 
Tick readLastSuspend () const
 
ProcessgetProcessPtr ()
 
void setProcessPtr (Process *p)
 
Status status () const
 Returns the status of this thread.
 
void setStatus (Status new_status)
 Sets the status of this thread.
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 
- Public Member Functions inherited from gem5::ThreadContext
bool getUseForClone ()
 
void setUseForClone (bool new_val)
 
virtual ~ThreadContext ()
 
virtual void sendFunctional (PacketPtr pkt)
 
void quiesce ()
 Quiesce thread context.
 
void quiesceTick (Tick resume)
 Quiesce, suspend, and schedule activate at resume.
 
virtual void regStats (const std::string &name)
 
void pcState (Addr addr)
 
virtual int exit ()
 

Public Attributes

PCEventQueue pcEventQueue
 
EventQueue comInstEventQueue
 An instruction-based event queue.
 
Systemsystem
 
BaseMMUmmu
 
InstDecoderdecoder
 
int64_t htmTransactionStarts
 
int64_t htmTransactionStops
 
- Public Attributes inherited from gem5::ThreadState
Counter numInst
 Number of instructions committed.
 
Counter numOp
 Number of ops (including micro ops) committed.
 
gem5::ThreadState::ThreadStateStats threadStats
 
Counter numLoad
 Number of simulated loads, used for tracking events based on the number of loads committed.
 
Counter startNumLoad
 The number of simulated loads committed prior to this run.
 
Tick lastActivate
 Last time activate was called on this thread.
 
Tick lastSuspend
 Last time suspend was called on this thread.
 
unsigned storeCondFailures
 
- Public Attributes inherited from gem5::ThreadContext
int intResult = DefaultIntResult
 
double floatResult = DefaultFloatResult
 
int intOffset = 0
 

Protected Attributes

std::array< RegFile, CCRegClass+1 > regFiles
 
BaseISA *const isa
 
std::unique_ptr< PCStateBase_pcState
 
std::unique_ptr< BaseHTMCheckpoint_htmCheckpoint
 
bool predicate
 Did this instruction execute or is it predicated false.
 
bool memAccPredicate
 True if the memory access should be skipped for this instruction.
 
- Protected Attributes inherited from gem5::ThreadState
ThreadContext::Status _status
 
BaseCPUbaseCpu
 
ContextID _contextId
 
ThreadID _threadId
 
Processprocess
 
- Protected Attributes inherited from gem5::ThreadContext
bool useForClone = false
 

Additional Inherited Members

- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 
- Static Public Member Functions inherited from gem5::ThreadContext
static void compare (ThreadContext *one, ThreadContext *two)
 function to compare two thread contexts (for debugging)
 
- Static Public Attributes inherited from gem5::ThreadContext
static const int ints []
 
static const double floats []
 
static const int DefaultIntResult = 0
 
static const double DefaultFloatResult = 0.0
 

Detailed Description

The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interface.

It implements the ThreadContext interface and adds to the ThreadState object by adding all the objects needed for simple functional execution, including a simple architectural register file, and pointers to the ITB and DTB in full system mode. For CPU models that do not need more advanced ways to hold state (i.e. a separate physical register file, or separate fetch and commit PC's), this SimpleThread class provides all the necessary state for full architecture-level functional simulation. See the AtomicSimpleCPU or TimingSimpleCPU for examples.

Definition at line 93 of file simple_thread.hh.

Member Typedef Documentation

◆ Status

Constructor & Destructor Documentation

◆ SimpleThread() [1/2]

gem5::SimpleThread::SimpleThread ( BaseCPU * _cpu,
int _thread_num,
System * _system,
BaseMMU * _mmu,
BaseISA * _isa,
InstDecoder * _decoder )

Definition at line 90 of file simple_thread.cc.

◆ SimpleThread() [2/2]

gem5::SimpleThread::SimpleThread ( BaseCPU * _cpu,
int _thread_num,
System * _system,
Process * _process,
BaseMMU * _mmu,
BaseISA * _isa,
InstDecoder * _decoder )

◆ ~SimpleThread()

virtual gem5::SimpleThread::~SimpleThread ( )
inlinevirtual

Definition at line 147 of file simple_thread.hh.

Member Function Documentation

◆ activate()

◆ clearArchRegs()

void gem5::SimpleThread::clearArchRegs ( )
inlineoverridevirtual

◆ contextId()

◆ copyArchRegs()

void gem5::SimpleThread::copyArchRegs ( ThreadContext * tc)
overridevirtual

◆ copyState()

◆ cpuId()

int gem5::SimpleThread::cpuId ( ) const
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 198 of file simple_thread.hh.

References gem5::ThreadState::cpuId().

◆ demapPage()

void gem5::SimpleThread::demapPage ( Addr vaddr,
uint64_t asn )
inline

◆ descheduleInstCountEvent()

void gem5::SimpleThread::descheduleInstCountEvent ( Event * event)
inlineoverridevirtual

◆ getCheckerCpuPtr()

CheckerCPU * gem5::SimpleThread::getCheckerCpuPtr ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 207 of file simple_thread.hh.

◆ getCpuPtr()

BaseCPU * gem5::SimpleThread::getCpuPtr ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 196 of file simple_thread.hh.

References gem5::ThreadState::baseCpu.

◆ getCurrentInstCount()

Tick gem5::SimpleThread::getCurrentInstCount ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 191 of file simple_thread.hh.

References comInstEventQueue, and gem5::EventQueue::getCurTick().

◆ getDecoderPtr()

InstDecoder * gem5::SimpleThread::getDecoderPtr ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 211 of file simple_thread.hh.

References decoder.

◆ getHtmCheckpointPtr()

BaseHTMCheckpointPtr & gem5::SimpleThread::getHtmCheckpointPtr ( )
overridevirtual

Implements gem5::ThreadContext.

Definition at line 184 of file simple_thread.cc.

References _htmCheckpoint.

◆ getIsaPtr()

◆ getMMUPtr()

BaseMMU * gem5::SimpleThread::getMMUPtr ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 205 of file simple_thread.hh.

References mmu.

Referenced by gem5::minor::ExecContext::demapPage().

◆ getProcessPtr()

Process * gem5::SimpleThread::getProcessPtr ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 215 of file simple_thread.hh.

References gem5::ThreadState::getProcessPtr().

◆ getReg() [1/2]

◆ getReg() [2/2]

void gem5::SimpleThread::getReg ( const RegId & arch_reg,
void * val ) const
inlineoverridevirtual

◆ getSystemPtr()

System * gem5::SimpleThread::getSystemPtr ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 213 of file simple_thread.hh.

References system.

◆ getTC()

◆ getWritableReg()

void * gem5::SimpleThread::getWritableReg ( const RegId & arch_reg)
inlineoverridevirtual

◆ halt()

void gem5::SimpleThread::halt ( )
overridevirtual

◆ htmAbortTransaction()

void gem5::SimpleThread::htmAbortTransaction ( uint64_t htm_uid,
HtmFailureFaultCause cause )
overridevirtual

◆ name()

std::string gem5::SimpleThread::name ( ) const
inline

◆ pcState() [1/2]

◆ pcState() [2/2]

void gem5::SimpleThread::pcState ( const PCStateBase & val)
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 257 of file simple_thread.hh.

References _pcState, gem5::ArmISA::set, and gem5::X86ISA::val.

◆ pcStateNoRecord()

void gem5::SimpleThread::pcStateNoRecord ( const PCStateBase & val)
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 260 of file simple_thread.hh.

References _pcState, gem5::ArmISA::set, and gem5::X86ISA::val.

◆ readLastActivate()

Tick gem5::SimpleThread::readLastActivate ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 232 of file simple_thread.hh.

References gem5::ThreadState::readLastActivate().

◆ readLastSuspend()

Tick gem5::SimpleThread::readLastSuspend ( )
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 237 of file simple_thread.hh.

References gem5::ThreadState::readLastSuspend().

◆ readMemAccPredicate()

bool gem5::SimpleThread::readMemAccPredicate ( )
inline

◆ readMiscReg()

◆ readMiscRegNoEffect()

RegVal gem5::SimpleThread::readMiscRegNoEffect ( RegIndex misc_reg) const
inlineoverridevirtual

◆ readPredicate()

bool gem5::SimpleThread::readPredicate ( ) const
inline

◆ readStCondFailures()

unsigned gem5::SimpleThread::readStCondFailures ( ) const
inlineoverridevirtual

◆ remove()

bool gem5::SimpleThread::remove ( PCEvent * e)
inlineoverridevirtual

◆ schedule()

bool gem5::SimpleThread::schedule ( PCEvent * e)
inlineoverridevirtual

◆ scheduleInstCountEvent()

void gem5::SimpleThread::scheduleInstCountEvent ( Event * event,
Tick count )
inlineoverridevirtual

◆ serialize()

void gem5::SimpleThread::serialize ( CheckpointOut & cp) const
overridevirtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 118 of file simple_thread.cc.

References gem5::serialize(), and gem5::ThreadState::serialize().

Referenced by gem5::BaseKvmCPU::serializeThread().

◆ setContextId()

void gem5::SimpleThread::setContextId ( ContextID id)
inlineoverridevirtual

◆ setHtmCheckpointPtr()

void gem5::SimpleThread::setHtmCheckpointPtr ( BaseHTMCheckpointPtr new_cpt)
overridevirtual

Implements gem5::ThreadContext.

Definition at line 190 of file simple_thread.cc.

References _htmCheckpoint.

◆ setMemAccPredicate()

void gem5::SimpleThread::setMemAccPredicate ( bool val)
inline

◆ setMiscReg()

◆ setMiscRegNoEffect()

void gem5::SimpleThread::setMiscRegNoEffect ( RegIndex misc_reg,
RegVal val )
inlineoverridevirtual

◆ setPredicate()

void gem5::SimpleThread::setPredicate ( bool val)
inline

◆ setProcessPtr()

void gem5::SimpleThread::setProcessPtr ( Process * p)
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 216 of file simple_thread.hh.

References gem5::MipsISA::p, and gem5::ThreadState::setProcessPtr().

◆ setReg() [1/2]

void gem5::SimpleThread::setReg ( const RegId & arch_reg,
const void * val )
inlineoverridevirtual

◆ setReg() [2/2]

◆ setStatus()

void gem5::SimpleThread::setStatus ( Status newStatus)
inlineoverridevirtual

◆ setStCondFailures()

void gem5::SimpleThread::setStCondFailures ( unsigned sc_failures)
inlineoverridevirtual

◆ setThreadId()

void gem5::SimpleThread::setThreadId ( int id)
inlineoverridevirtual

◆ socketId()

uint32_t gem5::SimpleThread::socketId ( ) const
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 199 of file simple_thread.hh.

References gem5::ThreadState::socketId().

◆ status()

Status gem5::SimpleThread::status ( ) const
inlineoverridevirtual

Implements gem5::ThreadContext.

Definition at line 218 of file simple_thread.hh.

References gem5::ThreadState::_status.

Referenced by activate(), halt(), suspend(), and gem5::BaseKvmCPU::wakeup().

◆ suspend()

◆ takeOverFrom()

void gem5::SimpleThread::takeOverFrom ( ThreadContext * oldContext)
overridevirtual

◆ threadId()

◆ unserialize()

void gem5::SimpleThread::unserialize ( CheckpointIn & cp)
overridevirtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 126 of file simple_thread.cc.

References gem5::ThreadState::unserialize(), and gem5::unserialize().

Referenced by gem5::BaseKvmCPU::unserializeThread().

Member Data Documentation

◆ _htmCheckpoint

std::unique_ptr<BaseHTMCheckpoint> gem5::SimpleThread::_htmCheckpoint
protected

Definition at line 106 of file simple_thread.hh.

Referenced by getHtmCheckpointPtr(), and setHtmCheckpointPtr().

◆ _pcState

std::unique_ptr<PCStateBase> gem5::SimpleThread::_pcState
protected

Definition at line 103 of file simple_thread.hh.

Referenced by clearArchRegs(), pcState(), pcState(), and pcStateNoRecord().

◆ comInstEventQueue

EventQueue gem5::SimpleThread::comInstEventQueue

An instruction-based event queue.

Used for scheduling events based on number of instructions committed.

Definition at line 126 of file simple_thread.hh.

Referenced by descheduleInstCountEvent(), gem5::minor::Execute::doInstCommitAccounting(), getCurrentInstCount(), scheduleInstCountEvent(), gem5::BaseSimpleCPU::serviceInstCountEvents(), gem5::BaseKvmCPU::setupInstStop(), and gem5::BaseKvmCPU::tick().

◆ decoder

◆ htmTransactionStarts

◆ htmTransactionStops

◆ isa

◆ memAccPredicate

bool gem5::SimpleThread::memAccPredicate
protected

True if the memory access should be skipped for this instruction.

Definition at line 112 of file simple_thread.hh.

Referenced by readMemAccPredicate(), and setMemAccPredicate().

◆ mmu

◆ pcEventQueue

PCEventQueue gem5::SimpleThread::pcEventQueue

Definition at line 121 of file simple_thread.hh.

Referenced by remove(), and schedule().

◆ predicate

bool gem5::SimpleThread::predicate
protected

Did this instruction execute or is it predicated false.

Definition at line 109 of file simple_thread.hh.

Referenced by readPredicate(), and setPredicate().

◆ regFiles

std::array<RegFile, CCRegClass + 1> gem5::SimpleThread::regFiles
protected

Definition at line 99 of file simple_thread.hh.

Referenced by clearArchRegs(), getReg(), getReg(), getWritableReg(), setReg(), and setReg().

◆ system

System* gem5::SimpleThread::system

Definition at line 128 of file simple_thread.hh.

Referenced by getSystemPtr().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:14 for gem5 by doxygen 1.11.0