Introduction: Simple C Tuning
2-2
2.1
Introduction: Simple C Tuning
The ’C6000 compiler delivers the industry’s best ”out of the box” C perfor-
mance. In addition to performing many common DSP optimizations, the
’C6000 compiler also performs software pipelining on various MIPS intensive
loops. This feature is important for any pipelined VLIW machine to perform. In
order to take full advantage of the eight available independent functional units,
the dependency graph of every loop is analyzed and then scheduled by soft-
ware pipelining. The more information the compiler gathers about the depen-
dency graph, the better the resulting schedule. Because of this, the ’C6000
compiler provides many features that facilitate sending information to the com-
piler to ”tune” your C code.
These tutorial lessons focus on four key areas where tuning your C code can
offer great performance improvements. In this tutorial, a single code example
is used to demonstrate all four areas. The following example is the vector
summation of two weighted vectors.
Example 2–1. Vector Summation of Two Weighted Vectors
void lesson_c(short *xptr, short *yptr, short *zptr, short *w_sum, int N){
int i, w_vec1, w_vec2;
short w1,w2;
w1 = zptr[0];
w2 = zptr[1];
for (i = 0; i < N; i++){
w_vec1 = xptr[i] * w1;
w_vec2 = yptr[i] * w2;
w_sum[i] = ( w_vec2) >> 15;
}
}
2.1.1
Project Familiarization
In order to load and run the provided example project, you must select the ap-
propriate target from Code Composer Setup. The optimizing_c project was
built and saved as a CCS project file (optimizing_c.pjt). This project assumes
a C62x fast simulator little endian target. Therefore, you need to import the
same target from Code Composer Setup:
Set Up Code Composer Studio for C62x Fast Simulator Little Endian
1) Click on Setup CCStudio to setup the target.
2) From the import configuration window, select C62xx Fast Sim Ltl Endian.