Transaction-Level Modeling Framework for Space Applications
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>
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_t * | get_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_t > | g_ntimers |
sr_param< uint32_t > | g_sbits |
sr_param< uint32_t > | g_nbits |
sr_param< uint32_t > | g_wdog_length |
sr_param< uint32_t > | powermon |
Enables the powermonitor capapbilities. More... | |
sr_param< bool > | g_sepirq |
sr_param< double > | sta_power_norm |
Normalized static power input. More... | |
sr_param< double > | int_power_norm |
Normalized internal power input (activation independent) More... | |
sr_param< double > | sta_power |
Static power of module. More... | |
sr_param< double > | int_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_t > | g_pindex |
sr_param< uint8_t > | g_pvendorid |
sr_param< uint16_t > | g_pdeviceid |
sr_param< uint8_t > | g_pversion |
sr_param< uint8_t > | g_pirq |
sr_param< uint32_t > | g_paddr |
sr_param< uint32_t > | g_pmask |
sr_param< uint32_t > | g_ptype |
sr_param< bool > | g_pcacheable |
sr_param< bool > | g_pprefetchable |
Protected Attributes inherited from BaseModule< DefaultBase > | |
ParameterAPI * | m_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 |
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.
Returns Counte Control Register Address for Counter nr
nr | Counter Number |
Referenced by GPCounter::calculate(), GPCounter::ctrl_read(), GPCounter::ctrl_write(), GPCounter::cycletime(), GPCounter::do_reset(), dorst(), init_registers(), GPCounter::nextzero(), GPCounter::start(), GPCounter::ticking(), and GPCounter::value_read().
GPTimer::GC_HAS_CALLBACKS | ( | ) |
Returns Counter Reload Register Address for Counter nr
nr | Counter 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 | ) |
Returns Counter Value Register Address for Counter nr
nr | Counter Number |
Referenced by GPCounter::calculate(), GPCounter::ctrl_write(), GPCounter::do_reset(), init_registers(), GPCounter::nextzero(), GPCounter::stop(), GPCounter::value_read(), and GPCounter::value_write().
|
friend |
Referenced by init_registers().
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().
Position of the Bit in the Scaler Configuration Register.
Mask of the IRQ Bits in the Scaler Configuration Register.
Offset of the IRQ Bits in the Scaler Configuration Register.
Mask of the Counter Number Bits in the Scaler Configuration Register.
Offset of the Counter Number Bits in the Scaler Configuration Register.
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().
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().
Position of the Debug Halt Bit in the Counter Control Registers.
Referenced by GPCounter::ctrl_read(), and GPCounter::ctrl_write().
Position of the Enable Bit in the Counter Control Registers.
Referenced by GPCounter::calculate(), GPCounter::ctrl_write(), GPCounter::start(), and GPCounter::ticking().
Position of the Interrupt Enable Bit in the Counter Control Registers.
Referenced by GPCounter::ticking().
Position of the Interrupt Pending Bit in the Counter Control Registers.
Referenced by GPCounter::ctrl_read(), and GPCounter::ctrl_write().
Position of the Load Bit in the Counter Control Registers.
Referenced by GPCounter::ctrl_write().
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.
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().
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().
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().
Seperated IRQ lines. If you whant to have seperated IRQ lines for each counter set this generic to true.
Referenced by init_generics().
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().
Internal power of module (activation independent)
Referenced by GPTimer(), and power_model().
Normalized internal power input (activation independent)
Referenced by power_model().
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().
Enables the powermonitor capapbilities.
Referenced by GPTimer(), and start_of_simulation().
Scaler Value Register Address.
Referenced by dorst(), GPCounter::nextzero(), scaler_read(), scaler_write(), and screload_write().
Scaler Relaod Register Address.
Referenced by GPCounter::cycletime(), dorst(), numberofticksbetween(), scaler_read(), and screload_write().
Static power of module.
Referenced by GPTimer(), and power_model().
Normalized static power input.
Referenced by power_model().
signal<bool>::out GPTimer::wdog |
Referenced by dorst(), GPTimer(), and GPCounter::ticking().