Motorola SC140 user manual Compiler Support on StarCore

Page 35

Compiler Support on StarCore

var3 =

*x_ptr--; /*

var3 = x[n+3] */

var2 =

*x_ptr--; /*

var3 = x[n+2] */

var1 =

*x_ptr--; /*

var3 = x[n+1]

*/

var0 =

*x_ptr--; /*

var3 = x[n]

*/

/*** x_ptr now points to x[n-1] ***/

for(i=0; i<12; i+=4)

 

 

 

{

 

 

 

 

res0

= L_mac(res0,

a[i], var0);

 

res1

= L_mac(res1,

a[i], var1);

 

res2

= L_mac(res2,

a[i], var2);

 

res3

= L_mac(res3,

a[i], var3);

 

var3

= *x_ptr--; /* var3 = x[n-i-1] */

res0

= L_mac(res0,

a[i+1],

var3);

 

res1

= L_mac(res1,

a[i+1],

var0);

 

res2

= L_mac(res2,

a[i+1],

var1);

 

res3

= L_mac(res3,

a[i+1],

var2);

 

var2

= *x_ptr--; /* var2 =

x[n-i-2] */

res0

= L_mac(res0,

a[i+2],

var2);

 

res1

= L_mac(res1,

a[i+2],

var3);

 

res2

= L_mac(res2,

a[i+2],

var0);

 

res3

= L_mac(res3,

a[i+2],

var1);

 

var1

= *x_ptr--; /* var1 =

x[n-i-3] */

res0

= L_mac(res0,

a[i+3],

var1);

 

res1

= L_mac(res1,

a[i+3],

var2);

 

res2

= L_mac(res2,

a[i+3],

var3);

 

res3

= L_mac(res3,

a[i+3],

var0);

 

var0

= *x_ptr--; /* var0 =

x[n-i-4] */

}

 

 

 

 

/*** Truncate results and store in y[] ***/

y[n] = extract_h(res0); y[n+1] = extract_h(res1); y[n+2] = extract_h(res2); y[n+3] = extract_h(res3);

x_ptr += 20; /* Increment pointer by 20 to point to x[n+7] for next iteration */

}

/*** Print results, y[] ***/

for (n=0; n<32; n++)

{

printf ("y[%d] = 0x%04hX\n", n, y[n]);

}

Introduction to the SC140 Tools

35

Image 35
Contents Motorola Typical development process is represented in Figure Compiler Good To Know File I/O ExerciseHands On Interpretation of 16-bit Integer and Fractional Data Values Integer and Fractional Arithmetic ExerciseInteger Arithmetic Compiler Support on StarCoreFractional Arithmetic Good To Know Local Optimization Local Versus Global Optimization ExerciseCompiler Support on StarCore StarCore C Compiler Global Optimization Local OptimizationMemory Alignment Exercise AA BB CC DD First Code Section Second Code Section Split Summation Exercise Code Generated Assembly Code = ∑ a i x n For 0 ≤ n L Multi-Sample ExerciseIntermediate Version Compromise Between Memory and Speed Further Speed Optimization Control Code The True Bit Exercise Save Ex7.c as Ex71.c Calling an Assembly Routine From C Exercise Current Following output should be displayed Challenge Introduction to the SC140 Tools Solutions to ExercisesAligned ExerciseExpected Motorola INC Intermediate version Compromise between Memory and Speed Compiler Support on StarCore Further Optimizing the Speed Compiler Support on StarCore Compiler Support on StarCore Motorola INC Zoffset equ Moffset equ Exercise Compiler Support on StarCore Compiler Support on StarCore AN2009/D