Motorola SC140 user manual Zoffset equ Moffset equ Exercise

Page 37

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

Image 37
Contents Motorola Typical development process is represented in Figure Compiler Hands On File I/O ExerciseGood To Know 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