Motorola SC140 user manual Local Optimization, Global Optimization

Page 11

Ex3_main.c

...

main()

{

...

res=Prod(&array1[0],&array2[0]);

...

}

Compiler Support on StarCore

Ex3_prod.c

...

long Prod(short a1[], short a2[])

{

...

}

Figure 6. Files for the Local Versus Global Optimization Exercise

1. Open the two files and understand their functionality.

Local Optimization

2.Compile the two files:

ccsc100 -Ot2 Ex3_main.c Ex3_prod.c -o Ex3.eld

3.Run the code: runsc100 -t Ex3.eld.

The -toption for runsc100 enables the cycle count generation. Write the cycle count in the box below:

Local Optimization (Default Mode) Cycle Count

Global Optimization

4.Compile the files using global optimization:

ccsc100 -Ot2 -Og Ex3_main.c Ex3_prod.c -o Ex3_glo.eld where -Og is the global optimization option.

5.Run the code: runsc100 -t Ex3_glo.eld. Write the cycle count in the box below:

Global Optimization (-Og option) Cycle Count

Introduction to the SC140 Tools

11

Image 11
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