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

Per-CPU architected timer. More...

#include <generic_timer.hh>

Inheritance diagram for gem5::ArchTimer:
gem5::SystemCounterListener gem5::Drainable gem5::Serializable gem5::ArchTimerKvm

Public Member Functions

 ArchTimer (const std::string &name, SimObject &parent, SystemCounter &sysctr, ArmInterruptPin *interrupt)
 
std::string name () const
 Returns the timer name.
 
uint64_t compareValue () const
 Returns the CompareValue view of the timer.
 
void setCompareValue (uint64_t val)
 Sets the CompareValue view of the timer.
 
uint32_t timerValue () const
 Returns the TimerValue view of the timer.
 
void setTimerValue (uint32_t val)
 Sets the TimerValue view of the timer.
 
uint32_t control () const
 Sets the control register.
 
void setControl (uint32_t val)
 
uint64_t offset () const
 
void setOffset (uint64_t val)
 
uint64_t value () const
 Returns the value of the counter which this timer relies on.
 
Tick whenValue (uint64_t target_val)
 
void notify (void) override
 Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled properly inside this member function.
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
DrainState drain () override
 Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.
 
void drainResume () override
 Resume execution after a successful drain.
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object.
 
virtual void notifyFork ()
 Notify a child process of a fork.
 
- 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)
 

Protected Member Functions

 BitUnion32 (ArchTimerCtrl) Bitfield< 0 > enable
 Control register.
 
void updateCounter ()
 Timer settings or the offset has changed, re-evaluate trigger condition and raise interrupt if necessary.
 
void counterLimitReached ()
 Called when the upcounter reaches the programmed value.
 
virtual bool scheduleEvents ()
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
void signalDrainDone () const
 Signal that an object is drained.
 

Protected Attributes

Bitfield< 1 > imask
 
Bitfield< 2 > istatus
 
EndBitUnion(ArchTimerCtrl) const std SimObject_parent
 Name of this timer.
 
SystemCounter_systemCounter
 
ArmInterruptPin *const _interrupt
 
ArchTimerCtrl _control
 Value of the control register ({CNTP/CNTHP/CNTV}_CTL).
 
uint64_t _counterLimit
 Programmed limit value for the upcounter ({CNTP/CNTHP/CNTV}_CVAL).
 
uint64_t _offset
 Offset relative to the physical timer (CNTVOFF)
 
EventFunctionWrapper _counterLimitReachedEvent
 

Private Member Functions

 ArchTimer (const ArchTimer &t)
 

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.
 

Detailed Description

Per-CPU architected timer.

Definition at line 179 of file generic_timer.hh.

Constructor & Destructor Documentation

◆ ArchTimer() [1/2]

gem5::ArchTimer::ArchTimer ( const std::string & name,
SimObject & parent,
SystemCounter & sysctr,
ArmInterruptPin * interrupt )

Definition at line 260 of file generic_timer.cc.

References counterLimitReached().

◆ ArchTimer() [2/2]

gem5::ArchTimer::ArchTimer ( const ArchTimer & t)
private

Member Function Documentation

◆ BitUnion32()

gem5::ArchTimer::BitUnion32 ( ArchTimerCtrl )
protected

Control register.

◆ compareValue()

uint64_t gem5::ArchTimer::compareValue ( ) const
inline

Returns the CompareValue view of the timer.

Definition at line 229 of file generic_timer.hh.

References _counterLimit.

Referenced by gem5::GenericTimer::readMiscReg(), gem5::GenericTimerFrame::timerRead(), and gem5::GenericTimerFrame::timerWrite().

◆ control()

uint32_t gem5::ArchTimer::control ( ) const
inline

Sets the control register.

Definition at line 239 of file generic_timer.hh.

References _control.

Referenced by gem5::GenericTimer::readMiscReg(), and gem5::GenericTimerFrame::timerRead().

◆ counterLimitReached()

void gem5::ArchTimer::counterLimitReached ( )
protected

Called when the upcounter reaches the programmed value.

Definition at line 273 of file generic_timer.cc.

References _control, _interrupt, DPRINTF, gem5::ArmInterruptPin::raise(), and scheduleEvents().

Referenced by ArchTimer(), and updateCounter().

◆ drain()

DrainState gem5::ArchTimer::drain ( )
overridevirtual

Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.

Draining is mostly used before forking and creating a check point.

This function notifies an object that it needs to drain its state.

If the object does not need further simulation to drain internal buffers, it returns DrainState::Drained and automatically switches to the Drained state. If the object needs more simulation, it returns DrainState::Draining and automatically enters the Draining state. Other return values are invalid.

Note
An object that has entered the Drained state can be disturbed by other objects in the system and consequently stop being drained. These perturbations are not visible in the drain state. The simulator therefore repeats the draining process until all objects return DrainState::Drained on the first call to drain().
Returns
DrainState::Drained if the object is drained at this point in time, DrainState::Draining if it needs further simulation.

Implements gem5::Drainable.

Definition at line 396 of file generic_timer.cc.

References _counterLimitReachedEvent, _parent, gem5::EventManager::deschedule(), gem5::Drained, and gem5::Event::scheduled().

◆ drainResume()

void gem5::ArchTimer::drainResume ( )
overridevirtual

Resume execution after a successful drain.

Reimplemented from gem5::Drainable.

Definition at line 405 of file generic_timer.cc.

References updateCounter().

◆ name()

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

Returns the timer name.

Definition at line 226 of file generic_timer.hh.

◆ notify()

void gem5::ArchTimer::notify ( void )
overridevirtual

Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled properly inside this member function.

Implements gem5::SystemCounterListener.

Definition at line 368 of file generic_timer.cc.

References updateCounter().

◆ offset()

uint64_t gem5::ArchTimer::offset ( ) const
inline

◆ scheduleEvents()

virtual bool gem5::ArchTimer::scheduleEvents ( )
inlineprotectedvirtual

Reimplemented in gem5::ArchTimerKvm.

Definition at line 217 of file generic_timer.hh.

Referenced by counterLimitReached(), and updateCounter().

◆ serialize()

void gem5::ArchTimer::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 374 of file generic_timer.cc.

References _control, _counterLimit, _offset, gem5::paramOut(), and SERIALIZE_SCALAR.

◆ setCompareValue()

void gem5::ArchTimer::setCompareValue ( uint64_t val)

Sets the CompareValue view of the timer.

Definition at line 314 of file generic_timer.cc.

References _counterLimit, updateCounter(), and gem5::X86ISA::val.

Referenced by gem5::GenericTimer::setMiscReg(), setTimerValue(), and gem5::GenericTimerFrame::timerWrite().

◆ setControl()

◆ setOffset()

void gem5::ArchTimer::setOffset ( uint64_t val)

◆ setTimerValue()

void gem5::ArchTimer::setTimerValue ( uint32_t val)

Sets the TimerValue view of the timer.

Definition at line 321 of file generic_timer.cc.

References setCompareValue(), gem5::sext(), gem5::X86ISA::val, and value().

Referenced by gem5::GenericTimer::setMiscReg(), and gem5::GenericTimerFrame::timerWrite().

◆ timerValue()

uint32_t gem5::ArchTimer::timerValue ( ) const
inline

Returns the TimerValue view of the timer.

Definition at line 234 of file generic_timer.hh.

References _counterLimit, and value().

Referenced by gem5::GenericTimer::readMiscReg(), and gem5::GenericTimerFrame::timerRead().

◆ unserialize()

void gem5::ArchTimer::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 382 of file generic_timer.cc.

References _control, _offset, gem5::paramIn(), and UNSERIALIZE_OPT_SCALAR.

◆ updateCounter()

void gem5::ArchTimer::updateCounter ( )
protected

◆ value()

uint64_t gem5::ArchTimer::value ( ) const

◆ whenValue()

Tick gem5::ArchTimer::whenValue ( uint64_t target_val)
inline

Member Data Documentation

◆ _control

ArchTimerCtrl gem5::ArchTimer::_control
protected

Value of the control register ({CNTP/CNTHP/CNTV}_CTL).

Definition at line 201 of file generic_timer.hh.

Referenced by control(), counterLimitReached(), serialize(), setControl(), unserialize(), and updateCounter().

◆ _counterLimit

uint64_t gem5::ArchTimer::_counterLimit
protected

Programmed limit value for the upcounter ({CNTP/CNTHP/CNTV}_CVAL).

Definition at line 203 of file generic_timer.hh.

Referenced by compareValue(), serialize(), setCompareValue(), timerValue(), and updateCounter().

◆ _counterLimitReachedEvent

EventFunctionWrapper gem5::ArchTimer::_counterLimitReachedEvent
protected

Definition at line 215 of file generic_timer.hh.

Referenced by drain(), and updateCounter().

◆ _interrupt

ArmInterruptPin* const gem5::ArchTimer::_interrupt
protected

Definition at line 198 of file generic_timer.hh.

Referenced by counterLimitReached(), setControl(), and updateCounter().

◆ _offset

uint64_t gem5::ArchTimer::_offset
protected

Offset relative to the physical timer (CNTVOFF)

Definition at line 205 of file generic_timer.hh.

Referenced by offset(), serialize(), setOffset(), unserialize(), and value().

◆ _parent

EndBitUnion (ArchTimerCtrl) const std SimObject& gem5::ArchTimer::_parent
protected

Name of this timer.

Pointer to parent class.

Definition at line 194 of file generic_timer.hh.

Referenced by drain(), and updateCounter().

◆ _systemCounter

SystemCounter& gem5::ArchTimer::_systemCounter
protected

Definition at line 196 of file generic_timer.hh.

Referenced by value(), and whenValue().

◆ imask

Bitfield<1> gem5::ArchTimer::imask
protected

Definition at line 186 of file generic_timer.hh.

◆ istatus

Bitfield<2> gem5::ArchTimer::istatus
protected

Definition at line 187 of file generic_timer.hh.


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

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