scc  2022.4.0
SystemC components library
scc::router< BUSWIDTH > Class Template Reference

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

#include <router.h>

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

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< tlm::scc::scv::tlm_rec_target_socket< BUSWIDTH > >
 

Public Member Functions

 router (const sc_core::sc_module_name &nm, unsigned slave_cnt=1, unsigned master_cnt=1)
 constructs a router More...
 
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 More...
 
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 More...
 
void set_initiator_base (size_t idx, uint64_t base)
 define a base address of a socket More...
 
void set_default_target (size_t idx)
 define the default target socket More...
 
void set_target_name (size_t idx, std::string name)
 establish a mapping between socket name and socket index More...
 
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 More...
 
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 More...
 
void b_transport (int i, tlm::tlm_generic_payload &trans, sc_core::sc_time &delay)
 tagged blocking transport method More...
 
bool get_direct_mem_ptr (int i, tlm::tlm_generic_payload &trans, tlm::tlm_dmi &dmi_data)
 tagged forward DMI method More...
 
unsigned transport_dbg (int i, tlm::tlm_generic_payload &trans)
 tagged debug transaction method More...
 
void invalidate_direct_mem_ptr (int id, ::sc_dt::uint64 start_range, ::sc_dt::uint64 end_range)
 tagged backward DMI method More...
 

Public Attributes

sc_core::sc_vector< target_sckttarget
 the array of target sockets
 
sc_core::sc_vector< intor_scktinitiator
 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
 

Detailed Description

template<unsigned BUSWIDTH = LT>
class scc::router< BUSWIDTH >

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 40 of file router.h.

Constructor & Destructor Documentation

◆ router()

template<unsigned BUSWIDTH>
scc::router< BUSWIDTH >::router ( const sc_core::sc_module_name &  nm,
unsigned  slave_cnt = 1,
unsigned  master_cnt = 1 
)

constructs a router

Parameters
nmthe component name
slave_cntnumber of slaves to be connected
master_cntnumber of masters to be connected

Definition at line 186 of file router.h.

Member Function Documentation

◆ add_target_range()

template<unsigned BUSWIDTH>
void scc::router< BUSWIDTH >::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 219 of file router.h.

◆ b_transport()

template<unsigned BUSWIDTH>
void scc::router< BUSWIDTH >::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 239 of file router.h.

◆ bind_target() [1/2]

template<unsigned BUSWIDTH = LT>
template<typename TYPE >
void scc::router< BUSWIDTH >::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 83 of file router.h.

◆ bind_target() [2/2]

template<unsigned BUSWIDTH = LT>
template<typename TYPE >
void scc::router< BUSWIDTH >::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 70 of file router.h.

◆ get_direct_mem_ptr()

template<unsigned BUSWIDTH>
bool scc::router< BUSWIDTH >::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 261 of file router.h.

◆ invalidate_direct_mem_ptr()

template<unsigned BUSWIDTH>
void scc::router< BUSWIDTH >::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 306 of file router.h.

◆ set_default_target()

template<unsigned BUSWIDTH = LT>
void scc::router< BUSWIDTH >::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 106 of file router.h.

◆ set_initiator_base()

template<unsigned BUSWIDTH = LT>
void scc::router< BUSWIDTH >::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 96 of file router.h.

◆ set_target_name()

template<unsigned BUSWIDTH = LT>
void scc::router< BUSWIDTH >::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 114 of file router.h.

◆ set_target_range()

template<unsigned BUSWIDTH>
void scc::router< BUSWIDTH >::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 212 of file router.h.

◆ transport_dbg()

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

tagged debug transaction method

Parameters
ithe tag
transthe incoming transaction

Definition at line 285 of file router.h.


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