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

Page 33
Image 33
Motorola SC140 user manual Further Optimizing the Speed