scc 2025.09
SystemC components library
scc::router< BUSWIDTH, TARGET_SOCKET_TYPE > Class Template Reference

a TLM2.0 router for loosly-timed (LT) models More...

#include <router.h>

Inheritance diagram for scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >:
Collaboration diagram for scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >:

Classes

struct  range_entry

Public Types

using intor_sckt = tlm::scc::initiator_mixin<tlm::tlm_initiator_socket<BUSWIDTH>>
using target_sckt = tlm::scc::target_mixin<TARGET_SOCKET_TYPE>

Public Member Functions

 router (const sc_core::sc_module_name &nm, size_t slave_cnt=1, size_t master_cnt=1, bool check_overlap_on_add_target=false)
 constructs a router
template<typename TYPE>
void bind_target (TYPE &socket, size_t idx, uint64_t base, uint64_t size, bool remap=true)
 bind the initiator socket of the router to some target giving a base and size
template<typename TYPE>
void bind_target (TYPE &socket, size_t idx, std::string name)
 bind the initiator socket of the router to some target and name it
void set_initiator_base (size_t idx, uint64_t base)
 define a base address of a socket
void set_default_target (size_t idx)
 define the default target socket
void set_target_name (size_t idx, std::string name)
 establish a mapping between socket name and socket index
void add_target_range (std::string name, uint64_t base, uint64_t size, bool remap=true)
 establish a mapping between a named socket and a target address range
void set_target_range (size_t idx, uint64_t base, uint64_t size, bool remap=true)
 establish a mapping between a socket and a target address range
void set_warn_on_address_error (bool enable)
 enable warning message on address not found error
void b_transport (int i, tlm::tlm_generic_payload &trans, sc_core::sc_time &delay)
 tagged blocking transport method
bool get_direct_mem_ptr (int i, tlm::tlm_generic_payload &trans, tlm::tlm_dmi &dmi_data)
 tagged forward DMI method
unsigned transport_dbg (int i, tlm::tlm_generic_payload &trans)
 tagged debug transaction method
void invalidate_direct_mem_ptr (int id, ::sc_dt::uint64 start_range, ::sc_dt::uint64 end_range)
 tagged backward DMI method
void end_of_elaboration () override
 tagged end of elaboration callback.

Public Attributes

sc_core::sc_vector< target_sckt > target
 the array of target sockets
sc_core::sc_vector< intor_sckt > initiator
 the array of initiator sockets

Protected Attributes

size_t default_idx = std::numeric_limits<size_t>::max()
std::vector< uint64_t > ibases
std::vector< range_entrytranges
std::vector< sc_core::sc_mutex > mutexes
util::range_lut< unsigned > addr_decoder
std::unordered_map< std::string, size_t > target_name_lut
bool check_overlap_on_add_target
bool warn_on_address_error {false}

Detailed Description

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
class scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >

a TLM2.0 router for loosly-timed (LT) models

It uses the tlm::scc::scv::tlm_rec_initiator_socket so that incoming and outgoing accesses can be traced using SCV

Template Parameters
BUSWIDTHthe width of the bus

Definition at line 41 of file router.h.

Member Typedef Documentation

◆ intor_sckt

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
using scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::intor_sckt = tlm::scc::initiator_mixin<tlm::tlm_initiator_socket<BUSWIDTH>>

Definition at line 42 of file router.h.

◆ target_sckt

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
using scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::target_sckt = tlm::scc::target_mixin<TARGET_SOCKET_TYPE>

Definition at line 43 of file router.h.

Constructor & Destructor Documentation

◆ router()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::router ( const sc_core::sc_module_name & nm,
size_t slave_cnt = 1,
size_t master_cnt = 1,
bool check_overlap_on_add_target = false )

constructs a router

Parameters
nmthe component name
slave_cntnumber of slaves to be connected
master_cntnumber of masters to be connected
check_overlap_on_add_targetif true this enables validation of overlaps when adding or setting the target range.

Definition at line 202 of file router.h.

Member Function Documentation

◆ add_target_range()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::add_target_range ( std::string name,
uint64_t base,
uint64_t size,
bool remap = true )

establish a mapping between a named socket and a target address range

Parameters
name
basebase address of the target
sizesize of the address range occupied by the target
remapif true address will be rewritten in accesses to be 0-based at the target

Definition at line 242 of file router.h.

◆ b_transport()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::b_transport ( int i,
tlm::tlm_generic_payload & trans,
sc_core::sc_time & delay )

tagged blocking transport method

Parameters
ithe tag
transthe incoming transaction
delaythe annotated delay

Definition at line 265 of file router.h.

◆ bind_target() [1/2]

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
template<typename TYPE>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::bind_target ( TYPE & socket,
size_t idx,
std::string name )
inline

bind the initiator socket of the router to some target and name it

Template Parameters
TYPEthe socket type to bind
Parameters
socketthe target socket to bind
idxnumber of the target
nameof the binding

Definition at line 84 of file router.h.

◆ bind_target() [2/2]

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
template<typename TYPE>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::bind_target ( TYPE & socket,
size_t idx,
uint64_t base,
uint64_t size,
bool remap = true )
inline

bind the initiator socket of the router to some target giving a base and size

Template Parameters
TYPEthe socket type to bind
Parameters
socketthe target socket to bind
idxnumber of the target
basebase address of the target
sizesize of the address range occupied by the target
remapif true address will be rewritten in accesses to be 0-based at the target

Definition at line 71 of file router.h.

◆ end_of_elaboration()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::end_of_elaboration ( )
override

tagged end of elaboration callback.

Definition at line 361 of file router.h.

◆ get_direct_mem_ptr()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
bool scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::get_direct_mem_ptr ( int i,
tlm::tlm_generic_payload & trans,
tlm::tlm_dmi & dmi_data )

tagged forward DMI method

Parameters
ithe tag
transthe incoming transaction
dmi_data
Returns

Definition at line 292 of file router.h.

◆ invalidate_direct_mem_ptr()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::invalidate_direct_mem_ptr ( int id,
::sc_dt::uint64 start_range,
::sc_dt::uint64 end_range )

tagged backward DMI method

Parameters
idthe tag
start_rangeaddress range start address
end_rangeaddress range end address

Definition at line 349 of file router.h.

◆ set_default_target()

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::set_default_target ( size_t idx)
inline

define the default target socket

If no target address range is hit the access is routed to this socket. If this is not defined a address error response is generated

Parameters
idxthe default target

Definition at line 107 of file router.h.

◆ set_initiator_base()

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::set_initiator_base ( size_t idx,
uint64_t base )
inline

define a base address of a socket

This will be added to the address of each access coming thru this socket

Parameters
idx
base

Definition at line 97 of file router.h.

◆ set_target_name()

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::set_target_name ( size_t idx,
std::string name )
inline

establish a mapping between socket name and socket index

Parameters
idxthe index of the socket
namethe name of the connection

Definition at line 115 of file router.h.

◆ set_target_range()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::set_target_range ( size_t idx,
uint64_t base,
uint64_t size,
bool remap = true )

establish a mapping between a socket and a target address range

Parameters
idx
basebase address of the target
sizesize of the address range occupied by the target
remapif true address will be rewritten in accesses to be 0-based at the target

Definition at line 232 of file router.h.

◆ set_warn_on_address_error()

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
void scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::set_warn_on_address_error ( bool enable)
inline

enable warning message on address not found error

Parameters
enableif true enable warning message

Definition at line 142 of file router.h.

◆ transport_dbg()

template<unsigned BUSWIDTH, typename TARGET_SOCKET_TYPE>
unsigned scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::transport_dbg ( int i,
tlm::tlm_generic_payload & trans )

tagged debug transaction method

Parameters
ithe tag
transthe incoming transaction

Definition at line 324 of file router.h.

Member Data Documentation

◆ addr_decoder

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
util::range_lut<unsigned> scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::addr_decoder
protected

Definition at line 195 of file router.h.

◆ check_overlap_on_add_target

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
bool scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::check_overlap_on_add_target
protected

Definition at line 197 of file router.h.

◆ default_idx

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
size_t scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::default_idx = std::numeric_limits<size_t>::max()
protected

Definition at line 191 of file router.h.

◆ ibases

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
std::vector<uint64_t> scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::ibases
protected

Definition at line 192 of file router.h.

◆ initiator

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
sc_core::sc_vector<intor_sckt> scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::initiator

the array of initiator sockets

Definition at line 47 of file router.h.

◆ mutexes

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
std::vector<sc_core::sc_mutex> scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::mutexes
protected

Definition at line 194 of file router.h.

◆ target

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
sc_core::sc_vector<target_sckt> scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::target

the array of target sockets

Definition at line 45 of file router.h.

◆ target_name_lut

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
std::unordered_map<std::string, size_t> scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::target_name_lut
protected

Definition at line 196 of file router.h.

◆ tranges

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
std::vector<range_entry> scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::tranges
protected

Definition at line 193 of file router.h.

◆ warn_on_address_error

template<unsigned BUSWIDTH = LT, typename TARGET_SOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH>>
bool scc::router< BUSWIDTH, TARGET_SOCKET_TYPE >::warn_on_address_error {false}
protected

Definition at line 198 of file router.h.


The documentation for this class was generated from the following file:
  • /home/eyck/Projects/MINRES/SystemC-Components/src/components/scc/router.h