TMS99105A and TMS99110A 16-Bit Microprocessors Preliminary Data Manual ADVANCE INFORMATION This document contains information on a new product. Specifications are subject to change without notice. NOTICE Texas Instruments reserves the right to make changes at any time in order to improve design and to supply the best product possible. Information contained in this publication is believed to be accurate and reliable. However, responsibility is assumed neither for its use nor for any infringement of patents or rights of others that may result from its use. No license is granted by implication or otherwise under any patent or patent right of Texas Instruments or others. Copyright © 1982 Texas Instruments Incorporated TABLE OF CONTENTS Section TItle 1. INTRODUCTION 1.1 Description 1.2 Key Features 2. ARCHITECTURE 2.1 Memory Allocation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2 Block Diagram and Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.3 Arithmetic Logic Unit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 10 2.4 Internal Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 10 2.4. 1 Program Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.4.2 Status Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 10 2.4.3 Workspace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 10 2.4.4 Context Switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 13 2.4.5 Access of PC, ST, and WP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 13 2.5 Macrostore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 13 3. MEMORY INTERFACE 3.1 Definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 14 3.2 Memory Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 16 3.2. 1 Memory Write Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 16 3.2.2 Memory Read Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 17 3.2.3 Extended Memory Addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 17 3.2.4 Direct Memory Access. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 19 3.2.5 Memory Wait-5tate Generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 20 3.3 Processor Internal Cycle Indication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 21 3.4 Applicable Bus Status Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 22 3.4.1 Memory Read Cycle Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 22 3.4.2 Memory Write Cycle Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 22 3.4.3 Hold Acknowledge Code - HOLDA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 22 3.4.4 Multiprocessor Interlock Code - MPILCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 22 3.4.5 Macrostore Accesses ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 23 4. INTERRUPT STRUCTURE 4.1 TMS99000 Interrupt Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 23 4.2 Interrupt Level 0 and Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.3 Non-Maskable Interrupt (NMI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.4 Interrupt Level 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 27 4.4.1 Arithmetic Fault Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.4.2 Macroinstruction Detection (MID) Trap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 29 4.4.3 lIIegalinstruction (lLLOP}lnterrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.4.4 Privileged Opcode Violation Interrupt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 30 4.4.5 Applicable Bus Status Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5. TMS99000 INPUT/OUTPUT INTERFACE 5.1 Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 30 5.2 Single-Bit 110 Operations ............. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 34 5.3 Multiple-Bit Seriali/O Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 35 5.4 Parallel 110 Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . •. 36 5.5 Applicable Bus Status Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 36 5.6 External Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 37 6. PRIVILEGED MODE ................ ',' ....................... , .............. . 37 iii 7. MACROSTORE INTERFACE AND OPERATION 7.1 Description ..... . 7.2 The Macrostore Interface . . . . . . . . . . . . . . . . . . . : . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 38 7.2.1 Timing. .. • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 38 7.2.2 Wait States. . . . . . . . . . . . • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 38 7.2.3 Organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 38 7.2.4 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 39 7.3 Macrostore Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 40 7.3.1 Entry Procedure . • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 40 7.3.2 Exit Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " 42 7.3.3 Macrostore Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 42 7.3.4 Subroutine Branch and Return. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 47 7.3.5 MID Opcodes in Interrupt Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " 47 7.3.6 Testing For External Macrostore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 8. ATTACHED PROCESSOR INTERFACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 47 9. PIN DESCRIPTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 52 10. INSTRUCTION SET 10.1 Definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 56 10.2 Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 10.2.1 Workspace Register Addressing, R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 56 10.2.2 Workspace Register Indirect Addressing, * R . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 56 10.2.3 Workspace Register Indirect Autoincrement Addressing, *R + ................. 56 10.2.4 Symbolic (Direct) Addressing, @LABEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 10.2.5 Indexed Addressing, @TABLE(R) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 57 10.2.6 Immediate Addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 57 10.2.7 Program Counter Relative Addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 57 10.2.8 110 Relative Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 58 10.3 Terms and Definitions . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 58 10.4 Status Register Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 10.5 Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 64 10.5.1 Dual Operand With Multiple Addressing Modes for Source and Destination. . . . . . . .. 65 10.5.2 Dual Operand With Multiple Addressing Modes for Source Operand. . . . . . . . . . . . .. 65 10.5.3 Signed Multiply and Divide Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 66 10.5.4 Extended Operation (XOP) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 10.5.5 Single Operand Instructions ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 68 10.5.6 BIND Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 10.5.7 Multiple-Bit 110 Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 68 10.5.8 Single-Bit 110 Instructions. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. 69 10.5.9 Jumplnstructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 10.5.10 Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 10.5.11 Immediate Register Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 71 10.5.12 Internal Register Load Immediate Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . .. 71 10.5.13 Internal Register Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 71 10.5.14 Return Workspace Pointer (RTWP)lnstruction . . . . . . . . . . . . . . . . . . . . . . . . . . .. 72 10.5.15 External Instructions . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 72 10.5.16 Bit Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.5.17 Double Precision Arithmetic Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 73 10.5.18 MIDOpcodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 10.6 Instruction Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 74 10.6.1 Microinstruction Cycle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 74 10.6.2 Opcode Prefetching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 74 10.6.3 TMS99000 Instruction Execution Times. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 75 10.6.4 Bus Status Code Sequence . . . . .. . . . ... ... . . ... . . .. .. ... . . . .. ....... 78 iv 11 . TMS991 05A/TMS9911 OA PRELIMINARY ELECTRICAL SPECIFICATIONS 11.1 Absolute Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 93 11.2 Recommended Operating Conditions. . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . . . . . .. 93 11.3 Electrical Characteristics ............... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 93 11.4 Clock Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 93 11.4.1 Internal Oscillator............................................... 93 11.4.2 External Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 94 11.5 Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . , . . . . . . . . . . . . . . . . .. 95 11.6 Switching Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 95 12. TMS99000 MECHANICAL SPECIFATIONS 12.1 TMS991 05A/TMS9911 OA - 40-Pin Ceramic Package. . . . . . . . . . . . . . . . . . . . . . . . . . .. 101 12.2 TMS991 05A/TMS9911 OA - 40-Pin Plastic Package. . . . . . . . . . . . . . . . . . . . . . . . . . . .. 101 APPENDIX A TMS991 05A Supplement .............. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 103 APPENDIX B TMS9911 OA Supplement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 105 LIST OF TABLES Table No. Title Paga 1 Dedicated Workspace Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2 Bus Status Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 15 3 Interrupt Level Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 24 4 Error Interrupt Status Bit Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 28 5 External Instruction Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 37 6 Macrostore Operating Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 39 7 Macrostore Entry Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 41 8 Instructions with Two-word Opcodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 42 9 Dedicated MRAM Register Functions (WP bits 11 to 15 are all zero) . . . . . . . . . . . . . . . . . . . . . . . . .. 43 10 Bus Status Codes Associated with WP Value (WP bits 11 to 15 not equal to zero) . . . . . . . . . . . . . . . .. 44 11 Evaluate Address Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 45 12 Jump on Pending Interrupt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . .. 46 13 Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 14 Symbol Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 15 Status Register Bit Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 59 16 Instruction Execution Times. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 76 17 Example Instruction Sequence for an A * R1 +. R2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 78 18 Source Addressing Mode Sequences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 79 19 Instruction Execution Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 80 20 Interrupt and Macrostore Trap Sequences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 91 21 Attached Processor ifF Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 92 v LIST OF FIGURES Figure No. Title Page 1 Word and Byte Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2 2 Map of Main Memory Address Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 3 3 Block Diagram of TMS99000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 4 4 TMS99000 Flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5 5 Status Register Field Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 6 Workspace Register Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 7 Workspace Pointer and Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1 2 8 Macrostore Memory Address Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1 4 9 Memory Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6 10 Memory Write Cycle Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1 6 11 Memory Read Cycle Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 7 12 Functional Segmentation Logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1 8 13 TMS99000 Extended Addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1 8 14 TMS991 05A or TMS9911 OA to TlM9961 0 Memory Mapper Interface . . . . . . . . . . . . . . . .. . . . . .. 19 15 Memory Cycle - DMA HOLD Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 20 16 Wait-State Generation For Memory Bus Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 21 17 Multiprocessor Interlock Timing - ABS, TSMB, TCMB Instructions .... . . . . . . . . . . . . . . . . . . . . .. 23 18 Interrupt Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 25 19 Reset Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 26 20 NMI Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 27 21 I/O Address Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 31 22 TMS99000 I/O Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 23 TMS99000 1/0 Timing - Input Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 32 24 TMS99000 1/0 Timing - Output Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 33 25 Wait-State Generation for 1/0 Cycles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 34 26 Single-Bit 1/0 Address Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 35 27 LDCRISTCR Data Transfers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 36 28 Address Map of Macrostore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . .. 39 29 Attached Processor (AP) Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 30 AP Interface Timing (A) Transferring Control to AP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 49 (B) Regaining Control from AP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 50 31 Pin Assignments . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 52 32 Overlapped Instruction Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 75 33 Internal Oscillator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 94 34 External Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 94 35 Switching Times Load Circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 96 36 Clock Timing Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 96 37 Memory and Internal Cycle Timing Parameters ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 97 38 1/0 Cycle Timing Parameters .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 98 39 Interrupt, Hold and APP Timing Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 99 40 Hold Cycle Timing Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 99 vi LIST OF ACRONYMS, COMMANDS AND CODES REFERENCE DEFINITION ABS Absolute value AID (bus) Address data bus AlATCH Address latch AP Attached processor APP Attached processor present AUMS Arithmetic logic unit, Macrostore access MPILCK inactive AUMSl Arithmetic logic unit, Macrostore access MPILCK asserted BlWP Branch and load workspace pointer BST Bus status code ClKOUT Clock output signal CRU Communications register unit DMA Direct memory access DOP (bus code) Destination operand transfer EIST Error interrupt status EVAD Evaluate address instruction GM (bus code) General memory transfer HOLD Self-explanatory HOLDA (bus code) Hold acknowledge lAO (bus codel Instruction acquisition IllOP Illegal operation INTA (bus code) Interrupt acknowledge INTREO Interrupt request 10 (bus code) I/O transfer lOP (bus codel Immediate data, symbolic address lDCR load CRU, output instruction lDD Long distance destination LOS long distance source lST load status lSW Least-significant word MEM Memory cycle MID(bus code) Macroinstruction detected MPILCK Multiprocessor interlock MSW Most-significant word NMI Non-maskable interrupt PC Program counter PSEL Memory page select RD Read enable RESET (bus code) Reset. RESET input is pulled low RTWP Return from subroutine or interrupt R/w Read/Write SBO Set bit to one SBZ Set bit to zero SOP (bus code) Source operand transfer, MPILCK inactive SOPl (bus codel Source operand transfer, MPILCK asserted ST (bus code) Status register update STCR Store CRU input instruction TB Test bit TCMB Test-and-clear memory bit TSMB Test-and-set memo", bit WS Workspace WEIIOClK Write enable and inverted I/O clock WP Workspace pointer XOP Extended operation vii/viii 1. INTRODUCTION , ., DESCRIPTION The TMS99000 series is a third generation family of single-chip 1 6-bit micrroprocessors and advanced peripherals, using N-channel silicon-gate SMOS technology. The TMS99000 family of processors offers un- precedented speed and a powerful instruction set that is an opcode-compatible enrichment of the TMS9900 and TMS9995 instruction set. These processors build on the unique memory-to-memory architecture that was pioneered at Texas Instruments and feature multiple register files, resident in memory, to permit faster response to interrupts and increased programming flexibility. The TMS99000 family includes two microprocessors, the TMS991 05A and the TMS9911 OA, which are iden- tical except for specialized programmations of the on-chip Macrostore memory. The ROM macrostore in the TMS9911 OA microprocessor contains floating point instructions as part of the machine language instruction set. The TMS99105A microprocessor contains RAM macrostore while the TMS99110A contains both RAM and ROM macrostore. Texas Instruments manufactures a complete set of MOS and TTL integrated circuits to provide memory and logic functions for the TMS99000 system. The system is fully supported by software and a complete prototyping system. All references in this document, unless explicitly indicated, refer to all members of the TMS99000 family of microprocessors. '.2 KEY FEATURES • 1 6-bit instruction word • Memory-to-memory architecture • Instantaneous access to 256K bytes of memory • 84-instruction superset of TMS9900 instruction set - SIGNED multiply and divide - Long-word (32-bit) shift, add, subtract Load status register, load workspace pointer Stack support - branch and push link, branch indirect Multiprocessor support - test, test and clear, test and set • Privileged mode • Macrostore* emulation of user-defined instructions • Status signals to identify processor activity • Interrupt acknowledge signal • Arithmetic fault interrupt • Illegal instruction interrupt • 16 prioritized hardware interrupts • 16 software interrupts (XOPS) • Programmed 1/0 • DMA compatible • Bit - , byte - and word-addressable 1/0 • Multiprocessor system interlock signal (hardware support for indivisible operations on semaphores) • Attached processor interface • N-channel silicon-gate SMOS technology • 167 nsec machine cycle time • On-chip clock generator and oscillator • Milcroatore i. a trademark of Texas Instruments Incorporated 1 • 40-pin package • Single + 5 volt supply 2. ARCHITECTURE 2.1 MEMORY ALLOCATION The memory word of the processor is 1 6 bits long as shown in Figure 1 . Words are assigned even-numbered ad- dresses in memory. The contents of each memory word can also be treated as two bytes of eight bits each. The in- struction set supports both word and byte opar-ations. A 1 6-bit address is explicitly manipulated by all memory ad· dressing modes, but only the 1 6-bit word address Is provided to the memory system. This allows direct addressing of 64K bytes of memory space, referred to as the logical address space. The instantaneous address reach of the processor may be increased to 266K bytes using the techniques described in Section 3.2.3. MSB LSB I0 I SIGN BIT ,~--------------~ V ~--------------~/ MEMORY WORD (EVEN ADDRESSI MSB LSB 2 3 4 5 6 SIGN BIT ,'-______ ,._ _ _.,.,A,-_ _ _-.. ,._ _ _.,/ V EVEN BYTE V ODD BYTE FIGURE 1 - WORD AND BYTE FORMATS Byte instructions may access either byte as necessary. Byte instructions involving workspace register data operate on the most-significant byte (even address in Figure 1) of the workspace register, and leave the least- significant byte (odd address) unchanged. The two bytes in a register can be swapped using the SWPB instruc- tion. Additionally, since the workspace resides in memory, the least-significant byte of a register may be address- ed, if desired, using any of the general memory addressing modes. The processor memory map (Figure 2) shows the locations in the memory address space for the interrupt and XOP trap vectors, and the non-maskable interrupt (NMI). All remaining memory space is available for programs, data, and workspaces. 2 MEMORY AREA DEFINITION ADDRESS MEMORY CONTENTS 0000 WP LEVEL 0 INTERRUPT 0002 PC LEVEL 0 INTERRUPT 0004 WP LEVEL 1 INTERRUPT 0008 PC LEVEL 1 INTERRUPT INTERRUPT VECTORS "I-' .. I'- 003C WP LEVEL 16 INTERRUPT 003E PC LEVEL 16 INTERRUPT 0040 WP XOPO 0042 PC XOPO XOP SOFTWARE .. ~ TRAP VECTORS 007C """ WP XOP16 007E PC XOP 15 0080 GENERAL MEMORY AREA GENERAL MEMORY FOR MAV BE ANY PROGRAM.DATA,AND COMBINATION OF WORKSPACE REGISTERS PROGRAM SPACE OR WORKSPACE FFFA FFFC WP NMI FUNCTION NMI SIGNAL VECTOR FFFE PC NMI FUNCTION FIGURE 2 - MAP OF MAIN MEMORY ADDRESS SPACE 2.2 TMS99000 BLOCK DIAGRAM AND FLOW CHART The block diagram of the processor is shown in Figure 3. A flowchart, representative of the processor functional operation, Is shown in Figure 4. 3 !II"- XTAL 1 WAIT-8TATE LOGIC -I MEMORY CONTROL 1--.- 1t L. .- CLOCKS I--- XTAL2 ~CLKOUT INTERRUPT : : - AND INT MICROCONTROLLER INT REQUEST LOGIC I t 1 1 -'- I ...0 r---- r--+ MICRO JUMP L IR L --- --- II: ~ Z 0 (J I STREG -L, > II: 0 ::& tJ~ w : CONSTANT I ST IJI ::& I:i rl 0( I ~. ALU SHIFT I > LOGIC COUNT [ ~ w Q -,.. I MQREG L "j ....- ::& 0 II: (J ~ :;) 1= :;) 0 III :;) IJI IJI ALU TREG "- jJ ~ ~ ~ ~ :;) IlL ~ ~ II: (J ~ II: 0 . .- CD .... ietSHIFT"}-J IJI IJI :;) 0 II: - w Q, CD .... ~ I I WP L ::& I L PC L III ~ DREG r:- i I L MAREG ~ ~ is ~ .. f-- ~ r. L::t KREG BYTE SWAPPER e- J.- ------ SBUS li: 0 II: ~ ::& ~ - PBUS + ADDRESS/DATA I/O FIGURE 3 - BLOCK DIAGRAM OF TMS99000 4- VECTOR @OOOO(1SI MASK4-0000 VECTOR@FFFC(1SI MASK4-0000 SAVE OLD WP INWR13 YES VECTOR @00081181 MASK4-0001 YES VECTOR @OOOO(181 MASK+OOOO VECTOR @4 ClCO-31 EXTERNAL INTERRUPT MASK 4- CLEAR ST7 -1 1 LEVELS 1-15 ACTIVE LEVEL - 1 AND LOAD NEW INTERRUPT MASK INTO ST12-ST15 YES FIGURE 4 - TMS99000 FLOWCHART 5 FETCH NEXT INSTRUCTION USING NEW PC PCe-PC+2 COMPLETE EXECUTION OF CURRENT !NSTR. «WRITE RESULTS) SET FAULT FLAGEIST4 NO SET FAULT FLAG EIST14 FIGURE 4 - YMS99000 FLOWCHART (CONY'DI 6 START EXECUTION OF NEW INSTRUCTION. UPDATE PC IF JUMP. FETCH OPERANDS YES NO LOCK IN ACTIVE INTERRUPT REQUEST YES FIGURE 4 - TMS99000 FLOWCHART (CON'O) 7 NO YES NO PC_PC-2 VECTOR@OOOI(1S) READNEWWP WR13 OLDWP WR14 OLDPC WR1S OLDST NO WP WR13 PC WR14 LOCK IN ACTIVE ST WR1S INTERRUPT REQUEST ICO-3 FIGURE 4 - TMS99000 FLOWCHART (CONT'D) 8 PC_PC-2 USE RTWP >382 SET ILLOP FLAG EIST13 USE RTWP >380 USE RTWP >384 FIGURE 4 - TMS99000 FLOWCHART (CONCLUDED) 9 2.3 ARITHMETIC LOGIC UNIT The arithmetic-logic unit (ALU) performs all arithmetic and logical operations required during instruction execution. These operations include addition, subtraction, AND, OR, exclusive-OR and complement. A separate comparison circuit within the chip performs the logical and arithmetic comparisions needed to control bits 0, 1 and 2 (Figure 5) of the status register. Byte operations are performed in the most-significant half of the ALU. The least-significant half of the result in byte operations is left unchanged. This conveniently permits the status circuitry used for word operations to be used for byte operations as well. 2.4 INTERNAL REGISTERS The following three internal registers are accessible to the programmer: • Program Counter (PC) • Status Register (ST) • Workspace Pointer (WP) Other internal registers that perform instruction acquisition and execution are inaccessible to the programmer. 2.4.1 Program Counter The program counter (PC) is a 1 5-bit hardware register that contains the memory address (or external Macrostore address; see Section 7) of the instruction word following the currently executing instruction. Conceptually, the PC is a 16-bit register that functions as a count-by-two counter with the least-significant bit (LSB) hardwired to O. Since instructions are constrained to word boundaries, the processor reads the instruction word from the location pOinted to by the PC, and increments the contents of the PC by two in preparation for the next instruction fetch. A program branch is performed by replacing the contents of the PC with the address of an instruction word located in memory or Macrostore. All jump, branch and context-switching instructions alter the PC in this manner. 2.4.2 Status Register The status register (ST) is a fully-implemented 16-bit internal register whose contents signify the results of arithmetic and logical comparisons, indicate program status conditions, and supply the arithmetic fault interrupt enable and the interrupt mask to the interrupt priority circuits. Each bit position in the register represents a par- ticular processor function or condition. Figure 5 illustrates the bit position assignments. Certain instructions, when executed, use the status register to check for a prerequisite condition; others affect the values of the bits in the register; still others load the entire status register with a new value. This last case occurs when an LST, RTWP or XOP instruction is executed. Other conditions causing a new status to be loaded are (1) an interrupt, and (2) return of system control from an attached processor (Section 8) to the host system. After the new status has been load- ed, an ST bus status code is output along with bits 7 to 11 of the updated status register. The effect of each individual instruction on the contents of the status register is described in Section 10.5. The in- dividual status register bits are identified in Section 10.4 along with the conditions affecting each bit. 2.4.3 Workspace A workspace is a block of 16 contiguous words in memory that contains frequently-accessed data and addresses. The location of the workspace is defined by t~e workspace pointer register. internal to the processor, which con- tains the address of the first word in the workspace. Each word in the workspace is treated as an individual 16-bit general-purpose register. Workspace registers (WRs) contain data and addresses, and function as operand registers, accumulators, address registers and index registers. During interrupts and certain instructions, however, particular WRs are assigned the special roles described in Table 1. As indicated in the workspace map in Figure 6, all 16 WRs manipulate data and addresses, .but only WRs 1 through 1 5 can be used as index registers. 10 o 1 2 3 4 5 8 7 8 9 13 14 15 (XOP) EMULATE ENABLE UNDEF ARITHMETIC FAULT INTERRUPT ENABLE --------MAP SELECT ' - - - - - - PRIVILEGED MODE ' - - - - - - - X O P IN PROGRESS '--------PARITY (ODD NO. OF BITS) '--------ARITHMETIC FAULT ......- - - - - - CARRY OUT '---------EQUALITB INDICATOR '----------ARITHMETIC GREATER THAN ' - - - - - - - - - - LOGICAL GREATER THAN FIGURE 6 - STATUS REGISTER FIELD ASSIGNMENTS REGISTER 0 1 2 3 4 5 8 DATA OR 7 ADDRESSES INDEX 8 CAPABILITY 9 10 11 12 13 14 15 FIGURE 8 - WORKSPACE REGISTER USAGE 11 TABLE 1 - DEDICATED WORKSPACE REGISTERS REGISTER NUMBER CONTENTS USED DURING 0 Shift count (optional) Shift instructions (SLA, SRA, SRC, and SRL) Multiplicand and MSW of result Signed multiply MSW of dividend and quotient Signed divide MSW of floating point accumulator Floating point operations 1 LSW of result Signed multiply LSW of dividend and remainder Signed divide 11 Return address Branch and link instruction (BL) Effective address Extended operation (XOP) 12 CRU base address CRU instructions (SBO, SBZ, TB, LDCR, and STCR) 13 Saved WP register Context switching (BLWP, RTWP, XOP, recognized interrupt, NMI, and RESET), ex- ternal process 14 Saved PC register Context switching (BLWP, RTWP, XOP recognized interrupt, NMI, and RESET), ex- ternal process 15 Saved ST register Context switching (BLWP, RTWP, XOP, recognized interrupt, NMI, and RESET), ex- ternal process WORKSPACE ADDRESS REGISTER -- WORKSPACE POINTER REGISTER IN MEMORY NUMBER I WP 1-1---. (WP)+OO WRO (WP) +02 WR1 (WP)+04 - WR2 (WP)+06 _ WR3 (Wj»+08 _ WR4 (WP)+OA - WR5 (WP)+OC_ WR6 -- THE MICROPROCESSOR ADDS THE CON- TENTS OF THE WP TO TWO TIMES THE WORKSPACE REGISTER NUMBER TO DERIVE (WP)+OE WR7 -- THE ADDRESS IN MEMORY OF THE REGISTER. (WP) + 10 WR8 WORKSPACE REGISTERS ARE ALWAYS LOCATED AT EVEN ADDRESSES SINCE THEY (WP) + 12 WR9 FALL ON WORD BOUNDARIES. -- (WP) + 14 WR10 (WP) + 16 WR11 (WP) + 18 WR12 (WP)+1A - WR13 (WP)+1C - WR14 (WPl+1E - WR15 FIGURE 7 - WORKSPACE POINTER AND REGISTERS 12 The location of the workspace in memory is defined by a hardware register, internal to the processor, called the workspace pointer (WP). The WP contains the address of the first workspace register (WRO). Conceptually, the WP is a 16-bit register with the LSB hardwired to O. As indicated in Figure 7, the memory address of WRn, n=0,1 , ... ,15, is calculated as (WP) +2n. * 2.4.4 Context Switching The processor's memory-resident workspace is a particularly valuable featur.e in applications that require frequent context switches. A context switch is a change from one program execution environment to another such as takes place during a subroutine call or an interrupt. Since the workspace registers already reside in memory,· the processor performs a context switch simply by saving its three internal registers, the WP, PC and ST, in memory and fetching the new WP and PC from memory. The processor realizes a similar time savings in returning from an interrupt or subroutine. The original context is restored by simply replacing the contents of the WP, PC and ST with the values saved in memory. The instructions that result in a context switch include BLWP (branch and load workspace pointer),.RTWP lretum from subroutine or interrupt) and XOP (extended operation). A device interrupt, arithmetic fault interrupt, privileg- ed opcode violation, illegal instruction error, a RESET or an NMllnon-maskable interrupt) also causes a context switch by forcing the processor to trap to a service routine. 2.4.5 Access of PC, ST. and WP System control can be transferred from the processor to an external device such as an attached processor or maintenance panel. During the transfer of control, the processor writes the contents of its WP, PC and ST to memory where they can be accessed and modified by the external device. Upon return of control to the processor, the WP, PC and ST are updated with the modified values from memory. The details are presented in Section 8. 2.5 MACROSTORE The TMS99000 addresses a 64K byte memory address space, which is logically distinct from the main memory address space. This memory space, which is called Macrostore, is logically differentiated from the main memory space through a bus status code output by the processor. The TMS99000 has reserved the first 4K byte addresses for on-chip Macrostore memory. Of this 4K byte space, there are 1K bytes of ROM and 32 bytes of RAM implemented on the initial versions of the TMS99000. The TMS991 05 does not utilize its on-chip ROM; however it does provide the 32 bytes of RAM eliminating the exter- nal RAM requirement in many cases where external Macrostore memory is provided. Other versions of the TMS99000 family provide preprogrammed functions in the on-chip Macrostore ROM (e.g. TMS99110 floating point). All members of the TMS99000 family can address external Macrostore memory for prototyping and ap- plications requiring more than the 1K bytes of on-chip ROM. Macrostore memory space implements added functions or instructions through emulation routines written in stan- dard machine code. The Macrostore address space is entered through the attempted execution of a subset of the unused opcodes called macroinstructions. When attempted execution of the macroinstruction takes place, the processor traps to a specified location within the Macrostore. It is the Macrostore-resident software's responsibili- ty to decode and perform the emulation of the function or instruction. A Macrostore memory map is shown in Figure 8. Section 7 describes the interface and use of the Macrostore memory space . • Enclosing WP in parenthesis means that the contents of WP ara being r.farred to. 13 AREA DEFINITION MEMORY MEMORY CONTENTS ADDRESS >0000 32 BYTES ON-CHIP RAM >001E >0020 >07FE >0800 ENTRY TABLE INTERNAL MACROSTORE ADDRESSES (ALL BUT RAM MAY BE MAPPED >0812 >0814 ------------- EXTERNALL YI 1 K BYTES ON-CHIP ROM >OBDE >OBEO >OFFE >1000 EXTERNAL MACROSTORE ADDRESS USER'S ROM AND RAM >FFFE FIGURE 8 - MACROSTORE MEMORY ADDRESS SPACE 3. TMS99000 MEMORY INTERFACE 3.1 DEFINITION The processor pin functions are described in Section 9. Several of the pins have dual or multiple functions deter- mined by the state of the ALATCH, MEM. and bus status code (BST1-BST31 outputs. Processor operations involv- ing the transfer of data utilize the time-multiplexed address and data lines. These lines, along with the correspon- ding control signals, comprise the local bus interface of the processor. The local bus interface is used to perform memory. DMA, input/output. external Macrostore. and attached processor operations. The term. bus cycle, describes the sequence of handshake operations necessary to complete the transfer of one datum over the local bus. The beginning of each bus cycle is marked by a positive ALATCH pulse, during which an address is output on the bus, and MEM and the bus status code become valid. Each particuiar type of bus cycle is indicated by its own unique bus status code (Table 21. A read or write operation is indicated early in the cycle by the RIW output. The R/W output acts as an early predictor of whether the AD buffers will tristate when in the data bus mode (after the falling edge of ALATCH). The R/W output is different from traditional R/W indic;ators in that the R/W output provides direction indication for both memory and non-memory cycles. During memory write operations, Riw remains at a low level throughout the memory cycle. During memory read operations. RiW re- mains at a high level throughout the memory cycle. l:he R/W output may be used to enable the direction on various data bus buffers. The R/W output also provides an early indication of the RD output such that whe~R/Wis high at the beginning of the cycle. RD will be taken low by the processor after ALATCH goes low. If R/W is low at the beginning of the cycle. the RD output will remain high after ALATCH goes low. Following the falling edge of the ALATCH pulse. the bus is used either to perform a write operation or is forced to the high-impedance state for a read operation. The bus status. R/W. and MEM outputs remain stable throughout the duration of the bus cycle. and either the WE/IOCLK or Ri5 output may be pulsed low to perform a write or read operation. 14 TABLE 2 -BUS STATUS CODES BST MEM- 1 2 3 NAME DESCRIPTION OF BUS ACTIVITY L L L L SOPL Source operand transfer with MPILCK asserted. L L L H SOP Source operand transfer. MPILCK is inactive. L L H L lOP Immediate data or second word of two-word instruction, or symbolic address. L L H H IAQ* Instruction acquisition. First word of instruction is fetched from memory. L H L L DOP Destination operand transfer. H L H INTA Interrupt acknowledge. Active during the WP and PC fetch for an interrupt or XOP. L H H L WS Workspace transfer (or multi-word transfer beginning with WR15, and Ts=O). L H H H GM General memory transfer. H L L L AUMSL Internal arithmetic-logical unit operation or macrostore access with MPILCK asserted. H L L H AUMS Internal arithmetic-logical unit operation or macrostore access. MPILCK is inactive. H L H L RESET Reset. The RESET input is pulled low. H L H H 10 I/O transfer H H L L WP Workspace pointer update due to BLWP, RTWP, LWP, XOP, APP entry, APP exit or interrupt. The new workspace pointer is on the address bus. H H L H ST Status register update due to LST, RTWP, XOP, APP exit or interrupt. Bits 7-11 of the new status are on the address bus. This occurs prior to the fetch of the next instruction. H H H L MID Macroinstruction detected. APi> is sampled when READY is high. H H H H HOLDA Hold acknowledge. 'Due to opcode prefetch, IAQ for the next instruction may be output before the result of the current instruction is stored. During bus cycles dedicated to internal functions, the RD and WE/IOCLK outputs remain high and R/W goes low: no transfer of data takes place, although a bus status code is output. During these operations, the activity of the ALATCH and address-data lines is as described in the previous paragraph. For convenience, reference will occasionally be made to the "address bus" and "data bus" as if they were separate lines. The reader should remember that address and data are, in fact, multiplexed over the same physical lines. The basic time unit of the local bus interface is the machine state, which has a duration of one CLKOUT period. A bus cycle minimally requires one machine state to complete but may be extended by some integral number of ad- ditional machine states. Bus cycles can be extended by the READY input signal. READY is manipulated by external logic to permit the pro- cessor to work with slow memory or I/O devices. The additional machine states generated by the READY signal are called wait states. It should be noted that wait states may be generated even during internal ALU cycles as in- dicated by the bus status codes. Three types of bus cycle are distinguished: memory, I/O and internal. During a memory or I/O cycle, a data transfer takes place on the local bus accompanied by either the WE/IOCLK output signal. During all cycles R/W also is out- put to give an early indication of readlwrite at the start of the cycle and continues to be active until the end of the bus cycle. Either RD or WE/IOCLK is active during an internal cycle involving an access of external macrostore. During inter~ machine cycles, which are not Macrostore cycles (as defined by the bus status codes AUMSL and AUMS), the RD and WE/IOCLK outputs remain inactive high. Memory and non-I/O cycles have a minimum duration of one machine state, and a 110 cycle has a minimum duration of two machine states. A memory, 1/0 or internal cy- 15 cle can be extended by an arbitrary number of wait states by pulling the READY input low. Note that because in- ternal cycles can be wait-stated, care must be exercised in the design of external READY control logic to avoid wait-stating internal cycles that are not Macrostore cycles. 3.2 MEMORY INTERFACE The signals used in the interface to system memory are shown in Figure 9. MEM - R/W JI V ADDRESS/DATA (0·15) ~ 1\'I j ALATCH " WE/IOCLK T MS99000 RO MEMORY CPU READY SYSTEM HOLD BST(1·3) ~ ,; FIGURE 9 - MEMORY INTERFACE 3.2.1 Memory Write Operations The timing for a memory write cycle is shown in Figure 10. At the beginnin~he cycle, the processo~erts ALATCH, outputs the address and PSEL on the address-data lines, and pulls MEM low. Concurrent with MEM go- ing low, R/W goes low to give an early indication of a memory write cycle. The CPU then pulls ALATCH low, out- puts the data word on the address-data lines, -and asserts WE/IOCLK. The cycle may be extended by wait states using the READY signal, as described in Section 3.2.5. (31 (31 (31 I CLKOUT I I I \ I I l I \ I I I A/DBUS =v1(lI I X (21 ~ (2) lC::::)C I I ALATCH -0 hI ~ I I PSEi.. BSTl-BST3 :::XI VALID CODE I XI VALID CODE X I I MEM :::) I I I lI I RtW ---J I j- I I 1 I iii5 I !I I I 1 I I WE '---I \ I I I I MEMORY :- I WRITE NO WAITS -I" , MEMORY WRITE ONE WAIT-STATE .,1 I I NOTES: (1) Address and PSEL are valid. (2) Memory write data valid. (3) READY is sampled at this time_ FIGURE 10 - MEMORY WRITE CYCLE OPERATION 16 3.2.2 Memory Read Operations The timing for a memory read cycle is shown in Figure 11. At the beginning of the cycle. the processor asserts ALATCH. outputs the address and PSEL on the address-data lines. and pulls Main low. The RIW output goes to a high level to indicate that the cycle is to be a memory read operation. The processor then pulls ALATCH low. forces the address-data lines into the high-impedance state. and pulls RD low to enable the read data from memory onto the address-data lines. The cycle may be extended by wait states using the READY signal. as described in Section 3.2.5. ~) ~) ~) I CLKOUT --..-~ I __- -__I \ I I , I 1 \\.___ I oJr- I I I I I A/D BUS :::::xm:J(-12) - -O-)CTiT)(- - - - - (2) - - - - - - - -a-Y:---Y- -- I I 1 I .'---' 1 (3) I (3) 1 ALATCH ~ I T I \ " I --- PsEi.. BST1-BST3 ::::xI VALID CODE Y I VALID CODE 1 Y,.---- I I I MEM ___~~I___________________I ______________________________________I~I~:::::~ I 1 I 1 R/W ~ ~~-------- 1 I RD I \ I \ I I WEIIOCLK I ,.- I MEMORY READ NO WAITS -I- I MEMORY READ ONE WAIT STATE ~ 1 I I I NOTES: (1) Address and PSEL are valid. (2) Bus is in input mode (drivers are tristated). (3) Memory read data must be valid at indicated CLKOUT edge. (4) READY is sampled at this time. FIGURE 11 - MEMORY READ CYCLE OPERATION 3.2.3 Extended Memory Addressing __ Several techniques are available for extending the address reach of the processor. These techniques use the PSEL and bus status codes (BST1-BST3) to provide for extended address reach by defining additional 64K byte pages of memory based 'on information output by the processor during every memory cycle. 3.2.3.1 Memory Paging Status bit 8 of the status register is inverted and multiplexed on the PSEL/DO/OUT pin. PSEL may be used as a 17th address bit to select between two pages of 64K bytes for a total address reach of 128K bytes of physical memory. The PSEL signal output occurs concurrently with the memory address when ALATCH is active high. The following instructions force the PSEL output to the high state regardless of the value of ST8 of the status register: • RrWP return from interrupt • XOP extended operations (software trap) • All interrupts • All I/O instructions 17 In addition, the LST (load status) instruction can modify the PSEI. output if the state of STB of the status register is changed by the instruction. The long distance sourceldestination instructions (LOS, LOO) cause the PSEL to be in- verted from the previous state during the source or destination access by the instruction following LOS or LOO, respectively. (see Section B.3). 3.2.3.2 Functional Segmentation In addition to paging capability using the PSEL output, memory may be segmented functionally into an instruction segment and a data segment. Referring to Table 2, the bus status codes lOP and IAQ may be decoded to create a segment-select line for differentiating between references to the instruction segment and the data segment. Note that BST3 is a "don't care" during the decode operation. The decoding necessary to distinguish between references to data and instruction segments is shown in Figure 12. Figure 13 illustrates the hierarchy of a 256K byte physical memory system utilizing the memory paging and functional segmentation techniques. :=;';:::;":~:"::~"---ID INSTR~ON/DATA . MEM FIGURE 12 - FUNCTIONAL SEGMENTATION LOGIC MAIN MEMORY SPACE I I i INSTRUCTION DATA SEGMENT SEGMENT (64K) (64K) I I PAGE 0 PAGE 1 PAGE 0 PAGE 1 (64K) (64K) (64K) (64K) J \~--------------------~V - 256K BYTES FIGURE 13 - TMS99000 EXTENDED ADDRESSING 3.2.3.3 Memory Mapping Techniques The TMS99000 may utilize the TIM9961 0 memory mapper (SN7 4LS61 0) device to extend the address reach of the processor to 16 megabytes. The TIM9961 0 device contains 16 12-bit map registers, which ere selected by the TMS99000's four most-significant address lines. These 12 bits are output from the TIM9961 0 and appended to the address bus as the most-significant address lines. Thus, mapped pages may reside on any 4K-byte address boundary. 18 The PSEL output may be used to enable/disable the operation of the memory mapper. If PSEL is connected to the MM pin of the mapper circuit, the mapping of the internal map registers occurs only when PSEL is low. When PSEL is inactive high, the four address bits present on the register-select inputs are passed through to the outputs un- changed. This allows for correct operation when interrupt or XOP (extended operations) vectors are fetched from predefined locations. The TMS99110 contains two instructions which are designed to facilitate operation with a TIM9961 0 memory mapper. They are Long Distance Source (LDS) and Long Distance Destination (LDD). These instructions are described in more detail in the TMS99110 supplement (Appendix B). The LOS and LDD instructions invert the PSEL output when performing source and destination operand fetches of the following instruction. This allows an instruction to reach operands outside the boundaries of the current page. Figure 1 4 illustrates the interface between a TMS99000 and the TIM99610 memory mapper. ADDRESS BUS TMS99000 TIM99610 MPU MEMORY MAPPER MAP ENABLE DATA BUS FIGURE 14 - TMS99105A ORTMS99110A TO TIM99610 MEMORY MAPPER INTERFACE 3.2.4 Direct Memory Access The processor provides the signals necessary to allow DMA devices to directly transfer information to and from the system memory. To gain control of the local bus interface, the DMA device sends a hold request to the pro- cessor by pulling the processor HOLD input low. The timing for the hold cycle is presented in Figure 15. Assume that HOLD is pulled low during a memory write cy- cle, as indicated in the example of Figure 15. As soon as the ongoing cycle is complete, the processor responds to the HQ[5 signal by outputting a HOLDA bus status code (MEM, RlW and BST1-BST3 are all driven high); this signals its impending surrender of the local bus to the DMA device. The bus status code is held only for a quarter state, long enough to be latched externally on the falling edge of ALATCH. As soon as ALATCH has made its high- to-low transition, the following output signals are forced to the high-impedance state: MEM, R/W, BST1-85T3, VVE/ii5CtK, RD and the address-data lines. At the beginning of the next machine state, the ALATCH signal is driven high for a quarter state, after which it also is forced to high impedance. These lines remain in the high im- pedance state for the duration of the hold cycle. The CLKOUT output line, on the other hand, remains active through the hold cycle. The DMA device takes control of the local bus and performs its transfer or transfers of data to or from main memory. When the DMA device has completed its transfers, it deactivates the HOLD signal. The processor responds by removing the HOLDA bus status code, and leaves the hold state to resume processing. 19 (1 ) (1) (1) (1 ) (1 ) (1 ) (1 ) CLKOUT ~~j ( 2 ) : hi-z I : A/D BUS ~---- - - ----- - ----- --X:::X;;:--x:::J<. I, I 1 I (3) I hi-z I : (4) ALATCH ~T----.- 1 I --~ I • ----.----- I hi-z : BST(1-3) J( I I -I - - - -. - - - I I I - - -, - - - , - - -X hi-z, , x:::: MEM ""\ r---- -- ---- --- -- - ---~ R/W ""-__---'r ____ .:.• I~-~ ___ · ', ·'-/~---- ----- I I I I ---- .I hi-z I I I ~---- hi-z I I I ~ '\~~--------------------~I 1 I 1 (1) I PRIOR I HOLD CYCLE I NEXT 1 STATE 1... 4 1 - - - MAY BE ANY NUMBER OF CLOCKS - - - - - - 4.....1 STATE I (WRITE I I (READ SHOWN) I SHOWN) 1 I NOTES: (1) CLKOUT edge at which HOi::D is sampled. (2) Tristate all outputs except ALATCH as follows: • BST(1·3) and RtW are first driven high to indicate hold acknowledge, and then tristated. • MEM, Ro, WE, and R/Vii are first driven high, and then tristated. • The data bus is tristated as is. (3) ALATCH is first driven high, and then tristated. (4) All outputs become active again. FIGURE 15 - MEMORY CYCLE - DMA HOLD OPERATION The processor samples HOLD at the falling edge of each CLKOUT pulse. Sampling of HOLD occurs even while the MPILCK (multiprocessor interlock) bus status code is being output (Section 3.4.4) in order to reduce worst-case DMA latency. If HOLD is asserted at the beginning of a reset operation, the processor requests no memory cycles until HOLD is removed. This permits automatic DMA loading of memory after power up. When HOLD and RESET are pulled low at the same clock edge, the RESET bus status code will be output prior to the HOLDA bus status code and for as long as RESET remains active low. If the READY input signal is low when HOLD is released, the hold cycle is extended with wait states until READY is allowed to go high. 3.2.5 Memory Wait-8tate Generation The READY input is held low to extend memory, I/O, and internal bus cycles by an arbitrary number of wait states. Wait states continue to be generated until READY is released (j.e., allowed to go high). Wait state generation for I/O cycles is presented in Section 5. READY is low during the first machine state of a memory cycle, however, the cycle is extended by one wait-state. If READY continues to be held low, the memory cycle is extended by additional wait-states until READY goes high. 20 External Macrostore accesses are treated as a special type of internal cycle. These cycles can be extended with wait-states by pulling READY low (see Section 7). The timing for wait state generation during memory cycles is shown in Figure 16. This same technique may be used for machine cycles which are neither memory nor I/O cycles (Le. internal cycles). Thus care must be taken when designing circuitry controlling the READY input. As indicated in the figure, READY is sampled at the falling edge of CLKOUT. (1) (1) (2) (1) (2) I CLKOUT .rvV- I J\.J)-/}F I I ~I I I ALATCH f\ I ~ I ~ I I I I I I I I READY YmMY'0384 to exit Macrostore (described in Section 7). 4.4 INTERRUPT LEVEL 2 The level 2 trap vector is used for external interrupts as well as for the following internal trap conditions: arithmetic fault, illegal instruction, and privileged opcode violation. Sampling of the level 2 external interrupt (anc:j of all other interrupts as well) is delayed until the end of each instruction (Figure 18) to facilitate non-ambiguous error reporting. An error detected by external logic during execution of an instruction will be recognized (if level 2 interrupts are enabled) before the next instruction is executed. The PC value stored during the level 2 context switch points to the instruction following the one which generated the error. The external level 2 interrupt should be reserved for system errors such as memory faults and access violations. A memory error generated by the in- struction prefetch should be delayed for one non-DMA bus cycle by external logic to insure that the memory error is associated with the prefetched instruction rather than with the instruction preceding it. 21 The error interrupt status bits are located at the I/O addresses shown in Table 4. Appropriate bits defined in Table 4 are set at the time the error occurs. A level 2 interrupt request is generated as long as any bit in the error status register, except the ILLOP (illegal instruction) flag, is set. The ILLOP flag is set under control of Macrostore emulation software, as described in Section 4.4.3. The error status bits can be examined by the level 2 interrupt service routine to determine the cause of the interrupt. The active bit(s) must be reset using a bit I/O operation (SBZ or LDCR) to acknowledge the condition and remove the interrupt request. This is not strictly necessary in the case of the ILLOP flag since it does not generate an interrupt request. TABLE 4 - ERROR INTERRUPT STATUS BIT ASSIGNMENTS 1/0 ADDRESS ERROR FLAG INPUT BIT OUTPUT BIT PRIVOP (privileged violation) >lFDC >1FDC ILLOP (illegal instruction code) >1FDA >1FDA AF (arithmetic overflow - ST 4 and ST1 0 on) >1FC8 >1FC8 Each bit is individually cleared by writing a 0 to the bit, e.g., by means of an SBZ or LDCR instruction. When 1/0 in- put operations are performed, the external IN input line is ignored. Writing a 1 to I/O address locations> IFCO to > IFC7 will cause all three flags (PRIVOP. ILLOP and AF) to be set to 1. Writing a 1 to > IFD3 or > IFD4 will set the ILLOP or PRIVOP flag to 1, respectively. When a level 2 interrupt has occurred, the level 2 service routine reads the I/O error interrupt status bits using the STCR or TB instruction to identify the source of the error. The interrupt is cleared by writing a 0 to the appropriate bit. The error interrupt status bits are automatically cleared by executing any of the following operations: • RSET instruction • Reset function (external device pulls RESET input low) • I/O output operations to the bit(s) I/O address. 4.4.1 Arithmetic Fault Interrupt The TMS99000 can be programmed to generate an interrupt when an overflow occurs during an arithmetic opera- tion. This permits arithmetic fault checking to be performed without software overhead. The arithmetic fault inter- rupt is controlled using three programmable flags: bits 4 and 10 of the status register (Table 15) and AF of the er- ror interrupt status bits (Table 4). ST4 is the arithmetic fault flag and is set to 1 whenever an overflow occurs. ST1 0 is the arithmetic fault enable bit and is set or cleared by the programmer to enable or disable. respectively. the arithmetic fault interrupt. AF of the error status register is automatically set when both ST 4 and ST1 0 are 1 . When set and the interrupt mask is greater than or equal to 2, AF generates a level 2 interrupt request, which is. handled according to the standard interrupt sequence described in Section 4.2. If an arithmetic overflow occurs while ST1 0 is 1 and the interrupt mask contains a value in the range 2 through 15, a level 2 interrupt occurs directly upon completion of the instruction causing the overflow. The PC value saved during the reSUlting context switch is the address of the first word of the instruction immediately following the in- struction that caused the overflow. The level 2 interrupt service routine must check ST4, ST1 0 of the saved status register in the routine's workspace register 15 (WR15) and AF to determine that the interrupt was caused by an overflow. The service routine, which is invoked by the arithmetic fault interrupt, must clear the AF bit and either bit 1 0 or bit 4 of WR 1 5 before return- ing to the routine which caused the overflow. If this procedure is not followed, the arithmetic fault will falsely oc- cur immediately upon the completion of the RTWP instruction. Should the level 2 interrupt service routine be interrupted, in turn, by a higher-priority interrupt, the arithmetic fault condition is retained in AF until the program explicitly clears it. Similarly, ST4 and ST1 0 are preserved when the status register is saved during the context change; they are restored upon return from the higher-priority interrupt. 28 4.4.2 Macroinstruction Detection (MIDI Trap The MID trap permits the detection of illegal opcodes and the emulation of opcodes not defined in the processor in- struction set. Emulation can be performed either in hardware or software. Hardware emulation takes place using the attached processor interface discussed in Section 8. Software emulation routines are contained in the Macrostore, described in Section 7. The acquisition of an undefined opcode during an instruction fetch causes an MID trap to occur immediately before the processor attempts to execute the instruction. A list of the opcodes, which cause the MID trap, are listed in Section 1 0.5.1 9 and consists of all opcodes undefined in the basic instruction set of the processor. These are referred to as MID opcodes. The XOP instruction is also ~eated as an MID opcode in the event that bit 11 of the status register is set to 1 . Whenever the processor detects an MID opcode in the instruction stream, a check is made to determine whether an attached processor is prepared to execute the instruction. If not, program control is transferred to the external Macrostore in the case of the TMS99105 or internal Macrostore in the case of the TMS9911 0 to allow the instruction to be emulated in software (see Section 4.4.41. The sequence of actions that takes place during an MID trap is as follows. Upon detecting an MID opcode, the pro- cessor outputs an MID bus status code (MEM = 1 , SST = 1101. If an attached processor is prepared to execute the instruction, it responds to the MID status code by pulling the processor's APP input low. If APP remains inactive, program control is transferred to the Macrostore. The PC saved during the context switch points to the word following the MID opcode. If the MID opcode is followed by immediate data or address information, the emulation routine can use the saved PC value to access this information. In a likewise manner the program may use the sav~ ed workspace pointer (WPI to access operands in the calling routines workspace. The MID trap is non-maskable. and is higher in priority than any other interrupt except the reset function (REsET active lowl. An MID opcode always results in an MID trap regardless of the value of the interrupt mask. If an NMI request is received at the same time that an MIDopcode is detected, the MID trap sequence will take place first and be followed immediately by the NMI sequence before the attached processor or Macrostore software begins to emulate the MID instruction. This permits the NMI input signal to control single-stepping in conjunction with MID opcodes and microcoded processor opcodes alike. When a user program attempts to execute an MID opcode that is defined neither by an attached processor nor by a Macrostore emulation routine, the Macrostore software should detect this fact and initiate a level 2 interrupt. This is accomplished by the special form of the RTWP instruction (opcode >03821. which causes the processor to set the ILLOP bit of the error status bits and then exit Macrostore memory space. This provides an indicator to the level 2 trap routine undefined opcode violation. If Macrostore is disabled at Reset, then an MID opcode will automatically cause the ILLOP bit to be set and a level 2 trap to occur. 4.4.3 Illegal Instruction IILLOPllnterrupt The illegal instruction interrupt is a result of a Macrostore exit through the execution of the special form of the RTWP instruction (opcode >03821 when in Macrostore (section 4.4.21. The level 2 interrupt routine can identify the illegal instruction interrupt by interrogating the ILLOP bit of the error status bits. This method is not reliable in detecting illegal instructions within level 0 or level 1 interrupt routines. The context linkage may be lost if two successive level 0 or level 1 external interrupts occur unless a software stack is created. The ILLOP trap permits the system to respond to illegal opcodes. When an illegal opcode is first encountered, the processor performs two preliminary checks before setting the ILLOP error interrupt status flag and vectoring to the level 2 interrupt routine. First, the processor outputs the MID (macro-instruction detected I bus status code to determine whether an attached processor is prepared to execute the instruction. If not, the processor transfers control to the emulation software in Macrostore to determine whether it recognizes the opcode. If this test also fails, the opcode is illegal. The Macrostore software sets the ILLOP flag and returns control to the user's program in main memory. The processor traps immediately to the level 2 interrupt routine before it has a chance to resume execution of the user's program. Once the trap has occurred, the level 2 interrupt routine checks the ILLOP flag to determine if the trap was caused by an illegal instruction. The ILLOP interrupt is non-maskable. 29 For further information, refer to the discussion of MID opcodes in Section 4.4.2. 4.4.4 Privileged Opcode Violation Interrupt When a privileged opcode violation occurs, as described in Section 6, PRIVOP, the error interrupt status bit is set and, if the interrupt mask is greater than or equal to 2, generates a level 2 interrupt request. The offending instruc- tion is permitted to complete any operand fetches it requires, but following detection of the violation, all further at- tempts to write to the 1/0 address space are inhibited. As soon as the offending instruction completes execution, a level 2 interrupt takes place unless the interrupt mask value is 0 or 1 . The trap sequence for the level 2 interrupt consists of a standard context switch, after which program control is transferred to the level 2 service routine. The routine checks the PRIVOP bit to determine if the interrupt was caused by a privileged opcode violation. PRIVOP should be cleared by the service routine before returning; otherwise, another level 2 interrupt will occur upon return unless the interrupt mask is set to a value of 0 or 1 . If a privileged opcode violation occurs while the interrupt mask is 0 or 1, the level 2 interrupt is disabled and does not take place. The PRIVOP bit is still set, and any write operations attempted by the offending instruction are in- hibited as before. Execution of succeeding instructions will occur normally, however, until the interrupt mask is set to a value of 2 or greater, at which point the PRIVOP bit, which has remained set, causes a level 2 interrupt to occur. 4.4.5 Applicable Bus Status Codes The INTA (interrupt acknowledge) bus status code is output by the processor to indicate that a reset, NMI, XOP (if ST11 =0), external interrupt or any of the level 2 interrupts is in progress. The INTA is output during the fetch of the WP and PC values from the trap vector for the interrupt or XOP. If desired, the INTA bus status code can be used as a signal to automatically acknowledge an interrupting device. The acknowledgment signal is generated by hardware external to the processor that can recognize the INTA code and determine the interrupt level by decoding address bits A 10 through A 13. 5. TMS99000 INPUT/OUTPUT INTERFACE 5.1 DESCRIPTION The TMS99000 provides both bit-serial and bit-parallel 110 to meet the requirements of both bit, byte and word peripheral applications. TMS99000's 110 is a command-driven direct 110 interface that supports bit, byte and word data transfers. The 110 address space contains 32768 peripheral input locations, and 32768 output loca- tions. The first 16384 110 addresses (input or output) are bit locations accessed in bit-serial fashion; the last 16384 1/0 addresses are word or byte locations (as specified by the user) accessed in bit-parallel fashion. Figure 21 provides the 1/0 address map for the TMS99000. 30 BIT-SERIAL I/O SPACE BIT-PARALLEL I/O SPACE (MSB OF BASE ADDRESS IS 0) (MSB OF BASE ADDRESS IS 1) 0000 8000 - - NON-PRIVILEGED I/O ADDRESS SPACE 1BFE 9BFE 9COO 1 COO PRIVILEGED I/O ADDRESS SPACE 1EC4 EXTERNAL 1ECE INSTRUCTIONS 1FCO ERROR STATUS 1FEO INTERRUPT BITS 7FFE - - FFFE -1 ____________ - BIT ADDRESS = BASE WORD OR BYTE ADDRESS ADDRESS IN WR12 + = BASE ADDRESS IN WR12 BIT NUMBER* 2 FIGURE 21 - 110 ADDRESS MAP The I/O interface utilizes the same signal lines as the interfaces for main memory and external Macrostore, as in- dicated in Figure 22. The 1/0 address space, however, is logically distinct from the memory and macrostore ad- dress spaces. The timing for 1/0 read and write operations is presented in Figures 23 and 24. 1/0 operations are ac- companied by the 1/0 bus status code (MEM = 1, BST =0 111 to distinguish them from accesses of memory or ex- ternal Macrostore. (In fact, only two signals, MEM and BST2, are required for this purpose; see Table 2.1 31 MEM R/W A II.. ~ AID OliN ;AlD 11-141 ;AlD 15 (OUT);; ... ALATCH WEIIOCLK - TMS99000 RD - I/O SYSTEM READY BST(1-3) -'\ vi FIGURE 22 - TMS99000 I/O INTERFACE (4) (4) (4) (4) (4) CLKOUT ..AJ0- I I ~I I .AJV-0- I I AID BUS :xLX2-'iKX: :::xr:x2-XOO:::X2-XiX)C :::xi:X2- -- xocx: I I I I I I I ALATCH .f\ ~ I I I I BST1-BST3 :xI x::::. I :J< I X I x:::. I ~ I x:::: r MEM J I c: I J I c: I ~ RD WE/IOCLK I R/W J I 'CO I J I I c: ={ c: I I I I BIT n BIT n+ 11 I I SINGLE BIT MULTIPLE BITS, SINGLE BIT NO WAITS NO WAITS ONE WAIT NOTES: (1) Valid address, PSEL high (internal ST8 = 0) (2) 8us in input mode (drivers are tristated) (3) If MSB of address is 0, I/O bit must be valid on DOli/IN. If MS8 of address is 1, 1/0 word must be valid on A/D(0-15), and 1/0 byte on A/D(0-7). (4) READY is sampled at this time. FIGURE 23 - TMS99000 I/O TIMING - INPUT OPERATION 32 (3) (3) (3) (3) 13) CLKOUT .rvV- I I ~ I I I JVV-V- I I AID BUS .:xr::x:I:XX J(!JC2 xx: I I I I ..f\_ __ ALATCH ~ I I I I I I BST1-BST3 )(_ _X:::: =1----'.~-F y c: I I I MEM c: I c:: I RD I I I WEIIOCLK ~ ~ I I \ - - 'r- ~. I R/W -\ I J-- i I I I (- }- I I BIT n BIT n + 1 I SINGLE BIT MULTIPLE BITS SINGLE BIT NO WAITS NO WAITS ONE WAIT NOTES: (1) Address is valid, and PSEi. is high !internal ST8 =0). (2) If MSB of address is 0, then valid I/O bit is on D15/0UT. If MSB of address is 1, then valid 110 word is on A/D(O-15), and I/O byte is on A/D(0-7). (3) READY is sampled at this time. FIGURE 24 - TMS99000 I/O TIMING - OUTPUT OPERATION Each I/O cycle begins with an ALATCH pulse, the falling edge of which latches externally the 1 5 address bits AO to A 14 and the PSEL page select signal. If AO, the MSB of the address, is 0, a bit-serial 1/0 operation is performed; if AO is 1 during an LOCR or STCR instruction, a bit-parallel (byte or word) I/O operation is performed. The PSEL output signal is forced high during all 1/0 cycles regardless of the actual state of ST8 of the processor's status register (Section 2.3.2). Following the ALATCH pulse, data is input or output on the address-data lines and R/W is taken high or low to indicate whether an input or output operation is to be performed. Serial I/O accesses utilize the AOIOOIIN line for reads, and the PSEL/015/0UT line for writes. Parallel I/O operations utilize all 16 data lines (00-015) for word transfers, and the first eight (00-07) for byte transfers. 1/0 write operations are accompanied by a low pulse on the WEIIOCLK output; I/O read operations are accompanied by a low pulse on RD. The minimum-length I/O cycle is two machine states (two CLKOUT periods) in duration. If, during the second machine state of a 110 cycle, READY is low, the cycle is extended by one wait-state. Holding READY low generates additional wait-states until READY is taken high prior to the high-to-Iow transition of CLKOUT. Figure 25 illustrates the relationship between I/O wait states and the READY line. 33 (1 ) (1) (2) I I I CLKOUT ./\...r\.r J\.f\..r\J I I I ALATCH - "_ _ __ -"-------"-- I I READY XXXXXXXY 'UiX (3) I NO WAIT STATE ONE WAIT STATE GENERATED BY READY NOTES: (1) First sample time of READY in I/O cycle. (2) Second sample time of READY in 110 cycle. Additional wait states are generated by keeping READY low at this and subsequent sample times. (3) XXX XXX denotes don't care. FIGURE 26 - WAIT-STATE GENERATION FOR 110 CYCLES The TMS99000 instruction set contains five I/O-oriented instructions. Three of the 1/0 instructions are used to perform single-bit operations in the first 16384 bits of the 1/0 address space. (See Figure 22.) These are the TB (test bit), SBO (set bit to one) and SBZ (set bit to zero) instrtlctions. The remaining two 1/0 instructions perform mUltiple-bit operations in either bit-serial or bit-parallel fashion, depending on which half of the 1/0 space is being addressed. 5.2 SINGLE-BIT I/O OPERATIONS The single.bit instructions facilitate the testing and for modification of a particular bit in a device. The three single- bit 1/0 instructions, TB, sao and saz, are executed as follows. The TB instruction reads the bit from the address- ed I/O location onto the AO/DOIIN line. and this bit is placed in status register bit 2 (EQI. The sao instruction out- puts a one on the PSEUD15/0UT line, and the SBZ outputs a zero on this line. The processor develops the address for a single-bit I/O operation from the base address contained in bits 0 to 14 of WR12 and from the signed displacement field contained in bits 8 to 15 of the instruction. As indicated in Figure 26, the signed displacement * 2 is added to the base address to generate the effective I/O address output onto the bus. The displacement allows two's complement addressing from base - 1 28 through base + 1 27. Note that for single-bit I/O instructions, SBO, saz, and TB, the most-significant bit of WR 1 2 does not affect the opera- tion (Le., no parallel operations). 34 FIGURE 26 - SINGLE-BIT 110 ADDRESS DEVELOPMENT 5.3 MULTIPLE-BIT SERIAL I/O OPERATIONS The STCR and LDCR instructions specify multiple-bit 1/0 operations. The starting address in 1/0 address space is loaded into WR12 prior to executing STCR or LDCR. When the MSB (bit 0) of the address in WR12 is 0, the transfer is performed in bit-serial fashion rather than in parallel. During a multiple-bit, bit-seriall/O transfer, the first bit is read from or written to the address pointed to by bits 0 through 14 of WR 1 2. Consecutive bits are read from or written to 1/0 locations separated by an address increment of + 1. The contents of WR12 are not altered by ex- ecution of the serial STCR or LDCR instructions. A multiple-bit serial 1/0 transfer is represented in Figure 27. Although a full 1 6-bit transfer is indicated in the figure, any number of bits from one to 1 6 can be specified. The transfer mechanism results in an order reversal of the bits; that is, bit 1 5 of the memory word (or bit 7 of the byte) corresponds to the bit stored at the lowest 1/0 ad- dress, and bit 0 corresponds to the bit stored at the highest 1/0 address. I/O INPUT BITS N 1/0 OUTPUT BITS N+1 N INPUT (STCRI • N+1 • MEMORY WORD • • • N+14 • N+15 OUTPUT (LDCRI N+14 N+15 N BIT SPECIFIED BY I/O BASE REGISTER FIGURE 27 - LDCRISTCR DATA TRANSFERS The first word of an STCR or LDCR instruction contains a 4-bit CNT (count) field, which specifies the number of bits to be transferred. If CNT is 0, then 16 bits are transferred. If CNT is in the range 1 to 8, the effective source operand address from the STCR or LDCR instruction is treated as a byte address; otherwise, it is treated as a word address. The LDCR instruction reads a word (or byte) from the memory and writes all or part of it to the 1/0 in bit serial fashion. Beginning with the rightmost bit in the word (or byte) and moving from right to left, each consecutive bit is output through the I/O interface until the specified number of bits has been transferred. The STCR instruction reads data from the I/O and transfers it to memory. If the specified number of bits to be transferred from the 1/0 is less than 9, they are stored right-justified in the addressed memory byte, and the leading bits are cleared to O. If the operation involves from 9 to 16 bits, the data is stored right-justified in the ad- dressed memory word, and the leading bits cleared to O. When the instruction is completed, the bit from the lowest I/O address occupies the LSB position in the memory word or byte. 5.4 PARALLEL I/O OPERATIONS When the MSB (bit 0) of the 1/0 base address in WR12 is 1, the multiple-bit 1/0 transfer specified by an STCR or LDCR instruction takes place in a single 1/0 transfer, i.e., in parallel. Either a word or byte is transferred as deter- mined by the 4-bit CNT field in the first word of the LDCR or STCR instruction. If the CNT field is within the range of 9 to 15, then a word is transferred. If the CNT field is within the range 1 to 8, then a byte is transferred. For parallel 1/0, CNT is restricted to (binary) 0010, 0011, 1010, and 1011. The CNT field selects the mode of transfer as shown below: if CNT = 0010, then byte transfer if CNT = 0011, then byte transfer with WR 1 2 auto increment if CNT = 101 0, then word transfer if CNT '" 1 0 11, then word transfer with WR 1 2 auto increment. The automatic increment of WR12 is provided to facilitate block transfers of data to and from devices in the parallel 1/0 address space. 5.5 APPLICABLE BUS STATUS CODES I/O cycles are identified by the I/O bus status code (Table 2). 36 6.6 EXTERNAL INSTRUCTIONS The TMS99000 has five external instructions that allow user-defined off-chip functions to be initiated under pro- gram control. These instructions are CKON, CKOF, RSET, IDLE and LREX. These names are arbitrary. The user may define the external function performed by these instructions. Execution of CKON, CKOF, RSET or LREX causes a bit value of 0 to be written to one of the I/O addresses specified in Table 5. Following the single I/O write cycle, execution proceeds to the next instruction. RSET is the only external instruction that can affect the ST (status) register or the error interrupt status bits. In privileged mode (ST7 =0), RSET causes ST9-ST15 and the AF, ILLOP, and PRIVOP bits ofthe error status bits to be cleared. This is followed by a status update cycle (ST bus status code) to notify external devices of the change in status. In user mode (ST7 = 1), the ST and error status bits are unaffected, and RSET is similar in effect to CKON, CKOF and LREX. TABLE 5 - EXTERNAL INSTRUCTION CODES INSTRUCTION I/O BASE ADDRESS IDLE 1EC4 RSET 1EC6 CKOF 1ECC CKON 1ECA LREX 1ECE IDLE differs from the other external instructions in that its function is predefined. Execution of IDLE causes the processor to enter and remain in the idle state until a RESET, NMI or unmasked external interrupt occurs. While in the idle state, a bit value of 0 is written repeatedly to I/O address >1 EC4 (i.e., the WEIIOCLK output is pulsed con- tinually). Upon leaving the idle state, a context switch takes place to service the interrupt. The PC value saved dur- ing the context switch points to the address of instruction following the IDLE instruction. The timing for the I/O write operation, or operations in the case of IDLE, follows that given in Figure 24. Each I/O write cycle is accompanied by the 110 bus status code (Table 2). When the processor receives a hold request (HOLD low) while in the idle state, the processor enters the hold state directly from the idle state. It reenters the idle state as soon as the hold request is deactivated. 6. PRIVILEGED MODE For hardwired system protection in a userlsupervisor programming environment, certain instructions performing 110 and control functions are designated as "privileged". When the system is placed in the user or "non- privileged" mode, any attempt to execute one of these instructions will result in abortion of the instruction and an interrupt request through the level 2 trap vector. (See Section 4J The system can be placed in the user mode by setting status bit 7 to 1 by means of an LST or RTWP instruction. The system is placed in the privileged mode by the occurrence of any interrupt, execution of the XOP instruction, by the assertion of the NMI or RESET input signals, or during Macrostore operations. When a privileged opcode violation is detected, error status bit PRIVOP is set, and this, in turn, generates a request for a level 2 interrupt as described in Section 4.4.3. The following instructions are privileged: CKON, CKOF, IDLE, UMI, LREX and RSET. The use of the following instructions is qualified in user mode: LDCR 010), RTWP, SBO (1/0), SBZ (110), and LST. In processors with LDD and LOS instructions implemented in Macrostore such as the TMS99110, these instructions are privileged. Section 10.5 should be consulted to determine the restrictions placed on each of these instructions in user mode. The LDCR instruction is a privileged instruction for byte and word transfers to output addresses falling within the range specified by Figure 21. Similarly, the SBO, SBZ I/O instructions are privileged for bit 110 operations falling within the same range. 37 The LST operation is dependent upon whether the processor is in the privileged or non-privileged mode when the instruction is executed. While in the privileged mode (ST7 =0), the LST instruction modifies all 16 bits of the status register. While in user mode (ST7 = 1), only bits 0 through 5 and bit 10 of the workspace register specified in the W field are placed in the status register, and loading these bits has the side effect of clearing ST6. Similarly, return workspace pointer (RTWP) instruction will cause all bits of the status register to be replaced when in privileged mode and only the seven bits discussed when in a non-privileged mode. Section 10.5 discusses the operation of these instructions in more detail. 7. MACROSTORE INTERFACE AND OPERATION 7.1 DESCRIPTION Macrostore is a special feature of the TMS99000 that permits new instructions to be defined and emulated in a manner completely transparent to programs residing in main memory. It provides the capability for adding new functions and enhancing the performance of specific kernels of software, thereby increasing the total system per- formance. Macrostore permits software kernels to be encapsulated within the TMS99000 system in a manner that makes them virtually indistinguishable in operation from functions implemented in hardware. This is ac- complished by providing a 64K byte address space that is logically distinct from the main memory and I/O address spaces. Macrostore functions as a control store for the TMS99000 but is programmed in assembly language rather than microcode. Internal to the TMS99000 are 1024 bytes of Macrostore ROM (MROM) and 32 bytes of Macrostore RAM (MRAM). The access time of the on-chip Macrostore is one machine state. Emulation routines in the internal Macrostore execute at the full speed of the processor since no wait states are required to access the on-chip MROM and MRAM. While executing in the Macrostore, certain control capabilities are provided that are not available to programs executing in the main memory. 7.2 THE MACROSTORE INTERFACE 7.2.1 Timing The timing signals generated during accesses of external Macrostore are identical to the memory timing described in Sections 3.2.1 and 3.2.2, with the following exceptions. The only bus status codes (Table 2) output are the AUMS and AUMSL codes. (AUMSL is output if an ABS, TSMB or TeMB instruction is executed in Macrostore. Otherwise, AUMS is output.) Another difference between Macrostore accesses versus main memory accesses is the operation of the PSEL out- put. In main memory accesses, the PSEL output represents the inverted state of the ST8 bit of the status register unless a long distance source/long distance destination instruction (LDS, LDD) is in effect (see Section B.3). (The LDS and LDD instructions apply to the TMS9911 0 only; see Appendix B.) If a LDS or LDD instruction is in effect per the description in Appendix B, the PSEL output will represent the logic state of the ST8 bit without inversion. A complete description of the LDS and LDD instructions is given in Appendix B, Section B.3. For Macrostore ac- cesses, the PSEL output is not guaranteed; thus it should not be used for paging Macrostore memory. The AUMS and AUMSL bus status codes differentiate between external Macrostore accesses and memory and I/O accesses. 7.2.2 Wait States Accesses of on-chip Macrostore require only a single machine state to complete. If the Macrostore is extended us- ing an external RAM or ROM that is too slow to respond in a single machine state, external control logic must cause wait-states to be generated by pulling the 99000's READY input low until the access is ready to complete. The generation of wait-states is identical to main memory wait state generation described in Section 3.2.5. 7.2.3 Organization The internal Macrostore consists of 1024 bytes of MROM and 32 bytes of MRAM. The MROM resides at addresses> 0800 to >OBFE. The MRAM resides at addresses >0000 to >OO1E and serves as workspace storage during Macrostore execution. External Macrostore may be added in the form of off-chip ROM or RAM residing at addresses in the range >l000to >FFFE: A map of the Macrostore address space appears in Figure 28. 38 0000 MRAM OO1E oom~~~~~~~~~~~~ 07FE 0100 entry-point teble 0812 081. --- - ------ 1~ Internal MROM byt.. OBDE OBEO - - - - - - - - -- r..erved OBFE OAOO OFFE J.' 1000 through >FFFE. On-chip ROM address range APP pin is taken (>0800 - >OFFE) is mapped low when RESET is Prototyping off-chip for use of external pulled low and Macrostore memory. On-chip is released when RAM is available. RESET is released. All Macrostore memory space APP pin is tied Baseline is disabled and the attached to ground.' processor interface is disabled. *If APPis brought high anytime after RESET. the processor will enter the prototyping mode. 39 7.2.4. 1 Standard Mode In standard mode, the on-chip MROM and MRAM are both enabled, permitting the firmware contained in the MROM to be utilized. During ~esses of on-chip MROM and MRAM, the AUMS and AUMSL status codes are out- put, and the WE/lOCLK and RD outputs both remain inactive high. While executing in Macrostore, a read or write to a Macrostore address in the range> 1000 to > FFFE results in an access of external Macrostore. During this access, either the RD or WE/IOCLK output goes active· low, depending on whether the Macrostore location is being read from or written to. The timing for the access is the same as that described for an access performed by a program residing in main memory, as described in Section 3.2, with the exception that the only bus status codes output are AUMS and AUMSL. This is consistent with the treatment of Macrostore execution as a special type of internal operation. The AUMS and AUMSL bus status codes are used by external decode logic to distinguish accesses of external Macrostore from accesses of main memory and I I 0 locations. Accesses of external Macrostore are, in turn, distinguished from other kinds of internal operations by observing the RD and WE/IOCLK outputs, which are active during Macrostore accesses, but not during other types of internal operations. The TMS99000 is placed in standard mode by keeping the APP input high while RESET is pulled low at system initializa- tion. 7.2.4.2 Prototyping Mode In prototyping mode, the TMS99000's internal MROM is disabled, but the MRAM remains enabled. A read or write to a Macrostore address in the range> 0000 to >001 E results in an access of the on-chip MRAM, but a read from or write to any Macrostore address in the range >0800 to > FFFE results in an external Macrostore access. As in the standard mode, the WE/IOCLK and RD outputs are active only when the Macrostore read or write is off-chip. The AUMS and AUMSL bus status codes are output during accesses of both internal and external Macrostore. The processor is placed in prototyping mode by pulling the RESET and APP inputs low together during system initializa- tion and releasing them at the same time. In systems without attached processors, the RESET and APP pins can simply be tied together. One use of prototyping mode is to permit external RAM or ROM occupying Macrostore addresses >0800 to >OBFE to emulate on-chip MROM during development and testing of Macrostore software. 7.2.4.3 Baseline Mode In baseline mode all Macrostore memory space is disabled. In the event a MID opcode is encountered, the TMS99000 will cause a level 2 interrupt to occur and the ILLOP bit of the error status register (Section 4.4) will be set. The level 2 interrupt routine then may emulate the opcode or the opcode may be handled as an illegal opcode violation. In baseline mode the attached processor interface is also disabled. Thus the APP input pin will not be tested on the occurrence of a MID opcode. The level 2 interrupt will be implemented immediately. The TMS99000 is placed in baseline mode by pulling the APP input low at reset. It remains in baseline mode as long as AAP remains low. Typically, this is accomplished simply by tying APP to ground. (Note that if APP goes high after RESET, the processor will enter the prototyping mode.) 7.3 MACROSTORE CAPABILITIES 7.3.1 Entry Procedure When the TMS99000 is executing a program residing in main memory and a MID opcode is encountered, the APP pin is tested to determine whether an attached processor is prepared to respond to the MID opcode. If not, pro- gram control is transferred to the Macrostore. A MID opcode is an undefined opcode in the basic TMS99000 in- struction set, or an XOP executed while ST11 = 1 . The Macrostore is entered via an entry point table occupying the first ten words of the MROM, shown in Table 7. Each entry in the table contains the start address in MROM of an emulation routine for a particular group of MID opcodes. When a MID opcode is encountered in the program in main memory, instruction execution transfers to the MROM address in the entry-point table corresponding to that opcode. Undefined single-word opcodes are divided into eight groups with the entry addresses for each group as indicated in Table 7. Undefined two-word opcodes are treated as a 9th group, and XOPs, when ST11 = 1, as a 10th. 4D TABLE 7 - MACROSTORE ENTRY VECTORS TABLE MIDt LOCATION OPCODES OBOO* 0000-001B, 001 E-002B, 002B-007F, OOAO-OOAF, OOCO-OOFF OB02* 0100-013F OB04* 021 0-021 F, 0230-023F, 0250-025F, 0270-027F, 0290-029F, 02BO-02BF, 02DO-02DF, 02E1-02FF OB06* 0301-031F, 0320-033F, 0341-035F, 0361-037F, 03B1-039F, 03A1-03BF, OEC1-03DF, 03E1-03FF OBOA* OCOO-OCOB,OCOC-OCFF OBOA* ODOO-ODFF 080C* OEOO-OEFF 080P OFOO-OFFF, 07 BO-07FF 0810 AM, SM, SRAM, SLAM, TMB, TCMB, TSMB (if the second word is illegal) 0812 XOP (if ST11 = 1) "Bits 5, 6 and 7 of the MID Opcode select one of eight entry-table locations. tThe opcodes reserved for the LDD and LOS instructions should not be used as MID opcodes. A context switch occurs after the entry-point address has been read from the table. The workspace pointer is set to 0000 and the program counter is set to the address from the entry-point table. The old WP, PC, and status are saved in the MRAM locations corresponding to WR13, WR14 and WR15, respectively. The PC value saved in WR14 always points to the word immediately following the MID opcode. If a two-word MID opcode was encountered, the PC value always points to the word immediately following the first word of the two-word opcode. Prior to transferring program control to the Macrostore emulation software, the MID opcode responsible for causing the MID trap is automatically placed in registers 3 and 5 of the Macrostore workspace. If the first word of an instruction causes the MID trap, the (entire) first word is placed in WR5. If the second word of an instruction causes the MID trap, the (entire) second word of the instruction is placed in WR5, and bits 10, 11, 14, and 15 of the first word of the instruction are placed into bits 10, 11, 14, and 15 of WR3. In the latter case, bits 10, 11, 14, and 15 are sufficient to uni- quely identify the possible first word of an opcode in which the second word is illegal. The identification is per- formed as follows: Table 8 enumerates all the 2-word opcodes in the TMS99000 instruction set. These instruc- tions are divided into 3 groups. Bits 10 and 1.1 identify the group. Each group contains 2 or 3 opcodes. Bits 14 and 1 5 serve to identify the individual opcodes within each group. WR3 IN MACROSTORE: 012 3 4 5 6 7 8 9 10 11 12 13 14 15 LDFLAGS o o o o o o o GROUP o o OP# LONG-DISTANCE BITS 10, 11, 12 & 15 FLAGS ENCODE FIRST WORD OF TWO-WORD OPCODE Bits 0, 1 and 2 of WR3 are initialized to the value of the 99110's long-distance flags upon entry to Macrostore. These flags indicate whether an LOS or LDD instruction is currently in effect, as explained in Section 10. 41 TABLE 8-INSTRUCTIONS WITH TWO-WORD OPCODES MNEMONIC FIRST INSTRUCTION WORD Group 1: TMB 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 TCMB 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 0 TSMB 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 1 Group 2: AM 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 SM 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 Group 3: SLAM 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 SRAM 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 I Bits 10 and 11 identify group Bits 14and 15 identify opcode within group I 7.3.2 Exit Procedure Macrostore is generally exited by executing a RTWP instruction (opcode > 0380). Interrupts are sampled prior to executing the next instruction. In those instances where interrupts (maskable or non-maskable) should not be sampled before executing the next instruction, the exit from Macrostore is invoked using the opcode > 0384, a special form of the RTWP instruction. In either case, the WP, PC, and ST registers are updated with WR13, WR14, and WR15 from the MRAM. The >0384 exit ties the Macrostore operation to the execution of the instruction that follows the MID instruction. For example, it is used in emulating the LDD and LOS instructions, described in Section 10. If the Macrostore is entered upon detection of a MID opcode, and the emulation software in Macrostore deter- mines that it does not recognize the MID opcode as valid, the software must transfer control to the level-2 inter- rupt service routine, which has the responsibility for dealing with illegal opcodes. The emulation software in Macrostore uses the opcode >0382, another special form of the RTWP instruction, to exit the Macrostore under these conditions. When this opcode is executed in Macrostore, the processor sets the ILLOP flag of the error status bits (Section 4.4) before executing the RTWP operation. Consequently, following the context switch back to the program in main memory that contains the undefined opcode, the ILLOP flag forces a trap to the Ievel-2 in- terrupt service routine. The ILLOP interrupt is non-maskable and cannot be disabled by the interrupt mask in ST1 2- ST15. The opcodes >0380, >0382 and >0384 provide the only means for performing an exit from Macrostore. To perform an RTWP in Macrostore (I.e., inverse of a BLWP) the opcode >0381 should be used. This opcode will allow for return branching in the Macrostore address space without exiting Macrostore. 7.3.3 Macrostore Execution During Macrostore execution, several processor functions are modified to provide increased control. These are described below. 7.3.3.1 Status Register The contents of the status register are not affected by the context switch to Macrostore that follows detection of a MID opcode. Macrostore routines are "super-privileged," meaning that they can alter the contents of the status register and perform other privileged operations regardless of the value of the privileged mode flag, ST7. An ST bus status code (Table 2) is output from the processor when a Macrostore routine alters the ST register by means of the LST instruction. When the status register of the original main memory program environment must be modified, the appropriate bits of WR 15 must be modified prior to Macrostore exit. During emulation of an MID opcode in Macrostore, the emulation routine can modify the ST register value saved in WR15 in accordance with the results. During the context switch that follows the exit from Macrostore, the new status is loaded into the ST register. If the status value saved in WR15 has not been changed since the entry to Macrostore, it will be restored in its original form. While in Macrostore, the setting of both ST4 and ST10 to 1 does not cause the AF flag of the error status register to be set to 1. If an arithmetic fault interrupt is to be generated, then bit 4 and 10 of WR15 should be set so that an arithmetic fault trap will occur when the context switch out of Macrostore is made. 42 If it is required to modify the status bits of the main memory routine's status register prior to context switching out of Macrostore, the appropriate bits of WR15 should be modified. (Note if ST7 = 1, then status bits 6 to 15 will be set according to Section 6.) 7.3.3.2 Interrupts All interrupts except RESET are inhibited while executing from Macrostore. However, pending interrupts can be detected using the conditional jumps described in Section 7.2.7.5. 7.3.3.3 Macrostore Workspace Registers When Macrostore is initially entered, the Workspace Pointer is set to zero so that the internal Macrostore RAM is utilized as the workspace. The Workspace Pointer may be set to another value by the LWP, LWPI, or BLWP instruction when it is desired that the workspace be located in external Macrostore RAM. The workspace registers located in internal RAM have special uses associated with the evaluate address (EVAD) instruction described in Section 7.3.3.5. For this reason care must be exercised in assuring that the EVAD instruc- tion is used only with the Workspace Pointer equal to zero. Table 9 lists the dedicated functions of the workspace registers when the workspace pointer bits 11 to 15 are equal to zero as is the case when Macrostore is first entered. Table 10 lists the bus status codes of the workspace registers when the workspace pointer bits 11 to 15 are not equal to zero (Le., external RAM is used). TABLE 9 - DEDICATED MRAM REGISTER FUNCTIONS [WP bits 11 to 1 5 ara all zarol MAIN BUS MOD MOD MEMORY STATUS BY BY REGISTER ACCESS CODE EVAD MACRO USAGE 0 NO AUMS shift counts 1 NO AUMS 2 YES IAQ first word of 2-word opcode; * 3 YES GM YES LDO and LOS internal flags 4 NO AUMS scratch register for EVAO * one-word opcode or second * 5 NO AUMS YES word of two-word opcode 6 YES SOP OOP TdnotO EVAO* 7 YES WS YES Td = 0 destination address SOP Ts not 0 EVAO* 8 YES WS YES Ts = 0 source address EVAO address of external * 9 YES WS YES dest. register if *R + EVAO address of external * A YES WS YES source register if *R + B NO AUMS BLandXOP C YES OOP CRU base address 0 YES WS YES oldWP E YES lOP YES old PC F NO AUMS YES oldST • EV AD should only be used if the WP =0000. 43 TABLE 10 - BUS STATUS CODE ASSOCIATED WITH WP VALUE /WP bits 11 to 15 not equal to zero) REGISTER MAIN BUS ADDRESS MEMORY STATUS BITS 11 TO 15 ACCESS CODE 0 NO AUMS 2 NO AUMS 4 YES IAQ 6 YES GM 8 NO AUMS A NO AUMS C YES SOP E YES OOP WS 10 YES SOP WS 12 YES WS 14 YES WS 16 NO AUMS 18 YES DOP lA YES WS lC YES lOP IE NO AUMS 7.3.3.4 Accessing Main Memory Curing Macrostore execution, data in the main memory is accessed using the indirect autoincrement and indexed addressing modes (*R, *R + and@TABLE(R)). MRAM workspace registers 2, 3, 6, 7, 8, 9,10,12, 13and 14are used as base registers during these accesses. This is only true when the Workspace Pointer resides on a 32-byte boundary, i.e., five LSB's = O. When a routine residing in Macrostore accesses the main memory through one of these registers, the access is accompanied by a bus status code indicating a particular type of memory cycle, and MEM is held active-low. The bus status code corresponding to the use of each register is indicated in Table 9 for the case when WP = > 0000. When the WP does not equal zero, the type of bus cycle and corresponding bus status code is determined by the least-significant addresses of the workspace register as shown in Table 10. For simplicity, it is recommended that the Workspace Pointer point to a 32-byte boundary to avoid confusion as to the type of bus cycle that will occur when the register is used as base register for memory transfers. Each main memory access should utilize a base register whose use is accompanied by the bus status code appropriate to the type of access being performed. As shown in Table 9, WRs 7 and 8 are a special case in regard to the bus status code output during a main memory access. The default bus status code output by the processor is COP (Table 2) when WR7 is used to access main memory; the default for WR8 is SOP. If an EVAD operation (to be described) is performed on an opcode whose Td field is 0 (workspace register direct addressing), the bus status code associated with WR7 is changed from its default of DOP to WS. Similarly, if an EVAD operation is performed on an opcode whose Ts field is 0, the bus status code for WR8 is changed from SOP to WS. If an EVAD subsequently is performed on an instruction with non-zero Td, the default of DOP is restored to WR7, and a non-zero Ts restores SOP to WRS. Everytime Macrostore is entered, the default status codes are restored. Two examples illustrate the main memory access capability. The convention is to refer to the program in main memory that contains the MID opcode as the "user's" program. Assume that WR 13 in MRAM contains the user's Workspace Pointer. To read the contents of WR4 in the user's workspace into WR1 in MRAM, the instruction MOV @8(R13), R1 is executed from Macrostore. A WS bus status code is output during this operation (MEM = 0, BST = 110). Second, assume that WR14 in MRAM contains the user's PC value. To read immediate data or a symbolic address (following a MID opcode in the user's program) into WR14 in MRAM, the instruction MOV *R14+,R1 is ex- ecuted. This also causes the user's PC value in WR14 to be incremented by two, and an lOP bus status code is output (MEM = 0, BST = 010). 44 Using register 0, 1,4, 5, 11 or 15 as base register for indirect autoincrement or indexed addressing results, in an access of Macrostore. During Macrostore accesses, the AUMS and AUMSL bus status codes are output to distinguish them from accesses of the main memory. While executing in Macrostore, all symbolic addresses refer to locations within Macrostore. A I/O access using the base address in Macrostore register WR12 is accompanied by the I/O bus status code. 7.3.3.5 Evaluate Address Instruction- EVAD An EVAD instruction during Macrostore execution permits convenient calculation of effective source and destination addresses for MID opcodes. EVAD assumes that the MID opcode contains a six-bit source operend field, and a six-bit destination operand field, i.e., the dual-operand format described in Section 10.5.1. The address calculations are based upon the original WP of the user, saved in WR 13 in MRAM. Note that the EVAD instruction assumes that the WP is equal to zero as initialized upon entry into Macrostore. If the WP is modified to point to external MRAM, the WP must be restored to zero prior to EVAD execution. If the contents of a register in the uaer's workspace are fetched as part of the address calculation, a WS bus status code is output by the processor while the external access takes place. The saved PC (in WR 14) is incremented appropriately if symbolic or indexed addressing is used. The contents of any workspece register in MRAM except WRO can be eveluated using EVAD. When EVAD is executed, the calculated effective source address is placed in WR8 in MRAM, and the calculated destination address in WR7. If the source or destination field specifies autoincrement mode, the address of the uaer's register is placed in WR9 or WR10, respectively. Execution of EVAD alters the contents of WR4, which EVAD uses as a scratch register. A summary of the EVAD i~struction, including its effect on status bits 0 and 2, is preaented in Table 11. Instruction o 9 10 11 12 15 Format 0000000100 Ts S ForEVAD: opcode mode register The Ts and S fields above are used to determine the effective source address of the target word of the EVAD in- struction. Once the target word is fetched as the source operand, the Ts, S, Td and D fields from that word are ex- tracted and utilized as indicated balow. TABLE 11 - EVALUATE ADDRESS INSTRUCTION STATUS BITS DESCRIPTION AFFECTED DA-WR7 SA-WR8 If target Ts = (symbolic or indexed) WR14+2 - WR14 If target Td = 2 (symbolic or indexed) WR14+2-WR14 O-ST2 If target Ts not 3 1 - STO If target Td not 3 1 -ST2 If target Ts = 3 (autoincrement): address of external register - WR10 O-STO If target Td = 3 (autoincrement): address of external register - WR9 The processor's WP register must be set to >0000 before executing the EVAD instruction. Otherwise, the results are unpredictable. If only the source field of an MID opcode is to be evaluated, the Td field (bits 4 and 5) should be cleared to prevent unnecessary external accesses or. unintentional modification of WR13 (generally the user's PC). For example, if the MID opcode resides in WR5 and bits 4 and 5 are not zero in MRAM, the instruction sequence 45 ANDI R5, >F3FF EVADR5 is executed while in Macrostore to calculate the effective source address. The destination field, which is all zeros, is interpreted as register direct addressing mode (and STO is set to one). In order to deal with the case where the source field specifies autoincrement mode (ST2 = 1), the instructions above are followed by JEQ $ +4 INCT *R10 The second instruction increments the user's base register by two, assuming the source operand is one word in length. If the operand occupies a byte or double-word instead, the base register should be incremented by one or four, respec- tively.* When developing an effective address based upon one of the user's workspace registers (in main memory), the EVAD instruction uses the contents of Macrostore register WR13. When developing an operand address based upon the user's program counter, the EVAD instruction uses the contents of Macrostore WR 14. Note that WR 14 is incremented by two for each symbolic or indexed addressing mode utilized. 7.3.3.6 Jump on Interrupt Status The TB (test bit), SBO (set bit to one) and SBZ (set bit to zero) instructions are not available during Macrostore execution. In place of these operations and using the same opcodes are conditional jump instructions that detect pending interrupts. A "pending" interrupt is defined as an interrupt that has been requested by activating the processor's NMI, or by asserting a request for an external interrupt that is not disabled by the interrupt mask in ST12-ST15. The instructions described in Table 12 allow interrupts to be tested at interruptible points in Macrostore routines. With this capability, instructions requiring long execution times can be emulated in a way that permits them to be interrupted and resumed after interrupt servicing. The "jump if interrupt present" can be used to test for the occurrence of an interrupt. The "jump not equal and no interrupt present" is useful in testing for interrupts while in loops. This single instruc- tion may be used to exit a loop either on the condition that the loop count is zero or the interrupt is present. t EXAMPLE: LOOP . MOV *R1 +, *R2+ DEC R3 R3 HAS LOOP COUNT SBZ LOOP DONE? JNE OUT JUMP TO OUT IF NO INTERRUPT • • OUT • These jump instructions have a displacement range of - 128 to + 127 words from the memory-word address following the jump instruction. The displacement is specified in the odd byte of each instruction. No status bits are affected by execution of a jump instruction. The SBO and SBZ opcodes are executed in Macrostore as conditional jump instructions. SBO is equivalent to "jump if an interrupt is pending," and SBZ is equivalent to "jump if an interrupt is pending and ST2 is zero." The TB opcode is undefined in Macrostore. These instructions are summarized in Table 12. TABLE 12-JUMP ON PENDING INTERRUPT MNEMONIC OPCODE MEANING SBO 1DXX Jump if unmasked interrupt is present SBZ 1EXX Jump if equal bit is not set and unmasked interrupt is not present TB 1FXX Undefined * The incrementing of workspace registers in the main memory is not performed by the EVAD Instruction but is the responsibility of the Macrostore software. Care may therefore be required to deal with the instance where the target word of an EVAD operation contains source and destination fields that specify in- direct autoincrement using the same workspace register n (i.e .. * Rn +, *Rn +). Otherwise, both the source and destination operands (pointed to by register n) will be read from the same address rather than from successive addresses. tWhen using SBZ to check for exiting a loop, a JNE or JEQ instruction should follow (outside the loop) to determine the reason the loop was exited; SBO should not be used for this purpose when an interrupt is applied and then removed. 46 7.3.4 Subroutine Branch and Return While executing in Macrostore, the BLWP instruction can be used to transfer program control to a subroutine located within Macrostore. For this purpose the opcode >0381 should be used. This version of the RTWP opcode should be distinguished from the RTWP variants >0380, >0382and >0384, discussed in Section 7.2.6, all three of which cause an exit from Macrostore. 7.3.5 MID Opcodes in Interrupt Routines One restriction exists regarding the use of MID opcodes within interrupt service routines. An MID opcode encountered in the interrupt routine for an NMI or level-1 interrupt, or for a Reset routine that does not cause complete system reinitializa- tion, must not result in an exit from Macrostore by means of opcode >0382, the special form of RTWP that causes a level-2 trap. The reason is that the level-2 routine can be interrupted by an NMI, level-1 interrupt or Reset, possibly destroying the return linkage established previously. In general, this restriction can be interpreted to mean that a MID opcode in the service routine of an interrupt of higher priority than level 2 must either be recognized by an attached processor or defined by an emulation routine in Macrostore. 7.3.6 Testing for External Macrostore The on-chip Macrostore software can use the following technique to allow the user to optionally expand the Macrostore functions by adding new routines residing in off-chip RAM or ROM. The TMS99110 uses this technique to check for populated off-chip Macrostore memory. When the emulation software in the 99110's on-chip MROM determines that it cannot execute a particular MID opcode, it then checks to determine whether the system contains external Macrostore (off-chip RAM or ROM). If so, the Macrostore program branches to location >1002, the entry point of the emulation software in the external Macrostore. Otherwise, a level-2 interrupt is requested, as described in Section 7.2.4.1. The check to determine whether the system contains external Macrostore works as follows. In a system having external Macrostore, the code >AAAA (alternative ones a~d zeros) must be stored at Macrostore address > 1000, which is the first location in the off-chip region of Macrostore. The internal Macrostore emulation software upon deciding to test for external Macrostore, reads the contents of address >1000. If this location contains the code >AAAA, this confirms that the external Macrostore is present. 8. ATTACHED PROCESSOR (AP) INTERFACE The TMS99000's basic instruction set can be extended by defining new instructions. The extended instruction set is supported either by emulation software contained in external Macrostore, or by external hardware utilizing the TMS99000's attached processor (AP) interface. The TMS99000's AP interface provides complete software transparency between these two methods. System support for extended instructions can be conveniently upgraded from Macrostore emulation routines to attached processors without affecting the user's software base. An AP in a TMS99000 system attaches to the local bus of the microprocessor. While the processor is actively executing instructions, the AP passively monitors the bus to detect opcode fetches. The TMS99000 outputs an IAQ (instruction acquisition) bus status code to notify the AP each time an opcode fetch cycle occurs, and the AP latches the opcode from the bus to examine it. When the TMS99000 fetches an opcode which it does not recognize, but which the AP is prepared to execute, the TMS99000transfers control ofthe local bus to the AP. After the AP completes execution of the instruction, it returns control to the processor. The signals utilized by the AP interface of the TMS99000 are shown in Figure 29. The transfer of control from the TMS99000 to an AP and the eventual return of control to the TMS99000 takes place chiefly through the following three signals: • APP (attached processor present) input • MID (macro-instruction detected) bus status code • HOLDA (hold acknowledge) bus status code 41 MEM ~ ADDRESS/DATA (0-15) ALATCH ..-- \ ~ WE/CRUCLK TMS99000 RD MEMORY SYSTEM .. READY R/W APP BST 11-3) l ~ ATTACHED PROCESSOR FIGURE 29-ATTACHED PROCESSOR INTERFACE System memory, shared by the TMS99000 and the AP, is used to transfer context information from one to the other. The TMS99000's workspace registers, which reside in memory, are readily available to the AP while the AP remains in control of the local bus. The timing for the AP interface is shown in Figures 30A and 30B. When the TMS99000 fetches an opcode it does not recognize, it outputs an MID bus status code to notify APs, should they be present, that it is prepared to relinquish system control. An opcode that causes this to occur will be referred to as an MID opcode. A list of MID opcodes is presented in Section 10.5.17. If bit 11 of the status register is set to 1, an XOP will also be treated as an MID opcode. 48 CLKOUT (6) (6) ALATCH BST(1-3) (1) XAUMSY MID XJiC.v:=J . . :-:T_..Jh!!!;i-:!,z_.....: I I (4) MEM "\ hi-z __X::= (2) READY ~\"' _ _..JI APP \\\\\\\\\"\\\\\\\\\\\ R/W \"'----- (6)C c I INSTR I LAST I DETERMINE FETCH NEW HOLD STATE I AP CYCLES: I FETCH I STATE I IF ATTACHED WP;STORE I ALL CONTROL IOF IOF I PROCESSOR OLDPC,WP I LINES ARE I MID I PRIOR I IS PRESENT ANDST I DRIVEN BY I OP- I INSTR I I ATTACHED I CODE I I I PROCESSOR I I I I NOTES: (1) This bus status is determined by the prior instruction. (2) Processor will remain in this state until READY goes high. (3) BST = STwhen the new status is output = INTA when the new WP is fetched = WP when the new WP is output = WS while the old WP. PC. and ST are stored I For simplicity, AUMS bus status codes are not shown.) (4) The processors tristates all signals except ALATCH as follows: • BST1-BST3 are first driven high to indicate hold acknowtedga and then are tristated. • MeM, Ro and WE are first driven high and then tristated. • The address-data bus is tristated "as is". 15) The processor first drives its ALATCH output high and then tristates it. 16) The CLKOUT remains the system clock throughout. FIGURE 3O-AP INTERFACE TIMING (AI Transferring Control to Attached Processor 49 CLKOUT ALATCH .J\..J\..../ ....!!!:L , - - - __ 01 BST(1-31 (21 1 )(_..J1 --.;.(1;.;.1_..;.h;.;..i-_Z_X~(3~1_ _ ~ - ST X fAQ )( WP X~__ MEM ::x I hi-z \ ----' \ I , APP I - HolD J (41 - LAST STATE APP RELEASED; PROCESSOR I LEAVES HOLD I OUT- PUT I FETCH NEXT I r OUT- I RESUME PUT 1NORMAL OFAP APANDMAIN AND FETCHES I NEW IINSTR I NEW I EXECUTION CON- CPU BOTH UPDATED I ST J I WP I TROL fNHOLD WP.PC.ST I I I I I I J I I NOTES: (1) The AP tristates ell signals except ALATCH al follows: • 8ST-I-8ST-3 are first driven active high and then are tristated. • MEM, iii) and WE are first driven high and then are tristated. • The addreas-data lines are tristated. (2) The AP dri_ its ALATCH high and then tris18tallt. (3) 8ST ~ WS during WP, PC, and STfatches. (4) An AP that felches instructions for chained operations wDl assert HOLD and release APP during the instruction felch to allow m to be used for a breakpoint request. FIGURE 30 - AP INTERFACE TIMING III Regaining Control From Attachad Proc•••or Assuming that an AP is (1 I presentand is (21 prepared to execute the MID opcode. it responds to the MID bus status code by pulling the APP line low to signify its readiness. Upon detecting the APP signal, the processor prepares to transfer control to the AP. This involves clearing status bit 8 and performing a context change. With the PSEL output signal high, the processor fetches the new WP value from the trap vector for the leval2 interrupt. (The PC value from the vector is not fetched. I The old WP, PC and ST values are saved in WRs 13, 14 and 150fthe new workspace. The saved PC points to the word following the MID opcode. After completing these actions, the processor begins a hold cycle, forces its outputs to the high-impedance state, and asserts HOLDA. This is the processor's signal that it is ready for the AP to assume control of the local bus. Since the 99000 uses the same HOLDA bus status cod!.!2,respond to both DMA devices and APs, each AP must monitor the HOLD line to distinguish a HOLDA in response to APP from a HOLDA in response to HOLD. After taking control of the local bus, the AP begins executing tha operation specified by the MID opcode. If a multiple- word instruction format is specified, the PC value saved in WR14 is used by the AP to access immediate data and operand address information. The contents of the original workspace are accessed through the WP value saved in WR13. The ST value in WR15 is altered to reflect tha results of the operation performed. The 99000 continually samples its APP and HOLD inputs during the hold cycle. When the AP completes its operation and releases APP , the processor responds by terminating the hold cycle. The processor loads PC, WP and ST registers with the values in WRs 13, 14and 15, and resumes execution. 50 If an MID opcode is detected and APP remains high, indicating that no AP is prepared to execute the instruction, the processor performs a context switch that transfers control to the instruction emulation software contained in its Macros- tore (Section 7). The APP input performs a second function apart from its use in transferring control to an AP. An external device can use APP to force the processor to enter a hold cycle by asserting APP during the instruction acquisition (lAO) cycle. The mechanism works as follows. The processor samples APP at the end of every opcode fetch, at the same point that it latches the opcode. The processor fetches the WP value from the level 2 trap vector and saves the old WP, PC, and ST values in WRs 13, 14, and 15 of the new workspace. The PC value saved in WR14 points to the memory word containing the opcode that was just fetched (and discarded). Following the context switch, the processor outputs the HOLDA bus status code, enters the hold state, and waits for APP to be released, as before. The APP signal can be used by a maintenance panel to force the processor to enter hold. Using the mechanism described above, the maintenance penel can trigger APP on either a selected address or a selected opcode to cause a breakpoint. To avoid possible interference with APs, the maintenance panel should not assert APP during an MID bus status code if it was not active at lAO. If the "panel option" is used with APP, an attached processor should not assert APP until it has recognized a MID bus status code. The processor acknowledges an unmasked interrupt upon completing execution of the instruction during which the interrupt becomes active. If the processor must respond to an interrupt before it can begin execution of a prefetched opcode, * the opcode is discarded prior to trapping to the interrupt service routine. Upon return from the interrupt, the opcode previously discarded is again fetched from memory. A special case of this procedure occurs when the discarded opcode is an MID opcode that an AP is preparing to execute. The AP must discard the opcode also. The AP knows to discard the opcode if the processor, following its fetch of the MID opcode, outputs the INTA bus status code. Alternatively to checking for the INT A bus status code, the AP can check for a subsequent lAO bus status code in- dicating that the instruction has been discarded. This means that the processor has discarded the opcode in order to service the pending interrupt. APs must monitor HOLD to detect DMA requests as discussed above. In a processor system containing one or more APs, the TMS99000 HOLDA signal is not distributed directly to DMA devices but is gated with the hold acknowledge signals from the APs to form a composite hold acknowledge signal that is passed on to the DMA devices. This composite hold acknowledge signal, which signifies transfer of control to the DMA device, is generated only after the processor and all APs have entered the hold state. When an X (execute) instruction is executed, an lAO bus status code is NOT output during the fetch of the target opcode located at the effective source address of the X instruction. Instead, an SOP or WS bus status code is output, depending on the addressing mode used. This means that APs cannot rely upon the lAO bus status code to notify them when the processor fetches a MID opcode that is the target opcode of an X instruction. The AP interface can be disabled by tying APP to ground. When operating in this mode, the processor automatically generates an ILLOP interrupt request upon encountering an MID opcode, bypassing the AP interface and Macrostore. -The processor routinely prefetches the next opcode one st8te prior to completion of the current instruction (Section 10.6.2), 51 S. PIN DESCRIPTION Table 13 defines the TMS991 05A/TMS9911 OA pin assignments and describes the functions of each pin. Figure 31 illustrates the TMS991 05A/TMS9911 OA pin assignment information. --- WEIIOCLK 1 40 MEM RD 39 BST1 RESET 38 BST2 APP 4 37 BST3 HOLD 36 XTAL1/CLKIN VSS 6 35 XTAL2 READY 7 34 CLKOUT INTREQ 33 Vss TMS99105A NMI 9 32 ALATCH TMS99110A ICO 31 PSELlD15/0UT IC1 30 A14/D14 1C2 12 29 A13/D13 IC3 13 28 A12/D12 R/W 14 27 A11/D11 Vee 15 26 A10/D10 AO/DOIIN 16 25 AS/DS A1/D1 17 24 AB/DB A2/D2 18 23 A7/D1 A3/D3 19 22 A6/D6 A4/D4 20 21 A5/D5 FIGURE 31 - PIN ASSIGNMENTS 52 TABLE 13-PIN DESCRIPTION SIGNATURE PIN I/O DESCRIPTION POWER SUPPLIES Vee 15 Supply voltage: + 5 V nominal. Vss 6,33 Ground reference. CLOCKS XT AL 1/CLKIN 36 IN Crystal input pin for internal oscillator; also input pin for external oscillator. XTAL2 35 IN Crystal input pin for internal oscillator. CLKOUT 34 OUT Clock output Signal. The frequency of CLKOUT is 14 the frequency of the crystal oscillator. ADDRESS/DATA BUS AO/DOIIN 16 I/O WhOe ALATCH = 1, these lines function as an address bus consisting of output signals AO-A 14 and PSEL. (addr/data MSB) During memory, I/O and Macrostore accesses, an address is output on AO-A14. During memory cycles, A1/D1 17 I/O status bit 8 is output in complemented form on PSEL.; PSEl. is forced high during I/O accesses. During WP A2/02 18 I/O and ST bus cycles (Table 2), status information is output on the address bus. A3/D3 19 I/O WhOe ALATCH=O, these lines function as a bidirectional data bus for memory, I/O and Macrostore A4/04 20 I/O accesses. Ouring a bit-parallel byte or word read operation, (RD active lowl. data is input on 00-015. A5/05 21 I/O During a bit-parellel write operetion (WE/iOcLK active low), data is output on 00-015. For bit-serial I/O A6/06 22 I/O operations, read data is input on IN, and write data is output on OUT. A7/07 23 I/O These lines are forced to the high-impedance state during a hold cycle. A8/DS 24 I/O AS/D9 25 I/O A10/D10 26 I/O A11/011 27 I/O A12/012 28 I/O A13/013 29 I/O A14/014 (addr LSB) 30 I/O PSEUD 1 5tOUT 31 I/O LOCAL BUS CONTROL SIGNALS ALATCH 32 OUT Address latch. While ALATCH is high, the multiplexed address-data lines function as an address bus; while ALATCH is low, they function as a data bus. Each bus cycle (memory, I/O or internall begins with a positive ALATCH pulse, the falling edge of which is used by external logic to latch the contents of the address bus. The MEM and BST1-BST3 outputs are stable while ALATCH is low. Prior to entering hold, the HOLDA bus status code is output and the ALATCH signal undergoes one final high-to-Iow transition before being driven to the high-impedance state. This permits an external device to latch the HOLDA code. MEM 40 OUT Memory cycle. When low, iiiiEM indicates that a memory cycle is in progress. When high, iiiiEM indicates thata 110 or internal cycle is in progress. MEM is forced to the high-impedance state during a hold cycle; an intamal resistive pull-up maintains a high level. WE/iOciJ< 1 OUT Write enable and inverted I/O clock. When low, WEtiOCD< indicates that write date is present on the data bus. WE/iOCD< is active during memory writes (MEM = 0), serial I/O writes (MEM = 1, BST2=1, AO=O), parallel I/O writes (MEM=1, BST2=1, AO=1), and writes to external Macrostore (ME"M = 1, BST2 =0). WEIIOCLK ,is a tri-state output signal, and is forced to the high- impedance state during a hold state; an internal resistive pull-up maintains. a high level. AD 2 OUT Read Enable. When active low, iffi indicates that a read (memory, parellel I/O, serial 1/0 or external Macrostore) is taking place on the bus, and that external devices may enable their tristate drivers to gate data onto the address-data lines. RD is a tristate signal and is forced to the high-impedance state during a hold state; an internal resistive pull-up maintains a high level. RIW 14 OUT READ/WRITE. The RIW is valid at the beginning of each new cycle. This signal is high during read operetion and low during write operations and internal ALU cycles. When RIW is low, it indicates thatthe 99000 will be driving the data bus. When RIW is high, it indicates that the 99000 will tristate the data bus (AD bus during the data time). 53 TABLE 13- PIN DESCRIPTION '(CONTINUED) SIGNATURE PIN I/O DESCRIPTION LOCAL BUS CONTROL SIGNALS (CONCLUDED) READY 7 IN Ready. When high, READY indicates that the current bus cycle (memory, 1/0 or internal) is ready to be completed. As long as READY remains low to indicate a not ready condition, the bus cycle continues to be extended with wait states. Near the end of each wait state, READY is sampled to determine whether the bus cycle can complete or another wait state is to be generated. Note that this READY function differs from some READY functions in that bus cycles of non-memory cycles are affected by its operation. INTERRUPTS INTREQ 8 IN Interrupt request. When active low, INTREQ indicates that an external interrupt is requested. If INTREQ is active, the processor latches the contents of the interrupt code inputs ICO-le3 into its internal interrupt code register. The code is compared with the interrupt mask in status register bits 12-15. If the code is less than or equal to the mask value, the interrupt is granted; otherwise, the request is ignored. ICO-IC3 continue to be sampled as long as INTREQ remains low. If the request is initially disabled by the mask, INTREQ may be held low until the mask changes to a value that enables the request. ICO (MSB) 10 IN Interrupt code. ICO is the MSB of the 4-bit interrupt code. ICO-IC3are sampled when iNTREci is active low. ICI 11 IN The highest-priority interrupt level is signified by ICO-IC3 = LLLL; the lowest level is HHHH. IC2 12 IN IC3(LSB) 13 IN NMi 9 IN Non-maskable interrupt. When active low, N MI causes the processor to perform a non-maskable interrupt - using the trap vector located at memory address FFFC. The NMI sequence begins following the execution of the instruction in progress at the time the NMI request is initiated. The NMI will also terminate an idle state. If NMlis active during the time RESET is released, the NMI sequence will occur following completion ofthe reset sequence, but prior to execution ofthe first instruction in the reset service routine. iiiMi must be active for at least one CLKOUT cycle to be recognized and will only be recognized once for each high-to- low transition. RESET 3 IN RESET. When active low, RESET causes the processor to set all status bits to zero and inhibits WEI iCiCLi<, RD and MEM internally. When RESET is released, the processor initiates a level 0 interrupt sequence using the trap vector at memory address 0000, clears the entire status register, and begins executing the reset service routine. RESET also will terminate an idle state. RESET must be held active for at least three CLKOUT periods to guarantee that a Reset will take place. RESEr is a Schmitt-trigger input. DMAREQUEST HOLD 5 IN HOLD. An external controller generates a hold request by pulling the processor's HOLD input low. This indicates the controller's wish to obtain control of the local bus to perform one or more DMA transfers. The processor responds to the hold request by outputting a HOLDA bus status code (Table 12) and then forcing MEM, WE/IOCLK, RD, BST1-BST3, R/IN, ALATCH and the address data lines to the high-impedance state. When HOLD is released, the processor terminates the hold cycle and resumes processing. BUS STATUS BSTI (MSB) 39 OUT Bus status lines. These lines are used with the MEM output to provide external circuitry with information BST2 38 OUT concerning the nature ofthe bus cycle currently in progress. The bus status codes are presented in Table 2. BST3 (LSB) 37 OUT MPILCK is indicated by BST1-BST3 = 000. BST1-BST3 are forced to the high-impedance state during a hold cycle. 54 TABLE 13-PIN DESCRIPTION (CONCLUDED) SIGNATURE PIN 1/0 DESCRIPTION ATIACHED PROCESSOR APP 4 IN Attached processor present. When the TMS99000 fetches an MID opcode (Section 2.4), it outputs an MID bus status code and samples the APP input. If APP has been pulled low by an external device, the CPU performs a context switch and relinquishes control of the local bus. The CPU fetches the new WP from the level 2 trap vector, and the old WP, PC, and ST are saved in the new workspace. The CPU signals its release of the local bus by outputting a HOLDA bus status code and then enters hold. After the attached processor has completed its operation, it releases APP; the CPU responds by terminating, restoring its context,' and resuming processing. If no extemal device asserts APP, the CPU attempts to emulate the MID opcode in Macrostore and traps to the level 2 interrupt service routine if the opcode is undefined in Macrostate. 55 10. INSTRUCTION SET 10.1 DEFINITION Each TMS99000 instruction performs one of the following: • Arithmetic or logical operation on data, or comparison or manipulation of data, • Loading or storing of internal registers (program counter, workspace pointer, or status register), • Data transfer between memory and external devices via the I/O, or • Control functions. 10.2 ADDRESSING MODES The TMS99000 instruction set provides a variety of modes for addressing random memory data, e.g., program parameters and flags, or formatted memory data (character strings, data lists, etc.). These addressing modes are: • Workspace register addressing • Workspace register indirect addressing • Workspace register indirect autoincrement addressing • Symbolic (direct) addressing • Indexed addressing • Immediate addressing • Program counter relative addressing • I/O relative addressing The derivation of the effective address for each addressing mode is described graphically below. The applicability of each addressing mode to particular instructions is described in Section 10.5, along with the operation performed by each instruction. The symbols following the names of the addressing modes, R, *R, *R + , @LABEL and @TABLE(R), are the general forms used by processor assemblers to specify the addressing mode for workspace register R. 10.2.1 Workspace Register Addressing, R Workspace register R contains the operand. REGISTERR IPC) --I.._I_N_ST_R_U_C_T_I_O_N_-,~IWP) + 2R...f.._ _O_P_E_R_A_N_D_...... The workspace register addressing mode is specified by setting the two-bit T-field (Ts or Td) of the instruction word to O. 10.2.2 Workspace Register Indirect Addressing, *R Workspace register R contains the address of the operand. REGISTER R IPC)-+I.. _I_N_ST_R_U_C_T_IO_N_...A~IWP) + 2R...f ADDRESS H OPERAND I The workspace register indirect addressing mode is specified by setting the two bits in the T-field (Ts or Td of the instruction word to 01. 10.2.3 Workspace Register Indirect Autoincrement Addressing, *R + Workspace register R contains the address of the operand. After acquiring the address of the operand, the contents of the workspace register are incremented. REGISTER R r-------~ r------~ I_I_N_S_T_R_U_C_T_IO_N_..I-IWP) + 2R .. 1 (byte) or 2 (word) The workspace register indirect autoincrement addressing mode is specified by setting the two-bit T-field (Ts or Td) of the instruction word to 3. 56 10.2.4 Symbolic (Direct) Addressing. @LABEL The word following the instruction contains the address of the operand. (PC). INSTRUCTION (PCI+2. ......-------1 LABEL t-----I"~ OPERAND I --------1 The symbolic addressing mode is specified by setting the two-bit T-field (Ts or Td) of the instruction word to 2 and setting the corresponding S or 0 field equal to O. 10.2.5 Indexed Addressing. @TABLE(R) The word following the instruction contains the base address. Workspace register R contains the index value. The sum of the base address and the index value results in the effective address of the operand. REGISTER R (PC)--i INSTRUCTION ~(WP)+2R INDEX VALUE ~----~" OPERAND (PC)+2 TABLE The indexed addressing mode is specified by setting the two-bit T-field (Ts or Td) of the instruction word to 2 and setting the corresponding S or 0 field to a value other than O. The value in the S or 0 field is the number of the workspace register which contains the index value. 10.2.6 Immediate Addressing The word following the instruction contains the operand. (PC)-. INSTRUCTION (PC) + 2... . . . .------1 OPERAND 10.2.7 Program Counter Relative Addressing The 8-bit signed displacement in the right byte (bits 8 through 15) of the instruction is multiplied by 2 and added to the updated contents of the program counter. The result is placed in the PC. PROGRAM COUNTER OPCODE t-----r----t.. NEXT MEMORY WORD 57 10.2.8 1/0 Relative Addressing The a-bit signed displacement in the right byte of the instruction is added to the I/O base address (bits 0 through 14 of workspace register 121. The result is the address of the selected bit in I/O space. (PC)----~ CRU BIT ADDRESS (WP) + 2*12 ------I... o 5 6 14 15 10.3 TERMS AND DEFINITIONS The terms used in describing the instructions of the processor are defined in Table 14. TABLE 14-SYMBOL CONVENTIONS SYMBOL DEFINITION B Byte indicator (1 = byte; 0 = word) C Bit count D Destination address register DA Destination address lOP Immediate operand LSB(n) Least-significant (rightmost) bit of n MSB(n) Most-significant (leftmost) bit of n N Don't care PC Program counter result Result of operation performed by instruction S Source address register SA Sou rce address ST Status register STn Bit n of status register Td Destination address modifier Ts Source address modifier W Workspace register WRn Workspace register n (n) Contents of n ((n)) Indirect contents of n a-b A is transferred to b Inl , Absolute value of n + Arithmetic addition - Arithmetic subtraction AND Logical AND OR Logical OR ® Logical exclusive OR . n Logical complement of n Arithmetic multiplication I/O base address The address which is stored in WR12 effective 1/0 base address The address which is formed by adding the displacement to the base address in WR12 for single bit 1/0, or the incremented value of WR12 for multibit 1/0. 1/0 bit address The effective address of a bit located in the lower half of the 110 space. 58 10.4 STATUS REGISTER MANIPULATION Various TMS99000 machine instructions affect the status register. Figure 5 shows the status register bit assignments. Table 15 lists the instructions and their effect on the status register. TABLE 15 - STATUS REGISTER BIT DEFINITIONS· CONDITIONS TO SET BIT TO 1 BIT NAME INSTRUCTION IOTHERWISESETTOOI STO LOGICALLY C,CB If MSB(SA) = 1 and MSB(DA) =0, or if GREATER MSB(SA) =MSB(DA) and MSBHDA) - (SA)) = 1 THAN CI If MSB(W) = 1 and MSB of lOP =0, or if MSB(W) = MSB of lOP and MSB(lOP - (W)) = 1 ABS, LDCR If (SA) is not zero RTWP IfbitOofWR15is 1 LST If bit 0 of selected WR is 1 A,AB,AI If result is not 0 AM,ANDI, (see Note 2) DEC, DECT, LI, MOV, MOVB, NEG, ORI, S, SB, DIVS, MPYS, INC,INCT, INV, SLA, SLAM, SM, SOC, SOCB, SRA, SRAM, SRC, SRL, STCR, SZC, SZCB, XOR Reset STO is cleared unconditionally All other STO is not affected instructions (see Note 1) and interrupts ·See Table 13 for definition of terminology used. NOTES: 1. 'The X instruction itself does not set any status bits, but the target instruction may set status bits accordingly. 2. If on a DIVS instruction an overflow occurs. ST4 is set and STO, STl. and ST2 are undefined. 59 TABLE 15 - STATUS REGISTER BIT DEFINITIONS (CONTINUEDI CONDITIONS TO SET BITTO 1 BIT NAME INSTRUCTION (OTHERWISE SET TO 01 ST1 ARITHMETIC C,CB If MSB(SAI = 0 and MSB(DAI = 1, or if GREATER MSB(SAI = MSB(DAI and MSB((DAI - (SA)) = 1 THAN CI If MSB(WI = 0 and MSB of lOP = 1, or if MSB(WI = MSB of lOP and MSB(lOP - (W)) = 1 ABS,LDCR If MSB(SAI =0 and (SAl is not 0 RTWP If bit 1 ofWR15 is 1 LST If bit 1 of selected WR is 1 A,AB,AI, If MSB of result = 0, AM,ANDI, and result is not 0 DEC, DECT, (see Note 21 LI, MOV, MOVB, NEG, ORI,S, SB, DIVS, MPYS, INC,INCT, INV,SLA, SLAM, SM, SOC,SOCB, SRA,SRAM, SRC, SRL, STCR, SZC, SZCB,XOR Reset ST1 is cleared unconditionally All other ST1 is not affected instructions (see Note 11 and interrupts NOTES: 1. The X instruction itself does not set any status bits, but the target instruction may set status bits accordingly. 2. If on a DIVS instruction an overflow occurs, ST4 is set and STD, ST1, and ST2 are undefined. 60 TABLE 1& - STATUS REGISTER BIT DEfINITIONS (CONTINUED) CONDITIONS TO SET BIT TO 1 BIT NAME INSTRUCTION (OTHERWISE SET TO 0) S12 EaUAL/TB C,CB If (SAl = (DAI INDICATOR CI If(WI=IOP COC If ((SAl and not (DAll = 0 CZC If ((SAl and (DAII = 0 TB If CRUIN = 1 for addressed CRU bit TSMB, TCMB, If addraased mamory bit = 1 TMB ABS,LDCR If(SAI=O RTWP If bit 2 ofWR15is 1 LST If bit 2 of selected WR is 1 A, AB, AI, AM, Ifrasult = 0 ANDI, DEC, (ssaNota21 DECT, LI, MOV,MOVB, NEG,ORI, S, SB, DIVS, MPYS,INC, INCT,INV, SLA,SLAM, 5M,SOC, SOCB,5RA, 5RAM,5RC, SRL, STCR, SZC, SZCB, XOR Resst 5T2 is cleared unconditionaUv All other 5T2 is not affected instructions (see Nota 1) and interrupts S13 CARRY OUT A,AB,ABS, AI,AM, DEC, DEeT,lNC, INCT If carry out = 1 NEG,S,SM, SB SLA, SRA, SRL, SRC, If last bit shifted out = 1 5RAM,SLAM RTWP If bit 3 ofWR15is 1 LST If bit 3 of selected WR is 1 Resat ST3 is cleared unconditionally AU other ST3 is not affacted instructions (sse Nota 11 and interrupts NOTES: 1. The X instruction itself does not set any status bits, but the target instruction may set status bits accordingly. 2. If on a DIVS instruction an overflow occurs, ST4 is set end STO, ST1, and ST2 are undefined. 61 TABLE 16 - STATUS REGISTER BIT DEFINITIONS (CONTINUED) CONDITIONS TO SET BITTO 1 BIT NAME INSTRUCTION (OTHERWISE SET TO 0) ST4 ARITHMETIC A,AB,AM If MSBISA) = MSBIDA) and FAULT MSB of result F MSB(DA) AI If MSB(W) F MSB of lOP and MSB of result F MSB(W) S,SB,SM If MSB(SA) = MSB(DA) and MSB of result = MSB(DA) DEC,DECT If MSBISA) = 1 and MSB of result = 0 INC,INCT If MSBISA)=Oand MSB of result = 1 SLA, SLAM If MSB changes during shift DIV If MSB(SA) = 0 and MSB(DA) = I, or if MSB(SA) = MSB(DA) and MSB((DA) - (SAil = 0 DIVS If the quotient cannot be expressed as signed IS-bit quantity (>8000 is a valid negative number) ABS, NEG If (SA) = >8000 RTWP If bit 4 ofWR15 is 1 LST If bit 4 of selected WR is 1 Reset ST4 is cleared unconditionally All other ST4 is not affected" instructions and interrupts ST5 PARITY CB, MOVB If ISA) has odd number of ones (ODD NO. LDCR If C = 1 to 8 and (SA) has odd OF"I" number of ones (if C = 9 to 15 BITS) or C = 0, then ST5 is not affected) AB,SB, SOCB, SZCB, If result has odd number of ones STCR If C = 1 to 8 and the result has an odd number of ones (if C = 0 or C = 9 to 15, then ST5 not affected) RTWP If bit 5 of WR15 is 1 LST If bit 5 of selected WR is 1 Reset ST5 is cleared unconditionally All other ST5 is not affected instructions (See Note 1) and interrupts NOTES: 1. The X instruction itself does not set any status bits, but the target instruction may set status bits accordingly, 2. If on a DIVS instruction an overflow occurs, ST4 is set and STO, STl, and ST2 are undefined. 62 TABLE 15 - STATUS REGISTER BIT DEFINITIONS ICONTINUED) CONDITIONS TO SET BIT TO 1 BIT NAME INSTRUCTION IOTHERWISE SET TO 0) ST6 XOPIN XOP If XOP instruction is executed PROGRESS (ST6 set after the context switch) RTWP* If executed when ST7 = 1 (non-privileged mode), then ST6 is clea~ed LST* If executed when ST7 = 1 (non-privileged model, then ST6 is cleared. Reset ST6 is cleared unconditionally All other ST6 is not affected instructions (see Note 1) and interrupts ST7 PRIVILEGED RTWP* II bit 7 0lWR15 is 1 MODE LST* II bit 7 of selected WR is 1 XOP, any ST7 is cleared unconditionally interrupt All other ST7 is not affected instructions (see Note 1) ST8 MAP RTWP* If bit 8 of WR 15 is 1 SELECT LST* If bit 8 of selected WR is 1 XOP, any ST8 is cleared unconditionally interrupt prior to read 01 trap vector. Previous value is saved in WR 15. LDCR,STCR, ST8 temporarily driven to 0 while SBO,SBZ, CR U address is on the address bus TB All other ST8 is not affected instructions (see Note 1) ST9 UNDEFINED RTWP* If bit 9 ofWR15is 1 LST* If bit 9 of selected WR is 1 XOP, any ST9 is cleared unconditionally interrupt All other Do not affect status bit interrupts (see Note 1) ST10 ARITHMETIC RTWP* If bit 10olWR15is 1 FAULT LST* II bit 1001 selected WR is 1 INTERRUPT XOP, any STlO is cleared unconditionally ENABLE interrupt All other ST10 is not affected instructions (see Note 1) 'Status bits 7,8,9, 11, 12, 13 and 14are not affected by LST or RTWP if ST7 = 1 before these instructions are executed. Note 1. The X instruction itself does not set any status bits, but the target instruction may set status bits accordingly. 2. If on a DIVS instruction an overflow occurs, ST4 is set and STO, ST1, and ST2 are undefined. 63 TABLE 16 - STATUS REGISTER BIT DEFINITIONS (CONCLUDED) CONDITIONS TO SET BITTO 1 BIT NAME INSTRUCTION (OTHERWISE SET TO 0) STt1 XOP RTWP* If bit 11 of WR15is 1 EMULATION LST* If bit 11 of selected WR is 1 MODE XOP, any ST11 is cleared unconditionally interrupt All other STS is not affected instructions ST12 INTERRUPT LIMit Set mask = bits 12-150f lOP to MAS.K ST15 RTWP* Set mask = bits 12-150fWR15 LST* Set mask = bits 12-15 of WR RSETt Mask is unconditionally cleared RESET, NMI (set to all zeros) All other If mask = 0, no change; interrupts otherwise, set mask to interrupt level minus one. All other Mask is not affected instructions (see Note 1) * Status bits 7,8, 9, 11, 12, 13, and 14 are not affected by LST or RTWP if ST7 = 1 before these instructions are executed. t ST1 2 to ST1 5 are not affected by LIMI and RSET if ST7 = 1. NOTE 1: The X instruction itself does not set any status bits, but the target instruction may set status bits accordingly. 10.5 INSTRUCTIONS A list of the instructions described in each of the following subsections is presented below for convenient reference. Instruction Mnemonic IGIIgo A,AB,C,CB,S,SB,SOC,SOCB,SZC,SZCB,MOV,MOVB 10.5.1 COC, CZC, XOR, MPY, DiV 10.5.2 MPYS,DIVS 10.5.3 XOP 10.5.4 B, BL, BLWP, CLR, SETO, INV, NEG, ABS, SWPB, INC, INCT, DEC, DECT, X 10.5.5 BIND 10.5.6 LDCR,STCR 10.5.7 SBO, SBZ, TB 10.5.8 JEQ, JGT, JH, JHE, JL, JLE, JLT, JMP, JNC, JNE, JNO, JOC, JOP 10.5.9 SLA,SRA,SRC,SRL 10.5.10 AI, ANDI, CI, LI, ORI, BLSK 10.5.11 LWPI, LlMI 10.5.12 STST,LST,STVVP,LVVP 10.5.13 RTVVP 10.5.14 IDLE, RSET, CKOF, CKON, LREX 10.5.15 TMB, TCMB, TSMB 10.5.16 AM, SM, SLAM, SRAM 10.5.17 MIDopcodes 10.5.18 LDD, LOS AppendixB LR, STR, NR, CER, CIR, CRE, CRI, AR, DR, SR, MR AppendixB 64 10.5.1 Dual-Operand Instructions with Multiple Addressing for Source and Destination Operand General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE B Td o Ts 5 If B = 1, the operands are bytes and the effective operand addresses are byte addresses. If B = 0, the operands are words and the LSB of each effective operand address is ignored. The addressing mode for each operand is determined by the two bits of the T -field corresponding to that operand. TsorTd SorD ADDRESSING MODE NOTES 0 0,1, ... ,15 Workspace register 1 1 0,1, ... ,15 Workspace register indirect 2 0 Symbolic 4 2 1,2, ... ,15 Indexed 2,4 3 0,1, ... ,15 Workspace register indirect autoincrement 3 NOTES: 1. When a workspace register is the operand of a byte instruction (bit 3 = 11, the left byte (bits 0 through 71 is the operand and the right byte (bits 8 through 15) is not altered. 2. Workspace register 0 may not be used for indexing. 3. The workspace register is incremented by 1 for byte instructions (bit 3 = 1) and is incremented by 2 for word instructions (bit 3 = 01. 4. When Ts = T d = 2, two words are required in addition to the instruction word. The first word is the source operand and the second word is the destination operand base address. RESULT OPCODE COMPARED BITS STATUS MNEMONIC 0123 MEANING TOO AFFECTED DESCRIPTION A 1010 Add Yes 0-4 (SAI+(DAI-(DAI AB 1011 Add bytes Yes 0-5 (SAI+(DA) -(DA) C 1000 Compare No 0-2 Compare (SA) to (DAI and set ap- propriate status bits CB 1001 Compare bytes No 0-2,5 Compare (SA) to (DA) and set ap- propriate status bits S 0110 Subtract Yes 0-4 (DA) - (SA) - (DA) SB 0111 Subtract bytes Yes 0-5 (DA) - (SAl "'(DA) SOC 1110 Set ones corresponding Yes 0-2 (DA) OR (SA) -(DA) SOCB 1111 Set ones corresponding bytes Yes 0-2,5 (DA) OR (SA) -(DA) SZC 0100 Set zeros corresponding Yes 0-2 (DA) AND (SA) -(DAI SZCB 0101 Set zeros corresponding Yes 0-2,5 (DA) AND (SA) _(DA) MOV 1100 Move Yes 0-2 (SA) _(DA) MOVB 1101 Movebvtes Yes 0-2.5 (SAI-IDAI 10.5.2 Dual-Operand Instructions with Multiple Addressing Modes for the Source Operand and Workspace Register Addressing for the Destination General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE o Ts 5 The addressing mode for the source operand is determined by the Ts field. Ts S ADDRESSING MODE NOTES 0 0,1, ... ,15 Workspace register 1 0,1, ... ,15 Workspace register indirect 2 0 Symbolic 2 1,2, ... ,15 Indexed 1 3 1,2, ... ,15 Workspace register indirect autoincrement 2 NOTES: 1. Workspace register 0 may not ba used for indexing. 2. The workspace register is incremented by 2. 65 RESULT STATUS OPCODE COMPARED BITS MNEMONIC 012346 MEANING TOO AFFECTED DESCRIPTION COC 001000 Compare ones corresponding No 2 Test (0 I to determine if 1s are in each bit position where Is are in (SAl. If so, set ST2. CZC 001001 Compare zeros corresponding No 2 Test (01 to determine if Os are in each bit position where Is are in (SAL Ifso, set ST2. XOR 001010 Exclusive OR Yes 0-2 (D) + (SAI- (01 MPY 001110 Multiply No -- Multiply unsigned (01 by unsigned (SAl and place unsigned 32-bit product in 0 (most significant) and 0+1 (least Significant). If WR15 is 0, the next word in memory after WR 15 is used for the least signifi- cant half of the product. DIV 001111 Divide No 4 If unsigned (SAl is less than or equal to unsigned (D), perform no opera- tion and set ST4. Otherwise, divide unsigned 101 and (0 + 11 by un- signed (SAL Quotient - (01, re- mainder -( 0 + 1) If 0 = 15, the next word in memory after WR15 will be used for the remainder. 10.5.3 Signed Multiply and Divide Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE Ts s The addressing mode for the source operand is determined by the Ts field. Ts S ADDRESSING MODE NOTES 00 0,1, ... ,15 Workspace register 1 01 0,1, ... ,15 Workspace register indirect 1 10 0 Symbolic 1 10 1.2, ... ,15 Indexed 1,2 11 1 2 ... 15 Works~ace reaister indirect autoincrement 13 NOTES: 1. Workspace registers 0 and 1 contain operands used in the signed multiply and divide operations. 2. Workspace register 0 may not be used for indexing. 3. The workspace register is incremented by 2. 66 RESULT STATUS OPCODE COMPARED BITS MNEMONIC 01234&8788 MEANING TOO AFFECTED DESCRIPTION MPYS 0000000111 Signed Multiply Yes 0-2 Multiply signed 2's complement in- teger in WRO by signed 2's comple- ment integer in (SA) and place signed 32-bit product in WRO (most significant) and WR 1 (least signifi- cant). DIVS 0000000110 Signed Divide Yes 0-2,4 If the quotient cannot be expressed as a signed 16-bit quantity (hex 8000 isa valid negative number), set ST4. Otherwise, divide the signed, 2's complement integer in WRO and WRl by the signed 2'8 complement integer at SA and placa the signed quotient in WRO and the signed re- mainder in WR 1. The sign of the quotient is determined by algebraic rules. The sign of the remainder is the seme as the sign of the dividend, and IREMAINDERI < IDIVI. 10.5.4 Extended Operation (XOPllnstruction General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: I0 o o o Ts S The Ts and S fields provide multiple-mode addressing capability for the source operand. Depending on the value of status bit 11 (ST11), the XOP instruction transfers control to a user routine located either at the main memory address in the specified XOP trap vector, or at Macrostore. If ST11 = 0, the 0 field specifies the trap vector in memory that contains the addresses ofthe entry point and workspace of the user routine to be executed. The address of the trap vector is calculated as >0040 + >4 x >0 Following the fetch of the newWP and PC values, the effective source address (SA) is calculated and placed in WR11 of the new workspace. The old WP, PC and ST are stored in WRs 13, 14 and 15, respectively. Status bit 6 is setto " and STs 7 through 11 are cleared after the old status has been saved. When ST11 = 1, the XOP causes a trap to Macrostore ifthe 99000 is not in the baseline mode. The contents of the WP are forced to 0, and the PC is updated with the value contained at Macrostore address >0812. The new WP and PC point to locations within the Macrostore, where address space is logically distinct from the main memory address space. The old WP, PC and STare stored in registers 13, 14and 15, respectively, ofthe Macrostore workspace. Status bits 7 through 11 are cleared after the old status has been saved. The execution of the XOP instruction is summarized below. If ST11 is 0, the addresses are memory addresses; if ST11 is 1 and the 99000 is not in baseline mode, the addresses are in Macrostore. If ST11 Is 0: If ST11 Is 1 Macroetore Is antared and: (0040+4 xD) - WP O-WP (0042 + 4 x D) - PC (0812) - PC SA- newWRll (old WP) - (new WR13) (old WP) - (new WR13) (old PC) - (new WR 14) (old PC) - (new WR14) (old ST) - (new WR15) (old ST) - (new WR15) 1 -ST6 0-ST9 0-ST7 0-ST10 0-ST8 O-ST11 The TMS99000does not test interrupt requests (i.e., does not look at INTREQ) upon completion of the XOP instruction. 61 10.5.5 Single Operand Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE Ts S The Ts and S fields provide multiple-mode addressing capability for the source operand. RESULT BITS MNEMONIC 0123466789 MEANING TOO? AFFECTED DESCRIPTION B 0000010001 Branch No -- SA -(PC) BL 0000011010 Branch and link No -- (PC) -(WR11), SA -(PC) BLWP 0000010000 Branch and load workspace pointer No -- (SA) -(WP), (SA+2) -(PC), (oldWP) _(newWR13), (old PC) -(newWR14), (old ST) - (new WR151. The INTREQ input is not tested upon completion of the BLWP instruction. CLR 0000010011 Clear operand No -- O_(SA) SETO 0000011100 Set to ones No -- FFFF -(SA) INV 0000010101 'nven Yes 0-2 (SA) -(SA) NEG 0000010100 Negate Yes 0-4 -(SA) -(SA) ABS 0000011101 Absolute value" No 0-4 I(SA)I-(SA) SWPB 0000011011 Swap bytes No -- Bits 0-7 of (SA) -bits 8-15 of (SA); bits 8- 150f(SA) -bits 0-7 of (SA). INC 0000010110 Increment Yes 0-4 (SA) + 1 - (SA) INCT 0000010111 'ncrement by two Yes 0-4 (SA) +'2 -(SA) DEC 0000011000 Decrament Yes 0-4 (SA)-l -(SA) DECT 0000011001 Decrement by two Yes 0-4 (SA) - 2 -(SA) Xt 0000010010 Execute No -- Execute instruction located at SA. 'Operand is compared to zero for status bit. tit additional memory words for the execute instruction are required to define the oparands of the instruction loceted at SA, these words will be accessed from PC and the PC will be updated accordingly. The IAQ ,instruction acquisition) bus status code will not be ouput at the time the process reads the instruction at SA; instesd, an SOP 'source operand) or WS bus status code will be output. Status bits are affected in the usual manner for the operation performed. 10.5.6 BIND Instruction General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE Ts S The Ts and S fields provide multiple-mode addressing capability for the source operand. The BIND instruction serves as the inverse of a BLSK instruction if the register indirect autoincrement addressing mode is used. Indexed addressing used with BIND implements a powerful CASE or multi-way branch instruction where the immediate operand points to a table of branch addresses and the register contents selects which way to branch. RESULT BITS MNEMONIC 0123466789 MEANING TOO? AFFECTED DESCRIPTION BIND 0000000101 Branch indirect No -- (SAI-(PC) 10.5.7 Multiple-Bit I/O Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE CNT Ts S The I/O base address is contained in bits 0 through 14 of WR12. If bit 0 (the MBS) of the base address is 0, a serial I/O transfer will occur; otherwise (MSB = 1), a parallel I/O transfer will occur. In thecaseofa serial I/O transfer, theCNTfield specifies the number of bits to be transferred (from 1 to 16). If CNT=O, 16 bits are transferred. The base address in WR12 defines the starting I/O bit address. The bits are transferred in bit-serial fashion, and the I/O base address is incremented by 2 with each bit transfer; the contents of WR12 are not affected. The effective source address in memory, specified by the Ts and S fields, is interpreted as a byte address if 8 or fewer bits are', 68 transferred (CNT = 1 through 8), or as a word address if 9 or more bits are transferred (CNT =0, 9 through 15). If the source is addressed in the workspace indirect autoincrement mode (Ts = 3), the specified workspace register is incremented by 1 if CNT is in the range 1 to 8, and is incremented by 2 otherwise. If the source is addressed in the register mode (Ts = 0), bits 8 through 15 of the specified workspace register are unchanged if the transfer is of 8 bits or less. In the case ofa parallel I /0 transfer, the CNT field determines whether a byte or word is to be transferred, and also whether the contents of WR12 are to be incremented by 2 following the transfer. A word transfer occurs if CNT is (binary) 1010 or 1011; a byte transfer occurs if CNT is 0010 or0011. WR12 is post-incremented by 2 if CNT is 0011 or 1010. All values of CNT besides 0010,0011, 1010and 1011 are reserved for future expansion of the parallel I/O capability and should not be used. The following table summarizes the use of the CNT field for a parallel I/O operation. CNT- TRANSFER DESCRIPTION IBINARYI byte 0010 WR 1 2 not altered transfer 0011 WR12 post-incremented by 1 word 1010 WR12 not altered transfer 1011 WR 1 2 post-incremented by 2 "TheH restrictions on the value of CNT apply only in the case of parallel 1/0 operations. When in user mode (ST7 = 1), an attempt to execute an LDCR instruction having a I/O address in the range 1COO to 7FFE or 9Coo to FFFE is flagged as a privileged opcode violation. This condition generates a level 2 interrupt and inhibits writes to the I/O in the privileged space for the duration ofthe instruction. When in privileged mode (ST7 = 0), the I/O address of an LDCR instruction is unrestricted. When in user mode (ST7 = 1), an attempt to execute an STCR with an I/O address 1COO to 7FFE or 9Coo to FFFE causes a privileged violation to occur after execution of the instruction. RESULT STATUS OPCODE COMPARED BITS MNEMONIC 012346 MEANING TOO AFFECTED DESCRIPTION LDCR 001100 Loild communication register Yes 0-2,5" Beginning with LSB of (SA), transfer the specified number of bits from (SA) to the I/O. STCR 001101 Store communication register Yes 0-2,5" Beginning with LSB of (SA), transfer the specified number of bits from the I/O to (SA). Load unfilled bit posi- tions with O. "STS is affected only if CNT is in the range 1 to 8. 10.&.8 Single-Bit I/O Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE SIGNED DISPLACEMENT The signed displacement is added to the contents of WR 12 (bits 0-14) to form the address ofthe 1/ a bit to be selected, as described in Section 8.2.8. When in user mode (ST7 = 11. ifthe effective 1/ a address ofan SBO or SBZ instruction is in the range >1COO to > 7FFE or > 9coo to > FFFE, a privileged violation occurs (Section 4.4.3) and the I/O write is inhibited. When in privileged mode (ST7 = 0), no restrictions are placed on the range of the effective I/O address. The user is cautioned that while the SBO and SBZ instructions can be used to access the parallel I/O address space (> 8000 to > FFFF), and they will set or clear data bit 015 as expected, the other 15 bits (DO to 014) written to the parallel I/O location will be undefined. When the TB instruction is executed with an address in parallel I/O space, the bit value input on data line DO is read. When in Macrostore, the SBO, SBZ and TB instructions are not available. The SBO and SBZ opcodes perform different functions when in Macrostore (see Section 7.3.3.6). 69 STATUS OPCODE BITS MNEMONIC 01234567 MEANING AFFECTED DESCRIPTION sao 0001 1101 Set bit to one - - Set the selected output bit to 1. SBZ 00011110 Set bit to zero - - Set the selected output bit to O. TB 00011111 Test bit 2 If the selected I/O input bit is 1, set ST2; if the selected 1/0 input bit is 0, clear ST2. 10.5.9 Jump Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE SIGNED DISPLACEMENT Jump instructions cause the PC to be loaded with the PC-relative jump address if the selected status bits are set as specified; otherwise, no jump occurs and the next instruction is fetched from the word following the jump instruction. The jump address is computed by adding twice the signed displacement to the current value of the PC (which points to the word following the jump instruction). The 8-bit displacement permits the computed jump address to be specified any- where in the range - 128 to + 127 words from the address of the word that follows the jump instruction. Status register bits are not affected by jump instructions. OPCODE STATUS CONDITION MNEMONIC 01234567 MEANING TO LOAD PC JEQ 00010011 Jump equal ST2 = 1 JGT 00010101 Jump greater than sn =1 JH 00011011 Jump high STO = 1 and ST2 = 0 JHE 00010100 Jump high or equal STO = 1 or ST2 = 1 JL 00011010 Jump low STO = 0 and ST2 = 0 JLE 00010010 Jump low or equal STO = 0 or ST2 = 1 JLT 00010001 Jump less than sn = 0 and ST2 = 0 JMP 00010000 Jump unconditional Unconditional JNC 00010111 Jump no carry ST3 = 0 JNE 00010110 Jump not equal ST2 = 0 JNO 00011001 Jump no overflow ST4 = 0 JOC 00011000 Jump on carry ST3 = 1 JOP 00011100 Jump odd parity ST5 = 1 10.5.10 Shift Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE SC W Field SC contains the shift count. W is the number of the workspace register whose contents are to be shifted. If SC = 0, however, bits 12 through 15 of WRO are used as the shift count. If SC = 0 and bits 12 through 15 of WRO are 0, the effective shift count is 16. /RESULT STATUS OPCODE COMPARED BITS MNEMONIC 01234567 MEANING TOO AFFECTED DESCRIPTION SLA 00001010 Shift left arithmetic Yes 0-4 Shift (W) left. Fill vacated bit pOSitions with O. SRA 00001000 Shift right arithmetic Yes 0-3 Shift (WI right. Fill vacated bit positions with original MSB of (WI. SRC 00001011 Shift right circular Shift (WI right. Shift previous LSB into MSB. SRL 00001001 Shift right logical Yes 0-3 Shift (WI right. !"iII vacated bit positions with zeros. 70 10.5.11 Immediate Register Instructions o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 General OPCODE W Format: lOP OPCODE RESULT BITS MNEMONIC 01234567891011 MEANING TOO? AFFECTED DESCRIPTION AI 000000100010 Add immediate Yes 0-4 (WI + lOP - (WI ANDI 0000 00100 100 AND immediate Yes 0-2 (WI AND lOP - (WI CI 0000 00101 000 Compare immediate Yes 0-2 Compare (WI to lOP and set ap propriate status bits. LI 0000 00100 000 Load immediate Yes 0-2 IOP-(WI ORI 0000 00100 110 OR immediate Yes 0-2 (W)ORIOP - BlSK 0000 00001 011 Branch immediate and push link to stack No -- (W)-2 _(WI. (PC)+4 -((W 10P-(PC) 10.5.12 Internal Register Load Immediate Instructions o 2 3 456 7 8 9 10 11 12 13 14 15 General OPCODE o o o o o Format: lOP When in user mode (ST7 = 1). execution of the LIM I instruction is flagged as a privileged opcode violation (Section 4.4.3). OPCODE MNEMONIC 012345678910 MEANING DESCRIPTION lWPI 0000 0010 111 Load workspace pointer immediate lOP - (W) not status bits affected. LIMI 0000 00 11 000 load interrupt mask immediate lOP - ST bits 12 thru 15. ST12 thru ST15. 10.5.13 Internal Register Load and Store Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE w STATUS OPCODE BITS MNEMONIC 01234567891011 MEANING AFFECTED DESCRIPTION STST 0000 0010 1 lOa Store status Register - - (ST)-(W) lST 0000 0000 1000 Load status Register 0-15 {WI - (ST) STWP 0000 0010 lOla Store workspace pointer - - (WP)-(WI lWP 0000 0000 1001 load workspace pointer - - (W)-(WPI While in privileged mode (ST7 = 0). the LST instruction modifies all 16 bits of the status register. While in user mode (ST7 = 1). only bits othrough 5 and bit 10 ofthe workspace register specified in the W field are placed in the status register; ST6 is cleared and the other status register bits are unaffected. 71 10.5.14 Return Workspace Pointer (RTWPllnstruction General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: I0 o o o o o o o o o o o o The RTWP instruction causes the following transfers to occur: (WR15) - (ST) (WR14) - (PC) (WR13) - (WPI When in privileged mode (ST7 = 0), the RTWP instruction causes the entire contents of WR15to be loaded into the status register. In user mode (ST7 = 1), only bits 0 through 5and 10 of WR15are loaded into the status register; ST6 is cleared and the other status register bits remain unaffected. When in Macrostore, several variations of the RTWP instruction opcode are available. These are opcodes >0381, > 0382, and >0384. These opcodes are summarized below. More detail in the operation of these special opcodes is given in Section 7.3.2 RTWPOpcode Function >0380 RTWP when in main memory or exit from Macrostore with interrupts sampled >0381 RTWP when in Macrostore memory (does not cause exit from Macrostorel >0382 Exit from Macrostore with level 2 trap >0384 Exit from Macrostore and suppress interrupt sample. 10.5.15 External Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE o o o o o External instructions cause a bit value of 0 to be written to a 110 address 1ECX, where the hexadecimal digit represented as "X" depends upon the particular external instruction being executed. During execution of the RSET, CKOF, CKON and LREX instructions, the WE/IOCLK output is pulsed low once. With the completion of the single 110 write cycle, execution ofthe external instruction is finished, and the processor proceeds to the next instruction. While in privileged mode (ST7 = 0), execution of RSET causes the interrupt mask (ST12-ST15) to be cleared. None of the other external instructions affect the status register. When the IDLE instruction is executed, the processor enters the idle state, where it remains until a Reset, NMI, APP, or unmasked external interrupt occurs. While in the idle state, the processor pulses the WE/IOCLK output repeatedly, with each 110 write cycle accompanied by a 1/0 bus status code (Table 2). The PC value saved during the context switch to the Reset, NMI or interrupt service routine points to the instruction following the IDLE. When in user mode (ST7 = 1), execution of an external instruction is flagged as a privileged opcode violation (Section 4.4.3). STATUS 1/0 OPCODE BITS ADDRESS MNEMONIC 012345878910 MEANING AFFECTED DESCRIPTION IN HEX IDLE 00000011 010 Idle - - Suspend processor instruction execution until an interrupt, NMI or Reset occurs. 1EC4 RSET 00000011 011 Reset 12-15 Clear interrupt mask (ST12- ST151 1ECS CKOF 00000011 110 User-defined - - - - 1ECC CKON 00000011 101 User-defined - - - - 1ECA LREX 0000 0011 111 User-defined - - - - 1ECE 72 10.5.16 Bit-Manipulation Instructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCODE o o o o o BITDISP Ts S The Ts and S fields provide multiple-mode addressing capability for the source operand. The indirect autoincrement addressing mode (Ts = 3), however, is undefined for the TMB, TCMB and TSMB instructions. If the two bits of the Ts field are 3, an MID trap occurs. Bit-manipulation instructions copy the specified memory bit into status bit 2, and set or clear the specified memory bit. In order to provide an indivisible test-and-set operation, the MPILCK (multiprocessor interlock) bus status code is active during the critical portions of the TSMB and TCMB instructions, except in the case Ts = 0 (register addressing mode). STATUS OPCODE BITS MNEMONIC IN HEX MEANING AFFECTED DESCRIPTION- TMB OC09 Test memory bit 2 (SA + Bo) - ST2 TCMB OCOA Test and clear memory bit 2 (SA+Bo) - ST2, 0 - (SA+Bo) TSMB OCOB Test and set memory bit 2 (SA+Bo) - ST2, 1 - (SA+Bo) "BD is used above to refer to the contents of the bit-displacement field. If the leading 6 bits in the predefined field of the second word of the instruction are not as specified, an MID trap occurs. 10.5.17 Double-Precision Arithmetic Instructions General Format: 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ADD/SUB OPCOoE 0 0 0 Td D Ts S SHIFT OPCOoE 0 0 0 0 0 SC Ts S STATUS OPCODE BITS MNEMONIC IHEX MEANING AFFECTED DESCRIPTION AM 002A Add double 0-4 (SA,SA+2)+(oA,oA+21- (OA, OA+2) SM 0029 Subtract double 0-4 (oA,OA+2) - (SA,SA+2) - (OA,OA+2) SLAM 0010 Shift left arithmetic double 0-4 Shift (SA, SA + 2) left. Fill vacated bit posi- tions with O. If SC=O, count is in bits 4 through 7 of WRO. SRAM 001C Shift right arithmetic double 0-3 Shift (SA,SA + 2) right. Fill vacated bit posi- tions with MSB. If SC =0, count is in bits 4 through 7 of WRO. If the two bits in the Ts or T d field are 3 (workspace register indirect autoincrement addressing mode) the contents of the corresponding workspace register are incremented by 4. If SC = 0 in the shift instructions, the shift count is taken from bits 4 through 7 of WRO, which are interpreted as an unsigned 4-bit integer. If bits 4 through 7 of WRO are 0, then the effective shift count is O. Bits shifted out are shifted into ST3. If the shift count is 0, ST3 is set to O. During a SRAM the sign bit fills the vacated positions. During a SLAM, zeros fill the vacated·positions. If the bits in the predefined field of the second word of the instruction are not as specified, an MID trap occurs. 73 10.5.18 MID Opcodes The single-word instruction opcodes that cause an MID trap (see Section 4.4.2) are: 0000-001B 02D0-02DF 001E-0028 02E1-02FF 002B-007F 0301-033F OOAO-OOAF 0341-036F OOCO-013F 0361-037F 0210-021F 038Hl39F 0230-023F 03A1-03BF 0250-025F 03C1-03DF 0270-027F 03E1-03FF 07lll-07FF 0290-029F OCOO-OCOB 02BO-02BF OCOC-OFFF 10.6 INSTRUCTION EXECUTION 10.6.1 Microinstruction Cycle The TMS99000 microprocessor is a microcoded machine. Each instruction in the 99000 instruction set is executed intemally as a sequence of microinstructions, the length of the sequence varying according to the particular instruction. Each microinstruction cycle is minimally one machine state in duration but can be extended with wait states by activating the READY input. The term "wait-state" is used to describe the condition where the processor is "frozen" in its present state and consequently cannot advance to the next state. In the 99000, all types of bus cycle - memory, I/O or internal- can be extended with wait-states. The ALATCH output toggles exactly once at the beginning of each microinstruction cycle. 10.6.2 Opcode Prefetching The TMS99000 increases its effective processing speed by prefetching opcodes where possible. By allowing successive bus cycles to be overlapped, as shown in Figure 27, the time required to fetch the opcode from memory and. decode it becomes transparent when no wait states are required. In processing a typical instruction, e.g., register-to-register add, the TMS99000 performs the following sequence of steps: 1. Fetch instruction 2. Decode instruction 3. Fetch source operand, if needed 4. Fetch destination operand, if needed 5. Process the operands 6. Store the results, if required The prefetch mechanism of the 99000 makes use of the fact that the processor's memory interface can operate in parallel with operations involving the processor's internal buses and registers. For example, during step 5 above, the memory bus ian.otneededb¥~rent instruetioFl, whiett is busy processh ,g tl,e operands internaW.Mence,thi!ftime can be used to prefetch the opcode for the next instruction. This overlapping is seen in Figure 32, where "MI" indicates an operation performed by the memory interface, and "OP" denotes an internal operation. Deterministic: a prefetched opcode is discarded only in the event that an interrupt occurs. Steps 1 and 2 above should really be considered part of the preceding instruction. In other words, each instruction is responsible for prefetching the opcode for the next instruction. This reduces the effective overhead of the typical instruction sequence given above to the four steps, 3-6. Without overlap, the overhead would be six rather than four steps. The instruction prefetch scheme employed by the 99000 can cause self-modifying software to execute incorrectly. Incorrect execution results when one instruction attempts to generate the opcode of the very next instruction to be executed. The TMS99000 fetches the opcode of the next instruction before storing the result of the current instruction. 74 ••• bus cycle 1 bus cycle 2 bus cycle 3 bus cycle 4 bus cycle 5 bus cycle 6 ... process write ••• operands result instruction n-1 OP MI fetch decode fetch fetch process write instruction n instruc instruc source dest'n operands result operand operand MI OP MI MI OP MI instruction n + 1 ••• increasing MI = memory interface time OP = internal operation FIGURE 32 - OVERLAPPED INSTRUCTION EXECUTION 10.6.3 TMS99000 Instruction Execution Times Instruction execution times for the TMS99000 are a function of the: • Machine state time ts (four times the external input clock period), • Particular addressing mode used in the event that the instruction provides mUltiple-mode addressing capability, and • Number of wait states required per memory access. Table 16 * lists the number of machine states and memory accesses required to execute each 99000 instruction. For instructions providing multiple addressing modes for one or both operands, the table lists the number of states and memory accesses with all operands addressed in the workspace register mode. To determine the additional number of states and memory accesses required for the other addressing modes, add the appropriate values from the table. The total execution time for an instruction, assuming all memory requires the same number of wait states, is calculated as: T = ts(C + WM) where: T = total instruction execution time ts = machine state time (four times the external input clock period) C = number of states for instruction execution plus address modification W = number of required wait states per memory access for instruction execution plus address modification M = number of memory accesses For example, consider a MOV instruction executed in a system for which ts = 0.107 p.sec. Assume that no wait ·states are required to access memory, and that both operands are accessed in workspace register mode: T = ts(C+ WM) = 0.107(3 + Ox3) p.sec = 0.50 p.sec If two wait states per memory access are required, the execution time becomes T = 0.107 (3 + 2 x 3) p.sec = 1.50 p.sec If the source operand was addressed in the symbolic mode and two wait states are required, then T = tc(C + WM), C = 3 + 1 = 4, M = 3 + 1 = 4, T = 0.167 (4 + 2 x 4) p.sec = 2.0 p.sec * Instruction prefetching is accounted for in Table 16. The table gives exact cycle counts required for instruction execution. 75 TABLE 16-INSTRUCTION EXECUTION TIMES MACHINE MEMORY ADDRESS INSTRUCTIONS STATES ACCESS MODIFICATION C M SOURCE DEST A 4 4 A* A AB 4 4 A A ABS 5 3 A - AI 4 4 - - AM 12 8 A A ANDI 4 4 - - B 3 1 A - BIND 4 2 A - BL 5 2 A - BLSK 7 5 - - BLWP 10 6 A - C 4 3 A A CB 4 3 A A CI 4 3 - - CKON 9 1 - - CKOF 9 1 - - CLR 3 2 A - COC 4 3 A - CZC 4 3 A - DEC 3 3 A - DECT 3 3 A - DIV (ST4 is set) 60rl0 4 A - DIV {ST4 is reset)t 30 6 A - DIVS (ST4 is set) 10,130r33 4 A - DIVS {ST4 is reset)t 34 6 A - IDLE 9+2xN 1 - - INC 3 3 A - INCT 3 3 A - INV 3 3 A - JUMP {PC is changedl 3 1 - - (PC is not changed) 3 1 - - LDCR (CNT=O, serial) 40 3 A - (CNT;e.O, serial) 8+2x CNT 3 A - (MSB R12= " autoincrement R12) 8 4 A - (MSB R12= 1, R12 notautoincremented) 8 3 A - LDDaridLDSt LI 3 3 - - LIMI 5 2 - - LMH LREX 9 1 - - LST 7 2 - - • Replace the letter "A: with appropriate value from Table A. The C and M values from Table A for the addressing mode used must be added to the C and M values from this table, t Execution time is dependent upon the partial quotient after each clock cvcle during execution. *Execution time is added to the execution time of the source address. 16 TABLE 16 - INSTRUCTION EXECUTION TIMES ICONCLUDEDI MACHINE MEMORY ADDRESS INSTRUCTIONS STATES ACCESS MODIFICATION C M SOURCE DEST LWP 3 2 - - LWPI 3 2 - - MOV 3 3 A* A MOVB 4 4 A A MPY 23 5 A - MPYS 25 5 A - NEG 3 3 A - ORI 4 4 - - RSET 9 1 - - RTWP, 9/7 4 - - 5 4 4 A A SB 4 4 A A SBO 7 2 - - SBZ 7 2 - - SETa 3 2 - - SHIFT (SC*O) 5+SC 3 - - (SC=Oand bits 12-150fWR =0) 23 4 - - (SC =0 and bits 12-15 of WR*O) 7+SC 4 - - SM 12 7 A A SOC 4 4 A A SOCB 4 4 A A SHIFT MULTIPLE (SC=O) 11+SC 5 A - (SC*O) 13+SC 6 A - STCR (CNT = 0, serial) 43 3 A - (CNT=l to 7) 2O+CNT 4 A - (CNT=8) 27 4 A - (CNT=9to 15) 2O+CNT 3 A - (MSB R12= 1, autoincrement R12) 10 5 A - (MSB R12= 1, R12 not autoincremented) 10 4 A - STST 3 2 - - STWP 3 2 - - SWPB 3 3 A - SZC 4 4 A A SZCB 4 4 A A TB 7 2 - - TESTMEMBIT 26 3 A - X§ 2 1 A - XOP (STll =0) 14 7 A - XOR 4 4 A - Reset function 13 6 - - Interrupt context switch 13 6 - - MID opcode (Macrostore) 14§ 0 - - (attached Drocessor) 21§ 8 - - • Replace the letter" A" with appropriate value from Table A. The C and M values from Table A for the addressing mode used must be added to the C and M values from this table. §Execution time does not include the time required bV software or an attached processor to amulate the instruction. ,RTWP, when staying in Macrostore, takas saven machine stalas. When not in Macrostore or exiting Macrostore, RTWP takas nine machine states. TABLE A MACHINE MEMORY STATES ACCESS ADDRESSING MODE C M WR(TsorTd = 0) 0 0 WRindirecHTsorTd = 1) 1 1 WR indirect autoincrement (Ts or Td = 3) 3 2 Symbolic (Ts or Td = 2, 5 or D = 0) 1 1 Indexed (TsorTd = 2, 5 or D = 0) 3 2 77 10.6.4 Bus Status Code Sequences This section presents the sequence of bus status codes output by the microprocessor during each (1) instruction execu- tion, (2) interrupt trap, (3) MID trap and (4) transfer of control between the TMS99000 and an attached processor. The TMS99000 microprocessors are microcoded machines. Each instruction in the instruction set is executed internally as a sequence of microinstructions, the length of the sequence varying according to the particular instruction. Each microin- struction cycle is minimally one machine state in duration. but can be extended with wait states by activating the READY input. The sequence of machine states generated during the execution of a particular instruction depends upon the opcode and the addressing modes used. A typical instruction contains an opcode and addressing modes for up to two operands (source and destination). The execution. of an instruction can similarly be divided into two parts: (1) the derivation of the operands from the specified addressing modes, and (2) the execution of the operation specified by the opcode. Since the same addressing modes are common to many instructions, the portion of the execution sequence corresponding to each addressing mode can be listed separately from the basic execution sequences for the various instructions. The listing of these sequences in separate tables is done in this section for the sake of brevity. Using this information, the user can reconstruct the entire sequence for a particular instruction by inserting the sequences corresponding to the addressing modes into the basic sequence given for the instruction. The basic execution sequences for the various TMS99000 instructions are presented in Table 14. In this table, the sequences corresponding to the source and destination addressing modes are represented by the symbols < SRC > and < DST >, respectively. These symbols must be replaced by the appropriate sequences from Tables 15 and 16 to reconstruct the entire execution sequence for the instruction with its particular addressing modes. An example will help to illustrate this procedure. Consider the following add instruction: A *Rl + ,R2 The addressing mode used to locate the source operand is register indirect autoincrement with R1. The addreSSing mode used to locate the destination operand is register direct with R2. Table 14 presents a complete list of the machine states generated during the execution of this instruction. Each state is identified by the bus status code output during that state. Refer to Table 2 of Section 3 for a list of all bus status codes and their mnemonics. The fetching of the A (add) opcode is not shown in Table 14; instead, the next to the last state shown is the prefetch ofthe opcode for the instruction that follows the add. This convention will be followed throughout Table 17. The prefetch of the opcode for the next instruction is considered to be part of the execution sequence of the current instruction. Using the data presented in Tables 18, 19 and 20, the information presented in the example of Table 17 is constructed as follows. The basic execution sequence for the A (add) instruction is presented at the beginning of Table 18. Here the execution sequences for the source and destination addressing modes are represented by the symbols < SRC > and . These symbols are replaced by the appropriate addressing mode sequences from Table 18 to generate the sequence seen in Table 17. The symbols Ns and Nd in Table 17 represent the number of machine cycles required to derive the source and destination operands, respectively, and are replaced by the appropriate numbers from Table 18. The execution sequences for all other TMS99000 instructions and operations shown in Table 17 are generated in similar fashion. TABLE 17-EXAMPLE INSTRUCTION SEQUENCE FORAN A "Rl + ,R2 NUMBER BUS READ OF STATUS OR CYCLES CODe NAME WRITE COMMENT 0110 WS R Fetch source operand from WR 1 Ns=4 1001 AUMS - Internal operation 0110 WS W Increment WR 1 0001 SOP R Read source operand Nd=l 0110 WS R Read dest'n operand from WR2 1 0011 IAQ R Prefetch next instruction 1 0110 WS W Write sum to WR2 78 TABLE la-SOURCE ADDRESSING MODE SEQUENCES NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT Workspace Register Source Addressing, R 1 0110 WS R Get source operand from WR Ns = 1 Workspaca Register Indirect Source Addressing, oR 1 0110 WS R Get source address from WR 1 0001 SOP R Fetch source operand Ns = 2 Workspece RegiS1er Indirect Autoincremant Source Address, OR + 1 0110 WS R Get source address from WR 1 1001 AUMS 1 0110 WS W Increment WR contents Ns = 4 1 0001 SOP R Fetch source operand Symbolic (Direct) Source Address, @LABEL 1 0010 lOP R Get source operand address 1 0001 SOP R Fetch source operand Ns = 2 Indexed Source Address, @TABLE(R) 1 0110 WS R Fetch base address from WR 1 0010 lOP R Fetch index 1 1001 AUMS Ns = 4 1 0001 SOP R Fetch source operand Workspace Register Destination Address, R 1 0110 WS R Get dest'n operand from WR Nd = 1 Workspace Register Indirect Destination Address, OR 1 0110 WS R Get dest'n address from WR 1 0100 DOP Fetch dest'n operand Nd = 2 Workspace Register Indirect Autoincrement Destination Address, OR + 1 0110 WS R Get desfn address from WR 1 1001 AUMS 1 0110 WS W Increment contents of WR Nd = 4 1 0100 DOP R Fetch dest'n operand SymbOlic (Direct) Destination Address, @LABEL 1 0010 lOP R Fetch desfn address 1 0100 DOP R Fetch dest'n operand Nd = 2 Indexed Destination Address,@TABLE(R) 1 0110 WS R Fetch base address from WR 1 0010 lOP R Fetch index 1 1001 AUMS Nd = 4 1 0100 DOP R Fetch dest'n operand 79 TABLE 19 - INSTRUCTION EXECUTION SEOUENCES NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT A, AB, MOVB, 5, SB, SOC, SOCB, SZC, SZCB (See MOV sequence below) Ns Fetch source operand Nd Fetch dest'n operand 1 0011 lAO R Prefetch next instruction 1 0100' DOP' R Save result at dest'n address MOV (move word) Ns Fetch source operand Nd-l Get dest'n address, but block fetchf 1 0011 lAO R Prefetch next instructiont 1 0100' DOP' R Write operand to desfn address SlA, SRA, SRC, SRl (if shift count is NOT zero) 1 0110 WS R Fetch source operand from WR 2 1001 AUMS Series of 2 consecutive AUMS cycles CNH 1001 AUMS Repeat shift operation 1 0011 lAO R Fetch next instruction 1 0110 WS W Save result in source WR SlA, SRA, SRC, SRl (if shift count is zero) 1 0110 WS R Fetch source operand from WR 1 1001 AUMS 1 0110 WS R Fetch shift count from WRO 2 1001 AUMS Series of 2 consecutive AUMS cycles CNTt 1001 AUMS Repeat shift operation 1 0011 lAO R Prefetch next instruction 1 0110 WS W Save result in source WR ABS (source operand in workspace register) 1 0110 WS R Fetch source operand from WR 1 1001 AUMS 1 0110 WS R Save result in source address 1 0011 lAO R Prefetch next instruction 1 1001 AUMS ABS (non-workspace source operand) Ns-l Develop address of source operand 1 0000 SOPL R Fetch source operand (MPllCK active) 1 1000 AUMSl 1 0001 SOP R Save result in source address 1 0011 lAO R Prefetch next instruction 1 1001 AUMS AI, ANDI, ORI 1 0110 WS R Fetch source operand from WR 1 0010 lOP R Fetch immediate operand 1 0011 lAO R Prefetch next instruction 1 0110 WS W Save result in source WR 'Substitute WS bus status code if operand is in workspace register. tThe last state of the destination operand derivation sequence is replaced by an instruction fetch. *Number of cycles is equal to shift count. 80 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES (CONTINUED I NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT C,CB Ns Fetch source operand Nd Fetch dest'n operand 1 0011 lAO R Prefetch next instruction 1 1001 AUMS CI 1 0110 WS R Fetch source operand from WR 1 0010 lOP R Fetch immediate operand 1 0011 lAO R Fetch next instruction 1 1001 AUMS AM, SM (double-word add and subtractl 1 0010 lOP R Fetch second word of instruction 1 1001 AUMS Ns Fetch MSW of source operand Nd-l Develop destination addresst 1 1001 AUMS Operand fetch is blocked 1 1001 AUMS 1 0001· SOP' R Fetch LSW of source operand 1 0100' DOP' R Fetch MSW of dest'n operand 1 1001 AUMS 1 0100' DOp· W Write LSW of result to dest'n address 1 0100' DOP' R Fetch MSW of dest'n operand 1 0011 lAO R Prefetch next instruction 1 0100' DOP' W Write MSW of result to dest'n address B Ns-l Get source addresst 1 1001 AUMS No fetch of source operand 1 0011 lAO R Prefetch next instruction from effective source address 1 1001 AUMS BIND Ns Fetch source operand 1 1001 AUMS 1 0011 lAO R Prefetch next instruction from effective source address 1 1001 AUMS BL Ns Fetch source operand 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 0011 lAO R Prefetch next instruction 1 0110 WS W Save old PC in WR11 "Replace with WS bus status code if operand is in workspace registers. tBlock the read cycle in the last cycle of the source fetch sequence. 81 TABLE " - INSTRUCTION EXECUTION SEQUENCES (CONTINUEDI NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT BLSK 1 0110 WS Fetch stack pointer from WR 1 1001 AUMS 1 0110 WS W Decrement stack pointer in WR 1 0010 lOP R Fetch brench address 1 0001 SOP W Push return PC onto stack 1 0011 IAQ R Fetch next instruction 1 1001 AUMS BLWP Ns Fetch source operend (the new WP) 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 0001" SOP· R Fetch new PC 1 1100 WP New WP is output on address lines 1 0110 WS W Save old WP in WR 13 1 0110 WS W Save old PC in WR14 1 0110 WS W Save old ST in WR15 1 0011 IAQ R Prefetch next instruction 1 1001 AUMS CLR,SETO Ns-l SRC> Get source addresst 1 1001 AUMS No fetch of source operand 1 0011 IAQ R Pre1etch next instruction 1 0001' SOP' W Save result in source address COC, CZC Ns Fetch source operand 1 0110 WS R Fetch dest'n from designated WR 1 0011 IAQ R Pre1etch next instruction 1 1001 AUMS DIV Ns Fetch source operand 1 1001 AUMS 1 0110 WS R Fetch MSW of dest'n operand from WR IF OVERFLOW, GO TO LABEL 1 Check for divide by zero 4 1 I IF OVERFLOW, GO TO LABEL 1 0110 1001 WS AUMS R Fetch LSW of dest'n operand from WR + 1 Series of 4 consecutive AUMS cycles Is divisor < MSW of dividend? 18 1001 AUMS Series of 18 consecutive AUMS cycles 1 0110 WS W Save quotient in dest'n WR 1 0011 IAQ R Prefetch next instruction 1 0110 WS W Save remainder in dest'n WR + 1 LABEL 1: (GO HERE IF OVERFLOW) 11 0011 IAQ R Prefetch next instruction 1 1001 AUMS 'Substitute WS bus stetus code if operand is in workspace register. tBlock the reed in the last cycle of the source fetch sequence. 82 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES (CONTINUED) NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT DIVS Ns Fetch source operand 1 1001 AUMS 1 0110 WS R Fetch LSW of dest'n optrand from WRl 1 1001 AUMS 1 0110 WS R Fetch MSW of dest'n operand from WRO 3 1001 AUMS Series of 3 consecutive AUMS cycles IF OVERFLOW, GO TO LABEL 1 Check for divide by zero 3 I 1001 AUMS Series of 3 consecutive AUMS cycles IF OVERFLOW, GO TO LABEL 1 Is Idivisorl < Idividendi? 20 I 1001 AUMS Series of 20 consecutive AUMS cycles IF OVERFLOW, GO TO LABEL 1 Does unsigned quotient overflow its 150bit boundary? If so, set ST4. 0110 WS W Save quotient in WRO 00'1 lAO R Prefetch next instruction 01'0 WS W Save remainder in WRl LABEL 1: :GO HEREIIF OVER~~~W) lAO R Prefetch next instruction 1 1001 AUMS DEC, DECT, INC, INCT, INV, NEG, SWAPB Ns Fetch source operand 1 0011 lAO R Prefetch next instruction 0001" SOP" R Save result in source address LREX, CKOF, CKON, RSET (external instructions) 4 1001 AUMS Series of 4 consecutive AUMS cycles 2 lOll 1/0 W 1/0 cycle is minimum 2 states long 1 1101 ST Output new status on address bus 1 0011 lAO R Prefetch next instruction 1 1001 AUMS IDLE (external instruction) 3 1001 AUMS Series of 3 consecutive AUMS cycles 2 lOll 1/0 W 1/0 cycle is minimum 2 clocks long 1 0011 lAO R Fetch next instruction 1 1001 AUMS LDCR (parallelloed CRU) Ns Fetch source operand 1 0110 WS R Get CRU base address from WR 12 2 1001 AUMS Series of 2 consecutive AUMS cycles 2 1001 1/0 W 110 cycle is minimum 2 states long 1 0011 lAO R Fetch next instruction 1 1001:1: AUMS:I: Increment WR12 if necessary 'Substitute WS bus status code if operand is in workspace register. *Substitute WS bus status code and a write cycle if WR12 is post-incremented by 2. 83 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES (CONTINUED) NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT LDCR (serial load CRUI Ns Fetch source operand 1 0110 WS R Fetch CRU base addresa from WR 12 4 1001 AUMS Series of 4 consecutive AUMS cycles 2" CNTt 1011 1/0 W 110 cycle is minimum 2 states long 1 0011 lAO R Fetch next instruction 1 1001 AUMS LDDANDLDS 1 1001 AUMS 1 1001 AUMS Update internal LDD and LOS flags 1 1001 AUMS MID trap follows LI 1 0010 lOP R Fetch immediate operand 1 0011 lAO R Fetch next instruction 1 0110 WS W Save operand in specified WR L1MI 1 0010 lOP R Fetch immediate operand 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 0011 lAO R Prefetch next instruction" 1 1001 AUMS LST 1 0110 WS R Fetch operend from WR 3 1001 AUMS Series of 3 consecutive AUMS cycles 1 1101 ST Output new status on address bus 1 0011 lAO R Fetch next instruction 1 1001 AUMS LWP 1 0110 WS R Fetch operand from WR 1 0011 lAO R Fetch next instruction 1 1100 WP Output new WP on address bus LWPI 1 0010 lOP R Fetch immediate operand 1 0011 lAO R Fetch next instruction 1 1100 WP Output new WP on addresa bus MPY Ns Fetch source operand 1 0110 WS R Fetch dest'n operand from WR 18 1001 AUMS Series of 18 consecutive AUMS cycles 1 0110 WS W Save MSW of result in WR 1 0011 lAO R Fetch next instruction 1 0110 WS W ' Save LSW of result in WR + 1 tThe number of cycles is specified in the count field of the opcode. "The MW mask controls interrupts. 84 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES (CONTINUED) NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT MPYS Ns Fetch source operend 1 1001 AUMS 1 0110 WS R Fetch dest'n operand from WR 19 1001 AUMS Series of 19 consecutive AUMS cycles 1 0110 WS W Save MSW of result in WR 1 0011 lAO R Fetch next instruction 1 0110 WS W Save LSWof result in WR + 1 RTWP (retum from subroutine in main memory) 1 1001 AUMS 1 0110 WS R Fetch new PC from WR14 1 0110 WS R Fetch new STfrom WR15 1 0110 WS R Fetch new WP from WR 13 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 1101 ST Output new ST on address bus 1 0011 lAO R Prefetch next instruction 1 1100 WP Output new WP on address bus RTWP (return from using opcodes > 380, > 382, or > 384 5 1001 AUMS Series of 5 consecutive AUMS cycles 1 0011 IAQ R Prefetch next instruction 1 1001 AUMS Jump Instructions 1 1001 AUMS 1 0011 lAO R Prefetch next instruction 1 1001 AUMS 85 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES (CONTINUEDI NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT SLAM,SRAM 1 0010 lOP R Fetch second word of opcode 1 1001 AUMS Ns Fetch MSW of source operand IF SHIFT COUNT IS ZERO, GO TO LABEL 1 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 0001' SOP' R Fetch LSW of source operand 2 1001 AUMS Series of 2 consecutive AUMS cycles CNTt 1001 AUMS Repeat shift operation 1 0001' SOP' W Save LSW of source operand 1 0011 lAO R Fetch next instruction 1 0001' SOP' W Save MSW of source operand LABEL 1: (GO HERE IF SHIFT COUNT IS ZEROI 1 1001 AUMS 1 0110 WS R Fetch shift count in WRO 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 0001' SOP' R Read LSW of source operand 1 1001 AUMS IF SHIFT COUNT IN RO IS ZERO, GO TO LABEL2 1 1001 AUMS CNTt l00l! AUMSt Repeat shift operation until done 1 0001' SOP" W Write LSW of result to source address 1 0011 lAO R Fetch next instruction 1 0001" SOP" W Write MSW of result to source address LABEL 2: (GO HERE IF SHIFT COUNT IN WRO IS ZEROI 1 1001 AUMS 1 0001" SOP' W Write LSW of result to source address 1 0011 lAO R Prefetch next instruction 1 0001" SOP' W Write MSW of result to source address 'Substitute WS bus status code if operand is in workspace register. tNumber of cycles is equal to shift count. 86 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES (CONTINUED) NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT STCR (parallel store CRUI Nst I I NOTE: SOURCE OPERAND IS NOT FETCHED IF WORD TRANSFER ! Fetch source operand if byte transfer 1 0110 WS R Read 1/0 base address from WR12 2 1001 AUMS Series of 2 consecutive AUMS cycles 2 1011 1/0 R I I 0 cycle is minimum 2 states long 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 000lt SOPt W Save result in source address 1 0011 lAO R Prefetch next instruction 1 l00lt NOPt Increment WR12 if necessary STCR (bit-serial store CRUI Nsi Fetch source operand if byte transfer 1 0110 WS R Fetch 1/0 base address from WR12 5 1001 AUMS Series of 5 consecutive AUMS cycles 2§CNT* 1011 1/0 R 1/0 read takes min. 2 stateslbit 3 1001 AUMS Series of 3 consecutiveAUMS cycles IF 8 OR 16 BITS TRANSFERRED, GO TO LABEL 1 7 1001 AUMS Repeat cycle 8-N for byte or 16-N for word, where N = number of bits LABEL 1: 1 0011 lAO R Fetch next instruction 1 0001§ SOP§ W Save result in source address SBO, SBZ (single-bit CRU instructionsl 1 1001 AUMS 1 0110 WS R Fetch 1/0 base address from WR12 1 1001 AUMS 2 1011 1/0 W I/O cycle is minimum 2 states long 1 0011 lAO R Fetch next instruction 1 1001 AUMS "Number of cycles is equal to count field from STCR opcode. tSubstitute WS bus status code if WR12 is post-incremented by 2. *If source operand is word rather than byte, fetch of operand is replaced by AUMS cycle. §Substitute WS bus status code if operand is in workspace register. 87 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES (CONTINUED) NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT TB 1 1001 AUMS 1 0110 WS R Fetch I/O base address from WR12 1 1001 AUMS 2 1011 I/O R I/O cycle is minimum 2 states long 1 0011 lAO R Fetch next instruction 1 1001 AUMS TMB, TCMB, TSMB (source operand in workspace register) 1 0010 lOP R Fetch second word of instruction 1 0110 WS R Fetch source operand from WR 2 1001 AUMS Series of 2 consecutive AUMS cycles Bit displacement t 1001 AUMS Shift target bit into position 2 1001 AUMS Series of 2 consecutive AUMS cycles ~ 6-bit displacement; 1001 AUMS Restore shifted bit to original position 1 1001 AUMS 1 0110 WS W Write result to WR 1 0011 lAO R Fetch next instruction 1 1001 AUMS TMB, TCMB, TSMB (non-register source operand) 1 0010 lOP R Fetch second word of instruction Ns-l Get source address (see next cycle) 1 0000 SOPL R Fetch source with MPILCK active 2 1000 AUMSL Series of 2 consecutive AUMSL cycles Bit displacement t 1000 AUMSL Shift target bit into position 2 1000 AUMSL Series of 2 consecutive AUMSL cycles 1 6-bit displacement; 1000 AUMSL Restore shifted bit to original position 1 1000 AUMSL 1 0001 SOP W Save results and deactivate MPILCK 1 0011 lAO R Prefetch next instruction 1 1001 AUMS t Number of cycles is equal to the bit number plus one. ~ Number of cycles is equal to 16 minus the b~ number. 88 TABLE'9 - INSTRUCTION EXECUTION SEQUENCES (CONTINUED) NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT X Ns Fetch source operand (target opcodel 1 1001 AUMS Execute target opcode STST,STWP 1 1001 AUMS 1 0011 lAO R Fetch next instruction 1 0110 WS W Save result in WR XOP Ns-l Get source operand address (see nextl 1 1001 AUMS Block fetch of source operand 1 1101 ST Output all zeros on address bus 1 1001 AUMS 1 0101 INTA R Fetch new WP from vector 1 1001 AUMS 1 1100 WP Output new WP on address bus 1 1001 AUMS 1 0110 WS W Save source address in WR 11 1 0101 INTA R Fetch new PC from vector 1 0110 WS W SaveoldWPinWR13 1 0110 WS W Save old PC in WR 14 1 0110 WS W Save old ST in WR15 1 0011 lAO R Fetch next instruction 1 1001 AUMS XOR Ns Fetch source operand 1 0110 WS R Fetch dest'n operand from WR 1 0011 lAO R Fetch next instruction 1 0110 WS W 89 TABLE 19 - INSTRUCTION EXECUTION SEQUENCES ICONCLUDED) NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT EVAD (This instruction is available only in Macrostore) Ns ' Fetch source operand 1 1001 AUMS 1 1001 AUMS Save Macrostore PC in WR4 of Macrostore 1 1001 AUMS Fetch user's PC from WR 14 of Macrostore 2 1001 AUMS Series of 2 consecutive AUMS cycles IF TARGET OPCODE SOURCE ADDRESS IS'R +, GO TO LABEL 1 Ns-l Get source address for target word GO TO LABEL 2 LABEL 1: 1 0110 WS R Fetch source address from user's WR 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 1001 AUMS Save address of user's WR in WR10 1 1001 AUMS LABEL 2: IF TARGET OPCODE DESTINATION ADDRESS IS *R +, GO TO LABEL 3 Nd-l Get dest'n address for target word GO TO LABEL 4 LABEL 3: 1 0110 WS R Fetch dest'n address from user's WR 1 1001 AUMS Save address of user's WR in WR9 LABEL 4: 3 1001 AUMS Series of 3 consecutive AUMS cycles 1 1001 AUMS Save updated user PC in WR14 of Macrostore 1 1001 AUMS Restore Macrostore PC 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 1001 AUMS Save dest'n address in WR7 of Macrostore 1 1001 AUMS Fetch next instruction 1 1001 AUMS Save source address in WR8 of Macrostore • All cvcles output AUMS bus status code. 90 TABLE 20 - INTERRUPT AND MACROSTORE TRAP SEQUENCES NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT INTERRUPTS 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 1101 ST Output all zeros on address bus 1 0101 INTA R Fetch new WP from interrupt vector 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 0101 INTA R Fetch new PC from interrupt vector 1 1100 WP Output new WP on address bus 1 0110 WS W Save old WP in WR13 1 0110 WS W Save old PC in WR14 1 0110 WS W SaveoidSTinWR15 1 0011 IAQ R Fetch next instruction 1 1001 AUMS TRAP TO MACROSTORE (MID trap) 1 1001 AUMS 1 1110 MID Check for attached processor 1 1001 AUMS 1 1001 AUMS Save contents of main IR .in WR5 1 1001 AUMS 1 1001 AUMS If MID trap is due to 2nd word of instruction, seve PC-2 in WR14 1 1001 AUMS Save LOS and LDD flags and first word of 32-bit opcode in WR3 1 1001 AUMS Read Macrostore PC from vector 1 1001 AUMS 1 1001 AUMS Save user's WP in WR 13 1 1001 AUMS Save user's PC in WR 14 1 1001 AUMS Save user's ST in WR15 2 1001 AUMS Series of 2 consecutive AUMS cycles 91 TABLE 21 - ATTACHED PROCESSOR INTERFACE SEQUENCES NUMBER BUS READ OF STATUS OR CYCLES CODE NAME WRITE COMMENT 9900b TRANSFERS CONTROL TO AITACHED PROCESSOR (MID trap) 1 1001 AUMS 1 1110 MID Check for attached processor 2 1001 AUMS Series of 2 consecutive AUMS cycles 1 1101 ST Output all zeros on address bus 1 0101 INTA R Fetch WP from level-2 vector 3 1001 AUMS Series of 3 consecutive AUMS cvcles 1 1100 WP Output new WP on address bus 1 0110 WS W Save old WP in WR13 1 0110 WS W Save old PC in WR14 1 0110 WS W Save old ST in WR15 1 1111 HOLDA Release bus to attached processor AITACHED PROCESSOR RETURNS CONTROL TO 99000 1 1111 HOLDA Last state of hold cycle 1 0110 WS R Fetch new PC from WR14 1 0110 WS R Fetch new ST from WR15 1 0110 WS R Fetch new WP from WR13 1 1101 ST Output new ST on address bus 1 0011 IAQ R Fetch next instruction 1 1100 WP Output new WP on address bus ADVANCE INFORMATION This document contains information on 92 a new product. Specifications are subject to change without notice. 11. TMS99105AJTMS99110A PRELIMINARY ELECTRICAL SPECIFICATIONS 11.1 ABSOLUTE MAXIMUM RATINGS OVER OPERATING FREE-AIR TEMPERATURE RANGE (UNLESS OTHERWISE NOTED)t Supply voltage, VCC (see Note 1) . . . . . . . . . . . . . . . . . . . • . . . . . . . . . . . . . . . • • . . . . . . . -0.3 to 7 V All input voltages . . . . . . . . . . . . . . . . . . • . . . . . . • . . . . . . . . . . . . . . . . . . . . . . • . . . . . -0.3 to 20 V Output voltages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . • . . . . . . . . . . . .. - 0.3 to 7 V Continuous power dissipation . . . . . . . . . . . . . . . • • . . . . . . . . . . . . . . . . . . . . . . • . . • . . . . . 1 000 mW Operating free-air temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . • • . . • . . . . . . . . • . .. 0 °C to 70 °C t Str..... beyond tho.. lI.ted under" Absolute Maximum Rating." may cau.. permanent damage to the device. This i. a stre•• rating only and func- tional operation of the d.vice at these or any other conditions beyond those indicated in the "Recommended Operating Conditions" ..ction of this specification i. not implied. Exposure to absolute-maximum-rated conditions for extended periods may affact device reliability. Note 1: All voltege value. are with re.pect to V SS 11.2 RECOMMENDED OPERATING CONDITIONS PARAMETER MIN NOM MAX UNITS Supply voltage, VCC 4.75 5 5.25 V Supply voltage, VSS 0 V High-level input voltage. VIH (all inputs except CLKIN) 2 VCC+1 V High-level Input voltage, VIH (ClKIN) 3.5 VCC+1 V low-level input voltaga, Vil (all inputs except ClKIN) 1 0.8 V low-level input voltage, Vil (ClKIN) 0.2 V High-level output current, IOH (All outputs) 400 fAA low-level output current. IOl (all outputs) 2'1' mA Operating free-air temperature. TA 0 70 ac *Output current of 2 mA is sufficient to drive 5 low-power Schottky TTL loads or 10 advanced low-power Schottky TTL loads (worst ca..l. 11.3 ELECTRICAL CHARACTERISTICS OVER RECOMMENDED FREE-AIR TEMPERATURE (UNLESS OTHERWISE NOTED) PARAMETER TEST CONDITIONSl MIN TYP~ MAX UNIT VOH High-level output voltage VCC=MIN, 10l=MAX 2.4 V low-level output voltage VOL VCC=MIN. 10l=MAX 0.5 V all except BST( 1-3), Rfii, iiiiEM low-level output voltage, VOL VCC=MIN, 10l=MAX 0.6 V (BST(1-3), R/W, MEM 10 Tristate (high-Impedance) output V =MAX I VO=2.4 V 20 fAA current (off) CC J VO-0.4 V -20 II Input current VI-VSS to VCC 20 fAA ICC Supply current Vce-MAX 120 mA Input capacitance (all inputs CI 15 pF except addressfdata lines) COB Addressfdata line capacitance f = 1 MHz, all other pins at 0 V 25 pF Output capacitance (except Co 10 15 pF address/data lines) .".- tFor conditions shown as MIN or MAX. use the appropriate value specified under recommended operating conditions. *AlltypicaivaluesareatVcc = 5V. TA = 25"C. 11.4 CLOCK CHARACTERISTICS The TMS99000 has an internal oscillator and 4-phase clock generator controlled by an external crystal or resistor-capacitor combination. Alternatively, the user can directly inject a frequency source into the XTAL1 input. The period of the frequency source must be one-fourth the desired machine state time. 11.4.1 Internal Oscillator The internal oscillator is enabled by connecting a crystal across XTAL 1 and XTAL2. The machine state time, \' is four times the crystal oscillator period, 1/fx ' The crystal should be a fundamental series-resonant type. Figure 33 presents the circuit configuration for this mode of operation. ADVANCE INFORMATION 93 This document contains information on a new product. Specifications are subject to change without notice. TMS99105A TMS99110A XTAL1/CLKIN XTAL2 crystal NOTES: 1. The crystal should be a fundamental series..rasonant type operating at four times the machine state frequency. 2. Cl and C2 represent the total capecitanca on these pins, including strays and parasitics. FIGURE 33 - INTERNAL OSCILLATOR PARAMETER TEST CONDITIONS MIN TVP MAX UNIT Crystal frequency. f x 0-70 oC 24 MHz C1. C2 0-70 oC 5 pF 11.4.2 External Clock An external clock of frequency f. may be connected to the XTAL 1/CLKIN in place of a crystal or RC combination. The period of the CLKOUT output signal will be 4/f•. Figure 34 shows the circuit configuration when an external clock is used_ PARAMETER MIN NOM MAX UNIT fext External source frequency 12 24 MHz t",- elKIN cycle time 41.25 83.33 ns tr+ ClKIN rise time (see Note 1) 4 10 ns tf+ ClKIN fall time (see Note 1) 4 10 ns twH1 ClKIN high-level pulse width tcq,/2-trq, ns twll ClKIN low-level pulse width tcq,/2-tft/> ns Note 1: CLKIN rise and fall times are a function of V'H and V'L' For the times shown the V'H and V'L levels are as given under "Recommended Operating Conditions." If a maximum 5 ns rise and fall time can be achieved, then the V,H and V'L levels may be standard levels of 2.4 V and 0.4 V respectively. +5V XTAL1 TMS99105A TMS99110A Crystal Oscillator nc XTAL2 FIGURE 34 - EXTERNAL OSCILLATOR ADVANCE INFORMATION This document contains information on 94 11 new product. Specifications are subject to change without notice. 11.5 TIMING REQUIREMENTS OVER RECOMMENDED OPERATING CONDITIONS PARAMETER MIN NOM MAX UNIT tad READY setup time prior to falling edge of CLKOUT 35 ns ttl 1 READY hold time after falling edge of CLKOUT 0 ns tsu2 Data setup time prior to falling edge of CLKOUT 30 ns th2 Data hold time after falling edge of CLKOUT 0 ns t sL 3 INTREQ, ~, APP setup time prior to falling edge of CLKOUT 40 ns t su4 HOLD setup time prior to falling edge of CLKOUT SO ns th3 INTREQ, RESET, APP, HOLD hold time after fallina adge of CLKOUT 15 ns tacc Access time, address valid to data valid at data setup time 3tc2/4-40 ns ~ed RD low until valid data required tc2/2-63 ns 11.6 SWITCHING CHARACTERISTICS OVER RECOMMENDED OPERATING CONDITIONS PARAMETER TEST CONDITIONS MIN TYP MAX UNIT !l:2. CLKOUT cycle time (f(x) = crystal freq) 4 tc 1 or 4/fx ns tr2 CLKOUT rise time 10 15 ns tf2 CLKOUT fall time 10 15 ns twH2 CLKOUT high-level pulse width tc2/2-tr2 ns twL2 CLKOUT low-level pulse width tc2/2-tf2 ns twH3 ALATCH pulse width high tc2/4-tr2 ns td1 Delay time, reference line to ALATCH low tc2/4+ 13 ns ~2 Delay time, ref line to ALATCH high 11 15 ns Delay time, ref line to MEM, SST, RIW td3 13 15 ns address, PSEL valid Delay time, ALATCH low to address, PSEL ~4 10 15 20 ns invalid ~z1 Delay time, ALATCH to address hi-z 20 30 35 ns CL = 100pF ~5 Delay time, ref line to start of WE invalid tc2/4 ns (See Figure 35) td6 Delay time, ALATCH low to start of m; invalid 10 24 30 ns ~7 Delay time, CLKOUT low to WE, RD high 15 30 ns ~8 Delay time, ALATCH low to data valid 20 30 35 ns ~9 Delay time, ref line to WE valid t,,2/4 + 13 tc2/4+20 ns '~10 Delay time, WE/IOCLK high to data invalid tc2/4-30 ns Delay time, CLKOUT low to data, PSEL, td11 tc2/4+5 ns BST, MEM, RIW invalid Delay time CLKOUT low to WE/IOCLK, RD td12 0 ns inactive tdrde Delay time ref line to RD low tc2/4+40 ns ~z2 Delay time, ref line to R/W hi-z tc2/4 + 25 ns ~z3 Delay time, ref line to ALATCH hi-z tc2/4 + 25 ns ~(ravl Delay time, ref line to ALATCH invalid tc2/4 ns Delay time, ALATCH low to address, 1IiIE1IiI, td13 10 ns BST, RD, WE, RIW invalid Delay time ref line to address, MEM, BST. td14 'tc2 /4 + 2O ns RD. WR, R/IN invalid ADVANCE INFORMATION 95 This document contains information on a new product. Specifications are subject to change without notice. +Vcc Test point 2.4K Diode From output o---...- -...........----4. .-----l!.-....- -.... under test 24K Diode. FIGURE 36 - SWITCHING nMES LOAD CIRCUIT "'twH1 CLKIN . .11 .... tf2 II ~11 .... tr2 ~ twL1 .. II II .. twL2 ., II.. CLKOUT [1 1. I l\ I I 14 twH2 I "'1 I I I I I- tc2 -I NOTES: 111 There I, no time reletionlhip ImpHed or specified between the Input clock and the output clock. 121 All timing reference poInts.re 10% and 90% points. FIGURE 38 - CLOCK TIMING PARAMETERS 96 COMMON SIGNALS Ie .J n clock cycles t-tc2/4--1 ( -...' .... In - 1 wait states) .. CLKOUT\ l td2-Jt;:: t d1---1 / I tI I 1 t--tr2 ALATCH : i: '1t~ II ---1Ij.-t WH3..ti:,.------------......,.· !* 'I , --.I /.- tf2 ........,L-tsu 1 I II READY. X~xxxX~XxxxxxX I --' j- t d3 I I' IxXXXXxX .....:..t J-th1 8STI1-3). - - " ' \ . 11;( I ',I,)c ,I , MEM.R/W valid code -~ MEMORY READ CYCLE I I.. tacc -t' I I I I I,. -I tdz1 I I, I I th2~td11---; td3~ ~ td4~ tsu2~ I !- ~~~=' 1 ~ addr~-hi-z-,;:.:a~ C I I tH3' -of -I 1 ...-tdS.... t-'tded--t td7- RD ] : ~ ~ l ~"'t----- I" tr~e -t Htd12 WE ] td8 I" , I - -t d11-----t MEMORY WRITE CYCLE : td4~ I I I ~td3 I I I t-'td10 .J ~~~=' --:""'~ odd.... ~·-----v-al-id-d-~-ta---:-~X: I RD 7' I I ,..:.--td9 - -... ; t-td7-1 WE -7.,....r-:---td-5-~NMu~'------:-:--1111111' td31 I-- l--i-td12 INTERNAL ALU CYCLE I ADADTDARI ___,I " J~~--un-d-e-fin-e-d__)(~------u-n-de-fi-n-ed--------->e:: I M.YlE 7: reference line FIGURE 37 - MEMORY AND INTERNAL CYCLE TIMING PARAMETERS All timing reference points are' 0% and 90% points, 97 COMMON SIGNALS i tc2/4 -t r- 14 -t n clock cycles ~ I 4- t,2 I, ~"'I"---I~t-(n wait states) I I ',-._--';'_--11 n.r_______ CLKOUT \ 11=;""'--- t d2 -i .... _. I I I tf2 I ~---Jr - ALATCH I_ _ _ _ _ _ twH3 I f.. -, I I...-t 1 I 1.--- su ~ READY ~ 4 t d3 I I th1-l1-- ~I BST(1-3) KImir.RIW ---!..ftt. I I valid code I-X I I \--tdZ1--.1 ..... td11:::1 1/0 INPUT CYCLE I I I ~~~ I '-td4--t I I- t su2-., I ADDRI DATA :Dt I ~---hi-:---~ data IX--)( td3 ~ r.....l...-tr~e .. I : t':.1.. r - - - - t c 2 + t d e d - -......' I ~td7 ~ I I ~I~ ~~ ~ .t--td12 I I I I I I- t d11-f 110 OUTPUT CYCLE I , td10 r--! X I .-.td4--t ADDRI DATA =bt a:dress X I valid data : I f...I- t d3 L.-tdS--"" I I I I ' I I I I I H t d7 r-Id'--J : of- 1...- - - - - t c 2 - - - - -..... ~ ~"'~'F_---~fllaI· ... refe:ence t-- td5 reference -I --.J I-td 2 ---, 1 line line FIGURE 38 - I/O CYCLE TIMING PARAMETERS All timing reference pOints are 10% and 90% points. 98 r .. - - - - 3 t c 2 / 4 - - -.... J I I CLKOUT _I_ _ f tsu3 ~ ~'-_ _ INTREQ, I 1 ~th3 ICIO-3), RESE'f. NMi,Aiiji ~~!~ 1 I I L.-- tSU4---, I HOLD ~ I ~ reference line NOTE: The ClKOUT edge at which each of the input signals is sampled is defined in the section pertaining to that signal. FIGURE 39 - INTERRUPT, HOLD AND APP TIMING PARAMETERS I· tc2 -I I I CLKOUT I f \ I f .I 1 I- tdz3 I ALATCH jJ , 1 :/ rtrav~ Shi-Z- BSTI1-3), 17 I r- Jj tdZ1 MEM,Ro, We/CRUCLK, _ ~ I ~ t--td13-i ~ hi-z I ADDRESS, RIW L. td14 -I 1 I. I tdz2 -t reference reference line line FIGURE 40 - HOLD CYCLE TIMING PARAMETERS All timing reference points are 10% and 90% points. 99 I I CLKOUT I I I ,, I / ALATCH hi-z I I " l.. tcl2 . .1 , I \ I I I ~ MEM. BSTI1-31. WE/IOCLK. hi-z I RD. RIW. ADDRESS I valid I I , I , .... teD . ., I I reference line FIGURE 40 - HOLD CYCLE TIMING PARAMETERS ICONCLUDED) All timing reference points are 10% and 90% points. 100 12. TMS99000 MECHANICAL SPECIFICATIONS 12.1 TMS99105AITMS99110A - 40·PlN CERAMIC PACKAGE 1e~--------61.31 12.0201 MAX---------et~ ~-.- - - - @ l .... ~ ~ ~ ~ 0) - - - - - - - - - - - - - - - - - ® L 16.24:1: 0.254 J ~ s:~::: 1 1 201 MIN ~ fLANE T ~ ~L~PlN ~ 0.81310.032) NOM 1.27:1:0.508 0.26410.0101 NOMJL SPACING 2.6410.100) T.P. 10.060:t 0.020) 0.467:1: 0.078 ISH Note a) 1.27:t 0.264 10.018:1: 0.003) 10.060:t 0.010) NOTES: a. Each pin canterllne Is located within 0.264 10.010) of Its true longitudinal position. b. All linear dImensions a.. In mlnlmet..s and perenthetlcal, In Inches. Inch dimensions govern. 12.2 TMS99105A/TMS99110A - 40·PIN PLASTIC PACKAGE ,....-------63.0912.090) M A X - - - - - - - -... EITHER.,--......_...1 INDEX fi. 15.24:1:0.254 fi. CD ir ~ I0.600:l:0.010)J <= ~ 0.508 10.020) MINr-------_· ~i ~- SEATING PLANE-4-- o 279 :I: 0 0781~ 0.457:1: 0.076 --II-" ~ 10:011 :t 0:003) II 10.018:1:0.003) . I PIN SPACING 2.5410.100) T.P. 2.41 10.095) ISee Note a) 1.40(0.065) NOTES: a. Each pin centerline is located within 0.254 (0.010) of Its trua longitudinal position. b. Allline.r dimensions 8re in millimeter••nd parenthetically In Inches. Inch dimensions govern. 1011102 APPENDIX A TMS99105A SUPPLEMENT 103 A. TMS99105A DESCRIPTION The TMS991 05A is the basic member of the TMS99000 microprocessor family. The TMS991 05A offers the same features as described in Sections 1 through Section 1 2. The only feature not implemented on the TMS99 105A is on- chip Macrostore. However, extemal Macrostore may be utilized for user-implemented functions and instructions. A.1 TMS99105A MACROSTORE OPERATION The TMS991 05A may utilize external Macrostore by placing the TMS991 05A in prototyping mode (see Section 7.2.4.2). If no external Macrostore is to be implemented in the system, it is recommended that the TMS99105A be placed in baseline mode (Section 7.2.4.3). If no external Macrostore is implemented on the TMS991 05A and the stan- dard mode or prototyping mode is selected, the occurrence of a MID opcode will result in indeterminate operation. This is due to the fact that a Macrostore vector will occur to non-existent Macrostore memory (see Section 7.3) and potentially cause a system lockup. 104 APPENDIX B TMS99110A SUPPLEMENT 105 B TMS99110A DESCRIPTION The TMS9911 OA 16-bit microprocessor is a powerful member of the TMS99000 family that implements 12 single precision floating point instructions, 2 memory mapper control instructions and a 32 X 32 signed integer mUltiply in- struction. These powerful instruction set enhancements are implemented via the on-chip Macrostore memory space. They are additions to the instruction set described in Section 10. B.1 TMS99110A MACROSTORE OPERATION With the instruction set extensions of the TMS9911 OA implemented in Macrostore, it is required that the TMS99110A be generated in standard mode (see Section 7.2.4.1). If either the prototyping mode or baseline mode of operation is selected, the instruction set extensions described in this section will not be operational. B.2 TMS99110A INSTRUCTION SET EXTENSION SUMMARY The TMS9911 OA implements the instructions listed Table B.l in addition to those listed in Section 10. Note that these instructions are operational only when the TMS9911 OA is operated in the standard mode. TASlES.1 - TMS99110A INSTRUCTION SET EXTENSION SUMMARY MNEMONIC DESCRIPTION OPERATION * lDD long Distance Source Update internal lDD flag lOS Long Distance Destination Update internal LOS flag AR Add Real FPAC + (SA,SA + 2) .... FPAC SR Subtract Real FPAC - (SA,SA+2) .... FPAC MR Multiply Real (SA,SA + 2) • FPAC .... FPAC DR Divide Real FPAC I (SA,SA + 2) .... FPAC LR load Real (SA,SA+2) .... FPAC STR Store Real FPAC .... (SA,SA+2) NEGR Negate Real - FPAC .... FPAC CR Compare Real (SA,SA + 2) - (DA,DA + 2) set status CIR Convert Integer to Real Convert (SA) .... FPAC CER Convert Extended Integer to Real Convert FPAC .... FPAC CRI Convert Real to Integer Convert FPAC to integer .... FPAC CRE Convert Real to Extended Integer Convert FPAC to ex. integer .... FPAC MMt Multiply Multiple (32 x 32) (SA,SA+2) • (DA,DA+2) .... (DA,DA - 2,DA + 4,DA + 6 'Floating point accumulator IFPAC) is designated as workspace registers 0 and 1 of the current workspace. t MM is not a floating pOint operation but is an addition to the TMS991 lOA instruction set. B.3 TMS99110A MEMORY MAPPER CONTROL INSTRUCTIONS The LOO and LOS instructions are provided for use in controlling a 16-register memory map file. These instructions are implemented on the 99110 only. These mapper instructions are intended to support the use of the TIM99610 (SN74LS610) memory mapper (see the SN74LS610 data sheet). General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: OPCOOE o o o o o o OPCODE MNEMONIC 0123456789 MEANING LOS 0000011110 Long Distance Source LDD 00000111 11 Long Distance Destination The LOO and LOS instructions permit data to be accessed through the user's memory map while in the supervisor mode. The PSEL pin will be inverted during the source (if LOS) or destination (if LOO) operand access cycles of the following instruction, unless the addressing mode is register direct. When register direct addressing (TS = 0 or TO = 0) is used for the source or destination operand fetch, PSEL is not altered. 106 Listed below are the effects when an lOO or lOS instruction foliows an lOS or lOO instruction. In general, only the first two cases, lOO followed by lOS or lOS followed by lOO, are considered useful: lOO -lOS: Both the source and destination memory cycles of the instruction that follows are long distance. lOS-lOO: Same as lOO-lOS. lOS -lOS: The first lOS has no effect; the source memory cycles of the instruction that follow are long distance. lOO -lOO: The first lOO has no effect; the destination memory cycles of the instruction that follow are long distance. Interrupts are inhibited until after the next instruction. An attempt to execute a long-distance instruction while in user mode (ST7 = 1) will be flagged as a privileged opcode violation. The lOS or lOO instruction has no effect if the source or destination addressing mode of the target instruction is workspace register direct. If the instruction to be long distanced is interruptible, the long distance information can be recovered upon return from the interrupt. An example of an interruptible instruction is a block move with multiple source and destination operands to which long distancing is applied. Typically, a checkpoint or loop count register keeps track of the number of moves completed. If long distancing is not applied to either operand, the normal procedure, when an interrupt occurs, is to store the loop count and other pertinent instruction status in a checkpoint register and decrement the program counter. After the interrupt is serviced, execution continues from where it stopped. After the instruction is completed, the check point register is set to - 1 or some other value to indicate that the instruction will be executed for the first time when it is next encountered. Several features have been incorporated into the lOO and lOS instructions to facilitate recovery from an interrupted instruction when an lOO and/or an lOO instruction is active. Both the lOO and the lOS instructions save the address plus 2 (main memory) of the first lOO or lOS in a possible sequence of lOO s and/or lOS s. Any Macrostore imple- mented instructions, which could be long distanced and interrupted, must not accidentally destroy this data. The three most significant bits of Macrostore location > 0006 (WR3 if WP = 0) are long distance status information as shown in the following table. The fact that a long distance instruction is active may be determined by comparing the contents of >0006 to the value> EOOO. If the comparison is greater than or equal, then the long distance instruction is not active. LONG-DISTANCE FLAGS 012 MEANING 1 1 1 No long distancing in effect 1 10 Long distance source 1 01 Will never occur 100 Long distance source' 01 1 Long distance destination 010 Sequence: 1) LOO, 2) LOS (order is significant) 001 Will never occur 000 Sequence: 1) LOS, 2) LOO, or see Note. t • A sequence of two LOS instructions has been encountered. If emulating the 990/12 version of LOS, the source operand access of the second LOS is controll· ed by the first LOS to be long distance. t The sequence LOS. LOO. LOS has been encountered. If emulating the 990/1 2 version of LOO and LOS, then the source operand access of the LOO is controll· ed by the first LOS to be long distance. The procedure for handling an interruptible instruction is relatively simple due to the information stored in locations> 0004 and >0006 (WR2 and WR3 if WP = 0). When an interrupt is detected by using one of the jump on interrupt instructions, first do all necessary clean-up (such as updating the checkpoint registerls)), and compare Macrostore location >0006 to value> EOOO to determine if a long distance instruction was active. If no long distance is active, then load the contents of WR14 (used to return back to main memory) with the address of the start of the instruction. It may be necessary to save the contents of WR 14 on entering Macrostore for this purpose because WR14 may be modified by executing the Macrostore routine or by an EVAO instruction. If a long distance is active, then the contents of location >0004 must be decremented by 2 and then loaded into WR 14 so that after returning with an RTWP ( > 0380), the PC will point to the start of the string of lOOs and/or LOSs. Since an interrupt caused the Macrostore routine to be exited, the interrupt vector will be taken immediately upon return to main memory via the RTWP instruction. Upon returning back to Macrostore from the interrupt(s), the PC will be initialized with the value at the time of Macrostore exit thus restarting the Macrostore routine. 107 The long-distance flags are automatically cleared if the exit from Macroatore is performed by executing the >0380 or >0382 form of RTWP but are NOT cleared If >0384 Is executed. The long-distance flags are also automatical- ly cleared after the instruction following the LDD or LOS has been completed. Note that the long-distance flags have no effect on the PSEL output during Macrostore accesses. Pm always represents the complemented value of ST8 when executing out of Macrostore memory space. Note if an SOP or DOP bus status code is output while in Macrostore, it will cause PSEL to flip if the corresponding LDD or LOS is active. 8.4 TMS99110A FLOATING POINT INSTRUCTIONS The floating point package of the TMS9911 OA provides flosting point operations. The general method is to load the Floating Point Accumulator (FPAC - RO,R1 of user's workspace) with one operand, perform the desired operation, and then store the result found in the FPAC (see examples below). The floating point instructions are only available to the TMS99110A when the processor is initialized in standard mode (Section 7.2.4.1). When in prototyping mode, the ex- ecution of these opcodes will cause a trap to external Macrostore memory space for user defined opcodes. The user should avoid the use of these opcodes to prevent possible conflicts with future TMS9911 OA floating point capability. When in baseline mode, execution of these opcodes will cause a level 2 illegal opcode interrupt. The following is the general format of a floating point number: o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3rd Digit 4th Digit Where: Sgn - Sign ofthe number, 0 = Pos, 1 = Neg Exponent- Exponent (radix 16) of the number+>40 (e.g., for the mantissa to be raised to the 2nd power, expo- nent would be 2+>40 = >42) Digits 1-6 - Mantissa of the number (in hex). NOTE: The TMS9911,OA anuma, tha decimal point pl_ to be prior to the flrat digit of the mantleA. It aleo a_a. that the number Ie a floating poll number and not zero, the flrat digit II non-zero. If a floating zero II to be rep,...nted, tha axponent should aleo be cleared (eat to 001. Otharwll error. could result. TABLE B.2 - TMS991 lOA FLOATING POINT FUNcnoNS AR Add Reel to FPAC SR Subtrect Real to FPAC MR Multiply Raal to FPAC DR Divide Reel to FPAC LR Loed Real into FPAC STR Store Real from FPAC NEGR Negate Real In FPAC CR Compere Reals general source/dest CIR Convert Integer to Real generel source to FPAC CER Convert Extended Integer to Real in FPAC CRI Convert Real to Integer in FPAC CRE Convert Reel to Extended Integer in FPAC MM Multiply Multiple (32 bit Integer x 32 bit Integer = >64 bi general source/destination To perform a floating pointfunction, the package uses RO and R1 of the user's workspace as a floating point accumulator. All floating point operations (except for MM and CR) use the FPAC. To load the accumulator use the LR instruction or manually move the desired operand into RD-R1. To store a result, the STR instruction could be used or the number could be manually moved out (see example below). EXAMPLE 1~ALTERNATE METHODS OF A SIMPLE OPERATION LR *R4 Load FPAC MOV*R4,RO MOV @2(R41.RO ARR5 Do Add Read ARR5 STR@ANS Store Answer MOVRO.@ANS MOVR1.@ANS+2 108 EXAMPLE 2-A MORE INVOLVED FLOAnNG POINT SEQUENCE Suppose the following equation was to be evaluated and a 'lowest value calculated' parameter replaced if the result was even smaller. V1 * ( - V2 - CONSTANT) V3. (V4 + 2.) Assuming the parameters were already off in memory some place, the following would be a possible solution. (Note addressing modes) LI RO,2 LOAD INTEGER 2 INTO FRAC (hi word only) CIR RO CONVERT IT TO REAL (register direct) AR *R2 ADD DENOMINATOR TERM V4 (indirect) MR ·R3+ MULTIPLY DENOMINATOR TERM V3 (indirect auto-inc) STR RS STORE TEMP RESULT (register direct) LR @CONST GET CONSTANT (symbolic) CER CONVERT EXTENDED INTEGER TO REAL (FPAC content) NEGR NEGATE FPAC CONTENTS SR @OFFSET(R4) SUBTRACT NUMERATOR TERM V2 (indexed) MR "R5 MULTIPLY NUMERATOR TERM VI (indirect) DR RS DO THE DIVISION (indirect) CR RO,@LOW COMPARE VS LOWEST (direct & symbolic) JGT LOOP JUMP IF NOT LOWER (OR EQUAL) STR @LOW STORE NEW LOWEST (symbolic) LOOP •••••• (etc.etc.etc.) B.4.1 Dual-Operand Floating Point Instructions with Multiple Addressing Modes for the Source Operand (9911 OA only) General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: I0 o o o OPCODE Ts S The addressing mode for the source operand is determined by the Ts field. Ts S ADDRESSING MODE NOTES 0 0,1, ••. ,15 Workspace register 1 0,1, ... ,15 Workspace register indirect 2 0 Symbolic 2 1,2, ... ,15 Indexed 1 3 1,2, ... ,15 Workspace register indirect autoincrement 1,2 NOTES: 1. Workspace register 0 may not be used. 2. The workspace register is incremented by 4. RESULT STATUS OPCODE COMPARED BITS MNEMONIC 4&6789 MEANING TOO AFFECTED DESCRIPTION AR 110001 Add Real Yes 0-4 FPAC + (SA,SA+2) _FPAC SR 110011 Subtract Real Yes 0-4 FPAC - (SA,SA+2) -FPAC MR 110100 Multiply Real Yes 0-4 (SA,SA+2)· FPAC -FPAC DR 110101 Divide Real Yes 0-4 FPAC I (SA,SA+2) -FPAC LR 110110 Load Real Yes 0-2 (SA,SA+2) - FPAC STR 110111 Store Real Yes 0-2 FPAC -ISA,SA+2) CIR· 110010 Convert Int to Real Yes 0-4 Real Representation of (SA)- FPAC • CIR is actually a single operand function; however. its operand is pointed to by SA. not necessarily the FPAC. 109 1.4.2 Single-operand Floating Point In8tructions General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: o o o o o ·0 o o o o o OPCD o OPCODE RESULT STATUS 11 COMPARED BITS MNEMONIC 34 MEANING TOO AFFECTED DESCRIPTION CRI 00 Convert Real to Int Vea G-4 Int Repr8Hntation of FPAC - FPAC NEGR 01 Negate Real Vea 0-2 - FPAC-FPAC CRE 10 Convert Real to Ext Int Vea G-4 Ext Int R.~ntation of FPAC- FPAC CER 11 Convert Ext Int to Reel Vea G-4 Real R~tation of FPAC - FPAC 1.4.3 Dual-Operand floating Point ln8tructlona with Multiple Add......ng Modaa for the Source and De8tinatlon Operands General o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Format: I~ o o o o o o o Td 0 D o o o Ts 0 I I OPCODE s The addressing mode for the operands is determined by the Tx fields ex being either D or 5). Tx X ADDRESSING MODE NOTES 0 0.1 •...• 15 WorkIpace registar 1 0.1 •...• 15 WorkIpace regietar indirect 2 0 SymboUc 2 1.2•.•.• 15 Indexed 1 3 1.2•..•• 15 WorkIpace register Indirect autoinc..-nt 1.2 NOTES: 1. Warkapac:e regia18r 0 may not be UI8d. 2. The workepace register is Incremented by 4 unllll X- 0 andopcode -0010IMM) In which _ the workepace register is incremented by 8. OPCODE RESULT STATUS 1111 COMPARED BITS MNEMONIC 234& MEANING TOO AFFECTED DESCRIPTION CR 0001 Compare Reala No G-4 (SA.SA+2) - (DA.DA+2)SetSta- MM 0010 Multiply Multiple Vea G-4 tus (SA.SA+2) . (DA.DA+2) - (DA.DA + 2.DA + 4. DA + 6) (Un- signed.lnteger) 110 B.4.4 Status Bit Summary for Floating Point Instructions The following table summarizes the conditions that set the status register bits during execution of floating point instruc- tions. TAILE B.3 - ADDITIDNS FOR THE 99110 VERSION CONDITION TO SET BIT TO 1 BIT NAME INSTRUCTION (OTHERWISE SET TO 01 STO Logically AR,SR,MR, If result is not 0 greater than DR,LR,STR, NEGR,CIR, CER,CRI, CRE,CR MM Cleared unconditionally STl Arithmetic AR,SR,MR If MSB of result = 0, greater than DR,LR,STR and result is not 0 NEGR,CIR, CER,CRI, CRE CR If (SA) > IDAl MM Cleared unconditionally ST2 EquallTB AR,SR,MR If result = 0 Indicator DR,LR,STR, NEGR,CIR, CER,CRI, CRE,MM CR If (SAl = IDAl ST3 Carry out LR,STR,NEGR Unaffected AR,SR,MR,DR If exponential overflow occurs MM,CR Cleared unconditionally CIR,CER Set unconditionally CRI,CRE If real source cannot be represented if the format selec- ted ST4 Arithmetic LR,STR,NEGR Unaffected Fault AR,SR,MR,DR If exponential over/underflow occurs MM,CR, Cleared unconditionally CIR,CER CRI,CRE If real source cannot be represented if the format selec- ted ST5- All Floating Unaffected ST15 Point Instructions 111/112 TEXAS INSTRUMENTS November 1982 Post Office B(), 144 3 Houston Texas 77001 MP009 Semiconductor Group Printed in U .S.A .