Motorola SC140 user manual Further Optimizing the Speed

Page 33

Compiler Support on StarCore

var0 = *x_ptr--;

/* var0 = x[n-i-1] */

}

/*** 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]);

}

}

Further Optimizing the Speed

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

*

MOTOROLA INC.

*

SEMICONDUCTOR PRODUCTS SECTOR

*

COPYRIGHT 1999 MOTOROLA INC.

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

*

INTRODUCTION TO THE SC140 TOOLS

*

Developed by MOTOROLA SPS/NCSG/WISD

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

/* Multi-sample technique Exercise on an FIR Filter */

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

short a[12]={0x1000,0x2000,0x3000,0x4000,0x5000,0x6000, 0x7000,0x8000,0x9000,0xA000,0xB000,0xC000};

short input[32+11]={0,0,0,0,0,0,0,0,0,0,0, /* zero-padding */ 0x0100,0x0200,0x0300,0x0400,0x0500,0x0600,0x0700,0x0800, 0x0900,0x0A00,0x0B00,0x0C00,0x0D00,0x0E00,0x0F00,0x1000, 0x1100,0x1200,0x1300,0x1400,0x1500,0x1600,0x1700,0x1800, 0x1900,0x1A00,0x1B00,0x1C00,0x1D00,0x1E00,0x1F00,0x2000};

short y[32]; /**********************************************************************

*** For reference, the following output should be observed after

***

*** running the code.

***

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

*

*

Introduction to the SC140 Tools

33

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