📄 test_fir_decima_spl.c
字号:
/*******************************************************************************
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved.
Developed by Joint Development Software Application Team, IPDC, Bangalore, India
for Blackfin DSPs ( Micro Signal Architecture 1.0 specification).
By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software.
********************************************************************************
File Name : test_fir_decima_spl.c
Description : This modules tests the fir_decima_spl function.
*******************************************************************************/
#include "mds_def.h"
#include"tfir.h"
extern void _fir_decima_spl(const fract16 *in, fract16 *out, int n, fract16 *h,
int L, int M, int LBYM, fract16 *d);
void (*f1)();
int error_flag = 0;
int cycle_count[10];
main()
{
fract16 outputmag;
fract32 accout;
int i,j,nsamples,error;
f1 = _fir_decima_spl;
/*
Test: Low pass Test, filter length燣 % 4 = 0
Description: Input data consists of sinusoidal signal whose normalised
frequency = 0.1,the signal amplitude = 1/4, Stored number of
samples = 260, Filter cutoff = 0.3 (normalised)
Number of samples = 260;
*/
for(i = 0; i < 16; i++)
d[i] = zero_in;
nsamples = BUFFER_SIZE; // No: of inputs
/* Read filter input data from header file */
/* input is scaled down by 1 bit right to allow */
/* filter output power not to overflow beyond 32 bits */
for(i=0;i<nsamples;i++)
{
in[i+1] = FIRINPUT1[i]>> 1;
}
nsamples=BUFFER_SIZE/2; // No: of outputs
// For testing purposes test2a and test2b are used.
// Test2a finds decimated filter output for Ni/2 samples and dslay line gts
// updated.
// Test2b finds decimated filter output for the next Ni/2 samples with the delay
// line previously updated by test2a.
cycle_count[0] = Compute_Cycle_Count(&in[1], out,nsamples/2, h, 16, 2, 8,
d);
//This function inturn calls fir_decima_spl()
// Test 2a
cycle_count[1] = Compute_Cycle_Count(&in[nsamples+1], &out[nsamples/2],
nsamples/2, h, 16, 2, 8, d);
//This function inturn calls fir_decima_spl()
// Test 2b
accout = 0;
for (i = 0; i < nsamples; i++)
{
accout += out[i] * out[i];
}
outputmag = (fract16)(accout>> NBITS1);
error = outputmag - thresh;
if(error<0) error = -error;
if(error > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 1;
}
#ifdef PRINTF_SUPPORT
if(error_flag & 1)
printf("Test Case failed\n");
else
printf("Test Case passed\n");
#endif
printf("cycle_count[0]=%d,cycle_count[1]=%d\n",cycle_count[0],cycle_count[1]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -