20 #include <axi/axi_tlm.h>
22 #include <scc/fifo_w_cb.h>
24 #include <scc/report.h>
25 #include <tlm/scc/tlm_gp_shared.h>
26 #include <unordered_map>
33 inline std::ostream& operator<<(std::ostream& os,
34 const std::tuple<axi::fsm::fsm_handle*, axi::fsm::protocol_time_point_e>&) {
38 using axi::operator<<;
46 using phase_type = axi::axi_protocol_types::tlm_phase_type;
52 base(
size_t transfer_width,
bool coherent =
false,
53 axi::fsm::protocol_time_point_e wr_start = axi::fsm::RequestPhaseBeg);
66 tlm::tlm_sync_enum
nb_fw(
payload_type& trans, phase_type
const& phase, sc_core::sc_time& t);
75 tlm::tlm_sync_enum
nb_bw(
payload_type& trans, phase_type
const& phase, sc_core::sc_time& t);
111 SCCTRACE(instance_name) <<
"pushing sync event " << evt2str(e) <<
" for transaction " << *gp
112 <<
" (sync:" << cycles <<
")";
113 fsm_clk_queue.push_back(std::make_tuple(e, gp, cycles));
120 bool syncronize =
false) {
124 bool syncronize =
false) {
125 SCCTRACE(instance_name) <<
"pushing event " << evt2str(e) <<
" for transaction " << *gp <<
" (delay " << delay
127 fsm_event_queue.
notify(std::make_tuple(e, gp, syncronize), delay);
139 SCCTRACE(instance_name) <<
"reacting on event " << evt2str(
static_cast<unsigned>(event)) <<
" for trans "
141 auto fsm_hndl = active_fsm[trans];
143 SCCFATAL(instance_name) <<
"No valid FSM found for trans " << std::hex << trans;
144 throw std::runtime_error(
"No valid FSM found for trans");
146 react(event, fsm_hndl);
155 sc_core::sc_process_handle fsm_clk_queue_hndl;
157 size_t transfer_width_in_bytes;
159 const axi::fsm::protocol_time_point_e wr_start;
163 std::unordered_map<payload_type*, axi::fsm::fsm_handle*> active_fsm;
165 std::deque<axi::fsm::fsm_handle*> idle_fsm;
167 std::vector<std::unique_ptr<axi::fsm::fsm_handle>> allocated_fsm;
169 std::string instance_name;
171 sc_core::sc_event finish_evt;
tlm::tlm_generic_payload * get() const noexcept
Return the stored pointer.
TLM2.0 components modeling AHB.
base class of all AXITLM based adapters and interfaces.
void react(axi::fsm::protocol_time_point_e event, tlm::scc::tlm_gp_shared_ptr &trans)
triggers the FSM with event and given transaction
tlm::tlm_sync_enum nb_fw(payload_type &trans, phase_type const &phase, sc_core::sc_time &t)
triggers the FSM based on TLM phases in the forward path. Should be called from np_transport_fw of th...
void schedule(axi::fsm::protocol_time_point_e e, tlm::scc::tlm_gp_shared_ptr &gp, sc_core::sc_time delay, bool syncronize=false)
processes the fsm_sched_queue and propagates events to fsm_clk_queue. Should be registered as falling...
virtual void setup_callbacks(axi::fsm::fsm_handle *)=0
this function is called to add the callbacks to the fsm handle during creation. Needs to be implement...
base(size_t transfer_width, bool coherent=false, axi::fsm::protocol_time_point_e wr_start=axi::fsm::RequestPhaseBeg)
the constructor
void schedule(axi::fsm::protocol_time_point_e e, tlm::scc::tlm_gp_shared_ptr &gp, unsigned cycles)
processes the fsm_sched_queue and propagates events to fsm_clk_queue. Should be registered as falling...
void process_fsm_clk_queue()
processes the fsm_clk_queue and triggers the FSM accordingly. Should be registered as rising-edge clo...
tlm::tlm_sync_enum nb_bw(payload_type &trans, phase_type const &phase, sc_core::sc_time &t)
triggers the FSM based on TLM phases in the backward path. Should be called from np_transport_bw of t...
axi::fsm::fsm_handle * find_or_create(payload_type *gp=nullptr, bool ace=false)
retrieve the FSM handle based on the transaction passed. If non exist one will be created
virtual ~base()
the destructor
void process_fsm_event()
processes the fsm_event_queue and triggers FSM aligned
axi::axi_protocol_types::tlm_payload_type payload_type
aliases used in the class
virtual axi::fsm::fsm_handle * create_fsm_handle()=0
function to create a fsm_handle. Needs to be implemented by the derived class
void notify(const TYPE &entry, const sc_core::sc_time &t)
non-blocking push.