fix: use of only one ni for both normal noc and circuit switching noc
This commit is contained in:
parent
ae0665f69e
commit
604ee46418
3 changed files with 80 additions and 9 deletions
|
@ -61,6 +61,11 @@ NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node,
|
|||
&NetworkInterfaceTlm::nb_transport_bw_cb, 0);
|
||||
target.register_nb_transport_fw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_fw_cb, 0);
|
||||
|
||||
initiator_cs.register_nb_transport_bw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_bw_cb, 0);
|
||||
target_cs.register_nb_transport_fw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_fw_cb, 0);
|
||||
}
|
||||
|
||||
NetworkInterfaceTlm::~NetworkInterfaceTlm() {
|
||||
|
@ -157,7 +162,43 @@ void NetworkInterfaceTlm::send_flit(Packet* p, Flit* f){
|
|||
|
||||
sc_time delay = sc_time(REQ_INIT_DELAY, UNITS_DELAY);
|
||||
tlm::tlm_phase send_phase = tlm::BEGIN_REQ;
|
||||
|
||||
if(p->dataType == TYPE_STREAM){
|
||||
initiator_cs->nb_transport_fw(*trans, send_phase, delay);
|
||||
}
|
||||
else{
|
||||
initiator->nb_transport_fw(*trans, send_phase, delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool NetworkInterfaceTlm::check_cs_needed(tlm_gp& trans){
|
||||
int type = get_type_from_extension(trans);
|
||||
return type == TYPE_INIT_STREAM || type == TYPE_END_STREAM;
|
||||
};
|
||||
|
||||
void NetworkInterfaceTlm::send_cs_rout_conf_msg(tlm_gp& trans){
|
||||
tlm::tlm_generic_payload* new_trans = m_mm.allocate();
|
||||
new_trans->acquire();
|
||||
new_trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||
new_trans->set_address(trans.get_address());
|
||||
new_trans->set_data_ptr(trans.get_data_ptr());
|
||||
new_trans->set_data_length(trans.get_data_length());
|
||||
new_trans->set_streaming_width(trans.get_streaming_width());
|
||||
new_trans->set_byte_enable_ptr(trans.get_byte_enable_ptr());
|
||||
new_trans->set_dmi_allowed(false);
|
||||
new_trans->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
|
||||
|
||||
// add id to new_transaction
|
||||
link_extension* ext = new link_extension();
|
||||
ext->link = dest_link; // set direction of connected router
|
||||
ext->data_type = get_type_from_extension(trans);
|
||||
new_trans->set_extension(ext);
|
||||
|
||||
// send transaction in socket
|
||||
tlm_phase phase = BEGIN_REQ;
|
||||
sc_time delay = sc_time(REQ_INIT_DELAY, UNITS_DELAY);
|
||||
initiator_cs->nb_transport_fw(*new_trans, phase, delay);
|
||||
}
|
||||
|
||||
void NetworkInterfaceTlm::send_data_to_noc(){
|
||||
|
@ -300,6 +341,7 @@ void NetworkInterfaceTlm::receive_and_process_flit(tlm_gp& trans){
|
|||
p->inTransmit.erase(position);
|
||||
p->transmitted.push_back(received_flit->id);
|
||||
|
||||
// log arrived flit
|
||||
if (received_flit->type==TAIL || received_flit->type==SINGLE){
|
||||
stringstream ss;
|
||||
string flit_type = received_flit->type==SINGLE ? "Single":"Tail";
|
||||
|
@ -317,6 +359,13 @@ void NetworkInterfaceTlm::receive_and_process_flit(tlm_gp& trans){
|
|||
packet_recv_queue.push(p);
|
||||
credit_counter++;
|
||||
|
||||
// send configuration message to cs_router
|
||||
if(check_cs_needed(link, trans)){
|
||||
send_cs_rout_conf_msg(trans);
|
||||
}
|
||||
|
||||
// send response if not type stream
|
||||
if(p->dataType != TYPE_STREAM){
|
||||
if(resp_in_progress) {
|
||||
if(nxt_resp_pend){
|
||||
log_fatal("Attempt to have two pending responses in target");
|
||||
|
@ -324,6 +373,7 @@ void NetworkInterfaceTlm::receive_and_process_flit(tlm_gp& trans){
|
|||
}
|
||||
}
|
||||
else{ send_response(trans); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -375,7 +425,9 @@ tlm::tlm_sync_enum NetworkInterfaceTlm::send_end_req(tlm_gp& trans){
|
|||
}
|
||||
|
||||
// Queue internal event to mark beginning of response
|
||||
delay = delay + sc_time(INTERN_PROC_DELAY, UNITS_DELAY); // Latency
|
||||
delay = p->dataType != 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);
|
||||
|
||||
return status;
|
||||
|
|
|
@ -70,6 +70,9 @@ public:
|
|||
Dir send_data_in_prog_dest;
|
||||
MemoryManager m_mm;
|
||||
uint8_t max_pos[3];
|
||||
// To Circuit Switching NoC
|
||||
ni_init_socket initiator_cs;
|
||||
ni_targ_socket target_cs;
|
||||
|
||||
sc_event_or_list ev_msg_arrv;
|
||||
|
||||
|
@ -122,6 +125,22 @@ public:
|
|||
*/
|
||||
tlm_gp* build_transaction(Packet* p, Flit* f);
|
||||
|
||||
/**
|
||||
* If message is init streaming, a router_cs needs to be
|
||||
* configured
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
bool check_cs_needed(tlm_gp& trans);
|
||||
|
||||
/**
|
||||
* Sends configuration message to router_cs
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
bool send_cs_rout_conf_msg(tlm_gp& trans);
|
||||
|
||||
|
||||
/**
|
||||
* Generates flits when a packet arrives
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue