Digital Signal Processing Reference
In-Depth Information
After testing the functionality of your C code, transport it to the C6x platform.
A floating-point implementation can be modeled first, then converted to a fixed-
point implementation if desired. If the performance of the code is not adequate, use
different compiler options to enable software pipelining (discussed later), reduce
redundant loops, and so on. If the performance desired is still not achieved, you can
use loop unrolling to avoid overhead in branching. This generally improves the exe-
cution speed but increases code size. You also can use word-wide optimization by
loading/accessing 32-bit word (int) data rather than 16-bit half-word (short) data.
You can then process lower and upper 16-bit data independently.
If performance is still not satisfactory, you can rewrite the time-critical section of
the code in linear assembly, which can be optimized by the assembler optimizer. The
profiler can be used to determine the specific function(s) that need to be optimized
further.
The final optimization procedure that we discuss is a software pipelining scheme
to produce hand-coded ASM instructions [1,2]. It is important to follow the proce-
dure associated with software pipelining to obtain an efficient and optimized code.
8.2 OPTIMIZATION STEPS
If the performance and results of your code are satisfactory after any particular step,
you are done.
1. Program in C. Build your project without optimization.
2. Use intrinsic functions when appropriate as well as the various optimization
levels.
3. Use the profiler to determine/identify the function(s) that may need to be
further optimized. Then convert these function(s) to linear ASM.
4. Optimize code in ASM.
8.2.1 Compiler Options
When the optimizer is invoked, the following steps are performed. A C-coded
program is first passed through a parser that performs preprocessing functions and
generates an intermediate file ( .if ) that becomes the input to an optimizer. The
optimizer generates an .opt file that becomes the input to a code generator for
further optimizations and generates an ASM file.
The options:
1. -o0 optimizes the use of registers.
2. -o1 performs a local optimization in addition to the optimizations performed
by the previous option: -o0.
3. -o2 performs a global optimization in addition to the optimizations per-
formed by the previous options: -o0 and -o1.
Search WWH ::




Custom Search