17 #ifndef _BUS_APB_PE_APB_TARGET_H_
18 #define _BUS_APB_PE_APB_TARGET_H_
21 #include <scc/ordered_semaphore.h>
31 class apb_target_b :
public sc_core::sc_module,
public tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types> {
35 using payload_type = tlm::tlm_base_protocol_types::tlm_payload_type;
36 using phase_type = tlm::tlm_base_protocol_types::tlm_phase_type;
38 sc_core::sc_in<bool> clk_i{
"clk_i"};
40 void b_transport(payload_type& trans, sc_core::sc_time& t)
override;
42 tlm::tlm_sync_enum nb_transport_fw(payload_type& trans, phase_type& phase, sc_core::sc_time& t)
override;
44 bool get_direct_mem_ptr(payload_type& trans, tlm::tlm_dmi& dmi_data)
override;
46 unsigned int transport_dbg(payload_type& trans)
override;
57 void set_operation_cb(std::function<
unsigned(payload_type& trans)> cb) { operation_cb = cb; }
68 sc_core::sc_port_b<tlm::tlm_bw_transport_if<tlm::tlm_base_protocol_types>>& port,
size_t transfer_width);
80 tlm::tlm_generic_payload* active_tx{
nullptr};
82 sc_core::sc_port_b<tlm::tlm_bw_transport_if<tlm::tlm_base_protocol_types>>& socket_bw;
83 std::function<unsigned(payload_type& trans)> operation_cb;
84 sc_core::sc_clock* clk_if{
nullptr};
85 void end_of_elaboration()
override;
86 sc_core::sc_process_handle mhndl;
92 template <
unsigned int BUSWIDTH = 32,
typename TYPES = tlm::tlm_base_protocol_types,
int N = 1,
93 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
97 using payload_type = base::payload_type;
98 using phase_type = base::phase_type;
103 apb_target(tlm::tlm_target_socket<BUSWIDTH, TYPES, N, POL>& socket)
105 apb_target(sc_core::sc_gen_unique_name(
"simple_target"), socket) {}
107 apb_target(
const sc_core::sc_module_name& nm, tlm::tlm_target_socket<BUSWIDTH, TYPES, N, POL>& socket)
113 apb_target() =
delete;
115 apb_target(apb_target
const&) =
delete;
117 apb_target(apb_target&&) =
delete;
119 apb_target& operator=(apb_target
const&) =
delete;
121 apb_target& operator=(apb_target&&) =
delete;
124 tlm::tlm_target_socket<BUSWIDTH, TYPES, N, POL>& socket;
apb_target_b(const sc_core::sc_module_name &nm, sc_core::sc_port_b< tlm::tlm_bw_transport_if< tlm::tlm_base_protocol_types >> &port, size_t transfer_width)
void set_operation_cb(std::function< unsigned(payload_type &trans)> cb)
Set the operation callback function.
apb_target(tlm::tlm_target_socket< BUSWIDTH, TYPES, N, POL > &socket)
the constructor
TLM2.0 components modeling APB.