Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
GPTimer Class Reference

This class is a TLM 2.0 Model of the Aeroflex Gaisler GRLIB GPTimer. Further informations to the original VHDL Modle are available in the GRLIB IP Core User's Manual Section 37. More...

#include <gptimer.h>

Inheritance diagram for GPTimer:
Collaboration diagram for GPTimer:

Public Member Functions

 SC_HAS_PROCESS (GPTimer)
 
 SR_HAS_SIGNALS (GPTimer)
 
 GC_HAS_CALLBACKS ()
 
 GPTimer (ModuleName name, unsigned int ncounters=1, int pindex=0, int paddr=0, int pmask=4095, int pirq=0, int sepirq=0, int sbits=16, int nbits=32, int wdog=0, bool powmon=false)
 
 ~GPTimer ()
 Free all counter and unregister all callbacks. More...
 
void init_generics ()
 
void init_registers ()
 
void start_of_simulation ()
 SystemC start of simulation callback. More...
 
void power_model ()
 Calculate power/energy values from normalized input data. More...
 
gs::cnf::callback_return_type sta_power_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 Static power callback. More...
 
gs::cnf::callback_return_type int_power_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 Dynamic/Internal power callback. More...
 
void end_of_elaboration ()
 Execute the callback registering when systemc reaches the end of elaboration. More...
 
void scaler_read ()
 Register callback executed before the prescaler value register gets read, to calculate the current value. More...
 
void scaler_write ()
 Register callback executed after the presacler value is written, to recalculate the counter and ticking functions. More...
 
void screload_write ()
 Register callback executed after the presacler reset is written, to recalculate the counter and ticking functions. More...
 
void conf_read ()
 Register callback executed before the prescaler config register gets read, to calculate the current value. More...
 
virtual void dorst ()
 
int64_t valueof (sc_core::sc_time t, int64_t offset, sc_core::sc_time cycletime) const
 
int64_t numberofticksbetween (sc_core::sc_time start, sc_core::sc_time end, int counter, sc_core::sc_time cycletime)
 
- Public Member Functions inherited from APBSlave
 APBSlave (ModuleName mn, uint32_t bus_id, uint8_t vendorid, uint16_t deviceid, uint8_t version, uint8_t irq, AMBADeviceType type, uint16_t mask, bool cacheable, bool prefetchable, uint16_t address)
 
 APBSlave (ModuleName mn)
 
 ~APBSlave ()
 
- Public Member Functions inherited from APBDevice< BaseModule< DefaultBase > >
 APBDevice (ModuleName mn, uint32_t bus_id, uint8_t vendorid, uint16_t deviceid, uint8_t version, uint8_t irq, AMBADeviceType type, uint16_t mask, bool cacheable, bool prefetchable, uint16_t address)
 
 APBDevice (ModuleName mn)
 
void init_apb (uint32_t pindex, uint8_t vendorid, uint16_t deviceid, uint8_t version, uint8_t irq, AMBADeviceType type, uint16_t mask, bool cacheable, bool prefetchable, uint16_t address)
 
void init_apb_generics ()
 Initialize the APBDevice generics. More...
 
virtual ~APBDevice ()
 Empty destructor. More...
 
virtual uint16_t get_apb_device_id () const
 Returns the device id. More...
 
virtual uint8_t get_apb_vendor_id () const
 Returns the vendor id. More...
 
virtual const uint32_tget_apb_device_info ()
 
virtual const AMBADeviceType get_apb_type () const
 
virtual uint32_t get_apb_base () const
 
virtual uint32_t get_apb_mask () const
 
virtual sc_dt::uint64 get_apb_base_addr ()
 
virtual uint32_t get_apb_base_addr_ () const
 
virtual sc_dt::uint64 get_apb_size ()
 
virtual uint32_t get_apb_size_ () const
 
virtual uint32_t get_apb_relative_addr (uint32_t addr) const
 
virtual uint32_t get_apb_pindex () const
 Returns the bus id of the module (pindex) More...
 
virtual void print_apb_device_info (char *name) const
 Prints the device info of the device. More...
 
- Public Member Functions inherited from BaseModule< DefaultBase >
 BaseModule (ModuleName mn)
 
virtual ~BaseModule ()
 
virtual void init_counters ()
 
virtual void init_power ()
 
- Public Member Functions inherited from APBDeviceBase
virtual ~APBDeviceBase ()
 Empty destructor. More...
 
- Public Member Functions inherited from CLKDevice
 SR_HAS_SIGNALS (CLKDevice)
 
 CLKDevice ()
 
virtual ~CLKDevice ()
 
virtual void onrst (const bool &value, const sc_core::sc_time &time)
 
virtual void onclk (const sc_core::sc_time &value, const sc_core::sc_time &time)
 
void set_clk (sc_core::sc_clock &clk)
 
void set_clk (sc_core::sc_time period)
 
void set_clk (double period, sc_core::sc_time_unit base)
 
virtual void clkcng ()
 

Static Public Member Functions

static const uint32_t VALUE (uint8_t nr)
 
static const uint32_t RELOAD (uint8_t nr)
 
static const uint32_t CTRL (uint8_t nr)
 

Public Attributes

signal< std::pair< uint32_t,
bool > >::out 
irq
 
signal< bool >::out wdog
 
unsigned int conf_defaults
 Stores the default config register value. More...
 
sc_core::sc_time lasttime
 Stores the time when the value of the prescaler was known. More...
 
uint64_t lastvalue
 
sc_core::sc_event e_tick
 
std::vector< GPCounter * > counter
 A vector of Counter classes, each representate an internal counter. More...
 
sr_param< uint32_tg_ntimers
 
sr_param< uint32_tg_sbits
 
sr_param< uint32_tg_nbits
 
sr_param< uint32_tg_wdog_length
 
sr_param< uint32_tpowermon
 Enables the powermonitor capapbilities. More...
 
sr_param< boolg_sepirq
 
sr_param< doublesta_power_norm
 Normalized static power input. More...
 
sr_param< doubleint_power_norm
 Normalized internal power input (activation independent) More...
 
sr_param< doublesta_power
 Static power of module. More...
 
sr_param< doubleint_power
 Internal power of module (activation independent) More...
 
- Public Attributes inherited from APBSlave
sr_register_bank< unsigned int,
unsigned int
r
 
APBSlaveSocket< 32, unsigned
int, unsigned int
apb
 
- Public Attributes inherited from CLKDevice
signal< bool >::in rst
 Reset input signal. More...
 
signal< sc_core::sc_time >::in clk
 Clock input signal. More...
 

Static Public Attributes

static const uint32_t SCALER = 0x00
 Scaler Value Register Address. More...
 
static const uint32_t SCRELOAD = 0x04
 Scaler Relaod Register Address. More...
 
static const uint32_t CONF = 0x08
 Scaler Configuration Register Address. More...
 
static const uint32_t CONF_DF = 9
 Position of the Bit in the Scaler Configuration Register. More...
 
static const uint32_t CONF_SI = 8
 Position of the SetInterrupt Bit in the Scaler Configuration Register. More...
 
static const uint32_t CONF_IQ_MA = 0x000000F8
 Mask of the IRQ Bits in the Scaler Configuration Register. More...
 
static const uint32_t CONF_IQ_OS = 3
 Offset of the IRQ Bits in the Scaler Configuration Register. More...
 
static const uint32_t CONF_NR_MA = 0x00000007
 Mask of the Counter Number Bits in the Scaler Configuration Register. More...
 
static const uint32_t CONF_NR_OS = 0
 Offset of the Counter Number Bits in the Scaler Configuration Register. More...
 
static const uint32_t CTRL_DH = 6
 Position of the Debug Halt Bit in the Counter Control Registers. More...
 
static const uint32_t CTRL_CH = 5
 Position of the Chaining Bit in the Counter Control Registers. More...
 
static const uint32_t CTRL_IP = 4
 Position of the Interrupt Pending Bit in the Counter Control Registers. More...
 
static const uint32_t CTRL_IE = 3
 Position of the Interrupt Enable Bit in the Counter Control Registers. More...
 
static const uint32_t CTRL_LD = 2
 Position of the Load Bit in the Counter Control Registers. More...
 
static const uint32_t CTRL_RS = 1
 Position of the Reset Bit in the Counter Control Registers. More...
 
static const uint32_t CTRL_EN = 0
 Position of the Enable Bit in the Counter Control Registers. More...
 

Friends

class GPCounter
 

Additional Inherited Members

- Protected Attributes inherited from APBDevice< BaseModule< DefaultBase > >
uint32_t m_register [2]
 Impementation of the device register file. More...
 
sr_param< uint32_tg_pindex
 
sr_param< uint8_tg_pvendorid
 
sr_param< uint16_tg_pdeviceid
 
sr_param< uint8_tg_pversion
 
sr_param< uint8_tg_pirq
 
sr_param< uint32_tg_paddr
 
sr_param< uint32_tg_pmask
 
sr_param< uint32_tg_ptype
 
sr_param< boolg_pcacheable
 
sr_param< boolg_pprefetchable
 
- Protected Attributes inherited from BaseModule< DefaultBase >
ParameterAPIm_api
 Internal module gs param api instance. More...
 
ParameterArray m_generics
 Configuration generic container. More...
 
ParameterArray m_counters
 Performance counter container. More...
 
ParameterArray m_power
 Power counters container. More...
 
- Protected Attributes inherited from CLKDevice
sc_core::sc_time clock_cycle
 

Detailed Description

This class is a TLM 2.0 Model of the Aeroflex Gaisler GRLIB GPTimer. Further informations to the original VHDL Modle are available in the GRLIB IP Core User's Manual Section 37.

Member Function Documentation

static const uint32_t GPTimer::CTRL ( uint8_t  nr)
inlinestatic
GPTimer::GC_HAS_CALLBACKS ( )
static const uint32_t GPTimer::RELOAD ( uint8_t  nr)
inlinestatic

Returns Counter Reload Register Address for Counter nr

Parameters
nrCounter Number

Referenced by GPCounter::ctrl_write(), GPCounter::cycletime(), GPCounter::do_reset(), dorst(), init_registers(), and GPCounter::value_read().

GPTimer::SC_HAS_PROCESS ( GPTimer  )
GPTimer::SR_HAS_SIGNALS ( GPTimer  )
static const uint32_t GPTimer::VALUE ( uint8_t  nr)
inlinestatic

Returns Counter Value Register Address for Counter nr

Parameters
nrCounter Number

Referenced by GPCounter::calculate(), GPCounter::ctrl_write(), GPCounter::do_reset(), init_registers(), GPCounter::nextzero(), GPCounter::stop(), GPCounter::value_read(), and GPCounter::value_write().

Friends And Related Function Documentation

friend class GPCounter
friend

Referenced by init_registers().

Member Data Documentation

const uint32_t GPTimer::CONF = 0x08
static

Scaler Configuration Register Address.

Referenced by conf_read(), dorst(), and GPCounter::ticking().

unsigned int GPTimer::conf_defaults

Stores the default config register value.

Referenced by conf_read(), dorst(), and init_registers().

const uint32_t GPTimer::CONF_DF = 9
static

Position of the Bit in the Scaler Configuration Register.

const uint32_t GPTimer::CONF_IQ_MA = 0x000000F8
static

Mask of the IRQ Bits in the Scaler Configuration Register.

const uint32_t GPTimer::CONF_IQ_OS = 3
static

Offset of the IRQ Bits in the Scaler Configuration Register.

const uint32_t GPTimer::CONF_NR_MA = 0x00000007
static

Mask of the Counter Number Bits in the Scaler Configuration Register.

const uint32_t GPTimer::CONF_NR_OS = 0
static

Offset of the Counter Number Bits in the Scaler Configuration Register.

const uint32_t GPTimer::CONF_SI = 8
static

Position of the SetInterrupt Bit in the Scaler Configuration Register.

Referenced by GPCounter::ticking().

std::vector<GPCounter *> GPTimer::counter

A vector of Counter classes, each representate an internal counter.

Referenced by GPCounter::cycletime(), dorst(), init_registers(), GPCounter::nextzero(), scaler_write(), GPCounter::ticking(), GPCounter::value_read(), and ~GPTimer().

const uint32_t GPTimer::CTRL_CH = 5
static

Position of the Chaining Bit in the Counter Control Registers.

Referenced by GPCounter::ctrl_write(), GPCounter::cycletime(), GPCounter::nextzero(), GPCounter::start(), GPCounter::ticking(), and GPCounter::value_read().

const uint32_t GPTimer::CTRL_DH = 6
static

Position of the Debug Halt Bit in the Counter Control Registers.

Referenced by GPCounter::ctrl_read(), and GPCounter::ctrl_write().

const uint32_t GPTimer::CTRL_EN = 0
static

Position of the Enable Bit in the Counter Control Registers.

Referenced by GPCounter::calculate(), GPCounter::ctrl_write(), GPCounter::start(), and GPCounter::ticking().

const uint32_t GPTimer::CTRL_IE = 3
static

Position of the Interrupt Enable Bit in the Counter Control Registers.

Referenced by GPCounter::ticking().

const uint32_t GPTimer::CTRL_IP = 4
static

Position of the Interrupt Pending Bit in the Counter Control Registers.

Referenced by GPCounter::ctrl_read(), and GPCounter::ctrl_write().

const uint32_t GPTimer::CTRL_LD = 2
static

Position of the Load Bit in the Counter Control Registers.

Referenced by GPCounter::ctrl_write().

const uint32_t GPTimer::CTRL_RS = 1
static

Position of the Reset Bit in the Counter Control Registers.

Referenced by GPCounter::ticking(), and GPCounter::value_read().

sc_core::sc_event GPTimer::e_tick

The tick event.

This event gets set to calculate and produce the tick value for the prescaler underflow. The value gets calculated either when the prescaler reset or value register change or when the undeflow just happend. See tick_calc for calculation and ticking for the event wait statement.

sr_param<uint32_t> GPTimer::g_nbits

Number of counter register bits. This value can be up to 32bits and limits the maximum value of all counters.

Referenced by init_generics(), and init_registers().

sr_param<uint32_t> GPTimer::g_ntimers

Number of Counter in the Timer. For compatibility to the GPTimer VHDL model this is still called "timers". But keep in mind that the ticking units of the SystemC GPTimer are called GPCounters/counters to decrease confusion.

Referenced by init_generics(), init_registers(), and power_model().

sr_param<uint32_t> GPTimer::g_sbits

Number of scaler bits to use for the pescaler. This value can be up to 32bits and limits the maximum value of the prescaler.

Referenced by dorst(), init_generics(), init_registers(), and GPCounter::value_read().

sr_param<bool> GPTimer::g_sepirq

Seperated IRQ lines. If you whant to have seperated IRQ lines for each counter set this generic to true.

Referenced by init_generics().

sr_param<uint32_t> GPTimer::g_wdog_length

Length of the initial watchdog period. It will be set after reset and if the watchdog counter reaches zero fire an watchdog event to reset the hardware. If zero the watchdog ist disabled.

Referenced by dorst(), init_generics(), and GPCounter::ticking().

sr_param<double> GPTimer::int_power

Internal power of module (activation independent)

Referenced by GPTimer(), and power_model().

sr_param<double> GPTimer::int_power_norm

Normalized internal power input (activation independent)

Referenced by power_model().

signal<std::pair<uint32_t, bool> >::out GPTimer::irq

Referenced by sc_main(), and GPCounter::ticking().

sc_core::sc_time GPTimer::lasttime

Stores the time when the value of the prescaler was known.

Referenced by dorst(), scaler_write(), and valueof().

uint64_t GPTimer::lastvalue

Stores the last known prescaler value.

A prescaler value is known when it gets set by the prescaler value register or when its get calculatet befor a complete stop.

It gets always set with the lasttime. Both define the prescaler function implemented in valueof.

Referenced by dorst(), scaler_write(), and valueof().

sr_param<uint32_t> GPTimer::powermon

Enables the powermonitor capapbilities.

Referenced by GPTimer(), and start_of_simulation().

const uint32_t GPTimer::SCALER = 0x00
static

Scaler Value Register Address.

Referenced by dorst(), GPCounter::nextzero(), scaler_read(), scaler_write(), and screload_write().

const uint32_t GPTimer::SCRELOAD = 0x04
static

Scaler Relaod Register Address.

Referenced by GPCounter::cycletime(), dorst(), numberofticksbetween(), scaler_read(), and screload_write().

sr_param<double> GPTimer::sta_power

Static power of module.

Referenced by GPTimer(), and power_model().

sr_param<double> GPTimer::sta_power_norm

Normalized static power input.

Referenced by power_model().

signal<bool>::out GPTimer::wdog

Referenced by dorst(), GPTimer(), and GPCounter::ticking().


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