diff --git a/src/networkInterface/NetworkInterfaceTlm.cpp b/src/networkInterface/NetworkInterfaceTlm.cpp index ec57717..96d3a04 100755 --- a/src/networkInterface/NetworkInterfaceTlm.cpp +++ b/src/networkInterface/NetworkInterfaceTlm.cpp @@ -33,8 +33,7 @@ NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node, credit_counter(NUM_CREDITS), ni_name(nm), init_peq(this, &NetworkInterfaceTlm::init_peq_cb), target_peq(this, &NetworkInterfaceTlm::target_peq_cb), - curr_req(0), resp_in_progress(false), - nxt_resp_pend(0) { + curr_req(0), resp_in_progress(false) { sc_report_handler::set_actions(NI_LOG, SC_INFO, SC_LOG|SC_DISPLAY); try { this->id = node.id%(globalResources.nodes.size()/2); @@ -424,11 +423,8 @@ void NetworkInterfaceTlm::receive_and_process_flit(tlm_gp& trans){ // send response if not type stream if(get_type_name(p->dataType) != TYPE_STREAM){ if(resp_in_progress) { - if(nxt_resp_pend){ - log_fatal("Attempt to have two pending responses in target"); - } log_info("Previous response transaction still in progress, scheduling it for next time"); - nxt_resp_pend = &trans; + nxt_resp_pend.push(&trans); } else{ send_response(trans); } } @@ -454,9 +450,10 @@ void NetworkInterfaceTlm::target_peq_cb(tlm_gp& trans, const tlm::tlm_phase& pha update_credits(trans, 1); // Target itself is now clear to issue the next BEGIN_RESP resp_in_progress = false; - if (nxt_resp_pend){ - send_response(*nxt_resp_pend); - nxt_resp_pend = 0; + if ( !nxt_resp_pend.empty() ){ + log_info("Issuing next response"); + send_response(*nxt_resp_pend.front()); + nxt_resp_pend.pop(); } break; diff --git a/src/networkInterface/NetworkInterfaceTlm.h b/src/networkInterface/NetworkInterfaceTlm.h index d5f81b3..20e535f 100755 --- a/src/networkInterface/NetworkInterfaceTlm.h +++ b/src/networkInterface/NetworkInterfaceTlm.h @@ -63,10 +63,10 @@ public: tlm_utils::peq_with_cb_and_phase init_peq; tlm_utils::peq_with_cb_and_phase target_peq; tlm_gp* curr_req; - tlm_gp* nxt_resp_pend; string ni_name; bool resp_in_progress; + queue nxt_resp_pend; int credit_counter; MemoryManager m_mm; uint8_t max_pos[3]; diff --git a/src/router/router.cpp b/src/router/router.cpp index 73b31e9..b5c0beb 100755 --- a/src/router/router.cpp +++ b/src/router/router.cpp @@ -213,10 +213,12 @@ void TlmRouter::start_pend_req(int rel_link, tlm_gp& trans){ tlm_gp* nxt_trans = nxt_send_data_pend[dir].front(); bool data_sent = send_data(dir, rel_link, *nxt_trans); if (!data_sent){ - log_error(dir, trans, "Credit counter was freed, but data can't be sent"); + log_warn(dir, trans, "Credit counter was freed, but data can't be sent"); + } + else{ + send_data_in_prog_dest[dir].pop(); + nxt_send_data_pend[dir].pop(); } - send_data_in_prog_dest[dir].pop(); - nxt_send_data_pend[dir].pop(); break; } }