diff --git a/src/networkInterface/NetworkInterfaceTlm.cpp b/src/networkInterface/NetworkInterfaceTlm.cpp index ca6c4ab..622e7a2 100755 --- a/src/networkInterface/NetworkInterfaceTlm.cpp +++ b/src/networkInterface/NetworkInterfaceTlm.cpp @@ -473,11 +473,12 @@ void NetworkInterfaceTlm::target_peq_cb(tlm_gp& trans, const tlm::tlm_phase& pha } tlm::tlm_sync_enum NetworkInterfaceTlm::send_end_req(tlm_gp& trans){ + string type_name = get_type_name(get_type_from_extension(trans)); // Queue the acceptance and the response with the appropriate latency tlm::tlm_phase bw_phase = tlm::END_REQ; sc_time delay = sc_time(REQ_END_DELAY, UNITS_DELAY); // Accept delay - - tlm::tlm_sync_enum status = (*target[0])->nb_transport_bw(trans, + int lay = type_name == TYPE_STREAM ? 1:0; + tlm::tlm_sync_enum status = (*target[lay])->nb_transport_bw(trans, bw_phase, delay); if (status == tlm::TLM_COMPLETED) { trans.release(); @@ -486,8 +487,7 @@ tlm::tlm_sync_enum NetworkInterfaceTlm::send_end_req(tlm_gp& trans){ } // Queue internal event to mark beginning of response - int type = get_type_from_extension(trans); - delay = get_type_name(type) != TYPE_STREAM ? + delay = type_name != TYPE_STREAM ? delay + sc_time(INTERN_PROC_DELAY, UNITS_DELAY) : SC_ZERO_TIME; // no processing on stream target_peq.notify(trans, INTERNAL_PROC_PHASE, delay); diff --git a/src/router/router.h b/src/router/router.h index 1eceb1b..7e73e2b 100755 --- a/src/router/router.h +++ b/src/router/router.h @@ -143,7 +143,7 @@ class TlmRouter : public sc_module{ * @param trans TLM generic payload object * @param phase TLM current phase */ - void init_peq_cb(tlm_gp& trans, const tlm_phase& phase); + virtual void init_peq_cb(tlm_gp& trans, const tlm_phase& phase); /** * Callback target Payload Event Queue (PEQ) diff --git a/src/router/router_cs.cpp b/src/router/router_cs.cpp index 0d3db70..d63f360 100755 --- a/src/router/router_cs.cpp +++ b/src/router/router_cs.cpp @@ -97,9 +97,20 @@ void TlmRouterCS::configure_router(int link, tlm_gp& trans){ tlm_sync_enum TlmRouterCS::nb_transport_bw_cb(int id, tlm_gp& trans, tlm_phase& phase, sc_time& delay) { log_info(id, trans, "Backward transport callback start CS"); + init_peq.notify(trans, phase, delay); return TLM_ACCEPTED; } +void TlmRouterCS::init_peq_cb(tlm_gp& trans, const tlm_phase& phase){ + int link = get_link_from_extension(trans); + log_info(link,trans, "Initiator PEQ callback start"); + log_info(link,trans, "Phase "+string(phase.get_name())+" received"); + if (phase != END_REQ){ + log_error(link,trans,"Illegal transaction phase received by initiator"); + } + check_transaction(link, trans); +} + /******************* TARGET SOCKET FUNCTIONS ********************/ void TlmRouterCS::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){ int link = DIR::getOppositeDir(get_link_from_extension(trans)); diff --git a/src/router/router_cs.h b/src/router/router_cs.h index 58d3679..584c3a7 100755 --- a/src/router/router_cs.h +++ b/src/router/router_cs.h @@ -116,6 +116,14 @@ class TlmRouterCS : public TlmRouter{ tlm_sync_enum nb_transport_bw_cb(int id, tlm_gp& trans, tlm_phase& phase, sc_time& delay) override; + /** + * Callback initiator Payload Event Queue (PEQ) + * + * @param trans TLM generic payload object + * @param phase TLM current phase + */ + void init_peq_cb(tlm_gp& trans, const tlm_phase& phase) override; + /** * Callback target Payload Event Queue (PEQ) *