14#ifndef SIMICS_SYSTEMC_AWARENESS_PROXY_SOCKET_H
15#define SIMICS_SYSTEMC_AWARENESS_PROXY_SOCKET_H
18#include <tlm_utils/multi_socket_bases.h>
42template <
typename TYPES>
58 void init(sc_core::sc_object *obj,
63 base_socket_ =
dynamic_cast<tlm::tlm_base_socket_if *
>(obj);
67 "SystemC object '%s' does not implement"
68 " tlm::tlm_base_socket_if. Init abort",
75 dynamic_cast<tlm_utils::multi_init_base_if<TYPES> *
>(obj);
80#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
81 base_bw_ =
const_cast<sc_core::sc_export_base *
>(
82 &
const_cast<const tlm::tlm_base_socket_if *
>(
94 dynamic_cast<tlm_utils::multi_target_base_if<TYPES> *
>(obj);
99#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
100 base_fw_ =
const_cast<sc_core::sc_export_base *
>(
101 &
const_cast<const tlm::tlm_base_socket_if *
>(
137 std::vector<tlm::tlm_fw_transport_if<TYPES> *> &sockets =
139 for (
auto s : sockets) {
146 std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES> *> &binds =
148 for (
const auto &b : binds) {
154 sc_core::sc_object *obj =
dynamic_cast<sc_core::sc_object *
>(
165 const sc_core::sc_interface *iface =
nullptr;
167 iface =
base_socket_->get_export_base().get_interface();
168#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
169 iface =
const_cast<const tlm::tlm_base_socket_if *
>(
172 return dynamic_cast<const tlm::tlm_fw_transport_if<TYPES> *
>(
180 handler->init(
this, controller);
196 static_cast<sc_core::sc_interface *
>(
221template <
typename TYPES>
223 public tlm::tlm_fw_transport_if<TYPES> {
231 sc_core::sc_time &t)
override {
233 return fw_if()->nb_transport_fw(trans, phase, t);
236 sc_core::sc_time &t)
override {
241 tlm::tlm_dmi &dmi_data)
override {
243 return fw_if()->get_direct_mem_ptr(trans, dmi_data);
247 return fw_if()->transport_dbg(trans);
250 tlm::tlm_fw_transport_if<TYPES> *fw_if() {
252 tlm::tlm_fw_transport_if<TYPES> *fw_if =
253 dynamic_cast<tlm::tlm_fw_transport_if<TYPES> *
>(
255#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
256 tlm::tlm_fw_transport_if<TYPES> *fw_if =
257 dynamic_cast<tlm::tlm_fw_transport_if<TYPES> *
>(
258 const_cast<sc_core::sc_interface *
>(
259 const_cast<const tlm::tlm_base_socket_if *
>(
268template <
typename TYPES>
269injection::BTransportInvoker<TYPES> ProxyInitiatorSocket<TYPES>::invoker_;
271template <
typename TYPES>
273 public tlm::tlm_bw_transport_if<TYPES> {
282 sc_core::sc_time &t)
override {
284 return bw_if()->nb_transport_bw(trans, phase, t);
287 sc_dt::uint64 end_range)
override {
289 bw_if()->invalidate_direct_mem_ptr(start_range, end_range);
293 tlm::tlm_bw_transport_if<TYPES> *bw_if() {
295 tlm::tlm_bw_transport_if<TYPES> *bw_if =
296 dynamic_cast<tlm::tlm_bw_transport_if<TYPES> *
>(
298#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
299 tlm::tlm_bw_transport_if<TYPES> *bw_if =
300 dynamic_cast<tlm::tlm_bw_transport_if<TYPES> *
>(
301 const_cast<sc_core::sc_interface *
>(
302 const_cast<const tlm::tlm_base_socket_if *
>(
static const char * get_typename(sc_export_base *object)
Definition: kernel_state_modifier.h:31
Utility class that reset the current context to the previous one upon leaving current scope.
Definition: kernel.h:27
sc_core::sc_simcontext * context() const override
Definition: simulation_interface_proxy.h:44
Definition: proxy_socket.h:223
tlm::tlm_sync_enum nb_transport_fw(transaction_type &trans, phase_type &phase, sc_core::sc_time &t) override
Definition: proxy_socket.h:229
unsigned int transport_dbg(transaction_type &trans) override
Definition: proxy_socket.h:245
void b_transport(transaction_type &trans, sc_core::sc_time &t) override
Definition: proxy_socket.h:235
TYPES::tlm_phase_type phase_type
Definition: proxy_socket.h:226
bool get_direct_mem_ptr(transaction_type &trans, tlm::tlm_dmi &dmi_data) override
Definition: proxy_socket.h:240
ProxyInitiatorSocket(simics::ConfObjectRef o)
Definition: proxy_socket.h:227
TYPES::tlm_payload_type transaction_type
Definition: proxy_socket.h:225
Definition: proxy_socket.h:49
std::string socket_name_
Definition: proxy_socket.h:208
void addHandler(TlmHandlerInterface *handler)
Definition: proxy_socket.h:203
std::vector< tlm_utils::callback_binder_fw< TYPES > * > binders_fw_
Definition: proxy_socket.h:215
sc_core::sc_export_base * base_bw_
Definition: proxy_socket.h:210
void tool_controller_init(ToolController *controller) override
Definition: proxy_socket.h:178
void allProxiesInitialized() override
Definition: proxy_socket.h:114
void simulationStarted() override
Definition: proxy_socket.h:124
void connection_list_updated(ConnectionListState state) override
Definition: proxy_socket.h:182
void init(sc_core::sc_object *obj, SimulationInterface *simulation) override
Definition: proxy_socket.h:58
std::vector< TlmHandlerInterface * > all_handlers_
Definition: proxy_socket.h:216
tlm_utils::multi_target_base_if< TYPES > * multi_target_
Definition: proxy_socket.h:218
ProxySocketBase(simics::ConfObjectRef o)
Definition: proxy_socket.h:54
const char * base_bw_typename_
Definition: proxy_socket.h:212
const char * base_fw_typename_
Definition: proxy_socket.h:213
void simulationEnded() override
Definition: proxy_socket.h:161
bool isTargetSocket() override
Definition: proxy_socket.h:163
tlm_utils::multi_init_base_if< TYPES > * multi_initiator_
Definition: proxy_socket.h:217
std::vector< tlm_utils::callback_binder_bw< TYPES > * > binders_bw_
Definition: proxy_socket.h:214
sc_core::sc_export_base * base_fw_
Definition: proxy_socket.h:211
virtual ~ProxySocketBase()
Definition: proxy_socket.h:190
tlm::tlm_base_socket_if * base_socket_
Definition: proxy_socket.h:209
TYPES types
Definition: proxy_socket.h:52
Definition: proxy_socket_interface.h:21
Definition: proxy_socket.h:273
void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range) override
Definition: proxy_socket.h:286
TYPES::tlm_payload_type transaction_type
Definition: proxy_socket.h:275
tlm::tlm_sync_enum nb_transport_bw(transaction_type &trans, phase_type &phase, sc_core::sc_time &t) override
Definition: proxy_socket.h:280
TYPES::tlm_phase_type phase_type
Definition: proxy_socket.h:276
ProxyTargetSocket(simics::ConfObjectRef o)
Definition: proxy_socket.h:277
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:38
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:40
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:37
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:159
static TlmHandlerInterface * mPInitiatorFwSocketHandler(tlm::tlm_fw_transport_if< TYPES > *socket)
Definition: tlm_base_handler.h:200
static TlmHandlerInterface * targetBwSocketHandler(sc_core::sc_object *obj)
Definition: tlm_base_handler.h:179
static TlmHandlerInterface * mPInitiatorBwSocketHandler(tlm_utils::callback_binder_bw< TYPES > *cb)
Definition: tlm_base_handler.h:215
static TlmHandlerInterface * mPtargetBwSocketHandler(tlm::tlm_bw_transport_if< TYPES > *socket)
Definition: tlm_base_handler.h:244
static TlmHandlerInterface * initiatorFwSocketHandler(sc_core::sc_object *obj)
Definition: tlm_base_handler.h:119
static TlmHandlerInterface * mPTargetFwSocketHandler(tlm_utils::callback_binder_fw< TYPES > *cb)
Definition: tlm_base_handler.h:225
static TlmHandlerInterface * mPTargetBwSocketHandler(tlm_utils::callback_binder_fw< TYPES > *cb)
Definition: tlm_base_handler.h:235
static TlmHandlerInterface * mPInitiatorFwMpSocketHandler(tlm::tlm_fw_transport_if< TYPES > *socket)
Definition: tlm_base_handler.h:210
static TlmHandlerInterface * initiatorBwSocketHandler(sc_core::sc_object *obj)
Definition: tlm_base_handler.h:139
Definition: tlm_handler_interface.h:24
virtual ConfObjectRef simics_object() const =0
Definition: b_transport_invoker.h:29
@ Log_Awareness
Definition: adapter_log_groups.h:24