Compiler Support on StarCore
Hands On
1.Open the Ex6.c file.
2.Compile Ex6.c using the
3.Recompile Ex6.c using the
Intermediate Version: Compromise Between Memory and Speed
4.Save Ex6.c as Ex6_1.c.
5.Change the C code of Ex6_1.c according to the following steps:
a.Process the first four samples at a time:
Replace the implementation of “y(n) = ai * x(n)” with the equations defined as Group 0 in Equation 5.
b.Replace x(n), x(n+1), x(n+2), x(n+3) with variables (for example, var0, var1, var2, var3, respectively), as follows:
res0 += a[i] * var0; res1 += a[i] * var1; res2 += a[i] * var2; res3 += a[i] * var3;
Group 0
This processes the first group (Group 0). To process the remaining groups, Group 1 and so on, the values from var0, var1, and var2 from Group 0 must be transferred to var1, var2, var3, respectively, for processing Group 1.
c. Transfer the values in var1, var2, and var3 and load the new sample
6.Compile the code with the
7.Recompile Ex6_1.c using the
During each iteration of the loop, the coefficient, a[i], is loaded into a data register. The data value,
8.In the box on the following page, write the code for the intermediate version.
Introduction to the SC140 Tools | 19 |