19 #ifndef SC_INCLUDE_DYNAMIC_PROCESSES
20 #define SC_INCLUDE_DYNAMIC_PROCESSES
24 #include <axi/fsm/base.h>
26 #include <scc/ordered_semaphore.h>
27 #include <sysc/kernel/sc_attribute.h>
28 #include <tlm/scc/pe/intor_if.h>
29 #include <unordered_map>
30 #include <unordered_set>
41 using payload_type = axi::axi_protocol_types::tlm_payload_type;
42 using phase_type = axi::axi_protocol_types::tlm_phase_type;
44 sc_core::sc_in<bool> clk_i{
"clk_i"};
46 sc_core::sc_export<tlm::scc::pe::intor_fw_b> fw_i{
"fw_i"};
48 sc_core::sc_port<tlm::scc::pe::intor_bw_b, 1, sc_core::SC_ZERO_OR_MORE_BOUND> bw_o{
"bw_o"};
67 void b_snoop(payload_type& trans, sc_core::sc_time& t);
69 tlm::tlm_sync_enum nb_transport_bw(payload_type& trans, phase_type& phase, sc_core::sc_time& t);
71 void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range){}
73 void set_clock_period(sc_core::sc_time clk_period) { this->clk_period = clk_period; }
75 size_t get_transferwith_in_bytes()
const {
return transfer_width_in_bytes; }
85 void transport(payload_type& trans,
bool blocking)
override;
99 void set_snoop_cb(std::function<
unsigned(payload_type& trans)> cb) { snoop_cb = cb; }
106 void snoop_resp(payload_type& trans,
bool sync =
false)
override;
122 void add_protocol_cb(axi::fsm::protocol_time_point_e e, std::function<
void(payload_type&,
bool)> cb) {
123 assert(e < axi::fsm::CB_CNT);
135 size_t transfer_width,
bool coherent =
false);
157 void process_snoop_resp();
159 unsigned thread_avail{0}, thread_active{0};
160 sc_core::sc_fifo<tlm::scc::tlm_gp_shared_ptr> dispatch_queue{
"dispatch_queue"};
161 sc_core::sc_port_b<axi::axi_fw_transport_if<axi_protocol_types>>& socket_fw;
162 std::deque<fsm::fsm_handle*> idle_proc;
165 sc_core::sc_process_handle snp_resp_queue_hndl;
167 sc_core::sc_time clk_period{1, sc_core::SC_NS};
168 std::function<unsigned(payload_type& trans)> snoop_cb;
169 std::array<std::function<void(payload_type&,
bool)>, axi::fsm::CB_CNT> protocol_cb;
170 sc_core::sc_clock* clk_if{
nullptr};
171 void end_of_elaboration()
override;
179 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
185 using phase_type = base::phase_type;
194 this->instance_name = name();
215 return base::nb_transport_bw(trans, phase, t);
223 return base::invalidate_direct_mem_ptr(start_range, end_range);
233 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
239 using phase_type = base::phase_type;
249 this->instance_name = name();
275 return base::nb_transport_bw(trans, phase, t);
283 return base::invalidate_direct_mem_ptr(start_range, end_range);
void b_snoop(payload_type &trans, sc_core::sc_time &t) override
forwarding function to the base class (due to inheritance)
simple_ace_initiator(const sc_core::sc_module_name &nm, axi::ace_initiator_socket< BUSWIDTH, TYPES, N, POL > &socket)
the constructor
void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range) override
forwarding function to the base class (due to inheritance)
tlm::tlm_sync_enum nb_transport_bw(payload_type &trans, phase_type &phase, sc_core::sc_time &t) override
forwarding function to the base class (due to inheritance)
void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range) override
forwarding function to the base class (due to inheritance)
simple_axi_initiator(const sc_core::sc_module_name &nm, axi::axi_initiator_socket< BUSWIDTH, TYPES, N, POL > &socket_)
the constructor
tlm::tlm_sync_enum nb_transport_bw(payload_type &trans, phase_type &phase, sc_core::sc_time &t) override
forwarding function to the base class (due to inheritance)
void setup_callbacks(axi::fsm::fsm_handle *) override
axi::fsm::fsm_handle * create_fsm_handle() override
void add_protocol_cb(axi::fsm::protocol_time_point_e e, std::function< void(payload_type &, bool)> cb)
register a callback for a certain time point
void snoop_resp(payload_type &trans, bool sync=false) override
triggers a non-blocking snoop response if the snoop callback does not do so.
sc_core::sc_attribute< unsigned > rd_data_accept_delay
the latency between between BEGIN(_PARTIAL)_RESP and END(_PARTIAL)_RESP (RVALID to RREADY)
sc_core::sc_attribute< unsigned > wr_resp_accept_delay
the latency between between BEGIN_RESP and END_RESP (BVALID to BREADY)
sc_core::sc_attribute< unsigned > ack_resp_delay
the latency between between BEGIN_RESP and END_RESP (BVALID to BREADY)
unsigned snoop_latency
the default snoop latency between request and response phase. Will be overwritten by the return of th...
sc_core::sc_attribute< unsigned > wr_data_beat_delay
the latency between between END(_PARTIAL)_REQ and BEGIN(_PARTIAL)_REQ (AWREADY to AWVALID and WREADY ...
void transport(payload_type &trans, bool blocking) override
The forward transport function. It behaves blocking and is re-entrant.
void set_snoop_cb(std::function< unsigned(payload_type &trans)> cb)
Set the snoop callback function.
The ordered_semaphore primitive channel class.
TLM2.0 components modeling AHB.
tlm::tlm_bw_transport_if< TYPES > axi_bw_transport_if
alias declaration for the backward interface:
tlm::tlm_fw_transport_if< TYPES > axi_fw_transport_if
alias declaration for the forward interface
The AXI protocol traits class. Since the protocoll defines additional non-ignorable phases a dedicate...
base class of all AXITLM based adapters and interfaces.
void process_fsm_clk_queue()
processes the fsm_clk_queue and triggers the FSM accordingly. Should be registered as rising-edge clo...
axi::axi_protocol_types::tlm_payload_type payload_type
aliases used in the class