gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ArchTimer Class Reference

Per-CPU architected timer. More...

#include <generic_timer.hh>

Inheritance diagram for ArchTimer:
Serializable

Classes

class  Interrupt
 

Public Member Functions

 ArchTimer (const std::string &name, SimObject &parent, SystemCounter &sysctr, const Interrupt &interrupt)
 
std::string name () const
 Returns the timer name. More...
 
uint64_t compareValue () const
 Returns the CompareValue view of the timer. More...
 
void setCompareValue (uint64_t val)
 Sets the CompareValue view of the timer. More...
 
uint32_t timerValue () const
 Returns the TimerValue view of the timer. More...
 
void setTimerValue (uint32_t val)
 Sets the TimerValue view of the timer. More...
 
uint32_t control () const
 Sets the control register. More...
 
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. More...
 
void serialize (CheckpointOut &cp) const override
 Serialize an object. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 
- Public Member Functions inherited from Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section. More...
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object. More...
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Protected Member Functions

 BitUnion32 (ArchTimerCtrl) Bitfield< 0 > enable
 Control register. More...
 
void updateCounter ()
 Timer settings or the offset has changed, re-evaluate trigger condition and raise interrupt if necessary. More...
 
void counterLimitReached ()
 Called when the upcounter reaches the programmed value. More...
 

Protected Attributes

Bitfield< 1 > imask
 
Bitfield< 2 > istatus
 
EndBitUnion(ArchTimerCtrl)
const std SimObject
_parent
 Name of this timer. More...
 
SystemCounter_systemCounter
 
Interrupt _interrupt
 
ArchTimerCtrl _control
 Value of the control register ({CNTP/CNTHP/CNTV}_CTL). More...
 
uint64_t _counterLimit
 Programmed limit value for the upcounter ({CNTP/CNTHP/CNTV}_CVAL). More...
 
uint64_t _offset
 Offset relative to the physical timer (CNTVOFF) More...
 
EventWrapper< ArchTimer,&ArchTimer::counterLimitReached_counterLimitReachedEvent
 

Private Member Functions

 ArchTimer (const ArchTimer &t)
 

Additional Inherited Members

- Static Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Get the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 
static void unserializeGlobals (CheckpointIn &cp)
 
- Static Public Attributes inherited from Serializable
static int ckptCount = 0
 
static int ckptMaxCount = 0
 
static int ckptPrevCount = -1
 

Detailed Description

Per-CPU architected timer.

Definition at line 105 of file generic_timer.hh.

Constructor & Destructor Documentation

ArchTimer::ArchTimer ( const std::string &  name,
SimObject parent,
SystemCounter sysctr,
const Interrupt interrupt 
)

Definition at line 91 of file generic_timer.cc.

ArchTimer::ArchTimer ( const ArchTimer t)
private

Member Function Documentation

ArchTimer::BitUnion32 ( ArchTimerCtrl  )
protected

Control register.

uint64_t ArchTimer::compareValue ( ) const
inline

Returns the CompareValue view of the timer.

Definition at line 173 of file generic_timer.hh.

References _counterLimit.

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

uint32_t ArchTimer::control ( ) const
inline

Sets the control register.

Definition at line 183 of file generic_timer.hh.

References _control.

Referenced by GenericTimer::readMiscReg(), and GenericTimerMem::timerRead().

void ArchTimer::counterLimitReached ( )
protected

Called when the upcounter reaches the programmed value.

Definition at line 103 of file generic_timer.cc.

References _control, _interrupt, DPRINTF, and ArchTimer::Interrupt::send().

Referenced by updateCounter().

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

Returns the timer name.

Definition at line 170 of file generic_timer.hh.

uint64_t ArchTimer::offset ( ) const
inline
void ArchTimer::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 177 of file generic_timer.cc.

References _control, _counterLimit, _counterLimitReachedEvent, _offset, paramOut(), Event::scheduled(), SERIALIZE_SCALAR, and Event::when().

void ArchTimer::setCompareValue ( uint64_t  val)

Sets the CompareValue view of the timer.

Definition at line 133 of file generic_timer.cc.

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

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

void ArchTimer::setControl ( uint32_t  val)
void ArchTimer::setOffset ( uint64_t  val)

Definition at line 164 of file generic_timer.cc.

References _offset, updateCounter(), and X86ISA::val.

Referenced by GenericTimerMem::ctrlWrite(), and GenericTimer::setMiscReg().

void ArchTimer::setTimerValue ( uint32_t  val)

Sets the TimerValue view of the timer.

Definition at line 140 of file generic_timer.cc.

References setCompareValue(), and value().

Referenced by GenericTimer::setMiscReg(), and GenericTimerMem::timerWrite().

uint32_t ArchTimer::timerValue ( ) const
inline

Returns the TimerValue view of the timer.

Definition at line 178 of file generic_timer.hh.

References _counterLimit, and value().

Referenced by GenericTimer::readMiscReg(), and GenericTimerMem::timerRead().

void ArchTimer::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 192 of file generic_timer.cc.

References _control, _counterLimitReachedEvent, _offset, _parent, paramIn(), EventManager::schedule(), UNSERIALIZE_OPT_SCALAR, and UNSERIALIZE_SCALAR.

void ArchTimer::updateCounter ( )
protected

Timer settings or the offset has changed, re-evaluate trigger condition and raise interrupt if necessary.

Definition at line 118 of file generic_timer.cc.

References _control, _counterLimit, _counterLimitReachedEvent, _parent, _systemCounter, counterLimitReached(), curTick(), EventManager::deschedule(), SystemCounter::period(), EventManager::schedule(), Event::scheduled(), and value().

Referenced by setCompareValue(), and setOffset().

uint64_t ArchTimer::value ( ) const

Returns the value of the counter which this timer relies on.

Definition at line 171 of file generic_timer.cc.

References _offset, _systemCounter, and SystemCounter::value().

Referenced by GenericTimer::readMiscReg(), setControl(), setTimerValue(), GenericTimerMem::timerRead(), timerValue(), and updateCounter().

Member Data Documentation

ArchTimerCtrl ArchTimer::_control
protected

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

Definition at line 146 of file generic_timer.hh.

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

uint64_t ArchTimer::_counterLimit
protected

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

Definition at line 148 of file generic_timer.hh.

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

EventWrapper<ArchTimer, &ArchTimer::counterLimitReached> ArchTimer::_counterLimitReachedEvent
protected

Definition at line 161 of file generic_timer.hh.

Referenced by serialize(), unserialize(), and updateCounter().

Interrupt ArchTimer::_interrupt
protected

Definition at line 143 of file generic_timer.hh.

Referenced by counterLimitReached().

uint64_t ArchTimer::_offset
protected

Offset relative to the physical timer (CNTVOFF)

Definition at line 150 of file generic_timer.hh.

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

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

Name of this timer.

Pointer to parent class.

Definition at line 133 of file generic_timer.hh.

Referenced by unserialize(), and updateCounter().

SystemCounter& ArchTimer::_systemCounter
protected

Definition at line 141 of file generic_timer.hh.

Referenced by updateCounter(), and value().

Bitfield<1> ArchTimer::imask
protected

Definition at line 131 of file generic_timer.hh.

Bitfield<2> ArchTimer::istatus
protected

Definition at line 132 of file generic_timer.hh.


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

Generated on Fri Jun 9 2017 13:04:00 for gem5 by doxygen 1.8.6