Table 6.7 Example of compiler without and with -o3 optimization option
-o3 disabled
-o3 enabled
;Ns 2;
;Ns 2;
;for(i Ns*2; i > 0; iÀÀ)
;for(i Ns*2; i > 0; iÀÀ)
; *ptr 0;
; *ptr 0;
MOV #4,*SP(#00)
RPT #3
MOV *SP(#00),AR1
MOV #0,*AR3
BCC L2, AR1 #0
MOV *SP(#01h),AR3
ADD #1,AR3,AR1
MOV AR1,*SP(#01h)
MOV #0,*AR3
ADD #-1,*SP(#00h)
MOV *SP(#00h),AR1
BCC L1,AR1 ! #0
± Place the main()and iir()functions into the program SARAM, and name the
section iir_code.
± Allocate the input and output buffers in []and out []to data SARAM, and
name the sections input and output.
± Put the IIR filter coefficient buffer C []in a separate data SARAM section, and
name the section iir_coef.
± Place the temporary buffer w []and temporary variables in a DARAM section,
and name it iir_data.
4. Enable -o3 and -mp options to rebuild the project.
5. Set a breakpoint at the statement for(;;)of the main()function, and use the CCS
graphic function to view the 16-bit integer output samples in the buffer out []. Set
data length to 128 for viewing one block of data at a time. Animate the filtering
process and observe the filter output as a clean 800 Hz sinewave.
6. Profile the IIR filter iir_i2(), and compare the result with those obtained in
Experiment 6B.
6.7.5 Experiment 6D ± Assembly Language Implementations
The advantages of C programming are quick prototyping, portable to other DSP
processors, easy maintenance, and flexibility for algorithm evaluation and analysis.
However, the IIR filter implementations given in previous experiments can be more
efficient if the program is written using the C55x assembly instructions. By examining
SOFTWARE DEVELOPMENTS AND EXPERIMENTS USING THE TMS320C55X
295