17 #ifndef TLM_REC_INITIATOR_SOCKET_H_
18 #define TLM_REC_INITIATOR_SOCKET_H_
20 #include <tlm/scc/scv/tlm_recorder.h>
29 template <
unsigned int BUSWIDTH = 32,
typename TYPES = tlm::tlm_base_protocol_types,
int N = 1
30 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
32 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND
36 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
41 static std::string gen_name(const char* first, const char* second) {
43 ss << first << "_" << second;
48 using fw_interface_type = tlm::tlm_fw_transport_if<TYPES>;
49 using bw_interface_type = tlm::tlm_bw_transport_if<TYPES>;
50 using port_type = sc_core::sc_port<fw_interface_type, N
51 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
56 using export_type = sc_core::sc_export<bw_interface_type>;
57 using base_target_socket_type = tlm::tlm_base_target_socket_b<BUSWIDTH, fw_interface_type, bw_interface_type>;
58 using base_type = tlm::tlm_base_initiator_socket_b<BUSWIDTH, fw_interface_type, bw_interface_type>;
60 tlm_rec_initiator_socket()
61 : tlm::tlm_initiator_socket<BUSWIDTH, TYPES, N
62 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
67 , recorder(this->name(), fw_port, bw_port) {
70 explicit tlm_rec_initiator_socket(const char* name)
71 : tlm::tlm_initiator_socket<BUSWIDTH, TYPES, N
72 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
77 , fw_port(sc_core::sc_gen_unique_name("$$$_fw"))
78 , bw_port(sc_core::sc_gen_unique_name("$$$_bw"))
79 , recorder(this->name(), fw_port, bw_port) {
82 virtual ~tlm_rec_initiator_socket() {}
84 virtual const char* kind() const { return "tlm_rec_target_socket"; }
92 virtual void bind(base_target_socket_type& s) {
94 (this->get_base_port())(recorder);
95 fw_port(s.get_base_interface());
97 (s.get_base_port())(recorder);
98 bw_port(this->get_base_interface());
104 virtual void bind(base_type& s) {
106 (this->get_base_port())(recorder);
107 fw_port(s.get_base_port());
109 (s.get_base_export())(recorder);
110 bw_port(this->get_base_export());
117 virtual void bind(bw_interface_type& ifs) { (this->get_base_export())(ifs); }
119 void setExtensionRecording(tlm_extensions_recording_if<TYPES>* extensionRecording) {
120 recorder.setExtensionRecording(extensionRecording);
124 sc_core::sc_port<tlm::tlm_fw_transport_if<TYPES>> fw_port{sc_core::sc_gen_unique_name("$$$__rec_fw__$$$")};
125 sc_core::sc_port<tlm::tlm_bw_transport_if<TYPES>> bw_port{sc_core::sc_gen_unique_name("$$$__rec_bw__$$$")};
126 scv::tlm_recorder<TYPES> recorder;