AN2094 Freescale Semiconductor / Motorola, AN2094 Datasheet - Page 19

no-image

AN2094

Manufacturer Part Number
AN2094
Description
ITU-T G.729 Implementation on StarCore SC140
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Results
The -t option of the SC140 executable runner is a useful tool for providing qualitative data. This tool was used
extensively in the optimization phases to monitor performance and bit-exactness. An important advantage of
runsc100 is that it is the fastest of all tools.
The CodeWarrior profiler provides information on the average time spent in each function. This information is
useful for quickly establishing the relationship between the functions in an application. The profiler provides the
overall number of cycles spent in each function with and without descendants (in absolute and percentage values)
as well as the number of times the function was called. In this project the profiler was used to identify the most
time-consuming functions and where to direct further optimization efforts.
In choosing the most appropriate measurement techniques, consider the types of programs that each measurement
tool can execute. All tools simulate the file I/O operations, but the profiler does not support console input.
Command line parameters are passed only in profiler and executable runner. The simulator is only stopped by a
halt breakpoint, while the other tools end execution at the exit() command.
All tools report the number of cycles to execute each function. For the vocoder project, a simple computation was
used to convert the number of cycles to the processing load, measured in million cycles per second (MCPS). The
number of MCPS required to encode or decode a frame is obtained by multiplying the measured number of cycles
by the number of frames to be processed per second (in G.729, 100 frames of 10 ms each must be processed per
second), and dividing the result by 1,000,000. For example, if it takes 220,000 cycles to encode or decode a frame,
the processing power required is (220,000 × 100) / 1,000,000 = 22 MCPS.
3.1.2 Code Size
Code size is measured in two ways. In the first method, the linker generates a map file which describes the memory
map of the entire application, including summary data (for example, for object files) and detail data (for example,
for global functions and data). This technique is useful for obtaining data for individual functions, such as size and
placement. An excerpt from a map file and notes on how to use it are provided in Appendix C. The second method
to measure code size is based on the sc100-size.exe program provided with the StarCore support tools. The
program analyzes an ELF object file and reports the size of the classical C segments .text, .rodata,
.data, and .bss. This method is good for providing summary data.
3.1.3 Data Size
In the vocoder application, data size has three components—tables and global data, per-channel data, and variables
on the stack. The first component is fixed for the entire application, while the other two have fixed values per
channel. In other documents, tables are typically considered ROM data, and the equivalent of channel data is static
memory. Table and overhead data are reported by the .data segment of the sc100-size.exe program. Table
placement information is extracted from the map file. Channel data is obtained by running a simple C program
which shows the size of the channel data structures.
Measuring the stack size is more complicated. The basic idea is to measure the stack when the program starts (at
the beginning of the g729_encode() function) and capture every change of the stack pointer without
interrupting execution. The simulator provides all the features required to create a log containing every value
received by the stack pointer during the execution of the coder. The stack pointer log is generated using only the
status breakpoint combined with the display of the stack pointer, as illustrated in Appendix C. The monitored stack
pointer is represented by the variable esp, which the C code generated by the SC140 compiler uses as an ordinary
stack pointer. The generated logs (one each for the encoder and the decoder) are analyzed with a Perl script that
shows the maximum difference between stack top and stack base. An example simulator script along with the Perl
ITU-T G.729 Implementation on the StarCore™ SC140/SC1400 Cores, Rev. 1
Freescale Semiconductor
19

Related parts for AN2094