fix: response issue with ni

This commit is contained in:
juanmanuel 2024-11-14 06:47:31 -05:00
parent 11666fb586
commit 29775f9a5a
3 changed files with 12 additions and 13 deletions

View file

@ -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;

View file

@ -63,10 +63,10 @@ public:
tlm_utils::peq_with_cb_and_phase<NetworkInterfaceTlm> init_peq;
tlm_utils::peq_with_cb_and_phase<NetworkInterfaceTlm> target_peq;
tlm_gp* curr_req;
tlm_gp* nxt_resp_pend;
string ni_name;
bool resp_in_progress;
queue<tlm_gp*> nxt_resp_pend;
int credit_counter;
MemoryManager m_mm;
uint8_t max_pos[3];

View file

@ -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;
}
}