Binary Search Algorithm on the TMS320C5x



Similar documents
Floating Point C Compiler: Tips and Tricks Part I

SN54165, SN54LS165A, SN74165, SN74LS165A PARALLEL-LOAD 8-BIT SHIFT REGISTERS

Fast Logarithms on a Floating-Point Device

Motor Speed Measurement Considerations When Using TMS320C24x DSPs

SDLS068A DECEMBER 1972 REVISED OCTOBER Copyright 2001, Texas Instruments Incorporated

Monitoring TMS320C240 Peripheral Registers in the Debugger Software

Signal Conditioning Wheatstone Resistive Bridge Sensors

Analysis of Filter Coefficient Precision on LMS Algorithm Performance for G.165/G.168 Echo Cancellation

CUSTOM GOOGLE SEARCH PRO. User Guide. User Guide Page 1

EDI s x32 MCM-L SRAM Family: Integrated Memory Solution for TMS320C3x DSPs

EDI s x32 MCM-L SRAM Family: Integrated Memory Solution for TMS320C4x DSPs

TSL250, TSL251, TLS252 LIGHT-TO-VOLTAGE OPTICAL SENSORS

Using C to Access Data Stored in Program Space Memory on the TMS320C24x DSP

TSL INTEGRATED OPTO SENSOR

How To Make A Two Series Cell Battery Pack Supervisor Module

Audio Tone Control Using The TLC074 Operational Amplifier

SN54HC157, SN74HC157 QUADRUPLE 2-LINE TO 1-LINE DATA SELECTORS/MULTIPLEXERS

SN28838 PAL-COLOR SUBCARRIER GENERATOR

SN54F157A, SN74F157A QUADRUPLE 2-LINE TO 1-LINE DATA SELECTORS/MULTIPLEXERS

High-Speed Gigabit Data Transmission Across Various Cable Media at Various Lengths and Data Rate

SN54HC191, SN74HC191 4-BIT SYNCHRONOUS UP/DOWN BINARY COUNTERS

Theory of Operation. Figure 1 illustrates a fan motor circuit used in an automobile application. The TPIC kω AREF.

RETRIEVING DATA FROM THE DDC112

Wireless Subwoofer TI Design Tests

Multi-Transformer LED TV Power User Guide. Anderson Hsiao

Implementing an In-Service, Non- Intrusive Measurement Device in Telecommunication Networks Using the TMS320C31

Using C to Access Data Stored in Program Memory on the TMS320C54x DSP

bq2114 NiCd or NiMH Gas Gauge Module with Charge-Control Output Features General Description Pin Descriptions

Next-Generation BTL/Futurebus Transceivers Allow Single-Sided SMT Manufacturing

A Low-Cost, Single Coupling Capacitor Configuration for Stereo Headphone Amplifiers

APPLICATION BULLETIN

Designing Gain and Offset in Thirty Seconds

IMPORT/EXPORT CUSTOMER REVIEWS. User Guide. User Guide Page 1

DUAL MONITOR DRIVER AND VBIOS UPDATE

Guidelines for Software Development Efficiency on the TMS320C6000 VelociTI Architecture

Smart Battery Module with LEDs and Pack Supervisor

Controlling TAS5026 Volume After Error Recovery

Filter Design in Thirty Seconds

Texas Instruments. FB PS LLC Test Report HVPS SYSTEM AND APPLICATION TEAM REVA

QUADRO POWER GUIDELINES

SN54ALS191A, SN74ALS191A SYNCHRONOUS 4-BIT UP/DOWN BINARY COUNTERS

SEO Meta Templates. Magento Extension. User Guide. SEO Meta Templates

Using Code Coverage and Multi-event Profiler in Code Composer Studio v2.3 for Robustness and Efficiency Analyses

WHAT DESIGNERS SHOULD KNOW ABOUT DATA CONVERTER DRIFT

1. Installation Instructions

Current-Transformer Phase-Shift Compensation and Calibration

Supply voltage Supervisor TL77xx Series. Author: Eilhard Haseloff

Simplifying System Design Using the CS4350 PLL DAC

Standard Linear & Logic Semiconductor Marking Guidelines

Signal Conditioning Piezoelectric Sensors

August 2001 PMP Low Power SLVU051

SINGLE-SUPPLY OPERATION OF OPERATIONAL AMPLIFIERS

Important Notice. All company and brand products and service names are trademarks or registered trademarks of their respective holders.

IMPORT/EXPORT COUPON/SHOPPING CART RULES. User Guide. User Guide Page 1

Managing Code Development Using CCS Project Manager

Designing With the SN54/74LS123. SDLA006A March 1997

Intel SSD 520 Series Specification Update

Teaching DSP through the Practical Case Study of an FSK Modem

How To Close The Loop On A Fully Differential Op Amp

SEO Suite Pro. User Guide

AN48. Application Note DESIGNNOTESFORA2-POLEFILTERWITH DIFFERENTIAL INPUT. by Steven Green. 1. Introduction AIN- AIN+ C2

CMOS Power Consumption and C pd Calculation

iscsi Quick-Connect Guide for Red Hat Linux

TI and ibiquity Introduce Industry s Lowest Cost Single-Chip AM/FM and HD Radio Baseband John Gardner Digital Radio Marketing Manager

NVIDIA GRID 2.0 ENTERPRISE SOFTWARE

Design Note DN304. Cebal CCxxxx Development Tools USB Driver Installation Guide By Åsmund B. Bø. Keywords. 1 Introduction

Automated Dialing of Cellular Telephones Using Speech Recognition

Using the Scripting Utility in the Code Composer Studio Integrated Development Environment

PESDxU1UT series. 1. Product profile. Ultra low capacitance ESD protection diode in SOT23 package. 1.1 General description. 1.

Schottky barrier quadruple diode

TIC225 SERIES SILICON TRIACS

How To Fix An Lmx9838 Bluetooth Serial Port Module With Bluetooth (Bluetooth 2) From A Bluetooth Bluetooth 4.2 Device With A Bluembee 2.2 Module

IMPORT / EXPORT PRODUCTS

Revenue/Expenses Balance by Fund

NVIDIA NVIEW DESKTOP MANAGEMENT SOFTWARE

Data sheet acquired from Harris Semiconductor SCHS067B Revised July 2003

News Extension 2.2 User Guide

Planar PIN diode in a SOD323 very small plastic SMD package.

AN3354 Application note

CAN bus ESD protection diode

Pressure Transducer to ADC Application

Application Report SLVA051

WAN_0240. I 2 S USB Audio Streaming INTRODUCTION IDENTIFYING THE FIRMWARE HARDWARE CONFIGURATION SOFTWARE CONFIGURATION

Medium power Schottky barrier single diode

Software License Monitoring

Understanding the Terms and Definitions of LDO Voltage Regulators

Intel Solid-State Drive Pro 2500 Series Opal* Compatibility Guide

LM5030 LM5030 Application: DC - DC Converter Utilizing the Push-Pull Topology

Using the RS232 serial evaluation boards on a USB port

BD239, BD239A, BD239B, BD239C NPN SILICON POWER TRANSISTORS

Intel Media SDK Library Distribution and Dispatching Process

PLEASE READ THIS AGREEMENT CAREFULLY. BY INSTALLING, DOWNLOADING OR OTHERWISE USING THE SOFTWARE, YOU AGREE TO THE TERMS OF THIS AGREEMENT.

Data sheet acquired from Harris Semiconductor SCHS087D Revised October 2003

Application Report. 1 Description of the Problem. Jeff Falin... PMP Portable Power Applications ABSTRACT

PMEG1020EA. 1. Product profile. 2 A ultra low V F MEGA Schottky barrier rectifier. 1.1 General description. 1.2 Features. 1.

TMS320C3x/C4x Assembly Language Tools User s Guide

TMS320C67x FastRTS Library Programmer s Reference

Transcription:

TMS320 DSP DESIGNER S NOTEBOOK Binary Search Algorithm on the TMS320C5x APPLICATION BRIEF: SPRA238 Lawrence Wong Digital Signal Processing Products Semiconductor Group Texas Instruments May 1994

IMPORTANT NOTICE Texas Instruments (TI) reserves the right to make changes to its products or to discontinue any semiconductor product or service without notice, and advises its customers to obtain the latest version of relevant information to verify, before placing orders, that the information being relied on is current TI warrants performance of its semiconductor products and related software 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 Certain application using semiconductor products may involve potential risks of death, personal injury, or severe property or environmental damage ( Critical Applications ) TI SEMICONDUCTOR PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED, OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT APPLICATIONS, DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS Inclusion of TI products in such applications is understood to be fully at the risk of the customer Use of TI products in such applications requires the written approval of an appropriate TI officer Questions concerning potential risk applications should be directed to TI through a local SC sales office In order to minimize risks associated with the customer s applications, adequate design and operating safeguards should be provided by the customer to minimize inherent or procedural hazards TI assumes no liability for applications assistance, customer product design, software performance, or infringement of patents or services described herein Nor does TI 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 semiconductor products or services might be or are used Copyright 1997, Texas Instruments Incorporated

TRADEMARKS TI is a trademark of Texas Instruments Incorporated Other brands and names are the property of their respective owners

CONTACT INFORMATION US TMS320 HOTLINE (281) 274-2320 US TMS320 FAX (281) 274-2324 US TMS320 BBS (281) 274-2323 US TMS320 email dsph@ticom

Contents Abstract 7 Design Problem 8 Solution 8 Examples Example 1 Code Listing 8

Binary Search Algorithm on the TMS320C5x Abstract This document shows how to implement an efficient binary search algorithm on the TMS320C5x Family that will take advantage of the C5x s capability Binary Search Algorithm on the TMS320C5x 7

Design Problem Solution How do I implement an efficient binary search algorithm on the TMS320C5x Family that will take advantage of the C5x s capability? There are many ways to implement the classical binary search algorithm but very few would take advantage of the C5x s advanced architecture and instruction set The following is one of the many possible examples using the TMS320C5x executing the binary search algorithm The program takes advantage of the C5x s capability of performing bit-reversed addressing to half the search after each testing and therefore freeing the accumulator for other tasks Also, instead of using conditional branching to perform the testing, the execute conditional (XC) instruction is used, thereby saving cycles and increasing performance This routine performs a binary search on an ordered table It assumes that the table is ordered from low to high, where the largest number is located in the highest memory of the array Modifications can be made to reverse the ordering, if necessary This program also assumes that the size of the search table is some integer power of 2 (ie, 2^N where N=11 in the following program) As a result, the search would never pass the last entry in the array A maximum of N iterations is required to complete the search or determine that the search failed Modifications can be made if the size of the array is not a power of 2 In order to do this, test conditions will have to be included to determine if the last entry has been passed This function returns the address of the found number and it is stored in the ACCUMULATOR A 0x0000 address in the ACCUMULATOR signifies that the search was unsuccessful Example 1 Code Listing bss NTABLE,800h ;Sorted search table ; from low to high bss LOOK,1 ;Search value mmregs text call bsearch bsearch lar AR0,#0800h ;AR0 size of array 8 SPRA238

mar *,AR0 ; mar *BR0+,AR3 ;Half the size of the array lar AR3,#NTABLE ;AR3 points to beginning of ; array lacl #11 ;RPT N Times, Size of Array is 2^N samm BRCR ;Setup Repeat Block ldp #LOOK lacc LOOK ;Begin search sub * ;Compare data at AR3 bcnd nothere,lt ;ERROR not found in this array rptb nothere-1 bcnd found,eq ;Check if found xc 1,GT ;If too low on array mar *0+,AR0 ;Jump forward xc 1,LT ;If too high on array mar *0-,AR0 ;Jump back mar *BR0+,AR3 ;Half the search space lacc LOOK sub * nothere retd ;Did not find value in the table zac ;return 0x0 for failed search nop found ldp #0 apl #Offfeh,PMST ;disable block repeat bit retd lamm AR3 ;return address of search nop Binary Search Algorithm on the TMS320C5x 9