Tms 320 C 5 X
Tms 320 C 5 X
IMPORTANT NOTICE Texas Instruments (TI) reserves the right to make changes to its products or to discontinue any semiconductor product or service without notice, and advises its customers to obtain the latest version of relevant information to verify, before placing orders, that the information being relied on is current. TI warrants performance of its semiconductor products and related software to the specifications applicable at the time of sale in accordance with TIs standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements. Certain applications using semiconductor products may involve potential risks of death, personal injury, or severe property or environmental damage (Critical Applications). TI SEMICONDUCTOR PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED, OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT APPLICATIONS, DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS. Inclusion of TI products in such applications is understood to be fully at the risk of the customer. Use of TI products in such applications requires the written approval of an appropriate TI officer. Questions concerning potential risk applications should be directed to TI through a local SC sales office. In order to minimize risks associated with the customers applications, adequate design and operating safeguards should be provided by the customer to minimize inherent or procedural hazards. TI assumes no liability for applications assistance, customer product design, software performance, or infringement of patents or services described herein. Nor does TI warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such semiconductor products or services might be or are used.
Preface
iii
If you are looking for information about: Pinouts Pipeline operation Program control Serial ports Status registers Timer Upgrading from a C25 Wait-state generators XDS510 Emulator
Turn to: Appendix A, Pinouts and Signal Descriptions Chapter 7, Pipeline Chapter 4, Program Control Chapter 9, On-Chip Peripherals Chapter 4, Program Control Chapter 9, On-Chip Peripherals Appendix C, System Migration Chapter 9, On-Chip Peripherals Appendix D, Design Considerations for Using XDS510 Emulator
Notational Conventions
This document uses the following conventions.
- Program listings, program examples, and interactive displays are shown
in a special typeface similar to a typewriters. Examples use a bold version of the special typeface for emphasis; interactive displays use a bold version of the special typeface to distinguish commands that you enter from items that the system displays (such as prompts, command output, error messages, etc.). Here is a sample program listing:
0011 0012 0013 0014 0005 0005 0005 0006 0001 0003 0006 .field .field .field .even 1, 2 3, 4 6, 3
Here is an example of a system prompt and a command that you might enter:
C: csr a /user/ti/simuboard/utilities
typeface font and parameters are in an italic typeface. Portions of a syntax that are in bold should be entered as shown; portions of a syntax that are in italics describe the type of information that should be entered. Here is an example of a directive syntax: .asect section name, address .asect is the directive. This directive has two parameters, indicated by section name and address. When you use .asect, the first parameter must be
iv
Notational Conventions
an actual section name, enclosed in double quotes; the second parameter must be an address.
- Square brackets ( [ and ] ) identify an optional parameter. If you use an
optional parameter, you specify the information within the brackets; you dont enter the brackets themselves. Heres an example of an instruction that has an optional parameter: LALK 16bit constant [, shift] The LALK instruction has two parameters. The first parameter, 16-bit constant, is required. The second parameter, shift, is optional. As this syntax shows, if you use the optional second parameter, you must precede it with a comma. Square brackets are also used as part of the pathname specification for VMS pathnames; in this case, the brackets are actually part of the pathname (they are not optional).
- Braces ( { and } ) indicate a list. The symbol | (read as or) separates items
within the list. Heres an example of a list: { * | *+ | * } This provides three choices: *, *+, or *. Unless the list is enclosed in square brackets, you must choose one item from the list.
- Some directives can have a varying number of parameters. For example,
the .byte directive can have up to 100 parameters. The syntax for this directive is: .byte value1 [, ... , valuen ] This syntax shows that .byte must have at least one value parameter, but you have the option of supplying additional value parameters, separated by commas.
Information About Cautions and Warnings / Related Documentaiton From Texas Instruments Information About Cautions and Warnings
This is an example of a caution statement. A caution statement describes a situation that could potentially damage your software or equipment.
The information in a caution is provided for your protection. Please read each caution and warning carefully.
TMS320C5x General-Purpose Applications Users Guide (literature number SPRU164) serves as a reference book for developing hardware and/ or software applications for the C5x generation of devices. TMS320C5x, TMS320LC5x Digital Signal Processors (literature number SPRS030) data sheet contains the electrical and timing specifications for these devices, as well as signal descriptions and pinouts for all of the available packages. TMS320C1x/C2x/C2xx/C5x Code Generation Tools Getting Started Guide (literature number SPRU121) describes how to install the TMS320C1x, TMS320C2x, TMS320C2xx, and TMS320C5x assembly language tools and the C compiler for the C1x, C2x, C2xx, and C5x devices. The installation for MS-DOS, OS/2, SunOS, and Solaris systems is covered. TMS320C1x/C2x/C2xx/C5x Assembly Language Tools Users Guide (literature number SPRU018) describes the assembly language tools (assembler, linker, and other tools used to develop assembly language code), assembler directives, macros, common object file format, and symbolic debugging directives for the C1x, C2x, C2xx, and C5x generations of devices.
vi
TMS320C2x/C2xx/C5x Optimizing C Compiler Users Guide (literature number SPRU024) describes the C2x/C2xx/C5x C compiler. This C compiler accepts ANSI standard C source code and produces TMS320 assembly language source code for the C2x, C2xx, and C5x generations of devices. TMS320C5x C Source Debugger Users Guide (literature number SPRU055) tells you how to invoke the C5x emulator, evaluation module, and simulator versions of the C source debugger interface. This book discusses various aspects of the debugger interface, including window management, command entry, code execution, data management, and breakpoints. It also includes a tutorial that introduces basic debugger functionality. TMS320C5x Evaluation Module Technical Reference (literature number SPRU087) describes the C5x evaluation module, its features, design details and external interfaces. TMS320C5x Evaluation Module Getting Started Guide (literature number SPRU126) tells you how to install the MS-DOS, PC-DOS, and Windows versions of the C5x evaluation module. TMS320C54x Simulator Getting Started Guide (literature number SPRU137) describes how to install the TMS320C54x simulator and the C source debugger for the C54x. The installation for Windows 3.1, SunOS, and HP-UX systems is covered. XDS51x Emulator Installation Guide (literature number SPNU070) describes the installation of the XDS510, XDS510PP, and XDS510WS emulator controllers. The installation of the XDS511 emulator is also described. JTAG/MPSD Emulation Technical Reference (literature number SPDU079) provides the design requirements of the XDS510 emulator controller, discusses JTAG designs (based on the IEEE 1149.1 standard), and modular port scan device (MPSD) designs. TMS320 Third-Party Support Reference Guide (literature number SPRU052) alphabetically lists over 100 third parties that provide various products that serve the family of TMS320 digital signal processors. A myriad of products and applications are offeredsoftware and hardware development tools, speech recognition, image processing, noise cancellation, modems, etc.
Read This First
vii
TMS320 DSP Development Support Reference Guide (literature number SPRU011) describes the TMS320 family of digital signal processors and the tools that support these devices. Included are code-generation tools (compilers, assemblers, linkers, etc.) and system integration and debug tools (simulators, emulators, evaluation modules, etc.). Also covered are available documentation, seminars, the university program, and factory repair and exchange.
If you are an assembly language programmer and would like more information about C or C expressions, you may find this book useful:
The C Programming Language (second edition, 1988), by Brian W. Kernighan and Dennis M. Ritchie, published by Prentice-Hall, Englewood Cliffs, New Jersey.
Technical Articles
A wide variety of related documentation is available on digital signal processing. These references fall into one of the following application categories:
-
General-Purpose DSP Graphics/Imagery Speech/Voice Control Multimedia Military Telecommunications Automotive Consumer Medical Development Support
In the following list, references appear in alphabetical order according to author. The documents contain beneficial information regarding designs, operations, and applications for signal-processing systems; all of the documents provide additional references. Texas Instruments strongly suggests that you refer to these publications.
General-Purpose DSP:
1) Antoniou, A., Digital Filters: Analysis and Design, New York, NY: McGrawHill Company, Inc., 1979. 2) Brigham, E.O., The Fast Fourier Transform, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1974.
viii
Technical Articles
3) Burrus, C.S., and T.W. Parks, DFT/FFT and Convolution Algorithms, New York, NY: John Wiley and Sons, Inc., 1984. 4) Chassaing, R., Horning, D.W., Digital Signal Processing with Fixed and Floating-Point Processors. CoED, USA, Volume 1, Number 1, pages 14, March 1991. 5) Defatta, David J., Joseph G. Lucas, and William S. Hodgkiss, Digital Signal Processing: A System Design Approach, New York: John Wiley, 1988. 6) Erskine, C., and S. Magar, Architecture and Applications of a SecondGeneration Digital Signal Processor. Proceedings of IEEE International Conference on Acoustics, Speech, and Signal Processing, USA, 1985. 7) Essig, D., C. Erskine, E. Caudel, and S. Magar, A Second-Generation Digital Signal Processor. IEEE Journal of Solid-State Circuits, USA, Volume SC21, Number 1, pages 8691, February 1986. 8) Frantz, G., K. Lin, J. Reimer, and J. Bradley, The Texas Instruments TMS320C25 Digital Signal Microcomputer. IEEE Microelectronics, USA, Volume 6, Number 6, pages 1028, December 1986. 9) Gass, W., R. Tarrant, T. Richard, B. Pawate, M. Gammel, P. Rajasekaran, R. Wiggins, and C. Covington, Multiple Digital Signal Processor Environment for Intelligent Signal Processing. Proceedings of the IEEE, USA, Volume 75, Number 9, pages 12461259, September 1987. 10) Gold, Bernard, and C.M. Rader, Digital Processing of Signals, New York, NY: McGraw-Hill Company, Inc., 1969. 11) Hamming, R.W., Digital Filters, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1977. 12) IEEE ASSP DSP Committee (Editor), Programs for Digital Signal Processing, New York, NY: IEEE Press, 1979. 13) Jackson, Leland B., Digital Filters and Signal Processing, Hingham, MA: Kluwer Academic Publishers, 1986. 14) Jones, D.L., and T.W. Parks, A Digital Signal Processing Laboratory Using the TMS32010, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1987. 15) Lim, Jae, and Alan V. Oppenheim, Advanced Topics in Signal Processing, Englewood Cliffs, NJ: Prentice- Hall, Inc., 1988. 16) Lin, K., G. Frantz, and R. Simar, Jr., The TMS320 Family of Digital Signal Processors. Proceedings of the IEEE, USA, Volume 75, Number 9, pages 11431159, September 1987.
Read This First
ix
Technical Articles
17) Lovrich, A., Reimer, J., An Advanced Audio Signal Processor. Digest of Technical Papers for 1991 International Conference on Consumer Electronics, June 1991. 18) Magar, S., D. Essig, E. Caudel, S. Marshall and R. Peters, An NMOS Digital Signal Processor with Multiprocessing Capability. Digest of IEEE International Solid-State Circuits Conference, USA, February 1985. 19) Morris, Robert L., Digital Signal Processing Software, Ottawa, Canada: Carleton University, 1983. 20) Oppenheim, Alan V. (Editor), Applications of Digital Signal Processing, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1978. 21) Oppenheim, Alan V., and R.W. Schafer, Digital Signal Processing, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1975 and 1988. 22) Oppenheim, A.V., A.N. Willsky, and I.T. Young, Signals and Systems, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1983. 23) Papamichalis, P.E., and C.S. Burrus, Conversion of Digit-Reversed to BitReversed Order in FFT Algorithms. Proceedings of ICASSP 89, USA, pages 984987, May 1989. 24) Papamichalis, P., and R. Simar, Jr., The TMS320C30 Floating-Point Digital Signal Processor. IEEE Micro Magazine, USA, pages 1329, December 1988. 25) Parks, T.W., and C.S. Burrus, Digital Filter Design, New York, NY: John Wiley and Sons, Inc., 1987. 26) Peterson, C., Zervakis, M., Shehadeh, N., Adaptive Filter Design and Implementation Using the TMS320C25 Microprocessor. Computers in Education Journal, USA, Volume 3, Number 3, pages 1216, July September 1993. 27) Prado, J., and R. Alcantara, A Fast Square-Rooting Algorithm Using a Digital Signal Processor. Proceedings of IEEE, USA, Volume 75, Number 2, pages 262264, February 1987. 28) Rabiner, L.R. and B. Gold, Theory and Applications of Digital Signal Processing, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1975. 29) Simar, Jr., R., and A. Davis, The Application of High-Level Languages to Single-Chip Digital Signal Processors. Proceedings of ICASSP 88, USA, Volume D, page 1678, April 1988. 30) Simar, Jr., R., T. Leigh, P. Koeppen, J. Leach, J. Potts, and D. Blalock, A 40 MFLOPS Digital Signal Processor: the First Supercomputer on a Chip. Proceedings of ICASSP 87, USA, Catalog Number 87CH2396 0, Volume 1, pages 535538, April 1987.
x
Technical Articles
31) Simar, Jr., R., and J. Reimer, The TMS320C25: a 100 ns CMOS VLSI Digital Signal Processor. 1986 Workshop on Applications of Signal Processing to Audio and Acoustics, September 1986. 32) Texas Instruments, Digital Signal Processing Applications with the TMS320 Family, 1986; Englewood Cliffs, NJ: Prentice-Hall, Inc., 1987. 33) Treichler, J.R., C.R. Johnson, Jr., and M.G. Larimore, A Practical Guide to Adaptive Filter Design, New York, NY: John Wiley and Sons, Inc., 1987.
Graphics/Imagery:
1) Andrews, H.C., and B.R. Hunt, Digital Image Restoration, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1977. 2) Gonzales, Rafael C., and Paul Wintz, Digital Image Processing, Reading, MA: Addison-Wesley Publishing Company, Inc., 1977. 3) Papamichalis, P.E., FFT Implementation on the TMS320C30. Proceedings of ICASSP 88, USA, Volume D, page 1399, April 1988. 4) Pratt, William K., Digital Image Processing, New York, NY: John Wiley and Sons, 1978. 5) Reimer, J., and A. Lovrich, Graphics with the TMS32020. WESCON/85 Conference Record, USA, 1985.
Speech/Voice:
1) DellaMorte, J., and P. Papamichalis, Full-Duplex Real-Time Implementation of the FED-STD-1015 LPC-10e Standard V.52 on the TMS320C25. Proceedings of SPEECH TECH 89, pages 218221, May 1989. 2) Frantz, G.A., and K.S. Lin, A Low-Cost Speech System Using the TMS320C17. Proceedings of SPEECH TECH 87, pages 2529, April 1987. 3) Gray, A.H., and J.D. Markel, Linear Prediction of Speech, New York, NY: Springer-Verlag, 1976. 4) Jayant, N.S., and Peter Noll, Digital Coding of Waveforms, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1984. 5) Papamichalis, Panos, Practical Approaches to Speech Coding, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1987. 6) Papamichalis, P., and D. Lively, Implementation of the DOD Standard LPC10/52E on the TMS320C25. Proceedings of SPEECH TECH 87, pages 201204, April 1987. 7) Pawate, B.I., and G.R. Doddington, Implementation of a Hidden Markov Model-Based Layered Grammar Recognizer. Proceedings of ICASSP 89, USA, pages 801 804, May 1989.
Read This First
xi
Technical Articles
8) Rabiner, L.R., and R.W. Schafer, Digital Processing of Speech Signals, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1978. 9) Reimer, J.B. and K.S. Lin, TMS320 Digital Signal Processors in Speech Applications. Proceedings of SPEECH TECH 88, April 1988. 10) Reimer, J.B., M.L. McMahan, and W.W. Anderson, Speech Recognition for a Low-Cost System Using a DSP. Digest of Technical Papers for 1987 International Conference on Consumer Electronics, June 1987.
Control:
1) Ahmed, I., 16-Bit DSP Microcontroller Fits Motion Control System Application. PCIM, October 1988. 2) Ahmed, I., Implementation of Self Tuning Regulators with TMS320 Family of Digital Signal Processors. MOTORCON 88, pages 248262, September 1988. 3) Ahmed, I., and S. Lindquist, Digital Signal Processors: Simplifying HighPerformance Control. Machine Design, September 1987. 4) Ahmed, I., and S. Meshkat, Using DSPs in Control. Control Engineering, February 1988. 5) Allen, C. and P. Pillay, TMS320 Design for Vector and Current Control of AC Motor Drives. Electronics Letters, UK, Volume 28, Number 23, pages 21882190, November 1992. 6) Bose, B.K., and P.M. Szczesny, A Microcomputer-Based Control and Simulation of an Advanced IPM Synchronous Machine Drive System for Electric Vehicle Propulsion. Proceedings of IECON 87, Volume 1, pages 454463, November 1987. 7) Hanselman, H., LQG-Control of a Highly Resonant Disc Drive Head Positioning Actuator. IEEE Transactions on Industrial Electronics, USA, Volume 35, Number 1, pages 100104, February 1988. 8) Jacquot, R., Modern Digital Control Systems, New York, NY: Marcel Dekker, Inc., 1981. 9) Katz, P., Digital Control Using Microprocessors, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1981. 10) Kuo, B.C., Digital Control Systems, New York, NY: Holt, Reinholt, and Winston, Inc., 1980. 11) Lovrich, A., G. Troullinos, and R. Chirayil, An All-Digital Automatic Gain Control. Proceedings of ICASSP 88, USA, Volume D, page 1734, April 1988.
xii
Technical Articles
12) Matsui, N. and M. Shigyo, Brushless DC Motor Control Without Position and Speed Sensors. IEEE Transactions on Industry Applications, USA, Volume 28, Number 1, Part 1, pages 120127, JanuaryFebruary 1992. 13) Meshkat, S., and I. Ahmed, Using DSPs in AC Induction Motor Drives. Control Engineering, February 1988. 14) Panahi, I. and R. Restle, DSPs Redefine Motion Control. Motion Control Magazine, December 1993. 15) Phillips, C., and H. Nagle, Digital Control System Analysis and Design, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1984.
Multimedia:
1) Reimer, J., DSP-Based Multimedia Solutions Lead Way Enhancing Audio Compression Performance. Dr. Dobbs Journal, December 1993. 2) Reimer, J., G. Benbassat, and W. Bonneau Jr., Application Processors: Making PC Multimedia Happen. Silicon Valley PC Design Conference, July 1991.
Military:
1) Papamichalis, P., and J. Reimer, Implementation of the Data Encryption Standard Using the TMS32010. Digital Signal Processing Applications, 1986.
Telecommunications:
1) Ahmed, I., and A. Lovrich, Adaptive Line Enhancer Using the TMS320C25. Conference Records of Northcon/86, USA, 14/3/110, September/October 1986. 2) Casale, S., R. Russo, and G. Bellina, Optimal Architectural Solution Using DSP Processors for the Implementation of an ADPCM Transcoder. Proceedings of GLOBECOM 89, pages 12671273, November 1989. 3) Cole, C., A. Haoui, and P. Winship, A High-Performance Digital Voice Echo Canceller on a SINGLE TMS32020. Proceedings of ICASSP 86, USA, Catalog Number 86CH22434, Volume 1, pages 429432, April 1986. 4) Cole, C., A. Haoui, and P. Winship, A High-Performance Digital Voice Echo Canceller on a Single TMS32020. Proceedings of IEEE International Conference on Acoustics, Speech and Signal Processing, USA, 1986. 5) Lovrich, A., and J. Reimer, A Multi-Rate Transcoder. Transactions on Consumer Electronics, USA, November 1989.
Read This First
xiii
Technical Articles
6) Lovrich, A. and J. Reimer, A Multi-Rate Transcoder. Digest of Technical Papers for 1989 International Conference on Consumer Electronics, June 79, 1989. 7) Lu, H., D. Hedberg, and B. Fraenkel, Implementation of High-Speed Voiceband Data Modems Using the TMS320C25. Proceedings of ICASSP 87, USA, Catalog Number 87CH23960, Volume 4, pages 19151918, April 1987. 8) Mock, P., Add DTMF Generation and Decoding to DSP P Designs. Electronic Design, USA, Volume 30, Number 6, pages 205213, March 1985. 9) Reimer, J., M. McMahan, and M. Arjmand, ADPCM on a TMS320 DSP Chip. Proceedings of SPEECH TECH 85, pages 246249, April 1985. 10) Troullinos, G., and J. Bradley, Split-Band Modem Implementation Using the TMS32010 Digital Signal Processor. Conference Records of Electro/86 and Mini/Micro Northeast, USA, 14/1/121, May 1986.
Automotive:
1) Lin, K., Trends of Digital Signal Processing in Automotive. International Congress on Transportation Electronic (CONVERGENCE 88), October 1988.
Consumer:
1) Frantz, G.A., J.B. Reimer, and R.A. Wotiz, Julie, The Application of DSP to a Product. Speech Tech Magazine, USA, September 1988. 2) Reimer, J.B., and G.A. Frantz, Customization of a DSP Integrated Circuit for a Customer Product. Transactions on Consumer Electronics, USA, August 1988. 3) Reimer, J.B., P.E. Nixon, E.B. Boles, and G.A. Frantz, Audio Customization of a DSP IC. Digest of Technical Papers for 1988 International Conference on Consumer Electronics, June 810 1988.
Medical:
1) Knapp and Townshend, A Real-Time Digital Signal Processing System for an Auditory Prosthesis. Proceedings of ICASSP 88, USA, Volume A, page 2493, April 1988. 2) Morris, L.R., and P.B. Barszczewski, Design and Evolution of a PocketSized DSP Speech Processing System for a Cochlear Implant and Other Hearing Prosthesis Applications. Proceedings of ICASSP 88, USA, Volume A, page 2516, April 1988.
xiv
Development Support:
1) Mersereau, R., R. Schafer, T. Barnwell, and D. Smith, A Digital Filter Design Package for PCs and TMS320. MIDCON/84 Electronic Show and Convention, USA, 1984. 2) Simar, Jr., R., and A. Davis, The Application of High-Level Languages to Single-Chip Digital Signal Processors. Proceedings of ICASSP 88, USA, Volume 3, pages 16781681, April 1988.
Trademarks
DuPont Electronics is a registered trademark of E.I. DuPont Corporation. HP-UX is a trademark of Hewlett-Packard Company. IBM, OS/2, and PC-DOS are trademarks of International Business Machines Corporation. MS and Windows are registered trademarks of Microsoft Corporation. Solaris and SunOS are trademarks of Sun Microsystems, Inc. SPARC is a trademark of SPARC International, Inc., but licensed exclusively to Sun Microsystems, Inc. 320 Hotline On-line, TI, XDS510, and XDS510WS are trademarks of Texas Instruments Incorporated. VAX and VMS are trademarks of Digital Equipment Corp.
xv
Email: dsph@ti.com
Fax: +49 81 61 80 40 10
Asia-Pacific
Literature Response Center +852 2 956 7288 Fax: +852 2 956 2200 Hong Kong DSP Hotline +852 2 956 7268 Fax: +852 2 956 1002 Korea DSP Hotline +82 2 551 2804 Fax: +82 2 551 2828 Korea DSP Modem BBS +82 2 551 2914 Singapore DSP Hotline Fax: +65 390 7179 Taiwan DSP Hotline +886 2 377 1450 Fax: +886 2 377 2718 Taiwan DSP Modem BBS +886 2 376 2592 Taiwan DSP Internet BBS via anonymous ftp to ftp://dsp.ee.tit.edu.tw/pub/TI/
Japan
Product Information Center +0120-81-0026 (in Japan) +03-3457-0972 or (INTL) 813-3457-0972 DSP Hotline +03-3769-8735 or (INTL) 813-3769-8735 DSP BBS via Nifty-Serve Type Go TIASP Fax: +0120-81-0036 (in Japan) Fax: +03-3457-1259 or (INTL) 813-3457-1259 Fax: +03-3457-7071 or (INTL) 813-3457-7071
Documentation
When making suggestions or reporting errors in documentation, please include the following information that is on the title page: the full title of the book, the publication date, and the literature number. Mail: Texas Instruments Incorporated Email: dsph@ti.com Technical Documentation Services, MS 702 P.O. Box 1443 Houston, Texas 77251-1443
Note:
When calling a Literature Response Center to order documentation, please specify the literature number of the book.
xvi
Contents
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 Summarizes the features of the TMS320 family of products and presents typical applications. Describes the TMS320C5x DSP and lists its key features. 1.1 TMS320 Family Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 History, Development, and Advantages of TMS320 DSPs . . . . . . . . . . . . . . . . . 1.1.2 TMS320 Typical Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TMS320C5x Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TMS320C5x Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 1 2 2 4 5 7
1.2 1.3 2
Architectural Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1 Summarizes the TMS320C5x architecture. Provides general information about the bus structure, CPU, internal memory organization, on-chip peripherals, and scanning logic. 2.1 2.2 Bus Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 Central Processing Unit (CPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 4 2.2.1 Central Arithmetic Logic Unit (CALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 4 2.2.2 Parallel Logic Unit (PLU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 4 2.2.3 Auxiliary Register Arithmetic Unit (ARAU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5 2.2.4 Memory-Mapped Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5 2.2.5 Program Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5 On-Chip Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 6 2.3.1 Program ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 6 2.3.2 Data/Program Dual-Access RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 6 2.3.3 Data/Program Single-Access RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 7 2.3.4 On-Chip Memory Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 7 On-Chip Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8 2.4.1 Clock Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8 2.4.2 Hardware Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8 2.4.3 Software-Programmable Wait-State Generators . . . . . . . . . . . . . . . . . . . . . . . . . 2 8 2.4.4 Parallel I/O Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 9 2.4.5 Host Port Interface (HPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 9 2.4.6 Serial Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 10 2.4.7 Buffered Serial Port (BSP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 10 2.4.8 TDM Serial Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 10 2.4.9 User-Maskable Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 10 Test/Emulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 11
xvii
2.3
2.4
2.5
Contents
Central Processing Unit (CPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 Describes the TMS320C5x CPU operations. Includes information about the central arithmetic logic unit, the parallel logic unit, and the auxiliary register arithmetic unit. Also provides a summary of registers. 3.1 3.2 Functional Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Central Arithmetic Logic Unit (CALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 7 3.2.1 Multiplier, Product Register (PREG), and Temporary Register 0 (TREG0) . . . 3 7 3.2.2 Arithmetic Logic Unit (ALU) and Accumulators . . . . . . . . . . . . . . . . . . . . . . . . . 3 11 3.2.3 Scaling Shifters and Temporary Register 1 (TREG1) . . . . . . . . . . . . . . . . . . . . 3 14 Parallel Logic Unit (PLU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 15 Auxiliary Register Arithmetic Unit (ARAU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 17 Summary of Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 21 3.5.1 Auxiliary Registers (AR0AR7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 21 3.5.2 Auxiliary Register Compare Register (ARCR) . . . . . . . . . . . . . . . . . . . . . . . . . . 3 21 3.5.3 Block Move Address Register (BMAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 21 3.5.4 Block Repeat Registers (RPTC, BRCR, PASR, PAER) . . . . . . . . . . . . . . . . . . 3 21 3.5.5 Buffered Serial Port Registers (ARR, AXR, BKR, BKX, SPCE) . . . . . . . . . . . . 3 22 3.5.6 Circular Buffer Registers (CBSR1, CBER1, CBSR2, CBER2, CBCR) . . . . . . 3 22 3.5.7 Dynamic Bit Manipulation Register (DBMR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 22 3.5.8 Global Memory Allocation Register (GREG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 23 3.5.9 Host Port Interface Registers (HPIC, HPIA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 23 3.5.10 Index Register (INDX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 23 3.5.11 I/O Space (PA0PA15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 23 3.5.12 Instruction Register (IREG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 23 3.5.13 Interrupt Registers (IMR, IFR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 23 3.5.14 Processor Mode Status Register (PMST) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 24 3.5.15 Product Register (PREG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 24 3.5.16 Serial Port Interface Registers (SPC, DRR, DXR, XSR, RSR) . . . . . . . . . . . . 3 24 3.5.17 Software-Programmable Wait-State Registers (PDWSR, IOWSR, CWSR) . 3 24 3.5.18 Status Registers (ST0, ST1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 25 3.5.19 Temporary Registers (TREG0, TREG1, TREG2) . . . . . . . . . . . . . . . . . . . . . . . . 3 25 3.5.20 Timer Registers (TIM, PRD, TCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 25 3.5.21 TDM Serial Port Registers (TRCV, TDXR, TSPC, TCSR, TRTA, TRAD, TRSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 25
Program Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1 Describes the TMS320C5x program control mechanisms. Includes information about the program counter, the hardware stack, address generation, status and control registers, interrupts, reset, and power-down modes. 4.1 4.2 4.3 4.4 Program Counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hardware Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program-Memory Address Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Status and Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.1 Circular Buffer Control Register (CBCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4 4 4 4 2 4 5 6 6
xviii
Contents
4.5
4.6 4.7
4.8
4.9 4.10
4.4.2 Processor Mode Status Register (PMST) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 7 4.4.3 Status Registers (ST0 and ST1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 10 Conditional Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 17 4.5.1 Conditional Branch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 17 4.5.2 Conditional Call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 18 4.5.3 Conditional Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 18 4.5.4 Multiconditional Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 18 4.5.5 Delayed Conditional Branches, Calls, and Returns . . . . . . . . . . . . . . . . . . . . . . 4 19 4.5.6 Conditional Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 20 Single Instruction Repeat Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 22 Block Repeat Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 31 4.7.1 Context Save and Restore Used With Block Repeat . . . . . . . . . . . . . . . . . . . . 4 32 4.7.2 Interrupt Operation in a Block Repeat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 34 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 36 4.8.1 Interrupt Vector Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 36 4.8.2 Interrupt Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 38 4.8.3 Interrupt Flag Register (IFR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 39 4.8.4 Interrupt Mask Register (IMR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 40 4.8.5 Interrupt Mode (INTM) Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 40 4.8.6 Nonmaskable Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 41 4.8.7 Software-Initiated Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 41 4.8.8 Interrupt Context Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 42 4.8.9 Interrupt Latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 43 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 45 Power-Down Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 50 4.10.1 IDLE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 50 4.10.2 IDLE2 Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 50 4.10.3 Power Down Using HOLD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 51
Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1 Describes the basic addressing modes of the TMS320C5x 5.1 5.2 Direct Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 Indirect Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4 5.2.1 Indirect Addressing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5.2.2 Indirect Addressing Opcode Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 7 5.2.3 Bit-Reversed Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 12 Immediate Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 14 5.3.1 Short Immediate Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 14 5.3.2 Long Immediate Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 15 Dedicated-Register Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 17 5.4.1 Using the Contents of the BMAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 17 5.4.2 Using the Contents of the DBMR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 18 Memory-Mapped Register Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 19 Circular Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 21
Contents
xix
5.3
5.4
5.5 5.6
Contents
Assembly Language Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1 Lists and defines the symbols and abbreviations used in the instruction set summary and in the individual instruction descriptions. Provides a summary of the instruction set divided into seven basic types of operation. Also provides an example description of an instruction and describes the TMS320C5x assembly language instructions individually. 6.1 Instruction Set Symbols and Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 6.1.1 Symbols and Abbreviations Used in the Instruction Set Opcodes . . . . . . . . . . 6 2 6.1.2 Symbols and Abbreviations Used in the Instruction Set Descriptions . . . . . . . 6 4 6.1.3 Notations Used in the Instruction Set Descriptions . . . . . . . . . . . . . . . . . . . . . . . 6 6 Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 8 Instruction Set Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 22
6.2 6.3 7
Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1 Describes the TMS320C5x pipeline operation and lists the pipeline latency cycles for these types of latencies 7.1 7.2 Pipeline Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 Pipeline Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 7.2.1 Normal Pipeline Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 7.2.2 Pipeline Operation on Branch and Subroutine Call . . . . . . . . . . . . . . . . . . . . . . . 7 6 7.2.3 Pipeline Operation on ARAU Memory-Mapped Registers . . . . . . . . . . . . . . . . 7 14 7.2.4 Pipeline Operation on External Memory Conflict . . . . . . . . . . . . . . . . . . . . . . . . 7 21 Pipeline Latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 24
7.3 8
Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1 Describes the TMS320C5x memory configuration and operation. Includes memory maps and descriptions of program memory, data memory, and I/O space. Also includes descriptions of direct memory access (DMA), memory management, and available bootloader options. 8.1 8.2 Memory Space Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 7 8.2.1 Program Memory Configurability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 7 8.2.2 Program Memory Address Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 11 8.2.3 Program Memory Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 13 8.2.4 Program Memory Protection Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 14 Local Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 15 8.3.1 Local Data Memory Configurability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 15 8.3.2 Local Data Memory Address Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 17 8.3.3 Local Data Memory Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 19 Global Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 20 8.4.1 Global Data Memory Configurability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 20 8.4.2 Global Data Memory Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 20 Input/Output (I/O) Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 22 8.5.1 Addressing I/O Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 22 Direct Memory Access (DMA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 23 8.6.1 DMA in a Master-Slave Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 23
8.3
8.4
8.5 8.6
xx
Contents
8.7
8.8
8.9 8.10 9
8.6.2 External DMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.1 Memory-to-Memory Moves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.2 Memory Block Moves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Boot Loader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8.1 HPI Boot Mode (C57 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8.2 Serial Boot Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8.3 Parallel EPROM Boot Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8.4 Parallel I/O Boot Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8.5 Warm Boot Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External Parallel Interface Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Software Wait-State Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8 8 8 8 8 8 8 8 8 8 8 8
24 26 26 27 32 33 34 35 37 37 39 42
On-Chip Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1 Describes the TMS320C5x on-chip peripherals and how to control them. Includes information about the clock generator, timer, wait-state generators, general-purpose I/O pins, parallel I/O ports, standard serial port interface, buffered serial port interface, time-division multiplexed serial port interface, and host port interface. 9.1 Peripheral Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2 9.1.1 Memory-Mapped Peripheral Registers and I/O Ports . . . . . . . . . . . . . . . . . . . . . 9 2 9.1.2 External Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4 9.1.3 Peripheral Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 6 Clock Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 7 9.2.1 Standard Clock Options (C50, C51, C52, C53, and C53S only) . . . . . . . . . . 9 7 9.2.2 PLL Clock Options (LC56, C57S, and LC57 only) . . . . . . . . . . . . . . . . . . . . . . 9 8 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 9 9.3.1 Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 9 9.3.2 Timer Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 11 Software-Programmable Wait-State Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 13 9.4.1 Program/Data Wait-State Register (PDWSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 13 9.4.2 I/O Wait-State Register (IOWSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 16 9.4.3 Wait-State Control Register (CWSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 17 9.4.4 Logic for External Program Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 19 General-Purpose I/O Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 20 9.5.1 Branch Control Input (BIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 20 9.5.2 External Flag Output (XF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 21 Parallel I/O Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 22 Serial Port Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 23 9.7.1 Serial Port Interface Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 24 9.7.2 Serial Port Interface Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 25 9.7.3 Setting the Serial Port Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 27 9.7.4 Burst Mode Transmit and Receive Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 9 37 9.7.5 Continuous Mode Transmit and Receive Operations . . . . . . . . . . . . . . . . . . . . 9 44 9.7.6 Serial Port Interface Exception Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 46
Contents
xxi
9.2
9.3
9.4
9.5
9.6 9.7
Contents
9.8
9.9
9.10
9.7.7 Example of Serial Port Interface Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 50 Buffered Serial Port (BSP) Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 53 9.8.1 BSP Operation in Standard Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 55 9.8.2 Autobuffering Unit (ABU) Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 60 9.8.3 System Considerations of BSP Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 69 9.8.4 BSP Operation in Power-Down Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 73 Time-Division Multiplexed (TDM) Serial Port Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 9 74 9.9.1 Basic Time-Division Multiplexed Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 74 9.9.2 TDM Serial Port Interface Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 74 9.9.3 TDM Serial Port Interface Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 76 9.9.4 TDM Mode Transmit and Receive Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 9 80 9.9.5 TDM Serial Port Interface Exception Conditions . . . . . . . . . . . . . . . . . . . . . . . . 9 82 9.9.6 Examples of TDM Serial Port Interface Operation . . . . . . . . . . . . . . . . . . . . . . . 9 82 Host Port Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 87 9.10.1 Basic Host Port Interface Functional Description . . . . . . . . . . . . . . . . . . . . . . . . 9 88 9.10.2 Details of Host Port Interface Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 91 9.10.3 Host Read/Write Access to HPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 97 9.10.4 DSPINT and HINT Function Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 101 9.10.5 Considerations in Changing HPI Memory Access Mode (SAM/HOM) and IDLE2 Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 102 9.10.6 Access of HPI Memory During Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 103
Pinouts and Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 1 Provides pinouts and signal descriptions for the TMS320C5x devices A.1 A.2 A.3 A.4 A.5 A.6 A.7 100-Pin QFP Pinout (C52) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 2 100-Pin TQFP Pinout (C51, C52, C53S, and LC56) . . . . . . . . . . . . . . . . . . . . . . . . . . . A 4 128-Pin TQFP Pinout (LC57) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 6 132-Pin BQFP Pinout (C50, C51, and C53) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 8 144-Pin TQFP Pinout (C57S) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 10 100-Pin TQFP Device-Specific Pinouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 12 Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 13
Instruction Classes and Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B 1 Describes the classes and lists the cycles of the instruction set B.1 B.2 Cycle Class-to-Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B 2 Instruction Set-to-Cycle Class Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B 5
System Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 1 Provides information that is necessary to upgrade a TMS320C2x system into a TMS320C5x system. Consists of a detailed list of the programming differences and hardware and timing differences between the two generations of TMS320 DSPs. C.1 C.2 Package and Pin Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 2 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 8 C.2.1 Device Clock Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 8
xxii
Contents
C.3 C.4
C.2.2 Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 8 C.2.3 External Memory Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 8 C.2.4 Execution Cycle Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 9 On-Chip Peripheral Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 11 C2x-to-C5x Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 12 C.4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 12 C.4.2 Serial Port Control Bit Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 13 C.4.3 C2x-to-C5x Instruction Set Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 13
Design Considerations for Using XDS510 Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 1 Describes the JTAG emulator cable and how to construct a 14-pin connector on your target system and how to connect the target system to the emulator D.1 D.2 D.3 D.4 D.5 D.6 D.7 Cable Header and Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 2 Bus Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 3 Emulator Cable Pod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 4 Emulator Cable Pod Signal Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 6 Target System Test Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 7 Configuring Multiple Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 8 Connections Between the Emulator and the Target System . . . . . . . . . . . . . . . . . . . . . . D 9 D.7.1 Emulation Signals Not Buffered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 9 D.7.2 Emulation Signals Buffered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 10 Emulation Timing Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 11
D.8 E
Memories, Sockets, and Crystals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E 1 Provides product information regarding memories and sockets that are manufactured by Texas Instruments and are compatible with the TMS320C5x E.1 E.2 E.3 Memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E 2 Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E 2 Crystals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E 3
Submitting ROM Codes to TI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F 1 Provides information for submitting ROM codes to Texas Instruments F.1 F.2 F.3 Single-Chip Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F 2 TMS320 Development Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F 3 Submitting TMS320 ROM Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F 4
Development Support and Part Order Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G 1 Provides device part numbers and support tool ordering information for the TMS320C5x and development support information available from TI and third-party vendors G.1 Development Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.1.1 Software and Hardware Development Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.1.2 Third-Party Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.1.3 Technical Training Organization (TTO) TMS320 Workshops . . . . . . . . . . . . . . . G.1.4 Assistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
G G G G G
2 2 2 3 3
xxiii
Contents
G.2
G.3
Part Order Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.1 Device and Development Support Tool Nomenclature . . . . . . . . . . . . . . . . . . . . G.2.2 Device Nomenclature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.3 Development Support Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hewlett-Packard E2442A Preprocessor C5x Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . G.3.1 Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.3.2 Logic Analyzers Supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.3.3 Pods Required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.3.4 Termination Adapters (TAs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.3.5 Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
G G G G G G G G G G
4 4 5 6 8 8 8 9 9 9
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H 1 Defines terms and abbreviations used throughout this book Summary of Updates in This Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I 1 Provides a summary of the updates in this version of the document
xxiv
Figures
Figures
11 12 21 31 32 33 34 35 36 41 42 43 44 45 46 47 48 49 410 51 52 53 54 55 56 57 58 59 510 511 71 81 82 83 84 85 Evolution of the TMS320 Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 3 Typical Applications for the TMS320 Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 4 C5x Functional Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Block Diagram of C5x DSP Central Processing Unit (CPU) . . . . . . . . . . . . . . . . . . . . . . . 3 3 Central Arithmetic Logic Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 8 Examples of Carry Bit Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 13 Parallel Logic Unit Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 15 Indirect Auxiliary Register Addressing Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 17 Auxiliary Register Arithmetic Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 18 Program Control Functional Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 Circular Buffer Control Register (CBCR) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 7 Processor Mode Status Register (PMST) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 8 Status Register 0 (ST0) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 11 Status Register 1 (ST1) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 13 Interrupt Vector Address Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 38 Interrupt Flag Register (IFR) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 39 Interrupt Mask Register (IMR) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 40 Minimum Interrupt Latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 44 RS and HOLD Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 49 Direct Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 Direct Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 Indirect Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4 Indirect Addressing Opcode Format Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 7 Short Immediate Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 14 Long Immediate Addressing Mode No Data Memory Access . . . . . . . . . . . . . . . . . . . . 5 15 Long Immediate Addressing Mode Two Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 16 Dedicated-Register Addressing Using the BMAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 18 Dedicated-Register Addressing Using the DBMR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 18 Memory-Mapped Register Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 19 Memory-Mapped Addressing in the Direct Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . 5 20 Four Level Pipeline Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 C50 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4 C51 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4 C52 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 5 C53 and C53S Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 5 LC56 and LC57 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6
Contents
xxv
Figures
86 87 88 89 810 811 812 813 814 815 816 91 92 93 94 95 96 97 98 99 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
xxvi
C57S Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6 Direct Memory Access Using a Master-Slave Configuration . . . . . . . . . . . . . . . . . . . . . . . . 8 23 Boot Routine Selection Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 33 16-Bit Word Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 34 8-Bit Word Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 35 16-Bit Source Address for Parallel EPROM Boot Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 35 Handshake Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 37 16-Bit Entry Address for Warm Boot Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 38 External Interface Operation for Read-Read-Write (Zero Wait States) . . . . . . . . . . . . . . . 8 40 External Interface Operation for Write-Write-Read (Zero Wait States) . . . . . . . . . . . . . . . 8 41 External Interface Operation for Read-Write (One Wait State) . . . . . . . . . . . . . . . . . . . . . . 8 41 External Interrupt Logic Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5 Timer Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 9 Timer Control Register (TCR) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 10 Program/Data Wait-State Register (PDWSR) Diagram (C50, C51, and C52 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 13 Program/Data Wait-State Register (PDWSR) Diagram (C53S, LC56, and C57 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 14 I/O Port Wait-State Register (IOWSR) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 16 Wait-State Control Register (CWSR) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 17 Software-Programmable Wait-State Generator Block Diagram . . . . . . . . . . . . . . . . . . . . . 9 19 BIO Timing Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 20 XF Timing Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 21 I/O Port Interface Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 22 One-Way Serial Port Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 26 Serial Port Interface Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 27 Serial Port Control Register (SPC) Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 28 Receiver Signal MUXes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 32 Burst Mode Serial Port Transmit Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 38 Serial Port Transmit With Long FSX Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 39 Burst Mode Serial Port Transmit Operation With Delayed Frame Sync in External Frame Sync Mode (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 40 Burst Mode Serial Port Transmit Operation With Delayed Frame Sync in External Frame Sync Mode (BSP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 40 Burst Mode Serial Port Receive Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 41 Burst Mode Serial Port Receive Overrun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 41 Serial Port Receive With Long FSR pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 42 Burst Mode Serial Port Transmit at Maximum Packet Frequency . . . . . . . . . . . . . . . . . . . 9 43 Burst Mode Serial Port Receive at Maximum Packet-Frequency . . . . . . . . . . . . . . . . . . . . 9 43 Continuous Mode Serial Port Transmit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 45 Continuous Mode Serial Port Receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 46 SP Receiver Functional Operation (Burst Mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 47 BSP Receiver Functional Operation (Burst Mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 47 SP/BSP Transmitter Functional Operation (Burst Mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 48 SP/BSP Receiver Functional Operation (Continuous Mode) . . . . . . . . . . . . . . . . . . . . . . . 9 49
Figures
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 A1 A2 A3 A4 A5 C1 C2 C3 C4 C5 D1 D2 D3 D4 D5 D6 D7 F1 G1 G2
SP/BSP Transmitter Functional Operation (Continuous Mode) . . . . . . . . . . . . . . . . . . . . . 9 50 BSP Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 54 BSP Control Extension Register (SPCE) Diagram Serial Port Control Bits . . . . . . . . . 9 57 Transmit Continuous Mode with External Frame and FIG = 1 (Format is 16 bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 60 ABU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 62 BSP Control Extension Register (SPCE) Diagram ABU Control Bits . . . . . . . . . . . . . . 9 63 Circular Addressing Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 67 Transmit Buffer and Receive Buffer Mapping Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 68 Standard Mode BSP Initialization Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 70 Autobuffering Mode Initialization Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 71 Time-Division Multiplexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 74 TDM 4-Wire Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 76 TDM Serial Port Registers Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 78 Serial Port Timing (TDM Mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 80 Host Port Interface Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 87 Generic System Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 89 Select Input Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 93 HPIC Diagram Host Reads from HPIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 96 HPIC Diagram Host Writes to HPIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 96 HPIC Diagram C5x Reads From HPIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 96 HPIC Diagram C5x Writes to HPIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 96 HPI Timing Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 98 Pin/Signal Assignments for the C52 in 100-Pin QFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 2 Pin/Signal Assignments for the C51, C52, C53S, and LC56 in 100-Pin TQFP . . . . . . . A 4 Pin/Signal Assignments for the LC57 in 128-Pin TQFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 6 Pin/Signal Assignments for the C50, C51, and C53 in 132-Pin BQFP . . . . . . . . . . . . . . . A 8 Pin/Signal Assignments for the C57S in 144-Pin TQFP . . . . . . . . . . . . . . . . . . . . . . . . . . . A 10 TMS320C25 in 68-Pin CPGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 2 TMS320C25 in 68-Pin PLCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 3 TMS320C25-to-TMS320C5x Pin/Signal Relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 5 TMS320C25 and TMS320C5x Clocking Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 6 TMS320C25 IACK Versus TMS320C5x IACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 7 Header Signals and Header Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 2 Emulator Cable Pod Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 5 Emulator Cable Pod Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 6 Target-System Generated Test Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 7 Multiprocessor Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 8 Emulator Connections Without Signal Buffering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 9 Buffered Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 10 TMS320 ROM Code Submittal Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F 3 TMS320 Device Nomenclature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G 5 TMS320 Development Tool Nomenclature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G 6
Contents
xxvii
Tables
Tables
11 21 22 31 32 41 42 43 44 45 46 47 48 49 410 411 412 413 414 415 416 51 52 53 54 55 61 62 63 64 65 66 67 68 69
xxviii
Characteristics of the C5x DSPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6 Number of Serial/Parallel Ports Available in Different C5x Package Types . . . . . . . . . . . . 2 9 IEEE Std.1149.1 (JTAG)/Boundary-Scan Interface Configurations for the C5x . . . . . . . 2 12 C5x CPU Internal Hardware Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 Auxiliary Register Arithmetic Unit Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 19 Address Loading Into the Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3 Circular Buffer Control Register (CBCR) Bit Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 7 Processor Mode Status Register (PMST) Bit Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 8 On-Chip RAM Configuration Using OVLY and RAM Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 10 Status Register 0 (ST0) Bit Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 11 Status Register 1 (ST1) Bit Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 13 Product Shifter Mode as Determined by PM Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 16 Conditions for Branch, Call, and Return Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 17 Groups for Multiconditional Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 19 Multi-cycle Instructions Transformed Into Single-Cycle Instructions by the Repeat Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 23 Repeatable Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 24 Instructions Not Meaningful to Repeat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 27 Nonrepeatable Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 29 Interrupt Vector Locations and Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 37 CPU Registers Bit Status at Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 46 Peripheral Registers Bit Status at Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 47 Indirect Addressing Opcode Format Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 7 Indirect Addressing Arithmetic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 9 Instruction Field Bit Values for Indirect Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 9 Bit-Reversed Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 13 Instructions That Support Immediate Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 14 Instruction Set Opcode Symbols and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 Instruction Set Descriptions Symbols and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4 Instruction Set Descriptions Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6 Accumulator Memory Reference Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 9 Auxiliary Registers and Data Memory Page Pointer Instructions . . . . . . . . . . . . . . . . . . . . 6 13 Parallel Logic Unit (PLU) Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 14 TREG0, PREG, and Multiply Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 15 Branch and Call Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 17 I/O and Data Memory Operation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 19
Tables
610 611 71 72 73 74 75 76 77 78 79 710 81 82 83 84 85 86 87 88 89 810 811 812 813 814 815 816 91 92 93 94 95 96 97 98 99 910 911 912 913
Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 20 Address Blocks for On-Chip Single-Access RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 26 Pipeline Operation of 1-Word Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 Pipeline Operation of 2-Word Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5 Pipeline Operation with Branch Taken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 Pipeline Operation with Branch Not Taken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 9 Pipeline Operation with Subroutine Call and Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 11 Pipeline Operation with ARx Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 15 Pipeline Operation with ARx Load and NOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 17 Pipeline Operation with ARx Load and NOP Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 7 19 Pipeline Operation with External Bus Conflicts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 21 Latencies Required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 24 C50 Program Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 8 C51 Program Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 9 C52 Program Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 9 C53 and C53S Program Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 10 LC56 and LC57 Program Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 10 C57S Program Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 11 C5x Interrupt Vector Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 12 C50 Local Data Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 16 C51 Local Data Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 16 C52 Local Data Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 16 C53 and C53S Local Data Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 16 LC56, LC57, and C57S Local Data Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . 8 17 Data Page 0 Address Map CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 18 Global Data Memory Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 21 Address Ranges for On-Chip Single-Access RAM During External DMA . . . . . . . . . . . . 8 25 Number of CLKOUT1 Cycles Per Access for Various Numbers of Wait States . . . . . . . . 8 42 Data Page 0 Address Map Peripheral Registers and I/O Ports . . . . . . . . . . . . . . . . . . . . 9 2 Standard Clock Options (C50, C51, C52, C53, and C53S only) . . . . . . . . . . . . . . . . . . . 9 7 PLL Clock Options (LC56, C57S, and LC57 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 8 Timer Control Register (TCR) Bit Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 10 Program/Data Wait-State Register (PDWSR) Address Ranges (C50, C51, and C52 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 14 Program/Data Wait-State Register (PDWSR) Address Ranges (C53S, LC56, and C57 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 14 Number of CLKOUT1 Cycles per Access for Various Numbers of Wait States . . . . . . . . 9 15 I/O Port Wait-State Register (IOWSR) Address Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 16 Wait-State Control Register (CWSR) Bit Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 17 Wait-State Field Values and Number of Wait States as a Function of CWSR Bits 03 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 18 Serial Port Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 24 Serial Port Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 26 Serial Port Control Register (SPC) Bit Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 28
Contents
xxix
Tables
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 A17 A18 B1 B2 C1 C2
xxx
Serial Port Clock Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 37 Buffered Serial Port Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 55 Differences Between SP and BSP Operation in Standard Mode . . . . . . . . . . . . . . . . . . . 9 56 BSP Control Extension Register (SPCE) Bit Summary Serial Port Control Bits . . . . 9 58 Buffered Serial Port Word Length Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 59 Autobuffering Unit Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 60 BSP Control Extension Register (SPCE) Bit Summary ABU Control Bits . . . . . . . . . 9 64 TDM Serial Port Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 75 Interprocessor Communications Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 83 TDM Register Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 83 HPI Registers Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 90 HPI Signal Names and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 91 HPI Input Control Signals Function Selection Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 9 94 HPI Control Register (HPIC) Bit Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 95 HPIC Host/C5x Read/Write Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 96 Wait-State Generation Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 99 Initialization of BOB and HPIA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 100 Read Access to HPI with Autoincrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 100 Write Access to HPI with Auto-Increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 101 Sequence of Entering and Exiting IDLE2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 103 HPI Operation During RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 104 Signal/Pin Assignments for the C52 in 100-Pin QFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 3 Signal/Pin Assignments for the C51, C52, C53S, and LC56 in 100-Pin TQFP . . . . . . . A 5 Signal/Pin Assignments for the LC57 in 128-Pin TQFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 7 Signal/Pin Assignments for the C50, C51, and C53 in 132-Pin BQFP . . . . . . . . . . . . . . . A 9 Signal/Pin Assignments for the C57S in 144-Pin TQFP . . . . . . . . . . . . . . . . . . . . . . . . . . . A 11 Device-Specific Pin/Signal Assignments for the C51, C52, C53S, and LC56 in 100-Pin TQFP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 12 Address and Data Bus Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 13 Memory Control Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 14 Multiprocessing Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 15 Initialization, Interrupt, and Reset Operations Signal Descriptions . . . . . . . . . . . . . . . . . . A 16 Supply Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 16 Oscillator/Timer Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 17 Oscillator/Timer Standard Options (C50, C51, C52, C53, and C53S Only) . . . . . . . . . A 18 Oscillator/Timer Expanded Options (LC56, C57S, and LC57 Only) . . . . . . . . . . . . . . . . A 19 Serial Port Interface Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 20 Buffered Serial Port Interface Signal Descriptions (LC56 and C57 Only) . . . . . . . . . . . . A 21 Host Port Interface Signal Descriptions (C57 Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 22 Emulation/Testing Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 24 Cycle Class-to-Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B 2 Instruction Set-to-Cycle Class Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B 5 TMS320C2x Versus TMS320C5x for the ADD Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . C 12 TMS320C2x to TMS320C5x Serial Port Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 13
Tables
C3 C4 C5 C6 C7 C8 D1 D2 E1 G1
TMS320C2x-to-TMS320C5x Accumulator Memory Reference Instructions . . . . . . . . . . C 14 TMS320C2x-to-TMS320C5x Auxiliary Registers and Data Memory Page Pointer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 15 TMS320C2x-to-TMS320C5x TREG0, PREG, and Multiply Instructions . . . . . . . . . . . . . . C 16 TMS320C2x-to-TMS320C5x Branch and Call Instructions . . . . . . . . . . . . . . . . . . . . . . . . . C 17 TMS320C2x-to-TMS320C5x I/O and Data Memory Operation Instructions . . . . . . . . . . . C 18 TMS320C2x-to-TMS320C5x Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 19 XDS510 Header Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 2 Emulator Cable Pod Timing Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D 6 Commonly Used Crystal Frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E 3 TMS320C5x Development Support Tools Part Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . G 7
Contents
xxxi
Examples
Examples
41 42 43 44 45 46 47 48 49 410 411 412 413 51 52 53 54 55 56 57 58 59 510 511 512 513 71 72 73 74 75 76 77 78 79 81
xxxii
Use of Conditional Returns (RETC Instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 18 Use of Conditional Branch (BCND Instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 19 Use of Delayed Conditional Branch (BCNDD Instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . 4 20 Conditional Branch Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 20 Use of Conditional Execution (XC Instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 20 XC Execution with Unstable Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 21 XC Execution with Stable Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 21 Use of Block Repeat (RPTB Instruction) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 31 Context Save and Restore Used With Block Repeat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 32 Block Repeat with Small Loop of Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 33 Interrupt Operation With a Single-Word Instruction at the End of an RPTB . . . . . . . . . . . 4 34 Interrupt Operation With a Single-Word Instruction Before the End of RPTB . . . . . . . . . 4 35 Modifying Register Values During Interrupt Context Save . . . . . . . . . . . . . . . . . . . . . . . . . . 4 43 Indirect Addressing With No Change to AR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 10 Indirect Addressing With Autodecrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 10 Indirect Addressing With Autoincrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 10 Indirect Addressing With Autoincrement and Change AR . . . . . . . . . . . . . . . . . . . . . . . . . . 5 11 Indirect Addressing With INDX Subtracted from AR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 11 Indirect Addressing With INDX Added to AR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 11 Indirect Addressing With INDX Subtracted from AR With Reverse Carry . . . . . . . . . . . . . 5 11 Indirect Addressing With INDX Added to AR With Reverse Carry . . . . . . . . . . . . . . . . . . . 5 12 Indirect Addressing Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 12 Sequence of Auxiliary Register Modifications in Bit-Reversed Addressing . . . . . . . . . . . 5 13 Memory-Mapped Register Addressing in the Indirect Addressing Mode . . . . . . . . . . . . . 5 20 Memory-Mapped Register Addressing in the Direct Addressing Mode . . . . . . . . . . . . . . . 5 20 Circular Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 22 Pipeline Operation of 1-Word Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 Pipeline Operation of 2-Word Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5 Pipeline Operation with Branch Taken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6 Pipeline Operation with Branch Not Taken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 9 Pipeline Operation with Subroutine Call and Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 11 Pipeline Operation with ARx Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 14 Pipeline Operation with ARx Load and NOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 16 Pipeline Operation with ARx Load and NOP Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 7 18 Pipeline Operation with External Bus Conflicts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 21 Moving External Data to Internal Data Memory With the BLDD Instruction . . . . . . . . . . . 8 27
Examples
82 83 84 85 86 87 91 92 93 94 95 96 97 98
Moving External Data to Internal Program Memory With the BLDP Instruction . . . . . . . . Moving External Data to Internal Program Memory With the TBLW Instruction . . . . . . . Moving External Program to Internal Data Memory With the BLPD Instruction . . . . . . . . Moving External Program to Internal Data Memory With the TBLR Instruction . . . . . . . . Moving Data From Internal Data Memory to I/O Space With the LMMR Instruction . . . . Moving Data from I/O Space to Internal Data Memory With the SMMR Instruction . . . . Code Initialization for Generating a 50-kHz Clock Signal . . . . . . . . . . . . . . . . . . . . . . . . . . Interrupt Service Routine for a 50-kHz Sample Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Device 0 Transmit Code (Serial Port Interface Operation) . . . . . . . . . . . . . . . . . . . . . . . . . Device 1 Receive Code (Serial Port Interface Operation) . . . . . . . . . . . . . . . . . . . . . . . . . . Transmit Initialization in Burst Mode with External Frame Sync and External Clock (Format is 10 bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Receive Initialization in Continuous Mode (Format is 16 bits) . . . . . . . . . . . . . . . . . . . . . . Device 0 Transmit Code (TDM Operation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Device 1 Receive Code (TDM Operation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8 8 8 8 8 8 9 9 9 9 9 9 9 9
28 29 30 30 31 31 12 12 51 52 72 73 85 86
Contents
xxxiii
Chapter 1
Introduction
This users guide discusses the TMS320C5x generation of fixed-point digital signal processors (DSPs) in the TMS320 family. The C5x DSP provides improved performance over earlier C1x and C2x generations while maintaining upward compatibility of source code between the devices. The C5x central processing unit (CPU) is based on the C25 CPU and incorporates additional architectural enhancements that allow the device to run twice as fast as C2x devices. Future expansion and enhancements are expected to heighten the performance and range of applications of the C5x DSPs. The C5x generation of static CMOS DSPs consists of the following devices:
Device TMS320C50/LC50 TMS320C51/LC51 TMS320C52/LC52 TMS320C53/LC53 TMS320C53S/LC53S TMS320LC56 TMS320LC57 TMS320C57S/LC57S On-Chip RAM 10K words 2K words 1K words 4K words 4K words 7K words 7K words 7K words On-Chip ROM 2K words 8K words 4K words 16K words 16K words 32K words 32K words 2K words
Topic
1.1 1.2 1.3
Page
TMS320 Family Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 TMS320C5x Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 TMS320C5x Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Introduction
1-1
Very flexible instruction set Inherent operational flexibility High-speed performance Innovative, parallel architectural design Cost-effectiveness
1.1.1
1-2
Introduction
1-3
1.1.2
Graphics/Imaging 3-D rotation Animation/digital map Homomorphic processing Pattern recognition Image enhancement Image compression/transmission Robot vision Workstations Medical Diagnostic equipment Fetal monitoring Hearing aids Patient monitoring Prosthetics Ultrasound equipment Telecommunications
Military Image processing Missile guidance Navigation Radar processing Radio frequency modems Secure communications Sonar processing Voice/Speech Speech enhancement Speech recognition Speech synthesis Speaker verification Speech vocoding Voice mail Text-to-speech
1200- to 19200-bps modems Adaptive equalizers ADPCM transcoders Cellular telephones Channel multiplexing Data encryption Digital PBXs Digital speech interpolation (DSI) Personal digital assistants (PDA)
DTMF encoding/decoding Echo cancellation Fax Line repeaters Speaker phones Spread spectrum communications Video conferencing X.25 Packet Switching Personal communications systems (PCS)
1-4
TMS320C5x Overview
versatility
- Modular architectural design for fast development of spin-off devices - Advanced integrated-circuit processing technology for increased per-
language operation
- Reduced power consumption and increased radiation hardness because
of new static design techniques Table 11 lists the major characteristics of the C5x DSPs. The table shows the capacity of on-chip RAM and ROM, number of serial and parallel input/output (I/O) ports, power supply requirements, execution time of one machine cycle, and package types available with total pin count. Use Table 11 for guidance in choosing the best C5x DSP for your application.
Introduction
1-5
TMS320C5x Overview
TMS320 Device ID C50 LC50 C51 C51 LC51 LC51 C52 C52 LC52 LC52 C53 C53S LC53 LC53S LC56 C57S LC57 LC57S PQ PQ PQ PZ PQ PZ PJ PZ PJ PZ PQ PZ PQ PZ PZ PGE PBK PGE
50/35/25/20 132 pin BQFPd 50/35/25/20 100 pin TQFPk 50/40/25 50/40/25 132 pin BQFPd 100 pin TQFPk
50/35/25/20 100 pin QFPh 50/35/25/20 100 pin TQFPk 50/40/25 50/40/25 50/35/25 50/35/25 50/40/25 50/40/25 50/35/25 50/35/25 50/35/25 50/35 100 pin QFPh 100 pin TQFPk 132 pin BQFPd 100 pin TQFPk 132 pin BQFPd 100 pin TQFPk 100 pin TQFPk 144 pin TQFPD 128 pinTQFPk 144 pin TQFPD
Dual-access RAM (DARAM) Single-access RAM (SARAM) ROM bootloader available Includes time-division multiplexed (TDM) serial port # Includes buffered serial port (BSP) || Includes host port interface (HPI) d 20 20 3.8 mm bumpered quad flat-pack (BQFP) package k 14 14 1.4 mm thin quad flat-pack (TQFP) package h 14 20 2.7 mm quad flat-pack (QFP) package D 20 20 1.4 mm thin quad flat-pack (TQFP) package Sixteen of the 64K parallel I/O ports are memory mapped.
1-6
- Power J J
3.3-V and 5-V static CMOS technology with two power-down modes Power consumption control with IDLE1 and IDLE2 instructions for power-down modes
- Memory J
224K-word 16-bit maximum addressable external memory space (64K-word program, 64K-word data, 64K-word I/O, and 32K-word global memory) 1056-word 16-bit dual-access on-chip data RAM 9K-word 16-bit single-access on-chip program/data RAM (C50) 2K-word 16-bit single-access on-chip boot ROM (C50, C57S) 1K-word 16-bit single-access on-chip program/data RAM (C51) 8K-word 16-bit single-access on-chip program ROM (C51) 4K-word 16-bit single-access on-chip program ROM (C52) 3K-word 16-bit single-access on-chip program/data RAM (C53, C53S) 16K-word 16-bit single-access on-chip program ROM (C53, C53S) 6K-word 16-bit single-access on-chip program/data RAM (LC56, C57S, LC57) 32K-word 16-bit single-access on-chip program ROM (LC56, LC57)
J J J J J J J J J J
Introduction
1-7
Central arithmetic logic unit (CALU) consisting of the following: H H H 32-bit arithmetic logic unit (ALU), 32-bit accumulator (ACC), and 32-bit accumulator buffer (ACCB) 16-bit 16-bit parallel multiplier with a 32-bit product capability 0- to 16-bit left and right data barrel-shifters and a 64-bit incremental data shifter
J J J
16-bit parallel logic unit (PLU) Dedicated auxiliary register arithmetic unit (ARAU) for indirect addressing Eight auxiliary registers
- Program control J J J J J
8-level hardware stack 4-deep pipelined operation for delayed branch, call, and return instructions Eleven shadow registers for storing strategic CPU-controlled registers during an interrupt service routine (ISR) Extended hold operation for concurrent external direct memory access (DMA) of external memory or on-chip RAM Two indirectly addressed circular buffers for circular addressing
- Instruction set J J J J J J J J J
Single-cycle multiply/accumulate instructions Single-instruction repeat and block repeat operations Block memory move instructions for better program and data management Memory-mapped register load and store instructions Conditional branch and call instructions Delayed execution of branch and call instructions Fast return from interrupt instructions Index-addressing mode Bit-reversed index-addressing mode for radix-2 fast-Fourier transforms (FFTs)
1-8
- On-chip peripherals J J J J J J J J J
64K parallel I/O ports (16 I/O ports are memory-mapped) Sixteen software-programmable wait-state generators for program, data, and I/O memory spaces Interval timer with period, control, and counter registers for software stop, start, and reset Phase-locked loop (PLL) clock generator with internal oscillator or external clock source Multiple PLL clocking option (x1, x2, x3, x4, x5, x9, depending on the device) Full-duplex synchronous serial port interface for direct communication between the C5x and another serial device Time-division multiplexed (TDM) serial port (C50, C51, C53) Buffered serial port (BSP) (LC56, C57S, LC57) 8-bit parallel host port interface (HPI) (C57, C57S)
- Test/Emulation J J
On-chip scan-based emulation logic IEEE JTAG Standard 1149.1 boundary scan logic (C50, C51, C53, C57S)
- Packages J J J J J
100-pin quad flat-pack (QFP) package (C52) 100-pin thin quad flat-pack (TQFP) package (C51, C52, C53S, LC56) 128-pin TQFP package (LC57) 132-pin bumpered quad flat-pack (BQFP) package (C50, C51, C53) 144-pin TQFP package (C57S)
Introduction
1-9
Chapter 2
Architectural Overview
This chapter provides an overview of the architectural structure of the C5x, which consists of the buses, on-chip memory, central processing unit (CPU), and on-chip peripherals. The C5x uses an advanced, modified Harvard-type architecture based on the C25 architecture and maximizes processing power with separate buses for program memory and data memory. The instruction set supports data transfers between the two memory spaces. Figure 21 shows a functional block diagram of the C5x. All C5x DSPs have the same CPU structure; however, they have different on-chip memory configurations and on-chip peripherals.
Topic
2.1 2.2 2.3 2.4 2.5
Page
Bus Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Central Processing Unit (CPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 On-Chip Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 On-Chip Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Test/Emulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
Architectural Overview
2-1
Memory Program ROM C50 C51 C52 C53 LC56 C57S LC57 2K 8K 4K 16K 32K 2K 32K Data/Program SARAM C50 C51 C52 C53 LC56 C57S LC57 9K 1K 3K 6K 6K 6K Peripherals 6 Serial port 1 Data DARAM Data/Program DARAM B0 (512 X 16) B2 (32 X 16) B1 (512 X 16) TDM serial port Program bus Buffered serial port 6 6 Serial port 2
1 Timer Program controller Memory control Multiprocessing Interrupts Initialization Oscillator/timer Program counter Status/control registers Hardware stack Address generation logic Instruction register Auxiliary register arithmetic unit (ARAU) Memorymapped registers Host port interface CALU D Multiplier D Accumulator D ACC Buffer D Shifters D Arithmetic logic unit (ALU) Parallel logic unit (PLU) 7 Test/emulation 18
2-2
Bus Structure
Program bus (PB) Program address bus (PAB) Data read bus (DB) Data read address bus (DAB)
The PAB provides addresses to program memory space for both reads and writes. The PB also carries the instruction code and immediate operands from program memory space to the CPU. The DB interconnects various elements of the CPU to data memory space. The program and data buses can work together to transfer data from on-chip data memory and internal or external program memory to the multiplier for single-cycle multiply/accumulate operations.
Architectural Overview
2-3
Central arithmetic logic unit (CALU) Parallel logic unit (PLU) Auxiliary register arithmetic unit (ARAU) Memory-mapped registers Program controller
The C5x CPU maintains source-code compatibility with the C1x and C2x generations while achieving high performance and greater versatility. Improvements include a 32-bit accumulator buffer, additional scaling capabilities, and a host of new instructions. The instruction set exploits the additional hardware features and is flexible in a wide range of applications. Data management has been improved through the use of new block move instructions and memory-mapped register instructions. See Chapter 3, Central Processing Unit (CPU).
2.2.1
16-bit 16-bit multiplier 32-bit arithmetic logic unit (ALU) 32-bit accumulator (ACC) 32-bit accumulator buffer (ACCB) Additional shifters at the outputs of both the accumulator and the product register (PREG)
For information on the CALU, see Section 3.2, Central Arithmetic Logic Unit (CALU), on page 3-7.
2.2.2
2-4
2.2.3
2.2.4
Memory-Mapped Registers
The C5x has 96 registers mapped into page 0 of the data memory space. All C5x DSPs have 28 CPU registers and 16 input/output (I/O) port registers but have different numbers of peripheral and reserved registers (see Chapter 4, Memory). Since the memory-mapped registers are a component of the data memory space, they can be written to and read from in the same way as any other data memory location. The memory-mapped registers are used for indirect data address pointers, temporary storage, CPU status and control, or integer arithmetic processing through the ARAU. For information on registers, see Section 3.5, Summary of Registers, on page 3-21.
2.2.5
Program Controller
The program controller contains logic circuitry that decodes the operational instructions, manages the CPU pipeline, stores the status of CPU operations, and decodes the conditional operations. Parallelism of architecture lets the C5x perform three concurrent memory operations in any given machine cycle: fetch an instruction, read an operand, and write an operand. See Chapter 4, Program Control, and Chapter 7, Pipeline. The program controller consists of these elements:
-
Program counter Status and control registers Hardware stack Address generation logic Instruction register
Architectural Overview
2-5
On-Chip Memory
The C5x has a total address range of 224K words 16 bits. The memory space is divided into four individually selectable memory segments: 64K-word program memory space, 64K-word local data memory space, 64K-word input/ output ports, and 32K-word global data memory space. For information on the memory organization, see Chapter 8, Memory.
2.3.1
Program ROM
All C5x DSPs carry a 16-bit on-chip maskable programmable ROM (see Table 11 for sizes). The C50 and C57S DSPs have boot loader code resident in the on-chip ROM, all other C5x DSPs offer the boot loader code as an option. This memory is used for booting program code from slower external ROM or EPROM to fast on-chip or external RAM. Once the custom program has been booted into RAM, the boot ROM space can be removed from program memory space by setting the MP/MC bit in the processor mode status register (PMST). The on-chip ROM is selected at reset by driving the MP/MC pin low. If the on-chip ROM is not selected, the C5x devices start execution from off-chip memory. For information on the program ROM, see Section 8.2, Program Memory, on page 8-7. The on-chip ROM may be configured with or without boot loader code. However, the on-chip ROM is intended for your specific program. Once the program is in its final form, you can submit the ROM code to Texas Instruments for implementation into your device. For details on how to submit code to Texas Instruments to program your ROM, see Appendix F, Submitting ROM Codes to TI.
2.3.2
2-6
On-Chip Memory
block B0 can be configured by software as data or program memory. The DARAM can be configured in one of two ways:
- All 1056 words 16 bits configured as data memory - 544 words 16 bits configured as data memory and 512 words 16 bits
configured as program memory DARAM improves the operational speed of the C5x CPU. The CPU operates with a 4-deep pipeline. In this pipeline, the CPU reads data on the third stage and writes data on the fourth stage. Hence, for a given instruction sequence, the second instruction could be reading data at the same time the first instruction is writing data. The dual data buses (DB and DAB) allow the CPU to read from and write to DARAM in the same machine cycle. For information on DARAM, see Section 8.3, Local Data Memory, on page 8-15.
2.3.3
The SARAM is divided into 1K- and/or 2K-word blocks contiguous in address memory space. All C5x CPUs support parallel accesses to these SARAM blocks. However, one SARAM block can be accessed only once per machine cycle. In other words, the CPU can read from or write to one SARAM block while accessing another SARAM block. When the CPU requests multiple accesses, the SARAM schedules the accesses by providing a not-ready condition to the CPU and executing the multiple accesses one cycle at a time. SARAM supports more flexible address mapping than DARAM because SARAM can be mapped to both program and data memory space simultaneously. However, because of simultaneous program and data mapping, an instruction fetch and data fetch that could be performed in one machine cycle with DARAM may take two machine cycles with SARAM. For information on SARAM, see Section 8.3, Local Data Memory, on page 8-15.
2.3.4
On-Chip Peripherals
Clock generator Hardware timer Software-programmable wait-state generators Parallel I/O ports Host port interface (HPI) Serial port Buffered serial port (BSP) Time-division multiplexed (TDM) serial port User-maskable interrupts
2.4.1
Clock Generator
The clock generator consists of an internal oscillator and a phase-locked loop (PLL) circuit. The clock generator can be driven internally by a crystal resonator circuit or driven externally by a clock source. The PLL circuit can generate an internal CPU clock by multiplying the clock source by a specific factor, so you can use a clock source with a lower frequency than that of the CPU. For information, see Section 9.2, Clock Generator, on page 9-7.
2.4.2
Hardware Timer
A 16-bit hardware timer with a 4-bit prescaler is available. This programmable timer clocks at a rate that is between 1/2 and 1/32 of the machine cycle rate (CLKOUT1), depending upon the timers divide-down ratio. The timer can be stopped, restarted, reset, or disabled by specific status bits. For information, see Section 9.3, Timer, on page 9-9.
2.4.3
2-8
On-Chip Peripherals
2.4.4
2.4.5
Table 21. Number of Serial/Parallel Ports Available in Different C5x Package Types
TMS320 Device Package ID PQ High-Speed Serial Port 1 1 1 1 2 1 1 1 TDM Serial Port 1 1 1 Buffered Serial Port 1 1 1 Host Port (Parallel) 1 1 C50/LC50 C51/LC51 C52/LC52 C53/LC53 PQ/PZ PJ/PZ PQ PZ PZ C53S/LC53S LC56 C57S/LC57S LC57 PGE PBK
PGE is a 20 20 1.4 mm thin quad flat-pack (TQFP) package PJ is a 14 20 2.7 mm quad flat-pack (QFP) package PQ is a 20 20 3.8 mm bumpered quad flat-pack (BQFP) package PZ and PBK are a 14 14 1.4 mm thin quad flat-pack (TQFP) package
Architectural Overview
2-9
On-Chip Peripherals
2.4.6
Serial Port
Three different kinds of serial ports are available: a general-purpose serial port, a time-division multiplexed (TDM) serial port, and a buffered serial port (BSP). Each C5x contains at least one general-purpose, high-speed synchronous, full-duplexed serial port interface that provides direct communication with serial devices such as codecs, serial analog-to-digital (A/D) converters, and other serial systems. The serial port is capable of operating at up to onefourth the machine cycle rate (CLKOUT1). The serial port transmitter and receiver are double-buffered and individually controlled by maskable external interrupt signals. Data is framed either as bytes or as words. Table 21 lists the number and type of serial ports available in C5x DSPs with various package types. For information on serial ports, see Section 9.7, Serial Port Interface, on page 9-23.
2.4.7
2.4.8
2.4.9
User-Maskable Interrupts
Four external interrupt lines (INT1INT4) and five internal interrupts, a timer interrupt and four serial port interrupts, are user maskable. When an interrupt service routine (ISR) is executed, the contents of the program counter are saved on an 8-level hardware stack, and the contents of eleven specific CPU registers are automatically saved (shadowed) on a 1-level-deep stack. When a return from interrupt instruction is executed, the CPU registers contents are restored. For information, see Section 4.8, Interrupts, on page 4-36.
2-10
Test/Emulation
2.5 Test/Emulation
On the C50, LC50, C51, LC51, C53, LC53, C57S and LC57S, an IEEE standard 1149.1 (JTAG) interface with boundary scan capability is used for emulation and test. This logic provides the boundary scan to and from the interfacing devices. It can be used to test pin-to-pin continuity and to perform operational tests on devices that are peripheral to the C5x. On the C52, LC52, C53S, LC53S, LC56, and LC57, an IEEE standard 1149.1 (JTAG) interface without boundary scan capability is used for emulation purposes only and is interfaced to other internal scanning logic circuitry that has access to all of the on-chip resources. Thus, the C5x can perform on-board emulation by means of the IEEE standard 1149.1 serial scan pins and the emulation-dedicated pins. The on-chip analysis block in conjunction with the C5x debugger software provides the capability to perform debugging and performance evaluation functions in a target system. The full analysis block provides the following capabilities:
- Flexible breakpoint setup. Breakpoints can be triggered based on the fol-
lowing events:
J J J J J
Program fetches/reads/writes EMU0/1 pin activity Data reads/writes CPU events (calls, returns, interrupts/traps, branches, pipeline clock) Event counter overflow
CPU clocks Pipeline advances Instruction fetches Calls, returns, interrupts/traps, branches Program fetches/reads/writes Data reads/writes
flow. The reduced analysis block on the C53S and LC53S provides the capability for breakpoint triggering based on program fetches/reads/writes and EMU0/1 pin activity. Table 22 lists the IEEE standard 1149.1 (JTAG) interface, boundary scan capability, and on-chip analysis block functions supported by the C5x. See IEEE Std. 1149.1 for more details.
Architectural Overview
2-11
Test/Emulation
Table 22. IEEE Std.1149.1 (JTAG)/Boundary-Scan Interface Configurations for the C5x
Refer to the TMS320 DSP Development Support Reference Guide for additional information on available TMS320 development tools.
LC57 C57S/LC57S LC56 C53S/LC53S C53/LC53 C52/LC52 C51/LC51 C50/LC50 TMS320 Device IEEE Std.1149.1 Interface Yes Yes Yes Yes Yes Yes Yes Yes Boundary Scan Capability Yes Yes Yes Yes No No No No On-Chip Analysis Block Reduced Full Full Full Full Full Full Full
2-12
Chapter 3
Program controller Central arithmetic logic unit (CALU) Parallel logic unit (PLU) Auxiliary register arithmetic unit (ARAU) Memory-mapped registers
This chapter does not discuss the memory and peripheral segments, except in relation to the CPU.
Topic
3.1 3.2 3.3 3.4 3.5
Page
Functional Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Central Arithmetic Logic Unit (CALU) . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 Parallel Logic Unit (PLU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 Auxiliary Register Arithmetic Unit (ARAU) . . . . . . . . . . . . . . . . . . . . . 3-17 Summary of Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
3-1
Functional Overview
3-2
Functional Overview
Figure 31. Block Diagram of C5x DSP Central Processing Unit (CPU)
CLKMD1 CLKMD2 CLKMD3 IS DS PS RW STRB READY BR XF HOLD HOLDA IAQ BIO RS IACK MP/MC INT(14) PROGRAM BUS Software waitstates PDWSR IOWSR Program Controller 16 CWSR(5) X1 CLKOUT1 X2/CLKIN CLKIN2 PFC PAER MUX COMPARE MCS RD WE NMI Address 4 ROM MUX A15A0 Stack (8x16) PC PASR IREG BMAR ST0 ST1 PMST RPTC IMR IFR GREG BRCR TREG1(5) TREG2(4) Serial Port 1
Serial Port 2
DATA BUS 7 LSB from IREG 3 AR0 AR1 AR2 AR3 AR4 AR5 AR6 AR7 CBCR(8) CBSR1 CBSR2 CBER1 CBER2 INDX 32 32 PRESCALER SFR(016) 32 Emulation DRB PRESCALER SFL(016) MULTIPLIER PREG(32) 32 MUX PSCALER (6,0,1,4) PLU TREG0 MUX Timer ST0 [DP] MUX 9 DBMR Time-Division Multiplexed Serial Port
DATA BUS
ST0 [ARP]
ARCR
. . .
MUX ARAU MUX 32 Data/Program MUX SARAM Data/Program DARAM B0 MUX Data DARAM B2 B1 MUX MUX POSTSCALER (07) ST1 [C] 32 PROGRAM BUS DATA BUS ALU(32) 32 32
PA15
ACCH
ACCL 32
ACCB(32)
Notes: All registers and data lines are 16-bits wide unless otherwise specified. Not available on all devices.
3-3
Functional Overview
3-4
Functional Overview
3-5
Functional Overview
3-6
3.2
16-bit 16-bit parallel multiplier 32-bit 2s-complement arithmetic logic unit (ALU) 32-bit accumulator (ACC) 32-bit accumulator buffer (ACCB) 0-, 1-, or 4-bit left or 6-bit right shifter 0- to 16-bit left barrel shifter 0- to 16-bit right barrel shifter 0- to 7-bit left barrel shifter
3.2.1
ALU or stored.
- If PM = 012, the PREG output is left-shifted 1 bit when transferred into the
ALU or stored, and the LSB is zero filled. This shift mode compensates for the extra sign bit gained when multiplying two 16-bit 2s-complement numbers.
Central Processing Unit (CPU)
3-7
MUX
TREG0 Multiplier
PRESCALER SFL(016)
TREG1(5)
MUX 32
PRESCALER SFR(016)
MUX 32
32 ST1
ALU(32) C(1) 32
32
ACCH
ACCL 32
ACCB(32)
POSTSCALER (07)
Program Bus
Data Bus
Notes: All registers and data lines are 16-bits wide unless otherwise specified.
- If PM = 102, the PREG output is left-shifted 4 bits when transferred into the
ALU or stored, and the 4 LSBs are zero filled. This shift mode is used in conjunction with the MPY instruction with a short immediate value (13 bits or less) to eliminate the four extra sign bits gained when multiplying a16-bit number times a 13-bit number.
- If PM = 112, the PREG output is right-shifted 6 bits, sign extended, when
transferred into the ALU or stored, and the 6 LSBs are lost. This shift mode enables the execution of up to 128 consecutive multiply/accumulates without the possibility of overflow. Note that the product is always sign extended, regardless of the value of the sign extension mode (SXM) bit in ST1.
3-8
The PM shifts also occur when the PREG contents are stored to data memory. The PREG contents remain unchanged during the shifts. The LT (load TREG0) instruction loads TREG0, from the data bus, with the first operand; the MPY instruction provides the second operand for multiplication operations. To perfrom a multiplication with a short or long immediate operand, use the MPY instruction with an immediate operand. A product can be obtained every two cycles except when a long immediate operand is used. Four multiply/accumulate instructions (MAC, MACD, MADD, and MADS) fully utilize the computational bandwidth of the multiplier, which allows both operands to be processed simultaneously. The data for these operations can be transferred to the multiplier each cycle via the program and data buses. When any of the four multiply/accumulate instructions are used with the RPT or RPTZ instruction, the instruction becomes a single-cycle multiply/accumulate function. In these repeated instructions, the coefficient addresses are generated by the PC while the data addresses are generated by the ARAU. This allows the RPT instruction to sequentially access the values from the coefficient table and step through the data in any of the indirect addressing modes. The RPTZ instruction also clears the ACC and the PREG to initialize the multiply/ accumulate operation. For example, consider multiplying the row of one matrix times the column of a second matrix: there are 10 10 matrices, MTRX1 points to the beginning of the first matrix, INDX = 10, and the current AR points to the beginning of the second matrix:
RPTZ MAC #9 MTRX1,*0+ ;For i = 0, i < 10, i++ ;PREG=DATA(MTRX1+i) x DATA[MTRX2 + ;(i x INDX)] ;ACC += PREG. ;ACC += PREG.
APAC
The MAC and MACD instructions obtain their coefficient pointer from a long immediate address and are, therefore, 2-word instructions. The MADS and MADD instructions obtain their coefficient pointer from the BMAR and are, therefore, 1-word instructions. When you use the BMAR as a source to the coefficient table, one block of code can support multiple applications, and you can change the long immediate address without modifying executable code. The MACD and MADD instructions include a data move (DMOV) operation that, in conjunction with the fetch of the data multiplicand, writes the data value to the next higher data address.
Central Processing Unit (CPU)
3-9
The MACD and MADD instructions, when repeated, support filter constructs (weighted running averages) so that as the sum-of-products operation is executed, the sample data is shifted in memory to make room for the next sample and to throw away the oldest sample. Circular addressing with MAC and MADS instructions can also be used to support filter implementation. In the next example, the current AR points to the oldest of the samples; BMAR points to the coefficient table. In addition to initiating the repeat operation, the RPTZ instruction also clears the ACC and the PREG. In this example, the PC is stored in a temporary register while the repeated operation is executed. Next, the PC is loaded with the value stored in BMAR. The program bus is used to address the coefficients and, as the MADD instruction is repeatedly executed, the PC increments to step through the coefficient table. The ARAU generates the address of the sample data. Indirect addressing with decrement steps through the sample data, starting with the oldest data. As the data is fetched, it is also written to the next higher location in data memory. This operation aligns the data for the next execution of the filter by moving the oldest sample out past the end of the samples array and making room for the new sample at the beginning of the sample array. The previous product of the PREG is added to the ACC, while the two fetched values are multiplied and the new product value is loaded into the PREG. Note that the DMOV portion of the MACD and MADD instructions does not function with external data memory addresses.
RPTZ MADD APAC #9 * ;ACC = PREG = 0. For I = 9 TO 0 Do ;SUM AI x XI. XI+1 = XI. ;FINAL SUM.
The MPYU instruction performs an unsigned multiplication that facilitates extended-precision arithmetic operations. The unsigned contents of TREG0 are multiplied by the unsigned contents of the addressed data memory location; the result is placed in PREG. This allows operands larger than 16 bits to be broken down into 16-bit words and processed separately to generate products larger than 32 bits. The square/add (SQRA) and square/subtract (SQRS) instructions pass the same value to both inputs of the multiplier for squaring a data memory value. After the multiplication of two 16-bit numbers, this 32-bit product is loaded into PREG. The product from the PREG can be transferred to the ALU or to data memory via the store product high (SPH) and store product low (SPL) instructions.
3-10
3.2.2
The 32-bit ACC can be split into two 16-bit segments (ACCH and ACCL) for storage in data memory (see Figure 32). A postscaler at the output of the ACC provides a left shift of 0 to 7 places. This shift is performed while the data is being transferred to the data bus for storage. The contents of the ACC remain unchanged. When the postscaler is used on the high word of the ACC (bits 16 31), the MSBs are lost and the LSBs are filled with bits shifted in from the low word (bits 0 15). When the postscaler is used on the low word, the LSBs are zero filled. For the following example, assume that ACC = FF23 4567h:
SACL SACH TEMP1,7 TEMP2,7 ;TEMP1 = B380h ;TEMP2 = 91A2h ACC = FF234567h. ACC = FF234567h.
3-11
The C5x supports floating-point operations for applications requiring a large dynamic range. By performing left shifts, the NORM (normalization) instruction normalizes fixed-point numbers contained in the ACC. The four bits of the TREG1 define a variable shift through the prescaler for the add to/load to/subtract from accumulator with shift specified by TREG1 (ADDT/LACT/SUBT) instructions. These instructions denormalize a number (convert it from floating-point to fixed-point) and also execute an automatic gain control (AGC) going into a filter. The single-cycle 1-bit to 16-bit right shift of the ACC can efficiently align its contents. This shift, coupled with the 32-bit temporary buffer on the ACC, enhances the effectiveness of the CALU in extended-precision arithmetic. The ACCB provides a temporary storage place for a fast save of the ACC. The ACCB can also be used as an input to the ALU. The minimum or maximum value in a string of numbers can be found by comparing the contents of the ACCB with the contents of the ACC. The minimum or maximum value is placed in both registers, and, if the condition is met, the carry bit (C) is set. The minimum and maximum functions are executed by the CRLT and CRGT instructions, respectively. These operations are signed arithmetic operations. In the next example, assume that ACC = 1234 5678h and ACCB = 7654 3210h:
CRLT CRGT ;ACC = ACCB = 1234 5678h. C = 1. ;ACC = ACCB = 7654 3210h. C = 0.
The ACC overflow saturation mode can be enabled by setting and disabled by clearing the overflow mode (OVM) bit of ST0. When the ACC is in the overflow saturation mode and an overflow occurs, the overflow flag is set and the ACC is loaded with either the most positive or the most negative value representable in the ACC, depending upon the direction of the overflow. The value of the ACC upon saturation is 7FFF FFFFh (positive) or 8000 0000h (negative). If the OVM bit is cleared and an overflow occurs, the overflowed results are loaded into the ACC without modification. Note that logical operations cannot result in overflow. The C5x can execute a variety of branch instructions that depend on the status of the ALU and the ACC. For example, execution of the instruction BCND can depend on a variety of conditions in the ALU and the ACC. The BACC instruction allows branching to an address stored in the ACC. The bit test instructions (BITT and BIT) facilitate branching on the condition of a specified bit in data memory.
3-12
The ACC has an associated carry bit that is set or cleared, depending on various operations within the C5x. The carry bit allows more efficient computation of extended-precision products and additions or subtractions; it is also useful in overflow management. The carry bit is affected by most arithmetic instructions as well as the single-bit shift and rotate instructions. The carry bit is not affected by loading the ACC, logical operations, or other nonarithmetic or control instructions. Examples of carry bit operations are shown in Figure 33.
The value added to or subtracted from the ACC can come from the prescaler, ACCB, or PREG. The carry bit is set if the result of an addition or accumulation process generates a carry; it is cleared if the result of a subtraction generates a borrow. Otherwise, it is cleared after an addition or set after a subtraction. The add to ACC with carry (ADDC) and add ACCB to ACC with carry (ADCB) instructions use the previous value of carry in their addition operation. The subtract from ACC with borrow (SUBB) and subtract ACCB from ACC with borrow (SBBB) instructions use the logical inversion of the previous value of carry. The one exception to the operation of the carry bit is in the use of ADD with a shift count of 16 (add to ACCH) and SUB with a shift count of 16 (subtract from ACCH). These instructions can generate a carry or a borrow, but they will not clear a carry or borrow, as is normally the case if a carry or borrow is not generated. This feature is useful for extended-precision arithmetic. Two conditional operands, C and NC, are provided for branching, calling, returning, and conditionally executing according to the status of the carry bit. The CLRC, LST #1, and SETC instructions can be used to load the carry bit. The carry bit is set on a reset. The 1-bit shift to the left (SFL) or right (SFR) and the rotate to the left (ROL) or right (ROR) instructions shift or rotate the contents of the ACC through the
Central Processing Unit (CPU)
3-13
carry bit. The SXM bit affects the definition of the shift accumulator right (SFR) instruction. When SXM = 1, SFR performs an arithmetic right shift, maintaining the sign of the ACC data. When SXM = 0, SFR performs a logical shift, shifting out the LSBs and shifting in a 0 for the MSB. The shift accumulator left (SFL) instruction is not affected by the SXM bit and behaves the same in both cases, shifting out the MSB and shifting in a 0. The RPT and RPTZ instructions can be used with the shift and rotate instructions for multiple-bit shifts. The SFLB, SFRB, RORB, and ROLB instructions can shift or rotate the 65-bit combination of the ACC, ACCB, and carry bit as described above. The ACC can also be shifted 031 bits right in two instruction cycles or 116 bits right in one cycle. The bits shifted out are lost, and the bits shifted in are either 0s or copies of the original sign bit, depending on the value of the SXM bit. A shift count of 1 to 16 is embedded in the instruction word of the BSAR instruction. For example, let ACC = 1234 5678h:
BSAR 7 ;ACC = 0246 8ACEh.
The right shift can also be controlled via TREG1. The SATL instruction shifts the ACC by 015 bits, as defined by bits 03 of TREG1. The SATH instruction shifts the ACC 16 bits to the right if bit 4 of TREG1 is a 1. The following code sequence executes a 0- to 31-bit right shift of the ACC, depending on the shift count stored at SHIFT. For example, consider the value stored at SHIFT = 01Bh and ACC = 1234 5678h:
LMMR SATH SATL TREG1,SHIFT ;TREG1 = shift count 0 31. TREG1 = 1B ;If shift count > 15, then ACC >> 16 ;ACC = 00001234 ;ACC >> shift count. ACC = 0000 0002
3.2.3
3-14
3.3
DBMR
MUX
PLU
Note:
All registers and data lines are 16-bits wide unless otherwise specified.
The PLU makes it possible to directly manipulate bits in any location in data memory space by ANDing, ORing, exclusive-ORing, or loading a 16-bit long immediate value to a data location. For example, to use AR1 for circular buffer 1 and AR2 for circular buffer 2 but not enable the circular buffers, initialize the circular buffer control register (CBCR) by executing the following code:
SPLK #021h,CBCR ;Store peripheral long immediate ;(DP = 0).
Program Bus
To test for individual bits in a specific register or data word, use the BIT instruction; however, to test for a pattern of bits, use the compare parallel long immediate (CPL) instruction. If the data value is equal to the long immediate value, then the test/control (TC) bit in ST1 is set. The TC bit is set if the result of any PLU instruction is 0. The set, clear, and toggle functions can be executed with a 16-bit dynamic register value instead of the long immediate value. This is done with the following three instructions: AND DBMR register to data (APL), OR DBMR register to data (OPL), and exclusive-OR DBMR register to data (XPL). The TC bit is also set by the APL, OPL, and XPL instructions if the result of the PLU operation (value written back into data memory) is 0. This allows bits to be tested and cleared simultaneously. For example,
APL BCND #0FF00h,TEMP HIGH_BITS_SET,NTC ;Clear low byte and check for ;bits set in high byte. ;If bits active in high byte, ;then branch.
or
XPL BCND #1,TEMP BIT_SET,TC ;Toggle bit 0. ;If bit was set, branch. If not, ;bit set now.
In the first example, the low byte of a flag word is cleared while the high byte is checked for any active flags (bits = 1). If none of the flags in the high byte is set, then the resulting APL operation yields a 0 to TEMP and the TC bit is set. If any of the flags in the high byte are set, then the resulting APL operation yields a nonzero value to TEMP and the TC bit is cleared. Therefore, the conditional branch (BCND) following the APL instruction branches if any of the bits in the high byte are nonzero. The second example tests the flag. If the flag is low, the flag is set high; if the flag is high, the flag is cleared and the branch is taken. The PLU instructions can operate anywhere in data address space, so they can operate with flags stored in RAM locations as well as in control registers for both on- and off-chip peripherals. The PLU instructions are listed in Table 66 on page 6-14.
3-16
3-17
ST0 ARP(3)
ST1 ARB(3)
Data Bus
16 ARAU MUX
MUX DARAM B2 B1
Notes: All registers and data lines are 16-bits wide unless otherwise specified.
The ARAU updates the ARs during the decode phase (second stage) of the pipeline, while the CALU writes during the execution phase (fourth stage). Therefore, the two instructions that immediately follow the CALU write to an AR should not use the same AR for address generation. See Chapter 7, Pipeline, for more details.
As shown in Figure 36, the INDX, auxiliary register compare register (ARCR), or eight LSBs of the instruction register (IREG) can be used as one of the inputs to the ARAU. The other input is provided by the contents of the current AR pointed to by ARP. Table 32 defines the functions of the ARAU.
3-18
Program Bus
AR0 AR1 AR2 AR3 AR4 AR5 AR6 AR7 CBCR(8) CBSR1 CBSR2 CBER1 CBER2 INDX ARCR
IREG
DRB
The INDX can be added to or subtracted from the current AR on any AR update cycle. The INDX can be used to increment or decrement the address in steps larger than 1; this is useful for operations such as addressing down a matrix column. The ARCR limits blocks of data and supports logical comparisons between the current AR and ARCR in conjunction with the CMPR instruction. Note that the C2x uses AR0 for this implementation. After reset, you can use the load auxiliary register (LAR) instruction to load AR0; if the enable extra index register (NDX) bit in the PMST is set, LAR also loads INDX and ARCR to maintain compatibility with the C2x.
Central Processing Unit (CPU)
3-19
Because the ARs are memory-mapped, the CALU can act directly upon them and use more advanced indirect addressing techniques. For example, the multiplier can calculate the addresses of 3-dimensional matrices. After a CALU load of the AR, there is, however, a 2-instruction-cycle delay before the ARs can be used for address generation. The INDX and ARCR are accessible via the CALU, regardless of the condition of the NDX bit (that is, SAMM ARCR writes only to the ARCR). The ARAU can serve as an additional general-purpose arithmetic unit because the auxiliary register file can directly communicate with data memory. The ARAU implements 16-bit unsigned arithmetic, whereas the CALU implements 32-bit 2s-complement arithmetic. The BANZ and BANZD instructions permit the ARs to be used as loop counters. The 3-bit auxiliary register pointer buffer (ARB), shown in Figure 36, stores the ARP on subroutine calls when the automatic context switch feature of the C5x is not used. Two circular buffers can operate at a given time and are controlled via the circular buffer control register (CBCR). Upon reset (rising edge of RS), both circular buffers are disabled. To define a circular buffer, load CBSR1 or CBSR2 with the start address of the buffer and CBER1 or CBER2 with the end address; then load the AR to be used with the circular buffer with an address between the start and end addresses. Finally, load CBCR with the appropriate AR number and set the enable (CENB1 or CENB2) bit.
Do not use the same AR to access both circular buffers or unexpected results will occur.
As the address is stepping through the circular buffer, the AR value is compared against the value contained in CBER prior to the update to the AR value. If the current AR value and the CBER are equal and an AR modification occurs, the value contained in CBSR is automatically loaded into the AR. If the values in the CBER and the AR are not equal, the AR is modified as specified. Circular buffers can be used with either increment- or decrement-type updates. If increment is used, then the value in CBER must be larger than the value in CBSR. If decrement is used, the value in CBER must be smaller than the value in CBSR. The other indirect addressing modes can be used; however, the ARAU tests only for the condition current AR = CBER. The ARAU does not detect an AR update that steps over the value contained in CBER. See Section 5.6, Circular Addressing, on page 5-21 for more details.
3-20
Summary of Registers
3.5.1
3.5.2
3.5.3
3.5.4
Although the RPTC is a memory-mapped register, you should avoid writing to this register. Writing to this register can cause undesired results.
3-21
Summary of Registers
The 16-bit block repeat counter register (BRCR) holds the count value for the block repeat feature. This value is loaded before a block repeat operation is initiated. The value can be changed while a block repeat is in progress; however, take care to avoid infinite loops. The block repeat program address start register (PASR) indicates the 16-bit address where the repeated block of code starts. The block repeat program address end register (PAER) indicates the 16-bit address where the repeated block of code ends. The PASR and PAER are loaded by the RPTB instruction. Block repeats are described in Section 4.7, Block Repeat Function, on page 4-31.
3.5.5
3.5.6
3.5.7
3-22
Summary of Registers
3.5.8
3.5.9
Summary of Registers
3.5.16 Serial Port Interface Registers (SPC, DRR, DXR, XSR, RSR)
Five registers control and operate the serial port interface. The 16-bit serial port control register (SPC) contains the mode control and status bits of the serial port. The 16-bit data receive register (DRR) holds the incoming serial data, and the 16-bit data transmit register (DXR) holds the outgoing serial data. The 16-bit data transmit shift register (XSR) controls the shifting of the data from the DXR to the output pin. The 16-bit data receive shift register (RSR) controls the storing of the data from the input pin to the DRR. The serial port is described in Section 9.7, Serial Port Interface, on page 9-23.
Summary of Registers
3.5.21 TDM Serial Port Registers (TRCV, TDXR, TSPC, TCSR, TRTA, TRAD, TRSR)
The time-division-multiplexed (TDM) serial port interface is a feature superset of the serial port interface and supports applications that require serial communication in a multiprocessing environment. Six registers control and operate the TDM serial port interface. The 16-bit TDM serial port control register (TSPC) contains the mode control and status bits of the TDM serial port interface. The 16-bit TDM data receive register (TRCV) holds the incoming TDM serial data, and the 16-bit TDM data transmit register (TDXR) holds the outgoing TDM serial data. The 16-bit TDM data receive shift register (TRSR) controls the storing of the data, from the input pin, to the TRCV. The 16-bit TDM channel select register (TCSR) specifies in which time slot(s) each C5x device is to transmit. The 16-bit TDM receive/transmit address register (TRTA) specifies in the eight LSBs (RA0RA7) the receive address of the C5x device and in the eight MSBs (TA0TA7) the transmit address of the C5x device. The 16-bit TDM receive address register (TRAD) contains various information regarding the status of the TDM address line (TADD). See Section 9.9, Time-Division Multiplexed (TDM) Serial Port Interface, on page 9-74.
Central Processing Unit (CPU)
3-25
Chapter 4
Program Control
Program control on the TMS320C5x is provided by the program counter, hardware stack, repeat counters, status registers, program counter-related hardware, and several software mechanisms. Software mechanisms used for program control include branches, calls, conditional instructions, repeat instructions, reset, and interrupts.
Topic
4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9
Page
Program Counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Hardware Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 Program-Memory Address Generation . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 Status and Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 Conditional Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17 Single Instruction Repeat Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22 Block Repeat Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-31 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-36 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-45
Program Control
4-1
Controller
PFC PAER MUX Compare MCS PC PASR IREG BMAR ST0 ST1 PMST RPTC IMR IFR GREG BRCR TREG2(4)
MUX
A15A0
To ARAU
RBIT MUX
D15D0
Data Bus
DP(9)
ST0
Notes: All registers and data lines are 16 bits wide unless otherwise specified.
4-2
BLDD, BLDP, BLPD, MAC, or MACD instruction BACC, BACCD, CALA, TBLR, or TBLW instruction BLDD, BLDP, BLPD, MADD, or MADS instruction End of a block repeat loop Return instruction
The PC is loaded with the contents of the accumulator low byte (ACCL). The PC is loaded with the content of the block move address register (BMAR). The PC is loaded with the content of the block repeat program address start register (PASR). The PC is loaded with the top of the stack.
The PC can also be loaded with coefficients residing in program memory for some instructions used with the repeat operation (see Section 4.6, Single Instruction Repeat Function, on page 4-22). In a repeat operation, once the instruction is repeated, it is no longer prefetched, and the PC can be used to address program memory sequentially. The multiply/accumulate instructions (MAC, MACD, MADD, and MADS), memory move from data-to-data instruction (BLDD), memory move from program-to-data instructions (BLPD and TBLR), and memory move from data-to-program instructions (BLDP and TBLW), use this capability.
Program Control
4-3
Hardware Stack
stack The stack is used during interrupts and subroutines to save and restore the PC contents. When a subroutine is called (CALA, CALAD, CALL, CALLD, CC, or CCD instruction) or an interrupt occurs (hardware interrupt, NMI, INTR, or TRAP instruction), the return address is automatically saved in the stack (a PUSH operation). When a subroutine returns (RET, RETC, RETCD, RETD, RETE, or RETI instruction), the return address is retrieved from the stack (a POP operation) and loaded into the PC.
4-4
ter (PMST) contain status and control information. Since these registers are memory-mapped, they can be stored into and loaded from data memory; therefore, the status of the CPU can be saved and restored for subroutines and interrupt service routines (ISRs).
- Status registers ST0 and ST1 contain the status of various conditions and
4.4.1
4-6
158 7 64 3 20 Reserved CENB2 CAR2 CENB1 CAR1
Function
These bits are reserved. Circular buffer 2 enable bit. This bit enables/disables circular buffer 2. CENB2 = 0 CENB2 = 1 Circular buffer 2 is disabled. Circular buffer 2 is enabled.
64 3
CAR2 CENB1
Circular buffer 2 auxiliary register bits. These bits select which auxiliary register (AR0AR7) is assigned to circular buffer 2. Circular buffer 1 enable bit. This bit enables/disables circular buffer 1. CENB1 = 0 CENB1 = 1 Circular buffer 1 is disabled. Circular buffer 1 is enabled.
20
CAR1
Circular buffer 1 auxiliary register bits. These bits select which auxiliary register (AR0AR7) is assigned to circular buffer 1.
4.4.2
1511 IPTR 10 0 9 0 8 0 7 6 0 5 4 3 2 1 0 AVIS OVLY RAM MP/MC NDX TRM BRAF
Function
Interrupt vector pointer bits. These bits select any of 32 2K-word pages where the interrupt vectors reside. The interrupt vectors can be remapped to RAM for bootloaded operations by loading the IPTR bits. At reset, the IPTR bits are cleared; therefore, the reset vector always resides at address 0h in program memory space. These bits are read as 0. Address visibility bit. This bit enables/disables the internal program address to be visible at the address pins. AVIS = 0 The internal program address is driven to the pins so that the address can be traced and the interrupt vector can be decoded in conjunction with IACK when the interrupt vectors reside in on-chip memory. The address lines do not change with the internal program address. The control and data lines are not affected and the address bus is driven with the last address on the bus.
108 7 AVIS
000 0
AVIS = 1
6 5 OVLY
0 0
This bit is read as 0. RAM overlay bit. This bit enables/disables the on-chip single-access RAM (SARAM) to be addressable in data memory space. The OVLY bit is used in conjunction with the RAM bit to configure the on-chip SARAM. See Table 44 on page 4-10 for specific mappings of the on-chip SARAM. OVLY = 0 OVLY = 1 The on-chip SARAM is not addressable in data memory space. The on-chip SARAM is mapped into data memory space.
RAM
Program RAM enable bit. This bit enables/disables the on-chip single-access RAM (SARAM) to be addressable in program memory space. The RAM bit is used in conjunction with the OVLY bit to configure the on-chip SARAM. See Table 44 on page 4-10 for specific mappings of the on-chip SARAM. RAM = 0 RAM = 1 The on-chip SARAM is not addressable in program memory space. The on-chip SARAM is mapped into program memory space.
4-8
Table 43. Processor Mode Status Register (PMST) Bit Summary (Continued)
Bit 3 Name MP/MC Reset value
Function
Microprocessor/microcomputer bit. This bit enables/disables the on-chip ROM to be addressable in program memory space. At reset, the MP/MC bit is set to the value corresponding to the logic level on the MP/MC pin. The level on the MP/MC pin is sampled at reset only and can have no effect until the next reset. MP/MC = 0 MP/MC = 1 The on-chip ROM is mapped into program memory space. The on-chip ROM is not addressable in program memory space.
NDX
Enable extra index register bit. This bit determines whether a C2x-compatible instruction that modifies or writes to auxiliary register 0 (AR0) also modifies or writes to the index register (INDX) and the auxiliary register compare register (ARCR) to maintain C5x object-code compatibility with the TMS320C2x. NDX = 0 C2x-compatible mode. Any C2x-compatible instruction that modifies or writes AR0 also modifies or writes the INDX and ARCR because the C2x uses AR0 for indexing and AR compare operations. C5x-enhanced mode. Any C2x-compatible instruction does not affect the INDX and ARCR. The C2x-compatible instructions affect only AR0 of the C5x.
NDX = 1
TRM
Enable multiple TREGs bit. This bit determines whether a C2x-compatible instruction that loads TREG0 also loads TREG1 and TREG2 to maintain C5x object-code compatibility with the TMS320C2x. TRM = 0 C2x-compatible mode. Any C2x-compatible instruction that loads TREG0 also loads TREG1 and TREG2 because the C2x uses TREG as a shift count for the prescaling shifter and as a bit address in the BITT instruction. C5x-enhanced mode. Any C2x-compatible instruction does not load TREG1 and TREG2. The C2x-compatible instructions affect only TREG0 of the C5x.
TRM = 1
BRAF
Block repeat active flag bit. This bit indicates that a block repeat is currently active. BRAF = 0 The block repeat is deactivated. The BRAF bit is cleared when the block repeat counter register (BRCR) decrements below 0. The block repeat is active. The BRAF bit is automatically set when an RPTB instruction is executed.
BRAF = 1
Program Control
4-9
Table 44. On-Chip RAM Configuration Using OVLY and RAM Bits
Bit values OVLY 0 0 1 1 RAM 0 1 0 1 On-Chip SARAM Configuration Disabled. The on-chip SARAM is not addressable. The on-chip SARAM is mapped into program space. The on-chip SARAM is mapped into data space. The on-chip SARAM is mapped into both program and data spaces.
4.4.3
4-10
1513 ARP 12 11 10 1 9 80 DP OV OVM INTM
Function
Auxiliary register pointer. These bits select the auxiliary register (AR) to be used in indirect addressing. When the ARP is loaded, the previous ARP value is copied to the auxiliary register buffer (ARB) in ST1. The ARP can be modified by memory-reference instructions when you use indirect addressing, and by the MAR or LST #0 instruction. When an LST #1 instruction is executed, the ARP is loaded with the same value as the ARB. Overflow flag bit. This bit indicates that an arithmetic operation overflow in the arithmetic logic unit (ALU). The OV bit can be modified by the LST #0 instruction. OV = 0 OV = 1 Overflow did not occur in the ALU. The OV bit is cleared by a reset or a conditional branch (BCND/BCNDD on OV/NOV). Overflow does occur in the ALU. As a latched overflow signal, the OV bit remains set.
12
OV
11
OVM
Overflow mode bit. This bit enables/disables the accumulator overflow saturation mode in the arithmetic logic unit (ALU). The OVM bit can be modified by the LST #0 instruction. OVM = 0 Disabled. An overflowed result is loaded into the accumulator without modification. The OVM bit can be cleared by the CLRC OVM instruction. Overflow saturation mode. An overflowed result is loaded into the accumulator with either the most positive (00 7FFF FFFFh) or the most negative value (FF 8000 0000h). The OVM bit can be set by the SETC OVM instruction.
OVM = 1
10
Program Control
4-11
Function
Interrupt mode bit. This bit globally masks or enables all interrupts. The INTM bit has no effect on the nonmaskable RS and NMI interrupts. Note that the INTM bit is unaffected by the TRAP and LST #0 instructions. The INTM bit is not saved on the stack or restored from the stack on an automatic context save during interrupt service routines. INTM = 0 INTM = 1 All unmaskable interrupts are enabled. The INTM bit can be cleared by the CLRC INTM or RETE instruction. All maskable interrupts are disabled. The INTM bit can be set by the SETC INTM or INTR instruction, a RS and IACK signal, or when a maskable interrupt trap is taken.
80
DP
Data memory page pointer bits. These bits specify the address of the current data memory page. The DP bits are concatenated with the 7 LSBs of an instruction word to form a direct memory address of 16 bits. The DP bits can be modified by the LST #0 or LDP instruction.
4-12
The ST1 bits are shown in Figure 45 and defined in Table 46.
1513 ARB 12 11 10 9 8 1 7 1 6 5 1 4 3 1 2 1 1 0 CNF TC SXM C HM XF PM
Function
Auxiliary register buffer. This 3-bit field holds the previous value contained in the auxiliary register pointer (ARP) in ST0. Whenever the ARP is loaded, the previous ARP value is copied to the ARB, except when using the LST #0 instruction. When the ARB is loaded using the LST #1 instruction, the same value is also copied to the ARP. This is useful when restoring context (when not using the automatic context save) in a subroutine that modifies the current ARP. On-chip RAM configuration control bit. This 1-bit field enables the on-chip dual-access RAM block 0 (DARAM B0) to be addressable in data memory space or program memory space. The CNF bit can be modified by the LST #1 instruction. CNF = 0 The on-chip DARAM block 0 is mapped into data memory space. The CNF bit can be cleared by a reset or the CLRC CNF instruction. The on-chip DARAM block 0 is mapped into program memory space. The CNF bit can be set by the SETC CNF instruction.
12
CNF
CNF = 1 11 TC X
Test/control flag bit. This 1-bit flag stores the results of the arithmetic logic unit (ALU) or parallel logic unit (PLU) test bit operations. The TC bit is affected by the APL, BIT, BITT, CMPR, CPL, NORM, OPL, and XPL instructions. The status of the TC bit determines if the conditional branch, call, and return instructions execute. The TC bit can be modified by the LST #1 instruction. TC = 0 The TC bit can be cleared by the CLRC TC instruction or any one of the following events:
-
The result of the logical operation is 1 when tested by the APL, OPL, or XPL instructions. A bit tested by the BIT or BITT instruction is equal to 0. A compare condition is false when tested by the CMPR or CPL instruction. The result of the exclusive-OR operation is false when tested by the NORM instruction.
Program Control
4-13
Function
TC = 1 The TC bit can be set by the SETC TC instruction or any one of the following events:
-
The result of the logical operation is 0 when tested by the APL, OPL, or XPL instructions. A bit tested by the BIT or BITT instruction is equal to 1. A compare condition is true when tested by the CMPR or CPL instruction. The result of the exclusive-OR operation is true when tested by the NORM instruction.
10
SXM
Sign-extension mode bit. This 1-bit field enables/disables sign extension of an arithmetic operation. The SXM bit does not affect the operations of certain arithmetic or logical instructions; the ADDC, ADDS, SUBB, or SUBS instruction suppresses sign extension, regardless of SXM. The SXM bit can be modified by the LST #1 instruction. SXM = 0 SXM = 1 Sign extension is suppressed. The SXM bit can be cleared by the CLRC SXM instruction. Sign extension is produced on data as the data is passed into the accumulator through the scaling shifter. The SXM bit can be set by a reset or the SETC SXM instruction.
Carry bit. This 1-bit field indicates an arithmetic operation carry or borrow in the arithmetic logic unit (ALU). The single-bit shift and rotate instructions affect the C bit. The C bit can be modified by the LST #1 instruction. C=0 The result of a subtraction generates a borrow or the result of an addition (except ADD with a 16-bit shift instruction) did not generate a carry. The ADD with a 16-bit shift instruction can only set the bit (by a carry operation); otherwise, the bit is unaffected. The C bit can be cleared by the CLRC C instruction. The result of an addition generates a carry or the result of a subtraction (except SUB with a 16-bit shift instruction) did not generate a borrow. The SUB with a 16-bit shift instruction can only clear the bit (by a borrow operation); otherwise, the bit is unaffected. The C bit can be set by a reset or the SETC C instruction.
C=1
4-14
Function
These bits are read as 1. Hold mode bit. This 1-bit field determines whether the central processing unit (CPU) stops or continues execution when acknowledging an active HOLD signal. The HM bit can be modified by the LST #1 instruction. HM = 0 The CPU continues execution from on-chip program memory but puts its external interface in the high-impedance state. The HM bit can be cleared by the CLRC HM instruction. The CPU halts internal execution. The HM bit can be set by a reset or the SETC HM instruction.
HM = 1 5 4 XF 1 1
This bit is read as 1. XF pin status bit. This 1-bit field determines the level of the external flag (XF) output pin. The XF bit can be modified by the LST #1 instruction. The XF bit is not saved or restored from the stack on an automatic context save during interrupt service routines. XF = 0 XF = 1 The XF output pin is set to a logic low. The XF bit can be cleared by the CLRC XF instruction. The XF output pin is set to a logic high. The XF bit can be set by a reset or the SETC XF instruction.
32 10 PM
11 00
These bits are read as 1. Product shift mode bits. This 2-bit field determines the product shifter (P-SCALER) mode and shift value for the product register (PREG) output into the arithmetic logic unit (ALU). The PM bits can be set by the SPM or LST #1 instruction. See Table 47 for the product shifter modes. The PM shifts also occur when the PREG contents are stored to data memory. The PREG contents remain unchanged during the shifts. See Section 3.2, Central Arithmetic Logic Unit (CALU), on page 3-7 for details.
Program Control
4-15
4-16
Conditional Operations
4.5.1
Conditional Branch
The BCND (conditional branch) is a 2-word instruction. The conditions for the branch are not stable until the fourth cycle of the branch instruction pipeline execution, because the previous instruction must have completely executed for the accumulators status bits to be accurate. Therefore, following the branch, the pipeline controller stops the decode of instructions until the conditions are valid. If the conditions defined in the operands of the instruction are met, the PC is loaded with the second word and the CPU starts filling the pipeline with instructions at the branch address. Because the pipeline has been flushed, the branch instruction has an effective execution time of four cycles if the branch is taken. If, however, any of the conditions are not met, the pipeline controller allows the next instruction (already fetched) to be decoded. This means that if the branch is not taken, the effective execution time of the branch is two cycles.
Program Control
4-17
Conditional Operations
4.5.2
Conditional Call
The CC (conditional call) is a 2-word instruction. The CC instruction operates like the BCND except that the PC pointing to the instruction following the CC is pushed onto the stack. Thus, the return (RET) operation can pop the stack to return to the calling sequence. A subroutine or function can have multiple return paths depending on the data being processed.
4.5.3
Conditional Return
The C5x supports conditional returns (RETC) to avoid conditionally branching around the return. Example 41 shows an overflow-handling subroutine called if the main algorithm causes an overflow condition. During the subroutine, the ACC is checked and, if it is positive, the subroutine returns to the calling sequence. If it is not positive, additional processing is necessary before the return. Note that RETC, like RET, is a 1-word instruction. However, because of the potential PC discontinuity, RETC operates with the same effective execution time as BCND and CC.
;Overflow-handling routine.
GEQ
;Return.
4.5.4
Multiconditional Instructions
Multiple conditions can be defined in the operands of the conditional instructions. All defined conditions must be met. The C5x includes instructions that test multiple conditions before passing control to another section of the program. These instructions are: BCND, BCNDD, CC, CCD, RETC, RETCD, and XC. These instructions can test the conditions listed in Table 48 individually or in combination with other conditions.
4-18
Conditional Operations
You can combine conditions from the following four groups (Table 49). You can select up to four conditions; however, each of these conditions must be from different groups. You cannot have two conditions from the same group. For example, you can test EQ and TC at the same time but not NEQ and GEQ. For example:
BCND BRANCH,LT,NOV,TC ; If ACC < 0, no overflow ; and TC bit set.
In this example, LT (ACC < 0), NOV (OV = 0), and TC (TC = 1) conditions must be met for the branch to be taken. For a description of the condition codes, see Section 4.5, Conditional Operations, on page 4-17.
4.5.5
Program Control
4-19
Conditional Operations
The code in Example 42 executes in six cycles (two for the OPL and four for the BCND). The code in Example 43 executes in four cycles because the two dead cycles following the BCNDD are filled with the OPL instruction. The condition tested on the branch is not affected by the OPL instruction, thereby allowing it to be executed after the branch.
4.5.6
Conditional Execution
In cases where you want the conditional branch to skip over one or two words of code, the branch can be replaced with the execute conditionally (XC) instruction. There are two forms of the XC instruction. One form is the conditional execute of a 1-word instruction (XC 1). The second form is the conditional execute of one 2-word instruction or two 1-word instructions (XC 2). Conditions for XC are the same as for conditional branches, calls, and returns (see Table 48 on page 4-17). Example 44 shows a code example for a conditional branch and Example 45 shows a code example for a conditional execution.
SUM
The code in Example 44 executes in six cycles (four for the BCND, one for the ADD, and one for the APAC). The code in Example 45 executes in three cycles (one each for the XC, ADD, and APAC). If the condition (C = 1) is met in Example 45, the ADD instruction is executed. If the condition is not met, a no operation (NOP) instruction is executed instead of the ADD.
4-20
Conditional Operations
The condition (C = 1) must be stable one full cycle before the XC instruction is executed. This ensures that the decision is made before the instruction following XC is decoded. You should avoid changing the XC test conditions in the 1-word instruction before XC. If no interrupts occur, this instruction has no effect on XC. However, if an interrupt occurs, it can trap between the instruction and XC, thus, affecting the condition before XC is executed. Example 46 and Example 47 show cycle dependency for the XC instruction.
In the code in Example 46, the NEQ condition (ACC = TEMP1 0) is not stable one full cycle before the XC instruction is executed. The NEQ status, caused by the ADD instruction, is not established because the ADD is only a 1-cycle instruction. Therefore, the previous EQ condition, caused by the LACL instruction, determines the conditional execute. Since the condition is met (ACC = 0), the one 2-word instruction is executed, and TEMP2 is loaded by the SPLK instruction. If an interrupt occurs, it can trap before XC and after ADD so the SPLK instruction cannot execute. In the code in Example 47, the NEQ condition (ACC 0) is stable one full cycle before the XC instruction is executed. The NEQ status, caused by the ADD instruction, is established because the long immediate value (#01234h) used with ADD is a 2-cycle instruction. Since the condition is not met, a NOP instruction is executed instead of the one 2-word instruction, and TEMP2 is not affected. If an interrupt occurs, it has no effect on this instruction sequence.
Program Control
4-21
The RPTC is a memory-mapped register. However, you should avoid writing to this register. Writing to this register can cause undesired results. You can use the repeat function with instructions such as multiply/accumulates, block moves, I/O transfers, and table reads/writes. When you use the repeat function, these multicycle instructions are pipelined and the instruction effectively becomes a single-cycle instruction after the first iteration. Absolute program or data addresses are automatically incremented when you use the repeat function. For example, the TBLR instruction can require three or more cycles to execute, but when the instruction is repeated, a table location can be read every cycle. Not all instructions can be repeated or are meaningful to repeat. Table 410 through Table 413 list all C5x instructions according to their repeatability.
4-22
Table 410. Multi-cycle Instructions Transformed Into Single-Cycle Instructions by the Repeat Function
Mnemonic BLDD BLDP BLPD IN MAC MACD Description Block move from data to data memory Block move from data to program memory with destination address in BMAR Block move from program to data memory Input data from I/O port to data memory location Add PREG, with shift specified by PM bits, to ACC; load data memory value to TREG0; multiply data memory value by program memory value and store result in PREG Add PREG, with shift specified by PM bits, to ACC; load data memory value to TREG0; multiply data memory value by program memory value and store result in PREG; and move data Add PREG, with shift specified by PM bits, to ACC; load data memory value to TREG0; multiply data memory value by value specified in BMAR and store result in PREG; and move data Add PREG, with shift specified by PM bits, to ACC; load data memory value to TREG0; multiply data memory value by value specified in BMAR and store result in PREG Output data from data memory location to I/O port Transfer data from program to data memory with source address in ACCL Transfer data from data to program memory with destination address in ACCL
MADD
Bold typeface indicates instructions that are new for the C5x instruction set.
Program Control
4-23
MADD
Bold typeface indicates instructions that are new for the C5x instruction set.
4-24
Bold typeface indicates instructions that are new for the C5x instruction set.
Program Control
4-25
Bold typeface indicates instructions that are new for the C5x instruction set.
4-26
Bold typeface indicates instructions that are new for the C5x instruction set.
Program Control
4-27
Bold typeface indicates instructions that are new for the C5x instruction set.
4-28
Bold typeface indicates instructions that are new for the C5x instruction set.
Program Control
4-29
Bold typeface indicates instructions that are new for the C5x instruction set.
4-30
Example 48 implements 16 executions of Y = aX2 + bX + c and saves the maximum value in ACCB. Note that the initialization of the auxiliary registers is not shown in the coded example. PAER is loaded with the address of the last word in the code segment. The label END_LOOP is placed after the last instruction, and the RPTB instruction long immediate is defined as END_LOOP1, in case the last word in the loop is a 2-word instruction.
Program Control
4-31
4.7.1
Example 49. Context Save and Restore Used With Block Repeat
SMMR SMMR SMMR SPLK RPTB . . . END_INNER LMMR OPL LMMR LMMR BRCR,TEMP1 PASR,TEMP2 PAER,TEMP3 #NUM_LOOP,BRCR END_INNER ;Save block repeat counter ;Save block start address ;Save block end address ;Set inner loop count ;For I = 0; I<=BRCR; I++
;Restore block repeat counter ;Set BRAF to continue outer loop ;Restore block start address ;Restore block end address
In Example 49, the context save and restore operations require 14 cycles. Repeated single and BANZ/BANZD loops can also be inside a block repeat and can include subroutine calls. Upon returning from a subroutine call, the block repeat resumes. Repeated blocks can also be interrupted. When an enabled interrupt occurs during a repeated block of code, the CALU traps to the interrupt and, when the interrupt service routine returns, the block repeat resumes. Caution should be exercised when interrupting block repeats. If the interrupt service routine uses block repeats, check whether a block repeat has been interrupted and, if so, save the context of the block repeat, as shown in Example 49. Smaller external loops can be implemented with the BANZDlooping method that requires two extra cycles per loop (that is, if the loop count is less than eight, it can be more efficient to use the BANZD technique). Singlecycle instructions can be repeated within a block repeat by using the RPT or RPTZ instructions. WHILE loops can be implemented with the RPTB instruction and a conditional reset of the BRAF bit. The following code example clears BRAF bit so that the
4-32
processor will drop out of the code loop and continue to sequentially access instructions past the end of the loop if an overflow occurs:
XC APL 2,OV ;If overflow, #0FFFEh,PMST ;then turn off block repeat.
The equivalent of a WHILE loop can be implemented by clearing the BRAF bit if the exit condition is met. If this is done, the program completes the current pass through the loop but does not go back to the top. To exit, the BRAF bit must be cleared at least four instruction words before the end of the loop. You can exit block repeat loops and return to them without stopping and restarting the loop. Branches, calls, and interrupts do not necessarily affect the loop. When program control is returned to the loop, loop execution is resumed. Example 410 shows the block repeat with a small loop of code that executes a series of tasks. The tasks are stored in a table addressed by TEMP0F. The number of tasks to be executed is defined at NUM_TASKS.
TASK_HANDLER LACC TEMP0F ADD #1 SACL TBLR LACC CALA ENDCALL TEMP0F TEMP0E TEMP0E
In the setup of Example 410, the BRCR is loaded with the number of tasks to be executed. Next, the address of the task table is loaded into a temporary register. The block repeat is started with the execution of the RPTB instruction. The PASR is loaded with the address of the LACC TEMP0F instruction. The PAER is loaded with the address of the last word of code. Notice that the label marking the end of the loop is placed after the last instruction, then the PAER is loaded with that label, minus 1. It is possible to place the label before the CALA instruction, then load the PAER with the label address because this is a 1-word instruction. However, if the last instruction in this loop had been a 2-word instruction, the second word of the instruction would not be read and the long immediate operand would be substituted with the first instruction in the loop.
Program Control
4-33
Inside the loop, the pointer to the task table is incremented and saved. Then, the task address is read from the table and loaded into the ACC. Next, the task is called by the CALA instruction. Notice that, when the task returns to the task handler, it returns to the top of the loop. This is because the PC has already been loaded with the PASR before the CALA executes the PC discontinuity. Therefore, when the CALA is executed, the address at the top of the loop is pushed onto the PC stack.
4.7.2
Example 411. Interrupt Operation With a Single-Word Instruction at the End of an RPTB
RPTB END_LOOP1 SAR AR0,* return from interrupt here if not the last loop iteration . . . LACC *+ SACL * interrupt occurs here ENDLOOP: MAR *,AR1 return from interrupt here if interrupt occurs during last two instruction words of the last loop iteration
4-34
Example 412. Interrupt Operation With a Single-Word Instruction Before the End of RPTB
RPTB END_LOOP1 SAR AR0,* . . . BLDD BMAR,*+ SACL * END_LOOP: MAR *,AR1
Program Control
4-35
Interrupts
4.8
Interrupts
The C5x CPU supports 16 user-maskable interrupts (INT16INT1); however, each C5x DSP does not necessarily use all 16 interrupts. For example, all the C5x DSPs use only 9 of these interrupts except C57, which uses 10 of them (the others are tied high internally). External interrupts are generated by external hardware using INT1INT4. Internal interrupts generated by the on-chip peripherals are:
- The timer (TINT) - The serial ports (RINT, XINT, TRNT, TXNT, BRNT, and BXNT) - Host port interface (HINT)
In addition, the C5x has three software interrupt instructions, INTR, NMI, and TRAP; and two external nonmaskable interrupts, RS and NMI. The reset (RS) interrupt has the highest priority, and the INT16 interrupt has the lowest priority. The INT1INT4 and NMI interrupts are valid if the signal is high for at least two machine cycles and low for a minimum of three machine cycles. This triggering gives the C5x the ability to avoid false interrupts from noise or taking multiple interrupts on a single, long interrupt signal. Note: If the CPU is in IDLE2 mode, an interrupt input must be high for at least four machine cycles and low for a minimum of five machine cycles to be properly recognized.
4.8.1
TEMP0 resides in DARAM block B2 and holds the address of the interrupt service routine (ISR). Note that the ISR addresses must be loaded into block B2 before interrupts are enabled. For further information regarding interrupt operation with respect to specific DSPs in the C5x generation, see subsection 9.1.2, External Interrupts, on page 9-4.
4-36
RINT2 on C52; BRNT on C56/C57 XINT2 on C52; BXNT on C56/C57
NMI
TRAP
HINT
INT4
TXNT
TRNT{
XINT
RINT
TINT
INT3
INT2
INT1
RS
Name
4063
3839
2633
2023
Dec
36
34
24
18
16
14
12
10
The interrupt vectors can be remapped to the beginning of any 2K-word page in program memory space. The interrupt vector address is generated by concatenating the IPTR bits in the PMST (see subsection 4.4.2, Processor Mode Status Registers (PMST), on page 4-7) with the interrupt vector number (116) shifted by 1 as shown in Figure 46.
Upon reset, the IPTR bits are all cleared, thereby mapping the vectors to page 0 in program memory space. Therefore, the reset vector always resides at location 0h in program memory space. You can move the interrupt vectors to another location by loading a nonzero value into the IPTR bits. For example, you can move the interrupt vectors of INT 5 (as shown in Figure 46) to location 080Ah by loading the IPTR with 1.
Location 1A21 283F 2627 1417 Hex 24 22 18 12 10 C E A 8 6 4 2 0 1 (highest) Priority N/A N/A N/A N/A N/A 10 11 2 9 8 7 6 5 4 3 Software interrupts Reserved for emulation and test Nonmaskable interrupt Software trap instruction Reserved HINT (C57 only) Reserved External user interrupt #4 TDM port transmit interrupt TDM port receive interrupt Serial port transmit interrupt Serial port receive interrupt Internal timer interrupt External user interrupt #3 External user interrupt #2 External user interrupt #1 External nonmaskable reset signal Function
Program Control
Interrupts
4-37
Interrupts
Vector
0 A
4.8.2
Interrupt Operation
When an interrupt occurs, a flag is activated in the 16-bit interrupt flag register (IFR). The interrupt flag is activated whether the interrupt is enabled or disabled. An interrupt flag (other than from an active serial port) is automatically cleared when the corresponding interrupt trap is taken. The number of the specific interrupt being acknowledged is indicated by address bits A5A1 on the falling edge of the interrupt acknowledge (IACK) signal. If the interrupt vectors reside in on-chip memory, the CPU should operate in address visibility mode (AVIS = 0) so the interrupt number can be decoded. If an interrupt occurs while the CPU is on hold and HM = 0, the address will not be present when the IACK is activated. Upon receiving an interrupt, the following actions occur:
-
The CPU completes execution of current instruction. Interrupts are globally disabled (INTM = 1). The PC is pushed to the top of the stack (TOS). The PC is set to the interrupt vector address. Key registers are saved into context shadow registers. IACK signal goes low. Corresponding interrupt flag bit in the IFR is cleared.
The C5x recognizes pending interrupts on a priority basis. At the start of each machine cycle (when INTM = 0), the interrupt status is polled and the highest priority interrupt present and enabled is executed. When an interrupt is being serviced, even higher priority interrupts cannot be serviced until interrupts are reenabled usually at the end of the ISR.
4-38
Interrupts
4.8.3
Note that when interrupts are disabled (INTM = 1) and an interrupt causes an IDLE or IDLE2 instruction to be exited, none of the IFR bits are cleared (including the IFR bit that caused the IDLE or IDLE2 to be exited). The only event, other than reset or clearing the IFR bits directly in software, that can cause an IFR bit to be cleared is actually taking the interrupt trap when the the ISR is entered. Therefore, if an interrupt causes an IDLE or IDLE2 instruction to be exited when interrupts are disabled, the corresponding IFR bit is not cleared; whereas, if interrupts are enabled and the ISR is entered, the IFR bit is cleared. Figure 47 shows the IFR fields. A value of 1 in an IFR bit indicates a pending interrupt. A 1 can be written to a specific bit to clear the corresponding interrupt. Writing a 0 to a specific bit has no effect. All pending interrupts can be cleared by writing the current contents of the IFR back into the IFR. The following example clears two interrupts, INT1 and INT3, without affecting any other flags that have been set:
SPLK #5,IFR ;Clear flags for INT1 and INT3.
The IFR sets only one flag for each interrupt recognized. If several hardware interrupts occur on the same pin before the interrupt is recognized by the CPU, the CPU will respond as though only a single interrupt (the last one) had occurred.
Lowest Priority Highest
1512
11
10
Reserved
HINT
Reserved
INT4
TXNT
TRNT
XINT
RINT
TINT
INT3
INT2
INT1
Program Control
4-39
Interrupts
4.8.4
1512 11 10 9 8 7 6 5 4 3 2 1 0 Reserved HINT Reserved INT4 TXNT TRNT XINT RINT TINT INT3 INT2 INT1
A value of 1 in an IMR bit enables the corresponding interrupt, provided that the INTM bit in ST0 (see subsection 4.4.3, Status Registers (ST0 and ST1), on page 4-10) is cleared. The IMR is accessible with both read and write operations.
4.8.5
The INTM bit does not modify the IFR or IMR. Any one of the following events sets the INTM bit:
-
The C5x is reset (RS is active). An interrupt trap is taken. The NMI instruction is executed. The SETC INTM instruction is executed.
4-40
Interrupts
4.8.6
Nonmaskable Interrupts
The two nonmaskable interrupts, RS and NMI, are unaffected by either the INTM bit or the contents of the IMR. You can use the NMI as a soft reset of the C5x or as the input to a systems most time-critical interrupt event. When used as a soft reset, NMI does not perform any of the control bit or register initializations that are provided by the RS function. The NMI trap can be initiated via software using the NMI instruction. Upon receiving an NMI, the following actions occur: 1) The CPU completes execution of all instructions in the pipeline. 2) Interrupts are globally disabled (INTM = 1). 3) The PC is set to the NMI interrupt vector (location 24h). Because it is possible to service an NMI, even during an ISR, the key registers are not saved automatically. The NMI is different from RS because it does not affect any of the C5x modes. The NMI is delayed by multicycle instructions (including RPT) and by HOLD, as described in subsection 4.8.9, Interrupt Latency, on page 4-43. RS is discussed in Section 4.9, Reset, on page 4-45.
4.8.7
Software-Initiated Interrupts
Not all of the 16 CPU interrupts are utilized on any given C5x DSP. The vectors for the interrupts that are not tied to specific external pins or internal peripherals can be used as software interrupts. The three software interrupt instructions, INTR, NMI, and TRAP, are unaffected by either the INTM bit or the contents of the IMR. These instructions allow interrupts to be invoked under software control. The INTR instruction (page 6-111) allows any ISR to be executed from your software. An INTR interrupt for the external interrupts (INT1INT4) executes like an external interrupt described in subsection 4.8.2, Interrupt Operation. The NMI instruction (page 6-179) has the same affect as a hardware nonmaskable interrupt (NMI). The NMI instruction transfers program control to program memory location 24h. Interrupts are globally disabled (INTM = 1), but key registers are not saved into context shadow registers. The TRAP instruction (page 6-277) transfers program control to program memory location 22h. The TRAP instruction disables interrupts (INTM = 1), but key registers are not saved into context shadow registers.
Program Control
4-41
Interrupts
4.8.8
Accumulator (ACC) Accumulator buffer (ACCB) Auxiliary register compare register (ARCR) Index register (INDX) Processor mode status register (PMST) Product register (PREG) Status register 0 (ST0) Status register 1 (ST1) Temporary register 0 (TREG0) for multiplier Temporary register 1 (TREG1) for shift count Temporary register 2 (TREG2) for bit test
When the interrupt trap is taken, the contents of all these registers are pushed onto a 1-level stack, with the exception of the the INTM bit in ST0 and the XF bit in ST1. On an interrupt, the INTM bit is always set to disable interrupts. The values in the registers at the time of the interrupt trap are still available to the ISR but are also protected in the shadow registers. The shadow registers are copied back to the CPU registers when the RETI or RETE instruction is executed. This function allows the CPU to be used for the ISR without requiring context save and restore overhead in the ISR. With only a 1-level stack for the registers, nested interrupts cannot be supported. In most cases this is not a problem, because without the context save and restore overhead, serial processing of the interrupts is so efficient that nested interrupt handling is less effective. If the application requires nested interrupts, they can be handled by using a software stack. Software compatibility with the C2x is maintained because the RET instruction, if it is used to return from the ISR on a C2x, cannot restore these registers. Interrupts are not enabled unless a RETE or CLRC INTM instruction is executed. In the case where the ISR needs to modify values in these registers with respect to the interrupted code, these registers can be restored from the stack and modified as shown in Example 413.
4-42
Interrupts
In Example 413, the address of the re-entry point within the ISR is pushed onto the PC stack. The RETI instruction pops all the stacks, including the PC stack, and resumes execution. At the end of the ISR, a standard return is executed because the stack is already popped.
4.8.9
Interrupt Latency
The interrupt latency of the C5x depends on the current contents of the pipeline. The CPU always completes all instructions in the pipeline before executing a software vector. Figure 49 shows the minimum latency from the time an interrupt occurs externally to the IACK. The minimum IACK time is defined as eight cycles:
- 3 cycles to externally synchronize the interrupt - 1 cycle for the interrupt to be recognized by the CPU - 4 cycles to execute the INTR instruction and flush the pipeline
On the sixth cycle, an INTR is jammed into the pipeline and the INTM bit is set to 1. On the ninth cycle, the interrupt vector is fetched and the IACK signal is generated. Note that if the instruction immediately ahead of the INTR in the pipeline (Main5 in Figure 49) is an SST #0 and INTM was previously cleared, INTM gets set before this instruction executes and INTM is stored as a 1. Therefore, if ST0 is restored in order to return to the previous context, interrupts will be disabled (INTM = 1) rather than enabled. Accordingly, if this is critical in an application, an SST #0 instruction should be executed only with interrupts disabled or interrupts should be reenabled after loading ST0, if necessary.
Program Control
4-43
Interrupts
The maximum latency is a function of the contents of the pipeline. Multicycle instructions add additional cycles to empty the pipeline. This applies to instructions that are extended via wait-state insertion on memory accesses. The wait states required for interrupt vector accesses also affect the latency. The repeat instructions (RPT and RPTZ) delay execution of interrupts (including NMI, but not RS). The repeat instructions require that all executions of the next instruction be completed before allowing an interrupt to execute to protect the context of the repeated instructions. This protection is necessary, because these instructions run parallel operations in the pipeline, and the context of these additional parallel operations cannot be saved in the ISR. The HOLD function takes precedence over interrupts and can delay the interrupt trap. If an interrupt occurs when the CPU is in hold (HOLD asserted), the interrupt is not taken until HOLDA is deasserted when the hold state ends. However, if the CPU is in the concurrent hold mode (HM = 0) and the interrupt vector table is located in on-chip memory, the CPU takes the interrupt regardless of the HOLD status. Interrupts cannot be processed between the CLRC INTM instruction and the next instruction in a program sequence. If an interrupt occurs during the decode phase of the CLRC INTM instruction, the CPU always completes CLRC INTM and the following instruction before the pending interrupt is processed. Waiting for these instructions to complete, ensures that a return (RET) can be executed in an ISR before the next interrupt is processed to protect against PC stack overflow. If the ISR is ends with an RETE instruction, the CLRC INTM instruction is unnecessary. Similarly, the SETC INTM instruction and the next instruction cannot be interrupted.
4-44
Reset
4.9 Reset
Reset (RS) is a nonmaskable external interrupt that can be used at any time to place the C5x into a known state. Reset is typically applied after power-up when the C5x is in an unknown state. The reset signal aborts memory operations; therefore, the system should be reinitialized after each reset. Reset is the highest priority interrupt; thus, no other interrupt takes precedence over a reset. You can use the NMI interrupt for soft resets because the NMI does not abort memory operations or initialize status bits. A hardware reset clears all pending interrupt flags. Driving the RS signal low causes the C5x to terminate execution and forces the PC to the reset vector location 0h in program memory space. At power-up, the state of the C5x is undefined. For correct system operation after power-up, the RS signal must be asserted low for a minimum of six clock cycles so that the data lines are placed into the high-impedance state and the address lines are driven low. The C5x latches the reset pulse and generates an internal reset pulse long enough to guarantee a reset. After the RS signal is high for 17 clock cycles, CPU execution begins at location 0h, which normally contains a branch instruction to the system initialization routine. When the C5x receives a reset signal, the following sequence of actions occur: 1) The program currently being executed is asynchronously aborted. 2) The CPU registers status bits are set per Table 415. Note that any remaining status bits remain undefined and should be initialized appropriately. 3) The PC is cleared. The address bus is unknown while RS is low. If HOLD is asserted while RS is low, HOLDA is generated. In this case, the address lines are placed into a high-impedance state until HOLD is brought back high. 4) A synchronized reset (SRESET) signal is sent to the peripheral circuits to initialize them. The peripheral registers status bits are set per Table 416 on page 4-47. See subsection 9.1.3, Peripheral Reset, on page 9-6. Execution starts from program memory location 0h when the RS signal is driven high. If HOLD is asserted while RS is low, normal reset operation occurs internally, but all buses and control lines remain in a high-impedance state, and HOLDA is asserted, as shown in Figure 410(a) and (b) on page 4-49. However, if RS is asserted while HOLD and HOLDA are low, the CPU comes out of the hold mode momentarily by deactivating HOLDA. This condition should be avoided. Upon release of HOLD and RS, execution starts from location 0h.
Program Control
4-45
Reset
Note that the external parallel interface signals are asynchronously disabled during reset; therefore, external DMA is not supported during reset. See subsection 8.6.2, External DMA, on page 8-24 for more information.
BRAF 0 IPTR 0
GREG RPTC
4-46
Reset
XSREMPTY 0
Program Control
4-47
Reset
4-48
Reset
HOLD
HOLDA
b)
RS
HOLD
HOLDA
Program Control
4-49
Power-Down Mode
4-50
Power-Down Mode
Program Control
4-51
Chapter 5
Addressing Modes
This chapter describes each of the following addressing modes and gives the opcode formats and some examples.
-
Direct addressing Indirect addressing Immediate addressing Dedicated-register addressing Memory-mapped register addressing Circular addressing
Topic
5.1 5.2 5.3 5.4 5.5 5.6
Page
Direct Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Indirect Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Immediate Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14 Dedicated-Register Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17 Memory-Mapped Register Addressing . . . . . . . . . . . . . . . . . . . . . . . . . 5-19 Circular Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21
Addressing Modes
5-1
Direct Addressing
9
15
DP
dma
PAGE 3 PAGE 2
DAB
PAGE 1 PAGE 0
128-WORD PAGE
5-2
Direct Addressing
Note: The DP is not initialized by reset and, therefore, is undefined after power-up. The C5x development tools, however, use default values for many parameters, including the DP. Because of this, programs that do not explicitly initialize the DP may execute improperly, depending on whether they are executed on a C5x device or with a development tool. Thus, it is critical that all programs initialize the DP in software.
Figure 52 illustrates the direct addressing mode. Bits 15 through 8 contain the opcode. Bit 7, with a value of 0, defines the addressing mode as direct, and bits 6 through 0 contain the dma.
ADD opcode
8 7 6
010h
0
Machine Code
0 0 1 0
0 1 0 1
0 0 0 1
0 0 0 0
DP
1 1 0 0
1 1 1 0
DAB Operand
Note:
1 1 0 0 Data(DAB)
1 1 1 0
1 0 0 1
0 0 0 0
Addressing Modes
5-3
Indirect Addressing
ARB
ARP 3 (ARP = 2)
AR1 AR2 AR3 AR4 AR5 AR6 AR7 16 ARAU 16-bit data address 16 16
To select a specific AR, load the auxiliary register pointer (ARP) with a value from 0 through 7, designating AR0 through AR7, respectively. The register pointed to by the ARP is referred to as the current auxiliary register (current AR). You can load the address into the AR using the LAR instruction and you can change the content of the AR by the:
-
ADRK instruction MAR instruction SBRK instruction Indirect addressing field of any instruction supporting indirect addressing.
The content of the current AR is used as the address of the data memory operand. After the instruction uses the data value, the content of the current AR can be incremented or decremented by the auxiliary register arithmetic unit (ARAU), which implements unsigned 16-bit arithmetic.
5-4
Indirect Addressing
The ARAU performs auxiliary register arithmetic operations in the decode phase of the pipeline (when the instruction specifying the operation is being decoded). This allows the address to be generated before the decode phase of the next instruction. The content of the current AR is incremented or decremented after it is used in the current instruction. You can load the ARs via the data bus by using memory-mapped writes to the ARs. The following instructions can write to the memory-mapped ARs: APL BLDD LMMR OPL SACH SACL SAMM SMMR SPLK XPL
Be careful when using these memory-mapped loads of the ARs because, in this case, the memory-mapped ARs are modified in the execute phase of the pipeline. This causes a pipeline conflict if one of the next two instruction words modifies that AR. For further information on the pipeline and possible pipeline conflicts, see Chapter 7, Pipeline. There are two ways to use the ARs for purposes other than referencing data memory addresses:
- Use the ARs to support conditional branches, calls, and returns by using
the CMPR instruction. This instruction compares the content of the current AR with the content of the auxiliary register compare register (ARCR) and puts the result in the test/control (TC) flag bit of status register ST1.
- Use the ARs for temporary storage by using the LAR instruction to load
a value into the AR and the SAR instruction to store the AR value to a data memory location.
5.2.1
AR as the data memory address, but neither increments nor decrements the content of the current AR.
- Increment or decrement by one. The instruction uses the content of the
current AR as the data memory address and then increments or decrements the content of the current AR by 1.
- Increment or decrement by an index amount. The value in INDX is the
index amount. The instruction uses the content of the current AR as the data memory address and then increments or decrements the content of the current AR by the index amount.
Addressing Modes
5-5
Indirect Addressing
value in INDX is the index amount. The instruction uses the content of the current AR as the data memory address and then increments or decrements the content of the current AR by the index amount. The addition or subtraction is done using reverse carry propagation. The contents of the current AR are used as the address of the data memory operand. Then, the ARAU performs the specified mathematical operation on the indicated AR. Additionally, the ARP can be loaded with a new value. All indexing operations are performed on the current AR in the same cycle as the original instruction decode phase of the pipeline. Indirect auxiliary register addressing lets you make post-access adjustments of the current AR. The adjustment may be an increment or decrement by one or may be based upon the contents of the INDX. To maintain compatibility with the C2x devices, clear the NDX bit in the PMST. In the C2x architecture, the current AR can be incremented or decremented by the value in the AR0. When the NDX bit is cleared, every AR0 modification or LAR write also writes the ARCR and INDX with the same value. Subsequent modifications of the current ARs with indexed addressing will use the INDX, therefore maintaining compatibility with existing C2x code. The NDX bit is cleared at reset. The bit-reversed addressing modes (see subsection 5.2.3 on page 5-12) helps you achieve efficient I/O by the resequencing of data points in a radix-2 fast Fourier transform (FFT) program. The direction of carry propagation in the ARAU is reversed when bit-reversed addressing is selected, and INDX is added to/subtracted from the current AR. Normally, this addressing mode requires that INDX first be set to a value corresponding to one-half of the arrays size, and that the current AR be set to the base address of the data (the first data point). The following indirect-addressing symbols are used in the C5x assembly language instructions: * No increment or decrement. Content of the current AR is used as the data memory address and is neither incremented nor decremented. Increment by 1. Content of the current AR is used as the data memory address. After the memory access, the content of the current AR is incremented by 1. Decrement by 1. Content of current AR is used as the data memory address. After the memory access, the content of the current AR is decremented by 1. Increment by index amount. Content of current AR is used as the data memory address. After the memory access, the content of INDX is added to the content of the current AR.
*+
*0+
5-6
Indirect Addressing
*0
Decrement by index amount. Content of current AR is used as the data memory address. After the memory access, the content of INDX is subtracted from the content of the current AR. Increment by index amount, adding with reverse carry. Content of current AR is used as the data memory address. After the memory access, the content of INDX with reverse carry propagation is added to the content of the current AR. Decrement by index amount, subtracting with reverse carry. Content of current AR is used as the data memory address. After the memory access, the content of INDX with reverse carry propagation is subtracted from the content of the current AR.
*BR0+
*BR0
5.2.2
158 7 I 6 5 4 3 20 Opcode IDV INC DEC N NAR
Addressing Modes
5-7
Indirect Addressing
INC
Auxiliary register increment bit. This 1-bit field determines whether the current AR is incremented. The INC bit works in conjunction with the IDV and DEC bits to determine the arithmetic operation. INC = 0 INC = 1 The current AR is not incremented. The current AR is incremented as determined by the IDV bit.
DEC
Auxiliary register decrement bit. This 1-bit field determines whether the current AR is decremented. The DEC bit works in conjunction with the IDV and INC bits to determine the arithmetic operation. See Table 52 for specific arithmetic operations. DEC = 0 DEC = 1 The current AR is not decremented. The current AR is decremented as determined by the IDV bit.
Next auxiliary register indicator bit. This 1-bit field determines whether the instruction will change the ARP value. N=0 N=1 The content of the ARP will remain unchanged. The content of NAR will be loaded into the ARP, and the old ARP value is loaded into the auxiliary register buffer (ARB) of status register ST1.
20
NAR
Next auxiliary register value bits. This 3-bit field contains the value of the next auxiliary register. If the N bit is set, NAR is loaded into the ARP.
5-8
Indirect Addressing
Addressing Modes
5-9
Indirect Addressing
Table 53. Instruction Field Bit Values for Indirect Addressing (Continued)
Instruction Field Bit Values 158 Opcode Opcode 7 1 1 6 1 1 5 1 1 4 1 1 3 0 1 20 NAR NAR Notation *BR0+ *BR0+, ARn Operation (Current AR) + rcINDX current AR (Current AR) + rcINDX current AR, NAR ARP
5-10
0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0
In Example 51, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The current AR is not changed. The instruction word is 2880h.
0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0
In Example 52, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The current AR is decremented by 1. The instruction word is 2890h.
0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0
In Example 53, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The current AR is incremented by 1. The instruction word is 28A0h.
Indirect Addressing
Example 57. Indirect Addressing With INDX Subtracted from AR With Reverse Carry
0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 1
In Example 54, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The current AR is incremented by 1. The auxiliary register pointer (ARP) is loaded with the value 3 for subsequent instructions. The instruction word is 28ABh.
0 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0
In Example 55, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The content of INDX is subtracted from the current AR. The instruction word is 28D0h.
0 0 1 0 1 0 0 0 1 1 1 0 0 0 0 0
In Example 56, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The content of INDX is added to the current AR. The instruction word is 28E0h.
0 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0
ADD *BR0 ,8
In Example 57, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The content of INDX with reverse carry propagation is subtracted from the current AR. The instruction word is 28C0h.
Addressing Modes
5-11
Indirect Addressing
Example 58. Indirect Addressing With INDX Added to AR With Reverse Carry
ADD *BR0+,8
5.2.3
Bit-Reversed Addressing
In the bit-reversed addressing mode, INDX specifies one-half the size of the FFT. The value contained in the current AR must be equal to 2n1, where n is an integer, and the FFT size is 2n. An auxiliary register points to the physical location of a data value. When you add INDX to the current AR using bitreversed addressing, addresses are generated in a bit-reversed fashion. Assume that the auxiliary registers are eight bits long, that AR2 represents the base address of the data in memory (0110 00002), and that INDX contains the value 0000 10002. Example 510 shows a sequence of modifications to AR2 and the resulting values of AR2. Table 54 shows the relationship of the bit pattern of the index steps and the four LSBs of AR2, which contain the bitreversed address.
5-12
0 0 1 0 1 0 0 0 1 1 1 1 0 0 0 0
In Example 58, the content of the data memory address, defined by the content of the current AR, is shifted left 8 bits and added to the ACC. The content of INDX with reverse carry propagation is added to the current AR. The instruction word is 28F0h.
Indirect Addressing
Addressing Modes
5-13
Immediate Addressing
5.3.1
Operand
1 1 1 1
1 1 1 1
5-14
Immediate Addressing
5.3.2
5.3.2.1
01234h
5.3.2.2
Immediate Addressing
012h
Machine Code1
1 0 1 0
1 0 0 0
0 0 0 1
0 0 1 0
DP
1 1 0 0
1 1 1 0
DAB
1 1 0 0
1 1 1 0
1 0 0 1
0 0 1 0
PC Operand1 Operand2
Note:
0 0 1 1
0 1 0 0
0 1 0 1
5-16
Dedicated-Register Addressing
The content of data memory location 200h is copied to data memory location 100 on the current data page.
- Exclude the immediate value from a parallel logic unit (PLU) instruction:
OPL
DAT10 ;DP = 6. DBMR contains the value FFF0h. ;Address 030Ah contains the value 01h
The content of data memory location 030Ah is ORed with the content of the DBMR. The resulting value FFF1h is stored back in memory location 030Ah.
5.4.1
Addressing Modes
5-17
Dedicated-Register Addressing
012h
Machine Code
1 0 1 0
1 1 0 0 0 0 0 1
0 0 1 0
DP
1 1 0 0
1 1 1 0
1 1 1 0
1 0 0 1
0 0 1 0
5.4.2
010h
Machine Code
0 1 0 1
1 0 1 0
0 0 0 1
0 0 0 0
DP
1 1 0 0
1 1 1 0
1 1 0 0 Data(DAB) DBMR
1 1 1 0
1 0 0 1
0 0 0 0
5-18
LAMM Load accumulator with memory-mapped register LMMR Load memory-mapped register SAMM Store accumulator in memory-mapped register SMMR Store memory-mapped register
Figure 510 illustrates how this is done by forcing the 9 MSBs of the data memory address to 0, regardless of the current value of the DP when direct addressing is used or of the current AR value when indirect addressing is used. Example 511 uses memory-mapped register addressing in the direct addressing mode and Example 512 uses the indirect addressing mode.
dma
PAGE 0
DAB
128-WORD PAGE
Addressing Modes
5-19
In Example 511, assume that ARP = 3 and AR3 = FF07h. The content of the ACC is stored to the PMST (address 07h) pointed at by the 7 LSBs of AR3.
In Example 512, assume that DP = 0184h and TEMP1 = 8060h. The content of memory location 07h (PMST) is loaded into the ACC. Figure 511 illustrates memory-mapped register addressing in the direct addressing mode.
07h
Machine Code
0 0 0 0
1 0 0 0
0 0 0 0
0 1 1 1
Value
0 0 0 0
0 0 0 0
DAB Operand
Note:
0 0 0 0 Data(DAB)
0 0 0 0
0 0 0 0
0 1 1 1
5-20
Circular Addressing
CBSR1 Circular buffer 1 start register CBSR2 Circular buffer 2 start register CBER1 Circular buffer 1 end register CBER2 Circular buffer 2 end register CBCR Circular buffer control register
The 8-bit CBCR enables and disables the circular buffer operation and is defined in subsection 4.4.1, Circular Buffer Control Register (CBCR), on page 4-6. To define circular buffers, you first load the start and end addresses into the corresponding buffer registers; next, load a value between the start and end registers for the circular buffer into an AR. Load the proper AR value, and set the corresponding circular buffer enable bit in the CBCR. Note that you must not enable the same AR for both circular buffers; if you do, unexpected results occur. The algorithm for circular buffer addressing below shows that the test of the AR value is performed before any modifications: If (ARn = CBER) and (any AR modification), Then: ARn = CBSR. Else: ARn = ARn + step. If ARn = CBER and no AR modification occurs, the current AR is not modified and is still equal to CBER. When the current AR = CBER, any AR modification (increment or decrement) will set the current AR = CBSR. Example 513 illustrates the operation of circular addressing.
Addressing Modes
5-21
Circular Addressing
In circular addressing, the step is the quantity that is being added to or subtracted from the specified AR. Take care when using a step of greater than 1 to modify the AR pointing to an element of the circular buffer. If an update to an AR generates an address outside the range of the circular buffer, the ARAU does not detect this situation, and the buffer does not wrap around. AR updates are performed as described in Section 5.2, Indirect Addressing. Because of the pipeline, there is a two-cycle latency between configuring the CBCR and performing AR modifications. Circular buffers can be used in increment- or decrement-type updates. For incrementing the value in the AR, the value in CBER must be greater than the value in CBSR. For decrementing the value in the AR, the value in CBSR must be greater than the value in CBER.
5-22
Chapter 6
Topic
6.1 6.2 6.3
Page
Instruction Set Symbols and Notations . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 Instruction Set Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22
6-1
6.1.1
ARX BITX CM I kkkk kkkk k kkkk kkkk k kkkk kkkk kkkk I NTR #
PM SHF SHFT
6-2
TP
Two 4-bit fields designating the following bit conditions to be tested and the bit states: Bit Z L V C Condition ACC = 0 ACC < 0 Overflow Carry
A conditional instruction contains two of these 4-bit fields. The 4-LSB field of the instruction is a mask field. A 1 in a mask bit indicates that the corresponding condition is being tested. The second 4-bit field (bits 47) indicates the state of the conditions being tested. For example, to test for ACC 0, the Z and L bits of the 4-LSB field are set, while the V and C bits are not set. When the Z bit is set, it indicates to test for the condition ACC = 0; when the L bit is set, it indicates to test for the condition ACC 0. The conditions possible with these 8 bits are shown in the BCND, BCNDD, CC, CCD, RETC, RETCD, and XC instructions. To determine if the conditions are met, the 4-LSB field is ANDed with the 4-bit field containing the state of the conditions. If any bits are set, the conditions are met. + 1 word The second word of a two-word opcode. This second word contains a 16-bit constant. Depending on the instruction, this constant is a long immediate value, a program memory address, or an address for an I/O port or an I/O-mapped register.
6-3
6.1.2
6-4
n A value of 1 or 2 designating the number of words following the XC instruction. Overflow bit (in ST0) OV OVLY OVM NDX PA PAER PASR RAM overlay bit (in PMST) Overflow mode bit (in ST0) Enable extra index register bit (in PMST) A 16-bit address for an I/O port or an I/O-mapped register ( 0 PA 65535 ) Block Repeat Program Address End Register
Block Repeat Program Address Start Register Program counter Prefetch counter PC PFC PGMn PM pma PREG RAM bit Label assigned to program memory location n Product shift mode bits (in ST1) A 16-bit program memory address Product register Program RAM enable bit (in PMST) Repeat counter
RPTC shift A 4-bit shift value from 015 A 3-bit shift value from 07 Source address field shift2 src
6-5
6.1.3
xy
r(nm) (r(nm))
6-6
italic symbols
[,x]
[,x1 [,x2 ] ]
6-7
on page 6-13)
- Parallel logic unit (PLU) instructions (Table 66 on page 6-14) - TREG0, PREG, and multiply instructions (Table 67 on page 6-15) - Branch and call instructions (Table 68 on page 6-17) - I/O and data memory operation instructions (Table 69 on page 6-19) - Control instructions (Table 610 on page 6-20)
The number of words that an instruction occupies in program memory is specified in the Words column of the table. Several instructions specify two values in the Words column because different forms of the instruction occupy a different number of words. For example, the ADD instruction occupies one word when the operand is a short immediate value or two words if the operand is a long immediate value. The number of cycles that an instruction requires to execute is in the Cycles column of the table. The tables assume that all instructions are executed from internal program memory (ROM) and internal data memory (RAM). The cycle timings are for single-instruction execution, not for repeat mode. Additional information is presented in Section 6.3, Instruction Set Descriptions on page 6-22. Bold typeface indicates instructions that are new for the C5x instruction set.
A read or write access to any peripheral memory-mapped register in data memory locations 20h4Fh will add one cycle to the cycle time shown. This occurs because all peripherals perform these accesses over the TI Bus, which requires an additional cycle.
Note that all writes to external memory require two cycles. Reads require one cycle. Any write access immediately before or after a read cycle will require three cycles (refer to Chapter 8). In addition, if two pipelined instructions try to access the same 2K-word single-access memory block simultaneously, one
6-8
extra cycle is required. For example, the DMOV instruction when used with the RPT instruction, requires one cycle in the dual-access RAM but requires two cycles in the single-access RAM. Wait states are added to all external accesses according to the configuration of the software wait-state registers described in Section 9.4, Software-Programmable Wait-State Generators, on page 9-13.
1 1 1 2 2 1 1
1 1 1 2 2 1 1
1011 1111 + 1 word 1011 1110 + 1 word 1011 1011 1110 1111
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode. Peripheral memory-mapped register access
6-9
1011 1111 + 1 word 0110 0110 1011 0110 0000 1010 1001 1001 1011 1000
NEG NORM OR
1 1 1 2 2
1 1 1 2 2
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode. Peripheral memory-mapped register access
6-10
1SHF IAAA 0SHF IAAA 1000 1110 1110 1110 1110 1110 1110 1110 1110 IAAA 0101 0101 0001 0001 0000 0001 0000 0001
Barrel-shift ACC right 0 or 16 bits as specified by TREG1 Barrel-shift ACC right as specified by TREG1 Subtract ACCB from ACC Subtract ACCB and logical inversion of carry bit from ACC Shift ACC left 1 bit Shift ACCB and ACC left 1 bit Shift ACC right 1 bit Shift ACCB and ACC right 1 bit
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode. Peripheral memory-mapped register access
6-11
SUBC SUBS
1 1
1 1
0000 0110
1010 0110
6-265 6-267
SUBT
0110
0111
IAAA AAAA
6-269
XOR
1 2 2 1 1 1
1 2 2 1 1 1
0110
1100
Exclusive-OR long immediate, with left shift of 16, with ACC Exclusive-OR long immediate, with left shift, with ACC XORB ZALR ZAP Exclusive-OR ACCB with ACC Zero ACCL and load ACCH with rounding Zero ACC and PREG
1011 1110 + 1 word 1011 1111 + 1 word 1011 0110 1011 1110 1000 1110
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode. Peripheral memory-mapped register access
6-12
Table 65. Auxiliary Registers and Data Memory Page Pointer Instructions
Mnemonic ADRK CMPR LAR Description Add short immediate to AR Compare AR with ARCR as specified by CM bits Load data memory value to ARx Load short immediate to ARx Load long immediate to ARx LDP Load data memory value to DP bits Load short immediate to DP bits MAR SAR SBRK Modify AR Store ARx in data memory location Subtract short immediate from AR Words 1 1 1 1 2 1 1 1 1 1 Cycles 1 1 2 2 2 2 2 1 1 1 Opcode 0111 1011 0000 1011 1000 1111 kkkk 0100 kkkk 01CM AAAA kkkk 1ARX AAAA kkkk AAAA AAAA kkkk Page 6-42 6-95 6-124 6-124 6-124 6-127 6-127 6-166 6-227 6-234
1011 1111 + 1 word 0000 1011 1000 1000 0111 1101 110I 1011
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode.
6-13
IAAA
AAAA
6-48
1 2 1
1 2 1
IAAA
AAAA
6-184
2 1
2 1
IAAA IAAA
AAAA AAAA
6-251 6-284
IAAA
AAAA
6-284
1 1
1 1
0111 0111
0101 0011
IAAA IAAA
AAAA AAAA
6-133 6-138
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode.
6-14
LTD
0111
0010
IAAA
AAAA
6-142
LTP
0111
0001
IAAA
AAAA
6-145
LTS
0111
0100
IAAA
AAAA
6-147
MAC
IAAA
AAAA
6-149
MACD
IAAA
AAAA
6-153
MADD
1010
1011
IAAA
AAAA
6-158
MADS
1010
1010
IAAA
AAAA
6-162
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode.
6-15
MPYS
0101
0001
IAAA
AAAA
6-173
MPYU
0101
0101
IAAA
AAAA
6-175
1 1 1 1
1 1 1 1
SPL
1000
1100
IAAA
AAAA
6-249
SPM SQRA
1 1
1 1
1011 0101
1111 0010
0000 IAAA
00PM AAAA
6-252 6-253
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode.
6-16
ZPR
1011
1110
0101
1000
6-290
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode.
2 2 2 2 2 1
4 or 2# 2 4 or 2# 2 2 4
1110 00TP ZLVC ZLVC + 1 word 1111 00TP ZLVC ZLVC + 1 word 0111 1101 + 1 word 1011 1110 1AAA AAAA 0011 0000
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode. Conditions true # Condition false
6-17
1110 10TP ZLVC ZLVC + 1 word 1111 10TP ZLVC ZLVC + 1 word 1011 1110 011 I NTR#
1 1 1 1 1 1
4 4 2 4 or 2# 2 4
0101 0000
0010 0000
RETI TRAP
1 1
4 4
1011 1011
1110 1110
0011 0101
1000 0001
6-209 6-277
XC
111N
6-278
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode. Conditions true # Condition false
6-18
IAAA
AAAA
6-67
1010
1101
IAAA
AAAA
6-67
0101
0111
IAAA
AAAA
6-73
BLPD
1010
0100
IAAA
AAAA
6-76
IAAA
AAAA
6-76
1 2 2 2 2 1
1 2 2 or 3 3 2 or 3 3
1010 1111 + 1 word 1000 1001 + 1 word 0000 1100 + 1 word 0000 1001 + 1 word 1010 0110
TBLW
1010
0111
IAAA
AAAA
6-274
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode. Peripheral memory-mapped register access
6-19
Clear interrupt mode (INTM) bit Clear external flag (XF) pin IDLE IDLE2 LST Idle until nonmaskable interrupt or reset Idle until nonmaskable interrupt or reset low-power mode Load data memory value to ST0 Load data memory value to ST1 NOP POP POPD PSHD PUSH No operation Pop top of stack to ACCL; zero ACCH Pop top of stack to data memory location Push data memory value to top of stack Push ACCL to top of stack
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode.
6-20
1011 1110 + 1 word 1011 1110 + 1 word 1011 1110 + 1 word 1011 1011 1011 1011 1011 1011 1011 1011 1000 1000 1110 1110 1110 1110 1110 1110 1110 1110 1110 1111
SETC
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
0100 0100 0100 0100 0100 0100 0100 0100 IAAA IAAA
0011 0111 1001 1011 1111 1101 0101 0001 AAAA AAAA
6-235 6-235 6-235 6-235 6-235 6-235 6-235 6-235 6-257 6-257
Bold typeface indicates instructions that are new for the C5x instruction set. The cycle timings are for single-instruction execution, not for repeat mode.
6-21
Assembler syntax Operands Opcodes Execution Status Bits Description Words Cycles Examples
The EXAMPLE instruction is provided to familiarize you with the format of the instruction descriptions and to explain what is described under each heading.
6-22
Syntax
EXAMPLE dma [,shift ] EXAMPLE {ind} [,shift ] [,ARn ] EXAMPLE #k EXAMPLE #lk
Each instruction description begins with an assembly language syntax expression. A source statement can contain four ordered fields. The general syntax for source statements is as follows: [label ] [:]
mnemonic
[operand list ]
[;comment ]
placed either before the instruction mnemonic on the same line or on the preceding line in the first column.
- One or more blanks must separate each field. Tab characters are equiva-
lent to blanks.
- Comments are optional. Comments that begin in column 1 can begin with
an asterisk or a semicolon (* or ;), but comments that begin in any other column must begin with a semicolon. See Table 62 on page 6-4 for definitions of symbols and abbreviations used in the syntax expression. Operands 0 dma 127 0 pma 65535 0 shift 15 0 shift2 7 0n7 0 k 255 0 lk 65535 0x7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Operands can be constants or assembly-time expressions that refer to memory, I/O ports, register addresses, pointers, shift counts, and a variety of other constants. This section also gives the range of acceptable values for the operand types. Opcode
15 x 14 x 13 x 12 x 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 x 0 x
The opcode graphic shows bit values or field names that make up each instruction. See Table 61 on page 6-2 for definitions of symbols and abbreviations used in the instruction opcodes.
6-23
Execution
(PC) + 1 PC (ACC) + (dma) ACC 0 C The execution section symbolically represents the process that takes place when the instruction is executed. See Table 62 on page 6-4 for definitions of symbols and abbreviations used in the execution section.
Status Bits
Affects: C and OV
An instructions execution may be affected by the state of the fields in the status registers; also it may affect the state of the status register fields. Both the effects on and the effects of the status register fields are listed in this section. Description This section describes the instruction execution and its effect on the rest of the processor or memory contents. Any constraints on the operands imposed by the processor or the assembler are discussed. The description parallels and supplements the information given symbolically in the execution section. This section specifies the number of memory words required to store the instruction and its extension words. This section provides tables showing the number of cycles required for a given instruction to execute in a given memory configuration both as a single instruction and in the repeat (RPT) mode. The following are examples of the cycle timing tables.
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1 1+d External Memory 1+p 1+p 2+d+p
Words
Cycles
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n n+nd External Memory n+p n+p n+1+p+nd
6-24
The column headings in the tables indicate the program source location. The program source locations are defined as follows: ROM DARAM SARAM The instruction executes from on-chip program ROM. The instruction executes from on-chip dual-access program RAM. The instruction executes from on-chip single-access program RAM.
If an instruction requires memory operand(s), the rows in the tables indicate the location(s) of the operand(s). The operands are defined as follows: DARAM SARAM External ROM MMR MMPORT The operand is in internal dual-access RAM. The operand is in internal single-access RAM. The operand is in external memory. The operand is in internal program ROM. The operand is a memory-mapped register. The operand is a memory-mapped I/O port.
The number of cycles required for each instruction is given in terms of the processor machine cycles (CLKOUT1 period). The additional wait states for program/data memory and I/O accesses are defined below. Note that these additional cycles can be generated by the on-chip software wait-state generator or by the external READY signal. These variables can also use the subscripts src, dst, and code to indicate source, destination, and code, respectively. d Data memory wait states. Represents the number of additional clock cycles the device waits for external data memory to respond to an access. I/O wait states. Represents the number of additional clock cycles the device waits for an external I/O to respond to an access. Repetitions (where n > 2 to fill the pipeline). Represents the number of times a repeated instruction is executed. Program memory wait states. Represents the number of additional clock cycles the device waits for external program memory to respond to an access.
io n p
6-25
Table 611 lists the on-chip single-access RAM available on each C5x processor. The on-chip single-access RAM is divided into 1K- and/or 2K-word blocks contiguous in address memory space. All C5x processors support parallel accesses to these on-chip SARAM blocks. However, one SARAM block allows only one access per cycle. In other words, the processor can read/write on one SARAM block while accessing another SARAM block. All external reads require at least one machine cycle while all external writes require at least two machine cycles. However, if an external write is immediately followed or preceded by an external read cycle, then the external write requires three cycles. See Section 8.9, External Memory Interface Timings, on page 8-39 for details. If you use an on-chip wait-state generator to add m (m>0) wait states to an external access, then both the external reads and the external writes require m+1 cycles, assuming that the external READY line is driven high. If you use the READY input line to add m additional cycles to an external access, then external reads require m+1 cycles and external write accesses require m+2 cycles. See Section 9.4, Software-Programmable Wait-State Generators, on page 9-13 and the data sheet for READY electrical specifications.
6-26
Device C50 SARAM Block size Hex Address Range 08000FFF 100017FF 9K-word 2K-word block 2K-word block 2K-word block 2K-word block 1K-word block 1K-word block 2K-word block 1K-word block 2K-word block 2K-word block 2K-word block 2K-word block 2K-word block 2K-word block 18001FFF 200027FF 28002BFF C51 1K-word 3K-word 08000BFF 08000FFF 100013FF C53/C53S LC56 6K-word 08000FFF 100017FF 18001FFF 08000FFF 100017FF C57S/LC57 6K-word 18001FFF
the same memory section (on-chip or external) as the current instruction, except in instructions that cause a program counter discontinuity, such as B, CALL, etc.
- When executing a single instruction, there is no pipeline conflict between
the current instruction and the instructions immediately preceding or following that instruction. The only exception is the conflict between the fetch phase of the pipeline and the memory read/write (if any) access of the instruction under consideration. See Chapter 7 for pipeline operation.
- In the repeat execution mode, all conflicts caused by the pipelined execu-
tion of that instruction are considered. Refer to Appendix B for a summary of instruction cycle classifications. Example Example code is shown for each instruction. The effect of the code on memory and/or registers is summarized.
6-27
ABS None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 0
Affects: C and OV
If the contents of the accumulator (ACC) are greater than or equal to 0, the contents of the ACC is unchanged. If the contents of the ACC are less than 0, the contents of the ACC is replaced by its 2s-complement value. The ABS instruction clears the C bit. Note that 8000 0000h is a special case. When the OVM bit is cleared, the ABS of 8000 0000h is 8000 0000h. When the OVM bit is set, the ABS of 8000 0000h is 7FFF FFFFh. In either case, the OV bit is set. ABS is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
ABS
Before Instruction ACC X C 1234h ACC 0 C After Instruction 1234h
Example 2
ABS
Before Instruction ACC X C FFFF FFFFh ACC 0 C After Instruction 1h
6-28
Example 3
ABS ;(OVM = 1)
Before Instruction ACC X C X OV 8000 0000h ACC 0 C 1 OV After Instruction 7FFF FFFFh
Example 4
ABS ;(OVM = 0)
Before Instruction ACC X C X OV 8000 0000h ACC 0 C 1 OV After Instruction 8000 0000h
6-29
ADCB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 0 1 0 0 1
Execution
Status Bits
Affects: C and OV
Description
The contents of the accumulator buffer (ACCB) and the value of the C bit are added to the contents of the accumulator (ACC). The result is stored in the ACC and the contents of the ACCB are unaffected. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. ADCB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ADCB
Before Instruction ACC ACCB 1 C 1234h 2h ACC ACCB 0 C After Instruction 1237h 2h
6-30
Syntax
ADD dma [,shift ] ADD {ind} [,shift ] [,ARn ] ADD #k ADD #lk [,shift]
Operands
0 dma 127 0 shift 16 (defaults to 0) 0n7 0 k 255 32768 lk 32767 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with shift
15 0 14 0 13 1 12 0 11 10 9 SHFT 8 7 0 6 5 4 3 2 dma 1 0
Opcode
Execution
Short immediate addressing: (PC) + 1 PC (ACC) + k ACC Long immediate addressing: (PC) + 2 PC (ACC) + (lk 2shift ) ACC Status Bits
Description
If direct, indirect, or long immediate addressing is used, the contents of the data memory address (dma) or a 16-bit constant are shifted left, as defined by the shift code, and added to the contents of the accumulator (ACC). The result is stored in the ACC. During shifting, the accumulator low byte (ACCL) is zero-filled. If the SXM bit is cleared, the high-order bits of the ACC are zerofilled; if the SXM bit is set, the high-order bits of the ACC are sign-extended. Note that when the auxiliary register pointer (ARP) is updated during indirect addressing, you must specify a shift operand. If you dont want a shift, you must enter a 0 for this operand. For example:
ADD*+,0,AR0
If short immediate addressing is used, an 8-bit positive constant is added to the contents of the ACC. The result is stored in the ACC. In this mode, no shift value may be specified and the addition is unaffected by the SXM bit. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. If a 16-bit shift is specified with the ADD instruction, the C bit is set only if the result of the addition generates a carry; otherwise, the C bit is unaffected. This allows the accumulation to generate the proper single carry when a 32-bit number is added to the ACC. ADD is an accumulator memory reference instruction (see Table 64). Words 1 2 (Direct, indirect, or short immediate addressing) (Long immediate addressing)
6-32
Cycles
For the short and long immediate addressing modes, the ADD instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (short immediate addressing) ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
Example 1
ADD
DAT1,1
;(DP = 6)
Before Instruction After Instruction Data Memory 301h ACC 0 C 1h 04h
1h 2h
6-33
Example 2
ADD
*+,0,AR0
Before Instruction ARP AR4 Data Memory 302h ACC X C 4 0302h 2h 2h ARP AR4 Data Memory 302h ACC 0 C After Instruction 0 0303h 2h 04h
Example 3
ADD
Example 4
ADD
6-34
ADDB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 0 1 0 0 0
Execution
Status Bits
Affects: C and OV
Description
The contents of the accumulator buffer (ACCB) are added to the contents of the accumulator (ACC). The result is stored in the ACC and the contents of the ACCB are unaffected. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. ADDB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ADDB
Before Instruction ACC ACCB X C 1234h 2h ACC ACCB 0 C After Instruction 1236h 2h
6-35
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 0 10 0 9 0 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Affects: C and OV
The contents of the data memory address (dma) and the value of the C bit are added to the contents of the accumulator (ACC) with sign extension suppressed. The result is stored in the ACC. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. The ADDC instruction can be used in performing multiple-precision arithmetic. ADDC is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
6-36
Example 1
Example 2
6-37
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 0 10 0 9 1 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Status Bits
Affects: C and OV
Description
The contents of the data memory address (dma) are added to the contents of the accumulator (ACC) with sign extension suppressed. The data is treated as an unsigned 16-bit number, regardless of the SXM bit. The contents of the ACC are treated as a signed number. The result is stored in the ACC. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. The ADDS instruction produces the same results as an ADD instruction with the SXM bit cleared and a shift count of 0. ADDS is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
6-38
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
ADDS *
Before Instruction ARP AR0 Data Memory 300h ACC X C 0 0300h FFFFh 7FFF 0000h ARP AR0 Data Memory 300h ACC 0 C After Instruction 0 0300h FFFFh 7FFF FFFFh
6-39
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 0 10 0 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (ACC) + ((dma) 2TREG1(30) ) ACC If SXM = 0: (dma) is not sign-extended If SXM = 1: (dma) is sign-extended
Status Bits
Affects: C and OV
Description
The contents of the data memory address (dma) are shifted left from 0 to 15 bits, as defined by the 4 LSBs of TREG1, and added to the contents of the accumulator (ACC). The result is stored in the ACC. Sign extension on the dma value is controlled by the SXM bit. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs. Subsequent calls to the ADDT instruction will shift the value by the TREG1 value (which is the same as TREG0), maintaining C5x object-code compatibility with the C2x. ADDT is an accumulator memory reference instruction (see Table 64).
Words
6-40
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-41
ADRK #k 0 k 255
15 0 14 1 13 1 12 1 11 1 10 0 9 0 8 0 7 6 5 4 3 2 8-Bit Constant 1 0
Execution
(PC) + 1 PC (current AR) + 8-bit positive constant current AR None affected. The 8-bit immediate value, right-justified, is added to the current auxiliary register (AR). The result is stored in the AR. The addition takes place in the auxiliary register arithmetic unit (ARAU), with the immediate value treated as an 8-bit positive integer. All arithmetic operations on the AR are unsigned. ADRK is an auxiliary registers and data memory page pointer instruction (see Table 65).
Words Cycles
Example
ADRK #80h
Before Instruction ARP AR5 5 4321h ARP AR5 After Instruction 5 43A1h
6-42
Syntax
Operands
0 dma 127 0n7 lk: 16-bit constant 0 shift 16 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 1 13 1 12 0 11 1 10 1 9 1 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 1 10 1 9 1 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Direct or indirect addressing: (PC) + 1 PC (ACC(150)) AND (dma) ACC(150) 0 ACC(3116) Long immediate addressing: (PC) + 2 PC (ACC(300)) AND (lk 2shift ) ACC
If a long immediate constant is specified, the constant is shifted left and zeroextended on both ends and is ANDed with the contents of the accumulator (ACC). The result is stored in the ACC. If a constant is not specified, the contents of the data memory address (dma) are ANDed with the contents of the accumulator low byte (ACCL). The result is stored in the ACCL and the accumulator high byte (ACCH) is zero-filled. AND is an accumulator memory reference instruction (see Table 64).
6-43
Words Cycles
1 2
For the long immediate addressing modes, the AND instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block.
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block.
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
Example 1
Example 2
AND *
Before Instruction ARP AR0 Data Memory 0301h ACC 0 0301h FF00h 1234 5678h ARP AR0 Data Memory 0301h ACC After Instruction 0 0301h FF00h 0000 5600h
6-44
Example 3
AND #00FFh,4
Before Instruction ACC 1234 5678h ACC After Instruction 0000 0670h
6-45
ANDB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 0 1 1 0 0
Execution
(PC) + 1 PC (ACC) AND (ACCB) ACC None affected. The contents of the accumulator (ACC) are ANDed with the contents of the accumulator buffer (ACCB). The result is stored in the ACC and the contents of the ACCB are unaffected. ANDB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ANDB
Before Instruction ACC ACCB 0F0F FFFFh 5555 5555h ACC ACCB After Instruction 0505 5555h 5555 5555h
6-46
APAC None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 0 2 1 1 0 0 0
Execution
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the contents of the accumulator (ACC). The result is stored in the ACC. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. The contents of the PREG are always sign extended. The APAC instruction is a subset of the LTA, LTD, MAC, MACD, MADS, MADD, MPYA, and SQRA instructions. APAC is a TREG0, PREG, and multiply instruction (see Table 67).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
6-47
Syntax Operands
Direct: Indirect:
0 dma 127 lk: 16-bit constant 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with long immediate not specified
15 0 14 1 13 0 12 1 11 1 10 0 9 1 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
Execution
Long immediate not specified: (PC) + 1 PC (dma) AND (DBMR) dma Long immediate specified: (PC) + 2 PC (dma) AND lk dma
Affects: TC
If a long immediate constant is specified, the constant is ANDed with the contents of the data memory address (dma). If a constant is not specified, the contents of the dma are ANDed with the contents of the dynamic bit manipulation register (DBMR). In both cases, the result is written directly back to the dma and the contents of the accumulator (ACC) are unaffected. The TC bit is set, if the result of the AND operation is 0; otherwise, the TC bit is cleared. APL is a parallel logic unit (PLU) instruction (see Table 66).
Words
1 2
6-48
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction (second operand DBMR) ROM 1 1 2+2d DARAM 1 1 2+2d SARAM 1 1, 3 2+2d External Memory 1+p 1+p 5+2d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (second operand DBMR) Operand DARAM SARAM External ROM n 2n2 4n2+2nd DARAM n 2n2 4n2+2nd SARAM n 2n2, 2n+1 4n2+2nd External Memory n+p 2n2+p 4n+1+2nd+p
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate specified) ROM DARAM SARAM External 2 2 3+2d DARAM 2 2 3+2d SARAM 2 2 3+2d External Memory 2+2p 2+2p 6+2d+2p
Cycles for a Repeat (RPT) Execution (long immediate specified) ROM DARAM SARAM External n+1 2n1 4n1+2nd DARAM n+1 2n1 4n1+2nd SARAM n+1 2n1, 2n+2 4n1+2nd External Memory n+1+2p 2n1+2p 4n+2+2nd+2p
6-49
Example 1
Example 2
Example 3
APL #0100h,*,AR6
Before Instruction ARP AR5 Data Memory 300h X TC 5 300h 0FFFh ARP AR5 Data Memory 300h 0 TC After Instruction 6 300h 0100h
Example 4
APL *,AR7
Before Instruction ARP AR6 DBMR Data Memory 310h X TC 6 310h 0303h 0EFFh ARP AR6 DBMR Data Memory 310h 0 TC After Instruction 7 310h 0303h 0203h
6-50
Syntax Operands
B pma [, {ind} [,ARn ] ] 0 pma 65535 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0}
15 0 14 1 13 1 12 1 11 1 10 0 9 8 7 6 0 1 1 16-Bit Constant 5 4 3 2 See Section 5.2 1 0
Opcode
Execution
pma PC Modify current AR and ARP as specified None affected. Control is passed to the program memory address (pma). The current auxiliary register (AR) and auxiliary register pointer (ARP) are modified as specified. The pma can be either a symbolic or numeric address. B is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
B 191,*+,AR1
The value 191 is loaded into the program counter (PC), and the program continues executing from that location. The current AR is incremented by 1, and ARP is set to 1.
6-51
BACC None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 0 3 0 2 0 1 0 0 0
ACC(150) PC None affected. Control is passed to the 16-bit address residing in the accumulator low byte (ACCL). BACC is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
The value 191 is loaded into the program counter (PC), and the program continues executing from that location.
6-52
BACCD None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 0 3 0 2 0 1 0 0 1
ACC(150) PC None affected. The one 2-word instruction or two 1-word instructions following the BACCD instruction are fetched from program memory and executed before the branch is taken. After the instructions are executed, control is passed to the 16-bit address residing in the accumulator low byte (ACCL). BACCD is a branch and call instruction (see Table 68).
Words Cycles
Example
After the current AR, ARP, and DP are modified as specified, program execution continues from location 191.
6-53
Syntax Operands
BANZ pma [, {ind} [,ARn ] ] 0 pma 65535 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0}
15 0 14 1 13 1 12 1 11 1 10 0 9 8 7 6 1 1 1 16-Bit Constant 5 4 3 2 See Section 5.2 1 0
Opcode
Execution
If (current AR) 0: pma PC Else: (PC) + 2 PC Modify current AR as specified None affected. If the contents of the current auxiliary register (AR) are not 0, control is passed to the program memory address (pma); otherwise, control is passed to the next instruction. The default modification to current AR is a decrement by 1. You can cause N loop iterations to be executed by initializing the auxiliary register loop counter to N1 before loop entry. The pma can be either a symbolic or numeric address. BANZ is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
6-54
Example 1
BANZ PGM0
Before Instruction ARP AR0 0 5h ARP AR0 After Instruction 0 4h
0 is loaded into the program counter (PC), and the program continues executing from that location. or
Before Instruction ARP AR0 0 0h ARP AR0 After Instruction 0 FFFFh
PGM191
The contents of data memory locations 60h63h are added to the accumulator (ACC).
6-55
Syntax Operands
BANZD pma [, {ind} [,ARn ] ] 0 pma 65535 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0}
15 0 14 1 13 1 12 1 11 1 10 1 9 8 7 6 1 1 1 16-Bit Constant 5 4 3 2 See Section 5.2 1 0
Opcode
Execution
If (current AR) 0: pma PC Else: (PC) + 2 PC Modify current AR as specified None affected. The one 2-word instruction or two 1-word instructions following the branch instruction are fetched from program memory and executed before the branch is taken. After the instructions are executed if the contents of the current auxiliary register (AR) are not 0, control is passed to the program memory address (pma); otherwise, control is passed to the next instruction. The default modification to current AR is a decrement by 1. You can cause N loop iterations to be executed by initializing the auxiliary register loop counter to N1 before loop entry. The pma can be either a symbolic or numeric address. BANZD is a branch and call instruction (see Table 68).
Words Cycles
6-56
Example
After the current DP and accumulator (ACC) are modified as specified, program execution continues from location 0.
6-57
Syntax Operands
BCND pma, cond [,cond1 ] [,...] 0 pma 65535 Conditions: ACC = 0 ACC 0 ACC < 0 ACC 0 ACC > 0 ACC 0 C=0 C=1 OV = 0 OV = 1 TC = 0 TC = 1 BIO low Unconditionally
12 0 11 0 10 0
Opcode
15 1
14 1
13 1
Execution
If (condition(s)): pma PC Else: (PC) + 2 PC None affected. If the specified conditions are met, control is passed to the program memory address (pma); otherwise, control is passed to the next instruction. Not all combinations of the conditions are meaningful and testing BIO is mutually exclusive to testing TC. BCND is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
6-58
Example
BCND PGM191,LEQ,C
If the accumulator (ACC) contents are less than or equal to 0 and the C bit is set, program address 191 is loaded into the program counter (PC), and the program continues executing from that location. If these conditions are not met, execution continues from location PC + 2.
6-59
Syntax Operands
BCNDD pma, cond [,cond1 ] [,...] 0 pma 65535 Conditions: ACC = 0 ACC 0 ACC < 0 ACC 0 ACC > 0 ACC 0 C=0 C=1 OV = 0 OV = 1 TC = 0 TC = 1 BIO low Unconditionally
12 1 11 0 10 0
Opcode
15 1
14 1
13 1
Execution
If (condition(s)): pma PC Else: (PC) + 2 PC None affected. The one 2-word instruction or two 1-word instructions following the branch are fetched from program memory and executed before the branch is taken. The two instruction words following the BCNDD instruction have no effect on the conditions being tested. After the instructions are executed if the specified conditions are met, control is passed to the program memory address (pma); otherwise, control is passed to the next instruction. Not all combinations of the conditions are meaningful and testing BIO is mutually exclusive to testing TC. BCNDD is a branch and call instruction (see Table 68).
Words Cycles
6-60
Example
After the current AR, ARP, and DP are modified as specified, program execution continues at location 191 if the overflow (OV) bit is set. If the OV bit is cleared, execution continues at the instruction following the LDP instruction.
6-61
Syntax Operands
BD pma [, {ind} [,ARn ] ] 0 pma 65535 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0}
15 0 14 1 13 1 12 1 11 1 10 1 9 8 7 6 0 1 1 16-Bit Constant 5 4 3 2 See Section 5.2 1 0
Opcode
Execution
pma PC Modify current AR and ARP as specified None affected. The one 2-word instruction or two 1-word instructions following the branch instruction are fetched from program memory and executed before the branch is taken. After the instructions are executed, control is passed to the program memory address (pma). The current auxiliary register (AR) and auxiliary register pointer (ARP) are modified as specified. The pma can be either a symbolic or numeric address. BD is a branch and call instruction (see Table 68).
Words Cycles
Example
After the current AR, ARP, and DP are modified as specified, program execution continues from location 191.
6-62
Syntax Operands
Direct: Indirect:
0 dma 127 0n7 0 bit code 15 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 1 13 0 12 0 11 10 9 BITX 8 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 1 13 0 12 0 11 10 9 BITX 8 7 1 6 5 4 3 2 See Section 5.2 1 0
Affects: TC
The specified bit of the data memory address (dma) value is copied to the TC bit in ST1. The APL, BITT, CMPR, CPL, LST1, NORM, OPL, and XPL instructions also affect the TC bit. The bit code value corresponds to a specified bit of the dma, as given by the following table:
Bit (LSB) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (MSB) 15 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 Bit Code 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-64
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 1 10 1 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Affects: TC
The specified bit of the data memory address (dma) value is copied to the TC bit in ST1. The APL, BIT, CMPR, CPL, LST1, OPL, NORM, and XPL instructions also affect the TC bit. The bit code value contained in the 4 LSBs of the TREG2 corresponds to a specified bit of the dma, as given by the following table:
Bit (LSB) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (MSB) 15 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 Bit Code 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
6-65
You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instructions that load TREG0 to write to all three TREGs. Subsequent calls to the BITT instruction will use the TREG2 value (which is the same as TREG0), maintaining C5x object-code compatibility with the C2x. BITT is a control instruction (see Table 610). Words Cycles
Operand DARAM SARAM External
1
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-66
Syntax
General syntax:
All valid cases have the general syntax: Direct BMAR/DMA: BLDD BMAR, dma Indirect BMAR/DMA: BLDD BMAR, {ind} [,ARn ] Direct DMA/BMAR: BLDD dma, BMAR Indirect DMA/BMAR: BLDD {ind}, BMAR [,ARn ] Direct K/DMA: BLDD #addr, dma Indirect K/DMA: BLDD #addr, {ind} [,ARn ] Direct DMA/K: BLDD dma, #addr Indirect DMA/K: BLDD {ind}, #addr [,ARn ] Operands 0 addr 65535 0 dma 127 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with SRC specified by BMAR
15 1 14 0 13 1 12 0 11 1 10 1 9 0 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
6-67
Execution
(PFC) MCS If long immediate: (PC) + 2 PC #lk PFC Else: (PC) + 1 PC (BMAR) PFC While (repeat counter) 0: (src, addressed by PFC) dst or src (dst, addressed by PFC) Modify current AR and ARP as specified (PFC) + 1 PFC (repeat counter) 1 repeat counter (src, addressed by PFC) dst or src (dst, addressed by PFC) Modify current AR and ARP as specified (MCS) PFC
None affected. The contents of the data memory address (dma) pointed at by src (source) are copied to the dma pointed at by dst (destination). The source and/or destination space can be pointed at by a long immediate value, the contents of the block move address register (BMAR), or a dma. Not all src/dst combinations of pointer types are valid. The source and destination blocks do not have to be entirely on-chip or off-chip. In the indirect addressing mode, you can use the RPT instruction with the BLDD instruction to move consecutive words in data memory. The number of words to be moved is one greater than the number contained in the repeat counter register (RPTC) at the beginning of the instruction. If a long immediate value or the contents of the BMAR is specified in the repeat mode, the source and/or destination address is automatically incremented. If a dma is specified in the repeat mode, the dma address is not automatically incremented. When used with the RPT instruction, the BLDD instruction becomes a single-cycle instruction, once the RPT pipeline is started. Interrupts are inhibited during a BLDD operation used with the RPT instruction. BLDD is an I/O and data memory operation instruction (see Table 69).
6-68
Neither the long immediate value nor the BMAR can be used as the address to the on-chip memory-mapped registers. The direct or indirect addressing mode can be used as the address to the on-chip memory-mapped registers.
Words
1 2
(One source or destination is specified by BMAR) (One source or destination is specified by long immediate)
Cycles
Cycles for a Single Instruction (SRC or DEST in BMAR) Operand Source: DARAM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM 2 2 2+dsrc 2 2 2+dsrc 3+ddst 3+ddst 3+dsrc +ddst DARAM 2 2 2+dsrc 2 2 2+dsrc 3+ddst 3+ddst 3+dsrc +ddst SARAM 2 2 2+dsrc 2, 3 2, 3 2+dsrc , 3+dsrc 3+ddst 3+ddst 3+dsrc +ddst External Memory 2+p 2+p 2+dsrc +p 2+p 2+p 2+dsrc +p 5+ddst +p 5+ddst +p 5+dsrc +ddst +p
If the destination operand and the code are in the same SARAM block
6-69
Cycles for a Repeat (RPT) Execution (SRC or DEST in BMAR) Operand Source: DARAM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM n+1 n+1 n+1+ndsrc n+1 n+1, 2n1 n+1+ndsrc 2n+1+nddst 2n+1+nddst 4n1+ndsrc +nddst DARAM n+1 n+1 n+1+ndsrc n+1 n+1, 2n1 n+1+ndsrc 2n+1+nddst 2n+1+nddst 4n1+ndsrc +nddst SARAM n+1 n+1 n+1+ndsrc n+1, n+3 n+1, 2n1, n+3, 2n+1 n+1+ndsrc , n+3+ndsrc 2n+1+nddst 2n+1+nddst 4n1+ndsrc +nddst External Memory n+1+p n+1+p n+1+ndsrc +p n+1+p n+1+p, 2n1+p n+1+ndsrc +p 2n+1+nddst +p 2n+1+nddst +p 4n+1+ndsrc +nddst +p
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
Cycles for a Single Instruction (SRC or DEST long immediate) Operand Source: DARAM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM Destination: SARAM Source: SARAM Destination: SARAM ROM 3 3 3+dsrc 3 3 DARAM 3 3 3+dsrc 3 3 SARAM 3 3 3+dsrc 3, 4 3, 4 External Memory 3+2p 3+2p 3+dsrc +2p 3+2p 3+2p
If the destination operand and the code are in the same SARAM block
6-70
Cycles for a Single Instruction (SRC or DEST long immediate) (Continued) Operand Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External Source: DARAM Destination: DARAM ROM 3+dsrc 4+ddst 4+ddst 4+dsrc +ddst n+2 DARAM 3+dsrc 4+ddst 4+ddst 4+dsrc +ddst n+2 SARAM 3+dsrc , 4+dsrc 4+ddst 4+ddst 4+dsrc +ddst n+2 External Memory 3+dsrc +2p 6+ddst +2p 6+ddst +2p 6+dsrc +ddst +2p n+2+2p
If the destination operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (SRC or DEST long immediate) Operand Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM n+2 n+2+ndsrc n+2 n+2, 2n n+2ndsrc 2n+2+nddst 2n+2+nddst 4n+ndsrc +nddst DARAM n+2 n+2+ndsrc n+2 n+2, 2n n+2ndsrc 2n+2+nddst 2n+2+nddst 4n+ndsrc +nddst SARAM n+2 n+2+ndsrc n+2, n+4 n+2, 2n, n+4, 2n+2 n+2ndsrc , n+4+ndsrc 2n+2+nddst 2n+2+nddst 4n+ndsrc +nddst External Memory n+2+2p n+2+ndsrc n+2+2p n+2+2p, 2n+2p n+2+ndsrc +2p 2n+2+nddst +2p 2n+2+nddst +2p 4n+2+ndsrc +nddst +2p
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
6-71
Example 1
Example 2
BLDD *+,#321h,AR3
Before Instruction ARP AR2 Data Memory 301h 321h 2 301h 01h 0Fh ARP AR2 Data Memory 301h 321h After Instruction 3 302h 01h 01h
Example 3
BLDD BMAR,*
Before Instruction ARP BMAR AR2 Data Memory 320h 340h 2 320h 340h 01h 0Fh ARP BMAR AR2 Data Memory 320h 340h After Instruction 2 320h 340h 01h 01h
Example 4
Example 5
6-72
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 1 13 0 12 1 11 0 10 1 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (PFC) MCS (BMAR) PFC While (repeat counter) 0: dma (dst, addressed by PFC) Modify current AR and ARP as specified (PFC) + 1 PFC (repeat counter) 1 repeat counter dma (dst, addressed by PFC) Modify current AR and ARP as specified (MCS) PFC
None affected. The contents of the data memory address (dma) are copied to the program memory address (pma) pointed at by the block move address register (BMAR). The source and destination blocks do not have to be entirely on-chip or off-chip. In the indirect addressing mode, you can use the RPT instruction with the BLDP instruction to move consecutive words in data memory to a contiguous program memory space pointed at by the BMAR. The number of words to be moved is one greater than the number contained in the repeat counter register (RPTC) at the beginning of the instruction. The contents of the BMAR are automatically incremented when used in the repeat mode. When used with the RPT instruction, the BLDP instruction becomes a single-cycle instruction, once the RPT pipeline is started. Interrupts are inhibited during a BLDP operation used with the RPT instruction. BLDP is an I/O and data memory operation instruction (see Table 69).
6-73
Words Cycles
Cycles for a Single Instruction Operand Source: DARAM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM 2 2 2+dsrc 2 2 2+dsrc 3+pdst 3+pdst 3+dsrc +pdst DARAM 2 2, 3 2+dsrc 2 2 2+dsrc 3+pdst 3+pdst 3+dsrc +pdst SARAM 2 2 2+dsrc 2, 3 2, 3 , 4 2+dsrc , 3+dsrc 3+pdst 3+pdst , 4+pdst 3+dsrc +pdst External Memory 2+p 2+p 3+dsrc +pcode 2+p 2+p 3+dsrc +pcode 4+pdst +pcode 4+pdst +pcode 5+dsrc +pdst +pcode
If the destination operand and the code are in the same SARAM block If both operands and the code are in the same SARAM block If the source operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand Source: DARAM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM ROM n+1 n+1 n+1+ndsrc DARAM n+1 n+1 n+1+ndsrc SARAM n+1 n+1, n+2 n+1+ndsrc External Memory n+1+pcode n+1+pcode n+2+ndsrc +pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block If the source operand and the code are in the same SARAM block
6-74
Cycles for a Repeat (RPT) Execution (Continued) Operand Source: DARAM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM n+1 n+1, 2n1 n+1+ndsrc 2n+1+npdst 2n+1+npdst 4n1+ndsrc +npdst DARAM n+1 n+1, 2n1 n+1+ndsrc 2n+1+npdst 2n+1+npdst 4n1+ndsr +npdst SARAM n+1, n+2 n+1, 2n1, n+2 , 2n+1 n+1+ndsrc , n+2+npsrc 2n+1+npdst 2n+1+npdst , 2n+2+npdst 4n1+ndsrc +npdst External Memory n+1+pcode n+1+pcode , 2n1+pcode n+2+ndsrc +pcode 2n+2+npdst +pcode 2n+2+npdst +pcode 4n+1+ndsrc +npdst +pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block If the source operand and the code are in the same SARAM block
Example 1
Example 2
BLDP *,AR0
Before Instruction ARP AR7 Data Memory 310h BMAR Program Memory 2800h 7 310h F0F0h 2800h 1234h ARP AR7 Data Memory 310h BMAR Program Memory 2800h After Instruction 0 310h F0F0h 2800h F0F0h
6-75
Syntax
General syntax:
All valid cases have the general syntax: Direct BMAR/DMA: BLPD BMAR, dma Indirect BMAR/DMA: BLPD BMAR, {ind} [,ARn ] Direct K/DMA: BLPD #pma, dma Indirect K/DMA: BLPD #pma, {ind} [,ARn ] Operands 0 pma 65535 0 dma 127 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with SRC specified by BMAR
15 1 14 0 13 1 12 0 11 0 10 1 9 0 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
Execution
If long immediate: (PC) + 2 PC (PFC) MCS lk PFC Else: (PC) + 1 PC (PFC) MCS (BMAR) PFC
6-76
While (repeat counter) 0: (pma, addressed by PFC) dst Modify current AR and ARP as specified (PFC) + 1 PFC (repeat counter) 1 repeat counter (pma, addressed by PFC) dst Modify current AR and ARP as specified (MCS) PFC Status Bits Description None affected. The contents of the program memory address (pma) pointed at by src (source) are copied to the data memory address (dma) pointed at by dst (destination). The source space can be pointed at by a long immediate value or the contents of the block move address register (BMAR). The destination space can be pointed at by a dma or the contents of current AR. Not all src/dst combinations of pointer types are valid. The source and destination blocks do not have to be entirely on-chip or off-chip. In the indirect addressing mode, you can use the RPT instruction with the BLPD instruction to move consecutive words in program memory to data memory. The number of words to be moved is one greater than the number contained in the repeat counter register (RPTC) at the beginning of the instruction. If a long immediate value or the contents of the BMAR is specified in the repeat mode, the source address is automatically incremented. When used with the RPT instruction, the BLPD instruction becomes a single-cycle instruction, once the RPT pipeline is started. Interrupts are inhibited during a BLPD operation used with the RPT instruction. BLPD is an I/O and data memory operation instruction (see Table 69). Words 1 2 Cycles
Cycles for a Single Instruction (SRC in BMAR) Operand Source: DARAM/ROM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM ROM 2 2 2+psrc DARAM 2 2 2+psrc SARAM 2 2 2+psrc External Memory 2+pcode 2+pcode 2+psrc +pcode
If the destination operand and the code are in the same SARAM block
6-77
Cycles for a Single Instruction (SRC in BMAR) (Continued) Operand Source: DARAM/ROM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM/ROM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM 2 2 2+psrc 3+ddst 3+ddst 3+psrc +ddst DARAM 2 2 2+psrc 3+ddst 3+ddst 3+psrc +ddst SARAM 2, 3 2, 3 2+psrc , 3+psrc 3+ddst 3+ddst 3+psrc +ddst External Memory 2+pcode 2+pcode 2+psrc +2pcode 5+ddst +pcode 5+ddst +pcode 5+psrc +ddst +pcode
If the destination operand and the code are in the same SARAM block
6-78
Cycles for a Repeat (RPT) Execution (SRC in BMAR) Operand Source: DARAM/ROM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM/ROM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM/ROM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM n+1 n+1 n+1+npsrc n+1 n+1, 2n1 n+1+npsrc 2n+1+nddst 2n+1+nddst 4n1+npsrc +nddst DARAM n+1 n+1 n+1+npsrc n+1 n+1, 2n1 n+1+npsrc 2n+1+nddst 2n+1+nddst 4n1+npsrc +nddst SARAM n+1 n+1 n+1+npsrc n+1, n+3 n+1, 2n1, n+3, 2n+1 n+1+npsrc , n+3+npsrc 2n+1+nddst 2n+1+nddst 4n1+npsrc +nddst External Memory n+1+pcode n+1+pcode n+1+npsrc +pcode n+1+pcode n+1+pcode , 2n1+pcode n+1+npsrc +pcode 2n+1+nddst +pcode 2n+1+nddst +pcode 4n+1+npsrc +nddst +pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
Cycles for a Single Instruction (SRC long immediate) Operand Source: DARAM/ROM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM/ROM Destination: SARAM Source: SARAM Destination: SARAM ROM 3 3 3+psrc 3 3 DARAM 3 3 3+psrc 3 3 SARAM 3 3 3+psrc 3, 4 3, 4 External Memory 3+2pcode 3+2pcode 3+psrc +2pcode 3+2pcode 3+2pcode
If the destination operand and the code are in the same SARAM block
6-79
Cycles for a Single Instruction (SRC long immediate) (Continued) Operand Source: External Destination: SARAM Source: DARAM/ROM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM 3+psrc 4+ddst 4+ddst 4+psrc +ddst DARAM 3+psrc 4+ddst 4+ddst 4+psrc +ddst SARAM 3+psrc , 4+psrc 4+ddst 4+ddst 4+psrc +ddst External Memory 3+psrc +2pcode 6+ddst +2pcode 6+ddst +2pcode 6+psrc +ddst +2pcode
If the destination operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (SRC long immediate) Operand Source: DARAM/ROM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM/ROM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM/ROM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM n+2 n+2 n+2+npsrc n+2 n+2, 2n n+2+npsrc 2n+2+nddst 2n+2+nddst 4n+npsrc +nddst DARAM n+2 n+2 n+2+npsrc n+2 n+2, 2n n+2+npsrc 2n+2+nddst 2n+2+nddst 4n+npsrc +nddst SARAM n+2 n+2 n+2+npsrc n+2, n+4 n+2, 2n, n+4, 2n+2 n+2+npsrc , n+4+npsrc 2n+2+nddst 2n+2+nddst 4n+npsrc +nddst External Memory n+2+2pcode n+2+2pcode n+2+npsrc +2pcode n+2+2pcode n+2+2pcode , 2n+2pcode n+2+npsrc +2pcode 2n+2+nddst +2pcode 2n+2+nddst +2pcode 4n+2+npsrc +nddst +2pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
6-80
Example 1
Example 2
BLPD #800h,*,AR7
Before Instruction ARP AR0 Program Memory 800h Data Memory 310h 0 310h 1111h 0100h ARP AR0 Program Memory 800h Data Memory 310h After Instruction 7 310h 1111h 1111h
Example 3
Example 4
BLPD BMAR,*+,AR7
Before Instruction ARP AR0 BMAR Program Memory 810h Data Memory 300h 0 300h 810h 4444h 0100h ARP AR0 BMAR Program Memory 810h Data Memory 300h After Instruction 7 301h 810h 4444h 4444h
6-81
Execution
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
BSAR 16 ;(SXM=0)
Before Instruction ACC 0001 0000h ACC After Instruction 0000 0001h
Example 2
BSAR 4 ;(SXM=1)
Before Instruction ACC FFF1 0000h ACC After Instruction FFFF 1000h
6-82
CALA None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 1 3 0 2 0 1 0 0 0
Execution
(PC) + 1 TOS (ACC(150)) PC None affected. The current program counter (PC) is incremented and pushed onto the top of the stack (TOS). The contents of the accumulator low byte (ACCL) are loaded into the PC. Execution continues at this address. The CALA instruction is used to perform computed subroutine calls. CALA is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
CALA
Before Instruction PC ACC TOS 25h 83h 100h PC ACC TOS After Instruction 83h 83h 26h
6-83
CALAD None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 1 3 1 2 1 1 0 0 1
(PC) + 3 TOS (ACC(150)) PC None affected. The current program counter (PC) is incremented by 3 and pushed onto the top of the stack (TOS). Then, the one 2-word instruction or two 1-word instructions following the CALAD instruction are fetched from program memory and executed before the call is executed. Then, the contents of the accumulator low byte (ACCL) are loaded into the PC. Execution continues at this address. The CALAD instruction is used to perform computed subroutine calls. CALAD is a branch and call instruction (see Table 68).
Words Cycles
Example
After the current AR, ARP, and DP are modified as specified, the address of the instruction following the LDP instruction is pushed onto the stack, and program execution continues from location 83h.
6-84
Syntax Operands
CALL pma [,{ind} [,ARn ] ] 0 pma 65535 0 n 7 ind: {* *+ * *0+ *0 *BR0+ *BR0}
15 0 14 1 13 1 12 1 11 1 10 0 9 8 7 6 1 0 1 16-Bit Constant 5 4 3 2 See Section 5.2 1 0
Opcode
Execution
(PC) + 2 TOS pma PC Modify current AR and ARP as specified None affected. The current program counter (PC) is incremented and pushed onto the top of the stack (TOS). The program memory address (pma) is loaded into the PC. Execution continues at this address. The current auxiliary register (AR) and auxiliary register pointer (ARP) are modified as specified. The pma can be either a symbolic or numeric address. CALL is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
CALL PRG191,*+,AR0
Before Instruction ARP AR1 PC TOS 1 05h 30h 100h ARP AR1 PC TOS After Instruction 0 06h 0BFh 32h
0BFh is loaded into the PC, and the program continues executing from that location.
6-85
Syntax Operands
CALLD pma [,{ind} [,ARn ] ] 0 pma 65535 0 n 7 ind: {* *+ * *0+ *0 *BR0+ *BR0}
15 0 14 1 13 1 12 1 11 1 10 1 9 8 7 6 1 0 1 16-Bit Constant 5 4 3 2 See Section 5.2 1 0
Opcode
Execution
(PC) + 4 TOS pma PC Modify current AR and ARP as specified None affected. The current program counter (PC) is incremented by 4 and pushed onto the top of the stack (TOS). Then, the one 2-word instruction or two 1-word instructions following the CALLD instruction are fetched from program memory and executed before the call is executed. Then, the program memory address (pma) is loaded into the PC. Execution continues at this address. The current auxiliary register (AR) and auxiliary register pointer (ARP) are modified as specified. The pma can be either a symbolic or numeric address. CALLD is a branch and call instruction (see Table 68).
Words Cycles
6-86
Example
After the current AR, ARP, and DP are modified as specified, the address of the instruction following the LDP instruction is pushed onto the stack, and program execution continues from location 0BFh.
6-87
Syntax Operands
CC pma cond [,cond1 ] [,...] 0 pma 65535 Conditions: ACC = 0 ACC 0 ACC < 0 ACC 0 ACC > 0 ACC 0 C=0 C=1 OV = 0 OV = 1 TC = 0 TC = 1 BIO low Unconditionally
12 0 11 1 10 0
Opcode
15 1
14 1
13 1
Execution
If (condition(s)): (PC) + 2 TOS pma PC Else: (PC) + 2 PC None affected. If the specified conditions are met, the current program counter (PC) is incremented and pushed onto the top of the stack (TOS). The program memory address (pma) is loaded into the PC. Execution continues at this address. The pma can be either a symbolic or numeric address. Not all combinations of the conditions are meaningful. In addition, the NTC, TC, and BIO conditions are mutually exclusive. If the specified conditions are not met, control is passed to the next instruction. The CC instruction functions in the same manner as the CALL instruction (page 6-85) if all conditions are true. CC is a branch and call instruction (see Table 68).
Words
6-88
Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
CC PGM191,LEQ,C
If the accumulator (ACC) contents are less than or equal to 0 and the C bit is set, 0BFh is loaded into the program counter (PC), and the program continues executing from that location. If the conditions are not met, execution continues at the instruction following the CC instruction.
6-89
Syntax Operands
CCD pma cond [,cond1 ] [,...] 0 pma 65535 Conditions: ACC = 0 ACC 0 ACC < 0 ACC 0 ACC > 0 ACC 0 C=0 C=1 OV = 0 OV = 1 TC = 0 TC = 1 BIO low Unconditionally
12 1 11 1 10 0
Opcode
15 1
14 1
13 1
Execution
If (condition(s)): (PC) + 4 TOS pma PC Else: (PC) + 2 PC None affected. If the specified conditions are met, the current program counter (PC) is incremented by 4 and pushed onto the top of the stack (TOS). Then, the one 2-word instruction or two 1-word instructions following the CCD instruction are fetched from program memory and executed before the call is executed. Then, the program memory address (pma) is loaded into the PC. Execution continues at this address. The pma can be either a symbolic or numeric address. Not all combinations of the conditions are meaningful. In addition, the NTC, TC, and BIO conditions are mutually exclusive. If the specified conditions are not met, control is passed to the next instruction. The CCD functions in the same manner as the CALLD instruction (page 6-86) if all conditions are true. CCD is a branch and call instruction (see Table 68).
6-90
Words Cycles
Example
The current AR, ARP, and DP are modified as specified. If the accumulator (ACC) contents are less than or equal to 0 and the C bit is set, the address of the instruction following the LDP instruction is pushed onto the stack and program execution continues from location 0BFh. If the conditions are not met, execution continues at the instruction following the LDP instruction.
6-91
control bit: {C, CNF, HM, INTM, OVM, SXM, TC, XF}
CLRC OVM (Clear overflow mode)
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 0 3 0 2 0 1 1 0 0
Execution
(PC) + 1 PC 0 control bit Affects selected control bit. The specified control bit is cleared. The LST instruction can also be used to load ST0 and ST1. See Section 4.4, Status and Control Registers, for more information on each control bit. CLRC is a control instruction (see Table 610).
Words
6-92
Cycles
ROM 1
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
6-93
CMPL None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 1
Execution
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
CMPL
Before Instruction ACC X C F798 2513h ACC X C After Instruction 0867 DAECh
6-94
CMPR CM 0 CM 3
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 1 7 0 6 1 5 0 4 0 3 0 2 1 1 0 CM
Execution
Status Bits
Affects: TC
Description
The contents of the current auxiliary register (AR) are compared with the contents of the auxiliary register compare register (ARCR), as defined by the value of CM: If CM = 00, test for (current AR) = (ARCR) If CM = 01, test for (current AR) < (ARCR) If CM = 10, test for (current AR) > (ARCR) If CM = 11, test for (current AR) (ARCR) If the condition is true, the TC bit is set. If the condition is false, the TC bit is cleared. The ARs are treated as unsigned integers in the comparisons. You can maintain software compatibility with the C2x by clearing the NDX bit. This causes any C2x instruction that loads auxiliary register 0 (AR0) to load the ARCR and index register (INDX) also, maintaining C5x object-code compatibility with the C2x. CMPR is an auxiliary registers and data memory page pointer instruction (see Table 65).
Words
6-95
Cycles
ROM 1
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
CMPR 2
Before Instruction ARP ARCR AR4 TC 4 FFFFh 7FFFh 1 ARP ARCR AR4 TC After Instruction 4 FFFFh 7FFFh 0
6-96
Syntax
Direct: Indirect:
Operands
0 dma 127 lk: 16-bit constant 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with long immediate not specified
15 0 14 1 13 0 12 1 11 1 10 0 9 1 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
Execution
Long immediate not specified: (PC) + 1 PC Compare (DBMR) to (dma) If (DBMR) = (dma): 1 TC Else: 0 TC Long immediate specified: (PC) + 2 PC Compare lk to (dma) If lk = (dma): 1 TC Else: 0 TC
Status Bits
Affects: TC
6-97
Description
If a long immediate constant is specified, the constant is compared with the contents of the data memory address (dma). If a constant is not specified, the contents of the dma are compared with the contents of the dynamic bit manipulation register (DBMR). If the two quantities involved in the comparison are equal, the TC bit is set. If the condition is false, the TC bit is cleared. CPL is a parallel logic unit (PLU) instruction (see Table 66).
Words
1 2
Cycles
Operand DARAM SARAM External
ROM 1 1 1+d
DARAM 1 1 1+d
SARAM 1 1, 2 1+d
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate specified) Operand DARAM SARAM External ROM 2 2 2+d DARAM 2 2 2+d SARAM 2 2, 3 2+d External Memory 2+2p 2+2p 3+d+2p
If the operand and the code are in the same SARAM block
6-98
Cycles for a Repeat (RPT) Execution (long immediate specified) Operand DARAM SARAM External ROM n+1 n+1 n+1 DARAM n+1 n+1 n+1 SARAM n+1 n+1, n+2 n+1 External Memory n+1+2p n+1+2p n+2+2p
If the operand and the code are in the same SARAM block
Example 1
CPL #060h,60h
Before Instruction Data Memory 60h TC 066h 1 Data Memory 60h TC After Instruction 066h 0
Example 2
CPL 60h
Before Instruction Data Memory 60h DBMR TC 066h 066h 0 Data Memory 60h DBMR TC After Instruction 066h 066h 1
Example 3
CPL #0F1h,*,AR6
Before Instruction ARP AR7 Data Memory 300h TC 7 300h 0F1h 1 ARP AR7 Data Memory 300h TC After Instruction 6 300h 0F1h 1
Example 4
CPL *,AR7
Before Instruction ARP AR6 Data Memory 300h DBMR TC 6 300h 0F1h 0F0h 0 ARP AR6 Data Memory 300h DBMR TC After Instruction 7 300h 0F1h 0F0h 0
6-99
CRGT None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 0 1 1 0 1
Execution
(PC) + 1 PC Compare (ACC) to (ACCB) If (ACC) > (ACCB): (ACC) ACCB 1 C If (ACC) < (ACCB): (ACCB) ACC 0 C If (ACC) = (ACCB): 1 C
Affects: C
The contents of the accumulator (ACC) are compared to the contents of the accumulator buffer (ACCB). The larger value (signed) is loaded into both registers. If the contents of the ACC are greater than or equal to the contents of the ACCB, the C bit is set; otherwise, the C bit is cleared. CRGT is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
6-100
Example 1
CRGT
Before Instruction ACCB ACC C 4h 5h 0 ACCB ACC C After Instruction 5h 5h 1
Example 2
CRGT
Before Instruction ACCB ACC C 5h 5h 0 ACCB ACC C After Instruction 5h 5h 1
6-101
CRLT None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 1 1 0 0 0
Execution
(PC) + 1 PC Compare (ACC) to (ACCB) If (ACC) < (ACCB): (ACC) ACCB 1 C If (ACC) > (ACCB): (ACCB) ACC 0 C If (ACC) = (ACCB): 0 C
Affects: C
The contents of the accumulator (ACC) are compared to the contents of the accumulator buffer (ACCB). The smaller (signed) value is loaded into both registers. If the contents of the ACC are less than the contents of the ACCB, the C bit is set; otherwise, the C bit is cleared. CRLT is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
6-102
Example 1
CRLT
Before Instruction ACCB ACC C 5h 4h 0 ACCB ACC C After Instruction 4h 4h 1
Example 2
CRLT
Before Instruction ACCB ACC C 4h 4h 1 ACCB ACC C After Instruction 4h 4h 0
6-103
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 1 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Words
6-104
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 2+2d DARAM 1 1 2+2d SARAM 1 1, 3 2+2d External Memory 1+p 1+p 5+2d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n 2n2 4n2+2nd DARAM n 2n2 4n2+2nd SARAM n 2n2, 2n+1 4n2+2nd External Memory n+p 2n2+p 4n+1+2nd+p
If the operand and the code are in the same SARAM block
Example 1
Example 2
DMOV *,AR1
Before Instruction ARP AR1 Data Memory 30Ah Data Memory 30Bh 0 30Ah 40h 41h ARP AR1 Data Memory 30Ah Data Memory 30Bh After Instruction 1 30Ah 40h 40h
6-105
EXAR None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 1 1 0 0 1
Execution
(PC) + 1 PC (ACCB) (ACC) None affected. The contents of the accumulator (ACC) are exchanged (switched) with the contents of the accumulator buffer (ACCB). 1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Words Cycles
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
EXAR
Before Instruction ACC ACCB 043h 02h ACC ACCB After Instruction 02h 043h
6-106
IDLE None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 0 3 0 2 0 1 1 0 0
(PC) + 1 PC
Words Cycles
Example
6-107
IDLE2 None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 0 3 0 2 0 1 1 0 1
(PC) + 1 PC
Words Cycles
Example
IDLE2 ;The processor idles until a reset or unmasked ;external interrupt occurs.
6-108
Syntax
Direct: Indirect:
Operands
0 dma 127 0 n 7 0 port address PA 65535 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 1 12 0 11 1 10 1 9 8 7 6 1 1 0 16-Bit Constant 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 1 14 0 13 1 12 0 11 1 10 1 9 8 7 6 1 1 1 16-Bit Constant 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 2 PC While (repeat counter) 0 Port address address bus A15A0 Data bus D15D0 dma Port address dma Port address + 1 Port address (repeat counter 1) repeat counter None affected. A 16-bit value from an external I/O port is read into the data memory address (dma). The IS line goes low to indicate an I/O access, and the STRB, RD, and READY timings are the same as for an external data memory read. While port addresses 50h5Fh are memory-mapped (see subsection 9.1.1, MemoryMapped Peripheral Registers and I/O Ports); the other port addresses are not. You can use the RPT instruction with the IN instruction to read consecutive words in I/O space to data space. The number of words to be moved is one greater than the number contained in the repeat counter register (RPTC) at the beginning of the instruction. When used with the RPT instruction, the IN instruction becomes a single-cycle instruction, once the RPT pipeline is started, and the port address is incremented after each access. IN is an I/O and data memory operation instruction (see Table 69).
Words
2
6-109
Cycles
Cycles for a Single Instruction Operand Destination: DARAM Destination: SARAM Destination: External ROM 2+iosrc 2+iosrc 3+ddst +iosrc DARAM 2+iosrc 2+iosrc 3+ddst +iosrc SARAM 2+iosrc 2+iosrc , 3+iosrc 3+ddst +iosrc External Memory 3+iosrc +2pcode 3+iosrc +2pcode 6+ddst +iosrc +2pcode
If the destination operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand Destination: DARAM Destination: SARAM Destination: External ROM 2n+niosrc 2n+niosrc 4n1+nddst +niosrc DARAM 2n+niosrc 2n+niosrc 4n1+nddst +niosrc SARAM 2n+niosrc 2n+niosrc , 2n+2+niosrc 4n1+nddst +niosrc External Memory 2n+1+niosrc +2pcode 2n+1+niosrc +2pcode 4n+2+nddst +niosrc +2pcode
If the destination operand and the code are in the same SARAM block
Example 1
IN DAT7,PA5 ;Read in word from peripheral on port ;address 5(i.e., I/O port 55h). Store in ;data memory location 307h (DP=6). IN *,1024 ;Read in word from peripheral on I/O ;port 400h. Store in data memory location ;specified by current auxiliary register.
Example 2
6-110
INTR K 0 K 31
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 1 4 3 2 1 INTR# 0
Affects: INTM
A software interrupt that transfers program control to a program memory address (pma) interrupt vector specified by K. The current program counter (PC) is incremented and pushed onto the stack. The pma is loaded into the PC. The K value corresponds to a pma specified by the following table:
K 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Interrupt RS INT1 INT2 INT3 TINT RINT XINT TRNT TXNT INT4 Reserved Reserved Reserved Reserved Reserved Reserved Hex Location 0 2 4 6 8 A C E 10 12 14 16 18 1A 1C 1E K 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Interrupt Reserved TRAP NMI Reserved User-defined User-defined User-defined User-defined User-defined User-defined User-defined User-defined User-defined User-defined User-defined User-defined Hex Location 20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E
The INTR instruction allows any interrupt service routine (ISR) to be executed from your software. The INTM bit has no affect on the INTR instruction. An INTR interrupt for the INT1INT4 interrupts looks exactly like an external interrupt except the interrupt will not clear the appropriate bit in the IFR. See Section 4.8, Interrupts, on page 4-36 for a complete description of interrupt operation. INTR is a branch and call instruction (see Table 68).
6-111
The reserved interrupt vectors can be used for the C50, C51, and C53. However, software compatibility with other fifth generation devices is not guaranteed.
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
INTR 3 ;Control is passed to program memory location 6h ;PC + 1 is pushed onto the stack.
6-112
LACB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 1 1 1 0 1
Execution
(PC) + 1 PC (ACCB) ACC None affected. The contents of the accumulator buffer (ACCB) are loaded into the accumulator (ACC). LACB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
LACB
Before Instruction ACC ACCB 01376h 5555 AAAAh ACC ACCB After Instruction 5555 AAAAh 5555 AAAAh
6-113
Syntax
LACC dma [,shift ] LACC {ind} [,shift [,ARn ] ] LACC #lk [,shift]
Operands
0 dma 127 0n7 0 shift 16 (defaults to 0) 32768 lk 32767 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with shift
15 0 14 0 13 0 12 1 11 10 9 SHFT 8 7 0 6 5 4 3 2 dma 1 0
Opcode
Execution
Direct or indirect addressing: (PC) + 1 PC (dma) 2shift1 ACC Long immediate addressing: (PC) + 2 PC lk 2shift2 ACC
Status Bits
6-114
Description
The contents of the data memory address (dma) or a 16-bit constant are shifted left, as defined by the shift code, and loaded into the accumulator (ACC). During shifting, the low-order bits of the ACC are zero-filled. If the SXM bit is cleared, the high-order bits of the ACC are zero-filled; if the SXM bit is set, the high-order bits of the ACC are sign-extended. LACC is an accumulator memory reference instruction (see Table 64).
Words
1 2
Cycles
For the long immediate addressing modes, the LACC instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
6-115
Example 1
Example 2
Example 3
6-116
Syntax
Operands
0 dma 127 0n7 0 k 255 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 1 13 1 12 0 11 1 10 0 9 0 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 1 10 0 9 0 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC Direct or indirect addressing: 0 ACC(3116) (dma) ACC(150) Short immediate addressing: 0 ACC(318) k ACC(70)
Words
6-117
Cycles
For the short immediate addressing modes, the LACL instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (short immediate addressing) ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Example 1
Example 2
LACL *,AR4
Before Instruction ARP AR0 Data Memory 401h ACC X C 0 401h 00FFh 7FFF FFFFh ARP AR0 Data Memory 401h ACC X C After Instruction 4 400h 00FFh 0FFh
6-118
Example 3
LACL #10h
Before Instruction ACC X C ACC 7FFF FFFFh X C After Instruction 010h
6-119
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 1 10 0 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (dma) 2TREG1(30) ACC If SXM = 0: (dma) is not sign extended If SXM = 1: (dma) is sign extended
Words
6-120
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-121
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 0 13 0 12 0 11 1 10 0 9 0 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Words Cycles
1
Cycles for a Single Instruction Operand MMR MMPORT ROM 1 1+iosrc DARAM 1 1+iosrc SARAM 1 1+iodsrc External Memory 1+p 1+2+p+iodsrc
Cycles for a Repeat (RPT) Execution Operand MMR MMPORT ROM n n+miosrc DARAM n n+miosrc SARAM n n+miosrc External Memory n+p n+p+miosrc
6-122
Example 1
Example 2
LAMM *
Before Instruction ARP AR1 ACC PRD Data Memory 325h 1 325h 2222 1376h 0Fh 1000h ARP AR1 ACC PRD Data Memory 325h After Instruction 1 325h 0Fh 0Fh 1000h
The value in data memory location 325h is not loaded into the ACC, the value at data memory location 25h (address of the PRD) is loaded into the ACC.
6-123
Syntax
LAR ARx, dma LAR ARx, {ind} [,ARn ] LAR ARx, #k LAR ARx, #lk
Operands
0x7 0 dma 127 0n7 0 k 255 0 lk 65535 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 0 13 0 12 0 11 0 10 9 8 ARX 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 0 13 0 12 0 11 0 10 9 8 ARX 7 1 6 5 4 3 2 See Section 5.2 1 0
16-Bit Constant
See Table 61 on page 6-2.
Execution
Direct or indirect addressing: (PC) + 1 PC (dma) AR Short immediate addressing: (PC) + 1 PC k AR Long immediate addressing: (PC) + 2 PC lk AR
Status Bits
6-124
Description
The contents of the data memory address (dma), an 8-bit constant, or a 16-bit constant are loaded into the auxiliary register (AR). The constant is acted upon like an unsigned integer, regardless of the value of the SXM bit. You can maintain software compatibility with the C2x by clearing the NDX bit. This causes any C2x instruction that loads auxiliary register 0 (AR0) to load the auxiliary register compare register (ARCR) and index register (INDX) also, maintaining C5x object-code compatibility with the C2x. You can use the LAR and SAR (store auxiliary register) instructions to load and store the ARs during subroutine calls and interrupts. If you do not use an AR for indirect addressing, LAR and SAR enable the register to be used as an additional storage register, especially for swapping values between data memory locations without affecting the contents of the accumulator (ACC). LAR is an auxiliary registers and data memory page pointer instruction (see Table 65).
Words
1 2
Cycles
For the short and long immediate addressing modes, the LAR instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand Source: DARAM Source: SARAM Source: External ROM 2 2 2+dsrc DARAM 2 2 2+dsrc SARAM 2 2, 3 2+dsrc External Memory 2+pcode 2+pcode 3+dsrc +pcode
If the source operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand Source: DARAM Source: SARAM Source: External ROM 2n 2n 2n+ndsrc DARAM 2n 2n 2n+ndsrc SARAM 2n 2n, 2n+1 2n+ndsrc External Memory 2n+pcode 2n+pcode 2n+1+ndsrc +pcode
If the source operand and the code are in the same SARAM block
6-125
Cycles for a Single Instruction (short immediate addressing) Operand ROM 2 DARAM 2 SARAM 2 External Memory 2+pcode
If the source operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
Example 1
Example 2
LAR AR4,*
Before Instruction ARP Data Memory 300h AR4 4 32h 300h ARP Data Memory 300h AR4 After Instruction 4 32h 32h
Note: LAR in the indirect addressing mode ignores any AR modifications if the AR specified by the instruction is the same as that pointed to by the ARP. Therefore, in Example 2, AR4 is not decremented after the LAR instruction. Example 3
LAR AR4,#01h
Before Instruction AR4 FF09h AR4 After Instruction 01h
Example 4
LAR AR4,#3FFFh
Before Instruction AR4 0h AR4 After Instruction 3FFFh
6-126
Syntax
Operands
0 dma 127 0n7 0 k 511 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 0 13 0 12 0 11 1 10 1 9 0 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 0 13 0 12 0 11 1 10 1 9 0 8 1 7 1 6 5 4 3 See Section 5.2 2 1 0
Execution
(PC) + 1 PC Direct or indirect addressing: Nine LSBs of (dma) DP bits Short immediate addressing: k DP bits
Affects: DP
The 9 LSBs of the data memory address (dma) contents or a 9-bit constant are loaded into the data memory page pointer (DP) bits. The DP bits and the 7-bit dma are concatenated to form the 16-bit dma. The DP bits can also be loaded by the LST instruction. LDP is an auxiliary registers and data memory page pointer instruction (see Table 65).
Words
6-127
Cycles
For the short immediate addressing modes, the LDP instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand Source: DARAM Source: SARAM Source: External ROM 2 2 2+dsrc DARAM 2 2 2+dsrc SARAM 2 2, 3 2+dsrc External Memory 2+pcode 2+pcode 3+dsrc +pcode
If the source operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand Source: DARAM Source: SARAM Source: External ROM 2n 2n 2n+ndsrc DARAM 2n 2n 2n+ndsrc SARAM 2n 2n, 2n+1 2n+ndsrc External Memory 2n+pcode 2n+pcode 2n+1+ndsrc +pcode
If the source operand and the code are in the same SARAM block
Cycles for a Single Instruction (short immediate addressing) Operand ROM 2 DARAM 2 SARAM 2 External Memory 2+pcode
If the source operand and the code are in the same SARAM block
Example 1
Example 2
LDP #0h
Before Instruction DP 1FFh DP After Instruction 0h
6-128
Example 3
LDP *,AR5
Before Instruction ARP AR4 Data Memory 300h DP 4 300h 06h 1FFh ARP AR4 Data Memory 300h DP After Instruction 5 300h 06h 06h
6-129
Syntax
Direct: Indirect:
Operands
0 dma 127 0n7 0 addr 65535 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 0 12 0 11 1 10 0 9 0 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
Indirect addressing
15 1 14 0 13 0 12 0 11 1 10 0 9 0 8 1 7 1 6 5 4 3 2 1 0 See Section 5.2
16-Bit Constant
Execution
PFC MCS (PC) + 2 PC lk PFC While (repeat counter 0): (src, addressed by PFC) (dst, specified by lower 7 bits of dma) (PFC) + 1 PFC (repeat counter) 1 repeat counter MCS PFC None affected. The memory-mapped register pointed at by the lower 7 bits of the data memory address (dma) is loaded with the contents of the data memory location addressed by the 16-bit source address, #addr. The 9 MSBs of the dma are cleared, regardless of the current value of the data memory page pointer (DP) bits or the upper 9 bits of the current AR. The LMMR instruction allows any memory location on data memory page 0 to be loaded from anywhere in data memory without modification of the DP bits. When you use the LMMR instruction with the RPT instruction, the source address, #addr, is incremented after every memory-mapped load operation. LMMR is an I/O and data memory operation instruction (see Table 69).
Words
6-130
Cycles
Cycles for a Single Instruction Operand Source: DARAM Destination: MMR Source: SARAM Destination: MMR Source: External Destination: MMR Source: DARAM Destination: MMPORT Source: SARAM Destination: MMPORT Source: External Destination: MMPORT ROM 2 2 2+psrc 3+iodst 3+iodst 3+psrc +iodst DARAM 2 2 2+psrc 3+iodst 3+iodst 3+psrc +iodst SARAM 2 2, 3 2+psrc 3+iodst 3+iodst , 4 3+psrc +iodst External Memory 2+2pcode 2+2pcode 3+psrc +2pcode 5+2pcode +iodst 5+2pcode +iodst 6+psrc +2pcode +iodst
If the source operand and the code are in the same SARAM block Add one more cycle for peripheral memory-mapped register access
Cycles for a Repeat (RPT) Execution Operand Source: DARAM Destination: MMR Source: SARAM Destination: MMR Source: External Destination: MMR Source: DARAM Destination: MMPORT Source: SARAM Destination: MMPORT Source: External Destination: MMPORT ROM 2n 2n 2n+ndsrc 3n+niodst 3n+niodst 4n1+ndsrc +niodst DARAM 2n 2n 2n+ndsrc 3n+niodst 3n+niodst 4n1+ndsrc +niodst SARAM 2n 2n, 2n+1 2n+ndsrc 3n+niodst 3n+niodst , 3n+1+niodst 4n1+ndsrc +niodst External Memory 2n+2pcode 2n+2pcode 2n+1+ndsrc +2pcode 3n+3+niodst +2pcode 3n+3+niodst +2pcode 4n+2+ndsrc + niodst +2pcode
If the source operand and the code are in the same SARAM block Add n more cycles for peripheral memory-mapped register access
6-131
Example 1
LMMR DBMR,#300h
Before Instruction Data Memory 300h DBMR 1376h 5555h Data Memory 300h DBMR After Instruction 1376h 1376h
Example 2
6-132
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 1 9 0 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
(PC) + 1 PC (dma) PREG (3116) None affected. The contents of the data memory address (dma) are loaded into the product register (PREG) high byte. The contents of the PREG low byte are unaffected. You can use the LPH instruction to restore the contents of the PREG high byte after interrupts and subroutine calls, if automatic context save is not used. LPH is a TREG0, PREG, and multiply instruction (see Table 67).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
6-133
Example 1
Example 2
LPH *,AR6
Before Instruction ARP AR5 Data Memory 200h PREG 5 200h F79Ch 3007 9844h ARP AR5 Data Memory 200h PREG After Instruction 6 200h F79Ch F79C 9844h
6-134
Syntax Operands
Direct: Indirect:
0 dma 127 m = 0 or 1 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing for LST #0
15 0 14 0 13 0 12 0 11 1 10 1 9 1 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
Execution
Status Bits
Affects: ARB, ARP, C, CNF, DP, HM, OV, OVM, PM, SXM, TC, and XF
Description
The contents of the data memory address (dma) are loaded into status register STm. The INTM bit is unaffected by an LST #0 instruction. In addition, the LST #0 instruction does not affect the auxiliary register buffer (ARB), even though a new auxiliary register pointer (ARP) is loaded. If a next ARP value is specified via the indirect addressing mode, the specified value is ignored. Instead, ARP is loaded with the value contained within the addressed data memory word. Note: When ST1 is loaded (LST #1), the value loaded into ARB is also loaded into ARP. You can use the LST instruction to restore the status registers after subroutine calls and interrupts. LST is a control instruction (see Table 610).
6-135
Words Cycles
1
Cycles for a Single Instruction Operand Source: DARAM Source: SARAM Source: External ROM 2 2 2+dsrc DARAM 2 2 2+dsrc SARAM 2 2, 3 2+dsrc External Memory 2+pcode 2+pcode 3+dsrc +pcode
If the source operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand Source: DARAM Source: SARAM Source: External ROM 2n 2n 2n+ndsrc DARAM 2n 2n 2n+ndsrc SARAM 2n 2n, 2n+1 2n+ndsrc External Memory 2n+pcode 2n+pcode 2n+1+ndsrc +pcode
If the source operand and the code are in the same SARAM block
Example 1
MAR *,AR0 LST #0,*,AR1 ;The data memory word addressed by the contents ;of auxiliary register AR0 is loaded into ;status register ST0,except for the INTM bit. ;Note that even though a next ARP value is ;specified, that value is ignored, and the ;old ARP is not loaded into the ARB. LST #0,60h ;(DP = 0)
Before Instruction Data Memory 60h ST0 ST1 2404h 6E00h 0580h Data Memory 60h ST0 ST1 After Instruction 2404h 2604h 0580h
Example 2
6-136
Example 3
LST #0,*,AR1
Before Instruction ARP AR4 Data Memory 3FFh ST0 ST1 4 3FFh EE04h 1E00h F7A0h ARP AR4 Data Memory 3FFh ST0 ST1 After Instruction 7 3FEh EE04h EE04h F7A0h
Example 4
6-137
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 0 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Words
6-138
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
LT *,AR3 ;(TRM = 0)
Before Instruction ARP AR2 Data Memory 418h TREG0 TREG1 TREG2 2 418h 62h 3h 4h 5h ARP AR2 Data Memory 418h TREG0 TREG1 TREG2 After Instruction 3 418h 62h 62h 2h 2h
6-139
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 0 9 0 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (dma) TREG0 (ACC) + (shifted PREG) ACC If TRM = 0: (dma) TREG1 (dma) TREG2
Status Bits
Affects: C and OV
Description
The contents of the data memory address (dma) are loaded into TREG0. The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the accumulator (ACC). The result is stored in the ACC. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. LTA is a TREG0, PREG, and multiply instruction (see Table 67).
Words
6-140
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-141
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 0 9 1 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (dma) TREG0 (dma) dma + 1 (ACC) + (shifted PREG) ACC If TRM = 0: (dma) TREG1 (dma) TREG2
Affects: C and OV
The contents of the data memory address (dma) are loaded into TREG0. The contents of the dma are also copied to the next higher dma. The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the accumulator (ACC). The result is stored in the ACC. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. See the DMOV instruction, page 6-104, for information on the data move feature. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. The LTD instruction functions in the same manner as the LTA instruction with the addition of data move for on-chip RAM blocks. If you use the LTD instruction with external data memory, its function is identical to that of the LTA instruction (page 6-140). LTD is a TREG0, PREG, and multiply instruction (see Table 67).
6-142
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 2+2d DARAM 1 1 2+2d SARAM 1 1, 3 2+2d External Memory 1+p 1+p 5+2d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n 2n2 4n2+2nd DARAM n 2n2 4n2+2nd SARAM n 2n2, 2n+1 4n2+2nd External Memory n+p 2n2+p 4n+1+2nd+p
If the operand and the code are in the same SARAM block
Example 1
6-143
Example 2
6-144
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 0 9 0 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (dma) TREG0 (shifted PREG) ACC If TRM = 0: (dma) TREG1 (dma) TREG2
Words
6-145
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-146
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 1 9 0 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (dma) TREG0 (ACC) (shifted PREG) ACC If TRM = 0: (dma) TREG1 (dma) TREG2
Status Bits
Affects: C and OV
Description
The contents of the data memory address (dma) are loaded into TREG0. The contents of the product register (PREG) are shifted, as defined by the PM bits, and subtracted from the accumulator (ACC). The result is stored in the ACC. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. LTS is a TREG0, PREG, and multiply instruction (see Table 67).
Words
6-147
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-148
Syntax
Direct: Indirect:
Operands
0 pma 65535 0 dma 127 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 1 12 0 11 0 10 0 9 1 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
Indirect addressing
15 1 14 0 13 1 12 0 11 0 10 0 9 1 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
16-Bit Constant
Execution
(PC) + 2 PC (PFC) MCS (pma) PFC If (repeat counter) 0: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG Modify current AR and ARP as specified (PFC) + 1 PFC (repeat counter) 1 repeat counter Else: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG Modify current AR and ARP as specified (MCS) PFC If TRM = 0: (dma) TREG1 (dma) TREG2
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the accumulator (ACC). The result is stored in the ACC. The contents of the data memory address (dma) are loaded into TREG0. The
6-149
contents of the dma are multiplied by the contents of the program memory address (pma). The result is stored in the PREG. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. The data and program memory locations on the C5x can be any nonreserved on-chip or off-chip memory locations. If the program memory is block B0 of onchip RAM, then the CNF bit must be set. When the MAC instruction is used in the direct addressing mode, the dma cannot be modified during repetition of the instruction. When the MAC instruction is repeated, the pma contained in the prefetch counter (PFC) is incremented by 1 during its operation. This allows access to a series of operands in memory. When used with the RPT instruction, the MAC instruction is useful for long sum-of-products operations because the instruction becomes a single-cycle instruction, once the RPT pipeline is started. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. MAC is a TREG0, PREG, and multiply instruction (see Table 67). Words Cycles
Cycles for a Single Instruction Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM ROM 3 3 3+pop1 3 3, 4 3+pop1 DARAM 3 3 3+pop1 3 3, 4 3+pop1 SARAM 3 3 3+pop1 3 3, 4 3+pop1 External Memory 3+2pcode 3+2pcode 3+pop1 +2pcode 3+2pcode 3+2pcode , 4+2pcode 3+pop1 +2pcode
6-150
Cycles for a Single Instruction (Continued) Operand 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM 3+dop2 3+dop2 4+pop1 +do p2 DARAM 3+dop2 3+dop2 4+pop1 +dop2 SARAM 3+dop2 3+dop2 4+pop1 +dop2 External Memory 3+dop2+2pcode 3+dop2 +2pcode 4+pop1 +dop2 +2pcode
Cycles for a Repeat (RPT) Execution Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM n+2 n+2 n+2+npop1 n+2 n+2, 2n+2 n+2+npop1 n+2+ndop2 n+2+ndop2 2n+2+npop1 +ndop2 DARAM n+2 n+2 n+2+npop1 n+2 n+2, 2n+2 n+2+npop1 n+2+ndop2 n+2+ndop2 2n+2+npop1 +ndop2 SARAM n+2 n+2 n+2+npop1 n+2 n+2, 2n+2 n+2+npop1 n+2+ndop2 n+2+ndop2 2n+2+npop1 +ndop2 External Memory n+2+2pcode n+2+2pcode n+2+npop1 +2pcode n+2+2pcode n+2+2pcode , 2n+2 n+2+npop1 +2pcode n+2+ndop2 +2pcode n+2+ndop2 +2pcode 2n+2+npop1 +ndop2 +2pcode
6-151
Example 1
Example 2
6-152
Syntax
Direct: Indirect:
Operands
0 pma 65535 0 dma 127 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 1 12 0 11 0 10 0 9 1 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
Indirect addressing
15 1 14 0 13 1 12 0 11 0 10 0 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
16-Bit Constant
Execution
(PC) + 2 PC (PFC) MCS (pma) PFC If (repeat counter) 0: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG Modify current AR and ARP as specified (PFC) + 1 PFC (dma) (dma) + 1 (repeat counter) 1 repeat counter Else: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG (dma) (dma) + 1 Modify current AR and ARP as specified (MCS) PFC If TRM = 0: (dma) TREG1 (dma) TREG2
Status Bits
Affects: C and OV
6-153
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the accumulator (ACC). The result is stored in the ACC. The contents of the data memory address (dma) are loaded into TREG0. The contents of the dma are multiplied by the contents of the program memory address (pma). The result is stored in the PREG. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. See the DMOV instruction, page 6-104, for information on the data move feature. The data and program memory locations on the C5x can be any nonreserved on-chip or off-chip memory locations. If the program memory is block B0 of onchip RAM, then the CNF bit must be set. When the MACD instruction is used in the direct addressing mode, the dma cannot be modified during repetition of the instruction. If the MACD instruction addresses one of the memorymapped registers or external memory as a data memory location, the effect of the instruction will be that of a MAC instruction. When the MACD instruction is repeated, the pma contained in the prefetch counter (PFC) is incremented by 1 during its operation. This allows access to a series of operands in memory. When used with the RPT instruction, the MACD instruction becomes a single-cycle instruction, once the RPT pipeline is started. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. The MACD instruction functions in the same manner as the MAC instruction with the addition of data move for on-chip RAM blocks. The data move feature makes the MACD instruction useful for applications such as convolution and transversal filtering. If you use the MACD instruction with external data memory, its function is identical to that of the MAC instruction (page 6-149). MACD is a TREG0, PREG, and multiply instruction (see Table 67).
Words
6-154
Cycles
Cycles for a Single Instruction Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM 3 3 3+pop1 3 3 3+pop1 3+dop2 3+dop2 4+pop1 +dop2 DARAM 3 3 3+pop1 3 3 3+pop1 3+dop2 3+dop2 4+pop1 +dop2 SARAM 3 3 3+pop1 3 3, 4, 5 3+pop1 3+dop2 3+dop2 4+pop1 +dop2 External Memory 3+2pcode 3+2pcode 3+pop1 +2pcode 3+2pcode 3+2pcode , 4+2pcode 3+pop1 +2pcode 3+dop2 +2pcode 3+dop2 +2pcode 4+pop1 +dop2 +2pcode
If both operands are in the same SARAM block If both operands and the code are in the same SARAM block Data move operation is not performed when operand2 is in external data memory.
6-155
Cycles for a Repeat (RPT) Execution Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM n+2 n+2 n+2+npop1 2n 2n, 3n 2n+npop1 n+2+ndop2 n+2+ndop2 2n+2+npop1 +ndop2 DARAM n+2 n+2 n+2+npop1 2n 2n, 3n 2n+npop1 n+2+ndop2 n+2+ndop2 2n+2+npop1 +ndop2 SARAM n+2 n+2 n+2+npop1 2n, 2n+2 2n, 2n+2, 3n, 3n+2 2n+npop1 , 2n+2+npop1 n+2+ndop2 n+2+ndop2 2n+2+npop1 +ndop2 External Memory n+2+2pcode n+2+2pcode n+2+npop1 +2pcode 2n+2pcode 2n+2pcode , 3n 2n+npop1 +2pcode n+2+ndop2 +2pcode n+2+ndop2 +2pcode 2n+2+npop1 +ndop2 +2pcode
If operand2 and code are in the same SARAM block If both operands are in the same SARAM block If both operands and the code are in the same SARAM block Data move operation is not performed when operand2 is in external data memory.
Example 1
6-156
Example 2
The data move function for MACD can occur only within on-chip data RAM blocks.
6-157
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 1 14 0 13 1 12 0 11 1 10 0 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 2 PC (PFC) MCS (BMAR) PFC If (repeat counter) 0: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG Modify current AR and ARP as specified (PFC) + 1 PFC (dma) (dma) + 1 (repeat counter) 1 repeat counter Else: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG (dma) (dma) + 1 Modify current AR and ARP as specified (MCS) PFC
Affects: C and OV
The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the accumulator (ACC). The result is stored in the ACC. The contents of the data memory address (dma) are loaded into TREG0. The contents of the dma are multiplied by the contents of the program memory address (pma). The result is stored in the PREG. The pma is contained in the block move address register (BMAR) and is not specified by a long immediate constant; this enables dynamic addressing of coefficient tables. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. See the DMOV instruction, page 6-104, for information on the data move feature.
6-158
The data and program memory locations on the C5x can be any nonreserved on-chip or off-chip memory locations. If the program memory is block B0 of onchip RAM, then the CNF bit must be set. When the MADD instruction is used in the direct addressing mode, the dma cannot be modified during repetition of the instruction. If the MADD instruction addresses one of the memorymapped registers or external memory as a data memory location, the effect of the instruction is that of a MADS instruction. When the MADD instruction is repeated, the pma contained in the prefetch counter (PFC) is incremented by 1 during its operation. This allows access to a series of operands in memory. When used with the RPT instruction, the MADD instruction becomes a single-cycle instruction, once the RPT pipeline is started. The MADD instruction functions in the same manner as the MADS instruction with the addition of data move for on-chip RAM blocks. The data move feature makes the MADD instruction useful for applications such as convolution and transversal filtering. If you use the MADD instruction with external data memory, its function is identical to that of the MADS instruction (page 6-162). MADD is a TREG0, PREG, and multiply instruction (see Table 67). Words Cycles
Cycles for a Single Instruction Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM ROM 2 2 2+pop1 2 2 2+pop1 DARAM 2 2 2+pop1 2 2 2+pop1 SARAM 2 2 2+pop1 2 2, 3, 4 2+pop1 External Memory 2+pcode 2+pcode 2+pop1 +pcode 2+pcode 2+pcode , 3+pcode 2+pop1 +pcode
If both operands are in the same SARAM block If both operands and code are in the same SARAM block Data move operation is not performed when operand2 is in external data memory.
6-159
Cycles for a Single Instruction (Continued) Operand 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM 2+dop2 2+dop2 3+pop1 +dop2 DARAM 2+dop2 2+dop2 3+pop1 +dop2 SARAM 2+dop2 2+dop2 3+pop1 +dop2 External Memory 2+dop2 +pcode 2+dop2 +pcode 3+pop1 +dop2 +pcode
If both operands are in the same SARAM block If both operands and code are in the same SARAM block Data move operation is not performed when operand2 is in external data memory.
Cycles for a Repeat (RPT) Execution Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM n+1 n+1 DARAM n+1 n+1 SARAM n+1 n+1 External Memory n+1+pcode n+1+pcode
n+1+npop1 2n1, 2n+1 2n1, 2n+1, 3n1, 3n+1 2n1+npop1 , 2n+1+npop1 n+1+ndop2 n+1+ndop2 2n+1+npop1 +ndop2
n+1+npop1 +pcode 2n1+pcode 2n1+pcode , 3n1 2n1+npop1 +pcode n+1+ndop2 +pcode n+1+ndop2 +pcode 2n+1+npop1 +ndop2 +pcode
If operand2 and code are in the same SARAM block If both operands are in the same SARAM block If both operands and code are in the same SARAM block Data move operation is not performed when operand2 is in external data memory.
6-160
Example 1
Example 2
The data move function for MADD can occur only within on-chip data RAM blocks.
6-161
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 1 14 0 13 1 12 0 11 1 10 0 9 1 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (PFC) MCS (BMAR) PFC If (repeat counter) 0: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG Modify current AR and ARP as specified (PFC) + 1 PFC (repeat counter) 1 repeat counter Else: (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (pma, addressed by PFC) PREG Modify current AR and ARP as specified (MCS) PFC
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the accumulator (ACC). The result is stored in the ACC. The contents of the data memory address (dma) are loaded into TREG0. The contents of the dma are multiplied by the contents of the program memory address (pma). The result is stored in the PREG. The pma is contained in the block move address register (BMAR) and is not specified by a long immediate constant; this enables dynamic addressing of coefficient tables. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared.
6-162
The data and program memory locations on the C5x can be any nonreserved on-chip or off-chip memory locations. If the program memory is block B0 of onchip RAM, then the CNF bit must be set. When the MADS instruction is used in the direct addressing mode, the dma cannot be modified during repetition of the instruction. When the MADS instruction is repeated, the pma contained in the prefetch counter (PFC) is incremented by 1 during its operation. This allows access to a series of operands in memory. When used with the RPT instruction, the MADS instruction is useful for long sum-of-products operations because the instruction becomes a single-cycle instruction, once the RPT pipeline is started. MADS is a TREG0, PREG, and multiply instruction (see Table 67). Words Cycles
Cycles for a Single Instruction Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM 2 2 2+pop1 2 2, 3 2+pop1 2+dop2 2+dop2 3+pop1 +do p2 DARAM 2 2 2+pop1 2 2, 3 2+pop1 2+dop2 2+dop2 3+pop1 +do p2 SARAM 2 2 2+pop1 2 2, 3 2+pop1 2+dop2 2+dop2 3+pop1 +dop2 2+pcode 2+pcode , 3+pcode 2+pop1+pcode 2+dop2 +pcode 2+dop2 +pcode 3+pop1 +dop2 +pcode External Memory 2+pcode 2+pcode
6-163
Cycles for a Repeat (RPT) Execution Operand 1: DARAM/ROM 2: DARAM 1: SARAM 2: DARAM 1: External 2: DARAM 1: DARAM/ROM 2: SARAM 1: SARAM 2: SARAM 1: External 2: SARAM 1: DARAM/ROM 2: External 1: SARAM 2: External 1: External 2: External ROM n+1 n+1 n+1+npop1 n+1 n+1, 2n+1 n+1+npop1 n+1+ndop2 n+1+ndop2 2n+1+npop1 +ndop2 DARAM n+1 n+1 n+1+npop1 n+1 n+1, 2n+1 n+1+npop1 n+1+ndop2 n+1+ndop2 2n+1+npop1 +ndop2 SARAM n+1 n+1 n+1+npop1 n+1 n+1, 2n+1 n+1+npop1 n+1+ndop2 n+1+ndop2 2n+1+npop1 +ndop2 External Memory n+1+pcode n+1+pcode n+1+npop1 +pcode n+1+pcode n+1+pcode , 2n+1 n+1+npop1 +pcode n+1+ndop2 +pcode n+1+ndop2 +pcode 2n+1+npop1 +ndop2 +pcode
Example 1
6-164
Example 2
6-165
Direct: Indirect:
Indirect addressing
15 1 14 0 13 0 12 0 11 1 10 0 9 1 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC Indirect addressing: Modify current AR and ARP as specified Direct addressing: Executes as a NOP
Words
6-166
Cycles
ROM 1
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
Example 2
MAR *+,AR5 ;Increment current auxiliary register (AR1) ;and load ARP with 5.
Before Instruction AR1 ARP ARB 34h 1 0 AR1 ARP ARB After Instruction 35h 5 1
6-167
Syntax
Operands
0 dma 127 0n7 4096 k 4095 32768 lk 32767 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 1 13 0 12 1 11 0 10 1 9 0 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 1 13 0 12 1 11 0 10 1 9 0 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Direct or indirect addressing: (PC) + 1 PC (TREG0) (dma) PREG Short immediate addressing: (PC) + 1 PC (TREG0) k PREG Long immediate addressing: (PC) + 2 PC (TREG0) lk PREG
If a constant is specified, the constant is multiplied by the contents of TREG0. If a constant is not specified, the contents of TREG0 are multiplied by the contents of the data memory address (dma). The result is stored in the product register (PREG). Short immediate addressing multiplies TREG0 by a signed 13-bit constant. The short immediate constant is right-justified and sign-extended before the multiplication, regardless of the SXM bit.
6-168
You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. MPY is a TREG0, PREG, and multiply instruction (see Table 67). Words 1 2 Cycles (Direct, indirect, or short immediate addressing) (Long immediate addressing)
For the short and long immediate addressing modes, the MPY instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (short immediate addressing) ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
6-169
Example 1
Example 2
MPY *,AR2
Before Instruction ARP AR1 Data Memory 40Dh TREG0 PREG 1 40Dh 7h 6h 36h ARP AR1 Data Memory 40Dh TREG0 PREG After Instruction 2 40Dh 7h 6h 2Ah
Example 3
MPY #031h
Before Instruction TREG0 PREG 2h 36h TREG0 PREG After Instruction 2h 62h
Example 4
MPY #01234h
Before Instruction TREG0 PREG 2h 36h TREG0 PREG After Instruction 2h 2468h
6-170
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 0 12 1 11 0 10 0 9 0 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the contents of the accumulator (ACC). The result is stored in the ACC. The contents of TREG0 are multiplied by the contents of the data memory address (dma). The result is stored in the PREG. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. MPYA is a TREG0, PREG, and multiply instruction (see Table 67).
Words
6-171
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-172
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 0 12 1 11 0 10 0 9 0 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and subtracted from the contents of the accumulator (ACC). The result is stored in the ACC. The contents of TREG0 are multiplied by the contents of the data memory address (dma). The result is stored in the PREG. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. MPYS is a TREG0, PREG, and multiply instruction (see Table 67).
Words
6-173
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-174
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 1 13 0 12 1 11 0 10 1 9 0 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Status Bits
Description
The unsigned contents of TREG0 are multiplied by the unsigned contents of the data memory address (dma). The result is stored in the product register (PREG). The multiplier acts as a signed 17 17-bit multiplier for this instruction, with the MSB of both operands forced to 0. The p-scaler shifter at the output of the PREG always invokes sign-extension on the PREG, when the PM bits are set to 112 (right-shift-by-6 mode). Therefore, you should not use this shift mode if you want unsigned products. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. The MPYU instruction is particularly useful for computing multiple-precision products, such as multiplying two 32-bit numbers to yield a 64-bit product. MPYU is a TREG0, PREG, and multiply instruction (see Table 67).
Words
6-175
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
MPYU *,AR6
Before Instruction ARP AR5 Data Memory 210h TREG0 PREG 5 210h FFFFh FFFFh 1h ARP AR5 Data Memory 210h TREG0 PREG After Instruction 6 210h FFFFh FFFFh FFFE 0001h
6-176
NEG None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 0 2 0 1 1 0 0
Affects: C and OV
The contents of the accumulator (ACC) are replaced with its arithmetic complement (2s complement). If the contents of the ACC are not 0, the C bit is cleared; if the contents of the ACC are 0, the C bit is set. When taking the 2s complement of 8000 0000h, the OV bit is set and: if the OVM bit is set, the ACC is replaced with 7FFF FFFFh; if the OVM bit is cleared, the ACC is replaced with 8000 0000h. NEG is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
NEG ;(OVM = X)
Before Instruction ACC X C X OV FFFF F228h ACC 0 C X OV After Instruction 0DD8h
6-177
Example 2
NEG ;(OVM = 0)
Before Instruction ACC X C X OV 8000 0000h ACC 0 C 1 OV After Instruction 8000 0000h
Example 3
NEG ;(OVM = 1)
Before Instruction ACC X C X OV 8000 0000h ACC 0 C 1 OV After Instruction 7FFF FFFFh
6-178
NMI None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 1 3 0 2 0 1 1 0 0
Execution
Status Bits
Affects: INTM
Description
The current program counter (PC) is incremented and pushed onto the stack. The nonmaskable interrupt vector located at 24h is loaded into the PC. Execution continues at this address. Interrupts are globally disabled (INTM bit is set). The NMI instruction has the same affect as a hardware nonmaskable interrupt. Automatic context save is not performed. NMI is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
NMI ;Control is passed to program memory location 24h ;and PC+1 is pushed onto the stack.
6-179
NOP None
15 1 14 0 13 0 12 0 11 1 10 0 9 1 8 1 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 0
(PC) + 1 PC None affected. No operation is performed. The NOP instruction affects only the program counter (PC). You can use the NOP instruction to create pipeline and execution delays. NOP is a control instruction (see Table 610).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
6-180
Execution
(PC) + 1 PC If (ACC) = 0: TC 1 Else: If (ACC(31)) XOR (ACC(30)) = 0: TC 0 (ACC) 2 ACC Modify current AR as specified Else: TC 1
Affects: TC
The signed number contained in the accumulator (ACC) is normalized. Normalizing a fixed-point number separates the number into a mantissa and an exponent by finding the magnitude of the sign-extended number. ACC bit 31 is exclusive-ORed (XOR) with ACC bit 30 to determine if bit 30 is part of the magnitude or part of the sign extension. If the bits are the same, then they are both sign bits, and the ACC is shifted left to eliminate the extra sign bit. If the result of the XOR operation is true, the TC bit is set; otherwise, the TC bit is cleared. The current AR is modified as specified to generate the magnitude of the exponent. It is assumed that the current AR is initialized before normalization begins. The default modification of the current AR is an increment. Multiple executions of the NORM instruction may be required to completely normalize a 32-bit number in the ACC. Although using NORM with RPT does not cause execution of NORM to fall out of the repeat loop automatically when the normalization is complete, no operation is performed for the remainder of the repeat loop. The NORM instruction functions on both positive and negative 2s-complement numbers. NORM is an accumulator memory reference instruction (see Table 64).
6-181
The NORM instruction executes the auxiliary register operation during the execution phase of the pipeline. Therefore, the auxiliary register used in the NORM instruction should not be used by an auxiliary register instruction in the next two instruction words immediately following the NORM instruction. Also, the auxiliary register pointer (ARP) should not be modified by the next two words.
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
NORM *+
Before Instruction ARP AR2 ACC X TC 2 00h FFFF F001h ARP AR2 ACC 0 TC After Instruction 2 01h 0FFF E002h
Example 2
31-bit normalization:
MAR LAR NORM BCND *,AR1 AR1,#0h *+ LOOP,NTC ;Use AR1 to store the exponent. ;Clear out exponent counter. ;One bit is normalized. ;If TC = 0, magnitude not found yet.
LOOP
Example 3
15-bit normalization:
MAR*,AR1 ;Use AR1 to store the exponent. LAR AR1,#0Fh ;Initialize exponent counter. RPT #14 ;15bit normalization specified (yielding ;a 4bit exponent and 16bit mantissa). NORM * ;NORM automatically stops shifting when ;first significant magnitude bit is found, ;performing NOPs for the remainder of the ;repeat loops
6-182
The method in Example 2 normalizes a 32-bit number and yields a 5-bit exponent magnitude. The method in Example 3 normalizes a 16-bit number and yields a 4-bit magnitude. If the number requires only a small amount of normalization, the Example 2 method may be preferable to the Example 3 method because the loop in Example 2 runs only until normalization is complete; Example 3 always executes all 15 cycles of the repeat loop. Specifically, Example 2 is more efficient if the number requires three or fewer shifts. If the number requires six or more shifts, Example 3 is more efficient. Note: The NORM instruction can be used without a specified operand. In that case, any comments on the same line as the instruction are interpreted as the operand. If the first character is an asterisk (*), then the instruction is assembled as NORM * with no auxiliary register modification taking place upon execution. Therefore, TI recommends that you replace the NORM instructions with NORM *+ when you want the default increment modification.
6-183
Syntax Operands
Direct: Indirect:
0 dma 127 lk: 16-bit constant 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with long immediate not specified
15 0 14 1 13 0 12 1 11 1 10 0 9 0 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
Execution
Long immediate not specified: (PC) + 1 PC (dma) OR (DBMR) dma Long immediate specified: (PC) +2 PC (dma) OR lk dma
Affects: TC
If a long immediate constant is specified, the constant is ORed with the contents of the data memory address (dma). If a constant is not specified, the contents of the dma are ORed with the contents of the dynamic bit manipulation register (DBMR). In both cases, the result is written directly back to the dma and the contents of the accumulator (ACC) are unaffected. If the result of the OR operation is 0, the TC bit is set; otherwise, the TC bit is cleared. OPL is a parallel logic unit (PLU) instruction (see Table 66).
Words
1 2
6-184
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 2+2d DARAM 1 1 2+2d SARAM 1 1, 3 2+2d External Memory 1+p 1+p 5+2d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n 2n2 4n2+2nd DARAM n 2n2 4n2+2nd SARAM n 2n2, 2n+1 4n2+2nd External Memory n+p 2n2+p 4n+1+2nd+p
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate specified) Operand DARAM SARAM External ROM 2 2 3+2d DARAM 2 2 3+2d SARAM 2 2 3+2d External Memory 2+2p 2+2p 6+2d+2p
Cycles for a Repeat (RPT) Execution (long immediate specified) Operand DARAM SARAM External ROM n+1 2n1 4n1+2nd DARAM n+1 2n1 4n1+2nd SARAM n+1 2n1, 2n+2 4n1+2nd External Memory n+1+2p 2n1+2p 4n+2+2nd+2p
If the operand and the code are in the same SARAM block
6-185
Example 1
Example 2
Example 3
OPL *,AR6
Before Instruction ARP AR3 DBMR Data Memory 300h 3 300h 00F0h 000Fh ARP AR3 DBMR Data Memory 300h After Instruction 6 300h 00F0h 00FFh
Example 4
OPL #1111h,*,AR3
Before Instruction ARP AR6 Data Memory 306h 6 306h 0Eh ARP AR6 Data Memory 306h After Instruction 3 306h 111Fh
6-186
Syntax
Operands
0 dma 127 0n7 lk: 16-bit constant 0 shift 16 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 1 13 1 12 0 11 1 10 1 9 0 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 1 10 1 9 0 8 1 7 1 6 5 4 3 2 See Section 5.2 1 0
16-Bit Constant
See Table 61 on page 6-2.
16-Bit Constant
See Table 61 on page 6-2.
Execution
Direct or indirect addressing: (PC) + 1 PC (ACC(150)) OR (dma) ACC(150) (ACC(3116)) ACC(3116) Long immediate addressing: (PC) + 2 PC (ACC) OR (lk 2shift ) ACC
Status Bits
6-187
Description
If a long immediate constant is specified, the constant is shifted, as defined by the shift code, and zero-extended on both ends and is ORed with the contents of the accumulator (ACC). The result is stored in the ACC. If a constant is not specified, the contents of the data memory address (dma) are ORed with the contents of the accumulator low byte (ACCL). The result is stored in the ACCL and the contents of the accumulator high byte (ACCH) are unaffected. OR is an accumulator memory reference instruction (see Table 64).
Words
1 2
Cycles
For the long immediate addressing modes, the OR instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
6-188
Example 1
OR DAT8 ;(DP = 8)
Before Instruction Data Memory 408h ACC X C F000h 0010 0002h Data Memory 408h ACC X C After Instruction F000h 0010 F002h
Example 2
OR *,AR0
Before Instruction ARP AR1 Data Memory 300h ACC X C 1 300h 1111h 222h ARP AR1 Data Memory 300h ACC X C After Instruction 0 300h 1111h 1333h
Example 3
OR #08111h,8
Before Instruction ACC X C 00FF 0000h ACC X C After Instruction 00FF 1100h
6-189
ORB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 0 1 1 0 1
Execution
(PC) + 1 PC (ACC) OR (ACCB) ACC None affected. The contents of the accumulator (ACC) are ORed with the contents of the accumulator buffer (ACCB). The result is stored in the ACC and the contents of the ACCB are unaffected. ORB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ORB
Before Instruction ACC ACCB X C 5555 5555h 0000 0002h ACC ACCB X C After Instruction 5555 5557h 0000 0002h
6-190
Syntax
Direct: Indirect:
Operands
0 dma 127 0n7 0 port address PA 65535 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 0 13 0 12 0 11 1 10 1 9 0 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
Indirect addressing
15 0 14 0 13 0 12 0 11 1 10 1 9 0 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
16-Bit Constant
Execution
(PC) + 2 PC While (repeat counter) 0 Port address address bus A15A0 (dma) data bus D15D0 Port address + 1 Port address (repeat counter 1) (repeat counter) (dma) Port address None affected. A 16-bit value from the data memory address (dma) is written to the specified I/O port. The IS line goes low to indicate an I/O access, and the STRB, R/W, and READY timings are the same as for an external data memory write. While port addresses 50h5Fh are memory-mapped (see subsection 9.1.1, Memory-Mapped Peripheral Registers and I/O Ports); the other port addresses are not. You can use the RPT instruction with the OUT instruction to write consecutive words in data memory to I/O space. The number of words to be moved is one greater than the number contained in the repeat counter register (RPTC) at the beginning of the instruction. When used with the RPT instruction, the OUT instruction becomes a single-cycle instruction, once the RPT pipeline is started, and the port address is incremented after each access. OUT is an I/O and data memory operation instruction (see Table 69).
Words
2
6-191
Cycles
Cycles for a Single Instruction Operand Source: DARAM Source: SARAM Source: External ROM 3+iodst 3+iodst 3+dsrc +iodst DARAM 3+iodst 3+iodst 3+dsrc +iodst SARAM 3+iodst 3+iodst , 4+iodst 3+dsrc +iodst External Memory 5+iodst +2pcode 5+iodst +2pcode 6+dsrc +iodst +2pcode
If the source operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand Source: DARAM Source: SARAM Source: External ROM 3n+niodst 3n+niodst 5n2+ndsrc +niodst DARAM 3n+niodst 3n+niodst 5n2+ndsrc + +niodst SARAM 3n+niodst 3n+niodst , 3n+1+niodst 5n2+ndsrc +niodst External Memory 3n+3+niodst +2pcode 3n+3+niodst +2pcode 5n+1+ndsrc +niodst +2pcode
If the source operand and the code are in the same SARAM block
Example 1
OUT DAT0,57h ;(DP = 4) Output data word stored in data memory ;location 200h to peripheral on I/O port 57h. OUT *,PA15 ;Output data word referenced by current auxiliary ;register to peripheral on port address 15 ;(i.e., I/O port 5Fh).
Example 2
6-192
PAC None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 0 2 0 1 1 0 1
Execution
Affected by: PM
The contents of the product register (PREG) are shifted, as defined by the PM bits, and loaded into the accumulator (ACC). PAC is a TREG0, PREG, and multiply instruction (see Table 67).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
PAC ;(PM = 0)
Before Instruction PREG ACC X C 144h 23h PREG ACC X C After Instruction 144h 144h
6-193
POP None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 1 3 0 2 0 1 1 0 0
Execution
(PC) + 1 PC (TOS) ACC(150) 0 ACC(3116) Pop stack one level None affected. The contents of the top of the stack (TOS) are copied to the accumulator low byte (ACCL). The stack is popped one level after the contents are copied. The accumulator high byte (ACCH) is zero-filled. The hardware stack is last-in, first-out with eight locations. Any time a pop occurs, every stack value is copied to the next higher stack location, and the top value is removed from the stack. After a pop, the bottom two stack words have the same value. Because each stack value is copied, if more than seven stack pops (POP, POPD, RET, RETC, RETE, or RETI instructions) occur before any pushes occur, all levels of the stack contain the same value. No provision exists to check stack underflow. POP is a control instruction (see Table 610).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
6-194
Example
POP
Before Instruction ACC Stack X C 82h 45h 16h 7h 33h 42h 56h 37h 61h ACC Stack X C After Instruction 45h 16h 7h 33h 42h 56h 37h 61h 61h
6-195
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 1 14 0 13 0 12 0 11 1 10 0 9 1 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(PC) + 1 PC (TOS) dma Pop stack one level None affected. The contents of the top of the stack (TOS) are copied to the data memory address (dma). The values are popped one level in the lower seven locations of the stack. The value in the lowest stack location is unaffected. See the POP instruction, page 6-194, for more information. POPD is a control instruction (see Table 610).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 2+d DARAM 1 1 2+d SARAM 1 1, 2 2+d External Memory 1+p 1+p 4+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n 2n+nd DARAM n n 2n+nd SARAM n n, n+2 2n+nd External Memory n+p n+p 2n+2+nd+p
If the operand and the code are in the same SARAM block
6-196
Example 1
Example 2
POPD *+,AR1
Before Instruction ARP AR0 Data Memory 300h Stack 0 300h 55h 92h 72h 8h 44h 81h 75h 32h AAh ARP AR0 Data Memory 300h Stack After Instruction 1 301h 92h 72h 8h 44h 81h 75h 32h AAh AAh
6-197
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 1 13 1 12 1 11 0 10 1 9 1 8 0 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
(dma) TOS (PC) + 1 PC Push all stack locations down one level None affected. The contents of the data memory address (dma) are copied to the top of the stack (TOS). The values are pushed down one level in the lower seven locations of the stack. The value in the lowest stack location is lost. See the PUSH instruction, page 6-200, for more information. PSHD is a control instruction (see Table 610).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
6-198
Example 1
Example 2
PSHD *,AR1
Before Instruction ARP AR0 Data Memory 1FFh Stack 0 1FFh 12h 2h 33h 78h 99h 42h 50h 0h 0h ARP AR0 Data Memory 1FFh Stack After Instruction 1 1FFh 12h 12h 2h 33h 78h 99h 42h 50h 0h
6-199
PUSH None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 1 3 1 2 1 1 0 0 0
Execution
(PC) + 1 PC Push all stack locations down one level ACC(150) TOS None affected. The values are pushed down one level in the lower seven locations of the stack. The contents of the accumulator low byte (ACCL) are copied to the top of the stack (TOS). The values on the stack are pushed down before the ACC value is copied. The hardware stack is last-in, first-out with eight locations. If more than eight pushes (CALA, CALL, CC, INTR, NMI, PSHD, PUSH, or TRAP instructions) occur before a pop, the first data values written are lost with each succeeding push. PUSH is a control instruction (see Table 610).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
6-200
Example
PUSH
Before Instruction ACC Stack X C 7h 2h 5h 3h 0h 12h 86h 54h 3Fh ACC Stack X C After Instruction 7h 7h 2h 5h 3h 0h 12h 86h 54h
6-201
RET None
15 1 14 1 13 1 12 0 11 1 10 1 9 1 8 1 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 0
Execution
(TOS) PC Pop stack one level None affected. The contents of the top of the stack (TOS) are copied to the program counter (PC). The stack is popped one level after the contents are copied. The RET instruction is used with the CALA, CALL, and CC instructions for subroutines. RET is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
RET
Before Instruction PC Stack 96h 37h 45h 75h 21h 3Fh 45h 6Eh 6Eh PC Stack After Instruction 37h 45h 75h 21h 3Fh 45h 6Eh 6Eh 6Eh
6-202
Syntax Operands
RETC cond [, cond1 ] [,...] Conditions: ACC = 0 ACC 0 ACC < 0 ACC 0 ACC > 0 ACC 0 C=0 C=1 OV = 0 OV = 1 BIO low TC = 0 TC = 1 Unconditional
12 0 11 1 10 1 9 8 TP 7
Opcode
15 1
14 1
13 1
Execution
If (condition(s)): (TOS) PC Pop stack one level Else, continue None affected. If the specified conditions are met, the contents of the top of the stack (TOS) are copied to the program counter (PC). The stack is popped one level after the contents are copied. Not all combinations of the conditions are meaningful. If the specified conditions are not met, control is passed to the next instruction. RETC is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
6-203
Example
RETC GEQ,NOV ;A return, RET, is executed if the ;accummulator contents are positive and the ;OV bit is a zero.
6-204
Syntax Operands
RETCD cond [, cond1 ] [,...] Conditions: ACC = 0 ACC 0 ACC < 0 ACC 0 ACC > 0 ACC 0 C=0 C=1 OV = 0 OV = 1 BIO low TC = 0 TC = 1 Unconditional
12 1 11 1 10 1 9 8 TP 7
Opcode
15 1
14 1
13 1
Execution
If (condition(s)): (TOS) PC Pop stack one level Else, continue None affected. The one 2-word instruction or two 1-word instructions following the RETCD instruction are fetched from program memory and executed before the execution of the return. The two instruction words following the RETCD instruction have no effect on the conditions being tested. After the instructions are executed if the specified conditions are met, the contents of the top of the stack (TOS) are copied to the program counter (PC). The stack is popped one level after the contents are copied. Not all combinations of the conditions are meaningful. If the specified conditions are not met, control is passed to the next instruction. RETCD is a branch and call instruction (see Table 68).
Words Cycles
6-205
Example
RETCD C ;A return, RET, is executed if the carry MAR *,4 ;bit is set. The two instructions following LAR AR3,#1h ;the return instruction are executed ;before the return is taken.
6-206
RETD None
15 1 14 1 13 1 12 1 11 1 10 1 9 1 8 1 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 0
(TOS) PC Pop stack one level None affected. The one 2-word instruction or two 1-word instructions following the RETD instruction are fetched from program memory and executed before the execution of the return. After the instructions are executed the contents of the top of the stack (TOS) are copied to the program counter (PC). The stack is popped one level after the contents are copied. RETD is a branch and call instruction (see Table 68).
Words Cycles
Example
6-207
RETE None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 1 3 1 2 0 1 1 0 0
Affects: ARB, ARP, AVIS, BRAF, C, CNF, DP, HM, INTM, MP/MC, NDX, OV, OVLY, OVM, PM, RAM, SXM, TC, TRM, and XF
The contents of the top of the stack (TOS) are copied to the program counter (PC). The stack is popped one level after the contents are copied. The RETE instruction automatically clears the INTM bit and pops the shadow register values (see the RETI description, page 6-209). The RETE instruction is the equivalent of clearing the INTM bit and executing a RETI instruction. RETE is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
RETE
Before Instruction PC ST0 Stack 96h xx6xh 37h 45h 75h 21h 3Fh 45h 6Eh 6Eh PC ST0 Stack After Instruction 37h xx4xh 45h 75h 21h 3Fh 45h 6Eh 6Eh 6Eh
6-208
RETI None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 1 4 1 3 1 2 0 1 0 0 0
Affects: ARB, ARP, AVIS, BRAF, C, CNF, DP, HM, MP/MC, NDX, OV, OVLY, OVM, PM, RAM, SXM, TC, TRM, and XF
Description
The contents of the top of the stack (TOS) are copied to the program counter (PC). The values in the shadow registers (stored when an interrupt was taken) are returned to their corresponding strategic registers. The following registers are shadowed: ACC, ACCB, ARCR, INDX, PMST, PREG, ST0, ST1, TREG0, TREG1, and TREG2. The INTM bit in ST0 and the XF bit in ST1 are not saved or restored to or from the shadow registers during an interrupt service routine (ISR). RETI is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
RETI
Before Instruction PC Stack 96h 37h 45h 75h 21h 3Fh 45h 6Eh 6Eh PC Stack After Instruction 37h 45h 75h 21h 3Fh 45h 6Eh 6Eh 6Eh
6-209
ROL None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 1 2 1 1 0 0 0
Execution
Status Bits
Affects: C
Description
The contents of the accumulator (ACC) are rotated left 1 bit. The value of the C bit is shifted into the LSB of the ACC. The MSB of the original ACC is shifted into the C bit.
(1)
C (2)
MSB
ACC
LSB
ROL is an accumulator memory reference instruction (see Table 64). Words Cycles
ROM 1
1
Cycles for a Single Instruction DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ROL
Before Instruction ACC 0 C B000 1234h ACC 1 C After Instruction 6000 2468h
6-210
ROLB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 1 1 0 0 0
Affects: C
The ROLB instruction causes a 65-bit rotation. The contents of both the accumulator (ACC) and accumulator buffer (ACCB) are rotated left 1 bit. The value of the C bit is shifted into the LSB of the ACCB. The MSB of the original ACCB is shifted into the LSB of the ACC. The MSB of the original ACC is shifted into the C bit.
(1)
C (3)
MSB
ACC
LSB (2)
MSB
ACCB
LSB
ROLB is an accumulator memory reference instruction (see Table 64). Words Cycles
ROM 1
1
Cycles for a Single Instruction DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ROLB
Before Instruction ACC ACCB 1 C 0808 0808h FFFF FFFEh ACC ACCB 0 C After Instruction 1010 1011h FFFF FFFDh
6-211
ROR None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 1 2 1 1 0 0 1
Execution
Status Bits
Affects: C
Description
The contents of the accumulator (ACC) are rotated right 1 bit. The value of the C bit is shifted into the MSB of the ACC. The LSB of the original ACC is shifted into the C bit.
C (1) MSB ACC LSB
(2)
ROR is an accumulator memory reference instruction (see Table 64). Words Cycles
ROM 1
1
Cycle Timings for a Single Instruction DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ROR
Before Instruction ACC 0 C B000 1235h ACC 1 C After Instruction 5800 091Ah
6-212
RORB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 1 1 0 0 1
Affects: C
The RORB instruction causes a 65-bit rotation. The contents of both the accumulator (ACC) and accumulator buffer (ACCB) are rotated right 1 bit. The value of the C bit is shifted into the MSB of the ACC. The LSB of the original ACC is shifted into the MSB of the ACCB. The LSB of the original ACCB is shifted into the C bit.
C (1) MSB ACC LSB (2) MSB ACCB LSB
(3)
RORB is an accumulator memory reference instruction (see Table 64). Words Cycles
ROM 1
1
Cycles for a Single Instruction DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
RORB
Before Instruction ACC ACCB 1 C 0808 0808h FFFF FFFEh ACC ACCB 0 C After Instruction 8404 0404h 7FFF FFFFh
6-213
Syntax
Operands
0 dma 127 0n7 0 k 255 0 lk 65535 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 0 13 0 12 0 11 1 10 0 9 1 8 1 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 0 13 0 12 0 11 1 10 0 9 1 8 1 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
Direct or indirect addressing: (PC) + 1 PC (dma) RPTC Short immediate addressing: (PC) + 1 PC k RPTC Long immediate addressing: (PC) + 2 PC lk RPTC
None affected. The contents of the data memory address (dma), an 8-bit constant, or a 16-bit constant are loaded into the repeat counter register (RPTC). The instruction following the RPT instruction is repeated n times, where n is one more than the initial value of the RPTC.
6-214
Since the RPTC cannot be saved during a context switch, repeat loops are regarded as multicycle instructions and are not interruptible. However, the processor can halt a repeat loop in response to an external HOLD signal. The execution restarts when HOLD/HOLDA are deasserted. The RPTC is cleared on a device reset. The RPT instruction is especially useful for block moves, multiply-accumulates, normalization, and other functions. RPT is a control instruction (see Table 610). Words Cycles 1 2 (Direct, indirect, or short immediate addressing) (Long immediate addressing)
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
Example 1
Example 2
RPT *,AR1
Before Instruction ARP AR0 Data Memory 300h RPTC 0 300h 0FFFh 0h ARP AR0 Data Memory 300h RPTC After Instruction 1 300h 0FFFh 0FFFh
6-215
Example 3
Example 4
6-216
Execution
Status Bits
Affects: BRAF
Description
A block of instructions to be repeated a number of times is specified by the memory-mapped block repeat counter register (BRCR) without any penalty for looping. The BRCR must be loaded before execution of an RPTB instruction. When the RPTB instruction is executed, the BRAF bit is set, the block repeat program address start register (PASR) is loaded with the contents of the program counter (PC) + 2, and the block repeat program address end register (PAER) is loaded with the program memory address (pma). Block repeat can be deactivated by clearing the BRAF bit. The number of loop iterations is given as (BRCR) + 1. The RPTB instruction is interruptible. However, RPTB instructions cannot be nested unless the BRAF bit is properly set and the BRCR, PAER, and PASR are appropriately saved and restored. Single-instruction repeat loops (RPT and RPTZ) can be included as part of RPTB blocks. Note: The repeat block must contain at least 3 instruction words for proper operation. RPTB is a control instruction (see Table 610).
Words
6-217
Cycles
Example
SPLK #iterations_minus_1,BRCR RPTB end_block 1 LACC DAT1 ADD DAT2 SACL DAT1 end_block
;initialize BRCR
6-218
Execution
0 ACC 0 PREG (PC) + 1 PC lk RPTC None affected. The contents of the accumulator (ACC) and product register (PREG) are cleared. The 16-bit constant, lk, is loaded into the repeat counter register (RPTC). The instruction following the RPTZ instruction is repeated lk + 1 times. The RPTZ instruction is equivalent to the following instruction sequence:
MPY #0 PAC RPT #<lk>
RPTZ is a control instruction (see Table 610). Words Cycles 2 The RPTZ instruction is not repeatable.
Cycles for a Single Instruction ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
Example
RPTZ #7FFh ;Zero product register and accumulator. MACD pma,*+ ;Repeat MACD 2048 times.
6-219
SACB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 1 1 1 0 0
Execution
(PC) + 1 PC (ACC) ACCB None affected. The contents of the accumulator (ACC) are copied to the accumulator buffer (ACCB). The contents of the ACC are unaffected. SACB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
SACB
Before Instruction ACC ACCB 7C63 8421h 5h ACC ACCB After Instruction 7C63 8421h 7C63 8421h
6-220
Syntax Operands
Direct: Indirect:
0 dma 127 0n7 0 shift2 7 (defaults to 0) ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 0 12 1 11 1 10 9 8 SHF 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 1 14 0 13 0 12 1 11 1 10 9 8 SHF 7 1 6 5 4 3 2 1 See Section 5.2 0
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 2+d DARAM 1 1 2+d SARAM 1 1, 2 2+d External Memory 1+p 1+p 4+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n 2n+nd DARAM n n 2n+nd SARAM n n, n+2 2n+nd External Memory n+p n+p 2n+2+nd+p
If the operand and the code are in the same SARAM block
6-221
Example 1
0h
0841h
Example 2
SACH *+,0,AR2
Before Instruction ARP AR1 ACC Data Memory 300h X C 0h Data Memory 300h 1 300h 0420 8001h ARP AR1 ACC X C 0420h After Instruction 2 301h 0420 8001h
6-222
Syntax Operands
Direct: Indirect:
0 dma 127 0n7 0 shift2 7 (defaults to 0) ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 0 12 1 11 0 10 9 8 SHF 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 1 14 0 13 0 12 1 11 0 10 9 8 SHF 7 1 6 5 4 3 2 1 See Section 5.2 0
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 2+d DARAM 1 1 2+d SARAM 1 1, 2 2+d External Memory 1+p 1+p 4+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n 2n+nd DARAM n n 2n+nd SARAM n n, n+2 2n+nd External Memory n+p n+p 2n+2+nd+p
If the operand and the code are in the same SARAM block
6-223
Example 1
05h
0842h
Example 2
SACL *,0,AR7
Before Instruction ARP AR6 ACC Data Memory 300h X C 05h Data Memory 300h 6 300h 00FF 8421h ARP AR6 ACC X C 8421h After Instruction 7 300h 00FF 8421h
6-224
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 1 14 0 13 0 12 0 11 1 10 0 9 0 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
(PC) + 1 PC (ACC(150)) dma(07) None affected. The contents of the accumulator low byte (ACCL) are copied to the addressed memory-mapped register. The 9 MSBs of the data memory address are cleared, regardless of the current value of the data memory page pointer (DP) bits or the upper 9 bits of the current AR. The SAMM instruction allows the ACC to be stored to any memory location on data memory page 0 without modifying the DP bits. SAMM is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction Operand MMR MMPORT ROM 1 2+iodst DARAM 1 2+iodst SARAM 1 2+iodst External Memory 1+p 4+iodst
Cycles for a Repeat (RPT) Execution Operand MMR MMPORT ROM n 2+niodst DARAM n 2+niodst SARAM n 2+niodst External Memory n+p 2n+2+p+p niodst
6-225
Example 1
Example 2
6-226
Syntax
Direct: Indirect:
Operands
0 dma 127 0x7 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 0 12 0 11 0 10 9 8 ARX 7 0 6 5 4 3 2 dma 1 0
Opcode
Indirect addressing
15 1 14 0 13 0 12 0 11 0 10 9 8 ARX 7 1 6 5 4 3 2 See Section 5.2 1 0
Execution
Words
1
6-227
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 2+d DARAM 1 1 2+d SARAM 1 1, 2 2+d External Memory 1+p 1+p 4+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n 2n+nd DARAM n n 2n+nd SARAM n n, n+2 2n+nd External Memory n+p n+p 2n+2+nd+p
If the operand and the code are in the same SARAM block
Example 1
Example 2
SAR AR0,*+
Before Instruction AR0 Data Memory 401h 401h 0h AR0 Data Memory 401h After Instruction 402h 401h
6-228
SATH None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 1 3 1 2 0 1 1 0 0
Execution
Status Bits
Description
The SATH instruction, in conjunction with the SATL instruction, allows for a 2-cycle 0- to 31-bit shift right. The contents of the accumulator (ACC) are barrel-shifted right 16 bits as defined by bit 4 of TREG1. If bit 4 of TREG1 is set, the contents of the ACC are barrel-shifted right by 16 bits. If bit 4 of TREG1 is cleared, the contents of the ACC are unaffected. If the SXM bit is cleared, the high-order bits are zero-filled; if the SXM bit is set, the high-order bits of the ACC are filled with copies of ACC bit 31. The C bit is unaffected. SATH is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
SATH ;(SXM = 0)
Before Instruction ACC TREG1 X C FFFF 0000h xx1xh ACC TREG1 X C After Instruction 0000 FFFFh xx1xh
6-229
Example 2
SATH ;(SXM = 1)
Before Instruction ACC TREG1 X C FFFF 0000h xx1xh ACC TREG1 X C After Instruction FFFF FFFFh xx1xh
6-230
SATL None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 1 3 1 2 0 1 1 0 1
The SATL instruction, in conjunction with the SATH instruction, allows for a 2-cycle 0- to 31-bit shift right. The contents of the accumulator (ACC) are barrel-shifted right 0 to 15 bits as defined by the 4 LSBs of TREG1. If the SXM bit is cleared, the high-order bits are zero-filled; if the SXM bit is set, the high-order bits of the ACC are filled with copies of ACC bit 31. The C bit is unaffected. SATL is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
SATL ;(SXM = 0)
Before Instruction ACC TREG1 X C FFFF 0000h x2h ACC TREG1 X C After Instruction 3FFF C000h x2h
Example 2
SATL ;(SXM = 1)
Before Instruction ACC TREG1 X C FFFF 0000h x2h ACC TREG1 X C After Instruction FFFF C000h x2h
6-231
SBB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 0 1 0 0 0
Execution
Affects: C
The contents of the accumulator buffer (ACCB) are subtracted from the contents of the accumulator (ACC). The result is stored in the ACC and the contents of the ACCB are unaffected. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. SBB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
SBB
Before Instruction ACC ACCB X C 2000 0000h 1000 0000h ACC ACCB 1 C After Instruction 1000 0000h 1000 0000h
6-232
SBBB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 0 1 0 0 1
Affects: C
The contents of the accumulator buffer (ACCB) and the logical inversion of the C bit are subtracted from the contents of the accumulator (ACC). The result is stored in the ACC and the contents of the ACCB are unaffected. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. SBBB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
SBBB
Before Instruction ACC ACCB 1 C 2000 0000h 1000 0000h ACC ACCB 1 C After Instruction 1000 0000h 1000 0000h
Example 2
SBBB
Before Instruction ACC ACCB 0 C 0009 8012h 0009 8010h ACC ACCB 1 C After Instruction 01h 0009 8010h
6-233
SBRK #k 0 k 255
15 0 14 1 13 1 12 1 11 1 10 1 9 0 8 0 7 6 5 4 3 2 8-Bit Constant 1 0
Execution
(PC) + 1 PC (current AR) 8-bit positive constant current AR None affected. The 8-bit immediate value, right-justified, is subtracted from the current auxiliary register (AR). The result is stored in the current AR. The subtraction takes place in the auxiliary register arithmetic unit (ARAU), with the immediate value treated as a 8-bit positive integer. SBRK is an auxiliary registers and data memory page pointer instruction (see Table 65).
Words Cycles
Example
SBRK #0FFh
Before Instruction ARP AR7 7 0h ARP AR7 After Instruction 7 FF01h
6-234
control bit : {C, CNF, HM, INTM, OVM, SXM, TC, XF}
SETC OVM (Set overflow mode)
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 0 3 0 2 0 1 1 0 1
(PC) + 1 PC 1 control bit Affects selected control bit. The specified control bit is set. The LST instruction can also be used to load ST0 and ST1. See Section 4.4, Status and Control Registers, for more information on each control bit. SETC is a control instruction (see Table 610).
6-235
An IDLE instruction must not follow a SETC INTM instruction; otherwise, an unmasked interrupt may take the device out of idle before the INTM bit is set.
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
6-236
SFL None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 1 2 0 1 0 0 1
Execution
Status Bits
Affects: C
Description
The contents of the accumulator (ACC) are shifted left 1 bit. The MSB of the ACC is shifted into the C bit. The LSB of the ACC is filled with a 0. The SFL instruction, unlike the SFR instruction, is unaffected by the SXM bit.
C (1) MSB ACC LSB (2)
SFL is an accumulator memory reference instruction (see Table 64). Words Cycles
ROM 1
1
Cycles for a Single Instruction DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
SFL
Before Instruction ACC X C B000 1234h ACC 1 C After Instruction 6000 2468h
6-237
SFLB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 1 1 1 0 0
Affects: C
The contents of both the accumulator (ACC) and accumulator buffer (ACCB) are shifted left 1 bit. The LSB of the ACCB is filled with a 0, and the MSB of the ACCB is shifted into the LSB of the ACC. The MSB of the ACC is shifted into the C bit. The SFLB instruction, unlike the SFRB instruction, is unaffected by the SXM bit.
C (3) MSB ACC LSB (2) MSB ACCB LSB (1)
SFLB is an accumulator memory reference instruction (see Table 64). Words Cycles
ROM 1
1
Cycles for a Single Instruction DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
SFLB
Before Instruction ACC ACCB X C B000 1234h B000 1234h ACC ACCB 1 C After Instruction 6000 2469h 6000 2468h
6-238
SFR None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 1 2 0 1 1 0 0
Affects: C
The contents of the accumulator (ACC) are shifted right 1 bit. The type of shift is determined by the SXM bit. If the SXM bit is cleared, the SFR instruction produces a logic right shift. The MSB of the ACC is filled with a 0. The LSB of the ACC is shifted into the C bit. 0
MSB (1) ACC LSB (2) C
If the SXM bit is set, the SFR instruction produces an arithmetic right shift. The MSB (sign bit) of the ACC is unchanged and is copied into ACC bit 30. The LSB of the ACC is shifted into the C bit.
MSB (1)
ACC
LSB (2)
SFR is an accumulator memory reference instruction (see Table 64). Words Cycles
ROM 1
1
Cycles for a Single Instruction DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
6-239
Example 1
SFR ;(SXM = 0)
Before Instruction ACC X C B000 1234h ACC 0 C After Instruction 5800 091Ah
Example 2
SFR ;(SXM = 1)
Before Instruction ACC X C B000 1234h ACC 0 C After Instruction D800 091Ah
6-240
SFRB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 0 2 1 1 1 0 1
Execution
(PC) + 1 PC If SXM=0: 0 ACC(31) If SXM=1: (ACC(31)) ACC(31) (ACC(311)) ACC(300) (ACC(0)) ACCB (31) (ACCB(311)) ACCB(300) (ACCB(0)) C
Status Bits
Affects: C
Description
The contents of both the accumulator (ACC) and accumulator buffer (ACCB) are shifted right 1 bit. The type of shift is determined by the SXM bit. If the SXM bit is cleared, the SFR instruction produces a logic right shift. The MSB of the ACC is filled with a 0. The LSB of the ACC is shifted into the MSB of the ACCB. The LSB of the ACCB is shifted into the C bit. 0
MSB (1) ACC LSB (2) MSB ACCB LSB (3) C
If the SXM bit is set, the SFR instruction produces an arithmetic right shift. The MSB (sign bit) of the ACC is unchanged and is copied into ACC bit 30. The LSB of the ACC is shifted into the MSB of the ACCB. The LSB of the ACCB is shifted into the C bit.
MSB (1)
ACC
LSB (2)
MSB
ACCB
LSB (3)
Cycles
ROM 1
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example 1
SFRB ;(SXM = 0)
Before Instruction ACC ACCB X C B000 1235h B000 1234h ACC ACCB 0 C After Instruction 5800 091Ah D800 091Ah
Example 2
SFRB ;(SXM = 1)
Before Instruction ACC ACCB X C B000 1234h B000 1234h ACC ACCB 0 C After Instruction D800 091Ah 5800 091Ah
6-242
Syntax
Direct: Indirect:
Operands
0 addr 65535 0 dma 127 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 0 13 0 12 0 11 1 10 0 9 8 7 6 0 1 0 16-Bit Constant 5 4 3 2 dma 1 0
Opcode
Indirect addressing
15 0 14 0 13 0 12 0 11 1 10 0 9 0 8 1 7 1 6 5 4 3 2 1 See Section 5.2 0
16-Bit Constant
Execution
PFC MCS (PC) + 2 PC lk PFC While (repeat counter 0): (src, specified by lower 7 bits of dma) (dst, addressed by PFC) (PFC) + 1 PFC (repeat counter) 1 repeat counter MCS PFC None affected. The memory-mapped register value pointed at by the lower 7 bits of the data memory address (dma) is stored to the data memory location addressed by the 16-bit source address, #addr. The 9 MSBs of the dma are cleared, regardless of the current value of the data memory page pointer (DP) bits or the upper 9 bits of the current AR. The SMMR instruction allows any memory location on data memory page 0 to be stored anywhere in data memory without modifying the DP bits. When using the SMMR instruction with the RPT instruction, the destination address, #addr, is incremented after every memory-mapped store operation. SMMR is an I/O and data memory operation instruction (see Table 69).
Words
2
6-243
Cycles
Cycles for a Single Instruction Operand Destination: DARAM Source: MMR Destination: SARAM Source: MMR Destination: External Source: MMR Destination: DARAM Source: MMPORT Destination: SARAM Source: MMPORT Destination: External Source: MMPORT ROM 2 2 3+ddst 3+iosrc 3+iosrc 4+iosrc +ddst DARAM 2 2 3+ddst 3+iosrc 3+iosrc 4+iosrc +ddst SARAM 2 2, 3 3+ddst 3+iosrc 3+iosrc , 4+iosrc 4+iosrc +ddst External Memory 2+2pcode 2+2pcode 5+ddst +2pcode 4+iosrc +2pcode 3+iosrc +2pcode 6+iosrc +ddst +2pcode
If the destination operand and the code are in the same SARAM block Add one more cycle for peripheral memory-mapped register access.
Cycles for a Repeat (RPT) Execution Operand Destination: DARAM Source: MMR Destination: SARAM Source: MMR Destination: External Source: MMR Destination: DARAM Source: MMPORT Destination: SARAM Source: MMPORT Destination: External Source: MMPORT ROM 2n 2n 3n+nddst 2n+niosrc 2n+niosrc 5n2+nddst +niosrc DARAM 2n 2n 3n+nddst 2n+niosrc 2n+niosrc 5n2+nddst +niosrc SARAM 2n 2n, 2n+2 3n+nddst 2n+niosrc 2n+niosrc , 2n+2+niosrc 5n2+nddst +niosrc External Memory 2n+2pcode 2n+2pcode 3n+3+nddst +2pcode 2n+1+niosrc +2pcode 2n+1+niosrc +2pcode 5n+1+nddst +niosrc +2pcode
If the destination operand and the code are in the same SARAM block Add n more cycles for peripheral memory-mapped register access.
6-244
Example 1
Example 2
6-245
SPAC None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 0 3 0 2 1 1 0 0 1
Execution
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and subtracted from the contents of the accumulator (ACC). The result is stored in the ACC. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. The SPAC instruction is not affected by the SXM bit and the PREG is always sign extended. The SPAC instruction is a subset of the LTS, MPYS, and SQRS instructions. SPAC is a TREG0, PREG, and multiply instruction (see Table 67).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
SPAC ;(PM = 0)
Before Instruction PREG ACC X C 1000 0000h 7000 0000h PREG ACC 1 C After Instruction 1000 0000h 6000 0000h
6-246
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 1 14 0 13 0 12 0 11 1 10 1 9 0 8 1 7 1 6 5 4 3 2 1 See Section 5.2 0
Affected by: PM
The contents of the product register (PREG) high byte are shifted, as defined by the PM bits, and stored in the data memory address (dma). The contents of the PREG and the accumulator (ACC) are unaffected. When the right-shiftby-6 mode (PM is set to 112) is selected, high-order bits are sign extended. When left shifts are selected, low-order bits are filled from the PREG low byte. SPH is a TREG0, PREG, and multiply instruction (see Table 67).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 2+d DARAM 1 1 2+d SARAM 1 1, 2 2+d External Memory 1+p 1+p 4+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n 2n+nd DARAM n n 2n+nd SARAM n n, n+2 2n+nd External Memory n+p n+p 2n+2+nd+p
If the operand and the code are in the same SARAM block
6-247
Example 1
Example 2
6-248
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 1 14 0 13 0 12 0 11 1 10 1 9 0 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Affected by: PM
The contents of the product register (PREG) low byte are shifted, as defined by the PM bits, and stored in the data memory address (dma). The contents of the PREG and the accumulator (ACC) are unaffected. When the right-shiftby-6 mode (PM is set to 112) is selected, high-order bits are filled from the PREG high byte. When left shifts are selected, low-order bits are zero-filled. SPL is a TREG0, PREG, and multiply instruction (see Table 67).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 2+d DARAM 1 1 2+d SARAM 1 1, 2 2+d External Memory 1+p 1+p 4+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n 2n+nd DARAM n n 2n+nd SARAM n n, n+2 2n+nd External Memory n+p n+p 2n+2+nd+p
If the operand and the code are in the same SARAM block
6-249
Example 1
Example 2
6-250
Syntax Operands
Direct: Indirect:
0 dma 127 0n7 lk: 16-bit constant ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 1 14 0 13 1 12 0 11 1 10 1 9 1 8 7 6 0 0 16-Bit Constant 5 4 3 2 dma 1 0
Opcode
Indirect addressing
15 1 14 0 13 1 12 0 11 1 10 1 9 1 8 7 6 0 1 16-Bit Constant 5 4 3 2 1 See Section 5.2 0
(PC) + 2 PC lk dma None affected. The 16-bit constant is stored into the data memory address (dma). The parallel logic unit (PLU) supports this bit manipulation independently of the arithmetic logic unit (ALU), so the contents of the accumulator (ACC) are unaffected. SPLK is a parallel logic unit (PLU) instruction (see Table 66).
Words Cycles
If the operand and the code are in the same SARAM block
Example 1
Example 2
SPLK #1111h,*+,AR4
Before Instruction ARP AR0 Data Memory 300h 0 300h ARP AR0
(PC) + 1 PC Constant PM
Affects: PM
The two low-order bits of the instruction word are copied into the product shift mode (PM) bits of ST1. The PM bits control the product register (PREG) output p-scaler shifter. The p-scaler shifter can shift the PREG output either 1 or 4 bits to the left or 6 bits to the right. The PM bit combinations and their meanings are shown below:
PM Field 00 01 10 11 Action Output is not shifted Output is left-shifted 1 bit and LSB is zero filled Output is left-shifted 4 bits and 4 LSBs are zero filled Output is right-shifted 6 bits, sign extended and 6 LSBs are lost
The left shifts allow the product to be justified for fractional arithmetic. The right shift by 6 accommodates up to 128 multiply-accumulate processes without overflow occurring. The PM bits may also be loaded by an LST #1 instruction (page 6-135). SPM is a TREG0, PREG, and multiply instruction (see Table 67). Words Cycles 1 The SPM instruction is not repeatable.
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Example
SPM 3 ;Product register shift mode 3 is selected, causing ;all subsequent transfers from the product register ;to the ALU to be shifted to the right six places.
6-252
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 0 12 1 11 0 10 0 9 1 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
(PC) + 1 PC (ACC) + (shifted PREG) ACC (dma) TREG0 (dma) (dma) PREG If TRM = 0: (dma) TREG1 (dma) TREG2
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and added to the contents of the accumulator (ACC). The result is stored in the ACC. The contents of the data memory address (dma) are loaded into TREG0 and squared. The result is stored in PREG. The C bit is set, if the result of the addition generates a carry; otherwise, the C bit is cleared. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. SQRA is a TREG0, PREG, and multiply instruction (see Table 67).
Words
1
6-253
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-254
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 0 12 1 11 0 10 0 9 1 8 1 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
(PC) + 1 PC (ACC) (shifted PREG) ACC (dma) TREG0 (dma) (dma) PREG If TRM = 0: (dma) TREG1 (dma) TREG2
Status Bits
Affects: C and OV
Description
The contents of the product register (PREG) are shifted, as defined by the PM bits, and subtracted from the contents of the accumulator (ACC). The result is stored in the ACC. The contents of the data memory address (dma) are loaded into TREG0 and squared. The result is stored in PREG. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs, maintaining C5x object-code compatibility with the C2x. The TREGs are memory-mapped registers and can be read and written with any instruction that accesses data memory. TREG1 has only 5 bits, and TREG2 has only 4 bits. SQRS is a TREG0, PREG, and multiply instruction (see Table 67).
Words
1
6-255
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-256
Syntax
Direct: Indirect:
Operands
0 dma 127 m = 0 or 1 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing for SST#0
15 1 14 0 13 0 12 0 11 1 10 1 9 1 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
Execution
(PC) + 1 PC (STm) dma None affected. The contents of the status register STm are stored in the data memory address (dma). In the direct addressing mode, status register STm is always stored in data memory page 0, regardless of the value of the data memory page pointer (DP) bits. The processor automatically forces the data memory page to 0, and the specific location within that data page is defined by the instruction. The DP bits are not physically modified. This allows storage of the DP bits in the data memory on interrupts, etc., in the direct addressing mode without having to change the DP. In the indirect addressing mode, the dma is obtained from the selected auxiliary register (see the LST instruction, page 6-135, for more information). In the indirect addressing mode, any page in data memory may be accessed. SST is a control instruction (see Table 610). Status registers ST0 and ST1 are defined in Section 4.4, Status and Control Registers.
Words
1
6-257
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 2+d DARAM 1 1 2+d SARAM 1 1, 2 2+d External Memory 1+p 1+p 4+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n 2n+nd DARAM n n 2n+nd SARAM n n, n+2 2n+nd External Memory n+p n+p 2n+2+nd+p
If the operand and the code are in the same SARAM block
Example 1
Example 2
SST #1,*,AR7
Before Instruction ARP AR0 ST1 Data Memory 300h 0 300h 2580h 0h ARP AR0 ST1 Data Memory 300h After Instruction 7 300h 2580h 2580h
6-258
Syntax
SUB dma [,shift ] SUB {ind} [,shift [,ARn ] ] SUB #k SUB #lk [,shift ]
Operands
0 dma 127 0 shift 16 (defaults to 0) 0n7 0 k 255 32768 lk 32767 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with shift
15 0 14 0 13 1 12 1 11 10 9 SHFT 8 7 0 6 5 4 3 dma 2 1 0
Opcode
Execution
Short immediate addressing: (PC) + 1 PC (ACC) k ACC Long immediate addressing: (PC) + 2 PC (ACC) (lk 2shift ) ACC Status Bits
Description
If direct, indirect, or long immediate addressing is used, the contents of the data memory address (dma) or a 16-bit constant are shifted left, as defined by the shift code, and subtracted from the contents of the accumulator (ACC). The result is stored in the ACC. During shifting, the accumulator low byte (ACCL) is zero-filled. If the SXM bit is cleared, the high-order bits of the ACC are zero-filled; if the SXM bit is set, the high-order bits of the ACC are signextended. Note that when the auxiliary register pointer (ARP) is updated during indirect addressing, you must specify a shift operand. If you dont want a shift, you must enter a 0 for this operand. For example:
SUB*+,0,AR0
If short immediate addressing is used, an 8-bit positive constant is subtracted from the contents of the ACC. The result is stored in the ACC. In this mode, no shift value may be specified and the subtraction is unaffected by the SXM bit. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. If a 16-bit shift is specified with the SUB instruction, the C bit is cleared only if the result of the subtraction generates a borrow; otherwise, the C bit is unaffected. SUB is an accumulator memory reference instruction (see Table 64). Words 1 2 (Direct, indirect, or short immediate) (Long immediate)
6-260
Cycles
For the short and long immediate addressing modes, the SUB instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (short immediate addressing) ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
Example 1
6-261
Example 2
Example 3
Example 4
6-262
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 0 10 1 9 0 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
Status Bits
Affects: C and OV
Description
The contents of the data memory address (dma) and the logical inversion of the C bit are subtracted from the contents of the accumulator (ACC) with sign extension suppressed. The result is stored in the ACC. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. The SUBB instruction can be used in performing multiple-precision arithmetic. SUBB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
6-263
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
SUBB *
Before Instruction ARP AR6 301h ACC 1 C 6 301h 02h 04h ARP AR6 301h ACC 1 C After Instruction 6 301h 02h 02h
In Example 1, the C bit is 0 from the result of a previous subtract instruction that performed a borrow. The operation performed was 6 6 (1) = 1, generating another borrow (C = 0) in the process. In Example 2, no borrow was previously generated (C = 1), and the result from the subtract instruction does not generate a borrow.
6-264
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 0 13 0 12 0 11 1 10 0 9 1 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
(PC) + 1 PC (ACC) ((dma) 215 ) ALU output If ALU output 0: (ALU output) 2 + 1 ACC Else: (ACC) 2 ACC
Affects: C and OV
The SUBC instruction performs conditional subtraction, which may be used for division. The 16-bit dividend is stored in the accumulator low byte (ACCL) and the accumulator high byte (ACCH) is zero-filled. The divisor is in data memory. The SUBC instruction is executed 16 times for 16-bit division. After completion of the last SUBC instruction, the quotient of the division is in the ACCL and the remainder is in the ACCH. The SUBC instruction assumes that the divisor and the dividend are both positive. The divisor is not sign extended. The dividend, in the ACCL, must initially be positive (bit 31 must be 0) and must remain positive following the ACC shift, which occurs in the first portion of the SUBC execution. If the 16-bit dividend contains fewer than 16 significant bits, the dividend may be placed in the ACC and shifted left by the number of leading nonsignificant zeroes. The number of SUBC executions is reduced from 16 by that number. One leading zero is always significant. The SUBC instruction affects the OV bit, but is not affected by the OVM bit, and therefore the ACC does not saturate upon positive or negative overflows when executing this instruction. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. SUBC is an accumulator memory reference instruction (see Table 64).
6-265
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
6-266
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 0 10 1 9 1 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
Status Bits
Affects: C and OV
Description
The contents of the data memory address (dma) are subtracted from the contents of the accumulator (ACC) with sign extension suppressed. The result is stored in the ACC. The data is treated as a 16-bit unsigned number, regardless of the SXM bit. The contents of the ACC are treated as a signed number. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. The SUBS instruction produces the same results as a SUB instruction (page 6-259) with the SXM bit cleared and a shift count of 0. SUBS is an accumulator memory reference instruction (see Table 64).
Words
6-267
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
SUBS * ;(SXM = 1)
Before Instruction ARP AR0 Data Memory 310h ACC X C 0 310h F003h 0FFF F105h ARP AR0 Data Memory 310h ACC 1 C After Instruction 0 310h F003h 0FFF 0102h
6-268
Syntax
Direct: Indirect:
Operands
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 0 10 1 9 1 8 1 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
(PC) + 1 PC (ACC) ((dma) 2TREG1(30) ) (ACC) If SXM = 1: (dma) is sign-extended If SXM = 0: (dma) is not sign-extended
Status Bits
Affects: C and OV
Description
The contents of the data memory address (dma) are shifted left from 0 to 15 bits, as defined by the 4 LSBs of TREG1, and subtracted from the contents of the accumulator (ACC). The result is stored in the ACC. Sign extension on the dma value is controlled by the SXM bit. The C bit is cleared, if the result of the subtraction generates a borrow; otherwise, the C bit is set. You can maintain software compatibility with the C2x by clearing the TRM bit. This causes any C2x instruction that loads TREG0 to write to all three TREGs. Subsequent calls to the SUBT instruction will shift the value by the TREG1 value (which is the same as TREG0), maintaining C5x object-code compatibility with the C2x. SUBT is an accumulator memory reference instruction (see Table 64).
Words
6-269
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Example 1
Example 2
SUBT *
Before Instruction ARP AR1 Data Memory 800h TREG1 ACC X C 1 800h 01h 08h 0h ARP AR1 Data Memory 800h TREG1 ACC 0 C After Instruction 1 800h 01h 08h FFFF FF00h
6-270
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 1 14 0 13 1 12 0 11 0 10 1 9 1 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
(PC) + 1 PC (PFC) MCS (ACC(150)) PFC If (repeat counter) 0: (pma, addressed by PFC) dma Modify current AR and ARP as specified (PFC) + 1 PFC (repeat counter) 1 repeat counter Else: (pma, addressed by PFC) dma Modify current AR and ARP as specified (MCS) PFC
None affected. The contents of the program memory address (pma) are transferred to the data memory address (dma). The pma is specified by the contents of the accumulator low byte (ACCL) and the dma is specified by the instruction. A read from program memory is followed by a write to data memory to complete the instruction. When used with the RPT instruction, the TBLR instruction becomes a single-cycle instruction, once the RPT pipeline is started, and the program counter (PC) that contains the contents of the ACCL is incremented once each cycle. TBLR is an I/O and data memory operation instruction (see Table 69).
Words
6-271
Cycles
Cycles for a Single Instruction Operand Source: DARAM/ROM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM/ROM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM/ROM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM 3 3 3+psrc 3 3 3+psrc 4+ddst 4+ddst 4+psrc +ddst DARAM 3 3 3+psrc 3 3 3+psrc 4+ddst 4+ddst 4+psrc +ddst SARAM 3 3 3+psrc 3, 4 3, 4 3+psrc , 4+psrc 4+ddst 4+ddst 4+psrc +ddst External Memory 3+pcode 3+pcode 3+psrc +pcode 3+pcode 3+pcode 3+psrc +pcode 6+ddst +pcode 6+ddst +pcode 6+psrc +ddst +pcode
If the destination operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand Source: DARAM/ROM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM/ROM Destination: SARAM ROM n+2 n+2 n+2+npsrc n+2 DARAM n+2 n+2 n+2+npsrc n+2 SARAM n+2 n+2 n+2+npsrc n+2, n+4 External Memory n+2+pcode n+2+pcode n+2+npsrc +pcode n+2+pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
6-272
Cycles for a Repeat (RPT) Execution (Continued) Operand Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM/ROM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM n+2, 2n n+2+npsrc 2n+2+nddst 2n+2+nddst 4n+npsrc +nddst DARAM n+2, 2n n+2+npsrc 2n+2+nddst 2n+2+nddst 4n+npsrc +nddst SARAM n+2, 2n, 2n+2 n+2+npsrc , n+4+npsrc 2n+2+nddst 2n+2+nddst 4n+npsrc +nddst External Memory n+2+pcode , 2n n+2+npsrc +pcode 2n+4+nddst +pcode 2n+4+nddst +pcode 4n+2+npsrc +nddst +pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
Example 1
Example 2
TBLR *,AR7
Before Instruction ARP AR0 ACC Program Memory 24h Data Memory 300h 0 300h 24h 307h 75h ARP AR0 ACC Program Memory 24h Data Memory 300h After Instruction 7 300h 24h 307h 307h
6-273
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 1 14 0 13 1 12 0 11 0 10 1 9 1 8 1 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
(PC) + 1 PC (PFC) MCS (ACC(150)) PFC If (repeat counter) 0: (dma, addressed by PFC) pma Modify current AR and ARP as specified (PFC) + 1 PFC (repeat counter) 1 repeat counter Else: (dma, addressed by PFC) pma Modify current AR and ARP as specified (MCS) PFC
None affected. The contents of the data memory address (dma) are transferred to the program memory address (pma). The dma is specified by the instruction and the pma is specified by the contents of the accumulator low byte (ACCL). A read from data memory is followed by a write to program memory to complete the instruction. When used with the RPT instruction, the TBLW instruction becomes a single-cycle instruction, once the RPT pipeline is started, and the program counter (PC) that contains the contents of the ACCL is incremented once each cycle. TBLW is an I/O and data memory operation instruction (see Table 69).
Words
6-274
Cycles
Cycles for a Single Instruction Operand Source: DARAM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM Destination: SARAM Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM 3 3 3+dsrc 3 3 3+dsrc 4+pdst 4+pdst 4+dsrc +pdst DARAM 3 3 3+dsrc 3 3 3+dsrc 4+pdst 4+pdst 4+dsrc +pdst SARAM 3 3 3+dsrc 3, 4 3, 4 3+dsrc , 4+dsrc 4+pdst 4+pdst 4+dsrc +pdst External Memory 3+pcode 3+pcode 3+dsrc +pcode 3+pcode 3+pcode 3+dsrc +pcode 5+pdst +pcode 5+pdst +pcode 5+dsrc +pdst +pcode
If the destination operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand Source: DARAM Destination: DARAM Source: SARAM Destination: DARAM Source: External Destination: DARAM Source: DARAM Destination: SARAM ROM n+2 n+2 n+2+ndsrc n+2 DARAM n+2 n+2 n+2+ndsrc n+2 SARAM n+2 n+2 n+2+ndsrc n+2, n+3 External Memory n+2+pcode n+2+pcode n+2+ndsrc +pcode n+2+pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
6-275
Cycles for a Repeat (RPT) Execution (Continued) Operand Source: SARAM Destination: SARAM Source: External Destination: SARAM Source: DARAM Destination: External Source: SARAM Destination: External Source: External Destination: External ROM n+2, 2n n+2+ndsrc DARAM n+2, 2n n+2+ndsrc SARAM n+2, 2n, 2n+1 n+2+ndsrc , n+3+ndsrc 2n+2+npdst 2n+2+npdst 4n+ndsrc +npdst External Memory n+2+pcode , 2n n+2+ndsrc +pcode
If the destination operand and the code are in the same SARAM block If both the source and the destination operands are in the same SARAM block If both operands and the code are in the same SARAM block
Example 1
Example 2
TBLW *
Before Instruction ARP AR6 ACC Data Memory 1006h Program Memory 258h 6 1006h 258h 4340h 307h ARP AR6 ACC Data Memory 1006h Program Memory 258h After Instruction 6 1006h 258h 4340h 4340h
6-276
TRAP None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 1 3 0 2 0 1 0 0 1
Execution
Status Bits
Description
A software interrupt that transfers program control to program memory location 22h. The current program counter (PC) is incremented and pushed onto the stack. The address 22h is loaded into the PC. The instruction at address 22h may contain a branch instruction to transfer control to the TRAP routine. Placing the PC onto the stack enables a return instruction to pop the return address (pointing to the instruction after the TRAP) from the stack. The TRAP instruction is not maskable. TRAP is a branch and call instruction (see Table 68).
Words Cycles
The C5x performs speculative fetching by reading two additional instruction words. If PC discontinuity is taken, these two instruction words are discarded.
Example
TRAP ;Control is passed to program memory location 22h and ;PC + 1 is pushed onto the stack.
6-277
Syntax Operands
XC n ,cond [,cond1 ] [,...] n = 1 or 2 Conditions: ACC = 0 ACC 0 ACC < 0 ACC 0 ACC > 0 ACC 0 C=0 C=1 OV = 0 OV = 1 TC = 0 TC = 1 BIO low Unconditional
11 0 10 1 9 8 TP 7
Opcode
15 1
14 1
13 12 1 N
Execution
If (condition(s)): next n instructions executed Else: execute NOPs for next n instructions None affected. If n = 1 and the conditions are met, the 1-word instruction following the XC instruction executes. If n = 2 and the conditions are met, the one 2-word instruction or two 1-word instructions following the XC instruction execute. Not all combinations of the conditions are meaningful. The XC instruction and the two instruction words following the XC are uninterruptible. If the conditions are not met, one or two NOPs are executed. Conditions tested are sampled one full cycle before the XC is executed. Therefore, if the instruction prior to the XC is a single-cycle instruction, its execution will not affect the condition of the XC. If the instruction prior to the XC does affect the condition being tested, interrupt operation with the XC can cause undesired results. XC is a branch and call instruction (see Table 68).
6-278
Words Cycles
Example
If the contents of the accumulator are less than or equal to 0 and the C bit is set, the ARP is modified prior to the execution of the ADD instruction.
6-279
Syntax
Operands
0 dma 127 0n7 lk: 16-bit constant 0 shift 16 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing
15 0 14 1 13 1 12 0 11 1 10 1 9 0 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 1 10 1 9 0 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
Direct or indirect addressing: (PC) + 1 PC (ACC(150)) XOR (dma) ACC(150) (ACC(3116)) ACC(3116) Long immediate addressing: (PC) + 2 PC (ACC(310)) XOR (lk 2shift ) ACC(310)
Status Bits
6-280
Description
If a long immediate constant is specified, the constant is shifted left, as defined by the shift code, and zero-extended on both ends and is exclusive-ORed with the contents of the accumulator (ACC). The result is stored in the ACC. If a constant is not specified, the contents of the data memory address (dma) are exclusive-ORed with the contents of the accumulator low byte (ACCL). The result is stored in the ACCL and the contents of the accumulator high byte (ACCH) are unaffected. XOR is an accumulator memory reference instruction (see Table 64).
Words
1 2
Cycles
For the long immediate addressing modes, the XOR instruction is not repeatable.
Cycles for a Single Instruction (direct or indirect addressing) Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution (direct or indirect addressing) Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate addressing) ROM 2 DARAM 2 SARAM 2 External Memory 2+2p
6-281
Example 1
Example 2
XOR *+,AR0
Before Instruction ARP AR7 Data Memory 300h ACC X C 7 300h FFFFh 1234 F0F0h ARP AR7 Data Memory 300h ACC X C After Instruction 0 301h FFFFh 1234 0F0Fh
Example 3
XOR #0F0F0h,4
Before Instruction ACC X C 1111 1010h ACC X C After Instruction 111E 1F10h
6-282
XORB None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 0 1 1 0 0
Execution
(PC) + 1 PC (ACC) XOR (ACCB) ACC None affected. The contents of the accumulator (ACC) are exclusive-ORed with the contents of the accumulator buffer (ACCB). The result is stored in the ACC and the contents of the ACCB are unaffected. XORB is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
XORB
Before Instruction ACCB ACC F0F0 F0F0h FFFF 0000h ACCB ACC After Instruction F0F0 F0F0h 0F0F F0F0h
6-283
Syntax Operands
Direct: Indirect:
0 dma 127 lk: 16-bit constant 0n7 ind: {* *+ * *0+ *0 *BR0+ *BR0} Direct addressing with long immediate not specified
15 0 14 1 13 0 12 1 11 1 10 0 9 0 8 0 7 0 6 5 4 3 dma 2 1 0
Opcode
16-Bit Constant
16-Bit Constant
Execution
Long immediate not specified: (PC) + 1 PC (dma) XOR (DBMR) dma Long immediate specified: (PC) + 2 PC (dma) XOR lk dma
Affects: TC
If a long immediate constant is specified, the constant is exclusive-ORed with the contents of the data memory address (dma). If a constant is not specified, the contents of the dma are exclusive-ORed with the contents of the dynamic bit manipulation register (DBMR). In both cases, the result is written directly back to the dma. The contents of the accumulator (ACC) are unaffected. If the result of the XOR operation is 0, the TC bit is set; otherwise, the TC bit is cleared. XPL is a parallel logic unit (PLU) instruction (see Table 66).
Words
1 2
6-284
Cycles
Operand DARAM SARAM External
Cycles for a Single Instruction ROM 1 1 2+2d DARAM 1 1 2+2d SARAM 1 1, 3 2+2d External Memory 1+p 1+p 5+2d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n 2n2 4n2+2nd DARAM n 2n2 4n2+2nd SARAM n 2n2, 2n+1 4n2+2nd External Memory n+p 2n2+p 4n+1+2nd+p
If the operand and the code are in the same SARAM block
Cycles for a Single Instruction (long immediate specified) Operand DARAM SARAM External ROM 2 2 3+2d DARAM 2 2 3+2d SARAM 2 2 3+2d External Memory 2+2p 2+2p 6+2d+2p
Cycles for a Repeat (RPT) Execution (long immediate specified) Operand DARAM SARAM External ROM n+1 2n1 4n1+2nd DARAM n+1 2n1 4n1+2nd SARAM n+1 2n1, 2n+2 4n1+2nd External Memory n+1+2p 2n1+2p 4n+2+2nd+2p
If the operand and the code are in the same SARAM block
6-285
Example 1
Example 2
Example 3
XPL #1000h,*,AR6
Before Instruction ARP AR0 Data Memory 300h 0 300h FF00h ARP AR0 Data Memory 300h After Instruction 6 300h EF00h
Example 4
XPL *,AR0
Before Instruction ARP AR6 DBMR Data Memory 301h 6 301h FF00h EF00h ARP AR6 DBMR Data Memory 301h After Instruction 0 300h FF00h 1000h
6-286
Syntax Operands
Direct: Indirect:
Opcode
Indirect addressing
15 0 14 1 13 1 12 0 11 1 10 0 9 0 8 0 7 1 6 5 4 3 2 1 See Section 5.2 0
Execution
Words Cycles
1
Cycles for a Single Instruction Operand DARAM SARAM External ROM 1 1 1+d DARAM 1 1 1+d SARAM 1 1, 2 1+d External Memory 1+p 1+p 2+d+p
If the operand and the code are in the same SARAM block
Cycles for a Repeat (RPT) Execution Operand DARAM SARAM External ROM n n n+nd DARAM n n n+nd SARAM n n, n+1 n+nd External Memory n+p n+p n+1+p+nd
If the operand and the code are in the same SARAM block
6-287
Example 1
Example 2
ZALR *,AR4
Before Instruction ARP AR7 Data Memory FF00h ACC X C 7 FF00h E0E0h 0010 7777h ARP AR7 Data Memory FF00h ACC X C After Instruction 4 FEFFh E0E0h E0E0 8000h
6-288
ZAP None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 1 3 1 2 0 1 0 0 1
Execution
(PC) + 1 PC 0 ACC 0 PREG None affected. The contents of the accumulator (ACC) and product register (PREG) are cleared. The ZAP instruction speeds up the preparation for a repeat multiply/ accumulate. ZAP is an accumulator memory reference instruction (see Table 64).
Words Cycles
1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ZAP
Before Instruction PREG ACC 3F01 1111h 77FF FF77h PREG ACC After Instruction 0000 0000h 0000 0000h
6-289
ZPR None
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 1 5 0 4 1 3 1 2 0 1 0 0 0
Execution
(PC) + 1 PC 0 PREG None affected. The contents of the product register (PREG) are cleared. ZPR is a TREG0, PREG, and multiply instruction (see Table 67). 1
Cycles for a Single Instruction ROM 1 DARAM 1 SARAM 1 External Memory 1+p
Words Cycles
Cycles for a Repeat (RPT) Execution ROM n DARAM n SARAM n External Memory n+p
Example
ZPR
Before Instruction PREG 3F01 1111h PREG After Instruction 0000 0000h
6-290
Chapter 7
Pipeline
In the operation of the pipeline, the instruction fetch, decode, operand read, and execute operations are independent, which allows overall instruction executions to overlap.
Topic
7.1 7.2 7.3
Page
Pipeline Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Pipeline Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 Pipeline Latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24
Pipeline
7-1
Pipeline Structure
7-2
Pipeline Operation
7.2.1
Pipeline
7-3
Pipeline Operation
Assume memory locations 60h = 10h, 61h = 3h, and 62h = 6h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the ADD instruction and update PC to next instruction. F) Fetch the SAMM instruction and update PC. D) Decode the ADD instruction, generate address, and update AR6. Cycle 3: F) Fetch the MPY instruction and update PC. D) Decode the SAMM instruction, no address generate, and no ARAU update. R) Read data from memory location 60h (10h) which is the location pointed at by AR6 before the update of cycle 2. Cycle 4: F) Fetch the SQRA instruction and update PC. D) Decode the MPY instruction and update AR6. R) No operand read for the SAMM instruction. E) Add data read in cycle 3 (10h) to data in ACC (20h) and store result in ACC (ACC = 30h). Cycle 5: F) Fetch the next instruction and update PC. D) Decode the SQRA instruction, and update AR6 and ARP. R) Read data from data memory location 61h (3h) which is the location pointed at by AR6 before the update of cycle 4. E) Store data in ACC to TREG0 (TREG0 = 30h). Cycle 6: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 5. R) Read data from data memory location 62h (6h) which is the location pointed at by AR6 before the update of cycle 5. E) Multiply data in TREG0 (30h) with data read in cycle 5 (3h) and store result in PREG (PREG = 90h). Cycle 7: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 6. R) Depends on the instruction fetched in cycle 5. E) Add data in ACC (30h) to data in PREG (90h) and store result in ACC (ACC = C0h). Store data read in cycle 6 (6h) to TREG0. Square data in TREG0 (6h) and store result in PREG (PREG = 24h).
7-4
Pipeline Operation
Assume memory location 60h = 10h and 61h = 3h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the LACC instruction and update PC to next instruction. F) Fetch the ADD instruction and update PC. D) Decode the LACC instruction and update AR1. Cycle 3: F) Fetch the second word 1000h and update PC. D) Decode the ADD instruction and no ARAU update. R) Read data from data memory location 60h (10h) which is the location pointed at by AR1 before the update of cycle 2. Cycle 4: F) Fetch the SACL instruction and update PC. D) Dummy operation (previous fetch phase is an operand). R) No operand read for the ADD instruction. E) Load ACC with data read in cycle 3 (ACC = 10h).
Pipeline
7-5
Pipeline Operation
Cycle 5:
F) Fetch the next instruction and update PC. D) Decode the SACL instruction, and update AR1 and ARP. R) Dummy operation (operand fetch on fetch phase). E) Add 1000h to data in ACC (10h) and store result in ACC (ACC = 1010h).
Cycle 6:
F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 5. R) No operand read for the SACL instruction. E) Dummy operation (operand fetch on fetch phase).
Cycle 7:
F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 6. R) Depends on the instruction fetched in cycle 5. E) Store data in ACC (1010h) to data memory location 61h which is the location pointed at by AR1 before the update of cycle 5.
7.2.2
; Branch if ACC 0
7-6
Pipeline Operation
Assume memory location 60h = 10h and 61h = 3h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the ADD instruction and update PC to next instruction. F) Fetch the BCND instruction and update PC. D) Decode the ADD instruction and update AR1. Cycle 3: F) Fetch the second word LBL and update PC. D) Decode the BCND instruction and no ARAU update. R) Read data from data memory location 60h (10h) which is the location pointed at by AR1 before the update of cycle 2. Cycle 4: F) Fetch the ADD instruction and update PC. D) Dummy operation (previous fetch phase is an operand). R) No operand read for the BCND instruction. E) Add data read in cycle 3 (10h) to data in ACC (20h) and store result in ACC (ACC = 30h). The PC update and decode (D) phase on cycle 5 depends on the execute (E) phase result of the BCND instruction. Since the condition is true, the PC will update to point to the destination address and a dummy operation will be inserted in the decode (D) phase to flush the pipeline. Cycle 5: F) Fetch the SUB instruction and update PC. Since the condition is true, the operand of BCND (LBL) will copy to PC. D) Dummy operation (flush the pipeline).
Pipeline
7-7
Pipeline Operation
R) Dummy operation (operand fetch on fetch phase). E) Conditional testing. Cycle 6: F) Fetch the SUB instruction and update PC. D) Dummy operation (flush the pipeline). R) Dummy operation (flush the pipeline). E) Dummy operation (operand fetch on fetch phase). Cycle 7: F) Fetch the next instruction and update PC. D) Decode the SUB instruction and update AR1. R) Dummy operation (flush the pipeline). E) Dummy operation (flush the pipeline). Cycle 8: F) Fetch the next instruction and update PC. D) Decode the instruction in cycle 7. R) Read data from data memory location 61h (3h) which is the location pointed at by AR1 before the update of cycle 7. E) Dummy operation (flush the pipeline). Cycle 9: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 8. R) Depends on the instruction fetched in cycle 7. E) Subtract data read in cycle 8 (3h) from data in ACC (30h) and store result in ACC (ACC = 2Dh).
7-8
Pipeline Operation
Branch Not Taken Example 74. Pipeline Operation with Branch Not Taken
ADD BCND ADD SUB SACL . . LBL SUB . . *+ LBL, EQ *+ #1 *+,0,AR2
;Branch if ACC = 0
*+
Assume memory location 60h = 10h, 61h = 3h, and 62h = 9h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the ADD instruction and update PC to next instruction. F) Fetch the BCND instruction and update PC. D) Decode the ADD instruction and update AR1. Cycle 3: F) Fetch the second word LBL and update PC. D) Decode the BCND instruction and no ARAU update. R) Read data from data memory location 60h (10h) which is the location pointed at by AR1 before the update of cycle 2.
Pipeline
7-9
Pipeline Operation
Cycle 4:
F) Fetch the ADD instruction and update PC. D) Dummy operation (previous fetch phase is an operand). R) No operand read for the BCND instruction. E) Add data read in cycle 3 (10h) to data in ACC (20h) and store result in ACC (ACC = 30h).
The PC update and decode (D) phase on cycle 5 depends on the execute (E) phase result of the BCND instruction. Since the condition is false, the PC will update to point to the next instruction and BCND will be treated as 2-word instruction. Cycle 5: F) Fetch the SUB instruction and update PC. D) Decode the ADD instruction and update AR1. R) Dummy operation (operand fetch on fetch phase). E) Conditional testing. Cycle 6: F) Fetch the SACL instruction and update PC. D) Decode the SUB instruction and no ARAU update. R) Read data from data memory location 61h (3h) which is the location pointed at by AR1 before the update of cycle 5. E) Dummy operation (operand fetch on fetch phase). Cycle 7: F) Fetch the next instruction and update PC. D) Decode the SACL instruction, and update AR1 and ARP. R) No operand read for the SUB instruction. E) Add data read in cycle 6 (3h) to data in ACC (30h) and store result in ACC (ACC = 33h). Cycle 8: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 7. R) No operand read for the SACL instruction. E) Subtract 1h from data in ACC (33h) and store result in ACC (ACC = 32h). Cycle 9: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 8. R) Depends on the instruction fetched in cycle 7. E) Store data in ACC (32h) to data memory location 62h which is the location pointed at by AR1 before the update of cycle 7.
7-10
Pipeline Operation
Subroutine Call and Return Example 75. Pipeline Operation with Subroutine Call and Return
ADD CALL ADD SUB SACL . . LBL SUBB RET NOP NOP NOP . . *+ LBL *+ #1 *+,0,AR2
*+
Pipeline
7-11
Pipeline Operation
Assume memory location 60h = 10h, 61h = 3h, and 62h = 9h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the ADD instruction and update PC to next instruction. F) Fetch the CALL instruction and update PC. D) Decode the ADD instruction and update AR1. Cycle 3: F) Fetch the second word LBL and update PC. D) Decode the CALL instruction and no ARAU update. R) Read data from data memory location 60h (10h) which is the location pointed at by AR1 before the update of cycle 2. Cycle 4: F) Fetch the ADD instruction and update PC. D) Dummy operation (previous fetch phase is an operand). R) No operand read for the CALL instruction. E) Add data read in cycle 3 (10h) to data in ACC (20h) and store result in ACC (ACC = 30h). Cycle 5: F) Fetch the SUB instruction. PC will modify during the execution (E) phase. D) Dummy operation (flush the pipeline). R) Dummy operation (operand fetch on fetch phase). E) Push the address of ADD on top of stack (TOS). Update PC equal to LBL (ready to enter the subroutine). Cycle 6: F) Fetch the SUBB instruction and update PC. D) Dummy operation (flush the pipeline). R) Dummy operation (flush the pipeline). E) Dummy operation (operand fetch on fetch phase). Cycle 7: F) Fetch the RET instruction and update PC. D) Decode the SUBB instruction and update AR1. R) Dummy operation (flush the pipeline). E) Dummy operation (flush the pipeline). Cycle 8: F) Fetch the NOP instruction and update PC. D) Decode the RET instruction and no ARAU update. R) Read data from data memory location 61h (3h) which is the location pointed at by AR1 before the update of cycle 7. E) Dummy operation (flush the pipeline).
7-12
Pipeline Operation
Cycle 9:
F) Fetch the NOP instruction and update PC. D) Dummy operation (flush the pipeline). R) No operand read for the RET instruction. E) Subtract data read in cycle 8 (3h) from data in ACC (30h) and store result in ACC (ACC = 2Dh).
Cycle 10: F) Fetch the NOP instruction. PC will modify during the execute (E) phase. D) Dummy operation (flush the pipeline). R) Dummy operation (flush the pipeline). E) Pop the address from TOS to PC (ready to return from subroutine). Cycle 11: F) Fetch the ADD instruction and update PC. D) Dummy operation (flush the pipeline). R) Dummy operation (flush the pipeline). E) Dummy operation (flush the pipeline). Cycle 12: F) Fetch the SUB instruction and update PC. D) Decode the ADD instruction and update AR1. R) Dummy operation (flush the pipeline). E) Dummy operation (flush the pipeline). Cycle 13: F) Fetch the SACL instruction and update PC. D) Decode the SUB instruction and no ARAU update. R) Read data from data memory location 62h (9h) which is the location pointed at by AR1 before the update of cycle 12. E) Dummy operation (flush the pipeline). Cycle 14: F) Fetch the next instruction and update PC. D) Decode the SACL instruction, and update AR1 and ARP. R) No operand read for the SUB instruction. E) Add data read in cycle 13 (9h) to data in ACC (2Dh) and store result in ACC (ACC = 36h). Cycle 15: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 14. R) No operand read for the SACL instruction. E) Subtract 1h from data in ACC (36h) and store result in ACC (ACC = 35h).
Pipeline
7-13
Pipeline Operation
Cycle 16: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 15. R) Depends on the instruction fetched in cycle 14. E) Store data in ACC (35h) to data memory location 63h which is the location pointed at by AR1 before the update of cycle 14.
7.2.3
7-14
Pipeline Operation
Assume memory location 65h = 30h, 66h = 40h, and 67h = 50h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the LAR instruction and update PC to next instruction. F) Fetch the LACC instruction and update PC. D) Decode the LAR instruction and no ARAU update. Cycle 3: F) Fetch the second word 64h and update PC. D) Decode the LACC instruction and no ARAU update. R) No operand read for the LAR instruction. Cycle 4: F) Fetch the SAMM instruction and update PC. D) Dummy operation (previous fetch phase is an operand). R) No operand read for the LACC instruction. E) Load AR2 with 67h. Cycle 5: F) Fetch the LACC instruction and update PC. D) Decode the SAMM instruction and no ARAU update. R) Dummy operation (operand fetch on fetch phase). E) Load ACC with 64h. Cycle 6: F) Fetch the ADD instruction and update PC. D) Decode the LACC instruction and update AR2. R) No operand read for the SAMM instruction. E) Dummy operation (operand fetch on fetch phase).
Pipeline
7-15
Pipeline Operation
Cycle 7:
F) Fetch the next instruction and update PC. D) Decode the ADD instruction and update AR2. R) Read data from data memory location 67h (50h) which is the location pointed at by AR2 before the update of cycle 6. E) Store data in ACC (64h) to AR2. This conflicts with decode (D) phase.
Cycle 8:
F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 7. R) Read data from data memory location 66h (40h) which is the location pointed at by AR2 before the update of cycle 7. E) Load ACC with data read in cycle 7 (ACC = 50h).
Cycle 9:
F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 8. R) Depends on the instruction fetched in cycle 7. E) Add data read in cycle 8 (40h) to data in ACC (50h) and store result in ACC (ACC = 90h).
Example 77. Pipeline Operation with ARx Load and NOP Instruction
LAR AR2,#67h LACC #64h SAMM AR2 LACC * NOP ADD * . .
7-16
Pipeline Operation
Table 77. Pipeline Operation with ARx Load and NOP Instruction
Pipeline operation Cycle 1 2 3 4 5 6 7 8 9 10 PC [LACC] [#64h] [SAMM] [LACC] [NOP] [ADD] LAR LACC 64h SAMM LACC NOP ADD LAR LACC dummy SAMM LACC dummy ADD LAR LACC dummy SAMM LACC dummy ADD LAR LACC dummy SAMM LACC dummy ADD F D R E ARP 2 2 2 2 2 2 2 2 2 2 AR2 XX XX XX 67h 67h 66h 64h 63h 63h 63h ACC XX XX XX XX 64h 64h 64h 64h 50h 70h
Assume memory location 63h = 10h, 64h = 20h, 65h = 30h, 66h = 40h, and 67h = 50h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the LAR instruction and update PC to next instruction. F) Fetch the LACC instruction and update PC. D) Decode the LAR instruction and no ARAU update. Cycle 3: F) Fetch the second word 64h and update PC. D) Decode the LACC instruction and no ARAU update. R) No operand read for the LAR instruction. Cycle 4: F) Fetch the SAMM instruction and update PC. D) Dummy operation (previous fetch (F) phase is an operand). R) No operand read for the LACC instruction. E) Load AR2 with 67h. Cycle 5: F) Fetch the LACC instruction and update PC. D) Decode the SAMM instruction and no ARAU update. R) Dummy operation (operand fetch on fetch phase). E) Load ACC with 64h.
Pipeline
7-17
Pipeline Operation
Cycle 6:
F) Fetch the NOP instruction and update PC. D) Decode the LACC instruction and update AR2. R) No operand read for the SAMM instruction. E) Dummy operation (operand fetch on fetch phase).
Cycle 7:
F) Fetch the ADD instruction and update PC. D) Dummy operation (flush the pipeline). R) Read data from data memory location 67h (50h) which is the location pointed at by AR2 before the update of cycle 6. E) Store data in ACC to AR2 (AR2 = 64h).
Cycle 8:
F) Fetch the next instruction and update PC. D) Decode the ADD instruction and update AR2. R) Dummy operation (flush the pipeline). E) Load ACC with data read in cycle 7 (ACC = 50h).
Cycle 9:
F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 8. R) Read data from data memory location 64h (20h) which is the location pointed at by AR2 before the update of cycle 8. E) Dummy operation (flush the pipeline).
Cycle 10: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 9. R) Depends on the instruction fetched in cycle 8. E) Add data read in cycle 9 (20h) to data in ACC (50h) and store result in ACC (ACC = 70h).
Example 78. Pipeline Operation with ARx Load and NOP Instructions
LAR AR2,#67h LACC #64h SAMM AR2 NOP NOP LACC * ADD * . .
7-18
Pipeline Operation
Table 78. Pipeline Operation with ARx Load and NOP Instructions
Pipeline operation Cycle 1 2 3 4 5 6 7 8 9 10 11 PC [LACC] [#64h] [SAMM] [NOP] [NOP] [LACC] [ADD] LAR LACC 64h SAMM NOP NOP LACC ADD LAR LACC dummy SAMM dummy dummy LACC ADD LAR LACC dummy SAMM dummy dummy LACC ADD LAR LACC dummy SAMM dummy dummy LACC ADD F D R E ARP 2 2 2 2 2 2 2 2 2 2 2 AR2 XX XX XX 67h 67h 67h 64h 63h 62h 62h 62h ACC XX XX XX XX 64h 64h 64h 64h 64h 20h 30h
Assume memory location 63h = 10h, 64h = 20h, 65h = 30h, 66h = 40h, and 67h = 50h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the LAR instruction and update PC to next instruction. F) Fetch the LACC instruction and update PC. D) Decode the LAR instruction and no ARAU update. Cycle 3: F) Fetch the second word 64h and update PC. D) Decode the LACC instruction and no ARAU update. R) No operand read for the LAR instruction. Cycle 4: F) Fetch the SAMM instruction and update PC. D) Dummy operation (previous fetch (F) phase is an operand). R) No operand read for the LACC instruction. E) Load AR2 with 67h. Cycle 5: F) Fetch the NOP instruction and update PC. D) Decode the SAMM instruction and no ARAU update. R) Dummy operation (operand fetch on fetch phase). E) Load ACC with 64h.
Pipeline
7-19
Pipeline Operation
Cycle 6:
F) Fetch the NOP instruction and update PC. D) Dummy operation (flush the pipeline). R) No operand read for the SAMM instruction. E) Dummy operation (operand fetch on fetch phase).
Cycle 7:
F) Fetch the LACC instruction and update PC. D) Dummy operation (flush the pipeline). R) Dummy operation (flush the pipeline). E) Store data in ACC to AR2 (AR2 = 64h).
Cycle 8:
F) Fetch the ADD instruction and update PC. D) Decode the LACC instruction and update AR2. R) Dummy operation (flush the pipeline). E) Dummy operation (flush the pipeline).
Cycle 9:
F) Fetch the next instruction and update PC. D) Decode the ADD instruction and update AR2. R) Read data from data memory location 64h (20h) which is the location pointed at by AR2 before the update of cycle 8. E) Dummy operation (flush the pipeline).
Cycle 10: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 9. R) Read data from data memory location 63h (10h) which is the location pointed at by AR2 before the update of cycle 9. E) Load ACC with data read in cycle 9 (ACC = 20h). Cycle 11: F) Fetch the next instruction and update PC. D) Decode the instruction fetched in cycle 10. R) Depends on the instruction fetched in cycle 9. E) Add data read in cycle 10 (10h) to data in ACC (20h) and store result in ACC (ACC = 30h).
7-20
Pipeline Operation
7.2.4
Pipeline
7-21
Pipeline Operation
Assume memory location 800h = 10h, 801h = 3h, 802h = FFh, and 803h = 6h. The following is the condition of the pipeline for each cycle. Cycle 1: Cycle 2: F) Fetch the LACC instruction and update PC to next instruction. F) Fetch the ADD instruction and update PC. D) Decode the LACC instruction and update AR1. Cycle 3: F) Since the read (R) phase occupies the external bus, insert a dummy operation and no update on PC. D) Decode the ADD instruction and update AR1. R) External data read for the LACC instruction from data memory location 800h (10h) which is the location pointed at by AR1 before the update of cycle 2. Cycle 4: F) Since the read (R) phase occupies the external bus, insert a dummy operation and no update on PC. D) Dummy operation from previous fetch phase. R) External data read for the ADD instruction from data memory location 801h (3h) which is the location pointed at by AR1 before the update of cycle 3. E) Load ACC with data read in cycle 3 (ACC = 10h). Cycle 5: F) Fetch the SACL instruction and update PC. D) Dummy operation from previous fetch phase. R) Dummy operation from previous decode phase. E) Add data read in cycle 4 (3h) to data in ACC (10h) and store result in ACC (ACC = 13h). Cycle 6: F) Fetch the NOP instruction and update PC. D) Decode the SACL instruction, and update ARP and AR1. R) Dummy operation from previous decode (D) phase. E) Dummy operation from previous read (R) phase. Cycle 7: F) Fetch the next instruction and update PC. D) Dummy operation (flush the pipeline). R) No operand read for the SACL instruction. E) Dummy operation from previous read (R) phase. Cycle 8: F) Since the execute (E) phase occupies the external bus and takes 3 cycles for an external write, insert a dummy operation in the next 3 fetch (F) phases and no update on PC. D) Decode instruction fetched in cycle 7.
7-22
Pipeline Operation
R) Dummy operation (flush the pipeline). E) Store data in ACC (13h) to external data memory location 802h which is the location pointed at by AR1 before the update of cycle 6. Cycle 9: F) Dummy operation and no update on PC. D) Dummy operation from previous fetch (F) phase. R) Depends on the instruction fetched in cycle 7. E) Dummy operation (flush the pipeline).
Pipeline
7-23
Pipeline Latency
7-24
Pipeline Latency
The C5x core CPU supports reconfiguration of memory segments (internal and external) during the execute (E) phase of the pipeline. Therefore, before an instruction utilizes the new configuration, at least two instruction words should follow the instruction that reconfigures memory. In the following example, assume the current AR = 0200h and RAMB0 (0) = 1.
CLRC LACC ADD CNF #01234h * ;Map RAM B0 to data space. ;ACC = 00001234. ;ACC = 00001235.
Notice the use of the LACC #01234h to fill the 2-word requirement. Because a long-immediate operand is used, this is a 2-word instruction and, therefore, meets the requirement. This also applies to memory configurations controlled by the PMST.
If the main code is running in the B0 block (CNF = 1) and an interrupt service routine not in B0 changes CNF to 0, a RETE will not restore CNF in time to fetch the next instruction from the B0 block. Therefore, in the interrupt service routine, the CNF bit should be set at least 2 words before the RETE.
Pipeline
7-25
Chapter 8
Memory
The total memory address range of the C5x devices is 224K 16-bit words. The memory space is divided into four individually-selectable memory segments:
-
64K-word program 64K-word local data 64K-word input/output (I/O) ports 32K-word global data
Their parallel architecture lets the C5x devices perform three concurrent memory operations in any given machine cycle: fetching an instruction, reading an operand, and writing an operand. This chapter discusses C5x memory configuration and operation.
Topic
8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9
Page
Memory Space Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7 Local Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-15 Global Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-20 Input/Output (I/O) Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-22 Direct Memory Access (DMA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-23 Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-26 Boot Loader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-32 External Parallel Interface Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-39
8-1
of the MP/MC pin control input at reset, or by manipulating the MP/MC bit in the processor mode status register (PMST) after reset. The C50 (Figure 81) includes 2K words of boot ROM, 9K words program/ data SARAM, and 1056 words of DARAM. The boot ROM resides in program space at address range 0000h07FFh. The 9K words of SARAM can be mapped into program or data space and reside at address range 0800h2BFFh in either space. The C51 (Figure 82) removes the 2K-word boot ROM from program memory space and replaces 8K words of program/data SARAM with an 8K-word block of maskable ROM. The C51 also includes 1K word of program/data SARAM and 1056 words of DARAM. The 8K words of ROM reside in program space at address range 0000h1FFFh. The 1K word of SARAM can be mapped into data space (address range 0800h0BFFh), program space (address range 2000h23FFh), or both spaces. The C52 (Figure 83) includes 4K words of maskable ROM and 1056 words of DARAM. No program/data SARAM is available on the C52. The 4K words of ROM reside in program space at address range 0000h0FFFh. The C53 and C53S (Figure 84) include 16K words of maskable ROM, 3K words of program/data SARAM, and 1056 words of DARAM. The 16K words of ROM reside in program space at address range 0000h3FFFh. The 3K words of SARAM can be mapped into data space (address range 080013FFh), program space (address range 4000h4BFFh), or both spaces. The LC56 and LC57 (Figure 85) include 32K words of maskable ROM, 6K words of program/data SARAM, and 1056 words of DARAM. The 32K words of ROM reside in program space at address range 0000h7FFFh. The 6K words of SARAM can be mapped into data space (address range 08001FFFh), program space (address range 8000h97FFh), or both spaces. The C57S (Figure 86) includes 2K words of boot ROM, 6K words of program/ data SARAM, and 1056 words of DARAM. The boot ROM resides in program space at address range 0000h07FFh. The 6K words of SARAM can be mapped into data space (address range 08001FFFh), program space (address range 8000h97FFh), or both spaces.
Memory
8-3
0800h
0300h 0500h
FE00h FFFFh
2000h
0300h 0500h
2400h
Off-chip
0800h
FE00h FFFFh
0C00h
FFFFh
8-4
Off-chip On-chip DARAM B0 (CNF = 1) Off-chip (CNF = 0) MP/MC = 1 (Microprocessor mode)
2C00h
0800h
2C00h
FFFFh
Off-chip
Reserved On-chip DARAM B0 (CNF = 0) Reserved (CNF = 1) On-chip DARAM B1 Reserved 9K-word On-chip SARAM (OVLY = 1) Off-chip (OVLY = 0) Off-chip Data Memory-mapped registers On-chip DARAM B2 Reserved On-chip DARAM B0 (CN F= 0) Reserved (CNF = 1) On-chip DARAM B1 Reserved 1K-word On-chip SARAM (OVLY = 1) Off-chip (OVLY = 0) Off-chip
1000h
0300h 0500h
Off-chip
0800h
FE00h FFFFh
FFFFh
0000h If MP/MC = 0, (Microcomputer mode) 16K-word on-chip ROM 0060h 0080h 0100h
4000h
0300h 0500h
4C00h
Off-chip
0800h
FE00h FFFFh
1400h
FFFFh
On-chip DARAM B0 (CNF = 0) Reserved (CNF = 1) On-chip DARAM B1 Reserved Off-chip Data Memory-mapped registers On-chip DARAM B2 Reserved
Memory
8-5
8000h
0300h 0500h
FE00h FFFFh
8000h
0300h 0500h
9800h
Off-chip
0800h
FE00h FFFFh
2000h
FFFFh
8-6
Off-chip On-chip DARAM B0 (CNF = 1) Off-chip (CNF = 0) MP/MC = 1 (Microprocessor mode)
9800h
0800h
2000h
FFFFh
Reserved On-chip DARAM B0 (CNF = 0) Reserved (CNF = 1) On-chip DARAM B1 Reserved 6K-word On-chip SARAM (OVLY = 1) Off-chip (OVLY = 0) Off-chip Data Memory-mapped registers On-chip DARAM B2 Reserved On-chip DARAM B0 (CNF = 0) Reserved (CNF = 1) On-chip DARAM B1 Reserved 6K-word On-chip SARAM (OVLY = 1) Off-chip (OVLY = 0) Off-chip
Program Memory
8.2.1
Code can be submitted to be masked into the on-chip ROM for C51, C52, C53, C56, and C57 devices. The process-masked ROM cell requires ROM codes to be submitted to Texas Instruments for implementation in the device, as detailed in Appendix F, Submitting ROM Codes to TI.
Memory
8-7
Program Memory
At reset, the SARAM and the 512-word DARAM block B0 are not resident in program space. You make the SARAM resident in program space by setting the RAM bit in the PMST. When the RAM bit is set, the RAM cells become addressable in program space. You make the DARAM block B0 resident in program space (address range FE00hFFFFh) by setting the CNF bit in the ST1. The following instructions map the SARAM and DARAM blocks into program space by setting the appropriate bit in the registers:
OPL SETC #010h,PMST CNF ;Map C5x single-access memory ;in program space. ;Map B0 to program space.
Table 81 through Table 86 show program memory configurations available on the C5x devices. Note that all addresses are specified in hexadecimal.
Bit values RAM 0 0 1 1 0 0 1 1 CNF 0 0 0 0 1 1 1 1 MP/MC 0 1 0 1 0 1 0 1 ROM (2K-words) 000007FF Off-chip SARAM (9K-words) Off-chip Off-chip DARAM B0 (512-words) Off-chip Off-chip Off-chip Off-chip Off-Chip 0800FFFF 0000FFFF 000007FF Off-chip 08002BFF 08002BFF Off-chip Off-chip 2C00FFFF 000007FF, 2C00FFFF 0800FDFF 0000FDFF 000007FF Off-chip FE00FFFF FE00FFFF FE00FFFF FE00FFFF 000007FF Off-chip 08002BFF 08002BFF 2C00FDFF 000007FF, 2C00FDFF 8-8
Legend:
CNF
CNF
Bit values
Bit values
RAM
RAM
MP/MC
MP/MC
Off-chip
00000FFF
Off-chip
00000FFF
ROM (4K-words)
Off-chip
00001FFF
Off-chip
00001FFF
Off-chip
00001FFF
Off-chip
00001FFF
ROM (8K-words)
None
None
None
None
SARAM
200023FF
200023FF
Off-chip
Off-chip
200023FF
200023FF
Off-chip
Off-chip
SARAM (1K-words)
FE00FFFF
FE00FFFF
Off-chip
Off-chip
DARAM B0 (512-words)
FE00FFFF
FE00FFFF
FE00FFFF
FE00FFFF
Off-chip
Off-chip
Off-chip
Off-chip
DARAM B0 (512-words)
Memory
0000FDFF 1000FDFF 0000FFFF 1000FFFF Off-Chip 00001FFF, 2400FDFF 2400FDFF 0000FDFF 2000FDFF 00001FFF, 2400FFFF 2400FFFF 0000FFFF 2000FFFF Off-Chip
Program Memory
8-9
Program Memory
8-10
CNF
CNF
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Bit values
Bit values
RAM
RAM
1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0
MP/MC
MP/MC
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
ROM (32K-words)
ROM (16K-words)
800097FF 800097FF Off-chip Off-chip 800097FF 800097FF Off-chip Off-chip Off-chip Off-chip Off-chip Off-chip
SARAM (6K-words)
40004BFF
40004BFF
40004BFF
40004BFF
SARAM (3K-words)
FE00FFFF FE00FFFF FE00FFFF FE00FFFF Off-chip Off-chip Off-chip Off-chip FE00FFFF FE00FFFF FE00FFFF FE00FFFF Off-chip Off-chip Off-chip Off-chip
DARAM B0 (512-words)
DARAM B0 (512-words)
00007FFF, 9800FDFF 9800FDFF 0000FDFF 8000FDFF 00007FFF, 9800FFFF 9800FFFF 0000FFFF 8000FFFF Off-Chip Off-Chip 0000FFFF 4000FFFF 0000FDFF 4000FDFF
Program Memory
Bit values RAM 0 0 1 1 0 0 1 1 CNF 0 0 0 0 1 1 1 1 MP/MC 0 1 0 1 0 1 0 1 ROM (2K-words) 000007FF Off-chip SARAM (6K-words) Off-chip Off-chip DARAM B0 (512-words) Off-chip Off-chip Off-chip Off-chip Off-Chip 8000FFFF 0000FFFF 9800FFFF 000007FF Off-chip 800097FF 800097FF Off-chip Off-chip 00007FFF, 9800FFFF 000007FF Off-chip FE00FFFF FE00FFFF FE00FFFF FE00FFFF 8000FDFF 0000FDFF 9800FDFF 00007FFF, 9800FDFF 000007FF Off-chip 800097FF 800097FF
8.2.2
The interrupt vectors are addressed in program space. These vectors are soft meaning that the processor, when taking the trap, loads the program counter (PC) with the trap address and executes code at the vector location. Two words are reserved at each vector location for a branch instruction to the appropriate interrupt service routine (ISR). Table 87 lists the interrupt vector addresses after reset. At reset, the interrupt vector is mapped absolutely to address 0000h in program space. However, the interrupt vector can be remapped to the beginning of any 2K-word page in program space after reset. To do this, load the interrupt vector pointer (IPTR) bits in the PMST with the appropriate 2K-word page boundary address. After IPTR is loaded, any user interrupt vector is mapped to the new 2K-word page. For example:
OPL#05800h,PMST ;Remap vectors to start at 5800h.
In this example, the interrupt vectors move to off-chip program space beginning at address 5800h. Any subsequent interrupt (except for a reset) will fetch its interrupt vector from that new location. For example, if, after loading the IPTR, an INT2 occurs, the interrupt service routine vector will be fetched from address 5804h in program space as opposed to address 0004h. This feature lets you move the desired vectors out of the boot ROM and then remove the ROM from the memory map. Once the system code is booted into the system from the boot-loader code resident in ROM, the application reloads the IPTR
Memory
8-11
RINT2 on C52; BRNT on C56/C57 XINT2 on C52; BXNT on C56/C57
8-12
Program Memory
RS
NMI
TRAP
HINT
INT4
TXNT
TRNT{
XINT
RINT
TINT
INT3
INT2
INT1
Name
Location
with a value pointing to the new vectors. In the above example, the OPL instruction is used to modify the IPTR bits in the PMST. This example assumes that the IPTR bits are currently cleared. To assure that the correct value for IPTR is set, the bits must be cleared before this instruction is executed.
The reset vector can not be remapped, because reset loads the IPTR with 0. Therefore, the reset vector will always be fetched at location 0000h in program memory. In addition, for the C51 and C53, 100 words are reserved in the on-chip ROM for device-testing purposes. Application code written to be implemented in on-chip ROM must reserve these 100 words at the top of the ROM addresses.
Note:
1A21
1 (highest)
Priority
Reserved for emulation and test Nonmaskable interrupt Internal timer interrupt Software trap instruction External user interrupt #4 External user interrupt #3 External user interrupt #2 External user interrupt #1 TDM port transmit interrupt TDM port receive interrupt Serial port transmit interrupt Serial port receive interrupt
Program Memory
8.2.3
The direct addressing mode The indirect addressing mode The short immediate addressing mode The long immediate addressing mode The dedicated-register addressing mode The memory-mapped register addressing mode
Refer to Chapter 5, Addressing Modes, for a discussion about the addressing modes.
Address Visibility
The address visibility (AVIS) feature can trace the address flow of a program externally and can be used for debugging during program development. It is enabled after reset and can be disabled by setting the AVIS bit in the PMST and enable it by clearing the AVIS bit. The address visibility mode sends the program address out to the address pins of the device, even when on-chip program memory is addressed. Note that the memory control signals (PS, RD, etc.) are not active in this mode.
Memory
8-13
Program Memory
Instruction addresses can be externally clocked with the falling edge of the instruction acquisition (IAQ) pin (refer to the TMS320C5x data sheet for IAQ timings). These instruction addresses include both words of a 2-word instruction but do not include block transfers, table reads, or multiply/accumulate operands. The address visibility mode also allows a specific interrupt trap to be decoded in conjunction with the interrupt acknowledge (IACK) pin. While IACK is low, address pins A1A4 can be decoded to identify which interrupt is being acknowledged (refer to the TMS320C5x data sheet for IACK timings). Once the system is debugged, you can disable the address visibility mode by setting the AVIS bit. Disabling the address visibility mode lowers the power consumption of the device and the RF noise of the system. Note that if the processor is running while HOLDA is active (HM = 0), the program address is not available at the address pins, regardless of the address visibility mode.
8.2.4
single-access RAM is not available for external memory. This feature can be used with the on-chip ROM to secure program code that is stored in external (off-chip) memory. The ROM code can include a decryption algorithm that takes encrypted off-chip code, decrypts it, and stores the routine in on-chip single-access program RAM. This process-mask option, like the ROM, must be submitted to Texas Instruments for implementation.
8-14
8.3.1
Memory
8-15
8-16
Legend:
Table 810. C52 Local Data Memory Configuration Table 89. C51 Local Data Memory Configuration
CNF Bit values 1 1 0 0 1 1 OVLY 1 0 1 0 1 0 Registers (96-words) 0000005F 0000005F 0000005F 0000005F 0000005F 0000005F 0060007F 0060007F 0060007F 0060007F DARAM B2 (32-words) 0060007F 0060007F Reserved Reserved 010002FF 010002FF DARAM B0 (512-words) Reserved Reserved 030004FF 030004FF 030004FF 030004FF DARAM B1 (512-words) 030004FF 030004FF 08000BFF Off-chip 08000BFF Off-chip SARAM (1K-words) 08002BFF Off-chip 0C00FFFF 0800FFFF 0C00FFFF 0800FFFF Off-Chip 2C00FFFF 0800FFFF
Local Data Memory
CNF
CNF
CNF
Bit values
Bit values
Bit values
1 1 0 0 1 0 0 0
OVLY
OVLY
OVLY
1 0 1 0 1 0
Registers (96-words)
Registers (96-words)
Registers (96-words)
DARAM B2 (32-words)
DARAM B2 (32-words)
DARAM B2 (32-words)
010002FF
010002FF
DARAM B0 (512-words)
010002FF
DARAM B0 (512-words)
010002FF
010002FF
DARAM B0 (512-words)
DARAM B1 (512-words)
DARAM B1 (512-words)
DARAM B1 (512-words)
SARAM (3K-words)
08002BFF
SARAM (9K-words)
1400FFFF 0800FFFF 1400FFFF 0800FFFF Off-Chip Off-Chip Off-Chip 0800FFFF 0800FFFF 0800FFFF
2C00FFFF
Table 812. LC56, LC57, and C57S Local Data Memory Configuration
Bit values CNF 0 0 1 1 OVLY 0 1 0 1 Registers (96-words) DARAM B2 (32-words) 0060007F 0060007F 0060007F 0060007F DARAM B0 (512-words) 010002FF 010002FF Reserved Reserved DARAM B1 (512-words) 030004FF 030004FF 030004FF 030004FF SARAM (6K-words) Off-chip Off-Chip 0000005F 0000005F 0000005F 0000005F 0800FFFF 2000FFFF 0800FFFF 2000FFFF 08001FFF Off-chip 08001FFF
8.3.2
The 64K words of local data memory space include the memory-mapped registers for the device. The memory-mapped registers reside in data page 0. Data page 0 has five sections of register banks: CPU registers, peripheral registers, test/emulation reserved area, I/O space, and scratch-pad RAM. Table 813 lists the addresses of data page 0.
- The 28 CPU registers can be accessed with zero wait states. Some of
these registers can be accessed through paths other than the data bus for example, auxiliary registers can be loaded by the auxiliary register arithmetic unit (ARAU) by using the LAR instruction.
- The peripheral registers are the control and data registers used in the pe-
ripheral circuits. These registers reside on a dedicated peripheral bus structure called the TI Bus. They require one wait state when accessed.
- The test/emulation reserved area is used by the test and emulation sys-
tems for special information transfers. Writing to the test/emulation reserved area can cause the device to change its operational mode and, therefore, affect the operation of the application.
- The I/O space provides access to 16 words of I/O space (other than IN and
OUT instructions) via the more extensive addressing modes available within the data space. For example, the SAMM instruction can write to an I/O memory-mapped port as an OUT instruction does. The external interface functions as if an OUT instruction occurred (IS active). Port addresses reside off-chip and are subject to external wait states. They are also affected by the on-chip software wait-state generator, like any other nonmemory-mapped I/O port.
Memory
8-17
8-18
Dec
03
26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 10 11 9 8 7 6 5 4
Address
Hex
03
1A 19 18 17 16 15 14 13 12 10 11 D C E B A F 9 8 7 6 5 4
CBSR1 ARCR INDX AR7 AR6 AR5 AR4 AR3 AR2 AR1 AR0 PAER PASR BRCR RPTC PMST IFR IMR Name DBMR TREG2 TREG1 TREG0 GREG
overhead variables so that the larger blocks of RAM are not fragmented. This RAM block supports dual-access operations and can be addressed via the memory-mapped addressing mode or any data memory addressing mode.
Circular buffer 1 start register Index register Reserved Description Auxiliary register 7 Auxiliary register 6 Auxiliary register 5 Auxiliary register 4 Auxiliary register 3 Auxiliary register 2 Auxiliary register 1 Auxiliary register 0 Block repeat counter register Repeat counter register Interrupt flag register Interrupt mask register
Auxiliary register compare register Dynamic bit manipulation register Processor mode status register Global memory allocation register
Temporary register 2 (used as bit pointer in dynamic bit test) Temporary register 1 (used for dynamic shift count) Temporary register 0 (used for multiplicand) Block repeat program address end register Block repeat program address start register
Table 813. Data Page 0 Address Map CPU Registers (Continued)
Address Dec 27 28 29 30 31 Hex 1B Name Description CBER1 CBSR2 CBER2 CBCR Circular buffer 1 end register 1C 1D 1E 1F Circular buffer 2 start register Circular buffer 2 end register Circular buffer control register Block move address register BMAR 3235 3642 4347 4855 5679 8095 2023 Memory-mapped serial port registers 242A Memory-mapped peripheral registers Reserved for test/emulation 2B2F 3037 Memory-mapped serial port registers Reserved 384F 505F 607F Memory-mapped I/O ports 96127 Scratch-pad RAM (DARAM block B2)
See subsection 9.1.1, Memory-Mapped Peripheral Registers and I/O Ports, on page 9-2
8.3.3
The local data space address generation is controlled by the decode of the current instruction. Local data memory is read via data address bus 1 (DAB) on instructions with only one data memory operand and via program address bus (PAB) on instructions with a second data memory operand. An instruction operand is provided to the CALU as described in subsection 8.2.3 on page 8-13. However, data memory addresses are generated in one of the following ways:
-
The direct addressing mode The indirect addressing mode The long immediate operand addressing mode The dedicated-register addressing mode The memory-mapped register addressing mode
Refer to Chapter 5, Addressing Modes, for a discussion about the addressing modes.
Memory
8-19
8.4.1
8.4.2
8-20
Table 814. Global Data Memory Configurations
Legend:
1111 1111
1111 1110
1111 1100
1111 1000
1111 0000
1110 0000
1100 0000
1000 0000
0000 00XX
GREG value
0000FEFF
0000FDFF
0000FBFF
0000F7FF
0000EFFF
0000DFFF
0000BFFF
00007FFF
0000FFFF
Range
Local Memory
65 280
65 024
64 512
63 488
61 440
57 344
49 152
32 768
65 536
# Words
FF00FFFF
FE00FFFF
FC00FFFF
F800FFFF
F000FFFF
E000FFFF
C000FFFF
8000FFFF
Range
Global Memory
Memory
256 512 1024 2048 4096 8192 16 384 32 768 0
# Words
8-21
8.5.1
Sixteen of the 64K I/O ports are memory-mapped to data memory address locations 50h5Fh. The I/O ports can be accessed by using the IN and OUT instructions or any instruction that reads or writes a location in data memory space. See Section 9.6, Parallel I/O Ports, on page 9-22. The access times to I/O ports can be modified through the software wait-state registers (IOWSR and CWSR). The BIG bit in the CWSR determines how the I/O space is partitioned. See Section 9.4, Software-Programmable Wait-State Generators, on page 9-13.
8-22
8.6.1
XF BIO
The C5x master device takes complete control of the slaves external memory by asserting the slaves HOLD low via the masters external flag (XF) pin. This causes the slave to place its address, data, and control lines in a high-impedance state. When the master gains control of the slaves buses, the slave asserts HOLDA. This signal may be tied to the master BIO pin. The slaves XF pin can indicate to the master when the slave has finished performing its task and needs to be reprogrammed or requires additional data to continue processing. In a multiple-slave configuration, priority of each slaves task can be determined by
Memory
8-23
connecting the slaves XF signals to the appropriate INT1INT4 pin on the master device. The external bus interface of the slave device is put in high-impedance mode when its HOLDA signal is asserted. Once HOLDA goes active, the IAQ pin does not indicate an instruction acquisition. While the HOLDA is active and the CPU is in hold mode (HM = 0), the CPU continues running code from internal memory (internal ROM or single/dual access RAM). If the CPU is not in hold mode (HM = 1), the CPU halts internal execution. See Section 4.9, Reset, on page 4-45 for interaction between HOLD, RS, and external interrupts.
8.6.2
External DMA
The C5x also provides access of the on-chip single-access RAM by external devices through a mechanism called external DMA. External DMA requires the following signals: A(150) BR D(150) HOLD HOLDA IAQ R/W STRB Address inputs when HOLDA and BR are low. Bus request signal externally driven low in hold mode to indicate a request for access. DMA data. External request for control of address, data, and control lines. Indication to external circuitry that the memory address, data, and control lines are in high impedance, allowing external access. Acknowledge BR request for access while HOLDA is low. Read/write signal indicates the data bus direction for DMA reads (high) and DMA writes (low). When IAQ and HOLDA are low, STRB selects the memory access and determines its duration.
To access the C5x on-chip SARAM, a master processor must control the C5x device. The master processor initiates a DMA transfer by asserting the C5x device HOLD low. The C5x responds by asserting HOLDA. The master gains control of the C5x bus and access to the SARAM by asserting BR low. The C5x responds by asserting IAQ low to acknowledge the access. Once access is granted, the master drives the R/W signal to indicate the direction of the transfer. On a DMA write, the master must drive the address and data lines for a write. On a DMA read, the master must drive the address lines and latch the data. Each memory access (read or write) is selected when STRB is low. External access wait states are added by extending the STRB signal. The address decode of the DMA access includes only address lines A13A0 (A14 and A15 are ignored). Table 815 lists the address ranges during DMA access, effectively overlaying address lines A13A0.
8-24
Table 815. Address Ranges for On-Chip Single-Access RAM During External DMA
Device C50 SARAM (words) 9K Address Bus Hex Address Ranges 00002BFF 40006BFF A15A14 ignored, A13A0 used 8000ABFF C000EBFF 000003FF 400043FF 800083FF C51 1K A15A14 ignored, A13A10 must be 0, A9A0 used C000C3FF 00000BFF 40004BFF 80008BFF C53 3K A15A14 ignored, A13A12 must be 0, A11A0 used C000CBFF 000017FF 400057FF 800097FF LC56 6K A15A14 ignored, A13 must be 0, A12A0 used C000D7FF 000017FF 400057FF 800097FF C57S/ LC57 6K A15A14 ignored, A13 must be 0, A12A0 used C000D7FF
DMA access to on-chip single-access RAM is not supported if the device is in concurrent hold mode (HM = 0).
Using DMA on a C50 and writing to address 01h affects the second memory location of the SARAM. Furthermore, writing to address 4001h on a C50 is equivalent to writing to addresses 01h, 8001h, and C001h, since address lines A14 and A15 are ignored. Note that the external parallel interface signals are asynchronously disabled during reset; therefore, external DMA is not supported during reset.
Memory
8-25
Memory Management
8.7.1
Memory-to-Memory Moves
The following instructions for data and program block moves, word transfers, and the data move function efficiently utilize C5x memory spaces.
- Data and program block move instructions J J J
BLDD instruction moves a block within data memory BLDP instruction moves a block from data memory to program memory BLPD instruction moves a block from program memory to data memory
The table read (TBLR) instruction reads words from program memory into data memory The table write (TBLW) instruction writes words from data memory to program memory
that data simultaneously in the same cycle. For block move instructions, one address is derived from the data address generator, while the other is derived from a long immediate constant or from the BMAR. When used with the repeat instructions (RPT and RPTZ), these instructions efficiently perform block moves from on-chip or off-chip memory. The DMOV function, implemented in on-chip data RAM, is equivalent to that of the C2x. DMOV copies a word from the currently addressed data memory location in on-chip RAM to the next-higher location, while the data from the addressed location is being operated upon in the same cycle (for example, by the CALU). An ARAU operation can also be performed in the same cycle when the indirect addressing mode is used. The DMOV function can implement algorithms that use the z 1 delay operation, such as convolution and digital filtering, in which data is passed through a time window.
8-26
Memory Management
The DMOV function is most efficient when operating in dual-access on-chip RAM. When operating in single-access RAM, DMOV requires an additional cycle. The DMOV function is contiguous across the boundary of dual-access on-chip RAM blocks B0 and B1. The DMOV function is used by these instructions:
- LTD load TREG0 and accumulate product with data move - MACD multiply and accumulate with data move - MADD multiply and accumulate with data move and coefficient address
contained in BMAR Note: The DMOV operation cannot be performed on external data memory.
8.7.2
8.7.2.1
From external data memory to external data memory From external data memory to internal data memory From internal data memory to internal data memory From internal data memory to external data memory
Example 81 illustrates how to use the BLDD instruction to move external data (for example, a table of coefficients) to internal DARAM block B1.
Example 81. Moving External Data to Internal Data Memory With the BLDD Instruction
* * This routine uses the BLDD instruction to move external data memory to * internal data memory. * MOVED LACC #8000h SAMM BMAR ;BMAR contains source address in data memory LAR AR7,#300h ;AR7 contains dest. address in data memory MAR *,AR7 ;ARP = AR7 RPT #511 ;Move 512 values from data memory to data memory block B1 BLDD BMAR,*+ RET
Memory
8-27
Memory Management
8.7.2.2
From external data memory to external program memory From external data memory to internal program memory From internal data memory to internal program memory From internal data memory to external program memory
For systems with external data memory but no external program memory, you can use the BLDP instruction to move additional blocks of code into internal program memory. Example 82 illustrates how to use the BLDP instruction to move external data to internal program memory. You can also use the TBLW instruction to transfer data memory to program memory. The TBLW instruction differs from the BLDP instruction in that the accumulator contains the destination program memory address. This lets you specify a calculated, rather than predetermined, location of a block of data in program memory. Example 83 illustrates how to use the TBLW instruction to move external data to internal program memory.
Example 82. Moving External Data to Internal Program Memory With the BLDP Instruction
* * This routine uses the BLDP instruction to move external data memory to * internal program memory. This instruction could be used to boot load a * program to the on chip program RAM from external data memory. * MOVEDP LACC #2000h SAMM BMAR ;BMAR contains dest. address in program memory (C51) LAR AR7,#0F000h ;AR7 contains source address in data memory MAR *,AR7 ;ARP=AR7 RPT #1023 ;Move 1k values from data memory to program memory BLDP *+ RET
8-28
Memory Management
Example 83. Moving External Data to Internal Program Memory With the TBLW Instruction
* * This routine uses the TBLW instruction to move data memory to program memory. * The calling routine must contain the destination program memory address in * the accumulator. * TABLEW LAR AR4,#300h ;AR4 contains source address in data memory MAR *,AR4 ;ARP = AR4 RPT #511 ;Move 512 values from data memory to program memory TBLW *+ ;Accumulator contains dest. address of program memory RET
8.7.2.3
From external program memory to external data memory From external program memory to internal data memory From internal program memory to internal data memory From internal program memory to external data memory
When no external data memory is available, program memory may contain necessary coefficient tables that should be loaded into internal data memory. Example 84 illustrates how to use the BLPD instruction to move external program memory to internal DARAM block B1. You can also use the TBLR instruction to transfer program data to data memory. The TBLR instruction differs from the BLPD instruction in that the accumulator contains the source program memory address. This lets you specify a calculated, rather than predetermined, location of a block of data in program memory. Example 85 illustrates how to use the TBLR instruction to move external program to internal DARAM block B1.
Memory
8-29
Memory Management
Example 84. Moving External Program to Internal Data Memory With the BLPD Instruction
* * This routine uses the BLPD instruction to move external program memory to * internal data memory. This routine is useful for loading a coefficient * table stored in external program memory to data memory when no external * data memory is available. * MOVEPD LAR AR7,#300h ;AR7 contains dest. address in data memory MAR *,AR7 ;ARP=AR7 RPT #127 ;Move 128 values from program memory to data block B1 BLPD #0FD00h,*+ RET
Example 85. Moving External Program to Internal Data Memory With the TBLR Instruction
* * This routine uses the TBLR instruction to move external program memory to * internal data memory. The calling routine must contain the source program * memory address in the accumulator. * TABLER LAR AR3,#300h ;AR3 contains dest. address in data memory MAR *,AR3 ;ARP=AR3 RPT #127 ;Move 128 values from program memory to data block B1 TBLR *+ ;Accumulator contains external program memory address RET
8-30
Memory Management
8.7.2.4
Moving Data From Data Memory to I/O Space With the LMMR Instruction
The LMMR instruction can be used to transfer data from external or internal data memory to an external I/O port. Example 86 illustrates how to use the LMMR instruction to move data from internal data memory to a memorymapped I/O port.
Example 86. Moving Data From Internal Data Memory to I/O Space With the LMMR Instruction
* * This routine uses the LMMR instruction to move data from internal data memory * to a memory-mapped I/O port. Note that 16 I/O ports are mapped in data * page 0 of the C5x memory map. * OUTPUT: LDP #0 ;DP=0 RPT #63 ;Move 64 values from a table beginning at 800h in data LMMR 50h,#800h ;memory to port 50h. Source address is incremented RET
8.7.2.5
Moving Data From I/O Space to Data Memory With the SMMR Instruction
The SMMR instruction can be used to transfer data from an external I/O port to external or internal data memory. Example 87 illustrates how to use the SMMR instruction to move data from a memory-mapped I/O port to internal data memory.
Example 87. Moving Data from I/O Space to Internal Data Memory With the SMMR Instruction
* * This routine uses the SMMR instruction to move * I/O port to internal data memory. Note that 16 * page 0 of the C5x memory map. * INPUT: LDP #0 :DP=0 RPT #511 ;Move 512 values from SMMR 51h,#800h ;800h in data memory. RET
Memory
8-31
Boot Loader
states.
- 32K words of global data memory are enabled initially in data spaces
8000h to FFFFh. After the code transfer is complete, the global memory is disabled before control is transferred to the destination address in program memory. Note that both DARAM and SARAM memory blocks are enabled in program memory space; this allows you to transfer code to on-chip program memory. The boot-loader program reads global data memory location FFFFh by driving the bus request (BR) and data strobe (DS) pins low. The lower 8 bits of the word at address FFFFh specify the boot mode; the higher 8 bits are ignored by the boot loader. Figure 88 lists the available boot mode options and the corresponding values for the boot routine selection word.
8-32
Boot Loader
At Address FFFFh 8-bit serial mode 16-bit serial mode 8-bit parallel I/O mode 16-bit parallel I/O mode 8-bit parallel EPROM mode 16-bit parallel EPROM mode Warm boot
Dont care condition 6-bit page address for parallel EPROM modes 6-bit page address for warm boot mode
8.8.1
Boot Loader
An alternative to the HPI boot mode is the warm boot mode described in subsection 8.8.5 on page 8-37. The warm boot mode may be preferred to the HPI boot mode, if it is not convenient to connect the HINT pin to the INT3 pin or if the program has already been transferred to program memory.
8.8.2
8.8.2.1
Legend:
16-bit destination address 16-bit word that specifies the length of the code (N) that follows N number of 16-bit words to be transferred
8.8.2.2
8-34
Boot Loader
length (Lengthh and Lengthl) of the actual code that follows. These two 16-bit words are followed by N number of code words to be transferred to program memory. Note that the number of 16-bit words specified by the parameter N does not include the first four bytes (first two 16-bit words) received (Destination and Length). After the specified number of code words are transferred to program memory, the C5x branches to the destination address. The length N is defined as: length N = number of 16-bit words 1 or length N = (number of bytes to be transferred 2 ) 1
Legend:
High byte of destination address Low byte of destination address High byte that specifies the length of the code (N) that follows Low byte that specifies the length of the code (N) that follows High byte of N number of 16-bit words to be transferred Low byte of N number of 16-bit words to be transferred
8.8.3
SRC
Source address
Legend: SRC = 6-bit page address
8.8.3.1
Boot Loader
source address is incremented by 1 after every read operation. The first 16-bit word read from the source address specifies the destination address (Destination16) of code in program memory. The next 16-bit word specifies the length (Length16) of the actual code that follows. These two 16-bit words are followed by N number of code words to be transferred to program memory. Note that the number of 16-bit words specified by the parameter N does not include the first two 16-bit words received (Destination16 and Length16). After the specified number of code words are transferred to program memory, the C5x branches to the destination address. The length N is defined as: length N = number of 16-bit words 1 Note that there is at least a 4-instruction-cycle delay between a read from the EPROM and a write to the destination address. This delay ensures that if the destination is in external memory (for example, fast SRAM), there is enough time to turn off the source memory (for example, EPROM) before the write operation is performed.
8.8.3.2
8-36
Boot Loader
8.8.4
BIO
XF
1-word transfer
8.8.5
Boot Loader
other means (for example, HPI or external DMA) or if only a warm device reset is required. The six MSBs of the entry address are specified by the ADDR field of the boot routine selection word (Figure 88 on page 8-33). A 16-bit entry address is defined by this ADDR field as shown in Figure 813. The C5x transfers control to the entry address after disabling global data memory. For C57 devices, the warm boot mode can be used instead of the HPI boot mode to transfer control to the on-chip HPI RAM.
ADDR
0 Entry address
Legend:
8-38
Transitions on the external parallel interface control outputs (CLKOUT1, STRB, WE, and RD) are all initiated by the same two internal clocks. Since these signals also use the same output buffer circuitry, they all switch within close tolerances of each other, as specified in the TMS320C5x data sheet. Transitions on the address bus and other related outputs (IS, PS, DS, R/W, and BR) are initiated by the same internal signals that cause transitions on the control outputs; however, the internal device logic that generates these outputs is different from the circuitry used for the control outputs. Therefore, transitions on the address bus and related outputs typically occur later than control-line transitions. Timings of control outputs with respect to CLKOUT1 are specified in the TMS320C5x data sheet. Address timings with respect to CLKOUT1 can be derived from address timings for control signals and control signal timings for CLKOUT1. For example, the delay from CLKOUT1 falling to address bus valid at the beginning of a read cycle is calculated as: [H (address setup to RD)] + maximum positive RD to CLKOUT1 skew (refer to the TMS320C5x data sheet for specific timing values) Other interface timings with respect to CLKOUT1 can be calculated in the same manner.
Figure 814. External Interface Operation for Read-Read-Write (Zero Wait States)
CLKOUT1 ADDRESS DATA R/W RD WE IS,DS,PS STRB 1-cycle Read 3-cycle Write Read Read Write Data
1-cycle Read
8-40
Figure 815. External Interface Operation for Write-Write-Read (Zero Wait States)
CLKOUT1 ADDRESS DATA R/W RD WE IS,DS,PS STRB 2-cycle Write 1-cycle Read 3-cycle Write Write Data Write Data Read
Figure 816. External Interface Operation for Read-Write (One Wait State)
CLKOUT1 ADDRESS DATA R/W RD WE IS,PS,DS STRB READY 2-cycle Read with one READY generated wait state 4-cycle Write with one READY generated wait state Read Write Data
Memory
8-41
Table 816. Number of CLKOUT1 Cycles Per Access for Various Numbers of Wait States
Number of CLKOUT1 Cycles Number N mber of Wait States 0 1 2 3 Hardware Wait State Read 1 2 3 4 Write 2n + 1 3n + 1 4n + 1 5n + 1 Software Wait State Read 1 2 3 4 Write 2n + 1 2n + 1 3n + 1 4n + 1
Also, note that the external READY input is sampled only after the internal software wait states are completed. Therefore, if the READY input is driven low before the completion of the internal software wait states, no wait states are added to the external memory access until the specified number of software wait states is completed. Wait states are only added if the READY input is still low after the software wait states are completed. Additionally, it should be noted that the READY input is not an asynchronous input and input setup and hold times for this signal as specified in the TMS320C5x data sheet must be met or significant device malfunction will result.
8-42
Chapter 9
On-Chip Peripherals
The on-chip peripheral interfaces connected to the C5x CPU include the divide-by-one clock, timer, software-programmable wait-state generators, general purpose I/O pins, parallel I/O ports, serial ports, and host port interface. These peripherals are controlled through registers that reside in the memory map. The serial ports and timer are synchronized to the processor via interrupts.
Topic
9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9
Page
Peripheral Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Clock Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 Software-Programmable Wait-State Generators . . . . . . . . . . . . . . . . 9-13 General-Purpose I/O Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20 Parallel I/O Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-22 Serial Port Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23 Buffered Serial Port (BSP) Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-53 Time-Division Multiplexed (TDM) Serial Port Interface . . . . . . . . . . . 9-74
On-Chip Peripherals
9-1
Peripheral Control
9.1.1
Table 91. Data Page 0 Address Map Peripheral Registers and I/O Ports
9-2
Address Dec 03 Hex 03 Name Description Reserved 431 41F Memory-mapped processor registers (see subsection 8.3.2, Local Data Memory Address Map, on page 8-17). Data receive register 32 33 34 35 36 37 38 39 40 41 42 20 21 22 23 24 25 26 27 28 29 DRR DXR SPC Data transmit register Serial port control register Reserved TIM Timer counter register Timer period register PRD TCR Timer control register Reserved PDWSR IOWSR CWSR Program/data wait-state register I/O port wait-state register Wait-state control register 2A
Table 91. Data Page 0 Address Map Peripheral Registers and I/O Ports (Continued)
5679 4347 Dec 89 88 87 86 85 84 83 82 81 80 55 54 53 52 51 50 49 48 Address 2B2F 384F Hex 59 58 57 56 55 54 53 52 51 50 37 36 35 34 33 32 31 30 PA9 PA8 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 BKR ARR BKX TRAD AXR TRTA SPCE TCSR BSPC TSPC BDXR TDXR BDRR TRCV Name Description I/O port 59h I/O port 58h I/O port 57h I/O port 56h I/O port 55h I/O port 54h I/O port 53h I/O port 52h I/O port 51h I/O port 50h Reserved BSP receive buffer size register BSP address receive register BSP transmit buffer size register TDM receive address register BSP address transmit register TDM receive/transmit address register BSP control extension register TDM channel select register BSP control register TDM serial port control register BSP data transmit register TDM data transmit register BSP data receive register TDM data receive register Reserved for test/emulation
On-Chip Peripherals
Peripheral Control
9-3
Peripheral Control
Table 91. Data Page 0 Address Map Peripheral Registers and I/O Ports (Continued)
9.1.2
External Interrupts
9-4
Address Dec 90 91 92 93 94 95 Hex 5A 5B Name Description I/O port 5Ah PA10 PA11 I/O port 5Bh 5C 5D 5E 5F PA12 PA13 PA14 PA15 I/O port 5Ch I/O port 5Dh I/O port 5Eh I/O port 5Fh 96127 607F Scratch-pad RAM (DARAM B2)
The C5x has four external, maskable user interrupts (INT4INT1) that external devices can use to interrupt the processor, and one external nonmaskable interrupt (NMI). Internal interrupts are generated by the timer (TINT), the serial port (RINT, XINT, TRNT, TXNT, BRNT, and BXNT), the host port (HINT), and the software interrupt instructions (TRAP, NMI and INTR). Interrupt priorities are set so that reset (RS) has the highest priority and INT4 has the lowest priority. The NMI has the second highest priority. For further information regarding interrupt operation, see Section 4.8, Interrupts, on page 4-36. Interrupts may be asynchronously triggered. In the functional logic organization for INT4INT1, shown in Figure 91, the external interrupt INTn is synchronized to the core via a five flip-flop synchronizer. The actual implementation of the interrupt circuits is similar to this logic implementation. If a 1-1-0-0-0 sequence on five consecutive CLKOUT1 cycles is detected, a 1 is loaded into the interrupt flag register (IFR).
Peripheral Control
RS
RS
SETC INTM
Q D IMR
R S
INTM Priority Decode INTn D Q Q D Q Q D Q Q D Q Q D Q Q R S CLKOUT Q IFR to PC Interrupt Processor Interrupt Active IACK
Machine State
The C5x devices sample the external interrupt pins multiple times to avoid noise-generated interrupts. To detect an active interrupt, the C5x must sample the signal low on at least three consecutive machine cycles. Once an interrupt is detected, the C5x must sample the signal high on at least two consecutive machine cycles to be able to detect another interrupt. The external interrupt pins are sampled on the rising edge of CLKOUT1. If the external interrupts are running asynchronously, the pulses should be stretched to guarantee three consecutive low samples. Note that if the CPU is in IDLE2 mode, an interrupt input must be high for at least four CLKOUT1 cycles and low for a minimum of five CLKOUT1 cycles to be properly recognized. If the INTM bit and mask register are properly enabled, the interrupt signal is accepted by the processor. INTM is set and the appropriate IFR bit is cleared when the INTR instruction is jammed into the pipeline, and then after three CLKOUT1 cycles, IACK is generated (see Figure 49 on page 4-44). NMI uses the same logic as for INT1INT4, except that NMI is not affected by the status of the interrupt mask register (IMR) or the INTM bit.
On-Chip Peripherals
9-5
Peripheral Control
9.1.3
Peripheral Reset
A number of actions occur when the C5x is reset. Section 4.9, Reset, on page 4-45 describes the events that occur when the C5x is reset. On a device reset, the central processing unit (CPU) sends an SRESET signal to the peripheral circuits. The SRESET signal affects the peripheral circuits in the following ways: 1) The two software wait-state registers (IOWSR and PDWSR) are set to FFFFh, causing all external accesses to occur with seven wait states. The CWSR is loaded with 0Fh. 2) The FO bits of the SPC and TSPC/BSPC are cleared, which selects a word length of 16 bits for each serial port. 3) The FSM bits of the SPC and TSPC/BSPC are cleared. The FSM bit must be set for operation with frame sync pulses. 4) The TXM bits of the SPC and TSPC/BSPC are cleared, which configures the FSX and TFSX pins as inputs. 5) The SPC and TSPC/BSPC are loaded with 0y00h, where the two MSBs of y are 102 and the two LSBs of y reflect the current levels on the transmit and receive clock pins of the respective port. 6) The TIM and PRD are loaded with FFFFh. The TDDR and TSS fields of the TCR are cleared and the timer starts. 7) On the HPI, HINT and SMOD are cleared while in reset, and then set after reset goes high. Refer to Section 4.9 for further details of reset operation.
9-6
Clock Generator
9.2.1
Standard Clock Options (C50, C51, C52, C53, and C53S only)
Table 92 lists the standard clock options available. When the internal divideby-2 option is selected, the internal oscillator is enabled by connecting a crystal across the X1 and X2/CLKIN pins. The frequency of CLKOUT1 is one-half the crystal oscillating frequency. When the external divide-by-2 option is selected, the external clock source is connected directly to the X2/CLKIN pin and the X1 pin is unconnected. The external frequency is divided by two to generate the internal machine cycle. When the PLL option is selected, the external clock source is connected directly to the CLKIN2 pin, the X1 pin is disconnected from VDD, and the X2/CLKIN pin is connected to VDD. For the C50, C51, C53, and C53S, the external frequency is multiplied by one to generate the internal machine cycle. For the C52, the external frequency is multiplied by two to generate the internal machine cycle.
Table 92. Standard Clock Options (C50, C51, C52, C53, and C53S only)
CLKMD1 0 0 1 CLKMD2 0 1 0 Clock Mode External divide-by-2 option with internal oscillator disabled. Reserved for test purposes. PLL clock generator option. - For C50, C51, C53, and C53S: multiply-by-1 option - For C52: multiply-by-2 option External divide-by-2 option or internal divide-by-2 option with an external crystal. 1 1
On-Chip Peripherals
9-7
Clock Generator
9.2.2
Table 93. PLL Clock Options (LC56, C57S, and LC57 only)
9-8
CLKMD1 0 0 0 0 1 1 1 1 CLKMD2 0 0 1 1 0 0 1 1 CLKMD3 0 1 0 1 0 1 0 1 Clock Mode PLL multiply-by-3 option External divide-by-2 option with internal oscillator disabled PLL multiply-by-4 option PLL multiply-by-2 option PLL multiply-by-5 option PLL multiply-by-1 option PLL multiply-by-9 option External divide-by-2 option or internal divideby-2 option with an internal oscillator enabled
Timer
9.3 Timer
The timer is an on-chip down counter that can be used to periodically generate CPU interrupts. Figure 92 shows a logical block diagram of the timer. The timer is driven by a prescaler which is decremented by 1 at every CLKOUT1 cycle. A timer interrupt (TINT) is generated each time the counter decrements to 0. The timer provides a convenient means of performing periodic I/O or other functions. When the timer is stopped (TSS = 1), the internal clocks to the timer are shut off, allowing the circuit to run in a low-power mode of operation.
PRD
TDDR
TIM Borrow
PSC Borrow
CLKOUT1 TSS
TINT TOUT
9.3.1
Timer Registers
The timer operation is controlled via the timer control register (TCR), the timer counter register (TIM), and the timer period register (PRD). Figure 93 shows and Table 94 describes the TCR bit fields.
On-Chip Peripherals
9-9
Timer
1512 11 10 96 5 4 30 Reserved Soft Free PSC TRB TSS TDDR
Bit 1512 11
Reset value 0
Function These bits are reserved and are always read as 0. This bit is used in conjunction with the Free bit to determine the state of the timer when a halt is encountered. When the Free bit is cleared, the Soft bit selects the emulation mode. Soft = 0 Soft = 1 The timer stops immediately. The timer stops after decrementing to zero.
10
Free
This bit is used in conjunction with the Soft bit to determine the state of the timer when a halt is encountered. When the Free bit is cleared, the Soft bit selects the emulation mode. Free = 0 Free = 1 The Soft bit selects the timer mode. The timer runs free regardless of the Soft bit.
96
PSC
Timer prescaler counter bits. These bits specify the count for the on-chip timer. When the PSC is decremented past 0 or the timer is reset, the PSC is loaded with the contents of the TDDR, and the TIM is decremented. Timer reload bit. This bit resets the on-chip timer. When the TRB is set, the TIM is loaded with the value in the PRD and the PSC is loaded with the value in the TDDR. The TRB is always read as a 0. Timer stop status bit. This bit stops or starts the on-chip timer. At reset, the TSS bit is cleared and the timer immediately starts timing.Note that due to timer logic implementation, two successive writes of one to the TSS bit are required to properly stop the timer. TSS = 0 TSS = 1 The timer is started. The timer is stopped.
TRB
TSS
30
TDDR
0000
Timer divide-down register bits. These bits specify the timer divide-down ratio (period) for the on-chip timer. When the PSC bits are decremented past 0, the PSC is loaded with the contents of the TDDR.
9-10
Timer
9.3.2
Timer Operation
When the PSC decrements to 0 or when the timer is reset by setting the TRB bit, the contents of the TDDR are loaded into the PSC and the TIM is decremented. When the TIM decrements to 0 or when the timer is reset by setting the TRB bit, the contents of the PRD are loaded into the TIM. The TRB bit is always read as 0. When a 1 is written to the TRB, the timer is reset, but TRB is still read as 0. Note: The current value in the timer can be read by reading the TIM; the PSC can be read by reading the TCR. Because it takes two instructions to read both registers, there may be a change between the two reads as the counter decrements. Therefore, when making precise timing measurements, it may be more accurate to stop the timer to read these two values. Due to timer logic implementation, two instructions are also required to properly stop the timer; therefore, two successive writes of one to the TSS bit should be made when the timer must be stopped. The timer interrupt (TINT) rate is given by: TINT rate + 1 t c(C) u v + t c(C) 1 (TDDR ) 1) (PRD ) 1)
where tc(C) is the period of CLKOUT1, u is the sum of the TDDR contents + 1, and v is the sum of the PRD contents + 1. The TINT rate equals the CLKOUT1 frequency divided by two independent factors. The two divisors are implemented with a down counter and period register (see Figure 92 on page 9-9) in each stage. The PSC and TDDR fields of the TCR are used for the first stage and the TIM and PRD are used for the second stage. Each time a down counter (PSC or TIM) decrements to 0, a borrow is generated on the next CLKOUT1 cycle, and the down counter is reloaded with the contents of its corresponding period register (TDDR or PRD). The output of the second stage is the TINT signal sent to the CPU and to the timer output (TOUT) pin. The width of the borrow pulse that appears on the output of the second stage equals tc(C). The timer can be used to generate a sample clock for an analog interface. Example 91 uses the timer to generate a sample rate of 50 kHz. Consider an analog-to-digital converter operating at this sample rate. Example 92 shows a typical interrupt service routine (ISR).
On-Chip Peripherals
9-11
Timer
9-12
9.4.1
Figure 94. Program/Data Wait-State Register (PDWSR) Diagram (C50, C51, and C52 only)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Data 4 Data 3 Data 2 Data 1 Program 4 Program 3 Program 2 Program 1
On-Chip Peripherals
9-13
Table 95. Program/Data Wait-State Register (PDWSR) Address Ranges (C50, C51, and C52 only)
Figure 95. Program/Data Wait-State Register (PDWSR) Diagram (C53S, LC56, and C57 only)
159
Reserved
Table 96. Program/Data Wait-State Register (PDWSR) Address Ranges (C53S, LC56, and C57 only)
Wait-State Field Bits 159 86 53 20 Space Hex Address Range
9-14
PDWSR Bits 1514 1312 1110 98 76 54 32 10 Memory Space Data 4 Data 3 Data 2 Data 1 Hex Address Range C000FFFF 8000BFFF 40007FFF 00003FFF Program 4 Program 3 Program 2 Program 1 C000FFFF 8000BFFF 40007FFF 00003FFF 86 I/O 53 Data
The C53S, LC56, and C57 implement a simpler version of the software wait states. Program, data, and I/O space wait states are specified by a single waitstate value. All external addresses in each space may be independently set from 0 to 7 wait states by the 3-bit wait-state field in the PDWSR, as shown in Figure 95 and listed in Table 96.
20
Program
Reserved I/O 0000FFFF 0000FFFF 0000FFFF Data Program
Note that if the on-chip wait-state generator is used to add wait states for external accesses, the number of CLKOUT1 cycles required for writes is not effected until two or more wait states are specified, contrary to wait states generated with the external READY input. Table 97 shows the number of cycles required for the different types of external device accesses. Also, note that the external READY input is sampled only after the internal software wait states are completed. Therefore, if the READY input is driven low before the completion of the internal software wait states, no wait states are added to the external memory access until the specified number of software wait states is completed. Wait states are only added if the READY input is still low after the software wait states are completed. Additionally, it should be noted that the READY input is not an asynchronous input and input setup and hold times for this signal as specified in the TMS320C5x data sheet must be met or significant device malfunction will result.
Table 97. Number of CLKOUT1 Cycles per Access for Various Numbers of Wait States
Number of CLKOUT1 Cycles Hardware Wait State Number of Wait States 0 1 2 3 Read 1 2 3 4 Write 2n + 1 3n + 1 4n + 1 5n + 1 Software Wait State Read 1 2 3 4 Write 2n + 1 2n + 1 3n + 1 4n + 1
On-Chip Peripherals
9-15
9.4.2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 I/O 8 I/O 7 I/O 6 I/O 5 I/O 4 I/O 3 I/O 2 I/O 1
BIG = 0
BIG = 1
Port 2/3, port 12/13, etc. Port 4/5, port 14/15, etc. Port 6/7, port 16/17, etc. Port 8/9, port 18/19, etc.
1011
A000BFFF
1213 1415
Port 0C/0D, Port 1C/1D, etc. Port 0E/0F, Port 1E/1F, etc.
C000DFFF E000FFFF
9-16
9.4.3
155 4 3 2 1 0 Reserved BIG I/O High I/O Low D P
This bit is used in conjunction with the 2-bit wait-state field in the IOWSR to determine the number of wait states for the I/O space upper half (I/O 5I/O 8). See Table 910 for the wait state configurations. I/O High = 0 I/O High = 1 The number of wait states assigned to the I/O space upper half is 0, 1, 2, or 3. The number of wait states assigned to the I/O space upper half is 0, 1, 3, or 7.
On-Chip Peripherals
9-17
Data memory space bit. This bit is used in conjunction with the 2-bit wait-state field in the PDWSR to determine the number of wait states for the data memory space. See Table 910 for the wait state configurations. D=0 D=1 The number of wait states assigned to the data memory space is 0, 1, 2, or 3. The number of wait states assigned to the data memory space is 0, 1, 3, or 7.
Program memory space bit. This bit is used in conjunction with the 2-bit wait-state field in the PDWSR to determine the number of wait states for the program memory space. See Table 910 for the wait state configurations. P=0 P=1 The number of wait states assigned to the program memory space is 0, 1, 2, or 3. The number of wait states assigned to the program memory space is 0, 1, 3, or 7.
Table 910. Wait-State Field Values and Number of Wait States as a Function of CWSR Bits 03
9-18
Wait-State Field of PDWSR or IOWSR 00 01 10 11 No. of Wait States (CWSR Bit 03 = 0) 0 1 2 3 No. of Wait States (CWSR Bit 03 = 1) 0 1 3 7
This bit field corresponds to the wait-state field bits in Figure 94 and Figure 96.
9.4.4
G A B 2-to-4 Decoder
CYCLE
WAIT
READY
On-Chip Peripherals
9-19
External Logic
Y0 Y1 Y2 Y3
9.5.1
Hold
9-20
9.5.2
On-Chip Peripherals
9-21
The RD signal can be used in conjunction with chip-select logic to generate an output enable signal for an external peripheral. The WE signal can be used in conjunction with chip-select logic to generate a write enable signal for an external peripheral. Figure 911 shows a typical I/O port interface circuitry. The decode section can be simplified if fewer I/O ports are used.
+5 V IS A3 A0 A1 A2
Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
CS Input Device OE WE
Output Device CS
TMS320C5x
G1 G2A G2B A B C
9-22
ports are in reset, the device may be configured to turn off the internal serial port clocks, allowing the device to run in a lower power mode of operation.
9.7.1
9-24
Address 0020h 0021h 0022h Register DRR DXR SPC Description Data receive register Data transmit register Serial port control register Receive shift register RSR XSR Data transmit shift register - Data receive register (DRR). The 16-bit memory-mapped data receive
register (DRR) holds the incoming serial data from the RSR to be written to the data bus. At reset, the DRR is cleared.
register (DXR) holds the outgoing serial data from the data bus to be loaded in the XSR. At reset, the DXR is cleared.
- Serial port control register (SPC). The 16-bit memory-mapped serial port
control register (SPC) contains the mode control and status bits of the serial port.
- Data receive shift register (RSR). The 16-bit data receive shift register
(RSR) holds the incoming serial data from the serial data receive (DR) pin and controls the transfer of the data to the DRR.
- Data transmit shift register (XSR). The 16-bit data transmit shift register
(XSR) controls the transfer of the outgoing data from the DXR and holds the data to be transmitted on the serial data transmit (DX) pin. During normal serial port operation, the DXR is typically loaded with data to be transmitted on the serial port by the executing program, and its contents read automatically by the serial port logic to be sent out when a transmission is initiated. The DRR is loaded automatically by the serial port logic with data received on the serial port and read by the executing program to retrieve the received data.
At times during normal serial port operation, however, it may be desirable for a program to perform other operations with the memory-mapped serial port registers besides simply writing to DXR and reading from DRR. On the SP, the DXR and DRR may be read or written at any time regardless of whether the serial port is in reset or not. On the BSP, access to these registers is restricted; the DRR can only be read, and the DXR can only be written when autobuffering is disabled (see subsection 9.8.2, Autobuffering Unit (ABU) Operation, on page 9-60). The DRR can only be written when the BSP is in reset. The DXR can be read at any time. Note, however, that on both the SP and the BSP, care should be exercised when reading or writing to these registers during normal operation. With the DRR, since, as mentioned previously, this register is written automatically by the serial port logic when data is received, if a write to DRR is performed, subsequent reads may not yield the result written if a serial port receive occurs after the write but before the read is performed. With the DXR, care should be exercised when this register is written, since if previously written contents intended for transmission have not yet been sent, these contents will be overwritten and the original data lost. As mentioned previously, the DXR can be read at any time. Alternatively, DXR and DRR may also serve as general purpose storage if they are not required for serial port use. If these registers are to be used for general purpose storage, the transmit and/or receive sections of the serial port should be disabled either by tying off (by pulling up or down, whichever is appropriate) external input pins which could spuriously cause serial port transfers, or by putting the port in reset.
9.7.2
9-26
Pin Description CLKR CLKX DR DX Receive clock signal Transmit clock signal Received serial data signal Transmitted serial data signal FSR FSX Receive framing synchronization signal Transmit frame synchronization signal C5x Device 1 DX FSX CLKX DR FSR CLKR
Figure 913 shows how the pins and registers are configured in the serial port logic and how the double-buffering is implemented. Transmit data is written to the DXR, while received data is read from the DRR. A transmit is initiated by writing data to the DXR, which copies the data to the XSR when the XSR is empty (when the last word has been transmitted serially, that is, driven on the DX pin). The XSR manages shifting the data to the DX pin, thus allowing another write to DXR as soon as the DXR-to-XSR copy is completed. During transmits, upon completion of the DXR-to-XSR copy, a 0-to-1 transition occurs on the transmit ready (XRDY) bit in the SPC. This 0-to-1 transition generates a serial port transmit interrupt (XINT) that signals that the DXR is ready to be reloaded. See Section 4.8, Interrupts, on page 4-36 and subsection 9.1.2, External Interrupts, on page 9-4 for more information on C5x interrupts.
XSR (16)
FSR DR
FSX DX
CLKR CLKX
The process is similar in the receiver. Data from the DR pin is shifted into the RSR, which is then copied into the DRR from which it may be read. Upon completion of the RSR-to-DRR copy, a 0-to-1 transition occurs on the receive ready (RRDY) bit in the SPC. This 0-to-1 transition generates a serial port receive interrupt (RINT). Thus, the serial port is double-buffered because data can be transferred to or from DXR or DRR while another transmit or receive is being performed. Note that transfer timing is synchronized by the frame sync pulse in burst mode (discussed in more detail in subsection 9.7.4, Burst Mode Transmit and Receive Operations, on page 9-37).
9.7.3
On-Chip Peripherals
9-27
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Free
R/W
IN1
R
FO
DLB
R/W
Res
R
R/W
Note:
R = Read, W = Write
This bit is used in conjunction with the Free bit to determine the state of the serial port clock when a halt is encountered. When the Free bit is cleared to 0, the Soft bit selects the emulation mode. See Table 914 on page 9-37 for the serial port clock configurations. Soft = 0 Soft = 1 The serial port clock stops immediately, thus aborting any transmission. The clock stops after completion of the current transmission.
13
RSRFULL
Receive Shift Register Full. This bit indicates whether the receiver has experienced overrun. Overrun occurs when RSR is full and DRR has not been read since the last RSR-to-DRR transfer. On the SP, when FSM = 1, the occurrence of a frame sync pulse on FSR qualifies the generation of RSRFULL = 1. When FSM = 0, and on the BSP, only the basic two conditions apply; that is, RSRFULL goes high without waiting for an FSR pulse. RSRFULL = 0 Any one of the following three events clears the RSRFULL bit to 0: reading DRR, resetting the receiver (RRST bit to 0), or resetting the device. The port has recognized an overrun. When RSRFULL = 1, the receiver halts and waits for DRR to be read, and any data sent on DR is lost. On the SP, the data in RSR is preserved; on the BSP, the contents of RSR are lost.
RSRFULL = 1
9-28
Table 913. Serial Port Control Register (SPC) Bit Summary (Continued)
Bit Name 12 XSREMPTY Reset Value 0 Function Transmit Shift Register Empty. This bit indicates whether the transmitter has experienced underflow. Underflow occurs when XSR is empty and DXR has not been loaded since the last DXR-to-XSR transfer. XSREMPTY = 0 Any one of the following three events clears the XSREMPTY bit to 0: underflow has occurred, resetting the transmitter (XRST bit to 0), or resetting the device. On the SP, XSREMPTY is deactivated (set to 1) directly as a result of writing to DXR; on the BSP, XSREMPTY is only deactivated after DXR is loaded followed by the occurrence of an FSX pulse.
XSREMPTY = 1
11
XRDY
Transmit Ready. A transition from 0 to 1 of the XRDY bit indicates that the DXR contents have been copied to XSR and that DXR is ready to be loaded with a new data word. A transmit interrupt (XINT) is generated upon the transition. This bit can be polled in software instead of using serial port interrupts. Note that on the SP, XRDY is generated directly as a result of writing to DXR; while on the BSP, XRDY is only generated after DXR is loaded followed by the occurrence of an FSX pulse. At reset or serial port transmitter reset (XRST = 0), the XRDY bit is set to 1. Receive Ready. A transition from 0 to 1 of the RRDY bit indicates that the RSR contents have been copied to the DRR and that the data can be read. A receive interrupt (RINT) is generated upon the transition. This bit can be polled in software instead of using serial port interrupts. At reset or serial port receiver reset (RRST = 0), the RRDY bit is cleared to 0. Input 1. This bit allows the CLKX pin to be used as a bit input. IN1 reflects the current level of the CLKX pin of the device. When CLKX switches levels, there is a latency of between 0.5 and 1.5 CLKOUT1 cycles before the new CLKX value is represented in the SPC. Input 0. This bit allows the CLKR pin to be used as a bit input. IN0 reflects the current level of the CLKR pin of the device. When CLKR switches levels, there is a latency of between 0.5 and 1.5 CLKOUT1 cycles before the new CLKR value is represented in the SPC. Receive Reset. This signal resets and enables the receiver. When a 0 is written to the RRST bit, activity in the receiver halts. RRST = 0 RRST = 1 The serial port receiver is reset. Writing a 0 to RRST clears the RSRFULL and RRDY bits to 0. The serial port receiver is enabled.
10
RRDY
IN1
IN0
RRST
On-Chip Peripherals
9-29
Table 913. Serial Port Control Register (SPC) Bit Summary (Continued)
Bit Name 6 XRST Reset Value 0 Function Transmitter Reset. This signal is used to reset and enable the transmitter. When a 0 is written to the XRST bit, activity in the transmitter halts. When the XRDY bit is 0, writing a 0 to XRST generates a transmit interrupt (XINT). XRST = 0 The serial port transmitter is reset. Writing a 0 to XRST clears the XSREMPTY bit to 0 and sets the XRDY bit to 1. The serial port transmitter is enabled.
XRST = 1 5 TXM 0
Transmit Mode. This bit configures the FSX pin as an input (TXM = 0) or as an output (TXM = 1). TXM = 0
External frame sync. The transmitter idles until a frame sync pulse is supplied on the FSX pin. Internal frame sync. Frame sync pulses are generated internally when data is transferred from the DXR to XSR to initiate data transfers. The internally generated framing signal is synchronous with respect to CLKX.
TXM = 1
MCM
Clock Mode. This bit specifies the clock source for CLKX. MCM = 0 MCM = 1 CLKX is taken from the CLKX pin. CLKX is driven by an on-chip clock source. For the SP and the BSP in standard mode, this on-chip clock source is at a frequency of one-fourth of CLKOUT1. The BSP also allows the option of generating clock frequencies at additional ratios of CLKOUT1. For a detailed description of this feature, see Section 9.8, Buffered Serial Port (BSP) Interface, on page 9-53. Note that if MCM = 1 and DLB = 1, a CLKR signal is also supplied by the internal source.
FSM
Frame Sync Mode. This bit specifies whether frame synchronization pulses (FSX and FSR) are required after the initial frame sync pulse for serial port operation. See subsection 9.7.2, Serial Port Interface Operation, on page 9-25 for more details on the frame sync signals. FSM = 0
Continuous mode. Frame sync pulses are not required after the initial frame sync pulse, but they are not ignored; therefore, improperly timed frame syncs may cause errors in serial transfers. See subsection 9.7.6, Serial Port Interface Exception Conditions, on page 9-46 for information about serial port operation under various exception conditions. Burst mode. A frame sync pulse is required on FSX/FSR for the transmission/reception of each word.
FSM = 1
9-30
Table 913. Serial Port Control Register (SPC) Bit Summary (Continued)
Bit Name 2 FO Reset Value 0 Function Format. This bit specifies the word length of the serial port transmitter and receiver. FO = 0 FO = 1 The data is transmitted and/or received as 16-bit words. The data is transferred as 8-bit bytes. The data is transferred with the MSB first. The BSP also allows the capability of 10and 12-bit transfers. For a detailed description of this feature, see Section 9.8, Buffered Serial Port (BSP) Interface, on page 9-53.
DLB
Digital Loopback Mode. This bit can be used to put the serial port in digital loopback mode. DLB = 0 DLB = 1 The digital loopback mode is disabled. The DR, FSR, and CLKR signals are taken from their respective device pins. The digital loopback mode is enabled. The DR and FSR signals are connected to DX and FSX, respectively, through multiplexers, as shown in Figure 915(a) and (b) on page 9-32. Additionally, CLKR is driven by CLKX if MCM = 1. If DLB = 1 and MCM = 0, CLKR is taken from the CLKR pin of the device. This configuration allows CLKX and CLKR to be tied together externally and supplied by a common external clock source. The logic diagram for CLKR is shown in Figure 915(c) on page 9-32. Note also that in DLB mode, the FSX and DX signals appear on the device pins, but FSR and DR do not. Either internal or external FSX signals may be used in DLB mode, as defined by the TXM bit.
Res
Reserved. Always read as a 0 in the serial port. This bit performs a function in the TDM serial port discussed in Section 9.9, Time-Division-Multiplexed (TDM) Serial Port Interface, on page 9-74.
Reserved Bit
Bit 0 is reserved and is read as 0, although it performs a function in the TDM serial port (discussed in Section 9.9, Time-Division-Multiplexed (TDM) Serial Port Interface, on page 9-74).
On-Chip Peripherals
9-31
DLB Bit
The DLB (bit 1) selects digital loopback mode, which allows testing of serial port code with a single C5x device. When DLB = 1, DR and FSR are connected to DX and FSX, respectively, through multiplexers, as shown in Figure 915. When in loopback mode, CLKR is driven by CLKX if on-chip serial port clock generation is selected (MCM = 1), but if MCM = 0, then CLKR is driven by the external CLKR signal. This allows for the capability of external serial port clock generation in digital loopback mode. If DLB = 0, then normal operation occurs where DR, FSR, and CLKR are all taken from their respective pins.
DR (internal) (c)
FSR (internal)
DX
FSX
1 DLB
CLKR (internal)
CLKX
1 DLB MCM
FO Bit
The FO (bit 2) specifies whether data is transmitted as 16-bit words (FO = 0) or 8-bit bytes (FO = 1). Note that in the latter case, only the lower byte of whatever is written to DXR is transmitted, and the lower byte of data read from DRR is what was received. To transmit a whole 16-bit word in 8-bit mode, two writes to DXR are necessary, with the appropriate shifts of the value because the upper eight bits written to DXR are ignored. Similarly, to receive a whole 16-bit word in 8-bit mode, two reads from DRR are required, with the appropriate shifts of the value. In the SP, the upper eight bits of DRR are indeterminate in 8-bit receptions; in the BSP, the unused bits of DRR are sign-extended. Additionally, in the BSP, transfers of 10- and 12-bit words are provided for additional flexibility. For a detailed description of this feature, refer to Section 9.8, Buffered Serial Port (BSP) Interface, on page 9-53.
9-32
FSM Bit
The FSM (bit 3) specifies whether or not frame sync pulses are required in consecutive serial port transmits. If FSM = 1, a frame sync must be present for every transfer, although FSX may be either externally or internally generated depending on TXM. This mode is referred to as burst mode, because there are normally periods of inactivity on the serial port between transmits. The frequency with which serial port transmissions occur is called packet frequency, and data packets can be 8, 10, 12, or 16 bits long. Therefore, as packet frequency increases, it reaches a maximum that occurs when the time, in serial port clock cycles, from one packet to the next, is equal to the number of bits being transferred. If transmission occurs at the maximum rate for multiple transfers in a row, however, frame sync essentially becomes redundant. Note that frame sync actually becomes redundant in burst mode only at maximum packet frequency with FSX configured as an output (TXM = 1). When FSX is an input (TXM = 0), its presence is required for transmissions to occur. FSM = 0 selects the continuous mode of operation which requires only an initial frame sync pulse as long as a write to DXR (for transmit), or a read from DRR (for receive), is executed during each transfer. Note that when FSM = 0, frame sync pulses are not required, but they are not ignored, therefore, improperly timed frame syncs may cause errors in serial transfers. The timing of burst and continuous modes is discussed in detail in subsections 9.7.4, 9.7.5, and 9.7.6.
MCM Bit
The serial port clock source is set by MCM (bit 4). If MCM = 0, CLKX is configured as an input and thus accepts an external clock. If MCM = 1, then CLKX is configured as an output, and is driven by an internal clock source. For the SP, and the BSP operating in standard mode, this on-chip clock is at a frequency of one-fourth of CLKOUT1. The BSP also allows the option of generating clock frequencies at additional ratios of CLKOUT1. For a detailed description of this feature, refer to Section 9.8, Buffered Serial Port (BSP) Interface, on page 9-53. Note that the CLKR pin is always configured as an input.
TXM Bit
The transmit frame synchronization pulse source is set by TXM (bit 5). Like MCM, if TXM = 1, FSX is configured as an output and generates a pulse at the beginning of every transmit. If TXM = 0, FSX is configured as an input, and accepts an external frame sync signal. Note that the FSR pin is always configured as an input.
On-Chip Peripherals
9-33
The second write takes the serial port out of reset. Note that the transmitter and receiver may be reset individually if desired. When a 0 is written to XRST or RRST, activity in the corresponding section of the serial port stops. This minimizes the switching and allows the device to operate with lower power consumption. When XRST = RRST = MCM = 0, power requirements are further reduced since CLKX is no longer driven as an output. Note that in IDLE2 mode, SP operation halts as with other parts of the C5x device. On the BSP, however, if the external serial port clock is being used, operation continues after an IDLE2 is executed. This allows power savings to still be realized in IDLE2 mode, while still maintaining operation of critical serial port functions if necessary (see Section 9.8, Buffered Serial Port (BSP) Interface, on page 9-53 for further information about BSP operation). It should also be noted that, on the SP, the serial port may be taken out of reset at any time. Depending on the timing of exiting reset, however, a frame sync pulse may be missed. On the BSP, for receive and transmit with external frame sync, a setup of at least one CLKOUT1 cycle plus 1/2 serial port clock cycle is required prior to FSX being sampled active in standard mode. In autobuffering mode, additional setup is required (see Section 9.8, Buffered Serial Port (BSP) Interface, on page 9-53 for further information about BSP initialization timing requirements).
9-34
XSREMPTY Bit
The XSREMPTY (bit 12) indicates whether the transmitter has experienced underflow. XSREMPTY is an active low bit; therefore, when XSREMPTY = 0, an underflow has occurred. Any one of the following three conditions causes XSREMPTY to become active (XSREMPTY = 0):
- DXR has not been loaded since the last DXR-to-XSR transfer, and XSR
empties (the actual transition of XSREMPTY occurs after the last bit has been shifted out of XSR),
- or the transmitter is reset (XRST = 0), - or the C5x device is reset (RS = 0).
On-Chip Peripherals
9-35
When XSREMPTY = 0, the transmitter halts and stops driving DX (the DX pin is in a high-impedance state) until the next frame sync pulse. Note that underflow does not constitute an error condition in the burst mode, although it does in the continuous mode (error conditions are further discussed in subsection 9.7.6, Serial Port Interface Exception Conditions, on page 9-46). The following condition causes XSREMPTY to become inactive (XSREMPTY = 1):
- A write to DXR occurs on the SP, or on the BSP a write to DXR occurs fol-
lowed by an FSX pulse (see subsection 9.7.4, Burst Mode Transmit and Receive Operations, on page 9-37 for further information about transmit timing).
RSRFULL Bit
The RSRFULL (bit 13) indicates whether the receiver has experienced overrun. RSRFULL is an active high bit; therefore, when RSRFULL = 1, RSR is full. In burst mode (FSM = 1), all three of the following must occur to cause RSRFULL to become active (RSRFULL = 1):
- The DRR has not been read since the last RSR-to-DRR transfer, - RSR is full, - and a frame sync pulse appears on FSR.
In continuous mode (FSM = 0), and on the BSP, only the first two conditions are necessary to set RSRFULL:
- The DRR has not been read since the last RSR-to-DRR transfer - and RSR is full.
Therefore, in continuous mode, and on the BSP, RSRFULL occurs after the last bit has been received. When RSRFULL = 1, the receiver halts and waits for the DRR to be read, and any data sent on DR is lost. On the SP, the data in RSR is preserved; on the BSP, the RSR contents are lost. Any one of the following three conditions causes RSRFULL to become inactive (RSRFULL = 0):
- The DRR is read, - or the serial port is reset (RRST = 0), - or the C5x device is reset (RS = 0). 9-36
Soft 0 1 X
Serial Port Clock Configuration Immediate stop, clocks are stopped. (Reset values) Transmitter stops after completion of word. Receiver is not affected. Free run.
X = Dont care
9.7.4
DXR reloaded
Note that in both the SP and the BSP, DXR to XSR transfers occur only if the XSR is empty and the DXR has been loaded since the last DXR to XSR transfer. If DXR is reloaded before the old DXR contents have been transferred to XSR, the previous DXR contents are overwritten. Accordingly, unless overwriting DXR is intended, the DXR should only be loaded if XRDY = 1. This is assured if DXR writes are made only in response to a transmit interrupt or polling XRDY. It should be noted that in the following discussions, the timings are slightly different for internally (TXM = 1, FSX is an output) and externally (TXM = 0, FSX is an input) generated frame syncs. This distinction is made because in the former case, the frame sync pulse is generated by the transmitting device as a direct result of a write to DXR. In the latter case, there is no such direct effect. Instead, the transmitting device must write to DXR and wait for an externally generated frame sync. If internal frame sync pulse generation is selected (TXM = 1), a frame sync pulse is generated on the second rising edge of CLKX following a write to DXR. For externally generated frame syncs, the events described here will occur as soon as a properly timed frame sync pulse occurs (see the data sheet for detailed serial port interface timings).
9-38
On the next rising edge of CLKX after FSX goes high, the first data bit (MSB first) is driven on the DX pin. Thus, if the frame sync pulse is generated internally (TXM = 1), there is a 2-CLKX cycle latency (approximately) after DXR is loaded, before the data is driven on the line. If frame sync is externally generated, data transmission is delayed indefinitely after a DXR load until the FSX pulse occurs (this is described in further detail later in this subsection). With the falling edge of frame sync, the rest of the bits are shifted out. When all the bits are transferred, DX enters a high-impedance state. At the end of each transmission, if DXR was not reloaded when XINT was generated, XSREMPTY becomes active (low) at this point, indicating underflow. With externally generated frame sync, if XSREMPTY is active and a frame sync pulse is generated, any old data in the DXR is transmitted. This is explained in detail in subsection 9.7.6, Serial Port Interface Exception Conditions, on page 9-46. Note that the first data bit transferred could have variable length if frame sync is generated externally and does not fall within one CLKX cycle (this is illustrated in Figure 917). Internally generated frame syncs are assured by C5x timings to be one CLKX cycle in duration.
FSX
DX
MSB
MSB-1
MSB-2
Serial port transmit with external frame sync pulses is similar to that with internal frame sync, with the exception that transfers do not actually begin until the external frame sync occurs. If the external frame sync occurs many CLKX cycles after DXR is loaded, however, the double buffer is filled and frozen until frame sync appears. On the SP (Figure 918), when the delayed frame sync occurs, A is transmitted on DX; after the transmit, a DXR-to-XSR copy of B occurs, XINT is generated, and again, the transmitter remains frozen until the next frame sync. When frame sync finally occurs, B is transmitted on DX. Note that when B is loaded into DXR, a DXR-to-XSR copy of B does not occur immediately because A has not been transmitted, and no XINT is generated. Any subsequent writes to DXR before the next delayed frame sync occurs overwrite B in the DXR.
On-Chip Peripherals
9-39
Figure 918. Burst Mode Serial Port Transmit Operation With Delayed Frame Sync in External Frame Sync Mode (SP)
CLKX FSX (TXM = 0) DX (F0 = 1) XRDY (SP) XINT (SP) XSREMPTY (SP) A1 MSB A7 A8 LSB B1 B2
On the BSP (Figure 919), since DXR was reloaded with B shortly after being loaded with A when the delayed frame sync finally occurs, B is transmitted on DX. After the transmit, the transmitter remains frozen until the next frame sync. When frame sync finally occurs, B is again transmitted on DX. Note that when B is loaded into DXR, a DXR-to-XSR copy of B does not occur immediately since the BSP requires a frame sync to initiate transmitting. Any subsequent writes to DXR before the next delayed frame sync occurs overwrite B in the DXR.
Figure 919. Burst Mode Serial Port Transmit Operation With Delayed Frame Sync in External Frame Sync Mode (BSP)
CLKX FSX (TXM = 0) DX (F0 = 1) XRDY (BSP) XINT (BSP) XSREMPTY (BSP) B1 MSB B7 B8 LSB B1 B2
9-40
During a receive operation, shifting into RSR begins on the falling edge of the CLKR cycle after frame sync has gone low (as shown in Figure 920). Then, as the last data bit is being received, the contents of the RSR are transferred to the DRR on the falling edge of CLKR, and RRDY goes high, generating a receive interrupt (RINT).
DRR Read
If the DRR from a previous receive has not been read, and another word is received, no more bits can be accepted without causing data corruption since DRR and RSR are both full. In this case, the RSRFULL bit is set indicating this condition. On the SP, this occurs with the next FSR; on the BSP, RSRFULL is set on the falling edge of CLKR during the last bit received. RSRFULL timing on both the SP and BSP is shown in Figure 921.
On-Chip Peripherals
9-41
Unlike transmit underflow, overrun (RSRFULL = 1) constitutes an actual error condition. While DRR contents are preserved in overrun, its occurrence can often result in loss of other received data. Overrun is handled differently on the SP and on the BSP. On the SP, the contents of RSR are preserved on overrun, but since RSRFULL is not set to 1 until the next FSR occurs after the overflowing reception, incoming data usually begins being lost as soon as RSRFULL is set. Data loss can only be avoided if RSRFULL is polled in software and the DRR is read immediately after RSRFULL is set to 1. This is normally possible only if the CLKR frequency is slow with respect to CLKOUT1, since RSRFULL is set on the falling edge of CLKR during FSR, and data begins being received on the following rising edge of CLKR. The time available for polling RSRFULL and reading the DRR to avoid data loss is, therefore, only half of one CLKR cycle. On the BSP, RSRFULL is set on the last valid bit received, but the contents of RSR are never transferred to DRR, therefore, the complete transferred word in RSR is lost. If the DRR is read (clearing RSRFULL) before the next FSR occurs, subsequent transfers can be received properly. Overrun and various other serial port exception conditions such as the occurrence of frame sync during a receive are discussed in further detail in subsection 9.7.6, Serial Port Interface Exception Conditions, on page 9-46. If the serial port receiver is provided with FSR pulses significantly longer than one CLKR cycle, timing of data reception is effected in a similar fashion as with long FSX pulses. With long FSR pulses, however, the reception of all bits, including the first one, is simply delayed until FSR goes low. Serial port receive operation with a long FSR pulse is illustrated in Figure 922.
FSR
DR
MSB
MSB-1
MSB-2
Note that if the packet transmit frequency is increased, the inactivity period between the data packets for adjacent transfers decreases to zero. This corresponds to a minimum period between frame sync pulses (equivalent to 8 or 16 CLKX/R cycles, depending on FO) that corresponds to a maximum packet frequency at which the serial port may operate. At maximum packet frequency, transmit timing is a compressed version of Figure 916, as shown in Figure 923.
9-42
Figure 923. Burst Mode Serial Port Transmit at Maximum Packet Frequency
CLKX FSX (TXM = 1) DX (FO = 1) XRDY (SP) XINT (SP) XRDY (BSP) XINT (BSP)
A7 A8 B1 MSB B2 B3 B4 B5 B6 B7 B8 LSB C1 C2 C3 C4
DXR reloaded
At maximum packet frequency, the data bits in consecutive packets are transmitted contiguously with no inactivity between bits. The frame sync pulse overlaps the last bit transmitted in the previous packet. Maximum packet frequency receive timing is similar and is shown in Figure 924.
DRR read
DRR read
On-Chip Peripherals
9-43
As shown in Figure 923 and Figure 924, with the transfer of multiple data packets at maximum packet frequency in burst mode, packets are transmitted at a constant rate, and the serial port clock provides sufficient timing information for the transfer, which permits a continuous stream of data. Therefore, the frame sync pulses are essentially redundant. Theoretically, then, only an initial frame sync signal is required to initiate the multipacket transfer. The C5x does support operation of the serial port in this fashion, referred to as continuous mode, which is selected by clearing the FSM bit in the SPC to 0. Continuous mode serial port operation is described in detail in subsection 9.7.5, Continuous Mode Transmit and Receive Operations.
9.7.5
9-44
transmitted. XSR operation is the same as in burst mode. A new external FSX pulse will abort the present transmission, cause one data packet to be lost, and initiate a new continuous mode transmit. This is explained in more detail in subsection 9.7.6, Serial Port Interface Exception Conditions, on page 9-46.
DXR reloaded
Continuous mode reception is similar to the transmit operation. After the initial frame sync pulse on FSR, no further frame syncs are required. This mode will continue as long as DRR is read every transmission. If DRR is not read by the end of the next transfer, the receiver will halt, and RSRFULL is set, indicating overrun. See subsection 9.7.6, Serial Port Interface Exception Conditions, on page 9-46. Overrun in continuous mode effects the SP and the BSP differently. On the SP, once overrun has occurred, reading DRR will restart continuous mode at the next word/byte boundary after DRR is read; no new FSR pulse is required. On the BSP, continuous mode reception does not resume until DRR is read and an FSR occurs. Continuous mode reception may only be discontinued by reconfiguring and resetting the serial port. Simply changing the FSM bit during a reception or halt will not properly switch to burst mode. Continuous mode receive timing is shown in Figure 926.
On-Chip Peripherals
9-45
DRR read
Figure 926 shows only one frame sync pulse; otherwise, it is similar to Figure 924. If a pulse occurs on FSR during a transfer (an error), then the receive operation is aborted, one packet is lost, and a new receive cycle is begun. This is discussed in more detail in subsection 9.7.2, Serial Port Interface Operation, on page 9-25 and in subsection 9.7.6, Serial Port Interface Exception Conditions.
9.7.6
Burst Mode
In burst mode, one type of error condition (presented in subsection 9.7.2, Serial Port Interface Operation) is receive overrun, indicated by the RSRFULL flag. This flag is set when the device has not read incoming data and more data is being sent. If this condition occurs, the processor halts serial port receives until DRR is read. Thus, any further data sent may be lost. Overrun is handled differently on the SP and on the BSP. On the SP, the contents of RSR are preserved on overrun, but since RSRFULL is not set to 1 until the next FSR occurs after the overflowing reception, incoming data usually begins being lost as soon as RSRFULL is set. Data loss can only be avoided if RSRFULL is polled in software and the DRR is read immediately after
9-46
RSRFULL is set to 1. This is normally possible only if the CLKR frequency is slow with respect to CLKOUT1, since RSRFULL is set on the falling edge of CLKR during FSR, and data begins being received on the following rising edge of CLKR. The time available for polling RSRFULL and reading the DRR to avoid data loss is, therefore, only half of one CLKR cycle. On the BSP, RSRFULL is set on the last valid bit received, but the contents of RSR are never transferred to DRR, therefore, the complete transferred word in RSR is lost. If the DRR is read (clearing RSRFULL) before the next FSR occurs, subsequent transfers can be received properly. Another type of receive error is caused if frame sync occurs during a receive (that is, data is being shifted into RSR from DR). If this happens, the present receive is aborted and a new one begins. Thus, the data that was being loaded into RSR is lost, but the data in DRR is not (no RSR-to-DRR copy occurs). Burst mode serial port receiver behavior under normal and error conditions for the SP is shown in Figure 927 and for the BSP is shown in Figure 928.
Receive in progress ?
No
No
Is RSR full ?
No
Yes Abort receive. Start next reception. (No RSR to DRR, thus, 1 word lost)
Receive in progress ?
No
No
Yes Abort receive. Start next reception. (No RSR to DRR, thus, 1 word lost)
On-Chip Peripherals
9-47
Transmitter exception conditions in burst mode may occur for several possible reasons. Underflow, which is described in subsection 9.7.3, Setting the Serial Port Configuration, on page 9-27 is an exception condition that may occur in burst mode, however, underflow is not normally considered an error. An exception condition that causes errors in transmitted data occurs when frame sync pulses occur at inappropriate times during a transfer. If a transmit is in progress (that is, XSR data is being driven on DX) when a frame sync pulse occurs, the transmission is aborted, and the data in XSR is lost. Then, whatever data is in DXR at the time of the frame sync pulse is transferred to XSR (DXR-to-XSR copy) and is transmitted. Note, however, that in this case an XINT is generated only if the DXR has been written to since the last transmit. Also, if XSREMPTY is active and a frame sync pulse occurs, the old data in DXR is shifted out. Figure 929 summarizes serial port transmit behavior under error and nonerror conditions. Note that if an FSX occurs when no transmit is in progress, and DXR has been reloaded since the last transmit, the DXR-toXSR copy and generation of transmit interrupt occur at this point only on the BSP. On the SP, these two events occur at the time the DXR was reloaded.
Transmit in progress?
No
No
Yes DXR-to-XSR copy (BSP only). Transmit interrupt (BSP only). Start transmit.
No
9-48
Continuous Mode
In continuous mode, errors take on a broader meaning, since data transfer is intended to occur at all times. Thus, underflow (XSREMPTY = 0) constitutes an error in continuous mode because data will not be transmitted. As in burst mode, overrun (RSRFULL = 1) is also an error, and in continuous mode, both overrun and underflow cause the serial port receive or transmit sections, respectively, to halt (see subsection 9.7.3, Setting the Serial Port Configuration, on page 9-27 for a description of these conditions). Fortunately, underflow and overrun errors may not be catastrophic; they can often be corrected simply by reading DRR or writing to DXR. The SP and the BSP are affected differently when overrun occurs in continuous mode. In the SP, when DRR is read to deactivate RSRFULL, a frame sync pulse is not required in order to resume continuous mode operation. The receiver keeps track of the transfer word boundary, even though it is not receiving data. Therefore, when the RSRFULL flag is deactivated by a read from DRR, the receiver begins reading from the correct bit. On the BSP, since an FSR pulse is required to restart continuous reception, this also reestablishes the proper bit alignment, in addition to restarting reception. Figure 930 shows receiver functional operation in continuous mode.
Receive in progress ?
No
Yes Abort current receive. Start next reception. (No RSR-to-DRR copy; thus, current word is lost)
During a receive in continuous mode, if a frame sync pulse occurs, this causes a receive abort condition, and one packet of data is lost (this is caused because the frame sync pulse resets the RSR bit counter). The data present on DR then begins being shifted into RSR, starting again from the first bit. Note that if a frame sync occurs after deactivating the RSRFULL flag by reading DRR, but before the beginning of the next word boundary, this also creates a receive abort condition.
On-Chip Peripherals
9-49
Another cause for error is the appearance of extraneous frame syncs during a transmission. After the initial frame sync in continuous mode, no others are required; if an improperly timed frame sync pulse occurs during a transmit, the current transfer (that is, serially driving XSR data onto DX) is aborted, and data in XSR is lost. A new transmit cycle is initiated, and transfers continue as long as the DXR is updated once per transmission afterward. Figure 931 shows continuous mode transmitter functional operation. Note that if XSREMPTY is active in continuous mode and an external frame sync occurs, the previous DXR data is transmitted as in burst mode operation.
Transmit in progress ?
No
No
Yes DXR-to-XSR copy. Transmit interrupt. Start new transmit. (Current word is lost)
9.7.7
9-50
SPLK
SPLK SPLK SPLK CLRC BCND B LACL LAR SACL SACL B LACC SUB BCND LACL ADD SACL SACL RETE B
ILOOP SENDZ
SELF1 XMT_ISR
: ;Setup SPC as CLK source ;and internal frame sync #0038h, SPC ;Set TXM=MCM=FSM=1, ;TDM=DLB=FO=0. ;And put SP into reset ;(XRST=RRST=0) #00F8h, SPC ;Take SP out of reset ;Setup interrupts #0ffffh, IFR ;clear IFR #020h, IMR ;Turn on XINT INTM ;enable interrupts SENDZ, BIO ;Wait for readytoreceive ILOOP ;from other device #0 ;First transmit/write ;value is 0 AR7, #9000h ;Setup where to write * ;Write first value DXR ;Transmit first value SELF1 ;Wait for interrupts AR7 ;Check if past 0x0b000 #0B000h ;i.e. end of block END_SERP,GEQ ;Go to tight loop if so ;Add one and transmit *+ ;Load value #1 ;Add one * ;Write value DXR ;Transmit value END_SERP ;Sit in tight loop after ;block is complete.
END_SERP
On-Chip Peripherals
9-51
Example 94 shows the code for device 1. It sends a ready-to-receive signal (XF) to device 0. Only its receive interrupt (RINT) is enabled, and its receive ISR reads from the DRR, writes to the block, and checks to see if the end of the block has been reached.
SPLK
SPLK SPLK SPLK CLRC LAR CLRC SELF1 RCV_ISR B LACL SACL LACC SUB BCND B
END_SERP
9-52
11
Read
Write
Control
XRDY
BCLKX BFSX
BDXR
SPCE
WXINT
XINT
BDX BDR
Interrupt Logic
Most aspects of BSP operation are similar to that of the C5x standard serial port. Section 9.7, Serial Port Interface, on page 9-23 discusses operation of both the C5x standard serial port and the BSP in standard mode. Since standard mode BSP operation is a superset of standard SP operation, Section 9.7 should first be studied before the rest of this section is read. System considerations of BSP operation such as initialization and low power modes are discussed in subsection 9.8.3 on page 9-69.
9-54
9.8.1
Address 0030h 0031h 0032h 0033h Register BDRR BDXR BSPC SPCE Description 16-bit BSP data receive register 16-bit BSP data transmit register 16-bit BSP control register 16-bit BSP control extension register BRSR BXSR 16-bit BSP data receive shift register 16-bit BSP data transmit shift register
On-Chip Peripherals
9-55
9.8.1.1
Preservation of data in RSR on overrun. Continuous mode receive restart after overrun.
BRSR contents are not preserved on overrun. Receive does not restart until BDRR is read and then a BFSR occurs. Yes Occur when when a BFSX occurs after BDXR is loaded. BDRR can only be read and BDXR can only be written when the ABU is disabled. BDRR can only be written when the BSP is in reset. BDXR can be read any time. The same precautions with regard to reads and writes to these registers apply as in SP.
Sign extension in DRR on 8-, 10-, or 12-bit transfers. XSR load, XSREMPTY clear, XRDY/XINT generation. Program accessibility to DXR and DRR.
CLKOUT1
9-56
Table 916. Differences Between SP and BSP Operation in Standard Mode (Continued)
Condition Initialization timing requirements. SP On the SP, the serial port may be taken out of reset at any time with respect to FSX/FSR, however, if XRST/RRST go high during or after the frame sync, the frame sync may be ignored. BSP On the BSP, exiting serial port reset under certain conditions must precede FSX timing by one CLKOUT1 cycle in standard mode and by six CLKOUT1 cycles in autobuffering mode (see subsection 9.8.3, System Considerations of BSP Operation, on page 9-69). Yes (see subsection 9.8.3, System Considerations of BSP Operation, on page 9-69).
No
9.8.1.2
Figure 933. BSP Control Extension Register (SPCE) Diagram Serial Port Control Bits
1510 9 8 7 6 5 40 ABU control PCM
R/W
FIG
FE
CLKP
R/W
FSP
R/W
CLKDV
R/W
R/W
R/W
Note:
R = Read, W = Write
On-Chip Peripherals
9-57
Table 917. BSP Control Extension Register (SPCE) Bit Summary Serial Port Control Bits
Bit 1510 9 Name ABU control PCM Reset value 0 Function Reserved for autobuffering unit control (see subsection 9.8.2, Autobuffering Unit (ABU) Operation, on page 9-60). Pulse Code Modulation Mode. This control bit puts the serial port in pulse-code modulation (PCM) mode. The PCM mode only affects the transmitter. BDXR-toBXSR transfer is not affected by the PCM bit value. PCM = 0 PCM = 1 Pulse-coded modulation mode is disabled. Pulse-coded modulation mode is enabled. In PCM mode, BDXR is transmitted only if its most significant B bit is set to 0. If this bit is set to 1, BDXR is not transmitted and BDX is put in high impedance during the transmission period.
FIG
Frame Ignore. This control bit operates only in transmit continuous mode with external frame and in receive continuous mode. FIG = 0 FIG = 1 Frame sync pulses following the first frame pulse restart the transfer. Frame sync pulses following the first frame pulse that initiates a transfer operation are ignored.
FE
Format Extension. The FE bit in conjunction with FO in the SPC register (Table 913 on page 9-28) specifies the word length. When FO FE = 00, the format is 16-bit words; when FO FE = 01, the format is 10-bit words; when FO FE = 10, the format is 8-bit words; and when FO FE = 11, the format is 12-bit words. Note that for 8-, 10-, and 12-bit words, the received words are right justified and the sign bit is extended to form a 16-bit word. Words to transmit must be right justified. See Table 918 for the word length configurations. Clock Polarity. This control bit specifies when the data is sampled by the receiver and transmitter. CLKP = 0 CLKP = 1 Data is sampled by the receiver on BCLKR falling edge and sent by the transmitter on BCLKX rising edge. Data is sampled by the receiver on BCLKR rising edge and sent by the transmitter on BCLKX falling edge.
CLKP
9-58
Table 917. BSP Control Extension Register (SPCE) Bit Summary Serial Port Control Bits (Continued)
Bit 5 Name FSP Reset value 0 Function Frame Sync Polarity. This control bit specifies whether frame sync pulses (BFSX and BFSR) are active high or low. FSP = 0 FSP = 1 40 CLKDV 00011 Frame sync pulses (BFSX and BFSR) are active high. Frame sync pulses (BFSX and BFSR) are active low.
Internal Transmit Clock Division factor. When the MCM bit of BSPC is set to 1, CLKX is driven by an on-chip source having a frequency equal to 1/(CLKDV+1) of CLKOUT. CLKDV range is 031. When CLKDV is odd or equal to 0, the CLKX duty cycle is 50%. When CLKDV is an even value (CLKDV=2p), the CLKX high and low state durations depend on CLKP. When CLKP is 0, the high state duration is p+1 cycles and the low state duration is p cycles; when CLKP is 1, the high state duration is p cycles and the low state duration is p+1 cycles.
These enhanced features allow greater flexibility in serial port interface in a variety of areas. In particular, the frame ignore feature offers a capability which allows a mechanism for effectively compressing transferred data packets if they are not transferred in 16 bit format. This feature is used with continuous receptions and continuous transmits with external frame sync. When FIG=0, if a frame sync pulse occurs after the initial one, the transfer is restarted; when FIG=1, this frame sync is ignored. Setting FIG to 1 allows, for example, effectively achieving continuous 16-bit transfers under circumstances where frame sync pulses occur every 8-, 10- or 12-bits. Without using FIG, each transfer of less than 16 bits requires an entire 16-bit memory word, and each 16 bits transferred as two 8-bit bytes requires two memory words and two transfer operations, rather than one of each. Using FIG, therefore, can result in a significant improvement in buffer size requirement in both autobuffered and standard mode, and a significant improvement in CPU cycle overhead required to handle serial port transfers in standard mode. Figure 934 shows an example with the BSP configured in 16-bit format but with a frame sync after 8 bits.
On-Chip Peripherals
9-59
Figure 934. Transmit Continuous Mode with External Frame and FIG = 1 (Format is 16 bits)
CLKX/ CLKR
Frame Ignored
FSX/FSR
DX/DR RRDY
MSB
XRDY
DXR reloaded
9.8.2
9-60
Address 0033h 0034h 0035h 0036h 0037h Register SPCE AXR BKX Description 16-bit BSP control extension register 11-bit BSP address transmit register (ABU) 11-bit BSP transmit buffer size register (ABU) 11-bit BSP address receive register (ABU) ARR BKR 11-bit BSP receive buffer size register (ABU)
Figure 935 shows the block diagram of the ABU. The SPCE contains bits which control ABU operation and will be discussed in detail later in this subsection. AXR, BKX, ARR, and BKR, along with their associated circular addressing logic, allow address generation for accessing words to be transferred between the C5X internal memory and the BSP data transmit register (BDXR) and BSP data receive register (BDRR) in autobuffering mode. The address and block size registers as well as circular addressing are also discussed in detail later in this subsection. Note that the 11-bit memory mapped AXR, BKX, ARR, and BKR registers are read as 16-bit words, with the five most significant bits read as zeroes and the 11-bit register contents right justified in the least significant 11 bits. If autobuffering is not used, these registers can be used for general purpose storage of 11-bit data. The transmit and receive sections of the ABU can be enabled separately. When either section is enabled, access to its corresponding serial port data register (BDXR or BDRR) through software is limited. The BDRR can only be read, and the BDXR can only be written when the ABU is disabled. The BDRR can only be written when the BSP is in reset. The BDXR can be read any time. When either transmit or receive autobuffering is disabled, that section operates in standard mode, and its portion of the ABU is transparent. The ABU also implements the capability to generate CPU interrupts when transmit and receive buffers have been halfway or entirely filled or emptied. These interrupts take the place of the transmit and receive interrupts in standard mode operation, which are not generated in autobuffering mode. This mechanism features an autodisabling capability which can be used to automatically terminate autobuffering when either the half-of- or bottom-of-buffer boundary is crossed. These features are also described in detail later in this subsection.
On-Chip Peripherals
9-61
11
Read
Write
MUX
11 11
AXR
16
ARR
BKX
BKR XRDY
Control
RRDY
BXINT
BRINT
BCLKX BFSX
BDXR
BDX BDR
BXSR BRSR
Interrupt Logic
Burst or continuous mode, as described in Section 9.7, Serial Port Interface, can be used in conjunction with the autobuffering capability. Note that due to the nature of autobuffering mode, however, if burst mode with internal frame sync is selected, this will effectively result in continuous transmission with FSX generated by the BSP at the start of each transmission.
9-62
The internal C5X memory used for autobuffering consists of a 2K-word block of single-access memory that can be configured as data, program, or both (as with other single-access memory blocks). This memory can also be used by the CPU as general purpose storage, however, this is the only memory block in which autobuffering can occur. Since the BSP is implemented on several different TMS320 devices, the actual base address of the ABU memory may not be the same in all cases. The 2K-word block of BSP memory is lcoated at 800hFFFh in data memory or at 8000h87FFh in program memory as specified by the RAM and OVLY control bits. When the ABU is enabled, this 2K-word block of memory can still be accessed by the CPU within data and/or program spaces. Conflicts may therefore occur between the CPU and the ABU if the 2K-word block is accessed at the same time by both. If a conflict does occur, priority is given to the ABU, resulting in the CPU access being delayed by one cycle. Accordingly, the worst case situation is that a CPU access could be delayed one cycle each time the ABU accesses the memory block, that is, for every new word transmitted or received. Note that external DMA can only be performed in the 2K-word block of ABU memory when autobuffering is disabled. Also note that when on-chip program memory is secured using the ROM protection feature, the 2K-word block of ABU memory cannot be mapped to program memory. For further information regarding the ROM protection feature, refer to subsection 8.2.4, Program Memory Protection Feature, on page 8-14. When the ABU is enabled for both transmit and receive, if transmit and receive requests from the serial port interface occur at same time, the transmit request takes priority over the receive request. In this case, the transmit memory access occurs first, delaying the receive memory access by generating a wait state. When the transmit memory access is completed, the receive memory access takes place.
9.8.2.1
15 14 13 12 11 10 90 HALTR
R/W
Figure 936. BSP Control Extension Register (SPCE) Diagram ABU Control Bits
RH
R
BRE
R/W
HALTX
R/W
XH
R
BXE
R/W
SP control
Note:
R = Read, W = Write
On-Chip Peripherals
9-63
Table 920. BSP Control Extension Register (SPCE) Bit Summary ABU Control Bits
Bit 15 Name HALTR Reset value 0 Function Autobuffering Receive Halt. This control bit determines whether autobuffering receive is halted when the current half of the buffer has been received. HALTR = 0 HALTR = 1 Autobuffering continues to operate when the current half of the buffer has been received. Autobuffering is halted when the current half of the buffer has been received. When this occurs, the BRE bit is cleared to 0 and the serial port continues to operate in standard mode.
14
RH
Receive Buffer Half Received. This read-only bit indicates which half of the receive buffer has been filled. Reading RH when the RINT interrupt occurs (seen either as a program interrupt or by polling IFR) is a convenient way to identify which boundary has just been crossed. RH = 0 RH = 1 The first half of the buffer has been filled and that receptions are currently placing data in the second half of the buffer. The second half of the buffer has been filled and that receptions are currently placing data in the first half of the buffer.
13
BRE
Autobuffering Receive Enable. This control bit enables autobuffering receive. BRE = 0 BRE = 1 Autobuffering is disabled and the serial port interface operates in standard mode. Autobuffering is enabled for the receiver.
12
HALTX
Autobuffering Transmit Halt. This control bit determines whether autobuffering transmit is halted when the current half of the buffer has been transmitted. HALTX = 0 HALTX = 1 Autobuffering continues to operate when the current half of the buffer has been transmitted. Autobuffering is halted when the current half of the buffer has been transmitted. When this occurs, the BXE bit is cleared to 0 and the serial port continues to operate in standard mode.
9-64
Table 920. BSP Control Extension Register (SPCE) Bit Summary ABU Control Bits (Continued)
Bit 11 Name XH Reset value 0 Function Transmit Buffer Half Transmitted. This read-only bit indicates which half of the transmit buffer has been transmitted. Reading XH when the XINT interrupt occurs (seen either as a program interrupt or by polling IFR) is a convenient way to identify which boundary has just been crossed. XH = 0 The first half of the buffer has been transmitted and transmissions are currently taking data from the second half of the buffer. The second half of the buffer has been transmitted and transmissions are currently taking data from the first half of the buffer.
XH = 1
10
BXE
Autobuffering Transmit Enable. This control bit enables the autobuffering transmit. BXE = 0 BXE = 1 Autobuffering is disabled and the serial port operates in standard mode. Autobuffering is enabled for the transmitter.
90
SP control
Serial Port Interface Control bits (see subsection 9.8.1.2, Enhanced BSP Features, on page 9-57).
9.8.2.2
Autobuffering Process
The autobuffering process occurs between the ABU and the 2K-word block of ABU memory. Each time a serial port transfer occurs, the data involved is automatically transferred to or from a buffer in the 2K-word block of memory under control of the ABU. During serial port transfers in autobuffering mode, interrupts are not generated with each word transferred as they are in standard mode operation. This prevents the overhead of having the CPU directly involved in each serial port transfer. Interrupts are generated to the CPU only each time one of the half-buffer boundaries is crossed. Within the 2K-word block of ABU memory, the starting address and size of the buffers allocated is programmable using the 11-bit address registers (AXR and ARR) and the 11-bit block size registers (BKX and BKR). The transmit and receive buffers can reside in independent areas, overlapping areas or the same area, which allows transmitting from a buffer while receiving into the same buffer if desired.
On-Chip Peripherals
9-65
The autobuffering process utilizes a circular addressing mechanism to access buffers within the 2K word block of ABU memory. This mechanism operates in the same fashion for transmit and receive. For each direction (transmit or receive), two registers specify the buffer size and the current address in the buffer. These registers are the block size and address register for transmit and receive. Each of the BK/AR register pairs fully specify the top and bottom of buffer addresses for transmit and receive. Note that this circular addressing mechanism only effects accesses into the 2K word block by the ABU. Accesses to this memory by the CPU are performed strictly according to the addressing mode(s) selected in the assembly language instructions which perform the memory access. The circular addressing mechanism automatically recirculates ABU memory accesses through the specified buffer, returning to the top of the buffer each time the bottom of the buffer is reached. The circular addressing mechanism is initialized by loading BK with the exact size of the desired buffer (as opposed to size1) and AR with a value which contains both the base address of the buffer within the 2K word block and the initial starting address within this buffer (this is explained in detail below). Often the initial starting address within the buffer is 0, indicating the start of the buffer (the top-of-buffer address), but the initial starting address may be any point within the defined buffer range. Once initialized, BK can be considered to consist of two parts; the most significant or higher part (BKH), which corresponds to the all of the most significant 0 bits of BK, and the lower part (BKL), which is the remaining bits, of which the most significant bit is a 1 and whose bit position is designated bit position N. The N bit position also defines the two parts (ARH and ARL) of the address register. The top of buffer address (TBA) is defined by the concatenation of ARH with N+1 least significant 0 bits. The bottom of buffer address (BBA) is defined by the concatenation of ARH and BKL1, and the current address within the buffer is specified by the complete contents of AR. A circular buffer of size BK must therefore start on an N-bit boundary (the N least significant bits of the address register are 0) where N is smallest integer that satisfies 2N > BK, or at the lowest address within the 2K memory block. The buffer consists of two halves, the address range for the first half is: ARH|0...0 to ARH|[(BKL >> 1) 1] and the address range for the second half is: ARH|(BKL >> 1) to ARH|(BKL1) Figure 937 illustrates all of the relationships between the defined buffer and the BK and AR registers, the bottom of circular buffer address (BBA), and the top of circular buffer address (TBA).
9-66
10 ARH
N ARL
Address register (AR) ARH 10 00 BKH N 1 BKL BBA ARH BKL Bottom of Buffer +1 SECOND HALF 0 BKL >>1 Second Half Start
The minimum block size for an ABU buffer is two; the maximum block size is 2047, and any buffer of 2047 to 1024 words must start at a relative address of 0x0000 with respect to the base address of the 2K block of ABU memory. If either of the address registers (AXR or ARR) is loaded with a value specifying a location that is outside the range of the currently allocated buffer size as defined by BK, improper operation may result. Subsequent memory accesses will be performed starting at the location specified, despite the fact that they will be to locations which are outside the range of the desired buffer, and the AR will be incremented with each access until its contents reach the next permitted buffer start address. Any further accesses are then performed using the correct circular buffering algorithm with the new AR contents as the updated buffer start address. It should be noted that any accesses performed with improperly loaded ARs may therefore unexpectedly corrupt some memory locations. The following example illustrates some of these functional aspects of the autobuffering process. Consider a transmit buffer of size 5 (BKX = 5) and a receive buffer of size 8 (BKR = 8) as shown in Figure 938. The transmit buffer may start at any relative address that is a multiple of 8 (address 0x0000, 0x0008, 0x0010, 0x0018, ..., 0x07F8), and the receive buffer may start at any relative address that is a multiple of 16 (0x0000, 0x0010, 0x0020, ..., 0x07F0). In this
On-Chip Peripherals
9-67
example, the transmit buffer starts at relative address 0x0008 and the receive buffer starts at relative address 0x0010. AXR may therefore contain any value in the range 0x00080x000C and ARR may contain any value in the range 0x00100x0017. If AXR in this example had been loaded with the value 0x000D (not acceptable in a modulo 5 buffer), memory accesses would be performed and AXR incremented until it reaches address 0x0010 which is an acceptable starting address for a modulo 5 buffer. Note, however, that if this had occurred, AXR would then specify a transmit buffer starting at the same base address as the receive buffer, which may cause improper buffer operation.
Transmit BKX = 5
The autobuffering process is activated upon request from serial port interface when XRDY or RRDY goes high, indicating that a word has been received. The required memory access is then performed, following which an interrupt is generated if half of the defined buffer (first or second) has been processed. The RH and XH flags in the SPCE register indicate which half has been processed when the interrupt occurs.
9-68
When autodisabling is selected (HALTX or HALTR bit is set), then when the next half (first or second) buffer boundary is encountered, the autobuffering enable bit in the SPCE (BXE or BRE) is cleared so that autobuffering is disabled and does not generate any further requests. When transmit autobuffering is halted, transmission of the current XSR contents and the last value loaded in DXR are completed, since these transfers have already been initiated. Therefore, when using the HALTX function, some delay will normally occur between crossing a buffer boundary and transmission actually stopping. If it is necessary to identify when transmission has actually ended, software should poll for the condition of XRDY = 1 and XSREMPTY = 0, which occurs after last bit has been transmitted. In the receiver, when using HALTR, since autobuffering is stopped when the most recent buffer boundary is crossed, future receptions may be lost, unless software begins servicing receive interrupts at this point, since BDRR is no longer being read and transferred to memory automatically by the ABU. For explanation of how the serial port operates in standard mode when DRR is not being read, refer to subsection 9.7.6, Serial Port Interface Exception Conditions, on page 9-46. The sequence of events involved in the autobuffering process is summarized as follows: 1) The ABU performs the memory access to the buffer. 2) The appropriate address register is incremented unless the bottom of buffer has been reached, in which case the address register is modified to point to the top of buffer address. 3) Generate an XINT or RINT and update XH/RH if the half buffer or bottom of buffer boundary has been crossed. 4) Autodisable the ABU if this function has been selected and if the half buffer or bottom of buffer boundary has been crossed.
9.8.3
9.8.3.1
simultaneously with CLKX/CLKR starting. Regardless of whether serial port clocks have been running previously, however, the timing of serial port initialization, and most importantly, when the port is taken out of reset, can be critical for proper serial port operation. The most significant consideration of this is when the port is taken out of reset with respect to when the first frame sync pulse occurs. Initialization timing requirements differ on the SP and the BSP. On the SP, the serial port may be taken out of reset at any time with respect to FSX/FSR, however, if XRST/RRST go high during or after the frame sync, the frame sync may be ignored. In standard mode operation on the BSP for receive, and for transmit with external frame sync (TXM = 0), the BSP must be taken out of reset at least one full CLKOUT1 cycle plus 1/2 serial port clock cycle prior to the edge of the clock which detects the active frame sync pulse (whether the clock has been running previously or not) for proper operation. See Figure 939. Transmit operations with internal clock and frame sync are not subject to this requirement since frame sync is internally generated automatically (after XRST is cleared (set to 1)) when BDXR is loaded. Note, however, that if external serial port clock is used with internal frame sync, frame sync generation may be delayed depending on the timing of clearing XRST with respect to the clock. Figure 939 illustrates the standard mode BSP initialization timing requirements for the transmitter. The figure shows standard mode operation with external frame (TXM = 0) and clock (MCM = 0), active high frame sync (FSP = 0) and data samples on rising edge (CLKP = 0). In this example, if the BFSX pulse occurs during the first BCLKX, the transmission is still properly initiated.
BFSX
BDX
9-70
In autobuffering mode, for receive, and transmit with external frame sync (TXM = 1), the BSP must be taken out of reset at least six CLKOUT1 cycles plus 1/2 serial port clock cycle prior to the edge of the clock which detects the active frame sync pulse (whether the clock has been running previously or not) for proper operation. This is due to the time delay for the ABU logic to be activated. See Figure 940. Transmit operations with internal clock and frame sync are not subject to this requirement since frame sync is internally generated automatically after XRST is cleared. Note, however, that if external serial port clock is used with internal frame sync, and if the clock is not running when XRST is cleared, frame sync generation may be delayed depending on the timing of clearing XRST with respect to the clock. Figure 940 illustrates autobuffering mode initialization timing requirements for the transmitter with external clock and frame sync. The figure shows standard mode operation with external frame (TXM = 0) and clock (MCM = 0), active high frame sync (FSP = 0), and data sampled on rising edge (CLKP = 0).
BFSX
BDX
XRDY
9.8.3.2
BSP in autobuffering mode, a similar set of steps must also be performed, in addition to which, the autobuffering registers must be initialized. The following two code examples illustrate initializing the serial port interface for autobuffering mode operation. In both cases, the code is written assuming that transmit and receive interrupts are used to service the ABU interrupts, however, polling of the interrupt flag register (IFR) could also be used. Both the transmit and receive sections can be initialized at the same time or separately depending upon system requirements. Example 95 initializes the serial port for transmit operations only, with burst mode, external frame sync and external clock selected. The selected data format is 10 bits, with frame sync and clock polarities selected to be high true. Transmit autobuffering is enabled by setting the BXE bit in the ABUC section of SPCE, and HALTX has been set to 1, which causes transmission to halt when half of the defined buffer is transmitted. Example 96 initializes the serial port for receive operations only, with continuous mode selected. Frame sync and clock polarities are selected to be low true, data format is 16 bits, and frame ignore is selected so that two received data bytes are packed into a single received word to minimize memory requirements. Receive autobuffering is enabled by setting the BRE bit in the ABUC section of SPCE. Note that in Example 95 and Example 96, the transmit and receive interrupts used are those that the BSP occupies on the C56 and C57, the two main devices which include the BSP. However, on other devices which use the BSP, different interrupts may be used, therefore, appropriate device documentation should be consulted. Also, for both examples, it is assumed that DP has been initialized to 0 and that interrupts are disabled (INTM = 1) when entering the routines.
Example 95. Transmit Initialization in Burst Mode with External Frame Sync and External Clock (Format is 10 bits)
OPL SPLK SPLK SPLK SPLK OPL OPL CLRC #00080h,IMR ;enable transmit interrupt (XINT) #00008h,BSPC ;configure serial port SPC register ;(XRST=0) #01480h,SPCE ;configure serial port SPCE register #XTOP,AXR ;init address of buffer start in AXR #XSIZE,BKX ;init size of buffer #00080h,IFR ;clear any latched transmit interrupt #00040h,BSPC ;start transmit part (XRST=1) INTM ;enable interrupts
9-72
#00040h,IMR ;enable receive interrupt (RINT) #00000h,BSPC ;reset and configure serial port SPC ;(RRST=0) #02160h,SPCE ;configure serial port SPCE register #RTOP,ARR ;init pointer with top of buffer address #RSIZE,BKR ;init size of receive buffer #00040h,IFR ;clear any latched receive interrupt #0080h,BSPC ;start receive part INTM ;enable interrupts
9.8.4
9.9.1
time
The C5x TDM port uses eight TDM channels. Which device is to transmit and which device or devices is/are to receive for each channel may be independently specified. This results in a high degree of flexibility in interprocessor communications.
9.9.2
9-74
Address 0030h 0031h 0032h 0033h 0034h 0035h Register TRCV TDXR TSPC Description TDM data receive register TDM data transmit register TDM serial port control register TDM channel select register TCSR TRTA TDM receive/transmit address register TDM receive address register TRAD TRSR TXSR TDM data receive shift register TDM data transmit shift register - TDM data receive register (TRCV). The 16-bit TDM data receive register
(TRCV) holds the incoming TDM serial data. The TRCV has the same function as the DRR, described in Section 9.7 on page 9-23.
- TDM data transmit register (TDXR). The 16-bit TDM data transmit register
(TDXR) holds the outgoing TDM serial data. The TDXR has the same function as the DXR, described in Section 9.7 on page 9-23.
- TDM serial port control register (TSPC). The 16-bit TDM serial port control
register (TSPC) contains the mode control and status bits of the TDM serial port interface. The TSPC is identical to the SPC (Figure 914) except that bit 0 serves as the TDM mode enable control bit in the TSPC. The TDM bit configures the port in TDM mode (TDM = 1) or stand-alone mode (TDM = 0). In stand-alone mode, the port operates as a standard serial port as described in Section 9.7 on page 9-23.
- TDM channel select register (TCSR). The 16-bit TDM channel select reg-
ister (TCSR) specifies in which time slot(s) each C5x device is to transmit.
- TDM receive/transmit address register (TRTA). The 16-bit TDM receive/
transmit address register (TRTA) specifies in the eight LSBs (RA0RA7) the receive address of the C5x device and in the eight MSBs (TA0TA7) the transmit address of the C5x device.
- TDM receive address register (TRAD). The 16-bit TDM receive address
register (TRAD) contains various information regarding the status of the TDM address line (TADD).
On-Chip Peripherals
9-75
- TDM data receive shift register (TRSR). The 16-bit TDM data receive shift
register (TRSR) controls the storing of the data, from the input pin, to the TRCV. The TRSR has the same function as the RSR, described in Section 9.7 on page 9-23.
- TDM data transmit shift register (TXSR). The 16-bit TDM data transmit
shift register (TXSR) controls the transfer of the outgoing data from the TDXR and holds the data to be transmitted on the data-transmit (TDX) pin. The TXSR has the same function as the XSR, described in Section 9.7 on page 9-23.
9.9.3
C5x
9-76
The TADD line, which is driven by a particular device for a particular time slot, determines which device(s) in the TDM configuration should execute a valid TDM receive during that time slot. This is similar to a valid serial port read operation, as described in Section 9.7, Serial Port Interface, on page 9-23, except that some corresponding TDM registers are named differently. The TDM receive register is TRCV, and the TDM receive shift register is TRSR. Data is transmitted on the bidirectional TDAT line. Note that in Figure 942(b) the device TDX and TDR pins are tied together externally to form the TDAT line. Also, note that only one device can drive the data and address line (TDAT and TADD) in a particular slot. All other devices TDAT and TADD outputs should be in the high-impedance state during that slot, which is accomplished through proper programming of the TDM port control registers (this is described in detail later in this section). Meanwhile, in that particular slot, all the devices (including the one driving that slot) sample the TDAT and TADD lines to determine if the current transmission represents valid data to be read by any one of the devices on the bus (this is also discussed in detail later in this section). When a device recognizes an address to which it is supposed to respond, a valid TDM read then occurs, the value is transferred from TRSR to the TRCV register. A receive interrupt (TRNT) is generated, which indicates that TRCV has valid receive data and can be read. All TDM port operations are synchronized by the TCLK and TFRM signals. Each of them are generated by only one device (typically the same device), referred to as the TCLK and TFRM source(s). The word master is not used here because it implies that one device controls the other, which is not the case, and TCSR must be set to prevent slot contention. Consequently, the remaining devices in the TDM configuration use these signals as inputs. Figure 942(b) shows that TCLKX and TCLKR are externally tied together to form the TCLK line. Also, TFRM and TADD originate from the TFSX and TFSR pins respectively. This is done to make the TDM serial port also easy to use in standard mode. TDM port operation is controlled by six memory-mapped registers. The layout of these registers is shown in Figure 943. The TRCV and TDXR registers have the same functions as the DRR and DXR registers respectively, described in Section 9.7, Serial Port Interface. The TSPC register is identical to the SPC register except that bit 0 serves as the TDM mode enable control bit in the TSPC. This bit configures the port in TDM mode (TDM=1) or stand-alone mode (TDM=0). In stand-alone mode, the port operates as a standard serial port as described in Section 9.7. Refer to Section 9.7, Serial Port Interface, on page 9-23 for additional information about the function of the bits in these registers.
On-Chip Peripherals
9-77
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 TRCV TDXR TSPC Receive Data Transmit Data IN0 X Free X Soft X X X X X XRDY RRDY X X IN1 X RRST XRST TXM MCM CH7 RA7 A7 CH6 RA6 A6 CH5 RA5 A5 CH4 RA4 A4 X 0 0 TDM TCSR TRTA CH3 RA3 A3 CH2 CH1 CH0 RA2 A2 RA1 A1 RA0 A0 TA7 X TA6 X TA5 X2 TA4 X1 TA3 X0 TA2 S2 TA1 S1 TA0 S0 TRAD Note: X=Dont care.
When TDM mode is selected, the DLB and FO bits in the TSPC are hardconfigured to 0, resulting in no access to the digital loopback mode and in a fixed word length of 16 bits (a different type of loopback is discussed in the example in subsection 9.9.6 on page 9-82). Also, the value of FSM does not affect the port when TDM=1, and the states of the underflow and overrun flags are indeterminate (subsection 9.9.5, TDM Serial Port Interface Exception Conditions, on page 9-82 explains how exceptions are handled in TDM mode). If TDM=1, changes made to the contents of the TSPC become effective upon completion of channel 7 of the current frame. Thus the TSPC value cannot be changed for the current frame; any changes made will take effect in the next frame. The source device for the TCLK and TFRM timing signals is set by the MCM and TXM bits, respectively. The TCLK source device is identified by setting the MCM bit of its TSPC register to 1. Typically, this device is the same one that supplies the TDM port clock signal TCLK. The TCLKX pin is configured as an input if MCM=0 and an output if MCM=1. In the latter case (internal C5x clock), the device whose MCM=1 supplies the clock (TCLK frequency=one fourth of CLKOUT1 frequency) for all devices on the TDM bus. The clock can be supplied by an external source if MCM=0 for all devices. TFRM can also be supplied externally if TXM=0. An external TFRM, however, must meet TDM receive timing specifications with respect to TCLK for proper operation. No more than one device should have MCM or TXM set to 1 at any given time. The specification of which device is to supply clock and framing signals is typically made only once, during system initialization. The TDM channel select register (TCSR) of a given device specifies in which time slot(s) that device is to transmit. A 1 in any one or more of bits 07 of the TCSR sets the transmitter active during the corresponding time slot. Again, a key system-level constraint is that no more than one device can transmit
9-78
during the same time slot; devices do not check for bus contention, and slots must be consistently assigned. As in TSPC operation, a write to TCSR during a particular frame is valid only during the next frame. However, a given device can transmit in more than one slot. This is discussed in more detail in subsection 9.9.4, TDM Mode Transmit and Receive Operations, on page 9-80, with an emphasis on the utilization of TRTA, TDXR, and TCSR in this respect. The TDM receive/transmit address register (TRTA) of a given device specifies two key pieces of information. The lower half specifies the receive address of the device, while the upper half of TRTA specifies the transmit address. The receive address (RA7RA0, refer to Figure 943) is the 8-bit value that a device compares to the 8-bit value it samples on the TADD line in a particular slot to determine whether it should execute a valid TDM receive. The receive address, therefore, establishes the slots in which that device may receive, dependent on the addresses present in those slots, as specified by the transmitting devices. This process occurs on each device during every slot. The transmit address (TA7TA0, refer to Figure 943) is the address that the device drives on the TADD line during a transmit operation on an assigned slot. The transmit address establishes which receiving devices may execute a valid TDM receive on the driven data. Only one device at a time can drive a transmit address on TADD. Each processor bit-wise-logically-ANDs the value it samples on the TADD line with its receive address (RA7RA0). If this operation results in a nonzero value, then a valid TDM receive is executed on the processor(s) whose receive addresses match the transmitted address. Thus, for one device to transmit to another, there must be at least one bit in the upper half of the transmitting devices TRTA (the transmit address) with a value of 1 that matches one bit with a value of 1 in the lower half of TRTA (the receive address) of the receiving device. This method of configuration of TRTA allows one device to transmit to one or more devices, and for any one device to receive from one or more than one transmitter. This can also allow the transmitting device to control which devices receive, without the receive address on any of the devices having to be changed. The TDM receive address register (TRAD) contains various information regarding the status of the TADD line which can be polled to verify the previous values of this signal and to verify the relationship between instruction cycles and TDM port timing. Bits 1311 (X2X0) contain the current slot number value, regardless of whether a valid data receive was executed in that slot or not. This value is latched at the beginning of the slot and retained only until the end of the slot.
On-Chip Peripherals
9-79
Bits 108 (S02S0) hold the number of the last slot plus one (modulo eight) in which data was received (that is, if the last valid data read occurred in slot 5 in the previous frame, these bits would contain the number six). This value is latched during the TDM receive interrupt (TRNT) at the end of the slot in which the last valid data receive occurred, and maintained until the end of the next slot in which a valid receive occurs. Bits 70 (A7A0) hold the last address sampled on the TADD line, regardless of whether a valid data receive was executed or not. This value is latched halfway through each slot (so the value on the TADD may be shifted in) and maintained until halfway through the next slot, whether a valid receive is executed or not.
9.9.4
9-80
Simultaneous with data transfer, the transmitting device also drives the TADD line with the transmit address for each slot. This information, unlike that on TDAT, is only one byte long and is transmitted with the LSB first for the first half of the slot. During the second half of the slot (that is, the last eight TCLK periods) the TADD line is driven high. The TDM receive logic samples the TADD line only for the first eight TCLK periods, ignoring it during the second half of the slot. Therefore, the transmitting device (if not a C5x) could drive TADD high or low during that time period. Note that, like TDAT, the first TADD bit transmitted lasts for only one half of one TCLK cycle. If no device on the TDM bus is configured to transmit in a slot (that is, none of the devices has a 1 for the corresponding slot in their TCSR register), that slot is considered empty. In an empty slot, both TADD and TDAT are high impedance. This condition has the potential for spurious receives, however, because TDAT and TADD are always sampled, and a device performs a valid TDM reception if its receive address matches the address on the TADD line. To avoid spurious reads, a 1-kilohm pull-down resistor must be tied to the TADD line. This causes the TADD line to read low on empty slots. Otherwise, any noise on the TADD line that happens to match a particular receive address would result in a spurious read. If power dissipation is a concern and the resistor is not desired, then an arbitrary processor with transmit address equal to 0h can drive empty slots by writing to TDXR in those slots. Slot manipulation is explained later in this section. The 1-kilohm resistor is not required on the TDAT line. An empty TDM slot can result in the following cases: the first obvious case, as mentioned above, occurs when no device has its TCSR configured to transmit in that slot. A second more subtle case occurs when TDXR has not been loaded before a transmit slot in a particular frame. This may also happen when the TCSR contents are changed, since the actual TCSR contents are not updated until the next TFRM pulse occurs. Therefore, any subsequent change takes effect only in the next frame. The same is true for the receive address (the lower half of TRTA). The transmit address (upper half of TRTA), however, and TDXR, clearly, may be changed within the current frame for a particular slot, assuming that the slot has not yet been reached when the instruction to load the TRTA or TDXR is executed. Note that it is not necessary to load the transmit address each time TDXR is loaded; when a TDXR load occurs and a transmission begins, the current transmit address in TRTA is transmitted on TADD. The current slot number may be obtained by reading the X2X0 bits in TRAD. This affords the flexibility of reconfiguring the TDM port on a slot-by-slot basis, and even slot sharing if desired. The key to utilizing this capability is to understand the timing relationship between the instructions being executed and the
On-Chip Peripherals
9-81
frame/slots of the TDM port. If the TDM port is to be manipulated on a slot-byslot basis, changes must be made to appropriate registers quickly enough for the desired effect to take place at the desired time. It is also important to take into account that the TCSR and the receive address (lower half of TRTA) take effect only at the start of a new frame, while the transmit address (upper half of TRTA) and TDXR (transmit data) can take effect at the start of a new slot, as mentioned previously. Note that if the transmit address is being changed on the fly, care should be exercised not to corrupt the receive address, since both addresses are located in the TRTA register, thus maintaining the convention of allowing the transmitting device to specify which devices can receive.
9.9.5
9.9.6
9-82
Table 923. TDM Register Contents
Table 923 shows the TDM serial port register contents of each device that results in the scenario given in Table 922. Device 0 provides the clock and frame control signals for all channels and devices. The TCSR and TRTA contents specify which device is to transmit on a given channel and which devices are to receive.
Device 7 6 5 4 3 2 1 0 xxC9h xxC9h xxC9h xxC9h xxC9h xxC9h xxC9h xxF9h TSPC 0FE01h 4080h 2040h 1020h 0810h 0408h 0204h 0102h TRTA TCSR xx02h xx04h xx08h xx10h xx20h xx40h xx80h xx01h
Table 922. Interprocessor Communications Scenario
Channel 7 6 5 4 3 2 1 0 TADD Data 0FEh 01h 02h 04h 08h 10h 20h 40h
Transmitter Device
On-Chip Peripherals
1 2 3 4 5 6 7 0 Receiver Device(s) 17 0 1 2 3 4 5 6
9-83
In this example, the transmit address of a given device (the upper byte of TRTA) matches the receive address (the lower byte of TRTA) of the receiving device. Note, however, that it is not necessary for the transmit and receive addresses to match exactly; the matching operation implemented in the receiver is a bitwise AND operation. Thus, it is only necessary that one bit in the field matches for a receive to occur. The advantage of this scheme is that a transmitting device can select the device or devices to receive its transmitted data by simply changing its transmit address (as long as each devices receive address is unique, the receive address of the receiving device does not need to be changed). In the example, device 0 can transmit to any combination of the other devices by merely writing to the upper byte of TRTA. Therefore, if a transmitting device changed its TRTA to 8001h on the fly, it would transmit only to device 7. A device may also transmit to itself, because both the transmit and receive operations are executed on the rising edge of TCLK (see the data sheet for detailed TDM interface timings). To enable this type of loopback, it is necessary to use the standard TDM port interface connections as shown in Figure 942. Then, if device 0 has a TRTA of 0101h, it would transmit only to itself. Another example of TDM port operation is provided in the code sequence of Example 97 in which a one-way transmit of a sequence of values from device 0 to device 1 is shown. The values are stored in each device in a block from 4000h to 6000h in data memory. Device 0 transmits in slot 0 and has a transmit address of 01h. It waits in a BIO loop for a ready-to-receive signal (XF) from device 1, and initializes the transfer data with a value of 0. Only its transmit interrupt is enabled and its transmit ISR writes the value it will send into its own memory.
9-84
* Device 0 Transmit side : : : SPLK #1h, TCSR SPLK #100h, TRTA ;Setup TCSR to xmt on ;slot 0 ;Setup transmit address ;Set up TSPC as TCLK, TFRM ;source ;Set TXM=MCM=FSM=TDM=1, ;DLB=FO=0. ;And put TDM into reset ;(XRST=RRST=0) ;Take TDM out of reset ;Setup interrupts ;clear IFR ;Turn on TXNT ;enable interrupts ;Wait for readyto ;receive from other device ;First transmission/write ;value is 0. ;Setup where to write ;Write first value ;Transmit first value ;Wait for interrupts ;Check if past 0x6000 ;i.e. end of block ;Go to tight loop if so. ;Add one and transmit ;Load value ;Add one ;Write value ;Transmit value ;Sit in tight loop after ;block is complete.
SPLK #00F9h, TSPC SPLK #0ffffh, IFR SPLK #080h, IMR CLRC INTM TILOOP TSENDZ BCND TSENDZ, BIO B TILOOP LACL #0 LAR AR7, #4000h SACL * SACL TDXR SELF2 _ISR LACC AR7 SUB #6000h BCND END_TDMP, GEQ LACL ADD SACL SACL RETE END_TDMP B *+ #1 * TDXR END_TDMP : : : B SELF2
On-Chip Peripherals
9-85
Example 98 shows the code in device 1. It has a receive address of 01h and sends a ready-to-receive signal (XF) to device 0. Only its receive interrupt is enabled, and its receive ISR reads from the TRCV, writes to the block, and then checks to see if it has reached the end of the block.
SPLK #00C9h, TSPC SPLK #0ffffh, IFR SPLK #040h, IMR CLRC INTM LAR AR7, #4000h CLRC XF SELF2 _ISR LACC SACL LACC SUB BCND RETE END_TDMP B TRCV *+ AR7 #6000h END_TDMP, GEQ END_TDMP B SELF2
; Setup interrupts ; clear IFR ; Mask on TRNT ; ; ; ; enable interrupts Setup where to write received data Signal ready to receive
; Wait for interrupts ; ; ; ; ; Load received value Write to memory block Check if past 0x6000 i.e. end of block Go to tight loop if so
9-86
HD7HD0
Data latch 8 8 16 16 MUX 16 MUX Address register Data Address HPI memory block HPI control logic Host port interface
DSP data
DSP address
On-Chip Peripherals
9-87
The HPI provides 16-bit data to the C5x while maintaining the economical 8-bit external interface by automatically combining successive bytes transferred into 16-bit words. When the host device performs a data transfer with the HPI registers, the HPI control logic automatically performs an access to a dedicated 2K-word block of internal C5x single access RAM to complete the transaction. The C5x can then access the data within its memory space. The HPI RAM can also be used as general purpose single access data or program RAM. The HPI has two modes of operation, shared-access mode (SAM) and hostonly mode (HOM). In shared-access mode, the normal mode of operation, both the C5x and the host can access HPI memory. In this mode, asynchronous host accesses are resynchronized internally and, in the case of a conflict between a C5x and a host cycle, the host has access priority and the C5x waits one cycle. In host-only mode, only the host can access HPI memory while the C5x is in reset or in IDLE2 with all internal and even external clocks stopped. The host can therefore access the HPI RAM while the C5x is in its minimum power consumption configuration. The HPI supports high speed, back-to-back host accesses. In shared-access mode, the HPI can transfer one byte every five CLKOUT1 cycles (that is 64M bps) with the C5x running at a 40-MHz CLKOUT1. The HPI is designed so the host can take advantage of this high bandwidth and run at frequencies up to (Fd*n)/5, where Fd is the C5x CLKOUT1 frequency and n is the number of host cycles for an external access. Therefore, with a 40-MHz C5x and common values of 4 (or 3) for n, the host can run at speeds of up to 32 (or 24) MHz without requiring wait states. In the host-only mode, the HPI supports even higher speed back-to-back host accesses on the order of one byte every 50 ns (that is, 160M bps), independent of the C5x clock rate (refer to the TMS320C5x data sheet for specific detailed timing information).
9-88
8 DATA HD0HD7 2 ADDRESS R/W HCNTL0/1 (address) HBIL (1st/2nd byte) HR/W HDS1 HDS2 HCS HAS Sampled by internal strobe or HAS DATA STROBE Internal strobe (controls transfer) ALE (if used) (Samples ADDRESS and R/W signals, if used) HINT READY HRDY INTERRUPT
Host device
C5x
The 8-bit data bus (HD0HD7) exchanges information with the host. Because of the 16-bit word structure of the C5x, all transfers with a host must consist of two consecutive bytes. The dedicated HBIL pin indicates whether the first or second byte is being transferred. An internal control register bit determines whether the first or second byte is placed into the most significant byte of a 16-bit word. The host must not break the first byte/second byte (HBIL low/high) sequence of an ongoing HPI access. If this sequence is broken, data can be lost, and unpredictable operation can result.
The two control inputs (HCNTL0 and HCNTL1) indicate which internal HPI register is being accessed and the type of access to the register. These inputs, along with HBIL, are commonly driven by host address bus bits or a function of these bits. Using the HCNTL0/1 inputs, the host can specify an access to the HPI control (HPIC) register, the HPI address (HPIA) register (which serves as the pointer into HPI memory), or HPI data (HPID) register. The HPID register can also be accessed with an optional automatic address increment. The autoincrement feature provides a convenient way of reading or writing to subsequent word locations. In autoincrement mode, a data read causes a postincrement of the HPIA, and a data write causes a preincrement of the HPIA. By writing to the HPIC, the host can interrupt the C5x CPU, and the HINT output can be used by the C5x to interrupt the host. The host can also acknowledge and clear HINT by writing to the HPIC.
On-Chip Peripherals
9-89
Table 924 summarizes the three registers that the HPI utilizes for communication between the host device and the C5x CPU and their functions.
The two data strobes (HDS1 and HDS2), the read/write strobe (HR/W), and the address strobe (HAS) enable the HPI to interface to a variety of industrystandard host devices with little or no additional logic required. The HPI is easily interfaced to hosts with multiplexed address/data bus, separate address and data buses, one data strobe and a read/write strobe, or two separate strobes for read and write. This is described in detail later in this section. The HPI ready pin (HRDY) allows insertion of wait states for hosts that support a ready input to allow deferred completion of access cycles and have faster cycle times than the HPI can accept due to C5x operating clock rates. If HRDY, when used directly from the C5x, does not meet host timing requirements, the signal can be resynchronized using external logic if necessary. HRDY is useful when the C5x operating frequency is variable, or when the host is capable of accessing at a faster rate than the maximum shared-access mode access rate (up to the host-only mode maximum access rate). In both cases, the HRDY pin provides a convenient way to automatically (no software handshake needed) adjust the host access rate to a faster C5x clock rate or switch the HPI mode. All of these features combined allow the HPI to provide a flexible and efficient interface to a wide variety of industry-standard host devices. Also, the simplicity of the HPI interface greatly simplifies data transfers both from the host and the C5x sides of the interface. Once the interface is configured, data transfers are made with a minimum of overhead at a maximum speed.
9-90
Table 925. HPI Signal Names and Functions
HPI Pin HAS Host Pin State Signal Function I Address latch enable (ALE) or Address strobe or unused (tied high) Address strobe input. Hosts with a multiplexed address and data bus connect HAS to their ALE pin or equivalent. HBIL, HCNTL0/1, and HR/W are then latched on HAS falling edge. When used, HAS must precede the later of HCS, HDS1, or HDS2 (see C5x data sheet for detailed HPI timing specifications). Hosts with separate address and data bus can connect HAS to a logic-1 level. In this case, HBIL, HCNTL0/1, and HR/W are latched by the later of HDS1, HDS2, or HCS falling edge while HAS stays inactive (high). HBIL Address or control lines I Byte identification input. Identifies first or second byte of transfer (but not most significant or least significant this is specified by the BOB bit in the HPIC register, described later in this section). HBIL is low for the first byte and high for the second byte. Host control inputs. Selects a host access to the HPIA register, the HPI data latches (with optional address increment), or the HPIC register. HCNTL0, HCNTL1 HCS Address or control lines Address or control lines I I Chip select. Serves as the enable input for the HPI and must be low during an access but may stay low between accesses. HCS normally precedes HDS1 and HDS2, but this signal also samples HCNTL0/1, HR/W, and HBIL if HAS is not used and HDS1 or HDS2 are already low (this is explained in further detail later in this subsection). Figure 947 on page 9-93 shows the equivalent circuit of the HCS, HDS1 and HDS2 inputs.
I: O: Z: Input Output High impedance
On-Chip Peripherals
9-91
Table 925. HPI Signal Names and Functions (Continued)
HPI Pin Host Pin Data bus State I/O/Z Signal Function HD7HD0 Parallel bidirectional 3-state data bus. HD7 (MSB) through HD0 (LSB) are placed in the high-impedance state when not outputting (HDSx and HCS = 1) or when EMU1/OFF is active (low). HDS1, HDS2 Read strobe and write strobe or data strobe I Data strobe inputs. Control transfer of data during host access cycles. Also, when HAS is not used, used to sample HBIL, HCNTL0/1, and HR/W when HCS is already low (which is the case in normal operation). Hosts with separate read and write strobes connect those strobes to either HDS1 or HDS2. Hosts with a single data strobe connect it to either HDS1 or HDS2, connecting the unused pin high. Regardless of HDS connections, HR/W is still required to determine direction of transfer. Because HDS1 and HDS2 are internally exclusive-NORed, hosts with a high true data strobe can connect this to one of the HDS inputs with the other HDS input connected low. Figure 947 on page 9-93 shows the equivalent circuit of the HDS1, HDS2, and HCS inputs. Host interrupt output. Controlled by the HINT bit in the HPIC. Driven high when the C5x is being reset. Placed in high impedance when EMU1/OFF is active (low). HINT Host interrupt input O/Z HRDY Asynchronous ready O/Z HPI ready output. When high, indicates that the HPI is ready for a transfer to be performed. When low, indicates that the HPI is busy completing the internal portion of the previous transaction. Placed in high impedance when EMU1/OFF is active (low). HCS enables HRDY; that is, HRDY is always high when HCS is high. HR/W Read/Write strobe, address line, or multiplexed address/data I Read/write input. Hosts must drive HR/W high to read HPI and low to write HPI. Hosts without a read/write strobe can use an address line for this function.
I: O: Z: Input Output High impedance
9-92
The HCS input serves primarily as the enable input for the HPI, and the HDS1 and HDS2 signals control the HPI data transfer; however, the logic with which these inputs are implemented allows their functions to be interchanged if desired. If HCS is used in place of HDS1 and HDS2 to control HPI access cycles, HRDY operation is affected (since HCS enables HRDY and HRDY is always high when HCS is high). The equivalent circuit for these inputs is shown in Figure 947. The figure shows that the internal strobe signal that samples the HCNTL0/1, HBIL, and HR/W inputs (when HAS is not used) is derived from all three of the input signals, as the logic illustrates. Therefore, the latest of HDS1, HDS2, or HCS is the one which actually controls sampling of the HCNTL0/1, HBIL, and HR/W inputs. Because HDS1 and HDS2 are exclusive-NORed, both these inputs being low does not constitute an enabled condition.
HDS1 HDS2
When using the HAS input to sample HCNTL0/1, HBIL and HR/W, this allows these signals to be removed earlier in an access cycle, therefore allowing more time to switch bus states from address to data information, facilitating interface to multiplexed address and data type buses. In this type of system, an ALE signal is often provided and would normally be the signal connected to HAS. The two control pins (HCNTL0 and HCNTL1) indicate which internal HPI register is being accessed and the type of access to the register. The states of these two pins select access to the HPI address (HPIA), HPI data (HPID), or HPI control (HPIC) registers. The HPIA register serves as the pointer into HPI memory, the HPIC contains control and status bits for the transfers, and the HPID contains the actual data transferred. Additionally, the HPID register can be accessed with an optional automatic address increment. Table 926 describes the HCNTL0/1 bit functions.
On-Chip Peripherals
9-93
HCNTL1 0 0 1 1 HCNTL0 0 1 0 1 Description Host can read or write the HPI control register, HPIC. Host can read or write the HPI data latches. HPIA is automatically postincremented each time a read is performed and preincremented each time a write is performed. Host can read or write the address register, HPIA. This register points to the HPI memory. Host can read or write the HPI data latches. HPIA is not affected.
On the C57, HPI memory is a 2K 16-bit word block of single-access RAM that can be configured to reside either from 1000h to 17FFh in data memory space or from 8800h to 8FFFh in program memory space. As with all singleaccess RAM blocks, the HPI RAM is affected by the ROM protection feature, if it is enabled. Also, the HPI memory may be located at different addresses on other C5x devices; consult the specific product documentation. From the host interface, the 2K-word block of HPI memory can conveniently be accessed at addresses 0 through 7FFh; however, the memory can also be accessed by the host starting with any HPIA values with the 11 LSBs equal to 0. For example, the first word of the HPI memory block, addressed at 1000h by the C57 in data memory space, can be accessed by the host with any of the following HPIA values: 0000h, 0800h,1000h,1800h, ... F800h. The HPI autoincrement feature provides a convenient way of accessing consecutive word locations in HPI memory. In the autoincrement mode, a data read causes a postincrement of the HPIA, and a data write causes a preincrement of the HPIA. Therefore, if a write is to be made to the first word of HPI memory with the increment option, due to the preincrement nature of the write operation, the HPIA should first be loaded with any of the following values: 07FFh, 0FFFh, 17FFh, ... FFFFh. The HPIA is a 16-bit register and all 16 bits can be written to or read from, although with a 2K-word HPI memory implementation, only the 11 LSBs of the HPIA are required to address the HPI memory. The HPIA increment and decrement affect all 16 bits of this register.
Bit Host Access Read/Write C5x Access Description BOB If BOB = 1, first byte is least significant. If BOB = 0, first byte is most significant. BOB affects both data and address transfers. Only the host can modify this bit and it is not visible to the C5x. BOB must be initialized before the first data or address register access. DSPINT Write The host processor-to-C5x interrupt. This bit can be written only by the host and is not readable by the host or the C5x. When the host writes a 1 to this bit, an interrupt is generated to the C5x. Writing a 0 to this bit has no effect. Always read as 0. When the host writes to HPIC, both bytes must write the same value. See this subsection for a detailed description of DSPINT function. This bit determines the state of the C5x HINT output, which can be used to generate an interrupt to the host. HINT = 0 upon reset, which causes the external HINT output to be inactive (high). The HINT bit can be set only by the C5x and can be cleared only by the host. The C5x writes a 1 to HINT, causing the HINT pin to go low. The HINT bit is read by the host or the C5x as a 0 when the external HINT pin is inactive (high) and as a 1 when the HINT pin is active (low). For the host to clear the interrupt, however, it must write a 1 to HINT. Writing a 0 to the HINT bit by either the host or the C5x has no effect. See this subsection for a detailed description of HINT function. HINT Read/Write Read/Write SMOD Read Read/Write If SMOD = 1, shared-access mode (SAM) is enabled: the HPI memory can be accessed by the C5x. If SMOD = 0, host-only mode (HOM) is enabled: the C5x is denied access to the entire HPI RAM block. SMOD = 0 during reset; SMOD = 1 after reset. SMOD can be modified only by the C5x but can be read by both the C5x and the host.
Because the host interface always performs transfers with 8-bit bytes and the control register is normally the first register accessed to set configuration bits and initialize the interface, the HPIC is organized on the host side as a 16-bit register with the same high and low byte contents (although access to certain bits is limited, as described previously) and with the upper bits unused on the C5x side. The control/status bits are located in the least significant four bits. The host accesses the HPIC register with the appropriate selection of HCNTL0/1, as described previously, and two consecutive byte accesses to the 8-bit HPI data bus. When the host writes to HPIC, both the first and second byte written must be the same value. The C57 accesses the HPIC at 500h in data memory space.
On-Chip Peripherals
9-95
The layout of the HPIC bits is shown in Figure 948 through Figure 951. In the figures for read operations, if 0 is specified, this value is always read; if X is specified, an unknown value is read. For write operations, if X is specified, any value can be written. On a host write, both bytes must be identical. Note that bits 47 and 1215 on the host side and bits 415 on the C5x side are reserved for future expansion.
1512 X 11 10 0 9 8 74 X 3 2 0 1 0 HINT SMOD BOB HINT SMOD BOB
Note: X = Unknown value is read.
74 X
HINT
DSPINT
BOB
HINT DSPINT
BOB
Note:
2 0
0 0
HINT
SMOD
Note:
HINT
SMOD
Note:
Because the C5x can write to the SMOD and HINT bits, and these bits are read twice on the host interface side, the first and second byte reads by the host may yield different data if the C5x changes the state of one or both of these bits in between the two read operations. The characteristics of host and C5x HPIC read/write cycles are summarized in Table 928.
9-96
Device Host C5x Read Write 2 bytes 16 bits 2 bytes (Both bytes must be equal) 16 bits
In a typical external access, as shown in Figure 952, the cycle begins with the host driving HCNTL0/1, HR/W, HBIL and HCS, indicating specifically what type of transfer is to occur and whether the cycle is to be read or a write. Then the host asserts the HAS signal (if used) followed by one of the data strobe signals. If HRDY is not already high, it goes high when the previous internal cycle is complete, allowing data to be transferred, and the control signals are deasserted. Following the external HPI cycle, HRDY goes low and stays low for a period of approximately five CLKOUT1 cycles (refer to C5x data sheet for HPI timing information) while the C5x completes the internal HPI memory access, and then HRDY is driven high again. Note, however, HRDY is always high when HCS is high. As mentioned previously, SAM accesses generally utilize the HRDY signal. The exception to the HRDY-based interface timings when in SAM occurs when reading HPIC or HPIA or writing to HPIC (except when writing 1 to either DSPINT or HINT). In these cases, HRDY stays high; for all other SAM accesses, HRDY is active.
9-98
Valid Valid Valid Valid
Host access cycles when in HOM have timings different from the SAM timings described previously. In HOM, the CPU is not involved (with one exception), and the access can be completed after a short, fixed delay time. The exception to this occurs when writing 1s to the DSPINT or HINT bits in HPIC. In this case, the host access takes several CPU clock cycles, and SAM timings apply. Besides the HRDY timings and a faster cycle time, HOM access cycles are logically the same as SAM access cycles. A summary of the conditions under which the HRDY signal is active (where SAM timings apply) for host accesses is shown in Table 929. When HRDY is not active (HRDY stays high), HOM timings apply. Refer to the C5x data sheet for detailed HPI timing specifications.
A complete host access cycle always involves two bytes, the first with HBIL low, and the second with HBIL high. This 2-byte sequence must be followed regardless of the type of host access (HPIA, HPIC, or data access) and the host must not break the first byte/second byte (HBIL low/high) sequence of an ongoing HPI access. If this sequence is broken, data may be lost, and unpredictable operation may result. Before accessing data, the host must first initialize HPIC, in particular the BOB bit, and then HPIA (in this order, because BOB affects the HPIA access). After initializing BOB, the host can then write to HPIA with the correct byte alignment. On an HPI memory read operation, after completion of the HPIA write, the HPI memory is read and the contents at the given address are transferred to the two 8-bit data latches, the first byte data latch and the second byte data latch. Table 930 illustrates the sequence involved in initializing BOB and HPIA for an HPI memory read. In this example, BOB is set to 0 and a read is requested of the first HPI memory location (in this case 1000h), which contains FFFEh.
On-Chip Peripherals
9-99
Wait State Generated Writes Register HPIA Reads No HOM No SAM Yes HPIC No 1 to DSPINT/HINT Yes All other cycles No HOM No HPID HOM No SAM Yes SAM Yes
Event HD 00 00 10 00 HR/W 0 0 0 0 HCNTL1/0 00 00 10 10 HBIL 0 1 0 1 HPIC 00xx HPIA xxxx xxxx latch1 xxxx xxxx xxxx xxxx FF latch2 xxxx xxxx xxxx xxxx FE Host writes HPIC, 1st byte Host writes HPIC, 2nd byte Host writes HPIA, 1st byte 0000 0000 10xx Host writes HPIA, 2nd byte 1000 1000 Internal HPI RAM read complete
In the cycle shown in Table 930, BOB and HPIA are initialized, and by loading HPIA, an internal HPI memory access is initiated. The last line of Table 930 shows the condition of the HPI after the internal RAM read is complete; that is, after some delay following the end of the host write of the second byte to HPIA, the read is completed and the data has been placed in the upper and lower byte data latches. For the host to actually retrieve this data, it must perform an additional read of HPID. During this HPID read access, the contents of the first byte data latch appears on the HD pins when HBIL is low and the content of the second byte data latch appears on the HD pins when HBIL is high. Then the address is incremented if autoincrement is selected and the memory is read again into the data latches. Note that the address autoincrement occurs between the transfers of the first and second bytes. The sequence involved in this access is shown in Table 931.
Event HD FF HR/W 1 1 HCNTL1/0 01 01 HBIL 0 1 HPIC 0000 0000 HPIA 1000 1001 1001 latch1 FF FF latch2 FE FE Host reads data, 1st byte Host reads data, 2nd byte FE Internal HPI RAM read complete 6A BC
In the access shown in Table 931, the data obtained from reading HPID is the data from the read initiated in the previous cycle (the one shown in Table 930) and the access performed as shown in Table 931 also initiates a further read, this time at location 1001h (because autoincrement was specified in this access by setting HCNTL1/0 to 01). Also, when autoincrement is selected, the increment occurs with each 16-bit word transferred (not with each byte); therefore, as shown in Table 931, the HPIA is incremented by only 1. The last line of Table 931 indicates that after the second internal RAM read is complete, the contents of location 1001h (6ABCh) has been read and placed into the upper and lower byte data latches.
9-100
During a write access to the HPI, the first byte data latch is overwritten by the data coming from the host while the HBIL pin is low, and the second byte data latch is overwritten by the data coming from the host while the HBIL pin is high. At the end of this write access, the data in both data latches is transferred as a 16-bit word to the HPI memory at the address specified by the HPIA register. The address is incremented prior to the memory write because autoincrement is selected. An HPI write access is illustrated in Table 932. In this example, after the internal portion of the write is completed, location 1002h of HPI RAM contains 1234h. If a read of the same address follows this write, the same data just written in the data latches (1234h) is read back.
Event HD 12 34 HR/W 0 0 HCNTL1/0 01 01 HBIL 0 1 HPIC 0000 0000 HPIA 1001 1002 1002 latch1 12 12 12 latch2 FE 34 34 Host writes data, 1st byte Host writes data, 2nd byte Internal HPI RAM write complete
The host and the C5x can interrupt each other using bits in the HPIC register. This subsection presents more information about this process.
Host Port Interface (C5x) Using HINT to Interrupt the Host Device
When the C5x writes a 1 to the HINT bit in HPIC, the HINT output is driven low; the HINT bit is then read as a 1 by the C5x or the host. The HINT signal can be used to interrupt the host device. The host device, after detecting the HINT interrupt line, can acknowledge and clear the C5x interrupt and the HINT bit by writing a 1 to the HINT bit. The HINT bit is cleared and then read as a 0 by the C5x or the host, and the HINT pin is driven high. If the C5x or the host writes a 0, the HINT bit remains unchanged. While accessing the SMOD bit, the C5x should not write a 1 to the HINT bit unless it also wants to interrupt the host.
9.10.5 Considerations in Changing HPI Memory Access Mode (SAM/HOM) and IDLE2 Use
The HPI host-only mode (HOM) allows the host to access HPI RAM while the C5x is in IDLE2 (that is, completely halted). Additionally, the external clock input to the C5x can be stopped for the lowest power consumption configuration. Under these conditions, random accesses can still be made without having to restart the external clock for each access and wait for its lockup time if the C5x on-chip PLL is used. The external clock need only be restarted before taking the C5x out of IDLE2. The host cannot access HPI RAM in SAM when the C5x is in IDLE2, because CPU clocks are required for access in this mode of operation. Therefore, if the host requires access to the HPI RAM while the C5x is in IDLE2, the C5x must change HPI mode to HOM before entering IDLE2. When the HPI is in HOM, the C5x can access HPIC to toggle the SMOD bit or send an interrupt to the host, but cannot access the HPI RAM block; a C5x access to the HPI RAM is disregarded in HOM. In order for the C5x to again access the HPI RAM block, HPI mode must be changed to SAM after exiting IDLE2. To select HOM, a 0 must be written to the SMOD bit in HPIC. To select SAM, a 1 must be written to SMOD. When changing between HOM and SAM, two considerations must be met for proper operation. First, the instruction immediately following the one that changes from SAM to HOM must not be an IDLE2. This is because in this case, due to the C5x pipeline and delays in the SAM to HOM mode switch, the IDLE2 takes effect before the mode switch occurs, causing the HPI to remain in SAM; therefore, no host accesses can occur. The second consideration is that when changing from HOM to SAM, the instruction immediately following the one that changes from HOM to SAM cannot read the HPI RAM block. This requirement is due to the fact that the mode has not yet changed when the HPI RAM read occurs and the RAM read is
9-102
ignored because the mode switch has not yet occurred. HPI RAM writes are not included in this restriction because these operations occur much later in the pipeline, so it is possible to write to HPI RAM in the instruction following the one which changes from HOM to SAM. On the host side, there are no specific considerations associated with the mode changes. For example, it is possible to have a third device wake up the C5x from IDLE2 and the C5x changing to SAM upon wake-up without a software handshake with the host. The host can continue accessing while the HPI mode changes. However, if the host accesses the HPI RAM while the mode is being changed, the actual mode change will be delayed until the host access is completed. In this case, a C5x access to the HPI memory is also delayed. Table 933 illustrates the sequence of events involved in entering and exiting an IDLE2 state on the C5x when using the HPI. Throughout the process, the HPI is accessible to the host.
Host or Other Device C5x Mode HOM HOM HOM HOM C5x clock Running Running Running Switches mode to HOM Executes a NOP Executes IDLE2 instruction In IDLE2 May stop DSP clock Stopped or running Running Running Running Running Turns on DSP clock if it was stopped Sends an interrupt to DSP In IDLE2 In IDLE2 HOM HOM HOM SAM C5x wakes up from IDLE2 C5x switches mode to SAM
Sufficient wake-up time must be ensured when the C5x on-chip PLL is used.
The C5x is not operational during reset, but the host can access the HPI, allowing program or data downloads to the HPI memory. When this capability is used, it is often convenient for the host to control the C5x reset input. The sequence of events for resetting the C5x and downloading a program to HPI memory while the C5x is in reset is summarized in Table 934 and corresponds to the reset of the C5x.
On-Chip Peripherals
9-103
Initially, the host stops accessing the HPI at least six C5x periods before driving the C5x reset line low. The host then drives the C5x reset line low and can start accessing the HPI after a minimum of four C5x periods. The HPI mode is automatically set to HOM during reset, allowing high-speed program download. The C5x clock can even be stopped at this time; however, the clock must be running when the reset line falls and rises for proper reset operation of the C5x. Once the host has finished downloading into HPI memory, the host stops accessing the HPI and drives the C5x reset line high. At least 20 C5x periods after the reset line rising edge, the host can again begin accessing the HPI. This number of periods corresponds to the internal reset delay of the C5x. The HPI mode is automatically set to SAM upon exiting reset. On the C5x, the RAM and OVLY bits must be set to 1 after reset for the HPI memory to be mapped into C5x program and data space, as with other singleaccess RAM blocks. The host, however, can access the HPI memory regardless of the status of these two bits. Also, if the host writes a 1 to DSPINT while the C5x is in reset, the interrupt is lost when the C5x comes out of reset. The C5x warm boot can use the HPI memory and start execution from the lowest HPI address.
Host C5x Mode X C5x clock Running Running Waits 6 C5x clock periods Running Brings RESET low and waits 4 clocks Can stop C5x clock Goes into reset In reset In reset In reset In reset HOM HOM HOM HOM HOM SAM SAM Stopped or Running Stopped or Running Running Running Running Running Writes program and/or data in HPI memory Turns on DSP clock if it was stopped Brings RESET high Waits 20 C5x clock periods Can access HPI Comes out of reset Running
Sufficient wake-up time must be ensured when the C5x on-chip PLL is used.
9-104
Appendix A Appendix A
Topic
A.1 A.2 A.3 A.4 A.5 A.6 A.7
Page
100-Pin QFP Pinout (C52) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 100-Pin TQFP Pinout (C51, C52, C53S, and LC56) . . . . . . . . . . . . . . A-4 128-Pin TQFP Pinout (LC57) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-6 132-Pin BQFP Pinout (C50, C51, and C53) . . . . . . . . . . . . . . . . . . . . . A-8 144-Pin TQFP Pinout (C57S) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-10 100-Pin TQFP Device-Specific Pinouts . . . . . . . . . . . . . . . . . . . . . . . . . A-12 Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-13
A-1
D9 D10 D11 D12 D13 D14 D15 MP/MC VSSI D8 VDDD VSSD VSSD D7 D6 D5 D4 D3 D2 D1 D0 TMS VDDD VDDD TCK VSSD VSSD INT1 INT2 INT3 INT4 NMI DR VSSI FSR CLKR VDDA VSSA A0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81
TRST
EMU1/OFF EMU0 VDDC VDDC VDDI VDDI CLKOUT1 XF HOLDA NC DX VSSI FSX CLKMD2 VSSI VSSI TDO VDDC X1 X2/CLKIN CLKIN2 BR STRB R/W PS IS DS VSSC WE RD
74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
A13
Note:
NC
A-2
A-3
Figure A2. Pin/Signal Assignments for the C51, C52, C53S, and LC56 in 100-Pin TQFP
CLKOUT1 XF HOLDA VDDC VDDI VDDI TDO VDDC X1 X2/CLKIN CLKMD2 VSSI VSSI DS VSSC BR STRB R/W
100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76
EMU0 EMU1/OFF VSSC TOUT * * * * RS READY HOLD BIO TRST VSSI VSSI MP/MC D15 D14 D13 D12 D11 D10 D9 D8 VDDD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
PS IS
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
WE RD VDDA A15 A14 A13 A12 A11 A10 CLKMD1 VSSA VSSA TDI VDDI A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 VSSA
VSSD VSSD
Note:
These pins are reserved for specific devices (see Table A6 on page A-12).
A-4
VDDA
INT1
Table A2. Signal/Pin Assignments for the C51, C52, C53S, and LC56 in 100-Pin TQFP
Signal A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 BR BIO CLKMD1 CLKMD2 CLKOUT1 D0 D1 D2 D3 D4 D5 D6 D7 D8
Legend: *
Pin 52 53 54 55 56 57 58 59 60 61 67 68 69 70 71 72 82 12 66 90 97 35 34 33 32 31 30 29 28 24
Signal D9 D10 D11 D12 D13 D14 D15 DS EMU0 EMU1/OFF HOLD HOLDA INT1 INT2 INT3 INT4 IS MP/MC NMI PS READY RD RS R/W STRB TCK TDI TDO TMS TRST
Pin 23 22 21 20 19 18 17 77 1 2 11 95 41 42 43 44 78 16 45 79 10 74 9 80 81 38 63 87 36 13
Signal VDDA VDDA VDDC VDDC VDDD VDDD VDDI VDDI VDDI
TOUT
Pin 50 73 86 100 25 37 62 98 99 4 65 64 51 3 76 26 27 39 40 14 15 88 89 75 85 84 96 5 6 7
Signal * * * * * * * * * *
Pin 8 46 47 48 49 83 91 92 93 94
VSSA VSSA VSSA VSSC VSSC VSSD VSSD VSSD VSSD VSSI VSSI VSSI VSSI WE X1 X2/CLKIN XF * * *
These pins are reserved for specific devices (see Table A6 on page A-12).
A-5
VDDC VDDI
VDDC X1
DS HD2 VSSC
128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97
VSSC
96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65
STRB
VSSI TDO
BR HD3
R/W
PS IS
HINT EMU0 EMU1/OFF VSSC VSSC TOUT BCLKX CLKX VDDC BFSR BCLKR RS READY HOLD BIO VDDC VDDC IAQ TRST VSSI VSSI MP/MC D15 D14 D13 D12 D11 D10 D9 D8 VDDD VDDD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
WE HD1 RD HD0 HRDY VDDA A15 A14 A13 A12 A11 A10 CLKMD1 VSSA VSSA TDI HDS1 HDS2 VDDI VDDI A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 VSSA HCS
HCNTL1 VDDD
HR/W INT1
VDDD TCK
NMI DR
VSSD VSSD
A-6
INT2
HAS
A-7
Figure A4. Pin/Signal Assignments for the C50, C51, and C53 in 132-Pin BQFP
TCLKR TFSR/TADD CLKX TCLKX TOUT VSSC VSSC EMU1/OFF
D8 D9 D10 D11 D12 D13 D14 D15 MP/MC VSSI VSSI TRST IAQ VDDC VDDC
READY RS
NC NC VDDD VDDD
17 16 15 14 13 12 11 10
1 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116
NC NC VSSD VSSD NC D7 D6 D5 D4 D3 D2 D1 D0 TMS VDDD VDDD TCK VSSD VSSD NC INT1 INT2 INT3 INT4 NMI DR TDR FSR CLKR VDDA VDDA NC NC
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
BIO HOLD
EMU0 NC
115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84
NC NC VDDI VDDI IACK NC CLKOUT1 XF HOLDA TDX DX TFSX/TFRM FSX CLKMD2 VSSI VSSI TDO VDDC VDDC X1 X2/CLKIN CLKIN2 BR STRB R/W PS IS DS NC VSSC VSSC NC NC
VDDA VDDA
Note:
NC
A-8
RD WE
NC NC
Table A4. Signal/Pin Assignments for the C50, C51, and C53 in 132-Pin BQFP
Signal A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 BR BIO CLKIN2 CLKMD1 CLKMD2 CLKOUT1 CLKR CLKX D0 D1 D2 D3 D4 D5 Pin 55 56 57 58 59 60 61 62 63 64 72 73 74 75 76 77 94 130 95 71 103 110 46 124 30 29 28 27 26 25 Signal D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 DR DS DX EMU0 EMU1/OFF FSR FSX HOLD HOLDA IACK IAQ INT1 INT2 INT3 INT4 IS MP/MC NMI PS READY Pin 24 23 13 12 11 10 9 8 7 6 43 89 106 118 119 45 104 129 108 112 1 38 39 40 41 90 5 42 91 128 Signal RD RS R/W STRB TCK TCLKR TCLKX TDI TDO TDR TDX TMS TOUT TRST TFSR/TADD TFSX/TFRM VDDC VDDC VDDA VDDA VDDA VDDA VDDC VDDC VDDD VDDD VDDD VDDD VDDI VDDI Pin 82 127 92 93 34 126 123 67 100 44 107 31 122 2 125 105 131 132 47 48 80 81 98 99 14 15 32 33 113 114 Signal VDDI VDDI VSSA VSSA VSSA VSSA VSSC VSSC VSSC VSSC VSSD VSSD VSSD VSSD VSSI VSSI VSSI VSSI WE X1 X2/CLKIN XF { { { { { { { { Pin 65 66 53 54 68 69 86 87 121 120 20 21 35 36 3 4 101 102 83 97 96 109 16 17 18 19 22 37 49 50 Signal { { {
{
{ { { { { { { {
A-9
HINT EMU0 NC EMU1/OFF VSSC VSSC TOUT BCLKX CLKX VDDC BFSR BCLKR RS READY HOLD NC BIO VDDC VDDC IAQ TRST VSSI VSSI MP/MC D15 D14 D13 NC D12 D11 D10 D9 NC D8 VDDD VDDD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
WE HD1 RD HD0 HRDY VDDA A15 NC A14 A13 A12 NC A11 A10 CLKMD1 VSSA VSSA TDI HDS1 HDS2 VDDI VDDI A9 A8 A7 NC A6 A5 A4 A3 NC A2 A1 A0 VSSA HCS
49 50 51 52
53 54 55 56
Note:
NC
A-10
VSSD V SSD D7 D6 NC D5 D4 D3 NC D2 D1 D0 HCNTL0 TMS HCNTL1 VDDD VDDD TCK VSSD VSSD NC HR/W INT1 INT2 INT3 INT4 HBIL NMI DR BDR FSR CLKR V DDA V DDA HAS NC
57 58 59 60
A-11
Table A6. Device-Specific Pin/Signal Assignments for the C51, C52, C53S, and LC56 in 100-Pin TQFP
Pin 5 6} 7 8 46} 47 48} 49} 83 91} 92 93} 94 C51 TCLKX CLKX TFSR/TADD TCLKR DR TDR FSR CLKR CLKIN2 FSX TFSX/TFRM DX TDX C52 VSSI CLKX VSSI VSSI DR VSSI FSR CLKR CLKIN2 FSX VSSI DX NC C53S CLKX2 CLKX1 FSR2 CLKR2 DR1 DR2 FSR1 CLKR1 CLKIN2 FSX1 FSX2 DX1 DX2 LC56 BCLKX CLKX BFSR BCLKR DR BDR FSR CLKR CLKMD3 FSX BFSX DX BDX
Pin names beginning with B indicate signals on the buffered serial port (BSP). No change in function. NC = These pins are not connected (reserved).
A-12
Signal Descriptions
State I/O/Z
Description Parallel, bidirectional, 3-state address bus A15 (MSB) through A0 (LSB). Multiplexed to address external data/program memory or I/O. Placed in high-impedance state in hold mode or when OFF { is active (low). These signals are used as inputs for external DMA access of the on-chip single-access RAM. They become inputs while HOLDA is active low, if the BR pin is externally driven low.
I/O/Z
Parallel, bidirectional, 3-state data bus D15 (MSB) through D0 (LSB). Multiplexed to transfer data between the core CPU and external data/program memory or I/O devices. Placed in high-impedance state when not outputting, when RS or HOLD is asserted, or when OFF { is active (low). These signals are also used in external DMA access of the on-chip single-access RAM.
Input pins that are unused may be connected to VDD or to an external pullup resistor. The BR pin has an internal pullup for performing DMA to the on-chip RAM. Legend: I Input O Output Z High impedance { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
A-13
Signal Descriptions
O/Z
READY
R/W
I/O/Z
STRB
I/O/Z
WE
O/Z
Input pins that are unused may be connected to VDD or to an external pullup resistor. The BR pin has an internal pullup for performing DMA to the on-chip RAM. Legend: I Input O Output Z High impedance { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
Note:
A-14
Signal Descriptions
HOLD
HOLDA
O/Z
IACK
O/Z
IAQ
O/Z
XF
O/Z
Note:
Input pins that are unused may be connected to VDD or to an external pullup resistor. The BR pin has an internal pullup for performing DMA to the on-chip RAM. Legend: I Input O Output Z High impedance { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
A-15
Signal Descriptions
NMI
RS
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: S Supply
A-16
Signal Descriptions
TOUT X1
O O
X2/CLKIN
I I I
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input O Output Z High impedance { This pin is not available on the LC56, C57S, and LC57 devices. } The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state. This pin is not available on the C50, C51, C52, C53, and C53S devices.
A-17
Signal Descriptions
Table A13. Oscillator/Timer Standard Options (C50, C51, C52, C53, and C53S Only)
Signal CLKMD1 CLKMD2 State I CLKMD1 CLKMD2 0 0
-
Clock Mode PLL disabled Internal oscillator disabled Input clock provided to X2/CLKIN pin External clock with divide-by-2 option Reserved for test purposes PLL enabled Internal oscillator disabled Input clock provided to CLKIN2 pin External clock option: For C50, C51, C53, and C53S: multiply-by-1 option For C52: multiply-by-2 option PLL disabled Internal oscillator enabled Input clock provided to X2/CLKIN pin Internal or external divide-by-2 option
0 1
1 0
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input
A-18
Signal Descriptions
Table A14. Oscillator/Timer Expanded Options (LC56, C57S, and LC57 Only)
Signal CLKMD1 CLKMD2 CLKMD3 State I CLKMD1 CLKMD2 CLKMD3 0 0 0
-
Clock Mode PLL enabled Internal oscillator disabled External multiply-by-3 option Internal oscillator disabled External divide-by-2 option PLL enabled Internal oscillator disabled External multiply-by-4 option PLL enabled Internal oscillator disabled External multiply-by-2 option PLL enabled Internal oscillator disabled External multiply-by-5 option PLL enabled Internal oscillator disabled External multiply-by-1 option PLL enabled Internal oscillator disabled External multiply-by-9 option Internal oscillator enabled External/internal divide-by-2 option
0 0
0 1
1 0
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input
A-19
Signal Descriptions
O/Z
Transmitted serial data. The XSR transmits serial data through this pin. This pin is placed in a high-impedance state when not transmitting and also when the OFF { signal is active (low). Receive frame synchronization. The falling edge of these pulses initiates the data receive process, beginning the clocking of the RSR. TFSR becomes an input/output (TADD) pin when the C50, C51, and the C53 are operating in TDM mode (TDM bit = 1). In TDM mode, this pin is used to output/input the address of the port. This signal goes into high impedance when OFF { is active (low). Transmit frame synchronization. The falling edge of these pulses initiates the data transmit process, beginning the clocking of the XSR. Following reset, the default operating condition of these pulses is an input. This pin can be selected by software to be an output when the TXM bit in the SPC (TSPC) is set. This signal goes into high impedance when the OFF { signal is active (low). When the C50, C51, and C53 are operating in the TDM mode (TDM bit = 1), the TFSX pin becomes TFRM (TDM frame synch).
I/O/Z
I/O/Z
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input O Output Z High impedance { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
A-20
Signal Descriptions
Table A16. Buffered Serial Port Interface Signal Descriptions (LC56 and C57 Only)
Signal BCLKR State I Description Receive clock signal. External clock signal for clocking data into the data receive shift register (BRSR) from the data receive (BDR) pin. Data is clocked on the falling edge of BCLKR, if the CLKP bit in the BSP control extension register (SPCE) is cleared; data is clocked on the rising edge of BCLKR, if the CLKP bit is set. If the serial port is not used, this pin can be sampled as an input via the IN0 bit in the SPC. Transmit clock signal. Clock signal for clocking data from the data transmit shift register (BXSR) to the data transmit (BDX) pin. Data is clocked on the rising edge of CLKX, if the CLKP bit in the SPCE is cleared; data is clocked on the falling edge of CLKX, if the CLKP bit is set. CLKX can be an input if the MCM bit in the BSP control register (BSPC) is cleared. When the MCM bit of BSPC is set to 1, CLKX is driven by an on-chip source having a frequency equal to 1/(CLKDV+1) of CLKOUT. CLKDV value is defined in SPCE. When CLKDV is odd or equal to 0, the CLKX duty cycle is 50%. When CLKDV is an even value (CLKDV=2p), the CLKX high and low state durations depend on CLKP. When CLKP is 0, the high state duration is p+1 cycles and the low state duration is p cycles; when CLKP is 1, the high state duration is p cycles and the low state duration is p+1 cycles. Following device reset, the default operating condition of CLKX is an input. If the serial port is not used, this pin can be sampled as an input via the IN1 bit in the SPC. Received serial data. The BRSR receives serial data through this input pin. Transmitted serial data. The BXSR transmits serial data through this pin. This pin is placed in a high-impedance state when not transmitting and also when the OFF { signal is active (low). Receive frame synchronization. This signal initiates the data receive process. Upon reset, BFSR is active high. BFSR can be configured as active low by setting the FSP bit in the SPCE. Transmit frame synchronization. This signal initiates the data transmit process. Upon reset, BFSX is an input signal. BFSX can be configured as an output by setting the TXM bit in the SPC. Upon reset, BFSX is active high. BFSX can be configured as active low by setting the FSP bit in the SPCE.
BCLKX
I/O/Z
BDR BDX
I O/Z
BFSR
BFSX
I/O/Z
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input O Output Z High impedance { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
A-21
Signal Descriptions
HBIL
HCNTL0 HCNTL1
Host can read or write the HPI data latches. HPIA postincremented when data is read HPIA preincremented when data is written Host can read or write the HPIA. HPIA points to the HPI memory. DSP does not have access to the HPIA.
1 HCS I
Host can read or write the HPI data latches. HPIA is not affected.
Chip select input. Serves as the enable input for the HPI and must be low during an access but may stay low between accesses. HCS normally precedes HDS1 and HDS2, but this signal also samples HCNTL0/1, HR/W, and HBIL if HAS is not used and HDS1 or HDS2 are already low. Parallel, bidirectional, 3-state data bus. HD7 (MSB) through HD0 (LSB) are placed in high-impedance state when not outputting (HDSx and HCS = 1) or when OFF { is active (low).
HD7 (MSB) HD6 HD5 HD4 HD3 HD2 HD1 HD0 (LSB)
I/O/Z
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input O Output Z High impedance S Supply { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
A-22
Signal Descriptions
Table A17. Host Port Interface Signal Descriptions (C57 Only) (Continued)
Signal HDS1 HDS2 State I Description Data strobe input. Control transfer of data during host access cycles. Also, when HAS is not used, used to sample HBIL, HCNTL0/1, and HR/W when HCS is already low (which is the case in normal operation). Hosts with separate read and write strobes connect those strobes to either HDS1 or HDS2. Hosts with a single data strobe connect it to either HDS1 or HDS2, connecting the unused pin high. Regardless of HDS connections, HR/W is still required to determine direction of transfer. Because HDS1 and HDS2 are internally exclusive-NORed, hosts with a high true data strobe can connect this to one of the HDS inputs with the other HDS input connected low. Host interrupt. Controlled by the HINT bit in the HPIC. This pin driven high when the C5x is being reset. Placed in high impedance when OFF { is active (low). HPI ready output. When high, indicates that the HPI is ready for a transfer to be performed. When low, indicates that the HPI is busy completing the internal portion of the previous transaction. Placed in high impedance when OFF { is active (low). HCS enables HRDY; that is, HRDY is always high when HCS is high. Read/write input. Hosts must drive HR/W high to read HPI and low to write HPI. Hosts without a R/W strobe can use an address line.
HINT HRDY
O/Z O/Z
HR/W
Note: Input pins that are unused may be connected to VDD or to an external pullup resistor. Legend: I Input O Output Z High impedance S Supply { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
A-23
Signal Descriptions
TDI TDO
I O/Z
TMS TRST
I I
EMU0
I/O/Z
EMU1/OFF
I/O/Z
Input pins that are unused may be connected to VDD or to an external pullup resistor. For emulation, TRST has an internal pulldown, and TMS, TCK, and TDI have internal pullups. EMU0 and EMU1 require external pullups to support emulation. Legend: I Input O Output Z High impedance { The OFF signal, when active (low), puts all C5x output drivers into the high-impedance state.
A-24
Appendix B Appendix A
Topic
B.1 B.2
Page
Cycle Class-to-Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . B-2 Instruction Set-to-Cycle Class Summary . . . . . . . . . . . . . . . . . . . . . . . . B-5
B-1
Class IIA
1 word, 1 cycle, memorymapped register read 2 words, 2 cycles, longimmediate operand, no memory access, not repeatable 1 word, 1 cycle, memory write operand 1 word, 1 cycle, memorymapped register write 1 word, 1 cycle, memory read and write 2 words, 2 cycles, memory read and write 2 words, 2 cycles, memory read operand 2 words, 2 cycles, memory write operand, not repeatable
Class IVA Class IVB Class V Class VI Class VIIa Class VIIb
POPD, SACH, SACL, SAR, SPH, SPL, SST SAMM APL, DMOV, LTD, OPL, XPL APL, OPL, XPL CPL #lk SPLK
Bold typeface indicates instructions that are new for the C5x instruction set. ADD #k, ADRK #k, LACL #k, MPY #k, RPT, SBRK #k, SPM, SUB #k, and XC are not repeatable instructions.
B-2
Class IX
Class X
Class XI
Class XV
BLPD
Class XVI
BLDP
Bold typeface indicates instructions that are new for the C5x instruction set. ADD #k, ADRK #k, LACL #k, MPY #k, RPT, SBRK #k, SPM, SUB #k, and XC are not repeatable instructions.
B-3
Class XXIIX
RPT #k
Bold typeface indicates instructions that are new for the C5x instruction set. ADD #k, ADRK #k, LACL #k, MPY #k, RPT, SBRK #k, SPM, SUB #k, and XC are not repeatable instructions.
B-4
Bold typeface indicates instructions that are new for the C5x instruction set.
B-5
Bold typeface indicates instructions that are new for the C5x instruction set.
B-6
Bold typeface indicates instructions that are new for the C5x instruction set.
B-7
LDP LDP #k
6-127 6-127
LMMR LPH LST LT LTA LTD LTP LTS MAC MACD MADD MADS MAR MPY MPY #k MPY #lk
Class XXIII Class IIA Class XXVII Class IIA Class IIA Class V Class IIA Class IIA Class XIX Class XXI Class XXII Class XX Class I Class IIA Class I Class III
6-130 6-133 6-135 6-138 6-140 6-142 6-145 6-147 6-149 6-153 6-158 6-162 6-166 6-168 6-168 6-168
Bold typeface indicates instructions that are new for the C5x instruction set.
B-8
Bold typeface indicates instructions that are new for the C5x instruction set.
B-9
Bold typeface indicates instructions that are new for the C5x instruction set.
B-10
Bold typeface indicates instructions that are new for the C5x instruction set.
B-11
Bold typeface indicates instructions that are new for the C5x instruction set.
B-12
Appendix C Appendix A
System Migration
This appendix contains information that is necessary to upgrade a C2x system into a C5x system. The information consists of a detailed list of the programming differences and hardware and timing differences between the two generations of TMS320 DSPs. Note that the C50, C51, and C53 have the same features with the exception of memory map; so within this appendix, any reference to C5x applies to C50, C51, and C53, unless otherwise stated.
Topic
C.1 C.2 C.3 C.4
Page
Package and Pin Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-8 On-Chip Peripheral Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-11 C2x-to-C5x Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-12
System Migration
C-1
1,575 (0.062) Dia 1,473(0.058) 2,54 (0.100) T.P. L K J H G F E D C B A 1 2 3 4 5 6 7 8 9 10 11 1,27 (0.050) Nom 1,524 (0.060) Nom 4 places Bottom view 2,54 (0.100) T.P.
Thermal Resistance Characteristics Parameter RJA RJC Junction-to-free-air thermal resistance Junction-to-case thermal resistance Max 36 6 Unit C/W C/W
C-2
Thermal Resistance Characteristics Parameter RJA RJC Junction-to-free-air thermal resistance Junction-to-case thermal resistance Max 46 11 Unit C/W C/W
0,51 (0.020) 0,36 (0.014) Lead Detail Notes: A. Centerline of center pin, each side, is within 0,10 (0.004) of package centerline as determined by this dimension. B. Location of each pin is within 0,127 (0.005) of true position with respect to center pin on each side. ALL LINEAR DIMENSIONS ARE IN MILLIMETERS AND PARENTHETICALLY IN INCHES. 0,64 (0.025) Min
23,62 (0.930) 23,11 (0.910) (At Seating Plane) 25,27 (0.995) 25,02 (0.985) 1,27 (0.050) T.P. (See Note B) 24,33 (0.956) 24,13 (0.950) (see Note A) 1,22 (0.048) 1,07 (0.042) 0,94 (0.037) R 0,69 (0.027) Seating Plane 25,27 (0.995) 25,02 (0.985) 45 0,81 (0.032) 0,66 (0.026) 1,52 (0.060) Min
System Migration
C-3
When a C25 is upgraded to a C50, C51, or C53, there is minimal layout modification. The C5x signals are on the same side (except the CLKR and A0 pins), and in the same order (except the X1 and X2/CLKIN pins) as those of the C25. Figure C3 shows the pin-to-pin relationship between the C25 and the C5x devices in J-leaded chip carrier packages. The two devices are not drawn to scale. The power (VDD) and ground (VSS) signals are symmetrically positioned on the C5x so that, in conjunction with the OFF signal, the device is not damaged by inserting it in the wrong orientation. The C5x has more power and ground pins to provide higher performance and more noise immunity than the C25.
C-4
D7 D6 D5 D4 D3 D2 D1 D0 TMS VDD VDD TCK VSS VSS INT1 INT2 INT3 INT4 NMI DR TDR FSR CLKR VDD VDD
D8 D9 D10 D11 D12 D13 D14 D15 MP/MC BIO HOLD READY RS CLKR CLKX VCC VCC
VSS VSS
VDD VDD IACK CLKOUT1 XF HOLDA TDX DX TFSX/TFRM FSX CLKMD2 VSS VSS TDO VDD VDD X1 X2/CLKIN CLKIN2 BR STRB R/W PS IS DS VSS VSS
C25
51 52 53 54 55 56 57 58 59
Note:
Three C25 signals (CLKOUT2, MSC and SYNC) are not present on the C5x. Because the C5x operates with a divide-by-two clock, it can be synchronized with reset. Therefore, there is no need for the SYNC signal. With only two phases, there are no external timings that tie to the CLKOUT2 of the C25. Some of the C25-equivalent pins have additional capabilities on the C5x. The C5x supports external direct memory access of the on-chip single-access RAM block. For this reason, the following signals are now bidirectional:
System Migration
C-5
VDD VDD RD WE
Address lines, A0A15 Memory access strobe, STRB Read/write, R/W Bus request, BR
The C5x serial port transmit clock (CLKX) can now be configured as an output that operates at one-fourth the machine clock rate. CLKX is configured as an input by reset. The C25 CLKX pin is always an input. The C25 operates with a four-phase clock. The C25 machine rate is one-fourth the CLKIN rate. CLKOUT1 and CLKOUT2 operate at the machine rate and are 90 out of phase. The C5x operates with a two-phase clock. The C5x machine rate is one-half the CLKIN rate. In addition, the C5x offers a divide-by-one clock input feature so that the C5x machine rate equals the CLKIN rate. CLKOUT1 operates at the machine rate. Figure C4 shows both the C25 and the C5x clocking schemes.
C5x
CLKIN CLKOUT1
The C5x MP/MC pin is sampled only while RS is low. Changes on this pin are ignored while RS is high. The mode can be changed during execution by changing the MP/MC bit in the PMST. On the C25, any change on the MP/MC pin affects the operation of the device, regardless of the state of RS. The C5x IACK signal goes low only on the first machine cycle of the fetch of the first word of the interrupt vector. The C25 IACK goes low on each wait-state cycle, as well as on the first machine cycle, but it is valid only during CLKOUT1 low (during CLKOUT1 high, it has a specific meaning for emulator/ test operations). Figure C5 illustrates this difference.
C-6
C25
IACK
C5x
IACK
The C5x device includes some additional functions not included with the C25. These functions and associated pins are as follows:
- TDM serial port: TCLKR, TCLKX, TDR, TDX, TADD, TFRM - Emulation interface: EMU0, EMU1/OFF, IAQ, TCK, TDI, TDO, TMS,
TRST
- Timer borrow: TOUT - Divide-by-one clock: CLKIN2, CLKMD1, and CLKMD2 - Fourth external interrupt: INT4 - Nonmaskable interrupt: NMI - Read enable: RD - Write enable: WE
The C5x package also includes 12 additional power and 13 additional ground pins. These additional power and ground pins enable the device to operate at much faster speeds. Twenty pins are reserved for future C5x spinoff devices.
System Migration
C-7
Timing
C.2 Timing
The C2x and the C5x operate with some timing differences. These timing differences include aspects of the on-chip operation and the external memory interfacing. These key differences are:
- The C5x is capable of operating at two to three times the speed of a C2x. - The C2x operates with a three-deep pipeline, while the C5x operates with
a four-deep pipeline.
- The C5x external memory interface is faster and includes external inter-
face enhancements.
- Some compatible operations execute in a different number of machine
cycles.
C.2.2 Pipeline
The C2x operates with a three-deep pipeline, while the C5x operates with a four-deep pipeline. This means that anytime there is a program counter (PC) discontinuity (for example, branch, call, return, interrupt, etc.), it takes four cycles to complete with the C5x, whereas it takes three cycles on the C2x. The C5x, however, also has delayed instructions that take only two cycles to complete.
Timing
The C5x has two additional memory interface signals to reduce the amount of external interfacing circuitries. The RD signal can be used to interface directly to the output enable pin of another device, while the WE signal can be directly connected to the write enable pin of another device. This alleviates the need of gating STRB and R/W to generate the equivalent signals.
System Migration
C-9
Timing
Unlike the C2x, the ARs are also accessible in the data address space on the C5x. This allows the ARs to be loaded with the CALU instructions for advanced-addressing modes. However, use caution when using this feature because the CALU operations write to the ARs on the execute phase of the pipeline and, therefore, are subject to the same characteristics of the NORM instruction. The assembler supports the option to flag these conflicts for resolution.
C-10
C.4.1 Overview
There are a number of new instructions on the C5x devices. These new instructions provide an advanced addressing scheme and exercise the new CPU enhancements. To simplify the description of the instruction set, a number of different instructions are combined into single new instructions with additional operand formats, such as the ADD instruction shown in Table C1.
The IDLE instruction, when executed, stops the CPU from fetching and executing instructions until an unmasked interrupt occurs. The C2x automatically enables the interrupts globally with the execution of the IDLE instruction; this saves the extra instruction word/cycle required to execute the EINT (enable interrupts globally) instruction. Upon receipt of the interrupt, the C2x executes the interrupt vector and resumes operations. The C5x does not automatically enable the interrupts globally with its IDLE instruction. If the interrupts are not globally enabled (INTM = 1), then the CPU resumes execution at the instruction following the IDLE instruction, without taking the interrupt trap. If the interrupts are globally enabled (INTM = 0), the C5x operates like the C2x. In addition, a second low-power mode is available with the IDLE2 instruction. This mode operates the same as IDLE, except that the CPU will resume only after an external interrupt. See Chapter 6, Assembly Language Instructions, for IDLE and IDLE2 instruction details. The C5x repeat counter is 16 bits wide (the C2x repeat counter is 8 bits wide). This means that, when loading from RAM, the RPT instruction supports repeat counts up to 65 536. The assembler also allows the RPT to support a16-bit immediate repeat count. Note that RPT with long immediate addressing is, however, a two-word instruction.
C-12
Any or all three of the SPC bits can be set in one execution of the OPL instruction, while any or all three of the bits can be cleared with the APL instruction. The SPC bits can be toggled with the XPL instruction. See Chapter 6, Assembly Language Instructions, for instruction details.
on page C-15) TREG0, PREG, and multiply instructions (Table C5 on page C-16) Branch and call instructions (Table C6 on page C-17) I/O and data memory operation instructions (Table C7 on page C-18) Control instructions (Table C8 on page C-19)
System Migration
C-13
There is a potential pipeline conflict with the NORM instruction. See the NORM instruction summary (page 6-181) for details.
C-14
Table C4. TMS320C2x-to-TMS320C5x Auxiliary Registers and Data Memory Page Pointer Instructions
C2x Instruction ADRK CMPR LAR LARK LARP LDP LDPK LRLK MAR SAR SBRK C5x Instruction ADRK CMPR LAR LAR MAR LDP LDP LAR MAR SAR SBRK
System Migration
C-15
C-16
System Migration
C-17
The suggested mapping requires that the data page pointer be set to 0.
C-18
System Migration
C-19
Appendix D Appendix A
FAX:
Topic
D.1 D.2 D.3 D.4 D.5 D.6 D.7 D.8
Page
Cable Header and Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-2 Bus Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-3 Emulator Cable Pod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-4 Emulator Cable Pod Signal Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-6 Target System Test Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-7 Configuring Multiple Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-8 Connections Between the Emulator and the Target System . . . . . . . D-9 Emulation Timing Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-11
D-1
Header Dimensions: Pin-to-pin spacing: 0.100 in. (X,Y) Pin width: 0.025 in. square post Pin length: 0.235 in., nominal
7 9
TDO TCK_RET
I I
O O
11
TCK
13 14
EMU0 EMU1
I I
I/O I/O
D-2
Bus Protocol
of the device.
- The TDO output is clocked from the falling edge of the TCK signal of the
device. When JTAG devices are daisy-chained together, the TDO of one device has approximately a half TCK cycle setup time before the next devices TDI signal. This timing scheme minimizes race conditions that would occur if both TDO and TDI were timed from the same TCK edge. The penalty for this timing scheme is a reduced TCK frequency. The IEEE standard 1149.1 does not provide rules for JTAG bus master (XDS510) devices. Instead, it states that it expects a bus master to provide bus slave compatible timings. The XDS510 provides timings that meet the bus slave rules and also provides an optional timing mode that allows you to run the emulation at a much higher frequency for improved performance.
D-3
(48 mA IOL/IOH), this signal can be parallel-terminated. If TCK is tied to TCK_RET, you can use the parallel terminator in the pod.
- TMS and TDI can be generated from the falling edge of TCK_RET, accord-
ing to the IEEE (JTAG) standard 1149.1 bus slave device timing rules. They can also be driven from the rising edge of TCK_RET, which allows a higher TCK_RET frequency. The default is to match the IEEE standard 1149.1 slave device timing rules. This is an emulator software option that can be selected when the emulator is invoked. In general, single-processor applications can benefit from the higher clock frequency. However, in multiprocessing applications, you may wish to use the IEEE standard 1149.1 bus slave timing mode to minimize emulation system timing constraints.
- TMS and TDI are series-terminated to reduce signal reflections. - A 10-MHz test clock source is provided. You can also provide your own
D-4
Q 74F175 D Q 33 258 33
TDO (Pin 7)
D-5
TDO
D-6
PD
D-7
through the same physical device package for better control of timing skew.
- The input buffers for TMS, TDI, and TCK should have pullup resistors con-
nected to 5 volts to hold these signals at a known value when the emulator is not connected. A pullup resistor value of 4.7 k or greater is suggested.
- Buffering EMU0 and EMU1 is optional but highly recommended to provide
isolation. These are not critical signals and do not have to be buffered through the same physical package as TMS, TCK, TDI, and TDO.
D-8
D-9
D-10
There are two key timing paths to consider in the emulation design: 1) the TCK_RET/TMS/TDI (tprdtck_TMS) path, and 2) the TCK_RET/TDO (tprdtck_TDO) path. In each case, the worst-case path delay is calculated to determine the maximum system test clock frequency.
D-11
Case 1:
Single processor, direct connection, TMS/TDI timed from TCK_RET low (default timing). tprdtck_TMS = = = = = = [t(d(XTMSmax) + tsu(TTMS)] / ttckfactor (20 ns + 10 ns) / 0 .4 75 ns (13.3 MHz) [t(d(TTDO) + tsu(XTDOmin)] / ttckfactor (15 ns + 3 ns) / 0.4 45 ns (22.2 MHz)
tprdtck_TDO
In Case 1, the TCK/TMS path is the limiting factor. Case 2: Single processor, direct connection, TMS/TDI timed from TCK_RET high (optional timing). tprdtck_TMS = = = = = = td(XTMSmax) + tsu(TTMS) (24 ns + 10 ns) 34 ns (29.4 MHz) [td(TTDO) + tsu(XTDOmin)] / ttckfactor (15 + 3) / 0.4 45 ns (22.2 MHz)
tprdtck_TDO
In Case 2, the TCK/TDO path is the limiting factor. One other thing to consider in this case is the TMS/TDI hold time. The minimum hold time for the XDS510 cable pod is 7 ns, which meets the 5-ns hold time of the target device. Case 3: Single/multiple processor, TMS/TDI buffered input; TCK_RET/TDO buffered output, TMS/TDI timed from TCK_RET high (optional timing). tprdtck_TMS = = = = = = td(XTMSmax) + tsu(TTMS) + 2 td(bufmax) 24 ns + 10 ns + 2 (10) 54 ns (18.5 MHz) [td(TTDO) + tsu(XTDOmin) + t(bufskew)] / ttckfactor (15 ns + 3 ns + 1.35 ns) / 0.4 58.4 ns (20.7 MHz)
tprdtck_TDO
In Case 3, the TCK/TMS path is the limiting factor. The hold time on TMS/TDI is also reduced by the buffer skew (1.35 ns) but still meets the minimum device hold time.
D-12
Case 4:
Single/multiprocessor, TMS/TDI/TCK buffered input; TDO buffered output, TMS/TDI timed from TCK_RET low (default timing). tprdtck_TMS = = = = = = [td(XTMSmax) + tsu(TTMS) + tbufskew] / tckfactor (24 ns + 10 ns + 1.35 ns) / 0.4 88.4 ns (11.3 MHz) [td(TTDO) + tsu(XTDOmin) + td(bufmax)] / tckfactor (15 ns + 3 ns + 10 ns) / 0.4 70 ns (14.3 MHz)
tprdtck_TDO
In Case 4, the TCK/TMS path is the limiting factor. In a multiprocessor application, it is necessary to ensure that the EMU0 and EMU1 lines can go from a logic low level to a logic high level in less than 10 s. This can be calculated as follows (remember that t = 5 RC): trise = = = 5(Rpullup Ndevices Cload_per_device) 5(4.7k 16 15pF) 5.64 s
D-13
Appendix E Appendix A
Topic
E.1 E.2 E.3
Page
Memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-2 Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-2 Crystals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-3
E-1
E.1 Memories
This section provides product information on EPROM memories that can be interfaced with C5x processors. Refer to Digital Signal Processing Applications with the TMS320 Family for additional information on interfaces using memories and analog conversion devices. Data sheets for EPROM memories are located in the MOS Memory Data Book (literature number SMYD095): TMS27C64 TMS27C128 TMS27C256 TMS27C512 Another EPROM memory, TMS27C291/292, is described in a data sheet (literature number SMLS291).
E.2 Sockets
AMP manufactures a 132-pin quad flat pack socket for the C5x devices. There are two pieces a base (the socket itself) and a lid. The part numbers are:
- Base: AMP part number 821942-1 - Lid: AMP part number 821949-5
For additional information about TI sockets, contact the nearest TI sales office or: Texas Instruments Incorporated Connector Systems Dept, M/S 143 Attleboro, MA 02703 (617) 6995242/5269 Telex: 927708
E-2
Crystals
E.3 Crystals
This section lists the commonly used crystal frequencies (Table E1), crystal specification requirements, and the names of suitable vendors.
When connected across X1 and X2/CLKIN of the TMS320 processor, a crystal enables the internal oscillator. Crystal specification requirements are listed below: Load capacitance = 20 pF Series resistance = 30 ohm Power dissipation = 1 mW Vendors of crystals suitable for use with TMS320 devices are listed below: RXD, Inc. Norfolk, NB (800) 2288108 N.E.L. Frequency Controls, Inc. Burlington, WI (414) 7633591 CTS Knight, Inc. Contact the local distributor.
E-3
Appendix F Appendix A
Topic
F.1 F.2 F.3
Page
Single-Chip Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-2 TMS320 Development Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-3 Submitting TMS320 ROM Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-4
F-1
Single-Chip Solution
Greater memory expansion Lower system cost Less hardware and wiring Smaller PCB
If a routine or algorithm is used often, it can be programmed into the on-chip ROM of a TMS320 DSP. TMS320 programs can also be expanded by using external memory; this reduces chip count and allows for a more flexible program memory. Multiple functions are easily implemented by a single device, thus enhancing system capabilities. TMS320 development tools are used to develop, test, refine, and finalize the algorithms. The microprocessor/microcomputer (MP/MC) mode is available on all ROM-coded TMS320 DSP devices when accesses to either on-chip or off-chip memory are required. The microprocessor mode is used to develop, test, and refine a system application. In this mode of operation, the TMS320 acts as a standard microprocessor by using external program memory. When the algorithm has been finalized, the code can be submitted to Texas Instruments for masking into the on-chip program ROM. At that time, the TMS320 becomes a microcomputer that executes customized programs from the onchip ROM. Should the code need changing or upgrading, the TMS320 can once again be used in the microprocessor mode. This shortens the fieldupgrade time and avoids the possibility of inventory obsolescence.
F-2
Customer submits: TMS320 New Code Release Form Print Evaluation and Acceptance Form (PEAF) Purchase order for mask prototypes TMS320 code
Texas Instruments responds: Customer code input into TI system Code sent back to customer for verification
No
No
Customer approves prototypes (minimum production order required) Yes TMS320 production
F-3
3-1/2-inch floppy: COFF format from macro-assembler/linker (preferred) 5-1/4-inch floppy: COFF format from macro-assembler/linker Modem (BBS): COFF format from macro-assembler/linker EPROM (others): TMS27C64 PROM: TBP28S166, TBP28S86
When code is submitted to TI for masking, the code is reformatted to accommodate the TI mask-generation system. System-level verification by the customer is therefore necessary to ensure the reformatting remains transparent and does not affect the execution of the algorithm. The formatting changes involve the removal of address-relocation information (the code address begins at the base address of the ROM in the TMS320 device and progresses without gaps to the last address of the ROM) and the addition of data in the reserved locations of the ROM for device ROM test. Because these changes have been made, a checksum comparison is not a valid means of verification. With each masked-device order, the customer must sign a disclaimer that states: The units to be shipped against this order were assembled, for expediency purposes, on a prototype (that is, nonproduction qualified) manufacturing line, the reliability of which is not fully characterized. Therefore, the anticipated inherent reliability of these prototype units cannot be expressly defined. and a release that states: Any masked ROM device may be resymbolized as TI standard product and resold as though it were an unprogrammed version of the device, at the convenience of Texas Instruments. The use of the ROM-protect feature does not hold for this release statement. Additional risk and charges are involved when the ROM-protect feature is selected. Contact the nearest TI Field Sales Office for more information on procedures, leadtimes, and cost associated with the ROM-protect feature.
F-4
Appendix G Appendix A
Topic
G.1 G.2 G.3
Page
Development Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2 Part Order Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-4 Hewlett-Packard E2442A Preprocessor C5x Interface . . . . . . . . . . . . G-8
G-1
Development Support
G-2
Development Support
DSP fundamentals C5x architecture/instruction set Use of the PC-based software simulator Use of the C5x assembler/linker C programming environment System architecture considerations Memory and I/O interfacing Serial ports and multiple processor features
G.1.4 Assistance
For assistance to TMS320 questions on device problems, development tools, documentation, software upgrades, and new products, you can contact TI. See If You Need Assistance in Preface for information.
G-3
TMS
Support Tool Development Evolutionary Flow: TMDX The development-support product that has not yet completed Texas Instruments internal qualification testing. TMDS The development-support product is a fully qualified development support product. TMX and TMP devices, and TMDX development-support tools are shipped with the following disclaimer: Developmental product is intended for internal evaluation purposes. TMS devices and TMDS development-support tools have been fully characterized, and the quality and reliability of the device has been fully demonstrated. Texas Instruments standard warranty applies to these products. Note: It is expected that prototype devices (TMX or TMP) have a greater failure rate than standard production devices. Texas Instruments recommends that these devices not be used in any production system, because their expected end-use failure rate is still undefined. Only qualified production devices should be used.
G-4
Device family 320 = DSP Family Boot loader option Technology C = CMOS E = CMOS EPROM LC = Low-Voltage CMOS (3.3V) VC = Low-Voltage CMOS (3V)
Temperature range H = 0 to 50C L = 0 to 70C A = -40 to 85C S = -55 to 100C M = -55 to 125C Package type FD = Ceramic leadless CC FN = Plastic leaded CC FZ = Ceramic CER-QUAD GB = Ceramic PGA J = Ceramic CER-DIP JD = Ceramic DIP side-brazed N = Plastic DIP PJ = 100-pin plastic EIAJ QFP PQ = 100/132-pin plastic BQFP PZ = 100-pin plastic TQFP PBK = 120/128-pin plastic TQFP PGE = 144-pin plastic TQFP Device C1x DSP: 10 14 15 16 17 C2x DSP: 25 26 C2xx DSP: 203 204 205 209 C3x DSP: 30 31 32 C4x DSP: 40 44 C5x DSP: 50 51 52 53 56 57 C54x DSP: 541 542 543 545 546 548 C8x DSP: 80 82
G-5
Product type 4 = Software 6 = Hardware 8 = Upgrade Model 11 = XDS/11 22 = XDS/22 88 = Upgrade kits
Operating system 02 = C1x VAX/VMS 08 = C1x IBM MS/PC-DOS 22 = C2x VAX/VMS 25 = C2x/C2xx/C5x SPARC 28 = C2x or C1x/C2x/C2xx/C5x IBM MS/PC-DOS 32 = C3x VAX/VMS 38 = C3x IBM MS/PC-DOS 42 = C4x VAX/VMS 48 = C4x IBM MS/PC-DOS 52 = C5x VAX/VMS 55 = C5x or C2xx/C5x SPARC 58 = C5x or C2xx/C5x IBM MS/PC-DOS
G-6
G-7
G.3.1 Capabilities
The preprocessor supports three modes of operation: in the first mode, State per Transfer, the preprocessor clocks the logic analyzer only when a bus transfer is complete. In this mode, wait and halt states are filtered out. In the second mode, CLKOUT1 clocks the logic analyzer every time the microprocessor is clocked. This mode captures all bus states. An example application would be to locate memory locations that do not respond to requests for data. In the third mode, you can use the preprocessor to make timing measurements. The JTAG TAP (test access port) controller can be monitored in realtime. TAP state can be viewed under the predefined label TAP.
G.3.5 Availability
For more information and availability of the Hewlett-Packard E2442A, contact: Hewlett-Packard Company 2000 South Park Place Atlanta, GA 30339 (404) 9807351
G-9
Appendix H Appendix A
Glossary
A
A0A15: External address pins for data/program memory or I/O devices. ABU: See autobuffering unit (ABU). ACC: See accumulator (ACC). ACCB: See accumulator buffer (ACCB). ACCH: See accumulator high byte (ACCH). ACCL: See accumulator low byte (ACCL). accumulator (ACC): A 32-bit register that stores the results of an arithmetic logic unit (ALU) operation and provides an input for subsequent ALU operations. The ACC is accessible in two halves: accumulator high (ACCH) and accumulator low (ACCL). accumulator buffer (ACCB): A 32-bit register that temporarily stores the 32-bit contents of the accumulator (ACC). The ACCB has a direct path back to the arithmetic logic unit (ALU) and can be arithmetically or logically acted upon with the ACC. accumulator high byte (ACCH): The higher 16 bits stored in the accumulator (ACC). See also accumulator. accumulator low byte (ACCL): The lower 16 bits stored in the accumulator (ACC). See also accumulator. address: The logical location of program code or data stored in memory.
addressing mode: The method by which an instruction calculates the location of its required data. address visibility (AVIS) bit: A 1-bit field that allows the internal program address to appear at the TMS320C5x pins so that the internal program address can be traced and the interrupt vector can be decoded in conjunction with IACK when the interrupt vectors reside in on-chip memory. At reset, AVIS = 0. This bit is stored in the processor mode status register (PMST).
H-1
Glossary
AFB: See auxiliary register file bus (AFB). ALU: See arithmetic logic unit (ALU). analog-to-digital (A/D) converter: An 8-bit successive-approximation converter with internal sample-and-hold circuitry that translates an analog signal to a digital signal. AR: See auxiliary register (AR). ARAU: See auxiliary register arithmetic unit ARAU). ARB: See auxiliary register buffer (ARB) bits. ARCR: See auxiliary register compare register (ARCR). arithmetic logic unit (ALU): A 32-bit 2s-complement arithmetic logic unit that has two 32-bit input ports and one 32-bit output port feeding the accumulator (ACC). Provides the logic for arithmetic and Boolean operations. ARP: See auxiliary register pointer (ARP) bits. ARR: See BSP address receive register (ARR). assembler: A software program that creates a machine-language program from a source file containing assembly language instructions, directives, and macro directives. The assembler substitutes absolute operation codes for symbolic operation codes, and absolute or relocatable addresses for symbolic addresses. assembly language instructions: The language in which computer operations are represented by mnemonics. autobuffering receiver enable (BRE) bit: A 1-bit field that enables/disables the autobuffering receiver. At reset, BRE = 0. This bit is stored in the BSP control extension register (SPCE). autobuffering receiver halt (HALTR) bit: A 1-bit field that enables/disables the autobuffer receiver. At reset, HALTR = 0. This bit is stored in the BSP control extension register (SPCE). autobuffering transmitter enable (BXE) bit: A 1-bit field that enables/disables the autobuffering transmitter. At reset, BXE = 0. This bit is stored in the BSP control extension register (SPCE). autobuffering transmitter halt (HALTX) bit: A 1-bit field that enables/disables the autobuffer transmitter. At reset, HALTX = 0. This bit is stored in the BSP control extension extension (SPCE).
H-2
Glossary
autobuffering unit (ABU): An on-chip module that allows the serial port interface to read or write directly to internal memory independently of the central processing unit (CPU). Autobuffering capability can be separately enabled for transmit and receive sections. When autobuffering is disabled, the operation is similar to that of the C5x standard serial port. auxiliary register (AR): Eight 16-bit memory-mapped registers (AR0AR7) that are used for indirect data address pointers, temporary storage, or integer arithmetic processing through the auxiliary register arithmetic unit (ARAU). Each AR is selected by the auxiliary register pointer (ARP). auxiliary register arithmetic unit (ARAU): An unsigned 16-bit arithmetic logic unit that calculates indirect addresses using the auxiliary, index, and compare registers as inputs. auxiliary register buffer (ARB) bits: A 3-bit field that holds the previous value contained in the auxiliary register pointer (ARP). These bits are stored in status register 1 (ST1). auxiliary register compare register (ARCR): A 16-bit memory-mapped register used as a limit to compare indirect adresses. auxiliary register file bus (AFB): The bus on which the currently selected auxiliary register (AR) addresses the data memory location. auxiliary register pointer (ARP) bits: A 3-bit field that selects the auxiliary register (AR) to use in indirect addressing. When the ARP is loaded, the previous ARP value is copied to the auxiliary register buffer (ARB). The ARP can be modified by memory-reference instructions when using indirect addressing, and by the MAR and LST instructions. These bits are stored in status register 0 (ST0). AVIS: See address visibility (AVIS) bit. AXR: See BSP address transmit register (AXR).
B
barrel shifter: A unit that rotates bits in a word. See also POSTSCALER and PRESCALER. BIG bit: A 1-bit field that specifies how the input/out (I/O) port wait-state register is mapped. This bit is stored in the wait-state control register (CWSR). At reset, BIG = 0. bit-reversed addressing: A method of indirect addressing that allows efficient I/O operations by resequencing the data points in a radix-2 FFT program. The direction of carry propagation in the ARAU is reversed.
Glossary
H-3
Glossary
BKR: See BSP receive buffer size register (BKR). BKX: See BSP transmit buffer size register (BKX). block move address register (BMAR): A 16-bit memory-mapped register that holds an address value for use with block moves or multiply/accumulates. block repeat active flag (BRAF) bit: A 1-bit field that indicates a block repeat is currently active. This bit is normally set when the RPTB instruction is executed and is cleared when the BRCR register decrements below 0. Writing a 0 to this bit deactivates block repeat. At reset, BRAF = 0. This bit is stored in the processor mode status register (PMST). block repeat counter register (BRCR): A 16-bit memory-mapped register that limits the number of times a block is repeated. block repeat program address end register (PAER): A 16-bit memorymapped register that contains the end address of the segment of code being repeated. block repeat program address start register (PASR): A 16-bit memorymapped register that contains the start address of the segment of code being repeated. BMAR: See block move address register (BMAR). BOB: See byte ordering bit (BOB). boot: The process of loading a program into program memory.
boot loader: A built-in segment of code that transfers code from an external source to program memory at power-up. BRAF: See block repeat active flag (BRAF) bit. BRCR: See block repeat counter register (BRCR). BRE: See autobuffering receiver enable (BRE) bit. BSP: See buffered serial port (BSP). BSP address receive register (ARR): An 11-bit memory-mapped register that stores the address for writing a word to be transferred from the data receive register (DRR) to C5x internal memory. When autobuffering is enabled (BRE = 1), the ARR is no longer available for software access as a memory-mapped register.
H-4
Glossary
BSP address transmit register (AXR): An 11-bit memory-mapped register that stores the address for reading a word to be transferred from C5x internal memory to the data transmit register (DXR). When autobuffering is enabled (BXE = 1), the AXR is no longer available for software access as a memory-mapped register. BSP control extension register (SPCE): A 16-bit memory-mapped register that contains status and control bits for the buffered serial port (BSP) interface. The 10 LSBs of the SPCE are dedicated to serial port interface control, whereas the 6 MSBs are used for autobuffering unit (ABU) control. BSP receive buffer size register (BKR): An 11-bit memory-mapped register that stores the address block size for writing a word to be transferred from the data receive register (DRR) to C5x internal memory. When autobuffering is enabled (BRE = 1), the BKR is no longer available for software access as a memory-mapped register. BSP transmit buffer size register (BKX): An 11-bit memory-mapped register that stores the address block size for reading a word to be transferred from C5x internal memory to the data transmit register (DXR). When autobuffering is enabled (BXE = 1), the BKX is no longer available for software access as a memory-mapped register. buffered serial port (BSP): An on-chip module that consists of a full-duplex, double-buffered serial port interface and an autobuffering unit (ABU). The double-buffered serial port of the BSP is an enhanced version of that available in other TMS320C5x devices (C50, C51, C52, and C53). The double-buffered serial port allows transfer of a continuous communication stream (8-,10-,12- or 16-bit data packets). Status and control of the BSP is specified in the BSP control extension register (SPCE). burst mode: A synchronous serial port mode in which a single word is transmitted following a frame synchronization pulse (FSX and FSR). butterfly: A kernel function that computes an N-point fast Fourier transform (FFT), where N is a power of 2. The combinational pattern of inputs resembles butterfly wings. BXE: See autobuffering transmitter enable (BXE) bit. byte ordering bit (BOB): A 1-bit field that affects host processor data and address transfers when using the host port interface. Only the host processor can toggle this bit. The BOB must be initialized before the first data or address register access. This bit is stored in the HPI control register (HPIC).
Glossary
H-5
Glossary
C
C: See carry (C) bit. CALU: See central arithmetic logic unit (CALU). CAR1: See circular buffer 1 auxiliary register (CAR1) bits. CAR2: See circular buffer 2 auxiliary register (CAR2) bits. carry (C) bit: A 1-bit field that stores the carry output of the arithmetic logic unit (ALU). At reset, C = 1. The C bit can be tested by conditional instructions. This bit is stored in status register 1 (ST1). CBCR: See circular buffer control register (CBCR). CBER1: See circular buffer 1 end register (CBER1). CBER2: See circular buffer 2 end register (CBER2). CBSR1: See circular buffer 1 start register (CBSR1). CBSR2: See circular buffer 2 start register (CBSR2). CENB1: See circular buffer 1 enable (CENB1) bit. CENB2: See circular buffer 2 enable (CENB2) bit. central arithmetic logic unit (CALU): A 32-bit arithmetic logic unit that executes 32-bit operations in a single machine cycle. The CALU consists of the arithmetic logic unit (ALU), multiplier (MULT), accumulator (ACC), accumulator buffer (ACCB), and scaling shifters (PRESCALERS, P-SCALER, and POSTSCALER). central processing unit (CPU): The module of the TMS320C5x that controls and interprets the machine-language program and its execution. The CPU consists of the central arithmetic logic unit (CALU), parallel logic unit (PLU), auxiliary register arithmetic unit (ARAU), and registers. circular buffer 1 auxiliary register (CAR1) bits: A 3-bit field that identifies which auxiliary register (AR) is assigned to circular buffer 1. These bits are stored in the circular buffer control register (CBCR). circular buffer 1 enable (CENB1) bit: A 1-bit field that enables/disables circular buffer 1. At reset, CENB1 = 0. This bit is stored in the circular buffer control register (CBCR). circular buffer 1 end register (CBER1): A 16-bit memory-mapped register that indicates the circular buffer 1 end address.
H-6
Glossary
circular buffer 1 start register (CBSR1): A 16-bit memory-mapped register that indicates the circular buffer 1 start address. circular buffer 2 auxiliary register (CAR2) bits: A 3-bit field that identifies which auxiliary register (AR) is assigned to circular buffer 2. These bits are stored in the circular buffer control register (CBCR). circular buffer 2 enable (CENB2) bit: A 1-bit field that enables/disables circular buffer 2. At reset, CENB2 = 0. This bit is stored in the circular buffer control register (CBCR). circular buffer 2 end register (CBER2): A 16-bit memory-mapped register that indicates the circular buffer 2 end address. circular buffer 2 start register (CBSR2): A 16-bit memory-mapped register that indicates the circular buffer 2 start address. circular buffer control register (CBCR): An 8-bit memory-mapped register that enables/disables the circular buffers (CENB1 and CENB2 bits) and defines which auxiliary registers (CAR1 and CAR2 bits) are mapped to the circular buffers. CLKDV: See internal transmit clock division factor (CLKDV) bits. CLKP: See clock polarity (CLKP) bit. clock modes: Options used by the clock generator to change the internal CPU clock frequency to a fraction or multiple of the frequency of the input clock signal. clock mode (MCM) bit: A 1-bit field that specifies the source of the clock for CLKX. At reset, MCM = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). clock polarity (CLKP) bit: A 1-bit field that indicates when the data is sampled by the receiver and sent by the transmitter. At reset, CLKP = 0. This bit is stored in the BSP control extension register (SPCE). CNF: See configuration control (CNF) bit. code: A set of instructions written to perform a task.
cold boot: The process of loading a program into program memory at power-up. configuration control (CNF) bit: A 1-bit field that indicates if on-chip dualaccess RAM block 0 (DARAM B0) is mapped to program or data space. At reset, CNF = 0. This bit is stored in status register 1 (ST1).
Glossary
H-7
Glossary
context save/restore: A save/restore of system status (status registers, accumulator, product register, temporary register, hardware stack, and auxiliary registers, etc.) when the device enters/exits a subroutine such as an interrupt service routine. continuous mode: A synchronous serial port mode in which only one frame synchronization pulse (FSX and FSR) is necessary to transmit several packets at maximum frequency. CPU: See central processing unit (CPU). current auxiliary register: The auxiliary register pointed to by the auxiliary register pointer (ARP). CWSR: See wait-state control register (CWSR).
D
D0D15: External data bus pins that transfer data between the C5x and external data/program memory or I/O devices. DAB: See direct address bus (DAB). DARAM: See dual-access RAM. data bus: A group of connections used to route data. data memory: A memory region used for storing and manipulating data. data memory address (dma): The seven LSBs of a direct addressed instruction that contains the immediate relative address within a 128-word data page. The seven LSBs are concatenated with the data memory page pointer (DP) to form the direct memory address of 16 bits. See also data memory page pointer (DP). data memory page pointer (DP) bits: A 9-bit field that specifies the current data memory page address. The DP bits are concatenated with the 7 LSBs of the instruction word to form the direct memory address of 16 bits. These bits are stored in status register 0 (ST0). data memory page 0: The first page in data memory space where the memory-mapped registers and the scratch-pad RAM block (B2) reside. data receive register (DRR): A 16-bit memory-mapped register that holds serial data copied from the receive shift register (RSR). When autobuffering is enabled (BRE = 1), the DRR is no longer available for software access as a memory-mapped register. See also data receive shift register (RSR).
H-8
Glossary
data receive shift register (RSR): A 16-bit register that holds serial data received from the DR pin. See also data receive register (DRR). data transmit register (DXR): A 16-bit memory-mapped register that holds serial data to be copied to the data transmit shift register (XSR). When autobuffering is enabled (BXE = 1), the DXR is no longer available for software access as a memory-mapped register. See also data transmit shift register (XSR). data transmit shift register (XSR): A 16-bit register that holds serial data to be transmitted from the DX pin (or TDX pin when TDM = 1). See also data transmit register (DXR) and TDM data transmit register (TDXR). DBMR: See dynamic bit manipulation register (DBMR). digital loopback (DLB) mode: A synchronous serial port test mode in which the DLB bit connects the receive pins to the transmit pins on the same device to test if the port is operating correctly. digital loopback mode (DLB) bit: A 1-bit field that puts the serial port in digital loopback mode. At reset, DLB = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). direct address bus (DAB): A 16-bit bus that provides the data address used by the central processing unit (CPU). direct memory access (DMA): A mode where a device other than the host processor contends for, and receives, mastership of the memory bus so that data transfers may take place independent of the host. DLB: See digital loopback mode (DLB) bit. dma: See data memory address (dma). DMA: See direct memory access (DMA). DP: See data memory page pointer (DP) bits. DRR: See data receive register (DRR). DSP interrupt (DSPINT) bit: A 1-bit field that enables/disables an interrupt from a host processor to the TMS320C57. The DSPINT bit is written from the host processor; a C57 write has no effect on the DSPINT bit. When DSPINT = 1, a C57 interrupt is generated. The host must write a 0 to the DSPINT bit while writing to the BOB or HINT bits, so that the host does not provoke an unwanted C57 interrupt. This bit is stored in the HPI control register (HPIC).
Glossary
H-9
Glossary
DSPINT: See DSP interrupt (DSPINT) bit. dual-access RAM (DARAM): Memory space that can be read from and written to in the same clock cycle. dynamic bit manipulation register (DBMR): A 16-bit memory-mapped register that masks the input to the parallel logic unit (PLU) in the absence of a long immediate value. DXR: See data transmit register (DXR).
E
enable extra index register (NDX) bit: A 1-bit field that determines if a modification or write to auxiliary register 0 (AR0) also modifies or writes to the index register (INDX), and the auxiliary register compare register (ARCR) to maintain compatibility with the TMS320C2x. This bit is stored in the processor mode status register (PMST). enable multiple TREGs (TRM) bit: A 1-bit field that indicates if an LT(A,D,P,S) instruction loads only TREG0 or loads all three of the temporary registers (TREG0, TREG1, and TREG2) to maintain compatibility with the TMS320C2x. The TRM bit allows the TMS320C5x to operate in either C2x-compatible mode (TRM = 0) or C5x-enhanced mode (TRM = 1) in conjunction with the use of TREG0, TREG1, and TREG2. The TRM bit affects the operation of all C2x-compatible instructions that modify TREG0. This bit is stored in the processor mode status register (PMST). external flag (XF) pin status bit: A 1-bit field that drives the level of the external flag (XF) pin. At reset, XF = 1.This bit is stored in status register 1 (ST1). external interrupt: A hardware interrupt triggered by a pin (INT1INT4).
F
fast Fourier transform (FFT): An efficient method of computing the discrete Fourier transform, which transforms functions between the time domain and frequency domain. The time-to-frequency domain is called the forward transform, and the frequency-to-time domain is called the inverse transformation. See also butterfly. FE: See format extension (FE) bit.
H-10
Glossary
FFT: See fast Fourier transform (FFT). FIG: See frame ignore (FIG) bit. FO: See format (FO) bit. format (FO) bit: A 1-bit field that specifies the word length of the serial port transmitter and receiver. The data is transferred with the MSB first. At reset, FO = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). format extension (FE) bit: A 1-bit field used in conjunction with the format bit (FO) to specify the word length of the BSP serial port transmitter and receiver. When FO = FE = 00, the format is 16-bit words; when FO = FE = 01, the format is 10-bit words; when FO = FE = 10, the format is 8-bit words; and when FO = FE = 11, the format is 12-bit words. For 8-,10-, and 12-bit words, the received words are right-justified and the sign bit is extended to form a 16-bit word. The words to transmit must be right-justified. At reset, FE = 0. This bit is stored in the BSP control extension register (SPCE). frame ignore (FIG) bit: A 1-bit field used only in transmit continuous mode with external frame and in receive continuous mode. At reset, FIG = 0. This bit is stored in the BSP control extension register (SPCE). frame synchronization mode (FSM) bit: A 1-bit field that specifies whether frame synchronization pulses (FSX and FSR) are required for serial port operation. At reset, FSM = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). frame synchronization polarity (FSP) bit: A 1-bit field that determines the status of the frame synchronization pulses. At reset, FSP = 0. This bit is stored in the BSP control extension register (SPCE). Free bit: A 1-bit field used in conjunction with the Soft bit to determine the state of the serial port clock when a breakpoint is encountered in the highlevel language debugger. At reset, Free = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). FSM: See frame synchronization mode (FSM) bit. FSP: See frame synchronization polarity (FSP) bit.
Glossary
H-11
Glossary
G
general-purpose input/output pins: Pins that can be used to supply input signals from an external device or output signals to an external device. These pins are not linked to specific uses; rather, they provide input or output signals for a variety of purposes. These pins include the generalpurpose BIO input pin and XF output pin. global data memory space: One of four memory spaces. The global data memory space can either share data with other processors within the system or serve as additional data memory space. global memory allocation register (GREG): An 8-bit memory-mapped register that specifies the size of the global memory space. At reset, the GREG is cleared. GREG: See global memory allocation register (GREG).
H
HALTR: See autobuffering receiver halt (HALTR) bit. HALTX: See autobuffering transmitter halt (HALTX) bit. hardware interrupt: An interrupt triggered through physical connections with on-chip peripherals or external devices. HINT bit: C57-to-Host Processor Interrupt. A 1-bit field that enables/disables an interrupt from the TMS320C57 to a host processor. At reset, HINT = 0. This bit is stored in the HPI control register (HPIC). HM: See hold mode (HM) bit. HOM: See host-only mode (HOM). hold mode (HM) bit: A 1-bit field that determines whether the central processing unit (CPU) can stop or continue when the HOLD signal initiates a power-down mode. At reset, HM = 1. This bit is stored in status register 1 (ST1). host-only mode (HOM): The mode that allows the host to access HPI memory while the TMS230C57 is in IDLE2 (all internal clocks stopped) or in reset mode. The external C57 clock may even be stopped. The host can therefore access the HPI RAM while the C57 is in its optimum configuration in terms of power consumption.
H-12
Glossary
host port interface (HPI): An on-chip module consisting of an 8-bit parallel port that interfaces a host processor to the TMS320C57. The HPI has two modes of operation, shared-access mode (SAM) and host-only mode (HOM). Status and control of the HPI is specified in the HPI control register (HPIC). See also shared-access mode (SAM) and host-only mode (HOM). HPI: See host port interface (HPI). HPIA: See HPI address register (HPIA). HPIAH: See HPI address register high byte (HPIAH). HPIAL: See HPI address register low byte (HPIAL). HPIC: See HPI control register (HPIC). HPICH: See HPI control register high byte (HPICH). HPICL: See HPI control register low byte (HPICL). HPI address register (HPIA): A 16-bit register that stores the address of the host port interface (HPI) memory block. The HPIA can be preincremented or postincremented. HPI address register high byte (HPIAH): The higher 16 bits stored in the HPI address register (HPIA). See also HPI address register (HPIA). HPI address register low byte (HPIAL): The lower 16 bits stored in the HPI address register (HPIA). See also HPI address register (HPIA). HPI control register (HPIC): A 16-bit register that contains status and control bits for the host port interface (HPI). HPI control register high byte (HPICH): The higher 16 bits stored in the HPI control register (HPIC). See also HPI control register (HPIC). HPI control register low byte (HPICL): The lower 16 bits stored in the HPI control register (HPIC). See also HPI control register (HPIC).
I
I/O port wait-state register (IOWSR): A 16-bit memory-mapped register that specifies the number of wait states for the input/out (I/O) port. The IOWSR can be mapped in one of two ways as specified by the BIG bit in the wait-state control register (CWSR). At reset, IOWSR = FFFF. IFR: See interrupt flag register (IFR).
Glossary
H-13
Glossary
IMR: See interrupt mask register (IMR). IN0 bit: Input 0 bit. A 1-bit field that allows the CLKR pin to be used as an input. IN0 reflects the current level of the CLKR pin of the device. This bit is stored in the SPC and TDM serial port control register (TSPC). IN1 bit: Input 1 bit. A 1-bit field that allows the CLKX pin to be used as an input. IN1 reflects the current level of the CLKX pin of the device. This bit is stored in the SPC and TDM serial port control register (TSPC). index register (INDX): A 16-bit memory-mapped register that specifies increment sizes greater than 1 for indirect addressing updates. In bitreversed addressing, the INDX defines the array size. INDX: See index register (INDX). instruction: The basic unit of programming that causes the execution of one operation; it consists of an opcode and operands along with optional labels and comments. instruction register (IREG): A 16-bit register that contains the actual instruction being executed. internal interrupt: A hardware interrupt caused by an on-chip peripheral. internal transmit clock division factor (CLKDV) bits: A 5-bit field that determines the internal transmit clock duty cycle. At reset, CLKDV = 00011. These bits are stored in the BSP control extension register (SPCE). interrupt: An exceptional condition that is caused either by an external event to the CPU or by a previously executed instruction that forces the current program to stop. The CPU executes instructions of an interrupt service routine (ISR) at an address corresponding to the source of the interrupt. After the CPU services the interrupt, the CPU resumes execution of the program at the instruction whose execution was interrupted. interrupt flag register (IFR): A 16-bit memory-mapped register that flags pending interrupts. The IFR may be read to identify pending interrupts and written to clear selected interrupts. A 1 read from any IFR bit position indicates a pending interrupt. A 1 written to any IFR bit position clears the corresponding interrupt. A 0 written to any IFR bit position has no effect. At reset, the IFR is cleared. interrupt mask register (IMR): A 16-bit memory-mapped register that masks external and internal interrupts. The IMR may be read and written to. A 1 written to any IMR bit position enables the corresponding interrupt (when INTM = 0).
H-14
Glossary
interrupt mode (INTM) bit: A 1-bit field that globally masks or enables all interrupts. When INTM = 0, all unmasked interrupts are enabled. When INTM = 1, all maskable interrupts are disabled. INTM has no effect on the nonmaskable RS and NMI interrupts. At reset, INTM = 1.This bit is stored in status register 0 (ST0). interrupt service routine (ISR): A module of code that is executed in response to a hardware or software interrupt. interrupt vector pointer (IPTR) bits: A 5-bit field that identifies the 2K page where the interrupt vectors currently reside in the system. The IPTR lets you remap the interrupt vectors to RAM for boot-loaded operations. At reset, IPTR = 0. These bits are stored in the processor mode status register (PMST). INTM: See interrupt mode (INTM) bit. IOWSR: See I/O Port Wait-State Register (IOWSR). IPTR: See interrupt vector pointer (IPTR) bits. IREG: See instruction register (IREG). ISR: See interrupt service routine (ISR).
L
latency: The delay between when a condition occurs and when the device reacts to the condition. Also, in a pipeline, the delay between the execution of two instructions that is necessary to ensure that the values used by the second instruction are correct. LSB: least significant bit. The lowest-order bit in a word.
M
maskable interrupts: A hardware interrupt that can be enabled or disabled through software. MCM: See clock mode (MCM) bit. MCS: See microcall stack (MCS). memory map: A map of the addressable memory space accessed by the TMS320C5x processor partitioned according to functionality (memory, registers, etc.).
Glossary
H-15
Glossary
memory-mapped registers: The TMS320C5x processor has 96 registers mapped into page 0 of the data memory space. There are 28 core CPU registers, 17 peripheral registers, 16 input/output (I/O) port registers, and 35 reserved registers. microcall stack (MCS): A single-word stack that temporarily stores the contents of the prefetch counter (PFC) while the PFC addresses data memory with the block move (BLDD/BLPD), multiply-accumulate (MAC/ MACD), and table read/write (TBLR/TBLW) instructions. microprocessor/microcomputer (MP/MC) bit: A 1-bit field that indicates if on-chip ROM is mapped into program address space. When MP/ MC = 0, the on-chip ROM is enabled. When MP/MC = 1, the on-chip ROM is not addressable. At reset, the MP/MC bit is set to the value corresponding to the logic level on the MP/MC pin. The level on the MP/MC pin is sampled at reset only and has no effect until the next reset. This bit is stored in the processor mode status register (PMST). mnemonic: An alphanumeric symbol designed to aid human memory; it commonly represents the operation code of an assembly language instruction name that the assembler translates into machine code. MP/MC: See microprocessor/microcomputer (MP/MC) bit. MSB: most significant bit. The highest-order bit in a word. MULT: See multiplier (MULT). multiplier (MULT): A 16-by-16-bit multiplier that generates a 32-bit product. The multiplier executes multiple operations in a single machine cycle and operates using either signed or unsigned 2s-complement arithmetic. The operand for the multiplier is specified by the value in temporary register 0 (TREG0). The result of the multiplier is stored in the product register (PREG).
N
nested interrupt: A higher-priority interrupt that must be serviced before completion of the current interrupt service routine (ISR). An executing ISR can set the interrupt mask register (IMR) bits to prevent being suspended by another interrupt. NDX: See enable extra index register (NDX) bit. nonmaskable interrupt: An interrupt that can be neither masked by the interrupt mask register (IMR) nor disabled by the INTM bit of status register ST0.
H-16
Glossary
O
off-chip: on-chip: A device external to the TMS320C5x device. An element or module of the TMS320C5x device.
opcode: operation code. In most cases, the first byte of the machine code that describes the type of operation and combination of operands to the central processing unit (CPU). operand: The part of an instruction that designates where the central processing unit (CPU) will fetch or store data. The operand consists of the arguments, or parameters, of an assembly language instruction, assembler directive, or macro directive. OV: See overflow (OV) bit. overflow: A condition in which the result of an arithmetic operation exceeds the capacity of the register used to hold that result. overflow (OV) bit: A 1-bit flag that indicates an arithmetic operation overflow in the arithmetic logic unit (ALU). At reset, OV = 0.This bit is stored in status register 0 (ST0). overflow mode (OVM) bit: A 1-bit field that determines if an overflow in the arithmetic logic unit (ALU) will wrap around or saturate. This bit is stored in status register 0 (ST0). OVLY: See RAM overlay (OVLY) bit. OVM: See overflow mode (OVM) bit.
P
PAER: See block repeat program address end register (PAER). parallel logic unit (PLU): A 16-bit logic unit that executes logic operations from either long immediate operands or the contents of the dynamic bit manipulation register (DBMR) directly upon data locations without affecting the contents of the accumulator (ACC) or product register (PREG). PASR: See block repeat program address start register (PASR). PC: See program counter (PC). PCM: See pulse coded modulation mode (PCM) bit.
Glossary
H-17
Glossary
PDWSR: See program/data wait-state register (PDWSR). PFC: See prefetch counter (PFC). pipelining: A design technique for reducing the effective propagation delay per instruction operation by partitioning the operation into a series of four independent stages, each of which performs a portion of the operation. PLU: See parallel logic unit (PLU). PM: See product shift mode (PM) bits. PMST: See processor mode status register (PMST). pop: Action of removing a word from a stack.
POSTSCALER: postscaling shifter. A 0- to 7-bit left barrel shifter used to postscale data coming out of the accumulator (ACC). PRD: See timer period register (PRD). prefetch counter (PFC): A 16-bit register that prefetches program instructions. The PFC contains the address of the instruction currently being prefetched and is updated when a new prefetch is initiated. PREG: See product register (PREG). PRESCALER: prescaling shifter. A 0- to 16-bit left barrel shifter used to prescale data coming into the arithmetic logic unit (ALU). This shifter is also used as a 0- to 16-bit right barrel shifter of the accumulator (ACC). The shift count is specified by a constant in the instruction or by the value in temporary register 1 (TREG1). processor mode status register (PMST): A 16-bit memory-mapped register that contains status and control bits. product register (PREG): A 32-bit register that holds the output from the multiplier. The high and low words of the PREG can be accessed individually. See also multiplier (MULT). product shift mode (PM) bits: A 2-bit field that defines the product shifter (P-SCALER) mode. These two bits determine the shift value (0-, 1-, 4-bit left shifter, 6-bit right shifter) for the output of the product register (PREG).These bits are stored in status register 1 (ST1).
H-18
Glossary
program/data wait-state register (PDWSR): (For the TMS320C50, C51, and C53) a 16-bit memory-mapped register that specifies the number of wait states for the program and data space. The higher byte of PDWSR specifies the data space wait states and the lower byte specifies the program space wait states. At reset, PDWSR = FFFF. (For the TMS320C52, C56, and C57) a 16-bit memory-mapped register that specifies the number of wait states for the program, data, and input/ output (I/O) space. Bits 02 of PDWSR specify the program space wait states, bits 35 specify the data space wait states, bits 68 specify the I/O space wait states, and bits 915 are reserved. At reset, PDWSR = FFFF. program controller: Logic circuitry that decodes instructions, manages the pipeline, stores the central processing unit (CPU) status, and decodes conditional operations. program counter (PC): A 16-bit register that identifies the current statement in the program. The PC addresses program memory sequentially and always contains the address of the next instruction to be fetched. The PC contents are updated following each instruction decode operation. P-SCALER: Product Shifter. A 0-, 1-, or 4-bit left shifter that removes extra signed bits (gained in the multiply operation) when fixed-point arithmetic is used; or a 6-bit right shifter that scales the products down to avoid overflow in the accumulation process. The shift mode is specified by the product shift mode (PM) bits. PSC: See timer prescaler counter (PSC) bits. pulse coded modulation mode (PCM) bit: A 1-bit field that enables/disables the BSP transmitter. This bit is stored in the BSP control extension register (SPCE). push: Action of placing a word onto a stack.
R
RAM overlay (OVLY) bit: A 1-bit field that determines if on-chip single-access RAM is addressable in data memory space. At reset, OVLY = 0. This bit is stored in the processor mode status register (PMST). receive buffer half received (RH) bit: A 1-bit flag that indicates which half of the receive buffer has been received. At reset, RH = 0. This bit is stored in the BSP control extension register (SPCE).
Glossary
H-19
Glossary
receive ready (RRDY) bit: A 1-bit flag that transitions from 0 to 1 to indicate the data receive shift register (RSR) contents have been copied to the data receive register (DRR) and that data can be read. A receive interrupt (RINT) is generated upon the transition. The RRDY bit can be polled in software in lieu of using serial port interrupts. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). receiver reset (RRST) bit: A 1-bit flag that resets the serial port receiver. At reset, RRST = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). receive shift register full (RSRFULL) bit: A 1-bit flag that indicates if the serial port receiver has experienced overrun. This bit is stored in the serial port control register (SPC). register: A group of bits used for temporarily holding data or for controlling or specifying the status of a device. repeat counter register (RPTC): A 16-bit memory-mapped register that controls the repeated execution of a single instruction. reset: A means to bring the central processing unit (CPU) to a known state by setting the registers and control bits to predetermined values and signaling execution to start at a specified address. RH: See receive buffer half received (RH) bit. RINT: See serial port receive interrupt (RINT) bit. RPTC: See repeat counter register (RPTC). RRDY: See receive ready (RRDY) bit. RRST: See receiver reset (RRST) bit. RSR: See data receive shift register (RSR). RSRFULL: See receive shift register full (RSRFULL) bit.
S
SAM: See shared-access mode (SAM). SARAM: See single-access RAM (SARAM). scratch-pad RAM: Block 2 (B2) on data memory page 0 in local data space (32 words) of DARAM. Scratch-pad RAM supports dual-access operations and can be addressed via any data memory addressing mode.
H-20
Glossary
serial port control register (SPC): A 16-bit memory-mapped register that contains status and control bits for the serial port interface. The SPC is identical to the time-division multiplexed serial port control register (TSPC), except that bit 0 is reserved for the TDM bit. serial port interface: An on-chip full-duplex serial port interface that provides direct serial communication to serial devices with a minimum of external hardware, such as codecs and serial analog-to-digital (A/D) converters. Status and control of the serial port is specified in the serial port control register (SPC). serial port receive interrupt (RINT) bit: A 1-bit flag that indicates the data receive shift register (RSR) contents have been copied to the data receive register (DRR). This bit is stored in the interrupt flag register (IFR). serial port transmit interrupt (XINT) bit: A 1-bit flag that indicates the the data transmit register (DXR) contents has been copied to the data transmit shift register (XSR). This bit is stored in the interrupt flag register (IFR). shared-access mode (SAM): The mode that allows both the TMS320C57 and the host to access HPI memory. In this mode, asynchronous host accesses are synchronized internally and, in case of conflict, the host has access priority and the C57 waits one cycle. shared-access mode (SMOD) bit: A 1-bit field that enables/disables the shared access mode (SAM). This bit is stored in the HPI control register (HPIC). See also shared-access mode (SAM) and host-only mode (HOM). shifter: A unit that shifts bits in a word to the left or to the right. See also P-SCALER. sign-extension: The process of filling the high-order bits of a number with the sign bit, when loading a 16-bit number into a 32-bit field. sign-extension mode (SXM) bit: A 1-bit field that enables/disables sign extension of an arithmetic operation. This bit is stored in status register 1 (ST1). single-access RAM (SARAM): Memory space that only can be read from or written to in a single clock cycle. SMOD: See shared-access mode (SMOD) bit. Soft bit: A 1-bit field used in conjunction with the Free bit to determine the state of the serial port clock when a breakpoint is encountered in the highlevel language debugger. At reset, Soft = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC).
Glossary
H-21
Glossary
software interrupt: An interrupt caused by the execution of an INTR, NMI, or TRAP instruction. SPC: See serial port control register (SPC). SPCE: See BSP control extension register (SPCE). stack: An 8-level-deep by 16-bit hardware stack used as a last-in, first-out memory for temporary variable storage; used during interrupt service routines (ISR) and calls to store the current program status. The area occupied by the stack is determined by the stack pointer and the application program. status register: A 16-bit register that contains status and control bits. SXM: See sign-extension mode (SXM) bit.
T
TADD: See TDM address (TADD). TC: See test/control (TC) bit. TCLK: See TDM clock (TCLK). TCR: See timer control register (TCR). TCSR: See TDM channel select register (TCSR). TDAT: See TDM data (TDAT). TDDR: See timer divide-down register (TDDR) bits. TDM: See time-division multiplexed (TDM) bit. TDM address (TADD): A single, bi-directional address line that identifies which devices on the four-wire serial bus should read in the data on the TDM data (TDAT) line. TDM channel select register (TCSR): A 16-bit memory-mapped register that specifies in which of the eight time slots (channels) a device on the four-wire serial bus is to transmit. A 1 in any one or more of bits 07 of the TCSR sets the device transmitter active during the corresponding time slot. Bits 815 are reserved. TDM clock (TCLK): A single, bi-directional clock line for TDM operation. The TDM receive clock (TCLKR) and TDM transmit clock (TCLKX) pins are externally connected to form the TCLK line.
H-22
Glossary
TDM data (TDAT): A single, bi-directional line from which all TDM data is carried. The TDM serial data receive (TDR) and TDM serial data transmit (TDX) pins are externally connected to form the TDAT line. TDM data receive register (TRCV): A 16-bit memory-mapped register that holds serial data copied from the TDM receive shift register (TRSR). When multiprocessing is enabled (TDM = 1), the TRCV is no longer available for software access as a memory-mapped register. See also TDM data receive shift register (TRSR). TDM data receive shift register (TRSR): A 16-bit register that holds serial data received from the TDM data (TDAT) line. See also TDM data receive register (TRCV). TDM data transmit register (TDXR): A 16-bit memory-mapped register that holds serial data to be copied to the data transmit shift register (XSR). When multiprocessing is enabled (TDM = 1), the TDXR is no longer available for software access as a memory-mapped register. See also data transmit shift register (XSR). TDM receive address register (TRAD): A 16-bit memory-mapped register that contains various information regarding the status of the TDM address (TADD) line and verifies the relationship between instruction cycles and TDM port timing. TDM receive interrupt (TRNT) bit: A 1-bit flag that indicates the TDM data receive shift register (TRSR) contents have been copied to the TDM data receive register (TRCV). This bit is stored in the interrupt flag register (IFR). TDM receive/transmit address register (TRTA): A 16-bit memorymapped register that specifies to which device(s) on the four-wire serial bus a given device can transmit. The lower byte of the TRTA specifies the receive address (RA) of the device and the higher byte specifies the transmit address (TA). The address is sent over the TDM address (TADD) line. TDM serial port control register (TSPC): A 16-bit memory-mapped register that contains status and control bits for the TDM serial port interface. The TSPC is identical to the serial port interface control register (SPC), except for the TDM bit 0. TDM transmit interrupt (TXNT) bit: A 1-bit flag that indicates the TDM data transmit register (TDXR) contents have been copied to the data transmit shift register (XSR). This bit is stored in the interrupt flag register (IFR). TDXR: See TDM data transmit register (TDXR).
Glossary
H-23
Glossary
temporary register: A 16-bit register that holds a temporary data value. See alsoTREG0, TREG1, and TREG2. test/control (TC) bit: A 1-bit flag that stores the results of the arithmetic logic unit (ALU) or parallel logic unit (PLU) test bit operations. The TC bit is affected by the APL, BIT, BITT, CMPR, CPL, LST #1, NORM, OPL, and XPL instructions. The status of the TC bit influences the execution of the conditional branch, call, and return instructions. This bit is stored in status register 1 (ST1). TIM: See timer counter register (TIM).
time-division multiplexed (TDM) bit: A 1-bit field that enables/disables the TDM serial port. This bit is stored in the TDM serial port control register (TSPC). time-division multiplexing (TDM): The process by which a single serial bus is shared by up to eight TMS320C5x devices with each device taking turns to communicate on the bus. There are a total of eight time slots (channels) available. During a time slot, a given device may talk to any combination of devices on the bus. timer control register (TCR): A 16-bit memory-mapped register that contains status and control bits for the on-chip timer. timer counter register (TIM): A 16-bit memory-mapped register that specifies the current count for the on-chip timer. The TIM is decremented once after each timer prescaler counter (PSC) decrement past 0. When the TIM is decremented past 0 or the timer is reset, the TIM is loaded with the contents of the timer period register (PRD) and an internal timer interrupt (TINT) is generated. timer divide-down register (TDDR) bits: A 4-bit field that specifies the timer divide-down ratio (period) for the on-chip timer. When the timer prescaler counter (PSC) is decremented past 0, the PSC is loaded with the contents of the TDDR. At reset, TDDR = 0000. These bits are stored in the timer control register (TCR). timer interrupt (TINT) bit: A 1-bit flag that indicates the timer counter register (TIM) has decremented past 0. This bit is stored in the interrupt flag register (IFR). timer period register (PRD): A 16-bit memory-mapped register that specifies the period for the on-chip timer. When the timer counter register (TIM) is decremented past 0, the TIM is loaded with the contents of the PRD.
H-24
Glossary
timer prescaler counter (PSC) bits: A 4-bit field that specifies the count for the on-chip timer. When the PSC is decremented past 0 or the timer is reset, the PSC is loaded with the contents of the timer divide-down register (TDDR) and the timer counter register (TIM) is decremented. These bits are stored in the timer control register (TCR). timer reload (TRB) bit: A 1-bit flag that resets the on-chip timer. When TRB = 1, the timer counter register (TIM) is loaded with the value in the timer period register (PRD) and the timer prescaler counter (PSC) is loaded with the value of the timer divide-down register (TDDR) bits. This bit is stored in the timer control register (TCR). timer stop status (TSS) bit: A 1-bit flag that stops and restarts the on-chip timer. At reset, TSS = 0 and the timer immediately starts timing. This bit is stored in the timer control register (TCR). TINT: See timer interrupt (TINT) bit. TRAD: See TDM receive address register (TRAD). transmit buffer half transmitted (XH) bit: A 1-bit flag that indicates which half of transmit buffer transmitted. The XH bit can be read when an XINT interrupt occurs (interrupt program or IFR polling). At reset, XH = 0. This bit is stored in the BSP control extension register (SPCE). transmit mode bit (TXM) bit: A 1-bit field that specifies the source of the frame synchronization transmit (FSX) pulse. At reset, TXM = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). transmit ready (XRDY) bit: A 1-bit flag that transitions from 0 to 1 to indicate the data transmit register (DXR) contents have been copied to the data transmit shift register (XSR) and that data is ready to be loaded with a new data word. A transmit interrupt (XINT) is generated upon the transition. The XRDY bit can be polled in software in lieu of using serial port interrupts. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). transmit shift register empty (XSREMPTY) bit: A 1-bit flag that indicates if the serial port transmitter has experienced underflow. This bit is stored in the serial port control register (SPC). transmitter reset (XRST) bit: A 1-bit flag that resets the serial port transmitter. At reset, XRST = 0. This bit is stored in the serial port control register (SPC) and TDM serial port control register (TSPC). TRB: See timer reload (TRB) bit.
Glossary
H-25
Glossary
TRCV: See TDM data receive register (TRCV). TREG0: temporary register 0. A 16-bit memory-mapped register that holds an operand for the multiplier. See also multiplier (MULT). TREG1: temporary register 1. A 5-bit memory-mapped register that holds a dynamic prescaling shift count for data inputs to the arithmetic logic unit (ALU). See also PRESCALER. TREG2: temporary register 2. A 4-bit memory-mapped register that holds a dynamic bit pointer for the BITT instruction. TRM: See enable multiple TREGs (TRM) bit. TRNT: See TDM receive interrupt (TRNT) bit. TRSR: See TDM data receive shift register (TRSR). TRTA: See TDM receive/transmit address register (TRTA). TSPC: See TDM serial port control register (TSPC). TSS: See timer stop status (TSS) bit. TXM: See transmit mode (TXM) bit. TXNT: See TDM transmit interrupt (TXNT) bit.
W
wait state: A period of time that the CPU must wait for external program, data, or I/O memory to respond when reading from or writing to that external memory. The CPU waits one extra cycle (one CLKOUT1 cycle) for every wait state. wait-state control register (CWSR): A 5-bit memory-mapped register that controls the mapping of the program/data wait-state register (PDWSR), the input/output port wait-state register (IOWSR), and the number of wait states. At reset, CWSR = 011112. wait-state generator: A program that can be modified to generate a limited number of wait states for a given off-chip memory space (lower program, upper program, data, or I/O). Wait states are set in the wait-state control register (CWSR). warm boot: The process by which the processor transfers control to the entry address of a previously-loaded program. word: A word, as defined in this document, consists of a sequence of 16 adjacent bits (two bytes).
H-26
Glossary
X
XF: See external flag (XF) pin status bit. XH: See transmit buffer half transmitted (XH) bit. XINT: See serial port transmit interrupt (XINT) bit. XRDY: See transmit ready (XRDY) bit. XRST: See transmitter reset (XRST) bit. XSR: See data transmit shift register (XSR). XSREMPTY: See transmit shift register empty (XSREMPTY) bit.
Z
zero fill: A method of filling the low- or high-order bits with zeros when a shift occurs.
Glossary
H-27
Appendix IA Appendix
Page:
33
Change or Add:
In the bottom half of Figure 31, the auxiliary register file MUX output now connects with the trailing wire bus found on the data bus.
Figure 31. Block Diagram of C5x DSP Central Processing Unit (CPU)
DATA BUS 7 LSB from IREG 3 ST0 [ARP] AR0 AR1 AR2 AR3 3 3 AR4 AR5 AR6 AR7 CBCR(8) CBSR1 CBSR2 CBER1 MUX I/O Ports PA0 CBER2 INDX ARCR 32 32 PRESCALER SFR(016) 32 Emulation DRB PRESCALER SFL(016) MULTIPLIER PREG(32) 32 MUX PSCALER (6,0,1,4) PLU TREG0 MUX Timer 9 ST0 [DP] MUX DBMR
MUX ARAU PA15 32 Data/Program MUX SARAM Data/Program DARAM B0 MUX Data DARAM B2 B1 MUX MUX POSTSCALER (07) ST1 [C] 32 PROGRAM BUS DATA BUS ALU(32) 32 MUX 32
ACCH
ACCL 32
ACCB(32)
Notes: All registers and data lines are 16-bits wide unless otherwise specified. Not available on all devices.
I-1
Page:
411
Change or Add:
In Table 45, changed the reset values for the ARP bit and the OVM bit so both have a reset value of X. In other words, there is no reset value for the ARP bit and the OVM bit.
Table 45.
Bit 1513 Name ARP
Function
Auxiliary register pointer. These bits select the auxiliary register (AR) to be used in indirect addressing. When the ARP is loaded, the previous ARP value is copied to the auxiliary register buffer (ARB) in ST1. The ARP can be modified by memory-reference instructions when you use indirect addressing, and by the MAR or LST #0 instruction. When an LST #1 instruction is executed, the ARP is loaded with the same value as the ARB. Overflow mode bit. This bit enables/disables the accumulator overflow saturation mode in the arithmetic logic unit (ALU). The OVM bit can be modified by the LST #0 instruction. OVM = 0 Disabled. An overflowed result is loaded into the accumulator without modification. The OVM bit can be cleared by the CLRC OVM instruction. Overflow saturation mode. An overflowed result is loaded into the accumulator with either the most positive (00 7FFF FFFFh) or the most negative value (FF 8000 0000h). The OVM bit can be set by the SETC OVM instruction.
11
OVM
OVM = 1
412
In Table 45, changed the reset value for the DP bit so it has a reset value of X. In other words, there is no reset value for the DP bit.
Table 45.
Bit 80 Name DP
Function
Data memory page pointer bits. These bits specify the address of the current data memory page. The DP bits are concatenated with the 7 LSBs of an instruction word to form a direct memory address of 16 bits. The DP bits can be modified by the LST #0 or LDP instruction.
I-2
Page:
413
Change or Add:
In Table 46, changed the reset value for the ARB bit and the TC bit so they have no reset value.
Function
Auxiliary register buffer. This 3-bit field holds the previous value contained in the auxiliary register pointer (ARP) in ST0. Whenever the ARP is loaded, the previous ARP value is copied to the ARB, except when using the LST #0 instruction. When the ARB is loaded using the LST #1 instruction, the same value is also copied to the ARP. This is useful when restoring context (when not using the automatic context save) in a subroutine that modifies the current ARP. Test/control flag bit. This 1-bit flag stores the results of the arithmetic logic unit (ALU) or parallel logic unit (PLU) test bit operations. The TC bit is affected by the APL, BIT, BITT, CMPR, CPL, NORM, OPL, and XPL instructions. The status of the TC bit determines if the conditional branch, call, and return instructions execute. The TC bit can be modified by the LST #1 instruction.
11
TC
I-3
Page:
52
Change or Add:
In Figure 51, changed the page 0 length to 128-WORD PAGE.
9
15
DP
dma
PAGE 3 PAGE 2
DAB
PAGE 1 PAGE 0
128-WORD PAGE
I-4
Page:
522
Change or Add:
In Example 513, added two new lines at the beginning of the example.
I-5
Page:
632 Operands 644 Operands 683 Operands 685
Change or Add:
Changed the second operand for the ADD instruction. 0 shift 16 (defaults to 0) Changed the fourth operand for the AND instruction. 0 shift 16 Changed the operand for the BSAR instruction. 1 shift 16 Changed the description for the CALAD instruction.
Description
The current program counter (PC) is incremented by 3 and pushed onto the top of the stack (TOS). Then, the one 2-word instruction or two 1-word instructions following the CALAD instruction are fetched from program memory and executed before the call is executed. Then, the contents of the accumulator low byte (ACCL) are loaded into the PC. Execution continues at this address. The CALAD instruction is used to perform computed subroutine calls. CALAD is a branch and call instruction (see Table 68).
687
Changed the description for the CALLD instruction. Description The current program counter (PC) is incremented by 4 and pushed onto the top of the stack (TOS). Then, the one 2-word instruction or two 1-word instructions following the CALLD instruction are fetched from program memory and executed before the call is executed. Then, the program memory address (pma) is loaded into the PC. Execution continues at this address. The current auxiliary register (AR) and auxiliary register pointer (ARP) are modified as specified. The pma can be either a symbolic or numeric address. CALLD is a branch and call instruction (see Table 68).
I-6
Page:
691
Change or Add:
Changed the description for the CCD instruction.
Description
If the specified conditions are met, the current program counter (PC) is incremented by 4 and pushed onto the top of the stack (TOS). Then, the one 2-word instruction or two 1-word instructions following the CCD instruction are fetched from program memory and executed before the call is executed. Then, the program memory address (pma) is loaded into the PC. Execution continues at this address. The pma can be either a symbolic or numeric address. Not all combinations of the conditions are meaningful. In addition, the NTC, TC, and BIO conditions are mutually exclusive. If the specified conditions are not met, control is passed to the next instruction. The CCD functions in the same manner as the CALLD instruction (page 687) if all conditions are true. CCD is a branch and call instruction (see Table 68).
6103 Opcode
Changed the opcode for the CRLT instruction to reflect the new values for bits 2, 1, and 0.
15 1 14 0 13 1 12 1 11 1 10 1 9 1 8 0 7 0 6 0 5 0 4 1 3 1 2 1 1 0 0 0
Changed the third operand for the LACC instruction. 0 shift 16 (defaults to 0) Changed the table Cycles for a Single Instruction (short immediate addressing).
Cycles for a Single Instruction (short immediate addressing) Operand ROM 2 DARAM 2 SARAM 2 External Memory 2+pcode
6129
Changed the table Cycles for a Single Instruction (short immediate addressing).
Cycles for a Single Instruction (short immediate addressing) Operand ROM 2 DARAM 2 SARAM 2 External Memory 2+pcode
6188 Operands
Page:
6261 Operands 6278 6282 Operands 86 811
Change or Add:
Changed the second operand for the SUB instruction. 0 shift 16 (defaults to 0) Changed the data memory address in Example 1 from 1905h to 1005h. Changed the fourth operand for the XOR instruction. 0 shift 16 In Figure 86, changed the word Off-chip to Reserved on the Program memory map for the range from 0040h to 8000h. In Table 86, changed the values in the Off-Chip column for the first and fifth rows.
832
910
Bit values RAM 0 0 CNF 0 1 MP/MC 0 0 ROM (2K-words) 000007FF 000007FF SARAM (6K-words) Off-chip Off-chip DARAM B0 (512-words) Off-chip Off-Chip 8000FFFF FE00FFFF 8000FDFF
- 32K words of global data memory are enabled initially in data spaces
8000h to FFFFh. After the code transfer is complete, the global memory is disabled before control is transferred to the destination address in program memory.
In Table 94, changed the sentences after Soft=0 and Soft=1. Also, add a sentence to the TSS register.
Timer stop status bit. This bit stops or starts the on-chip timer. At reset, the TSS bit is cleared and the timer immediately starts timing. Note that due to timer logic implementation, two successive writes of one to the TSS bit are required to properly stop the timer.
I-8
Page:
911
Change or Add:
Deleted the last sentence in the Notes section and replace it with the sentence indicated.
The current value in the timer can be read by reading the TIM; the PSC can be read by reading the TCR. Because it takes two instructions to read both registers, there may be a change between the two reads as the counter decrements. Therefore, when making precise timing measurements, it may be more accurate to stop the timer to read these two values. Due to timer logic implementation, two instructions are also required to properly stop the timer; therefore, two successive writes of one to the TSS bit should be made when the timer must be stopped. 962 Changed the XINT and RINT labels found in the lower right portion of Figure 935.
BCLKX BFSX
BDXR
BDX BDR
BXSR BRSR
Interrupt Logic
I-9
Page:
963
Change or Add:
Changed the last sentence in the first paragraph. The internal C5X memory used for autobuffering consists of a 2K-word block of single-access memory that can be configured as data, program, or both (as with other single-access memory blocks). This memory can also be used by the CPU as general purpose storage, however, this is the only memory block in which autobuffering can occur. Since the BSP is implemented on several different TMS320 devices, the actual base address of the ABU memory may not be the same in all cases. The 2K-word block of BSP memory is located at 800hFFFh in data memory or at 8000h87FFh in program memory as specified by the RAM and OVLY control bits.
I-10
Page:
A4
Change or Add:
In Figure A2, changed the signal name on pin 80 to R/W.
Figure A-2. Pin/Signal Assignments for the C51, C52, C53S, and LC56 in 100-Pin TQFP
CLKOUT1 XF HOLDA TDO VDDC X1 X2/CLKIN CLKMD2 VSSI VSSI
100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76
EMU0 EMU1/OFF VSSC TOUT * * * * RS READY HOLD BIO TRST VSSI VSSI MP/MC D15 D14 D13 D12 D11 D10 D9 D8 VDDD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
DS VSSC
BR STRB R/W
PS IS
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
WE RD VDDA A15 A14 A13 A12 A11 A10 CLKMD1 VSSA VSSA TDI VDDI A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 VSSA
VSSD VSSD
Note:
These pins are reserved for specific devices (see Table A6 on page A-12).
VDDA
INT1
I-11
Page:
A6
Change or Add:
In Figure A3, changed the signal name on pin 108 to X2/CLKIN.
VDDC VDDI
VDDC X1
DS HD2 VSSC
128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97
VSSC
96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65
STRB
VSSI TDO
BR HD3
R/W
PS IS
HINT EMU0 EMU1/OFF VSSC VSSC TOUT BCLKX CLKX VDDC BFSR BCLKR RS READY HOLD BIO VDDC VDDC IAQ TRST VSSI VSSI MP/MC D15 D14 D13 D12 D11 D10 D9 D8 VDDD VDDD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
WE HD1 RD HD0 HRDY VDDA A15 A14 A13 A12 A11 A10 CLKMD1 VSSA VSSA TDI HDS1 HDS2 VDDI VDDI A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 VSSA HCS
HCNTL1 VDDD
HR/W INT1
VDDD TCK
NMI DR
VSSD VSSD
I-12
INT2
HAS
Page:
A7
Change or Add:
In Table A3, changed the signal name on pin 108 to X2/CLKIN and reorder the signal names.
I-13
Page:
A10
Change or Add:
In Figure A5, corrected the signal names for pins 116, 2845, 5771, and 78141; changed the signal name on pin 122 to X2/CLKIN.
HINT EMU0 NC EMU1/OFF VSSC VSSC TOUT BCLKX CLKX VDDC BFSR BCLKR RS READY HOLD NC BIO VDDC VDDC IAQ TRST VSSI VSSI MP/MC D15 D14 D13 NC D12 D11 D10 D9 NC D8 VDDD VDDD
VDDC VDDI VDDI NC CKLOUT1 XF HOLDA BDX DX HD7 BFSX HD6 FSX HD5 CLKMD2 HD4 VSSI VSSI TDO NC VDDC X1 X2/CLKIN CLKMD3 NC BR HD3 NC STRB R/W PS IS DS HD2 VSSC VSSC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
WE HD1 RD HD0 HRDY VDDA A15 NC A14 A13 A12 NC A11 A10 CLKMD1 VSSA VSSA TDI HDS1 HDS2 VDDI VDDI A9 A8 A7 NC A6 A5 A4 A3 NC A2 A1 A0 VSSA HCS
49 50 51 52
53 54 55 56
Note:
NC
I-14
VSSD V SSD D7 D6 NC D5 D4 D3 NC D2 D1 D0 HCNTL0 TMS HCNTL1 VDDD VDDD TCK VSSD VSSD NC HR/W INT1 INT2 INT3 INT4 HBIL NMI DR BDR FSR CLKR V DDA V DDA HAS NC
57 58 59 60
Page:
A11
Change or Add:
In Table A5, corrected the signal names for pins 116, 2845, 5771, and 78141; changed the signal name on pin 122 to X2/CLKIN; reordered the signal names.
I-15
Page:
D2
Change or Add:
In Figure D1, changed the PD pin 5 from +5V to VDD.
Header Dimensions: Pin-to-pin spacing: 0.100 in. (X,Y) Pin width: 0.025 in. square post Pin length: 0.235 in., nominal
In Table D1, changed the voltage for pin 5 (the PD pin) from +5V to VDD.
Table D1.
I-16
Page:
D5
Change or Add:
In Figure D2, changed the voltages from +5V to VDD.
Q 74F175 D Q 33 258 33
TDO (Pin 7)
I-17
Page:
D7
Change or Add:
In Figure D4, changed the voltages from +5V to VDD.
PD
I-18
D8
I-19
Page:
D9
Change or Add:
In Figure D6, changed the voltages from +5V to VDD.
D10
I-20
Index
C2x instruction compatibility C-11 C2x to C5x software compatibility 5-6 C5x applications 1-4 characteristics 1-6 functional block diagram 2-2 IEEE Std. 1149.1 interface configurations key features 1-7 overview 1-5 C5x block diagram, CPU 3-3 ADD instruction description 6-32 summary 6-9 ADDB instruction description 6-36 summary 6-9 2-12 ADDC instruction description 6-37 summary 6-9 address bus pins A-13, H-1 address generation 4-2 address map, data page 0 8-17 address visibility (AVIS) bit H-1 See also AVIS bit addressing modes 5-1, H-1 circular 5-21 to 5-22 dedicated-register 5-17 to 5-18 direct 5-2 to 5-3 immediate 5-14 to 5-16 indirect 5-4 to 5-5 long immediate 5-15 memory-mapped register 5-19 to 5-22 short immediate 5-14 addressing program memory 4-5 ADDS instruction description 6-39 summary 6-9 ADDT instruction description 6-41 summary 6-9 ADRK instruction description 6-43 summary 6-13 AFB H-2 See also auxiliary register file bus (AFB) ALU H-2 See also arithmetic logic unit (ALU)
A
A/D converter H-2 A0A15 pin A-13, H-1 ABS instruction description 6-29 summary 6-9 ABU H-1 See also autobuffering unit (ABU) ACC H-1 See also accumulator (ACC) ACCB H-1 See also accumulator buffer (ACCB) ACCH H-1 See also accumulator high byte (ACCH) ACCL H-1 See also accumulator low byte (ACCL) accumulator (ACC) 3-11 to 3-14, H-1 accumulator buffer (ACCB) 3-11, H-1 accumulator high byte (ACCH) H-1 See also accumulator (ACC) accumulator low byte (ACCL) H-1 See also accumulator (ACC) ADCB instruction description 6-31 summary 6-9
Index-1
AND instruction description 6-44 summary 6-9 ANDB instruction description 6-47 summary 6-9 APAC instruction, description APL instruction description 6-49 summary 6-14 applications 1-4 AR H-2 See also auxiliary register (AR) ARAU H-2 See also auxiliary register arithmetic unit (ARAU) ARB bits 4-13, H-2 architecture 1-5, 2-1 bus structure 2-3 central processing unit (CPU) on-chip memory 2-6 on-chip peripherals 2-8 test/emulation 2-11 6-48
2-4, H-6
ARCR H-2 See also auxiliary register compare register (ARCR) arithmetic logic unit (ALU) ARP bits 4-11, H-2 3-11 to 3-14, H-2
autobuffering transmitter enable (BXE) bit H-2 See also BXE bit autobuffering transmitter halt (HALTX) bit H-2 See also HALTX bit autobuffering unit (ABU) 9-60, H-3 block diagram 9-62 control register 9-63 process 9-65 auxiliary register (AR) 3-21, H-3 auxiliary register arithmetic unit (ARAU) 2-5, 3-17 to 3-20, H-3 See also auxiliary register (AR) auxiliary register buffer (ARB) bits H-3 See also ARB bits auxiliary register compare register (ARCR) 3-19, 3-21, H-3 auxiliary register file bus (AFB) H-3 auxiliary register pointer (ARP) bits H-3 See also ARP bits auxiliary registers 5-4 circular buffer 1 4-7, 5-21 circular buffer 2 4-7, 5-21 AVIS bit 4-8, 4-38, 8-13, 8-14, H-3 AXR H-3 See also BSP address transmit register (AXR)
B
B instruction description 6-52 summary 6-17 BACC instruction description 6-53 summary 6-17 BACCD instruction description 6-54 summary 6-17 BANZ instruction description 6-55 summary 6-17 BANZD instruction description 6-57 summary 6-17 BCLKR pin A-21 BCLKX pin A-21 BCND instruction description 6-59 example 4-19, 4-20 summary 6-17
ARR H-2 See also BSP address receive register (ARR) assembler H-2 assembly language instructions 6-1, H-2 descriptions 6-23 instruction set summary 6-8 instructions not meaningful to repeat 4-27 nonrepeatable instructions 4-29 notations, instruction set descriptions 6-6 repeatable instructions 4-23 to 4-36 symbols and abbreviations instruction set descriptions 6-4 instruction set opcodes 6-2 symbols and notations 6-2 assistance G-3 H-2 H-2 autobuffering receiver enable (BRE) bit See also BRE bit autobuffering receiver halt (HALTR) bit See also HALTR bit Index-2
BCNDD instruction description 6-61 example 4-20 summary 6-17 BD instruction description 6-63 summary 6-17 BDR pin BDX pin BFSR pin BFSX pin BIG bit BIO pin A-21 A-21 A-21 A-21 9-20, A-15, H-12
BIT instruction description 6-64 summary 6-21 bit manipulation 3-11, 3-15 bit-reversed addressing 5-6, 5-12 auxiliary register modifications 5-13 step/bit pattern relationship 5-13 bit-reversed addressing BITT instruction description 6-66 summary 6-21 BKR H-4 See also BSP receive buffer size register (BKR) BKX H-4 See also BSP transmit buffer size register (BKX) BLDD instruction description 6-68 example 8-27 summary 6-20 BLDP instruction description 6-74 example 8-28 summary 6-20 block move address register (BMAR) block moves block repeat 8-26 3-22 H-4 3-21, H-4 3-21, H-4 H-3
block repeat active flag (BRAF) bit See also BRAF bit block repeat function 4-31
block repeat program address end register (PAER) 3-21, 4-31, H-4
block repeat program address start register (PASR) 3-21, 4-31, H-4 BLPD instruction description 6-77 example 8-29, 8-30 summary 6-20 BMAR H-4 See also block move address register (BMAR) BOB H-4 See also byte ordering bit (BOB) boot loader 8-32 boot routine selection 8-32 HPI boot mode 8-33 boot mode parallel EPROM boot 8-36 parallel I/O boot 8-37 serial boot 8-34 warm boot 8-38 boot ROM 8-3 boot routine selection 8-32, 8-33 parallel EPROM boot mode 8-36 parallel I/O boot mode 8-37 serial boot mode 8-34 warm boot mode 8-38 BR pin 8-20, 8-23, A-15 BRAF bit 4-9, H-4 branch execution 4-17 BRCR H-4 See also block repeat counter register (BRCR) BRE bit 9-64, H-4 BSAR instruction description 6-83 summary 6-9 BSP H-4 See also buffered serial port (BSP) BSP address receive register (ARR) 3-22, H-4 BSP address transmit register (AXR) 3-22, H-5 BSP control extension register (SPCE) 3-22, H-5 bit summary 9-58, 9-64 BRE bit 9-64, H-2 BXE bit 9-65, H-2 CLKDV bits 9-59, H-14 CLKP bit 9-58, H-7 diagram 9-57, 9-63 FE bit 9-58, H-11 FIG bit 9-58, H-11 FSP bit 9-59, H-11 HALTR bit 9-64, H-2
Index-3
BSP control extension register (SPCE) (continued) HALTX bit 9-64, H-2 PCM bit 9-58, H-19 reset status 4-48 RH bit 9-64, H-19 XH bit 9-65, H-25 BSP control register (BSPC), reset status 4-47 BSP operation system considerations 9-69 BSP receive buffer size register (BKR) 3-22, H-5 BSP transmit buffer size register (BKX) 3-22, H-5 buffered serial port (BSP) 2-10, 3-22, 9-53, H-5 autobuffering control register 9-63 autobuffering process 9-65 autobuffering unit (ABU) 9-60 power-down mode 9-73 registers 3-22 signal descriptions A-21 system considerations 9-69 buffered signals, JTAG D-10 bumpered quad flat-pack (BQFP) package A-1 burst mode (serial port) 9-37, H-5 bus protocol D-3 bus structure 2-3 BXE bit 9-65, H-5 byte ordering bit (BOB) H-5
C
C bit 4-14, H-6 example 3-13 C25 packages C-2 C25 to C5x clocking C-5 C25 to C5x execution times C-8 C25 to C5x pins/signals C-4 C25 to C5x software compatibility 4-42 C2x to C5x migration C-1 cable, target system to emulator D-1 to D-13 CALA instruction description 6-84 summary 6-17 CALAD instruction description 6-85 summary 6-18 CALL instruction description 6-86 summary 6-18 Index-4
CALLD instruction description 6-87 summary 6-18 CALU H-6 See also central arithmetic logic unit (CALU) CAR1 bits 4-7, H-6 CAR2 bits 4-7, H-6 carry (C) bit H-6 See also C bit CBCR H-6 See also circular buffer control register (CBCR) CBER1 H-6 See also circular buffer 1 end register (CBER1) CBER2 H-6 See also circular buffer 2 end register (CBER2) CBSR1 H-6 See also circular buffer 1 start register (CBSR1) CBSR2 H-6 See also circular buffer 2 start register (CBSR2) CC instruction description 6-89 summary 6-18 CCD instruction description 6-91 summary 6-18 CENB1 bit 4-7, H-6 CENB2 bit 4-7, H-6 central arithmetic logic unit (CALU) 2-4, 3-7 to 3-14, H-6 central processing unit (CPU) 2-4, 3-1, H-6 auxiliary register arithmetic unit (ARAU) 2-5, 3-17, H-3 central arithmetic logic unit (CALU) 2-4, 3-7, H-6 functional overview 3-2 memory-mapped registers 2-5, H-16 parallel logic unit (PLU) 2-4, 3-15, H-17 program controller 2-5, H-19 registers 3-21 circular addressing mode 5-21 to 5-22 circular buffer 3-20, 3-22, 5-21 circular buffer 1 auxiliary register (CAR1) bits H-6 See also CAR1 bits circular buffer 1 enable (CENB1) bit H-6 See also CENB1 bit circular buffer 1 end register (CBER1) 3-22, H-6 circular buffer 1 start register (CBSR1) 3-22, H-7
circular buffer 2 auxiliary register (CAR2) bits H-7 See also CAR2 bits circular buffer 2 enable (CENB2) bit H-7 See also CENB2 bit circular buffer 2 end register (CBER2) 3-22, H-7 circular buffer 2 start register (CBSR2) 3-22, H-7 circular buffer control register (CBCR) 3-15, 3-22, 4-6, H-7 bit summary 4-7 CAR1 bits 4-7, H-6 CAR2 bits 4-7, H-7 CENB1 bit 4-7, H-6 CENB2 bit 4-7, H-7 diagram 4-7 reset status 4-46 circular buffer registers 3-22, 5-21 clear control bit 6-93 CLKDV bits 9-59, H-7 CLKIN2 pin A-17 CLKMD1 pin A-17, A-18, A-19 CLKMD2 pin A-17, A-18, A-19 CLKMD3 pin A-17, A-19 CLKOUT1 pin A-17 CLKP bit 9-58, H-7 CLKR pin A-20 CLKR1 pin A-20 CLKR2 pin A-20 CLKX pin A-20 CLKX1 pin A-20 CLKX2 pin A-20 clock generator 2-8, 9-7 PLL options 9-8 standard options 9-7 clock mode (MCM) bit H-7 See also MCM bit clock modes 9-7, 9-8, H-7 clock polarity (CLKP) bit H-7 See also CLKP bit CLRC instruction description 6-93 summary 6-21 CMPL instruction description 6-95 summary 6-10 CMPR instruction description 6-96
summary 6-13 CNF bit 4-13, 8-8, 8-15, 8-32, H-7 conditional branch 4-17 conditional operations 4-17 configuration control (CNF) bit H-7 See also CNF bit contacting Texas Instruments xvi context save/restore H-8 continuous mode (serial port) 9-44, H-8 CPGA package C-2 CPL instruction description 6-98 summary 6-14 CPU H-8 See also central processing unit (CPU) CRGT instruction description 6-101 summary 6-10 CRLT instruction description 6-103 summary 6-10 crystals E-3 current auxiliary register (ARc), changed by auxiliary register arithmetic unit (ARAU) 5-5 CWSR H-8 See also wait-state control register (CWSR)
D
D bit 9-18 D0D15 pin A-13, H-8 DAB H-8 See also direct address bus (DAB) DARAM H-8 See also dual-access RAM (DARAM) data bus 2-3, H-8 data bus pins A-13, H-8 data memory 3-15, H-8 data memory address (dma) H-8 data memory page pointer (DP) bits H-8 See also DP bits data moves. See block moves data receive register (DRR) 3-24, 9-24, H-8 reset status 4-47 data receive shift register (RSR) 3-24, 9-24, H-9 data transmit register (DXR) 3-24, 9-24, H-9 reset status 4-47
Index-5
data transmit shift register (XSR) 3-24, 9-24, H-9 DBMR H-9 See also dynamic bit manipulation register (DBMR) dedicated-register addressing mode 5-17 to 5-18 using BMAR 5-17 using DBMR 5-18 delayed branches 4-19 development tool nomenclature G-6 development tools G-2 device nomenclature G-5 digital loopback mode (DLB) bit H-9 See also DLB bit direct address bus (DAB) H-9 direct addressing mode 5-2 to 5-3 direct memory access (DMA) 8-23, H-9 address ranges 8-24 master/slave configuration 8-23 division 6-267 DLB bit 9-31, 9-32, H-9 DMA H-9 See also direct memory access (DMA) dma H-9 See also data memory address (dma) DMOV instruction 8-27 description 6-105 summary 6-20 DP bits 4-12, H-9 DP register 5-2 to 5-4 DR pin A-20 DR1 pin A-20 DR2 pin A-20 DRB 5-2 DRR H-9 See also data receive register (DRR) DS pin A-14 DSP interrupt (DSPINT) bit H-9 See also DSPINT bit DSPINT bit H-10 dual-access RAM (DARAM) 2-6, 8-2, 8-18, H-10 DX pin A-20 DX1 pin A-20 DX2 pin A-20 DXR H-10 See also data transmit register (DXR) Index-6
3-15,
E
EMU0 pin A-24 EMU1/OFF pin A-24 emulator D-1 buffered signals D-10 bus protocol D-3 cable header D-2 cable pod D-4 designing the JTAG cable D-1 header signals D-2 signal buffering D-9 to D-10 signal timings D-6 timing D-11 timings D-6 unbuffered signals D-9 emulator cable pod, interface D-5 enable extra index register (NDX) bit H-10 See also NDX bit enable multiple TREGs (TRM) bit H-10 See also TRM bit EXAMPLE instruction, description 6-24 EXAR instruction description 6-107 summary 6-10 extended-precision arithmetic 3-12 external DMA. See direct memory access (DMA) external flag (XF) pin status bit H-10 See also XF bit external memory interface timings 8-39
F
fast Fourier transform (FFT) H-10 FE bit 9-58, H-10 FFT H-11 See also fast Fourier transform (FFT) FIG bit 9-58, H-11 FO bit 9-31, 9-32, H-11 format (FO) bit H-11 See also FO bit format extension (FE) bit H-11 See also FE bit frame ignore (FIG) bit H-11 See also FIG bit
frame synchronization mode (FSM) bit H-11 See also FSM bit frame synchronization polarity (FSP) bit H-11 See also FSP bit Free bit 9-10, 9-28, 9-37, H-11 FSM bit 9-30, 9-33, H-11 FSP bit 9-59, H-11 FSR pin 8-34, A-20 FSR1 pin A-20 FSR2 pin A-20 FSX pin A-20 FSX1 pin A-20 FSX2 pin A-20 functional overview 3-2
G
general-purpose I/O pins 9-20 BIO pin 9-20 XF pin 9-21 global data memory 8-20, H-12 addressing 8-20 configuration 8-20 global memory allocation register (GREG) 8-20 map 8-21 global memory allocation register (GREG) 3-23, 8-20, H-12 reset status 4-46 GREG H-12 See also global memory allocation register (GREG)
H
HALTR bit 9-64, H-12 HALTX bit 9-64, H-12 hardware development tools G-2, G-7 hardware stack 4-4, 4-42, H-22 hardware timer 2-8 Harvard architecture 1-5 HAS pin A-22 HBIL pin A-22 HCNTL0 pin A-22 HCNTL1 pin A-22 HCS pin A-22
HD0HD7 pin A-22 HDS1 pin A-23 HDS2 pin A-23 Hewlett-Packard interface G-8 HINT bit H-12 HINT pin A-23 HM bit 4-15, 4-38, 8-14, 8-24, H-12 hold mode (HM) bit H-12 See also HM bit HOLD pin 4-49, 8-23, A-15 HOLDA pin 4-45, 8-23, A-15 HOM H-12 See also host-only mode (HOM) host port interface (HPI) 2-9, 9-87, H-13 boot mode 8-33 registers 3-23 signal descriptions A-22 host processor interrupt (HINT) bit H-12 See also HINT bit host-only mode (HOM) H-12 HPI H-13 See also host port interface (HPI) HPI address register (HPIA) 3-23, H-13 HPI address register high byte (HPIAH) H-13 See also HPI address register (HPIA) HPI address register low byte (HPIAL) H-13 See also HPI address register (HPIA) HPI boot mode 8-33 HPI control register (HPIC) 3-23, H-13 BOB H-5 diagram 9-96 DSPINT bit H-9 HINT bit H-12 SMOD bit H-21 HPI control register high byte (HPICH) H-13 See also HPI control register (HPIC) HPI control register low byte (HPICL) H-13 See also HPI control register (HPIC) HPI modes host only (HOM) H-12 shared access (SAM) H-21 HPIA H-13 See also HPI address register (HPIA) HPIAH H-13 See also HPI address register high byte (HPIAH) HPIAL H-13 See also HPI address register low byte (HPIAL)
Index-7
HPIC H-13 See also HPI control register (HPIC) HPICH H-13 See also HPI control register high byte (HPICH) HPICL H-13 See also HPI control register low byte (HPICL) HR/W pin A-23 HRDY pin A-23
I
I/O addressing 8-22 buffered serial ports 2-10 general-purpose pins 9-20 host port 2-9 parallel ports 2-9, 9-22 serial ports 2-10 space 3-23, 8-22 TDM serial ports 2-10 I/O High bit 9-17 I/O Low bit 9-18 I/O port wait-state register (IOWSR) 3-24, 9-16, H-13 diagram 9-16 reset status 4-47 I/O space 3-23, 8-22 addressing 8-22 IACK pin 8-14, A-15 IAQ pin 8-14, 8-23, A-15 IDLE instruction description 6-108 summary 6-21 IDLE2 instruction 4-50 description 6-109 summary 6-21 IEEE 1149.1 D-3 IFR H-13 See also interrupt flag register (IFR) immediate addressing mode 5-14 to 5-16 long immediate 5-15 short immediate 5-14 IMR H-14 See also interrupt mask register (IMR) IN instruction description 6-110 Index-8
summary 6-20 IN0 bit 9-29, 9-35, H-14 IN1 bit 9-29, 9-35, H-14 index register (INDX) 3-19, 3-23, H-14 indirect addressing mode 3-17, 5-4 to 5-5 bit-reversed addressing 5-12 examples 5-10 to 5-13 format for instructions 5-7 opcode format 5-7 opcode format diagram 5-7 opcode format summary 5-7 operands 5-5 options 5-5 INDX H-14 See also index register (INDX) initialization CPU 4-45 peripherals 9-6 instruction. See assembly language instructions instruction classes B-1 instruction conditions branch 4-17 call 4-17 return 4-17 instruction cycles 6-25, B-1 instruction operands 8-13 instruction operation conditional branch 4-17 conditional call 4-18 conditional execution 4-20 conditional return 4-18 delayed conditional branches 4-19 delayed conditional calls 4-19 delayed conditional returns 4-19 multiconditional instructions 4-18 instruction register (IREG) 3-18, 3-23, 4-2, H-14 instruction set descriptions 6-23 latencies 7-24 summary 6-8 instruction set opcodes, summary 6-8 instruction set symbols and notations 6-2 instructions not meaningful to repeat 4-27 INT1 pin A-16 INT2 pin A-16 INT3 pin A-16 INT4 pin A-16
internal hardware summary 3-2 to 3-6 CPU 3-4 to 3-6 internal transmit clock division factor (CLKDV) bits H-14 See also CLKDV bits interrupt flag register (IFR) 3-23, 4-39, H-14 diagram 4-39 reset status 4-46 RINT bit H-21 TINT bit H-24 TRNT bit H-23 TXNT bit H-23 XINT bit H-21 interrupt mask register (IMR) 3-23, 4-40, H-14 diagram 4-40 interrupt mode (INTM) bit H-15 See also INTM bit interrupt service routine (ISR) H-15 interrupt trap 4-42 interrupt vector pointer (IPTR) bits H-15 See also IPTR bits interrupts 4-36 to 4-44, H-14 address location 4-37 context save 4-42 hardware H-12 latency 4-43, H-15 nested H-16 nonmaskable 4-41, H-16 operation 4-38 priorities 4-36, 4-37 registers 3-23 IFR. See interrupt flag register (IFR) IMR. See interrupt mask register (IMR) software initiated 4-41 user-maskable (external) 2-10, H-10 vector addresses 8-11, 8-12 vector locations 4-36 vectors 4-38, 8-11, 8-12 INTM bit 3-23, 4-12, 4-40, 8-32, H-15 INTR instruction description 6-112 summary 6-18 introduction 1-1 TMS320 family overview 1-2 TMS320C5x key features 1-7 TMS320C5x overview 1-5 IOWSR H-15 See also I/O port wait-state register (IOWSR)
IPTR bits 4-8, 4-37, 8-11, 8-12, H-15 IREG H-15 See also instruction register (IREG) IS pin A-14 ISR H-15 See also interrupt service routine (ISR)
J
JTAG D-1 scanning logic 2-11 to 2-12 signals D-3 JTAG emulator buffered signals D-10 connection to target system D-1 to D-13 no signal buffering D-9
K
key features 1-7
L
LACB instruction description 6-114 summary 6-10 LACC instruction description 6-115 summary 6-10 LACL instruction description 6-118 summary 6-10 LACT instruction description 6-121 summary 6-10 LAMM instruction description 6-123 summary 6-10 LAR instruction description 6-125 summary 6-13 latency instruction set 7-24 interrupts 4-43 pipeline 7-24 LDP instruction description 6-128 summary 6-13
Index-9
LMMR instruction description 6-131 example 8-31 summary 6-20 local data memory 8-15 address map 8-17 addressing 8-19 configuration 8-15 to 8-17 long immediate addressing 5-15 low-power mode 4-50 LPH instruction description 6-134 summary 6-14 LST instruction description 6-136 summary 6-21 LT instruction description 6-139 summary 6-14 LTA instruction description 6-141 summary 6-15 LTD instruction description 6-143 summary 6-15 LTP instruction description 6-146 summary 6-15 LTS instruction description 6-148 summary 6-15
M
MAC instruction 3-9 description 6-150 summary 6-15 MACD instruction description 6-154 summary 6-15 MADD instruction description 6-159 summary 6-15 MADS instruction description 6-163 summary 6-15 MAR instruction description 6-167 Index-10
summary 6-13 masked parts F-3 MCM bit 9-30, 9-33, H-15 MCS H-15 See also microcall stack (MCS) memories E-2 memory 2-6, 8-1 addressing modes 5-1 boot loader 8-32 direct memory access (DMA) 8-23 dual-access RAM (DARAM) 2-6 external 8-2 external memory interface timings 8-39 global data 8-20 I/O space 8-22 local data 8-15 management 8-26 maps 8-4 to 8-6 overview 8-2 program 2-6, 8-7 protection 2-7 single-access RAM (SARAM) 2-7 software wait-state generation 8-42 memory addressing modes 5-1 memory block moves 8-27 memory configuration local data memory 8-15 to 8-17 program memory 8-7 to 8-11 memory management 8-26 memory block moves 8-27 memory-to-memory moves 8-26 memory map H-15 memory protection feature 2-7, 8-14 memory-mapped register addressing mode 5-19 to 5-22 memory-mapped registers 2-5 CPU 8-18 defined H-16 I/O ports 8-19, 9-2 to 9-4 peripherals 8-19, 9-2 to 9-4 serial ports 8-19, 9-2 to 9-4 memory-to-memory moves 8-26 microcall stack (MCS) 5-15, H-16 microcomputer mode 4-9, 8-3 to 8-5 microprocessor mode 4-9, 8-3 to 8-5 microprocessor/microcomputer (MP/MC) bit H-16 See also MP/MC bit mnemonic H-16 See also assembly language instructions
O
off-chip, defined on-chip, defined on-chip memory H-17 H-17 2-6
MPY instruction description 6-169 summary 6-16 MPYA instruction description 6-172 summary 6-16 MPYS instruction description 6-174 summary 6-16 MPYU instruction 3-10 description 6-176 summary 6-16 MULT H-16 See also multiplier (MULT) multiplier (MULT) 3-7, H-16 3-9 8-20, 8-23, D-8 multiply accumulate
on-chip peripherals 2-8, 9-1 buffered serial port (BSP) 2-10, 9-53 clock generator 2-8, 9-7 general-purpose I/O pins 9-20 to 9-21 host port interface (HPI) 2-9, 9-87 parallel I/O ports 2-9, 9-22 peripheral control 9-2 serial port interface 2-10, 9-23 software-programmable wait-state generators 2-8, 9-13 TDM serial port 2-10, 9-74 timer 2-8, 9-9 on-chip ROM 2-6, 8-2, 8-3, F-2 opcode See also assembler defined H-17 summary 6-8 operand H-17 OPL instruction description 6-185 summary 6-14 OR instruction description 6-188 summary 6-10 ORB instruction description 6-191 summary 6-11 4-22 oscillator/timer expanded options A-19 standard options A-18 OUT instruction description 6-192 summary 6-20
N
NDX bit 4-9, 5-6, H-16 NEG instruction description 6-178 summary 6-10 nested interrupt nested loops H-16 4-32
next instruction repeat function NMI instruction description 6-180 summary 6-18 NMI pin A-16 nomenclature G-4, G-5 nonrepeatable instructions NOP instruction description 6-181 summary 6-21 NORM instruction description 6-182 summary 6-10
4-29
OV bit
4-11, H-17
overflow (OV) bit H-17 See also OV bit overflow mode (OVM) bit See also OVM bit OVLY bit OVM bit 3-12, 4-11, H-17 H-17
Index-11
P
P bit 9-18 PAC instruction description 6-194 summary 6-16 packages C-2 PAER H-17 See also block repeat program address end register (PAER) parallel EPROM boot mode 8-36 parallel I/O boot mode 8-37 parallel I/O ports 2-9, 9-22 parallel logic unit (PLU) 2-4, 3-15 to 3-16, H-17 block diagram 3-15 parallelism 2-3, 2-5, 2-7, 6-27 part numbers, tools G-7 part-order information G-4 PASR H-17 See also block repeat program address start register (PASR) PC H-17 See also program counter (PC) PCM bit 9-58, H-17 PDWSR H-18 See also program/data wait-state register (PDWSR) peripheral control 9-2 peripheral reset 9-6 PFC H-18 See also prefetch counter (PFC) pinouts A-1 C50 A-8 C51 A-4, A-8 C52 A-2, A-4 C53 A-8 C53S A-4 C57S A-10 LC56 A-4 LC57 A-6 100-pin QFP A-2, A-3 100-pin TQFP A-4, A-5 128-pin TQFP A-6, A-7 132-pin BQFP A-8, A-9 144-pin TQFP A-10, A-11 pipeline defined H-18 latency H-15 Index-12
pipeline operation 7-1, 7-3 1-word instruction 7-3 2-word instruction 7-5 branch not taken 7-9 branch taken 7-6 external memory conflict 7-21 four phases 7-2 latency 7-24 memory-mapped registers 7-14 normal 7-3 structure 7-2 subroutine call and return 7-11 PLCC package C-3 PLU H-18 See also parallel logic unit (PLU) PM bits 3-7, 4-15, 6-254, H-18 PMST H-18 See also processor mode status register (PMST) POP instruction description 6-195 summary 6-21 POPD instruction description 6-197 summary 6-21 postscaling shifter H-18 power-down mode 4-50 IDLE instruction 4-50 IDLE2 instruction 4-50 PRD H-18 See also timer period register (PRD) prefetch counter (PFC) 5-15, H-18 PREG H-18 See also product register (PREG) preprocessor interface G-8 prescaling shifter H-18 priorities, interrupt 4-37 processor mode status register (PMST) 3-24, 4-7, H-18 AVIS bit 4-8, 8-13, 8-14, H-1 bit summary 4-8 BRAF bit 4-9, H-4 diagram 4-8 IPTR bits 4-8, 8-11, 8-12, H-15 MP/MC bit 4-9, 8-7, H-16 NDX bit 4-9, H-10 OVLY bit 4-8, 8-15, 8-32, H-19 RAM bit 4-8, 8-8, 8-32 reset status 4-46 TRM bit 4-9, H-10
product register (PREG) 3-7, 3-24, H-18 product shift mode (PM) bits H-18 See also PM bits program address bus (PAB) 4-2 program bus 2-3 program control 4-1 block repeat function 4-31 functional block diagram 4-2 interrupts 4-36 next instruction repeat function 4-22 power-down mode 4-50 reset 4-45 status and control registers 4-6 program controller 2-5, H-19 program counter (PC) 4-2, 8-11, 8-13, H-19 program execution 4-2, 8-27 program memory 2-6, 4-5, 8-7 address map 8-11 addressing 8-13 configuration 8-7 to 8-11 protection feature 8-14 program/data wait-state register (PDWSR) 3-24, 9-13, H-19 diagram 9-13, 9-14 reset status 4-47 PS pin A-14 PSC bits 9-10, H-19 p-scaler 3-7, H-19 set shift 6-254 PSHD instruction description 6-199 summary 6-21 pulse coded modulation mode (PCM) bit H-19 See also PCM bit PUSH instruction description 6-201 summary 6-21
Q
quad flat-pack (QFP) package A-1
R
R/W pin 8-39, A-14 RAM bit 4-8, 8-8, 8-32
RAM overlay (OVLY) bit H-19 See also OVLY bit RD pin A-14 read/write timings 8-39 READY pin A-14 receive buffer half received (RH) bit H-19 See also RH bit receive ready (RRDY) bit H-20 See also RRDY bit receive shift register full (RSRFULL) bit H-20 See also RSRFULL bit receiver reset (RRST) bit H-20 See also RRST bit regional technology centers G-3 register 3-21 autobuffering control 9-63 auxiliary (AR) 3-21, H-3 auxiliary register compare (ARCR) 3-19, 3-21, H-3 block move address (BMAR) 3-21, H-4 block repeat 3-21 block repeat counter (BRCR) H-4 block repeat program address end (PAER) H-4 block repeat program address start (PASR) H-4 BSP address receive (ARR) H-4 BSP address transmit (AXR) H-5 BSP control extension (SPCE) H-5 BSP receive buffer size (BKR) H-5 BSP transmit buffer size (BKX) H-5 buffered serial port (BSP) 3-22 circular buffer 3-22 circular buffer control (CBCR) 4-6, H-7 circular buffer end register (CBERx) H-6, H-7 circular buffer start (CBSRx) H-7 data receive (DRR) H-8 data receive shift (RSR) H-9 data transmit (DXR) H-9 data transmit shift (XSR) H-9 dynamic bit manipulation (DBMR) 3-22, H-10 global memory allocation (GREG) 3-23, 8-20, H-12 host port interface (HPI) 3-23 host port interface address (HPIA) H-13 host port interface control (HPIC) H-13 I/O port wait-state (IOWSR) H-13 index (INDX) 3-19, 3-23, H-14 instruction (IREG) 3-23, H-14 interrupt 3-23, 4-39, 4-40 interrupt flag (IFR) H-14
Index-13
register (continued) interrupt mask (IMR) H-14 memory-mapped 2-5, 8-17 prefetch (PFC) H-18 processor mode status (PMST) 3-24, 4-7, H-18 product (PREG) 3-24, H-18 program/data wait state (PDWSR) H-19 program/data wait-state (PDWSR) 9-13, 9-14 repeat counter (RPTC) 4-22, H-20 reset status 4-46 to 4-48 serial port 9-24 serial port control (SPC) H-21 serial port interface 3-24 software wait-state control (CWSR) H-26 software-programmable wait states 3-24 status 3-25, 4-10 TDM channel select (TCSR) H-22 TDM data receive (TRCV) H-23 TDM data receive shift (TRSR) H-23 TDM data transmit (TDXR) H-23 TDM receive address (TRAD) H-23 TDM receive/transmit address (TRTA) H-23 TDM serial port 3-25, 9-74 TDM serial port control (TSPC) H-23 temporary 3-25, H-24, H-26 timer 3-25 timer control (TCR) 9-10, H-24 timer counter (TIM) H-24 timer period (PRD) H-24 repeat counter register (RPTC) reset status 4-46 repeat function block 4-31 next instruction reset CPU 4-45 defined H-20 peripherals 9-6 RET instruction description 6-203 summary 6-18 RETC instruction description 6-204 example 4-18 summary 6-18 RETCD instruction description 6-206 summary 6-18 Index-14 3-21, 4-22, H-20
RETD instruction description 6-208 summary 6-18 RETE instruction description 6-209 summary 6-18 RETI instruction description 6-210 summary 6-18 RH bit RINT bit 9-64, H-20 3-14 H-20 right shift
ROL instruction description 6-211 summary 6-11 ROLB instruction description 6-212 summary 6-11 ROM codes 2-6, F-1 development flow F-3 submitting ROM code F-4 ROR instruction description 6-213 summary 6-11 RORB instruction description 6-214 summary 6-11 RPT instruction description 6-215 summary 6-22 RPTB instruction description 6-218 example 4-31, 4-32 summary 6-22 RPTC H-20 See also repeat counter register (RPTC) RPTZ instruction description 6-220 summary 6-22 RRDY bit RRST bit RS pin 9-29, 9-35, H-20 9-29, 9-34, H-20
repeatable instructions
4-45, A-16
RSR H-20 See also data receive shift register (RSR) RSRFULL bit RTCs G-3 9-28, 9-36, H-20
S
SACB instruction description 6-221 summary 6-11 SACH instruction description 6-222 summary 6-11 SACL instruction description 6-224 summary 6-11 SAM H-20 See also shared-access mode (SAM) SAMM instruction description 6-226 summary 6-11 SAR instruction description 6-228 summary 6-13 SARAM H-20 See also single-access RAM (SARAM) SATH instruction description 6-230 summary 6-11 SATL instruction description 6-232 summary 6-11 SBB instruction description 6-233 summary 6-11 SBBB instruction description 6-234 summary 6-11 SBRK instruction description 6-235 summary 6-13 scaling shifters 3-14 scratch-pad RAM 8-18, H-20 seminars G-3 serial boot mode 8-34 serial port control register (SPC) 3-24, 8-34, 9-24, H-21 bit summary 9-28 diagram 9-28 DLB bit 9-31, 9-32, H-9 FO bit 9-31, 9-32, H-11 Free bit 9-28, 9-37, H-11
FSM bit 9-30, 9-33, H-11 IN0 bit 9-29, 9-35, H-14 IN1 bit 9-29, 9-35, H-14 MCM bit 9-30, 9-33, H-7 reset status 4-47 RRDY bit 9-29, 9-35, H-20 RRST bit 9-29, 9-34, H-20 RSRFULL bit 9-28, 9-36, H-20 Soft bit 9-28, 9-37, H-21 TXM bit 9-30, 9-33, H-25 XRDY bit 9-29, 9-35, H-25 XRST bit 9-30, 9-34, H-25 XSREMPTY bit 9-29, 9-35, H-25 serial port interface 2-10, 3-24, 9-23, H-21 configuring 9-27 error conditions 9-46 operation 9-25 operation examples 9-50 receive operation burst mode 9-37 continuous mode 9-44 registers 3-24, 9-24 signal descriptions A-20 transmit operation burst mode 9-37 continuous mode 9-44 serial port receive interrupt (RINT) bit See also RINT bit serial port transmit interrupt (XINT) bit See also XINT bit H-21 H-21
serial ports buffered serial port (BSP) 9-53 serial port interface 9-23 time-division multiplexed (TDM) 9-74 set control bit 6-236 6-254 set p-scaler shift
SETC instruction description 6-236 summary 6-22 SFL instruction description 6-238 summary 6-11 SFLB instruction description 6-239 summary 6-11 SFR instruction description 6-240 summary 6-11
Index-15
SFRB instruction description 6-242 summary 6-11 shadow registers 2-10, 4-42, 6-210 shared-access mode (SAM) H-21 shared-access mode (SMOD) bit H-21 See also SMOD bit shifters H-3, H-21 postscaler H-18 prescaler H-18 product H-19 short immediate addressing 5-14 signal descriptions A-13 address and data bus A-13 buffered serial port (BSP) A-21 emulation/testing A-24 host port interface (HPI) A-22 initialization A-16 interrupt A-16 memory control A-14 multiprocessing A-15 oscillator/timer A-17 reset operation A-16 serial port interface A-20 supply A-16 signals buffered D-10 buffering for emulator connections D-9 to D-10 sign-extension H-21 sign-extension mode (SXM) bit H-21 See also SXM bit single-access RAM (SARAM) 2-7, 6-27, 8-2, 8-25, H-21 SMMR instruction description 6-244 example 8-31 summary 6-20 SMOD bit H-21 sockets E-2 Soft bit 9-10, 9-28, 9-37, H-21 software development tools G-2, G-7 software wait states C-7 software wait-state generation 8-42 software-programmable wait-state generators 2-8, 9-13 block diagram 9-19 I/O port wait-state register (IOWSR) 9-16 Index-16
logic for external program space 9-19 program/data wait-state register (PDWSR) 9-13 wait-state control register (CWSR) 9-17 software-programmable wait-state registers 3-24 SPAC instruction description 6-247 summary 6-16 SPC H-22 See also serial port control register (SPC) SPCE H-22 See also BSP control extension register (SPCE) SPH instruction description 6-248 summary 6-16 SPL instruction description 6-250 summary 6-16 SPLK instruction description 6-252 summary 6-14 SPM instruction description 6-254 summary 6-16 SQRA instruction description 6-255 summary 6-16 SQRS instruction description 6-257 summary 6-17 SST instruction description 6-259 summary 6-22 stack hardware 4-4, 4-42, H-22 microcall (MCS) 5-15, H-16 status and control registers 4-6, H-22 status register 0 (ST0) 3-25, 4-10, H-22 ARP bits 4-11, H-3 bit summary 4-11 diagram 4-11 DP bits 4-12, H-8 INTM bit 3-23, 4-12, 4-40, 8-32, H-15 OV bit 4-11, H-17 OVM bit 4-11, H-17 reset status 4-46 status register 1 (ST1) 3-25, 4-10, H-22 ARB bits 4-13, H-3 bit summary 4-13 C bit 4-14, H-6
status register 1 (ST1) (continued) CNF bit 4-13, 8-8, 8-15, 8-32, H-7 diagram 4-13 HM bit 4-15, 8-14, 8-24, H-12 PM bits 4-15, H-18 reset status 4-46 SXM bit 4-14, H-21 TC bit 3-21, 4-13, H-24 XF bit 4-15, H-10 STRB pin A-14 strobe signal (STRB) 8-24 SUB instruction description 6-261 summary 6-12 SUBB instruction description 6-265 summary 6-12 SUBC instruction description 6-267 summary 6-12 submitting ROM code F-4 SUBS instruction description 6-269 summary 6-12 SUBT instruction description 6-271 summary 6-12 support tools development G-6 device G-6 nomenclature G-4 SXM bit 3-14, 4-14, H-22 system migration C-1 instruction set C-11 on-chip peripheral interfacing C-10 packages and pin layout C-2 timing C-7
T
TADD H-22 See also TDM address (TADD) target system, connection to emulator target system clock D-7 TBLR instruction 8-26 description 6-273 example 8-29, 8-30 summary 6-20 D-1 to D-13
TBLW instruction 8-26 description 6-276 example 8-28, 8-29 summary 6-20 TC bit 3-21, 4-13, H-22 TCK pin A-24 TCLK H-22 See also TDM clock (TCLK) TCLKR pin A-20 TCLKX pin A-20 TCR H-22 See also timer control register (TCR) TCSR H-22 See also TDM channel select register (TCSR) TDAT H-22 See also TDM data (TDAT) TDDR bits 9-10, H-22 TDI pin A-24 TDM address (TADD) 9-77, H-22 TDM bit H-22 TDM channel select register (TCSR) 3-25, 9-75, H-22 TDM clock (TCLK) H-22 TDM data (TDAT) H-23 TDM data receive register (TRCV) 3-25, 9-75, H-23 TDM data receive shift register (TRSR) 3-25, 9-76, H-23 TDM data transmit register (TDXR) 3-25, 9-75, H-23 TDM receive address register (TRAD) 3-25, 9-75, H-23 TDM receive interrupt (TRNT) bit H-23 See also TRNT bit TDM receive/transmit address register (TRTA) 3-25, 9-75, H-23 TDM registers, diagram 9-78 TDM serial port control register (TSPC) 3-25, 9-75, H-23 DLB bit H-9 FO bit H-11 Free bit 9-28, 9-37, H-11 FSM bit H-11 IN0 bit 9-29, 9-35, H-14 IN1 bit 9-29, 9-35, H-14 MCM bit 9-30, 9-33, H-7 reset status 4-47
Index-17
TDM serial port control register (TSPC) (continued) RRDY bit 9-29, 9-35, H-20 RRST bit 9-29, 9-34, H-20 Soft bit 9-28, 9-37, H-21 TDM bit H-24 TXM bit 9-30, 9-33, H-25 XRDY bit 9-29, 9-35, H-25 XRST bit 9-30, 9-34, H-25 TDM serial port interface 2-10, 9-74 exception conditions 9-82 operation 9-76 operation examples 9-82 receive operation 9-80 registers 3-25, 9-74 transmit operation 9-80 TDM transmit interrupt (TXNT) bit See also TXNT bit TDO pin TDR pin TDX pin A-24 A-20 A-20 H-23
TDXR H-23 See also TDM data transmit register (TDXR) temporary register 0 (TREG0) 3-7, 3-25, 6-139, 6-141, 6-143, 6-146, 6-148, 6-169, 6-172, 6-174, 6-176, H-26 temporary register 1 (TREG1) 3-12, 3-14, 3-25, 6-41, 6-230, 6-232, 6-271, H-26 temporary register 2 (TREG2) test/control (TC) bit See also TC bit test/emulation 2-11 TFSR/TADD pin TFSX/TFRM pin third-party support A-20 A-20 A-1 G-2 H-24 3-25, 6-66, H-26
TIM H-24 See also timer counter register (TIM) time-division multiplexed (TDM) bit See also TDM bit time-division multiplexing (TDM) basic operation 9-74 defined H-24 timer 2-8, 9-9 block diagram 9-9 operation 9-11 registers 3-25, 9-9 Index-18 H-24
timer control register (TCR) 3-25, 9-10, H-24 bit summary 9-10 diagram 9-10 Free bit 9-10 PSC bits 9-10, H-25 reset status 4-48 Soft bit 9-10 TDDR bits 9-10, H-24 TRB bit 9-10, H-25 TSS bit 9-10, H-25 timer counter register (TIM) 3-25, H-24 reset status 4-48 timer divide-down register (TDDR) bits H-24 See also TDDR bits timer interrupt (TINT) 9-9 rate 9-11 timer interrupt (TINT) bit H-24 See also TINT bit timer period register (PRD) 3-25, H-24 reset status 4-48 timer prescaler counter (PSC) bits H-25 See also PSC bits timer reload (TRB) bit H-25 See also TRB bit timer stop status (TSS) bit H-25 See also TSS bit timing BIO signal 9-20 emulator D-11 external memory interface 8-39 XF signal 9-21 TINT bit H-25 TMS pin A-24 TMS320 advantages 1-2 development 1-2 evolution 1-3 family overview 1-2 history 1-2 roadmap 1-3 typical applications 1-4 TMS320 ROM code submittal, figure F-3 TMS320C5x applications 1-4 characteristics 1-6 functional block diagram 2-2 IEEE Std. 1149.1 interface configurations 2-12 key features 1-7
TMS320C5x (continued) compatibility 1-7 CPU 1-8 instruction set 1-8 memory 1-7 on-chip peripherals 1-9 packages 1-9 power 1-7 program control 1-8 speed 1-7 test/emulation 1-9 number of parallel ports available 2-9 number of serial ports available 2-9 overview 1-5 tools, part numbers TOUT pin A-17 G-7
TRST pin A-24 TRTA H-26 See also TDM receive/transmit address register (TRTA) TSPC H-26 See also TDM serial port control register (TSPC) TSS bit 9-10, H-26 TXM bit 9-30, 9-33, H-26 TXNT bit H-26
U
user-maskable interrupts 2-10
V
H-25 vectors interrupt 8-12 reset 4-38
TRAD H-25 See also TDM receive address register (TRAD) transmit buffer half transmitted (XH) bit See also XH bit transmit mode (TXM) bit See also TXM bit transmit ready (XRDY) bit See also XRDY bit transmit reset (XRST) bit See also XRST bit H-25 H-25 H-25 H-25
W
wait-state control register (CWSR) H-26 BIG bit 3-24, 8-22, 9-17, H-3 bit summary 9-17 D bit 9-18 diagram 9-17 I/O High bit 9-17 I/O Low bit 9-18 P bit 9-18 reset status 4-47 warm boot mode 8-38 WE pin A-14 word moves 8-26 workshops G-3 3-24, 9-17,
transmit shift register empty (XSREMPTY) bit See also XSREMPTY bit TRAP instruction description 6-279 summary 6-19 TRB bit 9-10, H-25 TRCV H-26 See also TDM data receive register (TRCV) TREG0 H-26 See also temporary register 0 (TREG0) TREG1 H-26 See also temporary register 1 (TREG1) TREG2 H-26 See also temporary register 2 (TREG2) TRM bit TRNT bit 4-9, H-26 H-26
X
X1 pin A-17 X2/CLKIN pin A-17 XC instruction description 6-280 example 4-20, 4-21 summary 6-19 XF bit 4-15, H-27 XF pin 8-34, 9-21, A-15, H-12 XH bit 9-65, H-27
TRSR H-26 See also TDM data receive shift register (TRSR)
Index-19
XINT bit H-27 XOR instruction description 6-282 summary 6-12 XORB instruction description 6-285 summary 6-12 XPL instruction description 6-286 summary 6-14 XRDY bit 9-29, 9-35, H-27 XRST bit 9-30, 9-34, H-27 XSR H-27 See also data transmit shift register (XSR)
XSREMPTY bit
Z
ZALR instruction description 6-289 summary 6-12 ZAP instruction description 6-291 summary 6-12 ZPR instruction description 6-292 summary 6-17
Index-20