testiir_df1_32.c

来自「blankfin 中对iir功能进行测试」· C语言 代码 · 共 102 行

C
102
字号

/****************************************************************************
 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      : testiir_df1_32.c
  Module Name    : Test IIR 
  Description    : This module tests the iir function.

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


#include "math.h"
#include "input_iir.dat"
#include "output_iir.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[64];
segment("mydata4") fract32 out2[64];
segment("mydata3") fract32 inp3[256];
segment("mydata4") fract32 out3[256];

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

main()
{
	int i, No_Samp=128;
	
	f1 = _iir_fr32_df1;
	
	 h[2] = 0x257D0000;//b2
	 h[1] = 0x4AFA0000;//b1
	 h[0] = 0x257D0000;//b0
	 h[4] = 0x15F50000;//a2
	 h[3] = 0xFFFF0000;//a1
	 
	 
//Test case 1	
	for(i=0;i<No_Samp;i++)
		inp1[i]=input1[i];

	 

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

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

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

	
//Test case 2	
    No_Samp=64;
	for(i=0;i<No_Samp;i++)
		inp2[i]=input2[i];

	 

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

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

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

//Test case3
	No_Samp=256;
	for(i=0;i<No_Samp;i++)
		inp3[i]=input3[i];

	 

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

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

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

}

⌨️ 快捷键说明

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