Analog Devices ADSP-21000 Application Handbook

Add to My manuals
14 Pages

advertisement

Analog Devices ADSP-21000 Application Handbook | Manualzz

a

ADSP-21000 Family

Application Handbook Volume 1

 1994 Analog Devices, Inc.

ALL RIGHTS RESERVED

PRODUCT AND DOCUMENTATION NOTICE: Analog Devices reserves the right to change this product and its documentation without prior notice.

Information furnished by Analog Devices is believed to be accurate and reliable.

However, no responsibility is assumed by Analog Devices for its use, nor for any infringement of patents, or other rights of third parties which may result from its use. No license is granted by implication or otherwise under the patent rights of Analog Devices.

SHARC, EZ-ICE and EZ-LAB are trademarks of Analog Devices, Inc.

MS-DOS and Windows are trademarks of Microsoft, Inc.

PRINTED IN U.S.A.

Printing History

FIRST EDITION 5/94

For marketing information or Applications Engineering assistance, contact your local

Analog Devices sales office or authorized distributor.

If you have suggestions for how the ADSP-2100 Family development tools or documentation can better serve your needs, or you need Applications Engineering assistance from Analog Devices, please contact:

Analog Devices, Inc.

DSP Applications Engineering

One Technology Way

Norwood, MA 02062-9106

Tel: (617) 461-3672

Fax: (617) 461-3010 e-mail: [email protected]

The System IC Products Division runs a Bulletin Board Service that can be reached at speeds up to 14,400 baud, no parity, 8 bits data, 1 stop bit, dialing (617) 461-4258.

This BBS supports: V.32bis, error correction (V.42 and MNP classes 2, 3, and 4), and data compression (V.42bis and MNP class 5 )

The System IC Products Division Applications Group maintains an Internet FTP site. Login as anonymous using your email address for your password. Type (from your UNIX prompt): ftp ftp.analog.com (or type: ftp 137.71.23.11

)

For additional marketing information, call (617) 461-3881 in Norwood MA, USA.

ADSP-21020 User’s Manual

ADSP-21000 SHARC Preliminary Users Manual

Complete description of processor architectures and system interfaces.

ADSP-21000 Family Assembler Tools & Simulator Manual

ADSP-21000 Family C Tools Manual

ADSP-21000 Family C Runtime Library Manual

Programmer’s references.

ADSP-21020 EZ-ICE Manual

ADSP-21020 EZ-LAB Manual

User’s manuals for in-circuit emulators and demonstration boards.

ADSP-21020 Data Sheet

ADSP-2106 SHARC Preliminary Data Sheet

ADSP-21000 Family Development Tools Data Sheet

1.3.1

1.3.2

1.3.2.1

1.3.2.2

1.3.2.3

1.3.2.4

1.3.3

1.3.3.1

1.3.3.2

1.3.3.3

1.3.3.4

1.3.3.5

1.4

1.4.1

1.4.2

1.4.3

1.1

1.2

1.2.1

1.2.2

1.2.2.1

1.2.2.2

1.2.3

1.2.4

1.2.5

1.2.6

1.3

CHAPTER 1 INTRODUCTION

USAGE CONVENTIONS ................................................................... 1

DEVELOPMENT RESOURCES ......................................................... 1

Software Development Tools ..................................................... 1

Hardware Development Tools .................................................. 2

EZ-LAB .................................................................................. 2

EZ-ICE ................................................................................... 2

Third Party Support .................................................................... 2

DSPatch ......................................................................................... 3

Applications Engineering Support ........................................... 3

ADSP-21000 Family Classes ....................................................... 4

ADSP-21000 FAMILY: THE SIGNAL PROCESSING

SOLUTION ........................................................................................... 4

Why DSP? ..................................................................................... 4

Why Floating-Point?.................................................................... 4

Precision ................................................................................ 4

Dynamic Range .................................................................... 5

Signal-To-Noise Ratio ......................................................... 5

Ease-Of-Use .......................................................................... 5

Why ADSP-21000 Family? ......................................................... 5

Fast & Flexible Arithmetic .................................................. 6

Unconstrained Data Flow ................................................... 6

Extended IEEE-Floating-Point Support ............................ 6

Dual Address Generators ................................................... 6

Efficient Program Sequencing ........................................... 6

ADSP-21000 FAMILY ARCHITECTURE OVERVIEW .................. 7

ADSP-21000 Family Base Architecture ..................................... 7

ADSP-21020 DSP.......................................................................... 8

ADSP-21060 SHARC ................................................................. 10 v

vi

2.4.1

2.4.2

2.4.2.1

2.4.2.2

2.4.2.3

2.4.2.4

2.5

2.5.1

2.5.2

2.6

2.6.1

2.6.2

2.6.2.1

2.7

2.7.1

2.7.2

2.8

2.8.1

2.8.2

2.8.2.1

2.8.2.2

2.8.2.3

2.9

2.1

2.1.1

2.1.2

2.1.2.1

2.1.2.2

2.2

2.2.1

2.2.2

2.3

2.3.1

2.3.2

2.4

CHAPTER 2 TRIGONOMETRIC, MATHEMATICAL &

TRANSCENDENTAL FUNCTIONS

SINE/COSINE APPROXIMATION ............................................... 15

Implementation .......................................................................... 16

Code Listings .............................................................................. 18

Sine/Cosine Approximation Subroutine ....................... 18

Example Calling Routine .................................................. 21

TANGENT APPROXIMATION ...................................................... 22

Implementation .......................................................................... 22

Code Listing-Tangent Subroutine ........................................... 24

ARCTANGENT APPROXIMATION ............................................. 27

Implementation .......................................................................... 27

Listing-Arctangent Subroutine ................................................ 29

SQUARE ROOT & INVERSE SQUARE ROOT

APPROXIMATIONS ......................................................................... 33

Implementation .......................................................................... 34

Code Listings .............................................................................. 35

SQRT Approximation Subroutine ................................... 36

ISQRT Approximation Subroutine ................................. 38

SQRTSGL Approximation Subroutine ........................... 40

ISQRTSGL Approximation Subroutine .......................... 42

DIVISION............................................................................................ 44

Implementation .......................................................................... 44

Code Listing-Division Subroutine .......................................... 44

LOGARITHM APPROXIMATIONS ............................................... 46

Implementation .......................................................................... 47

Code Listing ............................................................................... 49

Logarithm Approximation Subroutine .......................... 49

EXPONENTIAL APPROXIMATION ............................................. 52

Implementation .......................................................................... 53

Code Listings-Exponential Subroutine................................... 55

POWER APPROXIMATION............................................................ 57

Implementation .......................................................................... 59

Code Listings .............................................................................. 62

Power Subroutine .............................................................. 62

Global Header File ............................................................. 68

Header File.......................................................................... 69

REFERENCES..................................................................................... 69

CHAPTER 3

3.1

3.2

3.2.1

3.2.2

3.3

3.3.1

3.3.2

3.4

3.4.1

3.4.2

3.5

MATRIX FUNCTIONS

STORING A MATRIX ....................................................................... 72

MULTIPLICATION OF A M

×

N MATRIX

BY AN N

×

1 VECTOR ........................................................................ 73

Implementation .......................................................................... 73

Code Listing—M

×

N By N

×

1 Multiplication .......................... 75

MULTIPLICATION OF A M

×

N MATRIX

BY A N

×

O MATRIX .......................................................................... 77

Implementation .......................................................................... 77

Code Listing—M

×

N By N

×

O Multiplication......................... 79

MATRIX INVERSION....................................................................... 81

Implementation .......................................................................... 82

Code Listing—Matrix Inversion .............................................. 84

REFERENCES..................................................................................... 88

CHAPTER 4

4.1

4.1.1

4.1.2

4.1.2.1

4.1.2.2

4.2

4.2.1

4.2.1.1

4.2.1.2

4.2.2

4.2.2.1

4.2.2.2

4.3

4.4

FIR & IIR FILTERS

FIR FILTERS ....................................................................................... 90

Implementation .......................................................................... 91

Code Listings .............................................................................. 96

Example Calling Routine .................................................. 96

Filter Code .......................................................................... 98

IIR FILTERS ...................................................................................... 100

Implementation ........................................................................ 101

Implementation Overview ............................................. 101

Implementation Details .................................................. 102

Code Listings ............................................................................ 106 iirmem.asm ....................................................................... 106 cascade.asm ...................................................................... 108

SUMMARY ....................................................................................... 111

REFERENCES................................................................................... 111

CHAPTER 5

5.1

5.1.1

5.1.2

5.2

5.2.1

MULTIRATE FILTERS

SINGLE-STAGE DECIMATION FILTER..................................... 114

Implementation ........................................................................ 114

Code Listings—decimate.asm ............................................... 117

SINGLE-STAGE INTERPOLATION FILTER .............................. 122

Implementation ........................................................................ 122 vii

viii

5.2.2

5.3

5.3.1

5.3.2

5.4

5.4.1

5.4.2

5.5

5.5.1

5.5.2

5.6

5.6.1

5.6.2

5.7

Code Listing—interpol.asm ................................................... 124

RATIONAL RATE CHANGER (TIMER-BASED) ...................... 129

Implementation ........................................................................ 129

Code Listings—ratiobuf.asm ................................................. 133

RATIONAL RATE CHANGER

(EXTERNAL INTERRUPT-BASED).............................................. 138

Implementation ........................................................................ 138

Code Listing—rat_2_int.asm.................................................. 139

TWO-STAGE DECIMATION FILTER .......................................... 143

Implementation ........................................................................ 143

Code Listing—dec2stg.asm .................................................... 145

TWO-STAGE INTERPOLATION FILTER ................................... 150

Implementation ........................................................................ 150

Code Listing—int2stg.asm ..................................................... 151

REFERENCES................................................................................... 156

6.1.1.4

6.1.1.5

6.1.2

6.1.2.1

6.1.2.2

6.1.2.3

6.1.3

6.1.3.1

6.1.3.2

6.2

6.2.1

6.2.2

6.2.2.1

6.2.3

6.2.3.1

6.2.4

6.2.4.1

6.2.5

CHAPTER 6

6.1

6.1.1

6.1.1.1

6.1.1.2

6.1.1.3

ADAPTIVE FILTERS

INTRODUCTION ............................................................................ 157

Applications Of Adaptive Filters .......................................... 157

System Identification ....................................................... 158

Adaptive Equalization For Data Transmission ........... 159

Echo Cancellation For Speech-Band

Data Transmission ........................................................... 159

Linear Predictive Coding of Speech Signals ................ 160

Array Processing .............................................................. 160

FIR Filter Structures ................................................................ 160

Transversal Structure ...................................................... 161

Symmetric Transversal Structure .................................. 162

Lattice Structure ............................................................... 163

Adaptive Filter Algorithms .................................................... 164

The LMS Algorithm......................................................... 164

The RLS Algorithm .......................................................... 165

IMPLEMENTATIONS .................................................................... 167

Transversal Filter Implementation ........................................ 168

LMS (Transversal FIR Filter Structure)................................. 168

Code Listing—lms.asm ................................................... 169 llms.asm—Leaky LMS Algorithm (Transversal) ................ 171

Code Listing ..................................................................... 171

Normalized LMS Algorithm (Transversal) .......................... 173

Code Listing—nlms.asm................................................. 174

Sign-Error LMS (Transversal) ................................................ 176

6.2.5.1

6.2.6

6.2.6.1

6.2.7

6.2.7.1

6.2.8

6.2.8.1

6.2.9

6.2.9.1

6.2.10

6.2.10.1

6.2.11

6.2.11.1

6.3

6.4

Code Listing—selms.asm ............................................... 177

Sign-Data LMS (Transversal) ................................................. 179

Code Listing—sdlms.asm ............................................... 180

Sign-Sign LMS (Transversal).................................................. 183

Code Listing—sslms.asm ............................................... 183

Symmetric Transversal Filter Implementation LMS .......... 185

Code Listing—sylms.asm ............................................... 186

Lattice Filter LMS With Joint Process Estimation ............... 189

Code Listing—latlms.asm .............................................. 191

RLS (Transversal Filter) .......................................................... 194

Code Listing—rls.asm ..................................................... 195

Testing Shell For Adaptive Filters ......................................... 199

Code Listing—testafa.asm .............................................. 199

CONCLUSION................................................................................. 202

REFERENCES................................................................................... 203

CHAPTER 7

7.3.4

7.3.5

7.4

7.5

7.6

7.6.1

7.6.2

7.6.3

7.1

7.1.1

7.1.2

7.2

7.3

7.3.1

7.3.2

7.3.3

7.6.4

7.6.5

7.7

FOURIER TRANSFORMS

COMPUTATION OF THE DFT ..................................................... 206

Derivation Of The Fast Fourier Transform .......................... 207

Butterfly Calculations ............................................................. 208

ARCHITECTURAL FEATURES FOR FFTS ................................. 210

COMPLEX FFTS .............................................................................. 211

Architecture File Requirements ............................................. 211

The Radix-2 DIT FFT Program .............................................. 212

The Radix-4 DIF FFT Program ............................................... 213

FFTs On The ADSP-21060 ...................................................... 214

FFT Twiddle Factor Generation............................................. 214

INVERSE COMPLEX FFTs ............................................................. 215

BENCHMARKS ............................................................................... 216

CODE LISTINGS ............................................................................. 217

FFT.ACH—Architecture File ................................................. 217

FFTRAD2.ASM—Complex Radix2 FFT ............................... 218

FFTRAD4.ASM—Complex Radix-4 FFT .............................. 225

TWIDRAD2.C—Radix2 Coefficient Generator ................... 232

TWIDRAD4.C—Radix4 Coefficient Generator ................... 234

REFERENCES................................................................................... 236 ix

x

8.3.2

8.4

8.4.1

8.4.2

8.5

8.5.1

8.5.2

8.6

8.6.1

8.6.2

8.1

8.1.1

8.1.2

8.2

8.2.1

8.2.2

8.3

8.3.1

8.7

8.7.1

8.7.2

8.8

8.8.1

8.8.2

8.9

8.9.1

8.9.2

8.10

CHAPTER 8 GRAPHICS

3-D GRAPHICS LINE ACCEPT/REJECT .................................... 237

Implementation ........................................................................ 239

Code Listing ............................................................................. 240

CUBIC BEZIER POLYNOMIAL EVALUATION ....................... 244

Implementation ........................................................................ 245

Code Listing ............................................................................. 246

CUBIC B-SPLINE POLYNOMIAL EVALUATION................... 248

Implementation ........................................................................ 248

Code Listing ............................................................................. 250

BIT BLOCK TRANSFER ................................................................. 253

Implementation ........................................................................ 253

Code Listing ............................................................................. 255

BRESENHAM LINE DRAWING .................................................. 257

Implementation ........................................................................ 257

Code Listing ............................................................................. 259

3-D GRAPHICS TRANSLATION, ROTATION, & SCALING . 262

Implementation ........................................................................ 262

Code Listing ............................................................................. 265

MULTIPLY 4

×

4 BY 4

×

1 MATRICES (3D GRAPHICS .....................

TRANSFORMATION) .................................................................... 267

Implementation ........................................................................ 267

Code Listing ............................................................................. 268

TABLE LOOKUP WITH INTERPOLATION .............................. 270

Implementation ........................................................................ 270

Code Listing ............................................................................. 272

VECTOR CROSS PRODUCT ......................................................... 274

Implementation ........................................................................ 274

Code Listing ............................................................................. 275

REFERENCES................................................................................... 277

9.1

9.1.1

9.1.2

9.2

9.2.1

9.2.2

9.3

CHAPTER 9 IMAGE PROCESSING

TWO-DIMENSIONAL CONVOLUTION .................................... 279

Implementation ........................................................................ 280

Code Listing ............................................................................. 283

MEDIAN FILTERING (3

×

3) ........................................................... 285

Implementation ........................................................................ 285

Code Listing ............................................................................. 286

HISTOGRAM EQUALIZATION................................................... 288

9.3.1

9.3.2

9.4

9.4.1

9.4.2

9.5

Implementation ........................................................................ 289

Code Listing ............................................................................. 290

ONE-DIMENSIONAL MEDIAN FILTERING ............................ 292

Implementation ........................................................................ 292

Code Listings ............................................................................ 294

REFERENCES................................................................................... 298

CHAPTER 10

10.1

10.1.1

10.1.2

10.1.3

10.2

10.2.1

10.2.2

10.2.3

10.3

10.3.1

10.3.2

10.3.3

10.3.4

10.3.5

10.3.6

10.3.7

10.3.8

10.4

JTAG DOWNLOADER

HARDWARE .................................................................................... 300

Details ........................................................................................ 301

Test Access Port Operations ................................................... 305

Timing Considerations ........................................................... 308

SOFTWARE ...................................................................................... 310

TMS & TDI Bit Generation ..................................................... 311

Software Example .................................................................... 313

Summary: How To Make The EPROM ................................ 316

DETAILED TMS & TDI BEHAVIOR ............................................ 316

Code Listings ............................................................................ 320 pub21k.h .................................................................................... 320 pub21k.c .................................................................................... 322 s2c.c ............................................................................................ 324 c2b.c ........................................................................................... 326 b2b.c ........................................................................................... 330 stox.c .......................................................................................... 331

Loader Kernel ........................................................................... 332

REFERENCE ..................................................................................... 336

INDEX ................................................................................................ 337

FIGURES

Figure 1.1

ADSP-21020 Block Diagram ....................................................... 9

Figure 1.2

ADSP-21020 System Diagram .................................................... 9

Figure 1.3

ADSP-21060 Block Diagram ..................................................... 12

Figure 1.4

ADSP-21060 System Diagram .................................................. 13

Figure 1.5

ADSP-21060 Multiprocessing System Diagram .................... 14

Figure 4.1

Delay Line ................................................................................... 94 xi

xii

Figure 6.1

System Identification Model .................................................. 158

Figure 6.2

Transversal FIR Filter Structure............................................. 161

Figure 6.3

Symmetric Transversal Filter Structure ................................ 162

Figure 6.4

One Stage Of Lattice FIR ......................................................... 163

Figure 6.5

Generic Adaptive Filter .......................................................... 167

Figure 7.1

Flow Graph Of Butterfly Calculation ................................... 208

Figure 7.2

32-Point Radix-2 DIT FFT ...................................................... 209

Figure 8.1

Cubic Bezier Polynomial ........................................................ 244

Figure 8.2

Register Assignments For Cubic Bezier Polynomial .......... 245

Figure 8.3

Cubic B-Spline Polynomial..................................................... 248

Figure 8.4

Register Assignments For Cubic B-Spline Polynomial ...... 249

Figure 8.5

BitBlt .......................................................................................... 253

Figure 8.6

Register Usage For BitBlt ........................................................ 253

Figure 9.1

3x3 Convolution Matrix .......................................................... 281

Figure 9.2

3x3 Convolution Operation .................................................... 281

Figure 9.3

Histogram Of Dark Picture .................................................... 288

Figure 9.4

Histogram Of Bright Picture .................................................. 289

Figure 9.5

Median Filter Algorithm ......................................................... 293

Figure 10.1

System Diagram ....................................................................... 301

Figure 10.2

Block Diagram .......................................................................... 302

Figure 10.3

Prototype Schematic ................................................................ 303

Figure 10.4

Prototype Board Layout ......................................................... 304

Figure 10.5

JTAG Test Access Port States ................................................. 305

Figure 10.6

Worst-Case Data Setup To Clock Time ................................ 309

Figure 10.7

TMS & TDI Timing From RESET Through Start

Of First Scan Of DR ................................................................. 317

Figure 10.8

TMS & TDI Timing From End Of First Scan To

Start Of Second Scan ............................................................... 318

Figure 10.9

Other TMS & TDI Timing ....................................................... 319

TABLES

Table 1.1

Table 6.1

Table 6.2

Table 6.3

ADSP-21060 Benchmarks (@ 40 MHz).................................... 11

Transversal FIR LMS Performance & Memory

Benchmarks For Filters Of Order N ...................................... 202

LMS Algorithm Benchmarks For

Different Filter Structures ....................................................... 202

LMS vs. RLS Benchmark Performance ................................. 203

Table 10.1

Parts List.................................................................................... 304

Table 10.2

JTAG States Used By The Downloader ................................ 306

Table 10.3

Downloader Operations ......................................................... 307

Table 10.4

Source Code Description & Usage ........................................ 310

Table 10.5

Bitstream/EPROM Byte Relationship .................................. 311

Table 10.6

TMS Values For State Transitions ......................................... 312

Table 10.7

TDI Values For IRSHIFT & DRSHIFT .................................. 312

Table 10.8

kernel.ach - Architecture File Used With kernel.asm ......... 313

Table 10.9

kernel.stk - Stacked-format spl21k Output .......................... 314

Table 10.10

kernel.s0 - pub21k Output Used To Burn

Downloader EPROM .............................................................. 315

LISTINGS

Listing 2.1

sin.asm ......................................................................................... 20

Listing 2.2

sintest.asm................................................................................... 21

Listing 2.3

tan.asm ........................................................................................ 26

Listing 2.4

atan.asm ...................................................................................... 32

Listing 2.5

sqrt.asm ....................................................................................... 37

Listing 2.6

isqrt.asm ...................................................................................... 39

Listing 2.7

sqrtsgl.asm .................................................................................. 41

Listing 2.8

isqrtsgl.asm ................................................................................. 43

Listing 2.9

Divide..asm ................................................................................. 45

Listing 2.10 logs.asm ....................................................................................... 51

Listing 2.11 Exponential Subroutine ............................................................ 57

Listing 2.12 pow.asm ...................................................................................... 67

Listing 2.13 asm_glob.h .................................................................................. 68

Listing 2.14 pow.h ........................................................................................... 69

Listing 3.1

MxNxNx1.asm ........................................................................... 76

Listing 3.2

MxNxNxO.asm .......................................................................... 80

Listing 3.3

matinv.asm ................................................................................. 87

Listing 4.1

firtest.asm .................................................................................... 97

Listing 4.2

fir.asm .......................................................................................... 99

Listing 4.3

Filter Specifications From FDAS ........................................... 102

Listing 4.4

iirmem.asm ............................................................................... 108

Listing 4.5

cascade.asm .............................................................................. 110

Listing 5.1

decimate.asm ............................................................................ 121

Listing 5.2

interpol.asm .............................................................................. 128

Listing 5.3

ratiobuf.asm .............................................................................. 137 xiii

Listing 5.4

rat2int.asm ................................................................................ 142

Listing 5.5

dec2stg.asm ............................................................................... 149

Listing 5.6

int2stg.asm ................................................................................ 155

Listing 6.1

lms.asm...................................................................................... 170

Listing 6.2

llms.asm .................................................................................... 173

Listing 6.3

nlms.asm ................................................................................... 176

Listing 6.4

selms.asm .................................................................................. 179

Listing 6.5

sdlms.asm ................................................................................. 182

Listing 6.6

sslms.asm .................................................................................. 185

Listing 6.7

sylms.asm .................................................................................. 188

Listing 6.8

latlms.asm ................................................................................. 193

Listing 6.9

rls.asm........................................................................................ 198

Listing 6.10 testafa.asm ................................................................................ 201

Listing 7.1

FFT.ACH ................................................................................... 217

Listing 7.2

fftrad2.asm ................................................................................ 224

Listing 7.3

fftrad4.asm ................................................................................ 231

Listing 7.4

twidrad2.c ................................................................................. 233

Listing 7.5

twidrad4.c ................................................................................. 235

Listing 8.1

accej.asm.................................................................................... 243

Listing 8.2

bezier.asm ................................................................................. 247

Listing 8.3

B-spline.asm.............................................................................. 252

Listing 8.4

bitblt.asm ................................................................................... 256

Listing 8.5

bresen.asm ................................................................................ 261

Listing 8.6

transf.asm .................................................................................. 266

Listing 8.7

mul44x41.asm ........................................................................... 270

Listing 8.8

tblllkup.asm .............................................................................. 273

Listing 8.9

xprod.asm ................................................................................. 277

Listing 9.1

CONV3x3.ASM ........................................................................ 284

Listing 9.2

med3x3.asm .............................................................................. 287

Listing 9.3

histo.asm ................................................................................... 292

Listing 9.4

Fixed-Point 1-D Median Fillter .............................................. 296

Listing 9.5

Floating-Point 1-D Median Fillter ......................................... 298 xiv

2 – 10

Listing 10.1 pub21k.h .................................................................................... 322

Listing 10.2 pub21k.c .................................................................................... 323

Listing 10.3 s2c.c ............................................................................................ 325

Listing 10.4 c2b.c ........................................................................................... 329

Listing 10.5 b2b.c ........................................................................................... 331

Listing 10.6 stox.c .......................................................................................... 331

Listing 10.7 Loader Kernal ........................................................................... 335

advertisement

Related manuals

Download PDF

advertisement