コード例 #1
0
ファイル: wrappers_noc.cpp プロジェクト: ArchC/MPSoCBench
void wrapper_noc::b_transport(ac_tlm2_payload &payload,
                              sc_core::sc_time &time_info) {

  if (NOC_DEBUG)
    printf("\n\nB_TRANSPORT--> Wrapper %d,%d with status %d is receiving a "
           "package",
           getX(), getY(), getStatus());

  tlm_payload_extension *ex;
  // tlm::tlm_extension_base* base;
  // base = payload.get_extension(1);

  // ex = reinterpret_cast<tlm_payload_extension*>(base);
  payload.get_extension(ex);

  if (ex == NULL) {

    uint64_t addr = payload.get_address();
    int targetX, targetY;

    tableOfRouts.returnsTargetPosition(addr, targetX, targetY);

    ex = new tlm_payload_extension();
    ex->setTargetX(targetX);
    ex->setTargetY(targetY);
    ex->setInitX(getX());
    ex->setInitY(getY());
    ex->setDirection(FORWARD); // blocking transport has just FORWARD path

    // payload.set_extension(1,ex);
    payload.set_extension(ex);

    if (NOC_DEBUG)
      printf("\nB_TRANSPORT--> Wrapper %d,%d is transporting package INTO the "
             "NOC trought NODE_port",
             getX(), getY());
    NODE_port->b_transport(payload, time_info);

    payload.release_extension(ex);

  } else {
    if (NOC_DEBUG)
      printf("\nB_TRANSPORT--> Wrapper %d,%d is cleaning payload extension",
             getX(), getY());
    if (NOC_DEBUG)
      printf("\nB_TRANSPORT--> Wrapper %d,%d is trasporting package OUT of NOC "
             "trought LOCAL_port",
             getX(), getY());
    LOCAL_port->b_transport(payload, time_info);
  }

  if (NOC_DEBUG) {
    printf("\n(wrapper_noc::b_transport returning)");
  }
}
コード例 #2
0
ファイル: wrappers_noc.cpp プロジェクト: felippi/MPSoCBench
tlm::tlm_sync_enum wrapper_master_slave_to_noc::nb_transport_fw(ac_tlm2_payload& payload, tlm::tlm_phase& phase, sc_core::sc_time& time_info)
{

		
	tlm::tlm_sync_enum status;

	if (NOC_DEBUG) printf("\n\nNB_TRANSPORT_FW--> Wrapper %d,%d with status %d is receiving a package",getX(), getY(), getStatus());
 	
	
    tlm_payload_extension *ex;
  	payload.get_extension(ex);
	

	if (ex==NULL)
	{
		
		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW-->Wrapper %d,%d is creating payload extension",getX(),getY());
		
		ex = new tlm_payload_extension();

		uint64_t addr = payload.get_address();
		int targetX, targetY;
		tableOfRouts.returnsTargetPosition(addr, targetX, targetY);

		ex->setTargetX(targetX);
		ex->setTargetY(targetY);
		ex->setInitX(getX());
		ex->setInitY(getY());
		ex->setDirection(FORWARD);

		/* NUMBER OF PACKAGES */
		this->numberOfPackages ++;
		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW --> Wrapper %d,%d is incrementing the number of requests(%ld)",getX(), getY(),this->numberOfPackages); 	   			


		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW --> Wrapper %d,%d is setting the new extension into the payload",getX(),getY()); 	   	
		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW --> Wrapper %d,%d is setting firstForward with false into the payload extension",getX(),getY());
		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW-->Wrapper %d,%d is processing transaction from InitX-> %d InitY-> %d to TargetX-> %d TargetY-> %d", getX(), getY(), ex->getInitX(), ex->getInitY(), ex->getTargetX(), ex->getTargetY());				

		payload.set_extension(ex);
		
	}

	if (ex->isFirstForward())
	{	
		ex->setFirstForward(false);	
		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW--> Wrapper %d,%d is trasporting package INTO the NOC using non-blocking-forward transport trought NODE-init-socket", getX(), getY());

		status = NODE_init_socket->nb_transport_fw(payload,phase,time_info); 
		if (status != tlm::TLM_UPDATED)
		{
			printf("\nNB_TRANSPORT_FW--> Wrapper %d,%d TRANSPORT ERROR (2)", getX(), getY());
			exit(1);
		}

		#ifdef POWER_SIM
		#ifdef DFS_AUTO_SELECTION_CPU_RATE
		dfs->noteFwTime();
		#endif
		#endif
	
				
	}
	else
	{

		if (NOC_DEBUG)  printf("\nNB_TRANSPORT_FW--> Wrapper %d,%d is trasporting package out of NOC to the target using blocking-forward transport trought LOCAL-init-socket", getX(), getY());
		LOCAL_init_socket->b_transport(payload,time_info);
		if (payload.get_response_status() != tlm::TLM_OK_RESPONSE)
		{
			printf("\nNB_TRANSPORT_FW--> Wrapper %d,%d TRANSPORT ERROR (1)", getX(), getY());
			exit(1);
		}

		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW--> Wrapper %d,%d is transporting into the NOC using non-blocking-backward transport trought the NODE-target-socket",getX(), getY());
		status = this->nb_transport_bw(payload,phase,time_info);
		if (status != tlm::TLM_COMPLETED)
		{
			printf("\nNB_TRANSPORT_FW--> Wrapper %d,%d TRANSPORT ERROR (2)", getX(), getY());
			exit(1);
		}
	
	}

	

	if (NOC_DEBUG) printf("\n\nNB_TRANSPORT_FW --> Wrapper %d,%d is returning with status %d\n",getX(), getY(),tlm::TLM_UPDATED);
	phase = tlm::END_REQ;
	return status;
}