Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections,
modifications, enhancements, improvements, and other changes to its products and services at any
time and to discontinue any product or service without notice. Customers should obtain the latest
relevant information before placing orders and should verify that such information is current and
complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order
acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale
in accordance with TI’s standard warranty. Testing and other quality control techniques are used to the
extent TI deems necessary to support this warranty. Except where mandated by government
requirements, testing of all parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are
responsible for their products and applications using TI components. To minimize the risks associated
with customer products and applications, customers should provide adequate design and operating
safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI
patent right, copyright, mask work right, or other TI intellectual property right relating to any
combination, machine, or process in which TI products or services are used. Information published by
TI regarding third-party products or services does not constitute a license from TI to use such products
or services or a warranty or endorsement thereof. Use of such information may require a license from
a third party under the patents or other intellectual property of the third party, or a license from TI under
the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices.
Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not
responsible or liable for such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by
TI for that product or service voids all express and any implied warranties for the associated TI product
or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such
statements.
Following are URLs where you can obtain information on other Texas Instruments products and
application solutions:
ProductsApplications
Amplifiersamplifier.ti.comAudiowww.ti.com/audio
Data Convertersdataconverter.ti.comAutomotivewww.ti.com/automotive
DSPdsp.ti.comBroadbandwww.ti.com/broadband
Interfaceinterface.ti.comDigital Controlwww.ti.com/digitalcontrol
Logiclogic.ti.comMilitarywww.ti.com/military
Power Mgmtpower.ti.comOptical Networkingwww.ti.com/opticalnetwork
Microcontrollersmicrocontroller.ti.comSecuritywww.ti.com/security
Telephonywww.ti.com/telephony
Video & Imagingwww.ti.com/video
Wirelesswww.ti.com/wireless
This document describes the C64x+ digital signal processor little-endian
(DSP) Library, or DSPLIB for short.
Notational Conventions
This document uses the following conventions:
- Hexadecimal numbers are shown with the suffix h. For example, the
- Registers in this document are shown in figures and described in tables.
- Macro names are written in uppercase text; function names are written in
Preface
Read This First
following number is 40 hexadecimal (decimal 64): 40h.
lowercase.
J Each register figure shows a rectangle divded into fields that repre-
sent the fields of the register . Each field is labeled with its bit name, its
beginning and ending bit numbers above, and its read/write properties
below. A legend explains the notation used for the properties.
J Reserved bits i n a register figure designate a bit that is used for future
device expansion.
Related Documentation From Texas Instruments
The following books describe the C6000™ devices and related support tools.
Copies of these documents are available on the Internet at www.ti.com
Enter the literature number in the search box provided at www.ti.com.
SPRU732 — TMS320C64x/C64x+ DSP CPU and Instruction Set
Reference Guide. Describes the CPU architecture, pipeline, instruction
set, and interrupts for the TMS320C64x and TMS320C64x+ digital
signal processors (DSPs) of the TMS320C6000 DSP family. The
C64x/C64x+ DSP generation comprises fixed-point devices in the
C6000 DSP platform. The C64x+ DSP is an enhancement of the C64x
DSP with added functionality and an expanded instruction set.
. Tip:
iRead This First
Trademarks
Trademarks
SPRAA84 — TMS320C64x to TMS320C64+ CPU Migration Guide.
Describes migrating from the Texas Instruments TMS320C64x digital
signal processor (DSP) to the TMS320C64x+ DSP. The objective of this
document is to indicate dif ferences between the two cores. Functionality
in the devices that is identical is not included.
C6000, TMS320C64x+, TMS320C64x, C64x are trademarks of Texas
Instruments.
Provides a brief introduction to the TI C64x+ DSPLIBs, shows the organization of the routines
contained in the libraries, and lists the features and benefits of the DSPLIBs.
This chapter provides a brief introduction to the TI C64x+ DSP Libraries
(DSPLIB), shows the organization of the routines contained in the library, and
lists the features and benefits of the DSPLIB.
The TI C64x+ DSPLIB is an optimized DSP Function Library for C
programmers using devices that include the C64x+ megamodule. It includes
many C-callable, assembly-optimized, general-purpose signal-processing
routines. These routines are typically used in computationally intensive
real-time applications where optimal execution speed is critical. By using
these routines, you can achieve execution speeds considerably faster than
equivalent code written in standard ANSI C language. In addition, by providing
ready-to-use DSP functions, TI DSPLIB can significantly shorten your DSP
application development time.
The TI DSPLIB includes commonly used DSP routines. Source code is
provided that allows you to modify functions to match your specific needs.
The routines contained in the library are organized into the following seven
different functional categories:
- Adaptive filtering
J DSP_firlms2
- Correlation
J DSP_autocor
J DSP_autocor_rA8
- FFT
J DSP_fft16x16
J DSP_fft16x16_imre
J DSP_fft16x16r
J DSP_fft16x32
J DSP_fft32x32
J DSP_fft32x32s
J DSP_ifft16x16
J DSP_ifft16x16_imre
J DSP_ifft16x32
J DSP_ifft32x32
J DSP_fft16x16t (obolete, use DSP_fft16x16)
J DSP_bitrev_cplx (obsolete, use DSP_fft16x16)
J DSP_radix 2 (obsolete, use DSP_fft16x16)
J DSP_r4fft (obsolete, use DSP_fft16x16)
J DSP_fft (obsolete, use DSP_fft16x16)
You should read the README.txt file for specific details of the release.
The DSPLIB is provided in the file dsp64plus.zip. The file must be unzipped to
provide the following directory structure:
dsp
|
+−−README.txtTop−level README file
|
+−−docslibrary documentation
|
+−−examplesCCS project examples
|
|−−includeRequired include files
|
|−−liblibrary and source archives
|
|−−supportfft twiddle generation functions
|
Please install the contents of the lib directory in the default directory indicated
by your C_DIR environment. If you choose not to install the contents in the
default directory, update the C_DIR environment variable, for example, by
adding the following line in autoexec.bat file:
SET C_DIR=<install_dir>/lib;<install_dir>/include;%C_DIR%
Unless specifically noted, DSPLIB operates on Q.15-fractional data type
elements. Appendix A presents an overview of Fractional Q formats.
2.2.1.2DSPLIB Arguments
TI DSPLIB functions typically operate over vector operands for greater
efficiency. Even though these routines can be used to process short arrays, or
even scalars (unless a minimum size requirement is noted), they will be slower
for those cases.
- Vector stride is always equal to 1: Vector operands are composed of vector
elements held in consecutive memory locations (vector stride equal to 1).
- Complex elements are assumed to be stored in consecutive memory
locations with Real data followed by Imaginary data.
- In-place computation is not allowed, unless specifically noted: Source
operand cannot be equal to destination operand.
2-3Installing and Using DSPLIB
Using DSPLIB
Using DSPLIB
2.2.2Calling a DSPLIB Function From C
In addition to correctly installing the DSPLIB software, follow these steps to
include a DSPLIB function in the code:
- Include the function header file corresponding to the DSPLIB function
- Link the code with dsp64plus.lib
- Use a correct linker command file for the platform used.
The examples in the DSP\Examples folder show how to use the DSPLIB in a
Code Composer Studio C envirionment.
2.2.3Calling a DSP Function From Assembly
The C64x+ DSPLIB functions were written to be used from C. Calling the
functions from assembly language source code is possible as long as the
calling function conforms to the Texas Instruments C64x+ C compiler calling
conventions. For more information, see Section 8 (Runtime Environment) of
TMS320C6000 Optimizing C Compiler User’s Guide (SPRU187).
2.2.4DSPLIB Testing − Allowable Error
DSPLIB is tested under the Code Composer Studio environment against a
reference C implementation. You can expect identical results between
Reference C implementation and its Assembly implementation when using
test routines that focus on fixed-point type results. The test routines that deal
with floating points typically allow an error margin of 0.000001 when
comparing the results of reference C code and DSPLIB assembly code.
2.2.5DSPLIB Overflow and Scaling Issues
The DSPLIB functions implement the same functionality of the reference C
code. You must conform to the range requirements specified in the API
function, and in addition, restrict the input range so that the outputs do not
overflow.
In FFT functions, twiddle factors are generated with a fixed scale factor; i.e.,
32767(=2
DSP_fft32x32s, 2147483647(=2
Twiddle factors cannot be scaled further to not scale input data. Because
DSP_fft16x16r and DSP_f ft32x32s perform scaling by 2 at each radix-4 stage,
the input data must be scaled by 2
overflow. I n all other FFT functions, the input data must be scaled by 2
because no scaling is done by the functions.
15−1
) for all 16-bit FFT functions, 1073741823(=2
31−1
) for all other 32-bit FFT functions.
(log2(nx)−cei[log4(nx)−1])
to completely prevent
30−1
) for
(log2(nx))
2-4
2.2.6Interrupt Behavior of DSPLIB Functions
All of the functions in this library are designed to be used in systems with
interrupts. Thus, it is not necessary to disable interrupts when calling any of
these functions. The functions in the library will disable interrupts as needed to
protect the execution of code in tight loops and so on. Library functions have
three categories:
- Fully-interruptible: These functions do not disable interrupts. Interrupts
are blocked by at most 5 to 10 cycles at a time (not counting stalls) by
branch delay slots.
- Partially-interruptible: These functions disable interrupts for long
periods of time, with small windows of interruptibility. Examples include a
function with a nested loop, where the inner loop is non-interruptible and
the outer loop permits interrupts between executions of the inner loop.
- Non-interruptible: These functions disable interrupts for nearly their
entire duration. Interrupts may happen for a short time during the setup
and exit sequence.
How to Rebuild DSPLIB
Note that all three function categories tolerate interrupts. That is, an interrupt
can occur at any time without affecting the function correctness. The
interruptibility of the function only determines how long the kernel might delay
the processing of the interrupt.
2.3How to Rebuild DSPLIB
If you would like to rebuild DSPLIB (for example, because you modified the
source file contained in the archive), you will have to use the mk6x utility as
follows:
mk6x dsp64plus.src −mv64plus −l dsp64plus.lib
2-5Installing and Using DSPLIB
2-6
Chapter 3
DSPLIB Function Tables
This chapter provides tables containing all DSPLIB functions, a brief
description of each, and a page reference for more detailed information.
3.4Differences Between the C64x and C64x+ DSPLIBs3-8
3-1
Arguments and Conventions Used
3.1Arguments and Conventions Used
The following convention has been used when describing the arguments for
each individual function:
Table 3−1. Argument Conventions
ArgumentDescription
x,yArgument reflecting input data vector
rArgument reflecting output data vector
nx,ny,nrArguments reflecting the size of vectors x,y, and r, respectively. For
functions in the case nx = ny = nr, only nx has been used across.
hArgument reflecting filter coefficient vector (filter routines only)
nhArgument reflecting the size of vector h
w
Some C64x+ functions have additional restrictions due to optimization using
new features such as higher multiply throughput. While these new functions
perform better, they can also lead to problems if not carefully used. For
example, DSP_autocor_rA8 is faster than DSP_autocor, but the output buffer
must be aligned to an 8−byte boundary. Therefore, the new functions are
named with any additional restrictions. Three types of restrictions are specified
to a pointer: minimum buffer size (M), buffer alignment (A), and the number of
elements in the buffer to be a multiple of an integer (X).The following
convention has been used when describing the arguments for each individual
function:
A kernel function foo with two parameters, m and n, with the following
restrictions:
m −> Minimum buffer size = 8, buffer alignment = double word, buffer
needs to be a multiple of 8 elements
n −> Minimum buffer size = 32, buffer alignment = word , buffer needs to be
a multiple of 16 elements
This function would be named: foo_mM8A8X8_nM32A4X16.
3-2
3.2DSPLIB Functions
The routines included in the DSP library are organized into eight functional
categories and listed below in alphabetical order.
- Adaptive filtering
- Correlation
- FFT
- Filtering and convolution
- Math
- Matrix functions
- Miscellaneous
- Obsolete functions
DSPLIB Functions
3-3DSPLIB Function Tables
DSPLIB Function Tables
3.3DSPLIB Function Tables
Table 3−2. Adaptive Filtering
FunctionsDescriptionPage
long DSP_firlms2(short *h, short *x, short b, int nh)LMS FIR4-2
Table 3−3. Correlation
FunctionsDescriptionPage
void DSP_autocor(short *r,short *x, int nx, int nr)Autocorrelation4-4
void DSP_autocor_rA8(short *r,short *x, int nx, int nr)Autocorrelation ( r[] must be
double word aligned)
4-4
Table 3−4. FFT
FunctionsDescriptionPage
void DSP_fft16x16(short *w, int nx, short *x, short *y)Complex out of place, Forward
FFT mixed radix with digit
reversal. Input/Output data in
Re/Im order.
void DSP_fft16x16_imre(short *w, int nx, short *x, short
*y)
void DSP_fft16x16r(int nx, short *x, short *w, unsigned
char *brev, short *y, int radix, int offset, int n_max)
void DSP_fft16x32(short *w, int nx, int *x, int *y)Extended precision, mixed radix
Complex out of place, Forward
FFT mixed radix with digit
reversal. Input/Output data in
Im/Re order.
Cache-optimized mixed radix FFT
with scaling and rounding, digit
reversal, out of place. Input and
output: 16 bits, Twiddle factor: 16
bits.
FFT, rounding, digit reversal, out
of place. Input and output: 32 bits,
Twiddle factor: 16 bits.
4-8
4-11
4-14
4-24
void DSP_fft32x32(int *w, int nx, int *x, int *y)Extended precision, mixed radix
FFT, rounding, digit reversal, out
of place. Input and output: 32 bits,
Twiddle factor: 32 bits.
void DSP_fft32x32s(int *w, int nx, int *x, int *y)
3-4
Extended precision, mixed radix
FFT, digit reversal, out of place.,
with scaling and rounding. Input
and output: 32 bits, Twiddle
factor: 32 bits.
4-26
4-28
Table 3−4. FFT (Continued)
FunctionsPageDescription
DSPLIB Function Tables
void DSP_ifft16x16(short *w, int nx, short *x, short *y)Complex out of place, Inverse
FFT mixed radix with digit
reversal. Input/Output data in
Re/Im order.
void DSP_ifft16x16_imre(short *w, int nx, short *x, short
*y)
void DSP_ifft16x32(short *w, int nx, int *x, int *y)Extended precision, mixed radix
void DSP_ifft32x32(int *w, int nx, int *x, int *y)
Complex out of place, Inverse
FFT mixed radix with digit
reversal. Input/Output data in
Re/Im order.
IFFT, rounding, digit reversal, out
of place. Input and output: 32 bits,
Twiddle factor: 16 bits.
Extended precision, mixed radix
IFFT, digit reversal, out of place,
with scaling and rounding. Input
and output: 32 bits, Twiddle
factor: 32 bits.
4-28
4-28
4-34
4-36
Table 3−5. Filtering and Convolution
FunctionsDescriptionPage
void DSP_fir_cplx (short *x, short *h, short *r, int nh, int
nx)
void DSP_fir_cplx_hM4X4 (short *x, short *h, short *r, int
nh, int nx)
void DSP_fir_gen (short *x, short *h, short *r, int nh, int nr) FIR Filter (any nh)4-42
void DSP_fir_gen_hM17_rA8X8 (short *x, short *h, short
*r, int nh, int nr)
void DSP_fir_r4 (short *x, short *h, short *r, int nh, int nr)FIR Filter (nh is a multiple of 4)4-46
void DSP_fir_r8 (short *x, short *h, short *r, int nh, int nr)FIR Filter (nh is a multiple of 8)4-50
void DSP_fir_r8_hM16_rM8A8X8 (short *x, short *h, short
*r, int nh, int nr)
void DSP_fir_sym (short *x, short *h, short *r, int nh, int nr,
int s)
Complex FIR Filter (nh is a
multiple of 2)
Complex FIR Filter (nh is a
multiple of 4)
FIR Filter (r[] must be double
word aligned, nr must be multiple
of 8)
FIR Filter (r[] must be double
word aligned, nr is a multiple of 8)
Symmetric FIR Filter (nh is a
multiple of 8)
4-38
4-38
4-42
4-50
4-52
3-5DSPLIB Function Tables
DSPLIB Function Tables
Table 3−5. Filtering and Convolution (Continued)
FunctionsPageDescription
void DSP_iir(short *r1, short *x, short *r2, short *h2, short
*h1, int nr)
void DSP_iirlat(short *x, int nx, short *k, int nk, int *b,
short *r)
IIR with 5 Coefficients4-54
All−pole IIR Lattice Filter4-56
Table 3−6. Math
FunctionsDescriptionPage
int DSP_dotp_sqr(int G, short *x, short *y, int *r, int nx)Vector Dot Product and Square4-58
int DSP_dotprod(short *x, short *y, int nx)Vector Dot Product4-60
short DSP_maxval (short *x, int nx)Maximum Value of a Vector4-62
int DSP_maxidx (short *x, int nx)Index of the Maximum Element of
a Vector
short DSP_minval (short *x, int nx)Minimum Value of a Vector4-65
void DSP_mul32(int *x, int *y, int *r, short nx)32-bit Vector Multiply4-66
void DSP_neg32(int *x, int *r, short nx)32-bit Vector Negate4-68
void DSP_recip16 (short *x, short *rfrac, short *rexp, short
nx)
16-bit Reciprocal4-69
4-63
int DSP_vecsumsq (short *x, int nx)Sum of Squares4-71
void DSP_w_vec(short *x, short *y, short m, short *r, short
nr)
Weighted V ector Sum4-72
Table 3−7. Matrix
FunctionsDescriptionPage
void DSP_mat_mul(short *x, int r1, int c1, short *y, int c2,
short *r, int qs)
void DSP_mat_trans(short *x, short rows, short columns,
short *r)
3-6
Matrix Multiplication4-73
Matrix Transpose4-75
DSPLIB Function Tables
Table 3−8. Miscellaneous
FunctionsDescriptionPage
short DSP_bexp(int *x, short nx)Max Exponent of a Vector (for
scaling)
void DSP_blk_eswap16(void *x, void *r, int nx)Endian-swap a block of 16-bit
values
void DSP_blk_eswap32(void *x, void *r, int nx)Endian-swap a block of 32-bit
values
void DSP_blk_eswap64(void *x, void *r, int nx)Endian-swap a block of 64-bit
values
void DSP_blk_move(short *x, short *r, int nx)Move a Block of Memory4-84
void DSP_fltoq15 (float *x,short *r, short nx)Float to Q15 Conversion4-85
int DSP_minerror (short *GSP0_TABLE,short *errCoefs,
int *savePtr_ret)
void DSP_q15tofl (short *x, float *r, short nx)
Minimum Energy Error Search4-87
Q15 to Float Conversion4-89
4-76
4-78
4-80
4-82
Table 3−9. Obsolete Functions
FunctionsDescriptionPage
void DSP_bitrev_cplx (int *x, short *index, int nx)Use DSP_fft16x16() instead4-88
void DSP_radix2 (int nx, short *x, short *w)Use DSP_fft16x16() instead4-91
void DSP_r4fft (int nx, short *x, short *w)Use DSP_fft16x16() instead4-93
void DSP_fft(short *w, int nx, short *x, short *y)Use DSP_fft16x16() instead4-96
void DSP_fft16x16t(short *w, int nx, short *x, short *y)
Use DSP_fft16x16() instead4-107
3-7DSPLIB Function Tables
Differences Between the C64x and C64x+ DSPLIBs
3.4Differences Between the C64x and C64x+ DSPLIBs
The C64x+ DSPLIB was developed by optimizing some of the functions of the
C64x DSPLIB to take advantage of the C64x+ architecture.
Table 3−10 shows the optimized functions for the C64x+ DSPLIB.
There are two optimization types:
- SPLOOP conversion: Optimized code uses SPLOOP to provide
interruptibility and decrease power consumption. The new C64x+
instructions do not increase algorithm performance, and thus, are not
used.
- Kernel redesign, SPLOOP: Kernel of algorithm rewritten to take
advantage of the new C64x+ instructions and of the SPLOOP feature.
Table 3−10. Functions Optimized in the C64x+ DSPLIB
Any functions which were not optimized for the C64x+ have the same
performance as on the C64x.
3-10
Chapter 4
DSPLIB Reference
This chapter provides a list of the functions within the DSP library (DSPLIB)
organized into functional categories. The functions within each category are
listed in alphabetical order and include arguments, descriptions, algorithms,
benchmarks, and special requirements.
Function long DSP_firlms2(short * restrict h, const short * restrict x, short b, int nh)
Argumentsh[nh]Coefficient Array
x[nh+1]Input Array
bError from previous FIR
nhNumber of coefficients. Must be multiple of 4.
return longReturn value
DescriptionThe Least Mean Square Adaptive Filter computes an update of all nh
coefficients by adding the weighted error times the inputs to the original
coefficients. The input array includes the last nh inputs followed by a new
single sample input. The coefficient array includes nh coefficients.
AlgorithmThis is the C equivalent of the assembly code without restrictions. Note that
the assembly code is hand optimized and restrictions may apply.
long DSP_firlms2(short h[ ],short x[ ], short b,
int nh)
{
int i;
long r = 0;
for (i = 0; i < nh; i++) {
h[i] += (x[i] * b) >> 15;
r += x[i + 1] * h[i];
}
return r;
}
Special Requirements
- This routine assumes 16-bit input and output.
- The number of coefficients nh must be a multiple of 4.
4-2
Loading...
+ 139 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.