17 #ifndef _TLM_TLM2_PV_AV_H_
18 #define _TLM_TLM2_PV_AV_H_
22 #include <util/ities.h>
29 template <
unsigned int BUSWIDTH = 32,
typename TYPES = tlm_base_protocol_types,
int N = 1,
30 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND,
31 typename TSOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH, TYPES, N, POL>,
32 typename ISOCKET_TYPE = tlm::tlm_initiator_socket<BUSWIDTH, TYPES, N, POL>>
34 public tlm::tlm_fw_transport_if<TYPES>,
35 public tlm::tlm_bw_transport_if<TYPES> {
37 using tlm_payload_type =
typename TYPES::tlm_payload_type;
38 using tlm_phase_type =
typename TYPES::tlm_phase_type;
39 using target_socket_type = TSOCKET_TYPE;
40 using initiator_socket_type = ISOCKET_TYPE;
42 target_socket_type tsck{
"tsck"};
48 : sc_core::sc_module(nm) {
52 void bind_pv(target_socket_type& tsck) {
53 pv_isck = util::make_unique<initiator_socket_type>(sc_core::sc_gen_unique_name(
"pv_isck"));
58 void bind_av(TSOCKET_TYPE& tsck) {
59 av_isck = util::make_unique<initiator_socket_type>(sc_core::sc_gen_unique_name(
"av_isck"));
67 tlm::tlm_sync_enum nb_transport_fw(tlm_payload_type& trans, tlm_phase_type& phase, sc_core::sc_time& t) {
69 return (*av_isck)->nb_transport_fw(trans, phase, t);
70 trans.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE);
71 return tlm::TLM_COMPLETED;
74 void b_transport(tlm_payload_type& trans, sc_core::sc_time& t) {
76 (*pv_isck)->b_transport(trans, t);
78 trans.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE);
81 bool get_direct_mem_ptr(tlm_payload_type& trans, tlm_dmi& dmi_data) {
83 return (*pv_isck)->get_direct_mem_ptr(trans, dmi_data);
84 trans.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE);
85 trans.set_dmi_allowed(
false);
89 unsigned int transport_dbg(tlm_payload_type& trans) {
91 return (*pv_isck)->transport_dbg(trans);
92 trans.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE);
96 tlm::tlm_sync_enum nb_transport_bw(tlm_payload_type& trans, tlm_phase_type& phase, sc_core::sc_time& t) {
97 return tsck->nb_transport_bw(trans, phase, t);
100 void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range) {
101 tsck->invalidate_direct_mem_ptr(start_range, end_range);
104 std::unique_ptr<initiator_socket_type> pv_isck;
105 std::unique_ptr<initiator_socket_type> av_isck;
108 template <
unsigned int BUSWIDTH = 32,
typename TYPES = tlm_base_protocol_types,
int N = 1,
109 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND,
110 typename TSOCKET_TYPE = tlm::tlm_target_socket<BUSWIDTH, TYPES, N, POL>,
111 typename ISOCKET_TYPE = tlm::tlm_initiator_socket<BUSWIDTH, TYPES, N, POL>>
113 public tlm::tlm_fw_transport_if<TYPES>,
114 public tlm::tlm_bw_transport_if<TYPES> {
116 using tlm_payload_type =
typename TYPES::tlm_payload_type;
117 using tlm_phase_type =
typename TYPES::tlm_phase_type;
118 using target_socket_type = TSOCKET_TYPE;
119 using initiator_socket_type = ISOCKET_TYPE;
121 initiator_socket_type isck{
"isck"};
127 : sc_core::sc_module(nm) {
131 void bind_pv(initiator_socket_type& isck) {
132 pv_tsck = util::make_unique<target_socket_type>(sc_core::sc_gen_unique_name(
"pv_tsck"));
133 pv_tsck->bind(*
this);
137 void bind_av(initiator_socket_type& isck) {
138 av_tsck = util::make_unique<target_socket_type>(sc_core::sc_gen_unique_name(
"av_tsck"));
139 av_tsck->bind(*
this);
146 tlm::tlm_sync_enum nb_transport_fw(tlm_payload_type& trans, tlm_phase_type& phase, sc_core::sc_time& t) {
147 return isck->nb_transport_fw(trans, phase, t);
150 void b_transport(tlm_payload_type& trans, sc_core::sc_time& t) { isck->b_transport(trans, t); }
152 bool get_direct_mem_ptr(tlm_payload_type& trans, tlm_dmi& dmi_data) {
return isck->get_direct_mem_ptr(trans, dmi_data); }
154 unsigned int transport_dbg(tlm_payload_type& trans) {
return isck->transport_dbg(trans); }
156 tlm::tlm_sync_enum nb_transport_bw(tlm_payload_type& trans, tlm_phase_type& phase, sc_core::sc_time& t) {
158 return (*av_tsck)->nb_transport_bw(trans, phase, t);
159 trans.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE);
160 return tlm::TLM_COMPLETED;
163 void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range) {
165 (*pv_tsck)->invalidate_direct_mem_ptr(start_range, end_range);
168 std::unique_ptr<target_socket_type> pv_tsck{};
169 std::unique_ptr<target_socket_type> av_tsck{};