17 #include "../../../interfaces/apb/pe/apb_target.h"
19 #include <scc/report.h>
23 using namespace sc_core;
31 apb_target_b::apb_target_b(
const sc_core::sc_module_name& nm, sc_core::sc_port_b<tlm::tlm_bw_transport_if<tlm_base_protocol_types>>& port,
32 size_t transfer_width)
37 sensitive << clk_i.pos();
40 void apb_target_b::end_of_elaboration() { clk_if =
dynamic_cast<sc_core::sc_clock*
>(clk_i.get_interface()); }
42 void apb_target_b::b_transport(payload_type& trans, sc_time& t) {
45 trans.set_dmi_allowed(
false);
46 trans.set_response_status(tlm::TLM_OK_RESPONSE);
47 clk_if =
dynamic_cast<sc_core::sc_clock*
>(clk_i.get_interface());
49 t += 1 * clk_if->period();
53 tlm_sync_enum apb_target_b::nb_transport_fw(payload_type& trans, phase_type& phase, sc_time& t) {
54 if(phase == tlm::BEGIN_REQ) {
55 sc_assert(active_tx ==
nullptr);
64 t += sc_time(clk_if ? clk_if->period() - 1_ps : SC_ZERO_TIME);
65 return tlm::TLM_UPDATED;
66 }
else if(phase == tlm::END_REQ) {
67 sc_assert(active_tx == &trans);
68 if(active_tx->has_mm())
71 return tlm::TLM_COMPLETED;
73 return tlm::TLM_ACCEPTED;
76 bool apb_target_b::get_direct_mem_ptr(payload_type& trans, tlm_dmi& dmi_data) {
77 trans.set_dmi_allowed(
false);
81 unsigned int apb_target_b::transport_dbg(payload_type& trans) {
return 0; }
83 void apb_target_b::response() {
85 mhndl = sc_get_current_process_handle();
87 tlm_phase phase{tlm::BEGIN_RESP};
89 auto ret = socket_bw->nb_transport_bw(*active_tx, phase, delay);
90 if((ret == tlm::TLM_UPDATED && phase == tlm::END_RESP) || ret == tlm::TLM_COMPLETED) {
91 if(active_tx->has_mm())
protocol engine implementations