scc  2022.4.0
SystemC components library
axi::pe::simple_initiator_b Class Reference

#include <simple_initiator.h>

Inheritance diagram for axi::pe::simple_initiator_b:
Collaboration diagram for axi::pe::simple_initiator_b:

Public Types

using payload_type = axi::axi_protocol_types::tlm_payload_type
 
using phase_type = axi::axi_protocol_types::tlm_phase_type
 

Public Member Functions

void b_snoop (payload_type &trans, sc_core::sc_time &t)
 
tlm::tlm_sync_enum nb_transport_bw (payload_type &trans, phase_type &phase, sc_core::sc_time &t)
 
void invalidate_direct_mem_ptr (sc_dt::uint64 start_range, sc_dt::uint64 end_range)
 
void set_clock_period (sc_core::sc_time clk_period)
 
size_t get_transferwith_in_bytes () const
 
void transport (payload_type &trans, bool blocking) override
 The forward transport function. It behaves blocking and is re-entrant. More...
 
void set_snoop_cb (std::function< unsigned(payload_type &trans)> cb)
 Set the snoop callback function. More...
 
void snoop_resp (payload_type &trans, bool sync=false) override
 triggers a non-blocking snoop response if the snoop callback does not do so. More...
 
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 More...
 

Public Attributes

sc_core::sc_in< bool > clk_i {"clk_i"}
 
sc_core::sc_export< tlm::scc::pe::intor_fw_bfw_i {"fw_i"}
 
sc_core::sc_port< tlm::scc::pe::intor_bw_b, 1, sc_core::SC_ZERO_OR_MORE_BOUND > bw_o {"bw_o"}
 
sc_core::sc_attribute< unsigned > wr_data_beat_delay {"wr_data_beat_delay", 0}
 the latency between between END(_PARTIAL)_REQ and BEGIN(_PARTIAL)_REQ (AWREADY to AWVALID and WREADY to WVALID)
 
sc_core::sc_attribute< unsigned > rd_data_accept_delay {"rd_data_accept_delay", 0}
 the latency between between BEGIN(_PARTIAL)_RESP and END(_PARTIAL)_RESP (RVALID to RREADY)
 
sc_core::sc_attribute< unsigned > wr_resp_accept_delay {"wr_resp_accept_delay", 0}
 the latency between between BEGIN_RESP and END_RESP (BVALID to BREADY)
 
sc_core::sc_attribute< unsigned > ack_resp_delay {"ack_resp_delay", 0}
 the latency between between BEGIN_RESP and END_RESP (BVALID to BREADY)
 
unsigned snoop_latency {1}
 the default snoop latency between request and response phase. Will be overwritten by the return of the callback function (if registered) More...
 

Protected Member Functions

 simple_initiator_b (const sc_core::sc_module_name &nm, sc_core::sc_port_b< axi::axi_fw_transport_if< axi_protocol_types >> &port, size_t transfer_width, bool coherent=false)
 
 simple_initiator_b (simple_initiator_b const &)=delete
 
 simple_initiator_b (simple_initiator_b &&)=delete
 
simple_initiator_boperator= (simple_initiator_b const &)=delete
 
simple_initiator_boperator= (simple_initiator_b &&)=delete
 
void fsm_clk_method ()
 
axi::fsm::fsm_handlecreate_fsm_handle () override
 
void setup_callbacks (axi::fsm::fsm_handle *) override
 
void process_snoop_resp ()
 
void end_of_elaboration () override
 
void cbpeq_cb ()
 
- Protected Member Functions inherited from axi::fsm::base
 base (size_t transfer_width, bool coherent=false, axi::fsm::protocol_time_point_e wr_start=axi::fsm::RequestPhaseBeg)
 the constructor More...
 
virtual ~base ()
 the destructor
 
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 the respective derived class More...
 
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 the respective derived class More...
 
axi::fsm::fsm_handlefind_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 More...
 
void process_fsm_event ()
 processes the fsm_event_queue and triggers FSM aligned
 
void process_fsm_clk_queue ()
 processes the fsm_clk_queue and triggers the FSM accordingly. Should be registered as rising-edge clock callback
 
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-edge clock callback
 
void schedule (axi::fsm::protocol_time_point_e e, payload_type *gp, unsigned cycles)
 
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-edge clock callback
 
void schedule (axi::fsm::protocol_time_point_e e, payload_type *gp, sc_core::sc_time delay, bool syncronize=false)
 
void react (axi::fsm::protocol_time_point_e event, tlm::scc::tlm_gp_shared_ptr &trans)
 triggers the FSM with event and given transaction More...
 
void react (axi::fsm::protocol_time_point_e event, payload_type *trans)
 
void react (axi::fsm::protocol_time_point_e, axi::fsm::fsm_handle *)
 

Protected Attributes

unsigned thread_avail {0}
 
unsigned thread_active {0}
 
sc_core::sc_fifo< tlm::scc::tlm_gp_shared_ptrdispatch_queue {"dispatch_queue"}
 
sc_core::sc_port_b< axi::axi_fw_transport_if< axi_protocol_types > > & socket_fw
 
std::deque< fsm::fsm_handle * > idle_proc
 
::scc::ordered_semaphore rd {1}
 
::scc::ordered_semaphore wr {1}
 
::scc::ordered_semaphore snp {1}
 
::scc::fifo_w_cb< std::tuple< axi::fsm::protocol_time_point_e, payload_type *, unsigned > > snp_resp_queue
 
sc_core::sc_process_handle snp_resp_queue_hndl
 
sc_core::sc_time clk_period {1, sc_core::SC_NS}
 
std::function< unsigned(payload_type &trans)> snoop_cb
 
std::array< std::function< void(payload_type &, bool)>, axi::fsm::CB_CNT > protocol_cb
 
sc_core::sc_clock * clk_if {nullptr}
 
scc::peq< std::tuple< axi::fsm::protocol_time_point_e, tlm::scc::tlm_gp_shared_ptr, bool > > cbpeq
 
- Protected Attributes inherited from axi::fsm::base
::scc::peq< std::tuple< axi::fsm::protocol_time_point_e, payload_type *, bool > > fsm_event_queue
 
::scc::fifo_w_cb< std::tuple< axi::fsm::protocol_time_point_e, payload_type *, unsigned > > fsm_clk_queue
 
sc_core::sc_process_handle fsm_clk_queue_hndl
 
size_t transfer_width_in_bytes
 
const axi::fsm::protocol_time_point_e wr_start
 
const bool coherent
 
std::unordered_map< payload_type *, axi::fsm::fsm_handle * > active_fsm
 
std::deque< axi::fsm::fsm_handle * > idle_fsm
 
std::vector< std::unique_ptr< axi::fsm::fsm_handle > > allocated_fsm
 
std::string instance_name
 
sc_core::sc_event finish_evt
 

Additional Inherited Members

- Protected Types inherited from axi::fsm::base
using payload_type = axi::axi_protocol_types::tlm_payload_type
 aliases used in the class
 
using phase_type = axi::axi_protocol_types::tlm_phase_type
 

Detailed Description

the initiator protocol engine base class

Definition at line 39 of file simple_initiator.h.

Constructor & Destructor Documentation

◆ simple_initiator_b()

simple_initiator_b::simple_initiator_b ( const sc_core::sc_module_name &  nm,
sc_core::sc_port_b< axi::axi_fw_transport_if< axi_protocol_types >> &  port,
size_t  transfer_width,
bool  coherent = false 
)
explicitprotected

the constructor. Protected as it should only be called by derived classes

Parameters
port
transfer_width

Definition at line 35 of file simple_initiator.cpp.

Member Function Documentation

◆ add_protocol_cb()

void axi::pe::simple_initiator_b::add_protocol_cb ( axi::fsm::protocol_time_point_e  e,
std::function< void(payload_type &, bool)>  cb 
)
inline

register a callback for a certain time point

This function allows to register a callback for certain time points of a transaction (see #axi::fsm::protocol_time_point_e). The callback will be invoked after the FSM-actions are executed.

Parameters
ethe timepoint
cbthe callback taking a reference to the transaction and a bool indicating a snoop if true

Definition at line 122 of file simple_initiator.h.

◆ create_fsm_handle()

axi::fsm::fsm_handle * axi::pe::simple_initiator_b::create_fsm_handle ( )
overrideprotectedvirtual
See also
base::create_fsm_handle()

Implements axi::fsm::base.

Definition at line 90 of file simple_initiator.cpp.

◆ set_snoop_cb()

void axi::pe::simple_initiator_b::set_snoop_cb ( std::function< unsigned(payload_type &trans)>  cb)
inline

Set the snoop callback function.

This callback is invoked once a snoop transaction arrives. This function shall return the latency for the snoop response. If the response is std::numeric_limits<unsigned>::max() not snoop response will be triggered. This needs to be done by a call to snoop_resp()

Todo:

refine API

handing in a pointer is a hack to work around a bug in gcc 4.8 not allowing to copy std::function objects and should be fixed

Parameters
cbthe callback function

Definition at line 99 of file simple_initiator.h.

◆ setup_callbacks()

void axi::pe::simple_initiator_b::setup_callbacks ( axi::fsm::fsm_handle fsm_hndl)
overrideprotectedvirtual
See also
base::setup_callbacks(axi::fsm::fsm_handle*)

Implements axi::fsm::base.

Definition at line 92 of file simple_initiator.cpp.

◆ snoop_resp()

void simple_initiator_b::snoop_resp ( payload_type trans,
bool  sync = false 
)
overridevirtual

triggers a non-blocking snoop response if the snoop callback does not do so.

Parameters
trans
syncwhen true send response with next rising clock edge otherwise send immediately

Implements tlm::scc::pe::intor_fw< type::BL >.

Definition at line 322 of file simple_initiator.cpp.

◆ transport()

void simple_initiator_b::transport ( payload_type trans,
bool  blocking 
)
overridevirtual

The forward transport function. It behaves blocking and is re-entrant.

This function initiates the forward transport either using b_transport() if blocking=true or the nb_transport_* interface.

Parameters
transthe transaction to send
blockingexecute in using the blocking interface

Implements tlm::scc::pe::intor_fw< type::BL >.

Definition at line 67 of file simple_initiator.cpp.

Member Data Documentation

◆ snoop_latency

unsigned axi::pe::simple_initiator_b::snoop_latency {1}

the default snoop latency between request and response phase. Will be overwritten by the return of the callback function (if registered)

Todo:
this is a hack and should be fixed

Definition at line 112 of file simple_initiator.h.


The documentation for this class was generated from the following files: