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

📄 main.c

📁 2005 Center for Biological & Computational Learning at MIT and MIT All rights reserved. Permissio
💻 C
字号:
/***********************************************************************

This is an example of a C callable floating point block FIR.
The example is for 64 taps with 128 samples and is provided to show
how the techniques detailed in the accompanying application note can be
applied to this example to convert it for operation on the TigerSHARC
family of processors.

Some of the macros for saving and restoring to and from the stack
have been added simply to show how the TigerSHARC macros provided with
the accompanying application note can be implemented without much
alteration of the code.

************************************************************************/


#ifdef __ADSPTS201__
	#include <defts201.h>
#endif

#ifdef __ADSPTS101__
	#include <defts101.h>
#endif

#include <sysreg.h>
#include <stdio.h>

#define     TAPS    64					/* length of filter */
#define     N       128					/* number of samples */

extern	void block_fir(dm float *, dm float *, pm float *, pm float *, int, int);

/* DM data */
/* TAPS+1 = delay line compensate for circ buffer as SIMD access at end of CB will take sample outside of CB */
#pragma align 4							/* Set alignment to long-word boundary for next variable */
dm float dline[TAPS+1];					

#pragma align 4							/* Set alignment to long-word boundary for next variable */
dm float input1[N] = { 
	#include "indata1.dat"
	};		/* array of samples */

#pragma align 4							/* Set alignment to long-word boundary for next variable */
dm float input2[N] = { 
	#include "indata2.dat"
	};		/* array of samples */

/* PM data */
#pragma align 4							/* Set alignment to long-word boundary for next variable */
pm float coeffs[TAPS] = {
	#include "coeffs.dat"
};	/* Filter coefficients */

#pragma align 4	
pm float output1[N+1];				    /* Output array 1.  The last entry is a dummy entry due to SIMD store of result */
							    
#pragma align 4
pm float    output2[N+1];			    /* Output array 2.  The last entry is a dummy entry due to SIMD store of result */

main()
{
	int samples = N;
	int taps = TAPS;
	long long cycle_count;
	long long temp;
	
	temp = __read_ccnt();
	block_fir(input1, dline, coeffs, output1, samples, taps);
	cycle_count = __read_ccnt();
	cycle_count = cycle_count - temp;
	printf("\ncycle count = %lld\n", cycle_count);
	
	temp = __read_ccnt();
	block_fir(input2, dline, coeffs, output2, samples, taps);
	cycle_count = __read_ccnt();
	cycle_count = cycle_count - temp;
	printf("\ncycle count = %lld\n", cycle_count);
}

⌨️ 快捷键说明

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