Motorola user manual Solutions to Exercises, Introduction to the SC140 Tools

Page 27

Compiler Support on StarCore

10 Solutions to Exercises

Exercise 1: /*****************************************************************************

*

MOTOROLA INC.

*

SEMICONDUCTOR PRODUCTS SECTOR

*

COPYRIGHT 1999 MOTOROLA INC.

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

*

INTRODUCTION TO THE SC140 TOOLS

*

Developed by MOTOROLA SPS/NCSG/WISD

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

#include <stdio.h>

main()

{

printf(“Welcome to StarCore SC140 Tools\n”);

}

Exercise 2: /*****************************************************************************

*

MOTOROLA INC.

*

SEMICONDUCTOR PRODUCTS SECTOR

*

COPYRIGHT 1999 MOTOROLA INC.

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

*

INTRODUCTION TO THE SC140 TOOLS

*

Developed by MOTOROLA SPS/NCSG/WISD

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

#include <stdio.h> #include <prototype.h>

short x[12] = {0,1,2,3,4,5,6,7,8,9,10,11};

main()

{

short i; long res=0; long fres=0;

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

{

res += x[i] * x[i];

}

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

{

fres = L_mac(fres,x[i],x[i]);

Introduction to the SC140 Tools

27

Image 27
Contents Motorola Typical development process is represented in Figure Compiler File I/O Exercise Hands OnGood 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