?? main.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.
************************************************************************/
//#include "def21160.h" /* Symbol Definition File */
#include <defts101.h>
#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 2 /* Set alignment to long-word boundary for next variable */
dm float dline[TAPS+1];
#pragma align 2 /* Set alignment to long-word boundary for next variable */
dm float input1[N] = {
#include "indata1.dat"
}; /* array of samples */
#pragma align 2 /* Set alignment to long-word boundary for next variable */
dm float input2[N] = {
#include "indata2.dat"
}; /* array of samples */
/* PM data */
#pragma align 2 /* Set alignment to long-word boundary for next variable */
pm float coeffs[TAPS] = {
#include "coeffs.dat"
}; /* Filter coefficients */
#pragma align 2
pm float output1[N+1]; /* Output array 1. The last entry is a dummy entry due to SIMD store of result */
#pragma align 2
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 + -