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

Page 35
Image 35
Motorola SC140 user manual Compiler Support on StarCore