Lesson 5: Writing Linear Assembly
Example 2–14. Using the iircas4 Function in C
void iircas4_1(const int n, const short (* restrict c)[4], int (*d)[2],
int *y)
{
int k0, k1, i;
int y0 = y[0];
int y1 = y[1];
_nassert(((int)(c) & 0x3) == 0));
#pragma MUST_ITERATE(10);
for (i = 0; i < n; i++)
{
k0
y0
k1
y1
d[i][1] = k0;
d[i][0] = k1;
}
y[0] = y0;
y[1] = y1;
}
2-26
Let's look at a new example, iircas4, which will show the benefit of using linear
assembly. The compiler does not not optimally partition this loop. Thus, the iir-
cas4 function does not improve with the C modification techniques we saw in
the first portion of the chapter. In order to get the best partition, we must write
the function in partitioned linear assembly.
In order to follow this example in Code Composer Studio, you must open the
ccs project , l_tutorial.pjt, located in c:\ti\tutorial\sim62xx\linear_asm. Build the
program and look at the software pipeline information feedback in the gener-
ated assembly files.
= c[i][1] * (d[i][1]>>16) + c[i][0] * (d[i][0]>>16) + y0;
= c[i][3] * (d[i][1]>>16) + c[i][2] * (d[i][0]>>16) + k0;
= c[i][1] * (d[i][0]>>16) + c[i][0] * (k0>>16) + y1;
= c[i][3] * (d[i][0]>>16) + c[i][2] * (k0>>16) + k1;
Example 2–15 shows the assembly output from Example 2–14
Need help?
Do you have a question about the TMS320C6000 and is the answer not in the manual?
Questions and answers