C28x IQmath Library

C28x IQmath Library

A Virtual Floating Point Engine V1.5c

June 6, 2010

Module user's Guide (SPRC990)

C28x Foundation Software

?Texas Instruments Inc., 2002-2010

1

IMPORTANT NOTICE

Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue any product or service without notice, and advise customers to obtain the latest version of relevant information to verify, before placing orders, that information being relied on is current and complete. All products are sold subject to the terms and conditions of sale supplied at the time of order acknowledgement, including those pertaining to warranty, patent infringement, and limitation of liability.

TI warrants performance of its semiconductor products to the specifications applicable at the time of sale in accordance with TI's standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements.

Customers are responsible for their applications using TI components.

In order to minimize risks associated with the customer's applications, adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards.

TI assumes no liability for applications assistance or customer product design. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such products or services might be or are used. TI's publication of information regarding any third party's products or services does not constitute TI's approval, license, warranty or endorsement thereof.

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. Representation or reproduction of this information with alteration voids all warranties provided for an associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible or liable for any such use.

Resale of TI's products or services with statements different from or beyond the parameters stated by TI for that products or service voids all express and any implied warranties for the associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.

Also see: Standard Terms and Conditions of Sale for Semiconductor Products. sc/docs/stdterms.htm

Mailing Address: Texas Instruments Post Office Box 655303 Dallas, Texas 75265

Copyright ?2002, Texas Instruments Incorporated

?Texas Instruments Inc., 2002-2010

2

Trademarks

TMS320 is the trademark of Texas Instruments Incorporated. All other trademarks mentioned herein are property of their respective companies

Acronyms

C28x+FPU: Refers to devices with the C28x plus floating-point-unit.

IQmath: High Accuracy Mathematical Functions (32-bit implementation).

QMATH: Fixed Point Mathematical computation

?Texas Instruments Inc., 2002-2010

3

Chapter 1. Introduction .............................................................................................6

1.1. Introduction.................................................................................................................6

Chapter 2. Installing the IQmath Library..................................................................7

2.1. IQmath Package Contents ..........................................................................................7

2.2. How to Install the IQmath Library ............................................................................8

Chapter 3. Using the IQmath Library........................................................................9

3.1. IQmath Arguments and Data Types...........................................................................9

3.2. IQmath Data type: Range & Resolution...................................................................10

3.3. Calling an IQmath Function from C ........................................................................11

3.4. Calling an IQmath function from C++ .....................................................................11

3.5. IQmath Section and Lookup Tables .........................................................................12

3.6. Accessing IQmath Functions in the Boot ROM .......................................................16

3.7. IQmath Naming Conventions ...................................................................................19

3.8. Selecting the GLOBAL_Q format ............................................................................20

3.9. Using the IQmath GEL file for Debugging...............................................................21

3.10. Converting an IQmath Application to Floating-Point ..........................................23

3.11. The IQmath C-Calling Convention .......................................................................23

Chapter 4. Libraries Available.................................................................................24

Chapter 5. Function Summary ................................................................................25

5.1. Arguments and Conventions Used............................................................................25

5.2. IQmath Function Overview ......................................................................................26 Format conversion Utilities............................................................................................26 Shift to Multiply or Divide by Powers of 2.......................................................................26 Arithmetic Operations ...................................................................................................27 Trigonometric Functions:...............................................................................................27 Mathematical Functions: ...............................................................................................28 Miscellaneous ............................................................................................................... 28

5.3. C28x IQmath Library Benchmarks..........................................................................29

Chapter 6. Function Descriptions............................................................................31

6.1. Conversion Utilities ...................................................................................................31 IQN............................................................................................................................... 31 IQN............................................................................................................................... 31 IQNtoF.......................................................................................................................... 33 atoIQN .......................................................................................................................... 34 IQNtoa.......................................................................................................................... 35 IQNint ...........................................................................................................................37 IQNfrac ......................................................................................................................... 38 IQtoIQN ........................................................................................................................ 39 IQNtoIQ ........................................................................................................................ 40

?Texas Instruments Inc., 2002-2010

4

IQtoQN ......................................................................................................................... 41 QNtoIQ ......................................................................................................................... 42

6.2. Shift to Multiply or Divide by Powers of 2 ...............................................................43 IQmpy2, 4, 8...64..........................................................................................................43 IQdiv2, 4, 8...64............................................................................................................44

6.3. Arithmetic Operations ..............................................................................................45 IQNmpy ........................................................................................................................45 IQNrmpy ....................................................................................................................... 46 IQNrsmpy .....................................................................................................................47 IQNmpyI32 ...................................................................................................................48 IQNmpyIQX ..................................................................................................................51 IQNdiv .......................................................................................................................... 52

6.4. Trigonometric Functions...........................................................................................55 IQNasin ........................................................................................................................55 IQNsin ..........................................................................................................................56 IQNsinPU .....................................................................................................................58 IQNacos ....................................................................................................................... 60 IQNcos ......................................................................................................................... 61 IQNcosPU .................................................................................................................... 63 IQNatan2 ...................................................................................................................... 65 IQNatan2PU ................................................................................................................. 67 IQNatan ........................................................................................................................ 69

6.5. Mathematical Utilities ...............................................................................................70 IQNexp .........................................................................................................................70 IQNsqrt ......................................................................................................................... 71 IQNisqrt ........................................................................................................................73 IQNmag ........................................................................................................................ 76 B .................................................................................................................................. 76 A .................................................................................................................................. 76

6.6. Miscellaneous Utilities...............................................................................................77 IQNabs ......................................................................................................................... 77 IQsat ............................................................................................................................ 78

Chapter 7. Revision History ..................................................................................... 79

?Texas Instruments Inc., 2002-2010

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download