Motorola SC140 user manual Intermediate version Compromise between Memory and Speed

Page 31

Compiler Support on StarCore

Exercise 6:

Intermediate version: Compromise between Memory and 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.

***

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

*

*

* y[0] = 0x0020

*

* y[1] = 0x0080

*

* y[2] = 0x0140

*

* y[3] = 0x0280

*

* y[4] = 0x0460

*

* y[5] = 0x0700

*

* y[6] = 0x0A80

*

* y[7] = 0x0D00

*

* y[8] = 0x0EA0

*

* y[9] = 0x0F80

*

* y[10] = 0x0FC0

*

* y[11] = 0x0F80

*

* y[12] = 0x0F40

*

* y[13] = 0x0F00

*

* y[14] = 0x0EC0

*

* y[15] = 0x0E80

*

* y[16] = 0x0E40

*

* y[17] = 0x0E00

*

Introduction to the SC140 Tools

31

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