Digital Signal Processing Reference
In-Depth Information
For example, the conditional branch instruction executes after the ADD instruction
to accumulate in A8, since branching has five delay slots. Additional changes to
make it faster would also make it less comprehensible due to further resequencing
of the instructions.
Build this project as FIRcasmfast , so that the linker option names the output
executable file FIRcasmfast.out . The resulting output is the same 1-kHz band-
pass filter as in the previous example.
Example 4.13: FIR Implementation Using C Calling an ASM Function with
a Circular Buffer ( FIRcirc )
The C program FIRcirc.c (Figure 4.34) calls the ASM function FIRcirc-
func.asm (Figure 4.35). This example expands Example 4.12 to implement an FIR
filter using a circular buffer. The coefficients within the file bp1750.cof were
designed with MATLAB using the Kaiser window and represent a 128-coefficient
FIR bandpass filter with a center frequency of 1750 Hz. Figure 4.36 displays the char-
acteristics of this filter, obtained from MATLAB's filter designer SPTool (described
in Appendix D).
In lieu of moving the data to update the delay samples, a pointer is used. The 16
LSBs of the address mode register are set with a value of
0x0040 = 0000 0000 0100 0000
// FIRcirc.c C program calling ASM function using circular buffer
#include "DSK6713_AIC23.h" //codec-DSK support file
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
#include "bp1750.cof" //BP at 1750 Hz coeff file
int yn = 0;
//init filter's output
interrupt void c_int11() //ISR
{
short sample_data;
sample_data = (input_sample()); //newest input sample data
yn = fircircfunc(sample_data,h,N); //ASM func passing to A4,B4,A6
output_sample((short)(yn>>15));
//filter's output
return;
//return to calling function
}
void main()
{
comm_intr(); //init DSK, codec, McBSP
while(1); //infinite loop
}
FIGURE 4.34. C program calling an ASM function using a circular buffer ( FIRcirc.c ).
Search WWH ::




Custom Search