The ADSP21xxx Applications Handbook File Area contains ADSP21020 source code, utilities, and test data for various DSP algorithms. These code examples were written using preVisualDSP^{TM} tools, and they are optimized for the ADSP21020 architecture. To port the examples to the more recent SHARC platforms (ADSP2106x, ADSP2116x) it is necessary to create a VisualDSP project and make the appropriate changes. The application areas are divided into the files listed below and zipped using PKZIP version 2.04g. Most files contain REAME or .doc files with information on building and running the code. 



DFT.ZIP  
The file DFT.ZIP contains the following files which are an example of a Discrete Fourier Transform for use with the ADSP21020 Development Software. A detailed discussion of these operations can be found in the "ADSP21020 Development Software Tutorial". DFT.ASM: ADSP21020 source for an example 64 point DFT GENERIC.ACH: Architecture file (system description) for DFT example MAKEWAVE.C: C source for waveform generation utility MAKEWAVE.EXE: Waveform generation utility (created TEST64 and SIN64) PLOTCPLX.M: PCMATLAB script for plotting DFT results README.DFT: Read first SIN64.DAT: Sine (and shifted Cosine) table for DFT example TEST64.DAT: Input data (all real) for DFT example 

back to top  


FFTCMPLX.ZIP  
The file FFTCMPLX.ZIP contains the following files which are code and utilities for running and testing a radix2 FFT and a radix4 FFT on the ADSP21020. A PCMATLAB script file PLOTLOG.M is included for ploting and comparison of FFT results. DEF21020.H: Definitions for bits in the ADSP21020's system regs DOIT.BAT: DOS batch file to assemble, link, and start simulator FFT.ACH: Architecture file for FFT FFT.DOC: ADSP21020 FFT user notes FFTRAD2.ASM: ADSP21020 assembly code for radix2 FFT FFTRAD4.ASM: ADSP21020 assembly code for radix4 FFT INIMAG.DAT: Imaginary input array INREAL.DAT: Real input array MAKEWAVE.C: Source for FFT test waveform generation program MAKEWAVE.EXE: Executable for above PLOTLOG.M: PCMATLAB script for plotting FFT results README.FT2: Read first README.FT4: Read first TC2.DAT: Real twiddle factors from TWIDRAD2 program TC4.DAT: Real twiddle factors from TWIDRAD4 program TS2.DAT: Imaginary twiddle factors from TWIDRAD2 program TS4.DAT: Imaginary twiddle factors from TWIDRAD4 program TWIDRAD2.C: Source for FFT twiddle factor generation program TWIDRAD2.EXE: Executable for above TWIDRAD4.C: Source for FFT twiddle factor generation program TWIDRAD4.EXE: Executable for above 

back to top  


FFTFIR.ZIP  
The file FFTFIR.ZIP contains the following code and utilities for running and testing a fast FIR filter on the ADSP21020. COEFF.DAT: Coefficient file DEF21020.H: Definitions for bits in the ADSP21020's system regs EZLAB21K.ACH: 21020 EZLAB board architecture file FCOEF.DAT: Filter coefficients FFIR.ASM: Demonstrates the use of FFTs to implement fast FIR filters FFIR.EXE: Fast FIR executable file FFIR.H: Contains preprocessor variable definitions FFIRCOEF.C: Converts FIR taps into coefficients for FFIR FFIRCOEF.EXE: Executable for above IMPULSE.DAT: Impulse data IMTRANS.DAT: Imaginary transfer function data generated by ffircoef.c RETRANS.DAT: Real transfer function data generated by ffircoef.c TC.DAT: Real twiddle factors from TWIDRAD4 program TS.DAT: Imaginary twiddle factors from TWIDRAD4 program TWIDRAD4.C: Source for FFT twiddle factor generation program TWIDRAD4.EXE: Executable for above _FFTRAD4.ASM: Assembly code for the radix4 FFT 

back to top  


FFTREAL.ZIP  
The file FFTREAL.ZIP contains the following code and utilities for running the real FFT programs:rfft2.asm a real radix2 FFT rfft4.asm a real radix4 FFT irfft2.asm an inverse real radix2 program irfft4.asm an inverse real radix4 program DEF21020.H: Definitions for bits in the ADSP21020's system regs DOIT.BAT: DOS batch file to assemble, link, and start simulator EVREAL.DAT: Real evenindexed time domain input data FFT.ACH: Architecture file for FFT FFT.DOC: ADSP21020 FFT user notes INIMFFT.DAT: Imaginary frequency domain input data INREAL.DAT: Real time domain input data INREFFT.DAT: Real frequency domain input data IRF2TBL.C: Table generation program for irfft2.asm IRF2TBL.EXE: Executable for above IRF4TBL.C: Table generation program for irfft4.asm IRF4TBL.EXE: Executable for above IRFFT2.ASM: Inverse real radix2 FFT routine IRFFT4.ASM: Inverse real radix4 FFT routine MAKESPLT.C: Source for a waveform gen. program that will split the even indexed data into one file and the odd indexed data into another. Used for rfft4.asm. MAKESPLT.EXE: Executable for above MAKEWAVE.C: Source for FFT test waveform generation program MAKEWAVE.EXE: Executable for above ODREAL.DAT: Real oddindexed time domain input data PLOTREAL.M: PCMATLAB script for plotting FFT results of rfft2.asm README: Read first RFFT2.ASM: Real radix2 FFT RFFT2TBL.C: Table generation program for rfft2.asm RFFT2TBL.EXE: Executable for above RFFT4.ASM: Real radix4 FFT RFFT4TBL.C: Table generation program for rfft4.asm RFFT4TBL.EXE: Executable for above TC2.DAT: Real twiddle factors for radix 2 routines TC4.DAT: Real twiddle factors for radix 4 routines THC.DAT: Half cosine table for conversion stage (FFT) THS.DAT: Half sine table for conversion stage (FFT) TNC.DAT: (1/N) cosine table for conversion stage (IFFT) TNS.DAT: (1/N) sine table for conversion stage (IFFT) TS2.DAT: Imaginary twiddle factors for radix 2 routines TS4.DAT: Imaginary twiddle factors for radix 4 routines 

back to top  


FILTER.ZIP  
The file FILTER.ZIP holds all the files required for an ADSP21020 programming example. A complete description of two such examples is given in a section of the "ADSP21020 User's Manual" called "Assembly Programmer's Tutorial". Refer to that for details. Both examples ("IIRMEM" and "IIRIRQ") filter data using infinite impulse response (IIR) filters. The examples consist of a main calling program and called subroutines. Technical information on the filters themselves is also presented in the user's manual. CASCADE.ASM: Cascaded biquad filter subroutine (called by main program) DEF21020.H: Bit position definitions for ADSP21020 system registers FIR.ASM: FIR Subroutine FIRCOEFS.DAT: Coefficient file FIRTEST.ASM: Example calling routine GENERIC.ACH: Example architecture file IIRCOEFS.DAT: Filter coefficients IRIRQ.ACH: Architecture description file IIRIRQ.ASM: Main assembly program IIRMEM.ASM: Main assembly program INPUT.DAT: Example port emulation file... the input data MAKEFILE.FIR: Builds the example MAKEFILE.IRQ: "Make" file used to create the executable main program MAKEFILE.MEM: "Make" file used to create the executable main program OUT300.DAT: Example output port result data README.FIR: Readme file for the FIR filter routine README.IRQ: Readme file for the IIRIRQ filter routine README.MEM: Readme file for the IIRMEM filter routine 

back to top  


FUNCTION.ZIP  
The file FUNCTION.ZIP contains the following code and utilities to perform mathematical funtions (sin,cos,tan,exp,sqrt,divide etc..) on the ADSP21020. 21K.ACH: Architecture file ACOMPRES.ASM: ALaw compression routine AEXPAND.ASM: ALaw expansion routine ASM_GLOB.H: Assembly library include file ATAN.ASM: Computes arctangent value of a floating point input DEF21020.H: Bit definitions DIVIDE.ASM: Floating point divide routine DIVSGL.ASM: Divide routine to single precision accuracy EXP.ASM: Exponential routine ISQRT.ASM: Inverse square root routine ISQRTSGL.ASM: Inverse square root to single precison accuracy LOGS.ASM: Logarithm routine MAKESIN.BAT: Builds the example code and calls up the simulator POW.ASM: Computes X raised to the Y power of 2 floating point inputs POW.H: Include file used by power routine README: Info file RECIP.ASM: Reciprocal of its floating point input SIN.ASM: Sine routine SINTEST.ASM: Example calling routine SQRT.ASM: Square root routine SQRTSGL.ASM: Square root to single precision accuracy TAN.ASM: Tangent routine UCOMPRES.ASM: MuLaw compression routine UEXPAND.ASM: MuLaw expansion routine 

back to top  


GRAPHICS.ZIP  
The file GRAPHICS.ZIP contains the following code and utilities to perform graphics funtions on the ADSP21020. 21K.ACH: Architecture file ACCREJ.ASM: Graphics trivial line accept/reject ACCREJ.H: Include file for accrej.asm BEZIER.ASM: Cubic Bezier polynomial evaluation BITBLT.ASM: Bit block transfer BRESEN.ASM: Bresenham line drawing BSPLINE.ASM: Cubic bspline polynomial evaluation ILLUM3D.ASM: 3D graphics illumination MUL44X41.ASM: Multiply 4x4 by 4x1 matrices POLYEVAL.ASM: Norder polynomial evaluation of two values README: Graphics & imaging benchmarks TBLLKUP.ASM: Table lookup with interpolation TRANSF.ASM: 3D graphics translation, rotation and scaling XPROD.ASM: Vector cross product 

back to top  


IMAGING.ZIP  
The file IMAGING.ZIP contains the following sample imaging applications. Each application is a subroutine call whose arguments and return values are described in detail in the source file FILENAME.asm. CONV3X3.ASM: 3x3 Convolution on an NxN array HISTO.ASM: Histogram Evaluation MED3X3.ASM: Median Filtering (3x3) 

back to top  


JTAG.ZIP  
The file JTAG.ZIP contains the following programs that read spl21k stackedformat output files, and write Motorola Exorciserformat Srecords for burning EPROMs for the EPROMbased 21020 JTAG Downloader Board. This board is described in an Analog Devices' DSP Division Application Note entitled "A JTAG Boot Downloader for the ADSP21020". B2B.C: Reads bytes created by code2bytes.c C2B.C: Translates object code structure to EPROM bytes PUB21K.C: Reads spl21k stackedformat output files PUB21K.EXE: Executable file PUB21K.H: Include file for pub21k.c README: Info file S2C.C: Reads splitter stacked format file, creates code structure STOX.C: Converts hexadecimal string to integer 

back to top  


LMS_RLS.ZIP  
The file LMS_RLS.ZIP contains the following code and utilities for running and testing the Least Mean Squares (LMS) algorithm, its modified versions, and the Recursive Least Squares (RLS) algorithm. DESIRED.DAT: Desired data ERR.DAT: Data file ERR1.DAT: Data file ERR2.DAT: Data file ERR3.DAT: Data file ERR4.DAT: Data file ERR5.DAT: Data file ERR6.DAT: Data file ERR7.DAT: Data file ERR8.DAT: Data file GENERIC.ACH: Contains architecture description LATLMS.ASM: Performs the LMS algorithm realized with a lattice FIR filter structure with Joint Process Estimation LLMS.ASM: Performs the leaky LMS algorithm implemented with a transversal FIR filter structure LMS.ASM: Performs the LMS algorithm implemented with a transversal FIR filter structure MACROS.H: Contains different macros, especially the DIVIDE macro used in the RLS and the normalized LMS algorithms NLMS.ASM: Performs the normalized LMS algorithm implemented with a transversal FIR filter structure README.LMS: Read first RLS.ASM: Performs the RLS algorithm implemented with a transversal FIR filter structure SDLMS.ASM: Performs the signdata LMS algorithm implemented with a transversal FIR filter structure SELMS.ASM: Performs the signerror LMS algorithm implemented with a transversal FIR filter structure SSLMS.ASM: Performs the signsign LMS algorithm implemented with a transversal FIR filter structure SYLMS.ASM: Performs the LMS algorithm realized with a symmetric transversal FIR filter structure TESTAFA.ASM: Testing shell for the various adaptive algorithms 

back to top  


MATRIX.ZIP  
The file MATRIX.ZIP contains some example matrix multiply routines which operate on matrices of arbitrary dimension on the ADSP21020. GENERIC.ACH: ADSP21020 generic achitecure decription file MACROS.H: General purpose macros MATINV.ASM: Inverts a square matrix MAT_A.DAT: Example input data file for mxnxnxo.asm and mxnxnx1.asm MAT_A1.DAT: Example input data file MAT_B.DAT: Example input data file for mxnxnxo.asm MAT_BB.DAT: Example input data file for mxnxnx1.asm MXNXNX0.ASM: Matrix times a matrix source code MXNXNX1.ASM: Matrix times a vector source code README.MAT: Info file 

back to top  


MULTRATE.ZIP  
The file MULTRATE.ZIP contains the following code and utilities for running and testing multirate filters using the ADSP21020. DEC2STG.EXE: Multirate timebased twostage decimator DECIMATE.EXE: Multirate timebased decimator INTERPOL.EXE: Multirate timebased interpolator INTSTG.EXE: Multirate timebased 2stage interpolator RATIOBUF.EXE: Multirate timebased rational rate changer RAT_2INT.EXE: Multirate interruptbased rational rate changer Note: All of the files in this directory are selfextracting compressed files. 

back to top  


RAD2FIR.ZIP  
The file RAD2FIR.ZIP contains the following code and utilities for running and testing a radix2 FIR filter on the ADSP21020. COEFF.DAT: Coefficient file DEF21020.H: Definitions for bits in the ADSP21020's system regs EZLAB21K.ACH: 21020 EZLAB board architecture file FCOEF.DAT: Filter coefficients GENERIC.ACH: Architecture file MKR2COEF.C: Converts direct form FIR coefficients into radix2 FIR coefficients MKR2COEF.EXE: Executable for above R2FIR.ASM: ADSP21020 radix2 FIR filter R2FIREZ.ASM: ADSP21020 radix2 FIR filter EZLAB example README: Info file 

back to top 
© 1995  Analog Devices, Inc. All Rights Reserved