Пример #1
0
int main(void) {
	//initialize
	int i;
	unsigned row, col, delay, num;
	unsigned *ivt;

	e_irq_global_mask(E_FALSE);
	e_irq_attach(E_WAND_INT, wand_isr);
	e_irq_mask(E_WAND_INT, E_FALSE);

	row     = e_group_config.core_row;
	col     = e_group_config.core_col;
	num     = row * e_group_config.group_cols + col;
	pause   = (volatile uint32_t *) (0x7000);
	result  = (volatile unsigned *) (0x8f000000 + 0x4*num);
	delay   = 0x2000 * num + 0x2000;

	if (num == 0)
		*pause = 0;

	*result = 0xdeadbeef;

	for(i=0; i<0x10000; i++)
	{
		*result = i;
		e_wait(E_CTIMER_0, delay);

		if (num == 0)
			while ((*pause));


		__asm__ __volatile__("wand");
		__asm__ __volatile__("idle");

		// clear wand bit
		state = e_reg_read(E_REG_STATUS);
		state = state & (~0x8);
		e_reg_write(E_REG_FSTATUS, state);
	}

	return EXIT_SUCCESS;
}
Пример #2
0
int main () {
  
  e_coreid_t coreid;
  unsigned int row, col, core, trow, tcol, *ec;
  volatile msg_block_t *msg = (msg_block_t *) BUF_ADDRESS;
  
  e_ctimer_set(E_CTIMER_0, 0xffffffff);
  e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
 
  ec = (unsigned int *) 0x4000;
  *ec = 0;
  
  coreid = e_get_coreid();
  e_coords_from_coreid(coreid, &row, &col);
   
  core = row*e_group_config.group_cols + col;
  
  srand(msg->shared_msg[core].seed);
  msg->shared_msg[core].seed = msg->shared_msg[core].seed + 10;
  
  trow = ((core + 1) % E_GROUP_CORES) / e_group_config.group_rows;
  tcol =  (core + 1) % e_group_config.group_cols;
  
  ec = e_get_global_address(trow, tcol, ec);
  e_write(&e_group_config, &coreid, 0, 0, ec, sizeof(e_coreid_t));
  /**ec = coreid;*/
  msg->shared_msg[core].msg = e_coreid_from_coords(trow, tcol);
  msg->shared_msg[core].external = *(unsigned int *) 0x4000;
    
  /* Sync */
  e_wait(E_CTIMER_1, 2000); 
  msg->shared_msg[core].timer = 0xffffffff - e_ctimer_get(E_CTIMER_0);
  msg->shared_msg[core].coreid = coreid;

  e_ctimer_stop(E_CTIMER_0);
  
  return 0;
  
}
Пример #3
0
int main(void) {
	//initialize
	int *p0, *p1, *p2;
	int core_num, value, fault;
	unsigned conf;
	int i,j,k,co;
//	co = 0;
	fault = 0;

	for(i=0;i<4;i++) 
	{
		for(j=0;j<4;j++) 
		{
			core_num = i * 4 + j;
			//initialize the target mem
			p2  = e_get_global_address(i,j,(void *)target);
			*p2 = 0x0;
			p1  = e_get_global_address(i,j,(void *)E_REG_MULTICAST);
/*			
			switch(core_num)
			{
				case  0: *p1 = _Z; break;
				case  1: *p1 = _X; break;
				case  2: *p1 = _Y; break;
				case  3: *p1 = _Z; break;
				case  4: *p1 = _W; break;
				case  5: *p1 = _Y; break;
				case  6: *p1 = _Z; break;
				case  7: *p1 = _W; break;
				case  8: *p1 = _X; break;
				case  9: *p1 = _Z; break;
				case 10: *p1 = _W; break;
				case 11: *p1 = _X; break;
				case 12: *p1 = _Y; break;
				case 13: *p1 = _W; break;
				case 14: *p1 = _X; break;
				case 15: *p1 = _Y; break;
				default: break; 	
			}
*/			
			switch(core_num)
			{
				case  0: *p1 = _X; break;
				case  1: *p1 = _X; break;
				case  2: *p1 = _Y; break;
				case  3: *p1 = _Y; break;
				case  4: *p1 = _X; break;
				case  5: *p1 = _X; break;
				case  6: *p1 = _Y; break;
				case  7: *p1 = _Y; break;
				case  8: *p1 = _Z; break;
				case  9: *p1 = _Z; break;
				case 10: *p1 = _W; break;
				case 11: *p1 = _W; break;
				case 12: *p1 = _Z; break;
				case 13: *p1 = _Z; break;
				case 14: *p1 = _W; break;
				case 15: *p1 = _W; break;
				default: break; 	
			}
			
		}
	}

	e_wait(E_CTIMER_0, 0x30000);

	//set the transaction mod to multicast
	conf = e_reg_read(E_REG_CONFIG);
	conf = conf & 0xffff0fff;
	conf = conf | 0x00003000;
	e_reg_write(E_REG_CONFIG, conf);	


	//do the multicast
	p0 = (int *) _Xmail;
	*p0 = 0x111;
	
	//wait for some time
//	for(k=0;k<50;k++) {co++;}

	p0 = (int *) _Ymail;
	*p0 = 0x222;

//	for(k=0;k<50;k++) {co++;}

	p0 = (int *) _Zmail;
	*p0 = 0x333;

//	for(k=0;k<50;k++) {co++;}

	p0 = (int *) _Wmail;
	*p0 = 0x444;


	//set the transaction mod to regular transaction
	conf = e_reg_read(E_REG_CONFIG);
	conf = conf & 0xffff0fff;
	e_reg_write(E_REG_CONFIG, conf);	


	e_wait(E_CTIMER_0, 0x30000);

	//check the results
	for(i=0;i<4;i++) 
	{
		for(j=0;j<4;j++) 
		{
			core_num = i * 4 + j;
			//get the target mem address
			p2 = e_get_global_address(i,j,(void *)target);
/*			
			switch(core_num) 
			{	
				case  0: value = _Zvalue; break;
				case  1: value = _Xvalue; break;
				case  2: value = _Yvalue; break;
				case  3: value = _Zvalue; break;
				case  4: value = _Wvalue; break;
				case  5: value = _Yvalue; break;
				case  6: value = _Zvalue; break;
				case  7: value = _Wvalue; break;
				case  8: value = _Xvalue; break;
				case  9: value = _Zvalue; break;
				case 10: value = _Wvalue; break;
				case 11: value = _Xvalue; break;
				case 12: value = _Yvalue; break;
				case 13: value = _Wvalue; break;
				case 14: value = _Xvalue; break;
				case 15: value = _Yvalue; break;
				default: break; 	
			}
*/			
			switch(core_num) 
			{	
				case  0: value = _Xvalue; break;
				case  1: value = _Xvalue; break;
				case  2: value = _Yvalue; break;
				case  3: value = _Yvalue; break;
				case  4: value = _Xvalue; break;
				case  5: value = _Xvalue; break;
				case  6: value = _Yvalue; break;
				case  7: value = _Yvalue; break;
				case  8: value = _Zvalue; break;
				case  9: value = _Zvalue; break;
				case 10: value = _Wvalue; break;
				case 11: value = _Wvalue; break;
				case 12: value = _Zvalue; break;
				case 13: value = _Zvalue; break;
				case 14: value = _Wvalue; break;
				case 15: value = _Wvalue; break;
				default: break; 	
			}
			
			if(*p2 != value)
				fault++;
		}
	}

	//check the final result
	*mailbox = fault;

	return EXIT_SUCCESS;
}
Пример #4
0
int main()
{
  msg_t *m = (msg_t *) 0x4000;
  uint64_t d64;
  uint32_t d32;
  uint16_t d16;
  uint8_t  d8;
  unsigned int dt;
  void *da, *dua, *dc;
  for (unsigned int row = 0; row < E_ROWS; row++) {
    for (unsigned int col = 0; col < E_COLS; col++) {
      if (row == 0 && col == 0) continue;
      unsigned int tcore = row * E_COLS + col;

      da = e_get_global_address(row, col, (void *) MEM_ALINEADA);
      dua = e_get_global_address(row, col, (void *) MEM_NO_ALINEADA);
      dc = e_get_global_address(row, col, (void *) MEM_A_CABALLO);

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d64, da, sizeof(d64));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].t64 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d32, da, sizeof(d32));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].t32 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d16, da, sizeof(d16));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].t16 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d8, da, sizeof(d8));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].t8 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d64, dua, sizeof(d64));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].ua64 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d32, dua, sizeof(d32));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].ua32 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d16, dua, sizeof(d16));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].ua16 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d8, dua, sizeof(d8));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].ua8 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d64, dua, sizeof(d64));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].c64 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d32, dc, sizeof(d32));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].c32 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d16, dc, sizeof(d16));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].c16 = (dt - DUMMY_WAIT) / (double) VECES;

      e_dma_wait(E_DMA_1);
      e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
      e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
      for (int i = 0; i < VECES; i++)
        e_dma_copy(&d8, dc, sizeof(d8));
      e_dma_wait(E_DMA_1);
      e_wait(E_CTIMER_1, DUMMY_WAIT);
      e_ctimer_stop(E_CTIMER_0);
      dt = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);
      m->ticks[tcore].c8 = (dt - DUMMY_WAIT) / (double) VECES;
    }
  }
  m->finalizado = E_TRUE;

  return 0;
}