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

📄 tfir_fr32.c

📁 blankfin 中对iir功能进行测试
💻 C
字号:

/****************************************************************************
 Copyright(c) 2000 - 2003 Analog Devices. All Rights Reserved.
Developed by Blackfin DSP software Group, IPDC, Bangalore, India
for Blackfin DSPs.
By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software. 
***************************************************************************
  File Name      : tfir_fr32.c
  Module Name    : Test FIR 
  Description    : This module tests the fir function.

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

/* Includes */

#include "math.h"
#include "input_fir.dat"
#include "output_fir.dat"

segment("mydata1") fract32 delay[8];
segment("mydata2") fract32 h[8];
segment("mydata3") fract32 inp1[128];
segment("mydata4") fract32 out1[128];
segment("mydata3") fract32 inp2[256];
segment("mydata4") fract32 out2[256];
segment("mydata3") fract32 inp3[256];
segment("mydata4") fract32 out3[256];
segment("mydata3") fract32 inp4[256];
segment("mydata4") fract32 out4[256];

void (*f1)();
int cycle_count[10];
void _fir_fr32();

main()
{

	fract32 *RWptr;
	int i, No_Samp=128, No_Coeff=8;
	
	f1 = _fir_fr32;
	
	h[0]=  0xFFD30000;
	h[1]=  0x03600000;
	h[2]=  0x13F00000;
	h[3]=  0x28DA0000;
	h[4]=  0x28DA0000;
	h[5]=  0x13F00000;
	h[6]=  0x03600000;
	h[7]=  0xFFD30000;

	for(i=0;i<No_Coeff;i++)
		delay[i]=0;
		
//Test case1		
		RWptr=&inp1[0];

	for(i=0;i<No_Samp;i++)
		inp1[i]=input1[i];	
		

cycle_count[0] = Compute_Cycle_Count(inp1,out1,h,delay,No_Coeff,No_Samp, RWptr);
                    //This function inturn calls fir_fr32()

	for(i=0;i<No_Samp;i++)
	{
		if(out1[i]!=output1[i])
		printf("Test case1 is failed\n");
	}


//Test case2
//Input data consists of sinusoidal signal whose normalised frequency = 0.1,the 
//signal amplitude = 1/4, Filter cutoff = 0.3 (normalised), 
//Number of samples = 256 = BUFFER_SIZE,  filter Tap length = BASE_TAPLENGTH = 8
		
		RWptr=&inp2[0];
		No_Samp=256;

	for(i=0;i<No_Samp;i++)
		inp2[i]=input2[i];	
		

cycle_count[1] = Compute_Cycle_Count(inp2,out2,h,delay,No_Coeff,No_Samp, RWptr);

	for(i=0;i<No_Samp;i++)
	{
		if(out2[i]!=output2[i])
		printf("Test case2 is failed %d\n",i);
	}


//Test case3
// Description: Input data consists of sinusoidal signal whose normalised 
//frequency = 0.1,the signal amplitude= 1/4, Filter cutoff = 0.3 (normalised),
// Number of samples = 256 = BUFFER_SIZE filter Tap length = 
//BASE_TAPLENGTH + 1  = 9         		
		RWptr=&inp3[0];
		No_Samp=256;

	for(i=0;i<No_Samp;i++)
		inp3[i]=input3[i];	
		

cycle_count[2] = Compute_Cycle_Count(inp3,out3,h,delay,No_Coeff,No_Samp, RWptr);

	for(i=0;i<No_Samp;i++)
	{
		if(out3[i]!=output3[i])
		printf("Test case3 is failed\n");
	}


//Test case4
    RWptr=&inp4[0];
    No_Samp=256;
    
    
    
    for(i=0;i<No_Samp;i++)
		inp4[i]=input4[i];
    
		
cycle_count[3] = Compute_Cycle_Count(inp4,out4,h,delay,No_Coeff,No_Samp, RWptr);

	for(i=0;i<No_Samp;i++)
	{
		if(out4[i]!=output4[i])
		printf("Test case4 is failed\n %d",i);
	}
}

⌨️ 快捷键说明

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