17 #include "apb_target.h"
18 #include <scc/report.h>
22 using namespace sc_core;
30 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,
31 size_t transfer_width)
36 sensitive << clk_i.pos();
39 void apb_target_b::end_of_elaboration() { clk_if =
dynamic_cast<sc_core::sc_clock*
>(clk_i.get_interface()); }
41 void apb_target_b::b_transport(payload_type& trans, sc_time& t) {
44 trans.set_dmi_allowed(
false);
45 trans.set_response_status(tlm::TLM_OK_RESPONSE);
46 clk_if =
dynamic_cast<sc_core::sc_clock*
>(clk_i.get_interface());
48 t += 1 * clk_if->period();
52 tlm_sync_enum apb_target_b::nb_transport_fw(payload_type& trans, phase_type& phase, sc_time& t) {
53 if(phase == tlm::BEGIN_REQ) {
54 sc_assert(active_tx ==
nullptr);
63 t += sc_time(clk_if ? clk_if->period() - 1_ps : SC_ZERO_TIME);
64 return tlm::TLM_UPDATED;
65 }
else if(phase == tlm::END_REQ) {
66 sc_assert(active_tx == &trans);
67 if(active_tx->has_mm())
70 return tlm::TLM_COMPLETED;
72 return tlm::TLM_ACCEPTED;
75 bool apb_target_b::get_direct_mem_ptr(payload_type& trans, tlm_dmi& dmi_data) {
76 trans.set_dmi_allowed(
false);
80 unsigned int apb_target_b::transport_dbg(payload_type& trans) {
return 0; }
82 void apb_target_b::response() {
84 mhndl = sc_get_current_process_handle();
86 tlm_phase phase{tlm::BEGIN_RESP};
88 auto ret = socket_bw->nb_transport_bw(*active_tx, phase, delay);
89 if((ret == tlm::TLM_UPDATED && phase == tlm::END_RESP) || ret == tlm::TLM_COMPLETED) {
90 if(active_tx->has_mm())
protocol engine implementations