Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Public Member Functions | Protected Attributes | List of all members
AHBDevice< BASE > Class Template Reference

This class is a base class for grlib models. It implements the device plug and play informations. Together with the AHBCtrl class it implements the plug and play feature of the grlib. More...

#include <ahbdevice.h>

Inheritance diagram for AHBDevice< BASE >:
Collaboration diagram for AHBDevice< BASE >:

Public Member Functions

 AHBDevice (ModuleName mn, uint32_t hindex, uint8_t vendorid, uint16_t deviceid, uint8_t version, uint8_t irq, BAR bar0, BAR bar1=BAR(), BAR bar2=BAR(), BAR bar3=BAR())
 
 AHBDevice (ModuleName mn)
 
void init (uint32_t hindex, uint8_t vendorid, uint16_t deviceid, uint8_t version, uint8_t irq, BAR bar0, BAR bar1=BAR(), BAR bar2=BAR(), BAR bar3=BAR())
 
void init_ahb_generics ()
 
virtual ~AHBDevice ()
 Empty destructor. More...
 
virtual const uint16_t get_ahb_device_id () const throw ()
 Returns the device id. More...
 
virtual const uint8_t get_ahb_vendor_id () const throw ()
 Returns the vendor id. More...
 
virtual const uint32_tget_ahb_device_info () throw ()
 
virtual const uint32_t get_ahb_base_addr_ () const throw ()
 
virtual sc_dt::uint64 get_ahb_base_addr () throw ()
 
virtual const uint32_t get_ahb_size_ () const throw ()
 
virtual sc_dt::uint64 get_ahb_size () throw ()
 
virtual const AMBADeviceType get_ahb_bar_type (uint32_t bar) const throw ()
 
virtual const uint32_t get_ahb_bar_base (uint32_t bar) const throw ()
 
virtual const uint32_t get_ahb_bar_mask (uint32_t bar) const throw ()
 
virtual const uint32_t get_ahb_bar_addr (uint32_t bar) const throw ()
 
virtual const uint32_t get_ahb_bar_size (uint32_t bar) const throw ()
 
virtual const uint32_t get_ahb_bar_relative_addr (uint32_t bar, uint32_t addr) const throw ()
 
const bool get_ahb_bar_prefetchable (uint32_t bar) const throw ()
 
const bool get_ahb_bar_cachable (uint32_t bar) const throw ()
 
virtual const uint32_t get_ahb_hindex () const throw ()
 Returns the bus id of the module (hindex) More...
 
virtual void print_ahb_device_info (char *name) const
 Prints the device info of the device. More...
 
virtual void transport_statistics (tlm::tlm_generic_payload &gp) throw ()
 Collect common transport statistics. More...
 
- Public Member Functions inherited from AHBDeviceBase
virtual ~AHBDeviceBase ()
 Empty destructor. More...
 

Protected Attributes

uint32_t m_register [8]
 Impementation of the device register file. More...
 
ParameterArray g_bars
 
ParameterArray g_bar0
 
ParameterArray g_bar1
 
ParameterArray g_bar2
 
ParameterArray g_bar3
 
sr_param< uint32_tg_hindex
 
sr_param< uint8_tg_hvendorid
 
sr_param< uint16_tg_hdeviceid
 
sr_param< uint8_tg_hversion
 
sr_param< uint8_tg_hirq
 
sr_param< uint32_tg_bar0haddr
 
sr_param< uint32_tg_bar0hmask
 
sr_param< uint32_tg_bar0htype
 
sr_param< boolg_bar0hcacheable
 
sr_param< boolg_bar0hprefetchable
 
sr_param< uint32_tg_bar1haddr
 
sr_param< uint32_tg_bar1hmask
 
sr_param< uint32_tg_bar1htype
 
sr_param< boolg_bar1hcacheable
 
sr_param< boolg_bar1hprefetchable
 
sr_param< uint32_tg_bar2haddr
 
sr_param< uint32_tg_bar2hmask
 
sr_param< uint32_tg_bar2htype
 
sr_param< boolg_bar2hcacheable
 
sr_param< boolg_bar2hprefetchable
 
sr_param< uint32_tg_bar3haddr
 
sr_param< uint32_tg_bar3hmask
 
sr_param< uint32_tg_bar3htype
 
sr_param< boolg_bar3hcacheable
 
sr_param< boolg_bar3hprefetchable
 

Detailed Description

template<class BASE = BaseModule<DefaultBase>>
class AHBDevice< BASE >

This class is a base class for grlib models. It implements the device plug and play informations. Together with the AHBCtrl class it implements the plug and play feature of the grlib.

All simulation models that are supposed to be connected to the TLM AHBCTRL must be derived from the class AHBDevice. Usually, this is indirectly done by inheriting from the AHBMaster or AHBSlave classes. The Aeroflex Gaisler AHBCTRL implements a Plug & Play mechanism, which relies on configuration information that is collected from the attached masters and slaves. AHBDevice models the respective configuration data records. The structure of these records is described in GRLIB IP Core User’s Manual. At start_of_simulation the TLM AHBCTRL iterates through all connected modules to retrieve AHB bar & mask and build up its internal routing table.

See Also
AHBCtrl

Constructor & Destructor Documentation

template<class BASE = BaseModule<DefaultBase>>
AHBDevice< BASE >::AHBDevice ( ModuleName  mn,
uint32_t  hindex,
uint8_t  vendorid,
uint16_t  deviceid,
uint8_t  version,
uint8_t  irq,
BAR  bar0,
BAR  bar1 = BAR(),
BAR  bar2 = BAR(),
BAR  bar3 = BAR() 
)

All device informations are needed while constructing a device. The register content is formed here.

template<class BASE = BaseModule<DefaultBase>>
AHBDevice< BASE >::AHBDevice ( ModuleName  mn)

All device informations are needed while constructing a device. The register content is formed here. Before ending the constructor of the subclass you have to call init!

template<class BASE = BaseModule<DefaultBase>>
virtual AHBDevice< BASE >::~AHBDevice ( )
virtual

Empty destructor.

Member Function Documentation

template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_bar_addr ( uint32_t  bar) const
throw (
)
virtual

Returns the Bus specific base address of the device. Returns the address of one bar in byte offset as seen from the bus.

Parameters
barThe selected bar

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_bar_base ( uint32_t  bar) const
throw (
)
virtual

Returns the Bus specific most significant 12bit of the bar base address Shifted to the lowest bits in the word.

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
const bool AHBDevice< BASE >::get_ahb_bar_cachable ( uint32_t  bar) const
throw (
)
inline

Returns whether a bar is cachable

Parameters
barThe selected bar
template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_bar_mask ( uint32_t  bar) const
throw (
)
virtual

Returns the Bus specific mask of the most significant 12bit of the bar address Shifted to the lowest bits in the word.

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
const bool AHBDevice< BASE >::get_ahb_bar_prefetchable ( uint32_t  bar) const
throw (
)
inline

Returns whether a bar is prefetchable

Parameters
barThe selected bar
template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_bar_relative_addr ( uint32_t  bar,
uint32_t  addr 
) const
throw (
)
virtual

Returns the BAR relative address

Parameters
barThe selected bar

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_bar_size ( uint32_t  bar) const
throw (
)
virtual

Returns the size of one bar in bytes as seen from the bus.

Parameters
barThe selected bar

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const AMBADeviceType AHBDevice< BASE >::get_ahb_bar_type ( uint32_t  bar) const
throw (
)
virtual

Returns the type of the bar.

Parameters
barThe selected bar
See Also
AMBADeviceType

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual sc_dt::uint64 AHBDevice< BASE >::get_ahb_base_addr ( )
throw (
)
virtual

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_base_addr_ ( ) const
throw (
)
virtual

Returns the Bus specific base address of the device. Legacy for AMBAKit Please use get_bar_address instead. It will work with gaps between slave areas.

See Also
get_bar_addr
Returns
The device base address.

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint16_t AHBDevice< BASE >::get_ahb_device_id ( ) const
throw (
)
virtual

Returns the device id.

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t* AHBDevice< BASE >::get_ahb_device_info ( )
throw (
)
virtual

Returns the device register file. A set of 8 registers as specified by the grlib manual. See section: 4.2.3 (Page 50)

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_hindex ( ) const
throw (
)
virtual

Returns the bus id of the module (hindex)

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual sc_dt::uint64 AHBDevice< BASE >::get_ahb_size ( )
throw (
)
virtual

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint32_t AHBDevice< BASE >::get_ahb_size_ ( ) const
throw (
)
virtual

Returns the size of the hole device as seen from the bus. Legacy for AMBAKit Please use get_bar_size instead. It will work with gaps between the slave areas.

See Also
get_bar_size
Returns
The device size.

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual const uint8_t AHBDevice< BASE >::get_ahb_vendor_id ( ) const
throw (
)
virtual

Returns the vendor id.

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
void AHBDevice< BASE >::init ( uint32_t  hindex,
uint8_t  vendorid,
uint16_t  deviceid,
uint8_t  version,
uint8_t  irq,
BAR  bar0,
BAR  bar1 = BAR(),
BAR  bar2 = BAR(),
BAR  bar3 = BAR() 
)

All device informations missing by the second constructor. The register content is formed here.

template<class BASE = BaseModule<DefaultBase>>
void AHBDevice< BASE >::init_ahb_generics ( )
template<class BASE = BaseModule<DefaultBase>>
virtual void AHBDevice< BASE >::print_ahb_device_info ( char name) const
virtual

Prints the device info of the device.

Implements AHBDeviceBase.

template<class BASE = BaseModule<DefaultBase>>
virtual void AHBDevice< BASE >::transport_statistics ( tlm::tlm_generic_payload &  gp)
throw (
)
virtual

Collect common transport statistics.

Implements AHBDeviceBase.

Reimplemented in AHBMaster< BASE >, AHBMaster<>, AHBSlave< BASE >, AHBSlave<>, and AHBSlave< APBSlave >.

Member Data Documentation

template<class BASE = BaseModule<DefaultBase>>
ParameterArray AHBDevice< BASE >::g_bar0
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar0haddr
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar0hcacheable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar0hmask
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar0hprefetchable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar0htype
protected
template<class BASE = BaseModule<DefaultBase>>
ParameterArray AHBDevice< BASE >::g_bar1
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar1haddr
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar1hcacheable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar1hmask
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar1hprefetchable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar1htype
protected
template<class BASE = BaseModule<DefaultBase>>
ParameterArray AHBDevice< BASE >::g_bar2
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar2haddr
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar2hcacheable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar2hmask
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar2hprefetchable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar2htype
protected
template<class BASE = BaseModule<DefaultBase>>
ParameterArray AHBDevice< BASE >::g_bar3
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar3haddr
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar3hcacheable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar3hmask
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<bool> AHBDevice< BASE >::g_bar3hprefetchable
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_bar3htype
protected
template<class BASE = BaseModule<DefaultBase>>
ParameterArray AHBDevice< BASE >::g_bars
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint16_t> AHBDevice< BASE >::g_hdeviceid
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint32_t> AHBDevice< BASE >::g_hindex
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint8_t> AHBDevice< BASE >::g_hirq
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint8_t> AHBDevice< BASE >::g_hvendorid
protected
template<class BASE = BaseModule<DefaultBase>>
sr_param<uint8_t> AHBDevice< BASE >::g_hversion
protected
template<class BASE = BaseModule<DefaultBase>>
uint32_t AHBDevice< BASE >::m_register[8]
protected

Impementation of the device register file.

Referenced by AHBDevice< APBSlave >::get_ahb_bar_cachable(), and AHBDevice< APBSlave >::get_ahb_bar_prefetchable().


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