Go to the documentation of this file.
20 #ifndef __SYSTEMC_EXT_TLM_UTILS_MULTI_SOCKET_BASES_H__
21 #define __SYSTEMC_EXT_TLM_UTILS_MULTI_SOCKET_BASES_H__
25 #include "../core/sc_port.hh"
26 #include "../tlm_core/2/interfaces/fw_bw_ifs.hh"
32 template <
typename signature>
38 #define TLM_DEFINE_FUNCTOR(name) \
39 template <typename MODULE, typename TRAITS> \
41 static_##name(void *mod, void *fn, int index, TLM_FULL_ARG_LIST) \
43 typedef fn_container<TLM_RET_VAL (MODULE::*)(int, TLM_FULL_ARG_LIST)> \
45 MODULE *tmp_mod = static_cast<MODULE *>(mod); \
46 fn_container_type *tmp_cb = static_cast<fn_container_type *> (fn); \
47 return (tmp_mod->*(tmp_cb->function))( \
48 index, TLM_ARG_LIST_WITHOUT_TYPES); \
51 template <typename MODULE, typename TRAITS> \
53 delete_fn_container_of_##name(void *fn) \
55 typedef fn_container<TLM_RET_VAL (MODULE::*)(int, TLM_FULL_ARG_LIST)> \
57 fn_container_type *tmp_cb = static_cast<fn_container_type *>(fn); \
62 template <typename TRAITS> \
63 class name##_functor{ \
65 typedef typename TRAITS::tlm_payload_type payload_type; \
66 typedef typename TRAITS::tlm_phase_type phase_type; \
67 typedef TLM_RET_VAL (*call_fn)(void *,void *, int, TLM_FULL_ARG_LIST); \
68 typedef void (*del_fn)(void *); \
70 name##_functor() : m_fn(0), m_del_fn(0), m_mod(0), m_mem_fn(0) {} \
74 (*m_del_fn)(m_mem_fn); \
77 template <typename MODULE> \
79 set_function(MODULE *mod, TLM_RET_VAL (MODULE::*cb)( \
80 int, TLM_FULL_ARG_LIST)) \
82 typedef fn_container<TLM_RET_VAL (MODULE::*)( \
83 int, TLM_FULL_ARG_LIST)> fn_container_type; \
84 m_fn = &static_##name<MODULE,TRAITS>; \
85 m_del_fn = &delete_fn_container_of_##name<MODULE, TRAITS>; \
87 fn_container_type *tmp =new fn_container_type(); \
89 m_mod = static_cast<void *>(mod); \
90 m_mem_fn = static_cast<void *>(tmp); \
94 operator ()(int index, TLM_FULL_ARG_LIST) \
96 return m_fn(m_mod, m_mem_fn, index, TLM_ARG_LIST_WITHOUT_TYPES); \
99 bool is_valid() { return (m_mod != 0 && m_mem_fn != 0 && m_fn != 0); } \
107 name##_functor &operator = (const name##_functor &); \
111 #define TLM_RET_VAL tlm::tlm_sync_enum
112 #define TLM_FULL_ARG_LIST \
113 typename TRAITS::tlm_payload_type &txn, \
114 typename TRAITS::tlm_phase_type &ph, sc_core::sc_time &t
115 #define TLM_ARG_LIST_WITHOUT_TYPES txn, ph, t
118 #undef TLM_FULL_ARG_LIST
119 #undef TLM_ARG_LIST_WITHOUT_TYPES
121 #define TLM_RET_VAL void
122 #define TLM_FULL_ARG_LIST \
123 typename TRAITS::tlm_payload_type &txn, sc_core::sc_time &t
124 #define TLM_ARG_LIST_WITHOUT_TYPES txn, t
127 #undef TLM_FULL_ARG_LIST
128 #undef TLM_ARG_LIST_WITHOUT_TYPES
130 #define TLM_RET_VAL unsigned int
131 #define TLM_FULL_ARG_LIST typename TRAITS::tlm_payload_type &txn
132 #define TLM_ARG_LIST_WITHOUT_TYPES txn
135 #undef TLM_FULL_ARG_LIST
136 #undef TLM_ARG_LIST_WITHOUT_TYPES
138 #define TLM_RET_VAL bool
139 #define TLM_FULL_ARG_LIST \
140 typename TRAITS::tlm_payload_type &txn, tlm::tlm_dmi &dmi
141 #define TLM_ARG_LIST_WITHOUT_TYPES txn, dmi
144 #undef TLM_FULL_ARG_LIST
145 #undef TLM_ARG_LIST_WITHOUT_TYPES
147 #define TLM_RET_VAL void
148 #define TLM_FULL_ARG_LIST sc_dt::uint64 l, sc_dt::uint64 u
149 #define TLM_ARG_LIST_WITHOUT_TYPES l, u
152 #undef TLM_FULL_ARG_LIST
153 #undef TLM_ARG_LIST_WITHOUT_TYPES
155 #undef TLM_DEFINE_FUNCTOR
163 template <
typename TYPES>
165 protected convenience_socket_cb_holder
170 typedef typename TYPES::tlm_phase_type
phase_type;
194 "registered callback for nb_transport_fw.");
204 (*m_b_f)(
m_id, trans,
t);
209 "registered callback for b_transport.");
285 template <
typename TYPES>
292 typedef typename TYPES::tlm_phase_type
phase_type;
315 "registered callback for nb_transport_bw");
350 template <
typename TYPES=tlm::tlm_base_protocol_types>
369 template <
unsigned int BUSWIDTH=32,
410 template <
typename TYPES=tlm::tlm_base_protocol_types>
422 virtual std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES>*> &
434 template <
unsigned int BUSWIDTH=32,
476 template <
typename TYPES>
TYPES::tlm_payload_type transaction_type
virtual tlm::tlm_socket_category get_socket_category() const
bool get_direct_mem_ptr(transaction_type &trans, tlm::tlm_dmi &dmi_data)
@ TLM_MULTI_INITIATOR_SOCKET
void register_port(sc_core::sc_port_base &b, const char *)
void set_callbacks(nb_func_type &cb1, dmi_func_type &cb2)
TLM_DEFINE_FUNCTOR(nb_transport)
virtual tlm::tlm_fw_transport_if< TYPES > * get_last_binder(tlm::tlm_bw_transport_if< TYPES > *)=0
nb_transport_functor< TYPES > nb_func_type
void set_callbacks(nb_func_type &cb1, b_func_type &cb2, dmi_func_type &cb3, debug_func_type &cb4)
sync_enum_type nb_transport_fw(transaction_type &txn, phase_type &p, sc_core::sc_time &t)
virtual ~multi_target_base_if()
void invalidate_direct_mem_ptr(sc_dt::uint64 l, sc_dt::uint64 u)
invalidate_dmi_functor< TYPES > dmi_func_type
virtual ~multi_init_base()
debug_func_type * m_dbg_f
tlm::tlm_sync_enum sync_enum_type
convenience_socket_cb_holder(convenience_socket_base *owner)
sc_core::sc_port_base * m_caller_port
void display_error(const char *msg) const
@ TLM_MULTI_TARGET_SOCKET
TYPES::tlm_payload_type transaction_type
virtual ~multi_to_multi_bind_base()
void set_end_address(sc_dt::uint64 addr)
virtual ~multi_init_base_if()
TYPES::tlm_phase_type phase_type
callback_binder_fw(multi_socket_base *owner, int id)
TYPES::tlm_phase_type phase_type
const sc_core::sc_object * get_socket() const
b_transport_functor< TYPES > b_func_type
debug_transport_functor< TYPES > debug_func_type
const char * sc_gen_unique_name(const char *seed)
virtual std::vector< tlm::tlm_fw_transport_if< TYPES > * > & get_sockets()=0
virtual tlm::tlm_socket_category get_socket_category() const
tlm::tlm_initiator_socket< BUSWIDTH, TYPES, N, POL > base_type
const std::string & name()
virtual std::map< unsigned int, tlm::tlm_bw_transport_if< TYPES > * > & get_multi_binds()=0
sync_enum_type nb_transport_bw(transaction_type &txn, phase_type &p, sc_core::sc_time &t)
virtual std::vector< callback_binder_fw< TYPES > * > & get_binders()=0
void b_transport(transaction_type &trans, sc_core::sc_time &t)
virtual multi_init_base * get_hierarch_bind()=0
const sc_core::sc_object * get_socket() const
sc_core::sc_port_base * get_other_side()
callback_binder_bw(multi_socket_base *owner, int id)
unsigned int transport_dbg(transaction_type &trans)
const char * name() const
get_dmi_ptr_functor< TYPES > dmi_func_type
nb_transport_functor< TYPES > nb_func_type
tlm::tlm_target_socket< BUSWIDTH, TYPES, N, POL > base_type
void set_start_address(sc_dt::uint64 addr)
virtual multi_target_base * get_hierarch_bind()=0
virtual void set_hierarch_bind(multi_target_base *)=0
tlm::tlm_sync_enum sync_enum_type
virtual ~multi_target_base()
virtual std::vector< callback_binder_bw< TYPES > * > & get_binders()=0
virtual void disable_cb_bind()=0
Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17