Beispiel #1
0
int main()
{
	int idata n;
	//int idata i;
	int idata A_re[8];
	int idata A_im[8];
	//int idata W_re[4];
	//int idata W_im[4]; 
	//int idata A_re[16];
	//int idata A_im[16];
	//int idata W_re[8];
	//int idata W_im[8]; 

	
	store_cpu_rate(16);

	P0_DIR &= ~0x28;
	P0_ALT &= ~0x28;

	for(n=0;n<6;n++)
	{
		blink_led();
		mdelay(400);
	}
	//A_re = (double*)malloc(sizeof(double)*n); 
	//A_im = (double*)malloc(sizeof(double)*n); 
	//W_re = (double*)malloc(sizeof(double)*n/2); 
	//W_im = (double*)malloc(sizeof(double)*n/2); 
	//assert(A_re != NULL && A_im != NULL && W_re != NULL && W_im != NULL); 
	
	while(1)
	{
	//for (i=0; i<3; i++) {
		//init_array(n, A_re, A_im); 
		n = 8;
		blink_led();

		//compute_W(n, W_re, W_im); 
		//fft(n, A_re, A_im, W_re, W_im);
		permute_bitrev(n, A_re, A_im);

		mdelay(100);
	//}
	}
	//free(A_re); 
	//free(A_im); 
	//free(W_re); 
	//free(W_im); 
	//exit(0);
	return 0;
}
Beispiel #2
0
/* gets no. of points from the user, initialize the points and roots of unity lookup table 
 * and lets fft go. finally bit-reverses the results and outputs them into a file. 
 * n should be a power of 2. 
 */ 
int main(int argc, char *argv[])
{
  int n; 
  double *A_re, *A_im, *W_re, *W_im; 
  long long start, end;
  struct timespec ts;

  if (argc <= 2) 
  {
    fprintf(stderr, "Usage: ./fft n outfile\n"); 
    exit(-1); 
  }
  n = atoi(argv[1]); 
 
  A_re = (double*)_mm_malloc(sizeof(double)*n, 32); 
  A_im = (double*)_mm_malloc(sizeof(double)*n, 32); 
  W_re = (double*)_mm_malloc(sizeof(double)*n/2, 32); 
  W_im = (double*)_mm_malloc(sizeof(double)*n/2, 32); 
  assert(A_re != NULL && A_im != NULL && W_re != NULL && W_im != NULL); 

  init_array(n, A_re, A_im); 
  compute_W(n, W_re, W_im); 
  clock_gettime(CLOCK_MONOTONIC, &ts);
  start = ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000;
  fft(n, A_re, A_im, W_re, W_im);
  clock_gettime(CLOCK_MONOTONIC, &ts);
  end = ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000;
  permute_bitrev(n, A_re, A_im);        
 // output_array(n, A_re, A_im, argv[2]);  
  
  printf ("The total CPU time of FFT is: %lld microseconds.\n", end - start);
  printf ("The number of errors is %lld \n.", errors);

  _mm_free(A_re); 
  _mm_free(A_im); 
  _mm_free(W_re); 
  _mm_free(W_im); 
}
Beispiel #3
0
void begin()
{
  int i;
  float *A, *W_re, *W_im; 

  A = (float*)malloc(sizeof(float)*2*n);
  W_re = (float*)malloc(sizeof(float)*n/2); 
  W_im = (float*)malloc(sizeof(float)*n/2); 
  /* assert(A_re != NULL && A_im != NULL && W_re != NULL && W_im != NULL);  */
  compute_W(W_re, W_im); 
  
  while (numiters == -1 || numiters-- > 0) {
    init_array(A); 
    fft(A, W_re, W_im);
#ifdef FFT2
    permute_bitrev(A);
#endif
    output_array(A);
  }

  free(A);
  free(W_re); 
  free(W_im); 
}