quic/qbox
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
gs::router< BUSWIDTH, CacheType > Class Template Reference

A SystemC TLM router module for transaction routing based on address. More...

#include <router.h>

Inheritance diagram for gs::router< BUSWIDTH, CacheType >:
Inheritance graph
[legend]
Collaboration diagram for gs::router< BUSWIDTH, CacheType >:
Collaboration graph
[legend]

Public Member Functions

 router (const sc_core::sc_module_name &nm, cci::cci_broker_handle broker=cci::cci_get_broker())
 Constructor for the router module.
 
 router ()=delete
 Deleted default constructor to enforce named instantiation.
 
 router (const router &)=delete
 Deleted copy constructor.
 
 ~router ()
 Destructor for the router module. Cleans up any remaining PathIDExtension objects in the pool.
 
void add_target (TargetSocket &t, const uint64_t address, uint64_t size, bool masked=true, unsigned int priority=0)
 Adds a target to the router's address map.
 
virtual void add_initiator (InitiatorSocket &i)
 Adds an initiator to the router.
 
void get_cache_stats (uint64_t &hits, uint64_t &misses) const
 Get cache statistics (hits and misses).
 
void reset_cache_stats ()
 Reset cache statistics to zero.
 
- Public Member Functions inherited from gs::router_if< BUSWIDTH >
void rename_last (std::string s)
 
std::vector< std::shared_ptr< target_info > > get_bound_targets ()
 

Public Attributes

initiator_socket_type initiator_socket
 Initiator socket to connect to targets.
 
tlm_utils::multi_passthrough_target_socket< router< BUSWIDTH, CacheType >, BUSWIDTHtarget_socket
 Target socket to receive transactions from initiators.
 
cci::cci_broker_handle m_broker
 CCI broker handle for configuration parameters.
 

Protected Member Functions

std::shared_ptr< target_infodecode_address (tlm::tlm_generic_payload &trans) override
 Decodes the address from a TLM generic payload to find the target.
 
virtual void before_end_of_elaboration () override
 Called before end of elaboration to ensure lazy initialization.
 
- Protected Member Functions inherited from gs::router_if< BUSWIDTH >
std::string parent (std::string name)
 
std::string nameFromSocket (std::string s)
 

Additional Inherited Members

- Protected Attributes inherited from gs::router_if< BUSWIDTH >
std::vector< std::shared_ptr< target_info > > bound_targets
 

Detailed Description

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
class gs::router< BUSWIDTH, CacheType >

A SystemC TLM router module for transaction routing based on address.

This router connects multiple initiator sockets to multiple target sockets, routing transactions based on the address map configured via CCI parameters. It supports DMI, debug transport, and various TLM extensions.

Template Parameters
BUSWIDTHThe TLM bus width in bits.

Constructor & Destructor Documentation

◆ router()

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
gs::router< BUSWIDTH, CacheType >::router ( const sc_core::sc_module_name &  nm,
cci::cci_broker_handle  broker = cci::cci_get_broker() 
)
inlineexplicit

Constructor for the router module.

Initializes the base sc_module, initiator and target sockets, address map, CCI broker, and the lazy initialization parameter. Registers transport methods.

Parameters
nmSystemC module name.
brokerOptional CCI broker handle. Defaults to the global broker.

Member Function Documentation

◆ add_initiator()

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
virtual void gs::router< BUSWIDTH, CacheType >::add_initiator ( InitiatorSocket &  i)
inlinevirtual

Adds an initiator to the router.

This method handles the binding between the initiator's port and the router's target socket.

Parameters
iThe initiator socket to add.

◆ add_target()

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
void gs::router< BUSWIDTH, CacheType >::add_target ( TargetSocket &  t,
const uint64_t  address,
uint64_t  size,
bool  masked = true,
unsigned int  priority = 0 
)
inline

Adds a target to the router's address map.

This method configures CCI parameters for the target (address, size, relative_addresses) and binds the target socket to the router's initiator socket.

Parameters
tThe target socket to add.
addressThe base address of the target.
sizeThe size of the target's address range.
maskedBoolean indicating if relative addresses should be used (defaults to true).
priorityunsigned int priority, lower values have higher priorities

◆ before_end_of_elaboration()

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
virtual void gs::router< BUSWIDTH, CacheType >::before_end_of_elaboration ( )
inlineoverrideprotectedvirtual

Called before end of elaboration to ensure lazy initialization.

If lazy_init is false, this method triggers the lazy_initialize process.

◆ decode_address()

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
std::shared_ptr< target_info > gs::router< BUSWIDTH, CacheType >::decode_address ( tlm::tlm_generic_payload &  trans)
inlineoverrideprotectedvirtual

Decodes the address from a TLM generic payload to find the target.

This virtual function, overriding the base class, ensures that the router is initialized (via lazy_initialize) before attempting to find the target_info associated with the transaction's address using the internal addressMap.

Parameters
transThe TLM generic payload.
Returns
A shared_ptr to the target_info object if found, otherwise nullptr.

Implements gs::router_if< BUSWIDTH >.

◆ get_cache_stats()

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
void gs::router< BUSWIDTH, CacheType >::get_cache_stats ( uint64_t hits,
uint64_t misses 
) const
inline

Get cache statistics (hits and misses).

This method exposes the cache performance metrics for benchmarking and analysis.

Parameters
hitsOutput parameter for number of cache hits
missesOutput parameter for number of cache misses

◆ reset_cache_stats()

template<unsigned int BUSWIDTH = DEFAULT_TLM_BUSWIDTH, template< typename, typename > class CacheType = AddrMapNoCache>
void gs::router< BUSWIDTH, CacheType >::reset_cache_stats ( )
inline

Reset cache statistics to zero.

This method should be called before each benchmark iteration to ensure accurate measurement of cache performance for that specific test.


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