scc  2024.06
SystemC components library
scc::memory< SIZE, BUSWIDTH > Class Template Reference

simple TLM2.0 LT memory model More...

#include <memory.h>

Inheritance diagram for scc::memory< SIZE, BUSWIDTH >:
Collaboration diagram for scc::memory< SIZE, BUSWIDTH >:

Public Member Functions

 memory (const sc_core::sc_module_name &nm)
 
constexpr unsigned long long getSize () const
 return the size of the array
 
void set_operation_callback (std::function< int(memory< SIZE, BUSWIDTH > &, tlm::tlm_generic_payload &, sc_core::sc_time &delay)> cb)
 allows to register a callback or functor being invoked upon an access to the memory More...
 
void set_dmi_callback (std::function< int(memory< SIZE, BUSWIDTH > &, tlm::tlm_generic_payload &, tlm::tlm_dmi &)> cb)
 allows to register a callback or functor being invoked upon a direct memory access (DMI) to the memory More...
 
int handle_operation (tlm::tlm_generic_payload &trans, sc_core::sc_time &delay)
 ! handle the memory operation independent on interface function used
 
bool handle_dmi (tlm::tlm_generic_payload &gp, tlm::tlm_dmi &dmi_data)
 handle the dmi functionality
 

Public Attributes

tlm::scc::target_mixin< tlm::tlm_target_socket< BUSWIDTH > > target {"ts"}
 the target socket to connect to TLM
 
cci::cci_param< sc_core::sc_time > rd_resp_delay {"rd_resp_delay", sc_core::SC_ZERO_TIME}
 
cci::cci_param< sc_core::sc_time > wr_resp_delay {"wr_resp_delay", sc_core::SC_ZERO_TIME}
 
cci::cci_param< unsigned > rd_resp_clk_delay {"rd_resp_clk_delay", 0}
 
cci::cci_param< unsigned > wr_resp_clk_delay {"wr_resp_clk_delay", 0}
 
std::function< int(memory< SIZE, BUSWIDTH > &, tlm::tlm_generic_payload &, sc_core::sc_time &delay)> operation_cb
 
std::function< int(memory< SIZE, BUSWIDTH > &, tlm::tlm_generic_payload &, tlm::tlm_dmi &)> dmi_cb
 

Protected Member Functions

void set_clock_period (sc_core::sc_time period)
 

Protected Attributes

util::sparse_array< uint8_t, SIZE > mem
 the real memory structure
 
sc_core::sc_time clk_period
 

Detailed Description

template<unsigned long long SIZE, unsigned BUSWIDTH = LT>
class scc::memory< SIZE, BUSWIDTH >

simple TLM2.0 LT memory model

This model uses the util::sparse_array as backing store. Therefore it can have an arbitrary size since only pages for accessed addresses are allocated.

TODO: add some more attributes/parameters to configure access time and type (DMI allowed, read only, etc)

Template Parameters
SIZEsize of the memery
BUSWIDTHbus width of the socket

Definition at line 48 of file memory.h.

Constructor & Destructor Documentation

◆ memory()

template<unsigned long long SIZE, unsigned BUSWIDTH>
scc::memory< SIZE, BUSWIDTH >::memory ( const sc_core::sc_module_name &  nm)

constructor with explicit instance name

Parameters
nm

Definition at line 117 of file memory.h.

Member Function Documentation

◆ set_dmi_callback()

template<unsigned long long SIZE, unsigned BUSWIDTH = LT>
void scc::memory< SIZE, BUSWIDTH >::set_dmi_callback ( std::function< int(memory< SIZE, BUSWIDTH > &, tlm::tlm_generic_payload &, tlm::tlm_dmi &)>  cb)
inline

allows to register a callback or functor being invoked upon a direct memory access (DMI) to the memory

Parameters
cbthe callback function or functor

Definition at line 79 of file memory.h.

◆ set_operation_callback()

template<unsigned long long SIZE, unsigned BUSWIDTH = LT>
void scc::memory< SIZE, BUSWIDTH >::set_operation_callback ( std::function< int(memory< SIZE, BUSWIDTH > &, tlm::tlm_generic_payload &, sc_core::sc_time &delay)>  cb)
inline

allows to register a callback or functor being invoked upon an access to the memory

Parameters
cbthe callback function or functor

Definition at line 70 of file memory.h.

Member Data Documentation

◆ rd_resp_clk_delay

template<unsigned long long SIZE, unsigned BUSWIDTH = LT>
cci::cci_param<unsigned> scc::memory< SIZE, BUSWIDTH >::rd_resp_clk_delay {"rd_resp_clk_delay", 0}

read response delay in clock cycles

Definition at line 91 of file memory.h.

◆ rd_resp_delay

template<unsigned long long SIZE, unsigned BUSWIDTH = LT>
cci::cci_param<sc_core::sc_time> scc::memory< SIZE, BUSWIDTH >::rd_resp_delay {"rd_resp_delay", sc_core::SC_ZERO_TIME}

read response delay

Definition at line 83 of file memory.h.

◆ wr_resp_clk_delay

template<unsigned long long SIZE, unsigned BUSWIDTH = LT>
cci::cci_param<unsigned> scc::memory< SIZE, BUSWIDTH >::wr_resp_clk_delay {"wr_resp_clk_delay", 0}

write response delay in clock cycles

Definition at line 95 of file memory.h.

◆ wr_resp_delay

template<unsigned long long SIZE, unsigned BUSWIDTH = LT>
cci::cci_param<sc_core::sc_time> scc::memory< SIZE, BUSWIDTH >::wr_resp_delay {"wr_resp_delay", sc_core::SC_ZERO_TIME}

write response delay

Definition at line 87 of file memory.h.


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