19 #include <axi/axi_tlm.h>
20 #include <axi/fsm/protocol_fsm.h>
21 #include <tlm/scc/pe/intor_if.h>
22 #include <scc/ordered_semaphore.h>
24 #include <scc/sc_variable.h>
25 #include <cci_configuration>
27 #include <tlm_utils/peq_with_get.h>
29 #include <unordered_map>
35 public sc_core::sc_module,
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"};
50 void b_snoop(payload_type& trans, sc_core::sc_time& t)
override;
52 tlm::tlm_sync_enum nb_transport_bw(payload_type& trans, phase_type& phase, sc_core::sc_time& t)
override;
54 void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)
override;
56 size_t get_transferwith_in_bytes()
const {
return transfer_width_in_bytes; }
66 void transport(payload_type& trans,
bool blocking)
override;
73 void snoop_resp(payload_type& trans,
bool sync =
false)
override;
76 size_t transfer_width, flavor_e flavor);
93 cci::cci_param<bool> data_interleaving{
"data_interleaving",
false};
95 cci::cci_param<unsigned>
artv{
"artv", 1};
97 cci::cci_param<unsigned>
awtv{
"awtv", 1};
99 cci::cci_param<unsigned>
wbv{
"wbv", 1};
101 cci::cci_param<unsigned>
rbr{
"rbr", 0};
103 cci::cci_param<unsigned>
br{
"br", 0};
105 cci::cci_param<unsigned>
rla{
"rla", 1};
107 cci::cci_param<unsigned>
ba{
"ba", 1};
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);
129 unsigned calculate_beats(payload_type& p) {
130 sc_assert(p.get_data_length() > 0);
131 return p.get_data_length() < transfer_width_in_bytes ? 1 : p.get_data_length() / transfer_width_in_bytes;
136 const size_t transfer_width_in_bytes;
138 const flavor_e flavor;
140 sc_core::sc_port_b<axi::axi_fw_transport_if<axi_protocol_types>>& socket_fw;
143 payload_type* active_tx{
nullptr};
146 std::unordered_map<void*, tx_state*> tx_state_by_tx;
147 std::unordered_map<unsigned, scc::ordered_semaphore*> id_mtx;
149 tlm_utils::peq_with_get<payload_type> snp_peq{
"snp_peq"};
151 std::unordered_map<void*, tx_state*> snp_state_by_id;
159 sc_core::sc_event any_tx_finished;
161 sc_core::sc_time clk_period{10, sc_core::SC_NS};
169 sc_core::sc_clock* clk_if{
nullptr};
170 void end_of_elaboration()
override;
171 void clk_counter() { m_clock_counter++; }
172 unsigned get_clk_cnt() {
return m_clock_counter; }
176 unsigned m_clock_counter{0};
177 unsigned m_prev_clk_cnt{0};
178 unsigned snoops_in_flight{0};
180 std::array<std::function<void(payload_type&,
bool)>, axi::fsm::CB_CNT> protocol_cb;
187 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
192 using payload_type = base::payload_type;
193 using phase_type = base::phase_type;
199 :
axi_initiator_b(nm, socket_.get_base_port(), BUSWIDTH, flavor_e::AXI)
222 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
227 using payload_type = base::payload_type;
228 using phase_type = base::phase_type;
234 :
axi_initiator_b(nm, socket_.get_base_port(), BUSWIDTH, flavor_e::ACEL)
257 sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND>
262 using payload_type = base::payload_type;
263 using phase_type = base::phase_type;
269 :
axi_initiator_b(nm, socket_.get_base_port(), BUSWIDTH, flavor_e::ACE)
ace_initiator(const sc_core::sc_module_name &nm, axi::ace_initiator_socket< BUSWIDTH, TYPES, N, POL > &socket_)
the constructor
ace_lite_initiator(const sc_core::sc_module_name &nm, axi::axi_initiator_socket< BUSWIDTH, TYPES, N, POL > &socket_)
the constructor
cci::cci_param< unsigned > rla
Read last data handshake to acknowledge.
cci::cci_param< unsigned > wbv
Write data handshake to next beat valid.
cci::cci_param< unsigned > br
Write response valid to ready.
void snoop_resp(payload_type &trans, bool sync=false) override
triggers a non-blocking snoop response if the snoop callback does not do so.
cci::cci_param< unsigned > outstanding_snoops
number of snoops which can be handled
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
cci::cci_param< unsigned > ba
Write response handshake to acknowledge.
cci::cci_param< unsigned > rbr
Read data valid to same beat ready.
cci::cci_param< unsigned > artv
Read address valid to next read address valid.
void transport(payload_type &trans, bool blocking) override
The forward transport function. It behaves blocking and is re-entrant.
cci::cci_param< unsigned > awtv
Write address valid to next write address valid.
cci::cci_param< bool > enable_id_serializing
Quirks enable.
axi_initiator(const sc_core::sc_module_name &nm, axi::axi_initiator_socket< BUSWIDTH, TYPES, N, POL > &socket_)
the constructor
The ordered_semaphore primitive channel class.
TLM2.0 components modeling AHB.
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...