Esempio n. 1
0
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)");
  }
}
Esempio n. 2
0
void tlm_dir::b_transport( ac_tlm2_payload &payload, sc_core::sc_time &time_info ) {
   
   tlm_payload_dir_extension *payloadExt;
   time_info = time_info + sc_core::sc_time(1,SC_NS);
   int nCache=-1; 
   bool validation=false;

   tlm::tlm_extension_base* base;
   base = payload.get_extension(0);

   payloadExt = reinterpret_cast<tlm_payload_dir_extension*>(base);

   if(payloadExt != 0)
   {
	    nCache = payloadExt->getnumberCache(); //id do processador
		uint32_t address =-1;
		address= payloadExt->getAddress(); //endereco do dado armazenado
		int cacheIndex = payloadExt->getCacheIndex(); //indice do vetor da cache
		int rule = payloadExt->getRule(); //comando requisitado
		if(rule == 0){
			int nWay = payloadExt->getNWay();
			int index_size = payloadExt->getIndex_size();
			dir->start(nWay, index_size);
		}
		if(rule == 1) //Cache leu dado da memoria, atualizar valor no diretorio
		{
			dir->validate(nCache, address, cacheIndex);
		}
		if(rule==2) //aconteceu escrita na memoria, invalidar todos os outros processadores diferentes de nCache
		{
			dir->unvalidate(nCache, address, cacheIndex);
		}
		if(rule == 3) //Verificar se dado da cache esta Valido
		{
			validation = dir->checkValidation(nCache, address, cacheIndex);
			payloadExt->setValidation(validation);
		}
	}
   tlm_command command = payload.get_command();
   uint32_t addr = (uint32_t) payload.get_address();
  
   unsigned char* data_pointer = payload.get_data_ptr();
  
   unsigned int len = payload.get_data_length();
   
   unsigned int resp;

   payload.set_response_status(tlm::TLM_OK_RESPONSE);    
   

   return;
    
  }
Esempio n. 3
0
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;
}
Esempio n. 4
0
tlm::tlm_sync_enum wrapper_master_slave_to_noc::nb_transport_bw(ac_tlm2_payload& payload, tlm::tlm_phase& phase, sc_core::sc_time& time_info)
{

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

	tlm_payload_extension *ex;
  	payload.get_extension(ex);
	
	
	if (ex == NULL)  {
		printf("\n\nNB_TRANSPORT_BW ERROR --> Wrapper %d,%d is processing a NULL payload extension",getX(),getY());
		exit(1);
	}

	if (ex->isFirstBackward())
	{
		ex->setFirstBackward(false);
		ex->setDirection(BACKWARD);
		ex->exchangeXY();
		phase = tlm::TLM_COMPLETED;

		if (NOC_DEBUG) printf("\n\nNB_TRANSPORT_BW --> Wrapper %d,%d is setting firstBackward with false into the payload extension",getX(),getY());
		if (NOC_DEBUG) printf("\nNB_TRANSPORT_BW--> Wrapper %d,%d is trasporting package INTO the NOC using non-blocking-backward transport trought NODE-target-socket", getX(), getY());
		
		status = NODE_target_socket->nb_transport_bw(payload,phase,time_info); 
		if (NOC_DEBUG) printf("\n\nNB_TRANSPORT_BW --> Wrapper %d,%d is returning\n",getX(), getY());
		phase = tlm::END_RESP;
		return status;
	}
	else
	{

		//printf("\ncpu_wait_time: %.10lf", cpu_wait_time);

		if (NOC_DEBUG) printf("\nNB_TRANSPORT_BW--> Wrapper %d,%d is cleaning payload extension", getX(), getY());
		
		/*NUMBER OF HOPS*/
		this->numberOfHops += ex->getNumberOfHops();
		if (NOC_DEBUG) printf("\nNB_TRANSPORT_FW --> Wrapper %d,%d is updating the number of hops (%ld)",getX(), getY(),this->getNumberOfHops());
		/*NUMBER OF HOPS*/


		if (NOC_DEBUG) printf("\nNB_TRANSPORT_BW--> Wrapper %d,%d is trasporting package OUT of NOC using non-blocking-backward transport trought LOCAL-target-socket", getX(), getY());
		status = LOCAL_target_socket->nb_transport_bw(payload,phase,time_info); 
		if (status != tlm::TLM_COMPLETED)
		{
			printf("\nNB_TRANSPORT_BW--> Wrapper %d,%d TRANSPORT ERROR", getX(), getY());
			exit(1);
		}
		phase = tlm::END_RESP;


		#ifdef POWER_SIM
		#ifdef DFS_AUTO_SELECTION_CPU_RATE
		dfs->noteBwTime();
		dfs->autoSelectionCPUrate();
		#endif
		#ifdef DFS_AUTO_SELECTION_ENERGY_STAMP
		dfs->autoSelectionEnergyStamp();
		#endif
		#endif

		return status;
	}

	
}