16#ifndef SIMICS_SYSTEMC_AWARENESS_PROXY_SOCKET_H
17#define SIMICS_SYSTEMC_AWARENESS_PROXY_SOCKET_H
20#include <tlm_utils/multi_socket_bases.h>
44template <
typename TYPES>
60 void init(sc_core::sc_object *obj,
65 base_socket_ =
dynamic_cast<tlm::tlm_base_socket_if *
>(obj);
69 "SystemC object '%s' does not implement"
70 " tlm::tlm_base_socket_if. Init abort",
77 dynamic_cast<tlm_utils::multi_init_base_if<TYPES> *
>(obj);
82#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
83 base_bw_ =
const_cast<sc_core::sc_export_base *
>(
84 &
const_cast<const tlm::tlm_base_socket_if *
>(
96 dynamic_cast<tlm_utils::multi_target_base_if<TYPES> *
>(obj);
101#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
102 base_fw_ =
const_cast<sc_core::sc_export_base *
>(
103 &
const_cast<const tlm::tlm_base_socket_if *
>(
139 std::vector<tlm::tlm_fw_transport_if<TYPES> *> &sockets =
141 for (
auto s : sockets) {
148 std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES> *> &binds =
150 for (
const auto &b : binds) {
156 sc_core::sc_object *obj =
dynamic_cast<sc_core::sc_object *
>(
167 const sc_core::sc_interface *iface =
nullptr;
169 iface =
base_socket_->get_export_base().get_interface();
170#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
171 iface =
const_cast<const tlm::tlm_base_socket_if *
>(
174 return dynamic_cast<const tlm::tlm_fw_transport_if<TYPES> *
>(
182 handler->init(
this, controller);
193 typename std::vector<tlm_utils::callback_binder_bw<TYPES>* >::
200 static_cast<sc_core::sc_interface *
>(
225template <
typename TYPES>
227 public tlm::tlm_fw_transport_if<TYPES> {
235 sc_core::sc_time &t)
override {
237 return fw_if()->nb_transport_fw(trans, phase, t);
240 sc_core::sc_time &t)
override {
245 tlm::tlm_dmi &dmi_data)
override {
247 return fw_if()->get_direct_mem_ptr(trans, dmi_data);
251 return fw_if()->transport_dbg(trans);
254 tlm::tlm_fw_transport_if<TYPES> *fw_if() {
256 tlm::tlm_fw_transport_if<TYPES> *fw_if =
257 dynamic_cast<tlm::tlm_fw_transport_if<TYPES> *
>(
259#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
260 tlm::tlm_fw_transport_if<TYPES> *fw_if =
261 dynamic_cast<tlm::tlm_fw_transport_if<TYPES> *
>(
262 const_cast<sc_core::sc_interface *
>(
263 const_cast<const tlm::tlm_base_socket_if *
>(
272template <
typename TYPES>
273injection::BTransportInvoker<TYPES> ProxyInitiatorSocket<TYPES>::invoker_;
275template <
typename TYPES>
277 public tlm::tlm_bw_transport_if<TYPES> {
286 sc_core::sc_time &t) {
288 return bw_if()->nb_transport_bw(trans, phase, t);
291 sc_dt::uint64 end_range) {
293 bw_if()->invalidate_direct_mem_ptr(start_range, end_range);
297 tlm::tlm_bw_transport_if<TYPES> *bw_if() {
299 tlm::tlm_bw_transport_if<TYPES> *bw_if =
300 dynamic_cast<tlm::tlm_bw_transport_if<TYPES> *
>(
302#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
303 tlm::tlm_bw_transport_if<TYPES> *bw_if =
304 dynamic_cast<tlm::tlm_bw_transport_if<TYPES> *
>(
305 const_cast<sc_core::sc_interface *
>(
306 const_cast<const tlm::tlm_base_socket_if *
>(
static const char * get_typename(sc_export_base *object)
Definition: kernel_state_modifier.h:33
Utility class that reset the current context to the previous one upon leaving current scope.
Definition: kernel.h:29
sc_core::sc_simcontext * context() const override
Definition: simulation_interface_proxy.h:46
Definition: proxy_socket.h:227
tlm::tlm_sync_enum nb_transport_fw(transaction_type &trans, phase_type &phase, sc_core::sc_time &t) override
Definition: proxy_socket.h:233
unsigned int transport_dbg(transaction_type &trans) override
Definition: proxy_socket.h:249
void b_transport(transaction_type &trans, sc_core::sc_time &t) override
Definition: proxy_socket.h:239
TYPES::tlm_phase_type phase_type
Definition: proxy_socket.h:230
bool get_direct_mem_ptr(transaction_type &trans, tlm::tlm_dmi &dmi_data) override
Definition: proxy_socket.h:244
ProxyInitiatorSocket(simics::ConfObjectRef o)
Definition: proxy_socket.h:231
TYPES::tlm_payload_type transaction_type
Definition: proxy_socket.h:229
Definition: proxy_socket.h:51
std::string socket_name_
Definition: proxy_socket.h:212
void addHandler(TlmHandlerInterface *handler)
Definition: proxy_socket.h:207
std::vector< tlm_utils::callback_binder_fw< TYPES > * > binders_fw_
Definition: proxy_socket.h:219
sc_core::sc_export_base * base_bw_
Definition: proxy_socket.h:214
void tool_controller_init(ToolController *controller) override
Definition: proxy_socket.h:180
void allProxiesInitialized() override
Definition: proxy_socket.h:116
void simulationStarted() override
Definition: proxy_socket.h:126
void connection_list_updated(ConnectionListState state) override
Definition: proxy_socket.h:184
void init(sc_core::sc_object *obj, SimulationInterface *simulation) override
Definition: proxy_socket.h:60
std::vector< TlmHandlerInterface * > all_handlers_
Definition: proxy_socket.h:220
tlm_utils::multi_target_base_if< TYPES > * multi_target_
Definition: proxy_socket.h:222
ProxySocketBase(simics::ConfObjectRef o)
Definition: proxy_socket.h:56
const char * base_bw_typename_
Definition: proxy_socket.h:216
const char * base_fw_typename_
Definition: proxy_socket.h:217
void simulationEnded() override
Definition: proxy_socket.h:163
bool isTargetSocket() override
Definition: proxy_socket.h:165
tlm_utils::multi_init_base_if< TYPES > * multi_initiator_
Definition: proxy_socket.h:221
std::vector< tlm_utils::callback_binder_bw< TYPES > * > binders_bw_
Definition: proxy_socket.h:218
sc_core::sc_export_base * base_fw_
Definition: proxy_socket.h:215
virtual ~ProxySocketBase()
Definition: proxy_socket.h:192
tlm::tlm_base_socket_if * base_socket_
Definition: proxy_socket.h:213
TYPES types
Definition: proxy_socket.h:54
Definition: proxy_socket_interface.h:23
Definition: proxy_socket.h:277
virtual void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)
Definition: proxy_socket.h:290
TYPES::tlm_payload_type transaction_type
Definition: proxy_socket.h:279
TYPES::tlm_phase_type phase_type
Definition: proxy_socket.h:280
virtual tlm::tlm_sync_enum nb_transport_bw(transaction_type &trans, phase_type &phase, sc_core::sc_time &t)
Definition: proxy_socket.h:284
ProxyTargetSocket(simics::ConfObjectRef o)
Definition: proxy_socket.h:281
void init(sc_core::sc_object *obj, iface::SimulationInterface *simulation) override
static ProxyInterface * findProxy(sc_core::sc_object *obj)
iface::SimulationInterface * simulation() override
Definition: sc_export_connection.h:40
void insertKey(keytype key)
conf_object_t * export_to_proxy() override
static void removeBinderExport(keytype key, sc_core::sc_export_base *obj)
std::pair< sc_core::sc_interface *, std::string > keytype
Definition: sc_export_connection.h:42
static void addBinderExport(const keytype &key, sc_core::sc_export_base *obj)
void init(sc_core::sc_object *object, iface::SimulationInterface *simulation)
Definition: sc_port_connection.h:39
void init(sc_core::sc_object *object, iface::SimulationInterface *simulation)
std::vector< conf_object_t * > port_to_proxies() override
static TlmHandlerInterface * targetFwSocketHandler(sc_core::sc_object *obj)
Definition: tlm_base_handler.h:161
static TlmHandlerInterface * mPInitiatorFwSocketHandler(tlm::tlm_fw_transport_if< TYPES > *socket)
Definition: tlm_base_handler.h:202
static TlmHandlerInterface * targetBwSocketHandler(sc_core::sc_object *obj)
Definition: tlm_base_handler.h:181
static TlmHandlerInterface * mPInitiatorBwSocketHandler(tlm_utils::callback_binder_bw< TYPES > *cb)
Definition: tlm_base_handler.h:217
static TlmHandlerInterface * mPtargetBwSocketHandler(tlm::tlm_bw_transport_if< TYPES > *socket)
Definition: tlm_base_handler.h:246
static TlmHandlerInterface * initiatorFwSocketHandler(sc_core::sc_object *obj)
Definition: tlm_base_handler.h:121
static TlmHandlerInterface * mPTargetFwSocketHandler(tlm_utils::callback_binder_fw< TYPES > *cb)
Definition: tlm_base_handler.h:227
static TlmHandlerInterface * mPTargetBwSocketHandler(tlm_utils::callback_binder_fw< TYPES > *cb)
Definition: tlm_base_handler.h:237
static TlmHandlerInterface * mPInitiatorFwMpSocketHandler(tlm::tlm_fw_transport_if< TYPES > *socket)
Definition: tlm_base_handler.h:212
static TlmHandlerInterface * initiatorBwSocketHandler(sc_core::sc_object *obj)
Definition: tlm_base_handler.h:141
Definition: tlm_handler_interface.h:26
virtual ConfObjectRef simics_object() const =0
Definition: b_transport_invoker.h:31
@ Log_Awareness
Definition: adapter_log_groups.h:26