17 #ifndef TLM_REC_TARGET_SOCKET_H_
18 #define TLM_REC_TARGET_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<bw_interface_type, N
51 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
57 using export_type = sc_core::sc_export<fw_interface_type>;
58 using base_initiator_socket_type = tlm::tlm_base_initiator_socket_b<BUSWIDTH, fw_interface_type, bw_interface_type>;
59 using base_type = tlm::tlm_base_target_socket_b<BUSWIDTH, fw_interface_type, bw_interface_type>;
61 tlm_rec_target_socket()
62 : tlm::tlm_target_socket<BUSWIDTH, TYPES, N
63 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
68 , recorder(this->name(), fw_port, this->get_base_port()) {
71 explicit tlm_rec_target_socket(const char* name)
72 : tlm::tlm_target_socket<BUSWIDTH, TYPES, N
73 #if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
78 , recorder(this->name(), fw_port, this->get_base_port()) {
81 virtual ~tlm_rec_target_socket() = default;
83 virtual const char* kind() const { return "tlm_rec_target_socket"; }
88 virtual void bind(base_type& s) {
90 (this->get_base_export())(s.get_base_export());
92 (s.get_base_port())(recorder);
99 virtual void bind(fw_interface_type& ifs) {
100 export_type* exp = &this->get_base_export();
102 export_type::bind(recorder);
111 bw_interface_type* operator->() { return &recorder; }
113 void setExtensionRecording(tlm_extensions_recording_if<TYPES>* extensionRecording) {
114 recorder.setExtensionRecording(extensionRecording);
118 sc_core::sc_port<fw_interface_type> fw_port{sc_core::sc_gen_unique_name("$$$__rec_fw__$$$")};
119 scv::tlm_recorder<TYPES> recorder;