⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 在ADSP-2126x上编写的优化过的FFT程序(用c和汇编编写)。
💻 C
字号:
/*******************************************************************************
*
* Function:  Main - Test Rad4FFT function
*            
* Description:
*		This routine tests the Rad4FFT function.  All necessary arrays 
*		are declared, an input signal is generated, the twiddle factors are
*		calculated, ant the Rad4FFT routine is called.  
*		Benchmark information for the routine is stored in CycleCount.
*
* Author:	
*				Darrel Judd
*				Judd Labs, Inc.
*				801-756-2057
*				drjudd@ieee.org
*
* Revisions:
*					Created June, 2003 Darrel Judd
*******************************************************************************/
//==============================================================================
// include files
//==============================================================================
#include "Rad4FFT.h"
#include <math.h>
#include "benchmark.h"
//==============================================================================
// definitions
//==============================================================================
// define fft size
#define N 1024
//==============================================================================
// declarations
//==============================================================================
// declare arrays for input data
float redata[N];
float pm imdata[N];
// declare arrays for output data aligned on N boundaries
#pragma align 1024
float refft[N];
#pragma align 1024
float pm imfft[N];
// declare arrays for twiddle factors
#pragma align 2
float retwid[N*3/4];
#pragma align 2
float pm imtwid[N*3/4];
// FFTsize
TCFFT4_simd_size FFTSize = N1024;
// prototypes
void sinf_simd(float *x,float *y);

main()
{
	S32 CycleCount;  // Benchmark data
	U32 i;
	// Calculate input data
	float x[2];
	float pi = pi=4.0*atanf(1.0f);
	for(i=0;i<FFTSize;i=i+2)
	{
		x[0]=2*pi/N*i;
		x[1]=2*pi/N*(i+1);
		// calculate 2 sines at a time
		sinf_simd(x,&redata[i]);
		imdata[i]=0.0;
		imdata[i+1]=0.0;
	}
	// calculate twiddle factors
	Rad4_Twiddle_Calc(FFTSize,retwid,imtwid);
	// initalize the fft
	Rad4FFT_Init(FFTSize,&redata[0],&imdata[0],refft,imfft,retwid,imtwid); // 69 cycles
	// start the clock ticking
	CycleCount=count_start();
	// calculate the fft
	Rad4FFT();	
	// stop the clock
	CycleCount = count_end(CycleCount);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -