16#ifndef SIMICS_SYSTEMC_SIMICS2TLM_GASKET_FACTORY_H
17#define SIMICS_SYSTEMC_SIMICS2TLM_GASKET_FACTORY_H
20#include <tlm_utils/multi_passthrough_target_socket.h>
34template<
unsigned int BUSWIDTH,
typename TYPES>
36 const std::string& socket_name,
37 const simics::ConfObjectRef &simics_obj) {
38 std::string name =
"gasket_" + socket_name;
39 std::replace(name.begin(), name.end(),
'.',
'_');
41 const char* char_name = name.c_str();
42 if (sc_core::sc_find_object(char_name))
43 char_name = sc_core::sc_gen_unique_name(char_name);
54template<
unsigned int BUSWIDTH,
typename TYPES,
55 int N, sc_core::sc_port_policy POL>
57 tlm::tlm_initiator_socket<BUSWIDTH, TYPES, N, POL> *initiator_socket,
58 const simics::ConfObjectRef &simics_obj) {
59 FATAL_ERROR_IF(initiator_socket->name() == NULL,
60 "initiator socket not fully initialized, name missing");
61 auto gasket = internal::createGasket<BUSWIDTH, TYPES>(
62 initiator_socket->name(), simics_obj);
63 gasket->bind(*initiator_socket);
68template<
unsigned int BUSWIDTH,
typename TYPES,
69 int N, sc_core::sc_port_policy POL>
71 tlm::tlm_target_socket<BUSWIDTH, TYPES, N, POL> *target_socket,
72 const simics::ConfObjectRef &simics_obj) {
73 FATAL_ERROR_IF(target_socket->name() == NULL,
74 "target socket not fully initialized, name missing");
75 auto gasket = internal::createGasket<BUSWIDTH, TYPES>(
76 target_socket->name(), simics_obj);
77 gasket->bind(*target_socket);
83template<
typename MODULE,
unsigned int BUSWIDTH,
typename TYPES,
84 unsigned int N, sc_core::sc_port_policy POL>
86 tlm_utils::multi_passthrough_target_socket<
87 MODULE, BUSWIDTH, TYPES, N, POL> *target_socket,
88 const simics::ConfObjectRef &simics_obj) {
89 FATAL_ERROR_IF(target_socket->name() == NULL,
90 "target socket not fully initialized, name missing");
91 auto gasket = internal::createGasket<BUSWIDTH, TYPES>(
92 target_socket->name(), simics_obj);
93 gasket->bind(*target_socket);
99 const simics::ConfObjectRef &simics_obj);
105 const ConfObjectRef &simics_obj) = 0;
108template <
unsigned int BUSWIDTH,
typename TYPES,
int N = 1,
109 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
112 typedef tlm::tlm_base_target_socket<BUSWIDTH,
113 tlm::tlm_fw_transport_if<TYPES>,
114 tlm::tlm_bw_transport_if<TYPES>,
118 const ConfObjectRef &simics_obj) {
123 auto gasket = internal::createGasket<BUSWIDTH, TYPES>(
124 socket->name(), simics_obj);
125 gasket->bind(*socket);
Definition: registry.h:88
Definition: gasket_factory.h:101
virtual ~GasketFactoryInterface()
Definition: gasket_factory.h:103
virtual GasketInterface::Ptr create(sc_core::sc_object *object, const ConfObjectRef &simics_obj)=0
Definition: gasket_factory.h:110
virtual GasketInterface::Ptr create(sc_core::sc_object *object, const ConfObjectRef &simics_obj)
Definition: gasket_factory.h:117
tlm::tlm_base_target_socket< BUSWIDTH, tlm::tlm_fw_transport_if< TYPES >, tlm::tlm_bw_transport_if< TYPES >, N, POL > Socket
Definition: gasket_factory.h:115
std::shared_ptr< GasketInterface > Ptr
Definition: gasket_interface.h:37
Implements core functionality for sending a TLM2 transaction over a socket.
Definition: gasket.h:48
GasketInterface::Ptr createGasketByName(std::string socket_name, const simics::ConfObjectRef &simics_obj)
Factory for creating a Gasket and bind it to a target socket.
Definition: pci_bus_interface.h:24