Compiler Support on StarCore

Exercise 8:

Z_OFFSET equ -12

M_OFFSET equ -14

Exercise 9: /*****************************************************************************

*

MOTOROLA INC.

*

SEMICONDUCTOR PRODUCTS SECTOR

*

COPYRIGHT 1999 MOTOROLA INC.

*******************************************************************************

*

INTRODUCTION TO THE SC140 TOOLS

*

Developed by MOTOROLA SPS/NCSG/WISD

*******************************************************************************/

#include <prototype.h>

#define DATA_LENGTH 6

Word16 y[2];

Word16 a[12]={0x0200, 0x0400, 0x0200, 0x0400, 0x0200, 0x0400, 0x0200, 0x0400, 0x0200, 0x0400, 0x0200, 0x0400};

Word16 b[12] = {0x0100, 0x0800, 0x1000, 0x2000, 0x1000, 0x0800, 0x0200, 0x0100, 0x1000, 0x0800, 0x0200, 0x0100};

void main()

{

Word16 i;

Word32 L_Re1, L_Re2, L_Im1, L_Im2;

L_Re1 = L_Re2 = L_Im1 = L_Im2 = 0;

for(i=0; i<2*DATA_LENGTH; i+=2)

{

L_Re1 = L_mac(L_Re1, a[i], b[i]);

L_Im1 = L_mac(L_Im1, a[i], b[i+1]);

L_Im2 = L_mac(L_Im2, a[i+1], b[i]);

L_Re2 = L_mac(L_Re2, a[i+1], b[i+1]);

}

y[0] = round(L_Re1 - L_Re2);

y[1] = round(L_Im1 + L_Im2);

}

Introduction to the SC140 Tools

37

Page 37
Image 37
Motorola SC140 user manual Zoffset equ Moffset equ Exercise