.- =A'ft.T - '=' January 1989 WE ® DSP16 and DSP16A Digital Signal Processors Information Manual A WORD ABOUT TRADEMARKS . .. The following AT&T trademarks are used in this manual: The following trademarks, owned by entities other than AT&T, are also used in this manual: MS-DOS® VMS® AT &T reserves the right to make changes to the product(s), including any hardware, software and/or firmware described herein without notice. No liability is assumed as a result of the use or application of this product(s). No rights under any patent accompany the sale of any such product(s). , Copyright © 1989 AT&T. All Rights Reserved. MN88-18DMOS Printed in United States of America FOREWORD This manual contains detailed information regarding the design and applications of the WE DSP16/DSP16A Digital Signal Processor that is essential to engineers designing systems using this device. The WE DSP16 and DSP16A Support Software Library, WE DSP16 Development System, and the WE DSP16A Development System are available to aid in developing software for the devices and integrating them into system environments. Additional information on the digital signal processor product line is available in the form of manuals, data sheets, and application notes. iii iv WE DSP16 AND DSP16A DIGITAL SIGNAL PROCESSORS INFORMATION MANUAL CONTENTS CHAPTER 1. INTRODUCTION 1. INTRODUCTION ....................................................................................................................... 1-1 1.1 FEATURES............................................................................................................................... 1-1 1.2 DEVICE DESCRIPTION ....... .............................................................. ..................................... 1-1 1.2.1 Architecture..... ........... ............. ............................................................................................... 1-1 1.2.2 Instruction Set......................................................................................................................... 1-2 1.3 APPLICATION DEVELOPMENT ........................................................................................... 1-2 1.3.1 Support Software Library........................................................................................................ 1-3 1.3.2 Development System .............................................................................................................. 1-3 1.4 DOCUMENTATION................................................................................................................. 1-4 1.4.1 Other Applicable Documentation............................................................................................ 1-4 1.5 ASSISTANCE........................................................................................................................... 1-5 CHAPTER 2. DSPI6/DSPI6A ARCHITECTURE 2. DSPI6/DSPI6A ARCHITECTURE............................................................................................ 2-1 2.1 MEMORY ................................................................................................................................. 2-2 2.1.1 ROM....................................................................................................................................... 2-2 2.1.2 RAM....................................................................................................................................... 2-3 2.2 CACHE...................................................................................................................................... 2-3 2.3 CONTROL ................................................................................................................................ 2-3 2.4 ADDRESS ARITHMETIC UNITS ........................................................................................... 2-4 2.4.1 ROM Address Arithmetic Unit .......................... ........... ................................................ .......... 2-4 2.4.2 RAM Address Arithmetic Unit ............................................................................................... 2-6 2.5 DATA ARITHMETIC UNIT..................................................................................................... 2-6 2.5.1 Arithmetic and Precision......................................................................................................... 2-9 2.6 SERIAL I/O............................................................................................................................... 2-13 2.7 PARALLEL I/O......................................................................................................................... 2-14 2.8 INTERRUPTS........................................................................................................................... 2-15 2.8.1 Hardware Description ............................................................................................................. 2-16 2.8.2 Software Description.......................................................... ..................................................... 2-17 CHAPTER 3. DSPI6/DSPI6A INSTRUCTION SET 3. DSPI6/DSPI6A INSTRUCTION SET ....................................................................................... 3-1 3.1 NOTATION............................................................................................................................... 3-1 3.2 ADDRESSING MODES ........................................................................................................... 3-2 3.2.1 Immediate Addressing ............................................................................................................ 3-2 3.2.2 Indirect Addressing ................................................................................................................. 3-2 v 3.2.3 Compound Addressing............................................................................................................ 3-3 3.3 PROCESSOR FLAGS............................................................................................................... 3-4 3.4 MULTIPLY/ALUGROUP ........................................................................................................ 3-6 3.4.1 Function Statements................................................................................................................ 3-9 3.4.2 Transfer Statements................................................................................................................. 3-10 3.4.3 No Operation........................................................................................................................... 3-12 3.5 SPECIAL FUNCTION GROUP ................................................................................................ 3-12 3.5.1 Special Function Statements ................................................................................................... 3-13 3.6 CONTROL GROUP .................................................................................................................. 3-14 3.6.1 Control Statements.................................................................................................................. 3-15 3. 7 DATA MOVE INSTRUCTIONS .............................................................................................. 3-16 3.7.1 Data Move Instruction Statements .......................................................................................... 3-18 3.8 CACHE INSTRUCTIONS ........................................................................................................ 3-18 3.8.1 Cache Statements .................................................................................................................... 3-19 3.9 INSTRUCTION SET SUMMARY ........................................................................................... 3-20 CHAPTER 4. DSP16/DSP16A DEVICE PROGRAMMING 4. DSP16/DSPl6A DEVICE PROGRAMMING ............................................................................ 4-1 4.1 DSP16/DSPl6A ASSEMBLY-LANGUAGE NOTATION ...................................................... 4-1 4.1.1 Integer Notation... ........... ............... ......... ............... ............. ....... ...... ........... ............................ 4-1 4.1.2 Comments............................................................................................................................... 4-1 4.1.3 Labels...................................................................................................................................... 4-2 4.1.4 Data Stored in ROM ............................................................................................................... 4-2 4.1.5 RAM Variables....................................................................................................................... 4-2 4.1.6 DSP16/DSP16A Source-file Format....................................................................................... 4-3 4.2 PROGRAMMING TECHNIQUES ........................................................................................... 4-3 4.2.1 Instruction Set Ambiguities .................................................................................................... 4-3 4.2.2 Polling for I/O. ...... ...................... ........................................ ...... ...................... ........ ................ 4-4 4.2.3 Modulo Addressing................................................................................................................. 4-5 4.2.4 Random Number Generation .................................................................................................. 4-5 4.2.5 Programming Tips .................................................................................................................. 4-5 4.2.6 Concurrent Interrupts .. ........................ ................ .............................. ............... ......... .............. 4-7 4.2.7 Interrupt Latency............................ ......... ................. .......................... ..................................... 4-11 CHAPTER 5. SERIAL 110 5. SERIAL I/O................................................................................................................................. 5-1 5.1 SIO OPERATION ..................................................................................................................... 5-2 5.1.1 Input Section........................................................................................................................... 5-2 5.1.2 Output Section.............................................................................. .......................................... 5-2 5.1.3 Active Clock Generator........................................................................................................... 5-3 5.2 USER-CONTROLLED FEATURES......................................................................................... 5-4 5.3 SERIAL I/O PIN DESCRIPTIONS ........................................................................................... 5-5 5.4 CODEC INTERFACE............................................................................................................... 5-7 5.5 SERIAL I/O PROGRAMMING EXAMPLE............................................................................. 5-7 5.5.1 Program Segment.................................................................................................................... 5-9 vi 5.6 MULTIPROCESSOR MODE DESCRIPTION......................................................................... 5-10 5.6.1 Suggested Multiprocessor Configuration....... ................. .................. ........ ............. ................. 5-16 5.7 SERIAL I/O TIMING DIAGRAMS .......................................................................................... 5-17 CHAPTER6. PARALLELVO 6. PARALLEL I/O........................................................................................................................... 6-1 6.1 SOFfWARE DESCRIPTION ................................................................................................... 6-1 6.1.1 pioc Register Settings ............................................................................................................. 6-3 6.1.2 Latent Reads ........................................................................................................................... 6-5 6.2 HARDWARE DESCRIPTION.................................................................................................. 6-6 6.2.1 Parallel I/O Signals ............................... ...................... ....................................... ......... ............ 6-6 6.2.2 Active Mode ............. ..................... ..... ........ ..... ............... ......... ......... .......... ........... ..... ............ 6-7 6.2.3 Passive Mode.......................................................................................................................... 6-8 6.2.4 Status and Control Mode ........................................................................................................ 6-8 6.3 INTERRUPTS AND THE PARALLEL I/O.............................................................................. 6-9 6.4 PIO BUS TRANSACTIONS ..................................................................................................... 6-9 6.4.1 Active Mode Input .................................................................................................................. 6-10 6.4.2 Active Mode Output ..... ;......................................................................................................... 6-11 6.4.3 Passive Mode Input................................................................................................................. 6-12 6.4.4 Passive Mode Output.............................................................................................................. 6-13 6.4.5 Parallel I/O Interaccess Timing............................................................................................... 6-14 CHAPTER 7. INTERFACE GUIDE 7. INTERFACE GUIDE.................................................................................................................. 7-1 7.1 PIN ASSiGNMENTS................................................................................................................ 7-1 7.1.1 Device Pins by Numerical Order............................................................................................. 7-2 7.1.2 Pins by Functional Group ........................................ .................. ............... ............. ................. 7-7 7.2 ELECTRICAL CHARACTERISTICS ...................................................................................... 7-12 7.3 EXTERNAL MEMORy............................................................................................................ 7-13 7.4 RESET AND INTERRUPT CONTROL ................................................................................... 7-14 7.5 DEVICE PACKAGE OUTLINE............................................................................................... 7-15 APPENDIX A. INSTRUCTION SET ENCODING A. INSTRUCTION SET ENCODING ............................................................................................ A-I A.l FORMATS ............................................................................................................................... A-I A.2 REPLACEMENT TABLES FOR FORMAT FIELDS ............................................................. A-4 APPENDIX B. PROGRAMMING EXAMPLES B. PROGRAMMING EXAMPLES................................................................................................. B-1 B.1 FIR FILTER.............................................................................. ................................................ B-2 B.2 IIR FILTER............................................................................................................................... B-5 B.3 MATRIX MULTIPLICATION................................................................................................. B-7 B.4 FIND MAXIMUM VECTOR ELEMENT ................................................................................ B-9 vii APPENDIX C. DSP16/DSP16A INSTRUCTION SET SUMMARY C. DSP16/DSP16A INSTRUCTION SET SUMMARy ................................................................. C-1 APPENDIX D. PROGRAMMABLE REGISTERS D. PROGRAMMABLE REGISTERS ............................................................................................. D-1 GLOSSARY LIST OF FIGURES Figure 2-1. DSP16/DSP16A Digital Signal Processor Block Diagram ........................ .................... 2-1 Figure 2-2. DSP16/DSPl6A Memory Maps .................................................................................... 2-2 Figure 2-3. Control and Cache......................................................................................................... 2-3 Figure 2-4. XAAU - ROM Address Arithmetic Unit...................................................................... 2-5 Figure 2-5. YAAU - RAM Address Arithmetic Unit ...................................................................... 2-5 Figure 2-6. DAU - Data Arithmetic Unit ........................................................................................ 2-7 Figure 2-7. DSP16/DSP16A Arithmetic Bit Alignment When auc[l, O]=()() ................................... 2-11 Figure 2-8. DSP16/DSP16A Arithmetic Bit Alignment When auc[1, 0]=10 ................................... 2-12 Figure 2-9. DSP16/DSPl6A Arithmetic Bit Alignment When auc[1, 0]=01 ................................... 2-12 Figure 2-10. SIO - Serial I/O Unit................................................................................................... 2-14 Figure 2-11. PIO - Parallel I/O Unit................................................................................................ 2-15 Figure 4-1. Case 1 - Internal Interrupt (PIDS) and !NT Occur Before Assertion of lACK.......................................................................... ................... 4-8 Figure 4-2. Case 2 - INT Asserted During Service of Internal Interrupt After pioc Status is Checked...... .............. .................. ........ ........ ..................... 4-9 Figure 4-3. Case 3 - Internal Interrupt Asserted While Servicing an External Interrupt.... ..... ..................... ......... ............................................................... 4-10 Figure 5-1. Serial I/O Internal Data Path.......................................................................................... 5-1 Figure 5-2. SIO Active Clock and Load Generation........................................................................ 5-3 Figure 5-3. WE DSP16/DSP16A to AT&T T7500 Codec Interface ................................................. 5-8 Figure 5-4. WE DSP16/DSP16A to AT&TT7520 or T7520 Codec Interface .................................. 5-8 Figure 5-5. DSP16/DSP16A Multiprocessor Connections............................................................... 5-11 Figure 5-6. DSP16/DSP16A Multiprocessor Communications ....................................................... 5-15 Figure 5-7. Serial Input Timing ....................................................................................................... 5-17 Figure 5-8. Serial Output Timing - 8 Bits ....................................................................................... 5-18 Figure 5-9. Serial Output Timing - 16 Bits ..................................................................................... 5-19 Figure 5-10. Multiprocessor Timing ................................................................................................ 5-20 Figure 6-1. Parallel I/O Section ....... ........................ .......................... ...................... ........................ 6-1 Figure 6-2. Active Mode Input Timing ............................................................................................ 6-10 Figure 6-3. Active Mode Output Timing ......................................................................................... 6-11 Figure 6-4. Passive Mode Input Timing........................................................................................... 6-12 Figure 6-5. Passive Mode Output Timing........................................................................................ 6-13 viii Figure 6-6. Parallel I/O Interaccess Timing ................ .................. ................ .................... ............... 6-14 Figure 7-1. DSP16/DSP16A Digital Signal Processor - Pin Diagram........ .................. ...... ............. 7-1 Figure 7-2. External Memory Interface Timing ............................................................................... 7-13 Figure 7-3. Reset and Interrupt Timing............................................................................................ 7-14 Figure 7-4. 84-Pin PLCC Device Outline ........................................................................................ 7-15 LIST OF TABLES Table 2-1. Processor Status Word (psw) Register ............................................................................ 2-9 Table 2-2. Arithmetic Unit Control (auc) Register........................................................................... 2-10 Table 2-3. Parallel I/O Control (pioc) Register ................................................................................ 2-16 Table 3-1. Compound Addressing Instructions................................................................................ 3-4 Table 3-2. Conditional Mnemonics.................................................................................................. 3-5 Table 3-3. Multiply/ALU Instructions ............................................................................................. 3-8 Table 3-4. Replacement Table for Multiply/ALU Instructions ........................................................ 3-8 Table 3-5. Special Function Instructions.......................................................................................... 3-13 Table 3-6. Replacement Table for Special Function Instructions ................................................ ..... 3-13 Table 3-7. Replacement Table for Control Function Instructions .................................................... 3-15 Table 3-8. Replacement Table for Data Move Instructions ................................................ .............. 3-17 Table 3-9. Replacement Table for Cache Instructions...................................................................... 3-19 Table 4-1. Optional Mnemonics.. ........ ............. ........... ........................................... ................ ......... 4-4 Table 5-1. Serial I/O Control (sioc) Register ................................................................................... 5-4 Table 5-2. Serial I/O Pins................................................................................................................. 5-6 Table 5-3. Time-Division Multiplexed Slot (tdms) Register............................................................ 5-12 Table 5-4. Serial Receive/Transmit Address (srta) Register............................................................. 5-13 Table 6-1. Parallel I/O Control (Pioc) Register .......................... .................. ...... .................. ............ 6-2 Table 6-2. Parallel I/O Signals......................................................................................................... 6-6 Table 6-3. PIO Strobe Widths.......................................................................................................... 6-7 Table 7-1. DSPI6/DSPI6A Pin Names ........................................................................................... 7-2 Table 7-2. DSPI6/DSPI6A Pin Descriptions .................................................................................. 7-2 Table 7-3. External Memory Interface Group .................................................................................. 7-7 Table 7-4. SIO Interface Group........................................................................................................ 7-8 Table 7-5. PIO Interface Group........................................................................................................ 7-9 Table 7-6. Miscellaneous Function Group....................................................................................... 7-10 Table 7-7. Power and Ground Group .................... .............................. .................. ........................... 7-11 Table 7-8. Electrical Characteristics................................................................................................. 7-12 Table C-l. Conditional Mnemonics................................................................................................. C-l Table C-2. Instruction Group Characteristics................................................................................... C-l Table C-3. Multiply/ALU Instructions............................................................................................. C-2 Table C-4. Replacement Table for Multiply/ALU Instructions........................................................ C-2 Table C-5. Special Function Instructions......................................................................................... C-3 Table C-6. Replacement Table for Special Function Instructions .................................................... C-3 ix Table C-7. Control Instructions ................................................. ............................ ...................... .... C-4 Table C-S. Replacement Table for Control Function Instructions.................................................... C-4 Table C-9. Oata Move Instructions ..................................... ...................... ...................... ................. C-4 Table C-lO. Replacement Table for Oata Move Instructions ................................................ ........... C-5 Table C-ll. Cache Instructions........................................................................................................ C-6 Table C-12. Replacement Table for Cache Instructions ................................................................... C-6 Table 0-1. Arithmetic Unit Control (auc) Register.......................................................................... 0-1 Table 0-2. Processor Status Word (psw) Register ........................................................................... 0-2 Table 0-3. Parallel I/O Control (Pioc) Register ............................................................................... 0-3 Table 0-4. Serial I/O Control (sioc) Register................................................................................... 0-4 Table 0-5. Serial Receiveffransmit Address (srta) Register............................................................ 0-5 Table 0-6. Time-Division Multiplex Slot (tdms) Register .............................................................. 0-6 x INTRODUCTION Architecture 1. INTRODUCTION The WE DSP16 and WE DSP16A Digital Signal Processors are l6-bit, high-perfonnance, CMOS integrated circuits. These devices can be programmed to perfonn a wide variety of signal- processing functions. They are the DSPs of choice for applications requiring low power, high perfonnance, and low cost. Both devices share the same architecture, instruction set, and I/O interfaces. The DSP16A offers greater speed and more internal memory for applications that require those characteristics. This manual is a reference guide for the DSP16 and DSP16A devices. It describes the architecture, instruction set, and interfacing requirements of both devices. 1.1 FEATURES The WE DSP16 Digital Signal Processor features: • 55 or 75 ns instruction cycle • 16 x l6-bit multiply/add in one instruction cycle • Two 36-bit accumulators • 2048 words of ROM, 512 words of RAM • Complete set of ALU (arithmetic logic unit) operations • Immediate, indirect, and compound addressing modes • Instruction cache for high-speed, ROM-efficient vector operations • Serial and parallel I/O ports with multiprocessor capability • Low-power CMOS technology, 84-pin plastic chip-carrier package In addition to the DSP16's features, the DSP16A offers: • 25 or 33 ns instruction cycle • 4096 words of ROM and 2048 words of RAM on-chip 1.2 DEVICE DESCRIPTION 1.2.1 Architecture The arithmetic unit contains a 16 x 16-bit parallel multiplier that generates a full 32-bit product in one instruction cycle. The product can be accumulated with one of two 36-bit accumulators. The data in these accumulators can be directly loaded from or stored to memory in 16-bit words with automatic saturation on overflow. The ALU supports a full set of arithmetic and logic operations on either 16- or 32-bit data. A standard set of ALU conditions can be tested for conditional branches and subroutine calls. This procedure allows the processor to function as a powerful 16- or 32-bit microprocessor for logical and control applications. Two addressing units support high-speed, register-indirect memory addressing with postmodification of the register. Four address registers can be used for either read or write addresses to the RAM without restrictions. One address register is dedicated to the ROM for table look-up. Direct and immediate addressing is supported at a cost of only one additional instruction cycle and one ROM location. 1-1 INTRODUCTION Application Development The DSP16 on-chip memory includes 2048 words of ROM and 512 words of RAM. For prototyping or for applications that require frequent program modification, the ROM can be replaced with up to 64 Kwords of external memory. The DSP16A offers twice as much ROM (4096 words) and 4 times as much RAM (2048 words) as the DSP16. The DSP16A ROM may be replaced with up to 64 Kwords of external memory or augmented with an additional 60 Kwords of external memory. An on-chip cache memory can be selectively used to store such repetitive operations as a filter section. The code in the cache can be repeated up to 127 times with no looping overhead. In addition, operations in the cache that require a ROM access (for example, reading fixed coefficients) execute at twice the nonnal rate. The cache greatly reduces the need for writing in-line repetitive code and, therefore, conserves ROM storage. The device has both serial and parallel I/O ports. The serial I/O unit is double-buffered and easily interfaces with other DSP16 devices, commercially available codecs, and time-division multiplexed (TDM) channels with few (if any) additional components. The parallel I/O unit is capable of interfacing to a l6-bit bus containing other DSPl6 devices, microprocessors, microprocessor peripherals, or other I/O devices. The processor is implemented in low-power CMOS technology and is packaged in an 84-pin plastic leaded chip carrier (PLCC) or a 133-pin ceramic pin-grid-array (PGA) package. 1.2.2 Instruction Set The DSP16/DSP16A instructions fall into five possible categories: multiply/ALU, special function, control, data move, and cache. All instructions are 16 bits wide and have a C-like assembler syntax. Although some pipelining of DSPI6/DSPI6A instructions is necessary to achieve the real-time perfonnance required in many signal processing applications, the degree of pipelining has been reduced from previous generation DSPs to simplify programming. Latency effects have been eliminated. 1.3 APPLICATION DEVELOPMENT Application development is aided by the use of the WE DSP16 and DSP16A Support Software Library, the WE DSP16 and DSP16A Application Library, and the WE DSP16/DSP16A Digital Signal Processor Development Systems. 1-2 INTRODUCTION Development System 1.3.1 Support Software Library Support software tools to help create, test, and debug DSPI6/DSPI6A application programs are available from the WE DSP16 and DSP16A Support Software Library. The suW?rt software libr~ consists of an integrated assembler and simulator that run on the UNIX ,MS-DOS *, or VMS Operating Systems. The DSP16/DSP16A software simulator provides access to all registers and to memory and allows program breakpointing. The simulator also provides the user interface to the WE DSP16/DSP16A Development Systems. The hardware development systems have many of the breakpointing capabilities of the software simulator and can also be used in a simulator/accelerator mode to speed software simulations. 1.3.2 Development System Application system hardware development and software testing are supported by the WE DSP16/DSP16A Development Systems. Each development system provides in-circuit emulation to facilitate real-time debugging of user hardware, as well as a simulator/accelerator to speed software simulations. Up to 16 development systems can be cascaded when developing applications that involve multiple DSPs. While connected to the development system, the user may edit, assemble, and load programs, as well as utilize the software simulator. An assembled program can be transferred from the host into the development system's program memory through an internal bus of a parallel interface to the AT&T PC 6300 (or compatible) Personal Computer. The software simulator and the development system can be used in three different modes: • Simulation Mode. In this mode, the development system is not being used; program execution is being simulated in the host computer. This mode is used for program development and testing. • Hardware Mode. The program has been downloaded into the development system and is being executed by the actual DSPI6/DSPI6A device. Hardware mode is used for real-time program testing. • Simulator/Accelerator Mode. The program is executed in the development system (as in the hardware mode), but data is supplied to and from the host. The simulator/accelerator mode is used to speed algorithm development by executing the program in the hardware of the development system rather than in the host computer. * Registered trademark of the Microsoft Coxporation t Registered trademark of the Digital Equipment Corporation 1-3 INTRODUCTION Other Applicable Documentation 1.4 DOCUMENTATION This document is a reference guide for the DSPl6 and DSPl6A devices. It describes the architecture, instruction set, and interfacing requirements of the both devices. Information on DSPI6/DSPI6A programming techniques and several complete sample application programs are provided. The remaining chapters of this manual are outlined below: o Chapter 2. DSPI61DSPI6A Architecture - a detailed description of the DSPI6/DSPI6A device, including separate sections describing the major elements of the architecture and how they function. o Chapter 3. Instruction Set -lists the complete instruction set of both devices and provides a description of each instruction, including restrictions and normal uses. Addressing modes are also discussed in detail. o Chapter 4. Device Programming - discusses topics related to programming beyond the syntax of the instruction set. Possible problems are discussed, along with solutions and advice. o Chapter 5. Serial I/O - a detailed analysis of the operation of the serial I/O port. Information specific to the serial I/O unit is provided that is essential to designs that utilize this port. o Chapter 6. Parallel I/O - a detailed analysis of the operation of the parallel I/O port. Information specific to the parallel I/O unit and detailed information regarding the interrupt mechanism are provided that are essential to designs utilizing the parallel port. o Chapter 7. Interface Guide - provides information regarding the physical design of the devices, including pin assignments, electrical characteristics, external memory interfacing, and reset and interrupt control. o Appendix A. Instruction Set Encoding -lists the hardware-level encoding of the instruction set. o Appendix B. Programming Examples - presents four complete sample application programs that demonstrate proper programming techniques. 1.4.1 Other Applicable Documentation When designing application hardware and software, it is important to have accurate information. A variety of documents exist to provide specific information on various members of the DSPl6 product family. Contact your AT&T Account Manager for the latest issue of any of the following documents. o The AT&T Digital Signal Processor Family Description introduces the AT&T DSP family of products and provides a brief overview of the capabilities of its members. o WE ® DSP16 and DSP16A Digital Signal Processor Information Manual (this manual) is a reference guide for the DSPI6/DSPI6A/DSPI6-Military devices. It describes the architecture, instruction set, and interfacing requirements. Information on programming techniques and several complete sample application programs are provided. 1-4 INTRODUCTION Assistance • WE ® DSP16 Digital Signal Processor Data Sheet provides up-to-date timing requirements and specifications, electrical characteristics, and a summary of the instruction set and device architecture. • WE ® DSP 16A Digital Signal Processor Data Sheet provides up-to-date timing requirements and specifications, electrical characteristics, and a summary of the instruction set and device architecture. • WE ® DSP16 and DSP 16A Support Software Library User Manual provides the information necessary to install and use the DSP16/DSP16A support software. TIlls manual is also required when working with the DSP16 Development System or the DSP16A Development System, as the support software provides an interface between the host computer and the development system. • WE ® DSP16 and DSP16A Development System User Manual provides the information necessary to set up and use the DSP16 and DSP 16A Development Systems. 1.5 ASSISTANCE Assistance is available during conception, development, and throughout the life of the product. These services include: • Technical documentation and product samples • Information on determining and selecting the appropriate hardware and software • The AT&T DSP Bulletin Board provides the latest and most up-to-date information about AT&T DSP products and application assistance: 1200/2400 baud 7 data bits, even parity 1 stop bit 201-834-6068 For technical assistance or further information including ordering information and part numbers, please contact the nearest office through the following phone numbers: Domestic (USA & Canada) Northeast Region Mid-Atlantic Region Southeast Region 508-626-2161 215-768-2626 404-446-4700 North Central Region South Central Region Southwest Region 612-885-4300 214-869-2040 602-244-1100 Rocky Mountain Region Pacific Northwest Sou~hem California 303-850-2935 408-522-5555 818~902-0139 or or 503-244-3883 714-220-6223 1-5 INTRODUCTION Assistance International Europe (except Spain Spain and Portugal and Portugal) +34 1404 6012 +49 89 950 86 0 Fax: +341404 6252 Telfax: +49 89 950 86 111 Japan Pacific Rim 813-593-3301 65-225-5233 Telex: 132562 ATIIJ Telex: RS 42898 Fax: 813-593-3307 Fax: 65-225-8725 Internal (AT&T Customers) AT&T internal customers should contact their local AT&T Account Management Office. If the Account Management telephone number is not known, call1-S00-372-2447 and ask for the telephone number of your account representative. 1-6 DSP16/DSP16A ARCHITECTURE DSPI6/DSPI6A Architecture 2. DSP16/DSP16A ARCHITECTURE The major elements of the DSP16/DSP16A architecture are the memories, ROM and RAM; the cache; the address arithmetic units; the data arithmetic unit; the I/O, serial and parallel; and the control unit that connects these elements in a pipeline. Figure 2-1 shows a block diagram. ABOO-AB15 ADDRESS BUS (16) .,LJ.. ,{. r-- - t=I --@T .- t- I XAAU CKI ADO ROM CONTROL ~ 15x16 2048X16 po RSTB (4096XI6, OSP16A) p' pi EXM - - I i i ..,LJ.. RBOO-RBtS I EXTERNAL MEMORY DATA BUS (16) DATA BUS (16) " "t " 1- I~ OAU yh(16) yl(16) SID 16 x 16 MULl .1" I I G!i:iJ . p (32) " 110 ~ SHIFT (-2,0,2) IBF 00 I ~ + y-- r-;;o- MUX ~ IJ.. '-:t ~ \ AlUISHIFT r-Hc- r--A. OSE ~ ~ • aO(36) at (36) ~ SADD aDEN I ~ ~ EXTRACT/SAT i ;-{-" DATA BUS (16) :1 It I~~ P'O 'NT lACK I ~ I " RAM I ~ S12x16 PSEL r (2048xI6, DSP16A) PIDS poas I I ~ ';" r3 fIl Figure 2-1. DSPI6/DSPI6A Digital Signal Processor Block Diagram 2-1 DSP16IDSP16A ARCHITECTURE ROM OxOOOO - r-- 16 BITS --..J OxOOOO - r-- 16 BITS --..J ON-CHIP ROM OR ON-CHIP ROM EXTERNAL MEMORY' Ox07FF OR EXTERNAL MEMORY' Ox0800 EXTERNAL MEMORY OxOFFF Ox1000 EXTERNAL MEMORY EXTERNAL MEMORY OxFFFF - ' - - - - - - - - ' DSP16 DSP16A • When EXM signal is low. Figure 2-2. DSP16/DSP16A Memory Maps 2.1 MEMORY The DSP16/DSP16A device provides both on-chip program memory and on-chip data memory. The program instructions and fixed operands are stored in the ROM. Instructions and immediate values are 16 bits wide and are fetched in one memory access each. Such variable operands as adaptive fIlter coefficients, state variables, intermediate results, and I/O data are stored in RAM. The on-chip ROM can be replaced with up to 64 Kwords of off-chip program memory on the DSP16. The DSP16A ROM may either be replaced with up to 64 Kwords or augmented with an additional 60 Kwords of off-chip program memory. 2.1.1 ROM The DSP16 device provides a 2K x l6-bit, on-chip ROM for program memory and immediate data. The on-chip ROM for the DSP16 device can be replaced by off-chip memory. The 16-bit address and ROM data buses are available off-chip for external program memory expansion. The DSP16 device provides on-chip address bus and data bus latches and memory control signals to allow for a zero chip interface to memory devices. The DSP16 device can execute programs residing in either the 2 Kword on-chip ROM or in off-chip program memory (64 Kwords maximum). A memory map for DSP16 program memory is provided in Figure 2-2. The DSP16A features a larger 4K x 16-bit, on-chip ROM. Like the DSP16, the ROM of the DSP16A can be replaced with up to 64 Kwords of external memory. The DSP16A also allows the use of both internal ROM and up to 60 K words of external memory. 2-2 DSPI6/DSPI6A ARCHITECTURE Control 2.1.2 RAM The DSP16 device provides a 512 x 16-bit, on-chip, static RAM to store intermediate results of calculations and I/O data. The DSP16A provides a 2048 x 16 on-chip, static RAM. RAM expansion is supported by the parallel I/O unit (see Chapter 6). 2.2 CACHE The on-board cache memory selectively stores repetitive operations to increase the throughput and the coding efficiency of the DSPI6/DSPI6A device. The cache can store up to 15 instructions at a time. The DSPI6/DSPI6A device can be programmed to execute the instructions in the cache up to 127 times without having to use branching instructions. Instructions previously stored in the cache can be re-executed without reloading the cache. Cache instructions eliminate the overhead when repeating a block of instructions. Therefore, the cache reduces the need to implement a routine that uses in-line coding in order to maximize the throughput. A routine utilizing the cache uses less ROM locations than an in-line coding of the same routine. For two-operand multiply/arithmetic logic unit (ALU) instructions that do not require a write memory, decreasing the execution time from two instruction cycles to one instruction cycle results in an increase in throughput CONTROL CACHE 15 x 16 Figure 2-3. Control and Cache 2.3 CONTROL The control block provides overall DSPI6/DSPI6A system coordination. The instructions are decoded by hardware in the control block. The execution of the phases of an instruction is controlled by hardware throughout the DSPI6/DSPI6A device. The hardware sequences instructions through the pipeline and controls the I/O, the processing, the memory accesses, and the timing necessary to perform each operation. 2-3 DSP16/DSP16A ARCHITECTURE ROM Address Arithmetic Unit 2.4 ADDRESS ARITHMETIC UNITS Separate address arithmetic units for the on-chip ROM and RAM are provided. Each address arithmetic unit consists of static registers and an adder. Addresses are held by four of the registers in each address arithmetic unit. The remaining registers hold values that can be used to modify the address pointers. The adder is used to increment or decrement the addresses stored in the registers. 2.4.1 ROM Address Arithmetic Unit The ROM address arithmetic unit (XAAU) consists of a 12-bit adder; a 12-bit static offset register, i; and four 16-bit static pointer registers: the program counter, pc; the program return, pr; the program interrupt, pi; and the table pointer, pt. These registers are used to address the ROM. The i register can be used to postmodify the pt register. The pt, pr, and i registers are user-accessible and can be modified under program control. The pc register can be loaded with the address of a subroutine or branch directly from the control section. The program return address from a subroutine invoked using the call control instruction is saved in the pr register. The program return address from an interrupt is saved in the pi register. The pc register is loaded with the address in pr when returning from a subroutine or in pi when returning from an interrupt. The pc register can also be loaded from the pt register. The pt register is normally used to point to tables of fixed data in ROM. The contents of the pt register can be modified by 1 or the value stored in the i register. The i register contains a 12-bit, 2's complement signed number with a range of -2048 to +2047. The adder in the XAAU is used to postmodify the contents of the pt register. The data in the i register is sign-extended to 16 bits when transferred on the data bus. The XAAU has a 12-bit adder. Therefore, the address space can be viewed as sixteen 4 Kword pages. The adder is used to modify the 12 least significant bits (LSBs). The four most Significant bits (MSBs) of the address may be changed by goto pt and call pt instructions. Due to the XAAU 12-bit adder, pt can only be postincremented to 4095 by x = *pt++. But, since pt is a 16-bit unsigned register, it can be loaded with values to 64K. The pi register is a 16-bit "shadow" register. Each time the pc register is modified, its new value is also loaded into the pi register. While in an interrupt service routine (lSR), this "shadowing" is disabled, and pi holds the last value of pc before the interrupt was taken. The return from interrupt instruction (ireturn) is simply a "goto pi" instruction. The pi register may be read or written while in an ISR, but writing affects the return address. When not in an ISR, writing to pi has no effect on the contents of pi (the write to pi resets the pseudorandom sequence generator). 2-4 DSP16IDSP16A ARCHITECTURE ROM Address Arithmetic Unit XAAU ADDRESS BUS (16) pI (16) pr (16) pi (16) Figure 2-4. XAAU - ROM Address Arithmetic Unit YAAU r2 r3 NOTE: All registers are 9 bits wide in the DSP16 and 16 bits wide in the DSP16A. Figure 2-5. YAAU - RAM Address Arithmetic Unit 2-5 DSP16/DSP16A ARCHITECTURE Data Arithmetic Unit 2.4.2 RAM Address Arithmetic Unit The RAM address arithmetic unit (YAAU) consists of eight static registers and an adder. These registers are 9 bits wide in the DSP16 and 16 bits wide in the DSP16A. The RAM is addressed by the rtl-r3 pointer registers. The j and k offset registers can be used to postmodify registers rtl-r3. The rb and re registers are used when a register addressing the RAM is used in a cyclical (modulo) fashion. The eight YAAU registers are accessible to the user and can be loaded under program control. The registers rtl-r3 point to the RAM location that is the source of data to be loaded into the destination specified in the instruction or to the RAM location that is the destination of data from the source specified in the instruction. The rtl-r3 pointers may be automatically postmodified by 0, +1, -1, +2, the contents of the j register, or the contents of the k register. The j and k registers contain 9-bit, 2's complement signed numbers with a range of -256 to +255 in the DSP16 and 16-bit, 2's complement signed numbers with a range of-32,768 to +32,767 in the DSPI6A. The adder in the YAAU is used to postmodify the contents of the rtl-r3 registers. Data in RAM can be addressed by using a virtual shift addressing mode. This addressing mode forms the equivalent of a cyclic shift register within the RAM. Virtual shift addressing realizes a shift register for the FIR filter tap values without moving the data stored in RAM. The memory space allocated in RAM for the table of data to be addressed by using virtual shift addressing is defined by the addresses loaded into rb and reo The rb contains the physical address of the first location of the shift register; re points to the last entry. When a pointer is used, its value is compared with the contents of reo If they are equal and the postincrement is 1, the RAM address arithmetic unit writes the value of rb into the RAM pointer after the memory access. The DSP16 device can support virtual shift addressing of shift registers of up to 512 words in length. The DSP16A device can support virtual shift registers of up to 2048 words in length. The virtual shift addressing mode is disabled when the value in re is O. Register re is cleared (0) on reset. 2.5 DATA ARITHMETIC UNIT The data arithmetic unit (DAD) is the main execution unit for signal processing algorithms. The DAU consists of a 16 x 16-bit multiplier, 36-bit ALU, and two 36-bit accumulators; aO and a1. The DAU performs 2's complement, fixed-point arithmetic and is software configurable as a multiply/accumulate or ALU structure. The DAU multiplier and adder operate in parallel, each requiring one instruction cycle for their execution. Microprocessor-like instructions are executed by the ALU. The multiplier executes a 16 x 16-bit multiply and stores the 32-bit product in the product register, p, in one instruction cycle. Data for the multiplier's inputs is stored in the 16-bit x register and the upper 16-bits (high half) of the 32-bit y register. The x register may be directly loaded from ROM, RAM, or the high half of an accumulator (bits 16-31 of the 36-bit word). The high half of the y register may be directly loaded from RAM or the high half of an accumulator. 2-6 DSP16IDSP16A ARCHITECTURE Data Arithmetic Unit < ) ROM DATA BUS (16) I I DATA BUS (16) •• I L x (16) J yh (16) yl (16) L-fI 16 x 16 MULTIPLY P (32) I '1-16 32 D A U I • SHIFT (-2. O. 2) I cO (8) 01 (8) + c2 (8) ~ .. / " MUX g ~ 000(7) ....L psw (16) II) OJ "'" ALU I SHIFT / '";!: + "'" I 00 (36) L I 01 (36) I t I EXTRACT I SAT. I I I • DATA BUS (16) Figure 2-6. DAU - Data Arithmetic Unit In addition to being used as an adder in the multiply/accumulate instructions, the 36-bit ALU provides the capability to implement functions and algorithms in the DSPI6/DSPI6A device that conventionally would have been executed in a microcomputer or a microprocessor. Operands to the ALU can be data in y, p, aO, or al. The ALU sign-extends 32-bit operands from y orp to 36 L bits and produces a 36-bit output (32 bits of data and 4 guard bits) in one instruction cycle. Either accumulator can receive the 36-bit result. The ALU supports diadic functions with register y and an accumulator, including addition, subtraction, and logical AND, OR, and XOR. Monadic functions of an accumulator include rounding, negation, incrementation, and left and right shifts of 1, 4, 8, or 16 bits. The y register is 32 bits wide. To read or write the low half of the y register (bits 0-15), yl is used in an assembly-language instruction. When y is used in an assembly-language instruction, the DSPI6/DSPI6A device will read or write the high half (bits 16-31) of the y register. Automatic clearing of yl may be selected (according to the CLR field of the auc register) to simplify 16-bit operations. If clearing of the yl is enabled, the lower half of register y is cleared (0) with a write to the high half of the y register. Writes to yl do not change the data in the high halfofy. The accumulators are 36 bits wide. The contents of either the high half of the accumulator (bits 16-31) or the low half of the accumulator (bits 0-15) may be transferred to the 16-bit data bus. Automatic clearing of aOl or all may be selected (according to the CLR field of the auc register) to simplify 16-bit operations. If clearing of the low half of the accumulator is enabled, the lower half of the accumulator is cleared (0) with a write to the high half of the accumulator. Writes to the low half of the accumulator do not change the data in the high half of the accumulator. When the high half of an accumulator is loaded, the guard bits (35-32) are also loaded with the value 2-7 DSP16IDSP16A ARCHITECTURE Data Arithmetic Unit of bit 31 and, thereby, sign-extended. Access to the guard bits for reading and writing is provided by the psw register. The SAT field of the auc register allows the enabling of saturation on overflow when transferring the contents of accumulators onto the data bus. If saturation on overflow is enabled and either half of an accumulator is selected, the value transferred is saturated to 32 bits. If the selected accumulator has overflowed, then either the positive or negative (based on bit 35) saturation value is transferred. 231 _1 is the positive saturation value _231 is the negative saturation value. A write of the contents of a 32-bit register to RAM requires two instructions: a write of the data in the high half of the register to RAM and a write of the data in the low half of the register to RAM. The order of the two writes to memory is left to the programmer. A read of the contents of RAM to a 32-bit register or accumulator also requires two instructions. If clearing of the low half of the destination's 32-bit register is enabled (according to the auc register, CLR field), the read of data in RAM to a 32-bit register must be done in the following order: load data to the high half of the register and load data to the low half of the register. This order is necessary because a load to the low half of a register does not change the data in the high half, while a load of the high half of a register clears the data from the low half. If clearing of the low half of the register is disabled, the two register loads may be performed in either order. In addition to the registers already mentioned, the user has access to the arithmetic unit control register, auc; the processor status word register, psw; and the counters, c0--<:2. The auc register configures some features of the data arithmetic unit. The psw register contains status information regarding the data arithmetic unit. Table 2-1 shows the contents of the psw register. The cO-c2 counters are 8 bits wide and may be used under program control to count events such as the number of times the program has executed a sequence of code. 2-8 DSPI6/DSPI6A ARCHITECTURE Arithmetic and Precision Table 2-1. Processor Status Word (psw) Register Bit 115 114 113 112111 110 I 9 181716151 4 131211101 Field I DAUFlags I X I X I a1[V] I a1[35-32] I aO[V] I aO[35-32] I Bit(s) Field Value· ResultiDescription Wxxx LMI -logical minus when set. xWxx LEQ -loltical eQual when set. 15-12 DAUFlags xxWx LLV -logical overflow when set. xxxW LMV - mathematical overflow when set. 11,10 X - Reserved. 9 al[V] W Accumulator 1 (al) overflow when set. Wxxx Accumulator 1 (al) bit 35. xWxx Accumulator 1 (al) bit 34. 8-5 al[35-32] xxWx Accumulator 1 (al) bit 33. xxxW Accumulator 1 (al) bit 32. 4 aO[V] W Accumulator 0 (aO) overflow when set. Wxxx Accumulator 0 (aO) bit 35. xWxx Accumulator 0 (aO) bit 34. 3-0 aO[35-32] xxWx Accumulator 0 (aO) bit 33. xxxW Accumulator 0 (aO) bit 32. * W indicates that the bit may be read or written. 2.5.1 Arithmetic and Precision Fixed-point, 2's complement arithmetic is used throughout the DSPI6/DSPI6A devices. The arithmetic bit alignment for the DSPI6/DSPI6A devices is shown in Figures 2-7, 2-8, and 2-9. The 16-bit data in the x register and in the high half of the y register can be multiplied together and the 32-bit result is stored in the p register. The data in the y or p registers can be operated on by the ALU and the result stored in either of the 36-bit accumulators. The 32-bit data from the y or p register is sign-extended to 36 bits when operated on by the ALU. For notational convenience, the 36-bit accumulators can be thought of as having an implied binary point to the right of bit 16. Bits 15--0 are then the fractional part, which is referred to as aNI, where aN = aO, or aI, and bits 35-16 are the integer part. The ALU operates on all 36 bits of the accumulators. The CLR field of the auc register controls automatic clearing of the low half of aO, aI, and y, making it easy to perform 16-bit integer operations in the ALU by automatically clearing the low half of the register when the high half is loaded. The data transferred between an accumulator and memory or register must be scaled properly to reflect the bit alignment between p and a[O, 1] determined by the auc word. The user can select where the data in p is placed in the accumulator. Table 2-2 shows how two bits in the auc register, auc[l, 0], determine the bit alignment of the data in p with respect to the data in the 2-9 DSP16/DSP16A ARCHITECTURE Arithmetic and Precision accumulators. The connection of the data bus to the RAM, the accumulators, and the remaining registers in the DSPl6/DSPl6A device is fixed. Table 2-2. Arithmetic Unit Control (aue) Register I I I 6 5 4 3 I2 I0 I I SAT 11 Bit Field. CLR . ALIGN. Bit(s) Field Value ResuitiDeseription lxx Clearing yl is disabled (enabled when 0). 6-4 CLR rI xix ClearingaU is disabled (enabled when 0). ) Ix al saturation on overflow is disabled (enabled when 0). 3,2 SAT I xl aO saturation on overflow is disabled (enabled when 0). 00 p f- (xxy). 01 p f- (xxy) + 4. 1,0 ALIGN 10 p f- (xxy) x 4. 11 Reserved. ~ xxi Clearing aOl is disabled (enabled when 0). Note: The auc register is not affected by reset. If the auc[l, 0] bits are 00, the data in the p register is not shifted with respect to the bits in the accumulator before p[31-O] is transferred into bits 31-0 of an accumulator. The sign of p is extended by four bits, p[35-32], to provide overflow protection. The data transfer from p to an accumulator moves the overflow bits of the product into the guard bits 35-32 of the accumulator (see Figure 2-7 for the bit aligmnent in the DAU for auc[I,O]=OO). This mode is most often used when both x and y operands are 16-bit integers. If the auc[ 1, 0] bits are 10, the data in the p register is shifted two bits to the left with respect to the bits in the accumulator before p[31-O] are transferred into bits 33-2 of an accumulator. ° Bits 1 and of the accumulator are not changed by the load of the accumulator with the data in p, since 00 is added to or copied into these accumulator bits as indicated in Figure 2-8. The sign of p is extended by two bits, p[33-32], to provide overflow protection. The data transfer from p to an accumulator moves the overflow bits of the product into guard bits 35-34 of the accumulator (see Figure 2-8 for the bit aligmnent in the DAU for auc[I,O]=IO). This mode is often used in filtering applications where coefficients in the x register are in Q14 format (2 magnitude bits, 14 fractional bits), and state variables in the y register are 16-bit integers. If the p register is not shifted prior to accumulation, the accumulated result would have 4 guard bits, 18 magnitude bits, and 14 fractional bits. Since it is often desirable to have the implied binary point to the right of bit 16 (16 fractional bits), the setting auc[I,0]=2 automatically shifts the result 2 bit locations to the left generating an accumulated result with 4 guard bits, 16 magnitude bits, and 16 fractional bits. 2-10 DSP16/DSP16A ARCHITECTURE Arithmetic and Precision If the auc[1 ,0] bits are 01, the data in the p register is shifted two bits to the right with respect to the bits in the accumulator before p[31-2] are transferred into bits 29-0 of an accumulator. Bits p[ 1,0] are not saved in the accumulator by the load of the accumulator with the data in p in this auc setting. The sign of p is extended by six bits, p[37-32], to provide overflow protection. The data transfer to an accumulator from p moves the overflow bits of the product into the guard bits 35-32 and bits 31-30 of the accumulator (see Figure 2-10 for the bit alignment in the DAU for auc[1,O]=01). This setting is most useful when avoiding overflow is a primary consideration, and the loss of the two LSBs of the product can be tolerated. 15 o x (16) 16 1 15 o y (32) 16 1 15 o P (32) 35 32 131 16 1 15 o aO, a1 (36) Figure 2-7. DSP16/DSP16A Arithmetic Bit Alignment When auc[l,O]=OO 2-11 DSP16/DSP16A ARCHITECTURE Arithmetic and Precision 15 0 x (16) I 131 16 1 15 0 I y (32) 21 I 31 129 01 p (32) I I 35 1 131 16 1 15 21 0 I aO, a1 (36) I Figure 2-8. DSP16IDSP16A Arithmetic Bit Alignment When auc[1,0]=10 15 0 1 13 x (16) I 1 o y (32) 31 1 29 1 P (32) 35 30 1 29 aO, a1 (36) Figure 2·9. DSP161DSP16A Arithmetic Bit Alignment When auc [1,0]=01 2·12 DSP16/DSP16A ARCHITECTURE Serial I/O 2.6 SERIAL I/O The serial I/O port (SIO) allows the DSP16/DSP16A device to interface serially to other devices with few, if any, external chips (see Figure 2-10). The serial I/O port converts the serial input data stream to a parallel input data word and the parallel output data word to a serial output data stream. Serial I/O transfers are double-buffered to enable the DSP16/DSP16A device to handle back-to-back serial transfers. The second serial transmission can begin before the data from the first serial transmission has been processed. The external DSP16/DSP 16A serial I/O control signals allow a zero chip interface to commercially available codecs and to the DSP16/DSP16A, DSP32, and DSP32C devices for multiple DSP applications. The serial I/O control register, sioc, allows the specification under program control of: the length of the serial input and output data words; the mode, active or passive, of the serial bit clocks; the mode, active or passive, of the serial load signals; bit ordering of the I/O; the active serial I/O bit clock rate; and active load generated from either ICK or OCK. The length of serial input and output data words can be 8 or 16 bits. The serial I/O bit clocks and the serial I/O load signals are transmitted by the DSP16/DSP16A device to the rest of the external system in the active mode or are generated by the external system and transmitted to DSP16/DSP16A device in the passive mode. The mode of the input bit clock and load signal can be selected independent of the mode for the output bit clock and load signal. Active serial I/O bit clock rates of CKI/4, CKl/12, CKI/l6, and CKI/20 can be selected. The bit order of the serial input data can be specified to be bit-reversed when the input is moved from the serial input buffer to the destination register or RAM location; the bit order of the data can be specified to be bit-reversed when data is transferred to the serial output buffer from the source register or RAM location. Bit reversal of the data is necessary for IL-Iaw and A-law conversion and is performed in hardware rather than in software. See Chapter 5. The tdms register specifies the time slot of the DSP in a time-division multiplexed signal, whether the DSP is operating in a single or multiple DSP16/DSP16A environment and the active frame synchronization signal clock rate, f/128 or f/256. The synchronization clock can be active or passive. In the multiple DSP environment, a DSPI6/DSP16A device can directly address a maximum of seven other DSP16/DSP16A devices via the serial I/O port. The 16-bit srta register is loaded with two 8-bit addresses. One address specifies the receiving DSP identity; the second address identifies the destination DSP, where the serial data is accepted. See Chapter 5 for more detailed information. 2-13 DSP16IDSP16A ARCHITECTURE Parallel 110 SIO ICK OCK -----t..(""""lSR(16)1 i£ ~ Ul :::J CD ..: IBF !;;: Cl OSE SYNC SADD DOEN Figure 2-10. SIO - Serial Input/Output Unit 2.7 PARALLEL I/O The DSP16/DSP16A parallel I/O port (PIO) provides a l6-bit, bidirectional data link to microprocessors and other I/O devices (see Figure 2-11). The parallel I/O port supports bidirectional communication with other devices over a wide range of data transfer rates. The parallel I/O control word, pioc, allows the specification, under program control, of the configuration of the PIO data pins; the mode, active or passive, of the parallel I/O data strobe signals; and the width of the parallel I/O data strobe signals in the active mode. The l6-bit PIO data bus can be configured to transmit and receive 8 bits simultaneously or, under program control, either to input 16 bits or output 16 bits. The parallel I/O data strobe signals are transmitted by the DSP16/DSP16A device to the external system in the active mode or are generated by the external system and transmitted to the DSP16/DSP16A device in the passive mode. The mode of the input data strobe signal can be selected independent of the mode for the output data strobe signal. In the active mode, the pulse width of the strobe signals can be selected. The contents of the pioc register can be read to determine the status of the DSPI6/DSPI6A serial and parallel I/O ports. The pioc register contains a bit field with the status of the serial and parallel I/O flags. Under program control, this bit field can be read to determine the state of the I/O flags; the program cannot write this bit field in the pioc register. The DSP16/DSP16A device can directly address two devices via the PIO ports, pdxO and pdxl. The signal level on the PIO address line, psel, is low when data is written to pdxO and high when data is written to pdxl. A DSP16 instruction writes to eitherpdxO or pdxl to output data via the PIO port. A DSP16 instruction reads pdxO or pdxl to access the data input to the PIO port by external devices. The PIO data strobe signals are asserted when data is written to the PIO port by the DSP16/DSP16A device or by external devices. The PIO port can be used to interface the DSP16/DSPI6A device with a large external RAM memory. 2-14 DSP16IDSP16A ARCHITECTURE Interrupts INT lACK .. PDBOO- -I I pdx in (16) PIO PDB15 I pdx out (16) J PIDS PSEL PODS :! ; pioe (16) I Figure 2-11. PIO - Parallel Input/Output Unit 2.8 INTERRUPTS The DSP16/DSP16A device has one external interrupt request signal and four internal interrupt request signals. Hence, it can respond to one external and four internal conditions. These conditions are: • INT - Interrupt by an External Device. An external device has requested service by asserting the !NT pin. • IBF - Input Buffer Full. Indicates that an external device has written data into the device's serial input buffer. • OBE - Output Buffer Empty. Indicates that an external device has read data from the SIO serial output buffer. • PIDS - Parallel Input Data Strobe. Indicates that an external device has written data into the PIO parallel input register. • PODS - Parallel Output Data Strobe. Indicates that an external device has read the data from the PIO parallel output buffer. Each interrupt is maskable; that is, by appropriately clearing bits in the pioc register, the associated interrupt is ignored. The interrupt mask bits, pioc[5-9], are cleared (0) on reset, thereby disabling all interrupts. An interrupt causes a goto 1 instruction to be jammed into the instruction register. When in an interrupt service routine, the shadowing of the pc register is disabled (see Section 2.4.1). The DSPI6/DSP16A device also provides a software interrupt facility_ The instruction icall causes the same sequence of events to occur as any other interrupt source, except the branch address of the interrupt service routine is 2 rather than 1. Note that the branch address for interrupts is always at location 1 or 2 (the branch is not limited to the current 4 Kword page). 2-15 DSP16IDSP16A ARCHITECTURE Hardware Description Table 2-3. Parallel I/O Control (pioc) Register Bit 115 h41 13 I 12 I 11 110 I 9-5 I 4--0 I FieldlmFlsTROBEI PODS IPIDS IS/ciINTERRUPTS I STATUS I Bit(s) Field Value* ResultlDescription 15 IBF R IBF interrupt status bit (same as bit 4). Strobe width of PODS PIDS 00 Tt T 14,13 STROBE 01 2T 2T 10 3T 3T 11 4T 4T 0 PODS is an input (passive mode). 12 PODS 1 PODS is an output (active mode). 0 PIDS is an input (passive mode). 11 PIDS 1 PIDS is an output (active mode). 0 Not SIC mode. 10 SIC 1 SIC mode. lxxxx IBF interrupt is enabled (disabled when 0). xlxxx OBE interrupt is enabled (disabled when 0). 9-5 INTERRUPTS xxlxx PIDS interrupt is enabled (disabled when 0). xxxIx PODS interrupt is enabled (disabled when 0). xxxxl INT interrupt is enabled (disabled when 0). Rxxxx IBF status bit. xRxxx OBE status bit. 4---0 STATUS xxRxx PIDS status bit. xxxRx PODS status bit. xxxxR INT status bit. * R indicates a read-only bit. t T = 2 x tCKIHCKIH 2.8.1 Hardware Description The external interrupt mechanism has two relevant signals: INT and lACK. oINT - Interrupt Request. When asserted, this input indicates to the DSPI6/DSPI6A device that an external device is requesting service. To guarantee that this request is serviced, the INT signal must remain asserted for twice the period of the DSPI6/DSPI6A device's CKO signal (Le., 4 x tCKIHCKIH) . • lACK - Interrupt Acknowledge. When asserted, this output indicates that one of the internal or the external interrupt requests has been recognized by the DSPI6/DSPI6A device. Once the lACK signal has been asserted, it is negated upon completion of the interrupt service routine 2-16 DSP16/DSP16A ARCHITECTURE Software Description (Le., upon execution of an iretum instruction). lACK, when active, masks the interrupt request signal (INT). 2.8.2 Software Description After recognizing an interrupt, the DSPI6/DSPI6A device completes execution of the current instruction and then branches to address 1. Branch and conditional branch instructions and instructions executing within the cache are not interruptible. If an interrupt request occurs during an uninterruptible instruction, the DSPI6/DSPI6A device does not recognize the request until an interruptible instruction is encountered. See Chapter 3 for more information on the DSPI6/DSPI6A instruction set. The interrupt service routine entered should clear the respective status bit in the pioc register. If this is not done, the DSPI6/DSPI6A device repeatedly recognizes the interrupt until the appropriate status bit in the pioc is cleared. (This can be useful in certain applications.) Individual status bits are cleared in the following manner: • IBF - Input buffer full (pioc bits 4 and 15) is cleared by reading sdx, the serial input buffer. • OBE - Output buffer empty (pioc bit 3) is cleared by writing to sdx, the serial output buffer. • PIDS - Parallel input data strobe (pioc bit 2) is cleared by reading the parallel input buffer, pdxO or pdxl. • PODS - Parallel output data strobe (Pioc bit 1) is cleared by writing to the parallel output buffer, pdxO or pxd l. oINT - Interrupt by an external device (pioc bit 0) is cleared when lACK makes a high-to- low transition (initiated by an ireturn instruction), indicating the end of the interrupt service routine. The interrupt status bits are also cleared on reset. See Section 6.3 for more information on interrupts utilizing the PIO and Section 4.2.5 for techniques on handling multiple interrupts. 2-17 2-18 DSPI6/DSPI6A INSTRUCTION SET Notation 3. DSPI6/DSPI6A INSTRUCTION SET All DSPI6/DSPI6A instructions are 16 bits wide and have a C-like syntax. Pipelining of the instructions is necessary to achieve the real-time performance required by many signal-processing applications. To facilitate programming, the degree of pipelining in the DSPI6/DSPI6A device has been reduced and the latency effects present in previous generation DSPs have been eliminated. The instructions fall into one of five possible categories: • Multiply/ALU instructions are the primary instructions used to implement signal-processing programs. These instructions perform multiply/accumulate, logical, and other ALU functions and also transfer data between memory and registers in the data arithmetic unit. • Special Function instructions are used to perform such operations as rounding, negation, and logical left shifts and arithmetic right shifts of accumulators. Special function instructions may be conditionally executed on the basis of the state of internal flags. • Control instructions are used to control program flow. The call, goto, and return instructions are provided and may be conditionally executed on the basis of the state of internal flags. • Data Move instructions are used to transfer data between registers, memory, and accumulators. Immediate loads of certain registers are also possible. • Cache instructions allow the implementation of low overhead loops by loading a set of multiply/ALU and special function instructions into a cache memory and repetitively executing them (up to 127 times). The following sections describe in detail the notation used in the instruction set, the addressing modes supported, the internal flags used by conditional instructions, and the five groups of instructions. Note: Only multiply/ALU and special function instructions set DAU flags. 3.1 NOTATION The following operators are used to describe the instruction set: Operator Meaning * 16 x 16 -7 32-bit multiplication (Denotes register-indirect addressing when used as a prefix to an address register) + 36-bit addition 36-bit subtraction ++ Register postincrement Register postdecrement » Arithmetic right shift « Logical left shift 3-1 DSP16IDSP16A INSTRUCTION SET Indirect Addressing & 32-bit bitwise AND I 32-bit bitwise OR " 32-bit bitwise EXCLUSIVE OR Compound addressing For all instructions listed in this chapter, the following are true: • Brackets, [ ], are not part of the instruction syntax, but indicate that the enclosed item is optional. • Parentheses, ( ), and braces, { }, are part of the instruction syntax and must appear where shown in the instruction. The valid instruction groups for the DSP16/DSP16A device are represented in Tables 3-3 to 3-12. The items in Tables 3-3 to 3-12 and 3-14 to 3-23 that are written in lower-case letters are proper statements and must appear where shown in the instruction. The items with capital letters are not proper statements and are replaced with immediate data, a register name, or a condition. 3.2 ADDRESSING MODES The DSP16/DSP16A Digital Signal Processor allows immediate, indirect, and compound addressing modes. Instructions using indirect and compound addressing are typically used to encode real-time, signal-processing algorithms and, hence, require less program memory and execute faster than immediate addressing. 3.2.1 Immediate Addressing In immediate addressing, the operand is supplied in the instruction. This situation is useful when initializing registers and is provided at the expense of one additional ROM location and one instruction cycle of execution time. A short immediate addressing mode is supplied to set the YAAU registers, rO--r3, j, k, rb, and re which are 9 bits wide on the DSP16. The DSP16A YAAU registers are 16 bits wide, so short immediate addressing may only be used when loading values that are 9 bits long or less. Short immediate instructions execute in one cycle, use one ROM location, and are cacheable. 3.2.2 Indirect Addressing Indirect addressing allows a register to be used as a pointer to another location. The terms X and Y specify the source of data from memory to registers or the destination of data from registers to memory: X = *pt++ or *pt++i Y = one of: *rM, *rM++, *rM- -, *rM++j Note: M=oneof: 0,1,2,3 The term X represents the ROM data to be copied into the x register. The term Y represents the RAM data to be copied into the specified register or the data written to RAM from a register. The 3-2 DSP16/DSP16A INSTRUCTION SET Compound Addressing mnemonics for X and Y indicate register indirect addressing with a postmodification of the address pointer. The asterisk preceding the RAM or ROM address register stands for "the data pointed to by the address in the register." The mnemonics have the following meaning: • *rM. This example means "the data pointed to by the address in the register." The contents of the register are not altered by the operation. • *rM++, pt++. The "++" following the address register indicates a postincrement of the address register. This example means "the data pointed to by the address in the register; add 1 to the contents of the register after the operation is complete." • *rM=. The "=" following the address register indicates a postdecrement of the address register. This example means "the data pointed to by the address of the register: subtract 1 from the contents of the register after the operation is complete." • *rM-H-j. The "++j" following the address register indicates a postincrement of the address register. This example means "the data pointed to by the address in the register; add the value of register j to the contents of the address register after the operation is complete." Negative values of j yield a postdecrement. • *pt++i. The "++i" following the address register indicates a postincrement of the address register. This example means "the data pointed to by the address in the register; add the value of register i to the contents of the address register after the operation is complete." Negative values of i yield a postdecrement. Modulo (virtual shift) addressing uses indirect addressing to form the equivalent of a cyclic shift register within the RAM. Addresses loaded into registers rb and re define the first and last physical addresses of the modulo, respectively. When a register is used as a memory pointer. its value is compared with reo If its value is equal to the contents of re and the postincrement is +I, then the value in rb is copied into the register after the memory access is complete. See Section 4.2.3. 3.2.3 Compound Addressing Compound addressing is a memory read/write operation using only one pointer register. The term Z specifies a source and a destination for a compound RAM read followed by a write sequence. The mnemonics for Z are a shorthand notation for the compound addressing functions explained below and shown in Table 3-1. The term temp used in the descriptions is a hypothetical register used for illustration only. 3-3 DSP16IDSP16A INSTRUCTION SET Processor Flags Table 3-1. Compound Addressing Instructions Instruction Operations Z:R Step 1 Step 2 Step 3 *rMzp:R temp=R; R=*rM; *rM++=temp; *rMpz:R temp=R; R=*rM++; *rM=temp; *rMm2:R temp=R; R=*rM-; *rM++2=temp; *rMik:R temp::R; R=*rM++j; *rM++k=temp; Notes: Mcanbe 0,1,2,3. R can be one of x, y, yl, rO, r1, r2, r3, pi, pr, i, j, k, cO, c1, c2, rb, Ie, psw, auc, sioc, SIta, sdx, tdms, pioc, all, aOl, aI, all. R and rM must not be the same register (i.e., rlpz:rl). As with other instructions that use the y, aO, and al registers, the following rules apply when using the compound addressing mode: • If clearing of the low half of the register is enabled (according to the CLR field of the auc register), the low half of the register is cleared when the high half is loaded. • If saturation on overflow is enabled (according to the SAT field of the auc register), the value in the accumulator is limited. See Section 2.5.1. Virtual shift addressing may be used with compound addressing. The contents of the address register are compared with the contents of register re during both the read and write cycles. If the contents of the address register are equal to the contents of re during the read cycle and the "*rMpz" mode is specified. rM is loaded with the contents of rh. If the contents of the address register are equal to the contents of re during the write cycle and the "*rMzp" mode is specified, rM is loaded with the contents of rh. See Section 4.2.3. 3.3 PROCESSOR FLAGS Control and special function instructions may be conditionally executed on the basis of internal flags set by the previous ALU operation, the condition of one of the counters, or the value of a randomly set bit in the device. Multiply/ALU function statements and special function instructions affect the flags; loading an accumulator with a multiply/ALU transfer statement or a data move instruction does not affect the flags. The processor flags and their meanings are: LMI Logical Minus - A logical minus is detennined by the state of bit 35 of the last DAU operation result. lfbit 35=1, the result is a negative number and LMI is true. LEQ Logical Equal- A logical equal is detennined by the sum of bits 35-0 of the last DAU operation result. lfthe sum of the bits equals zero, the result is zero and LEQ is true. LLV Logical Overflow (36-Bit Overflow) - LLV is true if the sign of the result of an operation cannot be represented in a 36-bit accumulator. 3-4 DSP16/DSP16A INSTRUCTION SET Processor Flags LMV Mathematical Overflow (32.Bit Overflow) - LMV is true if the overflow bits (35-31) of the accumulator used in the last DAU operation are not identical. This indicates a number not representable in 32 bits. Table 3·2 shows the mnemonics that are used in conditional instructions and their meanings. The state of the internal flags that causes the condition to be true is enclosed in parentheses after the description. For example, when testing the condition Ie, the result is true if either the logical minus (LMl) or logical equal (LEQ) flags are true. Table 3·2. Conditional Mnemonics Test Meaning Test Meaning pI Result is nonnegative (not mi Result is negative (LMI). LMI). eq Result is equal to zero (LEQ). ne Result is not equal to zero (not LEQ). gt Result is greater than zero (not Ie Result is less than or equal to LMI and not LEQ). zero (LMI or LEQ). lvs Logical overflow set (LLV). lvc Logical overflow clear (not LLV). mvs Mathematical overflow set mvc Mathematical overflow clear (LMV). (notLMV). cOge* Counter 0 greater than or equal cOlt* Counter 0 less than zero. to zero. clge* Counter I greater than or equal cllt* Counter I less than zero. to zero. headst Pseudorandom sequence bit set. taiist Pseudorandom sequence bit clear. true The condition is always false The condition is never satisfied satisfied in an if instruction. in an if instruction. * Testing each of these conditions increments the respective COlDlter being tested. t The heads or tails condition is determined by a randomly set or cleared bit, respectively. The bit is randomly set with probability of 0.5. The random bit is generated by a 10·state pseudorandom sequence generator that is updated after either a heads or tails test The pseudorandom sequence may be reset by writing any value to the pi register. Writing to the pi register does not affect the contents of the pi register except while in an interrupt service routine. A random rounding function can be implemented by using either of these two conditions. 3·5 DSP16/DSP16A INSTRUCTION SET Multiply/ALU Group 3.4 MULTIPLY/ALUGROUP The multiply/ALU instructions are the primary instructions used to implement signal-processing programs. Statements from this group can be combined to generate multiply/accumulate, logical, and other ALU functions and to transfer data between memory and registers in the data arithmetic unit. In the examples presented, the statements should be read from right to left, top to bottom. Statements within a multiply/ALU instruction are executed essentially in parallel. The multiply/ALU instructions usually consist of more than one part. Each part of an instruction is called a statement. The general rule is that valid instructions can be formed by choosing one statement from each statement column in Table 3-3. If either statement is not required, then a single statement from either column also constitutes a valid instruction. Conversely, valid instructions can be decomposed into separate statements, with each coming from a different column in the Table 3-3. The multiply/ALU instructions consist of two parts: a function and a transfer (see Table 3-3). The statements in the function column can be separated into two types: those involving the multiplier and those involving only the ALU in the data arithmetic unit. The multiply/accumulate instructions typically used in signal-processing applications are assembled from statements from the function column that include the multiplication of the data in x and y[31-16]. In a multiply/accumulate instruction, the x and y registers are loaded with the operands, the product of the previous operands is generated, and the previous product is accumulated in aO or a1. The following example shows how a typical multiply/accumulate sequence is implemented. Example: Instruction # (1) y=Y x=X (2) p=x*y (3) aD=aS+p In the example presented, the data in the X source is copied into the x register and the data in the Y source into bits 31-16 of the y register in line 1. In line 2, the product of the data in x and y[31-16] is generated and stored in p. In line 3 the data in the source accumulator, as, and the data in p are added and the result loaded into the destination accumulator. Note that lines 2 and 3 could also have specified memory transfer operations for later instructions. 3·6 DSP16IDSP16A INSTRUCTION SET MultiplylALU Group The ALU instructions perform one of the following: • The logical operations of AND, OR, or XOR between an accumulator and the data in the Y register. • The addition or subtraction of the data in the y register from an accumulator. • The load of an accumulator with the data in the y register. The y register must be loaded prior to the ALU operation. The following example shows how a typical logical operation is implemented. (1) y=Y (2) aD=aS&y In this example, the data in the Y source is copied into the y register in line 1. In line 2, the logical AND of the data in the source accumulator, as, and the data in y as a result of line 1 are calculated and the result is loaded into the destination accumulator. All multiply/ALU instructions require 1 word of memory. The number of instruction cycles required to execute an instruction in the multiply/ALU group is a function of the statement selected from the transfer column in Table 3-3. Instructions with statements in the transfer column involving a write to RAM are executed in two instruction cycles whether the instruction is in or out of the cache. Instructions with statements in the transfer column involving a read from the RAM and the ROM simultaneously are executed in two instruction cycles if not in the cache and one instruction cycle if in the cache. An instruction with no transfer statement executes in one instruction cycle either in or out of the cache. The remaining instructions are executed in one instruction cycle either in or out of the cache. Table 3-3 gives the number of instruction cycles for each case. The multiply/ALU instructions use one ROM location. The no operation (nop) instruction is a special-case encoding of a multiply/ALU instruction and is executed in one instruction cycle. The assembly-language notation representation of a no operation instruction is either nop or a single semicolon (;). 3-7 DSP16/DSP16A INSTRUCTION SET Multiply/ALU Group Note that the function statements and transfer statements in Table 3-3 are chosen independently. Any function statement may be combined with any transfer statement to form a valid multiply/ALU instruction. Table 3-3. Multiply/ALU Instructions Transfer Function Cycles Statements Statements OutlIn Cache p=x*y y=Y x=X 2/1 aD=p p=x*y y=aT x=X 2/1 aD=aS+p p=x*y y[l]=Y 1/1 aD=aS-p p=x*y aT[I]=Y 1/1 aD=p x=Y 1/1 aD=aS+p Y 1/1 aD=aS-p Y=y[I] 2/2 aD=y Y=aT[I] 2/2 aD=aS+y Z:y x=X 2/2 aD=aS-y Z: y[I] 2/2 aD=aS&y Z: aT[I] 2/2 aD=aSly aD=aSl\y as-y as&y Table 3-4. Replacement Table for Multiply/ALU Instructions Replace Value Meaning aD,aS, aT aO,aI One of two DAU accumulators. X *pH+, *pt++i ROM location pointed to by pt. pt is postmodified by + 1 and i, respectively. Y *rM, *rM++, RAM location pointed to by rM. *rM-, *rM++j (M= 0, 1,2, 3). rM is postmodified by 0,+1,-1, andj, respectively. Z *rMzp, *rMpz, Read/write compound addressing. *rMm2, *rMjk rM (M = 0, 1,2,3) is used twice. First, postmodified by 0, + I, -I, and j respectively and second, postmodified by + I, 0,+ 2, and k, respectively. 3-8 DSP16/DSP16A INSTRUCTION SET Function Statements On the basis of the information given in Table 3-4, apply the following information to the function and transfer statements in Table 3-3: • Loads of aD, ai, and y clear the lower half of the selected register when the appropriate CLR field bits in the auc register are zeroed. • Loads of aOl, all, and yl do not change the data in the high half of the selected register. • The y and p operands are sign-extended to match the width of the accumulators. 3.4.1 Function Statements In the execution of these statements, the width of the number is extended to 36 bits, which is the size of the accumulators. This extension is accomplished by extending the sign bit in the p register to retain the correct 2's complement value. The multiplier performs a 2 's complement multiply, using x and the high halfofy (bits 31-16). The statements must be written in the exact format shown. If the statements are written in any other way, for example, aD=p+aS instead of aD=aS+p, the assembler produces an error message. • p=x*y. The contents of the x and the y (bits 31-16) registers are multiplied and the result is placed in the p register. • aD=p p=x*y. The contents of the p register are copied into the destination accumulator, aD. The contents of the x and the y (bits 31-16) registers are multiplied and the result is placed in the p register. The bit alignment of the p register is a function of the ALIGN field of the auc register. • aD=aS+p p=x*y. The contents of the source accumulator, as, are added to the contents of the p register and the result is placed in the destination accumulator, aD. The bit alignment of the p register is a function of the ALIGN field of the auc register. The contents of the x and the y (bits 31-16) registers are multiplied and the result is placed in the p register. • aD=aS-p p=x*y. The contents of the p register are subtracted from the contents of the source accumulator, as, and the result is placed in the destination accumulator, aD. The bit alignment of the p register is a function of the ALIGN field of the auc register. The contents of the x and the y (bits 31-16) registers are multiplied and the result is placed in the p register. • aD=p. The contents of the p register are copied into the destination accumulator, aD. The bit alignment of the p register is a function of the ALIGN field of the auc register. • aD=aS+p. The contents of the source accumulator, as, are added to the contents of the p register, and the result is placed in the destination accumulator, aD. The bit alignment of the p register is a function of the ALIGN field of the auc register. • aD=aS-p. The contents of the p register are subtracted from the contents of the source accumulator, as, and the result is placed in the destination accumulator, aD. The bit alignment of the p register is a function of the ALIGN field of the auc register. • aD=y. The contents of the y register are copied into the destination accumulator, aD. o aD=aS+y. The contents of the source accumulator, as, are added to the contents of the y register and the result is placed in the destination accumulator, aD. • aD=aS-y. The contents of the y register are subtracted from the contents of the source 3-9 DSP16/DSP16A INSTRUCTION SET Transfer Statements accumulator, as, and the result is placed in the destination accumulator, aD. o aD=aS&y. The contents of the source accumulator, as, are ANDed with the contents of the y register, and the result is placed in the destination accumulator, aD. o aD=aSly. The contents of the source accumulator, as, are ORed with the contents of the y register, and the result is placed in the destination accumulator, aD . • aD=aSl\y. The contents of the source accumulator, as, are XORed with the contents of the y register, and the result is placed in the destination accumulator, aD. o as-yo The contents of the y register are subtracted from the contents of the source accumulator, as. The result is not placed in the destination accumulator, aD; however, the ALU flags are affected by the results of the subtraction. o as&y. The contents of the source accumulator, as, are ANDed to the contents of the y register. The result is not placed in the destination accumulator, aD; however, the ALU flags are affected by the results of the AND function. 3.4.2 Transfer Statements The transfer statements allow the user to transfer data from memory to the x and y registers and the accumulators, or from the y register and the accumulators to memory. o y=Y x=X. The data from the specified Y source is loaded into the high half (bits 31-16) of the y register. The data from the specified X source is loaded into the x register. If clearing of yl is enabled (according to the CLR field of the auc register), then yl is cleared (0) when the high half is loaded. o y=aT x=X. The data in the high half (bits 31-16) of the specified accumulator is loaded into the high half (bits 31-16) of the y register. The data from the specified X source is loaded into the x register. If clearing of yl is enabled (according to the CLR field of the auc register), then yl is cleared (0) when the high half is loaded. o y=Y. The data from the specified Y source is loaded into the high half of the y register (bits 31-16). If clearing of yl is enabled (according to the CLR field of the auc register), then yl is cleared (0) when the high half is loaded. o yl=Y. The data from the specified Y source is loaded into the low half of the y register (bits 15--0). The data in the high half of Y is not altered. o aT=Y. The data from the specified Y source is loaded into the high half (bits 31-16) of the specified accumulator. The guard bits (35-32) are loaded with the value of bit 31. If clearing of aTl is enabled (according to the CLR field of the auc register), the low half of the accumulator is cleared (0) when the high half is loaded. 3-10 DSP16/DSP16A INSTRUCTION SET Transfer Statements o aTI=Y. The data from the specified Y source is loaded into the low half (bits 15-0) of the specified accumulator. The data in the high half of the accumulator is not altered. o x=Y. The data from the specified Y source is loaded into the x register. o Y. No data is transferred. This transfer statement is used to modify the address register specified. o Y=y. The data in the high half of the y register (bits 31-16) is loaded into the specified Y destination. o Y=yl. The data in the low half of the y register (bits 15-0) is loaded into the specified Y destination. o Y=aT. The data in the high half (bits 31-16) of the specified accumulator is written into the specified Y destination. If saturation on overflow is selected (according to the SAT field of the auc register), the accumulator value is limited. See Section 2.5.1. o Y=aTI. The data in the low half (bits 15-0) of the specified accumulator is written into the specified Y destination. If saturation on overflow is selected (according to the SAT field of the auc register), the accumulator value is limited. See Section 2.5 .1. o Z: y x=X. The data from the specified X source is loaded into the x register. The data from the specified Z source is loaded into the high half (bits 31-16) of the y register, and the old data from the high half of the y register is loaded into the Z destination. If clearing of yl is enabled (according to the CLR field of the auc register), then yl is cleared (0) when the high half is loaded. o Z:y. The data from the specified Z source is loaded into the high half (bits 31-16) of the y register and the old data from the high half of the y register is loaded into the Z destination. If clearing of yl is enabled (according to the CLR field of the auc register), then yl is cleared (0) when the high half is loaded. o Z:yl. The data from the specified Z source is loaded into the low half (bits 15-0) of the y register and the old data of the low half of the y register is loaded into the Z destination. Data in the high half of the y register is not altered. o Z: aT. The data from the specified Z source is loaded into the high half (bits 31-16) of the specified accumulator. If clearing of aTl is enabled (according to the CLR field of the auc register), the low half of the accumulator is cleared (0) when the high half is loaded. The guard bits (35-32) are loaded with the value of bit 31. The old data from the high half of the accumulator is loaded into the Z destination. If saturation on overflow is enabled (according to the SAT field of the auc register), the accumulator value is limited. See Section 2.5.1. o Z:aTI. The data from the specified Z source is loaded into the low half (bits 15-0) of the specified accumulator and the old data from the high half of the accumulator is loaded into the Z destination. The data in the high half of the accumulator is not altered. If saturation on overflow is enabled (according to the SAT field of the auc register), the accumulator value is limited. See Section 2.5.1. 3-11 DSP/DSP16A INSTRUCTION SET Special Function Group 3.4.3 No Operation • nop. Single cycle no operation. N * nop (Le., 4 * nop) may be used to perform N no operation instructions. • ;. The semicolon is an optional no operation mnemonic. N * ; may also be used to perform N no operation instructions. 3.5 SPECIAL FUNCTION GROUP Instructions from the special function group are always executed in one instruction cycle. They require one word of program memory. Using the special function instructions, the DSP16/DSP16A device can be used to implement a number of algorithms, which include the following nonlinear functions: absolute value, signum, minimum and maximum value finder, A- law and Jl-Iaw conversions, division, half-wave and full-wave rectification, and rounding. Special function instructions are executed either conditionally or unconditionally. Both the condition and its complement are available for use in special function instructions. A special function instruction uses one ROM location. Instructions from this group can be used in the cache. The special function instructions can be conditioned on the basis of the results of previous multiply/ALU and special function instructions, the value of one of the counters (cO, c1), or the value of a randomly set bit in the DSPl6 device. The result of the most recent accumulator operation prior to the special function instruction establishes the state of the flags for the conditions associated with logical or mathematical functions. The special functions given in Table 3-5 can be conditionally executed as if CON instruction and with an event counter as ife CON instruction, meaning that: if CON is true then cl = cl + 1 instruction c2= cl else c1=c1+1 Note: When using the event counter (ife instruction), if CON is cOlt or cOgt, then cO is not incremented; if CON is cllt or clgt, then cl is incremented once. 3-12 DSP/DSPI6A INSTRUCTION SET Special Function Statements Table 3-5. Special Function Instructions Instruction Description aD=aS»1 aD=aS>>4 Arithmetic right shift (sign preserved) of aD=aS»8 36-bit accumulators. aD=aS»16 aD=aS aD=--aS - aD=md(aS) Round upper 20 bits of accumulator. aDh=aSh+l Increment high half of accumulator (lower half cleared). aD=aS+l Increment accumulator. aD=y - aD=p aD=aS«1 aD=aS«4 Logical left shift (sign-extended from bit 31) of the aD=aS«8 least significant 32 bits of the 36-bit accumulators. aD=aS«16 Table 3-6. Replacement Table for Special Function Instructions Replace Value Meaning aD,aS aO,al One of two DAD accumulators. CON mi, pI, eq, ne, gt, Ie, lvs, See Table 3-2 for defInitions mvs, mvc, cOge, cOlt, clge, of processor flags. c 11t, heads, tails, true, false _ 3.5.1 Special Function Statements The statements must be written in the exact format shown. If the statements are written in any other way, for example, aD= 1+as instead of aD=aS+ 1, the assembler produces an error message. • al>=aS»I. The contents of the source accumulator, as, are divided by 2 and the result is placed in the destination accumulator, aD. The sign bit is preserved. • al>=aS»4. The contents of the source accumulator, as, are divided by 24 and the result is placed in the destination accumulator, aD. The sign bit is preserved. • al>=aS»8. The contents of the source accumulator, as, are divided by 28 and the result is placed in the destination accumulator, aD. The sign bit is preserved. • aD=aS» 16. The contents of the source accumulator, as, are divided by 216 and the result is placed in the destination accumulator, aD. The sign bit is preserved. • al>=aS«I. The contents of the source accumulator, as, are logically shifted one bit left and the result is placed in the destination accumulator, aD. The sign bit is extended from bit 31. 3-13 DSP/DSP16A INSTRUCTION SET Control Group o aD=aS«4. The contents of the source accumulator, as, are logically shifted four bits left and the result is placed in the destination accumulator, aD. The sign bit is extended from bit 31. o aD=aS«8. The contents of the source accumulator, as, are logically shifted eight bits left and the result is placed in the destination accumulator, aD. The sign bit is extended from bit 31. o aD=aS<<16. The contents of the source accumulator, as, are logically shifted sixteen bits left and the result is placed in the destination accumulator, aD. The sign bit is extended from bit 31. o aD=aS. The contents of the source accumulator, as, are placed in the destination accumulator, aD. o aD=-aS. The 2's complement of the contents of the source accumulator, as, is placed in the destination accumulator, aD. o aD=rnd(aS). The contents of the source accumulator, as, are rounded to 16 bits, and the sign-extended result is placed in aD[35 - 16] with zeros in aD[15 - 0]. o aDh=aSh+l. The value OXOOOO10000 is added to the contents of the source accumulator, as, and the result is placed in the destination accumulator, aD. This statement increments by one the data in the high half of the source accumulator. The low half of aD is cleared. o aD=aS+l. The value OxOOOOOOOOI is added to the contents of the source accumulator, as, and the result is placed in the destination accumulator, aD. This statement increments by one the data in the source accumulator. o aD=y. The contents of the y register are written to the destination accumulator, aD. o aD=p. The contents of the p register are written to the destination accumulator, aD. The bit alignment of the p register is a function of the ALIGN field of the auc register. 3.6 CONTROL GROUP The control instructions allow the user to implement goto, call, and return commands. There is no latency when branching, i.e., the instruction executed following the control instruction has the address specified in the pc register after execution of the control instruction. Control instructions are executed either conditionally or unconditionally. Both the condition and its complement are available for use in control instructions. A control instruction uses one ROM location; conditional control instructions require two ROM locations. The execution time for an unconditional control instruction is two instruction cycles, and the execution time for conditional control instructions is three instruction cycles. The icall instruction executes in three cycles. Control instructions may not be executed in the cache. The control instructions can be conditioned on the basis of the results of previous multiply/ALU and special function instructions, the value of one of the counters (cO, c1), or the value of a randomly set bit in the DSPI6/DSPI6A device. The result of the most recent accumulator operation prior to the control instruction establishes the state of the flags for the conditions associated with logical or mathematical functions. 3·14 DSP!DSPI6A INSTRUCTION SET Control Statements An example of a control instruction conditionally executed is if CON goto lA. Control Instructions* gotolA icallt goto pt return (goto pr) calllA ireturnt (goto pi) call pt * Control instructions cannot be used in the cache. t ieall and ireturn can not be conditionally executed. Table 3-7. Replacement Table for Control Function Instructions Replace Value Meaning CON mi, pi, eq, ne, gt, Ie, lvs, See Table 3-2 for definitions mvs, mvc, cOge, cOlt, c1ge, of processor flags. c 11t, heads, tails, true, false JA 12-bit value Least significant 12 bits of an absolute address within the same 4 Kword memory section. 3.6.1 Control Statements • goto JA. The goto JA instruction moves the immediate value JA into the lower 12 bits of the program counter (pc) register, when goto JA is executed. The upper 4 bits of pc remain unchanged. The instruction with address JA is the next instruction executed. The goto JA instruction does not affect the program return (pr) register, and can be used in a subroutine without losing the return address of the subroutine. • call JA. The call JA instruction moves the contents of the program counter (pc) register into the program return (pr) register and the immediate data JA into the lower 12 bits of the pc register. The upper 4 bits of pc remain unchanged. The pr register holds the return address of the subroutine (the address of the instruction following call JA); i.e., if call JA is located at address i, then the pr register is loaded with address i+ 1. The instruction with address N is the next instruction executed. • goto pt. The goto pt instruction moves the contents of pt into the program counter (pc) register, when goto pt is executed. The instruction with address equal to the contents of pt is the next instruction executed. Since pt is a 16-bit register, goto pt allows branches to any location in the 64 Kword program space. The goto pt instruction does not affect the program return register. 3-15 DSP/DSP16A INSTRUCTION SET Data Move Instructions • call pt. The call pt instruction moves the contents of the program counter (PC) register into the program return (pr) register and the data in pt into the pc register. The pr register holds the return address of the subroutine (the address of the instruction following call pt); i.e., if the call pt is located at address i, then the pr register is loaded with the value i+ 1. The instruction with address equal to the contents of pt is the next instruction executed. • icall. The icall instruction moves the contents of the program counter (PC) register into the program interrupt (pi) register and the address 2 into the pc register. The pi register holds the return address of the interrupt routine (the address following the icall instruction); i.e., if the icall instruction is located at address i, then the pi register is loaded with the value i+ 1. The icall instruction is used by the DSP16/DSPI6A Development Systems for breakpointing and is, therefore, reserved for that purpose when development system breakpoints are used. • return Igoto pro The return instruction moves the contents of the program return (pr) register into the program counter (pc) register. The pr register holds the return address of the subroutine. Execution of the instruction with address equal to the contents of pr follows the execution of the return instruction. The goto pr instruction works identically to the return instruction. • ireturn /goto pi. The ireturn instruction moves the contents of the program interrupt (pi) register into the program counter (PC) register. The pi register holds the interrupt return address. When an interrupt occurs, the value of the pc register is written into the pi register. Execution of the instruction with address equal to the contents of pi follows the execution of the ireturn instruction. The goto pi instruction works identically to the ireturn instruction. 3.7 DATA MOVE INSTRUCTIONS Data move instructions transfer from a RAM location to a register, from a register to a RAM location, from an accumulator to a register, from a register to an accumulator; and load immediate data to a register. Data move instructions involving immediate data loaded into YAAU registers use one ROM location and execute in one instruction cycle if the data can be encoded in the instruction itself (R = M, M $; 9 bits) or two ROM locations if the data is not contained in the instruction (R = N). All other data move instructions use one ROM location. Data move instructions are executed in two instruction cycles except for those instructions in which the immediate data is encoded in the instruction which are executed in one instruction cycle as noted above (R = M). All data move instructions, with the exception of two-word immediate moves, may be executed inside the cache. Data Move Instructions R =N aT=R R=M Y=R R =Y Z:R R =as 3-16 DSP!DSP16A INSTRUCTION SET Data Move Instructions Table 3·8. Replacement Table for Data Move Instructions Replace Value Meaning R x DAU register - signed, 16 bits. y DAU register - signed, 16 bits.! yl DAU register - unsigned, 16 bits. auc DAU control register - unsigned, 7 bits. cO DAU counter 0 - signed, 8 bits. c1 DAU counter 1 - signed, 8 bits. c2 DAU counter 2 - signed, 8 bits. rO Y AAU ptr. reg. - unsigned, 9 bits (16 bits in DSP16A). r1 Y AAU ptr. reg. - unsigned, 9 bits (16 bits in DSP16A). r2 Y AAU ptr. reg. - unsigned, 9 bits (16 bits in DSP16A). r3 YAAU ptr. reg. - unsigned, 9 bits (16 bits in DSP16A). rb Y AAU mod. addr. reg. - unsigned, 9 bits (16 bits in DSP16A). re Y AAU mod. addr. reg. - unsigned, 9 bits (16 bits in DSP16A). j YAAU inc. reg. - signed, 9 bits (16 bits in DSP16A). k Y AAU inc. reg. - signed, 9 bits (16 bits in DSP16A). pt XAAU pointer register - unsigned, 16 bits. pr XAAU program return register - unsigned, 16 bits. pi XAAU program interrupt register - unsigned, 16 bits? i XAAU increment register - signed, 12 bits. psw Processor status word. sioc Serial I/O control register? sdx Serial I/O data register. tdrns Serial I/O tdms control register. 3 srta Serial receive/transmit address.3 pioc Parallel I/O control register. pdxO Parallel I/O data register with PSEL =0 (pin 72). pdx1 Parallel I/O data register with PSEL = 1 (pin 72). aD,aS aO,al High half of accumulator.! Y *rM,*rM++, Same as in multiply/ALU instructions. *rM--,*rM++j Z *rMzp,*rMpz, Same as in multiply/ALU instructions. *rMm2,*rMjk N 16·bit value Immediate data. M 9·bit value Immediate data for Y AAU registers. Notes: When reading signed registers less than 16 bits wide, their contents are sign-extended to 16 bits. When reading unsigned registers less than 16 bits wide, their contents are zero-extended to 16 bits. When short immediate addressing is used to write to YAAU registers in the DSPI6A, unsigned registers are zero-extended from 9 to 16 bits. Signed registers (j,k) are sign-extended from 9 to 16 bits. !Datamoves to y, aO, or alload the high half (bits 31-16) of the register. If clearing of the destination is enabled (according to the CLR field of the auc register), the low half of the destination register is cleared (0) when the high half is loaded. 2-rhe pi register acts as a "shadow" of the pc register. Each time the pc changes, its value is also loaded into pi. "Shadowing" is disabled when executing an interrupt service routine, therefore, pi contains the contents of pc prior to the interrupt. Writes to pi do not alter its contents, except during interrupt service routines. 3sioc, tdms, and srta registers are not readable. 3-17 DSPIDSP16A INSTRUCTION SET Data Move Instruction Statements 3.7.1 Data Move Instruction Statements The data move instruction statements must be written in the exact fonnat shown. If the statements are written in any other way, for example, R: Z instead of Z:R, the assembler generates incorrect code and produces an error message. Data move instructions execute in two instruction cycles and require 1 word of program memory (immediate loads, R =N, require two words of program memory). Short immediate data move instructions require one word of program memory and execute in one cycle. • R=N loads the immediate data value, N, into the specified destination register, R. This fonn of the data move instructions may not be executed in the cache. • R=M loads a 9-bit immediate data value, M, into one of the YAAU registers (rb, re, rO, rl, r2, or r3). This special case immediate instruction is often referred to as a "short immediate" or "register set" instruction. Short immediate instructions require one word of program memory, execute in one cycle, and may be executed inside the cache. • R=Y loads the data contained in the specified Y source into the specified destination register, R. • R=aS loads the data contained in bits 31-16 of the specified transfer accumulator, as, into the specified destination register, R. If saturation on overflow is enabled (according to the SAT field of the auc register), then the accumulator is limited. (See Section 2.5.1.) • Y=R loads the data contained in the specified source register, R, into the specified Y destination. • aT=R loads the data contained in the specified source register, R, into bits 31-16 of the specified accumulator. If clearing of aTl is enabled (according to the CLR field of the auc register), then aTl is cleared (0) when the high half is loaded. The guard bits are loaded with the value of bit 31. • Z: R writes data from the specified Z source to the specified R destination register and writes the old data in the source register, R, to the Z destination (see Section 3.2.4 for an explanation of this data transfer mode). 3.8 CACHE INSTRUCTIONS The cache instructions allow the implementation of low overhead loops to conserve program memory. When used, the cache instruction treats the specified NI instructions as a loop to be executed K times. Both cache instructions use one ROM location. The do instruction executes in one instruction cycle, while the redo instruction executes in two instruction cycles. 3-18 DSP/DSP16A INSTRUCTION SET Cache Statements Cache Instructions do K { redoK instruction 1 instruction2 instructionNI } Table 3-9. Replacement Table for Cache Instructions Replace Value Meaning K 2:::; K:::; 127 Number of times the instructions are to be executed. NI 1:::; N1:::; 15 1 to 15 instructions may be included. 3.8.1 Cache Statements When the cache is used to repeat a block of NI instructions, the cycle timings of the instructions are as follows: 1. The "first pass" does not affect cycle timings except for the last instruction in the block of NI instructions. This instruction executes in two cycles. 2. During pass 2 through pass K+I, each instruction is executed "in the cache" (see Table 3-3). 3. During the last (Kth) pass, the block of instructions executes "inside the cache," except for the last instruction, which executes outside the cache. The instructions remain in the cache memory and may be re-executed using the redo command without the need to reload the cache . • redo k. When the redo k instruction is used, the DSP executes the NI instructions currently in the cache's memory k times. On the last iteration, the last instruction is executed outside the cache. Note: Control group instructions and two-word data move instructions may not be executed from the cache. 3-19 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 3.9 INSTRUCTION SET SUMMARY This section explains, in detail, the instruction set for the DSP 16/DSP16A. Refer to Appendix A for instruction set fonnats and field encodings. goto JA (branch direct) (PC) +- (PC bits 15-12)(JA) Program control jumps to location JA (within the same 4 Kword page). The lower 12 bits of the PC are written with the 12-bit immediate value of JA. The upper 4 bits of the PC remain unchanged (the goto pt instruction is used for branches outside the current 4 Kword page). Bit i5 12 11 o Field o o o o JA Words: 1 Cycles: 2 Group: Control Addressing: Immediate Flags affected: None Interruptible: No Cacheable: No Fonnat: 4 3-20 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary gotoB (branch direct) (pc) ~ (B) Program control jumps to the location pointed to by the register encoded in the B field. The pc is written with the 16-bit value of the register. The following branch destinations are specified in the B field: BField Action 000 return (same as goto pr) 001 ireturn (same as goto pi) 010 goto pt 011 call pt* lxx Reserved * For this instruction, note that the current pc is also saved in the pr register before the jump. Bit 15 11 10 8 7 o Field o 0 o B o 0 0 0 0 000 Words: Cycles: 2 Group: Control Addressing: Register Flags affected: None Interruptible: No Cacheable: No Format: 5 3-21 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary if CON (conditional branch qualifier) go to/call/return test CONdition; if true, execute the following control statement The condition CON is tested (encoded in the CON field). If the condition is true, the next instruction (which must be a control instruction) is executed. If false, the control instruction is not executed. The CON field is encoded as: CON Flag CON Flag 00000 mi (negative result) 01001 tails (random bit c1ear)t 00001 pI (positive result) 01010 cOge (counterO ~ 0)* 00010 eq (result = 0) 01011 cOlt (counterO < 0)* 00011 ne (result ~ 0) 01100 c1ge (counter! ~ 0)* 00100 Ivs (logical overflow set) 01101 cllt (counter! < 0)* 00101 Ivc (logical overflow clear) 01110 true (always) 00110 mvs (math. overflow set) 01111 false (never) 00111 mvc (math. overflow clear) 10000 gt (result> 0) 01000 heads (random bit set)t 10001 Ie (result s 0) * Using the cOge or cOlt conditions also causes the value of the cO counter to be postincremented. Using the clge or cUt conditions also causes the value of the cl counter to be postincremented. t The random bit is updated after each test of heads or tails. The ensuing control opcode can be any of the following: goto JA goto pt call JA call pt return (goto pr) Note that ireturn and icall are the only control instructions that cannot be conditionally executed. Bit 15 5 4 0 word 1 1 1 0 1 0 0 0 0 0 0 0 CON Field word 2 CONTROL OPCODE Words: Cycles: 3 (including the branch!calVretum) Group: Control Addressing: None Flags affected: None Interruptible: No Cacheable: No Format: 6 3-22 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary call JA (call subroutine direct) (pr) f- (pc + 1) (pc) f- (pc bits 15-12)(JA) The subroutine at address JA (within the same 4 Kword page) is called. First the return address (the address of the first instruction following the call) is placed into the pr register. Then the lower 12 bits of the pc are written with the 12-bit immediate value of JA. The upper 4 bits ofpc remain unchanged (the call pt instruction is used for calling subroutines out of the current 4 Kword page). Bit 15 12 11 o Field o o o JA Words: 1 Cycles: 2 Group: Control Addressing: Immediate Flags affected: None Interruptible: No Cacheable: No Format: 4 3-23 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary icall (software interrupt) (Pi) ~ (pc + 1) (PC) ~ 2 lACK The interrupt handler is called, just as it would be by an external interrupt. The interrupt return register is set to next pc + 1, and the pc is set to 2, to start execution at the interrupt handler. Note that external interrupts vector to location 1, and icall vectors to location 2. The interrupt acknowledge pin (lACK) is set just as it would be by an external interrupt. Bit 15 o Field 1 0 o o 0 000 0 1 1 o Words: 1 Cycles: 3 Group: Control Addressing: None Flags affected: None Interruptible: No Cacheable: No Fonnat: 6 3-24 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary doK{ instrl (loop in cache; cache loaded with new contents) . instrNI } execute the next NI instructions K times The next NI instructions are loaded into the cache concurrent with their execution. They are then executed within the cache K-l more times, at (potentially) higher speed. The iteration count K can be between 2 and 127, inclusive, and the number of instructions NI must be between 1 and 15, inclusive. Notes on cache performance: The do instruction executes in one cycle. When the cache is used to repeat a block of NI instructions, the cycle timings of the instructions are as follows: 1. The "first pass" does not affect cycle timings except for the last instruction in the block of NI instructions. This instruction executes in two cycles. 2. During pass 2 through pass K +1, each instruction is executed "in the cache" (see Table 3-3). 3. During the last (Kth) pass, the block of instructions executes "inside the cache" except for the last instruction, which executes outside the cache. The instructions remain in the cache memory and may be re-executed using the redo command without the need to reload the cache. Bit 15 11 10 7 6 0 Field 0 1 1 0 NI K Words: 1 Cycles: 1 Group: Cache Addressing: Immediate Flags affected: None Interruptible: No Cacheable: No Format: 10 3-25 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary redoK (loop in cache; cache contents unaffected) execute the current contents of the cache K times The current contents of the cache (loaded with a previous do instruction) are executed within the cache K additional times. The iteration count K can be between 2 and 127, inclusive. Notes on cache performance: The redo instruction executes in two cycles. All instructions require the in-cache time to execute, except the last instruction of the last iteration, which requires the out-of-cache time to execute. Thereafter, instructions (fetched from ROM) require their normal out- of-cache time to execute. Bit 15 11 10 7 6 o Field o 1 1 1 o o 000 K Words: 1 Cycles: 2 Group: Cache Addressing: Immediate Flags affected: None Interruptible: No Cacheable: No Format: 10 3-26 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary (short immediate load) (R)~ (M) The contents of register R are replaced with the 9-bit immediate value of M. The value of R can be any of the following: Re ister R Re ister R j ()()() rt) 100 k 001 rl 101 rb 010 r2 110 re 011 r3 111 For the DSPI6, these registers are all 9 bits wide. For the DSPI6A, these registers are 16 bits wide and the j and k registers are sign-extended (2's complement). The others are zero-extended. Bit 15 12 11 9 8 0 Field 0 0 0 R I M Words: Cycles: Group: Data Move Addressing: Immediate Flags affected: None Interruptible: Yes Cacheable: Yes Format: 9 Notes: 1) In Appendix A, this instruction is encoded using a 2-bit I field that corresponds to the two LSBs of the R field shown above. The most significant bit of R is the least significant bit of the T field used in the instruction set encodings in Appendix A. 2) When a DSP16A program is encoded, if the immediate value M is greater than 9 bits or if a label is used for M, the assembler defaults to a two-word, two-cycle data move encoding. The short immediate encoding can be forced by using the optional mnemonic set (if the value of M is greater than 9 bits, it is truncated to 9 bits). For example: set r3 =varl forces a short immediate encoding. 3-27 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary R=N (16-bit immediate load) (R) f- (N) The contents of register R are replaced with the 16-bit immediate value of N. The value of R can be any of the following: Re ister R Field Re ister RField rO (u) 00000o yl 010010 r1 (u) 000001 auc (u) 010011 r2 (u) 000010 psw 010100 r3 (u) 000011 cO (s) 010101 j(s) 000100 c1 (s) 010110 k (s) 000101 c2 (s) 010111 rb (u) 000110 sioc 011000 re (u) 000111 srta 011001 pt 001000 sdx 011010 pr 001001 tdms 011011 pi 001010 pioc 011100 i (s) 001011 pdxO 011101 x 010000 pdx1 011110 y 010001 Register sources j, k, i, cO, c1, and c2 are less than 16 bits and are sign-extended (s). Register sources rO, r1, r2, r3, rb, re, and auc are less than 16 bits and are zero-extended (u). For the DSP16A, registers rO, r1, r2, r3,j, k, rb, and re are 16 bits wide and need no sign- or zero-extension. Note: writing the psw also writes the aO and a1 guard bits. Bit 15 10 9 4 3 0 word 1 0 1 0 1 0 0 R 0 0 0 0 Field word 2 Immediate Value (N) Words: 2 Cycles: 2 Group: Data Move Addressing: Immediate Flags affected: None Interruptible: Yes Cacheable: No Format: 8 3-28 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary R=aS (load register from accumulator) (R) ~ (as) The contents of register R are replaced with the current contents of bits 31-16 of accumulator as. Registers which are less than 16 bits load from the low-order bits of as[31-16]. The value of S can be 0 to select accumulator aO or 1 to select accumulator al. See Appendix A for the possible values ofR. Note: Writing the psw also writes the the aO and al guard bits. Bit 15 10 11 4 3 o Field o 1 0 S 1 o R o 0 0 0 Words: 1 Cycles: 2 Group: Data Move Addressing: Register Flags affected: None Interruptible: Yes Cacheable: Yes Format: 7 3-29 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary aT=R Ooad accumulator from register) (aT) +- (R) The contents of bits 31-16 of accumulator aT are replaced with the current contents of register R, zero- or sign-extended to 16 bits (if necessary). If clearing aT! is enabled (with the CLR field of the auc register), bits 15-0 of accumulator aT will be cleared. Bits 35-32 (the guard bits) will be loaded with copies of bit 31. The value of liT can be 0 to select aI, or 1 to select aO. (aT is encoded as liT in the instruction encodings in Appendix A.) The value ofR can be any of the following: Re 'ster RField Re ister RField rO (u) 00000o yl 010010 rl (u) 000001 auc (u) 010011 12 (u) 000010 psw 010100 r3 (u) 000011 cO (s) 010101 j(s) 000100 cl (s) 010110 k (s) 000101 c2 (s) 010111 rh (u) 000110 sioc 011000 re (u) 000111 srta 011001 pt 001000 sdx 011010 pr 001001 tdms 011011 pi 001010 pioc 011100 i (s) 001011 pdxO 011101 x 010000 pdxl 011110 Y 010001 Register sources j, k, i, cO, cl, and c2 are less than 16 bits and are sign-extended (s). Register sources rO, rl, 12, r3, rh, re, and auc are less than 16 bits and are zero-extended (u). For the DSP16A, registers rO, rl, 12, r3,j, k, rh, and re are 16 bits wide and need no sign- or zero-extension. 3-30 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Bit 15 4 3 0 Field o o 0 R 000 0 Words: 1 Cycles: 2 Group: Data Move Addressing: Register Flags affected: None Interruptible: Yes Cacheable: Yes Fonnat: 7a Note: If Y is used as the register R, the assembler forces a special function encoding. The resulting instruction moves all 32 bits (sign extended to 36 bits) of y into aT. All DAU flags are affected, and the execution requires only one cycle. If a two-cycle data move is desired, the optional mnemonic move may be used. Only the upper 16 bits ofy are transferred and no flags are affected. Example: moveaO=y 3-31 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary R=Y (load register from internal RAM) perform (R) f- (*rN); then modify rN The contents of register R are replaced with the current contents of the internal RAM location pointed to by rN, where rN is specified by the two most significant bits of the Y field. 00 - rl) 01 - rl 1O-r2 11 - r3 The value of rN is then postmodified, where the postmodification is specified by the two least significant bits of the Y field. 2 LSBs ofY Action Symbol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by (j) *rN++j Code 11, in this case, means add the current value of the j register to rN (after accessing *rN). See Appendix A for the possible values of destination register R. Registers which are less than 16 bits load from the low-order bits of the memory location. Note: writing the psw also writes the aO and al guard bits. Bit 15 4 3 o Field o 1 1 R Y Words: 1 Cycles: 2 Group: Data Move Addressing: Register, Register Indirect Flags affected: None Interruptible: Yes Cacheable: Yes FOimat: 7 Note: If y, yl, or x is the destination register, R, the assembler assembles this instruction as a single-cycle muItiply/ALU instruction. If a two-cycle move encoding is necessary, the optional mnemonic move may be used. For example: movey = *rl forces a move encoding. 3-32 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary (store register to RAM memory) (*rN) f- (R); then modify rN The contents of the RAM memory location pointed to by rN are replaced with the current contents of register R, zero- or sign-extended to 16 bits (if necessary). rN is specified the two most significant bits of the Y field: 00 - rl) 01 - rl 1O-r2 11-r3 The value of rN is then postmodified, where the postmodification is specified by the two least significant bits of the Y field. 2 LSBs ofY Action S mbol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by (j) *rN++j Code 11, in this case, means add the current value of the j register to rN (after accessing *rN). See Appendix A for possible values of R. Register sources j, k, i, cO, c1, and c2 are less than 16 bits and are sign-extended. Register sources rl), r1, r2, r3, rb, re, and auc are less than 16 bits and are zero-extended. For the DSP16A, registers rl), r1, r2, r3, j, k, rb, and re are 16 bits and need no sign- or zero-extending. Bit 15 4 3 o Field o o R Y Words: 1 Cycles: 2 Group: Data Move Addressing: Register, Register Indirect Flags affected: None Interruptible: Yes Cacheable: Yes Format: 7 3-33 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary Z:R (exchange register with RAM memory) temp ~ (R); then (R) ~ (*rN); then modify rN (first action); then (*rN) ~ temp; then modify rN (second action) The contents of the RAM memory location(s) pointed to by rN are exchanged with the current contents of register R, which is sign- or zero-extended to 16 bits (if necessary). The pointer rN is modified after each of the two memory accesses according to the M field. rN is specified by the two most significant bits of the Z field: oo-rO 01- rl 1O-r2 11-r3 The available options for the postmodification are specified by the two least significant bits of the Z field as follows: 2 LSBs S hot ofZ First Action Second Action *rNzp 00 no action postincrement *rNpz 01 postincrement no action *rNm2 10 postdecrement postincrement by 2 *rNjk 11 postincrement by G) postincrement by (k) Code II, in this case, means add the current value of the j register to rN after reading *rN, then add the current value of the k registerto rN after writing *rN. 3-34 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary See Appendix A for possible values of R. Register sources j, k, i, cO, cl, and c2 are less than 16 bits and are sign-extended. Register sources rO, rl, r2, r3, rb, re, and auc are less than 16 bits and are zero-extended. For the DSPI6A, registers rO, rl, r2, r3, j, k, rb, and re are 16 bits and need no sign- or zero-extension. Note: writing the psw also writes the aO and al guard bits. Bit 15 4 3 o Field 0 1 0 R z Words: 1 Cycles: 2 Group: Data Move Addressing: Register, Register Indirect Flags affected: None Interruptible: Yes Cacheable: Yes Fonnat: 7 Note: R and rM must not be the same register (Le., r2pz:r2). The two logical PIO registers,pdxO and pdxl, cannot be used in compound data moves. 3-35 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary ifCONF2 (If CONdition is true, then perfonn special function instruction) test CONdition; if true, then perfonn F2 The specified condition is tested. If it is true, the special function operation F2 is perfonned. See Appendix A for the conditions that can be tested (encoded in the CON field). The F2 functions (special function group) that can be conditionally perfonned (encoded in the F2 field) are as follows: F2 o eration 0000 aD= as» 1 0001 aD=aS« 1 0010 aD= as»4 0011 aD= as«4 0100 aD= as» 8 0101 aD= as« 8 0110 aD= as» 16 0111 aD= as« 16 1000 aD=p 1001 aDh= aSh + 1 1010 ReselVed 1011 aD= md(aS) 1100 aD=y 1101 aD=aS+1 1110 aD=aS 1111 aD=-aS Bit 15 5 4 o Field 0 0 F2 CON Words: 1 Cycles: 1 Group: Special Function Addressing: Register Flags affected: All Interruptible: Yes Cacheable: Yes Fonnat: 3 3-36 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary ifcCONF2 (if CONdition is true, then perfonn special function instruction) (modify counter1,2 accordingly) counter c1 = c1 + 1; test CONdition; if true then {perfonn F2; c2 = c1} First, counter c1 is incremented. Next, the specified condition is tested. If the condition is true, the special function operation F2 is perfonned and counter c2 is set to the value of cl. The conditions that can be tested are encoded in the CON field (see Appendix A). The possible F2 special functions that can be conditionally perfonned are: F2 0 eration 0000 aD =as » 1 0001 aD = as « 1 0010 aD = as » 4 0011 aD = as « 4 0100 aD=aS»8 0101 aD =as « 8 0110 aD = as» 16 0111 aD = as« 16 1000 aD=p 1001 aDh = aSh + 1 1010 Reserved 1011 aD = md(aS) 1100 aD=y 1101 aD = as + 1 1110 aD= as 1111 aD=-aS The D and S fields are used to specify aD and as. Bit 15 5 4 o Field 1 0 0 1 F2 CON Words: 1 Cycles: 1 Group: Special Function Addressing: Register Flags affected: All Interruptible: Yes Cacheable: Yes Fonnat: 3 3·37 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl Y (multiply/ALU operation with postmodification of pointer register) perform operation Fl; then access *rN; then postmodify rN (the contents of *rN are not written to a destination) This instruction performs the following three operations (effectively in sequence): 1. The operation Fl is performed. The possible Fl operations are: Fl 0 eration 0000 aD=p p=x*y 0001 aD = as + p p = x*y 0010 p=x*y 0011 aD=aS-p p=x*y 0100 aD=p 0101 aD = as + p 0110 NOP 0111 aD=aS-p 1000 aD =as I y 1001 aD=aSAy 1010 as &y 1011 as-y 1100 aD=y 1101 aD= as + y 1110 aD=aS&y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select al. The value of D can be 0 to select aO or 1 to select al. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 3-38 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 2. Access the internal RAM location pointed to by rN, where rN is specified by the two most significant bits of the Y field as follows (the accessed location is not written to a destination): oo-rO 01- rl 1O-r2 ll-r3 3. Postmodify the value of rN, where the postmodification is specified by the two least significant bits of the Y field. 2 LSBs ory Action S bol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by G) *rN++j Code 11, in this case, means add the current value of the j register to rN (after accessing *rN). Bit 15 o Field 0 0 1 1 Fl Y Words: 1 Cycles: 1 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: 1 3-39 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl Y = aO[l] (multiply/ALU operation with parallel accumulator store) Fl Y = al[1] write the value of aT[l] to *rN; then modify rN; then perfonn operation FI This instruction perfonns the following three operations (effectively in sequence): 1. Write the (old) value of aO, ai, aOl, or all to the internal RAM location pointed to by rN, where rN is specified by the two most significant bits of the Y field. 00-1'0 01 - rl 1O-r2 11-r3 The X field selects y or yl: X=O ~ yl X=I ~ Y 2. Postmodify the value ofrN, where the postmodification is specified by the two least significant bits of the Y field. 2 LSBs ofY Action Symbol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by (j) *rN++j Code II in this case means add the current value of the j register to rN (after accessing *rN). 3-40 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 3. The operation F1 is perfonned. The possible operations for F1 are: F1 0 eration 0000 aD = p p = x*y 0001 aD = as + p p = x*y 0010 P = x*y 0011 aD=aS-p p=x*y 0100 aD=p 0101 aD = as + p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD = as 1\ y 1010 as & y 1011 as-y 1100 aD=y 1101 aD= as + y IllO aD = as & y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select al. The value of D can be 0 to select aO or 1 to select al. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before perfonning the operation (this includes logical operations). Bit 15 11 10 9 8 5 4 3 0 aO 1 1 1 0 0 D S F1 X Y Field a1 0 0 1 0 0 D S F1 X Y Words: 1 Cycles: 2 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Fonnat: I 3-41 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl X=Y (multiply/ALU operation with parallel load of x register) perform operation F1; then copy *rN to x; then modify rN This instruction performs the following three operations (effectively in sequence): 1. The multiply/ALU operation F1 is performed. The possible operations for F1 are as follows: F1 o eration 0000 aD=p p=x*y 0001 aD=aS+p p=x*y 0010 p=x*y 0011 aD=aS-p p=x*y 0100 aD=p 0101 aD=aS+p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD=aSAy 1010 as &y 1011 as-y 1100 aD=y 1101 aD=aS+y 1110 aD=aS&y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select al. The value of D can be 0 to select aO or 1 to select al. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 3-42 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary 2. Access the internal RAM location pointed to by rN, and write this value into the x register. rN is specified by the most significant bits of the Y field: OO-rlJ 01 - rl 1O-r2 11- r3 3. Postmodify the value of rN, where the postmodification is specified by the two least significant bits of the Y field. 2 LSBs ofY Action S bol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by G) *rN++j Code II, in this case, means add the current value of the j register to rN (after accessing *rN). ~I I I Bit 15 10 9 8 5 4 3 0 Field 1 0 1 D S Fl II 0 Y Words: 1 Cycles: 1 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: 1 3-43 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl y[l] =Y (multiply/ALU operation with parallel load of y register) perform operation Fl; then copy *rN to y (or yl); then modify rN This instruction performs the following three operations (effectively in sequence): 1. The multiply/ALU operation Fl is performed. The possible Fl operations are as follows: F1 0 eration 0000 aD = p p = x*y 0001 aD = as + p p = x*y 0010 P =x*y 0011 aD = as - p p = x*y 0100 aD=p 0101 aD = as + p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD= as I\y 1010 as & y 1011 as-y 1100 aD=y 1101 aD=aS+y 1110 aD=aS&y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select al. The value of D can be 0 to select aO or 1 to select a1. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 3-44 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 2. Access the internal RAM location pointed to by rN, and write this value into the y (oryl) register. rN is specified by the two most significant bits of the Y field: 00- IO 01 - rl to-r2 11-r3 The X field selects y or yl: X= 0 --+ yl X=1 --+ Y 3. Postmodify the value ofrN, where the postmodification is specified by the two least significant bits of the Y field: 2 LSBs ofY Action Symbol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by G) *rN++j Code 11, in this case, means add the current value of the j register to rN (after accessing *rN). Bit 15 o Field 1 0 1 1 F1 Y Words: 1 Cycles: 1 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: 1 3-45 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary Fl y=Y x =*pt++[i] (multiply/ALU operation with parallel load of x and y registers) perfonn operation FI; then (y) ~ (*rN); then modify rN; then (x) ~ (*pt); then (pt)= (pt)+ [1 or i] This instruction perfonns the following operations (effectively in sequence): 1. The operation F1 is perfonned. The possible operations for F1 are: F1 0 eration 0000 aD=p p=x*y 0001 aD=aS+p p=x*y 0010 p=x*y 0011 aD=aS-p p=x*y 0100 aD=p 0101 aD = as + p 0110 NOP 0111 aD=aS-p 1000 aD= as I y 1001 aD= as I\y 1010 as &y 1011 as-y 1100 aD=y 1101 aD=aS+y 1110 aD= as & y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select a1. The value ofD can be 0 to select aO or 1 to select a1. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before perfonning the operation (this includes logical operations). 3-46 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 2. Access the internal RAM location pointed to by rN, and write this value into the y register. rN is specified by the two most significant bits of the Y field: OO-rll 01 - rl 1O-r2 11 - r3 3. Postmodify the value of rN, where the postmodification is specified by the two least significant bits of the Y field: 2 LSBs ofY Action S bol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by (j) *rN++j Code 11, in this case, means add the current value of the j register to rN (after accessing *rN). 4. Access the ROM location pointed to by pt, and write this value into the x register. Either internal or external ROM may be accessed, depending on the state of the EXM pin (and the address, in the case of the DSPI6A). 5. Postmodify the value of the pt register by either lori, selected by the X field: X=o ~ *pt++ X= 1 ~ *pt++i Bit 15 10 9 8 5 4 3 0 111 ID iX Field I IS I FI I Y Words: Cycles: 2 (1 cycle if in cache) Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: 1 3-47 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl y = aO x = *pt++[i] (multiply/ALU operation with parallel load of Fl y =al X = *pt++[i] x and y registers) perform operation F1; then (y) f- (aO) or (a1); then (x) f- (*pt); then (pt)= (pt)+ [lor i] This instruction performs the following operations (effectively in sequence): 1. The operation F1 is performed. The possible operations for F1 are: Fl 0 eration 0000 aD = p p = x*y 0001 aD=aS+p p=x*Y 0010 p= x*y 0011 aD = as - p p = x*y 0100 aD=p 0101 aD=aS+p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD = as 1\ y 1010 as & y 1011 as-y 1100 aD= y 1101 aD = as + y 1110 aD=aS&y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select a 1. The value of D can be 0 to select aO or 1 to select a1. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 3-48 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 2. Copy the value in aO or al to the y register. Note that the value copied from aO or al is the value before executing the FI operation, due to pipelining. 3. Access the ROM location pointed to by pt, and write this value into the x register. Either internal or external ROM may be accessed, depending on the state of the EXM pin (and the address, for the DSPI6A). 4. Postmodify the value of the pt register by either I or i, selected by the X field: X= 0 ~ *pt++ X= 1 ~ *pt++i Bit 15 11 10 9 8 5 4 3 0 aO 1 1 0 0 1 D S Fl X 0 0 0 0 Field al 1 1 0 1 I D S FI X 0 0 0 0 Words: Cycles: 2 (1 cycle if in cache) Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Fonnat: 1 3-49 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl aT[l] = Y (multiply/ALU operation with parallel load of accumulator register) perform operation F1; then copy *rN to aT (or aTl); then modify rN by M This instruction performs the following three operations (effectively in sequence): 1. The operation F1 is performed. The possible operations for F1 are: Fl o eration 0000 aD=p p=x*y 0001 aD=aS+p p=x*y 0010 p=x*y 0011 aD=aS-p p=x*y 0100 aD=p 0101 aD=aS+p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD=aSAy 1010 as&y 1011 as-y 1100 aD=y 1101 aD=aS+y 1110 aD= as & y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select a1. The value of aT can be 0 to select a1 or 1 to select aO. Since aD and aT must be different accumulators, aD will be the opposite of aT. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 3-50 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 2. Access the internal RAM location pointed to by rN, and write this value to the aT (or aTl) register. aT is defined as the opposite of D for this instruction. Therefore, if the FI field selects writing to aD, aD will be the opposite of aT. rN is specified by the two most significant bits of the Y field: oo-rO 01 - rl 1O-r2 11 - r3 The X field selects y or yl: X=o ~ yl 3. Postmodify the value of rN, where the postmodification is specified the two least significant bits of the Y field: 2 LSBs ofY Action S mbol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by (j) *rN++j Code 11, in this case, means add the current value of the j register to rN (after accessing *rN). Bit 15 10 9 8 5 4 3 0 111 I Field 1 0 1 aT IS I Fl I I X Y Words: 1 Cycles: 1 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: la 3-51 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl Y = y[l] (multiply/ALU operation with parallel store of y register) perform operation Fl; (*rN) ~ (y) or (yl); then modify rN This instruction performs the following operations (effectively in sequence): 1. The operation Fl is performed. The possible operations for Fl are: F1 o eration 0000 aD=p p=x*y 0001 aD=aS+p p=x*y 0010 p=x*y 0011 aD=aS-p p=x*y 0100 aD=p 0101 aD=aS+p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD=aSl\y 1010 as&y 1011 as-y llOO aD=y 1101 aD=aS+y 1110 aD=aS&y llli aD=aS-y The value of S can be 0 to select aD or I to select al. The value of D can be 0 to select aO or 1 to select al. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 3-52 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 2. Write the value of y or yl to the internal RAM location pointed to by rN, where N is specified by the two most significant bits of the Y field: oo-rO 01 - rl 1O-r2 11 - r3 The X field selects y or yl: X = 0 --7 yl 3. Postmodify the value of rN, where the postmodification is specified by the two least significant bits of the Y field: 2 LSBs ofY Action Symbol 00 no action *rN 01 postincrement *rN++ 10 postdecrement *rN-- 11 postincrement by (j) *rN++j Code II, in this case, means add the current value of the j register to rN (after accessing *rN). ~I I I Bit 15 10 9 8 5 4 3 0 Field 0 1 0 D S Fl II X Y Words: 1 Cycles: 2 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Fonnat: 1 3-53 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary Fl Z: y[l] (multiply/ALU operation with compound data move) perfonn operation F1; then temp ~ (y) or (yl); then (y) or (yl) ~ (*rN); then modify rN (first action); then (*rN) ~ temp; then modify rN (second action) This instruction perfonns the following operations (effectively in sequence): 1. The operation F1 is perfonned. The possible F1 operations are: F1 o eration 0000 aD=p p=x*y 0001 aD=aS+p p=x*y 00 to p=x*y 0011 aD=aS-p p=x*y 0100 aD=p 0101 aD=aS+p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD=aS"y 10 to as&y 1011 as-y 1100 aD=y 1101 aD=aS+y 1110 aD= as & y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select a1. The value of D can be 0 to select aO or 1 to select a1. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register. y is sign-extended to 36 bits before perfonning the operation (this includes logical operations). 3-54 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 2. Save either the y or yl register into an internal temporary location (temp). The X field select y or yl: X= 0 -7 yl 3. Access the internal RAM location pointed to by rN, and write this value into the y (or yl) register. rN is specified by the 2 most significant bits of the Z field: oo-rO 01 - rl 1O-r2 11 - r3 4. Postmodify the value of rN by the first action described by the two least significant bits of the Z field (described below). 5. Write the value saved in the temporary register (temp) to the memory location now pointed to by rN. 6. Postmodify the value of rN by the second action described by the two least significant bits of the Z field. The available options for the postmodification are specified as follows: 2 LSBs Symbol ofZ First Action Second Action *rNzp 00 no action postincrement *rNpz 01 postincrement no action *rNm2 10 postdecrement postincrement by 2 *rNjk 11 postincrement by G) postincrement by (k) Code 11, in this case, means add the current value of the j (or) k register to rN (after accessing *rN). ~1 I I I Bit 15 10 9 8 5 4 3 0 Field 0 0 D S Fl IX I Z Words: 1 Cycles: 2 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: 2 3-55 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary Fl Z: aT[l] (multiply/ALU operation with parallel compound accumlator move) perform operation F1; then temp +- (aT) or (aTl); then (aT) or (aTl) +- (*rN); then modify rN (first action); (*rN) +- temp; modify rN (second action) This instruction performs the following operations (effectively in sequence): 1. The operation F1 is performed. The possible operations for F1 are: Fl Operation 0000 aD=p p=x*y 0001 aD = as + p p = x*y 0010 p=x*y 0011 aD = as - p p = x*y 0100 aD=p 0101 aD = as + p 0110 NOP 0111 aD=aS-p 1000 aD=aSly 1001 aD = as" y 1010 as & y 1011 as-y 1100 aD=y 1101 aD = as + y 1110 aD = as & y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select al. The value of aT can be 0 to select a1 or 1 to select aO. Since aD and aT must be different accumulators, aD will be the opposite of aT. Flags are modified based on the value computed by the ALU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 2. Save either the aT or aTl register into an internal temporary location (temp). aT is defined as the opposite of D for this instruction. Therefore, if the F1 field selects writing to aD, aD will be the opposite of aT since the aT field must read/write aT, and vice versa. Note that if as in the F1 operation is the same as aT, the value used in the Fl operation will be the old value, due to pipelining. The X field selects aT or aTl: X=O ~ aTl X= 1 ~ aT 3-56 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 3. Access the internal RAM location pointed to by rN, and write this value to the aT (or aTl) register. rN is specified by the two most significant bits of the Z field: OO-rl> 01 - r1 1O-r2 11 - r3 4. Postmodify the value of rN by the first action described by the two least significant bits of the Z field (described below). 5. Write the value saved in the temporary register (temp) to the memory location now pointed to by rN. 6. Postmodify the value of rN by the second action described by the two least significant bits of the Z field. The available options for the postmodification are specified as follows: 2 LSBs S mbol ofZ First Action Second Action *rNzp 00 no action postincrement *rNpz 01 postincrement no action *rNm2 10 postdecrement postincrement by 2 *rNjk 11 postincrement by (j) postincrement by (k) Code 11, in this case, means add the current value of the j (or) k register to rN (after accessing *rN). Bit 15 10 9 8 5 4 3 0 111 I aT Field 0 0 1 0 IS I F1 IX I Z Words: 1 Cycles: 2 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: 2a 3-57 DSP16IDSP16A INSTRUCTION SET Instruction Set Summary Fl Z: y x = *pt++[i] (multiply/ALU operation with compound data move and parallel load of x register) perform operation Fl; then temp ~ (y); then (y) ~ (*rN); then modify rN (first action); then (*rN) ~ temp; then modify rN (second action); then (x) ~ (*pt); then (pt)= (pt)+ [lor iJ This instruction performs the following operations (effectively in sequence): 1. The operation Fl is performed. The possible operations for Fl are: Fl 0 eration 0000 aD = p p = x*y 0001 aD = as + p p = x*y 0010 p= x*y 0011 aD = as - p p = x*y 0100 aD=p 0101 aD = as + p 0110 NOP 0111 aD=aS-p 1000 aD = as I y 1001 aD = as 1\ y 1010 as & y 1011 as - y 1100 aD= y 1101 aD = as + y 1110 aD=aS&y 1111 aD=aS-y The value of S can be 0 to select aO or 1 to select al. The value ofD can be 0 to select aO or 1 to select al. Flags are modified based on the value computed by the DAU. Note: for all diadic operations involving the y register, y is sign-extended to 36 bits before performing the operation (this includes logical operations). 2. Save the y register into an internal temporary location (temp). 3. Access the internal RAM location pointed to by rN, and write this value into the y register. rN is specified by the two most significant bits of the Z field: oo-rO 01 - rl 1O-r2 11 - r3 3-58 DSP16/DSP16A INSTRUCTION SET Instruction Set Summary 4. Postmodify the value of rN by the first action described by the two least significant bits of the Z field (described below). 5. Write the value saved in the temporary register (temp) to the memory location now pointed to by rN. 6. Postmodify the value of rN by the second action described by the two least significant bits of the Z field. The available options for the postmodification are specified as follows: 2 LSBs S mbol ofZ First Action Second Action *rNzp 00 no action postincrement *rNpz 01 postincrement no action *rNm2 10 postdecrement postincrement by 2 *rNjk 11 postincrement by (j) postincrement by (k) Code 11, in this case, means add the current value of the j (or) k register to rN (after accessing *rN). 7. Access the ROM location pointed to by pt, and write this value into the x register. Either internal or external ROM may be accessed, depending on the state of the EXM pin (and the address, for the DSPI6A). 8. Postmodify the value of the pt register by either I or i, selected by the X field: X=o ~ *pt++ X= 1 ~ *pt++i Bit 15 10 9 8 5 4 3 0 1: I Field 1 0 D IS I FI IX I Z Words: I Cycles: 2 Group: Multiply/ALU Addressing: Register Indirect, Register Flags affected: All Interruptible: Yes Cacheable: Yes Format: 2 3-59 3-60 DSP16/DSP16A DEVICE PROGRAMMING Comments 4. DSP16/DSP16A DEVICE PROGRAMMING This chapter discusses various aspects of programming the DSP16 and DSP16A devices. Many of the topics are illustrated in the complete sample programs presented in Appendix B. Techniques for programming the serial and parallel I/O sections of the device may be found in Chapters 5 and 6, respectively. Chapter 3 described the instruction set specific to the DSP16/DSP16A device. Programming examples in this manual follow the assembler syntax of the WE DSP16/DSP16A Support Software Library for DSP16/DSP16A source files. An overview of the DSP16/DSP16A assembly language is provided in the following section. 4.1 DSP16/DSP16A ASSEMBLY-LANGUAGE NOTATION A DSP16/DSPI6A source file exists as a text file and contains DSP16/DSP16A instructions, directives to allow the assembler to interpret the instructions and data, and comments to clarify the use of the program. The syntax of the assembler directives is described in this chapter; also described are conventions and nomenclature used throughout the remainder of this manual. Appropriate formats for DSP16/DSP16A source files are also discussed. 4.1.1 Integer Notation Decimal, hexadecimal, or octal expressions may be freely mixed when specifying numerical data in a source file. The syntax is identical to C-Ianguage programming. • Decimal. Any string of normal digits (0-9) is interpreted as a decimal number, provided it does not have a leading zero. • Hexadecimal. A numerical string beginning with Ox is interpreted as a hexadecimal number and may contain the digits 0-9, a-f, or A-F. For example, OxO is the same as O. OxOlO is the same as Ox 10, which is the decimal number 16. And OxFF or Oxff is the decimal number 127. • Octal. A numerical string beginning with the digit zero is interpreted as an octal number and may contain the digits 0-7. For example, 07 is the decimal number 7 and 010 is the decimal number 8. • Fixed-Point. Numbers with a decimal point are interpreted as binary fixed-point numbers by the DSP16/DSP16A assembler. The number of binary digits to the right of the decimal point is 14 by default, but may be changed (see the We® DSP16 and DSP 16A Support Software Library User Manua{). 4.1.2 Comments Comments may be placed in the source file to enhance readability and to provide information for other users. A comment may be placed on a line by itself or may appear at the end of a line containing an instruction. The following lines are examples of valid comments: 4-1 DSPI6/DSPI6A DEVICE PROGRAMMING Labels /* This is a valid comment */ instruction instruction /* this is a valid comment */ 4.1.3 Labels Labels in a source file serve two purposes: to give a descriptive name to a particular location and to provide a destination for a branch instruction. Labels may consist of upper- and/or lower-case alphanumeric characters and the underscore, although the first character may not be numeric. A label must be terminated with a colon. Labels may be as long as necessary to be descriptive; however, only the first eight characters are significant. The following lines show examples of valid labels: start 1: instruction /* "start 1" is a valid label */ instruction end: instruction /* "end" is a valid label */ 4.1.4 Data Stored in ROM Data may be stored in a ROM location by using the int directive. The following lines of source code are examples of how to store data in ROM: table: int OxFF /* Initialize one ROM location */ 2*int OxlO OxA2 /* Initialize four ROM locations */ 3*int 23 /* Initialize three ROM locations */ fixed: int 1.23 -1.634 /* Initialize two ROM locations */ tab end: int 3.72l!lO /* Initialize one ROM location */ As shown above, multiple ROM locations may be specified with a single statement. In the second example, two ROM locations are replicated to initialize four ROM locations; however, in the third example, all three locations are initialized to the same value. Following the labeljixed, two ROM locations are initialized in a fixed-point notation. By default, the DSPI6/DSP16A assembler assumes that fixed-point numbers are to be assembled with 14 bits of precision and 2 bits of magnitude. An environment variable, precision, may be changed to allow other values of precision. The last example demonstrates another method to specify the precision of a fixed-point format. The suffix !N (where N is the desired precision) can be used to force different precision encodings "on the fly." In this case, 3.721 is encoded with 6 magnitude bits and 10 precision bits. 4.1.5 RAM Variables RAM variables can be allocated similarly to data stored in ROM by surrounding the int directives with the .ram and .endram directives. Note that RAM locations are allocated without being initialized. The following sequence allocates six RAM variables: 4-2 DSPI6/DSPI6A DEVICE PROGRAMMING Instruction Set Ambiguities .ram datal: int 1* allocate 1 RAM variable *1 data2: 2*int 1* allocate 2 RAM variables *1 data4: 3*int 1* allocate 3 RAM variables *1 .endram 4.1.6 DSPI6/DSPI6A Source-File Format A DSP16/DSP16A source flle is prepared as a text flle by using a text editor with the UNIX Operating System or MS-DOS Operating System. (See Appendix B for complete DSP16/DSP16A program listings.) When creating a source file, the following conventions should be observed: • The source flle name must end with ".s". • Directives beginning with "." (such as.ram and .endram) must begin in the first column. • White space is used to separate the fields of instructions. Either a space or a tab character constitutes white space. Using tabs to separate and align the fields improves the readability of source flles. • Labels normally begin in the first column to enhance readability, but may be indented if desired. • It is customary, but not required, to place the title and a brief description of the program at the top of the flle for reference. 4.2 PROGRAMMING TECHNIQUES The following sections describe problems commonly encountered when programming the DSP16/DSP16A device and their possible solutions. In general, many of the problems encountered when programming other digital signal processors (such as latency and pipeline effects) have been eliminated by the design of the DSP16 and DSP16A devices. 4.2.1 Instruction Set Ambiguities Several instructions, which normally would be written identically, can be interpreted as various types of instructions. This interpretation of the instructions determines the number of ROM locations used to store the instruction, the number of instruction cycles used to execute the instruction, and whether or not the instruction affects the flags. Hence, the interpretation can be critical. For example, the instruction aO = y could be a multiply/ALU, special function, or data move instruction. When the instruction is interpreted as a multiply/ALU or special function instruction, the instruction requires one ROM location and executes in one instruction cycle. When the instruction is interpreted as a data move instruction, the instruction requires one ROM location and executes in two instruction cycles. The interpretation of the instruction is critical if conditional testing based on the results of the instruction execution is performed. The DSP16/DSP16A flags are affected by the multiply/ALU and special function instructions, but not by the data move instructions. 4-3 DSP16/DSP16A DEVICE PROGRAMMING Polling for I/O The WE DSPI6/DSPI6A Support Software Library provides optional mnemonics that may be used with an instruction to specify its type. Table 4-1 shows the mnemonics that can be used to specify the type of instruction. For example, the instruction au aO = y is interpreted as a multiply/ALU instruction. Table 4-1. Optional Mnemonics Use To Specify au Multiply/ALU instruction if true Special function instruction set Short immediate instruction move Data move instruction If an instruction may be encoded several ways, the assembler chooses the encoding based on the following priority: 1. Special function 2. Multiply/ALU 3. Short immediate 4. Data move 4.2.2 Polling for 110 When not using interrupt driven I/O, polling for input and output conditions is the simplest means of handling I/O timing. The following segment of code continuously polls the pioc register to determine if the condition IBF is true, meaning that there is data in the serial input register waiting to be processed. When data is loaded into the serial input buffer from an external device, program execution continues below the wait loop. y = Ox01O /* place mask into y register */ wait: aO = pioc /* cheek pioe register for IBF */ aO & y /* - look only at bit 4 */ i f eq goto wait ./* - i f no input, wait. */ *rO = sdx /* move data into RAM */ This same code fragment can be used to poll any I/O condition by changing the value in register y, which is used to mask the unwanted bits of the pioc register. For example, use Ox04 to check only the condition PIDS, which indicates that a parallel input was performed. 4-4 DSP16/DSP16A DEVICE PROGRAMMING Programming Tips 4.2.3 Modulo Addressing Modulo addressing is provided to allow efficient implementation of cyclical memory accesses. To use modulo addressing, the first RAM address of the modulo must be loaded into register rb and the last RAM address into reo The register being used as the memory pointer must be postincremented by +1. Each time the pointer is used, its value is compared with the contents of register re (before the postincrement is performed). If the two values are equal, the value of register rb is loaded into the register being used to address the RAM and the cycle repeats. It is important to note that whenever register re contains a value not equal to zero, modulo addressing is active. On reset, the value of re is zero. Whenever modulo addressing is not used, this register should contain zero and should not be used to store any number other than the address of the end of a modulo. 4.2.4 Random Number Generation The DAU includes a lO-state pseudorandom binary sequence (PRBS) generator, which is used to toggle a bit in the DAU. The status of this bit may be determined by testing for the "heads" or "tails" condition. The following segment of code generates a 16-bit random number in the high half of accumulator aD by randomly setting each of the 16 bits: do 16 if heads aOh = aOh + 1 /* if heads, set bit to 1 */ aO = aO « 1 /* shift left 1 position */ The pseudorandom sequence is incremented each time it is tested and may be reset by writing any value to the pi register (writing to the pi register does not affect its contents except when in an interrupt service routine). (See Section 4.2.5.) 4.2.5 Programming Tips The following section describes several practical programming tips that may not be obvious to a new user of the DSP16/DSP16A. 1) When loading count values into cO and c 1, the count value is 1 - count, where count is the desired number of times the loop is to be executed. An easy way to assemble the loop counter load is to let the assembler compute the 1 - count value. For example, if a loop is to be repeated 10 times, the following code could be used: cO = 1 - 10 loop: ... if cOlt goto loop The assembler correctly computes 1 - count, and the code is easier to read. 4-5 DSP16/DSP16A DEVICE PROGRAMMING Programming Tips 2) If extra 16-bit registers are needed, there are several possible ways to "create" them. a) Unot using interrupts or development system breakpoints, an icall instruction may be placed at location O. This causes a branch to location 2 (where program execution begins) and makes the DSP16/DSPI6A "think" that it is in an interrupt service routine (ISR). While in an ISR, the DSP16/DSP16A no longer updates the pi register each time the pc register changes, and the pi register may be written to (writes to pi do not affect its contents when not in an ISR, but writing the pi register resets the pseudorandom sequence generator). When in an ISR, the pi register is not used by the DSP16/DSP16A and is free for use as a general-purpose 16-bit register. b) While not in a subroutine, the pr register is available as a general-purpose 16-bit register. c) While not doing ROM table lookups, the pt register is available as a general-purpose 16-bit register. It can easily be incremented or modified using: {y = Y, Y = aT, Z : y} x = *pt++ /* load of y necessary when */ /* loading x from ROM */ or i = N /* or -N */ {y = Y, Y = aT, Z : y} x = *pt++i Note: The XAA U adder is only 12 bits wide, therefore, modifying as above is modulo 4K, i.e., pt 4095 {y Y, Y aT, Z y} x = *pt++ /* pt is now 0, */ /* not 4096 (2**12) */ However, aO = pt aOh = aOh + 1 pt = aO is no problem, except above 32767 unless saturation logic is disabled on aO (since a value above 32767 appears to be an overflowed 2's complement value). 3) While not using modulo addressing (re = 0), the rb register is available as a general-purpose register. The re register is not available since a non-zero value enables modulo addressing. Note that all YAAU register are 9 bits wide in the DSP16 and 16 bits wide in the DSP16A. 4) If a write of 0 to a RAM location is required, and modulo addressing is not being used, the re register can be used (re is zero by definition). *rN [++, --, ++j) = re clears the RAM location pointed to by rN with no setup required. 4-6 DSP16/DSP16A DEVICE PROGRAMMING Concurrent Interrupts 5) If adding and subtracting accumulators without using y is desired, the following instructions could be used to perfonn an add (assuming that only the high half of an accumulator is being used or the high half is a whole number and the low half is a fraction): aO = aO » 4 aOh = aOh + 1 aO aO« 4 /* adds 16 (2**4) to aO */ /* (similarly, « 8 adds 256) */ aO = -aO aOh = aOh + 1 aO = -aO /* subtracts 1 from aO */ Shifting left and adding can be used to add fractions. 6) The following two-cycle data move instructions can be coded as a single-cycle multiply!ALU instruction (when executing in the cache) by doing a dummy load to x. do 40 y = aN /* 2-cyc1e data move */ } This takes 81 machine cycles, while: do 40 y = aN x = *pt++ /* single-cycle when in cache */ } takes only 43 machine cycles (2 when it is loaded the first time and 2 the last time it is executed). In both cases, the do instruction requires 1 cycle. Note that this is a trivial example to make the cycle counts more obvious. This "trick" is most useful when the kernel of an operation is in the cache and a result needs to be multiplied by a coefficient or operated on by the ALU. 7) The above assumes that pt has already been set and that postincrementing pt does not affect anything. If this is not true (postincrementing pt is not desired), the following can be done: i = 0 do 40 y aN x = *pt++i /* postincrement by 0 */ } This does not alter the value of pt. 4.2.6 Concurrent Interrupts Consideration must be given to situations in which multiple interrupting conditions occur. The DSP16/DSP16A device does not allow nesting of interrupts; however, there are other ways to guarantee that all interrupts can be recognized and serviced. 4-7 DSP16IDSP16A DEVICE PROGRAMMING Concurrent Interrupts Case I If an internal and external interrupt request occur at nearly the same time and before the execution of the branch-to-one (start of interrupt service routine), the status field in the pioc register can be examined. In this case, the status will indicate that both interrupts are pending. They can be serviced accordingly. RULE: An interrupt occurring after an internal interrupt occurs and before lACK is asserted (in response to the internal interrupt) causes the !NT bit in the pioc register (bit 0) to be set, providing that !NT meets its assertion time requirements. The !NT signal is negated on the rising edge of lACK. ABC D I I PIDS ----I'(i ! lACK _ _ --+-'~r-----i---;-------.{) INT ______- J / !-l I I ~----------_+------~-------------- A. Branch-to-mle instruction executed. Beginning of interrupt service responding to negation of PIDS. B. pioc register has PIDS and INT status bits set. C. ireturn instruction executed. End of interrupt service routine. D. Next interruptible instruction. Figure 4-1. Case I - Internal Interrupt (PIDS) and INT Occur Before Assertion ofIACK 4-8 DSP16/DSP16A DEVICE PROGRAMMING Concurrent Interrupts Case 2 If !NT is asserted (high) when lACK is already asserted (i.e., when the DSP16 device is servicing another interrupt), then !NT must remain asserted until the next rising edge of lACK. This is because the internal interrupt request is cleared on the falling edge of lACK. This guarantees that the interrupt request (assertion of INT) will be serviced at the next interruptible instruction after the currently executing interrupt service routine has fmished. RULE: To guarantee recognition of !NT when it is asserted during an interrupt service routine (lACK high), !NT should not be negated until the next rising edge of lACK. providing that !NT assertion time is met. A B C D E F I I I PIDS~ I I I I I I I I I I I I lACK /: ~ /: I I I INT / ~ A. Branch-to-one instruction executed in response to internal interrupt (PIDS). B. pioc register has PIDS status bit seL C. iretom instruction executed. D. Next interruptible instruction. E. Branch-to-one instruction executed in response to INT. F. pioc register has INT status bit set. Figure 4·2. Case 2 - !NT Asserted During Service of Internal Interrupt After pioc Status is Checked 4·9 DSP16IDSP16A DEVICE PROGRAMMING Concurrent Interrupts Case 3 Internal interrupt requests remain pending until the respective pdx or sdx registers are serviced. Hence, if an external interrupt is being serviced and another internal interrupt request is generated, the internal interrupt request remains pending and causes a second interrupt to be taken at the next interruptible instruction. In this way, the internal interrupt is not missed if it occurs during the servicing of another external interrupt. A B c o E F G H INT lACK PIDS A. Branch-to-{)ne inslrUction. B. pioc register has INT status bit set. C. Read of pioc register status. D. pioc register has PIDS status bit set. E. ireturn inslrUction executed. F. Next interruptible inslrUction. G. Branch-to-{)ne inslrUction. Begin to service internal interrupt. H. Service internal interrupt. Figure 4·3. Case 3 - Internal Interrupt Asserted While Servicing an External Interrupt 4·10 DSP16IDSP16A DEVICE PROGRAMMING Interrupt Latency Case 4 If it is possible for two or more interrupt requests to be pending, the easiest method for servicing these interrupts is to service the external interrupt first and then the internal interrupt requests individually (by taking a new interrupt for each internal request) until no more interrupts are pending. The drawback of this procedure is that if external interrupts are frequent, there may be a large latency when servicing internal interrupts. 4.2.7 Interrupt Latency Two classes of DSP16/DSP16A instructions are not interruptible. The first class contains all branch instructions. The second class contains instructions that are executing in the cache (Le., any instruction when executing from the on-chip instruction cache cannot be interrupted). Interrupt latency is bounded by the longest in-cache operation. In situations where interrupt latency is critical, in-cache operations should be split into smaller cache operations whose execution time is less than any critical latency requirements. In this situation, an interruptible instruction must be placed between successive cache instructions. For example: do 93 instr instr instr nap /* interruptible instruction */ redo 50 nap /* interruptible instruction */ redo 50 4-11 4-12 • .:' ',., ,> , : ' : OUTPUT BUFFER BUFFER (IBUF) (OBUF) INPUT FLAG lr INPUT DATA ~> OUTPUT DATA OUTPUT FLAG SHIFT REGISTER SHIFT REGISTER SHIFT REGISTER SHIFT REGISTER (lFSR) (ISR) (OSR) (OFSR) : CLOCK GENERATOR : IBF ILD DI t t ICK OCK DO OLD OSE Figure 5-1. Serial I/O Internal Data Path 5.1 SIO OPERATION The following subsections describe the operation of the SIO input and output sections and the , active clock generator. 5-1 SERIAL I/O Output Section 5.1.1 Input Section A typically free-running clock (lCK) synchronizes all events occurring within the input section of the SIO. A high-to-Iow transition of the input load (lLD) signal followed by a rising edge of ICK initiates the start of an input transaction. The first serial data bit is read from DI on the next rising edge of ICK. Eight or sixteen bits later, when the input shift (isr) register fills, this data is transferred to the input buffer (ibuf) register and the input buffer full (lBF) signal is asserted, indicating that the buffer is full. The DSPI6/DSPI6A device may read the data at this time. The read command is of the type aO =sdx, al =sdx, or Y =sdx. The IBF is negated when the input buffer is read. Another serial input may begin before the input buffer read takes place since the port is double-buffered. If the new transfer is completed before the previous input is read, then the new data is transferred to the input buffer, overwriting the old data. The status of IBF may be read from the pioc register, IBF status field (bit 4), or the IBF field (bit 15) - this is the sign bit that can be tested without masking (Le., aO = pioc \ aO = aO \ if pI goto loop). The IBF may also be used as an interrupting condition, if the appropriate enable bit in the pioc register is set (Pioc register, bit 9). 5.1.2 Output Section When the DSP16/DSPI6A device is reset (power-up or RSTB), the internal status flag output buffer empty (OBE) is set, indicating that the buffer is empty. When data is written to the output buffer by an instruction of the form sdx =aO, sdx =ai, sdx =Y, or sdx =value, OBE is cleared and the serial output section is ready for a serial transmission. The status of the OBE flag may be read from the pioc register (OBE status field, bit 3). The OBE may be used as an interrupting condition if the appropriate enable bit in the pioc register is set (Pioc register, bit 8). A typically free-running clock (OCK) synchronizes all events taking place within the output section. A high-to-Iow transition of the output load (OLD) signal, followed by a rising edge of OCK, initiates the start of an output transaction. This procedure causes the contents of the output buffer register to be transferred to the output shift (osr) register, the internal flag OBE to be set (indicating the need for more data), and a high-to-Iow transition of OSE (indicating that the shift register is full). The first serial data bit is placed on the data output (DO) at this time. Eight or sixteen bits later, when the serial output has been completed, the output shift register empty (OSE) signal will be asserted, indicating that the last bit of the serial transmission has been sent (OSE can be used by external hardware to latch a shift register.) If the output buffer has been reloaded, another transfer begins immediately; otherwise, zeros are sent on the serial output until the buffer is reloaded prior to a high-to-Iow transition of OLD beginning another transmission. Double-buffering allows the output buffer to be reloaded while data is being shifted out of the output shift register. 5-2 SERIAL I/O Active Clock Generator A serial address (SADD) transmits simultaneously with DO. This address is the transmit address field of the srta register (see Table 5-4). The SADD output is active low. The SADD may also be used as a second serial output (only) port. The SADD signal is valid whether or not the device is in the multiprocessor mode (See Section 5.6). If SADD is to be used in this manner, the LD field of the sioc register should be set high to synchronize SADD with 00. 5.1.3 Active Clock Generator The active clock signals for the SIO section are derived from CKI, with a maximum frequency of CKI + 4. A simplified representation of the SIO active clock and load generator is shown in Figure 5-2. In the figure, the switches represent the user-programmable features. A closed switch corresponds to the associated bit in the sioc or tdms register having a value of one. The five signals ICK, OCK, ILD, OLD, and SYNC can be individually programmed to be either inputs or outputs (passive or active). When using active clocks (generated by the DSPI6/DSPI6A device), the speed of the clocks can be selected from four speeds: CKI divided by 4, 12, 16, or 20. This selection determines the speed of both ICK and OCK. The speed of ILD and OLD can be selected as either the ICK or OCK signals divided by 16. An active SYNC signal is generated from this same source (ICK or OCK divided by 16) and is further divided by 8 or 16. The resulting SYNC signal is either the signal ICK or OCK divided by 128 or 256. The SYNC signal can be configured to generate an 8 kHz sampling signal for codec applications. eLK SPEED SELECT CKI SYNCSP SPEED rot OCK ICK SELECT SERIAL OUTPUT SECTION LD TO SERIAL INPUT SECTION 1 +----.......__ CIRCUITRY TO MULTIPROCESSOR OCK ICK ILD OLD SYNC Figure 5-2. SIO Active Clock and Load Generation 5-3 SERIAL 110 User-Controlled Features 5.2 USER-CONTROLLED FEATURES Programmable modes are controlled by the serial I/O control (sioc) register. Flexibility in programming the functions of the serial I/O port allows the port to interface with a variety of devices with little or no "glue logic." Table 5-1 shows the control bits of the sioc register. During device reset, the sioc register bits are cleared. Table 5-1. Serial I/O Control (sioc) Register Bit 1 9 1 8 71 6 I Field. LO . CLK . MSB IO~O I;0 I~ II~K IOL~ I~N I Field Value ResultiDescription 0 Active ILD/OLD = ICK+16, LD Active SYNC = ICK+128/256.t 1 Active ILD/OLD = OCK+16,* Active SYNC = OCK+128/256.U 00 Active clock = CKI+4. 01 Active clock = CKI+ 12. CLK 10 Active clock = CKI+ 16. 11 Active clock = CKI+20. 0 LSB first MSB 1 MSB first 0 OLD is an input (passive mode). OLD 1 OLD is an output (active mode). 0 ILD is an input (passive mode). ILD 1 ILD is an output (active mode). 0 OCK is an inl'ut Jpassive mode). OCK 1 OCK is an output (active mode). 0 ICK is an input (passive mode). ICK 1 ICK is an output (active mode). 0 16-bit output. OLEN 1 8-bit output. 0 16-bit input. ILEN 1 8-bit input. t Either 128 or 256 - see tdms register SYNC field. * Select this mode when using SAOO (not necessary if ICK =OCK). 5-4 SERIAL I/O Serial I/O Pin Descriptions The following section describes each programmable mode in detail. • LD - The LD field (sioc bit 9) allows the active (internally generated) lLD and OLD signals to be derived from either ICK (LD =0) or OCK (LD = 1). Active lLD and OLD always are derived from the same source. • CLK - The CLK field (sioc bits 8,7) allows one of four active I/O speeds to be selected: a division of the input clock CKI by either 4, 12, 16, or 20. As an example, with a CKI of 8.192 MHz, 24.576 MHz, 32.768 MHz, or 40.960 MHz, using the appropriate divisor of 4, 12, 16, or 20, respectively, results in an active I/O rate of 2.048 MHz. Refer to Table 5-1 for the CLK field encoding. • MSB - The MSB field (sioc bit 6) determines the bit order of the serial transmissions: most significant bit (MSB) first (MSB = 1) or least significant bit (LSB) first (MSB =0). This mode switch allows compatibility with devices that perform either MSB first or LSB first serial transfers. This mode is also useful when performing IJ.-Iaw or A-law conversions. A minimal amount of software is required to perform these conversions. Since this field allows the bit order to be switched when an sdx read or write occurs, the MSB field can be switched immediately before and/or after an sdx read or write. If this technique is used in other than an interrupt service routine, care should be taken to insure that the proper mode is in effect in the event of an interrupt. • OLD - The OLD field (sioc bit 5) allows OLD to be either an input (OLD = 0) or an output (OLD = 1). • ILD - The lLD field (sioc bit 4) allows ILD to be either an input (lLD =0) or an output (lLD = 1). • OCK - The OCK field (sioc bit 3) allows OCK to be either an input (OCK = 0) or an output (OCK = 1). • ICK - The ICK field (sioc bit 2) allows ICK to be either an input (lCK = 0) or an output (lCK = 1). • OLEN - The OLEN field (sioc bit 1) controls the length of the serial output: either 16-bit (OLEN =0) or 8-bit (OLEN =1). When the data is sent in the 8-bit mode with the LSB first (MSB =0), the eight data bits should be placed in the least significant half of obuf; i.e., OxOODD (D =data). When the data is sent in the 8-bit mode with the MSB first (MSB =1), the eight data bits should be "packed" in the most significant half of obuf; i.e., OxDDOO (D = data). • ILEN - The !LEN field (sioc bit 0) controls the length of the serial input either 16-bit (lLEN = 0) or 8-bit (lLEN = 1). When the data is sent in the 8-bit mode with the LSB first (MSB = 0), the eight data bits are placed in the most significant half of ibuf; i.e., OxDDOO (D = data). When the data was sent in the 8-bit mode with the MSB first (MSB = 1), the eight data bits are placed in the least significant half of ibuf; i.e., OxOODD (D = data). 5.3 SERIAL I/O PIN DESCRIPTIONS The physical serial I/O port consists of eleven signals: four are used for serial input, four are used for serial output, and three are used in multiprocessor and/or TOM applications. Table 5-2 lists each signal with its type, pin number, and description. 5-5 SERlALJ/O Serial I/O Pin Descriptions Table 5-2. Serial I/O Pins Symbol Type· Pin Name/Description DI I 56 Data Input. Serial PCM data latched on rising edge of ICK, either LSB or MSB first, according to the sioc register MSB field. ICK I/Ot 58 Input Clock. Clock for serial PCM input data. In active mode, ICK is an output; in passive mode, ICK is an input, according to the sioc register ICK field. ILD I/Ot 57 Input Load. Falling edge of ILD indicates the beginning of a serial input word. In active mode, ILD is an output; in passive mode, ILD is an input, according to the sioc register ILD field. IBF Ot 53 Input ButTer Full. mF is asserted when the input buffer is filled and negated by a read of the buffer. mF is also negated by asserting RSTB. DO Ot 61 Data Output. Serial PCM data output from the output shift register (osr), either LSB or MSB first - according to the sioc register MSB field. DO changes on the rising edges of OCK. DO is 3-stated when DOEN is high. DOEN I/ot 64 Data Output Enable (Active-Low). An input when not in the multiprocessor mode. DO and SADD are enabled only if DOEN is low. DOEN is an output when in the multiprocessor mode (tdms register MODE field set). In the multiprocessor mode, DOEN indicates a valid time slot for a serial output. OCK I/Ot 59 Output Clock. Clock for serial PCM output data. In active mode, OCK is an output; in passive mode, OCK is an input, according to the sioc register OCK field. OLD I/Ot 60 Output Load. Clock for loading the parallel-to-serial converter from the output buffer (obut). A falling edge of OLD indicates the beginning of a serial output word. In active mode, OLD is an output; in passive, OLD is an input, according to the sioc register OLDfield. OSE Ot 52 Output Shift Register Empty. Indicates the end of a serial transmission. OSE is set either by the emptying of the output shift register or by asserting RSTB. OSE is reset by the DSP16 writing a word (two clock cycles after the falling edge of OLD) to the output shift register. Ifno new word is written by the DSP16, OSE remains high regardless of activity on OLD. '" I = Input; 0 = Output t 3-stated. 5-6 SERIAL I/O Serial I/O Programming Example Table 5-2. Serial I/O Pins (continued) Symbol Type'" Pin Name/Description SADD I/Ot 63 Serial Address (Active-Low). An 8-bit serial bit stream typically used for addressing during multiprocessor communication between multiple DSP16 devices. In multiprocessor mode, SADD is an output when the tdms time slot dictates a serial transmission; otherwise, it is an input. SADD is always an output when not in multiprocessor mode and can be used as a second serial output. SADD is 3-stated when DOEN is high. SYNC I/Ot 62 Multiprocessor Synchronization. Typically used in the multiprocessor mode, a falling edge of SYNC indicates the first word of a TDM I/O stream and causes the resynchronization of the active ILD and OLD generators. SYNC is an output when the tdms register SYNC field is set; otherwise, it is an input. SYNC must be tied low if it is not used as an output. When used as an output, SYNC = ILD/OLD + 8 or 16, depending on the setting of the SYNCSP field of the tdms register. This procedure can be used to generate a slow clock for SIO operation. * I = Input; 0 = Output. t 3-stated. 5.4 CODEC INTERFACE Figure 5-3 is the schematic showing the connections required to interface the DSPI6/DSP16A device to an AT&T T7500 Il-law/A-law Codec. Figure 5-4 shows the connections necessary to interface the DSPI6/DSPI6A device to an AT&T T7520 or T7522 High-Precision Codec. In both examples, the SYNC signal is actively driving ILD, OLD, and the codec with an 8 kHz signal. 5.5 SERIAL I/O PROGRAMMING EXAMPLE The program segment shown in this section demonstrates the use of the serial I/O port's interrupt facility. The advantage of using the interrupt on input buffer full (IBF) is that the input data is read in immediately, making careful placement of the sdx read commands within the program unnecessary. This program allows 128 inputs to be read into a buffer while another buffer already loaded with data is used by the program. When the first buffer fiUs, the two buffers are switched and the process repeats. 5-7 SERIAL 110 Serial I/O Programming Example BCLK OCK MCLK U It>- ICK SYNC T7500 DSP16 u-Iaw I A-law FS ILD IDSP16A CODEC OLD DR DO DX DI DOEN --L Figure 5-3. WE ® DSP16IDSP16A to AT&T T7500 Codec Interface R2048 OCK T7520 T2048 U ICK OR SYNC T7522 DSP16 PRECISION RSYNC ILD IDSP16A U CODEC TSYNC OLD RPCM DO TPCM DI DOEN --L Figure 5-4. WE® DSPl61DSP16A to AT&T T7520 or T7522 Codec Interface 5-8 SERIAL I/O Program Segment 5.5.1 Program Segment /* Ping pong I/O routine */ goto start intrpt: *rO++ = sdx ireturn start: auc = OxO pioc = Ox200 /* interrupt on IBF */ sioc = OxO /* passive I/O */ y = OxO r1 = Oxfe *r1 = y /* initialize flag */ r2 Oxfd /* temp storage */ rO = Oxff /* interrupt pointer */ rl = Oxff /* program I/O pointer */ y = Ox17f /* address of last sample in */ *r2 = y /* 128 point buffer */ goto loop mainprg: /* Main program here; prog. must take less time than I/O! */ aO *r1++ /* read in data from buffer */ loop: aO rO /* rO is address of input ptr. */ y = *r2 aO - y /* check for 128 samples in buffer */ i f ne goto loop /* loop i f not full */ rl Oxfe aO = *r1 /* get alternate buf flag */ aO = aO /* set DAU flags */ if eq goto buf /* alternate between buffers */ y = OxOO *r1 = y /* set flag for buf1 */ rO = Oxff /* interrupt pointer to buf1 */ r1 = Ox17f /* program I/O pointer to buf2 */ y = Ox17f *r2 = y /* address of last sample in buf1 */ goto mainprg buf: y = Ox01 *r1 = y /* set flag for buf2 */ rO = Ox17f /* interrupt pointer to buf2 */ r1 = Oxff /* program I/O pointer to buf1 */ y = Ox1ff /* address of last sample in buf2 */ *r2 = y goto mainprg 5-9 SERIAL 110 Multiprocessor Mode Description 5.6 MULTIPROCESSOR MODE DESCRIPTION The multiprocessor mode allows up to eight DSP16/DSP16A devices to be connected together in such a way as to provide data transmission to any of the individual DSP16/DSP16As in the system. Two registers associated with the multiprocessor mode are the time division multiplexed slot (tdms) register (see Table 5-3) and the serial receive and transmit address (srta) register (see Table 5-4). This mode requires no external hardware and uses a TDM interface with eight time slots per frame. A serial address on the SADD line is sent simultaneously with data on DO from anyone device in a predetermined time slot, and the data is received only by other device(s) having the address specified. Each device has a user-programmable receive address associated with it. In the multiprocessor mode, the following pins are connected together to form a four-wire bus, as shown in Figure 5-5. The DI and DO form a single-wire data bus referred to as DATA; ICK and OCK form a clock line referred to as CK; the SADD forms a single-wire address bus referred to as ADD; and SYNC provides a synchronization line referred to as SYN. Typically, CK and SYN are specified statically for one particular DSP16/DSP16A device to always generate, although CK may also be generated by an external clock. The signals are generated by the DSP16/DSP16A device having active SYNC and OCK signals, which occur when the tdms register SYNC field is set and the sioc register OCK field is set The other devices use the SYNC and OCK signals in the passive mode to synchronize operations. All DSPs have their ILD and OLD signals in active mode. A high-to-low transition of SYNC delineates transmit slot O. Eight words are exchanged within a SYNC frame, so the tdms register should have the SYNCSP field set low when in the mUltiprocessor mode. This provides 128 active ICK and/or OCK cycles per SYNC frame (8 words x 16-bits/word). The multiprocessor mode is turned on by setting the tdms mode field to one. In the multiprocessor mode, each device can send data in a unique time slot designated by the tdms register transmit slot field. The tdms register has fully decoded fielding in order to allow for one DSP16/DSP16A device transmitting in more than one time slot. This procedure is useful for multiprocessor systems with less than eight DSP16/DSP16A devices, when a higher bandwidth is necessary between certain devices in that system. Each device also has an address specified by the srta register transmit address field (Table 5-4), used to transmit the information regarding the destination of the data and an address assignment made to it by the receive address field referring to its own identity. In subsequent examples, the srta register receive address will be referred to as the "device number." Note: It is possible to assign more than one receive address or a duplicate receive address to a DSP16/DSP16A device, but the examples given assume a unique receive address. 5-10 SERIAL I/O Multiprocessor Mode Description DSP16/DSPl6A DI DO ICK OCK ILD OLD IBF OBE SADD SYNC DOEN DATA CK NC NC NC NC ADD SYN NC DSP16/DSP16A DSP16/DSP16A DSP16/DSP16A 0 1 7 • • • DATA CK ADD SYN DATA CK ADD SYN DATA CK ADD SYN Figure 5-5. DSPl61DSP16A Multiprocessor Connections If the serial address coming from the bidirectional SADD line of the transmitting device matches the address of one of the other devices, the input is loaded into that device's input buffer and its IBF flag is set at the end of the transmission. In order to read in the new data, an interrupt could take place based on the IBF flag. Note that the address is eight bits wide with eight DSPI6/DSPI6A devices (maximum) in the multiprocessor configuration. This means there is one address bit per DSPI6/DSPI6A device. The srta register has one address bit per device in order to allow transmissions to more than one device at a time. A broadcast mode sending data from one device to all others is accomplished by setting all bits high on the transmission field of srta. 5·11 SERIAL I/O Multiprocessor Mode Description Table 5·3. Time·Division Multiplexed Slot (tdms) Register Bit 1 9 1 8 171615141312111 0 Field. SYNCSP MODE TRANSMIT SLOT SYNC I Field Value ResultlDescription 0 SYNC =ICK/OCKt + 128. :j: SYNCSP 1 SYNC =ICK/OCKt + 256. 0 Multiprocessor mode off. MODE DOEN is an input (passive mode). 1 Multiprocessor mode on. DOEN is an output (active mode). lxxxxxxx Transmit slot 7. xlxxxxxx Transmit slot 6. xx 1xxxxx Transmit slot 5. TRANSMIT SLOT xxxlxxxx Transmit slot 4. xxxxlxxx Transmit slot 3. xxxxxlxx Transmit slot 2. xxxxxxlx Transmit slot 1. xxxxxxxi Transmit slot O. SYNC SYNC is an output (active mode). xxxxxxxO SYNC is an input (passive mode). t See sioc register. LD field. :j: Select this mode when in multiprocessor mode. Typically, the time-division multiplexed slot register (tdms) is set up at the beginning of a program and does not change for each of the devices in the multiprocessor system. If the time slot needs to be changed, it is imperative that each processor still have its own unique time slot. The falling edge of SYNC (the TDM frame sync) is used to update all the new time slots except time slot 0, which is updated in the next cycle of SYNC. During reset, the tdms register resets to all zeros, disabling the multiprocessor mode by default. The srta register is unaltered by reset. 5·12 SERIAL 110 Multiprocessor Mode Description Table 5-4. Serial Receive/Transmit Address (srta) Register Bit I 15 I 14 I 13 I 12 I 11 I 10 I 9 I 8 I 7 I 6 I 5 I 4 I 3 I 2 I 1 I 0 I Field I RECEIVE ADDRESS I TRANSMIT ADDRESS I Field Value Result/Description 1xxxxxxx Receive address 7. x1xxxxxx Receive address 6. xx 1xxxxx Receive address 5. xxx1xxxx Receive address 4. RECEIVE ADDRESS xxxx1xxx Receive address 3. xxxxx1xx Receive address 2. xxxxxx1x Receive address 1. xxxxxxxi Receive address O. 1xxxxxxx Transmit address 7. x1xxxxxx Transmit address 6. xx 1xxxxx Transmit address 5. xxx 1xxxx Transmit address 4. TRANSMIT ADDRESS xxxx1xxx Transmit address 3. xxxxx1xx Transmit address 2. xxxxxx1x Transmit address 1. xxxxxxxi Transmit address O. Figure 5-6 shows the operation of a system using eight DSP16/DSP16A devices in a multiprocessor configuration. The settings used for the tdms and srta registers are shown in order to illustrate the current state of these registers during each I/O operation. The following describes the operation shown in Figure 5-6. Time Slot Actions o In preparation for time slot 0 (left-most column), the tdms register of device number 7 has been initialized so that it can transmit in time slot zero. This situation also forces the device to generate the frame sync of the 1/0 stream. The srta register of device 7 has been set so that it can transmit to device 3 and receive address 7. The serial data register (SDX) of device 7 contains the data to be transmitted. During time slot 0, the data from device 7 is transmitted on the TDM channel. Device 3 recognizes its address on the serial address line (SADD) and accepts the data into its SDX register, which is subsequently read by the command *rO = sdx. All other devices ignore this transaction, since the transmit address was not theirs. 1 No actions in time slot 1. 5-13 SERIAL I/O Multiprocessor Mode Description 2 In preparation for time-slot 2, the tdms register of device 2 has been initialized so that during time slot 2, device 2 will transmit to device 5. During time slot 2, the data from device 2 is transmitted on the TDM channel. Device 5 recognizes the address on the SADD and accepts the data into its sdx register, which is then read by the command *r1 ++ = sdx. 3 No actions in time slot 3. 4 No actions in time slot 4. 5 In preparation for time slot 5, device 0 has been initialized so that it will transmit in this time slot to all other devices. Devices 1,4, and 6, which have not been previously mentioned, are ready to receive data assigned to their respective addresses. Devices 2, 3,5, and 7, which were initialized earlier, are also ready to receive data. During time slot 5, the data in device 0 is transmitted on the TDM channel. Every device address is represented on the SADD line, and all devices will accept the data. 6 No actions in time slot 6. 7 No actions in time slot 7. 5-14 SERIAL 110 Multiprocessor Mode Description TIME SLOT NUMBER ••• I a 2 3 4 5 6 7 I• • • TOMS = ox120 SRTA = ox01 FE f - - sdx = *r1++ SRTA = OX0200 (/) aO = sdx f4--- (/) w a: 0 0 « TOMS = ox104 w SRTA = ox0400 <:: w '" SRTA = ox042O aO = sdx f4-- () sdx = aO w a: « f- a: (/) SRTA = Ox0800 SRTA = ox0800 0 f- '" orO = sdx aO = sdx f4--- (!l z <5 a: 0 () () « v SRTA = ox1000 a: w aO = sdx f4-- en ::E ::l Z «<0 on SRTA = ox2000 SRTA = 0<2000 c::rn j4- *r1++ = sdx aO = sdx ~ c:: (/) 0 SRTA = ox4000 r.- <0 aD = sdx TOMS = ox101 SRTA = Ox8008 SRTA = Ox8008 sdx = *rO++ aO = sdx f.- Figure 5-6. DSP16/DSP16A Multiprocessor Communications 5-15 SERIAL I/O Suggested Multiprocessor Configuration 5.6.1 Suggested Multiprocessor Configuration In the suggested configuration, the DSP16/DSP16A device supplying the SYNC signal also supplies the ICK and OCK signals; the remaining DSPs are configured for passive SYNC, ICK, and OCK signals. All DSPs have active ILD and OLD signals. For the DSP16/DSP16A device with the given transmit slot, the following parameters should be configured as shown: Transmit Transmit Slot Parameter Slot 0 1-7 SYNC Active Passive ICK Active Passive OCK Active Passive ILD Active Active OLD Active Active To achieve the configuration shown above, the following registers in the DSPs should be set as shown: Transmit Transmit Register Slot 0 Slot 1-7 sioc Ox23C Ox230 tdms OxlOl OxlXX srta OxXXX OxXXX Note: An "X" indicates that the number is dependent on the specific application. The interrupt on IBF must also be enabled in the pioc register of each DSPI6/DSP16A device to allow the devices to detect and process an input. 5-16 SERIAL I/O Serial I/O Timing Diagrams S.7 SERIAL I/O TIMING DIAGRAMS ICK ILO VIH- 01 VIL- tlCKHIBFH ---..J ~ VOH- ------------------------~<~ IBF Figure 5-7. Serial Input Timing 5-17 SERIAL I/O Serial I/O Timing Diagrams VIH - OCK VIL - _ _~ OLD ~\\\\\\\\\\ OH- tOCKHDOV I DO VOL - tDOENLDOV tDOENLSADDV VIH - DOEN VIL - tOCKHSADDV VOH - SADD VOL - tOCKHOSEH VOH - OSE Figure 5-8. Serial Output Timing - 8 Bits 5-18 SERIAL I/O Serial I/O Timing Diagrams VIH- OCK OLD VIL VOH - DO VOl. _ tDOENLDOV tDOENLSADDV VIH -=-----"'\ DOEN VIL - tOCKHSADDV VOH - SADD VOL _ VOH OSE Figure 5·9. Serial Output Timing - 16 Bits 5·19 en ~ 1r rn .,t'!j VIH - 5· '" -"'"4 §~ OCK VIL - ~8 D<~:===X d1S '~;......__-;- ~.:~P.- J. ~ SADD VIH - VIL - tOCKLSADDV 1 tOCKHSYNCH SYNC --If tOCKHSYNCL VOH j.- tSYNCLOCKH fo tOCKHDOENL tOCKHDOENH ----I t DOEN ~It---------- VOL - U t Figure 5-10. Multiprocessor Timing ::C~t~~; ,p~~~·:It(/ '6:-8" 6·8 ..................,.. ,.."....,.... ,....,............._.. ,.""~."....... \();(f 6"9 .··.~~~.El;:.~t9:;:::::::::~=:::::::::~:;::;::~:::::::::~::~:::.:::::::;:::::::~:;:::;:~. ·t~~ 'l::~\~~~.:a~~·;~:::~::~::~::::'::~;:::::::.:;::~::::~::~:::~:.:~~::::::::::.~;:::;:::~:::::::~~::: ."::~ PARALLEL I/O Software Description 6. PARALLEL I/O The WE DSP16/DSP16A Digital Signal Processor has a l6-bit parallel I/O interface with external devices for rapid transfer of data. Access times are programmable via the strobe field in the pioc register. Minimal or no additional logic is required to interface with memory or other peripheral devices. Five maskable interrupts are included in the PIO unit. Although there is only one physical PIO port, there are two logical PIO ports: pdxO and pdxl. The two logical ports are distinguished by the state of the peripheral select line (PSEL). Figure 6-1 shows the DSP16/DSP16A PIO unit at the block level. INT ----=----....,~~I lACK .. I I PDBOO· pdx in (16) I I I PDB15 II I pdx out (16) I I PIDS PSEL PODS : I I .1 i pioe (16) J I I I D Figure 6-1. Parallel I/O Section 6.1 SOFTWARE DESCRIPfION The parallel I/O port can be accessed via the data move group of instructions. The two logical ports (pdx0 and pdx 1) correspond to the state of the PSEL pin (logical 0 or logical 1, respectively). That is, an access to the logical port pdxO initiates a transaction with the PSEL signal cleared (0), while an access to logical port pdxl initiates a transaction with the PSEL signal set (1). When programming the device, three PIO registers can be referenced: • pioc - Parallel I/O control register. • pdxO - Logical port O. • pdxl- Logical port 1. Note: pdxO and pdxl both reference the same physical register. 6-1 PARALLEL I/O Software Description The parallel I/O control (Pioc) register is a 16-bit, user-accessible register used to configure some features of the parallel I/O: • External device access time. • Interrupt masks. • Active/passive mode. • Statuslcontrol (SIC) bit mode. Table 6-1 shows the pioc register. Table 6-1 Parallel I/O Control (pioc) Register Bit l15 J14J 13 J 12 J 11 I 10 19181716151413121 do j Field I mF I STROBE I PODS I PIDS SIC I INTERRUPTS 1 STATUS J Field Value ResultlDescriI!tion mF R mF interrupt status bit (same as bit 4). Strobe width of PODS PIDS 00 T* T STROBE 01 2T 2T 10 3T 3T 11 4T 4T 0 PODS is an ~ut ~assive mode). PODS 1 PODS is an output (active mode). 0 PIDS is an input (passive mode). PIDS 1 PIDS is an o\l1Qut (active mode). 0 Not SIC mode. SIC 1 SIC mode. Wxxxx mF inte1'I'l!Qt enabled when set. xWxxx OBE inteI'flllll: enabled when set. INTERRUPTS xxWxx PIDS interrupt enabled when set. xxxWx PODS interrupt enabled when set. xxxxW !NT interrupt enabled when set. Rxxxx mF status bit. xRxxx OBE status bit. STATUS xxRxx PIDS status bit. xxxRx PODS status bit. xxxxR !NT status bit. * T = 2 x tCKIHCKIH. 6-2 PARALLELVO pioc Register Settings 6.1.1 pioc Register Settings From the system perspective, the DSPI6/DSPI6A device can be an active device (Le., initiates transactions on the parallel data bus, PDB), or a passive device (Le., receives stimulus from external devices). In the active mode, the DSPI6/DSPI6A device behaves as a bus master; in the passive mode of operation, the DSPI6/DSPI6A device behaves as a peripheral to another device, such as a microprocessor or another DSPI6/DSPI6A device. Bit 15 of the pioc register is the same as bit 4. See the following description of bit 4. Bits 14 and 13 of the pioc register control the duration of assertion of the PIDS and PODS signals. This will be described in more detail in Section 6.2.2. Bit 12 of the pioc register, when equal to logic 1, makes the PODS pin an output; hence, the DSPI6/DSPI6A device can perform active mode write transactions to external devices. When bit 12 of the pioc register is equal to logic 0, the PODS pin is an input used for passive reads from the DSPI6/DSP16A device by external devices. Bit 11 of the pioc register, when equal to logic I, makes the PIDS pin an output; hence, the DSP16/DSP16A device can perform active mode read transactions from external devices. When bit 11 of the pioc register is equal to logic 0, the PIDS pin is an input used for passive writes to the DSP16/DSP16A device. Note: The external PSEL pin always reflects the last access of pdxO or pdxl by the DSP16/DSPI6A program. PSEL is unaffected by the selection of active or passive PIDS or PODS. Bit 10 of the pioc register, when equal to logic I, places the PIO in status and control (SIC) mode. In the SIC mode, the upper half of the parallel data bus (pDB15-PDB08) becomes an input only; the lower half (pDB07-PDBOO) remains bidirectional (see Section 6.2.4). Bits 9,8,7,6, and 5 of the pioc register are used to mask interrupts. There are five types of interrupts that can occur: • Interrupts caused by an external device writing to the DSPI6/DSPI6A device's serial port. This type of interrupt is masked when bit 9 of the pioc register is set to logic O. • Interrupts caused by an external device reading from the DSPI6/DSPI6A device's serial port. This type of interrupt is masked when bit 8 of the pioc register is set to logic O. • Interrupts caused by an external device writing to the DSPI6/DSPI6A device's parallel port when the DSPI6/DSP16A device is in passive mode. This type of interrupt is masked when bit 7 of the pioc register is set to logic o. • Interrupts caused by an external device reading from the DSPI6/DSPI6A device's parallel port when the DSP16 device is in passive mode. This type of interrupt is masked when bit 6 of the pioc register is set to logic O. • Interrupts caused by an external device asserting the !NT pin. This type of interrupt is masked when bit 5 of the pioc register is set to logic O. 6-3 PARALLELVO pioc Register Settings Note: There is one instruction latency when altering the INTERRUPTS field of the pioc register. For example, if interrupts are disabled with the command pioc=OxOO, the DSPI6/DSPI6A device still responds to an interrupt during the next instruction. After this instruction has executed, the interrupts are disabled. Therefore, to protect an instruction sequence from interrupts, follow the command to mask the INTERRUPTS field of the pioc register with one instruction that may be safely interrupted. Bits 4, 3, 2, 1, and 0 of the pioc register indicate the serial and parallel VO buffers and the interrupt pin. This portion of the pioc register can be used to determine which of the five aforementioned interrupts are requesting service. These bits can be read by an interrupt service routine to determine which interrupt(s) have occurred and, hence, how to proceed to service the interrupt request. These status bits can also be used to perform programmed VO by polling some condition when necessary. It is important to note that pending interrupt status bits are cleared under the following conditions: • pioc[4], which indicates that the serial VO input buffer is full, is cleared by reading from the sdx (serial VO) register. • pioc[3], which indicates that the serial output buffer is empty, is cleared when a write to the sdx (serial I/O) register is performed. • pioc[2], which indicates that an external device has written into the DSPI6/DSPI6A device's pio register, is cleared when the DSPI6/DSPI6A device reads from the PIO register (either pdxO or pdxl). Reading from the PIO register clears this bit irrespective of whether it is done inside or outside an interrupt routine. Note that this interrupt can occur only when the DSPI6/DSPI6A device is in the passive mode; hence, the DSPI6/DSPI6A device reading from the PIO registers (to clear pioc[2]) does NOT cause an external read transaction to take place. • pioc[l], which indicates that an external device has read from the DSPI6/DSPI6A device's PIO register, is cleared when the DSPI6/DSPI6A device writes to the PIO register (either pdxO or pdxl). Writing to the PIO register clears this bit irrespective of whether it is done inside or outside an interrupt routine. Note that this interrupt can occur only when the DSPI6/DSPI6A device is in the passive mode; hence, writing to the PIO registers (to clearpioc[l]) does NOT cause an external write transaction to take place. • pioc[O], which indicates that an external device has asserted the INT signal, is cleared when the interrupt acknowledge (lACK) signal makes a high-to-Iow transition, indicating that the interrupt service routine has completed. If external interrupts are masked, this bit will NOT be set when !NT is asserted. Recall that this bit can be cleared only when an ireturn instruction causes the high-to-Iow transition ofIACK. Note: The contents of the pioc register are cleared, except bit 3 which is set, when the RSTB signal is asserted. Hence, the DSPI6/DSPI6A device is in passive mode, non-status and control (S/C) bit mode, with all interrupts masked after a chip reset. 6-4 PARALLEL I/O Latent Reads 6.1.2 Latent Reads While in active mode, reading from a logical PIO port is accomplished by an actual read of the single physical port on the DSPI6/DSPI6A device. When a read of the parallel input register (Physical port) is performed, a transaction to the external system is performed on the logical port. Reads from the logical port imply that: • All reads take their data from the on-chip parallel input register. • As data is read from the internal parallel input register, a read transaction to the external system is initiated. • Upon completion of the external read transaction, data received from the external system (logical port 0 or I) is loaded into the parallel input register. Since data is read from the internal parallel input register and then new data is accepted into the parallel input register from a logical port, reads from the external system are latent. For example, to read a string of four words of data (dO, d I, d2, d3) from the PIO port, the following actions are required: 1. The first instruction reads meaningless data from the parallel input register and initiates the transaction to bring the first datum (dO) from the external device. 2. The second instruction reads the first datum (dO) from the parallel input register and initiates the transaction to bring the second datum (dl) from the external device. 3. The third instruction reads the second datum (dl) from the parallel input register and initiates the transaction to bring the third datum (d2) from the external device. 4. The fourth instruction reads the third datum (d2) from the parallel input register and initiates the transaction to bring the fourth datum (d3) from the external device. 5. The fifth and final instruction reads the fourth datum (d3) from the parallel input register and initiates a transaction that reads another word of data from the external device and overwrites the last datum (d3) in the parallel input register. To fetch a vector of data of length N requires N+ I instructions and generates N+ I read transactions to the external system. In order to fetch a single datum that is not already present in the parallel input register, two instructions are required. Since both logical ports map into the same physical port, a fetch from either logical port takes data from the parallel input register; the external access then overwrites the contents of the parallel input register with the data from the logical port specified in the instruction. The parallel output register is distinct from the parallel input register. Writing to pdxO and pdxl does not alter the contents of the parallel input register. 6-5 PARALLEL I/O Hardware Description 6.2 HARDWARE DESCRIPTION The parallel I/O bus is an asynchronous interface. Data strobes indicate when data may be put on the bus during active mode reads and when data is available on the bus during active mode writes. The PIO port characteristics are programmable and are controlled by the parallel I/O control register (Pioc). The following sections describe the PIO signals and their functions. 6.2.1 Parallel I/O Signals Table 6-2 describes the PIO signals of the DSPI6/DSPI6A device. Table 6-2. Parallel I/O Si2nals Symbol Type· Pin NamelDescription PDBOO 11 Parallel Data Bus - Bit O. PDBOI 10 Parallel Data Bus - Bit 1. PDB02 9 Parallel Data Bus - Bit 2_ PDB03 8 Parallel Data Bus - Bit 3. PDB04 5 Parallel Data Bus - Bit 4_ PDB05 4 Parallel Data Bus - Bit s. PDB06 3 Parallel Data Bus - Bit 6. PDB07 I/Ot 2 Parallel Data Bus - Bit 7. PDB08 84 Parallel Data Bus - Bit 8. PDB09 83 Parallel Data Bus - Bit 9. PDBlO 82 Parallel Data Bus - Bit 10. PDB11 81 Parallel Data Bus - Bit 11. PDBl2 78 Parallel Data Bus - Bit 12. PDBl3 77 Parallel Data Bus - Bit 13. PDBl4 76 Parallel Data Bus - Bit 14. PDBl5 75 Parallel Data Bus - Bit 15. PSEL Ot 72 Peripheral Select. PSEL is used to specify the logical port to/from which data is to be conveyed. PSEL is high (logic I) when pdx I is the register specified in the I/O instruction and low when pdxO is the register specified. * I = Input; 0 = Output. t 3-stated. 6-6 PARALLEL I/O Active Mode Table 6-2. Parallel I/O Sienals (continued) Symbol Type· Pin NarneiDescription PIDS I/Ot 73 Parallel Input Data Strobe (Active-Low). In active mode, PIDS is an output. when PIDS is asserted, data may be placed onto the PDB. Upon negation ofPIDS, data should be removed from the PDB. PIDS is asserted by the DSP16/DSP16A device during active mode read transaction In passive mode, PIDS is an input. When asserted by an external device, this signal indicates that data is available on the PDB. In both passive and active modes, the trailing edge (low-to-high transition) ofPIDS is the sampling point. PODS I/Ot 74 Parallel Output Data Strobe (Active-Low). In active mode, PODS is an output. When PODS is asserted, data is available on the PDB. PODS is asserted by the DSP16/DSP16A device during an active mode write transaction. In passive mode, PODS is an input. When PODS is asserted by an external device, the DSP16/DSP16A device places the contents of its parallel output register (pdxO or pdx 1) onto the PDB . ... I = Input; 0 = Output t 3-stated. 6.2.2 Active Mode The duration of parallel I/O strobe signals can be programmed using bits 14 and 13 of the pioc register. Table 6-3 shows the possible configurations. Table 6-3. PIO Strobe Widths pioc Bits Strobe width 14 13 PIDS· PODS· 0 0 T T 0 1 2T 2T 1 0 3T 3T 1 1 4T 4T ... T = 2 x tCKIHCKIH When minimum strobe widths are configured, parallel I/O transactions can occur at the instruction rate. Consecutive parallel I/O instructions can be executed. Note: When the strobe widths are not minimum, consecutive PIa instructions are prohibited - other non-PIO instructions must be placed between two PIa instructions. 6-7 PARALLELVO Status and Control Mode • When pioc[14, 13] = 01, one or more instructions must be placed between PIO instructions. • When pioc[ 14, 13] = 10, two or more instructions must be placed between PIO instructions. • When pioc[ 14, 13] = 11, three or more instructions must be placed between PIO instructions. Any interrupt seIVice routine must guarantee that these conditions are met. As a simple rule, when pioc[14, 13] = II, the first instruction in an interrupt service routine cannot be a PIO instruction. 6.2.3 Passive Mode In passive mode, the DSP16/DSP16A device can be used as a peripheral to such other devices as a microprocessor. Bits 12 and 11 of the pioc register are used to configure the passive mode. When bit 12 of the pioc register is clear (0), the PODS signal becomes an input and the contents of the DSP16/DSP16A device's parallel output register can be read by an external device asserting PODS. When bit 11 of the pioc register is clear (0), PIDS is an input and the DSP16/DSP16A device's parallel input register can be written by an external device asserting PIDS. Providing that their respective interrupt mask bits are set Oogic I), the assertion ofPIDS and PODS by an external device causes the DSPI6/DSPI6A device to recognize an interrupt. This mechanism is a means by which functional synchronization between the DSP16/DSPI6A device and an external device can be achieved. 6.2.4 Status and Control (SIC) Mode The (S/C) mode of the DSP16/DSPI6A device's parallel 1/0 is invoked by setting bit 10 of the pioc register to logic 1. When this bit is set, the upper half of the parallel data bus (pDB 15- PDB08) becomes an input only. The lower half of the parallel data bus (pDB07-PDBOO) remains bidirectional. The lower half of the parallel data bus can be used as an 8-bit, bidirectional port that behaves just as the 16-bit port does in both the active and passive modes. The upper half of the parallel data bus, being an input only, can perform active and passive mode input transactions. The SIC bit mode may be used as follows: • The upper bits (PDB 15-PDB08) can be used by devices external to the DSP16/DSP16A device to control the behavior of the DSP16/DSP16A. The DSP16/DSP16A device can be programmed to poll the parallel port and to respond according to the data there. An external device can use the upper eight bits of the parallel I/O (in the passive mode) to write a control byte into a DSP16/DSP16A device. Data on this upper byte must be clocked (using PIDS) into the parallel 1/0 port. Furthermore, the DSP16/DSP16A device should have its PODS signal configured in the passive mode (bit 12 ofpioc clear). 6-8 PARALLEL I/O PIO Bus Transactions • The lower eight bits of the parallel data bus (pDB07-PDBOO) can be used by external devices to indicate some condition (status) internal to the DSP16/DSP16A device. The DSP16/DSPI6A device, by writing to the pdx register enables these eight bits when PODS is asserted. 6.3 INTERRUPTS AND THE PARALLEL I/O There are two internal interrupts generated, based on parallel I/O events. An internal interrupt is generated (provided it is unmasked) when an external device performs a passive mode write. When the external device negates the PIDS signal (low-to-high transition), an internal interrupt request is generated. When the DSP16/DSP16A device accepts this interrupt request, the lACK signal is asserted. When the interrupt routine is completed, lACK is negated (becomes logic 0). See Section 2.8 for more information on how the DSP16/DSP16A device reacts to interrupts. Similarly, when an external device performs a passive read, an internal interrupt request is generated upon negation (low-to-high transition) of PODS. When the DSP16/DSP16A device accepts this interrupt request, the lACK signal is asserted. When the interrupt routine has completed, lACK is negated (becomes logic 0). When the DSPI6/DSPI6A device is in the passive mode, program synchronization can be obtained by using the interrupt mechanism to synchronize a data source, with the program being run by the DSP16/DSP16A device. Briefly, the DSP16/DSPI6A device can have its parallel I/O configured in the passive mode. A data source provides data to the DSP16/DSP16A device via passive writes. During the associated interrupt routine, the DSP16/DSP16A device program performs 1/0 functions. The receipt of data by the DSP16/DSP16A device is indicated to the external data source by the falling edge (high-to-Iow) transition of the lACK signal. When the PIDS signal is active, the pdx in register is shadowed during interrupts. This allows the parallel input to be used during interrupts without the possibility of destroying data previously fetched via a latent PIO read. When the interrupt service routine is exited, pdx in is loaded with its value prior to the interrupt. If the parallel input is changed from active to passive during the interrupt, the shadowing feature is disabled. 6.4 PIO BUS TRANSACTIONS In this section, the four types of parallel I/O transactions are described: • Active mode input (active read) • Active mode output (active write) • Passive mode input (passive read) • Passive mode output (passive write) Note: For timing information, refer to the appropriate data sheet. 6-9 PARALLEL I/O Active Mode Input 6.4.1 Active Mode Input The active mode input transaction (shown in Figure 6-2) is initiated by the DSP16/DSP16A device executing a data move instruction (e.g., *r2 = pdxO). When an active mode input occurs, PIDS and PSEL are asserted, indicating that an external device can place data on the parallel data bus (PDB). PSEL can be used to select one of two external sources for the data. The external device must place valid data on the PDB before the negation ofPIDS. The access time for the external data source is configurable via the pioc register. The external data source can remove data from the PDB after negation of PIDS. \ ~~ CKO PSEL VOH- --d tCKOHPIDSL VOL- tPIDSLPSELV VOH- PODS VOL- tPIDSLPIDSH VOH- , , , , ," E::3: PIDS VOL- ,,,,,,"eo,, VIH- PDS VIL - Figure 6-2. Active Mode Input Timing 6-10 PARALLEL I/O Active Mode Output 6.4.2 Active Mode Output The active mode output transaction (shown in Figure 6-3) is initiated by the DSPI6/DSPI6A device executing a data move instruction (e.g., pdxO =*r2). When an active mode output occurs, PODS and PSEL are asserted. A short time later, the DSPI6/DSPI6A device places data onto the PDB. This data remains valid until a short time after the negation of PODS. This write time is configurable via the pioc register. ICKOLPODSL CKO tCKOHPSELV J ~ > I< B *1 1* *1 1* aO, cl, rb, re, j, x, y registers are also *1 1* used. *1 B-7 PROGRAMMING EXAMPLES Matrix Multiplication Mmult: cl=-3 /* Initialize registers */ auc=OxOO /* Integer mode */ /* Read in Matrices */ rO=A aO=pdxO do 32 { aO=pdxO *rO++=aO rb=A /* Reinitialize regs */ re=A+3 r2=C rl=A /* Main program loop */ loop: rO=B j=4 y=*rO++j x=*rl++ do 4 { p=x*y y=*rO++j aO=p x=*rl++ p=x*y y=*rO++j aO=aO+p x=*rl++ j=-ll p=x*y y=*rO++j aO=aO+p x=*rl++ j=4 p=x*y y=*rO++j aO=aO+p x=*rl++ *r2++=aOl j=3 *rl++j aO=rl rb=aO *rl++j aO=rl re=aO *rl++ i f cllt goto loop stop: goto stop B-8 PROGRAMMING EXAMPLES Find Maximum Vector Element B.4 FIND MAXIMUM VECTOR ELEMENT /* The following segment of code will find the */ /* component of an input vector with maximum magnitude. */ /* Both the magnitude and index (offset) of the component */ /* are retained upon completion. */ /* This coding example demonstrates the use of */ /* conditional ALU monadic instructions and event counting */ /* using the c2 register. */ /* */ .ram vector: 32*int .endram /* Read in the vector to be searched via PIO. */ /* (It is assumed that the vector will be reused */ /* after the determination of its maximum component. */ /* Otherwise, a more efficient loop might be written */ /* which determines the max component as the values */ /* are read.) */ setup: auc=OxOO r1=vector aO=pdx1 do 32 { aO=pdxl *rl++=aO /* Begin search. */ /* Upon completion, the magnitude of the component */ /* with maximum value is stored in aO, and the index */ /* of this component (its offset from the base address */ /* 'vector') is stored in c2. */ /* As written, if more than one component of the */ /* vector share the maximum value, then the first of these */ /* two is retained. The routine can easily be modified to */ /* retain the last of these components by replacing the */ /* test condition with 'le'. */ findmaxM: r1=vector c1=O c2=O y=*r1 x=*rl++ p=x*y y=*r1 aO=p x=*r1++ do 31 { p=x*y y=*r1 a1=aO-p x=*r1++ ifc mi aO=p stop: goto stop B-9 B-lO DSP16/DSP16A INSTRUCTION SET SUMMARY DSPl6lDSPl6A Instruction Set Summary C. DSP16/DSP16A INSTRUCTION SET SUMMARY Tables 3-2 through 3-12 are repeated below for the convenience of the user, to provide quick access to the DSPI6/DSPI6A instruction set See Section 3.9 for a more detailed desciption of the instruction set. Table Col. Conditional Mnemonics Test Meaning Test Meaning pi Result is nonnegative (sign bit mi Result is negative. is bit 35). eq Result is equal to zero. ne Result is not equal. to zero. gt Result is greater than zero. Ie Result is less than or equal. to zero. lvs Logical overflow set (36-bit lvc Logical overflow clear. overflow). mvs Mathematical overflow set (32- mvc Mathematical overflow clear. bit overtiow). cOge Counter 0 greater than or equal cOlt Counter 0 less than zero. to zero. clge Counter I greater than or equal. cllt Counter 1 less than zero. to zero. heads Pseudorandom sequence bit set. tails Pseudorandom sequence bit clear. true The condition is always false The condition is never satisfied satisfied in an if instruction. in an if instruction. Note: Testing the state of cO or cl automatically increments the counter by 1. Table C-2. Instruction Group Characteristics Instruction Flags Execute From Group Affected Within Cache Interruj>tible Multiply/ALU DAU Yes Yes Special Function DAU Yes Yes Control None No No Data Move 1/0 status only Yes· Yes Cache None No No • Two-word data immediate instructions may not be executed from within the cache. C-I DSP16/DSP16A INSTRUCTION SET SUMMARY DSPl61DSP16A Instruction Set Summary All multiply/ALU instructions require one word of memory. Table C-3. Multiply!ALU Instructions Transfer Function Cycles Statements Statements Out/In Cache p=x*y y=Y x=X 2/1 aD=p p=x*y y=aT x=X 2/1 aD=aS+p p=x*y y[l]=Y 1/1 aD=aS-p p=x*y aT[l]=Y 1/1 aD=p x=Y 1/1 aD=aS+p Y 1/1 aD=aS-p Y=y[l] 2/2 aD=y Y=aT[l] 2/2 aD=aS+y Z:y x=X 2/2 aD=aS-y Z: y[l] 2/2 aD=aS&y Z: aT[l] 2/2 aD=aSly aD=aSl\y as-y as&y Table C-4. Replacement Table for Multiply!ALU Instructions Replace Value Meaning aD, as, aT aO, al One of two DAU accumulators. X *pt++, *pt++i ROM location pointed to by pt. pt is postmodified by + 1 and i, respectively. Y *rM, *rM++, *rM--, RAM location pointed to by *rM++j rM. (M= 0, 1,2,3) rM is postmodified by 0,+1,-1, andj, respectively. Z *rMzp, *rMpz, *rMm2, Read/write compound *rMjk addressing. M=O, 1,2,3. rM is used twice: first, postmodified by 0, + I, -I, and j, respectively; and second, postmodified by +1, 0, +2, and k respectively. C-2 DSP16/DSP16A INSTRUCTION SET SUMMARY DSP16/DSP16A Instruction Set Summary All special function instructions (conditional and unconditional) require 1 word of program memory and execute in 1 instruction cycle. Table CoS. Special Function Instructions Instruction Description aD=aS»1 aD=aS»4 Arithmetic right shift (sign preserved) of aD=aS»8 36-bit accumulators. aD=aS»16 aD=aS aD=-aS - aD=md(aS) Round upper 20 bits of accumulator. aDh=aSh+1 Increment high half of accumulator (lower half cleared). aD=aS+1 Increment accumulator. aD=y aD=p - aD=aS«1 aD=aS«4 Logical left shift (sign-extended from bit 31) of the aD=aS«8 least significant 32 bits of the 36-bit accumulators. aD=aS«16 The above special function instructions can be conditionally executed: if CON instruction and with an event counter: ifc CON instruction which means: if CON is true then cl = cl + 1 instruction c2= cl else cl = cl + 1 Table C-6. Replacement Table for Special Function Instructions Replace Value MeanillJt aD,aS aO,al One of two DAU accumulators. CON mi, pI, eq, ne, gt, Ie, lvs, See Table C-l for definitions of mvs, mvc, cOge, cOlt, processor flags. c Ige, c1lt, heads, tails, true, false C-3 DSP16/DSP16A INSTRUCTION SET SUMMARY DSPl6/DSP16A Instruction Set Summary All unconditional control instructions (except icall) execute in 2 instruction cycles and require 1 word of program memory; conditional control instructions execute in 3 instruction cycles and require 2 words of program memory. icall requires 1 word of program memory and executes in 3 instruction cycles. Table C-'. Control Instructions gotoJA icall goto pt return (goto pr) callJA iretum (goto pi) call pt The control instructions, with the exception of iretum and icall can be conditionally executed as follows: if CON instruction Table CoS. Replacement Table for Control Function Instructions Replace Value Meaning CON mi, pI, eq, ne, gt, Ie, Ivs, See Table 3-12 for mvs, mvc, cOge, cmt, definitions of processor clge, cllt, heads, tails, flags. true, false JA 12-bit value Least significant 12 bits of an absolute address within the same 4 Kword memory section. Data move instructions execute in 2 instruction cycles. Immediate data move instructions require two words of program memory; all other data move instructions require only 1 word. The only exception is a special case immediate load (short immediate) instruction. If a Y AAU register is loaded with a 9-bit, or smaller, value, the instruction requires only 1 word of memory and executes in 1 instruction cycle. Table C-9. Data Move Instructions R =N R=M R =Y Y=R aT=R R=aS Z:R C-4 DSP16/DSP16A INSTRUCTION SET SUMMARY DSP16IDSP16A Instruction Set Summary Table ColO. Replacement Table for Data Move Instructions Replace Value Meaning R x DAU register - signed, 16 bits. y DAU register - signed, 16 bits. ! yl DAU register - unsigned, 16 bits. auc DAU control register - unsigned, 7 bits. cO DAU counter 0 - signed, 8 bits. cl DAU counter 1 - signed, 8 bits. c2 DAU counter 2 - signed, 8 bits. rO Y AAU pointer reg. - unsigned, 9 bits (16 bits in DSPI6A). rl Y AAU pointer reg. - unsigned, 9 bits (16 bits in DSPI6A). r2 Y AAU pointer reg. - unsigned, 9 bits (16 bits in DSPI6A). r3 Y AAU pointer reg. - unsigned, 9 bits (16 bits in DSPI6A). rb Y AAU modulo addr. reg. - unsigned, 9 bits (16 bits in DSPI6A). re Y AAU modulo addr. reg. - unsigned, 9 bits (16 bits in DSPI6A). j YAAU incr. register - signed, 9 bits (16 bits in DSPI6A). k YAAU incr. register - signed, 9 bits (16 bits in DSPI6A). pt XAAU pointer register - unsigned, 16 bits. pr XAAU program return register - unsigned, 16 bits. pi XAAU program interrupt register - unsigned, 16 bits.2 i XAAU incrmient register - signed, 12 bits. psw Processor status word. sioc Serial I/O control register? sdx Serial I/O data register. tdms Serial I/O tdms control register.3 srta Serial receive/transmit address. 3 pioc Parallel I/O control register. pdxO Parallel I/O data register with PSEL = 0 (pin 72). pdxl Parallel I/O data register with PSEL = 1 (pin 72). aD,aS aO,al High half of accumulator.! Y *rM,*rM++, Same as in multiply/ALU instructions. *rM--,*rM++j Z *rMzp,*rMpz, Same as in multiply/ALU instructions. *rMm2, *rMjk N 16-bit value Immediate data. M 9-bit value Immediate data for YAAU registers. Notes: When reading signed registers less than 16 bits wide. their contents are sign-extended to 16 bits. When reading unsigned registers less than 16 bits wide, their contents are zero-extended to 16 bits. When short inunediate addressing is used to write to YAAU registers in the DSPI6A. unsigned registers are zero-extended from 9 to 16 bits. Signed registers (j,k) are sign-extended from 9 to 16 bits. !Data moves to y, aO, or alload the high half (bits 31-16) of the register. If clearing of the destination is enabled (according to the CLR field of the auc register), the low half of the destination register is cleared (0) when the high half is loaded. 2rhe pi register acts as a "shadow" of the pc register. Each time the pc changes, its value is also loaded into pi. "Shadowing" is disabled when executing an interrupt service routine, therefore, pi contains the contents of pc prior to the interrupt. Writes to pi do not alter its contents, except during interrupt service routines. 3sioc, tdms, and srta registers are not readable. C-s DSP16IDSP16A INSTRUCTION SET SUMMARY DSP16IDSP16A Instruction Set Summary The do and redo instructions require 1 word of program memory. The do instruction executes in 1 instruction cycle, and the redo instruction executes in 2 instruction cycles. Table C-H. Cache Instructions do K { instructionl instruction2 instructionNl } redoK Table C-l2. Replacement Table for Cache Instructions Replace Value Meaning K 2 ::;;K::;; 127 Number of times the instructions are to be executed. NI I::;;NI::;; 15 1 to 15 instructions may be included. When the cache is used to repeat a block of NI instructions, the cycle timings of the instructions are as follows: 1. The "first pass" does not affect cycle timing except for the last instruction in the block of NI instructions. This instruction executes in 2 cycles. 2. During pass 2 through pass K+1, each instruction is executed "in the cache" (see Table C-3). 3. During the last (Kth) pass, the block of instructions executes "inside the cache" except for the last instruction which executes outside the cache. The instructions remain in the cache memory and may be re-executed using the redo command without the need to reload the cache. . C-6 PROGRAMMABLE REGISTERS Programmable Registers D. PROGRAMMABLE REGISTERS This reference section shows the six programmable control registers of the DSP16/DSP16A device: • Processor status word (psw) • Arithmetic unit control (auc) • Parallel I/O control (pioc) • Serial I/O control (sioc) • Serial receive/transmit address (srta) • Time-division multiplexed slot (tdms) All six registers are described in detail in other chapters in this manual. This section is provided only as a quick reference for the programmable registers. Table D-I. Arithmetic Unit Control (auc) Register I I Bit 1 6 5 4 13 211 I 0 1 I Field . CLR . SAT . ALIGN. Field Value ResultlDescription lxx Clearing yl is disabled (enabled when 0). CLR xIx Clearing all is disabled (enabled when 0). xxI Clearing aOl is disabled (enabled when 0). Ix al saturation on overflow is disabled (enabled when 0). SAT xl aO saturation on overflow is disabled (enabled when 0). 00 p+- (xxy). 01 P +- (xxy) + 4. ALIGN 10 p +- (xxy) x 4. 11 Reserved. D-I PROGRAMMABLE REGISTERS Programmable Registers Table D-2. Processor Status Word (psw) Register Bit I 15-12 1111101 9 I 8-5 I 4 I 3-0 I Field I DAU Flags I X I X I al[V] I al[35-32] I aO[V] I aO[35-32] I Field Value Result/Description Wxxx 1MI -logical minus when set. xWxx LEQ -logical equal when set. DAUFlags xxWx LLV -logical overflow when set. xxxW LMV - mathematical overflow when set. al[V] W Accumulator 1 (al) overflow when set. Wxxx Accumulator 1 (al) bit 35. xWxx Accumulator 1 (al) bit 34. al[35-32] xxWx Accumulator 1 (al) bit 33. xxxW Accumulator 1 (al) bit 32. aO[V] W Accumulator 0 (aO) overflow when set. Wxxx Accumulator 0 (aO) bit 35. xWxx Accumulator 0 (aO) bit 34. aO[35-32] xxWx Accumulator 0 (aO) bit 33. xxxW Accumulator O{aO) bit 32. D-2 PROGRAMMABLE REGISTERS Programmable Registers Table D-3. Parallel I/O Control (pioc) Register Bit I 15 I 14 I 13 I 12 I 11 I 10 I9-5 4-0 I I Field I mF I STROBE I PODS I PIOS I SIC I INTERRUPTS I STATUS I Field Value ResultlDescription IBF R IBF interrupt status bit (same as bit 4). Strobe width of PODS PIDS 00 T* T STROBE 01 2T 2T 10 3T 3T 11 4T 4T 0 PODS is an input (passive mode). PODS 1 PODS is an output (active mode). 0 PIDS is an input (passive mode). PIDS 1 PIDS is an output (active mode). 0 Not SIC mode. SIC 1 SIC mode. Wxxxx IBF interrupt enabled when set. xWxxx OBE interrupt enabled when set. INTERRUPTS xxWxx PIDS interrupt enabled when set. xxxWx PODS interrupt enabled when set. xxxxW !NT interrupt enabled when set. Rxxxx IBF status bit. xRxxx OBE status bit. STATUS xxRxx PIDS status bit. xxxRx PODS status bit. xxxxR !NT status bit. * T = 2xtCKIHCKIH. D-3 PROGRAMMABLE REGISTERS Programmable Registers Table D-4. Serial I/O Control (sioc) Register Bit I I I 71 IO~D I~D I~ II~K IOL~ I~ I 9 8 6 Field. LD . CLK • MSB Field Value ResultlDescription 0 Active ILD/OLD =ICK+16, LD Active SYNC =ICK+128/256t 1 Active ILD/OLD =OCK+ 16,+ Active SYNC =OCK+128/256.t.:J: 00 Active clock =CKI+4 01 Active clock =CKI+ 12 CLK 10 Active clock =CKI+ 16 11 Active clock =CKI+20 0 LSB first MSB 1 MSB first 0 OLD is an input (passive mode). OLD 1 OLD is an output (active mode). 0 ILD is an input (passive mode). ILD 1 ILD is an output (active mode). 0 OCK is an input (passive mode). OCK 1 OCK is an output (active mode). 0 ICK is an input (passive mode). ICK 1 ICK is an output (active mode). 0 16-bit output OLEN 1 8-bit output 0 16-bit input ILEN 1 8-bit input t Either 128 or 256 - see tdms register SYNC field. :/: Select this mode when using SADD (not necessary if ICK =OCK). D-4 PROGRAMMABLE REGISTERS Programmable Registers Table D-S. Serial ReceiveITransmit Address (srta) Register Bit I 15 - 8 I 7 - 0 Field . RECEIVE ADDRESS . TRANSMIT ADDRESS . I Field Value ResultlDescription lxxxxxxx Receive address 7 xlxxxxxx Receive address 6 xx 1xxxxx Receive address 5 xxxlxxxx Receive address 4 RECEIVE ADDRESS xxxxlxxx Receive address 3 xxxxxlxx Receive address 2 xxxxxxlx Receive address 1 xxxxxxxl Receive address 0 lxxxxxxx Transmit address 7 xlxxxxxx Transmit address 6 xxlxxxxx Transmit address 5 xxx 1xxxx Transmit address 4 TRANSMIT ADDRESS xxxxlxxx Transmit address 3 xxxxxlxx Transmit address 2 xxxxxxlx Transmit address 1 xxxxxxxl Transmit address 0 D-S PROGRAMMABLE REGISTERS Programmable Registers Table D-6. Time-Division Multiplex Slot (tdms) Register Bit I 9 8 I 7-1 I 0 I I Field : SYNCSP : MODE : TRANSMIT SLOT : SYNC : Field Value ResultlDescription 0 SYNC = ICK/OCKt + 128 :j: SYNCSP 1 SYNC = ICK/OCKt + 256 0 Multiprocessor mode off. MODE DOEN is an input (passive mode). 1 Multiprocessor mode on. DOEN is an output (active mode). lxxxxxxx Transmit slot 7. xlxxxxxx Transmit slot 6. xx 1xxxxx Transmit slot 5. TRANSMIT SLOT xxx 1xxxx Transmit slot 4. xxxx 1xxx Transmit slot 3. xxxxxlxx Transmit slot 2. xxxxxxlx Transmit slot 1. xxxxxxxi Transmit slot O. SYNC SYNC is an output (active mode). xxxxxxxO SYNC is an input (passive mode). t See sioc register, LD field in Table D-4. :f: Select this mode when in mUltiprocessor mode. D-6 <.. ; ;:1'< :~;'ii~ GLOSSARY A -law - A European standard for the Compound Addressing - A memory compression and expansion of the dynamic read/write operation using only one pointer. range of a signal. CMP - Comparator. Active mode - Certain pins on the DSP16/DSPl6A device are programmable as Cyclical addressing - See Modulo either inputs or outputs. When one of these addressing. signals is set as an output, it is in active mode. When one of these signals is set as an Data arithmetic unit (DAU) - A 16-/32-bit input, it is in passive mode. unit that is the main execution unit for signal processing algorithms. ADD-Adder. DAU - Data arithmetic unit. Addressing modes - The DSP16/DSPl6A device supports various modes for addressing, Hardware mode - When using the DSPl6 or which include immediate, indirect, and DSP16A Development System, a mode in compound. which the program has been downloaded into the development system and is being ALU - Arithmetic logic unit. executed by the actual DSPl6/DSP16A device. Hardware mode is used for real-time Arithmetic logic unit (ALU) - On-chip unit program testing. that perfonns microprocessor-like arithmetic operations. I - Increment register in XAAU. Arithmetic unit control register (auc) - A ibuf - Input buffer. register that configures some features for the data arithmetic unit. Input buffer (ibuf) - A register in the SIO unit is used to accept input from an external Assembler - A program that translates device. symbolically represented character input into a fonn (binary) that the computer can Immediate addressing mode - An interpret. addressing mode in which the operand contains the value to be operated on. No auc - Arithmetic unit control register. address reference is required. Breakpointing - The ability to have the Interrupt - A means by which external software simulator or hardware development devices may request service by the system halt and/or perfonn some command at microprocessor. a present location or when some test condition is met. I/O - Input/output. Byte - An 8-bit quantity that may appear at isr - Input shift register. any address in memory. j - Increment register in YAAU. Cache - A small, high-speed memory that can be used selectively to store repetitive k - Increment register in YAAU. operations. GLOSSARY Latency - The time required for the pc - Program counter. completion of a task once initiated. pdx(in) - Parallel I/O input register. Modulo addressing - Cyclical addressing between upper and lower bounds. pdx(out) - Parallel I/O output register. Jl-Iaw - An American standard for pi - Program interrupt register. compression and expansion of the dynamic range of a signal. pio - Parallel I/O port. MUX - Multiplexer. pioc - Parallel I/O control register. osr - Output shift register. Pipelining - Overlapping the execution of instructions to increase the DSP's Overhead - A quantity in addition to the performance. minimum required. When transmitting data, it is the bits other than information bits, e.g., pr - Program return register. check bits, framing bits, or some other procedure or format bits. When executing a Processor status word register (psw) - A program loop, it is the instructions needed to register that contains the status information control the program flow, those not involved for the data arithmetic unit. in the desired computation. Postmodification - The addition of an p - Product register. increment/decrement value to a memory pointer after each use. Parallel I/O port (pio) - A group of registers used to provide a bidirectional data link to psw - Processor status word. microprocessors and other I/O devices. pt - ROM table pointer. Parallel I/O control register (pioc) - A register that allows the specification of the RAM - Random access memory. configuration of the PIO data pins, the mode of the parallel I/O data strobe signals, and the rb - Modulo addressing register containing width of the parallel I/O data strobe signals in the beginning value of the modulo. the active mode. The pioc also contains the mask and status fields for interrupts. re - Modulo addressing register containing the end value of the modulo. re contains zero Passive mode - Certain pins on the if modulo addressing is not active. DSP16/DSP16A device are programmable as either inputs or outputs. When one of these ROM - Read only memory. signals is set as an input, it is in passive mode. When one of these signals is set as an sdx(in) - Serial I/O input register. output, it is in active mode. sdx(out) - Serial I/O output register. GLOSSARY Serial I/O (SIO) - A group of registers that Throughput - A means of relating the speed allows interfacing with other devices with with which problems, programs, or segments few, if any, external chips. It converts serial are performed. input data into parallel data and parallel data into serial output data. Time-division multiplexed (TDM) - A procedure for transmitting two or more Serial I/O control register (sioc) - A signals over a common channel through the register that allows specification of the length use of successive time intervals for different of serial input and output data words, the devices. mode of serial bit clocks and serial load signals, the bit ordering of I/O, the active x - Multiplier input register. serial I/O bit clock rate, and active load generated from either ICK or OCK. XAAU - ROM address arithmetic unit Simulator - A highly specific program that YAAU - RAM address arithmetic unit. allows the simulation in software of the logical functions of the DSP16/DSP16A yor yh - y(high) DAU register. device. yl- y(low) DAU register. SIO - Serial I/O unit. 2's complement - A method used in some sioc - Serial I/O control register. systems to represent positive and negative integers. Positive integers are identical to srta - Serial receive/transmit address register. standard binary numbers; however, negative integers are the 1's complement of a standard Stack - An area of reserved memory used for binary number plus one. storing the program counter and contents of registers during a program interrupt. 3-state - To place an output in a high- impedance state. SHIFT - Shifter. tdms - Serial I/O time-division multiplexed slot register. INDEX A control instructions, 3-1, 3-14-3-16, C-4 formats, A-2 accumulaU)rs(a~3),2-7 statements, 3-15 active clock generator, 5-3 counters cO-c2, 2-8 active mode, 6-2, 6-5, 6-7 input, 6-10 D output, 6-11 adder (XAAU), 2-4 DAU, see data arithmetic unit adder (yAAU), 2-6 data arithmetic unit (DAU), 2-6 address arithmetic units, 2-4 data move instructions, 3-1, 3-16--3-18, addressing modes, 3-2 C-4-C-5 ALU, see arithmetic logic unit formats, A-2-A-3 application deve1opment, 1-2 statements, 3-18 architecture, 1-1,2-1 device number, 5-10 arithmetic, 2-9 do instruction, C-6 arithmetic bit alignment, 2-9-2-12 documentation, 1-4 arithmetic logic unit (ALU), 1-1,2-7,2-9 double-buffering, 5-2 diadic functions, 2-7 DSPI6,1-1 monadic functions, 2-7 development system, 1-3,7-13 arithmetic unit control (auc) register, DSPI6A,I-1 2-8,2-10, D-l development system, 1-3,7-13 CLR field, 2-9 SAT field, 2-8 E assembly language, 4-1 electrical characteristics, 7-12 AT&T Bulletin Board, 1-5 EXM signal, 7-13 auc register, see arithmetic unit extemalmemory, 7-13 control register interface timing, 7-13 B F bit reversal, 2-13 features, bit-reversal mode, 5-1 DSPI6,1-1 block diagram, 2-1 DSPI6A,I-1 broadcast mode, 5-11 c G guard bits, 2-7 cache, 1-2,2-3 cache instructions, 2-3, 3-1, H 3-18-3-19, C-6 formats, A-3 hardware mode, 1-3 statements, 3-19 CKI signal, 5-3 I clock speed, 5-3 codec interface, 5-7, 5-8 i register, see static offset register comments, 4-1-4-2 ibuf, see input buffer register compound addressing instructions, 3-4 icall instruction, 2-15, 3-14, 4-6, C-4 concurrent interrupts, mF signal, 5-2 see interrupts, concurrent ICK signal, 5-2, 5-3 conditional mnemonics, 3-5, C-l if instruction, 3-12 control block, 2-3 ifc instruction, 3-12 INDEX ifsr, see input flag shift register I/O timing, 4-4 ILD signal, 5-2,5-3 isr, see input data shift register immediate addressing, 3-2 ISR, see interrupt service routine indirect addressing, 3-2 input buffer register, 5-1, 5-2 J input data shift register, 5-2 input flag shift register, 5-1 j register, see offset registers instruction set, 1-2, 3-1 ambiguities, 4-3 K characteristics, C-l k register, see offset registers encoding, A-I fonnats, A-I-A-3 L replacement tables, A -4--A-7 notation, 3-1-3-2 labels, 4-2 mnemonics, 3-3 latent reads, 6-5 summary, 3-20:-3-59, C-l LEQ, see logical equal syntax, 3-1 LLV, see logical overflow integer notation, 4-1 LMI, see logical minus decimal, 4-1 LMV, see mathematical overflow fixed-point, 4-1 logical equal (LEQ), 3-4 hexadecimal, 4-1 logical minus (LMI), 3-4 octal,4-1 logical overflow (LLV), 3-4 interfacing, 7-1 interrupt conditions, 2-15 M mF condition, 2-15, 4-4, 5-7 !NT condition, 2-15 mathematical overflow (LMV), 3-5 OBE condition, 2-15 maximum ratings, 7-12 PIDS condition, 2-15 memory, 1-2,2-2 PODS condition, 2-15 maps, 2-2 interrupt hardware, 2-16 on-chip, 1-2,2-2 !NT signal, 2-16, 4-8, 4-9,6-3, modulo addressing, 3-3, 4-5 6-4,7-14 multiplier (DAU), 2-6 lACK signal, 2-16,4-8,4-9,6-4, multiply/ALU instructions, 3-1, 6-9,7-14 3-6--3-12, C-2 interrupt service routine (ISR), 2-17, fonnats, A-I 4-6,6-8 function statements, 3-6, 3-9 interrupt software, 2-17 transfer statements, 3-6, 3-10 mF bits (Pioc), 2-17 multiprocessor mode, 5-10 !NT bit (Pioc), 2-17, 4-8,7-14 communications, 5-15 OBE bit (pioc), 2-17 connections, 5-11 PIDS bit (pioc), 2-17 suggested configuration, 5-16 PODS bit (pioc), 2-17 interrupts, 2-15, 6-3 N concurrent, 4-7---4-11 no operation instruction, 3-7, 3-12 control, 7-14 nop instruction, see no operation internal, 6-9 instruction latency, 4-11 noninterruptible instructions, 2-17, 4-11 masking, 6-3 paralIell/0, 6-9 timing, 7-14 INDEX o pin descriptions, 7-2-7-11 external memory interface group, 7-7 obuf, see output buffer register miscellaneous function group, 7-10 OCK signal, 5-2, 5-3 numerical order, 7-2-7-6 offset registers PIO interface group, 7-9-7-10 j register, 2-6, 3-2 power and ground group, 7-11 k register, 2-6, 3-2 SIO interface group, 7-8-7-9 ofsr, see output flag shift register pin diagram, 7-1 OLD signal, 5-2, 5-3 pin names, 7-2 optional mnemonics, 4-4 PIO, see parallel I/O OSE signal, 5-2 pioc, see parallel I/O control word osr, see output data shift register register output buffer register, 5-1 PODS signal, 6-3, 6-8, 6-9, 6-11, 6-13 output data shift register, 5-2 polling I/O, 4-4 output flag shift register, 5-1 pr register, see program return register PRBS, see pseudorandom binary p sequence precision, 2-9,4-2 p register, see product register processor flags, 3-4 package outlme, 7-15 processor status word (psw) register, 2-8, parallel input register, 6-5 2-9,0-2 parallel I/O (PIO), 6-1 product (P) register, 2-6, 2-9, 2-10 access times, 6-1 programming, 4-1 bus transactions examples, B-I-B-9 data strobes, 2-14,6-6 techniques, 4-3-4-11 interaccess timing, 6-14 tips, 4-5--4-7 signals, 6-6---6-7 program counter (PC) register, 2-4, 4-6 strobe widths, 6-7 program interrupt (Pi) register, 2-4, 4-5, parallel 1/0 address line (psel), 2-14 4-6 parallel I/O control word (Pioc) program return (pr) register, 2-4, 4-6 register, 2-14, 2-15, 2-16, 4-8, 6-1, PSEL signal, 6-1, 6-3, 6-10, 6-11 6-2-6-4,6-6, D-3 psel, see paralll/O address line mF field, 5-2 pseudorandom binary sequence (PRBS), mF status bit, 5-1, 5-2, 5-11 4-5 IN1ERRUPI'S field, 6-4 psw register, see processor status word OBE status bit, 5-1, 5-2 register parallel I/O data bus (PDB), 2-14, 6-6, pt register, see table pointer register 6-10,6-11,6-12,6-13 parallel I/O port, 1-2,2-14,2-15 R passive mode, 6-2, 6-4, 6-8, 6-9 input, 6-12 rO-r3 pointer registers, 2-6, 3-2 output, 6-13 RAM,2-3 pc register, see program counter register RAM address arithmetic unit (YAAU), PDB, see parallel I/O data bus 2-5, 2-6, 4-6, C-4 pdxO and pdxl, 2-14, 6-1, 6-4, 6-5, 6-9 RAM variables, 4-2-4-3 pi register, see program interrupt random numbers, 4-5 register rb register, 2-6, 3-2, 3-3,4-5 PIDS signal, 6-3, 6-8, 6-10, 6-12 re register, 2-6, 3-2, 3-3, 4-5 redo instruction, C-6 register loads, 2-8 INDEX reset control, 7-14 source file, 4-1, 4-3 reset timing, 7-14 special function instructions, 3-1, ROM,2-2 3-12-3-14, C-3 data storage, 4-2 formats, A-I initialization, 4-2 statements, 3-13 ROM address arithmetic unit (XAAU), srta register, see serial receive/transmit 2-4,2-5,4-6,7-13 address register RSTB signal, 6-4, 7-14 static offset (i) register, 2-4 status and control mode, 6-3, 6-8 s support software library, 1-3, 4-4 SYNC signal, 5-3, 5-12 SADD signal, 5-3 synchronization clock, 2-13 saturation, 2-8 serial I/O (SIO), 5-1 T bit clocks, 2-13 data length, 2-13 table pointer (Pt) register, 2-4, 4-6, 4-7 data path, 5-1 tdms register, see time-division input section, 5-2 multiplexed register load signals, 2-13 technical assistance, 1-5 pin descriptions, 5-5-5-7 time-division multiplexed slot (tdms) operation, 5-2 register, 2-13,5-1,5-10,5-12, D-6 output section, 5-2 timing characteristics, 7-1 programming example, 5-7 timing, 5-17-5-20 v transfers, 2-13 serial I/O control (sioc) register, 2-13, virtual shift addressing mode, 2-6, 3-3, 5-1,5-4, D-4 3-4 LD field, 5-3 serial I/O port, 1-2,2-13,2-14 x serial receive/transmit address (srta) x register, 2-6 register, 2-13, 5-1, 5-10, 5-13, D-5 XAAU, see ROM address arithmetic unit shadow register, 2-4 simulation mode, 1-3 y simulator/accelerator mode, 1-3 SIO, see serial I/O y register, 2-6, 2-7, 2-9, 4-4 sioc, see serial I/O control register YAAU, see RAM address arithmetic unit software simulator, 1-3 yl,2-7