找回密码
 注册
搜索
查看: 662|回复: 1

[综合资料] TMS320C55x DSP Programmer's Guide

[复制链接]
发表于 2006-2-21 12:02:00 | 显示全部楼层 |阅读模式
TMS320C55x DSP Programmer's Guide
1 Introduction 1-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lists some key features of the TMS320C55x DSP architecture and recommends a process for
code development.
1.1 TMS320C55x Architecture 1-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Code Development Flow for Best Performance 1-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 Tutorial 2-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Uses example code to walk you through the code development flow for the TMS320C55x DSP.
2.1 Introduction 2-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Writing Assembly Code 2-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.1 Allocate Sections for Code, Constants, and Variables 2-5 . . . . . . . . . . . . . . . . . . . .
2.2.2 Processor Mode Initialization 2-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.3 Setting up Addressing Modes 2-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Understanding the Linking Process 2-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 Building Your Program 2-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.1 Creating a Project 2-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.2 Adding Files to the Workspace 2-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.3 Modifying Build Options 2-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.4 Building the Program 2-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5 Testing Your Code 2-19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.6 Benchmarking Your Code 2-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3 Optimizing C Code 3-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Describes how you can maximize the performance of your C code by using certain compiler
options, C code transformations, and compiler intrinsics.
3.1 Introduction to Writing C/C++ Code for a C55x DSP 3-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.1 Tips on Data Types 3-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.2 How to Write Multiplication Expressions Correctly in C Code 3-3 . . . . . . . . . . . . . .
3.1.3 Memory Dependences 3-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.4 Analyzing C Code Performance 3-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Compiling the C/C++ Code 3-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Compiler Options 3-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.2 Performing Program-Level Optimization (−pm Option) 3-9 . . . . . . . . . . . . . . . . . . . .
3.2.3 Using Function Inlining 3-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 Profiling Your Code 3-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.1 Using the clock() Function to Profile 3-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.2 Using CCS 2.0 to Profile 3-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
viii
3.4 Refining the C/C++ Code 3-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.1 Generating Efficient Loop Code 3-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.2 Efficient Use of MAC hardware 3-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.3 Using Intrinsics 3-29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.4 Using Long Data Accesses for 16-Bit Data 3-34 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.5 Simulating Circular Addressing in C 3-35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.6 Generating Efficient Control Code 3-39 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.7 Summary of Coding Idioms for C55x 3-40 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.5 Memory Management Issues 3-42 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.5.1 Avoiding Holes Caused by Data Alignment 3-42 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.5.2 Local vs. Global Symbol Declarations 3-43 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.5.3 Stack Configuration 3-43 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.5.4 Allocating Code and Data in the C55x Memory Map 3-44 . . . . . . . . . . . . . . . . . . . . .
3.5.5 Allocating Function Code to Different Sections 3-48 . . . . . . . . . . . . . . . . . . . . . . . . .
4 Optimizing Assembly Code 4-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Describes some of the opportunities for optimizing TMS320C55x assembly code and provides
corresponding code examples.
4.1 Efficient Use of the Dual-MAC Hardware 4-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.1 Implicit Algorithm Symmetry 4-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.2 Loop Unrolling 4-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.3 Multichannel Applications 4-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.4 Multi-Algorithm Applications 4-15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Using Parallel Execution Features 4-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.1 Built-In Parallelism 4-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2 User-Defined Parallelism 4-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.3 Architectural Features Supporting Parallelism 4-17 . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.4 User-Defined Parallelism Rules 4-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.5 Process for Implementing User-Defined Parallelism 4-22 . . . . . . . . . . . . . . . . . . . . .
4.2.6 Parallelism Tips 4-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.7 Examples of Parallel Optimization Within CPU Functional Units 4-25 . . . . . . . . . .
4.2.8 Example of Parallel Optimization Across the A-Unit, P-Unit, and D-Unit 4-35 . . . .
4.3 Implementing Efficient Loops 4-42 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.1 Nesting of Loops 4-42 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.2 Efficient Use of repeat(CSR) Looping 4-46 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.3 Avoiding Pipeline Delays When Accessing Loop-Control Registers 4-48 . . . . . . . .
4.4 Minimizing Pipeline and IBQ Delays 4-49 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.1 Process to Resolve Pipeline and IBQ Conflicts 4-53 . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.2 Recommendations for Preventing Pipeline Delays 4-54 . . . . . . . . . . . . . . . . . . . . . .
4.4.3 Memory Accesses and the Pipeline 4-72 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.4 Recommendations for Preventing IBQ Delays 4-79 . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
ix Contents
5 Fixed-Point Arithmetic 5-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Explains important considerations for doing fixed-point arithmetic with the TMS320C55x DSP.
Includes code examples.
5.1 Fixed-Point Arithmetic − a Tutorial 5-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.1 2s-Complement Numbers 5-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.2 Integers Versus Fractions 5-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.3 2s-Complement Arithmetic 5-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 Extended-Precision Addition and Subtraction 5-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.1 A 64-Bit Addition Example 5-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.2 A 64-Bit Subtraction Example 5-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Extended-Precision Multiplication 5-14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 Division 5-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.1 Integer Division 5-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.2 Fractional Division 5-23 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 Methods of Handling Overflows 5-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5.1 Hardware Features for Overflow Handling 5-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6 Bit-Reversed Addressing 6-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduces bit-reverse addressing and its implementation on the TMS320C55x DSP. Includes
code examples.
6.1 Introduction to Bit-Reverse Addressing 6-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 Using Bit-Reverse Addressing In FFT Algorithms 6-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3 In-Place Versus Off-Place Bit-Reversing 6-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4 Using the C55x DSPLIB for FFTs and Bit-Reversing 6-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7 Application-Specific Instructions 7-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Explains how to implement some common DSP algorithms using specialized TMS320C55x
instructions. Includes code examples.
7.1 Symmetric and Asymmetric FIR Filtering (FIRS, FIRSN) 7-2 . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.1 Symmetric FIR Filtering With the firs Instruction 7-3 . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.2 Antisymmetric FIR Filtering With the firsn Instruction 7-4 . . . . . . . . . . . . . . . . . . . . .
7.1.3 Implementation of a Symmetric FIR Filter on the TMS320C55x DSP 7-4 . . . . . . .
7.2 Adaptive Filtering (LMS) 7-6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.1 Delayed LMS Algorithm 7-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3 Convolutional Encoding (BFXPA, BFXTR) 7-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.1 Bit-Stream Multiplexing and Demultiplexing 7-12 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4 Viterbi Algorithm for Channel Decoding (ADDSUB, SUBADD, MAXDIFF) 7-16 . . . . . . . . .
8 TI C55x DSPLIB 8-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduces the features and the C functions of the TI TMS320C55x DSP function library.
8.1 Features and Benefits 8-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 DSPLIB Data Types 8-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.3 DSPLIB Arguments 8-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.4 Calling a DSPLIB Function from C 8-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.5 Calling a DSPLIB Function from Assembly Language Source Code 8-4 . . . . . . . . . . . . . . .
8.6 Where to Find Sample Code 8-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.7 DSPLIB Functions 8-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
x
A Special D-Unit Instructions A-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lists the D-unit instructions where A-unit registers are read (“pre-fetched”) in the Read phase
of the execution pipeline.
B Algebraic Instructions Code Examples B-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Shows the algebraic instructions code examples that correspond to the mnemonic instructions
code examples shown in Chapters 2 through 7.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
发表于 2007-5-18 15:47:00 | 显示全部楼层
zhe shi shen me ?
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-10-7 02:26 , Processed in 0.058789 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表