^r Texas Instruments TMS34010 User's Guide 1988 Graphics Products TMS34010 User's Guide * Texas Instruments IMPORTANT NOTICE Texas Instruments (Tl) reserves the right to make changes to or to discontinue any semiconductor product or service identified in this publication without notice. Tl advises its customers to obtain the latest version of the relevant in- formation to verify, before placing orders, that the information being relied upon is current. Tl warrants performance of its semiconductor products to current specifica- tions in accordance with Tl's standard warranty. Testing and other quality control techniques are utilized to the extent Tl deems necessary to support this warranty. Unless mandated by government requirements, specific testing of all parameters of each device is not necessarily performed. Tl assumes no liability for Tl applications assistance, customer product design, software performance, or infringement of patents or services described herein. Nor does Tl warrant or represent that license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellec- tual property right of Tl covering or relating to any combination, machine, or process in which such semiconductor products or services might be or are used. Copyright © 1988, Texas Instruments Incorporated Contents Section Page 1 Introduction 1-1 1.1 TMS34010 Overview 1-2 1 .2 Key Features 1-3 1 .3 Architectural Overview 1-4 1.3.1 TMS34010 Block Diagram 1-5 1.3.2 Other Special Processing Hardware 1-7 1 .4 Typical Applications 1-8 1.5 Manual Organization 1-9 1.6 Related Documentation, References, and Suggested Reading 1-11 2 Pin Functions 2-1 2.1 Pinout and Pin Descriptions 2-2 2.2 Host Interface Bus Signals 2-5 2.3 Local Memory Interface Signals 2-7 2.4 Video Timing Signals 2-9 2.5 Hold and Emulator Interface Signals 2-10 2.6 Power, Ground, and Reset Signals 2-11 3 Memory Organization 3-1 3.1 Memory Addressing 3-2 3.2 Memory Map 3-4 3.3 Stacks 3-6 3.3.1 System Stack 3-6 3.3.2 Auxiliary Stacks 3-9 4 Hardware-Supported Data Structures 4-1 4.1 Fields 4-2 4.2 Pixels 4-6 4.2.1 Pixels in Memory 4-6 4.2.2 Pixels on the Screen 4-7 4.2.3 Display Pitch 4-10 4.3 XY Addressing 4-11 4.3.1 XY-to- Linear Conversion 4-12 4.4 Pixel Arrays 4-15 5 CPU Registers and Instruction Cache 5-1 5.1 General- Purpose Registers 5-2 5.1.1 Register File A 5-2 5.1.2 Register File B 5-3 5.1.3 Stack Pointer 5-4 5.1.4 Implied Graphics Operands 5-5 5.2 Status Register 5-18 5.3 Program Counter 5-19 5.4 Instruction Cache 5-20 5.4.1 Cache Hardware 5-20 5.4.2 Cache Replacement Algorithm 5-21 5.4.3 Cache Operation 5-22 in 5.4.4 Self- Modifying Code 5-23 5.4.5 Flushing the Cache 5-23 5.4.6 Cache Disable 5-24 5.4.7 Performance with Cache Enabled versus Cache Disabled 5-24 5.5 Internal Parallelism 5-25 6 I/O Registers 6-1 6.1 I/O Register Addressing 6-2 6.2 Latency of Writes to I/O Registers 6-4 6.3 I/O Registers Summary 6-5 6.3.1 Host Interface Registers 6-7 6.3.2 Local Memory Interface Registers 6-8 6.3.3 Interrupt Interface Registers 6-8 6.3.4 Video Timing and Screen Refresh Registers 6-9 6.4 Alphabetical Listing of I/O Registers 6-10 7 Graphics Operations 7-1 7.1 Graphics Operations Overview 7-2 7.2 Pixel Block Transfers 7-4 7.2.1 Color-Expand Operation 7-5 7.2.2 Starting Corner Selection 7-7 7.2.3 Interrupting PixBlts and Fills 7-8 7.3 Pixel Transfers 7-10 7.4 Incremental Algorithm Support 7-10 7.5 Transparency 7-11 7.6 Plane Masking 7-12 7.7 Pixel Processing 7-15 7.8 Boolean Processing Examples 7-17 7.8.1 Replace Destination with Source 7-18 7.8.2 Logical OR of Source with Destination 7-18 7.8.3 Logical AND of NOT Source with Destination 7-18 7.8.4 Exclusive OR of Source with Destination 7-18 7.9 Multiple- Bit Pixel Operations 7-19 7.9.1 Examples of Boolean and Arithmetic Operations 7-19 7.9.2 Operations on Pixel Intensity 7-22 7.10 Window Checking 7-25 7.10.1 W=1 Mode- Window Hit Detection 7-26 7.10.2 W=2 Mode- Window Miss Detection .7-27 7.10.3 W=3 Mode- Window Clipping 7-27 7.10.4 Specifying Window Limits 7-28 7.10.5 Window Violation Interrupt 7-29 7.10.6 Line Clipping 7-29 8 Interrupts, Traps, and Reset 8-1 8.1 Interrupt Priorities and Vector Addresses 8-2 8.2 Interrupt Interface Registers 8-3 8.3 External Interrupts 8-3 8.4 Internal Interrupts 8-5 8.5 Interrupt Processing 8-6 8.5.1 Interrupt Latency 8-7 8.6 Traps 8-9 8.7 Illegal Opcode Interrupts 8-9 8.8 Reset 8-10 8.8.1 Asserting Reset 8-10 8.8.2 Suspension of DRAM- Refresh Cycles During Reset 8-11 IV 8.8.3 State of VCLK During Reset 8-11 8.8.4 Initial State Following Reset 8-11 8.8.5 Activity Following Reset ' 8-12 9 Screen Refresh and Video Timing 9-1 9.1 Screen Sizes 9-2 9.2 Video Timing Signals 9-3 9.3 Video Timing Registers 9-4 9.4 Relationship Between Horizontal and Vertical Timing Signals 9-5 9.5 Horizontal Video Timing 9-6 9.6 Vertical Video Timing 9-8 9.6.1 Noninterlaced Video Timing 9-9 9.7 Display Interrupt 9-13 9.8 Dot Rate 9-14 9.9 External Sync Mode 9-15 9.9.1 ATwo-GSP System ' 9-15 9.9.2 External Interlaced Video 9-17 9.10 Video RAM Control 9-18 9.10.1 Screen Refresh 9-18 9.10.2 Video Memory Bulk Initialization 9-26 10 Host interface Bus 10-1 10.1 Host Interface Bus Pins 10-2 10.2 Host Interface Registers 10-2 10.3 Host Register Reads and Writes 10-4 10.3.1 Functional Timing Examples 10-5 10.3.2 Ready Signal to Host 10-8 10.3.3 Indirect Accesses of Local Memory 10-11 10.3.4 Halt Latency 10-19 10.3.5 Accommodating Host Byte-Addressing Conventions 10-20 10.4 Bandwidth 10-22 10.5 Worst-Case Delay 10-23 11 Local Memory Interface 11-1 1 1 .1 Local Memory Interface Pins 11-2 1 1 .2 Local Memory Interface Registers 11-3 1 1 .3 Memory Bus Request Priorities 11-4 1 1 .4 Local Memory Interface Timing 11-5 1 1 .4.1 Local Memory Write Cycle Timing 11-7 11.4.2 Local Memory Read Cycle Timing 11-8 11.4.3 Local Register-to- Memory Cycle Timing 11-9 11.4.4 Local Memory- to-R egister Cycle Timing 11-10 11.4.5 Local Memory RAS-Only DRAM Refresh Cycle Timing 11-11 11.4.6 Local Memory CAS- before- R AS DRAM Refresh Cycle Timing 11-12 11.4.7 Local Memory Internal Cycles 11-13 11.4.8 I/O Register Access Cycles 11-13 11.4.9 Read- Modify-Write Operations 11-15 11.4.10 Local Memory Wait States 11-16 11.4.11 Hold Interface Timing 11-18 11.4.12 Local Bus Timing Following Reset 11-22 11.5 Addressing Mechanisms 11-23 11.5.1 Display Memory Hardware Requirements 11-24 11.5.2 Memory Organization and Bank Selecting 11-25 1 1 .5.3 Dynamic RAM Refresh Addresses 1 1 -25 11.5.4 An Example- Memory Organization and Decoding 11-28 12 TMS34010 Instruction Set 12-1 12.1 Style and Symbol Conventions 12-2 1 2.2 Addressing Modes and Operand Formats 1 2-4 12.2.1 Immediate Values and Constants 12-4 12.2.2 Absolute Addresses 12-5 12.2.3 Register- Direct Operands 12-6 12.2.4 Register- Indirect Operands 12-7 12.2.5 Register-Indirect with Offset 12-8 12.2.6 Register-Indirect with Postincrement 12-9 12.2.7 Register-Indirect with Predecrement 12-10 12.2.8 Register- Indirect in XY Mode 12-11 12.3 Instruction Set Summary Table 12-12 12.4 Arithmetic, Logical, and Compare Instructions 12-19 12.5 Move Instructions Summary 12-20 12.5.1 Register-to- Register Moves 12-20 12.5.2 Value-to- Register Moves 12-20 12.5.3 XY Moves 12-20 12.5.4 Multiple- Register Moves 12-21 12.5.5 Byte Moves 12-21 12.5.6 Field Moves 12-22 12.6 Graphics Instructions Summary 12-26 12.6.1 Comparing a Point to a Window 12-26 12.6.2 Converting an XY Address to a Linear Address 12-26 12.6.3 Drawing a Pixel and Advancing to the Next Pixel Address 12-26 12.6.4 Draw a Line 12-26 12.6.5 Filling a Pixel Block 12-26 12.6.6 Moving a Single Pixel 12-27 12.6.7 Moving a Two- Dimensional Block of Pixels 12-27 12.6.8 Implied Operands 12-28 12.7 Program Control and Context Switching Instructions 12-29 12.7.1 Subroutine Calls and Returns 12-29 12.7.2 Interrupt Handling 12-29 1 2.7.3 Setting, Saving, and Restoring Status Information 1 2-29 12.7.4 Jump Instructions 12-30 12.8 Shift Instructions 12-32 12.9 XY Instructions 12-33 12.10 Alphabetical Reference of Instructions 12-34 13 Instruction Timings 13-1 13.1 General Instructions 13-2 13.1.1 Best Case Timing - Considering Hidden States 13-2 1 3.1 .2 Other Effects on Instruction Timing 1 3-3 13.2 MOVE and MOVB Instructions 13-4 13.2.1 Moves Between Registers and Memory 13-5 13.2.2 Memory- to- Memory Moves 13-6 13.2.3 MOVE Timing Example 13-8 13.3 FILL Instructions 13-10 13.3.1 FILL Setup Time 13-10 13.3.2 FILL Transfer Timing 13-11 13.3.3 FILL Timing Examples 13-14 13.3.4 Interrupt Effects on FILL Timing 13-17 13.4 PIXBLT Instructions 13-18 13.4.1 PIXBLT Setup Time 13-18 13.4.2 PIXBLT Transfer Timing 13-20 VI 13.4.3 PIXBLT Timing Examples 13-26 13.4.4 The Effect of Interrupts on PIXBLT Instructions 13-30 13.5 PIXBLT Expand Instructions 13-31 13.5.1 PIXBLT Setup Time 13-31 13.5.2 PIXBLT Transfer Timing 13-32 13.5.3 PIXBLT Timing Examples 13-37 13.5.4 The Effect of Interrupts 13-40 A TMS34010 Data Sheet A-1 B System Design Considerations B-1 C Software Compatibility with Future GSPs C-1 D Glossary D-1 VII Illustrations Figure Page 1 -1 System Block Diagram 1-4 1 -2 Internal Architecture Block Diagram 1-5 2-1 TMS3401 Pinout (Top View) 2-2 2-2 TMS34010 Major Interfaces 2-3 3-1 Logical Memory Address Space 3-2 3-2 Physical Memory Addressing 3-3 3-3 TMS3401 Memory Map 3-4 3-4 System Stack 3-7 3-5 Stack Operations 3-8 3-6 An Auxiliary Stack that Grows Toward Lower Addresses 3-10 3-7 An Auxiliary Stack that Grows Toward Higher Addresses 3-11 4-1 Field Storage in External Memory 4-2 4-2 Field Alignment in Memory 4-3 4-3 Field Insertion 4-5 4-4 Pixel Storage in External Memory 4-7 4-5 Mapping of Pixels to Monitor Screen 4-7 4-6 Configurable Screen Origin 4-8 4-7 Display Memory Dimensions 4-9 4-8 Display Memory Coordinates 4-9 4-9 Pixel Addressing in Terms of XY Coordinates 4-11 4-10 Concatenation of XY Coordinates in Address 4-12 4-1 1 Conversion from XY Coordinates to Memory Address 4-13 4-1 2 Pixel Array 4-15 5-1 Register File A 5-2 5-2 Register File B 5-3 5-3 Stack Pointer Register 5-4 5-4 Status Register 5-18 5-5 Program Counter 5-1 9 5-6 TMS34010 Instruction Cache 5-20 5-7 Segment Start Address 5-21 5-8 Internal Data Paths 5-25 5-9 Parallel Operation of Cache, Execution Unit, and Memory Interface 5-26 6-1 I/O Register Memory Map 6-2 6-2 Correlation Between SRFADR and Logical Address Bits 6-18 6-3 Correlation Between DPYADR Bits and Row/Column Addresses 6-18 7-1 Color-Expand Operation 7-6 7-2 Starting Corner Selection 7-7 7-3 Transparency 7-11 7-4 Read Cycle With Plane Masking 7-13 7-5 Write Cycle With Transparency and Plane Masking 7-14 7-6 Graphics Operations Interaction 7-1 6 7-7 Examples of Operations on Single- Bit Pixels 7-17 7-8 Examples of Boolean and Arithmetic Operations 7-19 7-9 Examples of Operations on Pixel Intensity 7-22 7-10 Specifying Window Limits 7-28 7-1 1 Outcodes for Line Endpoints 7-30 7-12 Midpoint Subdivision Method 7-31 8-1 Vector Address Map 8-2 9-1 Horizontal and Vertical Timing Relationship 9-5 VIII 9-2 Horizontal Timing 9-6 9-3 Horizontal Timing Logic - Equivalent Circuit 9-7 9-4 Example of Horizontal Signal Generation 9-7 9-5 Vertical Timing for Noninterlaced Display 9-8 9-6 Vertical Timing Logic - Equivalent Circuit 9-9 9-7 Electron Beam Pattern for Noninterlaced Video 9-9 9-8 Noninterlaced Video Timing Waveform Example 9-10 9-9 Electron Beam Pattern for Interlaced Video 9-11 9-10 Interlaced Video Timing Waveform Example 9-12 9-1 1 External Sync Timing - Two GSP Chips 9-16 9-1 2 Screen -Refresh Address Registers 9-1 9 9-1 3 Logical Pixel Address 9-21 9-14 Screen -Refresh Address Generation 9-22 10-1 Equivalent Circuit of H ost I nterface Control Signals 10-4 10-2 Host 8-Bit Write with HCS Used as Strobe 10-5 10-3 Host 8- Bit Read with H CS Use d as Strobe 10-6 10-4 Host 16- Bit Read with HREAD U sed as Strobe 10-6 10-5 Host 16-Bit Write with HWRI T E Used as Strobe 10-7 10-6 Host 16- Bit Write with HL"DS , HUPS Used as Strobes 10-7 10-7 Host 16-Bit Read with HLDS, HUDS Used as Strobes 10-8 1 0-8 Host Interface Timing - Write Cycle With Wait 10-10 1 0-9 Host Interface Timing - Read Cycle With Wait 10-10 10-10 Host Indirect Read from Local Memory (INCR = 1) 10-13 10-11 Host Indirect Write to Local Memory (INCW=1) 10-15 10-12 Indirect Write Followed by Two Indirect Reads (INCW=1, INCR=0) 10-16 10-13 Calculation of Worst-Case Host Interface Delay 10-23 1 1 -1 Triple Multiplexing of Addresses and Data 11-5 11-2 Row and Column Address Phases of Memory Cycle 11-6 1 1 -3 Local Bus Write Cycle Timing 11-7 1 1 -4 Local Bus Read Cycle Timing 11-8 1 1 -5 Local Bus Register-to- Memory Cycle Timing 11-9 11-6 Local Bus Memory-to- Register Cycle Timing 11-10 11-7 Local Bus RAS-Only DRAM-Refresh Cycle Timing 11-11 11-8 Local Bus CAS - before -R AS DRAM-Refresh Cycle Timing 11-12 1 1 -9 Local Bus Internal Cycles Back to Back 11-13 11-10 I/O Register Read Cycle Timing 11-14 11-11 I/O Register Write Cycle Timing 11-15 11-12 Local Bus Read Cycle with One Wait State 11-16 11-13 Local Bus Write Cycle with One Wait State 11-17 11-14 Local Bus Register-to- Memory Cycle with One Wait State 11-18 11-15 TMS3401 Releases Control of Local Bus 11-19 11-16 TMS3401 Resumes Control of Local Bus 11-21 11-17 Local Bus Timing Following Reset 11 -22 11-18 External Address Format 1 1 -23 11-19 Row Address for DRAM-Refresh Cycle 11-27 1 1 -20 Address Decode for Example System 11 -28 1 1 -21 Display Memory Dimensions for the Example 11 -29 12-1 An Example of immediate Addressing 1 2-4 12-2 An Example of Absolute Addressing 1 2-5 12-3 An Example of Register- Direct Addressing 12-6 12-4 An Example of Register- Indirect Addressing 12-7 12-5 An Example of Register- Indirect with Offset Addressing 12-8 12-6 An Example of Register- Indirect with Postincrement Addressing 12-9 12-7 An Example of Register- Indirect with Predecrement Addressing 12-10 12-8 Register-to- Memory Moves 12-23 12-9 Memory-to- Register Moves 12-24 IX 12-10 Memory-to- Memory Moves 12-25 12-11 Implied Operand Setup for LINE Timing Example 12-10 12-12 LINE Timing Example 12-10 12-13 LINE Examples 12-10 1 3-1 Field Alignments in Memory 1 3-4 1 3-2 Source Data, Alignment G 1 3-8 1 3-3 Destination Location, Alignment E 1 3-8 1 3-4 Pixel Block Alignment in X 13-11 1 3-5 Pixel Block Alignments 13-12 13-6 Implied Operand Setup for FILL Example 13-14 13-7 FILL XY Timing Example 13-15 1 3-8 Pixel Block Alignment in X 1 3-21 1 3-9 Pixel Block Alignments 1 3-22 1 3-1 Source to Destination Alignments 1 3-23 1 3-1 1 Implied Operand Setup for PIXBLT Timing Examples 1 3-26 1 3-1 2 PIXBLT XY,L Timing Example 1 3-27 1 3-1 3 Pixel Block Alignment in X 1 3-33 1 3-1 4 Pixel Block Row Alignments 1 3-34 13-15 Implied Operand Setup for PIXBLT- Expand Examples 13-37 1 3-1 6 PIXBLT B,XY Timing Example 1 3-38 Tables Table Page 1 -1 Typical Applications of the TMS3401 1-8 2-1 Pin Descriptions 2-3 2-2 Host Interface Signals 2-5 2-3 Local Bus Interface Signals 2-7 2-4 Video Timing Signals 2-9 2-5 Hold and Emulator Interface Signals 2-10 2-6 Power, Ground, and Reset Signals 2-11 5-1 B-File Registers Summary 5-5 5-2 Definition of Bits in Status Register 5-18 5-3 Decoding of Field-Size Bits in Status Register 5-19 5-4 Instruction Effects on the PC 5-19 6-1 I/O Registers Summary 6-5 7-1 Boolean Pixel Processing Options 7-1 5 7-2 Arithmetic (or Color) Pixel Processing Options 7-15 8-1 Interrupt Priorities 8-2 8-2 External Interrupt Vectors 8-4 8-3 Interrupts Associated with Internal Events 8-5 8-4 Six Sources of Interrupt Delay 8-8 8-5 Sample Instruction Completion Times 8-8 8-6 Illegal Opcodes Ranges 8-9 8-7 State of Pins During a Reset 8-11 9-1 Programming GSP #2 For External Sync Mode 9-16 9-2 Screen -Refresh Latency 9-25 10-1 Host Interface Register Selection 10-2 1 0-2 Five Sources of Halt Delay 1 0-20 10-3 Sample Instruction Completion Times 10-20 1 0-4 Host Interface Estimated Bandwidth 1 0-22 11-1 Priorities for Memory Cycle Requests 11-4 12-1 Instruction Set Symbol and Abbreviation Definitions 12-2 1 2-2 Summary of Move Instructions 1 2-20 1 2-3 Summary of Operand Formats for the MOVB Instruction 1 2-21 1 2-4 Summary of Operand Formats for the MOVE Instruction 1 2-22 12-5 Summary of Operand Formats for the PIXT Instruction 12-27 1 2-6 Summary of Array Types for the PIXBLT Instruction 1 2-27 1 2-7 Implied Operands Used by Graphics Instructions 1 2-28 1 2-8 Condition Codes for JRcc and J Ace Instructions 1 2-31 1 2-9 Summary of XY Instructions 1 2-33 12-10 LINE Transfer Timing 12-10 1 2-1 1 Per- Word Timing Values for Pixel Processing (P) 12-10 1 3-1 MOVE and MOVB Memory-to-Register Timings 13-5 1 3-2 MOVE and MOVB Register-to- Memory Timings 13-6 1 3-3 Alignment Indices for Memory-to- Memory Moves 1 3-6 1 3-4 MOVE Memory-to- Memory Timings 1 3-7 13-5 FILL Setup Time 13-10 1 3-6 FILL Transfer Timing 13-11 1 3-7 Timing Values per Word for Graphics Operations (G) 13-13 13-8 PIXBLT Setup Time 13-18 1 3-9 PIXBLT Transfer Timing 1 3-20 1 3-1 Timing Values per Word for Graphics Operations (G) 1 3-24 1 3-1 1 PIXBLT Expand Setup Time 1 3-32 13-12 PIXBLT Expand Transfer Timing 13-32 13-13 Timing Values per Word for Graphics Operations (G) 13-36 B-1 Loading B-2 XI XH Section 1 Introduction The TMS34010 Graphics System Processor (GSP) is an advanced 32-bit microprocessor, optimized for graphics systems. The TMS34010 is a member of the TMS340 family of computer graphics products from Texas Instruments. A single TMS34010 provides a cost-effective solution in applications that re- quire efficient data manipulation. The TMS34010 can be configured to serve in either a host-based or a stand-alone environment. Systems based on mul- tiple TMS34010 devices are implemented using special features of the TMS34010's local and host interfaces. The TMS34010 is well supported by a full set of hardware and software de- velopment tools, including a full-speed emulator, a software simulator, an IBM -PC development board, a C compiler, predeveloped software libraries, and assembly language tools. Topics covered in this introductory section include: Section Page 1.1 TMS34010 Overview 1-2 1.2 Key Features 1-3 1.3 Architectural Overview 1-4 1.4 Typical Applications 1-8 1.5 Manual Organization 1-9 1.6 Related Documentation, References, and Suggested Reading 1-11 1-1 Introduction - TMS34010 Overview 1.1 TMS34010 Overview The TMS3401 combines the best features of general-purpose processors and graphics controllers to create a powerful and flexible Graphics System Pro- cessor. Key features of the TMS34010 are its speed, high degree of pro- grammability, and efficient manipulation of hardware-supported data types such as pixels and two-dimensional pixel arrays. The TMS34010's unique memory interface reduces the time needed to per- form tasks such as bit alignment and masking. The 32-bit architecture sup- plies the large blocks of continuously-addressable memory that are necessary in graphics applications. TMS34010 system designs can take advantage of video RAM (such as the TMS4461 ) technology to facilitate applications such as high-bandwidth frame buffers; this circumvents the bottleneck often en- countered when using conventional DRAMs in graphics systems. The TMS34010 instruction set includes a full complement of general-purpose instructions, as well as graphics functions, from which you can construct ef- ficient high-level functions. The instructions support arithmetic and Boolean operations, data moves, conditional jumps, and subroutine calls and returns. The TMS34010 architecture supports a variety of pixel sizes, frame buffer sizes, and screen sizes. On-chip functions have been carefully selected so that no functions tie the TMS34010 to a particular display resolution. This en- hances the portability of graphics software, and allows the TMS34010 to adapt to graphics standards such as MIT's X, CGI/CGM, GKS, NAPLPS, PHIGS, and evolving industry and display management standards. 1-2 Introduction - Key Features 1.2 Key Features • Fully programmable 32-bit general-purpose processor • 1 28-megabyte address range • Instruction cycle times: 132 ns (TMS3401 0-60) 160 ns (TMS3401 0-50) 200 ns (TMS3401 0-40) • On-chip peripheral functions include: Programmable CRT control (horizontal sync, vertical sync, and blanking) Direct interfacing to conventional DRAMs and multiport video RAMs Automatic CRT display refresh Direct communications with an external (host) processor Instruction set includes special graphics functions such as pixel processing, XY addressing, and window clip/hit Programmable 1, 2, 4, 8, or 16-bit pixel size with 16 Boolean and 6 arithmetic pixel-processing options 30 general-purpose 32-bit registers 256-byte on-chip instruction cache Dedicated 8/16-bit host- processor interface and HOLD/HLDA interface 32-bit and 64-bit integer arithmetic High-level language support Full line of hardware and software development tools including: - C compiler - Macro assembler - Linker - Archiver - Software application libraries XDS (Extended Development Support) in-circuit emulator Software development board (SDB) ROM utility - Simulator - Symbolic debugger 68-pin PLCC package 5-V CMOS technology 1-3 Introduction - Architectural Overview 1.3 Architectural Overview Figure 1-1 illustrates the TMS34010's major internal functions and its inter- faces to external devices. The on-chip processor executes both graphics in- structions and general-purpose instructions. The TMS34010 is a true 32-bit processor, with 32-bit internal data paths, a 32-bit ALU, and a large address space. Thirty 32-bit general-purpose registers, a 32-bit stack pointer, and a 256-byte instruction cache increase performance. Nonprocessor functions included on the chip include CRT timing, screen refresh, and DRAM refresh. Separate physical interfaces are provided for communicating with a host pro- cessor, for providing the video timing signals necessary to control a CRT monitor, and for connecting directly to dynamic RAMs (like the TMS4256 or TMS4C1024) and video RAMs (such as the TMS4461 ). Graphics System Processor Chip Boundary To Host < Prooessor <•:•:•: Host Bus ::•:• > Figure 1-1. System Block Diagram 1-4 Introduction - Architectural Overview 1.3.1 TMS34010 Block Diagram External interrupt Requests Reset Host Interface Bus Syne and Blanking Figure 1 -2 illustrates the internal architecture of the TMS34010; the following subsections describe the individual blocks shown in Figure 1 -2. r-Mf |T I I I I >« . V . I I II I I I I l I I I I I l I I l I I I I I ■— I/O Registers Interrupt Registers Host Interface Registers Video Timing Registers Looal Memory Control Registers Instruction Cache i2 Program Counter 5tatu8 Register ALU Barrel Shifter Register File A Register File B Stack Pointer Execution Unit Local Memory Control Loglo and Buffers =ff Local Memory Interface Bus Instruction Decode Mlorocontrol ROM Internal Clook J"^ 0utpute Circuitry ^ c , ook 1 l Inputs Clook Figure 1-2. Internal Architecture Block Diagram 1.3.1.1 CPU Internal Functions The center portion of Figure 1 -2 highlights the main internal functions of the TMS34010: • The 32-bit program counter (PC) points to the next instruction word to be fetched. The PC's four LSBs are always 0. Section 5.3 (page 5-18) discusses the program counter. • The 32-bit status register (ST) specifies the status of the TMS3401 processor. It contains the sign, carry, zero, overflow, interrupt enable, and PixBIt execution status bits. It also specifies the lengths and field extension modes of fields and 1. Section 5.2 (page 5-17) discusses the status register. 1-5 Introduction - Architectural Overview • Register files A and B each contain 15 general-purpose registers, A0-A14 and B0-B14, respectively. The B-file registers are also used as implied operands for the graphics instructions. Section 5.1 (page 5-2) discusses the register files. The general -purpose register files are dual ported to support parallel data movement. Two separate internal buses route data from the registers to the ALU, and a third bus routes results back to the registers. • The stack pointer, or SP, is available to instructions that operate on either register file. • The 32-bit barrel shifter shifts or rotates 32-bit operands from 1 to 32 bit positions in a single machine state. • The 32-bit ALU is connected to the other CPU components by 32-bit data paths. This allows most register-to-register operations to be per- formed in a single machine state. (Accessing external memory requires a minimum of two states.) The following actions occur in parallel during a single state: 1) Two operands are transferred from the selected general-purpose register file to the ALU. 2) The ALU performs the specified operation on the operands. 3) The result is routed back to the general -purpose register file. 1.3.1.2 Instruction Cache The TMS34010 contains a 256-byte instruction cache that can contain up to 128 instruction words (an instruction word may be an entire single-word in- struction or 16 bits of a multiple-word instruction). Section 5.4 (page 5-19) describes instruction cache operation. 1.3.1.3 I/O Registers Twenty-eight 16-bit, on-chip I/O registers are dedicated to peripheral control functions. The I/O registers are divided into four categories: • Seven local memory interface registers are dedicated to memory interface control and configure the memory controller. • Fourteen video timing and screen refresh registers generate the sync and blanking signals used to drive a CRT, and schedule screen - refresh cycles. • Five host interface registers are accessible to external host process- ors as well as to the TMS34010. Status information can be communi- cated directly through these registers. Large blocks of data in TMS34010 memory can be accessed indirectly through pointer registers. • Two interrupt control registers provide status information about interrupt requests. Section 6 provides individual descriptions of each I/O register. 1-6 Introduction - Architectural Overview 1.3. 1.4 Microcontrol ROM The TMS34010 transfers decoded instructions to the microcontrol ROM for interpretation. The microcontrol ROM has 166 control outputs and 808 mic- rostates. 1.3.1.5 Clock Timing Logic The clock timing logic converts the clock input signals to internal timing sig- nals and generates the clock output signals, LCLK1 and LCLK2, used by ex- ternal devices. The machine state is a fundamental time unit of the graphics processor in the TMS34010; it is the time interval during which the processor is in a particular microinstruction state. The instruction timing for each as- sembly language instruction is specified in multiples of machine states. The TMS34010's machine state is a single local clock period (the time from one LCLK1 low-to-high transition to the next) in duration. 1 .3.2 Other Special Processing Hardware The TMS34010 CPU also supports the following special processing functions in hardware: • Detecting whether a pixel lies within a specified display window • Detecting the leftmost one in a 32- bit register • Expanding a black-and-white pattern to a variable pixel-depth pattern 1-7 Introduction - Typical Applications 1.4 Typical Applications The TMS34010's 32-bit processing power and its ability to handle complex data structures make it well suited for a variety of applications. These include display systems, imaging systems, mass storage, communications, high-speed controllers, and peripheral processing. The TMS34010's efficient bit manip- ulation facilitates demanding tasks such as high-quality, proportionally- spaced text; this capability makes it especially useful in applications such as desktop publishing. In graphics display systems, the TMS34010 provides cost-effective performance for color or black-and-white bit-mapped displays. Table 1 -1 lists typical end uses of the TMS3401 0. Table 1-1. Typical Applications of the TMS34010 Computers Industrial Control - Terminals and CRTs - Robotics - Windowing systems - Process control - Electronic publishing - Instrumentation - Laser printers - Motor control - Personal computers - Navigation - Printers and plotters - Engineering workstations - Copiers Telecommunications - Document readers - FAX - Video phones - Imaging - PBX - Data processing Consumer Elect ronics - Automotive displays - Information terminals - Cable TV - Home control - Video games 1-8 Introduction - Manual Organization 1.5 Manual Organization The TMS34010 User's Guide describes TMS34010 operation, focusing on the TMS34010's role in applications that involve CRT-based, bit-mapped, graph- ics systems. The user's guide is divided into four major sections: 1 ) General information (Section 1 ) 2) Architecture (Sections 2-8) 3) Timing (Sections 9-1 1 ) 4) Instruction set (Sections 7, 12, and 13) A glossary, an index, and a reference card are also provided. Section 1 Introduction Provides an overview of the TMS34010 and TMS34010 architecture, includ- ing key features, a block diagram, and typical applications. Discusses manual organization and lists suggested reading. Section 2 Pin Functions Illustrates the TMS34010 pinout and contains general pin descriptions. Also describes specific pin functions regarding the host interface, the local bus in- terface, video timing signals, hold and emulator interface pins, and power, ground, and reset pins. Section 3 Memory Organization Discusses 32-bit addressing methods, the TMS34010 memory map, and the stack. Section 4 Hardware-Supported Data Structures Discusses hardware-supported data structures (such as fields and pixels) and XY addressing. Section 5 CPU Registers and Instruction Cache Describes general-purpose register files A and B (including a reference of the B registers' graphics functions), the status register, the program counter, and the instruction cache. Section 6 I/O Registers Provides a detailed discussion of host interface registers, memory- interface control registers, video timing and screen refresh registers, interrupt interface registers, and I/O register addressing. Includes an alphabetical reference of the I/O registers. Section 7 Graphics Operations Discusses graphics instructions such as PixBlts, PIXTs, and related topics such as 2-dimensional arrays of pixels, window checking, XY-to-linear conversion, and plane masking. Section 8 Interrupts, Traps, and Reset Describes external and internal interrupts, interrupt processing, and reset. 1-9 Introduction - Manual Organization Section 9 Screen Refresh and Video Timing Describes the horizontal sync, vertical sync, and blanking signals, horizontal and vertical timing, and video RAM control. Section 10 Host Interface Bus Discusses host interface pins, registers, and timing. Section 11 Local Memory Interface Bus Discusses local memory interface timing, addressing mechanisms, and data manipulation at the local memory interface. Section 12 Assembly Language Instruction Set Discusses addressing modes, summarizes MOVE, PIXBLT, and PIXT in- struction variations, and presents the entire TMS34010 assembly language instruction set in alphabetical order. Section 13 Instruction Timings Contains an overview of timing for general instructions, and specific timing information for move and graphics instructions. Appendix A TMS34010 Data Sheet Appendix B Emulation Guidelines for Prototyping Appendix C Software Compatibility with Future GSPs Appendix D Glossary 1-10 Introduction - Related Documentation, References, and Suggested Reading 1.6 Related Documentation, References, and Suggested Reading The following books and articles provide further background in graphics and system concepts associated with graphics. Artwick, Bruce A. Applied Concepts in Microcomputer Graphics. Englewood Cliffs, New Jersey: Prentice-Hall, 1984. Asal, Short, Preston, Simpson, Roskell, and Guttag. "The Texas Instruments 34010 Graphics System Processor." IEEE Computer Graphics and Appli- cations vol.6 no.10, pp. 24-39. Bresenham, J.E. "Algorithm for Computer Control of a Digital Plotter." IBM Systems Journal 4 No.1 (1965): 25-30. Bresenham, J.E. "A Linear Algorithm for Incremental Display of Digital Arcs." Communications of the ACM 20 (Feb. 1 977): 1 00-1 06. Cody, William J. Jr., and William Waite. Software Manual for the Elementary Functions. Englewood Cliffs, New Jersey: Prentice- Hall, 1980. Foley, James, and Andries van Dam. Fundamentals of Interactive Computer Graphics. Reading, Massachussetts: Addison -Wesley, 1982. Gupta, Satish. "Architectures and Algorithms for Parallel Updates of Raster Scan Displays." Tech. Report CMU-CS-82-1 1 1 , Computer Science Dept, Carnegie Mellon University, 1981. Ingalls, D.H. "The Smalltalk Graphics Kernel." Special issue on Smalltalk, Byte, August 1 981 , pp. 1 68-1 94. Kernighan, B., and D. Ritchie The "C" Programming Language. Englewood Cliffs, New Jersey: Prentice- Hall, 1978. Killebrew, C.R. Jr., "The TMS34010 Graphics System Processor." BYTE, De- cember 1 986, pp. 1 93-204. Kochan, Stephen G. Programming in C. Hasbrouck Heights, New Jersey: Hayden Book Company, 1 983. Newman, W.M., and R.F. Sproull. Principles of Interactive Computer Graphics. 2nd ed. New York: McGraw-Hill, 1979. Pike, Rob. "Graphics in Overlapping Bitmap Layers." ACM Transactions On Graphics 2 (April 1983): 135-160. Pinkham, R., M. Novak, and K. Guttag. "Video RAM Excels at Fast Graphics." Electronic Design, August 1 8, 1 983, pp. 1 61-1 68. Pitteway, M.L.V. "Algorithm for Drawing Ellipses or Hyperbolae with a Digital Plotter." Computer JournaHO (November 1967): 24-35. Porter, T. and T. Duff. "Composing Digital Images." Computer Graphics, July 1 984, pp. 253-259. Sproull, R.F. and I.E. Sutherland. "A Clipping Divider." Fall Joint Computer Conference Washington, DC: Thompson Books, 1 968. 1-11 Introduction - Related Documentation, References, and Suggested Reading Van Aken, Jerry R. "An Efficient Ellipse- Drawing Algorithm." IEEE Computer Graphics St Applications 4 (Sept. 1 984): 24-35. Wientjes, Guttag, and Roskell. "First Graphics Processor Takes Complex Or- ders to Run Bit- Mapped Displays." Electronic Design Vol. 34, No.2 (January 23, 1986): 73-80. The following TMS34010 documents are available from Texas Instruments. To obtain a copy of any of the Tl documents listed below, please call the Texas Instruments Customer Response Center (CRC) at 1 -800-232-3200. • The TMS34010 Application Guide (literature number SPVA007) is a collection of individual application reports. Each application report dis- cusses a specific TMS34010 application; for example, using a TMS34010 in a 51 2x51 2-pixel minimum-chip system, designing TMS34010- based systems that are compatible with various graphics standards, and interfacing the TMS3401 to a variety of host processors. • The TMS34010 Assembly Language Tools User's Guide (literature number SPVU004) tells you how to use the TMS34010 assembler, linker, archiver, object format converter, and simulator. • The TMS34010 C Compiler User's Guide (literature number SPVU005) tells you how to use the TMS34010 C compiler. This C compiler accepts standard Kernighan and Ritchie C source code and produces TMS34010 assembly language source code. We suggest that you use The C Programming Language (written by Brian W. Kernighan and Dennis M. Ritchie, published by Prentice- Hall) as a companion to the TMS34010 C Compiler User's Guide. • The TMS34010 Math/Graphics Function Library User's Guide (literature number SPVS006) describes a collection of mathematics and graphics functions that can be called from C programs. • The TMS34010 Software Development Board User's Guide (lit- erature number SPVU002) describes using the TMS34010 software de- velopment board (a high-performance, PC-based graphics card) for testing and developing TMS34010- based graphics systems. • The TMS34010 Software Development Board Schematics (liter- ature number SPVU003) is a companion to the TMS34010 Software Development Board User's Guide. • The TMS34010 Font Library User's Guide (literature number SPVU007) describes a set of fonts that are available for use in a TMS34010- based graphics system. 1-12 Section 2 Pin Functions This section discusses the TMS34010 pin functions. Section 2.1 contains a TMS34010 pinout, summarizes the pin functions, and categorizes the signals by function; Section 2.2 through Section 2.6 describe the functional catego- ries. Topics in this section include: Section Page 2.1 Pinout and Pin Descriptions 2-2 2.2 Host Interface Bus Signals 2-5 2.3 Local Memory Interface Signals 2-7 2.4 Video Timing Signals 2-9 2.5 Hold and Emulator Interface Signals 2-10 2.6 Power, Ground, and Reset Signals 2-11 2-1 Pin Functions - Pinout and Pin Descriptions 2.1 Pinout and Pin Descriptions The TMS34010 is packaged as a 68-pin plastic leaded chip carrier (PLCC). Figure 2-1 shows a pinout of the TMS34010 processor, and Table 2-1 sum- marizes the pin functions at each interface. Appendix A contains mechanical information. Q CN -- * l-l l-l — LADO ]10 LAD1 ]11 LAD2 ]12 LAD3 ]13 LAD4 ]u LAD5 ]15 LAD6 ]16 LAD7 ] 1 7 Vss ]l8 LAD8 ]19 LAD9 ] 20 LAD10 ]21 LAD11 ]22 LAD12 ]23 LAD13 ]24 LAD14]25 LAD15]26 LJLJLJL-ILJ 9 8 7 6 5 > UUL 4 3 2 1- o *- o , . < ICO CO CO CO W UJ Q CO LL li. U tr _i > I ill I I ll CO Q CJ D U X > I LJL-ILJI-II-H-ILJLJLJ 1 68 67 66 65 64 63 62 61 27 28 29 30 31 32 33 34 i-n-inr-iiif-ir-ii-! 35 36 37 38 39 40 41 42 43 f-n-ir-n-ir-ir-ni-ii-ii-i 60 C HDO 59[HD1 58 [ HD2 57 C HD3 56 C HD4 55[HD5 54 C HD6 53 C HD7 52 C V S S 51 [ HD8 50 [ HD9 49 C HD10 48 C HD11 47 [ HD12 46 C HD13 45 C HD14 44 C HD15 - 1 - 1 •^ u u CO I- |Z ICO |C0 WDb < < > O ID |CC |u Q O Figure 2-1. TMS34010 Pinout (Top View) As Figure 2-2 shows, the TMS34010's 68 pins are divided among several in- terfaces: Host interface 25 pins Local memory interface 29 pins Video timing interface 4 pins Hold and emulator interfaces 3 pins Power and reset 7 pins Total: 68 pins 2-2 Pin Functions - Pinout and Pin Descriptions Host Interface Video Timing Power, Ground and Reset \ 1^, „y) *=> »ES_ {= — s~^ =3-> HD0-HD15 LAD0-LAD15 HF60-HFS1 <■ n > HREAD HWRlT S HEPS HUBS* HRDY PINT VSYNC BCANK VCLK V CC V 86 RESET BER DDOUT DC R*B CAS W TR/Ql LRDY UNTl-DRTfe LCLK1 LCLK2 INCLK RoTD d£ „ Looal Memory ' Interface il Hold and Emulator Interfaces Figure 2-2. TMS34010 Major Interfaces Table 2-1. Pin Descriptions Host Interface Bus Pins Name Pin I/O Description TTC5 66 I Host chip select HD0-HD15 44-51,53-60 I/O Host bidirectional data bus HFS0,HFS1 67,68 I Host function select HTNT 42 Host interrupt request 63 I Host lower data select HLbS 62 I Host upper data select HUbS HRDY 43 Host ready 64 I Host read strobe HREAD 65 I Host write strobe HWRlTE 2-3 Pin Functions - Pinout and Pin Descriptions Table 2-1. Pin Descriptions (Concluded) Local Interface Bus Pins Name Pin I/O Description KS5 38 Local row-address strobe CSS 39 Local column-address strobe DDOUT 36 Local data direction out TJER 37 Local data enable LAD0-LAD1 5 10-17,19-26 I/O Local address/data bus DVL 34 Local address latched LCLK1.LCLK2 28,29 Local output clocks nRT1,ITRT2 6,7 I Local interrupt request pins LRDY 9 I Local ready TTT/GE 41 Local shift-register transfer or output enable W 40 Local write strobe INCLK 5 I Input clock Hold and Emulation Name Pin I/O Description HOLD 8 I Hold request RUN/tMU 2 I Run/Emulate HLDA/EMuA 33 Hold acknowledge or emulate acknowledge Video Timing Signals Name Pin I/O Description BLANK 32 Blanking HSVNC 30 I/O Horizontal sync VCLK 4 I Video clock VSYNC 31 I/O Vertical sync Power, Ground, and Reset Signals Name Pin I/O Description RESET 3 I Device reset v C c 27,61 I Nominal 5-volt power supply v S s 1,18,35,52 I Ground 2-4 Pin Functions - Host Interface Bus Signals 2.2 Host Interface Bus Signals The host interface pins are used for communication between the TMS34010 and a host processor. Signals output on these pins are assumed to be asyn- chronous with respect to local clocks LCLK1 and LCLK2. To software running on a host processor, the TMS34010's host interface appears as a peripheral device containing a block of four 16-bit registers. Table 2-2 describes the host interface pins. Section 6 describes the host interface registers, and Sec- tion 10 discusses host interface operation. Table 2-2. Host Interface Signals Signal I/O Description iTCs" I Host Chip Select. HCS is driven active low to enable access to the 1 6-bit host interface register that is selected by HFSO and HFS1. During the low-to-high transition of RESET, the level on the HCS input determines whether the TMS34010 is halted (if HCS is high), or begins immediately executing its reset service routine (it HCS is low). In the second case, the HCS and RESET pins may be tied directly together. HFSO, HFS1 I Host Function Select. HFSO and HFS1 determine which of the four 16-bit host interface registers is selected during a read or write cycle that is initiated by the host processor. HFS1HFS0 Register Description HSTADRL LSBs of pointer address 1 HSTADRH MSBs of pointer address 1 H ST DATA Data buffer register 1 1 HSTCTL Control register I HREAD Host Read Strobe. HREAD is driven active low during a read cycle that is initiated by the host processor. This enables the contents of the selected host interface register to be output on HD0-HD15. HREAD should not be active low at the same time that HWRITE is active low. I HWRITE Host Write Strobe. HWRITE is driven active low during a write cycle that is initiated by the host processor. This enables the contents of HD0-HD15 to be written to the selected host interface register. HWRITE should not be active low at the same time that HREAD is active low. I HLDS Host Lower Data Select. HLDS is driven active low during a read or write cycle that is initiated by the host. This enables the lower byte (bits 0-7) of the selected host interface register to be accessed. I HUDS Host Upper Data Select. HUDS is driven active low during a read or write cycle that is initiated by the host processor. This enables the upper byte (bits 8-1 5) of the selected host interface register to be accessed. In systems that do not use the host interface, it may be desirable to pull these inputs up to the level. 'CC 2-5 Pin Functions - Host Interface Bus Signals Table 2-2. Host Interface Signals (Concluded) Signal I/O Description HRDY Host Ready. HRDY indicates when the TMS34010 is ready to complete a read or write cycle that is initiated by the host. Except during an access of a host interface register, HRDY is always high. HRDY is driven low if the host pro- cessor attempts to initiate an access of a host interface register before the TMS34010 has had sufficient time to complete all processing resulting from an access initiated previously by the host. HRDY always goes low briefly at the start of a HSTCTL register access. When HRDY is driven low, the host must wait to complete the access until HRDY is again driven high. While HCS is high, HRDY is driven high. HINT Host Interrupt Request. HINT follows the INTOUT bit in the HSTCTL reg- ister; it is typically used to transmit interrupt requests from the TMS3401 to the host processor. When INTOUT is set to 1 by the TMS34010, HINT is driven active low. HINT remains active low until the host writes a to INTOUT, at which time HINT becomes inactive high. HD0-HD15 I/O Host Bidirectional Data Bus. The host data pins, HD0-HD15, form a bidi- rectional 16-bit bus which is used to transfer data between the selected 16-bit host interface register and the host processor. HDO is the LSB and HD1 5 is the MSB. 2-6 Pin Functions - Local Memory Interface Signals 2.3 Local Memory Interface Signals The TMS3401 uses the local bus interface pins to communicate with external memory and with memory-mapped I/O devices. The signals at this interface are used directly to control DRAMs (dynamic RAMs) and VRAMs (video RAMs). Section 11 discusses local memory interface operation. Table 2-3. Local Bus Interface Signals Signal I/O Description DEN Local Data Enable. DEN is an active- low output; it drives the active- low output-enable inputs on the bidirectional transceivers (such as the 74ALS245) which are used to buffer data input and output on the LAD0-LAD15 pins. External buffering may be required on the LAD0-LAD15 pins when the TMS34010 is interfaced to a large number of local memory devices. DDOUT Local Data Direction Out. DDOUT drives the direction control inputs on the bidirectional transceivers (such as the 74ALS245) which are used to buf- fer data input and output on the LAD0-LAD15 pins. External buffering may be required on the LAD0-LAD15 pins when the TMS34010 is interfaced to a large number of local memory devices. During write cycles, DDOUT is driven high to enable data to be output from the LAD0-LAD15 pins while DEN is driven active low. During read cycles, DDOUT goes low to enable data to be input to the LAD0-LAD15 pins while DEN is driven active low. At all other times, DDOUT remains driven to the default high level. LAL Local Address Latched. An external latch can use the high-to-low transi- tion of LAL to capture the column address from the LAD0-LAD1 5 pins. When a transparent latch such as a 74ALS373 is used, the address remains latched as long as LAL remains active low. RAS Local Row Address Strobe. The RAS output drives the RAS inputs of DRAMs and VRAMs. CA5 Local Column Address Strobe. The CAS output drives the CAS inputs of DRAMs and VRAMs. W Local Write Strobe. The active-low W output drives the W inputs of DRAMs and VRAMs. W can also be used as the active-low write enable to static memories and other devices connected to the TMS3401 local interface. During a local memory read cycle, W remains inactive high while CAS is strobed active low. During a local memory write cycle, W is strobed active low while CAS is low. During shift-register-transfer cycles, the state of W indicates whether the transfer is from shift register to memory (W is low) or memory to shift register (W is high). At all other times, W is driven to the default high level. Tr/Oe Local Shift Register Transfer or Output Enable. This pin connects di- rectly to a VRAM's Tr/Ge (or DT/0"1) pin. During local memory read cycles, the Tr/QI pin functions as an active-low output enable to gate data from memory to the LAD0-LAD15 pins. During VRAM shift- register-transfer cy- cles, TR/CTF is driven active low during the high-to-low transition of RAS. INCLK I Input Clock. INCLK is the input clock used to generate the LCLK1 and LCLK2 outputs, to which all processor functions in the TMS34010 are syn- chronous. A separate input clock, VCLK, controls the video timing registers. 2-7 Pin Functions - Local Memory Interface Signals Table 2-3. Local Bus Interface Signals (Concluded) Signal I/O Description LCLK1.LCLK2 Local Output Clocks. These two output clocks, 90 degrees out of phase with each other, provide convenient synchronous control of external circuitry to the TMS34010's internal timing. All clocked signals output from the TMS34010, with the exception of the CRT timing signals, are synchronous to these clocks. LRDY I Local Ready. LRDY is driven low by external circuitry to inhibit the TMS34010 from completing a local memory cycle it has initiated. While LRDY remains low, the TMS34010 continues to wait. When LRDY is again driven high, the TMS34010 completes the cycle. While LRDY is low, the TMS34010 generates internal wait states in increments of one full LCLK1 cycle in duration. LRDY can be driven low to extend local memory read and write cycles, shift- register-transfer cycles, and DRAM refresh cycles. During internal cycles, the TMS34010 ignores LRDY. LffiTl,LTRT2 I Local Interrupt Request Pins. Interrupt requests from external devices are transmitted to the TMS34010 on the LINT1 and LINT2 pins. Each pin activates the request for one of two external interrupt request levels. An external device generates an interrupt request by driving the appropriate interrupt request pin to its active-low state. The pin should remain active low until the TMS34010 has recognized the request. Transitions on the two interrupt request pins are assumed to be asynchronous with respect to local clocks LCLK1 and LCLK2; the signals on these pins are synchronized internally before being used internally. LAD0-LAD15 I/O Local Address/Data Bus. LAD0-LAD15 form the local multiplexed address/data bus. At the start of a memory cycle, two addresses (row and col- umn) are output on LAD0-LAD15. During a read cycle, data are input on LAD0-LAD15 during the latter part of the cycle. During a write cycle, data are output on LAD0-LAD15 during the latter part of the cycle. LADO is the LSB, and LAD15 is the MSB. During the time the row address is output on LADO-LAD14, status bit RT is output on LAD15. RF is active low at the start of a DRAM-refresh cycle (either RAS-only or CAS-before-RAS). During the time that the column address is output on LAD0-LAD13, status bits TR and IAQ are output on LAD15 and LAD14, respectively. IAQ is active high during a read cycle in which the TMS34010 fetches an instruction word from the local me- mory. During all other cycles, IAQ is inactive low. TR is active low during shift-register-transfer cycles. (The level output on LAD14 during the high- to-low transition of CAS is always the same as the level output on TR/flE during the high-to-low transition of RAS.) Notes: 1 ) The system designer must ensure that LRDY is not held low for so long that the TMS3401 is prevented from performing the necessary number of DRAM refresh cycles or is prevented from refreshing the display by performing a VRAM memory-to-shift-register cycle during horizontal retrace; 2) The operation of LINT1 and LINT2 is affected by the RUN/EMU pin. Make sure this pin is in the proper state. 2-8 Pin Functions - Video Timing Signals 2.4 Video Timing Signals The video timing signals (BLANK, HSYNC, and VSYNC) control the horizontal and vertical sweep rates of the video monitor. They also synchronize the dis- play on the monitor to video data that is output from the VRAMs. Section 9 discusses video timing and screen refresh operations. Table 2-4. Video Timing Signals Signal I/O Description I/O HSYNC Horizontal Sync. HSYNC is the horizontal sync signal used to control external video circuitry. It is programmed as either an input or an output by means of two control bits in the DPYCTL register. When configured as an output, the active-low horizontal sync signal is generated by the TMS34010's on-chip vi- deo timers. When configured as an input, the TMS3401 synchronizes its video timers to externally-generated horizontal sync pulses. Immediately following reset, HSYNC is configured as an input. I/O VSYNC Vertical Sync. VSYNC is the vertical sync signal used to control external video circuitry. It is programmed as either an input or an output by means of a control bit in the DPYCTL register. When configured as an output, the active-low ver- tical sync signal is generated by the TMS34010's on-chip video timers. When configured as an input, the TMS34010 synchronizes its video timers to exter- nally-generated vertical sync pulses. Immediately following reset, VSYNC is configured as an input. BLANK Blanking. BLANK is a composite blanking signal used to turn oft the electron beam of a CRT during both horizontal and vertical retrace intervals. This signal may also be used to control the starting and stopping of the VRAM shift regis- ters. VCLK 1 Video Clock. VCLK is derived from the dot clock of the external video system and is used internally to drive the TMS34010's video timing logic. The signals output at the BLANK, HSYNC, and VSYNC pins are synchronous to VCLK. VCLK is not required to have any timing relationship with respect to INCLK; that is, VCLK and INCLK can be asynchronous. In order to read HCOUNT and VCOUNT registers reliably, VCLK should be held high during the read. In sys- tems which do not use the video timing registers or require automatic screen refreshing, VCLK can be strapped high. Note: The operation of HSYNC and VSYNC is affected by the RUN/EMU pin. Make sure this pin is in the proper state. 2-9 Pin Functions - Hold and Emulator Interface Signals 2.5 Hold and Emulator Interface Signals The TMS34010 hold interface permits other devices to request and be granted control of the local interface bus. The emulator interface is used to control the TMS34010 when it is used for emulation. The RUN/emU pin may remain unconnected in nonemulation ap- plications. Table 2-5. Hold and Emulator Interface Signals Signal I/O Description i HOLD Hold Request. The HOLD pin is driven active low by an external device to signal a request that the TMS3401 release ownership of the local memory bus. Once the TMS34010 has acknowledged the hold request via a hold acknowl- edge signal, the external device assumes ownership of the bus. The device must continue to assert its hold request until it has released the bus. HLDA/EMUA Hold Acknowledge and Emulate Acknowledge. The HLDA/EMUA pin is multiplexed between two functions: (1) acknowledgment of hold requests and (2) acknowledgment of emulation requests. The hold acknowledge signal (HLDA) is output during phases U3 and Q4 ot the local clock cycle. The emulate acknowledge signal (EMUA) is output during phases Q1 and Q2. HLDA is driven active low in response to a hold request from an external device, but not until the TMS34010 has released the bus to the re- questing device. The device must delay taking possession of the bus until it has received an active HLDA signal. Once an active-low hold acknowledge signal has been transmitted during Q3-Q4, it will continue to be transmitted during Q3-Q4 of each local clock period until the external device ceases to as- sert its hold request. EMUA is driven active low to indicate to external circuitry that the TMS3401U has halted in response to an EMU command input on the RUN/EMU pin. HLDA/EMUA is also driven low when an EMU opcode is executed by the TMS34010, but only during phases Q1 and Q2 of a single LCLK1 cycle. Exe- cution of an EMU opcode causes an active-low signal to be output at the HLDA/EMUA pin during phases Q1 and Q2, so external devices that generate hold requests should avoid interpreting these signals as hold acknowledgment. run/Emu I Run/Emulate. This pin is defined as a no-connect during normal system op- eration. The RUN/EMU pin should not be pulled low except during factor testing or chip emulation. An internal pull-up load permits RUN/EMU to remain unconnected during normal use. It RUN/EMU is pulled low, RESET, LINT1, LINT2, HSYNC, and VSYNC are recon- figured to perform special functions used only during emulation and factory testing. 2-10 Pin Functions - Power, Ground, and Reset Signals 2.6 Power, Ground, and Reset Signals Six TMS34010 pins are dedicated to ground and power supply. Section 8 provides more details about reset. Table 2-6. Power, Ground, and Reset Signals Signal I/O Description v C c I Vcc (2 pins). Two +5-volt power supply inputs. v S s I Vss (^ pins). Four electrical ground inputs. I RESET Reset. RESET is pulled low to reset the device during normal operation. While RESET is asserted low, the internal registers of the TMS34010 are set to an initial known state, and all output and bidirectional pins are driven ei- ther to inactive levels or to high impedance. The behavior of the TMS3401 chip following reset depends on the level of the HCS input just prior to the low-to-high transition of RESET. It HCs is low, the I MS34U1U begins exe- cuting the instructions pointed to by the reset vector. If HCS is high, the TMS34010 is halted until a host processor writes a to the HLT bit in the HSTCTL register. Transitions on the RESET pin are assumed to be asynchronous with respect to local clocks LCLK1 and LCLK2; the signal input on this pin is synchro- nized internally before it is used internally. 2-11 Pin Functions 2-12 Section 3 Memory Organization This section presents details of physical and logical addresses, illustrates the TMS34010 memory map, and describes stack operation. Section Page 3.1 Memory Addressing 3-2 3.2 Memory Map 3-4 3.3 Stacks 3-6 3-1 Memory Organization - Memory Addressing 3.1 Memory Addressing The TMS34010 is a bit-addressable machine with a 32-bit internal memory address. The total memory capacity is four gigabits (or 512 megabytes); the TMS34010 supports external addressing of 128 megabytes. Memory is accessed as a continuously addressable string of bits. Each 32-bit address points to an individual bit within memory. Groups of adjacent bits form data structures called fields. A field is specified by its starting bit ad- dress and its length. The TMS34010 supports field lengths from 1 to 32 bits. Bit addresses range from OOOOOOOOh to OFFFFFFFFh. Figure 3-1 illustrates the logical memory structure. 32-Blt Logical Address Memory Bit 232-1 TTT Bit Bit Bit N+1 N N-1 n Bit Bit 1 Figure 3-1. Logical Memory Address Space Figure 3-2 illustrates physical memory organization. The TMS34010 com- municates with memory over a 16-bit data bus, and always reads or writes a complete 16-bit word from or to memory. A word accessed during a memory cycle always begins on an even 16-bit boundary; thus, the four LSBs of the 32-bit starting address of the word are Os. Bits within a word are numbered from to 1 5; bit 1 5 is the MSB and bit is the LSB. A word is identified by the address of its LSB. In this document, the LSB of a memory word is de- picted as the rightmost bit in the word. 3-2 Memory Organization - Memory Addressing 2 MSBS fr« 31 30 29 Not Used Externally Memory •32-Blt Logical Address - 26-Bit Physioal Address Word N+1 Word N 4 LSBs 4 3 Select Bit Boundary Within Word Word N-1 15 14 13 12 1110 9 8 7 6 5 4 3 2 10 MSB LSB Figure 3-2. Physical Memory Addressing The four LSBs of the 32-bit logical address in Figure 3-2 do not appear on the local memory bus. When the TMS34010 extracts a data structure that does not begin and end on even word boundaries, these four LSBs are used inter- nally to indicate a bit boundary within an accessed word. Control logic at the local memory interface automatically performs the bit alignment and masking necessary to extract a data structure from physical memory; this is completely transparent to software. If the data structure being extracted straddles word boundaries, multiple read cycles are required. Similarly, inserting a data structure into memory may require a series of read and write cycles, accom- panied by the internal masking and shifting of data to properly align the data structure within memory. The memory-control logic performs these tasks au- tomatically. The two MSBs of the 32-bit logical address are not output. The TMS34010 supports an external address range of 1 28 megabytes of physical memory. 3-3 Memory Organization - Memory Map 3.2 Memory Map Figure 3-3 illustrates the TMS34010 memory map. Memory is logically or- ganized as four gigabits, but is physically accessed 1 6 bits at a time. Locations are shown as 16-bit words, identified by 32-bit addresses whose four LSBs are Os. Word addresses range from OOOOOOOOh to FFFFFFFOh (bit address OOOOOOOOh is the rightmost bit in the word at the bottom of Figure 3-3, and bit address FFFFFFFFh is the leftmost bit in the word at the top.) Reading or writing to an address in the range COOOOOOOh to C00001 FOh accesses an internal I/O register. Reading or writing to any address outside this range accesses off-chip memory (or a memory-mapped device) external to the TMS34010. Address FFFF FFFO FFFF FCOO FFFF FBFO J7 FFFF EOOO FFFF DFFO COOO 2000 C0001FFO ^ COOO 0200 COOO 01 FO COOO 0000 BFFF FFFO 0000 0000 I Bit2 32 -1 (last bit in memory) 512 words 2: 64 words i Z 2 26 - 1024 words z 2 512 words 32 words 3 x 2 26 words !! -16 bits- Interrupt Vectors ^ Reserved General Use > Reserved Internal I/O Registers General Use ^BitO (first bit in memory) Figure 3-3. TMS34010 Memory Map As Figure 3-3 shows, memory is divided into several regions: • General use Addresses ranges Oh-BFFFFFFOh and C0002000h-FFFFDFF0h are for general use (executable code, data tables, etc.). • I/O registers Addresses C0000000h-C00001 FOh are reserved for the 16-bit I/O reg- isters. Section 6 discusses the I/O registers; it contains a map of this 3-4 Memory Organization - Memory Map memory area which associates each I/O register with the appropriate address. Interrupt, Reset, and Trap Vectors Addresses FFFFFCOOh-FFFFFFEOh are reserved for 32 interrupt, reset, and trap vectors. A vector is a 32- bit address that points to the starting location in memory of the appropriate interrupt, reset, or trap service routine. Each address is stored in physical memory as two consecutive 1 6-bit words, with the 16 LSBs at the lower address. Section 8 contains more information about interrupts and traps. Reserved memory Addresses C0000200h-C0001 FFOh are reserved for future expansion of the I/O registers. Addresses FFFFEOOOh-FFFFFBFOh are reserved for future expansion of the interrupt vectors. 3-5 Memory Organization - Stacks 3.3 Stacks The TMS34010's system stack is implemented in local memory and managed in hardware. The stack is used to store return addresses and processor status information during interrupts, traps, and subroutine calls. The contents of general-purpose registers can be pushed onto the stack and popped off the stack. The system stack can also be used for dynamically allocated data stor- age. The stack is accessed through a dedicated 32-bit internal register, called the stack pointer, or SP. The SP points to the top of the system stack; it can be accessed as register 1 5 in either register file. In addition to the system stack, you can define your own auxiliary stacks. The system stack always grows toward lower memory addresses; an auxiliary stack can be defined to grow toward either lower or higher addresses. The MOVE and MOVB instructions, combined with the automatic predecrement and postincrement addressing modes, facilitate pushing and popping auxiliary stack data. One or more registers in the A or B files can be used by software as auxiliary stack pointers and frame pointers. The indexed addressing modes can be used in conjunction with a frame pointer to access variables embedded within the stack. 3.3.1 System Stack Figure 3-4 shows the structure of the system stack, which grows in the di- rection of lower memory addresses. The SP points to the top of the stack; it contains the 32-bit address of the LSB (bit 0) of the value on top of the stack. The SP can contain any 32-bit ad- dress; however, stack operations execute more efficiently when the four LSBs of the SP are 0s. This aligns the SP to word boundaries in memory, reducing the number of memory cycles necessary to push values onto the stack or pop values off the stack. Any instruction that manipulates general-purpose registers (A0-A14 or B0-B14) can also be used to manipulate the SP. The SP can be specified as the source or destination operand in any instruction that operates on the general-purpose registers. Instructions that manipulate the SP include: Instructions that Push Instructions that Pop Values on the Stack Values from the Stack MMTM SP ', register list MMFM SP ', register list CALL Rs RETI CALLA absolute address RETS CALLR relative address POPST TRAP number MOVE *SP+, Rd PUSHST MOMERs, -*SP 3-6 Memory Organization - Stacks Memory a Highest Address Stack Bottom J4-32-H SP Lowest Address ■16- System > Stack Area Figure 3-4. System Stack 3.3.1.1 Saving Registers on the System Stack Register information can be stored on the stack during an interrupt or a sub- routine call. This frees up the register for use by an interrupt routine or a su- broutine, and allows you to restore the original register values from the stack when the routine finishes executing. During an interrupt, the contents of the PC and ST are automatically saved on the stack; if you want to save values that are in general-purpose registers, you can use the MMTM and MMFM instructions. MMTM pushes multiple general-purpose registers onto the stack, and MMFM pops multiple gener- al-purpose registers from the stack. When the contents of a 32-bit register are pushed onto the stack, they are stored in two consecutive 1 6-bit words. The 1 6 MSBs are stored at the higher memory address, and the 16 LSBs are stored at the lower address. This is shown in Figure 3-5, which demonstrates the effects of the following in- struction sequence: MMTM SP, AO ; Push register AO onto stack MMFM SP, Al ; Pop stack into register Al 3-7 Memory Organization - Stacks • Figure 3-5 a shows the original state of the stack and registers. • Figure 3-5 b illustrates the state after AO is pushed onto the stack. • Figure 3-5 c shows the result of popping the top of the stack into A1 )« 32- sp | /v-52~ Lowest Address - 1— 16 — 1 \» 32 — *>| Stack 0FE2h | N \— ■- Memory __A Stack .0123h_ "4567h" W-16 rV-32 m 16 — 1 h— 32 — i Stack 0FE2h General-Purpose Register File A m 32 *j AO 01234567h A1 89ABCDEFh tpp^j General-Purpose Register File A General-Purpose Register File A A C MMFM SP, Al J Figure 3-5. Stack Operations The TMS34010 performs two steps to push the contents of a 32-bit register onto the top of the stack: 1 ) Decrement the PC by 32. 2) Push the register contents onto the stack. The TMS34010 performs two steps to pop the top of stack into a 32-bit reg- ister: 1 ) Pop the 32 bits at the top of the stack into the register. 2) Increment the SP by 32. 3-8 Memory Organization - Stacks 3.3. 1.2 Saving Information On the System Stack During an Interrupt During an interrupt, the TMS34010 pushes the PC and ST onto the stack; this allows the interrupted routine to resume execution when the interrupt proc- essing is completed. An interrupt routine performs the following actions: 1 ) Decrement the SP by 32. 2) Push the PC onto the stack. 3) Decrement the SP again by 32. 4) Push the ST onto the stack. During a return from an interrupt: 1 ) Pop the 32 bits at the top of the stack into the ST. 2) Increment the SP by 32. 3) Pop the 32 bits at the top of the stack into the PC. 4) Increment the SP again by 32. 3.3. 1.3 Saving Information On the System Stack During a Subroutine Call A subroutine call saves the state of the calling routine on the stack; this allows the routine to resume execution when the subroutine completes. A subroutine call performs the following actions: 1 ) Decrement the SP by 32. 2) Push the PC onto the stack. During a return from a subroutine: 1 ) Pop the 32 bits at the top of the stack into the PC. 2) Increment the SP by 32. 3.3.2 Auxiliary Stacks Auxiliary stacks can be managed in software. Any A- or B-file register, except the SP, can be used as the auxiliary stack pointer. Auxiliary stacks are typically used to contain dynamically allocated data storage. In the following discussion, STK represents the auxiliary stack pointer. STK is a symbol that must be equated to one of the general-purpose registers; for example: STK .set AO The STK may contain any 32-bit value; however, stack operations execute more efficiently when the four LSBs of the STK are Os. This aligns the STK to word boundaries in memory, reducing the number of memory cycles nec- essary to push values onto the stack or pop values off the stack. As Figure 3-6 and Figure 3-7 show, the auxiliary stack can be configured to grow in either direction in memory. The memory is shown in these figures as a string of continuously addressable bits. 3-9 Memory Organization - Stacks 3.3.2.1 An Auxiliary Stack that Grows Toward Lower Addresses Figure 3-6 shows a stack that grows toward lower memory addresses: • Figure 3-6 a shows the original stack. • In Figure 3-6 b, a field of arbitrary size is pushed onto the stack with this instruction: MOVE Rs, *-STK (Rs and STK represent general-purpose registers.) • In Figure 3-6 c, the field is popped off the stack with this instruction: MOVE *STK-, Rd (Rd and STK represent general-purpose registers.) Between instructions, the STK always points to the lowest bit address in the stack - this corresponds to the very top of the stack. You can use the M MTM STK,register list instruction to save multiple registers on the stack in Figure 3-6. Later, you can restore the registers to their former values with an MMFM STKjegister list instruction. (a) (b) (o) Hlah Address Stack STK Stack Field 1 STK Stack Low. Address STK Figure 3-6. An Auxiliary Stack that Grows Toward Lower Addresses 3-10 Memory Organization - Stacks 3.3.2.2 An Auxiliary Stack that Grows Toward Higher Addresses Figure 3-7 shows a stack that grows toward higher memory addresses: • Figure 3-7 a shows the original stack. • In Figure 3-7 b, a field of arbitrary size is pushed onto the stack using the following instruction: MOVE Rs, *STK+ • In Figure 3-7 c, the field is popped off the stack with this instruction: MOVE *-S1K,Rd Between instructions, the STK always points to one plus the highest bit ad- dress in the stack - this location is one bit beyond the very top of the stack. (a) (b) High Addresses Stack STK Low. Addresses Stack __A__ Field I (e) STK Stack T STK Figure 3-7. An Auxiliary Stack that Grows Toward Higher Addresses 3-11 Memory Organization 3-12 Section 4 Hardware-Supported Data Structures The TMS34010 supports several data structures at the machine level: • Fields are configurable data structures whose length can be defined within the range 1 to 32 bits. Two field sizes can be defined simul- taneously. A field can begin and end at arbitrary bit addresses. • Bytes are a special case of field in which the field length is fixed at eight bits and is sign extended. Bytes can begin on any bit boundary within a word. • Pixels are configurable data structures; pixel length can be programmed to be 1, 2, 4, 8, or 16 bits (always a power of two). Pixels are aligned so that they do not cross word boundaries in memory. • Two-dimensional pixel arrays, or pixel blocks, are rectangular groups of pixels that are manipulated using the PIXBLT (pixel block transfer) and FILL (pixel block fill) instructions. A pixel array can be moved from one area of memory to another in a single PixBIt operation. It can be combined with another array of the same size by performing Boolean or arithmetic operations on the corresponding pixels of the two arrays. The number of bits in a pixel, field, or array is programmable, but byte length is fixed. Two field sizes and one pixel size can be specified simultaneously. The size and starting addresses of the pixel arrays that are manipulated during a PixBIt operation are specified by the values loaded into dedicated hardware registers. Topics in this section include: Section Page 4.1 Fields 4-2 4.2 Pixels 4-6 4.3 XY Addressing 4-11 4.4 Pixel Arrays 4-15 4-1 Hardware-Supported Data Structures - Fields 4.1 Fields The TMS34010 supports two software-configurable field types, field and field 1 . A field in memory is defined by two parameters: • Starting address and • Field size (1 to 32 bits) A field's starting address is the address of the field's LSB. A field can begin at an arbitrary bit address in memory. When a field is moved from memory to a general-purpose register, the field is right justified within the register; that is, the field's LSB coincides with the register's rightmost bit (bit 0). The reg- ister bits to the left of the field are all 1s or all Os, depending on the values of both the appropriate FE (field extension) bit in the status register, and the sign bit (MSB) of the field. If FE = 1, the field is sign extended; if FE=0, the field is zero extended. Field size can range from 1 to 32 bits. The lengths of fields and 1 are defined by two 5-bit fields in the status register, FSO and FS1 . Figure 4-1 illustrates a field in memory. In this example, the field straddles the boundary between words N and N+1 in memory. Field extraction and in- sertion is performed by on-chip hardware: • To move the field to a general-purpose register, the TMS34010 extracts the field from memory by reading word N and word N+ 1 in separate cycles. • To move the field from a general-purpose register, the TMS3401 inserts the field into memory by reading and writing word N, and reading and writing word N+1 . The memory operations necessary to insert or extract a field are performed automatically by special hardware, and are transparent to software. ■32-Blt Logical Address - 2 MSBs 31 30 26-Bit PhysloeJ Address 29 4 LSBS Memory \| 4 Word N+1 m Word N Field Size' Figure 4-1 . Field Storage in External Memory 4-2 Hardware-Supported Data Structures - Fields In Figure 4-1 , word N is pointed to by a 26-bit physical address output by the TMS34010 to memory. This 26-bit address corresponds to bits 4-29 of the field's 32-bit logical address. The four LSBs of the logical address point to the beginning of the field within word N. The number of memory cycles required to extract or insert a field depends on how the field is aligned in memory. Field manipulation is more rapid when fields are stored in memory so that they do not cross word boundaries. Figure 4-2 illustrates various cases of alignment and nonalignment of fields to word boundaries in memory. Given a field starting address and field length, the memory controller will recognize the specified field alignment as one of the seven cases in Figure 4-2. Field extraction and field insertion are performed in a manner that requires the minimum number of memory cycles. Case A E Word N I 16-Bit Field -H l Word N | ■ Field - Case B < | Word d N I -Field— »| Word N - Field - Case C Word N+1 Word N ■32-Blt Field- Case D Word N+1 - Field - Word N | ^r^ — Case E Word N+1 Case F | Word N+f Word N ■Field- - Field - Word N ==5T Case Q | Word N+2* ■F Word N+1 - Field - Word N Figure 4-2. Field Alignment in Memory Case A A 16-bit field is aligned on word boundaries. Field extraction requires a single read cycle, and field insertion requires a single write cycle. Cases B1-B3 The field length is less than 1 6 bits. • In Case B1, the field starting address is not aligned to a word boundary, although the end of the field coincides with the end of the word. • In Case B2, the field starting address is aligned to a word boundary, but the end of the field does not coincide with the end of the word. • In Case B3, the field length is 1 4 bits or less, and neither the start nor the end of the field is aligned to a word boundary. 4-3 Hardware-Supported Data Structures - Fields For Cases B1-B3, a field extraction requires a single read cycle. A field in- sertion requires the following sequence of memory cycles: 1 ) Read word N 2) Write word N Case C A 32-bit field is aligned on word boundaries. A field extraction requires the following sequence of memory cycles: 1 ) Read word N 2) Read word N+ 1 A field insertion requires the following sequence of memory cycles: 1 ) Write word N 2) Write word N+ 1 Case D The field size is greater than 16 bits. The field starting address is not aligned to a word boundary, but the end of the field coincides with the end of the word. A field extraction requires the following sequence of memory cycles: 1 ) Read word N 2) Read word N+ 1 A field insertion requires the following sequence of memory cycles: 1 ) Read word N 2) Write word N 3) Write word N+ 1 Case E The field size is greater than 1 6 bits. The field starting address is aligned to a word boundary, but the end of the field does not coincide with the end of the word. A field extraction requires the following sequence of memory cycles: 1 ) Read word N 2) Read word N+ 1 A field insertion requires the following sequence of memory cycles: 1 ) Write word N 2) Read word N+ 1 3) Write word N+ 1 Case F The field straddles the boundary between two words. Neither the start nor the end of the field is aligned to a word boundary. A field extraction requires the following sequence of memory cycles: 1 ) Read word N 2) Read word N+ 1 A field insertion requires the following sequence of memory cycles: 1 ) Read word N 2) Write word N 3) Read word N+ 1 4) Write word N+ 1 Case G The field size ranges from 1 8 to 32 bits, and the field straddles two word boundaries. Neither the start nor the end of the field is aligned to a word boundary. A field extraction requires the following sequence of memory cy- cles: 1 ) Read word N 2) Read word /V+ 1 3) Read word N+2 4-4 Hardware-Supported Data Structures - Fields A field insertion requires the following sequence of memory cycles: 1 ) Read word N 2) Write word N 3) Write word N+ 1 4) Read word N+2 5) Write word N+2 A field insertion modifies only the portion of a word that lies within a field. The TMS34010 memory controller must perform a read-modify-write opera- tion when a field that does not begin and end on even 1 6-bit word boundaries is to be written to memory. This occurs when the four LSBs of the address are not 0, or when the specified field size is a value other than 1 6 or 32. The memory controller uses these two parameters (address LSBs and field size) to produce a mask that identifies the bits in the word corresponding to the field. Hardware uses the mask to perform the read-modify-write cycle. The TMS34010's local memory control logic automatically generates the mask and executes the read-modify-write operation; this is transparent to software. Figure 4-3 shows an example of inserting a 5-bit field stored in a register to logical address 00000008h. In Figure 4-3 a, the field to be inserted is shown right-justified in the 16 LSBs of the designated general-purpose register. In b, memory controller hardware has rotated the field to align it with the destination in memory. In c, the TMS34010 reads the original word from the destination in me- mory. In d, the mask is generated to designate the bits to be modified. In e, the field is inserted into the word from memory, and the result is written back to the destination address in memory. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 (a) Field to be Inserted |XXXXXXXXXXXFFFFF~ (b) Rotate to align to bit 8 JXXXFFFFFXXXXXXXX (c) Initial destination data fAAAAAAAAAAAAAAAA (d) Mask generated |000111110000000o" (e) Final destination data JAAAFFFFFAAAAAAAa" Figure 4-3. Field Insertion In the more complex case in which a field straddles one or two word bound- aries in memory, the portion of the field lying within each word is inserted into that word using the methods described above. 4-5 Hardware-Supported Data Structures - Pixels 4.2 Pixels The term pixel has two meanings in the context of a TMS34010- based graphics system. Outside the TMS34010, a pixel is a picture element on a display surface. Inside the TMS34010, a logical pixel is a software- configurable data structure supported by the TMS34010 instruction set. The logical pixel data structure in TMS34010 memory contains the information needed to specify the attributes of a picture element visible on a screen. The information for a horizontal line of pixels on the screen is usually stored in consecutive words in memory. 4.2.1 Pixels in Memory Within TMS34010 memory, the pixel data structure is defined by two param- eters: • Starting address and • Pixel size A pixel's starting address is the address of the LSB of the pixel. Pixel size (the number of bits per pixel) is defined in the PSIZE register. A pixel can be 1 , 2, 4, 8, or 1 6 bits long. The TMS3401 treats pixels as a spe- cial case of a field in which the field size is constrained to be a power of two. However, pixels do not cross word boundaries within memory; they are aligned within memory so that an integral number of pixels is contained within the boundaries of a memory word. For example, a 2-bit pixel should begin at an even bit address whose LSB is 0, a 4-bit pixel should begin at a bit address whose two LSBs are 0s, and so forth. When a pixel is moved from memory to a general-purpose register, the pixel is right justified within the register. That is, the LSB of the pixel coincides with the rightmost bit (bit 0) of the register. Register bits to the left of the pixel are loaded with 0s. Figure 4-4 illustrates pixel storage in memory. The pixel is located within the word pointed to by the 26-bit physical address corresponding to bits 4-29 of the 32-bit logical address of the pixel. The four LSBs of the logical address specify the displacement of the pixel within the word. When the pixel length is less than 16, each word contains two or more pixels. Pixel extraction and insertion is performed by on-chip hardware in a manner that requires the minimum number of memory cycles. (The operations are transparent to the programmer.) In the worst case, two memory cycles (a read followed by a write) are required to insert a pixel of less than 1 6 bits. Inserting a 16-bit pixel requires a single write cycle, and extracting a pixel (1 to 16 bits) requires a single read cycle. 4-6 Hardware-Supported Data Structures - Pixels 32-Blt Logical Address - Memory Figure 4-4. Pixel Storage in External Memory 4.2.2 Pixels on the Screen Figure 4-5 illustrates the mapping of pixels from memory to a display screen. The screen refresh function outputs pixels in the sequence of ascending pixel addresses. However, the electron beam sweeps from the left edge of the screen to the right edge during each horizontal scan interval, so pixels appear on the screen in the opposite order of their representation in memory. That is, the least significant pixel (in terms of bit address) appears on the left, and the most significant pixel appears on the right. Memory Video Monitor Screen Word Word Word .Jhl—Ji—Jitt, ! ■••••! ] V**." Pixel Pixel Pixel Pixel 4N+3 4N+2 4N+1 4N Word N+1- -Word N- -*- ■Word N-1- Figure 4-5. Mapping of Pixels to Monitor Screen 4-7 Hardware-Supported Data Structures - Pixels The TMS34010 allows a pixel to be identified either in terms of its XY coor- dinates on the screen, or in terms of the address of the logical pixel in memory. These two methods are called XY addressing and linear addressing, re- spectively. When XY addressing is used, the origin can be selected to lie in either the upper left or lower left corner of the screen. The position of the origin is controlled by the ORG bit in the DPYCTL register. Figure 4-6 a illustrates the default coordinate system (ORG =0), in which the origin of the two coordinate axes is located in the upper left corner of the screen. Figure 4-6 b shows the alternate coordinate system (ORG = 1) in which the origin is located in the lower left corner of the screen. (a) -♦X R Default Screen Origin Monitor Screen (b) y_ Alternate Screen Origin Monitor Screen -♦X Figure 4-6. Configurable Screen Origin Using the default screen origin, Figure 4-7 illustrates the mapping of pixels from memory to the screen. In Figure 4-7, horizontal movement represents travel in the X direction on the screen. Vertical movement represents travel in the Y direction. The depth of the buffer represents the pixel size. The "on- screen memory" contains the pixels that appear on the screen. The display memory shown in Figure 4-7 is shown in terms of a "screen for- mat" rather than the "memory format" used in the memory map shown in Figure 3-3 on page 3-4. The screen format places the lowest pixel address at the upper left corner of the memory map. This is the same relative orien- tation in which pixels appear on the screen. Compare this to the memory format shown in Figure 3-3, which places the lowest bit address at the lower right corner of the memory map. This convention is frequently used in in- dustry to represent the relative location of addresses in memory. In this doc- ument, assume the standard memory format is used unless the screen format is indicated. Figure 4-8 illustrates the mapping of XY coordinates to the on-screen memory. For simplicity, assume that the screen origin coincides with the upper left 4-8 Hardware-Supported Data Structures - Pixels corner of the display memory. P represents the X extent of the display memory and N represents the Y extent. Each box represents a pixel within the memory. The number within the box represents the pixel's memory location, relative to the beginning of the on-screen memory. The number in the box is multiplied by the number of bits per pixel to produce the address offset of the pixel from the start of the display memory. Since the pixel size is constrained to be a power of two, the multiply can be replaced by a simple shift operation. -*x Display Memory -4- On-Soreen Memory Off-Screen Memory i i -X Extent- Y Extent *\ — Pixel Size (bite/pixel) Figure 4-7. Display Memory Dimensions Increasing Y -> Increasing X Y=0 Y=1 Y=2 Y=N-2 Y=N-1 X=0 X=1 X=2 X=3 X=P-2 X=P-1 1 2 3 p P+1 P+2 P+3 I 2P 2P+1 2P+2 2P+3 ) (N-2)P (N-DP (N-2)P ±1 (N-1)P (N-DP .±1 (N-2)P ±2 (N-2 .±2. r P-2 P-1 t 2P-2 2P-1 l 3P-2 3P-1 ) (N-DP (N-DP -1 1 NP-2 NP-1 Display Memory P = X Extent N = Y Extent v Each box contains a pixel. The number inside the box Is the pixel's XY address. Display Pitch = (X extent) x (pixel size) = Differences in 32-bit memory addresses of two vertically adjacent pixels Figure 4-8. Display Memory Coordinates 4-9 Hardware -Supported Data Structures - Pixels 4.2.3 Display Pitch The term display pitch refers to the difference in memory addresses between two pixels that appear in vertically adjacent positions (one directly above the other) on the screen. In Figure 4-8, the pitch is calculated as P times the pixel size, where P is the X extent of the display memory. The display pitch must be a power of two in order to support XY addressing of pixels on the screen. Linear addressing of pixels on the screen imposes fewer restrictions. In particular, the display pitch for linear addressing may be any value that is a multiple of 16; that is, the four LSBs of the address must be Os. Features such as automatic window checking are available with XY addressing, but are not available with linear addressing. The pitch of a pixel array is the difference in memory addresses of two verti- cally adjacent pixels in the array. If the array occupies a rectangular area of the screen, the array pitch is the same as the display pitch. During a pixel operation such as a PixBIt, the source and destination array pitches are specified in separate dedicated hardware registers. This facilitates the transfer of pixel arrays between on-screen and off-screen memory, which may have different pitches. A sample display pitch calculation is shown below. In this example, the pixel size is four bits and the X extent of the pixel display is 640 pixels. However, since XY addressing and windowing are to be used, the physical memory is organized so that there are 1024 pixels between successive scan lines. Thus, the X extent of physical display memory is 1024, and the display pitch is: Display Pitch = (1024 pixels/line) x (4 bits/pixel) - 4096 (which is 2 12 ) 4-10 Hardware-Supported Data Structures - XY Addressing 4.3 XY Addressing The TMS34010 allows pixel addresses to be specified in terms of two- dimensional XY coordinates that correspond to locations on the screen. This is referred to as XY addressing. XY addressing has several benefits: • TMS3401 software can be easily ported from one display configuration to another. System-dependent details such as the number of bits per pixel and the X extent of the display memory are transparent to the software, but are used by the machine to automatically convert the XY coordinates to the address of a pixel in memory. • XY addressing allows you to think in terms of the high-level concept of XY coordinates rather than in terms of the machine-level mapping of pixels into memory. • XY addressing facilitates such functions as window clipping. Figure 4-9 illustrates XY addressing format. The XY address is stored in a 32-bit general-purpose register. The X and Y components are each treated as 16-bit signed integers. The X component resides in the 16 LSBs of the register, and is right justified to bit of the register. The Y component occu- pies the 16 MSBs of the register, and is right justified to bit 16 of the register. XY coordinates in the range (-32768,-32768) to ( + 32767, + 32767) can be represented. The clipping window, which identifies the pixels that can be al- tered during drawing operations, is restricted to positive X and Y coordinate values, (0,0) to (+32767,+32767). Thus, pixels identified by negative X or Y coordinates must always lie outside the window. PIXEL AT (X,Y) Figure 4-9. Pixel Addressing in Terms of XY Coordinates 4-11 Hardware-Supported Data Structures - XY Addressing 4.3.1 XY-to-Linear Conversion The TMS34010 automatically converts a pixel's XY address to a 32-bit logical address (linear address) for all instructions that use XY addressing. Three parameters are used to perform XY-to- linear conversion: • The logical pixel size (stored in the PSIZE register) • A pitch conversion factor (stored in the CONVSP or CONVDP registers) • An offset defining the XY origin (stored in the OFFSET register) The TMS34010 uses the following formula to calculate the physical address associated with the XY address: Address = [(Y x display pitch) OR (X x pixel size)] + offset Since the display pitch and pixel size are both powers of two, the calculation is performed using only shift, OR, and add operations. Window clipping may be used to detect out-of-bounds (negative) X or Y values before this calcu- lation is performed. Linear addresses are formed from XY addresses by simply concatenating the binary numbers that represent the X and Y coordinate values, as shown in Figure 4-10. The number of 0s to the right of the X component of the address depends on the number of bits per pixel, and equals log2(pixel size). The displacement of the Y component within the 32-bit logical address in Figure 4-10 is equal to log2(display pitch). Finally, a 32-bit offset is added to the address in Figure 4-10 to calculate the address in memory of the pixel at co- ordinates (X,Y). The offset corresponds to the linear address in memory of the pixel at (0,0). ... ... MSB8 are 0s Y Component V X Component V LSBs are 0s Note: The shift value for the Y component is contained in CONVSP or CONVDP register, depending on the in- struction being executed. Figure 4-10. Concatenation of XY Coordinates in Address The TMS34010 uses the pitch conversion factors CONVSP and CONVDP to compute the displacement of the Y component within the address, as shown in Figure 4-1 0. The Y component is displaced from bit of the address by an amount equal to log2(pitch), which the hardware obtains by inverting the five LSBs of the appropriate CONVSP or CONVDP register. These values must be loaded through software before executing an instruction that uses XY addressing. CONVSP (source address pitch) is used if the XY address points to a source pixel or pixel array; CONVDP (destination address pitch) is used if the XY address points to a destination pixel or pixel array. The pixel size stored in the PSIZE register is used similarly to determine the displace- ment of the X component, as shown in Figure 4-10. 4-12 Hardware-Supported Data Structures - XY Addressing The OFFSET register contains the linear memory address of the pixel located at coordinates (0,0) on the monitor screen. The OFFSET register is used in translating XY coordinates into linear addresses, but does not control which region of the display memory is output to refresh the video screen. It is a vir- tual screen origin. It allows the coordinate axes of the XY address to be translated to an arbitrary position in memory. The OFFSET register supports the use of "window relative" addressing in which the X and Y coordinates are specified relative to coordinate offsets in the display memory. The position and size of a window can be specified arbitrarily. A new offset specified in terms of XY coordinates can be converted to a linear address using the CVXYL instruction. CVXYL converts an XY address to a linear address for the purpose of absolute memory addressing, or to use special features available to in- structions that use linear addressing. Figure 4-11 illustrates the XY-to-linear conversion process. 31 16 15 (a) Original XY address 000000 (b) Extract 1 6 LSBs and extend with 0s (c) Rotate X left by log2 (pixel size) (d) Extract 1 6 MSBs from original XY address C000000000000000000000 00000000000000000000 00 Y 0000000000000000 (e) Rotate Y left by 16 + log2 (vertical pitch) sign of y Y 000000000000 (f) Bitwise logical-OR together shifted X and Y components (g) Add offset from B4 to displacement above to get final memory address sign of y Y X 00 Memory Address Figure 4-11. Conversion from XY Coordinates to Memory Address Step a shows the original XY address. The X component is extracted in step b. In step c, the X component is shifted left by log2(pixel size). The result of step c represents the product of the X component and the pixel size. The Y component is extracted in step d. In step e, the Y component is rotated left by 16 + log2(display pitch). The result of step e is Y multiplied by the display pitch. In step f, the results of steps c and e are bitwise-ORed to form the dis- placement in memory of the pixel at (X,Y) from the pixel at the origin. In step G, the offset is added to produce the final memory address. he example of Figure 4-1 1 corresponds to a pixel size of four bits and a pitch of 4,096. The six MSBs of the X half of the XY address (bits 1 0-1 5) in Figure 4-11 must be Os to produce a valid memory address. For this example, the 4-13 Hardware-Supported Data Structures - XY Addressing clipping window should be set to disable writes to pixels having X coordinate values outside the range to +1 023. Generally, given a display with a pitch of 2 n , a valid memory address is pro- duced by the XY translation process shown in Figure 4-11 when only the n LSBs of the X half of the XY address are nonzero (that is, when the 16-/7 MSBs are 0). X values may be in the range -32768 to +32767 before clip- ping. However, after clipping, the X value should be a positive number in the range to (X extent -1), where X extent = pitch/pixel size. The TMS34010's automatic window clipping can be configured to clip pixels lying outside the window; hence, no software overhead is incurred in clipping. Y values lying outside the window are clipped in a similar fashion. 4-14 Graphics Operations - Pixel Arrays 4.4 Pixel Arrays A rectangular area of the screen that is DX pixels wide and DY pixels high is an example of a data structure called a two-dimensional pixel array. The array contains DX x DY pixels, but can be manipulated by the TMS34010 as one structure. The TMS34010's instruction set includes a powerful set of raster operations, called PixBlts, that manipulate pixel arrays on the screen and elsewhere in memory. Figure 4-12 shows a pixel array occupying a rectangular region in display memory. The DX pixels in each row of the array are packed together into ad- jacent cells in the display memory. Rows do not generally occupy adjacent areas of memory, but are separated from each other by a constant displace- ment called the array pitch. The array pitch is the difference in memory ad- dresses between the start of one row and the start of the row directly beneath it. In the Figure 4-12 example, the array pitch is equal to the display pitch. The product of the array width DX and the pixel size must be less than or equal to the pitch. Display Memory -»x Default Starting Address 2-Dlmenslonal Pixel Array I ■ k i i AY ' ^ _ AX = Pixels per row of array AY = Pixels per column of array Figure 4-12. Pixel Array A pixel array is specified in terms of its width, height, pitch, and starting ad- dress. The starting address is the address of the first pixel to be moved during a PixBlt. The default starting address is simply the base address of the array; that is, the address of the pixel that has the lowest address in the array. In Figure 4-1 2, the XY origin is located in its default position at the upper left corner of the screen. The default starting address is the address of the pixel located in the upper left corner of the array. When a PixBlt operation moves the pixels from a source pixel array to a destination array, the pixels in each row are moved in sequence from left to right, and the rows are moved in se- quence from top to bottom. 4-15 Graphics Operations - Pixel Arrays Certain PixBIt operations allow the starting pixel to be specified as one of the pixels in the other three corners of the array. This feature is provided so that when the source and destination arrays overlap, the appropriate starting corner can be selected to ensure that no data is lost by being overwritten during PixBIt execution. The order in which pixels in the array are moved can be al- tered to be from right to left or from bottom to top as appropriate to accom- modate the change in starting corner. The starting address of a pixel array can be specified either in terms of the XY coordinates of the starting pixel (XY address), or the memory address of the starting pixel (linear address): • An array whose starting location is specified as an XY address is referred to as an XY array. In this format, the starting location of the array is identified by the XY coordinates of the first pixel in the array. • A pixel array whose starting location is specified as a memory address is referred to as a linear array. In this format, the location of the array is identified by the memory address of the first pixel (the pixel that has the lowest bit address) in the array. The XY array format has two advantages. First, the starting location of the array is specified in system-independent Cartesian coordinates rather than as a system -dependent memory address. Second, the TMS34010's window checking (which allows it to automatically detect an attempt to write a pixel inside or outside a specified window) can only be used in conjunction with XY addressing. The linear format's main advantage is that the array pitch does not have to be a power of two. This supports a wider variety of memory organizations. Using XY format, the array pitch is constrained to be a power of two. The general rules governing array pitch are as follows. When an array is spe- cified in XY format, the pitch must be a power of two. The pitch for an array specified in linear format may be any multiple of 16; that is, the four LSBs of the pitch must be Os. There are a few important exceptions to the second rule which are discussed below. For the special case of a PIXBLT B,XY or PIXBLT B,L instruction, the source pitch may be any value. This feature supports efficient use of memory by al- lowing adjacent rows of the source array to be packed together with no in- tervening gaps. The destination pitch must still be a multiple of 1 6. Under certain conditions the linear source array specified for a PIXBLT L,XY or PIXBLT B,XY must have a pitch that is a power of two. This is necessary when the linear start address for the array has to be adjusted in the Y direction due to one of the following conditions: • The source array is automatically preclipped to lie within a rectangular window. • One of the lower two corners of the source array (refer to Figure 4-12) is selected to be the start address. 4-16 Graphics Operations - Pixel Arrays In either case, the start addresses specified for both the source and destination arrays are automatically adjusted, and for this purpose the conversion factors specified in the CONVSP and CONVDP registers must be valid. While PixBlts are useful for moving arrays from one area of the screen to an- other, they can also be used to move arrays to the screen from other parts of memory, and vice versa. The pitch for the off-screen pixel array can be spec- ified independently of the pitch for the on-screen array. This permits off- screen data to make efficient use of storage, regardless of the display pitch. On-screen objects may be defined as XY arrays but may be more efficiently stored as linear arrays in off-screen memory. The PIXBLT instructions support the transfer of a linear array to an XY array, and vice versa. PIXBLT in- structions can also be used to rapidly move blocks of non-pixel data (ASCII characters, for example) from one location in memory to another. 4-17 Hardware-Supported Data Structures 4-18 Section 5 CPU Registers and Instruction Cache The TMS34010 has two on-chip general-purpose register files, file A and file B. Each register file contains 1 5 32-bit registers. The two files share a 32-bit hardware stack pointer (SP) that automatically manages the system stack during interrupts and subroutine calls. The TMS3401 also has two dedicated 32-bit registers - a program counter and a status register. An on-chip cache holds up to 128 instruction words, and is transparent to software. The CPU registers and instruction cache are discussed in the following sections: Section Page 5.1 General-Purpose Registers 5-2 5.2 Status Register 5-18 5.3 Program Counter 5-19 5.4 Instruction Cache 5-20 5.5 Internal Parallelism 5-25 In addition to the CPU registers, the TMS34010 contains 28 memory-mapped registers that are dedicated to I/O functions; Section 6 discusses the I/O reg- isters. 5-1 CPU Registers and Instruction Cache - General- Purpose Registers 5.1 General-Purpose Registers TheTMS34010 has 30 32-bit general-purpose registers, divided into register files A and B. In addition, a single stack pointer (SP) is common to both regis- ter files. The multiple internal data paths that link the ALU and general-purpose regis- ters provide single machine state execution of most register-to -register in- structions. Single-state instructions include add, subtract, Boolean operations, and shifts (1 to 32 bits). During a single-state instruction, the following actions occur: 1 ) Two 32-bit operands are read in parallel from the general-purpose registers. 2) The ALU performs the specified operation. 3) The 32-bit result is stored in the specified general-purpose register. The general-purpose registers are dual-ported to permit operands to be read from two independent registers at the same time. 5.1 .1 Register File A Fifteen of the 30 general-purpose registers, A0-A14, form register file A. These registers can be used for data storage and manipulation. No hard- ware-dedicated functions are associated with these general-purpose registers. All register-to-register instructions (except MOVE Rs, Rd) require both regis- ters to be in the same file. Instructions that manipulate registers A0-A14 can also manipulate the stack pointer. The SP can be specified in place of an A- file register in any of these instructions. Figure 5-1 illustrates register file A. MSB LSB bit 31 bit A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 AT! A12 A13 A14 SP Stack Pointer Figure 5-1. Register File A 5-2 CPU Registers and Instruction Cache - General-Purpose Registers 5.1.2 Register File B Register file B consists of 15 general-purpose registers, B0-B14. All regis- ter-to-register instructions (except MOVE Rs,Rd) require both registers to be in the same file. Instructions that manipulate registers B0-B14 can also ma- nipulate the stack pointer. The SP can be specified in place of a B-file register in any of these instructions. Registers B0-B14 can be used for general-purpose functions such as data storage and manipulation. During PixBIt and other pixel operations, however, these registers are assigned hardware-dedicated functions. MSB bit 31 LSB bit BO SADDR Source address B1 SPTCH Source pitch B2 DADDR Destination address B3 DPTCH Destination pitch B4 OFFSET Offset B5 WSTART Window start address B6 WEND Window end address B7 DYDX Delta Y/Delta X B8 COLORO Color B9 COLOR1 Color 1 B10 TEMP or COUNT B11 TEMP or INC1 B12 TEMP or INC2 B13 TEMP or PATTRN B14 TEMP SP Stack Pointer Figure 5-2. Register File B As Figure 5-2 shows, registers B0-B9 are used as special-purpose registers during pixel operations. These registers must be loaded with specific param- eters before execution of pixel operations. Registers B10-B14 are used as special-purpose registers for the LINE instruction. During pixel operations, registers B10-B14 are used for temporary storage; their previous contents are destroyed. Register functions may vary for individual instructions. Section 5.1 .4 describes the B-file registers in detail. 5-3 CPU Registers and Instruction Cache - General-Purpose Registers 5.1.3 Stack Pointer The stack pointer (SP) is a 32-bit register that contains the bit address of the top of the system stack. The TMS34010 contains only a single SP. However, this SP can be addressed as a member of either register file, as register A15 or register B15. Any instruction that uses a general-purpose register as an operand can also use the SP as an operand. Figure 5-3 illustrates the stack pointer; Section 3.3 (page 3-6) describes stack operation in detail. 31 4 3 Word Address I Bit Addr \i 28 bits >\*-4 bits— H Figure 5-3. Stack Pointer Register The system stack grows in the direction of smaller addresses. During an in- terrupt, the PC and ST are pushed onto the stack to permit the interrupted routine to resume execution when interrupt processing is completed. A sub- routine call saves the PC on the stack to allow the calling routine to resume execution when subroutine execution is completed. The stack pointer always points to the value at the top of the stack. Specif- ically, the SP contains the 32-bit address of the LSB of that value. While the four LSBs of the SP may be set to an arbitrary value, stack operations execute more efficiently when the four LSBs are 0s. Setting these bits to 0s aligns the stack pointer to 16-bit word boundaries in memory, reducing to two the number of memory cycles necessary to push or pop the contents of a 32-bit register. The SP can be specified as the source or destination operand in any in- struction that operates on the general-purpose registers. The SP can be ac- cessed as register 1 5 in file A or B. Refer to the descriptions of the specific instructions for details. 5-4 CPU Registers and Instruction Cache - General-Purpose Registers 5.1.4 Implied Graphics Operands Table 5-1 summarizes the B-file register functions during graphics operations. These registers are referred to as implied graphics operands. Several I/O reg- isters, described in Section 6, are also implied graphics operands. Table 5-1. B-File Registers Summary Reg. Function Description BO SADDR Source Address. Address of the upper left corner of the source pixel array (lowest pixel address in the array). SADDR is a linear or XY address, depend- ing on the instruction which uses it. B1 SPTCH Source Pitch. Difference in linear start addresses between adjacent rows of a source pixel array. B2 DADDR Destination Address. Address of the upper left corner of the destination pixel array (lowest pixel address in the array). DADDR is a linear or XY ad- dress, depending on the instruction which uses it. B3 DPTCH Destination Pitch. Difference in linear start addresses between adjacent rows of a destination pixel array. B4 OFFSET Offset. Linear bit address corresponding to XY-coordinate origin (X=0, Y=0). B5 WSTART Window Start Address. XY address of the upper left corner of the window (smallest X and Y coordinate values in the array). B6 WEND Window End Address. XY address of the lower right corner of the window (largest X and Y coordinate values in the array). B7 DYDX Delta Y/Delta X. The 16 LSBs of this register specify the width (X dimen- sion) of the destination array. The 16 MSBs specify the height (Y dimension) of the destination array. If either DY = or DX = 0, then nothing is moved. B8 COLORO Pixel value corresponding to "color 0". COLORO contains the source background color to be used during a color-expand operation (PIXBLT B,XY or PIXBLT B,L). The pixel value should be replicated throughout the 16 LSBs of register B8 (see note below). Non-replicated patterns may be entered for dithering effects. The 16 MSBs are ignored during the expand operation. For example, at four bits per pixel, COLORO contains four identical pixel values, as shown below. B9 COLOR1 Pixel value corresponding to "color 1". COLOR1 contains the source foreground color to be used during a color-expand, fill, or draw-and-advance operation. The pixel value should be replicated throughout the 16 LSBs of register B9 (see note below). Nonreplicated patterns may be entered for dith- ering effects. The 16 MSBs are ignored during the expand operation. For ex- ample, at four bits per pixel, COLOR1 contains four identical pixel values, as shown below. B10-B14 PixBIt temporary registers. PixBIt instructions use these registers for storing temporary values and context information necessary to resume exe- cution of a partially-completed PixBIt operation in the event of an interrupt. SP SP Stack pointer. SP contains the bit address of the top of the stack. Notes: To provide upward compatibility with future versions of the GSP, replicate the pixel value throughout all 32 bits of COLORO or COLOR1, as shown. 5-5 BO Source Address Register Format 31 16 15 Y X or 31 Linear Bit Address Description SADDR contains the source array address for PIXBLTs. Generally, SADDR points to the pixel with the lowest address in the source array. When the selected starting corner is not the upper left corner, the TMS34010 auto- matically adjusts SADDR to point to the selected starting corner of the source array. (For PIXBLT L,L, however, you must manually adjust SADDR to point to the starting corner. This feature allows you to use PIXBLT L,L for manipulating pixel arrays with pitches that are not powers of two.) SADDR is in either XY or linear format. If the first operand of a PIXBLT instruction is an L (such as PIXBLT L,XY), then SADDR is in linear format. If the first operand of a PIXBLT instruction is an XY (such as PIXBLT XY,L), then SADDR is in XY format. During PIXBLT operations, SADDR is used in linear format. When the PIXBLT is completed, SADDR points to the starting location of the row that follows the last row in the array. If a PIXBLT is interrupted, SADDR points to the next word of pixels to be read. During LINE operation, SADDR contains the current decision variable va- lue. The following instructions use SADDR as an implied operand: Instruction SADDR Format and Function LINE Contains d=2b-a, used for the line draw. PIXBLT B,L Linear address; points to the beginning of a binary source array (a bit map). PIXBLT B,XY Linear address; points to the beginning of a binary source array (a bit map). PIXBLT L,L Linear address with special requirements when PBH = 1 or PBV = 1 . Refer to the PIXBLT L,L for a description of its unique requirements. PIXBLT L,XY Linear address; points to the beginning of a source array. PIXBLT XY,L XY address; points to the beginning of a source array. PIXBLT XY,XY XY address; points to the beginning of a source array. Example SADDR .set BO MOVI MOVI 00080015h, SADDR OOOlOAFCh, SADDR Move XY value 15h,8h into BO Move linear value lOAFCh into BO 5-6 Source Pitch Register B1 Format 31 Linear Bit Address Description Example SPTCH specifies the linear difference in the start addresses of adjacent rows of the source array for PIXBLT and FILL instructions. The TMS34010 uses the value in SPTCH to move from row to row through the source array. SPTCH must be an integer multiple of 16 (except for the special cases of PIXBLT B,L and PIXBLT B,XY). SPTCH is constrained in some cases to be a power of two; this allows XY addressing and allows SADDR to be automatically adjusted to point to an alternate starting corner. The following instructions use SPTCH as an implied operand. Instruction SPTCH Format and Function PIXBLT B,L Linear; any value. PIXBLT B,XY Linear; power of two for windowing, any value otherwise. PIXBLT L,L Linear; multiple of 1 6. PIXBLT L,XY Linear; power of two >. 16 for windowing or PBV = 1, multiple of 16 otherwise. PIXBLT XY,L Linear; power of two >. 1 6. PIXBLT XY,XY Linear; power of two > 1 6. SPTCH set Bl MOV I MOVI OOOOlOOOh, SPTCH OOOlOAFCh, SPTCH Power of two for PIXBLT XY,L Any value for PIXBLT B,L 5-7 B2 Destination Address Register Format Description 31 16 15 Y X or 31 Linear Bit Address DADDR contains the destination array address for PIXBLTs. Generally, DADDR points to the pixel with the lowest address in the destination array. When the selected starting corner is not the upper left corner, the TMS34010 automatically adjusts DADDR to point to the selected starting corner of the destination array. (For PIXBLT L,L, however, you must man- ually adjust DADDR to point to the starting corner. This feature allows you to use PIXBLT L,L for manipulating pixel arrays with pitches that are not powers of two.) DADDR is also used in conjunction with DYDX to perform a common rec- tangle function for some instructions (FILL XY, PIXBLT B,XY, PIXBLT L,XY, and PIXBLT XY,XY, with window option 1 ). In these cases, DADDR is set to the starting XY address of the common rectangle that represents the intersection of the original destination array and the clipping window indicated by WSTART and WEND. No drawing is performed. If the array and the window do not intersect, the V bit is not set and the contents of DADDR are undefined. DADDR is in either XY or linear format. If the second operand of the PIXBLT instruction is an L (such as PIXBLT XY,L), then DADDR is in linear format. If the second operand of the PIXBLT instruction is an XY (such as PIXBLT XY,XY), then DADDR is in XY format. If DADDR is specified in XY format, the PIXBLT converts it to the corre- sponding linear address prior to the start of the pixel array transfer. During PIXBLT operation, DADDR is maintained in linear format. When the PIXBLT completes, DADDR points to the linear starting address of the row following the last row in the array. If a PIXBLT is interrupted, DADDR points to the next word of pixels to be read. For the LINE instruction, DADDR contains the XY address of the next point on the line. The following instructions use DADDR as an implied operand. Instruction FILL L FILL XY LINE PIXBLT B,L PIXBLT B,XY PIXBLT L,L PIXBLT L,XY PIXBLT XY,L PIXBLT XY,XY DADDR Format and Function Linear; points to the beginning of the destination array. XY; points to the beginning of the destination array. XY; points to the current pixel. Linear; points to the beginning of the destination array. XY; points to the beginning of the destination array. Linear with special requirements when PBH = 1 or PBV=1 Refer to the PIXBLT L,L for a description of its unique re- quirements. XY; points to the beginning of the destination array. Linear; points to the beginning of the destination array. XY; points to the beginning of the destination array. 5-8 Destination Address Register B2 Example daddr .set B2 MOVI 00080015h, DADDR MOVI OOOlOAFCh, DADDR Move XY value 15h,8h into B2 Move linear value lOAFCh into B2 5-9 B3 Destination Pitch Register Format Description 31 Example Linear Bit Address DPTCH specifies the linear difference in the starting memory addresses of adjacent rows of the destination array for PIXBLT and FILL instructions. The TMS34010 uses the value in DPTCH to move from row to row through the destination array. DPTCH must be an integer multiple of 16 (except for FILL L when DX=1). DPTCH is also constrained in some cases to be a power of two; this allows XY addressing and allows DADDR to be auto- matically adjusted to point to an alternate starting corner. The following instructions use DPTCH as an implied operand. Instruction DPTCH Format and Function FILL L Linear; unused when DY=1. FILL XY Linear; power of two >. 1 6. PIXBLT B,L Linear; multiple of 1 6. PIXBLT B,XY Linear; power of two >. 16 for windowing, multiple of 16 otherwise. PIXBLT L,L Linear; multiple of 1 6. PIXBLT L,XY Linear; power of two > 1 6. PIXBLT XY,L Linear; power of two us.> 1 6 for PBV = 1 , multiple of 1 6 otherwise. PIXBLT XY,XY Linear; power of two > 1 6. DPTCH .set B3 MOVI OOOOlOOOh, DPTCH ; Power of two for ; PIXBLT XY,L MOVI OOOlOAFCh, DPTCH ; Any value for ; PIXBLT L,L 5-10 XY Addressing Offset Register B4 Format 31 Linear Bit Address Description OFFSET contains the linear address of the first pixel in the XY coordinate space for instructions using XY addressing. This corresponds to the linear address of the XY origin (X=0,Y=0). This value is used as the memory base for performing XY to linear address conversions. OFFSET is always in linear format. It may be placed at any position in the TMS34010 linear address space and should contain a pixel-aligned value for proper XY address conversions, transparency, pixel processing, and plane masking. Instructions that use OFFSET as an implied operand do not modify the contents of OFFSET. The following instructions use OFFSET as an implied operand. Instruction CVXYL Rs,Rd DRAV Rs.Rd FILL XY LINE PIXBLT B,XY PIXBLT L,XY PIXBLT XY,L PIXBLT XY,XY PIXT Rs,Rd.XY PIXT Rs.XY,Rd PIXT Rs.XY,Rd.XY OFFSET Format and Function Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Linear address of XY origin Example OFFSET set B4 MOVI 00042000h, OFFSET Linear value on pixel boundary 5-11 B5 Window Start Address Register Format 31 16 15 Window start Y Window start X Description WSTART specifies the XY address of the least significant pixel contained in the rectangular destination clipping window. WSTART must be valid for instructions that use an XY destination address and a window option. The least significant pixel is the pixel with the lowest address in the array. For a screen with the ORG bit of the DPYCTL register set to 0, this corresponds to the pixel in the upper left corner of the pixel array. WSTART may be placed at any position in the positive quadrant of the XY address space. It describes an inclusive pixel; that is, the pixel at the XY location contained in WSTART is included in the window. The value in WSTART is used with WEND, DADDR, and DYDX to preclip pixels, lines, and pixel arrays. WSTART is not modified by instruction execution. The following instructions use WSTART as an implied operand. Instruction CPW Rs,Rd DRAV Rs,Rd FILL XY LINE PIXBLT B,XY PIXBLT L,XY PIXBLT XY,XY PIXT Rs,Rd.XY PIXT Rs.XY,Rd.XY WSTART Format and Function XY value of least significant window corner XY value of least significant window corner XY value of least significant window corner XY value of least significant window corner XY value of least significant window corner XY value of least significant window corner XY value of least significant window corner XY value of least significant window corner XY value of least significant window corner Example WSTART set B5 MOVI 00400100h, WSTART XY value (256,64) stored in WSTART 5-12 Window End Address Register B6 Format 31 16 15 Window end Y Window end X Description WEND specifies the XY address of the most significant pixel contained in the rectangular destination clipping window. WEND must be valid for in- structions that use an XY destination address and a window option. The most significant pixel is the pixel with the highest address in the array. For a screen with the ORG bit of the DPYCTL register set to 0, this corresponds to the pixel in the lower right corner of the pixel array. WEND may be placed at any position in the positive quadrant of the XY address space. It describes an inclusive pixel; that is, the pixel at the XY location contained in WEND is included in the window. The value in WEND is used with WSTART, DADDR, and DYDX to preclip pixels, lines, and pixel arrays. WEND is not modified by instruction execution. The following instructions use WEND as an implied operand. Instruction CPW Rs,Rd DRAV Rs,Rd FILL XY LINE PIXBLT B,XY PIXBLT L,XY PIXBLT XY,XY PIXT Rs,Rd.XY PIXT Rs.XY,Rd.XY WEND Format and Function XY value of most XY value of most XY value of most XY value of most XY value of most XY value of most XY value of most XY value of most XY value of most significant window significant window significant window significant window significant window significant window significant window significant window significant window corner corner corner corner corner corner corner corner corner Example WEND set B6 MOVI 00400100h, WEND XY value (256,64) stored in WEND 5-13 B7 Delta Y/Delta X Register Format 31 16 15 Delta Y Delta X Description Example DYDX specifies the X and Y dimensions of the rectangular destination array for PIXBLT and FILL instructions. Both the X and Y dimensions are in pixels; that is, the DX value is number of pixels in width of the array, and DY is the number of rows of pixels in the destination array. When the window clipping option is selected, the pixel block dimensions for the transfer are determined by the relationships between WSTART, WEND, DADDR, and DYDX. If either the X or Y dimension is 0, then the block is interpreted as having a dimension of 0; no transfer is performed. The values for DY and DX may range up to the coordinate extent of the display (up to 65,535, depending on the display pitch and pixel size se- lected). For window operations, the relationship between DYDX, WSTART, and WEND is such that DY = Y end - Y start + 1 and DX = X end - Xstart + 1 • The value in DYDX is used with WSTART ' DADDR, and DYDX to preclip pixels, lines, and pixel arrays. Most graphics instructions do not modify the contents of DYDX. For FILL XY, PIXBLT B,XY, PIXBLT L,XY, and PIXBLT XY,XY, with window option 1, however, DYDX is used with DADDR to perform a common rectangle function. In this case, the instruction sets DYDX to the dimensions of the common pixel block described by the intersection of the original destination array and the window identified by WSTART and WEND. No drawing is performed. If there is no common rectangle, the V bit is not set and the value of DYDX is indeterminate. See these instructions for further infor- mation. The following instructions use DYDX as an implied operand. Instruction DYDX Format and Function FILL L Array dimensions in XY format. FILL XY Array dimensions in XY format; special results when W=1 is selected, as previously noted. LINE Dimensions of the rectangle described by the line to be drawn. PIXBLT B,L Array dimensions in XY format PIXBLT B,XY Array dimensions in XY format; special results when pick is selected, as previously noted. PIXBLT L,L Array dimensions in XY format. PIXBLT L,XY Array dimensions in XY format; special results when pick is selected, as previously noted. PIXBLT XY,L Array dimensions in XY format. PIXBLT XY,XY Array dimensions in XY format; special results when pick is selected, as previously noted. This example illustrates the relationship of DYDX to WSTART and WEND. WSTART WEND DYDX set set set B5 B6 B7 MOVE WEND, DYDX SUBXY WSTART, DYDX ADDI lOOOlh, DYDX Put WEND into DYDX Generate (WEND - WSTART) Increment by 1 in each dimension 5-14 Background Color Register B8 Format 31 Replicated Pixel Value Description COLORO specifies the replacement color for bits in the source array for PIXBLT B,L and PIXBLT B,XY instructions. These two instructions trans- form binary pixel array information to multiple bits per pixel arrays using the color information in COLOR1 and COLORO. The lower 16 bits of COLORO are used for the or background color. There is a direct correspondence between the alignment of pixels within the COLORO register and pixels within memory words to be altered. That is, individual pixels within COLORO are used as they align with destination pixels in the destination word. Execution of graphics instructions does not modify COLORO. To provide upward compatibility with future versions of the GSP, the plane mask should be replicated through all 32 bits of COLORO. The following instructions use COLORO as an implied operand. Instruction COLORO Contents PIXBLT B,L Background pixel color for color-expanded array PIXBLT B,XY Background pixel color for color-expanded array Example This example is for 4-bit pixels. A pixel value of 5 is replicated throughout the register. COLORO set B8 MOVI 55555555h, COLORO ; store uniform pixel ; value in COLORO 5-15 B9 Foreground Color Register Format Description 31 Example Replicated Pixel Value C0L0R1 specifies the replacement color for pixels to be altered at the des- tination pixel or pixel block for FILL, DRAV and LINE instructions. For PIXBLT B,L and PIXBLT B,XY instructions, COLOR1 specifies the re- placement color for 1 bits in the source array. These two instructions transform binary pixel array information to multiple-plane pixel arrays using color information in COLOR1 and COLORO. There is a direct correspond- ence between the alignment of pixels within the COLOR1 register and pix- els within memory words to be altered. That is, individual pixels within COLOR1 are used as they align with destination pixels in the destination word. Execution of graphics instructions does not modify COLOR1. To provide upward compatibility with future versions of the GSP, the plane mask should be replicated through all 32 bits of COLOR1 . The following instructions use COLOR1 as an implied operand. Instruction COLOR1 Contents DRAV Rs,Rd Pixel color for pixel draw FILL L Pixel color for filled array FILL XY Pixel color for filled array LINE Pixel color for line draw PIXBLT B,L Foreground pixel color for color-expanded array PIXBLT B,XY Foreground pixel color for color-expanded array This example is for 4-bit pixels. A pixel value of 3 is replicated throughout the register. COLORl .set B9 MOVI 33333333h, COLORl ; Store uniform pixel ; value in COLORl 5-16 Reserved Registers B10-B14 Format 31 Various Formats Description The functions of these registers depend on which instruction uses them: • PIXBLT and FILL instructions use registers B10 through B14 as tem- porary registers that hold intermediate values. • The LINE instruction uses these registers as implied operands with the following functions: - B1 1 is the INC1 register; it specifies the X and Y increments for a diagonal step. - B1 2 is the INC2 register; it specifies the X and Y increments for a nondiagonal step. B10 is the COUNT register; it specifies the number of pixels to be drawn in the line. - B13 is the PATTRN register; it is reserved for future LINE draw enhancement. It should be set to OFFFFFFFFh before executing the LINE instruction to ensure software compatibility. B14 is a temporary register (TEMP) that holds intermediate va- lues. 5-17 CPU Registers and Instruction Cache - Status Register 5.2 Status Register The status register (ST) is a special-purpose, 32-bit register that specifies the processor status. The ST also contains several parameters that specify the characteristics of two programmable data types, fields and 1 . The ST is ini- tialized to 0000001 Oh at reset. Figure 5-4 illustrates the status register. Table 5-2 lists the functions associ- ated with the status bits. Table 5-3 describes the encoding of the field size bits in FSO and FS1 . 31302928272626242322212019 18 17 1615 1413 121110 9 876543210 N C z V Pi B xl . . I E rtonoryod F E 1 FS1 F E F80 Note: The status register bits marked reserved (bits 12-20, 22-24, and 26-27) are currently unused. When read, a reserved bit returns the last value written to it. At reset, all reserved bits are forced to Os. Figure 5-4. Status Register Table 5-2. Definition of Bits in Status Register Bit No. Field Name Function 0-4 FSO Field Size 0. Length in bits of first memory data field (see Table 5-3 for values). 5 FEO Field Extend 0. Bit determines whether field from memory is extended with Os or with the sign bit when loaded into 32-bit general-purpose register. FEO = selects zero extension for field FEO = 1 selects sign extension for field 6-10 FS1 Field Size 1. Length in bits of second memory data field (see Table 5-3 for values). 11 FE1 Field Extend 1. Bit determines whether field from memory is extended with 0s or with the sign bit when loaded into 32-bit general -purpose register. FE1 = selects zero extension for field 1 FE1 = 1 selects sign extension for field 1 21 IE Interrupt Enable. Master interrupt enable/disable bit. IE = disables all maskable interrupts IE = 1 enables all maskable interrupts 25 PBX PixBIt Executing. Indicates upon return from an interrupt that the interrupt oc- curred between instructions or in the middle of a PIXBLT or FILL instruction. = Indicates interrupt occurred at PIXBLT or FILL instruction boundary 1 = Indicates interrupt occurred in the middle of a PIXBLT or FILL instruction 28 V Overflow. Set according to instruction execution. 29 Z Zero. Set according to instruction execution. 30 c Carry. Set according to instruction execution. 31 N Negative. Set according to instruction execution. 12 20 22-24 26-27 - Reserved 5-18 CPU Registers and Instruction Cache - Status Register/Program Counter Table 5-3. Decoding of Field-Size Bits in Status Register Five FS Field Five FS Field Five FS Field Five FS Field Bits Sizet Bits Sizet Bits Sizet Bits Sizet 00001 1 01001 9 10001 17 11001 25 00010 2 01010 10 10010 18 11010 26 00011 3 01011 11 10011 19 11011 27 00100 4 01100 12 10100 20 11100 28 00101 5 01101 13 10101 21 11101 29 00110 6 01110 14 10110 22 11110 30 00111 7 01111 15 10111 23 11111 31 01000 8 10000 16 11000 24 00000 32 t In bits 5.3 Program Counter The program counter (PC) is a dedicated 32-bit register that points to the next instruction word to be executed. Instructions are always aligned on even 1 6-bit word boundaries, and as shown in Figure 5-5, the four LSBs of the PC are always 0s. 31 Word Address 4 3 K> 0| ■28 bits- -»Mb«B-H Figure 5-5. Program Counter An instruction consists of one or more instruction words. The first word contains the opcode for the instruction. Additional words may be required for immediate data, displacements, or absolute addresses. As each instruction word is fetched, the PC is incremented by 16 to point to the next instruction word. The PC contents are replaced during a branch instruction, subroutine call instruction, return instruction, or interrupt. Instructions may be categor- ized according to their effect on the PC, as indicated in Table 5-4. Table 5-4. Instruction Effects on the PC Category Description Non-branch The PC is incremented by 16 at the end of the instruction, allowing execution to proceed sequentially to the next in- struction. Absolute Branch (TRAP, CALL, JAcc) The PC is loaded with an absolute address; the four LSBs of the address are set to 0s. Relative Branch (JRcc, DSJxx) The signed displacement (8 or 16 bits) is added to the current contents of the PC. The signed displacement is treated as a word displacement; that is, it is shifted left four bit positions before it is added to the PC. Indirect Branch (JUMP, CALL, EXGPC) The PC is loaded with the register contents. The four LSBs are set to 0s. 5-19 CPU Registers and Instruction Cache - Instruction Cache 5.4 Instruction Cache Most program execution time is spent on repeated execution of a few main procedures or loops. Program execution can be speeded up by placing these often used code segments in a fast memory. The TMS34010 uses a 256-byte instruction cache for this purpose. Only instruction words (memory words that are pointed to by the PC) can be accessed from the cache. This includes opcodes, immediate operands, dis- placements, and absolute addresses. Instructions and data may reside in the same area of memory; therefore, data may occasionally be copied into the in- struction cache along with instruction words. However, the processor cannot access data from the cache. All reads and writes of data in memory bypass the cache. 5.4.1 Cache Hardware The instruction cache contains 256 bytes of RAM, used to store up to 1 28 1 6-bit instruction words. Each instruction word in cache is aligned on an even word boundary. Figure 5-6 illustrates cache organization. Segment Start Address Rags { * 1 r "" A ""^ Data Registers / *- «, 1 6SA Register 1 M 23 H T 2" 3" J X V 7 SI T 1 3" J ¥ 7 euDseoment o 1 2 3 > Segment 4 s 6 7 ^ | 68A Register 1 | K 64 M subeeoment o 2 *" ^ Word 1 3 word 2 word 3 4 6 M 16 — N 3 7 I 66A Register 2 I i 3" 4 7 subeeoment o 1 2 3 > Segment 2 4 5 6 7 ^ | S8A Register 3 | l 2. 2. £ 1 I Sutweoment o 1 2 3 > Segment 3 4 s 6 7 J Figure 5-6. TMS34010 In struction Ca Subeegment 2 of segment 1 Most Recently Used Least Reoently - Used > LRU Staok The cache is divided into four 32-word segments. Each cache segment may contain up to 32 words of a 32-word segment in memory. This memory seg- 5-20 CPU Registers and Instruction Cache - Instruction Cache ment is a block of 32 contiguous words beginning at an even 32-word boundary in memory. Each cache segment is divided into eight subsegments; each subsegment contains four words. Dividing each segment into subsegments reduces the number of word fetches required from memory when fewer than 32 words of a memory segment are used. Each of the four cache segments is associated with a segment start address (SSA) register. Figure 5-7 shows how an in- struction word is partitioned into the components used by the cache control algorithm. k- -32-Blt Linear Address- M ■23 Btts- ♦ 3 Bits o|o|o|o| The four LSBs of an instruction word address are always 0. Instruction word address 'within subsegment -Subsegment address Segment start address (SSA register) Figure 5-7. Segment Start Address The 23 bits of the SSA register correspond to the 23 MSBs of the segment's memory address. These 23 MSBs are common to all eight subsegments within a segment. The next three bits (bits 6-8) identify one of the eight subseg- ments. Bits 4 and 5 identify one of the four words contained in a subsegment. The four LSBs are always 0s because instructions are aligned on word boun- daries. 5.4.2 Cache Replacement Algorithm When the TMS34010 requests an instruction word from a segment that is not in the cache, the contents of one of the four cache-resident segments must be discarded to make room for the segment that contains the requested word. A modified form of the least- recently- used (LRU) replacement algorithm is used to select the segment to be discarded. The LRU segment manager (part of the cache control logic) maintains an LRU stack to track use of the four segments. The LRU stack contains a queue of segment numbers, through 3. Each time a segment is accessed, its segment number is moved to the top of the stack, pushing the other segment numbers down as necessary to make room at the top. Thus, the number at the top of the LRU stack identifies the most-recently-used segment and the number at the bottom identifies the least- recently- used segment. When a new segment must be loaded into cache, the least- recently- used segment is discarded. The eight P flags (described in Section 5.4.3) of the selected segment are set to 0s, and the segment's SSA register is loaded with the new segment address. After the requested subsegment has been loaded from memory, its P flag is set to 1, and the requested instruction fetch is al- lowed to complete. Following a reset, all P flags in the cache are set to and the four segment numbers in the LRU stack are stored in numerical order (0-1-2-3). 5-21 CPU Registers and Instruction Cache - Instruction Cache 5.4.3 Cache Operation When the TMS3401 requests an instruction word, it checks to see if the word is contained in cache. First, it compares the 23 MSBs of the instruction ad- dress to the four SSA registers. If a match is found, the processor searches for the appropriate subsegment. A present (P) flag, associated with each sub- segment, indicates the presence of a particular subsegment within a cache segment. P=1 indicates that the requested word is in cache; this is called a cache hit. If there is no match, or if there is a match and P=0, the word is not in cache; this is called a cache miss. 5.4.3.1 Cache Hit The cache contains the requested instruction word. The processor performs the following actions: 1 ) A short (one machine state) access cycle reads the instruction word from cache. 2) The segment number is moved to the top of the LRU stack, pushing the other three segment numbers toward the bottom of the stack. Due to pipelining, instruction fetches from the cache frequently overlap com- pletion of preceding instructions. The overhead due to instruction fetches in such cases is effectively zero. 5.4.3.2 Cache Miss The cache does not contain the instruction word. There are two types of cache miss - subsegment miss and segment miss. • Subsegment Miss. The 23 MSBs of the instruction word address match one of the four SSA registers' 23 MSBs; that is, the appropriate segment is in the cache. However, the P flag for the requested subseg- ment is not set. The processor performs the following actions: 1 ) The four-word subsegment containing the requested instruction word is read from local memory into the cache. 2) The segment number is moved to the top of the LRU stack, push- ing the other three segment numbers toward the bottom of the stack. 3) The subsegment's P flag is set. 4) The instruction word is read from the cache. • Segment Miss. The instruction word address does not match any of the SSA registers. The processor performs the following actions: 1 ) The least- recently- used segment is selected for replacement; the P flags of all eight subsegments are cleared. 2) The SSA register for the selected segment is loaded with the 23 MSBs of the address of the requested instruction word. 5-22 CPU Registers and Instruction Cache - Instruction Cache 3) The four-word subsegment in memory that contains the requested instruction word is read into the cache. It is placed in the appro- priate subsegment of the least-recently-used segment. The sub- segment's P flag is set to 1 . 4) The LRU stack is adjusted by moving the number of the new seg- ment from the bottom (indicating that it is least recently used) to the top (indicating that it is most recently used). This pushes the other three segment numbers in the stack down one position. 5) The instruction word is read from the cache. 5.4.4 Self- Modifying Code Avoid using self-modifying code; it can cause unpredictable results. When a program modifies its own instructions, only the copy of the instruction that resides in external memory is affected. Copies of the instructions that reside in cache are not modified, and the internal control logic does not attempt to detect this situation. 5.4.5 Flushing the Cache Flushing the cache sets it to an initial state which is identical to the state of the cache following reset. The cache is empty and all 32 P flags are set to 0. The cache is flushed by setting the CF (cache flush) bit in the HSTCTL register to 1 . The CF bit retains the last value loaded until a new value is loaded or until the TMS3401 is reset. The contents of the cache remain flushed as long as the CF bit is set to 1 . All instruction fetches bypass the cache and are ac- cessed directly from memory. Unless the cache is disabled, normal cache operation will resume when the CF bit is set to 0. One use for flushing the cache is to facilitate downloading new code from a host processor to TMS34010 local memory. The host typically halts the TMS34010 during downloading by writing a 1 to the HLT bit in the HSTCTL register. Before allowing the TMS34010 to execute downloaded code, the host should flush the cache to purge it of stale instructions. For performance reasons, the CD bit should not remain set to 1 for long peri- ods. While CD = 1, each instruction-word fetch is interpreted as a cache miss, causing the four words in the subsegment to be fetched from memory. Though the word pointed to by the PC is executed, none of the four words is preserved in cache. 5-23 CPU Registers and Instruction Cache - Instruction Cache 5.4.6 Cache Disable Disabling the cache facilitates program debugging and emulation. The cache is disabled by setting the CD (cache disable) bit in the CONTROL register to 1 . While disabled, the cache is bypassed and all instructions are fetched from external memory. CD = 1 is similar in effect to CF = 1 , with several exceptions: • While CD = 1 and CF=0, data already in the cache are protected from change. When the CD bit is set back to 0, the state of the cache prior to setting the CD bit to 1 is restored. The instructions in the cache are once again available for execution. If the contents of the cache become invalid while CD = 1 , they can be flushed by setting CF to 1 . • While CD = 1 and CF=0, each instruction word is fetched from memory as it is requested, but the other three words in the subsegment are not fetched. In contrast, if CF=1 and CD=0, all four words in the subseg- ment that contain the requested instruction word are fetched, although all but the requested word are immediately discarded. The CD bit can be manipulated to preserve code in the cache for faster exe- cution in some time-critical applications. For example, if an inner loop just exceeds 256 bytes, most of the loop, but not all of it, can fit in the cache. During execution of the few instructions that are not in the cache, the CD bit can be set to 1 to prevent the code in the cache from being replaced. In this instance, the loop's execution speed is improved by eliminating the thrashing of cache contents. Use this technique carefully; in some cases, it can nega- tively affect execution speed. 5.4.7 Performance with Cache Enabled versus Cache Disabled When the instruction cache is disabled, instruction words are fetched from external memory. Assuming no wait states are necessary, each instruction fetch from external memory adds 3 machine cycles to the access time. This is considerably slower than a program which uses the cache efficiently (when each word in cache is used several times before it is replaced). A less efficient use of cache occurs when words in cache are used only once before replacement. This produces a cache miss every fourth word (even in this case, operation is usually much better than operation when the cache is disabled). With the cache enabled, the time penalty due to cache misses in this case is 2.25 machine states per single-word instruction (compare this to 3 states when the cache is disabled), which is calculated as follows: • Eight machine cycles are required to load four words into cache from memory. • An additional machine state is required to start processing the in- struction. • Dividing the total of nine machine states by four instruction words yields an average of 2.25 machine states per instruction word. Performance using the cache is nearly always better than performance with the cache disabled. There are two exceptions. The first occurs when the code contains so many jumps that only a portion of each subsegment is executed before control is transferred to another subsegment. The second occurs when 5-24 CPU Registers and Instruction Cache - Cache/ Internal Parallelism an inner loop is larger than the cache, in which case only some portion of the instructions in the inner loop can be contained in the cache at any time. In this case, performance may be improved by manipulating the CD bit as described in Section 5.4.6. While the cache is disabled, the TMS34010's internal memory controller fetches each instruction word from memory only as it is requested by the in- ternal execution unit. This differs from operation with the cache enabled, in which case a cache miss causes the entire four-word subsegment containing the requested instruction word to be loaded into the cache at once. 5.5 Internal Parallelism Figure 5-8 illustrates the internal data paths associated with TMS34010 pro- cessor functions. The TMS34010 has a single, logical memory space for sto- rage of both data and instructions. However, internal parallelism provides the TMS34010 with the benefits found in architectures which contain separate data and instruction storage (sometimes referred to as Harvard architectures). The ability to fetch instructions from cache in parallel with data accesses from memory greatly enhances execution speed. Hardware parallelism allows the following three storage areas to be accessed simultaneously: • Instruction cache • Dual-ported, general-purpose register files A and B • External memory 1 TMeawiu Instruction Cache t Instructions General- Purpose Registers CPU i Data i Memory Interface External Memory : Figure 5-8. Internal Data Paths 5-25 CPU Registers and Instruction Cache - Internal Parallelism Each storage area can also be accessed independently of the other two. This allows the TMS3401 to perform the following actions in parallel during a pair of machine states: • One external memory cycle • Two instruction fetches from cache • Four reads and two writes to the general-purpose register files The need to schedule conflicting internal operations can limit the TMS34010's ability to perform these actions in parallel. For example, an instruction which requires the memory controller to perform a read must finish executing before the next instruction can be executed. Figure 5-9 illustrates an example of internal parallelism, three activities occurring in parallel: Figure 5-9 a shows (a) • Instructions are fetched from cache. • Instructions are executed through the general-purpose registers and the ALU. • The local memory interface controller performs memory accesses. Figure 5-9 a represents execution of the code in Figure 5-9 b, which is the inner loop of a graphics routine. The memory controller accesses pixels while the ALU fetches instructions from cache. The memory controller completes a write cycle while execution begins on the next instruction. -One Iteration - State: H«- 1-H*-2 -*M -+|«-4-+|«-5-H«-6 -Jfl-7 ->ft- 8 ~H«- 9 -•+»- 10 -H<- H "»!*- t2-H«- MOVE ADD PIXT ADD DSJS MOVE Instruction Fetch: A | | B jjSii | D jliil | A | (b) A B C D E Execution: Memory Interface: L1: E | ». \ A I A \ B I S |. C i.P I O \ D \ & i £ \ E I "A~ MOVE ADD PIXT ADD DSJS Read Cycle •B1+.B10.0 B10.B8 •B1,*B8 B0.B1 B11.L1 Read Get DELTAX Adjust pixel pointer Draw next pixel Add field size Loop N Times Write Figure 5-9. Parallel Operation of Cache, Execution Unit, and Memory Interface 5-26 Section 6 I/O Registers The TMS34010's 28 on-chip I/O registers control and monitor the following functions: • Host interface communications • Local memory interface control • Interrupt control • Video timing and screen refresh This section describes these functions, I/O register addressing, and then pro- vides an alphabetical presentation of the I/O registers: Section Page 6.1 I/O Register Addressing 6-2 6.2 Latency of Writes to I/O Registers 6-4 6.3 I/O Registers Summary 6-5 6.4 Alphabetical Listing of I/O Registers 6-10 6-1 I/O Registers - Addressing 6.1 I/O Register Addressing TMS34010 I/O registers occupy addresses COOOOOOOh to C0O0O1 FFh. These registers can be directly accessed by the TMS34010; they can also be indi- rectly accessed by a host processor through the host interface registers. For example, the host processor can indirectly read the contents of the PSIZE re- gister by loading the address C0000150h into the HSTADRL and HSTADRH registers, and reading the HSTDATA register. Figure 6-1 illustrates the I/O register memory map. DRAM Refresh Count Display Address Vertical Count Horizontal Count Display Tap Point Plane Mask Pixel Size Destination Conversion Pitch Source Conversion Pitch Interrupt Pending Interrupt Enable Host Control (MSBs) Host Control (LSBs) Host Address (MSBs) Host Address (LSBs) Host Data Control Display Interrupt Display Start Display Control Vertical Total Vertical Start Blank Vertical End Blank Vertical End Sync Horizontal Total Horizontal Start Blank Horizontal End Blank Horizontal End Sync Figure 6-1. I/O Register Memory Map The two MSBs of an I/O register's 32-bit internal address are not output on the TMS34010 pins; however, the address is fully decoded internally. Thus, the two MSBs of a 32-bit address must both be 1s for an address to be re- cognized as that of an I/O register. When an I/O register is accessed, the ac- companying memory cycle (as seen at the TMS3401 pins) is altered so that the row address strobe is output, but the column address strobe is inhibited. This is true whether the access is initiated directly by the TMS34010 or indi- rectly by a host processor. C00001 FOh REFCNT C00001 EOh DPYADR C00001 DOh VCOUNT C00001 COh HCOUNT C00001 BOh DPYTAP COOOOIAOh C00001 90h C00001 80h C00001 70h Reserved C00001 60h PMASK C00001 50h PSIZE COOOOUOh CONVDP C00001 30h CONVSP C00001 20h INTPEND C00001 1 0h INTENB C0000100h HSTCTLH COOOOOFOh HSTCTLL COOOOOEOh HSTADRH COOOOODOh HSTADRL COOOOOCOh HSTDATA COOOOOBOh CONTROL COOOOOAOh DPYINT C0000090h DPYSTRT C0000080h DPYCTL C0000070h VTOTAL C0000060h VSBLNK C0000050h VEBLNK C0000040h VESYNC C0000030h HTOTAL C0000020h HSBLNK C000001 Oh HEBLNK COOOOOOOh HESYNC 6-2 I/O Registers - Addressing An access of any address in the range C0000000h-C00001 FFh is decoded as an access of an on-chip register location, and the column address strobe re- mains inactive high through the cycle. An access of any location outside this range is treated as an access of an external memory location. All I/O registers, with one exception, are cleared to at reset. The exception is the HLT (halt ) bit in the HSTCTL register, which is set depending on the value at the HCS input pin at the end of the reset pulse: If HCS is high at reset, the HLT bit is set to 1 If HCS is low at reset, the HLT bit is set to 6-3 I/O Registers - Latency of Writes to I/O Registers 6.2 Latency of Writes to I/O Registers When an instruction alters the contents of an I/O register, the memory write cycle that modifies the register may not be completed before execution of the next instruction begins. If the second instruction relies on the I/O register value loaded by the first instruction, the second instruction may cause incor- rect results. This type of problem could occur, for example, if a PIXBLT in- struction were immediately preceded by a MOVE register-to-memory instruction that modified the CONTROL register. This situation is easily avoided by ensuring that the write to the I/O register is allowed to complete before the I/O register value is used as an implied operand by a subsequent instruction. For example, by immediately following a write to an I/O register with a read of the register, the write is certain to have been completed by the time subsequent instructions begin execution. Internal to the TMS34010, the memory controller operates semi-autono- mously with respect to the execution unit that processes instructions. Paral- lelism between the execution unit and memory controller may allow a write initiated by an instruction to be completed only after one or more subsequent instructions have been executed. An instruction that alters an I/O register (or any other address in memory) transmits its request for a write cycle to the memory controller. Once the request is accepted, the memory controller is responsible for completing the write cycle; in the meantime, execution of the next instruction can begin. A field insertion request submitted to the memory controller can take as many as five cycles to complete in the case in which a field of 18 or more bits straddles two word boundaries. This case requires a read-modify-write oper- ation to one word, a write to a second word, and a read-modify-write opera- tion to a third word. Although this would be an unusual way of altering locations in the I/O register file, it represents the theoretical worst case number of memory cycles for a field insertion. The start of a pending field-insertion cycle may be delayed by the following conditions: Screen -refresh cycle DRAM -refresh cycle Host-indirect read or write cycle Wait states required for slower memories Hold request from an external device Any uncertainty as to whether a pending write to memory has been completed can be eliminated by making use of the fact that only one field insertion re- quest can be queued at the memory controller at a time. An instruction that requests a second memory access before the earlier field insertion has been completed will be forced to wait. Hence, by following an instruction that al- ters an I/O register with an instruction that requests a second memory access {any memory access), the I/O register is certain to have been updated before the second instruction finishes executing. 6-4 I/O Registers - Summary 6.3 I/O Registers Summary Table 6-1 summarizes the I/O registers. Descriptions of the four categories of I/O registers follow the table. Table 6-1. I/O Registers Summary Host Interface Registers Register Address Description HSTADRH COOOOOEOh Host interface address, high word. Contains the 16 MSBs of a 32-bit pointer address used by a host processor for indirect accesses of TMS34010 local memory. HSTADRL COOOOODOh Host interface address, low word. Contains the 1 6 LSBs of a 32-bit pointer address used by a host processor for indirect accesses of TMS34010 local memory. HSTCTLH C0000100h Host interface control, high byte Contains seven programmable bits that control host interface functions: NMI (bit 8) - Nonmaskable interrupt NMIM (bit 9) - NMI mode bit INCW (bit 11)- Increment pointer address on write INCR (bit 12) - Increment pointer address on read LBL(bit13) - Lower byte last CF (bit 14) - Cache flush HLT (bit 1 5) - Halt TMS3401 execution Bits through 7 and 1 are reserved HSTCTLL COOOOOFOh Host interface control, low byte. Contains eight programmable bits that control host interface functions: MSGIN (bits 0-2) - Input message buffer INTIN (bit 3) - Input interrupt bit MSGOUT (bits 4-6) - Output message buffer INTOUT(bit7) - Output interrupt bit Bits 8 through 15 are reserved H ST DATA COOOOOCOh Host interface data. Buffers data transferred between TMS3401 local memory and a host processor. Local Memory Interface Registers Register Address Description CONTROLt COOOOOBOh Memory control. Contains several parameters that control local mem- ory interface operation: RM (bit 2) - DRAM refresh mode RR (bits 3-4) - DRAM refresh rate T (bit 5) - Transparency enable W (bits 6-7) - Window violation detection mode PBH (bit 8) - PixBIt horizontal direction PBV (bit 9) - PixBIt vertical direction PPOP (bits 10-14) - Pixel processing operation select CD (bit 15) - Cache disable Bits and 1 are reserved CONVDPt C0000140h Destination pitch conversion factor. Used during XY to linear con- version of a destination memory address. CONVSPt C00001 30h Source pitch conversion factor. Used during XY to linear conversion of a source memory address. t Implied graphics operands 6-5 I/O Registers - Summary Table 6-1. I/O Registers Summary (Continued) Local Memory Interface Registers (Continued) Register Address Description PMASKt C0000160h Plane mask register. Selectively enables/disables the various planes in the bit map of a display system in which each pixel is represented by multiple bits. PSIZEt C00001 50h Pixel size register. Specifies the pixel size (in bits). Possible pixel sizes include 1, 2, 4, 8, and 16 bits. REFCNT C00001 FOh Refresh count register. Generates the addresses output during DRAM refresh cycles and counts the intervals between successive DRAM refresh cycles: RINTVL (bits 2-7) - Refresh interval counter ROWADR (bits 8-15) - Row address Bits and 1 are reserved Interrupt Control Registers Register Address Description INTENB C00001 1 0h Interrupt enable. Contains the interrupt mask used to selectively enable/disable the three internal and two external interrupts: X1 E (bit 1 ) - External interrupt 1 enable X2E (bit 2) - External interrupt 2 enable HIE (bit 9) - Host interrupt enable DIE (bit 10) - Display interrupt enable WVE (bit 11) - Window violation interrupt enable Bits 0, 3 through 8, and 12 through 1 5 are reserved INTPEND C00001 20h Interrupt pending. Indicates which interrupt requests are currently pending: X1 P (bit 1 ) - External interrupt 1 pending X2P (bit 2) - External interrupt 2 pending HIP (bit 9) - Host interrupt pending DIP (bit 10) - Display interrupt pending WVP (bit 11) - Window violation interrupt pending Bits 0, 3 through 8, and 1 2 through 1 5 are reserved Video Timing and Screen Refresh Registers Register Address Description DPYADR C00001 EOh Display address. Counts the number of scan lines output between successive screen refresh cycles and contains the source of the row and column addresses output during a screen refresh cycle: LNCNT (bits 0-1 ) - Scan line counter SRFADR (bits 2-15) -Screen refresh address DPYCTL C0000080h Display control. Contains several parameters that control video timing signals: HSD (bit 0) - Horizontal sync direction DUDATE (bits 2-9) - Display address update ORG (bit 10) - Screen origin select SRT (bit 11) - VRAM serial-register transfer enable SRE (bit 12) - Screen refresh enable DXV (bit 1 3) - Disable external video NIL (bit 14) - Noninterlaced video enable ENV (bit 15) - Enable video Bit 1 is reserved. DPYINT COOOOOAOh Display interrupt. Specifies the next scan line that will cause a display interrupt request. t Implied graphics operands 6-6 I/O Registers - Summary Table 6-1 . I/O Registers Summary (Concluded) Video Timing and Screen Refresh Registers (Continued) Register Address Description DPYSTRT C0000090h Display start address. Provides control of the automatic memory-to- register cycles necessary to refresh a screen: LCSTRT (bits 0-1 ) - Specifies the number of scan lines to be displayed between screen refreshes SRSTRT (bits 2-15)- Starting screen -refresh address DPYTAP C00001 BOh Display tap point address. Contains a VRAM tap point address output during shift register transfer cycles. HCOUNT C00001 COh Horizontal count. Counts the number of VCLK periods per horizontal scan line. HEBLNK C000001 Oh Horizontal end blank. Designates the endpoint for horizontal blanking. HESYNC COOOOOOOh Horizontal end sync. Specifies the endpoint of the horizontal sync interval. HSBLNK C0000020h Horizontal start blank. Specifies the starting point of the horizontal blanking interval. HTOTAL C0000030h Horizontal total. Specifies the total number of VCLK periods per hori- zontal scan line. VCOUNT C00001 DOh Vertical count. Counts the horizontal scan lines in a video display. VEBLNK C0000050h Vertical end blank. Specifies the endpoint of the vertical blanking in- terval. VESYNC C0000040h Vertical end sync. Specifies the endpoint of the vertical sync pulse. VSBLNK C0000060h Vertical start blank. Specifies the starting point of the vertical blank- ing interval. VTOTAL C0000070h Vertical total. Specifies the value of VCOUNT at which the vertical sync pulse begins. 6.3.1 Host Interface Registers Five I/O registers are dedicated to host interface communications, allowing the TMS34010to: • Directly transfer status messages or command information • Indirectly transfer large blocks of data through local memory • Receive interrupt requests from a host processor • Transfer interrupt requests to a host processor The ability to indirectly transfer large blocks of data makes the host interface extremely flexible. For example, a host can transfer blocks of commands to the TMS34010, can halt the TMS34010 temporarily to download a new program for the TMS34010 to execute, or can read blocks of graphics data generated bytheTMS34010. The host interface registers occupy five TMS34010 register locations, and are typically mapped into four consecutive 16-bit locations in the memory or I/O address space of the host processor. The host processor accesses the 6-7 I/O Registers - Summary HSTCTLL and HSTCTLH registers as the eight LSBs and eight MSBs, re- spectively, of a single location (the HSTCTL register). The HSTCTL (host control) register controls functions such as the transfer of interrupt requests and 3 -bit status codes between a host processor and the TMS34010. These requests are typically used by software to coordinate the transfer of large blocks of data through TMS34010 local memory. The HSTCTL register also allows the host to flush the instruction cache, halt TMS34010 execution, and transmit nonmaskable interrupt requests to the TMS3401 0. The host processor uses the remaining three host interface registers to indi- rectly access selected data blocks within TMS34010 local memory. The HSTADRL and HSTADRH registers contain a 32-bit address that points to the current word location in memory. The HSTDATA register buffers data trans- ferred to and from the memory under control of the host processor. The host interface can be programmed to automatically increment the address pointer following each transfer, providing the host with rapid access to a block of se- quential locations. 6.3.2 Local Memory Interface Registers Six of the I/O registers support local memory interface functions such as: • Frequency of DRAM refresh cycles • Type of DRAM refresh cycles • Pixel size • Color plane masking • Various pixel access control parameters 6.3.3 Interrupt Interface Registers Two I/O registers monitor and mask interrupt requests to the TMS34010. These include two external and three internal interrupts. Ext ernal i nterr upt re- quests are transmitted to the TMS34010 via input pins LINT1 and LINT2. The TMS34010 can be programmed to generate an internal interrupt request in response to any of the following conditions: • Window violation - an attempt is made to write a pixel to a location in- side or outside a specified window, depending on the selected win- dowing mode. • Host interrupt - the host processor sets the INTIN interrupt request bit in the HSTCTL register. • Display interrupt - the specified line number in a frame is displayed on the monitor. A nonmaskable interrupt occurs when the host processor sets the NMI bit in the HSTCTL host interface register. Reset is controlled by a dedicated pin. 6-8 I/O Registers - Summary 6.3.4 Video Timing and Screen Refresh Registers Fifteen I/O registers support video timing and screen refresh functions. The TMS34010's on-chip CRT timing generator creates the sync and blanking signals used to drive the CRT monitor in a bit-mapped display system. The timing of these signals can be controlled through the appropriate I/O registers, allowing the TMS34010 to support various screen resolutions and interlaced or noninterlaced video. The TMS34010 directly supports VRAMs (such as the TMS4461) by gener- ating the memory-to-register cycles necessary to refresh the screen of a CRT monitor. Programmable features include the locations in memory to be dis- played on the monitor, as well as the number of horizontal scan lines displayed between individual screen -refresh cycles. The TMS34010 can optionally be programmed to synchronize to externally generated sync signals. This permits TMS34010-created graphics images to be superimposed upon externally-created images. This external sync mode can also be used to synchronize the video timing of two or more TMS34010 devices in a multiple-TMS34010 display system. 6-9 I/O Registers - Alphabetical Listing 6.4 Alphabetical Listing of I/O Registers The remainder of this section describes the I/O registers individually; they are listed in alphabetical order. Fields within each register are identified and functions associated with each register are discussed. Bits within I/O registers that are identified as reserved are not used by the TMS34010. When read, a reserved bit returns the last value written to it. No control function, however, is affected by this value. All reserved bits are loaded with Os at reset. A good software practice is to maintain Os in these bits. 6-10 Memory Control Register CONTROL Address Fields COOOOOBOh 15 14 13 12 11 10 1 CD PPOP PBV PBH W T RR RM reserved Bits Name Function 0-1 Reserved Not used 2 RM DRAM refresh mode 3-4 RR DRAM refresh rate 5 T Pixel transparency enable 6-7 W Window violation detection mode 8 PBH PixBIt horizontal direction 9 PBV PixBIt vertical direction 10-14 PPOP Pixel processing operation select 15 CD Instruction cache disable Description The CONTROL register contains several control parameters used to config- ure local memory interface operation. • R M {DRAM refresh mode, bit 2) The RM bit selects the type of DRAM refresh cycle to be performed. De- pending on the value of this bit, the TMS34010 perfo rms ea ch D RAM- refresh cycle as either a RAS-only cycle or as a CAS-before-RAS cycle. DRAMs and VRAMs that rely on the TMS34010 to generate an 8-bit row address during a refresh cycle typically use the RAS-only refresh cy cle, w hile thos e tha t generate their own 9-bit row address internally use the CAS-be- fore-RAS refresh cycle. RM Description Selects RAS-only refresh cycle 1 Selects CAS - before- R AS refresh cycle RR {DRAM refresh rate, bits 3 and 4) The RR field controls the frequency of DRAM refresh cycles. The TMS34010 automatically generates DRAM refresh cycles at regular inter- vals. The duration of the interval is specified by the value of RR. If required, DRAM refreshing can be disabled by setting RR to the appropriate value. The initial value of RR after r eset is 002- No DRAM refresh cycles are per- formed while the TMS34010 RESET signal is active. 6-11 CONTROL Memory Control Register RR Description 00 Refresh every 32 local clock periods 01 Refresh every 64 local clock periods 10 Reserved code 11 No DRAM refreshing T {Pixel transparency, bit 5) The T bit enables or disables the pixel attribute of transparency. When transparency is enabled, a value of resulting from a pixel operation on source and destination pixels is inhibited from overwriting the destination pixel. In the case of a replace operation (PPOP = 0), a source pixel value of is inhibited from overwriting the destination pixel. Disabling transpar- ency allows a pixel value of to be written to the destination. T Effect Disable transparency 1 Enable transparency W ( Window checking, bits 6 and 7) The W field selects the course of action to be taken when a pixel operation will cause a pixel to be written to a location lying either inside or outside the specified window limits. Window checking applies only to attempts to write to pixel locations defined by XY addresses; writes to pixel locations defined by linear memory addresses are not affected. Nonpixel data writes are not affected. w Description 00 No pixel writes are inhibited, and no interrupt requests are generated 01 Generate interrupt request on attempt to write to pixel lying inside window, and inhibit all pixel writes 10 Generate interrupt request on attempt to write to pixel lying outside window 11 Inhibit pixel writes outside window, but do not request interrupt A request for a window violation interrupt can occur when W=012 or W=102- The WVP bit in the INTPEND register is set to 1 to indicate that a window violation has occurred. This in turn causes the TMS34010 to be interrupted if the WVE bit in the INTENB register and the status IE bit are set to 1 . PBH (PixB It horizontal direction, bit 8) The PBH bit determines the horizontal direction (increasing X or decreasing X) of pixel processing for the following instructions: PIXBLT XY,XY PIXBLT L,XY 6-12 Memory Control Register CONTROL PIXBLT XY,L PIXBLT L,L PBH Effect Increment X (move from left to right) 1 Decrement X (move from right to left) PBV (PixB/t vertical direction, bit 9) The PBV bit determines the vertical direction (increasing Y or decreasing Y) of pixel processing for the following instructions: PIXBLT XY,XY PIXBLT L,XY PIXBLT XY,L PIXBLT L,L PBV Effectt Increment Y (move from top to bottom) 1 Decrement Y (move from bottom to top) 1" Default screen origin assumed PPOP {Pixel processing operation, bits 10-14) The PPOP field selects the operation to be performed on the source and destination pixels during a pixel operation. The following 16 PPOP codes perform Boolean operations on pixels of 1 , 2, 4, 8, and 1 6 bits. PPOP Operation Description 00000 S -► D Replace destination with source 00001 SAND D -♦ D AND source with destination 00010 S AND D-" D AND source with NOT destination 00011 -* D Replace destination with 0s 00100 SORDID OR source with NOT destination 00101 SXNOR D -» D XNOR source with destination 00110 D -» D Negate destination 00111 S NOR D -» D NOR source with destination 01000 SORDID OR source with destination 01001 D -• D No change in destination"!" 01010 SXOR D -> D XOR source with destination 01011 SAND D -* D AND NOT source with destination 01100 1 -* D Replace destination with 1s 01101 SORDID OR NOT source with destination 01110 S NAND D -* D NAND source with destination 01111 5-+ D Replace destination with NOT source Although the destination array is not changed by this operation, memory cycles still occur. The following six PPOP codes perform arithmetic operations on 4- 1 6-bit pixels (but not 1 or 2 bits). 8-, and 6-13 CONTROL Memory Control Register PPOP Operation Description 10000 D + S -» D Add source to destination 10001 ADDS(D,S) -♦ D Add S to D with saturation 10010 D - S -» D Subtract source from destination 10011 SUBS(D,S) -» D Subtract S from D with saturation 10100 MAX(D,S) -► D Maximum of source and destination 10101 MIN(D,S) -» D Minimum of source and destination PPOP codes 1 01 1 02 through 1 1 1 1 1 2 are reserved. Standard addition and subtraction allow the result of the operation to over- flow. However, add-with-saturation and subtract-with-saturation (ADDS and SUBS) do not allow overflow or underflow. In cases in which addition would allow an overflow, ADDS produces a result whose value is all 1s. In cases in which subtraction would allow an underflow, SUBS produces a result whose value is all 0s. CD {Cache disable, bit 15) The CD bit selectively enables or disables the instruction cache. CD Effect Enable instruction cache 1 Disable instruction cache When the cache is disabled, cache contents (including data, P flags, SSA registers, and so on) remain undisturbed. While the cache remains disabled, all instructions are fetched from memory rather than cache. When the cache is subsequently enabled, its previous state (before it was disabled) is re- stored. The instructions retained within the cache are once again available for execution. 6-14 Destination Pitch Conversion Factor COIMVDP Address Description C00001 40h 15 14 13 12 11 10 8 1 CONVDP CONVDP is a full 16-bit register that contains a control parameter used during execution of a pixel operation instruction. CONVDP is used with: • XY addressing • Window clipping • PIXBLTs or FILLS (except for PIXBLT L,L) that process pixels from the bottom of the array to the top (PBV=1 ) CONVDP is calculated as the result of an LMO instruction whose input operand is the destination pitch value in register B3 (DPTCH). The fol- lowing assembly code calculates the CONVDP value. LMO B3,A0 MOVE A0,@CONVDP,0 Convert DPTCH value Place result in CONVDP register In this example, A0 is used as a scratch register. Constant CONVDP has the value 0C0000140h, and the size of Field is 16 bits. TMS34010 internal hardware uses the CONVDP value during XY-to-linear conversion of a destination address. PIXBLT and FILL instructions which specify the destination address in XY format use the DPTCH and CONVDP values to convert the XY coordinates to a linear memory address before actually beginning the pixel block move. During a PIXBLT or FILL in- struction that requires preclipping of the destination array in the Y direction, the TMS34010 uses the CONVDP value to calculate the effect of the clipped starting Y coordinate on the starting linear address of the destina- tion array. When a PIXBLT instruction's starting Y coordinate is specified to lie in one of the lower two corners of the destination array (when PBV=1), the TMS34010 uses CONVDP to calculate the linear address corresponding to the specified starting coordinates. The value contained in the five LSBs of CONVDP should be the 1s com- plement of log2(DPTCH). When an XY address is specified for the desti- nation, DPTCH must be a power of two; thus, log2(DPTCH) is an integer. During XY-to-linear conversion, the product of the Y value and the desti- nation pitch is calculated by shifting Y left by log2(DPTCH). One instruction, the PIXBLT XY,L instruction, specifies the destination ad- dress in linear format but also requires DPTCH to be a power of two. This restriction is necessary when the PBV bit is set to 1 . 6-15 CONVSP Source Pitch Conversion Factor Address Description C00001 30h 15 14 13 12 11 10 8 1 CONVSP CONVSP is a full 16-bit register that contains a control parameter used during execution of a pixel operation instruction. CONVSP is used with: • XY addressing • Window clipping • PIXBLTs or FILLS (except for PIXBLT L,L) that process pixels from the bottom of the array to the top (PBV=1 ) CONVSP is calculated as the result of an LMO instruction whose input operand is the source pitch value in register B1 (SPTCH). The following assembly code calculates the CONVSP value LMO B1,A0 MOVE A0,§CONVSP Convert SPTCH value Place result in CONVSP register In this example, A0 is used as a scratch register. Constant CONVSP has the value 0C00001 30h, and the size of Field is 1 6 bits. TMS34010 internal hardware uses the CONVSP value during XY-to-linear conversion of a source address. PIXBLT and FILL instructions which spe- cify the source address in XY format use the SPTCH and CONVSP values to convert the XY coordinates to a linear memory address before actually beginning the pixel block move. During a PIXBLT or FILL instruction that requires preclipping of the destination array in the Y direction, the starting source address is modified to accommodate the resulting changes to the starting destination address. When a PIXBLT instruction's starting Y coor- dinate is specified to lie in one of the lower two corners of the destination array (when PBV=1), the TMS34010 uses CONVSP to calculate the linear address at the corresponding corner of the source array. The value contained in the five LSBs of CONVSP should be the 1s com- plement of log2 (SPTCH). When an XY address is specified for the source, SPTCH must be a power of two; thus, log2(SPTCH) is an integer. During XY-to-linear conversion, the product of the Y value and the source pitch is calculated by shifting Y left by log2(SPTCH). Two instructions that specify the source address in linear format also require SPTCH to be a power of two. This is necessary when window clipping is required during execution of either of the following instructions: • PIXBLT B,XY • PIXBLT L,XY It is also necessary when either of these two instructions is executed and the PBV bit in the CONTROL register is set to 1 . If PBV=0 and window clipping is disabled, or if window clipping is enabled but the specified array does not require preclipping in the Y dimension, CONVSP is not used, and SPTCH is not required to be a power of two. 6-16 Display Address Register DPYADR Address Fields Description C00001 EOh 15 14 13 12 11 10 8 1 SRFADR LNCNT Bits Name Function 0-1 LNCNT Scan line counter 2-15 SRFADR Screen refresh address The 16-bit DPYADR register contains two separate counters that control the generation of screen -refresh cycles. A screen -refresh cycle transfers the video data for a new scan line to the VRAMs' serial data registers. LNCNT (Scan line counter, bits and 1) LNCNT counts the number of scan lines output to the screen between suc- cessive screen -refresh cycles. Providing explicit control over the line count permits the implementation of systems that do not reload the VRAMs' in- ternal serial data register on every horizontal scan line. The two-bit LNCNT field is loaded from the two-bit LCSTRT field of the DPYSTRT register at the end of each screen -refresh cycle. The value loaded determines whether the next screen -refresh cycle occurs after 1 , 2, 3 or 4 scan lines: - When LCSTRT = 0, a screen -refresh cycle occurs after every line. - When LCSTRT = 1, 2 or 3, a screen -refresh cycle occurs after every 2, 3 or 4 lines, respectively. SRFADR (Screen refresh address, bits 2-15) SRFADR is the source of the row and column addresses output during a screen -refresh cycle. The 14 bits of SRFADR are output as logical address bits 10-23 during screen -refresh cycles. During row address time, DPYADR4-DPYADR15 are output on LAD0-LAD11, and 0s are output on the remaining LAD pins (except as modified by the contents of the DPYTAP register). During column address time, DPYADR2-DPYADR7 are output on LAD6-LAD11 and 0s are output on the remaining LAD lines. Following the completion of each screen -refresh cycle, the value in SRFADR is dec- remented by the amount indicated in the DUDATE field of the DPYCTL re- gister. The following diagrams illustrate the mapping of bits to LAD0-LAD15 from 1 ) The logical address as seen by the programmer and 2) The bits of the DPYADR register The bits of a 32-bit logical address are numbered to 31, beginning with the LSB. The 14 MSBs of DPYADR, shown in Figure 6-2, are output as logical address bits 10-23 during a screen -refresh cycle. DPYADR2 corre- sponds to logical address bit 10, DPYADR3 corresponds to logical address bit 1 1, and so on. 6-17 DPYADR Display Address Register DPYADR Logical Address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ILNCNTJ SRFADR 23 22 21 20 19 18 17 16 15 14 13 12 11 10 Figure 6-2. Correlation Between SRFADR and Logical Address Bits Figure 6-3 shows the mapping of logical addresses to LAD0-LAD15 during the row and column address times of the cycle. The symbol xx indicates status information output with the row and column addresses. LAD Pin Number 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Logical Row Address Bits XX 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 Row Address Corresponding DPYADR bits 15 14 13 12 11 10 9 8 7 6 5 4 Time Logical Column Address Bits XX XX 29 28 27 14 13 12 11 10 9 8 7 6 5 4 Column Address Corresponding DPYADR bits 7 6 5 4 3 2 Time Figure 6-3. Correlation Between DPYADR Bits and Row/Column Addresses A board designer typically selects eight consecutive address lines from LAD0-LAD1 1 to connect to the multiplexed address inputs of the VRAMs. For example, by selecting the eight lines LAD2-LAD9, bits 14-21 of the logical address become the row address bits output to the RAMs, and bits 6-13 of the logical address become the column address bits. This means that during a screen -refresh cycle, bits 6-13 of DPYADR become the row address bits output to the RAMs, and bits 4-5 of DPYADR become the two MSBs of the tap point address. 6-18 Display Control Register DPYCTL Address Bit Assignments C0000080h 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ENV NIL DXV SRE SRT ORG DUDATE Res HSD Fields Description Bits Name Function HSD Horizontal sync direction 1 Reserved Not used 2-9 DUDATE Display address update 10 ORG Screen origin select 11 SRT Shift register transfer enable 12 SRE Screen refresh enable 13 DXV Disable external video 14 NIL Noninterlaced video enable 15 ENV Enable video The DPYCTL register contains several parameters that control video timing signals and serial-register transfer cycles using VRAMs. HSD {Horizontal sync direction, bit 0) The HSD bit controls the direction (input or output) of the HSYNC (hori- zontal sync ) pin w hen the TMS34010 is in external video mode ( DXV=0). If HSD=0, HSYNC is configured as an input, the same as VSYNC. In this case, the on-chip horizontal sync interval begins when either: - The start of the external horizontal sync pulse input at the HSYNC pin is detected, or H COUNT = HTOTAL, whichever condition occurs first. VSYNC and HSYNC are configured as in- puts or outputs according to the values of the HSD and DXV bits: HSD DXV HSYNC VSYNC Input input 1 Output Output 1 Output Input 1 1 Undefined When VSYNC and HSYNC are both configured as inputs, the on-chip vertical sync interval begins when any of the following conditions occur: The start of the external vertical sync pulse input at the VSYNC pin is detected, or VCOUNT=VJOTAL, and the start of the horizontal sync pulse input at the HSYNC pin is detected, or VCOUNT=VTOTAL and HCOUNT= HTOTAL 6-19 DPYCTL Display Control Register When VSYNC is an input and HSYNC is an output, the vertical sync interval begins when either the first or third of the listed conditions occurs. DUDATE {Display update amount, bits 2-9) The DUDATE field indicates the amount by which the SRFADR field in the DPYADR register is incremented (if ORG=0) or decremented (ORG = 1) following completion of each memory-to-register cycle used to refresh the screen. DUDATE is loaded with a value containing seven Os and a single 1. The 1 indicates the bit position at which DPYADR is to be incremented (or decremented if ORG=1 ). Increment DUDATE Size 00000000 00000001 1 00000010 2 00000100 4 00001000 8 00010000 16 00100000 32 01 000000 64 10000000 128 The increment size is undefined when more than one bit in the DUDATE field is a 1. When interlaced scan mode is enabled, SRFADR is increment- ed/decremented by half the value indicated in DUDATE at the start of a vertical blanking interval preceding the start of an even field, just after DPYADR2-DPYADR15 have been loaded from DPYSTRT2-DPYSTRT15. For noninterlaced scanning, DUDATE is programmed to increment the screen address by one scan line. For interlaced scanning, DUDATE is pro- grammed to increment the screen address by two scan lines. Larger incre- ments are typically not used since screen -refresh cycles do not occur more often than once per active scan line. ORG {Screen origin select, bit 10) The ORG bit controls the origin of the screen coordinate system. ORG Effect XY coordinate origin located in upper left corner of screen 1 XY coordinate origin located in lower left corner of screen If ORG=0 then DPYADR is updated by being incremented by the value in the DUDATE field. If ORG = 1 then DPYADR is updated by being decre- mented by the value in the DUDATE field. Unless explicitly stated other- wise, the discussion in this document assumes that the default origin (ORG=0) is used. 6-20 Display Control Register DPYCTL SRT {Shift- register-transfer enable, bit 11) The SRT bit enables conversion of an ordinary pixel access into a VRAM serial-register transfer cycle. SRT Effect Pixel access cycles occur normally 1 Pixel access cycles are converted into VRAM shift-register-transfer cycles The TMS34010 instruction set includes several instructions (DRAV, PIXT, LINE, FILL, and PIXBLT) that operate specifically on pixels. By default, SRT=0 and memory accesses performed during accesses of pixel data are the usual memory read and write cycles. When SRT=1, however, accesses of pixel data are converted to shift- register-transfer cycles: - A pixel read cycle is converted to a memory-to-register cycle - A pixel write cycle is converted to a register-to-memory cycle This register-transfer cycle is performed under explicit program control, as opposed to the screen -refresh cycles enabled by the SRE bit, which are au- tomatically generated at regular intervals. Uses of the SRT bit include bulk initialization of the entire VRAM array; the entire screen can be cleared to a specified background color in only 256 memory cycles. (While the TMS4461 has this capability, not all VRAMs support this function.) Only pixel accesses are affected by the state of the SRT bit. Instruction fetches and non -pixel data accesses are not altered in any way. SRE {Screen-refresh enable, bit 12) The SRE bit enables automatic screen refreshing. Screen refreshes are per- formed by means of the VRAM memory-to-register cycles which the TMS34010 performs automatically during selected horizontal blanking in- tervals. The frequency of screen -refresh cycles and the generation of the addresses output during these cycles are programmed by means of the DPYSTRT and DPYCTL registers. SRE Effect Disable screen refresh 1 Enable screen refresh Changing the value of the SRE bit affects screen refreshes with the start of the next horizontal blanking interval. When SRE changes from to 1, the first screen -refresh cycle occurs at the start of the next horizontal blanking level. When SRE changes from 1 to 0, screen -refresh cycles are disabled beginning at the start of the next horizontal blanking level. 6-21 DPYCTL Display Control Register DXV {Disable external video, bit 13) The DXV bit selects between internally generated or externally generated video timing. DXV Effect Selects external video source 1 Selects internally generated video timing When DXV=0, the TMS34010 vide o timin g circuitry is programmed to lock onto an external video source. The VSYNC pin is configured a s an inp ut and is connected to an external vertical sync signal. If HSD=0, HSYNC is also configured as an input and is connected to an external horizontal sync sig- nal. When DXV=1, the TMS34010 generates its own video ti ming, a ccor ding to the values loaded into the video timing registers. The HSYNC and VSYNC pins are configured as outputs, and provide the horizontal and vertical sync signals required to drive the video monitor. NIL {Noninterlaced video enable, bit 14) The NIL bit selects between an interlaced or a noninterlaced display. The video timing signals output by the TMS3401 are modified according to this selection. The timing differences between interlaced and noninterlaced displays are described in Section 9. NIL Effect Selects interlaced video timing 1 Selects noninterlaced video timing ENV {Enable video, bit 15) The ENV bit enables or disables the video display. The displ ay rema ins blanked when ENV=0. During this time, the signal output at the BLANK pin is forced to remain at its active-low level throughout the frame, and setting of the DIP (display interrupt) bit in the INTPEND register is inhibited. (If DIP is already set at the time the ENV is changed from 1 to 0, DIP remains set unt il explicitly cleared.) When ENV=1, the video display is enabled. The BLANK output signal is controlled according to the parameters contained in the video timing registers, and the DIP bit becomes set when the condition VCOUNT = DPYINT occurs. ENV Effect Blank entire screen 1 Enable video 6-22 Display Interrupt Register DPYINT Address Description COOOOOAOh 15 14 13 12 11 10 9 8 1 DPYINT The DPYINT register designates the next scan line at which a display in- terrupt will be requested. This register facilitates the coordination of soft- ware activity with the refreshing of selected horizontal lines on the screen of a video monitor. The contents of DPYINT are compared to the VCOUNT register. When VCOUNT = DPYINT, a display interrupt is requested and the DIP bit in the INTPEND register is set to 1 . This coincides with the start of the horizontal blanking interval that marks the end of the line designated by the value contained in DPYINT. For split-screen applications, a new value can be loaded into the DPYADR register immediately following detection of the 0-to-1 transition of DIP. The new DPYADR value will not affect the line that immediately follows the end of the current horizontal blanking interval, but will affect the next line. The details of this timing are as follows. A screen -refresh cycle may be scheduled to occur at the start of the same horizontal blanking interval during which DIP becomes set. At the end of the screen -refresh cycle, the screen -refresh address in the DPYADR register will be automatically incre- mented. Requests for screen -refresh cycles have a higher priority than re- quests for cycles initiated by the on-chip processor. Hence, if the processor loads a new value into DPYADR immediately following detection of DIP's transition from to 1 , the value will become the address used for the next screen -refresh cycle, which cannot occur before the next horizontal blank- ing interval. Between the time that DIP becomes set to 1 and the com- pletion of the next screen -refresh cycle at least one full scan line later, the DPYADR register is guaranteed not to be incremented. Its contents will change during this interval only if it is loaded with a new value under ex- plicit program control. The display interrupt is disabled when the ENV bit in the DPYCTL register is 0. 6-23 DPYSTRT Display Start Address Register Address Fields Description C0000090h 15 14 13 12 11 10 8 1 SRSTRT LCSTRT Bits Name Function 0-1 LCSTRT Starting line count 2-15 SRSTRT Starting screen -refresh address The DPYSTRT register contains two parameters that control the automatic memory-to-register cycles necessary to refresh the screen. LCSTRT (Starting line count, bits and 1) LCSTRT is a two-bit code designating the number of scan lines to be dis- played between screen refreshes. LCSTRT Value Scan Lines Between Refresh Cycles 00 01 1 1 1 1 2 3 4 LCSTRT is loaded into the LNCNT field of the DPYADR register at the end of each screen -refresh cycle. LCSTRT is also loaded into LNCNT at the start of the last horizontal blanking interval preceding the first active scan line of a new frame. SRSTRT (Starting screen -refresh address, bits 2-15) The 14-bit SRSTRT field contains the starting address loaded into the DPYADR register at the start of each frame. Its value identifies the start of the region of the graphics bit map to be displayed on the screen. SRSTRT is loaded into the SRFADR field of the DPYADR register at the beginning of each vertical blanking interval. (Loading occurs coincides with the start of the horizontal blanking interval at the end of the last active scan line in the frame.) The sense of the SRSTRT value depends on the value of the ORG (origin select) bit in the DPYCTL register. When ORG=0, SRSTRT is loaded with the 1's complement of the starting address. When ORG = 1, SRSTRT is loaded with the unmodified starting address. Regardless of the value of the ORG bit, the starting address points to the location in memory of the first pixel output to the screen during each frame. For a typical CRT display, the first pixel of each frame is output to the top left corner of the screen. Refer to the description of the DPYADR register for more information on the generation of screen -refresh addresses. 6-24 Display Tap Point Address Register DPYTAP Address Fields Description C00001 BOh 15 14 13 12 11 10 1 Reserved DPYTAP Bits Name Function 0-13 DPYTAP Display tap point address 14-15 Reserved Not used The DPYTAP register contains a VRAM tap point address output during a screen -refresh (memory-to-register) cycle. (The contents of DPYTAP are not output during a serial-register transfer initiated under program control while the SRT bit in the DPYCTL register is set to 1.) During a screen- refresh cycle, the 1 6 bits of the DPYTAP register are bitwise-ORed with the value output at the LAD0-LAD15 pins during the column address time. DPYTAP bit is ORed with LADO, DPYTAP bit 1 is ORed with LAD1, and so on. This means that the column address output during the cycle is the OR of bits 2-7 of DPYADR and bits 0-15 of DPYTAP. One application of the DPYTAP register is to permit horizontal panning of the screen over a frame buffer that is wider than the screen. A DPYTAP value of locates the screea at its leftmost position within the frame buffer. Incrementing DPYTAP causes the display to pan to the right through the frame buffer. DPYTAP is typically used to alter (set to a value other than all Os) only those column address bits of the SRFADR field of DPYADR that are never incremented. For instance, given a VRAM that requires an 8-bit column address, assume that SRFADR alternately sets the two MSBs of the column address to OO2, 01 2, IO2, and 11 2- In this case, DPYTAP should contain 1s only in the bit positions corresponding to the six LSBs of the column address. 6-25 HCOUNT Horizontal Count Register Address Description C00001 COh 15 14 13 12 11 10 8 1 HCOUNT The HCOUNT register is a 16-bit counter used in the generation of the horizontal sync and blanking signals. HCOUNT is incremented on the fall- ing edge of the video input clock, and is used to count the number of video clock periods per horizontal scan line. To generate horizontal sync and blanking signals, the value of HCOUNT is compared to the value of the four horizontal timing registers: HESYNC, HEBLNK, HSBLNK, and HTOTAL When external sync mode is disabled and the value in HCOUNT = HTO- TAL, HCOUNT is reset to on the next VCLK falling edge and the HSYNC output is driven active low. HCOUN T is also reset to if the external sync mode is enabled and the input signal HSYNC is driven low. Two separate, asynchronous elements of the TMS34010 logic can access the HCOUNT register: • The internal processor, which runs synchronously to local clocks LCLK1 and LCLK2, can access HCOUNT as an I/O register. • The video timing control logic, which runs synchronously to the video clock VCLK, increments and clears HCOUNT in generating the sync and blanking signals. No synchronization between these two subsystems is provided, and HCOUNT can only be reliably read or written to while VCLK is held at the logic-high level. HCOUNT is typically not read or written to except during chip test. 6-26 Horizontal End Blank Register HEBLNK Address Description C0000010h 15 14 13 12 11 10 8 1 HEBLNK The HEBLNK register is used during the generation of the blanking signal output to the video monitor. The 16-bit value loaded into HEBLNK is compared to HCOUNT, and designates the point at whic h the h orizontal blanking interval ends. The blanking signal output at the BLANK pin is a composite of the internal horizontal a nd vert ical blanking signals. When the value in HCOUNT = HEBLNK, the BLANK output is driven inactive high unless vertical blanking is currently active. Most video monitors require HEBLNK to be set to a value that is less than the value in HSBLNK, but greater than the value in HESYNC. 6-27 HESYNC Horizontal End Sync Register Address Description COOOOOOOh 15 14 13 12 11 10 8 1 HESYNC The HESYNC register is used during generation of the horizontal sync sig- nal output to the video monitor. The 16-bit value loaded into HESYNC determines the point at which the horizontal sync pulse en ds. Wh en the value in HCOUNT = HESYNC, the signal output from the HSYNC pin is driven inactive high to signal the end of the horizontal sync interval. Typical monitors require that HESYNC be set to a value less than the value con- tained in the HEBLNK register. (However, the HESYNC value is not re- quired \o be less than the HEBLNK value.) The minimum value of HESYNC isO. When external video is enabled and the HSYNC pin is configured as an in- put, HESYNC should be loaded with a value tha t ensur es that the condition HCOUNT = HESYNC occurs after the external HSYNC signal has gone in- active-high, but before HSYNC goes active low again. For example, a good HESYNC value might be the average of the values in HEBLNK and HSBLNK. 6-28 Horizontal Start Blank Register HSBLNK Address Description C0000020h 15 14 13 12 11 10 9 8 1 HSBLNK The HSBLNK register is used during generation of the blanking signal out- put to the video monitor. The 16-bit value in HSBLNK is compared to HCOUNT, and designates the point at which t he hori zontal blanking inter- val begins. The blanking signal output at the BLANK pin is a composite of the internal horizontal and vertical blankin g signals. When the condition HCOUNT = HSBLNK occurs, the BLANK output is driven from its inac- tive-high level to its active-low level (unless it is already low due to vertical blanking being active). Several internal events coincide with the start of horizontal blanking. First, when a screen -refresh cycle is programmed to occur during a particular horizontal scan line, a request for the cycle is sent to the memory controller at the beginning of the horizontal blanking interval that occurs at the end of the line. Second, if a display interrupt request is programmed to occur during a particular horizontal scan line, the request is generated at the start of horizontal blanking. Typical monitors require that HSBLNK be set to a value that is less than the value in HTOTAL, but greater than the value in HEBLNK. 6-29 HSTADRH Host Interface Address Register, High Word Address Description COOOOOEOh 15 14 13 12 11 10 8 1 HSTADRH The HSTADRH register contains the 16 MSBs of a 32-bit pointer address; the 16 LSBs are contained in HSTADRL. The contents of HSTADRL and HSTADRH are concatenated to form a single 32-bit address during an in- direct access by a host processor. The pointer address can be accessed by both the host processor and the TMS3401 0. The host accesses the pointer address through two 16-bit host interface registers that are mapped into the host's memory or I/O address space. The four LSBs of the 32-bit pointer address are forced to to point to an even word boundary in memory. If the address pointer is incremented past the largest word address in memory, it will wrap around to the lowest ad- dress (all 0s). When you use the HSTADRH and HSTADRL registers to read data indi- rectly from the host, be sure that you access them in the correct order. If LBL=0, HSTADRH should be written last. If LBL=1, HSTADRL should be written last. Note: When the TMS34010's on-chip processor writes to HSTADRH or HSTADRL, the referenced data is not automatically read into HSTDATA. For more information about the host interface, refer to Section 10. 6-30 Host Interface Address Register, Low Word HSTADRL Address Description COOOOODOh 15 14 13 12 11 10 8 1 HSTADRL The HSTADRL register contains the 16 LSBs of a 32-bit pointer address; the 16 MSBs are contained in HSTADRH. The contents of HSTADRL and HSTADRH are concatenated to form a single 32-bit address during an in- direct access by a host processor. The pointer address can be accessed by both the host processor and the TMS34010. The host accesses the pointer address through two 1 6-bit host interface registers that are mapped into the host's memory or I/O address space. The four LSBs of the 32-bit pointer address are forced to to point to an even word boundary in memory. If the address pointer is incremented past the largest word address in memory, it will wrap around to the lowest ad- dress (all 0s). When you use the HSTADRH and HSTADRL registers to read data indi- rectly from the host, be sure that you access them in the correct order. If LBL=0, HSTADRH should be written last. If LBL=1, HSTADRL should be written last. Note: When the TMS34010's on-chip processor writes to HSTADRH or HSTADRL, the referenced data is not automatically read into HSTDATA. For more information about the host interface, refer to Section 10. 6-31 HSTCTLH Host Interface Control Register, High Byte Address Bit Assignments Fields Description C00001 OOh 15 14 13 12 11 10 9 8 [ HLT | CF | LBL |lNCR|lNCW| Res |NMIM| NMI 2 1 Reserved Bits Name Function 0-7 Reserved Not used 8 NMI Nonmaskable interrupt 9 NMIM Mode bit for NMI 10 Reserved Not used 11 INCW Increment pointer address on write 12 INCR Increment pointer address on read 13 LBL Lower byte last 14 CF Cache flush 15 HLT Halt TMS34010 processing The HSTCTLH register contains seven programmable bits used to control host interface communications. A host processor can access the control bits in the HSTCTLL and HSTCTLH registers as a single host interface re- gister, HSTCTL. The bits of the host interface's HSTCTL register are mapped into two separate I/O register locations in the TMS34010's mem- ory map, HSTCTLL and HSTCTLH, to allow the TMS3401 to alter the bits in one location without affecting the bits in the other. The HSTCTLH bits can be both written to and read by both the host pro- cessor and the TMS34010. Unpredictable results occur if the TMS34010 and host simultaneously write different values to the HSTCTLH bits. Typi- cally only the host alters the bits in HSTCTLH. NMI {Nonmaskable interrupt, host to TMS34010, bit 8) The nonmaskable interrupt allows the host processor to redirect the exe- cution flow of TMS34010 processing to an NMI routine, regardless of the current state of the interrupt mask flags. The host writes a 1 to the NMI bit to send a nonmaskable interrupt request to the TMS34010. The interrupt request cannot be disabled, and will always be executed (unless the TMS34010 is reset before it can complete interrupt execution). The inter- rupt is initiated immediately upon NMI becoming set (at the time the current instruction completes execution, or in the case of a pixel array instruction, at the next interruptible point in the instruction). Once the interrupt is taken, internal logic automatically clears the NMI bit to 0. One use of the NMI is to generate a soft reset after the host downloads new program code into TMS34010 memory. Following execution of a non- maskable interrupt, screen -refresh and DRAM -refresh functions continue unaffected. The contents of internal registers other than the HSTCTL reg- ister are not altered by the interrupt, although they can be modified by the NMI service routine. 6-32 Host Interface Control Register, High Byte HSTCTLH NMIM {Nonmaskable interrupt mode, bit 9) The NMI mode bit determines whether or not the context of the interrupted program is saved when a nonmaskable interrupt occurs. When NMIM=0, the context is saved on the system stack before the NMI service routine is executed. When NMIM^I, the context is discarded when the NMI service routine is executed. The NMIM=0 mode supports applications such as single stepping of in- structions where the status and PC must be preserved between consecutive nonmaskable interrupts. When NMIM=1, a nonmaskable interrupt can be used to simulate a hardware reset in software (using the NMI vector). Saving the context may be of no benefit if either: - Control is never to be returned to the interrupt program or - The integrity of the stack pointer is suspect. The nonmaskable interrupt does not cause the I/O registers to be reset. Consequently, if an NMI is used to simulate a hardware reset, the I/O reg- isters should be reset by software within the NMI service routine. NMI NMIM Effect No effect 1 Undefined 1 NMI (save context on stack) 1 1 NMI (discard previous context) CF {Cache flush, bit 14) While CF is set to 1, the contents of the instruction cache are flushed. All four P (present) flags in the cache control logic remain forced to as long as CF remains 1. When CF=1, the cache is disabled; instruction words are fetched from local memory one at a time as they are needed for execution by the TMS34010. Normal cache operation resumes when CF is set to 0, assuming the CD bit in the CONTROL register is also 0. When the value of CF is changed from 1 to 0, the cache begins operation in the same initial state as that which immediately follows reset. One use of the CF bit is during downloads of new software from the host processor to TMS34010 local memory. By setting CF to 1 and then to again, the host processor forces the TMS34010 to begin to load new in- structions into the cache from memory rather than continue execution of stale instructions already contained in the cache. A must be loaded into CF for normal cache operation to resume. CF Effect No effect 1 Flush and disable cache 6-33 HSTCTLH Host Interface Control Register, High Byte LBL {Lower byte last, bit 13) The LBL bit specifies whether an indirect access of TMS34010 memory, initiated by a host register access, begins when the upper or lower byte of the register is accessed by the host processor. LBL is provided to accommodate host processors with 8-bit data paths. An 8-bit processor must access a 16-bit TMS34010 host interface register as a series of two 8-bit bytes. Processors which access the lower byte (bits 0-7) first and the upper byte (bits 8-1 5) second should typically set LBL to 0, and those that access bytes in the opposite sequence should set LBL to 1. When LBL is 0, a local bus cycle is initiated if: The host writes to the upper byte of HSTADRH, or - The host reads from or writes to the upper byte of HSTDATA. If LBL is 1, a local bus cycle is initiated if - The host accesses the lower byte of HSTDATA, or - The host writes to the lower byte of HSTADRL With this capability, the TMS34010 is capable of automatically resolving so called "Little- Endian/Big-Endian" byte addressing incompatibilities be- tween various processors, and promotes software transparency between 8- and 16-bit versions of the same processor architecture (such as the 8088 and 8086). LBL Effect Initiate 16-bit local bus cycle on host access of upper byte of HSTDATA, or on load of upper byte of HSTADRH 1 Initiate 16-bit local bus cycle on host access of lower byte of HSTDATA, or on load of lower byte of HSTADRL INCR {Increment address before local read, bit 12) The INCR bit controls whether or not the 32-bit address pointer contained in the HSTADRL and HSTADRH registers is incremented before each read. INCR Effect Do not increment address pointer before read cycle on local memory bus Increment address pointer before read cycle on local memory bus When INCR = 1, the 32-bit address contained in registers HSTADRL and HSTADRH is incremented by 16 before being used for the next read of the TMS34010 memory. This means that HSTDATA is updated to the contents of the next sequential word in the local memory in preparation for the next anticipated read of HSTDATA by the host processor. A local read cycle also occurs when the host loads a new address into the HSTADRL and HSTADRH registers, but the address is not incremented in this case. When incrementing is enabled, repeated reads of the HSTDATA register by the 6-34 Host Interface Control Register, High Byte HSTCTLH host result in a series of adjacent words in TMS34010 memory being read; otherwise, the same memory word is read each time. Regardless of the va- lue of the I NCR bit, each time HSTDATA is read by the host, a new word is automatically read into HSTDATA from the TMS34010's memory. INCW {Increment address after local write, bit 11) The INCW bit controls whether or not the 32-bit address pointer contained in the HSTADRL and HSTADRH registers is incremented after each write. INCW Effect Do not increment address pointer after write cycle on local memory bus Increment address pointer after write cycle on local memory bus When INCW=1, the 32-bit address contained in registers HSTADRL and HSTADRH is incremented by 16 after being used as the memory write ad- dress. When incrementing is enabled, repeated writes to the HSTDATA re- gister by the host cause a series of adjacent words in TMS34010 memory to be modified; otherwise, the same memory word is modified repeatedly. Regardless of the value of the INCW bit, each time HSTDATA is written to by the host, a new cycle is initiated to write the contents of HSTDATA to the TMS34010's memory. HLT {Halt T MS 340 10 program execution, bit 11) When the HLT bit is set to 1, the TMS34010 suspends instruction process- ing at the next instruction boundary. Once halted, the TMS3401 does not respond to interrupt requests (including NMI). Local memory refresh and video timing functions continue unaffected while the TMS34010 is halted. When HLT is again set to 0, the TMS34010 continues execution. While the TMS3401 is halted, external bus-master devices can arbitrate for, obtain, and release control of the local bus via the TMS34010 hold inter- face. While the TMS34010 is in the hold state, it cannot perform DRAM- refresh or screen -refresh cycles. The state o f the HLT bit immediately following reset is determ ined b y the state of the HCS pin at the time of the low-to-high transition of RESET: If HCS is low, HLT is set to 0, and the TMS3401 is enabled to begin executing its reset routine. If HCS is high, HLT is set to 1 , and the TMS3401 is halted. Both the host processor and TMS3401 can write to the HLT bit; this means the TMS34010 can halt itself by loading a 1 into HLT. HLT Effect Allow TMS34010 to run 1 Halt TMS3401 instruction execution 6-35 HSTCTLL Host Interface Control Register, Low Byte Address COOOOOFOh Bit Assignments 15 14 13 12 11 10 9 8 7 1 Reserved INT OUT MSGOUT INT IN MSGIN Fields Bits Name Function 0-2 MSGIN Input message buffer 3 INTIN Input interrupt bit 4-6 MSGOUT Output message buffer 7 INTOUT Output interrupt bit 8-15 Reserved Not used Description The HSTCTLL register contains eight programmable bits used to control host interface communications. A host processor can access the control bits in the HSTCTLL and HSTCTLH registers as a single host interface re- gister, HSTCTL. The bits of the host interface's HSTCTL register are mapped into two separate I/O register locations in the TMS3401 0's mem- ory map, HSTCTLL and HSTCTLH, to allow the TMS3401 to alter the bits in one location without affecting the bits in the other. he HSTCTLH bits can be read by both the host processor and the MS340T0. The following restrictions apply to writes: The MSGOUT field can be modified only by the TMS34010. The MSGIN field can be modified only by the host. The host can write a 1 to the INTIN bit, but writing a has no effect. The TMS34010 can write a to the INTIN bit, but writing a 1 has no effect. The TMS34010 can write a 1 to the INTOUT bit, but writing a has no effect. The host can write a to the INTOUT bit, but writing a 1 has no ef- fect. Internal arbitration logic permits the TMS34010 and host processor to ac- cess HSTCTLL at the same time without hazard. Synchronization of asyn- chronous signals at the host interface pins is performed internally. MSGIN {Message in, host to TMS34010, bits 0-2) The MSGIN field buffers a 3-bit interrupt message to the TMS34010 from the host. The MSGIN field can be both written to and read by the host, but only read by the TMS34010. The MSGIN field typically contains a com- mand or status code from the host, which is read by the TMS34010 in re- sponse to a host-generated interrupt (INTIN = 1 ). The meaning of this code is defined in the software of the host and TMS34010. 6-36 Host Interface Control Register, Low Byte HSTCTLL INTIN {Interrupt in, host to TMS34010, bit 3) The INTIN bit controls the interrupt request to the TMS3401 from the host. To generate an interrupt request, the host processor loads a 1 to INTIN. The TMS34010 deactivates the request by loading a to INTIN. An attempt by the host to load a to INTIN has no effect. Similarly, an attempt by the TMS34010 to load a 1 to INTIN has no effect. A read-only copy of the INTIN bit is available as the HIP bit in the INTPEND register. The HIP bit faithfully represents the state of the INTIN bit at all times. INTIN Effect No interrupt request to TMS34010 1 Send interrupt request to TMS34010 MSGOUT (Message out, TMS34010 to host, bits 4-6) The MSGOUT field buffers a 3-bit interrupt message to the host from the TMS34010. The MSGOUT field can be both written to and read by the TMS34010, but only read by the host. The MSGOUT field permits an in- terrupt request generated by means of the INTOUT bit to be qualified by an additional command or status code, the meaning of which is defined in the software of the host and TMS34010. INTOUT (Interrupt out, TMS34010 to host, bit 7) The INTOUT bit controls the interrupt request to the host processor from the TMS34010. An interru pt req uest is transmitted to the host by means of an active-low level on the H INT p in. When INTOUT is 1, HINT is driven active low; when INTOUT is 0, HINT is driven inactive high. The TMS34010 acti- vates the interrupt request by loading a 1 to INTOUT, and the host deacti- vates the interrupt request by loading a to INTOUT. An attempt by the TMS34010 to load a to INTOUT has no effect. Similarly, an attempt by the host to load a 1 to INTOUT has no effect. INTOUT Effect No interrupt request to host 1 Send interrupt request to host 6-37 HSTDATA Host Interface Data Register Address Description COOOOOCOh 15 14 13 12 11 10 8 1 HSTDATA The HSTDATA register buffers data transferred through the host interface between TMS34010 local memory and a host processor. HSTDATA can be accessed by the TMS3401 at address COOOOOCOh. It is one of the four 16-bit registers that can be accessed by the host register through the TMS34010 host interface. HSTDATA is typically accessed by the host rather than the TMS34010. Using the HSTDATA register, the host can ei- ther read the TMS34010's memory or write to it. The host initiates the in- direct access through the host interface using the 32-bit pointer address in the HSTADRL and HSTADRH registers. During each indirect access, a 16-bit word is transferred between the HSTDATA register and TMS34010 memory. The host processor can access the contents of the HSTDATA re- gister in one 16-bit data transfer or two 8-bit transfers. When the TMS34010's on-chip processor reads from or writes to HSTDATA, no au- tomatic read or write cycle takes place between HSTDATA and the memory word pointed to by HSTADRL and HSTADRH. 6-38 Horizontal Total Register HTOTAL Address Description C0000030h 15 14 13 12 11 10 9 8 1 HTOTAL The HTOTAL register is used during generation of the horizontal sync signal output to the video monitor from the TMS34010. It determines the dura- tion of each horizontal scan line on the screen in terms of the number of VCLK (video clock) periods. The contents of HTOTAL are compared with the horizontal count in HCOUNT to determine the point at which the hori- zontal sync pulse begins, which also represents the beginning of a new scan line. HCOUNT counts fro m to the value contained in HTOTAL. When HCOUNT - HTOTAL, the HSYNC output is driven active low on the next falling edge of the VCLK signal, and HCOUNT is reset to on the same clock edge. HTOTAL is loaded with a 16-bit value greater than that contained in HSBLNK, but less than or equal to 65535. In interlaced scan mode, the value in HTOTAL should be an odd number (LSB = 1) to achieve equal spacing between adjacent scan lines. The total number of VCLK video clocks in each horizontal scan line is calculat ed as H TOTAL + 1 . When external sync mode is enabled (DXV=0) and HSYNC is configured as an input (HSD=0), HTOTAL should be loaded with a value greater than the value of HCOUNT at the point at which the external sync pulse is expected. If the external sync pulse does not occur, HCOUNT will be reset when HCOUNT = HTOTAL. 6-39 INTENB Interrupt Enable Register Address C0000110h Bit Assignments 15 14 13 12 11 10 9 8 7 3 2 10 Reserved WVE DIE HIE Reserved X2E X1E Res Fields Description Bits Name Function Reserved Not used 1 X1E External interrupt 1 enable 2 X2E External interrupt 2 enable 3-8 Reserved Not used 9 HIE Host interrupt enable 10 DIE Display interrupt enable 11 WVE Window-violation interrupt enable 12-15 Reserved Not used The INTENB register contains the interrupt mask used to selectively enable the three internally and two externally generated interrupt requests. The following interrupts are enabled by the INTENB register: • External in terru pts 1 and 2 are generated by active-low signals on the input pins LINT1 and LINT2, respectively. • The host interrupt is generated when the host processor sets the IN- TIN bit in the HSTCTL register to 1 . • The display interrupt is generated when the vertical count in the VCOUNT register reaches the value contained in the DPYINT register. • The window-violation interrupt is caused by an attempt to write a pixel to a region of the bit map lying outside the limits of the cur- rently-defined window. The status register contains a global interrupt enable bit, IE. The INTENB register contains individual interrupt enable bits associated with each of the interrupts (X1 E, X2E, HIE, DIE, and WVE). Interrupts are enabled through a combination of setting the IE bit and the appropriate bit in the INTENB register. When IE=0, all interrupts are disabled regardless of the values of the bits in the INTENB register. When IE=1, each interrupt is enabled or disabled according to the corresponding enable bit in the INTENB register (1 enables the interrupt, disables it). 6-40 Interrupt Pending Register INTPEND Address Bit Assignments C00001 20h 15 14 13 12 11 10 9 8 7 3 2 1 Reserved WVP DIP HIP Reserved X2P X1P Res Fields Description Bits Name Function Reserved Not used 1 X1P External interrupt 1 pending 2 X2P External interrupt 2 pending 3-8 Reserved Not used 9 HIP Host interrupt pending 10 DIP Display interrupt pending 11 WVP Window-violation interrupt pending 15-12 Reserved Not used The INTPEND register indicates which interrupt requests are currently pending. INTPEND's six active bits indicate the status of the following in- terrupts: • External in terru pts 1 and 2 are generated by active- low signals on the input pins LINT1 and LINT2, respectively. • The host interrupt request is generated when the host processor sets the INTIN bit in the HSTCTL register to 1 . • The display interrupt request is generated when the vertical count in the VCOUNT register reaches the value contained in the DPYINT re- gister. • The window-violation interrupt request is caused by an attempt to write a pixel to a region of the bit map lying inside or outside the limits of the currently-defined window, depending on the selected win- dowing mode. The individual pending bits in the INTPEND register reflect the status of interrupt requests. The interrupt is requested if the corresponding pending bit is 1 . There is no request if the pending bit is 0. The status of each in- terrupt request is reflected in the INTPEND register regardless of whether the interrupt is enabled or not; this allows the TMS34010 to poll interrupts. The X1P an d X2P bits of IN TPEND are read only. They reflect the input levels on the LINT1 and LIN T2 pi ns, an d are not affected when the INTPEND register is written to. The LINT1 and LINT2 pins are asynchronous inputs, but the signals to these pins are synchronized internally so that the X1 P and X2P bits in the INTPEND register may be reliably read at any time. If an external interrupt is disabled, the interrupt request is ignored, even though the corresponding pending flag in INTPEND is set. The interrupt will be taken by the TMS34010 only if the external request is maintained at the corresponding interrupt request pin until the interrupt is again enabled. 6-41 INTPEND Interrupt Pending Register The DIP and WVP bits in the INTPEND register reflect the status of interrupt requests generated by conditions internal to the TMS3401 0. These two bits are implemented as latches. Once set, DIP or WVP will remain set until a is written to it (or the TMS3401 is reset). Writing a 1 to either of these bits has no effect at any time. While an internal interrupt is disabled, the interrupt request is ignored, even though the corresponding pending flag in INTPEND is set. If the interrupt is subsequently enabled while the in- terrupt pending flag remains set (because of a prior interrupt request) then the interrupt will be taken by the TMS34010. The HIP bit in the INTPEND register is a read-only bit that always displays the current contents of the INTIN bit in the HSTCTL register. Writing to the INTPEND register has no effect on the HIP bit. A host interrupt request is generated when the host processor writes a 1 to the INTIN bit of the HSTCTL register. The TMS34010 clears the interrupt request by writing a to the INTIN bit. 6-42 Plane Mask Register PMASK Address Description C00001 60h 15 14 13 12 11 10 8 1 PMASK The PMASK register selectively enables or disables various planes in the bit map of a display system in which each pixel is represented by multiple bits. PMASK contains a 16-bit value that determines which bits of each pixel can be modified during execution of a DRAV, PIXT, FILL, LINE, or PIXBLT instruction. Via the PMASK register, the programmer specifies which bits within each pixel are protected (mask bit=1) and not protected (mask bit=0) from modification. During a pixel write operation, the 0s in the plane mask represent bit positions within the destination pixel that are to be modified by the pixel operation. The 1s in the plane mask represent bit positions in the destination pixel that are protected from modification. During a pixel read operation, the 0s in the mask indicate which bits within a pixel may be read; bits corresponding to 1s in the mask are always read as 0s. The organization of a display memory is sometimes described in terms of bit planes. If the pixel size is four bits, for example, and the bits in each pixel are numbered from to 3, the display memory is said to be composed of four bit planes, numbered from to 3. Plane contains all the bits numbered from all the pixels, plane 1 contains all the bits numbered 1 from all the pixels, and so on. A 4-bit mask is constructed such that bit of the mask enables (if 0) or disables (if 1 ) writes to the bits in plane 0, mask bit 1 enables or disables writes to plane 1 , and so on. The plane mask for a 4-bit pixel is four bits; the plane mask for an 8-bit pixel is eight bits; and so on. The plane mask must be replicated throughout the 16 bits of the PMASK register. For example, with four bits per pixel, the PMASK register is loaded with four identical copies of the corresponding 4-bit plane mask, as indicated below. 15 12 11 8 7 43 PMASK MASK MASK MASK MASK With a pixel size of eight bits, the corresponding 8-bit plane mask is repli- cated twice- once in bits 0-7 of PMASK, and again in bits 8-15. In gen- eral, all 1 6 bits of the register are used, and a mask for a pixel size of less than 1 6 bits must be duplicated n times, where n is 1 6 divided by the pixel size. The individual bits of the PMASK register are associated with the corre- sponding bits of the 16-bit local data bus (data are in fact multiplexed over the same LAD0-LAD15 pins as addresses). PMASK register bit is asso- ciated with bit of the data bus (the bit transferred on LADO), PMASK bit 1 is associated with bit 1 of the data bus, and so on. In general, if PMASK bit n is a 0, then bit n of the data bus is enabled by the mask; if PMASK bit n is a 1 , bit n is disabled by the mask. Plane masking is effectively disabled (allowing all bits of each pixel to be modified) by loading all 0s into the PMASK register. This is the default state of PMASK following reset. 6-43 PMASK Plane Mask Register To maintain upward compatibility with future versions of the GSP, software drivers should treat the PMASK register as a 32-bit register beginning at address C00001 60h. In other words, software should write the plane mask value not only to the 16-bit word at address C0000160h, but also to the word at C0000170h. Writing the second word will have no effect on the TMS34010, but will ensure software compatibility with future graphics processors which may extend the PMASK register from 1 6 to 32 bits. 6-44 Pixel Size Register PSIZE Address Description C00001 50h 15 14 13 12 11 10 9 8 1 PSIZE The PSIZE register is used to specify the pixel size in bits. If the pixel size is four, for example, PSIZE is loaded with the value four. If the pixel size is eight, PSIZE is loaded with the value eight, and so on. All 1 6 bits of the PSIZE register can be written to or read. Legal pixel sizes are 1 , 2, 4, 8, and 16 bits; any other value of PSIZE is undefined. PSIZE Pixel Size 0001 h 1 bit/pixel 0002h 2 bits/pixel 0004 h 4 bits/pixel 0008h 8 bits/pixel 001 Oh 1 6 bits/pixel 6-45 REFCNT Refresh Count Register Address Fields Description C00001 FOh 15 14 13 12 11 10 9 8 1 ROWADR RINTVL Reserved Bits Name Function 0-1 Reserved Not used 2-7 RINTVL Refresh interval 8-15 ROWADR Row address The REFCNT register generates the addresses output during DRAM refresh cycles and counts the intervals between successive DRAM refresh cycles. DRAMs require periodic refreshing to retain their data. The TMS34010 automatically generates DRAM refresh cycles at regular intervals. The in- terval between refresh cycles is programmable. The DRAM refresh mode is selected by loading the appropriate value to the two-bit RR (refresh rate) field in the CONTROL register. DRAM refreshing can be disabled in sys- tems that do not require it. The modes are defined as follows. RR Description 00 Refresh every 32 local clock periods 01 Refresh every 64 local clock periods 10 Reserved for future expansion 11 No DRAM refreshing At reset, the RR field is set to the initial value OO2. During the time that the reset signal to the TMS34010 is active, no DRAM-refresh cycles are per- formed. Bits 2-15 of REFCNT form a continuous binary counter. Bits 2-7 form the RINTVL field, which counts the intervals between successive requests for DRAM-refresh cycles. When RR=012, the RINTVL field is decremented by 1 every local clock cycle; that is, the register is decremented at bit 2. This means that RINTVL underflows into ROWADR (a borrow ripples from bit 7 to bit 8 of REFCNT) every 64 local clock cycles. The underflow has two effects: • ROWADR is decremented by 1 and • A request for a DRAM-refresh cycle is sent to the memory control logic. When RR=0(>2, the RINTVL field is decremented by 2 every local clock period. This means that a DRAM-refresh cycle is generated every 32 local clock periods, twice the rate that results when RR=012- When RR = 112, DRAM refreshing is disabled and no DRAM-refresh cycles occur. 6-46 Refresh Count Register REFCNT During a DRAM-refresh cycle, the row address output to memory is taken from the 8-bit ROWADR field of REFCNT. Specifically, bits 8-15 of REFCNT are output on LAD0-LAD7. REFCNT bits 8-1 4 are simultaneously output on LAD8-LAD1 4. (The RF bus status signal is output as a low level on LAD15.) This means that the 8-bit row address needed to refresh a DRAM can be taken from any eight adjacent LAD pins in the range LAD0-LAD14. Note that as ROWADR counts from 255 to 0, the refresh addresses output at the selected eight LAD pins will sequence through all 256 values in the range 255 to 0, though not necessarily in the same order as ROWADR. REFCNT is set to at reset; after that, refresh address generation is auto- matic. Typically there is no reason to read this register or write to it, al- though it can be accessed similarly to the way other I/O registers are accessed. In order to reliably write a value to REFCNT, DRAM refresh should be disabled (by setting RR to 11 2) before writing to REFCNT. 6-47 VCOUNT Vertical Count Register Address Description C00001 DOh 15 14 13 12 11 10 8 VCOUNT The VCOUNT register is a 16-bit counter used during generation of the vertical sync and blanking signals. VCOUNT counts the horizontal lines in the video display, incrementing at the same clock edge at whic h H COUNT is internally reset to 0. This causes the falling edges of HSYNC and VSYNC to coincide. In order to generate vertical sync and blanking signals, the value of VCOUNT is compared to the value of the four vertical timing registers, VESYNC, VEBLNK, VSBLNK, and VTOTAL When HCOUNT = HTOTAL and VCOUNT = VTOTAL at th e same time, VCOUNT is reset to on the next VCLK falling edge and the VSYNC output is driven active low. If interlaced scan mode is enabled and the current field is even, and if VCOUNT = VTO TAL and HCOUNT - HTOTAL/2, then VCOUNT is reset to and VSYNC goes low (HCOUNT is not reset until it reaches the value HCOUNT = HTOT AL). W hen external sync mode is enabled, VCOUNT is reset to when the VSYNC input signal goes active low. A display interrupt request is generated when VCOUNT = DPYINT. This can be used to coordinate software activity with the refreshing of selected lines on the screen. Two separate, asynchronous elements of the TMS34010 internal logic can access VCOUNT: • The internal processor, which runs synchronously to local clocks LCLK1 and LCLK2, can access VCOUNT as an I/O register. • The video timing control logic, which runs synchronously to the video clock VCLK, increments and clears VCOUNT in the course of gener- ating the sync and blanking signals. No synchronization between these two subsystems is provided, and VCOUNT can only be reliably read or written while VCLK is held at the logic-high level. VCOUNT is typically not read or written to except during chip test. 6-48 Vertical End Blank Register VEBLNK Address Description C0000050h 15 14 13 12 11 10 9 8 1 VEBLNK VEBLNK is a video timing register that designates the time at which the vertical blanking interval ends. The 16-bit value contained in VEBLNK is compared to VCOUNT to determine when to end the vertical blanking in- terval. The vertical blanking interval ends when the following conditions are satisfied: • VCOUNT - VEBLNK • HCOUNT = HTOTAL The end of the vertical blanking interval coincides with the start of the horizontal sync, occurring at a time when the interna l horizo ntal blanking signal is active. The blanking signal output from the BLANK pin is a com- posite of the horizontal and vertical blanking signals generated internally, and will not reach its inactive-high level until both internal blanking signals have become inactive. When external video is enabled (DXV=0) and the HSYNC pin is configured as an input (HSD=0), the vertical blanking interval ends when the follow- ing conditions are satisfied: • VCOUNT = VEBLNK and • The leading edge of the external horizontal sync pulse is detected The be ginning of the sync pulse is seen as a high-to-low transition at the HSYNC pin. Typical video monitors require VEBLNK to be set to a value less than the value in VSBLNK, and greater than the value in VESYNC. 6-49 VESYNC Vertical End Sync Register Address Description C0000040h 15 14 13 12 11 10 9 8 1 VESYNC VESYNC is a video timing register that designates the time at which the vertical sync pulse ends. The 16-bit value contained in VESYNC is com- pared to VCOUNT to determine when to end the vertical sync pulse. The sync pulse ends when the following conditions are satisfied: • VCOUNT = VESYNC • HCOUNT - HTOTAL The VSYNC output is driven inactive high to signal the end of the vertical sync interval. When interlaced mode is enabled and the next vertical field is odd, VSYNC is driven high when VCOUNT = VESYNC and HCOUNT = HTOTAL/2. Typical video monitors require VESYNC to be set to a value less than the value contained in the VEBLNK register; the minimum value of VESYNC is 0. When external sync mode is enabled (DXV=0), the end of t he exte rnal vertical sync pulse is detected as a low-to- high transition at the VSYNC pin, which is configured as an input. VESYNC should be loaded with a value greater than the value in VCOUNT at the point at which the external VSYNC input signal shoul d go ina ctive high, but lower than the value in VCOUNT when the external VSYNC should again become active low. For example, VESYNC could be loaded with the sum of the values in VEBLNK and VSBLNK divided by two. 6-50 Vertical Start Blank Register VSBLNK Address Description C0000060h 15 14 13 12 11 10 8 1 VSBLNK VSBLNK is a video timing register that designates the time at which the vertical blanking interval starts. The 16-bit value contained in VSBLNK is compared to VCOUNT to determine when to start the vertical blanking in- terval. The vertical blanking interval starts when the following conditions are satisfied: • VCOUNT = VSBLNK • H COUNT = HTOTAL The start of the vertical blanking interval coincides with the start of the horizontal sync, occurring at a time when the interna l horizo ntal blanking signal is active. The blanking signal output from the BLANK pin is a com- posite of the horizontal and vertical blanking signals generated internally, and reaches its active-low level when either or both internal blanking sig- nals are active. When external video is enabled (DXV=0) and the HSYNC pin is configured as an input (HSD=0), the vertical blanking interval starts when the follow- ing conditions are satisfied: • VCOUNT = VSBLNK • The leading edge of the external horizontal sync pulse is detected The begin ning of the horizontal sync pulse is seen as a high-to-low transi- tion at the HSYNC pin. VSBLNK should be set to a value less than the value in VTOTAL, and greater than the value in VEBLNK. 6-51 VTOTAL Vertical Total Register Address Description C0000070h 15 14 13 12 11 10 8 1 VTOTAL VTOTAL contains a 16-bit value that designates the value of VCOUNT at which the vertical sync pulse begins. The contents of VTOTAL are com- pared to VCOUNT to determine when to start the vertical sync pulse. Ver- tical sync begins when the following two conditions are satisfied: • VCOUNT = VTOTAL • HCOUNT = HTOTAL These conditions cause HCOUNT to begin counting from again. The VSYNC output is driven active low to s ignal th e sta rt of the vertical sync interval. The high-to-low transitions of VSYNC and HSYNC occur at the same clock edge. When interlaced mode is enabled and the next vertical field is odd, VSYNC is driven low when VCOUNT - VESYNC and HCOUNT = HTOTAL/2. The total number of horizontal lines in each vertical field is calculated as VTO- TAL + 1 . In interlaced mode the total number of horizontal lines in both fields of the vertical frame is calculated as 2x VTOTAL-1 . When external video is enabled (DXV=0), the VSYNC pin is c onfigur ed as an input rather than an output. The high-to-low transition of VSYNC is re- cognized as the beginning of the vertical sync pulse, unless the condition VCOUNT = VTOTAL and the start of horizontal sync are detected first. VTOTAL should be loaded with a value at least as large as the value of VCOUNT at which the external sync pulse should begin. Should the ex- ternal sync pulse not occur, VCOUNT will be reset one VCLK period after the conditions VCOUNT = VTOTAL and HCOUNT = HTOTAL occur. VTOTAL should be set to a value greater than the value in VSBLNK. The maximum value that can be loaded into VTOTAL is 65535. 6-52 Section 7 Graphics Operations This section provides an overview of the graphics drawing capabilities of the TMS34010. Topics in this section include: Section Page 7.1 Graphics Operations Overview 7-2 7.2 Pixel Block Transfers 7-4 7.3 Pixel Transfers 7-10 7.4 Incremental Algorithm Support 7-10 7.5 Transparency 7-1 1 7.6 Plane Masking 7-12 7.7 Pixel Processing 7-15 7.8 Boolean Processing Examples 7-17 7.9 Multiple- Bit Pixel Operations 7-19 7.10 Window Checking 7-25 7-1 Graphics Operations - Overview 7.1 Graphics Operations Overview The TMS34010 instruction set provides several fundamental graphics drawing operations: • The PIXBLT and FILL instructions manipulate two-dimensional arrays of pixels. • The LINE instruction implements the fast inner loop of the Bresenham algorithm for drawing lines. • The DRAV (draw and advance) instruction draws a pixel and increments the pixel address by a specified amount. This function supports the im- plementation of incremental algorithms for drawing circles, ellipses, arcs, and other curves. • The PIXT (pixel transfer) instruction transfers individual pixels from one location to another. The PIXBLT instruction plays an important role in rapidly drawing high- quality, bit-mapped text. In particular, the PIXBLT B,XY and PIXBLT B,L in- structions expand character patterns stored as bit maps (at one bit per pixel) into color or gray-scale characters of 1 , 2, 4, 8 or 1 6 bits per pixel. This allows character shape information to be stored independently of attributes such as color and intensity, providing greater storage efficiency. The TMS34010 provides several methods for processing the values of the source and destination pixels before the result is written to the destination. These operations include: • Boolean and arithmetic pixel processing operations for combining source pixels with destination pixels. • A plane mask which specifies which bits within pixels can be altered during pixel operations. • Transparency, an option which permits objects written onto the screen to have transparent regions through which the background is visible. Pixel processing, plane masking, and transparency can be used simultane- ously. These operations on pixel values can be used in combination with any of the pixel drawing instructions listed above. The arithmetic operations are especially important in displays that use multiple bits per pixel to encode color or intensity information. For example, the MAX and MIN operations allow two objects with antialiased edges to be smoothly merged into a single image. The TMS34010 has features such as automatic window checking to support windowed graphics environments. Three window-checking modes are pro- vided: • Clipping a figure to fit a rectangular window. • Requesting an interrupt on an attempt to write to a pixel outside of a window. 7-2 Graphics Operations - Overview • Requesting an interrupt on an attempt to write to a pixel inside of a window. The last of these modes can be used to identify screen objects that are pointed to by a cursor. The window checking modes can be used with any of the pixel drawing instructions that use XY addressing. Window checking is optional and can be turned off. The TMS34010 provides further support for windowed environments by rap- idly detecting the following conditions: • Whether a point lies inside or outside a rectangular window. • Whether a line lies entirely inside or entirely outside a window. Lines that lie entirely outside a window can be trivially rejected, meaning that they take no further processing time. These conditions are detected via the CPW (compare point to window) instruction, which takes only one machine state to compare the XY coordinates of a point to all four sides of a window. Another operation that occurs frequently in windowed environments is calcu- lating the region where two rectangles intersect. This is a feature available with the PIXBLT and FILL instructions. Based on the window-checking mode, one of two methods can be selected to calculate the region of inter- section: • The destination pixel array is preclipped to a rectangular window before the PixBIt or fill operation begins. • The intersection of the destination pixel array with a rectangular window is calculated, but no pixels are transferred. 7-3 Graphics Operations - Pixel Block Transfers 7.2 Pixel Block Transfers The TMS34010 supports a powerful set of raster operations, known as PixBlts (pixel block transfers), that manipulate two-dimensional arrays of bits or pixels. A pixel array is defined by the following parameters: • A starting address (by default, the address of the pixel with the lowest address in the array) • A width DX (the number of pixels per row) • A height DY (the number of rows of pixels) • A pitch (the difference between the starting addresses of two successive rows) A pixel array appears as a rectangular area on the screen. The array pitch is the same in this case as the pitch of the display. The default starting address is the address of the pixel in the upper left corner of the rectangle. (This assumes that the ORG bit in the DPYCTL register and the PBH and PBV bits in the CONTROL register are all set to their default values of 0.) Two operands must be specified for a PIXBLT instruction: • A source pixel array and • A destination pixel array The two arrays must have the same width and height, although they may have different pitches. Each pixel in the source array is combined with the corre- sponding pixel of the destination array. A Boolean or arithmetic pixel proc- essing operation is selected and applied to the PIXBLT operation. The default pixel processing operation is replace. If replace is selected, source pixel values are simply copied into destination pixels. Before executing a PIXBLT instruction, load the following parameters into the appropriate GSP internal registers: DYDX Composed of two portions: DX, which specifies the width of the array, and DY, which specifies the height of the array. PSIZE Pixel size (number of bits per pixel). SADDR Starting address of source array (XY or linear address). DADDR Starting address of destination array (XY or linear address). SPTCH Source pitch, or difference in memory addresses of two vertically adjacent pixels in the source array. DPTCH Destination pitch, or difference in memory addresses of two verti- cally adjacent pixels in the destination array. If either the source or destination array is specified in XY format, the contents of the CONVSP and CONVDP registers will be used in instances in which the Y component of the starting address must be adjusted prior to the start of the 7-4 Graphics Operations - Pixel Block Transfers PixBlt. The Y component may require adjustment, either to preclip the array or to select a starting pixel in one of the lower two corners of the array. Pitches and starting addresses must be specified separately for the two arrays (source and destination). The width, height, and pixel size are common to both arrays. (During a color expand operation, only the destination pixel size is specified; the source pixel size is assumed to be one bit.) The starting address of a pixel array can be specified as a linear (memory) address or as an XY address. Window checking can be used only when the destination array is pointed to by an XY address. On-screen objects may be defined as XY arrays but may be more efficiently stored as linear arrays in off-screen memory. An array specified in linear format can be transferred to an array specified in XY format (and vice versa) by means of the PIXBLT L,XY and PIXBLT XY,L instructions. The FILL instruction fills a specified destination pixel array with the pixel value specified in the COLOR1 register. A fill operation can be thought of as a special type of PixBlt that does not use a source pixel array. The source pixel value used in pixel processing is the value in the COLOR1 register. The des- tination array of a FILL instruction can be specified in either XY or linear for- mat. 7.2.1 Color-Expand Operation The TMS34010 allows shape information to be stored separately from attri- butes such as color and intensity. A shape can be stored in compressed form as a bit map containing 1 s and Os. The color information is added as the shape is drawn to the screen; the 1s in the bit map are expanded to the specified Color 1 value, and the Os are expanded to the Color value. This saves a significant amount of memory when the pixel size in the display memory is two bits or more. Two PIXBLT instructions, PIXBLT B,XY and PIXBLT B,L, provide the color- expand capability. The source array for either instruction is a bit map (one bit per pixel) stored off-screen in linear format for greater storage efficiency. The destination array can be specified in either XY or linear format. The pixel size for the destination array is governed by the value in the PSIZE register. The colors to which the 1s and Os in the source array are expanded are specified in the COLOR1 and COLORO registers. A primary benefit of the color-expand capability is the reduction in table area needed to store text fonts. Font bit maps are stored in compressed form at one bit per pixel. The color-expand operation adds color to a character shape at draw time, allowing color to be treated as an attribute separate from the shape of the character. The alternative would be to store the fonts in expanded form, which can be costly. The amount of table storage necessary to store red letters A-Z, blue letters A-Z, and so on, multiplied by the number of font styles needed for an application program, would be prohibitive. Furthermore, the color-expand operation is inherently faster than using pre-expanded fonts because far fewer bits of character shape information have to be read from the font table when a character is drawn to the screen. Figure 7-1 shows the expansion of a bit map, one bit per pixel and four bits wide, into four 4-bit pixels (transforming 0-1 -1 -0 into yellow-red-red-yellow, 7-5 Graphics Operations - Pixel Block Transfers for example). Before transferring the expanded source array to the destination array, any of the Boolean or arithmetic pixel processing operations can be ap- plied. E n 5> Four bits per pixel example of color expand Four bit binary or unexpended Image In lo It In I lolnhlnl imniiim InlnhlfllgjSS COLORO Register EHEan lamam 1 01 1 1 q ! 1 1 I vHlgHl COLORO Execute Expand l»nT"HI iPiflTiioi mmTimi |pmT<»MI Resulting 16-blt expanded Image Figure 7-1. Color-Expand Operation The expand function is also useful in applications that generate shapes or patterns dynamically. During the first stage of this process, a compressed im- age is constructed in an off-screen buffer area at one bit per pixel. The image is built up of geometric objects such as rectangles, circles or polygons. Pat- terns can also be added. When complete, the compressed image is color- expanded onto the screen. This method defers the application of color and intensity attributes until the final stage. Combining color expand with the replace-with-transparency operation yields a new operation that is particularly useful in drawing overlapping or kerned text. The color value used to replace the Os in the source array is selected by the programmer as all Os, which is the transparency code. The GSP defers the check for transparency until after the color-expand operation has been per- formed. As the color-expand operation is performed, the Os in the source array are expanded to ail Os. Only the pixels in the destination array that correspond to nontransparent pixels in the resulting source array are replaced. The PIXBLT B,XY and PIXBLT B,L instructions can be used in conjunction with pixel processing, transparency and plane masking. Source pixels are ex- panded before being processed. Window checking can be used with PIXBLT B,XY. 7-6 Graphics Operations - Pixel Block Transfers 7.2.2 Starting Corner Selection The default starting address of a pixel array is the lowest pixel address in the array. When an array is displayed on the screen, as shown in Figure 7-2 a, the starting address is the address of the pixel in the upper left corner of the array. (The XY origin is located in its default position at the upper left corner of the screen.) During a PixBIt operation, this pixel is processed first. The PixBIt processes pixels from left to right within each row, beginning at the top row and moving toward the bottom row. The pixel at the lower right corner of the array is processed last. Certain PixBIt operations allow any of the other three corners to be used as the starting location. This may be necessary, for instance, if the source and des- tination arrays overlap. The sequence in which pixels are moved when the arrays overlap should be controlled so as to not overwrite the pixels in the source array before they are written to the destination array. Figure 7-2 shows how the PBV and PBH bits in the CONTROL register de- termine the starting corner for the PixBIt operation. The starting corner is in- dicated for each of four cases. PBH selects movement in the X direction, from left to right or right to left. PBV selects movement in the Y direction, from top to bottom or bottom to top. +X -►+Y Pixel Array Address Pixel Array Address PBH=0, PBV=0 PBH=1, PBV=0 Pixel Array Address Pixel Array Address PBH=0, PBV=1 Note: Starting corners are shaded. Figure 7-2. Starting Corner Selection PBH=1, PBV=1 7-7 Graphics Operations - Pixel Block Transfers PBH=0 The PixBIt processes pixels from left to right; that is, in the direction of increasing X. PBH=1 The PixBIt processes pixels from right to left; that is, in the direction of decreasing X. PBV=0 The PixBIt processes rows from top to bottom; that is, in the di- rection of increasing Y. PBV=1 The PixBIt processes rows from bottom to top; that is, in the di- rection of decreasing Y. All the pixels in one row are processed before moving to the next row. When one or both of the arrays is specified in XY format, the GSP automat- ically calculates the actual starting address (specified by PBH and PBV) from the default starting address (that is, the lowest pixel address in the array) and the width and height of the array. Automatic starting address adjustment is available with the following instructions: • PIXBLT L,XY • PIXBLT XY,L • PIXBLT XY,XY The programmer supplies the default starting addresses for these PixBlts in the SADDR and DADDR registers. During the course of instruction execution, SADDR and DADDR are automatically adjusted to the address of the corner selected by PBH and PBV. When both arrays are specified in linear format, the starting addresses of the appropriate corner pixels must be provided by the programmer. The PIXBLT L,L instruction allows any of the four corners to be used as the starting lo- cation, but in this case the programmer must adjust the addresses in SADDR and DADDR to the corner selected by PBH and PBV. 7.2.3 Interrupting PixBlts and Fills PIXBLT and FILL are interruptible instructions. An interrupt can occur during execution of one of these instructions; when interrupt processing is com- pleted, execution of the PIXBLT or FILL resumes at the point at which the in- terruption occurred. The execution time of a PIXBLT or FILL instruction depends on the specified pixel array size. In order to prevent high-priority interrupts from being delayed until completion of PixBlts and fills of large arrays, the PIXBLT and FILL in- structions check for interrupts at regular intervals during their execution. When a PIXBLT or FILL instruction is interrupted the PBX (PixBIt executing) status bit is set to 1. This records the fact that the interrupt occurred during a pixel array operation. The PC and the ST are pushed onto the stack, and control is transferred to the appropriate interrupt service routine. At the end of the interrupt service routine, an RETI (return from interrupt) instruction is executed to return control to the interrupted program. The RETI instruction 7-8 Graphics Operations - Pixel Block Transfers pops the ST and PC from the stack. When the PBX bit is detected, execution of the interrupted PIXBLT or FILL instruction resumes. At the time of the interrupt, the state of the PIXBLT or FILL instruction is saved in certain B-file registers. The source and destination address registers contain intermediate values. The source and destination pitches may also contain in- termediate values, depending on the instruction. The SADDR, SPTCH, DADDR, DPTCH registers and registers B10-B14 (as well as the original set of implied operands) contain the information necessary to resume the in- struction upon return from an interrupt. If the interrupt routine uses any of these registers, they should be saved on the stack and restored when interrupt processing is complete. By following this procedure, PIXBLT or FILL instructions can be safely executed within interrupt service routines. Note: The PBX bit is not set to 1 when a PIXBLT or FILL instruction is aborted due to a window violation. 7-9 Graphics Operations - Pixel Transfers/Incremental Algorithm Support 7.3 Pixel Transfers The TMS34010 uses the PIXT (pixel transfer) instructions to transfer individ- ual pixels from one location to another. The following pixel transfers can be performed: • From an A- or B-file register to memory, • From memory to an A- or B-file register, or • From one memory location to another. The address of a pixel in memory can be specified in XY or linear format. Li- near addresses must be pixel aligned. The pixel size for all PIXTs is specified by the value in the PSIZE register. Pixel sizes are restricted to 1, 2, 4, 8, or 16 bits to facilitate XY address computa- tions, window checking, transparency, and arithmetic pixel processing. The PIXT instruction can be used in conjunction with window checking, Boolean or arithmetic pixel processing, plane masking, and transparency. 7.4 Incremental Algorithm Support The TMS34010 supports incremental drawing algorithms via its DRAV (draw and advance) and LINE instructions. The DRAV instruction is used primarily in the construction of algorithms for incrementally drawing circles, ellipses, arcs, and other curves. The DRAV instruction can also be used in the inner loop of algorithms for drawing straight lines incrementally. Lines, however, are treated as a special case by the TMS34010 in order to achieve even faster drawing rates. A separate instruction, LINE, implements the entire inner loop of the Bresenham algorithm for drawing lines. The DRAV (draw and advance) instruction draws a pixel to a location pointed to by a register; the pointer register is then incremented to point to the next pixel. The pointer is specified as an XY address. The X and Y portions of the address are incremented independently, but in parallel. The value written to the destination pixel in memory is taken from the COLOR1 register. The DRAV instruction is embedded in the inner loop of an incremental algo- rithm to speed up its execution. As an incremental algorithm plots each pixel on a curve, it also determines where the next pixel will be drawn. The next pixel is typically one of the eight pixels immediately surrounding the pixel just plotted on the screen. Advancing in this manner, the algorithm tracks the curve from one end to the other. The DRAV and LINE instructions may be used in conjunction with Boolean or arithmetic pixel processing operations, window checking, plane masking and transparency. 7-10 Graphics Operations - Transparency 7.5 Transparency When a PixBIt is used to draw an object to the screen, some of the pixels in the rectangular pixel array that contains the object may not be part of the ob- ject itself. Transparency is a mechanism that allows surrounding pixels in the array to be specified as invisible. This is useful for ensuring that only the object, and not the rectangle surrounding it, is written to the screen. Transparency is enabled by setting the T bit in the CONTROL register to 1, or disabled by setting the T bit to 0. When enabled, a pixel that has a value of is considered transparent, and will not overwrite a destination pixel. Trans- parency detection is applied not to the source pixel values, but to the pixel values resulting from plane masking and pixel processing. When an operation performed on a pair of source and destination pixels yields a result, the GSP detects this and prevents the destination pixel from being altered. In the case of pixel processing operations such as AND, MIN, and replace, a source pixel value of ensures that the result of the operation will be a transparent pixel. Figure 7-3 illustrates how transparency works in the GSP. Assuming four bits per pixel, the hardware must detect strings of 0s of length four falling between pixel boundaries. While bit strings A and B are both of pixel length, only string A is detected as transparent. String B crosses the pixel boundary. The memory interface logic generates an internal mask to govern which bits are modified during a write cycle. This mask contains 0s in the bits corresponding to the transparent pixel. Only destination bits corresponding to 1s in the mask will be modified. j*- String A-^j ^m- String B-^j Data to be written 01010000100 00110 1111 1111 1111 A A A A B B B B C C C C D D D D 10 1 B B B B 10 110 Mask generated Data to be modified Resulting data Note: This example assumes four bits per pixel. Figure 7-3. Transparency Figure 7-7 (page 7-17) and Figure 7-8 (page 7-20) illustrate several pixel processing operations. Figure 7-8 h shows an example of a replace operation performed with transparency enabled. The pixels surrounding the letter A pattern in the source array are transparent (all Os). Compare Figure 7-8 h with Figure 7-7 d; this replace-with-transparency operation is analogous to the logical OR operation in a one-bit-per-pixel display. Transparency can be used with any instruction that writes to pixels, including the PIXBLT, FILL, DRAV, LINE, and PIXT instructions. Transparency does not affect writes to non- pixel data. 7-11 Graphics Operations - Plane Masking 7.6 Plane Masking The plane mask is a hardware mechanism for protecting specified bits within pixels. Mask- protected pixels will not be modified during graphics in- structions. The plane mask allows the bits within pixels to be manipulated as though the display memory were organized into bit planes (or color planes) that can selectively be protected from modification. The number of planes equals the number of bits per pixel. Consider an example in which the pixel size is four bits. The bits within each pixel are numbered 0-3, and belong to planes 0-3, respectively. All the bits numbered in all the pixels form plane 0, all the bits numbered 1 in all the pixels form plane 1, and so on. The plane mask allows one or more planes to be manipulated independently of the other planes. Given four planes of display memory, for example, three of the planes can be dedicated to eight-color graphics, while the fourth plane can be used to overlay text in a single color. The plane mask can be set so that the text plane can be modified without affecting the graphics planes, and vice versa. The PMASK register contains the plane mask. Each bit in the plane mask corresponds to a bit position in a pixel. The 1s in the mask designate pixel bits that are protected, while 0s in the mask designate pixel bits that can be modified. Those pixel bits that are protected by the plane mask are always read as 0s during read cycles, and are protected from alteration during write cycles. While no single control bit enables or disables plane masking, it is ef- fectively disabled by setting PMASK to all 0s; this is the default condition following reset. The logical width of a quantity in the plane mask is the same as the pixel size. However, in order to maintain a consistent effect on all of the pixels within a destination region, regardless of their position within the destination words, you should replicate the mask for a single pixel to fill the entire 1 6-bit PMASK register. (To provide upward compatibility with future versions of the GSP, you should replicate the plane mask through the 32 bits beginning at address C0000170h.) For example, if the pixel size is four bits, the 4-bit mask is rep- licated four times within PMASK; in bits 0-3, 4-7, 8-11, and 12-15. These four copies of the mask are applied to the four pixels in a word written to or read from memory. A 16-bit PMASK value for pixels of 1, 2, 8, or 16 bits is constructed similarly by replicating the mask 1 6, 8, 2, or 1 times, respectively. The plane mask affects only pixel accesses performed during execution of the PIXBLT, FILL, PIXT, DRAV, and LINE instructions. Data accesses by non- graphics instructions are not affected. The following list summarizes operation of the PMASK register during pixel reads and writes: • Pixel Read: The 0s in PMASK correspond to unprotected bits in the source pixel that are seen by the GSP to contain the actual values read from memory. The 1s in PMASK correspond to protected bits in the source pixel that are seen as 0s by the GSP, regardless of the values read from memory. 7-12 Graphics Operations - Plane Masking • Pixel Write: The Os in PMASK specify those bits in the destination pixel in memory which may be altered. The Is in PMASK specify protected bits in the destination pixel which cannot be altered. When a pixel is being transferred from a source to a destination location, plane masking is applied to the values read from the source and destination before pixel processing is applied. As the operands are read from memory, the bits protected by the plane mask are replaced with Os before the specified Boolean or arithmetic pixel processing operation is performed, and destination before pixel processing is applied. Transparency detection is performed on the result of this operation. When the result is written back to the destination, those bits of the destination that are protected by the plane mask are not modified. Source pixels that originate from registers are not affected by the plane mask, and undergo pixel processing in unmodified form. The FILL, DRAV, LINE, PIXT Rs*Rd, and PIXT Rs,*Rd.XY instructions obtain their source pixels from registers. Figure 7-4 shows how special hardware in the local memory interface of the TMS34010 applies the plane mask to pixel data during a read cycle. The pixel size for this example is eight bits per pixel. This could represent the execution of a PIXT *Rs.XY,Rd instruction, for instance. Move trite pixel Into a GSP register 15(M6B) 8 7 OCLSB) IQIMOPJ O / ♦ VAIOPJ (a) Original data In memory (2 pixels) |AAAAAAAA|BBBBBBBB| (b) Plane mask (PMASK) | 1 1 1 1 10 10 (c) Data read Into GSP register |00O000O0l00BB0BBB Notes: 1 . This example assumes eight bits per pixel. 2. The pixel moved into the GSP register is left justified. All register bits to the left of the pixel are zero filled. Figure 7-4. Read Cycle With Plane Masking • Figure 7-4 a shows the 16-bit word containing the pixel as it is read from memory. • The word is ANDed with the inverse of the plane mask shown in b. • The result in Figure 7-4 c shows that the bits within the data word that correspond to 1s in the mask have been set to Os. 7-13 Graphics Operations - Plane Masking After plane masking, the designated pixel is loaded into the eight LSBs of the 32-bit destination register, and the 24 MSBs of the register are filled with Os. Figure 7-5 shows the effect of combining plane masking with pixel transpar- ency. Again, the performance of the special hardware in the local memory interface controller is demonstrated. The example shows the transfer of two pixels during the course of a PixBIt operation with transparency enabled, the pixel size set at eight bits, and the replace pixel processing operation. The inverse of PMASK is ANDed with the source data, and transparency detection is applied to the resulting entire pixel. In other words, the result is used to control the write in the manner described in the previous discussion of pixel transparency. Since the three LSBs of the source pixel in bits 8-1 5 are Os, and the rest of the pixel is masked off, the entire source pixel is interpreted as transparent. The memory interface logic generates an internal mask to govern which bits are modified during a write cycle. This mask contains Os in the bits corresponding to the transparent pixel. 15(MSB) 8 7 O(LSB) [A A A A A A A A B B B B B B B B |Y Y Y Y Y Z Z Z Z Z Z Z z M 1 1 1 1 1 1 1 1 1 o lo z z z IX 1 1 1 1 1 1 1 1 f'o ° o 1 1 1 LL A A A A A A A B B B B B z z * (a) Original data In memory (2 pixels) (b) Source data In memory (to be moved) (o) Plane mask (PMASK) (d) Mask source data for tra ns- parency detection (SRC* PMASK) (e) Transparency mask (f) Combined mask (PBRSR* trans- parency mask) (g) Resulting memory data after write cycle ( Combined Mask * SRC DATA + Combined Mask* DSTDATA) Note: This example assumes eight bits per pixel. Figure 7-5. Write Cycle With Transparency and Plane Masking Figure 7-5 a shows the original data at the destination location. b shows the source data. In c, the source data is ANDed with the inverse of the plane mask. d shows the intermediate result produced by c. This result is used to generate the transparency mask in e, which is ANDed with the inverse of the plane mask in c to produce the composite mask shown in /. The result in G is produced by replacing with the source only those bits of the destination corresponding to 1s in the composite mask in f. 7-14 Graphics Operations - Pixel Processing 7.7 Pixel Processing Source and destination pixel values can be combined according to the pixel processing operation (or raster operation) selected. The TMS34010's pixel processing operations include 16 Boolean and 6 arithmetic operations. The Booleans are performed in bitwise fashion on operand pixels of 1, 2, 4, 8, or 1 6 bits. The arithmetic operations treat operand pixels of 4, 8, or 1 6 bits as unsigned binary numbers. When a pixel is read from its source location, it is arithmetically combined with the corresponding destination pixel according to the Boolean or arithmetic pixel processing option selected, and the result is written to the destination pixel. The pixel processing operation is selected by the PPOP field in the CONTROL register. Table 7-1 and Table 7-2 list the 22 PPOP codes and their meanings. Table 7-1. Boolean Pixel Processing Options PPOP Field Operation 00000 Source -* Destination 00001 Source AND Destination -» Destination 00010 Source AND ~ Destination -» Destination 00011 0s -* Destination 00100 Source OR ~ Destination -» Destination 00101 Source XNOR Destination -* Destination 00110 ~ Destination -* Destination 00111 Source NOR Destination -» Destination 01000 Source OR Destination -» Destination 01001 Destination -* Destination 01010 Source XOR Destination -» Destination 01011 ~ Source AND Destination -* Destination 01100 1s -*■ Destination 01101 ~ Source OR Destination -► Destination 01110 Source NAND Destination -* Destination 01111 ~ Source -* Destination Table 7-2. Arithmetic (or Color) Pixel Processing Options PPOP Field Operation 10000 Source + Destination -* Destination 10001 ADDS(Source, Destination) -* Destination 10010 Destination - Source -* Destination 10011 SUBS(Source, Destination) -+ Destination 10100 MAX(Source, Destination) -+ Destination 10101 MIN(Source, Destination) -+ Destination 10110-11111 Reserved 7-15 Graphics Operations - Pixel Processing In Table 7-2, pixel processing codes IOOOO2 and 100102 correspond to stan- dard 2s complement addition and subtraction. A result that overflows the specified pixel size causes the pixel value to wrap around within its 4, 8, or 16-bit range. Carry bits are, however, prevented from propagating to adjacent pixels. The ADDS (add with saturation) and SUBS (subtract with saturation) oper- ations shown in Table 7-2 produce results identical to those of standard ad- dition or subtraction, except when arithmetic overflow occurs. When the ADDS operation would produce an overflow result, the result is replaced with all 1s. When the SUBS operation would produce an underflow result, the re- sult is replaced with all Os. The MAX operation shown in Table 7-2 compares the source and destination pixels and then writes the greater value to the destination location. The MIN operation is similar, but writes the lesser value to the destination. Figure 7-6 depicts the interaction of pixel processing with other graphics op- erations when a source pixel is transferred to a destination pixel. Note that this is a general description; some of these operations do not occur if they are not selected. Pixels are first read from memory and modified by the plane mask. Pixel processing is then performed on the modified pixel values. The plane mask is applied to the result. Bits which are 1s in the PMASK produce bits in the result of this process. Thus, some processed pixels may become trans- parent as the result of plane masking. Next, transparency detection is applied to the data, and finally, a read -modify- write operation is invoked. \ Source pixel / \ Destination pixel 1 Read Read* PMASK PMASK ' ' Pixel Prooessing > ' PMASK Transparency Detect Read-M odlfy-Wrtte* Destination Pixel / 1" Not performed if replace is selected. * Only performed when plane masking or transparency is active and the pixel size is not 16, or the data being written is not word-aligned. Figure 7-6. Graphics Operations Interaction 7-16 Graphics Operations - Boolean Processing Examples 7.8 Boolean Processing Examples Figure 7-7 illustrates the effects of five commonly used Boolean operations when applied to one-bit pixels. Black regions contain Os, and white regions contain 1s. Figure 7-7 a and b show the original source and destination ar- rays. The source operand in a is the letter A, and the destination in b is a calligraphic-style X. (A) 60URCE ARRAY (B) ORIGINAL DESTINATION ARRAY Iai v v */v (C) REPLACE (D)OR (E) AND-NOT JS JC (F) AND (G) XOR Figure 7-7. Examples of Operations on Single-Bit Pixels 7-17 Graphics Operations - Boolean Processing Examples 7.8.1 Replace Destination with Source A simple replacement operation overwrites the pixels of the destination array with those of the source. Figure 7-7 c shows the letter A written over the center portion of a larger X using the replace operation. The rectangular region around the letter A obscures a portion of the X lying outside the A pattern. Other operations allow only those pixels corresponding to the A pattern within the rectangle to be replaced, permitting the background pattern to show through. These are the logical OR and logical AND-NOT (NOT source AND destination) operations. The replace-with-transparency operation performs similarly in color systems. 7.8.2 Logical OR of Source with Destination Figure 7-7 d illustrates the use of the logical OR operation during a PixBlt. For a one-bit-per-pixel display, the OR function leaves the destination pixels unaltered in locations corresponding to Os in the source pixel array. Destina- tion pixels in positions corresponding to 1s in the source are forced to 1s. 7.8.3 Logical AND of NOT Source with Destination Logically AN Ding the negated source with the destination is complementary to the logical OR operation. Destination pixels corresponding to 1s in the source array remain unaltered, but those corresponding to Os in the source are forced to Os. Figure 7-7 e is an example of the AND-NOT PixBlt operation (notice the negative image of the letter A). For comparison, Figure 7-7 f shows the result of simply AN Ding the source and destination. 7.8.4 Exclusive OR of Source with Destination The XOR operation is useful in making patterns stand out on a screen in in- stances where it is not known in advance whether the background will be 1s or Os. At every point at which the source array contains a pixel value of 1 , the corresponding pixel of the destination array is flipped - a 1 is converted to a 0, and vice versa. XOR is a reversible operation; by XORing the same source to the same destination twice, the original destination is restored. These pro- perties make the XOR operation useful for placing and removing temporary objects such as cursors, and in "rubberbanding" lines. As seen in the example of Figure 7-7 g, however, the object may be difficult to see if both the source and destination arrays contain intricate shapes. 7-18 Graphics Operations - Multiple-Bit Pixel Operations 7.9 Multiple-Bit Pixel Operations The Boolean operations described in Section 7.8 are sufficient for single-bit pixel operations, but they may be inappropriate for multiple-bit pixel oper- ations, especially when color is involved. For example, the result of a bit- wise-OR operation on a black-and-white (one bit per pixel) display is easily predicted - ORing black and white yields white. However, the meaning of this operation is less intuitive when it is applied to multiple-bit pixels. For exam- ple, in a population-density map, colors may be used to represent numeric values. If one color, such as red, represents one level of population density, and blue represents another, what happens when the two colors are bit- wise-ORed? When pixels represent numeric values, numerical operations such as addition and subtraction yield more useful results. Boolean operations are usually inadequate for merging antialiased objects into a single bit-mapped image. Older graphics systems that are limited to Boolean operations on pixels are incapable of supporting many practical applications on multiple-bit-per-pixel images. For instance, where two antialiased lines cross, AND and OR operations yield chaotic pixel intensities that defeat the purpose of the antialiasing. However, merging the two lines by means of the GSP's MAX operation (for white on black) or MIN operation (for black on white) yields a smooth and aesthetically pleasing image. 7.9.1 Examples of Boolean and Arithmetic Operations Figure 7-8 illustrates Boolean and arithmetic operations on multiple-bit pixels. Figure 7-8 a illustrates a source array that contains a red letter A; the red pixels have the value 8 (IOOO2) and the black background pixels have the value (00002)- Figure 7-8 b shows the destination array, a yellow X; the yellow pixels have the value 12(11 OO2) and the pixels in the blue background pixels have the value 2 (001 O2). Boolean operations can be applied to multiple-bit pixels by combining the corresponding bits of each pair of source and destination pixels on a bit-by-bit basis according to the specified Boolean operation. Figure 7-8 c through g show the effects of combining the source and destination arrays using the re- place, OR, AND-NOT, AND, and XOR PixBIt operations. Compare these to Figure 7-7 (page 7-17). Arithmetic operations treat 4-bit, 8-bit, and 16-bit pixels as unsigned binary numbers. An /7-bit pixel represents a positive integer in the range to 2 n -1 (all 1s). Examples of arithmetic operations on source and destination pixels are shown in Figure 7-8 / through n and discussed in Section 7.9.1 .1 through Section 7.9.1.4. (a) Source (b) Destination Figure 7-8. Examples of Boolean and Arithmetic Operations 7-19 Graphics Operations - Multiple-Bit Pixel Operations (c) Src Replaces Dst (d) Src OR Dst (e) Src AND Dst (f) Src AND Dst (g) Src XOR Dst (h) Replace with Transparency (i) Add A» X enc j or Y start > Y enc |, the window is empty; that is, it contains no pixels. Under these conditions, the window checking hardware detects all destination pixel addresses as lying outside the window. Note that the con- ditions X start = X enc j and Y start = Y enc ( together specify a window containing a single pixel. Window start and (+32767,+32767). coordinates. end coordinates must lie in the range (0,0) to A window cannot contain pixels with negative X or Y 7-28 Graphics Operations - Window Checking 7.10.5 Window Violation Interrupt A window violation (WV) interrupt is requested (the WVP bit in the INTPEND register is set to 1 ) when: • W=1 and an attempt is made to write to a pixel inside the window or • W=2 and an attempt is made to write to a pixel outside the window The interrupt occurs if it is enabled by the following conditions: • The WVE bit in the INTENB register is 1 • The IE bit in the status register is 1 Alternatively, if the WV interrupt is disabled (IE=0 or WVE=0), the window violation can be detected by testing the value of either the V bit in the status register or the WVP bit following the operation. When a WV interrupt occurs, the registers that change during the LINE, PIXBLT and FILL instructions contain their intermediate values at the time the violation was detected. 7.10.6 Line Clipping The TMS34010 supports two methods for clipping straight lines to the boundaries of a rectangular window: postclipping and preclipping. Postclip- ping means that just before each pixel on the line is drawn, it is compared with the window limits. If it lies outside the window, the write is inhibited. In contrast, preclipping involves determining in advance of any drawing oper- ations which pixels in the line lie within the window. The algorithm draws only these pixels, and makes no attempt to write to pixels outside the window. A preclipped line may take less time to draw since no calculations are per- formed for pixels lying outside the window. In contrast, postclipping spends the same amount of time calculating the position of a pixel outside the win- dow as it does calculating a pixel inside the window. When postclipping is used, special window comparison hardware compares the coordinates of the pixel being drawn against all four sides of the window at once. The W=3 window-checking mode is selected, and window checking is performed in parallel with execution of the LINE instruction, so no overhead is added to the time to draw a pixel. However, unless this form of clipping is used carefully, another type of overhead may become significant. For example, in a CAD (computer-aided design) environment where only a small portion of a system diagram is to be displayed at once, potentially a great deal of time could be spent performing calculations for points (or entire lines) lying off- screen. Preclipping is generally faster than postclipping, depending on how likely a line is to lie outside the window. The first step in preclipping a series of lines is to identify those that lie either entirely inside or outside the window. This is accomplished by using an "outcode" technique similar to that of the Co- hen-Sutherland algorithm. Those lines lying entirely outside are "trivially re- jected" and consume no more processing time. Those lines lying entirely within are drawn from one endpoint to the other with no clipping required. This still leaves a third category of lines that may cross a window boundary, and these require intersection calculations. However, this technique is pow- 7-29 Graphics Operations - Window Checking erful for reducing the number of lines that require such calculations. While the calculation of outcodes could be performed in software, this would represent significant overhead for each line considered. The TMS34010 provides a more efficient implementation via its CPW (compare point to window) instruction, which compares a point to all four sides of the window at once. The outcode technique classifies a line according to where its endpoints fall in relation to the current clipping window. The area surrounding the window is partitioned into eight regions, as indicated in Figure 7-11. Each region is assigned a 4-bit code called an outcode. The outcode within the window is 00002- When an endpoint of a line falls within a particular region, it is as- signed the outcode for that region. If the two endpoints of a line both have outcodes OOOO2, the line lies entirely within the window. If the bitwise AND of the outcodes of the two endpoints yields a value other than OOOO2, the line lies entirely outside the window. Lines that fall into neither of these categories may or may not be partially visible within the window. ■++X +y Y = Y MIN Y = YMAX 1001 i 1000 1 1010 Window x = X MIN X = X MAX Figure 7-11. Outcodes for Line Endpoints For those lines that require intersection calculations after the outcodes have been determined, midpoint subdivision is an efficient means of preclipping. The object again is to ensure that drawing calculations are performed only for pixels lying within the window. An example of the midpoint subdivision technique is illustrated in Figure 7-12. The line AB lies partially within the window. The first step is to determine the coordinates of the line's midpoint at C. These are calculated as follows: (Xo Y C ) (■ Xa + Xb y a + y b ) 7-30 Graphics Operations - Window Checking (X B .Y B ) 4 Y= YMIN Window Y = YMAX X = X MIN X = X MAX <^fi.V^ B ) (X D .Y D )=(M±^.YA|VC) Figure 7-12. Midpoint Subdivision Method Comparing the outcodes of B and C, segment BC lies entirely outside the window and can be trivially rejected. Segment AC still lies partially within the window and will be subdivided again. The coordinates of point D, the mid- point of AC, are calculated as before. Point D is determined to lie within the window. The LINE instruction is now invoked two times, for segments DC and DA, with D selected as the starting point in each case. For each segment the W=2 window-checking mode is selected, but the window violation inter- rupt is disabled. When each line crosses the window boundary, the win- dow-checking hardware detects this and the LINE instruction aborts. In this way the LINE instruction performs drawing calculations only for portions of DA and DC lying within the window. 7-31 Graphics Operations 7-32 Section 8 Interrupts, Traps, and Reset The TMS34010 supports eight interrupts, including reset. Memory addresses FFFFFCOOh to FFFFFFFFh contain the 32 vector addresses used during in- terrupts, software traps and reset. Each vector is a 32- bit address that points to the beginning of the appropriate interrupt service routine. This section includes the following topics: Section Page 8.1 Interrupt Priorities and Vector Addresses 8-2 8.2 Interrupt Interface Registers 8-3 8.3 External Interrupts 8-3 8.4 Internal Interrupts 8-5 8.5 Interrupt Processing 8-6 8.6 Traps 8-9 8.7 Illegal Opcode Interrupts 8-9 8.8 Reset 8-10 8-1 Interrupts, Traps, and Reset - Interrupt Priories and Vector Addresses 8.1 Interrupt Priorities and Vector Addresses Table 8-1 and Figure 8-1 su mmari ze the TMS3401 interrupt vector addresses and the interrupt priorities. RESET has the highest priority, and the illegal op- code interrupt has the lowest. If two interrupts are requested at the sam e time, the highest priority interrupt is serviced first (assuming it is enabled). RESET and the nonmaskable interrupt cannot be disabled. Table 8-1. Interrupt Priorities Trap Number Int. Priority Internal/ External Description and Source Reset 1 I Device reset. Taken when the input signal at the RESET pin is asserted low. NMI 2 I Nonmaskable interrupt. Generated by a host processor. HI 3 I Host interrupt. Generated by a host processor. Dl 4 I Display interrupt. Generated by the TMS3401 0. WV 5 I Window violation interrupt. Generated by the TMS34010. INT1 6 E External interrupts 1 and 2. Generated by external devices. INT2 7 E ILLOP 8 I Illegal opcode interrupt. Generated by the TMS34010 when an illegal opcode is en- countered. OFFFFFFEOh Reset OFFFFFFCOh INT1 OFFFFFFAOh INT2 0FFFFFF80h 1 OFFFFFFSOh T OFFFFFF40h Traps 3-7 OFFFFFF20H 1 OFFFFFFOOh 1 OFFFFFEEOh MNI OFFFFFECOh HI OFFFFFEAOh Dl 0FFFFFE80h WV 0FFFFFE60h J 0FFFFFE40h 0FFFFFE20h OFFFFFEOOh OFFFFFDEOh OFFFFFDCOh OFFFFFDAOh 0FFFFFD8Oh Traps 12-29 OFFFFFD60h OFFFFFD40h 0FFFFFD20h OFFFFFDOOh OFFFFFCEOh OFFFFFCCOh OFFFFFCAOh 0FFFFFC80h OFFFFFCSOh OFFFFFC40h ' 1 0FFFFFC20h ILLOP OFFFFFCOOh Trap 31 i^ *- Reset External Interrupt 1 External Interrupt 2 Nonmaskable Host Interrupt Display Interrupt Window Violation Figure 8-1. Vector Address Map 8-2 Interrupts, Traps, and Reset - Registers/External Interrupts 8.2 Interrupt Interface Registers Two registers, a subset of the I/O registers discussed in Section 6, monitor and mask interrupt requests. These registers are summarized below; for more in- formation, please refer to the register descriptions in Section 6. The interrupt enable register, INTENB, contains the interrupt mask that se- lectively enables various interrupts. An interrupt is enabled when the status IE (global interrupt enable) bit and the appropriate bit in the INTENB register are both set to 1 . • XI E (bit 1 ) enables external interrupt 1 . • X2E (bit 2) enables external interrupt 2. • HIE (bit 9) enables the host interrupt. • DIE (bit 10) enables the display interrupt. • WVE (bit 1 1 ) enables the window violation interrupt. The interrupt pending register, INTPEND, indicates which interrupts are cur- rently pending. When an interrupt is requested, the appropriate bit in the INTPEND register is set. • XI P (bit 1 ) indicates that external interrupt 1 is pending. • X2P (bit 2) indicates that external interrupt 2 is pending. • HIP (bit 9) indicates that the host interrupt is pending. • DIP (bit 10) indicates that the display interrupt is pending. • WVP (bit 1 1 ) indicates that the window violation interrupt is pending. 8.3 External Interrupts External interrupt requests are received through input pins LINT1 and LINT2. The two request pins are level-sensitive, active-low inputs. Each pin is dedi- cated to an individual interrupt, allowing two independent interru pt req uests to b e generated. (The pins are not encoded.) The state of the LINT1 and LINT2 inputs is reflected in the X1 P and X2P bits in the INTPEND register. The register bit is 1 if the corresponding request is active. The interrupts generated by requests at the LINT1 and LINT2 inputs are referred to as INT1 and INT2. Interrupts INT1 and INT2 are selectively enabled by means of the X1 E and X2 E bits in th e INT ENB register. If external interrupt requests become active at LINT1 and LINT2 at the same time, and both inter- rupts are enabled, INT1 will be se rviced first . If one or both of these interrupts is disabled, the state of the LINT1 and LINT2 inputs continues to be reflected in the X1 P and X2P bits. These bits may be polled by software to detect transitions at the interrupt inputs. Table 8-2 shows the interrupt trap vectors for INT1 and INT2. 8-3 Interrupts, Traps, and Reset - External Interrupts Table 8-2. External Interrupt Vectors Name Input Pin Vector Address INT1 LINT1 FFFFFFCOh INT2 UNT2 FFFFFFAOh Once an interrupt request has been initiated by driving an interrupt request pin low, the input should continue to be driven low until the interrupt service routine can respond to the interrupting device. If the interrupt pin is permitted to go inactive high before it has been recognized by the interrupt service rou- tine, the request may be missed. If the active level is maintained after returning from the interrupt service routine, however, the interrupt will be taken once again. The RETI instruction restores the ST (status) and PC (program counter) reg- isters to their original state just prior to the interrupt. (This would not be the case, however, if for some reason the values for these registers, saved on the stack, were altered by the interrupt service routine). Assuming that the IE bit in the restored ST is a 1, interrupts are again enabled by the time the RETI in- struction finishes executing. If an interrupt request is active during the last state of the RETI instruction, and the interrupt is enabled in the INTENB reg- ister, the interrupt will be taken immediately following the RETI. The interrupt service routine typically writes to the interrupting device to clear the interrupt request before executing an RETI (return from interrupt) in- struction. An example of the last three instructions in a typical interrupt service routine is shown below, where device is the symbolic address of the inter- rupting device: CLR MOVE RETI AO AO , @DEVICE The interrupt request is cleared by the MOVE instruction above, which writes a to the device address. The maximum asynchronous delayjrom the end of the write cycle (measured from the low-to-high transition of W) to the result- ing low-to-high transition at the GSP's interrupt request input should be no more than six local clock periods. Signals input to the local interrupt pins are assumed to be asynchronous to the GSP local clocks, and are synchronized intern ally b y the GSP before they are processed. The GSP samples the state of the LINT1 and LINT2 inputs at each high-to-low transition of LCLK1, and updates the X1 P and X2P bits in the INTPEND register accordingly (an active-low input is seen as a one in the appropriate register bit). The delay from the transition at the input to the corresponding change in the X1 P or X2P bit is from one to two states, de- pending on the transition's phase relationship to LCLK1 . 8-4 Interrupts, Traps, and Reset - Internal Interrupts 8.4 Internal Interrupts Several internal conditions are associated with specific interrupts. Table 8-3 summarizes these interrupts. If two internal interrupts are requested simul- taneously, or if two or more internal interrupt requests are pending, the highest priority interrupt is serviced first; NMI has the highest priority, followed by HI, Dl, and WV. When internal and external interrupts are pending, the internal interrupts are serviced first (with the exception of the ILLOP interrupt). Table 8-3. Interrupts Associated with Internal Events Name Function Level Vector Location Description NMI Nonmaskable interrupt 8 FFFFFEEOh The host processor sets the NMI bit in the HSTCTL register to a 1. HI Host interrupt 9 FFFFFECOh The host processor sets the INTIN bit in the HSTCTL register to a 1 . Dl Display interrupt 10 FFFFFEAOh A particular horizontal line on the video display is being refreshed. The line number is specified in the DPYINT register. WV Window violation interrupt 11 FFFFFE80h An attempt has been made to move a pixel to a destination location that lies inside or outside a specified window, depending on the selected windowing mode. ILLOP Illegal operand interrupt 30 FFFFFC20h See Section 8.7. The nonmaskable interrupt, or NMI, occurs when a host processor requests an interrupt by writing a 1 to the NMI bit in the HSTCTL register. This inter- rupt cannot be disabled, and always occurs as soon as possible following the request. The NMI is delayed only for completion of an instruction already in progress, or until the next interruptible point of an interruptible instruction such as a PIXBLT is reached. The NMI mode bit in the HSTCTL register determines whether or not context information is saved on the stack when a nonmaskable interrupt occurs: • If NMIM = 0, the PC and ST are pushed on the stack before the interrupt is serviced. • If NMIM = 1, nothing is saved on the stack before the interrupt is ser- viced. The TMS34010 automatically clears the NMI bit at the time it takes the inter- rupt. After setting the NMI bit, the host processor can determine when the TMS3401 has taken the interrupt by polling the NMI bit until it changes from a 1 to a 0. The display interrupt (Dl) is used to coordinate processing activity with the refreshing of particular areas of the display. The display interrupt request be- comes active when a particular display line, specified in the DPYINT register, is output to the monitor screen. At the start of each horizontal blanking period, the VCOUNT register is compared to the DPYINT register. When the vertical count value in VCOUNT = DPYINT, a display interrupt request is generated. If enabled, the interrupt is taken. 8-5 Interrupts, Traps, and Reset - Interrupt Processing 8.5 Interrupt Processing An interrupt is said to be pending if it has been requested but has not yet been processed. If a pending interrupt is enabled, and no interrupt of higher priority is pending at the same time, the interrupt is accepted by the TMS3401 at the end of the current instruction (or at the next interruptibie point in the middle of a PIXBLT or FILL instruction). When the TMS34010 takes an interrupt, it performs the following actions: 1 ) The TMS3401 pushes the PC on the stack. 2) The TMS34010 pushes the ST on the stack. PIXBLT and FILL in- structions that are interrupted by external, host, and nonmaskable (if NMIM=0) interrupts set the PBX bit in the ST before pushing the ST. 3) The TMS34010 modifies the contents of the ST as follows: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 |0 0|0 0|0|0 0|0|0 o oio |0 0|0|1 | \ PBX / IE Reserved Reserved t FE1 FS1 t 1 - FEO FSO 4) The TMS34010 fetches the interrupt vector from external memory into the PC. 5) The TMS34010 begins executing the instruction pointed to by the new PC value. In step 5, the TMS34010 resumes instruction execution at the entry point of the interrupt service routine. At the time the first instruction of the service routine begins execution, the new status register contents imply the following conditions: • All interrupts are disabled (except NMI and reset) • Field is 1 6 bits long and is zero extended • Field 1 is 32 bits long and is zero extended The service routine can allow itself to be interrupted by loading a new inter- rupt-enable mask into the INTENB register and setting status bit IE to 1 . The INTENB mask value is selected to determine which interrupts can interrupt the currently executing service routine. The service routine can also load new field sizes if values other than the defaults are required. The last instruction in any interrupt service routine must be RETI (return from interrupt). Unlike the RETS (return from subroutine) instruction, which only pops the PC from the stack, RETI pops both the ST and PC. This restores the original state of the interrupted program so that execution can proceed from the point at which the interrupt occurred. 8-6 Interrupts, Traps, and Reset - Interrupt Processing 8.5.1 Interrupt Latency An external interrupt, host interrupt request, or NMI request is delayed by an amount of time that depends on the instruction in progress and on the local memory bus traffic at the time of the request. The delay from an interrupt request to the time that the first instruction of the interrupt service routine begins execution is the sum of six potential sources of delay: 1 ) Interrupt request recognition 2) Screen -refresh cycle 3) DRAM -refresh cycle 4) Host- indirect cycle 5) Instruction interrupt 6) Interrupt context switch In the best case, items 2 through 5 cause no delay. The minimum delay due to items 1 and 6 is 1 7 machine states. • The interrupt request recognition delay is the time required for a request to be internally synchronized to the local clock. In the case of an external interrupt request, the delay is measured from the high-to-low transition of the TNT1 or INT2 pin. In the case of a host interrupt or NMI request, the delay is measured from completion of the host's write to the INTIN or NMI pin. • The screen-refresh and DRAM -refresh cycles are a potential source of delay, but in fact occur rarely and are unlikely to delay an interrupt. • The likelihood of a delay caused by a host-indirect cycle is small in most instances, but this depends on the application. The delay due to a single host-indirect cycle is two machine states, assuming no wait states, but multiple host-indirect cycles occurring within a brief period of time could cause additional delays. Theoretically, a fast host processor could generate so many local memory cycles that the TMS34010 would be prevented from servicing interrupts for an indefinite period. • The instruction interrupt time refers to the time required for an in- struction that was already executing at the time the interrupt request was received to either complete or to reach the next interruptible point in an instruction (such as a PIXBLT, FILL, or LINE). • The interrupt context switch operation pushes the PC and ST onto the stack, and fetches the PC for the interrupt service routine from the appropriate vector in memory. Table 8-4 shows the minimum and maximum times for each of the six oper- ations listed. The interrupt latency is calculated as the sum of the numbers in the six rows. In the best case, the interrupt latency is only 17 machine states. The worst-case latency can be as high as 22 machine states plus the delays due to host-indirect cycles and instruction completion. Table 8-5 shows in- struction interrupt times for some of the longer, noninterruptible instructions. Table 8-5 also shows the instruction completion time for a JRUC instruction 8-7 Interrupts, Traps, and Reset - Interrupt Processing that jumps to itself - the TMS34010 may be executing this instruction if the software is simply waiting for an interrupt. Table 8-4. Six Sources of Interrupt Delay Operation Latency (In States) Min Max Interrupt recognition 1 2 Instruction interrupt See Table 8-5 DRAM -refresh cycle 2 See Note 2 Screen-refresh cycle 2 See Note 2 Host-indirect cycle See Note 1 Interrupt context switch 16 16 Notes: 1) The latency due to host-indirect cycles depends on both the hardware system and the application. Theoretically, a host pro- cessor could generate so many local memory cycles that the TMS34010 could effectively be prevented from servicing inter- rupts. The delay due to a single host-indirect cycle is two machine states, assuming no wait states. 2) DRAM-refresh and screen -refresh cycle times assume no wait states. 3) Context switch time assumes that the SP is aligned to a word boundary; that is, the four LSBs of the SP are Os. If the SP is not aligned, the delay is 28 states. Table 8-5. Sample Instruction Completion Times Instruction Worst-Case Instruction Interrupt Time (In States) SP Aligned SP Not Aligned DIVS A0,A2 . 43 43 MMFM SP,ALL 72 144 MMTM SP,ALL 73 169 Wait: JRUC wait 1 1 Notes: 1 ) The worst-case instruction interrupt time is equal to the instruction execution time less one machine state (except for PIXBLTs, FILLs, and LINE). 2) The SP-aligned case assumes that the SP is aligned to a word boundary in memory. 8-8 Interrupts, Traps, and Reset - Traps/Illegal Opcodes 8.6 Traps The TMS34010 supports 32 software traps, numbered through 31. Soft- ware traps behave similarly to interrupts, except that they are initiated when the TMS34010 executes a TRAP instruction. Unlike an interrupt, a software trap cannot be disabled. When the TMS34010 executes a TRAP instruction, it performs the same se- quence of actions that it performs for interrupts. The TRAP 1 through TRAP 31 instructions cause the status register and the PC to be pushed onto the stack. TRAP is similar to a hardware reset because it does not push the status register or PC onto the stack; it differs from a hardware reset because it does not cause the TMS34010's internal registers to be set to a known initial state. TRAP 8 is similar to an NMI interrupt, except that the NMIM (NMI mode) bit in the HSTCTLL register has no effect on instruction execution; the status register and PC are stacked unconditionally when TRAP 8 is executed. A 32-bit vector address is associated with each software trap. To determine the vector address for a trap number N, where N = through 31, subtract 32/V from FFFFFFEOh. Figure 8-1 on page 8-2 shows the vector addresses for the software traps. 8.7 Illegal Opcode Interrupts The TMS34010 recognizes several reserved opcodes as illegal. When one of these opcodes is encountered in the instruction stream, the TMS34010 traps to vector number 30, located at memory address FFFFFC20h. An illegal op- code is similar in effect to a TRAP 30 instruction. The illegal opcode interrupt cannot be disabled. Table 8-6 lists ranges of illegal opcodes. Table 8-6. Illegal Opcodes Ranges 0200h through 02FFh 0400h through 04FFh 0800h through 08FFh OAOOh through OAFFh OCOOh through OCFFh OEOOh through OEFFh 3400h through 37FFh 7000h through 7FFFh 9E00h through 9FFFh BEOOh through BFFFh D800h through DEFFh FEOOh through FFFFh 8-9 Interrupts, Traps, and Reset - Reset 8.8 Reset Reset puts the TMS34010 into a known initial state that is entered when the input signal at the RESET pin is asserted low. RESET must remain active low for a minimum of 40 local clock (LCLK1 or LCLK2) periods to ensure that the TMS34010 has sufficient time to establish its initial internal state. While the reset signal remains asserted, all outputs are in a known state, no DRAM- refresh cycles take place, and no screen -refresh cycles are performed. At the low-to-high transition of the RESET signal, the state of the HCS input determines whether the TMS34010 is halted {host- present mode) or whether it begins executing instructions {self- bootstrap mode): • Host- Present Mode If HCS is high at the end of reset, TMS34010 instruction execution is halted and remains halted until the host clears the HLT (h alt) b it in HSTCTL (host control register). Following reset, the eight RAS-only refresh cycles required to initialize the dynamic RAMs are performed autom atica lly by the TMS34010 memory control logic. As soon as the eight RAS-only cycles are completed, the host is allowed access to TMS34010 memory. At this time, the TMS34010 begins to automat- ically perform DRAM refresh cycles at regular intervals. The TMS34010 remains halted until the host clears the HLT bit. Only then does the TMS34010 fetch the level-0 vector address from location FFFFFFEOh and begin executing its reset service routine. • Self- Bootstrap Mode If HC S is low at the end of reset, the TMS34010 first performs the eight RAS-only refresh cy cles required to initialize the DRAMs. Immediately following the eight RAS-only cycles, the TMS34010 fetches the level-0 vector address from location FFFFFFEOh, and begins executing its reset service routine. Unlike other interrupts and software traps, reset does not save previous ST or PC values. This is because the value of the stack pointer just before a reset is generally not valid, and saving its value on the stack is unnecessary. A TRAP instruction, which uses the same vector address as reset, similarly does not save the ST or PC values. 8.8.1 Asserting Reset A reset is initiated by asserting the RESET input pin at its active-low level. To reset the TMS34010 at power up, RESET must remain active low for a mini- mum of 40 local clock periods after power levels have become stable . At times other than power up, the TMS34010 is also reset by holding RESET low for a minimum of 40 clock periods. The 40-clock interval is req uired to bring TMS34010 internal circuitry to a known initial state. While RESET remains asserted, the output and bidirectional signals are driven to a known state. The TMS34010 drives its RAS signal inactive high as long as RESET remains low. The specifications for certain DRAM and VRAM devices, inc luding the TMS4161, TMS4164 and TMS4464 devices, require that the RAS signal be driven inactive-high for 100 microseconds during syste m reset. Holding the RESET signal low for 150 microseconds causes the RAS signal to remain high 8-10 Interrupts, Traps, and Reset - Reset for the 100 microseconds required to bring the memory devi ces to their initial states. DRAMs such as the T MS42 56 specify an initial RAS high time of 200 microseconds, r equirin g that RESET be held low for 250 micro seconds. In general, holding RESET low for t microseconds ensures that RAS remains high initially for t - 50 microseconds. 8.8.2 Suspension of DRAM -Refresh Cycles During Reset An active-low level at the RESET pin is con sidered to be a power-up condition, and DRAM refresh is not performed until RESET goes inactive high. Conse- quently, the previous contents of the local memory may not be valid after a reset. 8.8.3 State of VCLK During Reset In many systems, the VCLK pin continues to be clocked during reset. How- ever, a system in which VCLK is not clocked during reset should maintain VCLK at the logic high level while it is not being clocked. This is necessary to ensure that the video counters are reset properly. In fact, VCLK should be held at the logic high level when it is not being clocked regardless of whether the device is being reset. While VCLK is low, storage nodes in the VCOUNT and HCOUNT registers rely on their internal capacitance to maintain their state. If VCLK remains low for a sufficiently long period, these registers are subject to bit errors due to charge leakage. 8.8.4 Initial State Following Reset While the RESET pin is asserted low, the TMS34010's output and bidirectional pins are forced to the states listed in Table 8-7. Table 8-7. State of Pins During a Reset Outputs Driven To High level Outputs Driven To Low Level Bidirectional Pins Driven to High Impedance DDOUT HRDYt DEN LAL TR/QE RAS CAS W HINT HLDA/EMUA BLANK HSYNC VSYNC HD0-HD15 LAD0-LAD15 t HRDY will stay high during reset if the HCS input is also high. Immediately following reset, all I/O registers are cleared (set to OOOOh), with the possi ble ex ception of the HLT bit in the HSTCTL register. The H LT bit is set to 1 if HCS is high just before the low-to-high transition of RESET. 8-11 Interrupts, Traps, and Reset - Reset Just before execution of the first instruction in the reset routine, the MS34010's internal registers are in the following state: General-purpose register files A and B are uninitialized. The ST is set to 0000001 Oh. The PC contains the 32-bit vector fetched from memory address FFFFFFEOh. he instruction cache is in the following state at this time: The SSA (segment start address) registers are uninitialized. The LRU (least recently used) stack is set to the initial sequence 0,1,2,3, where occupies the most- recently- used position, and 3 occupies the least- recently- used position. All P (present) flags are cleared to Os. 8.8.5 Activity Following Reset Immediately following th e low -to-high transition of RESET, the TMS34010 performs a series of eight RAS-only memory cycles to bring the DRAMs and VRAMs to their initial operating states. These cycles are completed before any accesses of the TMS34010's memory (by either the TMS34010 or host pro- cessor) are allowed to occur. If the host proc essor attempts to access the TMS34010 memory indirectly before the eight RAS-only cycles have com- pleted, it receives a no t -rea dy signal from the TMS34010 until the cycles have completed. The eight RAS-only cycles occur regardless of the initial value to which the HLT bit in the HSTCTL register is set. Each of the eight RAS-only cycles is a standard DRAM -refresh cycle. The RF bus status signal output with the row address is active low. The row address is all Os. Following the eight RAS-only cycles, the TMS34010 automatically begins to initiate a new DRAM -refresh cycle every 32 TMS34010 local clock cycles. The first DRAM refresh cycle begins approximately 32 local clock periods after the end of reset. A DRAM-refresh cycle is initiated every 32 TMS3401 clock cycles until the DRAM-refresh rate is changed by the TMS34010 or host processor. The TMS34010 is configured by means of an external signal input on the HCS pin to either: • Begin executing instructions immediately after reset is completed (self- bootstrap mode), or • Halt until the host processor instructs it to begin executing (host-present mode). 8-12 Interrupts, Traps, and Reset - Reset 8.8.5.7 Self -Bootstrap Mode In self- bootstrap mode, the TMS34010 begins executing instructions imme- diately following reset. This mode is typically used in a system in which the reset vector and reset service routine are contained in nonvolatile memory, such as a bootstrap ROM. This type of system does not necessarily require a host processor, and the TMS3401 may be responsible for performing host processor functions for the system. The TMS3401 is configured in self-boo tstrap mode whe n the HCS pin is low just before the low-to-high transition of RESET. The low HCS level force s the HLT bit to 0. Immediately following the end of reset and the eight RAS-only cycles, the TMS3401 fetches the level-0 vector address and begins executing the reset interrupt routine. At the low-to-high transition of RESET, the HCS input is internally delayed before being checked to determine how to set the HLT bit. In a sy stem with- out a host processor, for instance, this permits the HCS and RESET pins to be tied together, eliminating the need for additional external logic. Transitions of the HCS and RESET signals are a ssu med to be asynchronous with respect to the TMS34010 local clock. HCS and RESET are internally syn- chronized to the local clock by being held in latches for at least one clock pe- riod before being used by the TMS3401 0. The delay through the synchronizer latch is from one to two local clock periods, dependi ng o n th e phase of the signal transitions relative to the clock. To permit the HCS and R ESET pins to be wired together, TMS34010 on-chip logic delays the HCS low-to-high transition to ensure that it is detected after the RESET low-to-hi gh tra nsition. The level of the delayed HCS signal at the time the low-to-high RESET transi- tion is detected determines the setting of the HLT bit. 8.8.5.2 Host-Present Mode Host-present mode assumes that a host processor is connected to the TMS34010's host interface pins. In this mode, the TMS34010 local memory can be composed entirely of RAM (no ROM). Following reset, the host pro- cessor must download the initial program code, interrupt vectors, and so on, before allowing the TMS34010 to begin executing instructions. The TM S34010 is c onfig ured in host-present mode as follows. On the trailing edge of RESET, the HCS (host interface chip select) input is sampled. If the HCS pin is inactive high, internal logic forces the HLT (halt) bit to a 1 . In this fashion, the TMS34010 is automatically halted following reset, and does not begin execution of its reset service routine until the host processor loads a to HLT. In the meantime, the host processor is able to load the memory and I/O registers with the appropriate initial values before the TMS34010 begins executing instructions. This may include writing the reset vector and reset service routine into the TMS34010's memory, for example. No additional exte rnal log ic is required to force HCS high before the low-to- high trans ition of RESET. The simple external decode logic typically used drives the HCS input active low only when one of the TMS34010's host in- terface registers is addressed by the host processor. Assuming that the host processor is not actively chip-selecting the TMS34010 at the end of reset, HCS is high. 8-13 Interrupts, Traps, and Reset 8-14 Section 9 Screen Refresh and Video Timing The TMS34010 generates the synchronization and blanking signals used to drive a video screen in a graphics system. The GSP can be programmed to support a variety of screen resolutions and interlaced or noninterlaced video. If desired, the GSP can be programmed to synchronize to externally generated video signals. The GSP also supports the use of video RAMs by generating the memory-to-register cycles necessary to refresh a screen. This section includes the following topics: Section Page 9.1 Screen Sizes 9-2 9.2 Video Timing Signals 9-3 9.3 Video Timing Registers 9-4 9.4 Relationship Between Horizontal and Vertical Timing Signals 9-5 9.5 Horizontal Video Timing 9-6 9.6 Vertical Video Timing 9-8 9.7 Display Interrupt 9-13 9.8 Dot Rate 9-14 9.9 External Sync Mode 9-15 9.10Video RAM Control 9-18 9-1 Screen Refresh and Video Timing - Screen Sizes 9.1 Screen Sizes The TMS34010's 26-bit word address provides direct addressing of up to 1 28 megabytes of external memory. This address reach supports very high- resolution displays. For example, the designer of a large TMS34010-based system could decide to use the lower half of the address space for display memory, and use the upper half for storing programs and data. Half of this memory space, for example, could be used as a display memory, and the re- maining memory can be used for programs and data. The 64-megabyte dis- play memory in this example could support the following display sizes: 81 92 by 4096 pixels at 1 6 bits per pixel 81 92 by 81 92 pixels at 8 bits per pixel 1 6,384 by 81 92 pixels at 4 bits per pixel 1 6,384 by 1 6,384 pixels at 2 bits per pixel 32,768 by 1 6,384 pixels at 1 bit per pixel he video timing registers also support high-resolution displays. The 16-bit vertical counter register, VCOUNT, directly supports screen lengths of up to 65,536 lines. The 16-bit horizontal counter register, HCOUNT, does not di- rectly limit the horizontal resolution. Each horizontal line can be programmed to be up to 65,536 VCLK (video clock) periods long. The VCLK period, however, is an arbitrary number of dot-clock periods in length, depending on the external divide-down logic used to produce the VCLK signal from the dot clock. Thus, the number of pixels per line supported by the GSP horizontal timing registers is limited only by the amount of video memory that is present. Note that frame buffers in excess of 2 24 bits may require an external counter to determine which VRAM serial outputs should be enabled during a scan line. This external counter would increment upon detecting a 1 -to-0 transition of the logical address bit 23 during successive screen -refresh cycles. To support applications requiring panning and scrolling of the frame buffer, the initial va- lue of this counter immediately following vertical retrace should be capable of being loaded under program control. 9-2 Screen Refresh and Video Timing - Video Timing Signals 9.2 Video Timing Signals The TM334010 gen erates h orizontal sync, vertical sync, and blanking signals (HSYNC, VSYNC, and BLANK) on chip. The GSP's video timing logic is driven by the video input clock (VCLK). The sync and blanking signals control the horizontal and vertical sweep rates of the screen and synchronize the screen display to data output by the VRAMs. HSYNC is the horizontal sync signal used to control external video circuitry. It may be configured as an input or an output via the DXV and HSD bits in the DPYCTL r egister. When DXV=0 and HD S=0, ex ternal video is selected and HSYNC is an input. Otherwise, HSYNC is an output. VSYNC BLANK VCLK is the vertical sync signal used to control external video circuitry. It may be configured as an input or an output via the DXV bit in th e DPYCTL register. If DXV=1 , internal video is select ed and V SYNC is an output. If DXV=0, external video is selected and VSYNC is an in- put. is used to turn off a CRT's electron beam during horizo ntal and vertical retrace intervals. The signal output at the BLANK pin is a composite o f the in ternally generated horizontal and vertical blank- ing signals. BLANK can also be used to control starting and stopping of the VRAM shift registers. is derived from the dot clock of the external video system, drives the internal video timing logic. VCLK Holding VCLK low for long periods may cause video counter errors. When VCLK is not being clocked for long periods, it should be held at the logic high level. While VCLK is low, the storage nodes within the device rely on their internal capacitance to maintain state information, and if VCLK is held low for a sufficiently long time, charge leakage may cause bit errors. 9-3 Screen Refresh and Video Timing - Video Timing Registers 9.3 Video Timing Registers The video timing registers are a subset of the I/O registers described in Section 6. The values in the video timing registers control the video timing signals. These registers are divided into two groups: Horizontal timing registers control the timing of the HSYNC signal and the internal horizontal blanking signal. - HCOUNT counts the number of VCLK periods per horizontal scan line. - HESYN C specifies the point in a horizontal scan line at which the HSYNC signal ends. - HEBLNK specifies the endpoint of the horizontal blanking interval. - HSBLNK specifies the starting point of the horizontal blanking interval. - HTOTAL defines the number of VCLK periods allowed per hori- zontal scan line. Vertical timing registers control the timing of the VSYNC signal and the internal vertical blanking signal. - VCOUNT counts the horizontal scan lines in the screen display. VESYNC specifies the endpoint of the VSYNC signal. VEBLNK specifies the endpoint of the vertical blanking interval. VSBLNK specifies the starting point of the vertical blanking in- terval. VTOTAL specifies the value of VCOUNT at which VSYNC may begin. 9-4 Screen Refresh and Video Timing - Horizontal vs. Vertical Signals 9.4 Relationship Between Horizontal and Vertical Timing Signals Figure 9-1 illustrates the relationship between the horizontal and vertical tim- ing signals in the construction of a two-dimensional raster display pattern. The vertical sync and blanking signals span an entire frame. The horizontal sync and blanking signals span a single horizontal scan line within the frame. Start New Frame VSBLNK VTOTAL ►VCOUNT=0 * VESYNC H VEBLNK » -Horizontal Internal- ■A tTT il o * Active Display Time •HSYNC ■HBLNK ^ r m o S 5e vertloal Interval 1 -6tart New Line- Figure 9-1. Horizontal and Vertical Timing Relationship Figure 9-1 illustrates the following terms and phrases, which are used throughout this section: HBLNK and VBLNK are in terna/ h orizontal and verti cal blan king signals that combine to form the BLANK signal output. (HBLNK and VBLNK cannot be accessed at TM S34 010 pi ns.) The display is active (not blanked) only when HBLNK and VBLNK are both inactive high. Horizontal front porch refers to the interval between the beginning of horizontal blanking and the beginning of the horizontal sync signal. Horizontal back porch is the interval between the end of the hori- zontal sync signal and the end of horizontal blanking. Vertical front porch refers to the interval between the beginning of vertical blanking and the beginning of the vertical sync signal. Vertical back porch is the interval between the end of the vertical sync signal and the end of vertical blanking. 9-5 Screen Refresh and Video Timing - Horizontal Video Timing 9.5 Horizontal Video Timing The following discussion applies to internally generated video timing (the DXV and HSD bits in the DPYCTL register are set to 1 and 0, respectively). Hori- zontal timing signals are the same for interlaced and noninterlaced video. The HESYNC, HEBLNK, HSBLNK, and HTOTAL registers control horizontal signal timing as shown in Figure 9-2. All horizontal timing parameters are specifie d as multiples of VCLK. The time between the start of two successive HSYNC pulses is specified by HTOTAL. HCOUNT counts from to the value in HTOTAL and then repeats. The value in HTOTAL represents the number of VCLK periods, minus one, per horizontal scan line. The value in HESYNC represents the duration of the sync pulse, minus one. The values in HEBLNK and HSBLNK specify the beginning and end points of the horizontal blanking interval. HBLNK HSYNC \ I Horz. I Un — I Horz. I Front I gSSI," I Baok | Porch | Byno | Porch ^ i hE8YNC+-i I* *\ f— HEBLNK+1 |< HSBLNK+1 !l ■HTOTAL+1 Figure 9-2. Horizontal Timing Figure 9-3 shows the internal logic used to generate the horizontal timing signals. HCOUNT is incremented once each VCLK period (on the high-to-low transition) until it equals the value in HTOTAL. On the next VCLK period following HCOUNT= HTOTAL, HCOUNT is reset to 0, and begins counting again. The limits of th e horizo ntal sync pulse are defined by the values in HESYNC and HTOTAL. HSYNC is driven active low when HCOUNT= HTOTAL; it is driven inactive high when HCOUNT=HESYNC. After HCOUNT becomes equal to HTOTAL or HESYNC, there i s a on e-clock delay before the active/inactive transition takes place at the HSYNC pin. The internal HBLNK signal is driven active low after HC OUNT=HSBLNK; it is driven inactive hi gh after HCOUNT=HE BLNK. HBLNK is logi cally O Red (ne- gative logic) with VB LNK to prod uce the BLANK signal; that is, BLANK goes low when either HBLNK or VBLNK is low. After HCOUNT becomes equal to HSBLNK or HEBL NK, there is a one-clock delay before the transition takes place at the BLANK pin. 9-6 Screen Refresh and Video Timing - Horizontal Video Timing HTOTAL HESYNC Comparator as — ]-n Comparator ♦ 6 Q < R Q VCLK » HCOUNT tJL Comparator — as — 3-T Comparator HSBLNK 1 * 6 » R HEBLNK -►HSYNC -+HBLNK Figure 9-3. Horizontal Timing Logic - Equivalent Circuit Figure 9-4 illustrates horizontal signal generation. In this example, HTOT AL=IM, HSB LNK=N -2, HESYNC=2, and HEBLNK=4. Signal transitions at the HSYNC and BLANK pins occur at high-to-low VCLK transitions. After HCOUNT becomes equal to HTOTAL, HSBLNK, HESYNC, or HEBL N K, there is a one-clock delay before the transition takes place at the HSYNC or BLANK pin. When HCOUNT= HSBLNK (shortly before the end of the horizontal scan), horizontal blanking begins. At this time, the DIP (display interrupt) bit in the INTPEND register is set to 1 if VCOUNT=DPYINT. The next screen- refresh cycle may also occur at this time - the GSP can be programmed to re- fresh the screen after one, two, three, or four scan lines. VCLK HCOUNT HSYNC BLANK HSBLNK = N-2 HTOTAL = N HESYNC = 2 HEBLNK = 4 Figure 9-4. Example of Horizontal Signal Generation 9-7 Screen Refresh and Video Timing - Vertical Video Timing 9.6 Vertical Video Timing The following discussion applies to internally generated video timing (the DXV bit in the DPYCTL register is set to 1 ). The VESYNC, VEBLNK, VSBLNK, and VTOTAL registers control vertical signal timing as shown in Figure 9-5. All vertical timing parameters are specified as multiples of the horizontal sweep time H, where H = (HTOTAL + 1) x (VCLK period) VTOTAL specifies the time interval between the start of two successive vertical sync pulses; this value is the number of H inte rvals, le ss one, in each vertical frame. VESY NC repre sents the duration of the VSYNC pulse, less one, in each vertical frame. VSYNC's high-t o-low a nd low-to-high transitions coincide with high-to-low transitions at the HSYNC pin. VSBLNK and VEBLNK specify the starting and ending points of vertical blanking. Blanking begins when VCOUNT=VSBLNK and ends when VCOUN T=VEBL NK. Assuming that horizontal blanking is active at the start of eac h HSYNC pulse, transitions of the internal vertical blanking signal, VBLNK, occur while horizontal blanking is active. VBLNK VSYNC \ I Vert I w -rt I Vert I Front I Z*?i | Back | Porch | 6yno | Porch r^^i K/E6YNC+1 e m f — VEBLNK+1- [4 VSBLNK+1 L VTOTAL+1 ■ 4 V \ Figure 9-5. Vertical Timing for Noninterlaced Display Figure 9-6 shows the internal logic that gener ates th e vertical timing signals. VCOUNT increments at the beginning of each HSYNC pulse until it equals the value in VTOTAL. W hen VC OUNT=VTOTAL, VCOUNT is reset to and be- gins counting again. VSYNC is driven active low after VCOU NT= VT OTAL; it is driven inactive high after VCOUNT=VESYNC. The internal VBLNK signal is driven active low aft er VCO UNT=VSBLNK; it is driven inactive high af ter VCOUNT= VEBLNK. VBLNK is logically ORed (negative logic) with HBLNKto produce the BLANK signal. This description applies to a noninterlaced display. The vertical timing changes slightly for an interlaced display. 9-8 Screen Refresh and Video Timing - Vertical Video Timing I VTCTAL 1 [ VESYNC 1£ Comparator 7S 1-J1 ii Comparator I- — r> ■ 6 Q «|R Q -►V8YNC HSYNC VCOUNT Com parator m — — m — Comparator \ - 7v I 6 Q * R Q +VBLNK VSBLNK VEBLNK Figure 9-6. Vertical Timing Logic - Equivalent Circuit 9.6.1 Noninterlaced Video Timing Noninterlaced scan mode is selected by setting the NIL bit in the DPYCTL register to 1 . In this mode, each video frame consists of a single vertical field. Figure 9-7 shows the path traced by the electron beam on the screen. Box A shows the vertical retrace, which is an integral number of horizontal scan lines in duration. Box B shows the active portion of the frame. Solid lines represent lines that are displayed; dashed lines are blanked. Monitor Screen Monitor Screen (a) (b) Figure 9-7. Electron Beam Pattern for Noninterlaced Video Figure 9-8 illustrates the video timing signals that generate the display. In this example, VSBLNK=8, VTOTAL=9, VESYN01, and VEBLNK=2. (In actual 9-9 Screen Refresh and Video Tinning - Vertical Video Timing applications, much larger values are used; these values were chosen for illus- tration only.) Each horizontal scan line is preceded by a horizontal retrace. The horizontal scan pattern repeats until VCOUNT=VTOTAL; VCOUNT is then reset to 0, and vertical retrace returns the beam to the top of the screen. BLANK is active low during both horizontal and vertical retrace intervals. VCOUNT is incre mented each time HCOUNT is reset to at the end of a scan line. Th e VSYN C out put beg ins when VCOUNT=VTOTAL, coinciding with the start of HSYNC. The VSYNC output e nds when VCOUNT=VESYNC; this also coincides with the start of an HSYNC pulse. The starting screen -refresh address is loaded from DPYSTRT into DPYADR at the end of the last active horizontal scan line preceding vertical retrace. This load is triggered when HCOUNT=HSBLNK and VCOUNT=VSBLNK. __\ {_ j I j — lirinnnjWiiWirinj I I I I I I VSYNC VBLNK Vertical Sweep Horizontal Sweep VSBLNK =«8 VESYNC = 1 VTOTAL = 9 VEBLNK = 2 Figure 9-8. Noninterlaced Video Timing Waveform Example 9-10 Screen Refresh and Video Timing - Vertical Video Timing 9.6.1.1 Interlaced Video Timing Interlaced scan mode is selected when the NIL bit in the DPYCTL register is set to 0. In this mode, each display frame is composed of two fields of hori- zontal scan lines. The display consists of alternate lines from the two fields. This doubles the display resolution while only slightly increasing the frequency with which data is supplied to the screen. Figure 9-9 illustrates the path traced by the electron beam on the screen. Figure 9-10 shows the timing waveforms used to generate the display in Fig- ure 9-9. In this example, VSBLNK=6, VTOTAL=7, VESYNC = 1, and VEBLNK=2. (In actual applications, much larger values are used; these values were chosen for illustration only.) In interlaced mode, two separate vertical scans are performed for each frame - one for the even line numbers (even field) and one for the odd line numbers (odd field). The even field is scanned first, starting at the top left of the screen (see Figure 9-9 b). When VCOUNT=VTOTAL, the vertical retrace returns the beam to the top of the screen, and the odd field is scanned (Figure 9-9 d). The electron beam starts scanning the odd and even fields at dif ferent p oints. The reason for this is illustrated in Figure 9-10. The end of t he VSYNC pulse tha t preced es the even field coincides with start of an HSYNC pulse; however, the VSY NC pulse that precedes the odd field ends exactly halfway between two HSYNC pulses Even Field Odd Field — -A— Monitor Screen Monitor Screen Monitor Screen Monitor Screen •■WW (a) Juxtaposition of even and odd fields on monitor screen. Figure 9-9. Electron Beam Pattern for Interlaced Video In interlaced mode, video timing logic operation is altered so that the odd field begins when HCOUNT=HTOTAL/2. The beam is thus positioned so that horizontal scan lines in the odd field fall between horizontal scan lines in the even field. To place each line of the odd field precisely between two lines of the even field, load HTOTAL with an odd number. 9-11 Screen Refresh and Video Timing - Vertical Video Tinning The transition from d to a in Figure 9-9 shows that the vertical retrace at the end of the odd field begins a t the en d of a horizontal scan line; that is, it co- incides with the start of an HSY NC pulse, which results from the condition HCOUNT=HTOTAL The VSYNC pulse duration is an integral number of hor- izontal scan retrace intervals. When vertical retrace ends and the active portion of the next even field begins, the beam is positioned at the beginning of a horizontal scan line. Horizontal timing is similar for interlaced and noninterlaced displays. HCOUNT is reset to at the end of each horizontal scan line. A screen -refresh cycle begins before the end of the line, coinciding with the start of the hori- zontal blanking interval. Assuming that the starting corner of the display is the upper left corner, the DUDATE field of the DPYCTL register is added to the screen -refresh address (SRFADR in the DPYADR register) to generate the row address for the next screen -refresh cycle. In interlaced mode, the DUDATE value must be twice that of the value needed to produce the same display in noninterlaced mode (that is, two times the difference in addresses between consecutive scan lines). This causes the screen refresh to skip alternate lines during the odd and even fields. At the beginning of each vertical blanking interval, the screen -refresh address (SRFADR in the DPYADR register) is loaded with the starting value specified by the DPYSTRT register. When vertical blanking precedes an even field, the new DPYADR row address is incremented by half the value in the DUDATE field. This is in preparation to display line 2 (Figure 9-9 b). When vertical blanking precedes an odd field, the row address loaded into DPYADR from DPYSTRT is not incremented. In this case, the starting row address in DPYSTRT points to the beginning of line 1 (Figure 9-9 d). Figure 9-10. Interlaced Video Timing Waveform Example 9-12 Screen Refresh and Video Timing - Display Interrupt 9.7 Display Interrupt The TMS34010 can be programmed to interrupt the display when a specified line is displayed on the screen. This is called a display interrupt. It is ena- bled by setting the DIE bit in the INTENB register to 1 and loading the DPY- INT register with the desired horizontal scan line number. When VCOUNT = DPYINT, the interrupt request is generated to coincide with the start of hori- zontal blanking at the end of the specified line. The display interrupt request can be polled by disabling the interrupt (setting DIE=0) and checking the value of the DIP bit in the INTPEND register. Writing a to DIP clears the request. The display interrupt has several applications. It can be used to coordinate modifications of the bit map with the display of the bit map's contents, for example. While the bottom half of the screen is displayed, the GSP can modify the bit map of the top half of the screen, and vice versa. Another use for the display interrupt is in maintaining a cursor on the monitor screen. The cursor image resides in the on-screen memory only during the time the electron beam is scanning the lines containing the cursor. The cursor remains free from flicker even during periods in which the TMS34010 busy drawing to the screen. The technique is to load the DPYINT register with the VCOUNT value of a scan line just above where the top of the cursor is to ap- pear. When the display interrupt occurs, the interrupt service routine performs the following tasks: • Sets DPYINT to the scan line just below the cursor, • Saves the portion of the screen where the cursor is to appear, and • PixBlts the cursor onto the screen. The cursor remains on the screen until the electron beam reaches the bottom of the cursor, at which time a second interrupt request occurs. The original screen is then restored, and the TMS34010 can resume drawing to the screen. The display interrupt is also useful in split screen applications. By modifying the contents of the DPYADR register halfway through a frame, different parts of the bit map can be displayed on the top and bottom halves of the screen. No special steps are necessary to ensure that loading a new value to DPYADR does not interfere with an ongoing screen -refresh cycle. The display interrupt is requested at the beginning of the horizontal blanking interval. If a screen- refresh cycle occurs during the same horizontal blanking interval, the GSP cannot respond to the interrupt request until the refresh cycle and subsequent updating of DPYADR are complete. This is true whether the interrupt is taken or the GSP simply polls the DIP bit and detects a 0-to-1 transition. After DIP has been set to 1, DPYADR can be loaded with a new value to achieve the split screen anytime before the next screen -refresh cycle. In interlaced mode, the display interrupt can be used to detect the start of the even field. For this purpose, the DPYINT register is loaded with the value from the VESYNC register. Figure 9-10 (page 9-12) shows that during the odd field, VCOUNT is incremented by 1 halfway through the horizontal interval when the condition VCOUNT=VESYNC is detected. Assuming that HSBLNK=HTOTAL/2, VCOUNT contains the value VESYNC+1 by the time horizontal blanking begins. This means that if DPYINT=VESYNC, the display interrupt is effectively prevented from occurring during the odd field. 9-13 Screen Refresh and Video Timing - Dot Rate 9.8 Dot Rate A typical screen must be refreshed 60 times per second for a noninterlaced scan or 30 times per second for an interlaced scan. For a noninterlaced dis- play, the dot period (time to refresh one pixel) is estimated as: Dot Period - (0.8)(1/60 seoond) (pixels/line) x (lines/frame) For an interlaced display, the dot period is estimated as (0.8) (1/30 second) Dot Period = (pixels/line) x (lines/frame) The 0.8 factor in the numerator accounts for the fact that the display is typi- cally blanked for about 20% of the duration of each frame. This factor varies somewhat from monitor to monitor. During each dot period, the complete information for one pixel must be ob- tained from the display memory (or frame buffer). Thus, the rate at which vi- deo data must be supplied from the display memory (which is usually the limiting factor for large systems) is a function of pixel size as well as screen dimensions. 9-14 Screen Refresh and Video Timing - External Sync Mode 9.9 External Sync Mode External sync mode allows the TMS34010 to use horizontal and vertical sync signals from an external source. This permits graphics images generated by the GSP to be superimposed upon or mixed with images from external sources. External sync mode is select ed b y setti ng the DXV and HSD bits in the DPYCTL register to 0. HSYNC and VSYNC are now con figured as inputs. (Al- ternately, HSYNC can be configured as an output and VSYNC as an input by setting DXV=0 and HSD = 1.) When an active-low sync pulse is input to one of these pins, the corresponding counter (HCOUNT or VCOUNT) is forced to all 0s. By forcing the counters to follow the external sync signals, the blanking intervals and screen -refresh cycles are also forced to follow the external video signals. The HSYNC and VSYNC inputs are sampled on each VCLK rising edge. HCOUNT or VCOUNT are cleared 2.5 cloc k perio ds (on a V CLK falling edge) followi ng a high-to-low transition at the HSYNC or VSYNC pin, respectively. BLANK remains an output, but its timing is affected because the point at which HCOUNT and VCOUNT are cleared is controlled by the external sync signals. The 2.5-clock delay must be considered when selecting values for the HSBLNK and HEBLNK registers. 9.9.1 A Two-GSP System One GSP can generate video timing for two GSPs. As Figure 9-1 1 shows, GSP #1 is configured for internal sync mode (DXV=1 ) and generates the sync timing. GSP #2 is conf igure d for e xternal sync mode (DXV=0 and HSD=0), and receives the HSYNC and VSYNC inputs from GSP #1 . Assume that the vi- deo timing registers of the two devices are named as follows: GSP #1 GSP#2 HCOUNT1 HCOUNT2 HESYNC1 HESYNC2 HSBLNK1 HSBLNK2 HEBLNK1 HEBLNK2 HTOTAL1 HTOTAL2 VCOUNT1 VCOUNT2 VESYNC1 VESYNC2 VSBLNK1 VSBLNK2 VEBLNK1 VEBLNK2 VTOTAL1 VTOTAL2 GSP #2's registers should be program med in t erms of the values in GSP #1's registers, as shown in Table 9-1. The BLANK signals from GSP #1 and GSP #2 are the same, and switch in unison on the same VCLK edges. When HCOUNT1 is cleared on a VCLK falling edge, HCOUNT2 is cleared three full VCLK periods later. For short horizontal blanking periods, HEBLNK2 may need to be loaded with a value that is less than zero. For example, assume that HSBLNK1=HTOTAL1-4 and HEBLNK1=1 (that is, the horizontal blanking interval is six VCLK periods). To ensure that GSP #2's horizontal blanking interval begins and ends at the same time as GSP #1's, GSP #2's registers must be loaded with values so that HSBLNK2=HTOTAL1-8 and HEBLNK2 = HTOTAL1-2. 9-15 Screen Refresh and Video Timing - External Sync Mode VCLK _, Q6P 1; / \ / \ / \ { \ / \ / \ / \ / 1 1 HCOUNT X N-, X N x X 1 x a x 3 x « HSYNC (Output to Q6P #2) k_i Q6P #2: !« 2.0 CI0CK8 9\ r i flor M3& | SSSLnt HCOUNT X - X - X - x - X n X • X 1 Figure 9-11 . External Sync Timing - Two GSP Chips The values in HT0TAL2 and VT0TAL2 must be large enough so that the conditions HCOUNT=HTOTAL and VCOUNT=VTOTAL do not cause HCOUNT and VCOUNT, respectively, to be cleared before the leading edges of the external horizontal and vertical sync pulses occur. In the example in Table 9-1, HT0TAL2 and VT0TAL2 are set to their maximum values. The value of HESYNC2 mu st be su ch that HC0UNT=HESYNC2 occurs between the end of an external HSYNC pulse and the beginning of the next external HSYNC pulse. The value of VESYNC2 must be such that VC0UNT=VESYNC2 occurs betwe en the end of an external VSYNC pulse and the beginning of the next external VSYNC pulse. Table 9-1. Programming GSP #2 For External Sync Mode HEBLNK2 = HEBLNK1 - 3 HSBLNK2 = HSBLNK1 - 3 HT0TAL2 = 65535 HESYNC2 = (HEBLNK2 + HSBLNK2)/2t VEBLNK2 = VEBLNK1 VSBLNK2 = VSBLNK1 VT0TAL2 = 65535 VESYNC2 = (VEBLNK2 + VSBLNK2)/2t 1" Suggested value; see description in text. Since the internal counter can only be resolved to the nearest VCLK edge, precise synchronization with an external video source can be achieved only when VCLK is harmo nically r elate d to th e external horizontal sync signal. In general, however, the HSYNC and VSYNC inputs are allowed to change asyn- chronously with respect to VCLK, although the precise VCLK edge at which an external sync pulse is recognized can be guaranteed only if the setup and hold times specified for sync inputs are met. 9-16 Screen Refresh and Video Timing - External Sync Mode 9.9.2 External Interlaced Video External sync mode can be used for both interlaced and noninterlaced dis- plays. When locking onto external interlaced sync signals, the GSP discrimi- nates between the odd and even fields of the external video signals based on whether its internal horizontal blanking is active at the time that the start of the external vertical sync pulse is detecte d. In Figure 9-10, for example, the even field begins at a point where HBLNK is active low, and the odd field begins while HBLNK is high. In interlaced mode, the discrimination between the even and odd fields of an external video source is based on the value of HCOUNT at a p oint two VCLK periods past the rising VCLK edge at which the GSP detects the VSYNC input's high-to-low transition. If HCOUNT contains a value greater than the value in HEBLNK, but less than or equal to the value in HSBLNK, the GSP assumes that the vertical sync pulse precedes the start of an odd field. Otherwise, the next field is assumed to be even. Alternatively, the GSP can be placed in noninterlaced mode, even though the external sync signals it is locking onto are for an interlaced display. In this case, the GSP simply causes identical display information to be output to the monitor during the odd and even fields. The program can determine at any time whether an even or odd field is being scanned by inspecting the least significant bits of the DPYADR register to determine whether they have been incremented by DU DATE/2. Recall that that at the start of an even field, the initial address loaded into DPYADR from the DPYSTRT register is automatically incremented by DUDATE/2 (that is, incremented by half the value specified in the DUDATE field of the DPYCTL register). At all other times, DPYADR is incremented by DUDATE rather than DUDATE/2. 9-17 Screen Refresh and Video Timing - Video RAM Control 9.10 Video RAM Control The TMS34010 automatically schedules the VRAM (video RAM) memory- to-register cycles needed to refresh a video monitor screen. These cycles are referred to as screen -refresh cycles. In addition to automatic screen -refresh cycles, the GSP can be configured to perform memory-to-register and register-to-memory cycles under the explicit control of software executing on the GSP's internal processor. One of the primary uses for this capability is to facilitate nearly instantaneous clearing of the screen. The screen is cleared in 256 memory cycles or less by means of a technique referred to here as bulk initialization of the display memory. 9.10.1 Screen Refresh A screen -refresh cycle loads the VRAM shift registers with a portion of the display memory corresponding to a scan line of the display. The internal re- quests for these cycles occur at regular intervals coinciding with the start of the horizontal blanking intervals defined by the video timing registers. When horizontal blanking ends, the contents of the shift registers are clocked out serially to drive the video inputs of a monitor. A screen -refresh cycle typically occurs prior to each active line of the display. 9. 10.1.1 Display Memory The display memory is the area of memory which holds the graphics image output to the video monitor. This memory is typically implemented with VRAMs. During a screen -refresh cycle, a portion of the display memory cor- responding to one (or possibly more) scan lines of the display are loaded into the VRAM shift registers. Depending on the screen dimensions selected, not all portions of the display memory are necessarily output to the monitor. The width of the display memory is referred to as the screen pitch, which is the difference in 32-bit memory addresses between two vertically-adjacent pixels on the screen. The screen pitch is also the difference in starting memory ad- dresses of the video data for two consecutive scan lines. When XY addressing is used, the screen pitch must be a power of two to facilitate the conversion of XY addresses to memory addresses. The value loaded into the DUDATE field of the DPYCTL register represents the screen pitch, and is the amount by which the screen -refresh address is incremented (or decremented) follow- ing each screen -refresh cycle. The portion of display memory that is actually output to the monitor is referred to as the on-screen memory. The starting location of the on-screen memory is specified by the SRFADR field in the DPYSTRT register. The starting screen -refresh address is output during the screen -refresh cycle that occurs at the start of each frame. At the end of the screen -refresh cycle, the address is incremented to point to the area of memory containing the pixels for the second scan line. The process is repeated for each subsequent scan line of the frame. 9-18 Screen Refresh and Video Timing - Video RAM Control A screen -refresh cycle typically affects all video RAMs in the system. A me- mory-to-register cycle transfers data from a selected row of memory to the internal shift register of each VRAM. The data is then shifted out to refresh the display. A screen -refresh cycle takes place during the horizontal blanking interval that precedes a scan line to be displayed. Typically, the shift registers containing the video data for the line are clo cked only during the active portion of the scan line, that is, when the BLANK output is high. At higher dot rates, the pixel clock or dot clock used to shift video data to the monitor is run through a frequency divider to create the VCLK signal input to the GSP. The 8-bit row address output during the screen -refresh cycle specifies the row in memory to be loaded into the shift register internal to the VRAM. The number of bits of video data transferred to the shift registers of all the VRAMs in the system during a single screen -refresh cycle is calculated by multiplying the number of VRAMs times the length of the shift register in each VRAM. For example, 64 TMS4161 (64K-by-1) VRAM devices are sufficient to con- tain the bit map for a 1 024-by-1 024-pixel display with four bits per pixel. The length of the shift register in each TMS4161 is 256 bits. Thus, in a single screen -refresh cycle, a total of 64 times 256, or 16,384, bits are loaded. This is enough data to refresh four complete scan lines of the display. In general, a single screen -refresh cycle performed during a horizontal blanking interval is sufficient to supply one or more complete scan lines worth of data to the video monitor screen. 9. 10. 1.2 Generation of Screen-Refresh Addresses The DPYADR, DPYCTL, DPYSTRT, and DPYTAP registers are used to gener- ate the addresses output during screen -refresh cycles. Figure 9-12 shows these four registers, and indicates the register fields which determine the way in which screen -refresh addresses are generated. 15 2 10 DPYADR I ' ' ' ' " " SRFADR" ' ' ' ' I * j 15 DPYSTRT I ' ' ' ' ' " ShstRT" 15 14 13 12 11 10 9 I' ■ ■ T NIL ORG 15 14 13 DPYTAP i : j : : : ; ; dmap; : :TT Figure 9-12. Screen- Refresh Address Registers 9-19 Screen Refresh and Video Timing - Video RAM Control • DPYADR contains the SRFADR field, which is a counter that generates the addresses output during screen -refresh cycles. • DPYSTRT contains the SRSTRT field, the starting address loaded into SRFADR at the beginning of each frame. • DPYCTL contains several fields that affect screen -refresh addresses. The 8-bit DUDATE field is loaded with seven Os and a single 1 that points to the bit position within SRFADR (bits 2-9 of DPYADR) at which the address is to be incremented (or decremented) at the end of each screen -refresh cycle. The ORG bit determines whether the screen- refresh address is incremented or decremented. If ORG = 0, the screen origin is located at the top left corner of the screen and the address is incremented; otherwise, it is decremented. The NIL bit determines whether the GSP is configured to generated an interlaced (NIL=0) or noninterlaced (NIL=1) display. The generation of screen -refresh ad- dresses can be modified to accommodate either type of display. • The DPYTAP register is used to specify screen -refresh address bits to right of the position at which DUDATE increments the address. DPY- TAP provides the additional control over screen -refresh address gener- ation necessary to allow the screen to pan through the display memory. Bits not directly involved in address generation are shaded in Figure 9-12. The address output during a screen -refresh cycle identifies the starting pixel on the scan line about to be output to the monitor. Figure 9-1 3 (page 9-21 ) shows a 32-bit logical address of the first pixel on one of the scan lines ap- pearing on the screen. The screen -refresh address consists of bits 4-23 of the logical address, which are generated by combining the values contained in SRFADR and DPYTAP. Where SRFADR and DPYTAP overlap (bits 10-17 of the logical address), the address bits are generated by logical ORing the corresponding bits of SRFADR and DPYTAP. The 8-bit DUDATE value con- tains seven Os and a single 1 pointing to the position at which SRFADR is to be incremented (or decremented). The DPYTAP register should be loaded with the portion of the pixel address in Figure 9-13 lying to the right of the position indicated by the DUDATE pointer bit. SRFADR contains the portion of the pixel address that is incremented by the DUDATE pointer bit. Following system power up, the software should load the starting screen - refresh address into the SRSTRT field of the DPYSTRT register, and load the increment to the screen -refresh address into the DPYCTL register. For a typi- cal CRT display, the starting address is the address in memory of the pixel that appears in the upper left corner of the display. If ORG bit in DPYCTL is 0, the 1s complement of the starting address should be loaded into DPYSTRT. If ORG=1, the starting address loaded into DPYSTRT should not be comple- mented. DPYADR is automatically loaded with the starting display address from DPYSTRT prior to the start of each frame. As shown in Figure 9-14 a, bits 2-15 of DPYSTRT (SRSTRT) are loaded into bits 2-15 of DPYADR (SRFADR). The load occurs coincident with the start of the horizontal blanking interval that occurs just at the end of the last active scan line of the preceding frame. 9-20 Screen Refresh and Video Timing - Video RAM Control Output During Row Address Time > Output During Column Address Time A. Figure 9-13. Logical Pixel Address The address output during each screen -refresh cycle is contained in bits 2 through 15 of the DPYADR register (the 14-bit SRFADR field). As shown in Figure 9-14/?, DPYADR bits 4-1 5 are output at the LAD0-LAD1 1 pins during the row address time of the screen -refresh cycle. If ORG=0, the DPYADR bits are inverted before being output; otherwise, they are output unaltered. Zeros (logic-low level) are output on LAD12-LAD14, and a one (logic-high level) is output on LAD1 5; this is the RF status bit. During the column address time of the screen -refresh cycle, bits 2-6 of DPYADR are output at LAD6-LAD10. If ORG=0, the DPYADR bits are in- verted before being output. DPYTAP bits 6-11 are ORed with DPYADR bits 2-7 and output at LAD6-LAD1 1 . Bits 0-5 and 1 2-1 3 of DPYTAP are output at LAD0-LAD5 and LAD11-LAD13, respectively. Zeros are output at LAD1 4-LAD1 5 (the TR and IAQ status bits). After the row and column addresses have been output, the address in DPYADR bits 2-1 5 is decremented by the 8-bit value in DPYCTL bits 2-9 (the DUDATE field). This is done in preparation for the next screen -refresh cycle. The 8-bit DUDATE value is a binary number consisting of seven Os and a single 1. This single 1 indicates the position at which DPYADR is decre- mented. If ORG=0, the screen -refresh address in DPYADR is effectively in- cremented; the 1s complement of the address contained in DPYADR is decremented by the DUDATE amount, but is inverted before being output. This is equivalent to incrementing the address. If ORG = 1, the address is de- cremented. 9-21 Screen Refresh and Video Timing - Video RAM Control 6R6TRT 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 DPYSTRT Register h i i i i rl ! 1 1 ' ' ' ' ' ' DPYADR Register i ■ ■ 6RFADR (a) Display-Address Initial Value 16 14 13 12 11 10 9 8 7 6 5 4 3 2 10 DPYADR I, ', ' «'« ' , ' « ' . ' « ' , ' , ' Register I ■ ■ ■ ■ ■ ■ ■ ■ ■ ' ■ T ■ T ■ i_ ORG i> (b) Row-Address Time Figure 9-14. Screen- Refresh Address Generation 9-22 Screen Refresh and Video Timing - Video RAM Control DPYADR Register 15 14 13 12 11 10 9 8 I I l 1 1 1 I r I I I l I I I ■ T ' T ' ORG DPYTAP Register 15r 14 13 12 11 10 9 8 7 6 5 4 3 2 1 -D» •i-J-L tMXQJ LAD Bus Pins ______ (c) Column-Address Time Figure 9-14. Screen- Refresh Address Generation (Continued) ♦ 1 ♦ 2 ♦ 3 ♦ 4 ♦ 5 ♦ 7 ♦ 8 ♦ 9 ♦ 10 ♦ 11 ♦ 12 ♦ 13 -14(TR) -150AQ) I 9-23 Screen Refresh and Video Timing - Video RAM Control (d) Display-Address Update Figure 9-14. Screen- Refresh Address Generation (Concluded) 9-24 Screen Refresh and Video Timing - Video RAM Control 9. 10. 1.3 Screen Refresh for Interlaced Displays The size of the DUDATE increment specified for an interlaced display should be twice that required for a noninterlaced display of the same dimensions. This allows every other line to be skipped during the even or odd field of an interlaced frame. Before the start of the even field, half the value of the DU- DATE increment is added to the starting address loaded into DPYADR to ob- tain the necessary starting displacement. The SRSTRT field in DPYSTRT points to the area of memory containing the video data for scan line 1 in the example of Figure 9-9 on page 9-11. 9.10.1.4 Panning the Display The DPYTAP register supports horizontal panning of the screen across a dis- play memory that is larger than the screen. The value contained in the low- order bits of DPYTAP furnish the LSBs of the column address output during the screen -refresh cycle. Incrementing this value results in panning to the right; decrementing this value results in panning to the left. 9.10.1.5 Scheduling Screen-Refresh Cycles The internal request for a screen -refresh cycle is generated when horizontal blanking begins. This gives the GSP essentially the entire horizontal blanking interval in which to perform the screen -refresh cycle. The delay from the start of horizontal blanking to the start of the screen -refresh cycle is called the screen -refresh latency, and is determined by the internal memory controller. The best and worst case screen -refresh latencies are given in Tab le 9-2. In the best case, the delay from the high-to-low transition of the BLANK output to the start of the screen -refresh cycle (the time the row address is output) is only 3.25 machine states (or local clock periods). In the worst case, the delay is (7.25 + 2W) states, where W represents the number of wait states required per memory cycle. The worst case number is based on the fact that the start of the screen -refresh cycle can be delayed by up to three states if a read- modify-write operation began one state before the memory controller received the request for the screen -refresh cycle. A screen -refresh request is given higher priority than requests for DRAM -refresh, host-indirect or GSP CPU cycles; hence, no further delays occur unless an external device generates a hold request. Table 9-2. Screen -Refresh Latency Min Max 3.25 states (7.25 + 2W) states Note: W is the number of wait states per memory cycle. The horizontal blanking interval should be sufficiently long in duration for the screen -refresh cycle to be completed before blanking ends. The required mi- nimum blanking interval is therefore about (9.25 + 3W) machine states, de- pending on how soon after the end of blanking the external video logic begins clocking the VRAM shift registers. Of course, this time must be translated from 9-25 Screen Refresh and Video Timing - Video RAM Control machine states (local clock periods) to VCLK periods to program the HEBLNK register. The horizontal sync pulse is permitted to be as small as a single VCLK period in duration. No screen -refresh cycles are performed during vertical blanking until nearly the end of vertical blanking - at the start of the horizontal blanking interval that precedes the first active scan line of the new frame. The scre en -refr esh latency specified in Table 9-2 assumes that a local bus hold request (HOLD low) is not asserted between the start of blanking and the start of the screen -refresh cycle. If a hold request prevents the TMS34010 from initiating a scheduled screen -refresh cycle during this time, the TMS34010 is forced to delay its screen -refresh cycle until the bus is released by the external device asserting the hold request. A hold request occurring during the hori- zontal blanking interval preceding an active scan line on the display should be deasserted in time to allow the TMS34010 to complete the pending screen -refresh cycle before blanking ends. If a screen -refresh cycle is pending at the time the external device releases the bus, the screen -refresh cycle is the first cycle performed by the TMS34010 after it regains control of the bus. 9.10.2 Video Memory Bulk Initialization VRAMs may be rapidly loaded with an initial value using a special GSP feature that converts pixel accesses to register transfers. This rapid loading method is referred to as bulk initialization of the video memory, and can be used with VRAMs such as the TMS4461. When the SRT (shift register transfer) bit in the DPYCTL register is set to a 1, all reads and writes of pixel data are con- verted at the memory interface of the GSP to register-transfer cycles. When SRT=0, pixel accesses are performed in normal fashion. When SRT=1, the processor can initiate register-transfer cycles under explicit program control. By performing a series of such cycles, some or all of the display memory can be set to an initial background color or pattern very rapidly (in a small fraction of one frame time). First, the VRAM shift registers are loaded with the initial value. The video memory is then set to the initial color or pattern one row at a time by writing the shift register contents to the me- mory. During a register-transfer cycle (when SRT=1 ), the row and column addresses are output in unaltered form; that is, the address is not affected by the state of SRT. The 8-bit row address output during the cycle designates which row in memory is involved in the transfer. The direction of the transfer is deter- mined by whether the cycle is a read or a write. A write cycle such as a PIXT transfer from a general-purpose register to memory is converted to a VRAM register-to-memory cycle. Similarly, a read cycle such as a PIXT transfer from memory to a general-purpose register is converted to a VRAM memory-to- register cycle. Only pixel transfers are affected by the SRT bit. The manner in which all other data accesses and instruction fetches are performed is not affected. 9-26 Screen Refresh and Video Timing - Video RAM Control Before bulk initialization of the display memory, the VRAM shift registers are loaded with the solid color or pattern with which the display memory is loaded. This can be done in one of two ways, by either: • Serially shifting bits into the shift register or • First loading a row of display memory with the color or pattern using a series of "normal" pixel writes (when SRT=0), and then loading the contents of this row into the shift register by means of a PIXT memo- ry -to -register instruction (executed while SRT=1). To speed up the bulk initialization operation further, a series of transfers can be made more rapidly by using a single FILL instruction in place of a series of PIXT instructions. The fill region is selected so that each pixel write cycle generates a new row address. The fill region is specified to be precisely 16 bits wide, the width of the memory data bus. Also, plane masking is disabled, transparency is turned off, and the pixel processing replace operation is se- lected. This ensures that each row is addressed only once during the course of the fill operation. The number of bits of the display memory that are altered by a single regis- ter-to-memory transfer cycle is calculated by multiplying the number of VRAM devices by the number of shift register bits in each device. The entire frame buffer is loaded with the initial color or pattern in 256 memory cycles. 9-27 Screen Refresh and Video Timing 9-28 Section 1 Host Interface Bus A host processor can communicate with the TMS34010 by means of an in- terface bus consisting of a 16-bit data path and several transfer-control sig- nals. The TMS34010's host interface provides a host with access to four programmable 16-bit registers (resident on the TMS34010), which are mapped into four locations in the host processor's memory or I/O address space. Through this interface, commands, status information, and data are transferred between the TMS34010 and host processor. A host processor may read from or write to TMS34010 local memory indirectly via an autoincrementing address register and data port. This optional autoin- crement feature supports efficient block moves. The TMS34010 and host can send interrupt requests to each other. A pin is dedicated to the interrupt re- quest from the TMS34010 to the host. To allow block moves initiated by a host to take place more efficiently, the host may suspend TMS34010 program execution to eliminate contention with the TMS34010 for local memory. DRAM -refresh and screen -refresh cycles continue to occur while the TMS34010 is halted. This section includes the following topics: Section Page 10.1 Host Interface Bus Pins 10-2 10.2 Host Interface Registers 10-2 10.3 Host Register Reads and Writes 10-4 10.4 Bandwidth 10-22 10.5 Worst-Case Delay 10-23 10-1 Host Interface Bus - Pins/Registers 10.1 Host Interface Bus Pins The TMS34010's host interface bus consists of a 1 6-bit bidirectional data bus and nine control lines. These signals are described in detail in Section 2. HD0-HD15 form a 16-bit bidirectional bus, used to transfer data between the TMS3401 and a host processor. HCS is the host chip select signal. It is driven active low to allow a host processor to access one of the host interface registers. HFSO, HFS1 are function select pins. They specify which of four host interface registers a host can access (see Section 10.2). HREAD is driven active low to allow a host processor to read the contents of the selected host interface register, output on HD0-HD15. HWRITE is driven active low to allow a host processor to write the contents of HD0-HD15 to the selected host interface register. HLDS is driven low to enable a host processor to access the lower byte of the selected host interface register. HUDS is driven low to enable a host processor to access the upper byte of the selected host interface register. HRDY informs a host processor when the TMS34010 is ready to com- plete an access cycle initiated by the host. HINT transmits interrupt requests from the TMS34010 to a host proces- sor. 10.2 Host Interface Registers The host interface registers are a subset of the I/O registers discussed in Sec- tion 6. The host interface registers can be accessed by both the TMS34010 and the host processor. These registers occupy four 16-bit locations in the host processor's memory or I/O address map. One of these four locations is selected by placing a particular code on the two function select inputs, HFSO and HFS1 , as shown in Table 1 0-1 . Table 10-1. Host Interface Register Selection HFS1 HFSO Selected Register HSTADRL 1 HSTADRH 1 HSTDATA 1 1 HSTCTL A 16-bit host processor typically connects two of its low-order address lines to HFSO and HFS1. An 8-bit processor typically connects two low-order ad- dress lines to HFS0-HFS1 and uses a third low-order address bit to enable either the upper or lower byte of the selected register by activating one of the 10-2 Host Interface Bus - Registers byte select inputs, HUDS or HLDS. In the second case, the registers occupy eight 8-bit locations in the host processor's memory map. • The HSTADRL and HSTADRH registers contain the 16 LSBs and 16 MSBs, respectively, of a 32-bit pointer address. A host processor uses this address to indirectly access TMS34010 local memory. • The HSTDATA register buffers data that is transferred through the host inter- face between TMS34010 local memory and a host processor. HSTDATA contains the contents of the address pointed to by the HSTADRL and HSTADRH registers. • The HSTCTL register is accessible to the TMS34010 as two separate I/O re- gisters, HSTCTLL and HSTCTLH, but is accessed by a host processor as a single 16-bit register. HSTCTL contains several programmable fields that control host interface functions. - NMI (nonmaskable interrupt, bit 8): Allows a host processor to interrupt TMS34010 execution. - NMIM (NMI mode, bit 9): Specifies if the context of an interrupted program is saved when a nonmaskable interrupt occurs. - CF (cache flush, bit 14): Setting this bit flushes the contents of the TMS3401 instruction cache. A host processor can force the TMS3401 to execute new code after a download by flushing old instructions out of cache. - LBL (lower byte last, bit 13): Specifies which byte of a register an 8-bit host processor accesses first. - /NCR (increment address before local read, bit 1 2): Controls whether the 32- bit pointer in the HSTADR registers is incremented before being used in a local read cycle that updates the HSTDATA register. - INCW (increment address after local write, bit 11): Controls whether the 32-bit pointer in the HSTADR registers is incremented after being used in a local write cycle that transfers the contents of the HSTDATA register to memory. - HLT (halt TMS34010 program execution, bit 15): A host processor can halt the TMS3401 0's on-chip processor by setting this bit to 1 . - MSGIN (message in, bits 0-2): Buffers a 3-bit interrupt message from a host processor to the TMS3401 0. - INTIN (input interrupt bit, bit 3): A host must load a 1 into this bit to generate an interrupt request to the TMS34010. - MSGOUT (message out, bits 4-6): Buffers a 3-bit interrupt message from the TMS34010 to a host. INTOUT (Interrupt out, bit 7): The TMS34010 must load a 1 to this bit to send an interrupt request to a host processor. 10-3 Host Interface Bus - Reads and Writes 10.3 Host Register Reads and Writes Host interface read and write cycl e s are ini ti ated by the ho st pro cesso r and are controlled by means of the HCS, HWRITE, HREAD, HUDS, and HLDS signals. Host- initiated accesses of the register selected by the function -select code input on HFSO and HFS1 are controlled as follows: While HCS, HLDS, and HWRITE are active low, the contents of HD0-HD7 are latched into the lower byte of the selected register. • While HCS, HUDS, and HWRITE are active low, the contents of HD8-HD1 5 are latched into the upper byte of the selected register. While HCS, HLDS, and HREAD are active low, the contents of the lower byte of the selected register are driven onto HD0-HD7. • While HCS, HUDS, and HREAD are active low, the contents of the upper byte of the selected register are driven onto HD8-HD1 5. As this list indicates, at least three control signals must be active at the same time to initiate an access. The last of the three signals to become active begins the access, and the first of the three signals to become inactive signals the end of the access. A signal that begins or completes an access is referred to in the following discussion as the strobe signal for the cycle. Any of the signals listed above may be a strobe. Figure 10-1 shows a functional representation of the logic that controls the TMS34010's host interface. TM834010 H£5 h wrtte flTOS HLDS HRK5 ^O Cr—n 3Z> Write to upper byte of selected register __ Write to lower I I byte of selected J *- register ^_^ Read from upper I I byte of selected J "- register =D— -n Read from lower byte of selected register Figure 10-1. Equivalent Circuit of Host Interface Control Signals 10-4 Host Interface Bus - Reads and Writes The designer must ensure that HREAD and HWRITE are never active low si- multaneously during an access of a host interface register; this may cause in- ternal damage to the device. 10.3.1 Functional Timing Examples he functional timing examples in this section are based on the circuit shown n Figure 10-1. The HCS input is the strobe in Figure 1 0-2 and Figure 1 0-3. The HWRITE signal is the strobe in Figure 1 0-4. The HREAD signal is the strobe in Figure 10-5. The HUDS and HLDS signals are strobes in Figure 10-6 and Figure 10-7. HFS0-HFS1 HREAD HWRITE HLDS HUDS HCS HD0-HD15 Valid Function Select Enable Write to Lower Byte V L L Inhibit Write to Upper Byte V \___y Valid Data In HRDY (High) Figure 10-2. Host 8-Bit Write with HCS Used as Strobe 10-5 Host Interface Bus - Reads and Writes HF60-HF61 Valid Function Select HWRITE HREAO HLDS HUD8 HCS HD0-HD15 — L Inhibit Read from Lower Byte V^ Enable Read from Upper Byte / a r c Valid Data Out > HRDY (High) Figure 10-3. Host 8-Bit Read with HCS Used as Strobe HF80-HF81 Valid Funotlon Seleot HWRITE HC6 HLDS X L Enable Read from Lower Byte z HUDS \ Enable Read from Upper Byte f HREAD HD0-HD15 HRDY "\ f Valid Data Out > (High) Figure 10-4. Host 16- Bit Read with HREAD Used as Strobe 10-6 Host Interface Bus - Reads and Writes HF80-HF81 Valid Function Select HREAD X HCS z HLDS Enable Write to Lower Byte z HUDS Enable Write to Upper Byte / HWRITE A f HD0-HD15 Valid Data In HRDY (High) Figure 10-5. Host 16-Bit Write with HWRITE Used as Strobe HFS0-HFS1 Valid Function Select HREAD X HCS z HWRITE L HLDS ^Strobe Low Byte y - _ \6trobe High Byte^ HD0-HD15 Valid Data In HRDY (High) Figure 10-6. Host 16-Bit Write with HLDS, HUDS Used as Strobes 10-7 Host Interface Bus - Reads and Writes HFS0-HFS1 Valid Funotlon Seleot HCS L HWRTTE \ HREAD L HLDS \ Strobe Low Byte r HUDS A Strobe High Byte / HD0-MD15 Valid Data Out > HRDY (High) Figure 10-7. Host 16-Bit Read with HLDS, HUDS Used as Strobes 10.3.2 Ready Signal to Host The default state of the bus ready output pin, HRDY, is active high. HRDY is driven inactive low to force the host processor to wait in circumstances in which the TMS34010 is not prepared to allow a host-initiated register access to be completed immediately. HRDY is always driven low for a brief period at the beginning of a read or write access of the HSTCTL register. When the host attempts to read from or write to the HSTCTL register, HRDY is driven low at the beginning of the access, and is driven high again after a brief interval of one to two local clock cycles. When the host processor performs certain types of host interface register ac- cesses, a local memory cycle results. For example, in reading from or writing to the HSTDATA register, a read or write cycle on the local bus results. If the host processor attempts to perform an access that initiates a second local memory cycle before the TMS3401 has had sufficient time to complete the first, the TMS3401 drives its HRDY output low to indicate that the host must wait before completing the access. When the TMS34010 has completed the local memory cycle resulting from the previous access, it drives HRDY high to indicate that the host processor can now complete its second access. A data tran sfer through t he host i nterfa ce ta kes pla ce only when some com- bination of HCS, HREAD, HWRITE, HUDS, and HLDS are active simultaneously; however, the HRDY signal is activated by the HCS input alone. HRDY can be active-low only while the TMS34010 is chip-selected by the host processor. 10-8 Host Interface Bus - Reads and Writes that is, while HCS is active low . A high-to-low transition on HRDY follows a high-to-low transition on HCS. The benefit of this mode of operation is that HRDY becomes valid as soon as HCS goe s low , which typically is early in the cycle. HRDY is always driven high when HCS is inactive high. A transient low level on the HCS input may cause a corresponding low pulse on the HRDY output. S ystem s that cannot tolerate such transient signals must be designed to prevent HCS from going low except during a valid host inter- face access. In summary, the following rules govern the HRDY output: 1) If a high-to-low HCS transition occurs while the TMS34010 is still completing a local memory cycle resulting from a previous host-indirect access, HRDY goes low. If the register selected is HSTDATA, HSTADRL or HSTADRH, HRDY remains low until the local memory cycle is com- pleted. If the register selected is HSTCTL, the HRDY output remains low for one to two local clock periods. 2) If the host is given a ready signal (HRDY high) to allow it to complete a register access that causes a local memory read or write cycle, HRDY stays high to the end of the access. The access e nds when th e strobe for the cycle ends. Th e strob e en ds wh en HREAD and HWRITE are both inactive high, or when HLDS and HUDS are both inactive high, or when HCS is inactive high, which ever is the first to occur. As soon as the strobe ends, a low level on HCS allow s HR DY to go low again. If the strobe is an input other than HCS, and HCS remains low after the strob e ends, HRDY can go low as a delay from the end of the s trobe. If HCS is the strobe for the access, the acc ess e nds when HCS goes high, and HRDY can go low again as soon as HCS goes low again. 3) If HSTC TL is selected (FSO = FS1 = 1 ) at the high-to-low transition of HCS, HRDY goes low as a delay from the fall of HCS, and remains low for one to two local clock periods. To avoid a low-going pulse on HRDY when accessing a register other than HST CTL, FSO and FS1 should be valid prior to the high-to-low transition of HCS. Figure 10-8 and Figure 10-9 (page 10-10) show examples of host interface register accesses in which HRDY is driven low. 10-9 Host Interface Bus - Reads and Writes HF80-HFS1 VaBd Function Select HREAD J XL HC6 / HTE8. \ / HRDY \ / HD0-HD1S VaHd Data In Figure 10-8. Host Interface Timing - Write Cycle With Wait HF80-HF61 Valid Function Seleot HWRITC I HCS \ / \ / HRDY ^ r HD0-HD15 —n_z i > Figure 10-9. Host Interface Timing - Read Cycle With Wait 10-10 Host Interface Bus - Reads and Writes 10.3.3 Indirect Accesses of Local Memory The host processor indirectly accesses TMS34010 local memory by reading from or writing to the HSTDATA register. HSTDATA buffers data written to or read from the local memory. The word in local memory that is accessed is the word pointed to by the 32-bit address contained in the HSTADRL and HSTADRH registers. The pointer address is loaded into HSTADRL and HSTADRH by the host processor before performing one or more indirect ac- cesses of local memory using the HSTDATA register. The four LSBs of HSTADRL are forced to 0s internally so that the address formed by HSTADRL and HSTADRH always points to a word boundary in local memory. Between successive indirect accesses of local memory using the HSTDATA register, the local memory address contained in the HSTADR registers can be autoincremented by 16. This allows the host processor to access a block of sequential words in local memory without the overhead of loading a new address prior to each access. During a sequence of one or more indirect reads of local memory by the host, the TMS34010 maintains in HSTDATA a copy of the local memory word cur- rently addressed by the HSTADRL and HSTADRH registers. Reading from HSTDATA returns the word prefetched from the local memory location pointed to by the HSTADRL and HSTADRH registers, and causes HSTDATA to be updated from local memory again. Writing to HSTDATA causes the word written to HSTDATA to subsequently be written to the location in local memory pointed to by the HSTADRL and HSTADRH registers. Two increment-control bits, INCR and INCW (contained in the HSTCTL reg- ister), are set to 1 to cause the pointer address in HSTADRL and HSTADRH to be incremented by 16 during reads and writes, respectively. In preparing to use the autoincrement feature, the appropriate increment-control bit, INCR or INCW, is loaded with a 1, and the HSTADRL and HSTADRH registers are set up to point to the first location of a buffer region in the local memory. • When INCR=1, a read of HSTDATA causes the address in HSTADRL and HSTADRH to be incremented before it is used in the local memory read cycle that updates HSTDATA. • When INCW=1, a write to HSTDATA causes the address in HSTADRL and HSTADRH to be incremented after it is used in the local memory read cycle that writes the new contents of HSTDATA to local memory. Loading the pointer address automatically triggers an update of HSTDATA to the contents of the local memory word pointed to. No increment of HSTADRL and HSTADRH takes place at this time regardless of the state of the increment bits. Each subsequent host access of HSTDATA causes HSTADRL and HSTADRH to be automatically incremented (assuming INCR or INCW is set) to point to the next word location in the local memory. In this manner, a series of contiguous words in local memory can be accessed following a single load of the HSTADRL and HSTADRH registers without additional pointer- management overhead. 10-11 Host Interface Bus - Reads and Writes 10.3.3.1 Indirectly Reading from a Buffer Figure 10-10 illustrates the procedure for reading a block of words beginning at local memory address N. Assume that the I NCR bit in the HSTCTL register is set to 1 and the LBL bit in HSTCTL is set to 0. • In Figure 10-10 a, the host processor loads the 32-bit address N into HSTADRL and HSTADRH. • The loading of the second half of the address into HSTADRH causes the TMS34010 host interface control logic to automatically initiate a read cycle on the local bus. This read cycle, shown in Figure 10-10 b, transfers the contents of memory address N to the HSTDATA register. • In c, the host processor reads the HSTDATA register, fetching the data previously read from address N. • The read of HSTDATA by the host processor causes the TMS34010 to automatically increment the contents of HSTADRL and HSTADRH by 1 6, as shown in d. • The contents of the new address are read into HSTDATA, as shown in Figure 10-10 e. This data will be available in HSTDATA the next time it is read by the host processor. The process shown in c through e repeats for every word read from TMS34010 local memory. 10-12 Host Interface Bus - Reads and Writes (a) (b) (o) (d) (e) Host Processor Host Interface Local Memory Registers HSTADRH.HSTADRL 1 A 1- B N+16 <^iH8TDATA 1 1 A N Host Processor Host Interface Registers Local Memory HSTADRH.HSTADRL 1 A k- B N+16 HSTDATA 1 A *— A N Host Processor Host Interface Registers Local Memory HSTADRH.HSTADRL 1 A k- B N+16 HSTDATA 1 A 1 A N Host Processor Host Interface Registers Local Memory r d HSTADRH.HSTADRL 1 kll-IA 1 -J N+16 N | N+TO J — HSTDATA 1 A 1 A Host Processor Host Interface Registers Local Memory HSTADRH.HSTADRL i Nfie i— B N+16 HSTDATA 1 B r*-^ A N Figure 10-10. Host Indirect Read from Local Memory (INCR=1) 10-13 Host Interface Bus - Reads and Writes 1 0.3.3.2 Indirectly Writing to a Buffer Figure 10-11 illustrates the procedure for writing a block of words to TMS3401 local memory. The block begins at address N. Assume that the INCW bit is set to 1 and the LBL bit is set to 0. • In Figure 10-11 a, the host processor loads the 32-bit address N into HSTADRL and HSTADRH. • The loading of the second half of the address into HSTADRH causes the TMS34010 host interface control logic to automatically initiate a read cycle on the local bus. This read cycle, which takes place in Figure 10-1 1 b, fetches the contents of memory address N into HSTDATA. • The data loaded into this register is not used, however. Instead, the host processor writes to the HSTDATA register in Figure 10-1 1 c, overwriting its previous contents. • In response to the host's write to HSTDATA, the TMS34010 automat- ically initiates a write cycle to transfer the contents of HSTDATA to the local memory address N as shown in d. • Following the write, the TMS34010 automatically increments the ad- dress in HSTADRL and HSTADRH to point to the next word, as shown in e. At this point the host interface registers are ready for the host pro- cessor to write the next word to HSTDATA. The process shown in c through e repeats for every word written to TMS34010 local memory. 10-14 Host Interface Bus - Reads and Writes (a) (b) (o) (d) (e) Host Processor Host Interface Local Memory Registers HSTADRH.HSTAORL 1 A ^ B N+16 - sStfS nFi6TT>ATA 1 1 A N Host Processor Host Interface Registers Local Memory HSTADRH.HSTAORL 1 rfi k. B N+16 HSTDATA 1 a k— A N Host Processor Host Interface Registers Local Memory HSTADRH.HSTAORL 1 ii k~ B N+16 HSTDATA _»l C 1 A N Host Processor Host Interface Registers Local Memory HSTADRH.HSTAORL 1 A h- B N+16 HSTDATA 1 C 1 C N Host Processor Host Interface Registers Local Memory HSTADRH.HSTAORL i Niie i— B N+16 HSTDATA 1 C 1 C N Figure 10-11. Host Indirect Write to Local Memory (INCW=1) 10-15 Host Interface Bus - Reads and Writes 10.3.3.3 Combining Indirect Reads and Writes If the HSTDATA register in Figure 10-11 is read by the host processor fol- lowing step e, the value returned is the value that the host previously loaded into the register. The host must read HSTDATA a second time to access data from TMS34010 local memory. This principle is illustrated in Figure 10-12, which shows how the host interface performs when a write is followed by two reads. For this example, INCW=1 and INCR=0. • In Figure 10-12 a, HSTADRL and HSTADRH together point to location N in the TMS34010's local memory. The host processor is shown writ- ing to HSTDATA. • In b, the data buffered in HSTDATA is written to location N in memory. • The address registers are incremented in c. • In d, the host processor reads the HSTDATA register, which returns the value that the host loaded into the register in step a. • Reading HSTDATA causes a memory read cycle to take place in e, which loads the value from memory address A/+1 6 into HSTDATA. • In f, a second read of HSTDATA by the host processor returns the value from memory address /V+16. Host Processor Host Interface Local Memory Registers HSTADRH.HSTADRL i k k- B N+16 (a) HSTDATA — *\ C I A N Host Processor Host Interface Registers Local Memory HSTADRH.HSTADRL i k r- B N+16 ft>> HSTDATA I C I — — -* C N Figure 10-12. Indirect Write Followec I by Tw o Indirei Ct R( (INCW=1, INCR=0) 10-16 Host Interface Bus - Reads and Writes Host Processor Host Interface Registers Local Memory (c) 1 — s — HSTADRH.HSTADRL 1 klHA I -> N+16 N | N+TO J HSTDATA 1 C 1 c Host Processor Host Interface Registers Local Memory (d) HSTADRH HSTADRL 1 N+16 I— ► B N+16 HSTDATA 1 C I C N Host Processor Host Interface Registers Local Memory (e) HSTADRH HSTADRL I N+,16 r— > B N+16 HSTDATA I B l4— C N Host Processor Host Interface Registers Local Memory (f) HSTADRH HSTADRL I N+16 I— > B ^16 HSTDATA ■ 1 B I C M 9 Figure 10-12 . indire ct Writ< s Followed by 1 'wo Ind rect Re ads (INCW=1, INCR=0) (Concluded) 10-17 Host interface Bus - Reads and Writes 10.3.3.4 Accessing Host Data and Address Registers When the TMS34010 internal processor accesses the HSTDATA, HSTADRL, or HSTADRH register, no subsequent cycle occurs to transfer data between HSTDATA and local memory. Also, the address in HSTADRL and HSTADRH is not incremented, regardless of the state of the INCR and INCW bits. The host processor can indirectly access any register in the TMS34010's in- ternal I/O register file by first loading HSTADRL and HSTADRH with the ad- dress of the register, and they writing to or reading from HSTDATA. No hardware mechanism is provided to prevent simultaneous accesses of the HSTDATA, HSTADRL and HSTADRH registers by the host processor and by the TMS34010 internal processor. Software must be written to avoid simul- taneous accesses, which can result in invalid data being read from or written to these registers. 10.3.3.5 Downloading New Code The TMS34010 host interface provides a means of efficiently downloading new code from a host processor to TMS34010 local memory. The host initi- ates this operation through the following process: • Before downloading, the host interrupts and halts the TMS34010 by writing 1s to the HLT and NMI bits in the HSTCTL register. The host processor should then wait for a period of time equal to the TMS34010 interrupt latency. (TMS34010 hardware resets the NMI bit if the non- maskable interrupt is initiated before the halt occurs.) • The code is then downloaded using the auto-increment features of the host interface registers. • After downloading the code, the host should flush the cache as de- scribed in Section 5.4.5, Flushing the Cache (page 5-23). • The nonmaskable interrupt vector is written through the host port to lo- cation FFFFFEEOh so that the new code begins execution at the vec- tored address. • The NMI bit in the HSTCTL register should be set to 1 to initiate a non- maskable interrupt. At the same time, the NMI M bit in the HSTCTL re- gister should be set to 1 . If the host does not need the current context to be stored on the stack, or if the nonmaskable interrupt was taken in the first step, the NMIM bit should be set to 1 . Otherwise, NMIM should be set to 0. • The host restarts the TMS34010 by writing a to the HLT bit in the HSTCTL register. Setting the HLT and NMI bits to 1 simultaneously reduces the worst-case delay (compared to setting HLT only). NMI latency is the delay from the 0- to-1 transition of the NMI bit and the start of execution of the first instruction of the NMI service routine. Halt latency is the delay from the 0-to-1 transition of the HLT bit and the time at which the TMS34010 actually halts (see Sec- tion 10.3.4). The maximum NMI latency may be much less than the halt la- 10-18 Host Interface Bus - Reads and Writes tency if a PIXBLT, FILL, or LINE instruction is in progress at the time of the NMI or halt request. An NMI request interrupts instruction execution at the next interruptible point, but a halt request is ignored until the executing in- struction completes or is interrupted. When NMI and HLT are set to 1 simul- taneously, the TMS34010 halts before beginning execution of the first instruction in the NMI service routine. Therefore, the delay from the setting the NMI and HLT bits to the time that the TMS34010 actually halts is simply the NMI latency. 10.3.4 Halt Latency The TMS34010 may be halted by a host processor via the HLT bit in the HSTCTL register. The delay from the receipt of a halt request to the time that the TMS34010 actually halts is the sum of five potential sources of delay: 1 ) Halt request recognition 2) Screen -refresh cycle 3) DRAM -refresh cycle 4) Host- indirect cycle 5) Instruction completion In the best case, items 2 through 5 cause no delay. The minimum delay to due to item 1 is one machine state. • The h alt r equest recognition delay is the time required for the setting of the HLT bit to be internally synchronized after the low-to-high transi- tion of the HRDY pin. • The screen -refresh and DRAM-ref resh cycles are a potential source of delay, but in fact occur rarely and are unlikely to delay a halt. • The likelihood of a delay caused by a host-indirect cycle is small in most instances, but this depends largely on the application. It would only occur if the host had written to the data register just prior to writing to the HLT bit. The delay due to a single host-indirect cycle is two ma- chine states, assuming no wait states. • The instruction completion time refers to the time required for an in- struction that was already executing at the time the halt request was re- ceived to complete. Note that the TMS34010 halt condition is entered only on instruction boundaries. This means that a PIXBLT, FILL, or LINE instruction that is already in progress runs to completion before the TMS34010 halts. Table 10-2 shows the minimum and maximum times for each of the five op- erations listed. The halt latency is calculated as the sum of the numbers in the five rows. In the best case, the halt latency is only one machine state. The worst-case latency is six machine states plus the delays due to host- indirect cycles and instruction completion. Table 10-3 shows instruction completion times for some of the longer instructions. However, a PIXBLT, FILL, or LINE instruction may take longer than the times shown in Table 10-3, depending on the size of the pixel array or line specified. Table 10-3 also shows the in- struction completion time for a JRUC instruction that jumps to itself - the TMS34010 may be executing this instruction if the software is simply waiting for a halt. 10-19 Host Interface Bus - Reads and Writes Table 10-2. Five Sources of Halt Delay Operation Latency (In States) Min Max Halt recognition 1 2 Instruction completion See Table 10-3 D RAM-refresh cycle 2 See Note 2 Screen -refresh cycle 2 See Note 2 Host- indirect cycle See Note 1 Notes: 1) The latency due to host-indirect cycles depends on both the hardware system and the application. The delay due to a single host- indirect cycle is two machine states, assuming no wait states. 2) DRAM-refresh and screen -refresh cycle times as- sume no wait states. Table 10-3. Sample Instruction Completion Times Instruction Worst- Case Instruction Completion Time (In States) SP Aligned SP Not Aligned DIVS A0,A2 43 43 MMFM SP,ALL 72 144 MMTM SP,ALL 73 169 PIXBLT, FILL, and LINE See Note 1 See Note 1 Wait: JRUC wait 1 1 Notes: 1 ) The worst-case instruction completion time is equal to the in- struction execution time less one machine state. 2) The SP-aligned case assumes that the SP is aligned to a word boundary in memory. 10.3.5 Accommodating Host Byte-Addressing Conventions Processor architectures differ in the manner in which they assign addresses to bytes. The TMS34010 host interface logic can be programmed to accommo- date the particular byte-addressing conventions used by a host processor. This ability is important in ensuring software compatibility between 8- and 16-bit versions of the same processor, such as the 8088 and 8086 or the 68008 and 68000. The 8088 transfers a 1 6-bit word as a series of two 8-bit bytes, low byte first, high byte second. The 68008 transfers the high byte first, and low byte second. The HSTCTL register's LBL bit is used to configure the TMS34010 host in- terface to accommodate different byte- accessing methods. The host interface is configured to operate according to the following two principles: 10-20 Host Interface Bus - Reads and Writes 1 ) First, when a host processor with an 8-bit data bus reads from or writes to the HSTDATA register, it accesses the high and low bytes of the reg- ister in separate cycles. The TMS34010 does not initiate its local mem- ory access until both bytes of HSTDATA have been accessed. 2) Second, when HSTADRH and HSTADRL are loaded by the host, the TMS34010 must not initiate its read of the local memory until the com- plete pointer address has been loaded into HSTADRL and HSTADRH. When LBL=0: • A local memory read cycle is intitiated by the TMS34010 when the host processor reads the high byte of HSTDATA, or writes to the high byte of HSTADRH. • A local memory write cycle is initiated by the TMS3401 when the host processor writes to the high byte of HSTDATA. When LBL=1: • A local memory read cycle is initiated by the TMS34010 when the host processor reads the low byte of HSTDATA, or writes to the low byte of HSTADRL. • A local memory write cycle is initiated by the TMS34010 when the host processor writes to the low byte of HSTDATA. When the host processor is an 8088, for example, the TMS34010 is typically configured by setting the LBL bit of the HSTCTL register to 0. When config- ured in this manner, the TMS34010 expects the HSTADRL register to be loaded first, and HSTADRH loaded second. Furthermore, the high byte of the HSTADRH register is expected to be loaded after the low byte. When LBL is set to 0, a local read cycle is initiated when the upper byte of the HSTADRH register is written to by the host processor. This permits the lower byte of HSTADRH to be loaded first without causing side effects. 10-21 Host Interface Bus - Bandwidth 10.4 Bandwidth One measure of the performance of the host interface is its data rate, or bandwidth. The bandwidth is the number of bits per second that can be transferred through the host interface during a block transfer of data to or from TMS34010 memory. Assume that the host interface address register is pro- grammed to autoincrement. The maximum data rate through the host interface can be expected to approach the bandwidth of the TMS34010's memory. For example, assume a 50- MHz TMS34010 and a memory requiring no wait states. The memory cycle time is about 320 nanoseconds (bandwidth = 50 megabits/second). The host's access cycle time at the host interface is so- mewhat longer than this due to certain additional delays inherent in the oper- ation of the TMS34010's internal host interface logic. Also, the throughput of the host interface may depend on whether or not the TMS34010 is halted. The bandwidth is calculated as the width of the host data path (1 6 bits) times the frequency of access cycles through the host interface. Given a continuous series of word accesses, with successive accesses occurring at regular inter- vals, what is the minimum interval between host accesses that the interface can sustain without having to send not-ready signals to the host? (The TMS34010 drives its HRDY output low temporarily to inform the host when the TMS34010 is not yet ready to complete the host's current access.) First, when the TMS34010 is halted, the host interface should support con- tinuous accesses occurring at regular intervals no less than about 400 nano- seconds apart. As long as the host attempts to maintain a throughput no greater than this limit, delays due to not-ready signals occur rarely, if at all. The bandwidth for this case is calculated in Table 1 0-4 a as approximately 40 megabits per second. This value can be expected to vary slightly with sys- tem-dependent conditions such as the frequency of DRAM -refresh and screen -refresh cycles. When the TMS34010 is running, the host interface should support continuous accesses occurring at regular intervals no less than approximately 550 nano- seconds. The bandwidth for this case is calculated in Table 10-4 as approxi- mately 29 megabits per second. This value varies slightly with conditions such as the frequency of DRAM-refresh and screen -refresh cycles, and also with the characteristics of the program being executed by the TMS34010. Table 10-4. Host Interface Estimated Bandwidth Assumptions Approximate Throughput TMS34010 halted 50-MHzTMS34010 No wait states 1 6 bits/transfer 400 ns/transfer = 40 megabits/s TMS34010 running 50-MHzTMS34010 No wait states 1 6 bits/transfer 550 ns/transfer = 29 megabits/s 10-22 Host Interface Bus - Worst-Case Delay 10.5 Worst-Case Delay In some applications, designers must determine not only the effective throughput of the host interface, but also the delays that can occur under worst-case conditions. These conditions occur too rarely to affect overall throughput, but the important consideration here is not how often they occur, but that they can occur at all. First, with the TMS34010 halted, the worst delay is given by the formula (6 + 2N)T, where N is the number of wait states per TMS34010 memory cycle, and T is the local clock period (nominally 160 nanoseconds for a 50-MHz TMS34010). Second, with the TMS34010 run- ning, the worst delay is given by the formula (9 + 4/V)7\ The derivation of these formulas, summarized in Figure 10-13, may be helpful in illustrating the mechanisms of the host interface. 2f Synchronization delay (2 + N)T Screen -refresh cycle + (2 + N)T DRAM -refresh cycle (6 + 2N)T Worst-case delay (total) (a) Worst-Case Delay with TMS34010 Halted 2T Synchronization delay (1+/V)7" TMS34010 CPU read (2 + N)T TMS34010 CPU write (2 + N)T Screen-refresh cycle + (2 + N)T DRAM-refresh cycle (9 + 4/V)7" Worst-case delay (total) (b) Worst-Case Delay with TMS34010 Running N = Number of wait states per memory cycle 7" = Local clock period (nominal 160 nanoseconds for 50-MHz device) Note: These are worst-case delays and have negligible effect on performance. The case shown in a, for example, could be expected to occur less than once per thousand (0.1 percent of) host accesses in a typical system. Figure 10-13. Calculation of Worst-Case Host Interface Delay Consider case a, in which the TMS3401 is halted, first; the worst-case delay is calculated as the sum of the three delays. The first of these delays is the time required to internally synchronize the host interface cycle to the TMS34010 local clock. The host's signals are generally not synchronous to the TMS34010 local clocks. A signal from the host must therefore be passed through a synchronizer latch (part of the TMS34010 on-chip host interface logic) before being used by the TMS34010. The delay through the syn- chronizer is from one to two local clock periods (1 7" to 27"), depending on the phase of the host clock relative to the TMS34010's local clock. The second and third delays in Figure 10-13 represent the time needed to perform a screen -refresh cycle followed by a DRAM-refresh cycle. The arbitration logic internal to the TMS34010 assigns these two types of cycles higher priorities than host- requested indirect accesses. (Screen refresh has a higher priority than DRAM refresh.) Thus, a host access requested at the same time as one of these cycles must wait. The worst-case assumption is that a screen-refresh cycle is generated internal to the TMS34010 on the same clock edge at which the request for the host access arrives. Furthermore, a DRAM-refresh cycle is 10-23 Host Interface Bus - Worst-Case Delay requested during this same clock edge or during the next 1 + N clock edges. An equivalent delay occurs in the case in which a DRAM refresh and host access are requested on the same clock edge (the DRAM refresh wins), and a screen refresh is requested on a later clock edge before the host access can begin. This case is not shown in Figure 10-13, but the delay in this instance is also (6 + 2N)T. In a typical system, DRAM-refresh cycles consume about 2 percent of the available memory bandwidth, and screen -refresh cycles take about 1.5 percent (using VRAMs). The probability of either sequence of events is therefore very small (less than one in a thousand, assuming N = 0; that is, no wait states), and the performance degradation due to these unlikely events is negligible. Now consider the case in which the TMS3401 is running. Host accesses are of higher priority than TMS34010 instruction fetches and data accesses, but still of lower priority than DRAM-refresh or screen -refresh cycles. The worst- case delay is calculated as the sum of the five delays indicated in Figure 1 0-1 3 b. This assumes that the TMS34010 begins a read-modify-write operation on a memory word (this is performed as a read cycle followed by a separate write cycle) just one clock before the TMS34010 receives the host access re- quest. The TMS34010 CPU read cycle is actually (2 + N)T in duration, but since it begins one clock before the host access is requested, only (1 + N)T is left in the cycle. The TMS34010's local memory controller treats a read- modify-write operation as indivisible; once the read has started, no other re- quest can be granted until the write completes. The write cycle is (2 + N)T in duration. Again, assume that sometime before the write cycle does com- plete, screen -refresh and DRAM-refresh cycles are also requested. The prob- ability of this case is somewhat more difficult to calculate than that of Figure 10-13 a, since the frequency of read-modify-write operations is very program dependent. This sequence of events rarely occurs, however. 10-24 Section 1 1 Local Memory Interface The TMS34010 local memory interface consists of a triple-multiplexed address/data bus and associated control signals. Several types of memory cycles, including read, write, screen -refresh, and DRAM -refresh cycles are supported. During a memory cycle, the row address, column address, and data are transmitted over the same physical bus lines. The row and column ad- dresses necessary to address DRAMs and VRAMs are available directly at the address/ data pins, eliminating the need for external multiplexing hardware. The TMS34010 interfaces directly to DRAMs (such as the TMS4256 and TMS4C1024) and VRAMs (such as the TMS4461), and can be prog ramm ed to p erform DRAM -refresh cycles at regular intervals. CAS-before-RAS or RAS-only refresh cycles may be selected. The TMS34010 can also be pro- grammed to perform screen refresh by scheduling VRAM register-transfer cy- cles to occur at regular intervals. The local memory interface provides a hold/hold acknowledge capability that allows external devices to request control of the bus. After acknowledging a hold request, the TMS34010 releases the bus by driving its address/data bus and control outputs into high impedance. Section Page 11.1 Local Memory Interface Pins 11-2 11.2 Local Memory Interface Registers 11-3 11.3 Memory Bus Request Priorities 11-4 11.4 Local Memory Interface Timing 11-5 11.5 Addressing Mechanisms 11-23 11-1 Local Memory Interface Bus - Local Memory Interface Pins 11.1 Local Memory Interface Pins Section 2 describes TMS34010 pin functions in detail summarizes the local memory interface pins. This section briefly LAD0-LAD15 These pins form the local multiplexed address/data bus. DEN DDOUT LAL RAS CAS W TR/QE LRDY INCLK LCLK1, LCLK2 LINT 1, LINT2 The local data enable signal is driven active low to allow data to be written to or read from LAD0-LAD1 5. (Connects to the G pins of a pair of optional '245-type octal bus transceivers.) The local data direction out signal is driven high to enable data to be output on LAD0-LAD1 5. It is driven low to enable data to be input on LAD0-LAD15. (Connects to the DIR pins of a pair of optional '245-type octal bus transceivers.) The high-to-low transition of the local address latched signal is used by an external '373-type latch to capture the column address from LAD0-LAD1 5. The local row address strobe signal drives the RAS inputs of DRAMs and VRAMs. The local column address strobe signal drives the CAS inputs of DRAMs and VRAMs. The local write strobe signal drives the W inputs of DRAMs and VRAMs. The local j^gister transfer/output enable signal connects to the TR/QE (or DT/OE) pins of a VRAM. The local ready signal is driven low by external circuitry to inhibit the TMS34010 from completing a local memory cycle. TMS34010 processor functions are synchronous to this input clock signal. (Video timing is controlled by VCLK.) These output clocks are available to the board designer for syn- chronous control of external circuitry. Interrupt requests are transmitted to the TMS34010 on these pins. 11-2 Local Memory Interface Bus - Local Memory Interface Registers 11.2 Local Memory Interface Registers The local memory interface registers are summarized below. These registers are a subset of the I/O registers which are detailed in Section 6. • The memory CONTROL register contains several programmable param- eters that provide control of the local memory interface: RM (DRAM refresh mode, bit 2): Selects RAS-only or CAS-before-RAS refresh cycles. - RR (DRAM refresh rate, bits 3 and 4): Controls the frequency of DRAM refresh cycles. T (transparency enable, bit 5): Enables or disables the pixel attri- bute of transparency. - W (window violation detection mode, bits 6 and 7): Selects the course of action the TMS34010 follows when it detects a window violation. PBH (PIXBLT horizontal direction, bit 8): Determines the hori- zontal direction (increasing X or decreasing X) for pixel operations. PBV (PIXBLT vertical direction, bit 9): Determines the vertical di- rection (increasing Y or decreasing Y) for pixel operations. - PPOP (pixel processing operation select, bits 10-14): Selects among several Boolean and arithmetic pixel processing options. - CD (instruction cache disable, bit 15): Enables or disables the in- struction cache. • The CONVDP register contains the destination pitch conversion factor that is used during XY-to-linear conversion of a destination pixel ad- dress. • The CONVSP register contains the source pitch conversion factor that is used during XY-to-linear conversion of a source pixel address. • The PMASK (plane mask) register selectively disables or enables vari- ous planes in a multiple-bit-per-pixel bit map display. • The PSIZE (pixel size) register specifies the number of bits per pixel. • The REFCNT (refresh count) register generates the addresses output during DRAM-refresh cycles and counts the intervals between succes- sive DRAM -refresh cycles. 11-3 Local Memory Interface Bus - Memory Bus Request Priorities 11.3 Memory Bus Request Priorities The TMS3401 0's local memory interface controller assigns priorities to re- quests from various sources, both on and off chip, for local memory cycles. Table 11-1 lists these priorities (priority 1 is highest). Table 11-1. Priorities for Memory Cycle Requests Priority Memory Cycle Requested 1 Hold request from external bus master device 2 Screen -refresh cycle 3 DRAM-refresh cycle 4 Host-initiated indirect read or write cycle 5 TMS34010 CPU memory cycle A TMS34010 CPU memory cycle is a read or write performed by the TMS34010's on-chip 32-bit processor. Insertion of a field (or a portion of a field spanning multiple words) into a word requires two CPU memory cycles when the field does not begin and end on word boundaries. The two cycles are a read followed by a write. This sequence is called a read-modify-write operation. The read and write are performed as separate memory cycles, but are treated as indivisible; that is, the memory controller does not permit another memory request to be serviced between the read and its accompanying write. The only exception to this statement is the hold request. If a read-modify- write is interrupted by a hold, the entire read-modify-write operation is re- started after the hold is released. While a read-modify-write operation on an individual memory word is indi- visible, the accesses necessary to extract or insert a field spanning multiple memory words are not. For example, if a field spans portions of two memory words, a higher priority access such as a host-indirect cycle can occur be- tween the two read-modify-write operations required to insert the field. The hold request has the highest priority. An external device requests control of the bus by signalling a hold request to the TMS3401 0. The external device may perform multiple memory cycles following acknowledgment from the TMS34010. However, the device should not control the bus for so long that necessary screen -refresh and DRAM-refresh cycles are prevented from occur- ring. Indirect accesses initiated by a host processor are blocked as long as the external device continues to control the bus. If the host processor attempts to initiate another indirect access during this time, the host is forced to wait at the host interface (the TMS34010 sends it a not-ready signal) until the external device releases the local bus. A memory cycle already in progress is always permitted to complete, even if a higher priority request is received while the cycle is still in progress. 11-4 Local Memory Interface Bus - Local Memory Interface Timing 11.4 Local Memory Interface Timing The TMS34010 memory interface contains a triple-multiplexed address/data bus on which row addresses, column addresses and data are transmitted. Figure 1 1 -1 illustrates multiplexing of addresses and data. (L6B) 16-Bit Data Word T Bit 15 (MSB) r Bit (LSB) RF = DRAM-Refresh bus status bit IAQ = Instruction acquisition bus status bit TR - VRAM Shift-Register-Transfer bus status bit Figure 11-1. Triple Multiplexing of Addresses and Data The TMS34010 LAD pins directly provide the multiplexed row and column addresses needed to drive dynamic RAMs (like the TMS4256) and video RAMs (such as the TMS4461). Any eight adjacent pins in the range LAD0-LAD10 provide 16 contiguous logical address bits; the eight MSBs are output as part of the row address, and the eight LSBs are output as part of the column address. For example, Figure 11-1 shows that logical address bits 5-20 are output at LAD1-LAD8. The control signals output to memory support direct interfacing to DRAMs and VRAMs. At the beginning of a memory cycle, the address is output in multiplexed fashion as a row address followed by a column address. The re- mainder of the cycle is used to transfer data between the TMS34010 and memory. Figure 11-2 (page 1 1 -6) illustrates general timing (the local address/data pins are identified as the LAD Bus) 11-5 Local Memory Interface Bus - Local Memory Interface Timing — \ r ^ r RA8 CA6 Figure 11-2. Row and Column Address Phases of Memory Cycle Figure 11-3 through Figure 11-8 show functional timing of the local memory interface. Several timing features are common to the memory read and write cycles in Figure 11-3 and Figure 1 1 -4, and to the register-transfer cycles in Figure 11-6 and Figure 11-7. A row address is outp ut on LAD0-LAD1 5 at the start of the cycle, and is valid before and after RAS falls. A column address is then output on LAD0-L AD1 5. The column address is valid briefly befor e and after the falling edge of LAL, but is not valid at the falling edge of CAS. The column address is clocked into an extern al tra nsparent latch (such as a 74AS373 octal latch) on the falling edge of LAL to provide the hold time on the column address required for DRAMs and VRAMs. A transparent latch is required so that the row address is available at the outputs of the latch during the start of the cycle. 11-6 Local Memory Interface Bus - Local Memory Interface Timing 11.4.1 Local Memory Write Cycle Timing Figure 11-3 illustrates a memory write cycle. Data are output on LAD0-LAD15 following the latching of the column address. DEN goes active low at the same time the data become valid, and remains low as long as the data rem ain v alid. In a large system that requires buffering of the data bus to memory, DEN is typically used as the enable signal to an external bidirectional buffer (such as a 74AS245 octal buffer). DDOUT is used as the direction control signal to the buf fer. The write strobe, W, goes active low after the data have become valid and CAS is low. This is interpreted as a "late write" cycle by the DRAMs and VRAMs, which are prevented by the inactive-high TR/QE signal from enabling their read drivers. Because the data are valid on both sides of the W write strobe, extemal_devices can latch the data on either the high-to-low or low-to-high edge of W. LRDY Figure 11-3. Local Bus Write Cycle Timing 11-7 Local Memory Interface Bus - Local Memory Interface Timing 11.4.2 Local Memory Read Cycle Timing Figure 11-4 illustrates a memory read cycle. LAD0-LAD1 5 ar e forced to high impedance followin g the latching of the column address. DEN and TR/QE both go active low after CAS becomes low in order to enable read data from the memory t o the LAD pins. TR/QE enables the output drivers of the DRAMs and VRAMs. DEN enables the external bidirectional buffers needed with memories so large that external buffering (using a device such as a 74AS245 octal buf- fer) of the data bus is required. The DDOUT signal serves as the direction control for the external bid irect ional buffers, and is low well in advance of the high-to-low tran sition of DEN, and remains low well after the low-to-high transition of DEN. The data that is read from memory must be valid during the middle of the Q4 clock phase , as indicated in Figure 1 1 -4. The low-to-high transitions of TR/QE and DEN occur well in advance of the time at which the LAD drivers turn on to output the row address of the next cycle. This prevents bus conflicts. I a, I Q2 1 Q3 K 1 Q4 1 Q1 I Q2 lo K i \ Q4 1 Q1 I i / 1 LCLK1 \/ f 1 — i-HI-Z- | | L ' I i LCLK2 1 Ki y i j i Y Data Vi I ! i LAD0-LAD15 . Row i I |\ RSS I V\ I 1 I i L i 1 i / i xm\~t 1 I |\l i 1 CSS | I i ' i V i I I w ' 1 1 (High i ] i i 1 i TR/OE I | V\ i I 1 ! ' 1 DEfJ ■/ I i I i h 1 r , ODOUT / I j \ I ! I y i : i Figure 11-4. Local Bus Read Cycle Timing 11-8 Local Memory Interface Bus - Local Memory Interface Timing 11.4.3 Local Register-to-Memory Cycle Timing A register-to-memory cycle is a special type of cycle used in systems with VRAMs. The cycle transfers the contents of the VRAM's internal serial-data register to a selected row of its internal memory array. The cycle typically af- fects all VRAMs in the system. _During the register-to-me mory cycle shown in Figure 1 1 -5, both TR/QE and W are low during the fall of RAS. VRAMs re- cognize this timing as the beginning of a register-to-memory cycle. Conven- tional DRAMs may need to be de-selected (by withholding the row or column address strobe, for example) to prevent them from interpreting the cycle as a conventional read cycle. Alternately, the output enable signal requ ired by a DRAM such as the TMS4464 can be synthesized by connecting DEN and DDO UT to the inputs of a two-input OR gate. (In fact, any pair of the signals DEN, DDOUT, and TR/QE will work.) The low-to-high transition of TR/QE occurs after the fall of CAS but prior to the rising edge of RAS. This timing provides compatibility with a variety of VRAMs. The TMS34010 performs a register-to-memory cycle when writing to a pixel while the DPYCTL register's SRT bit is set to 1 . For example, the instruction pixt ao,*ai writes the pixel in AO to the address pointed to by A1. The PSIZE register should contain the value 16 so that the write cycle is not pre- ceded by a read cycle. When SRT is set to 1, this write is converted to the register-to-memory cycle shown in Figure 11 -5. The row address is selected from bits 12-26 of A1, which are output on LAD0-LAD14 during the cycle. LCLK1 LCLK2 LAD0-LAD15 TR/QE DDOUT LRDY Figure 11-5. Local Bus Register-to-Memory Cycle Timing 11-9 Local Memory Interface Bus - Local Memory Interface Timing 11.4.4 Local Memory-to- Register Cycle Timing A memory-to-register cycle is a special type of cycle used in systems with VRAMs. The cycle transfers the contents of a selected row of a video RAM's memory array to its internal shift register. VRAM memory-to-register cycles are primarily used to refresh the screen of a CRT monitor. The cycles referred to elsewhere in this document as screen- refresh cycles are in fact memory-to-register cycles. The TMS34010 also performs a memory-to-register cycle when reading a pixel (for example, by executing a pixt *ao,ai instruction) while the SRT bit of the DPYCTL reg- ister is set to 1 . During the mem ory-t o-register cycle shown in Figure 1 1 -6, TR/QE is low during the fall of RAS, but W remains high. VRAMs recognize this timing as the beginning of a memory-to-register cycle, and their data outputs remain in high impedance. Conventional DRAMs may need to be de-selected to prevent them from interpreting the cycle as a memory read cycle. Alternately, the output enable signal re quire d by a DRAM such as the TMS4464 can be syn- thesized by connecting DEN and_ DDOUT to the inputs of a two -input OR gate. The low-to-hig h tran sition of TR/QE occurs after the fall of CAS but prior to the rising edge of RAS. This timing provides compatibility with a variety of VRAMs. I Q1 I 02 ! 1 Q3 1 04 | Q1 | 02 1 Q3 1 04 1 01 I | LCLK1 J j !\ I i 1/ / i i j r !\i i i i r "Ni ! LCLK2 [ •/" i i i i !/ I I i : i LAD0-LAD15 )f" Row i Xco, i x Undefined ,x I ' 1 > : i RAS J !\ i/i ! i : i , I i lal/ I i i ! M ! i V f I I i • i CA6 I j i i ! ' \ i \J\ ' I i r i I ! I W I j ( TR/QE | \_ High) 1 1 | i : i i - i JT i i i i : i i : i I ! i 1 « I 1 \ i i i i i i i i i i i i i:i i i i ; i i """i 1 i i i i | i ill i i i i i : i i i i : i i LRDY Figure 11-6. Local Bus Memory-to- Register Cycle Timing 11-10 Local Memory Interface Bus - Local Memory Interface Timing 11.4.5 Local Memory RAS-Only DRAM Refresh Cycle Timing During the RAS-only DRAM refresh cycle shown in Figure 1 1 -7, RAS and LAL are the only active control signals. All other signals, including CAS, W, and TR/QE, remain inactive high through the cycle. The row address, output on the LAD pins during the high-to-low transition of RAS, is generated by the REFCNT (DRAM -refresh counter) register. LRDY Figure 11-7. Local Bus RAS-Only DRAM -Refresh Cycle Timing 11-11 Local Memory Interface Bus - Local Memory Interface Timing 11.4.6 Local Memory CAS-before-RAS DRAM Refresh Cycle Timing During the CAS- befo re-RAS DRAM-refresh cycle shown in Figure 11 -8, CAS goes low before RAS goes low. Certain types of DRAMs (like the TMS4256 and TMS4C1024) and VRAMs (such as the TMS4461 ) recognize this as the beginning of a DRAM-refresh cycle in which the address of the row to be re- freshed is generated by a counter on the RAM chip itself, rather than by an external device such as the TMS34010. The row address output by the TMS34010 during the cycle is the s ame as would be output if the TMS34010 were confi gured to perform a RAS-only refresh cycle rather than a CAS-before-RAS cycle. The address bits output on LAD0-LAD15 remain sta- ble from the start of the row address time (start of Q2) to the end of the col- umn address time (end of Q4). LAD15, on which the RF bus status bit is output, is low duri ng the row ad dres s times. In contrast to other types of cy- cles in wh ich R AS goes low, the LAL outp ut goes low at t he st art of Q3, after the fall of CAS and before the fall of RAS. The timing of LAL is designed to support the use of decode circuitry whi ch latches the state of selected addr ess/data pins during the fall of LAL, and whi ch recognizes a CAS-b efor e-RAS cycle by detecting a high level at the RAS output during the fall of LAL. LAD0-LAD15 Figure 11-8. Local Bus CAS-before-RAS DRAM -Refresh Cycle Timing 11-12 Local Memory Interface Bus - Local Memory Interface Timing 11.4.7 Local Memory Internal Cycles When the TMS34010 is not performing one of the memory operations shown in Figure 1 1 -3 through Figure 1 1 -8, its memory interface control signals re- main inactive, as shown in Figure 1 1 -9. This is called an internal cycle. Figure 11-9 shows two sequential internal cycles. During internal cycles, the LRDY input is ignored. I Q1 I Q2 I 0.3 I 04 I 0.1 i Q2 I 03 I 04 I 01 I I 1 ! 1 1 1 1 LCLK1 ]i \ ,\ , Y !V JJ i I''' 1 ! ^ i LCLK2 I [/ | j\ i j/ i iv ! I/ - ! I I I ' 1 1 1 1 III 1 LAD0-LAD15 X Undefined X I'll II!! RAS | j (High) j ! ! ! 1 1 II ""Mil 1 i ! ! i i i i CAS J | (High) [""" I'll i i ! ! 1 i ■ i i i W I j (High) I 'III ii ii TR/QE | J (High) j ! ' I I ii ii!! DEN j / j j I'll ii 1 ' DDOUT ! / j j I I I I 1 i ii LRDY Figure 11-9. Local Bus Internal Cycles Back to Back 11.4.8 I/O Register Access Cycles A special memory read or write cycle is performed when the TMS 34010 ad- dresses an on-c hip I/ O register. During this cycle, the external RAS signal falls, but the external CAS remains inactive high for the duration of the cycle. I/O register locations begin at address COOOOOOOh, and all 32 bits of the I/O reg- ister address are decoded internally. The two MSBs of the 32-bit logical ad- dress are not output at the LAD0-LAD1 5 pins. Figure 11-10 shows an I/O register read cycle and Figure 11-11 shows an I/O register write cycle. These cycles occur when one of the TMS3401 0's on-chip I/O registers is accessed by the on-chip processor or by the host processor via a host- indirect access. An address in the range COOOOOOOh to C00001 FFh is interpreted as an I/O register access by on-chip decode logic, and the read or write cycle is modified as shown in Figure 11-10 or Figure 11-11. The two 11-13 Local Memory Interface Bus - Local Memory Interface Timing MSBs of the internal address (bits 30 and 31) are available internally and are included in the internal decoding operation. An I/O register read or write cycle is always two clock periods in duration, and LR DY is ign ored . The only control out puts that are active low during the cycle are RAS and LAL. The CAS, W, TR/QE, DEN and DDOUT outputs all remain in- active high. The row and column addresses output at the LAD0-LAD1 5 pins are all 0s. All three bus status bits are inactive (RF is high, IAQ is low, and TR is high). During the read cycle shown in Figure 11-10, the LAD0-LAD1 5 pins are driven to high impedance during the data phase of the cycle. During the write cycle shown in Figure 11-11, the LAD0-LAD15 pins contain the valid data being written to the I/O register. i Q1 I Q2 I Q3 I Q4 I Q1 | Q2 i Q3 i Q4 i Q1 j 1 | , ' ■ ' i ■ ' i LCLK1 / i i\ j K v ! ! V \ I I I I ! ! : ! I LCLK2I [/ | |\ ! j/ \! j i/ LAD0-LAD15 )^ Row Vcol.) 1 — Hl-Z — i — | — | ( I'll ras! !\ i ! ! ! i/i ! ! ! i i °*M \| ! ! ! j !/ ! i ! I i CAS] | (High) J I'll Wl | (High) I ill! TR/QE | | (High) I i I | | DEN j f j j I I I I j i | i DDOUT | / | | I I I I 1 j j [ i j j LRDY Figure 11-10. I/O Register Read Cycle Timing 11-14 Local Memory Interface Bus - Local Memory Interface Timing | Q1 j 02 j 03 j 04 j 01 | 02 j 03 i 9* i Q1 j LCLK1 1 ' \ ! j / I I I , I ! / i i i\i ! I r i ml I I LCLK2 i i / Ivi ! !/~ i * i III 1 LAD0-LAD15 X Row X™-X Data X i r 1 I I i : i ; RA8 i i i i, i |\ -Y\ ! 1 I I I t ! 1 1 LAL i i 1 1 ! N| !il/l I CAS i i i i i i (High) i | I I j W i i i i (High) 1 I I TR/Ql i i i i (High) i I I DEN \-/ 1 I I I l DDOUT i / i i 1 1 I I LRDY Figure 11-11. I/O Register Write Cycle Timing 11.4.9 Read-Modify-Write Operations The TMS34010's read-modify-write operation, which consists of separate read and write cycles, is not the same as the read-modify-write cycle specified for some DRAMs. As explained in Section 5, when inserting a field into me- mory that is not aligned to 16-bit word boundaries, the TMS34010 memory interface logic may be required to perform read-modify-write (RMW) oper- ations on one or more words in memory. A RMW operation consists of the following sequence of steps: 1 ) A word is read from memory. 2) The portion of that word corresponding to the field being inserted is loaded with the new value. 3) The modified word is written back to memory. The read cycle is as shown in Figure 11-4 (page 1 1 -8), and the write cycle is as shown in Figure 11-3 (page 1 1 -7). A local bus request (HOLD low) may cause the TMS34010 to release the bus after the read cycle of a RMW operation has completed, but before the ac- companying write cycle has begun. When the TMS3401 later regains control of the bus, it performs both the read and the write cycles of the RMW opera- tion. The RMW operation is performed only when it is the highest priority bus operation pending. Any pending screen -refresh, DRAM-refresh, or host- indirect cycle has higher priority, and is performed first. 11-15 Local Memory Interface Bus - Local Memory Interface Timing 11.4.10 Local Memory Wait States The timing shown in Figure 1 1 -3 through Figure 1 1 -8 assumes that the LRDY input remains high during the cycle. The LRDY pin is pulled low by slower memories requiring a longer cycle time. The TMS34010 samples the LRDY input at the end of Q1, as indicated in the figures. If LRDY is low, the TMS34010 inserts an additional state, called a wait state, into the cycle. Wait states continue to be inserted until LRDY is sampled at a high level. The cycle then completes in the manner indicated in Figure 11-3 through Figure 11-8. The LRDY input is ignored by the TMS34010 during internal cycles, as indi- cated in Figure 1 1 -9. Figure 11-12 shows an example of a read cycle extended by one wait state. The first time LRDY signal is sampled, a low level is detected by the TMS34010, causing the cycle to be delayed by a wait state. When LRDY is sampled again one local clock period later, a h igh l evel i s det ected, p ermi tting the cycle to complete. The time during which RAS, CAS, LAL, TR/QE, DEN, and DDOUT remain low is extended by one state (one local bus clock period). HSS CSS TR/QE BER Q1 I Q2 | Q3 J\ kn -VI — r*-T^ i i Q4 | Q1 1 1 1 1 1 1 I Q2 | Q3 1 Q4 | Q1 Q2 / 1r» Q3 I Q4 | Q1 | Q2 I | TV] I I I I I I I I I I I I f II 1 1 I iV y h !! i i j j |\ ! ! ! ! iii i y\ ! WVT i i I I l I I I I I I I I I | i i I iii i iiV i i i i ^/\\ ! i i i i i i i i iii i iii i i i i i | | j (High) Mil ill i iii i i i i i i i i i Aj/\ i I I I I \ i I I I \ I III 1 A i i i i i i i Ay\ i I I I I I I I I I I I I II 11 iii i A i \\\ y i i 1 1 1 1 iii r iii i yyywywww' $$& \M§0 wf;™ Figure 11-12. Local Bus Read Cycle with One Wait State 11-16 Local Memory Interface Bus - Local Memory Interface Timing Figure 11-13 is an example of a write cycle extended by one wait state. The first time LRDY signal is sampled, a low level is detected by the TMS34010, causing the cycle to be delayed by a wait state. When LRDY is sampled again one local clock period later, a high leve l is detect ed, per mittin g the cycle to complete. The time during which RAS, CAS, LAL, W and DEN remain low is extended by one state. LCLK2 I TR/SE 4 Q2 I Q3 | Q4 \. K V 4_L }Q ! ! I ■ I K ! ! 4- I I LI i i 7 & \ K 02 I Q3 | Q4 K. K K K Figure 11-13. Local Bus Write Cycle w A A X Y th One Wait State Figure 11-14 is an example of a register-to-memory cycle extended by one wait state. The first time the LRDY signal is sampled, a low level is detected by the TMS34010, causing the cycle to be delayed by a wait state. When LRDY is sampled again one local clock period later, a hig h level is detec ted, permitting the cycle to complete. The time during which RAS, CAS, and LAL remain low is extended by one state. The W and TR/QE low times are not ex- tended, however. Similarly, during a memory-to-register cycle, TR/QE is not extended. 11-17 Local Memory Interface Bus - Local Memory Interface Timing LAD0-LAD15 TB/QE < Q1 | Q2 \ v Q3 ; Q4 | Q1 ; Q2 | Q3 Q4 \ Q1 ] Q2 j Q3 | Q4 | Q1 /H~N-U^ Q2 r -^A low Ycol.Y Undefined X \ \ | ! \i i | 1 i i i i i i Src (N • V • Z) + ( N • V • Z) 0111 GE XGT Dst > Src (N • V) + (N • V) 0101 EQ(Z) - Dst = Src Z 1010 NE (NZ) - Dst * Src z 1011 Compare to Z YZ Result = zero z 0101 Zero NZ YNZ Result & zero z 1011 P - Result is positive N • Z 0001 N xz Result is negative N 1110 NN XNZ Result is nonnegative N 1111 General Z YZ Result is zero Z 1010 Arithmetic NZ YNZ Result is nonzero Z 1011 C YN Carry set on result c 1000 NC YNN No carry on result c 1001 B(C) - Borrow set on result c 1000 NB (NC) - No borrow on result c 1001 vt XN Overflow on result V 1100 NVt XNN No overflow on result V 1101 Note: A mnemonic code in parentheses is an alternate code for the preceding code. t Also used for window clipping + Logical OR j. Logical AND Logical NOT 12-31 Instruction Set - Shift Instructions 12.8 Shift Instructions The TMS3410 supports several instructions that left-rotate, left-shift, or right-shift the contents of the destination register. These instructions use re- gister-direct operands or a combination of register-direct and immediate op- erands; the shift amount is specified by the value of a 5-bit constant or by the value specified in the 5 LSBs of a source register. (Note that the SRA Rs, Rd and SRL Rs, Rd use the 2s complement value of the 5 LSBs in Rs.) • The RL instruction left-rotates the contents of the destination register by. (This rotation is a barrel shift.) The bits shifted out of the MSB are shifted into the LSB. The C (carry) bit is set to the final value shifted out of the MSB. • The SLA instruction left shifts the contents of the destination register. Os are shifted into the LSBs. The MSBs are shifted out through the C (carry) bit so that the C bit is set to the final value shifted out of the MSB. If either the N (sign) bit or any of the bits shifted out differ from the original sign bit, the V (overflow) bit is set. • The SLL instruction left shifts the contents of the destination register. Os are shifted into the LSBs. The MSBs are shifted out through the C (carry) bit so that the C bit is set to the final value shifted out of the MSB. The main difference between SLL and SLA is that SLL does not check to see if the sign bit changes. • The SRA instruction right shifts the contents of the destination register. The value of the sign bit is shifted into the MSBs; this sign-extends the value and preserves the original value of the sign bit. The LSBs are shifted out through the C (carry) bit so that the C bit is set to the final value shifted out of the LSB. • The SRL instruction right shifts the contents of the destination register. Os are shifted into the MSBs, beginning with bit 31. The LSBs are shifted out through the C (carry) bit so that the C bit is set to the final value shifted out of the LSB. The main difference between SRL and SRA is that SRL does not preserve the original value of the sign bit. 12-32 Instruction Set - XY Instructions 12.9 XY Instructions The TMS34010 allows you to use XY addresses. This is useful for specifying pixel addresses on the screen. Many of the graphics instructions use XY ad- dressing; the TMS34010 instruction set also supports several other in- structions that allow you to manipulate XY addresses. An XY address is a 32-bit address that is divided into two parts. The 16 LSBs of the address are the X half of the address or register; the 16 MSBs of the address are the Y half of the address or register. The two parts are treated as completely separate values; for example, using the ADDXY instruction, the X half does not propagate into the Y half. Table 12-9 summarizes the instructions that use XY addresses. Table 12-9. Summary of XY Instructions Instruction Description Instruction Description ADDXY Rs, Rd Add registers in XY PIXBLT B, XY Pixel block transfer (binary to XY) CPW Rs. Rd Compare point to window PIXBLT L, XY Pixel block transfer (linear to XY) CMPXY Rs, Rd Compare registers in XY mode PIXBLT XY, L Pixel block transfer (XY to linear) CVXYL Rs, Rd Convert XY address to linear address PIXBLT XY, XY Pixel block transfer (XY toXY) DRAV Rs, Rd Draw and advance PIXT Rs, *Rd.XY Pixel transfer (register to indirect XY) FILL XY Fill array with processed pixels PIXT *Rs.XY,Rd Pixel transfer (indirect XY to register) LINE [0, 1] Line draw with XY addressing PIXT *Rs.XY, *Rd.XY Pixel transfer (indirect XY to indirect XY) MOVX Rs, Rd Move X half of Rs to X half of Rd SUBXY Rs, Rd Subtract registers in XY mode MOVY Rs, Rd Move Y half of Rs to Y half of Rd The PIXBLT and FILL instructions in Table 12-9 use XY source and/or destination addresses. The PIXT instructions in Table 12-9 use the contents of registers as XY addresses. The LINE instruction draws a line along points that are calculated as XY addresses. The move instructions in Table 12-9 (MOVX and MOVY) move the X or Y half of a source register into the X or Y half of a destination register. The arithmetic and logical instructions in Table 12-9 (ADDXY, SUBXY, and CMPXY) add, subtract, or compare the X and Y halves of the regis- ters separately. 12-33 Instruction Set - Alphabetical Reference 12.10 Alphabetical Reference of Instructions The remainder of this section is an alphabetical reference of the TMS34010 assembly language instructions. Each instruction discussion begins on a new page, and contains the following information: • Syntax: Shows you how to enter an instruction. (Section 12.1, page 12-2, describes the symbols used in instruction syntaxes.) • Execution: Illustrates the effects of instruction execution on CPU reg- isters and memory. • Instruction Words: Shows the object code generated by an in- struction. • Description: Discusses the purpose of the instruction and any other general information related to the instruction. • Machine States: Lists the instruction cycle timing. Two timings are listed for each instruction; the first number is the cache-enabled case, the second number is the cache-disabled case. • Status Bits: Lists the effects of instruction execution on the status bits (N, C, Z, and V). • Examples: Show the effects of the instruction on memory and registers using various sets of data and initial conditions. Several instructions discuss additional topics; for example, the conditional jump instructions list the conditions codes and mnemonics for various jumps, and the graphics instructions list the implied operands that they use. 12-34 Store Absolute Value ABS Syntax Execution Instruction Words Description Machine States Status Bits Examples ABS Rd |Rd| -+ Rd 15 14 13 12 11 10 9 8 1 1 1 1 R Rd ABS stores the absolute value of the contents of the destination register back into the destination register. This is accomplished by: • Subtracting the contents of the destination register data from and • Storing the result back into Rd if status bit N indicates that the result is positive. If the result of the subtraction is negative, then the original contents of the destination register are retained. 1,4 N Set to the sign of the result of - Rd; typically, N=0 if the original contents of Rd are negative (unless Rd = 80000000h), 7 otherwise C Unaffected Z 7 if the original data is 0, otherwise V 7 if there is an overflow, otherwise; an overflow occurs if Rd contains 80000000h (80000000h is returned) Code ABS Al ABS Al ABS Al ABS Al ABS Al ABS Al ABS Al Before A1 7FFFFFFFh FFFFFFFFh 80000000h 80000001 h 00000001 h OOOOOOOOh FFFA001 1 h After NCZV 1x00 0x00 1x01 0x00 1x00 0x10 0x00 Al 7FFFFFFFh 00000001 h 80000000h 7FFFFFFFh 00000001 h OOOOOOOOh 0005FFEFh 12-35 ADD Add Registers Syntax Execution Instruction Words Description Machine States Status Bits ADD Rs.Rd Rs + Rd ->■ Rd 15 14 13 12 11 10 9 8 1 1 Rs R Rd ADD adds the contents of the source register to the contents of the desti- nation register, and stores the result in the destination register. You can is the ADD instruction with the AD DC instruction to perform multiple-precision arithmetic. Rs and Rd must be in the same register file. 1,4 N /if the result is negative, otherwise C 7 if there is a carry, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Examples Code Before After Al A0 NCZV A0 ADD Al r A0 FFFFFFFFh FFFFFFFFh 1100 FFFFFFFEh ADD Al ,A0 FFFFFFFFh 00000001 h 0110 OOOOOOOOh ADD Al P A0 FFFFFFFFh 00000002 h 0100 00000001 h ADD Al ,A0 FFFFFFFFh 80000000h 0101 7FFFFFFFh ADD Al ,A0 FFFFFFFFh 80000001 h 1100 80000000h ADD Al f A0 7FFFFFFFh 80000001 h 0110 OOOOOOOOh ADD Al ,A0 7FFFFFFFh 80000000h 1000 FFFFFFFFh ADD Al ,A0 7FFFFFFFh 00000001 h 1001 80000000h ADD Al ,A0 00000002h 00000002h 0000 00000004h 12-36 Add Register with Carry ADDC Syntax Execution Instruction Words Description Machine States Status Bits Examples ADDC Rs.Rd Rs + Rd + C -► Rd 15 14 13 12 11 10 9 8 1 1 1 Rs R Rd ADDC adds the contents of the source register, the carry bit, and the con- tents of the destination register, and then stores the result in the destination register. Note that the status bits are set on the final result. Rs and Rd must be in the same register file. 1,4 N 7 if the result is negative, otherwise C /if there is a carry, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Code Before After C Al A0 IMCZV AO ADDC Al ,A0 FFFFFFFFh FFFFFFFFh 1 100 FFFFFFFFh ADDC Al r A0 FFFFFFFFh 00000001 h 0100 00000001 h ADDC Al ,A0 FFFFFFFFh 00000002h 0100 00000002h ADDC Al ,A0 FFFFFFFFh 80000000h 1 100 80000000h ADDC Al ,A0 FFFFFFFFh 80000001 h 1 100 80000001 h ADDC Al ,A0 FFFFFFFFh 80000001 h 0100 80000001 h ADDC Al f A0 FFFFFFFFh 80000000h 0110 OOOOOOOOh ADDC Al ,A0 7FFFFFFFh 00000001 h 1001 80000001 h ADDC Al ,A0 00000002 h 00000002h 0000 00000005h ADDC Al ,A0 FFFFFFFFh FFFFFFFFh 1 100 FFFFFFFEh ADDC Al ,A0 FFFFFFFFh 00000001 h 0110 OOOOOOOOh ADDC Al A0 FFFFFFFFh 00000002h 0100 00000001 h ADDC Al ,A0 FFFFFFFFh 80000000h 0101 7FFFFFFFh ADDC Al r A0 FFFFFFFFh 80000001 h 1 100 80000000h ADDC Al r A0 7FFFFFFFh 30000001 h 0110 OOOOOOOOh ADDC Al ,A0 7FFFFFFFh 80000000h 1000 FFFFFFFFh ADDC Al ,A0 7FFFFFFFh 00000001 h 1001 80000000h ADDC Al A0 00000002h 00000002h 0000 00000004h 12-37 ADDI Add Immediate - 16 Bits Syntax Execution Instruction Words Description ADDI /W,Rd[,\NJ IW + Rd - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 110 R Rd 16-bit value This ADDI instruction adds a sign-extended, 16-bit immediate value to the contents of the destination register, and stores the result in the destination register. (The symbol IW in the syntax above represents a 16-bit, sign- extended immediate value.) The assembler uses the short (16-bit) add if the immediate value is previ- ously defined and is in the range -32,768 to 32,767. You can force the assembler to use the short form by following the register operand with a W: ADDI IW,Rd,W If you use the W parameter and the value is outside the legal range, the assembler discards all but the 16 LSBs and issues an appropriate warning message. You can use the ADDI instruction with the ADDC instruction to perform multiple-precision arithmetic. Machine States 2,8 Status Bits N 7 if the result is negative otherwise C 7 if there is a carry, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Examples Code Before After • AO IMCZV A0 ADDI 1,A0 FFFFFFFFh 0110 OOOOOOOOh ADDI 2,A0 FFFFFFFFh 0100 00000001 h ADDI 1,A0 7FFFFFFFh 1001 80000000h ADDI 2,A0 00000002h 0000 00000004h ADDI 32767, A0 00000002h 0000 00008001 h ADDI 0FFFF0010h,A0 ,w FFFFFFFOh 0110 OOOOOOOOh 12-38 Add Immediate - 32 Bits ADDI Syntax Execution Instruction Words Description Machine States Status Bits Examples ADDI IL.Rd[.L] IL + Rd -* Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 110 1 R Rd 16 LSBsof IL 16 MSBsof IL This ADDI instruction adds a 32-bit, signed immediate value to the con- tents of the destination register, and stores the result in the destination re- gister. (The symbol IL in the syntax above represents a 32-bit, signed immediate value.) The assembler uses the long (32-bit) ADDI if it cannot use the short form. You can force the assembler to use the long form by following the register operand with an L: ADDI IL,Rd,L 3,12 N 7 if the result is negative, otherwise C 7 if there is a carry, otherwise Z /if the result is 0, otherwise V 7 if there is an overflow, otherwise Code Before After A0 IMCZV A0 ADDI 0FFFFFFFFh,A0 FFFFFFFFh 1100 FFFFFFFEh ADDI 80000000h,A0 FFFFFFFFh 0101 7FFFFFFFh ADDI 80000000h,A0 7FFFFFFFh 1000 FFFFFFFFh ADDI 32768, A0 7FFFFFFFh 1001 80007FFFh ADDI 2,A0,L FFFFFFFFh 0100 00000001 h 12-39 ADDK Add Constant (5 Bits) Syntax Execution Instruction Words Description ADDK K.Rd K + Rd - Rd 15 14 13 12 11 10 9 8 10 K R Rd ADDK adds a 5-bit constant to the contents of the destination register and stores the result in the destination register. (The symbol K in the syntax above represents a 5-bit constant.) The constant is treated as an unsigned number in the range 1-32; if the or- iginal value of K=32, then K is converted to in the opcode. The assembler issues an error if you try to add to a register. You can use the ADDK instruction with the ADDC instruction to perform multiple-precision arithmetic. Machine States 1,4 Status Bits N /if the result is negative, otherwise C 7 if there is a carry, otherwise Z /if the result is 0, otherwise V /if there is an overflow, otherwise Examples Code Before After A0 IMCZV A0 ADDK 1,A0 FFFFFFFFh 0110 OOOOOOOOh ADDK 2,A0 FFFFFFFFh 0100 00000001 h ADDK 1,A0 7FFFFFFFh 1001 80000000h ADDK 1,A0 80000000h 1000 80000001 h ADDK 32,A0 80000000h 1000 80000020h ADDK 32,A0 00000002h 0000 00000022 h 12-40 Add Registers in XY Mode ADDXY Syntax Execution Instruction Words Description ADDXY Rs, Rd RsX + RdX RsY + RdY RdX RdY 15 14 13 12 11 10 9 8 1 1110 Rs R Rd ADDXY adds the signed source X value to the signed destination X value, adds the signed source Y value to the signed destination Y value, and stores the result in the destination register. The source and destination registers are treated as if they contained separate X and Y values. Any carry out from the lower (X) half of the register does not propagate into the upper (Y) half. If you only want to add the X halves together, then one of the Y values must be (the method for adding the Y halves is similar). You can use this instruction to manipulate XY addresses in the register file; ADDXY is also useful for incremental figure drawing. Rs and Rd must be in the same register file. Machine States 1 ,4 Status Bits N 1 i1 resulting X field is all 0s, otherwise C The sign bit of the Y half of the result Z / if Y field is all 0s, otherwise V The sign bit of the X half of the result Examples Code Before After A1 AO AO NCZV ADDXY A1,A0 OOOOOOOOh OOOOOOOOh OOOOOOOOh 1010 ADDXY A1,A0 OOOOOOOOh 00000001 h 00000001 h 0010 ADDXY A1,A0 OOOOOOOOh 0001 OOOOh 0001 OOOOh 1000 ADDXY A1,A0 OOOOOOOOh 0001 0001 h 0001 0001 h 0000 ADDXY A1,A0 OOOOFFFFh 00000001 h OOOOOOOOh 1010 ADDXY A1,A0 OOOOFFFFh 0001 0001 h 0001 OOOOh 1000 ADDXY A1,A0 OOOOFFFFh 00000002 h 00000001 h 0010 ADDXY A1,A0 OOOOFFFFh 0001 0002h 0001 0001 h 0000 ADDXY A1,A0 FFFFOOOOh 0001 OOOOh OOOOOOOOh 1010 ADDXY A1,A0 FFFFOOOOh 0001 0001 h 00000001 h 0010 ADDXY A1,A0 FFFFOOOOh 00020000h 0001 OOOOh 1000 ADDXY A1,A0 FFFFOOOOh 00020001 h 0001 0001 h 0000 ADDXY A1,A0 FFFFFFFFh 0001 0001 h OOOOOOOOh 1010 ADDXY A1,A0 FFFFFFFFh 0001 0002h 00000001 h 0010 ADDXY A1,A0 FFFFFFFFh 00020001 h 0001 OOOOh 1000 ADDXY A1,A0 FFFFFFFFh 00020002h 0001 0001 h 0000 12-41 AND AND Registers Syntax AND Rs, Rd Execution Rs AND Rd - Rd instruction Words 15 14 13 12 11 10 9 8 7 6 5 4 3 2 10 10 1 Rs R Rd Description AND bitwise-ANDs the contents of the source of the destination register and stores the result Rs and Rd must be in the same register file. register with the contents in the destination register. Machine States 1,4 Status Bits N Unaffected C Unaffected Z /if the result is 0, otherwise V Unaffected Examples Code Before After AND A1,A0 AND A1,A0 AND A1,A0 AND A1,A0 AND A1,A0 AND A1,A0 AND A1,A0 A1 FFFFFFFFh FFFFFFFFh OOOOOOOOh AAAAAAAAh AAAAAAAAh 55555555h 55555555h A0 FFFFFFFFh OOOOOOOOh OOOOOOOOh 55555555h AAAAAAAAh 55555555h AAAAAAAAh NCZV AO xxOx FFFFFFFFh xx 1x OOOOOOOOh xxlx OOOOOOOOh xxlx OOOOOOOOh xx Ox AAAAAAAAh xxOx 55555555h xx 1x OOOOOOOOh 12-42 AND Immediate (32 Bits) ANDI Syntax Execution Instruction Words Description ANDI IL.Rd IL AND Rd - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 R Rd 1s complement of 16 LSBs of IL 1s complement of 16 MSBs of IL ANDI bitwise-ANDs the value of a 32-bit immediate value with the con- tents of the destination register, and stores the result in the destination re- gister. (The symbol IL in the syntax above represents a 32-bit immediate value.) This is an alternate mnemonic for ANDNI IL.Rd. Note that the assembler stores the 1s complement of I L in the two extension words. Machine States 3,12 Status Bits N Unaffected C Unaffected Z /if the result is 0, otherwise V Unaffected Examples Code Before After A0 NCZV A0 ANDI 0FFFFFFFFh,A0 FFFFFFFFh xxOx FFFFFFFFh ANDI 0FFFFFFFFh,A0 OOOOOOOOh xxlx OOOOOOOOh ANDI 00000000h,A0 OOOOOOOOh xxlx OOOOOOOOh ANDI OAAAAAAAAh , A0 55555555h xxlx OOOOOOOOh ANDI OAAAAAAAAh , A0 AAAAAAAAh xxOx AAAAAAAAh ANDI 55555555h,A0 55555555h xxOx 55555555h ANDI 55555555h,A0 AAAAAAAAh xxlx OOOOOOOOh 12-43 ANDN AND Register with Complement Syntax Execution Instruction Words Description ANDN Rs.Rd (NOT Rs) AND Rd - Rd 15 14 13 12 11 10 9 8 10 10 1 Rs R Rd ANDN bitwise- AN Ds the 1s complement of the contents of Rs with the contents of Rd, and stores the result in the destination register. Rs and Rd must be in the same register file. Note that andn Rn , Rn has the same effect as clr Rn. Machine States 1,4 Status Bits N Unaffected C Unaffected Z /if the result V Unaffected is 0, otherwise Examples Code Before After A1 A0 IMCZV A0 ANDN A1,A0 FFFFFFFFh FFFFFFFFh xx 1x OOOOOOOOh ANDN A1,A0 FFFFFFFFh OOOOOOOOh XX 1 X OOOOOOOOh ANDN A1,A0 OOOOOOOOh OOOOOOOOh XX 1 X OOOOOOOOh ANDN A1,A0 AAAAAAAAh 55555555h xx Ox 55555555h ANDN A1,A0 AAAAAAAAh AAAAAAAAh XX 1 X OOOOOOOOh ANDN A1,A0 55555555h 55555555h XX 1 X OOOOOOOOh ANDN A1,A0 55555555h AAAAAAAAh xx Ox AAAAAAAAh 12-44 AND Not Immediate (32 Bits) ANDNI Syntax Execution Instruction Words Description ANDNI IL.Rd (NOT IL) AND Rd - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1110 R Rd 16 LSBsof IL 16 MSBsof IL ANDNI bitwise-ANDs the 1s complement of a 32-bit immediate value with the contents of the destination register, and stores the result in the desti- nation register. (The symbol IL in the syntax above represents a 32-bit immediate value.) ANDI also uses this opcode. Machine States 3,12 Status Bits N Unaffected C Unaffected Z 7 if the result is 0, otherwise V Unaffected Examples Code Before After A0 NCZV AO ANDNI 0FFFFFFFFh,A0 FFFFFFFFh xx1 X OOOOOOOOh ANDNI 0FFFFFFFFh,A0 OOOOOOOOh xxlx OOOOOOOOh ANDNI 00000000h,A0 OOOOOOOOh xxlx OOOOOOOOh ANDNI OAAAAAAAAh , A0 55555555h xxOx 55555555h ANDNI OAAAAAAAAh , A0 AAAAAAAAh xxlx OOOOOOOOh ANDNI 55555555h,A0 55555555h xxlx OOOOOOOOh ANDNI 55555555h,A0 AAAAAAAAh xx Ox AAAAAAAAh 12-45 BTST Test Register Bit - Constant Syntax Execution Instruction Words Description Machine States Status Bits Examples BTST K, Rd Set status on value of bit K in Rd 15 14 13 12 11 10 9 8 1 1 1 1 ~K R Rd BTST tests a bit in the destination register bit and sets status bit Z accord- ingly. This form of the BTST instruction uses a 5-bit constant to specify the bit in Rd that is tested (the symbol K in the syntax above represents a 5-bit constant). The K value must be an absolute expression that evaluates to a number in the range to 31; if the value is greater than 31, the assembler issues a warning and truncates the K operand value to the five LSBs. Note that the assembler 1s-complements the value of K before inserting it into the opcode. 1,4 N Unaffected C Unaffected Z 7 if the bit tested is 0, if the bit tested is 1 V Unaffected Code Before After AO NCZV BTST 0,A0 55555555h xxOx BTST 15, A0 55555555h xxlx BTST 31, A0 55555555h xxlx BTST 0,A0 AAAAAAAAh xxlx BTST 15, A0 AAAAAAAAh xxOx BTST 31, A0 AAAAAAAAh xxOx BTST 0,A0 FFFFFFFFh xxOx BTST 15, A0 FFFFFFFFh xxOx BTST 31, A0 FFFFFFFFh xxOx BTST 0,A0 OOOOOOOOh xxlx BTST 15, A0 OOOOOOOOh xxlx BTST 31,A0 OOOOOOOOh xxlx 12-46 Test Register Bit - Register BTST Syntax Execution Instruction Words Description BTST Rs.Rd Set status on value of specified bit in Rd 15 14 13 12 11 10 9 8 7 1 10 10 1 Rs R Rd BTST tests a bit in the destination register bit and sets status bit Z accord- ingly. This form of the BTST instruction uses the 5 LSBs of the source re- gister to specify the bit in Rd that is tested (the symbol Rs in the syntax above represents the source register). Note that the 27 MSBs of Rs are ignored. Rs and Rd must be in the same register file. Machine States 2,5 Status Bits N Unaffected C U n affected Z 7 if the bit tested is 0, if the bit tested is 1 V U n affected Examples Code Before After A1 AO NICZV BTST A1,A0 OOOOOOOOh 55555555h xxOx BTST A1,A0 OOOOOOOFh 55555555h xx1 X BTST A1,A0 0000001 Fh 55555555h xx1 X BTST A1,A0 OOOOOOOOh AAAAAAAAh xxlx BTST A1,A0 OOOOOOOFh AAAAAAAAh xxOx BTST A1,A0 0000001 Fh AAAAAAAAh xxOx BTST A1,A0 FFFFFF8Fh FFFF7FFFh xxOx BTST A1,A0 OOOOOOOOh FFFFFFFFh xxOx BTST A1,A0 OOOOOOOFh FFFFFFFFh xxOx BTST A1,A0 0000001 Fh FFFFFFFFh xxOx BTST A1,A0 OOOOOOOOh OOOOOOOOh xx1 X BTST A1,A0 OOOOOOOFh OOOOOOOOh xx1 X BTST A1,A0 0000001 Fh OOOOOOOOh xx1 X 12-47 CALL Call Subroutine - Indirect Syntax Execution Instruction Words Description CALL Rs PC -* TOS Rs - PC SP - 32 - SP 15 14 13 12 11 10 9 8 1 1 1 1 Rs CALL pushes the address of the next instruction (PC) onto the stack, then jumps to a subroutine whose address is contained in the source register. You can use this instruction for indexed subroutine calls. Note that when Rs is the SP, Rs is decremented after being written to the PC (the PC contains the original value of Rs). The TMS34010 always sets the four LSBs of the program counter to 0, so instructions are always word aligned. The stack pointer (SP) points to the top of the stack; the stack is located in external memory. The stack grows in the direction of decreasing linear addresses. PC is pushed onto the stack and the SP is predecremented by 32 before the return address is loaded onto the stack. Stack pointer align- ment affects timing as indicated in Machine States, below. Use the RETS instruction to return from a subroutine. States 3 + (3),9 (SP aligned) 3 + (9),15 (SP nonaligned) Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Example CALL A0 Before After A0 PC SP PC SP 01234560h 0444221 Oh F000020h 01234560h FOOOOOOh Memory contains the following values after instruction execution: Address Data F00001 Oh 2220h F000020h 0444h 12-48 Call Subroutine - Absolute CALLA Syntax Execution Instruction Words Description Machine States Status Bits Example CALLA Address PC - TOS Address -» PC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 10 10 10 1 1 1 1 1 16 LSBs of Address 16 MSBs of Address CALLA pushes the address of the next instruction (PC) onto the stack, then jumps to the address contained in the two extension words. The Ad- dress operand is a 32-bit absolute address. This instruction is used for long (greater than ±32K words) or externally referenced calls. The lower four bits of the program counter are always set to 0, so in- structions are always word-aligned. The stack pointer (SP) points to the top of the stack; the stack is located in external memory. The stack grows in the direction of decreasing linear address. PC is pushed onto the stack and the SP is predecremented by 32 before the return address is loaded onto the stack. Stack pointer alignment affects timing as indicated in Machine States, below. Use the RETS instruction to return from a subroutine. 4+(2),15 (SP aligned) 4+(8),21 (SP nonaligned) N Unaffected C Unaffected Z Unaffected V Unaffected CALLA 01234560h Before PC 0444221 Oh SP 0F000020h After PC 01234560h SP OFOOOOOOh Memory contains the following values after instruction execution: Address F00001 Oh F000020h Data 2240h 0444h 12-49 CALLR Call Subroutine - Relative Syntax Execution Instruction Words Description Machine States Status Bits Examples CALLR Address PC - TOS PC + (offset x 16) PC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 1 1 1 offset CALLR pushes the address of the next instruction (PC) onto the stack, then jumps to the subroutine at the address specified by the sum of the next instruction address and the signed word offset. This instruction is used for calls within a specified module or section. The Address operand is a 32-bit address within ±32K words (-32,768 to 32,767) of the PC. The address must be defined within the current section; the assembler does not accept an address value that is externally defined or defined within a different section than PC. The assembler calculates the offset value for the opcode as (Address - PC)/1 6. The lower four bits of the program counter are always set to 0, so in- structions are always word aligned. The stack pointer (SP) points to the top of the stack; the stack is located in external memory. The stack grows in the direction of decreasing linear address. The PC is pushed on to the stack and the SP is predecremented by 32 before the return address is loaded onto the stack. Stack pointer alignment affects timing as indicated in Machine States, below. Use the RETS instruction to return from a subroutine. 3+(2),11 (SP aligned) 3+(8),17 (SP nonaligned) N Unaffected C Unaffected Z Unaffected V Unaffected Code CALLR 0447FFF0h CALLR 04480000h Before PC 04400000h 04400000h SP 0F000020h 0F000020h After PC 0447FFF0h 04480000h SP OFOOOOOOh OFOOOOOOh Memory contains the following values after instruction execution: Address F00001 Oh F000020h Data OOOOh 0440h 12-50 Clear Register CLR Syntax Execution Instruction Words Description Machine States Status Bits Examples CLR Rd Rd XOR Rd - Rd 15 14 13 12 11 10 9 8 1 10 10 11 Rd R Rd CLR clears the destination register by XORing the contents of the register with itself. This is an alternate mnemonic for XOR Rd.Rd. 1,4 N Unaffected C Unaffected Z 7 V Unaffected Code CLR A0 CLR A0 CLR A0 CLR A0 Before AO FFFFFFFFh 00000001 h 80000000h AAAAAAAAh After AO OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh IMCZV xxlx xxlx xx1 X xxlx 12-51 CLRC Clear Carry Syntax Execution Instruction Words Description Machine States Status Bits Examples CLRC -> C 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 CLRC sets the C (carry) bit in the status register to 0; the rest of the status register is unaffected. (Note that the SETC instruction sets the C bit.) This instruction is useful for returning a true/false value (in the carry bit) from a subroutine without using a general-purpose register. 1,4 N Unaffected C Z Unaffected V Unaffected Code CLRC CLRC CLRC Before After ST IMCZV ST IMCZV FOOOOOOOh 1111 BOOOOOOOh 1011 4000001 Oh 0100 0000001 Oh 0000 BOOOOOIFh 1011 BOOOOOIFh 1011 12-52 Compare Registers CMP Syntax Execution Instruction Words Description Machine States Status Bits Examples CMP Rs.Rd Set status bits on the result of Rd - Rs 15 14 13 12 11 10 9 8 1 10 10 Rs R Rd CMP sets the status bits on the result of subtracting the contents of Rs from the contents of Rd. This is a nondestructive compare; the contents of the registers are not affected. This instruction is often used in conjunction with the J Ace or JRcc conditional jump instructions. Rs and Rd must be in the same register file. 1,4 N 7 if the result is negative, otherwise C 7 if a there is a borrow, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Code Before CMP CMP CMP CMP CMP CMP CMP A1,A0 A1,A0 A1,A0 A1,A0 A1,A0 A1,A0 A1,A0 A1 A0 NCZV 00000001 h 00000001 h 0010 00000001 h 00000002h 0000 00000001 h FFFFFFFFh 1000 00000001 h 80000000h 0001 FFFFFFFFh 7FFFFFFFh 1 101 FFFFFFFFh 80000000h 1 100 80000000h 7FFFFFFFh 1 101 After Jumps Taken U C, N N, N C,Z, N V, LS, G E, LE, H S UC f NN,NC f NZ,NV,P,Hl f GE,GT,HS UC,N,NC,NZ,NV,P,HI,LT,LE,HS UC,NN,NC,NZ,V,HI,LT,LE,HS UC,N,C,NZ,V,LS,GE,GT r LO UC,N,C,NZ,NV,LS,LT,LE,LO UC,N,C,NZ,V,LS,GE,GT,LO 12-53 CMPI Compare Immediate - 16 Bits Syntax Execution Instruction Words Description Machine States Status Bits Examples CMPI /W,Rd[,\N] Set status bits on the result of Rd - IW 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 110 10 R Rd 1s complement of IW CMPI sets the status bits on the result of subtracting a 16-bit, sign- extended immediate value from the contents of the destination register. (The symbol IW in the syntax above represents a 16-bit, signed immediate value.) This is a nondestructive compare; the contents of the destination register are not affected. This instruction is often used in conjunction with the J Ace or JRcc conditional jump instructions. Note that the assembler inserts the 1s complement of the 16-bit value into the second instruction word. The assembler uses the short form of the CMPI instruction if the immediate value is previously defined and is in the range -32,768 to 32,767. You can force the assembler to use the short form by following the register operand with W: CMPI IW,Rd,W The assembler truncates the upper bits and issues an appropriate warning message if the value is greater than 16 bits. 2,8 N /if the result is negative, otherwise C 7 if there is a borrow, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Code Before After Jumps Taken AO NCZV CMPI 1,A0 00000002h 0000 CMPI 1,A0 00000001 h 0010 CMPI 1,A0 OOOOOOOOh 1100 CMPI 1,A0 FFFFFFFFh 1000 CMPI 1,A0 80000000h 0001 CMPI -2,A0 OOOOOOOOh 0100 CMPI -2,A0 FFFFFFFFh 0000 CMPI -2,A0 FFFFFFFEh 0010 CMPI -2,A0 FFFFFFFDh 1100 CMPI -1,A0 7FFFFFFFh 1101 UC,NN,NC,NZ,NV,P,HI,GE,GT,HS UC,NN,NC,Z,IW,LS,GE,LE,HS UC,N,C,NZ,NV,LS,LT,LE,LO UC,N,NC,NZ,NV,P,HI,LT,LE,HS UC,NN,NC,NZ,V,HI,LT,LE,HS UC,NN,C,NZ,NV,P,LS,GE,GT,LO UC,NN,NC,NZ,NV,P,LI,GE,GT,HS UC,NN,NC,Z,NV,LS,GE,LE,HS UC,N,C,NZ,NV,LS,LT,LE,LO UC,N,C,NZ,V,LS,GE,GT,LO 12-54 Compare Immediate - 32 Bits CMPI Syntax Execution Instruction Words Description Machine States Status Bits Examples CMPI IL,Rd[.L] Set status bits on the result of Rd - IL 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 R Rd 1s complement of 1 6 LSBs of IL 1s complement of 16 MSBs of IL CMPI sets the status bits on the result of subtracting a 32-bit, signed im- mediate value from the contents of the destination register. (The IL symbol in the syntax above represents a 32-bit, signed immediate value.) This is a nondestructive compare; the contents of the destination register are not af- fected. Note that the assembler inserts the 1s complement of the 16 LSBs of the value into the second instruction word, and inserts the 1s complement of the 1 6 MSBs of the value into the third instruction word. The assembler uses this form of the CMPI instruction if it cannot use the short form. You can force the assembler to use the long form by following the register operand with an L: CMPI IL,Rd,L This instruction is often used in conjunction with the J Ace or JRcc condi- tional jump instructions. 3,12 N 1 C 7 Z 7 V if the result is negative, otherwise if there is a borrow, otherwise if the result is 0, otherwise 7 if there is an overflow, otherwise Code CMPI CMPI CMPI CMPI CMPI CMPI CMPI CMPI CMPI CMPI 8000h,A0 8000h,A0 8000h,A0 8000h,A0 8000h,A0 0FFFF7FFFh,A0 0FFFF7FFEh,A0 0FFFF7FFEh,A0 0FFFF7FFEh,A0 0FFFF7FFFh,A0 Before After Jumps Taken A0 IMCZV 00008001 h 0000 UC,NN,NC,NZ,NV,P,HI,GE,GT,HS 00008000h 0010 UC,NN,NC,Z,NV,LS,GE,LE,HS 00007FFFh 1100 UC,N,C,NZ,NV,LS,LT,LE,LO FFFFFFFFh 1000 UC,N,NC,NZ,NV,P,HI,LT,LE,HS 80007FFFh 0001 UC,NN,NC,NZ,V,HI,LT,LE,HS OOOOOOOOh 0100 UC,NN,C,NZ,NV,P,LS,GE,GT,LO FFFF7FFFh 0000 UC,NN,IMC,NZ,NV,P,HI,GE,GT,HS FFFF7FFEh 0010 UC,NN,NC,Z,NV,LS,GE,LE,HS FFFF7FFDh 1100 UC,N,C,NZ,NV,LS,LT,LE,LO 7FFF7FFFh 1101 UC,N,C,NZ,V,LS,GE,GT,LO 12-55 CMPXY Compare X and Y Halves of Registers Syntax CMPXY Rs, Rd Execution Set status bits on the results of: RdX - RsX RdY - RsY Instruction Words Description Machine States Status Bits Examples 15 14 13 12 11 10 9 8 1 1110 10 Rs R Rd CMPXY compares the source register to the destination register in XY mode and sets the status bits as if a subtraction had been performed. This is a nondestructive compare; the contents of the register are not affected. The source and destination registers are treated as signed XY registers. Note that no overflow detection is provided. Rs and Rd must be in the same register file. 1,4 N 1 if source X field = destination X field, otherwise C Sign bit of Y half of the result Z 7 if source Y field = destination Y field, otherwise V Sign bit of X half of the result Code Before A1 A0 NCZV CMPXY Al r A0 00090009h 0001 0001 h 01 01 CMPXY Al f A0 00090009h 00090001 h 001 1 CMPXY Al ,A0 00090009h 0001 0009h 1 1 00 CMPXY Al ,A0 00090009h 00090009h 1 01 CMPXY Al ,A0 00090009h 0000001 Oh 0100 CMPXY Al P A0 00090009h 0009001 Oh 0010 CMPXY Al P A0 00090009h 00100000h 0001 CMPXY Al P A0 00090009h 001 00009h 1 000 CMPXY Al ,A0 00090009h 001 0001 Oh 0000 After Jumps Taken NN,C,NZ,V,LS,LT NN,NC,Z,V,LS,LT N,C,NZ,NV,LS,LT N,NC,Z,NV,LS,LT NN,C,NZ,NV,LS,GE NN,NC,Z,NV,LS,GE NN,NC,NZ,V,HI,LT N,NC,NZ,NV,HI,LT NN,NC,NZ,NV,HI,GE 12-56 Compare Point to Window CPW Syntax Execution Instruction Words Description Implied Operands CPW Rs.Rd point code -*• Rd 15 14 13 12 11 10 9 8 1 1110 11 Rs R Rd CPW compares a point represented by an XY value in the source register to the window limits in the WSTART and WEND registers. The contents of the source register are treated as an XY address that consists of 16-bit signed X and Y values. WSTART and WEND are also treated as signed XY-format registers. WSTART and WEND must contain positive values; negative values produce unpredictable results. The location of the point with respect to the window is encoded as shown below; the code is loaded into the destination register. Codes: 0101 0100 0110 0010 1010 Window 0000 31 8 8 5 4 0001 000....000 CODE oooool 1000 1001 ' +y The following list describes the contents of the destination register after CPW execution: Bit Postion: Contents: 0-4 0s 5 1 if WSTART.X > Rs.X, otherwise 6 1 if Rs.X > WEND.X, otherwise 7 1 if WSTART.Y > Rs.Y, otherwise 8 1 if Rs.Y > WEND.Y, otherwise 9-31 Os This instruction can also be used to trivially reject lines that do not intersect with a window. The CPW codes for the two points defining the line are ANDed together. If the result is nonzero, then the line must lie completely outside the window (and does not intersect it). A result indicates that the line may intersect the window, and a more rigorous test must be applied. Rs and Rd must be in the same register file. B File Registers Register Name Format Description B5 WSTART XY Window start. Defines inclusive starting corner of window (lesser value corner). B6 WEND XY Window end. Defines inclusive ending corner of window (greater value corner). 12-57 CPW Compare Point to Window Machine States Status Bits Examples 1,4 N C z V Unaffected Unaffected Unaffected 1 if point lies outside window, otherwise You must select appropriate implied operand values before executing the CPW instruction. In this example, the implied operands are set up as fol- lows, specifying a block of 36 pixels. WSTART = 5,5 WEND = A,A CPW A1,A0 Before After A1 NCZV AO NCZV 00040004h xxxO OOOOOOAOh xxxl 00040005h xxxO 00000080h xxxl 0004000Ah xxxO 00000080h xxxl 0004000 Bh xxxl OOOOOOCOh xxxl 00050004b xxxl 00000020h xxxl 00050005h xxxO OOOOOOOOh xxxO 0005000Ah xxxO OOOOOOOOh xxxO 0005000 Bh xxxO 00000040h xxxl 000A0004h xxxO 00000020h xxxl 000A0005h xxxl OOOOOOOOh xxxO OOOAOOOAh xxxl OOOOOOOOh xxxO OOOAOOOBh xxxO 00000040h xxxl 000B0004h xxxO 000001 20h xxxl 000B0005h xxxO 000001 OOh xxxl OOOBOOOAh xxxO 000001 OOh xxxl OOOBOOOBh xxxO 000001 40h xxxl 12-58 Convert XY Address to Linear Address CVXYL CVXYL Rs, Rd RsXY -» linear address in Rd 15 14 13 12 11 10 9 8 1 1110 10 Rs R Rd Syntax Execution Instruction Words Description CVXYL converts an XY address to a linear address: • The source register contains an XY address. The signed X value oc- cupies the 16 LSBs of the register and the signed Y value occupies the 16 MSBs. The X value must be positive. • The XY address is converted into a 32-bit linear address which is stored in the destination register. The following conversion formula is used: Address = [(Y x Display Pitch) OR (X x Pixel Size)] + Offset Since the TMS34010 restricts the screen pitch and pixel size to powers of two (for XY addressing), the multiply operations in this conversion are ac- tually shifts. The offset value is in the OFFSET register. The CONVDP value is used to determine the shift amount for the Y value, while the PSIZE reg- ister determines the X shift amount. Implied Operands Machine States Status Bits Rs and Rd must be in the same register file. B File Registers Register Name Format Description B3 DPTCH Linear Destination pitch B4 OFFSET Linear Screen origin (location 0,0) I/O Registers Address Name Description and Elements (Bits) C00001 40h CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the CVXYL instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an instruction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. 3,6 N Unaffected C Unaffected Z Unaffected V Unaffected 12-59 CVXYL Convert XY Address to Linear Address Examples Code Before After AO OFFSET PSIZE CONVDP A1 CVXYL AO, P A1 00400030h OOOOOOOOh 001 Oh 001 4h 00020300h CVXYL AO, ,A1 00400030h OOOOOOOOh 0008h 001 4h 000201 80h CVXYL AO, rAl 00400030h OOOOOOOOh 0004h 001 4h 00020000h CVXYL AO, rAl 00400030h 00008000h 0004h 001 4h 00028000h CVXYL AO, ,A1 00400030h OFOOOOOOh 0004h 001 4h 0F020000h CVXYL AO, rAl 00400030h OOOOOOOOh 0002h 001 4h 00020060h CVXYL AO, rAl 00400030h OOOOOOOOh 0001 h 001 4h 00020030h CVXYL AO, rAl 00400030h OOOOOOOOh 0001 h 001 3h 00040030h CVXYL AO, rAl 00400030h OOOOOOOOh 0001 h 001 5h 0001 OOOOh CONVDP = 001 3h corresponds to DPTCH = 00001 OOOh CONVDP = 001 4h corresponds to DPTCH = 00000800h CONVDP = 001 5h corresponds to DPTCH = 00000400h 12-60 Decrement Register DEC Syntax Execution Instruction Words Description Machine States Status Bits Examples DEC Rd Rd - 1 - Rd 15 14 13 12 11 10 9 8 1 1 1 1 Rd DEC subtracts 1 from the contents of the destination register and stores the result in the destination register. This instruction is an alternate mnemonic for SUBK l,Rd. You can use the DEC instruction with the SUBB instruction to perform multiple-precision arithmetic. 1,4 N 7 if the result is negative, otherwise C /if there is a borrow, otherwise Z /if the result is 0, otherwise V /if there is an overflow, otherwise Code Before After A1 A1 NCZV DEC Al 0000001 Oh OOOOOOOFh 0000 DEC Al 00000001 h OOOOOOOOh 0010 DEC Al OOOOOOOOh FFFFFFFFh 1100 DEC Al FFFFFFFFh FFFFFFFEh 1000 DEC Al 80000000h 7FFFFFFFh 0001 12-61 DINT Disable Interrupts Syntax Execution Instruction Words Description DINT -» IE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 DINT disables interrupts by setting the global interrupt enable bit (IE, status bit 21 ) to 0. All interrupts except reset and NMI are disabled; the interrupt enable mask in the INTENB register is ignored. The remainder of the status register is unaffected. The EINT instruction enables interrupts. Machine States 3,6 Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected IE Examples Code Before After DINT DINT ST 0000001 Oh 0020001 Oh ST 0000001 Oh 0000001 Oh 12-62 Divide Registers - Signed DIVS Syntax Execution Instruction Words Description Machine States DIVS Rs, Rd Rd Even: Rd:Rd + 1/Rs Rd Odd: Rd/Rs - Rd Rd, remainder -»■ Rd + 1 15 14 13 12 11 10 9 8 1 10 110 Rs R Rd DIVS performs a signed 32-bit or 64-bit divide. The source register con- tains the 32-bit signed divisor. The destination register contains a 32-bit signed dividend or the most significant half of a 64-bit signed dividend, depending on whether Rd is an odd register (for example, A1 or B3) or an even register (for example, A8 or B2): Rd Even DIVS performs a signed divide of the 64-bit operand contained in the two consecutive registers, starting at the specified desti- nation register, by the 32-bit contents of the source register. The specified even-numbered destination register, Rd, contains the 32 MSBs of the dividend. The next consecutive register (which is odd-numbered) contains the 32 LSBs of the divi- dend. The quotient is stored in the destination register, and the remainder is stored in the following register (Rd+1). The re- mainder is always the same sign as the dividend (in Rd:Rd + 1 ). Avoid using A14 or B14 as the destination register, since this overwrites the SP; the assembler issues a warning in this case. Rd Odd DIVS performs a signed divide of the 32-bit operand contained in the destination register by the 32-bit value in the source re- gister. The quotient is stored in the destination register; the re- mainder is not returned. Rs and Rd must be in the same register file. Rd Odd Rd Even Normal 39,42 40,43 Result = 80000000h 41,44 41,44 Rs = 7,10 7,10 Rd >. Rs treated as normal 7,10 Status Bits N if: 7 if: Rs = 0, or Rd is even and Rd >_ Rs, or Quotient is nonnegative. • Result = 80000000h or • Quotient is negative. C Unaffected Z0 if: • Rs = 0, or • Rd is even and Rd >. Rs, or 12-63 DIVS Divide Registers - Signed • Result = 80000000h, or • Quotient * 0. 1 if: • Quotient = 0. V 7 if quotient overflows (cannot be represented by 32 bits), other- wise The following conditions cause an overflow and set the overflow flag: • Divisor (Rs) is • Quotient cannot be contained within 32 bits Example 1 This example divides the contents of register A0 by the contents of register A2, and stores the result in register A0. Note that the contents of reg- ister A2 are not affected by instruction execution. DIVS A2,A0 Before After A0 A1 A2 AO A1 A2 NCZV 1 2345678h 87654321 h 87654321 h D95BC60Ah 15CA1DD7h 87654321 h 1x00 EDCBA987h 789ABCDFh 87654321 h 26A439F6h EA35E229h 87654321 h 0x00 EDCBA987h 789ABCDFh 789ABCDFh D95BC60Ah EA35E229h 789ABCDFh 1x00 1 2345678h 87654321 h 789ABCDFh 26A439F6h 15CA1DD7h 789ABCDFh 0x00 1 2345678h 87654321 h OOOOOOOOh 1 2345678h 87654321 h OOOOOOOOh 0x01 OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh 0x01 00000000H OOOOOOOOh 87654321 h OOOOOOOOh OOOOOOOOh 87654321 h 0x10 87654321 h OOOOOOOOh 87654321 h 87654321 h OOOOOOOOh 87654321 h 0x01 Example 2 This example divides the contents of register A1 by the contents of of reg- ister A2, and stores the result in register AO. Note that the contents of register A2 are not affected by instruction execution. DIVS A2,A1 Before After AO A1 A2 AO A1 A2 NCZV OOOOOOOOh 87654321 h 1 2345678h OOOOOOOOh FFFFFFFAh 1 2345678h 1x00 OOOOOOOOh 87654321 h 0EDCBA988h OOOOOOOOh 00000006 h EDCBA988h 0x00 OOOOOOOOh 789ABCDFh 0EDCBA988h OOOOOOOOh FFFFFFFAh EDCBA988h 1x00 OOOOOOOOh 789ABCDFh 1 2345678h OOOOOOOOh 00000006 h 12345678h 0x00 OOOOOOOOh 87654321 h OOOOOOOOh OOOOOOOOh 87654321 h OOOOOOOOh 0x01 OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh 0x01 12-64 Divide Registers - Unsigned DIVU Syntax Execution Instruction Words Description DIVU Rs, Rd Rd Even: Rd Odd: Rd:Rd + 1/Rs Rd/Rs - Rd Rd, remainder -*■ Rd + 1 15 14 13 12 11 10 9 8 1 10 110 1 Rs R Rd DIVU performs an unsigned 32-bit or 64-bit divide. The source register contains the 32-bit divisor. The destination register contains a 32-bit divi- dend or the most significant half of a 64-bit dividend, depending on whether Rd is an odd register (for example, A1 or B3) or an even register (for example, A8 or B2): Rd Even DIVU performs an unsigned divide of the 64-bit operand con- tained in the two consecutive registers, starting at the destina- tion register, by the 32 -bit contents of the source register. The specified even-numbered destination register, Rd, contains the 32 MSBs of the dividend. The next consecutive register (which is odd-numbered) contains the 32 LSBs of the divi- dend. The quotient is stored in the destination register, and the remainder is stored in the following register (Rd + 1). Avoid using A14 or B14 as the destination register, since this over- writes the SP; the assembler issues a warning in this case. Rd Odd DIVU performs an unsigned divide of the 32-bit operand con- tained in the destination register by the 32-bit value in the source register. The quotient is stored in the destination regis- ter; the remainder is not returned. Rs and Rd must be in the same register file. Machine States Rd Odd Normal 37,40 Rs = 5,8, Rd >. Rs treated as normal Status Bits N Unaffected C Unaffected z If: • Rs = 0, or • Rd is even and Rd >. Rs, or • Quotient * 0. Rd Even 37,40 5,8 5,8 1 If: Quotient = 0. V 7 if quotient overflows (cannot be represented by 32 bits), other- wise The following conditions cause an overflow and set the overflow flag: • Divisor (Rs) is 12-65 DIVU Divide Registers - Unsigned Quotient cannot be contained within 32 bits Example 1 This instruction divides the contents of register AO by the contents of reg- ister A2, and stores the unsigned result in register AO. Note that the contents of register A2 are not affected by instruction execution. Before DIVU A2,A0 After AO A1 A2 AO A1 A2 NCZV 1 2345678h 87654321 h 789ABCDFh 26A439F6h 15CA1DD7h 789ABCDFh xxOO 1 2345678h 87654321 h OOOOOOOOh 12345678h 87654321 h OOOOOOOOh xx01 OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh xx01 OOOOOOOOh OOOOOOOOh 87654321 h OOOOOOOOh OOOOOOOOh 87654321 h xx10 87654321 h OOOOOOOOh 87654321 h 87654321 h OOOOOOOOh 87654321 h xx01 Example 2 This instruction divides the contents of register A1 by the contents of reg- ister A2, and stores the unsigned result in register A1. Note that the contents of register A2 are not affected by instruction execution. DIVU A2,A1 Before After AO A1 A2 AO A1 A2 NCZV OOOOOOOOh 789ABCDFh 1 2345678h OOOOOOOOh 00000006h 1 2345678h xxOO OOOOOOOOh 1 2345678h OOOOOOOOh OOOOOOOOh 12345678h OOOOOOOOh xx01 OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh OOOOOOOOh xx01 OOOOOOOOh OOOOOOOOh 87654321 h OOOOOOOOh OOOOOOOOh 87654321 h xx10 OOOOOOOOh 87654321 h 87654321 h OOOOOOOOh 00000001 h 87654321 h xxOO 12-66 Draw and Advance DRAV Syntax Execution Instruction Words Description Implied Operands Pixel Processing DRAV Rs.Rd C0L0R1 pixels -♦ *Rd RsX + RdX -> RdX RsY + RdY -» RdY 15 14 13 12 11 10 9 8 1 11110 11 Rs R Rd DRAV writes the pixel value in the COLOR1 register to the location pointed to by the XY address in the destination register. Following the write, the XY address in the destination register is incremented by the value in the source register: the X half of Rs is added to the X half of Rd, and the Y half of Rs is added to the Y half of Rd. Any carry out from the lower (X) half of the register does not propagate into the upper (Y) half. COLOR1 bits 0-15 are output on data bus lines 0-15, respectively. The pixel data used from COLOR1 is that which aligns to the destination lo- cation, so 16-bit patterns can be implemented. Rs and Rd must be in the same register file. B File Registers Register Name Format Description B3 DPTCH Linear Destination pitch B4 OFFSET Linear Screen origin (location 0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner B9 COLOR1 Pixel Pixel color I/O Registers Address Name Description and Elements (Bits) COOOOOBOh CONTROL PP- Pixel processing operations (22 options) W -Window checking operation T -Transparency operation C0000140h CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C00001 60h PMASK Plane mask - pixel format Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the DRAV instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. Set the PPOP field in the CONTROL register to select a pixel processing operation. This operation is applied to the pixel as it is moved to the des- tination location. At reset, the default pixel processing operation is replace (S -»■ D). For more information, see Section 7.7, Pixel Processing, on page 7-15. 12-67 DRAV Draw and Advance Window Checking Select a window checking mode by setting the W bits in the CONTROL register. If you select an active window checking mode (W = 1, 2, or 3), the WSTART and WEND registers define the XY starting and ending corners of a rectangular window. The X and Y values in both WSTART and WEND must be positive. When the TMS34010 attempts to write a pixel inside or outside a defined value, the following actions may occur: W=0 No window operation. The pixel is drawn and the WVP and V bits are unaffected. W=1 Window hit. No pixels are drawn. The V bit is set to if the pixel lies within the window; otherwise, it is set to 1 . The WVP bit is set to 1 if the pixel lies within the window; otherwise, it is not affected. W=2 Window miss. If the pixel lies outside the window, the WVP and V bits are set to 1 and the instruction is aborted (no pixel is drawn). Otherwise, the pixel is drawn, the V bit is set to 0, and the WVP bit is unaffected. W=3 Window clip. If the pixel lies outside the window, the V bit is set to 1 and the instruction is aborted (no pixels are drawn). Otherwise, the pixel is drawn and the V bit is set to 0. For more information, see Section 7.10, Window Checking, on page 7-27. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. Shift Register Transfers When this instruction is executed and the SRT bit is set, normal memory read and write operations become SRT reads and writes. Refer to Section 9.10.2, Video Memory Bulk Initialization, on page 9-28 for more informa- tion. Machine States The states consumed depend on the operation selected, as indicated below. Pixel Processing Operation Window Violation PSIZE Replace Boolean ADD ADDS SUB SUBS MIN/MAX W=1 W=2 W=3 1,2,4,8 16 4 + (3),10 4+(1),8 6 + (3),12 6 + (1),10 7 + (3),13 6+(1),10 7 + (3),13 7 + (1),11 7 + (3),13 7 + (1),11 8+(3),14 8 + (1),12 7 + (3),13 7 + (1),11 5,8 5,8 3,6 3,6 5,8 5,8 Status Bits N Unaffected C Unaffected Z Unaffected V / if a window violation occurs, otherwise; unaffected if window clipping is not used. 12-68 Draw and Advance DRAV Examples These DRAV examples use the following implied operand setup. Register File B: DPTCH (B3) OFFSET (B4) = WSTART (B5) = WEND (B6) C0L0R1 (B9) - 200h 0001 OOOOh 001 OOOOOh 003C0040h FFFFFFFFh I/O Registers: CONVDP = 001 6h Assume that memory contains the following values before instruction exe- cution: Address Data 0001 8040h 8888h Code Before After A0 A1 PSIZE PP w PMASK AO @18040h DRAV Al r A0 00400040h 001 0001 Oh 0001 h 00000 00 OOOOh 00500050h 8889h DRAV Al r A0 00400020h 001 0001 Oh 0002h 00000 00 OOOOh 00500030h 888 Bh DRAV Al ,A0 00400010 001 0001 Oh 0004h 00000 00 OOOOh 00500020h 888Fh DRAV Al ,A0 00400008 001 0001 Oh 0008h 00000 00 OOOOh 0050001 8h 88FFh DRAV Al ,A0 00400004 001 0001 Oh 001 Oh 00000 00 OOOOh 0050001 4h FFFFh DRAV Al r A0 00400004 OOOOFFFFh 001 Oh 01010 00 OOOOh 00400003 h OOOOh DRAV Al ,A0 00400004 FFFFOOOOh 001 Oh 10011 00 OOOOh 003F0004h OOOOh DRAV Al r A0 00400004 0001 0001 h 001 Oh 00000 11 OOOOh 00410005h OOOOh DRAV Al ,A0 00400004h 00400004h 001 Oh 00000 00 OOFFh 00800008h FFOOh 12-69 DSJ Decrement Register and Skip Jump Syntax Execution Instruction Words Description DSJ Rd, Address Rd - 1 - Rd If Rd * 0, then (offset x 16) + PC -» If Rd = 0, then go to next instruction PC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 R Rd offset DSJ decrements the contents of the destination register by 1 . Depending on the decremented value of Rd, the TMS34010 either jumps or skips the jump: • Rd - 1 ± The TMS3401 jumps. The current PC points to the instruction word that immediately follows the second word of the DSJ instruction. The signed word offset is converted to a bit offset by multiplying by 16. The new PC address is then obtained by adding the resulting signed offset (offset x 1 6) to the address of the next instruction. • Rd - 1 = The TMS3401 skips the jump and continues and program execution with the next sequential instruction. The Address operand is a 32-bit address. The assembler calculates the offset as (Address - PC')/16; this results in a jump range of -32,768 to +32,767 words. (The offset is the second instruction word of the opcode.) The DSJ instruction is useful for large loops involving a counter, shorter loops, the assembler translates this into a DSJS instruction. For Machine States 3,9 (Jump) 2,8 (No jump) Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples Code Before After DSJ A5,LOOP DSJ A5,LOOP DSJ A5,LOOP A5 00000009h 00000001 h OOOOOOOOh A5 00000008 h OOOOOOOOh FFFFFFFFh Jump taken? Yes No Yes 12-70 Conditionally Decrement Register and Skip Jump DSJEQ Syntax Execution Instruction Words Description DSJEQ Rd, Address If Z Machine States Status Bits 1,then Rd - 1 - Rd If Rd * 0, then PC + (offset x 16) -> If Rd = 0, then go to next instruction If Z = 0, then go to next instruction PC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 R Rd offset The DSJEQ instruction evaluates the status Z bit. Depending on the value of that bit, the TMS3401 either skips the jump, or decrements Rd and then makes a decision to jump or skip the jump: • Z = 1 The TMS34010 decrements the contents of the destination register by 1. Rd - 1 * The TMS34010 jumps relative to the current PC. The current PC points to the instruction word that immediately follows the second word of the DSJEQ instruction. The signed word offset is converted to a bit offset by multiplying by 16. The new PC address is then obtained by adding the resulting signed offset (offset x 1 6) to the address of the next instruction. Rd - 1 = The TMS34010 skips the jump and continues program exe- cution at the next sequential instruction. • Z = The TMS34010 skips the jump and continues program execution at the next sequential instruction. The Address operand is a 32-bit address. The assembler calculates the offset as (Address - PC')/16; this results in a jump range of -32,768 to +32,767 words. (The offset is the second instruction word of the opcode.) You can use this instruction after an explicit or implicit compare to 0. Ad- ditional information on these types of compares can be obtained in the CMP and CM PI, and MOVE- to- register instructions, respectively. 3,9 (Jump) 2,8 (No jump) N Unaffected C Unaffected Z Unaffected V Unaffected 12-71 DSJEQ Conditionally Decrement Register and Skip Jump Examples Code Before After A5 NCZV A5 Ju mp taken? DSJEQ A5, ,LOOP 00000009h xxlx 00000008h Yes DSJEQ A5, ,LOOP 00000001 h xxlx OOOOOOOOh No DSJEQ A5, r LOOP OOOOOOOOh xxlx FFFFFFFFh Yes DSJEQ A5, ,LOOP 00000009h xxOx 00000009h No DSJEQ A5 ; ,LOOP 00000001 h xxOx 00000001 h No DSJEQ A5, r LOOP OOOOOOOOh xxOx OOOOOOOOh No 12-72 Conditionally Decrement Register and Skip Jump DSJNE Syntax Execution Instruction Words Description DSJNE Rd, Address If Z Machine States Status Bits 0, then Rd - 1 -» Rd If Rd * 0, then PC + (offset x 16) -» If Rd = 0, then go to next instruction If Z = 1 , then to to next instruction PC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 R Rd offset The DSJNE instruction evaluates the status Z bit. Depending on the value of that bit, the TMS3401 either skips the jump, or decrements Rd and then makes a decision to jump or skip the jump: • Z = 0, The TMS34010 decrements the contents of the destination register by 1. Rd - 1 * The TMS34010 jumps relative to the current PC. The current PC points to the instruction word that immediately follows the second word of the DSJNE instruction. The signed word offset is converted to a bit offset by multiplying by 16. The new PC address is then obtained by adding the resulting signed offset (offset x 16) to the address of the next instruction. Rd - 1 = The TMS34010 skips the jump and continues program exe- cution at the next sequential instruction. • Z = 1 The TMS34010 skips the jump and continues program execution at the next sequential instruction. The Address operand is a 32- bit address. The assembler calculates the offset as (Address - PC')/16; this results in a jump range of -32,768 to + 32,767 words. (The offset is the second instruction word of the opcode.) You can use this instruction after an explicit or implicit compare to 0. Ad- ditional information on these types of compares can be obtained in the CMP, CMPI, and MOVE -to- register instructions. 3,9 (Jump) 2,8 (No jump) N Unaffected C Unaffected Z Unaffected V Unaffected 12-73 Conditionally Decrement Register DSJNE and Skip Jump Examples Code Before After A5 NCZV A5 Ju mp taken? DSJNE A5, ,LOOP 00000009h xx1 X 00000009h No DSJNE A5, ,LOOP 00000001 h xxlx 00000001 h No DSJNE A5, ,LOOP 00000000 h xxlx OOOOOOOOh No DSJNE A5, ,LOOP 00000009h xxOx 00000008h Yes DSJNE A5, ,LOOP 00000001 h xxOx OOOOOOOOh No DSJNE A5, r LOOP OOOOOOOOh xxOx FFFFFFFFh Yes 12-74 Decrement Register and Skip Jump - Short DSJS Syntax Execution Instruction Words Fields Description Machine States Status Bits Examples DSJS Rd, Address Rd - 1 -^ Rd If Rd # 0, then PC + (offset x 16) - If Rd = 0, then go to next instruction 15 14 13 12 11 10 9 8 PC 1 111 D offset R Rd D is a 1 -bit direction bit (from PC to Address): D=0 - forward jump D=1 - backward jump DSJS decrements the contents of the destination register by 1 on the result, the TMS3401 either jumps or skips the jump: • Rd - 1 * Depending The TMS34010 jumps relative to PC. PC points to the instruction word that immediately follows the DSJS instruction. Internally, the 5-bit offset is multiplied by 1 6 to convert it to a bit offset. This allows a jump range of -30 to +32 words from the PC. If direction bit D = The new PC address is obtained by adding the resulting offset to PC. - If direction bit D = 1 The new PC address is obtained by subtracting the resulting offset from PC. • Rd - 1 = The TMS34010 skips the jump and continues program execution at the next sequential instruction. The Address operand is a 32-bit address. The assembler calculates the offset as (Address - PC)/16; this results in a jump range of -30 to +32 words from the PC. (The offset is encoded as part of the instruction word.) This instruction is useful for coding tight loops for cache-resident routines. 2.5 (Jump) 3.6 (No jump) Unaffected Unaffected Unaffected Unaffected Code DSJS A5,LOOP DSJS A5,LOOP DSJS A5,LOOP Before After A5 A5 Jump taken? 00000009h 00000008h Yes 00000001 h OOOOOOOOh No OOOOOOOOh FFFFFFFFh Yes 12-75 EINT Enable Interrupts Syntax Execution Instruction Words Description EINT 1 - IE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 EINT sets the global interrupt enable bit (IE) to 1, allowing interrupts to be enabled. When IE=1, individual interrupts are enabled by setting the ap- propriate bits in the INTENB interrupt mask register. The rest of the status register is unaffected. The DINT instruction disables interrupts. Machine States 3,6 Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected IE 7 Examples Code Before After EINT EINT ST 0000001 Oh 0020001 Oh ST 0020001 Oh 0020001 Oh 12-76 Initiate Emulation EMU Syntax Execution Instruction Words Description Machine States Status Bits EMU ST -»• Rd and conditionally enter emulator mode 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 The EMU i nstruc tion pulses the EMUA pin and samples the RUN/EMU pin. If the RUN/EMU pin is in the RUN state, the EMU instruction acts as a NOP. If the pin is in the EMU state, emulation mode is entered. This instruction is not intended for general use; refer to the TMS34010 XDS/22 User's Guide for more information. 8,1 1 (or more if EMU mode is entered) N C z V Indeterminate Indeterminate Indeterminate Indeterminate 12-77 EXGF Exchange Field Definition Syntax Execution Instruction Words Description EXGF Rdf.FJ Rd -* FSO, FEO or Rd - FS1, FE1 FSO, FEO - Rd or FS1,FE1 - Rd 15 14 13 12 11 10 9 8 1 110 10 1 F 10 Rd EXGF exchanges the six LSBs of the destination register with the selected six bits of field information (field size and field extension). Bit 5 of the 6-bit quantity in Rd is exchanged with the field extension value. The upper 26 bits of Rd are cleared. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 876543210 N C Z V ft» p B X ft«tt I E F E 1 F81 F E FSO Status Register Status Bits Examples EXGF's F parameter is optional: F=0 selects FSO, FEO to be exchanged F=1 selects FS1, FE1 to be exchanged If you do not specify an F parameter, the default is 0. N Unaffected C Unaffected Z Unaffected V Unaffected Code EXGF A5,0 EXGF A5,l Before A5 FFFFFFCOh FFFFFFCOh ST FOOOOFFFh FOOOOFFFh After A5 0000003 Fh 0000003 Fh ST FOOOOFCOh F000003Fh 12-78 Exchange Program Counter EXGPC Syntax Execution Instruction Words Description Machine States Status Bits Examples EXGPC Rd Rd -> PC, PC - Rd 15 14 13 12 11 10 9 8 1 1 1 R Rd EXGPC exchanges the next program counter value with the destination re- gister contents. After this instruction has been executed, the destination register contains the address of the instruction immediately following the EXGPC instruction. Note that the TMS34010 sets the four LSBs of the program counter to (word aligned). This instruction provides a "quick call" capability by saving the return ad- dress in a register (rather than on the stack). The return from the call is accomplished by repeating the instruction at the end of the "subroutine." Note that the subroutine address must be reloaded following each call- return operation. 2,5 N Unaffected C Unaffected Z Unaffected V Unaffected Code EXGPC Al EXGPC Al Before Al 00001 C1 Oh 00001 C50h PC 00002080h 00002080h After Al 00002090h 00002090h PC 00001 C1 Oh 00001 C50h 12-79 FILL Fill Array with Processed Pixels - Linear Syntax Execution Instruction Words Description Implied Operands Destination Array FILL L C0L0R1 pixels pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 FILL processes a set of source pixel values (specified by the C0L0R1 reg- ister) with a destination pixel array. This instruction operates on a two-dimensional array of pixels using pixels defined in the COLOR1 register. As the FILL proceeds, the source pixels are combined with destination pixels based on the selected graphics oper- ations. Note that the L parameter in the instruction syntax does not represent a value or a register - the L is entered as part of the instruction and identifies the starting address of the pixel array as an L address. That is, the in- struction is entered as fill l. The following set of implied operands govern the operation of the in- struction and define both the source pixels and the destination array. B File Registers Register Name Format Description B2t DADDR Linear Pixel array starting address B3 DPTCH Linear Pixel array pitch B7 DYDX XY Pixel array dimensions (rowsxolumns) B9 COLOR1 Pixel Fill color or 16-bit pattern B10-B14T Reserved registers I/O Registers Address Name Description and Operations COOOOOBOh CONTROL PP- Pixel processing operations (22 options) T - Transparency operation C00001 50h PSIZE Pixel size (1,2,4,8,16) C00001 60h PMASK Plane mask - pixel format 1" Changed by FILL during execution. Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the FILL instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. The contents of the DADDR, DPTCH, and DYDX registers define the lo- cation of the destination pixel array. • At the outset of the instruction, DADDR contains the linear address of the pixel with the lowest address in the array. 12-80 Fill Array with Processed Pixels - Linear FILL During instruction execution, DADDR points to the next pixel (or word of pixels) to be modified in the destination array. When the ar- ray transfer is complete, DADDR points to the linear address of the pixel following the last pixel written. DPTCH contains the linear difference in the starting addresses of ad- jacent rows of the destination array. DPTCH must be a multiple of 16, except when a single pixel-width line is drawn (DY=1). In this case, DPTCH may be any value. DYDX specifies the dimensions of the destination array in pixels. The DY portion of DYDX contains the number of rows in the array, while the DX portion contains the number of columns. Pixel Processing Window Checking Set the PPOP field in the CONTROL register to select a pixel processing operation. This operation is applied to the pixel as it is moved to the des- tination location. There are 16 Boolean and 6 arithmetic operations; the default operation at reset is replace (S -* D). Note that the destination data is read through the plane mask and then processed. The 6 arithmetic op- erations do not operate with pixel sizes of one or two bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. Window checking cannot be used with this instruction. The contents of the WSTART and WEND registers are ignored. Corner Adjust There is no corner adjust for this instruction. The direction of the FILL is fixed as increasing linear addresses. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Interrupts This instruction can be interrupted at a word or row boundary of the desti- nation array. When the FILL is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on the stack. At this time, DPTCH and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modified after the interrupt is processed. Before executing the RETI instruction to return from the interrupt, restore any B-file registers that were modified (also restore the CONTROL register if it was modified). This allows the TMS34010 to resume the FILL cor- rectly. Plane Mask The plane mask is enabled for this instruction. Shift Register Transfers If the SRT bit in the DPYCTL register is set, each memory read or write in- itiated by the FILL generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers. (Not all VRAMs support this capability.) See Section 9.10.2, Video Memory Bulk Initialization, on page 9-28 for more information. Machine States See Section 13.3, FILL Instructions Timing. 12-81 FILL Fill Array with Processed Pixels - Linear Status Bits Examples Example 1 Example 2 Example 3 N Unaffected C Unaffected Z Unaffected V Unaffected These FILL examples use the following implied operand setup. I/O Registers: PSIZE = 0008h Register File B: DADDR (B2) = 0000201 Oh DPTCH (B3) = 00000080h DYDX (B7) = 0002000Dh COLOR1 (B9) = 30303030h Assume that memory contains the following values before instruction exe- cution. Linear Data Address 02000h 1100h, 3322h, 5544h, 7766h, 9988h, BBAAh,DDCCh, FFEEh 02080h 1100h, 3322h, 5544h, 7766h, 9988h, BBAAh,DDCCh, FFEEh This example uses the pixel processing replace (S -*■ D) operation. Before instruction execution, PMASK = OOOOh and CONTROL = OOOOh (T=0, PP=00000). After instruction execution, memory contains the following values: Linear Data Address 02000h 1100h, 3030h, 3030h, 3030h, 3030h, 3030h, 3030h, FF30h 02080h 1100h, 3030h, 3030h, 3030h, 3030h, 3030h, 3030h, FF30h This example uses the (S and D) -» D pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 2C00h (T=0, PP=01010). After instruction execution, memory contains the following values: Linear D ata Address 02000h 1100h, 0302h, 4544h, 4746h, 8988h, 8B8Ah, CDCCh,FFCEh 02080h 1100h, 0302h, 4544h, 4746h, 8988h, 8B8Ah, CDCCh,FFCEh This example uses transparency and the (S and D) -*' D pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 0420h (T=1, PP =00000). After instruction execution, memory contains the following values: Linear D ata Address 02000h 1 1 0Oh, 3020h, 1 044h, 3020h, 1 088h, 3020h, 1 0CCh, FF20h 02080h 1 1 0Oh, 3020h, 1 044h, 3020h, 1 088h, 3020h, 1 0CCh, FF20h 12-82 Fill Array with Processed Pixels - Linear FILL Example 4 This example uses plane masking - the four MSBs are masked. Before in- struction execution, PMASK = OFOFOh and CONTROL - OOOOh (T=0, PP-OOOOO). After instruction execution, memory contains the following values: Linear Data Address 02000h 1100h, 3020h, 5040h, 7060h, 9080h, BOAOh, DOCOh, FFEOh 02080h 1100h, 3020h, 5040h, 7060h, 9080h, BOAOh, DOCOh, FFEOh 12-83 FILL Fill Array with Processed Pixels - XY Syntax Execution Instruction Words Description Implied Operands FILL XY C0L0R1 pixels pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 1 FILL processes a set of source pixel values (specified by the C0L0R1 reg- ister) with a destination pixel array. This instruction operates on a two-dimensional array of pixels using pixels defined in the COLOR1 register. As the FILL proceeds, the source pixels are combined with destination pixels based on the selected graphics oper- ations. Note that the XY parameter in the instruction syntax does not represent a value or a register - it is entered as part of the instruction and identifies the starting address of the pixel array as an XY address. That is, the instruction is entered as fill l,xy. The following set of implied operands govern the operation of the in- struction and define both the source pixels and the destination array. B File Registers Register Name Format Description B2tt DADDR XY Pixel array starting address B3 DPTCH Linear Pixel array pitch B4 OFFSET Linear Screen origin (address of 0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner B7t* DYDX XY Pixel array dimensions (rowsxolumns) B9 COLOR1 Pixel Fill color or 16-bit pattern B10-B14t Reserved registers I/O Registers Address Name Description and Elements (Bits) COOOOOBOh CONTROL PP- Pixel processing operations (22 options) W -Window checking operation T -Transparency operation C0000140h CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C00001 60h PMASK Plane mask - pixel format t Changed by FILL during execution. t Used for common rectangle function with window hit operation (W=1 ). Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the FILL instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. 12-84 Fill Array with Processed Pixels - XY FILL Destination Array Pixel Processing Window Checking The location of the destination pixel array is defined by the contents of the DADDR, DPTCH, CONVDP, OFFSET, and DYDX registers. At the outset of the instruction, DADDR contains the XY address of the pixel with the lowest address in the array. It is used with OFFSET and CONVDP to cal- culate the linear address of the starting location of the array. DPTCH con- tains the linear difference in the starting addresses of adjacent rows of the destination array (typically this is the screen pitch). DPTCH must be a power of two (greater than or equal to 16) and CONVDP must be set to correspond to the DPTCH value. CONVDP is computed by operating on the DPTCH register with the LMO instruction; it is used for the XY calcu- lations involved in XY addressing and window clipping. DYDX specifies the dimensions of the destination array in pixels. The DY portion of DYDX contains the number of rows in the array, while the DX portion contains the number of columns. During instruction execution, DADDR points to the next pixel (or word of pixels) to be modified in the destination array. When the array transfer is complete, DADDR points to the linear address of the pixel following the last pixel written. This is that pixel on the last row that would have been written had the array transfer been wider in the X dimen- sion. Pixel processing can be used with this instruction. The PPOP field of the CONTROL register specifies the pixel processing operation that is applied to pixels as they are processed with the destination array. There are 1 6 Boolean and 6 arithmetic operations; the default case at reset is the rep/ace (S -* D) operation. Note that the destination data is read through the plane mask and then processed. The 6 arithmetic operations do not operate with pixel sizes of one or two bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. The window operations described in Section 7.10, Window Checking, on page 7-27. can be used with this instruction. You can select window pick, violation detect, or preclipping by setting the W bits in the CONTROL reg- ister to 1, 2, or 3, respectively. Window pick modifies the DADDR and DYDX registers to correspond to the common rectangle formed by the destination array and the clipping window defined by WSTART and WEND. DADDR is set to the XY address of the pixel with the lowest address in the common rectangle, while DYDX is set to the X and Y dimensions of the rectangle. If no window operations are selected, the WSTART and WEND registers are ignored. At reset, no window operations are enabled. Corner Adjust There is no corner adjust for this instruction. The direction of the FILL is fixed as increasing linear addresses. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Interrupts This instruction can be interrupted at a word or row boundary of the desti- nation array. When the FILL is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on At this time, DPTCH and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modified after the interrupt is processed. 12-85 FILL Fill Array with Processed Pixels - XY Before executing the RETI instruction to return from the interrupt, restore any B-file registers that were modified (also restore the CONTROL register if it was modified). This allows the TMS34010 to resume the FILL cor- rectly. Plane Mask The plane mask is enabled for this instruction. Shift Register Transfers Machine States Status Bits Examples Example 1 If the SRT bit in the DPYCTL register is set, each memory read or write in- itiated by the FILL generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers. (Not all VRAMs support this capability.) See Section 9.10.2, Video Memory Bulk Initialization, on page 9-28 for more information. See Section 13.3, FILL Instructions Timing. N Unaffected C Unaffected Z Unaffected V 1 if a window violation occurs, otherwise; unaffected if window clipping is not enabled These FILL examples use the following implied operand setup. Register File B. I/O Registers: DADDR (B2) - 00520007 h CONVDP =0017h DPTCH (B3) = 000001 OOh PSIZE = 0004h OFFSET (B4) = 0001 OOOOh PMASK - OOOOh WSTART (B5) - 0030000Ch CONTROL = OOOOh WEND (B6) = 0053001 4h (W=00, T DYDX (B7) - 0003001 2h COLOR1 (B9) = FFFFFFFFh ^O, PP=00000) Assume that memory contains the following values before instruction exe- cution. Linear Data Address 15200h 321 Oh, 7654h, BA98h, FEDCh,3210h, 7654h, BA98h, FEDCh 15300h 321 Oh, 7654h, BA98h, FEDCh, 321 Oh, 7654h, BA98h, FEDCh 15400h 321 Oh, 7654h, BA98h, FEDCh, 321 Oh, 7654h, BA98h, FEDCh This example uses the replace (S -* D) pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = OOOOh (T=0, W=00, PP =00000). After instruction execution, memory contains the following values: Linear Data Ad d ress 15200h 321 Oh, F654h, FFFFh, FFFFh, FFFFh, FFFFh, BA9Fh, FEDCh 15300h 321 Oh, F654h, FFFFh, FFFFh, FFFFh, FFFFh, BA9Fh, FEDCh 15400h 321 Oh, F654h, FFFFh, FFFFh, FFFFh, FFFFh, BA9Fh, FEDCh 12-86 Fill Array with Processed Pixels - XY FILL XY Addressing X Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 2 3 4 5 6 7 8 9 ABCDE F A d 52 0123456FFFFFFFFFFFFFFFFFF9ABCDEF d r 53 0123456FFFFFFFFFFFFFFFFFF9ABCDEF e s 54 0123456FFFFFFFFFFFFFFFFFF9ABCDEF s Example 2 This example uses the (D XOR S) -*■ D pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 2800h (T=0, W=00, PP=01010). After instruction execution, memory contains the following values: X Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 52 01 2345687654321 0FEDCBA9879ABCDEF d r 53 01 2345687654321 0FEDCBA9879ABCDEF e s 54 01 2345687654321 0FEDCBA9879ABCDEF s Example 3 This example uses transparency, the (D subs S) -* D pixel processing op- eration. Before instruction execution, COLOR1 = 88888888h, PMASK = OOOOh, and CONTROL - 4C20h (T=1, W=00, PP=10011). After instruction execution, memory contains the following values: v Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 52 01 23456781 23456701 23456789ABCDEF d r 53 01 23456781 23456701 23456789ABCDEF e s 54 01 23456781 23456701 23456789ABCDEF s 12-87 FILL Fill Array with Processed Pixels - XY Example 4 This example uses window operation 3 - the destination is clipped. Before instruction execution, PMASK - OOOOh and CONTROL = OOCOh (T=0, W=11, PP=00000). After instruction execution, memory contains the following values Y X Address 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF d 52 0123456789ABFFFFFFFFF56789ABCDEF d r 53 0123456789ABFFFFFFFFF56789ABCDEF s 54 01 23456789ABCDEF01 23456789ABCDEF s Example 5 This example uses plane masking - the most significant bit is masked. Be- fore instruction execution, PMASK = 8888h and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: X Ad dross Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 52 01234567FFFFFFFF77777777F9ABCDEF d r 53 01234567FFFFFFFF77777777F9ABCDEF s 54 01 234567FFFFFFFF77777777F9ABCDEF 12-88 Get Program Counter into Register GETPC Syntax Execution Instruction Words Description GETPC Rd PC - Rd 15 14 13 12 11 10 9 8 1 1 1 Rd GETPC increments the PC contents by 16 to point past the GETPC in- struction, and copies the value into the destination register. Execution continues with the next instruction. You can use GETPC with the EXGPC and JUMP instructions for quick call on jump operations. You can also use GETPC to access relocatable data areas whose position relative to the code area is known at assembly time. Machine States 1,4 Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples Code Before After GETPC Al GETPC Al PC 00001 BDOh 00001 C1 Oh A1 00001 BEOh 00001 C20h 12-89 GETST Get Status Register into Register Syntax Execution Instruction Words Description Machine States Status Bits Examples GETST Rd ST -* Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00000001 1 00 R Rd GETST copies the contents of the status register into the destination regis- ter. 31302928272625242322212019 18 17 16 15 14 13 12 1110 9 876543210 N C z V Rn P B X ftes I E -f!tt#lftKt F E 1 P61 F E FSO 1,4 N Unaffected C Unaffected Z Unaffected V Unaffected Code GETST Al GETST Al Status Register Before PC 2020001 Oh 0000001 Oh After Al 2020001 Oh 0000001 Oh 12-90 Increment Register INC Syntax Execution Instruction Words Description Machine States Status Bits Examples INC Rd Rd + 1 -* Rd 15 14 13 12 11 10 9 8 1 1 1 Rd INC adds 1 to the contents of the destination register and stores the result in the destination register. This instruction is an alternate mnemonic for ADDK l,Rd. You can accomplish multiple-precision arithmetic by using INC in con- junction with the ADDC instruction. 1,4 N 7 if the result is negative, otherwise C 7 if there is a carry, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Code Before After Al Al NCZV INC Al OOOOOOOOh 00000001 h 0000 INC Al OOOOOOOFh 0000001 Oh 0000 INC Al FFFFFFFFh OOOOOOOOh 0110 INC Al FFFFFFFEh FFFFFFFFh 1000 INC Al 7FFFFFFFh 80000000h 1001 12-91 J Ace Jump Absolute Conditional Syntax Execution Instruction Words Fields Description JAcc Address If condition true, then Address -» PC If condition false, then go to next instruction 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 code 1 16 LSBs of Address 16 MSBs of Address code is a 4-bit digit that identifies the condition for the jump within the opcode. (See the condition codes table below.) The JAcc instruction conditionally jumps to an absolute address. The cc is part of a mnemonic that represents the condition for the jump; for exam- ple, if cc is UC, then the instruction is JAUC. (See the condition mne- monics and codes listed below.) If the specified condition is true, the TMS34010 jumps to the address and continues execution from that point. If the specified condition is false, the TMS3401 skips the jump and con- tinues execution at the next sequential instruction. Note that the lower four bits of the program counter are set to (word aligned). The Address operand in the syntax represents the 32-bit absolute address. Note that the second and third instruction words contain the address for the jump. The JAcc instructions are usually used in conjunction with the CMP and CMPI instructions. The JAV and JANV instructions can also be used to detect window violations or CPW status. Condition Codes Mnemonic Result of Compare Status Bits Code Unconditional Compares JAUC - Unconditional don't care 0000 Unsigned Compares JALO (JAC) JALS JAHI JAHS (JANC) JAEQ (JAZ) JANE (JANZ) JAYLE JAYGT Dst lower than Src Dst lower or same as Src Dst higher than Src Dst higher or same as Src Dst = Src Dst * Src C C + Z C" • Z C z z 0001 0010 0011 1001 1010 1011 Signed Compares JALT JALE JAGT JAGE JAEQ (JAZ) JANE (JANZ) JAXLE JAXGT Dst < Src Dst ^ Src Dst > Src Dst > Src Dst = Src Dst * Src (N • V) + ( N • V) (N • V + (N • V) + Z (N • V • Z) + ( N • V • Z) (N • V) + (N • V) Z z 0100 0110 0111 0101 1010 1011 Compare to Zero JAZ JANZ JAP JAN JANN JAYZ JAYNZ JAXZ JAXNZ Result = zero Result # zero Result is positive Result is negative Result is nonnegative z z N • Z N N 0101 1011 0001 1110 1111 12-92 Jump Absolute Conditional J Ace Condition Codes (continued) Mnemonic Result of Compare Status Bits Code General JAZ JAYZ Result is zero Z 1010 Arithmetic JANZ JAYNZ Result is nonzero Z 1011 JAC JAYN Carry set on result c 1000 JANC JAYNN No carry on result c 1001 JAB - Borrow set on result c 1000 (JAC) JANB - No borrow on result c 1001 (JANC) JAVt JAXN Overflow on result V 1100 JANVt JAXNN No overflow on result V 1101 Note: A mnemonic code in parentheses is an alternate code for the preceding code. t Also used for window clipping + Logical OR • Logical AND Logical NOT Machine States 3,6 (J ump) 4,7 (No jump) Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples Code Flaas for Branch Code Flaas for Branch NCZV NCZV NCZV NCZV NCZV IMCZ^ JAUC HERE xxxx JAV HERE xxxl JAP HERE Ox Ox JANZ HERE xxOx JALS HERE xx1 X x1 XX JANN HERE Oxxx JAHI HERE xOOx JANV HERE xxxO JALT HERE 0xx1 1xx0 JAN HERE 1 XXX JAGE HERE OxxO 1xx1 JAB HERE xlxx JALE HERE 0xx1 1xx0 xx1 X JANB HERE xOxx JAGT HERE 0x00 1x01 JALO HERE xlxx JAC HERE x1 XX JAHS HERE xOOx xxlx JANC HERE xOxx JANE HERE xxOx JAZ HERE xx1 X JAEQ HERE xx1 X Note that the TMS34010 jumps when any one or more of the Flags for Branch listed above are set as indicated. 12-93 JRcc Jump Relative Conditional - ±127 Words Syntax Execution Instruction Words Fields Description Condition JRcc Address If condition true, then offset + PC -»• PC If condition false, then go to next instruction 15 14 13 12 11 10 9 8 1 110 code offset code is a 4-bit digit that identifies the condition for the jump within the opcode. (See the condition codes table below.) The J Rcc instruction conditionally jumps to an address that is relative to the current PC. The cc is part of a mnemonic that represents the condition for the jump; for example, if cc is UC, then the instruction is JAUC. (See the condition mnemonics and codes listed below.) If the specified condition is true, the TMS3401 jumps to a new location. The assembler calculates the address of this location by adding the address of the next instruction (PC) to the signed word offset. The TMS3401 then continues execution from this point. If the specified condition is false, the TMS3401 skip the jump and continues execution at the next sequential instruction. The Address operand in the syntax represents the 32-bit relative address. The assembler calculates the offset as (Address - PC')/16 and inserts the resulting 8-bit offset into the opcode. The range for this form of the JRcc instruction is ±127 words (excluding 0). If the offset is outside the range of ±127 words, the assembler automat- ically substitutes the longer form of the JRcc instruction. If the offset is 0, the assembler substitutes a NOP instruction. The assembler does not ac- cept an address which is externally defined or an address which is relative to a different section than the PC. Note that the four LSBs of the program counter are always (word aligned). The JRcc instructions are usually used in conjunction with the CMP and CMPI instructions. The JRV and JRNV instructions can also be used to detect window violations or CPW status. Codes Mnemonic Result of Compare Status Bits Code Unconditional Compares JRUC - Unconditional don't care 0000 Unsigned Compares JRLO (JRC) JRLS JRHI JRHS (JRNC) JREQ (JRZ) JRNE (JRNZ) JRYLE JRYGT Dst lower than Src Dst lower or same as Src Dst higher than Src Dst higher or same as Src Dst = Src Dst * Src C C + Z C • Z C z z 0001 0010 0011 1001 1010 1011 12-94 Jump Relative Conditional - ±127 Words JRcc Condition Codes (continued) Mnemonic Result of Compare Status Bits Code Signed Compares JRLT JRLE JRGT JRGE JREQ (JRZ) JRNE (JRNZ) JRXLE JRXGT Dst < Src Dst < Src Dst > Src Dst > Src Dst = Src Dst * Src (N • V) + ( N • V) (N • V + (N • V) + Z (N • V • Z) + ( N • V • Z) (N • V) + (N • V) Z z 0100 0110 0111 0101 1010 1011 Compare to Zero JRZ JRNZ JRP JRN JRNN JRYZ JRYNZ JRXZ JRXNZ Result = zero Result ^ zero Result is positive Result is negative Result is nonnegative z z N • Z N N 0101 1011 0001 1110 1111 Genera/ Arithmetic JRZ JRNZ JRC JRNC JRB (JRC) JRNB (JRNC) JRVt JRNVt JRYZ JRYNZ JRYN JRYNN JRXN JRXNN Result is zero Result is nonzero Carry set on result No carry on result Borrow set on result No borrow on result Overflow on result No overflow on result Z Z c c c c V V 1010 1011 1000 1001 1000 1001 1100 1101 Note: A mnemonic code in parentheses is an alternate code for the preceding code, t Also used for window clipping + Logical OR _^ Logical AND Logical NOT Machine States 2,5 (Jump) 1,4 (No jump) Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples Code Flaqs for Branch Code Flaqs for Branch NCZV NCZV NCZV NCZV NCZV NCZV JRUC HERE xxxx JRC HERE xlxx JRP HERE OxOx JRNC HERE xOxx JRLS HERE xxlx x1 XX JRZ HERE xxlx JRHI HERE xOOx JRNZ HERE xxOx JRLT HERE 0xx1 1xx0 JRV HERE xxxl JRGE HERE OxxO 1xx1 JRNV HERE xxxO JRLE HERE 0xx1 1xx0 xxlx JRN HERE 1xxx JRGT HERE 0x00 1x01 JRNN HERE Oxxx Note that the TMS34010 jumps when any one or more of the Flags for Branch listed above are set as indicated. 12-95 JRcc Jump Relative Conditional - ±32K Words Syntax Execution Instruction Words Fields Description JRcc Address If condition true, then offset + PC -» PC If condition false, then go to next instruction 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 code offset code is a 4-bit digit that identifies the condition for the jump within the opcode. (See the condition codes table below.) The JRcc instruction conditionally jumps to an address that is relative to the current PC. The cc is part of a mnemonic that represents the condition for the jump; for example, if cc is UC, then the instruction is JAUC. (See the condition mnemonics and codes listed below.) If the specified condition is true, the TMS34010 jumps to a new location. The assembler calculates the address of this location by adding the address of the next instruction (PC) to the signed word offset. The TMS34010 then continues execution from this point. If the specified condition is false, the TMS3401 skips the jump and continues execution at the next sequential instruction. The Address operand in the syntax represents the 32-bit relative address. The assembler calculates the offset as (Address - PC)/16 and inserts the resulting offset into the second instruction word of the opcode. The range for this form of the JRcc instruction is -32,768 to +32,767 words (ex- cluding 0). If the offset is 0, the assembler substitutes a NOP instruction. If the address is out of range, the assembler uses the JAcc instruction instead. The as- sembler does not accept an address which is externally defined or an ad- dress which is relative to a different section than the PC. Note that the four LSBs of the program counter are always (word aligned). The JRcc instructions are usually used in conjunction with the CMP and CM PI instructions. The JRV and JRNV instructions can also be used to detect window violations or CPW status. Condition Codes Mnemonic Result of Compare Status Bits Code Unconditional Compares JRUC — Unconditional don't care 0000 Unsigned Compares JRLO (JRC) JRLS JRHI JRHS (JRNC) JREQ (JRZ) JRNE (JRNZ) JRYLE JRYGT Dst lower than Src Dst lower or same as Src Dst higher than Src Dst higher or same as Src Dst = Src Dst * Src C C + Z C • Z C Z Z 0001 0010 0011 1001 1010 1011 12-96 Jump Relative Conditional - ±32K Words JRcc Condition Codes (continued) Mnemonic Result of Compare Status Bits Code Signed JRLT JRXLE Dst < Src (N • V) + ( N • V) 0100 Compares JRLE - Dst <, Src (N • V + (N • V) + Z 0110 JRGT - Dst > Src (N • V • Z) + ( N • V • Z) 0111 JRGE JRXGT Dst > Src (N • V) + (N • V) 0101 JREQ - Dst = Src Z 1010 (JRZ) JRNE - Dst * Src z 1011 (JRNZ) Compare to JRZ JRYZ Result = zero z 0101 Zero JRNZ JRYNZ Result ^ zero z 1011 JRP - Result is positive N • Z 0001 JRN JRXZ Result is negative N 1110 JRNN JRXNZ Result is nonnegative N 1111 General JRZ JRYZ Result is zero Z 1010 Arithmetic JRNZ JRYNZ Result is nonzero z 1011 JRC JRYN Carry set on result c 1000 JRNC JRYNN No carry on result c 1001 JRB - Borrow set on result c 1000 (JRC) JRNB - No borrow on result c 1001 (JRNC) JRVt JRXN Overflow on result V 1100 JRNVt JRXNN No overflow on result V 1101 Note: A mnemonic code in parentheses is an alternate code for the preceding code. t Also used for window clipping + Logical OR ^ Logical AND Logical NOT Machine States 3,6 (J ump) 4,7 (No jump) Status Bits N U n affected C Unaffected Z U n affected V Unaffected Examples Code Flaqs for Branch Code Flaqs for Branch NCZV NCZV NCZV NCZV NCZV NCZ^ JRUC HERE xxxx JRV HERE xxxl JRP HERE OxOx JRNZ HERE xxOx JRLS HERE xxlx xlxx JRNN HERE Oxxx JRHI HERE xOOx JRNV HERE xxxO JRLT HERE 0xx1 1xx0 JRN HERE 1xxx JRGE HERE OxxO 1xx1 JRB HERE xlxx JRLE HERE 0xx1 1xx0 xxlx JRNB HERE xOxx JRGT HERE 0x00 1x01 JRLO HERE xlxx JRC HERE xlxx JRHS HERE xOOx xxlx JRNC HERE xOxx JRNE HERE xxOx JRZ HERE xxlx JREQ HERE xxlx Note that the TMS34010 jumps when any one or more of the Flags for Branch listed above are set as indicated. 12-97 JUMP Jump Indirect Syntax Execution Instruction Words Description Machine States Status Bits Examples JUMP Rs Rs - PC 15 14 13 12 11 10 9 8 000000 1 01 1 R Rs JUMP jumps to the address contained in the source register. The TMS34010 sets the four LSBs of the program counter to (word aligned). This instruction can be used in conjunction with the GETPC and/or EXGPC instructions. 2,5 N Unaffected C Unaffected Z Unaffected V Unaffected Code JUMP Al JUMP Al JUMP Al Before A1 00001 EEOh 00001 EE5h FFFFFFFFh PC 00555550h 00555550h 00555550h After PC 00001 EEOh 00001 EEOh FFFFFFFOh 12-98 Line Draw with XY Addressing LINE Syntax Execution Instruction Words Fields Description LINE {0, 1} The two execution algorithms for the LINE instruction are explained below. These algorithms are similar, varying only in their treatment of d-0. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 1 Z 1 1 1 The assembler sets bit 7 in the instruction word (the Z bit) to or 1 , de- pending on which LINE algorithm you select: Z=0 selects algorithm Z=1 selects algorithm 1 LINE performs the inner loop of Bresenham's line-drawing algorithm. This type of line draw plots a series of points (xj,yj) either diagonally or laterally with respect to the previous point. Movement from pixel to pixel always proceeds in a dominant lateral direction. The algorithm may or may not also increment in the direction with the smaller dimension (this produces a di- agonal movement). Two XY-format registers supply the XY increment val- ues for the two possible movements. The LINE instruction maintains a decision variable, d, that acts as an error term, controlling movement in ei- ther the dominant or diagonal direction. The algorithm operates in one of two modes, depending on how the condition d=0 is treated. During LINE execution, some portion of a line [(xo,yo)( x l/Yl)] is drawn. The line is drawn so that the axis with the largest extent has dimension a and the axis with the least extent has dimension b. Thus, a is the larger (in absolute terms) of yi - yn or x-| - xq and b is the smaller of the two. This means that a >_b >_0. The following values must be supplied to draw a line from (xrj,yo) to (xi,yi): 1) Set the XY pointer (x„yj) in the DADDR register to the initial value of (x ,yo)- 2) Use the line endpoints to determine the major and minor dimensions (a and b, respectively) for the line draw; then set the DYDX register to this value \b:a). 3) Place the signed XY increment for a movement in the diagonal (or minor) direction (d >_ for Z=0, d > for Z=1) in the INC1 register. 4) Place the signed XY increment for a movement in the dominant (or major) direction (d < for Z=0, d < for Z=1 ) in the INC2 register. 5) Set the initial value of the decision variable in register BO to 2b - a. 6) Set the initial count value in the COUNT register to a + 1 . 7) Set the LINE color in the COLOR1 register. 8) Set the PATTRN register to all 1s. 12-99 LINE Line Draw with XY Addressing The LINE instruction may use one of two algorithms, depending on the value of Z: Algorithm (Z=0): While COUNT > COUNT = COUNT - 1 Draw the next pixel If d> d = d + 2b-2a POINTER = POINTER + INC1 Else d = d + 2b; POINTER = POINTER + INC2 Algorithm 1 (Z=1): While COUNT > COUNT = COUNT - 1 Draw the next pixel If d > d = d + 2b - 2a POINTER = POINTER + INC1 Else d = d + 2b; POINTER = POINTER + INC2 LINE 1 is commonly used to draw lines with decreasing y values; LINE is used to draw lines with increasing y values. For horizontal lines, use FILL or LINE 0. Implied Operands B File Registers Register Name Format Description BOt SADDR Integer Decision variable, d B2t DADDR XY Starting point (vj:xj), usually (yn:xo) B4 OFFSET Linear Screen origin (0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner B7 DYDX XY b:a minormajor line dimensions B9 COLOR1 Pixel Pixel color to be replicated B10t COUNT Integer Loop count B11 INC1 XY Minor axis (diagonal) increment, INC1 B12 INC2 XY Major axis (dominant) increment, INC2 B13t PATTRN Pattern Future pattern register, must be set to all 1s B14 TEMP - Temporary register I/O Registers Address Name Description and Elements (Bits) COOOOOBOh CONTROL PP- Pixel processing operations W -Window clipping operation T -Transparency operation C00001 40h CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C00001 60h PMASK Plane mask - pixel format t These registers are changed by instruction execution 12-100 Line Draw with XY Addressing LINE Pixel Processing Window Checking Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the LINE instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. The PP field in the CONTROL I/O register specifies the operation to be applied to the pixel as it is written. There are 22 operations; the default case at reset is the pixel processing replace (S -»■ D) operation. For more infor- mation, see Section 7.7, Pixel Processing, on page 7-1 5. Window clipping or pick is selected by setting the W bits in the CONTROL I/O register to the appropriate value. The WSTART and WEND registers define the window in XY-coordinate space. Options include: No window clipping. LINE draws the entire line. Neither the WVP or V bit are affected. WSTART and WEND are ignored. 1 Window hit. The instruction calculates points but no pixels are actually drawn. As soon as the pixel to be drawn lies inside the window, the WVP bit is set, the V bit is cleared, and the instruction is aborted. At this point, registers BO, B2, B10, B13, and B14 are set so as to draw the next pixel in the line; BO is set to the value for the pixel beyond the next pixel on the line. If the line lies entirely outside the window, then the WVP bit is not affected, the V bit in the status is set, and the in- struction completes execution. 2 Clip and set WVP. LINE draws pixels until the pixel to be drawn lies outside the window. At this point, the WVP bit is set, the V bit is set, and the instruction is aborted. At this point, registers BO, B2, B10, B13, and B1 4 are set so as to draw the next pixel in the line; BO is set to the value for the pixel beyond the next pixel on the line. If the entire line lies within the window, then the WVP bit is not affected, the V bit is cleared and the instruction completes execution. The initial value of WVP does not affect instruction execution. 3 Clip. LINE calculates all the points, but only draws the points that lie inside the window. The V bit tracks the state of the last pixel. If the pixel was outside the window, V is set to 1; otherwise, it is 0. The in- struction traverses the entire line. The default case at reset is no window clipping. Section 7.10, Window Checking, on page 7-25. For more information, see Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1 . The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. Interrupts LINE may be interrupted after every pixel in the line draw except for the last pixel. If the instruction is interrupted, the PC is decremented by 1 6 to point back to the LINE instruction (the one being executed) before the PC is 12-101 LINE Line Draw with XY Addressing Machine States pushed on the stack. Thus, the LINE instruction is resumed upon return from the interrupt. In order for the LINE to be resumed correctly, any B-file registers that are modified by the interrupting routine must be restored, and the RETI instruction must be executed. Note that a LINE instruction that is aborted because of window checking options 1 or 2 does not decrement the PC before pushing it on the stack. In this case, the LINE is not resumed after returning from the interrupt service routine. The total LINE instruction timing is obtained by adding a setup time to a transfer time: LINE time = LINE setup time + LINE transfer time • LINE setup time is the overhead incurred from initiating the LINE instruction. The setup sequence executes an initialization sequence, performing any necessary setup operations and translations. The setup time is always 4 machine states. • The transfer sequence performs the actual data transfer from the source register to the destination pixels. Table 12-10 shows LINE transfer timing. LINE transfer timing may be influenced by window and pixel processing operations; their affects are discussed in the list that follows Table 12-10. Table 12-10. LINE Transfer Timing Window Option Instruction W=0 (Off) W=1 Window Hit W=2, Interrupt On Clip W=3 Clipping LINEO (3+P)E 5<7 + 5 (3+ P)£t (3+ P)E + 5<7 LINE1 (3+P)E 5q + 5 (3+ P)£t (3+ P)E + 5q t Add 5 for a window violation Key: E Number of pixels written q Number of pixels calculated, but not written P Selected pixel processing operation Although window operations affect the setup time of most instructions, they are performed during transfer execution of the LINE instruction, af- fecting it on a per-pixel basis. Window operations that affect the LINE in- struction include: • No window checking • Window clip: V flag set, LINE aborted on first write outside window • Window hit: WVP flag set, V flag cleared, abort LINE on first write inside window Pixel processing operations influence the LINE transfer timing. (The effects of other graphics operations, such as plane masking and transparency, are already included.) Pixel processing consumes 2, 4, 5, or 6 machine states per pixel, depending on the operation selected. Table 12-11 shows the effects of pixel processing on LINE timing. 12-102 Line Draw with XY Addressing LINE Table 12-11. Per-Word Timing Values for Pixel Processing (P) Replace Other Booleans or ADD ADDS.SUBS MAX or MIN SUBS 2 4 5 6 Figure 12-11 illustrates timing for a LINE 0, drawing a line from (3h,52h) to (19h,55h). ************************************************** * Implied op erand setup for LINE example (assume * * that B reg ister and I/O re gister names are * * equated with the proper re gisters) * ************************************************** MOVI OFFFFFFFOh, BO ; Decision variable d=2b-a=-16 MOVI 00520003h, B2 ; DADDR MOVI 00000800h, B3 ; DPTCH (CONVDP=14) MOVI OOOOOlOOh, B4 ; OFFSET MOVI 00300003h, B5 ; WSTART MOVI 00550025h, B6 ; WEND MOVI 00030016h, B7 ; b:a; b=3 and a=22 MOVI 44444444h, B9 ; COLOR1 (color of the line) MOVI 00000017h, BIO ; COUNT (a+1) MOVI OOOlOOOlh, Bll ; Diagonal increment (+1,+1) MOVI OOOOOOOlh, B12 ; Nondiagonal increment (0,+l) MOVI OFFFFFFFFh, B13 ; PATTRN (all Is) MOVI OOCOh, AO MOVE AO , @CONTROL ; W=3, T=0, PP=0, CLR AO MOVE AO, @PMASK ; No plane masking Figure 12-11. Implied Operand Setup for LINE Timing Example 51 5?" 53 54L 55.. 5.6.. I0J1 12 [314 j5i6i7j8i9[AjB!CiDiEiFi10i11j12h3i14i15jie!l7i18j ;•:•■•••: 19j1Ai :•:•:•:• Figure 12-12. LINE Timing Example Follow these steps to determine the number of machine states consumed by this LINE example: 1 ) The setup time for a LINE instruction is always 4 machine states. 2) Determine the transfer time. Transfer time comprehends window- ing, the number of pixels drawn, and graphics operations. a) Windowing: is on for this LINE instruction; as Table 12-10 shows, the transfer timing is (3+P)E + 5Q. b) Graphics operations: The pixel processing rep/ace operation has been selected; according to Table 12-11, P=2. 12-103 LINE Line Draw with XY Addressing c) Number of pixels drawn: Register B10 indicates the total num- ber of pixels in the line (23). Since the line fits within the win- dow, all pixels calculated are drawn; thus, £ = 23 and Q=0. The total machine states required for this instruction are: LINE time = LINE setup time + LINE transfer time = 4 + (3+P)E + 5Q = 4 + (3+2) x 23 + = 119 states 119 states are needed to draw these 23 pixels. The LINE instruction may be interrupted on any pixel boundary during the transfer portion of the algorithm. The context of the LINE is saved in re- served registers; the PC is decremented before it is pushed on the stack, so that execution returns to the LINE opcode. This operation takes 20 ma- chine states for the interrupt to be recognized. The time for the context switch must be added; see the TRAP instruction for context switch timing. Status Bits N Undefined C Undefined Z Undefined V Set depending upon window operation. 12-104 Line Draw with XY Addressing LINE Lined raw Code The following code segment shows setup and execution of the LINE in- struction. ************************************************************* * Draw a line from point (xs,ys) to point (xe,ye) using Bresenham's * * algorithm. When —draw— line is called, xs is in the 16 LSBs of B2 , * * ys is in the 16 MSBs of B2 , xe is in the 16 LSBs of BO, and ye is * * in the 16 MSBs of BO . * ********************************************************************* —draw— line : global —draw— line SUBXY B2, BO Calculate a and b * Now set up B7 = (a,b) and Bll = (dx— diag,dy— diag) . Assume that * a < and b < 0; if a >= or b >= 0, make corrections later. * Register Bll (INC1) contains dy— diag: : dx_diag * Register B12 (INC2) contains dy_ nondiag: : dx— nondiag ; dx— diag = dy— diag' - 1 ; Constant = 1 ; B7 = (-a,-b) ; Jump if b < ; Make a in B7 positive ; Change dy_diag to +1 ; Jump if a < MOVI -1, Bll MOVK 1, B12 CLR B7 SUBXY BO, B7 JRNC LI * Handle case wher e b >= MOVY BO, B7 SRL 15, Bll LI: JRNV L2 * Handle case where a >= 0: MOVX BO, B7 MOVX B12, Bll L2: MOVX Bll, B12 * Compare magnitudes of a and b MOVE B7, BO SRL 16, BO CMPXY BO, B7 JRNV L3 Take absolute value of a Change dx_ diag to +1 dx_nondiag=dx_ diag, dy_nondiag=0 Copy a and b Move b into 16 LSBs Compare a and b Jump if a >= b * Handle case where a < b; must swap a and b so that a >= b: MOVX B7, BO ; Copy b into BO RL 16, B7 ; Swap a and b halves of B7 CLR B12 MOVY Bll, B 12 ; dx_ nondiag=0 , dy— nondiag=dy— diag * Calculate initial values of decision variable (d) and * loop counter : L3: ADD MOVX SUB ADDK BO, BO B7, BIO BIO, BO 1, BIO BO = 2 x b BIO = a BO = d (2 x Loop count = b - a) a + 1 (in BIO] * Draw line and return to caller LINE RETS Inner loop of line algorithm Return to caller 12-105 BO = FFFFFFFIh B2 = 00520003h B3 = 00000800h B4 = 000001 OOh B5 = 00300003h B6 = 00550025h B7 = 0003001 6h B9 = 44444444h B10 = 0000001 7h B11 = 0001 0001 h B12 = 00000001 h B13 = FFFFFFFFh LINE Line Draw with XY Addressing Example 1 This example draws a line from (3,52) to (1 9,55). Window checking is off, transparency and the pixel processing replace operation are selected, and plane masking is disabled. Assume the following registers have been loaded with these values: Decision variable d = 2b - a = -15 DADDR DPTCH (CONVDP=13) OFFSET WSTART WEND b:a;b=3 and a =22 COLOR1 (color of the line) COUNT (a + 1) Diagonal increment ( + 1, + 1) Nondiagonal increment (0,+1) PATTRN (all 1s) This line is shown in Figure 1 2-1 3, represented by •s. Before LINE execution, DADDR contains the first pixel to be drawn. During LINE execution, DADDR is updated so that it always points to the next pixel to be drawn. After this example is completed, DADDR equals 0055001 Ah. Register B7 contains the X and Y dimensions of the line. Register B10 indicates the number of pixels that are drawn; if you want the endpoint to be drawn (in this case, (1 9,55)), B1 should equal a + 1 . B11 contains the XY increment for diagonal moves. You can see the line progressing in a diagonal direction when it moves from (6,52) to (7,53); it is incremented by 1 in both the X and the Y dimensions. B1 2 contains the XY increment for nondiagonal moves. You can see the line progressing in a nondiagonal direction when it moves from (3,52) to (4,52); it is incre- mented by 1 in the X dimension. i0;1!2i3i4i5i6;7i8i9iAiBiCiDiEiFi10i11i1213i14rl5i16i17i18i1S1Ai 51 ""]""T"'T""i rTTTl'Tl'TT7T7T7Tl'TT7TTl'T'1 53 1....LJ L.I....L.J L»l»i«i».L»i.»!.»; iXiXiXiXiXiXiXi....! L.L.1.J L b=3 54. L..U {....Li...! iX]XiXLX.!XiXiXLXL-i-i»L»L»L«!.»L...i L.L..U f D ^ 55 1....LJ ix.IXiXjX.LLLJ LL.L..J L.L.L..L..J LLlTJ • .i«i*i.J ) 56 1....L...L..J....I....L.J L.L.LJ L.L.LJ L.i...i....L.i !._!...!...{ L.1....1..J a=22 Figure 12-13. LINE Examples 12-106 Line Draw with XY Addressing LINE Example 2 This example draws a line from (19,52) to (3,55). Window checking is off, transparency and the pixel processing replace operation are selected, and plane masking is disabled. Assume the following registers have been loaded with these values: -15 BO = FFFFFFFIh Decision variable d = lb - a - B2 = 0052001 9h DADDR B3 = 00000800h DPTCH (CONVDP-13) B4 = 000001 OOh OFFSET B5 = 00300003h WSTART B6 = 00550025h WEND B7 = 0003001 6 h b:a; b=3 and a=22 B9 = 22222222h COLOR1 (color of the line) B10 = 0000001 7 h COUNT (a+1) B11 = 0001FFFFh Diagonal increment ( + 1,-1) B12 = OOOOFFFFh Nondiagonal increment (0,-1) B13 = FFFFFFFFh PATTRN (all 1s) This line is shown in Figure 12-13, represented by Xs. Before LINE execution, DADDR contains the first pixel to be drawn. During LINE execution, DADDR is updated so that it always points to the next pixel to be drawn. After this example is completed, DADDR equals 00550002h. Register B7 contains the X and Y dimensions of the line. Register B10 indicates the number of pixels that are drawn; if you want the endpoint to be drawn (in this case, (3,55)), B10 should equal a+1. B11 contains the XY increment for diagonal moves. You can see the line progressing in a diagonal direction when it moves from (F,53) to (E,54); it is decremented by 1 in the X dimension and incremented by 1 in the Y di- mension. B12 contains the XY increment for nondiagonal moves. You can see the line progressing in a nondiagonal direction when it moves from (14,53) to (13,53); it is decremented by 1 in the X dimension. 12-107 LMO Find Leftmost One Syntax Execution Instruction Words Description LMO Rs.Rd 31 - (bit number of leftmost 1 in Rs) -*■ Rd 15 14 13 12 11 10 9 8 7 6 1 110 10 1 Rs R Rd LMO locates the leftmost (most significant) 1 in the source register. It then loads the 1s complement of the bit number of the leftmost-1 bit into the five LSBs of the destination register. The 27 MSBs of the destination reg- ister are loaded with 0s. Bit 31 of Rs is the MSB (leftmost) and bit is the LSB. If the source register contains all 0s, then the destination register is loaded with all 0s and status bit Z is set. You can normalize the contents of the source register by following the LMO instruction with an RL Rs.Rd instruction, where Rs is the destination reg- ister of the LMO instruction and Rd is the source register. Rs and Rd must be in the same register file. Machine States 1,4 Status Bits N Unaffected C Unaffected Z 7 if the source register contents are 0, otherwise V Unaffected Examples Code Before After AO NCZV A1 LMO A0,A1 OOOOOOOOh xxlx OOOOOOOOh LMO A0,A1 00000001 h xxOx 0000001 Fh LMO A0,A1 0000001 Oh xxOx 0000001 Bh LMO A0,A1 08000000h xxOx 00000004h LMO A0,A1 80000000h xxOx OOOOOOOOh 12-108 Move Multiple Registers from Memory MMFM Syntax Execution Instruct/on Words Description MMFM Rp, register list For each register R/7 in the register list, 32 bits of data at the address specified in Rp Rp + 32 -»■ Rp Rn 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 R Rs binary representation of the register list MMFM loads the contents of a specified list of either A or B file registers (not both) from a block of memory. • The Rp operand is a register that points to the first location in the block of memory. • The register list is a list of registers separated by commas (such as A0, A1, A9). These are the registers that MMFM loads new values into. The MMTM and MMFM instructions are "stack" instructions for storing multiple registers in memory and then retrieving their values. Both in- structions use Rp as a "stack pointer" that contains the bit address of the top of the stack. The stack grows toward lower addresses so that the bot- tom of the stack is the highest address in the stack. MMTM stores the re- gisters in memory. MMFM reverses the action of the MMTM instruction by "popping" register values from memory. At the outset of the MMFM instruction, Rp must contain the address of the 16 LSBs of the highest or- der register in the list. The LSW is moved into the register, and then the contents of the next consecutive word are moved into the MSW of the re- gister. After a register is "popped", the contents of Rp are incremented by 32 to point to the address of the LSW of the next register to be restored. Rp and the registers in the list must all be in the same register file. The re- gisters in the list can be specified in any order; the highest order register is always restored first (that is, the value at the top of the stack - the lowest address in the stack - is loaded into the highest order register). Don't in- clude Rp as one of the registers in the register list, because this produces unpredictable results. The original contents of Rp should be aligned on a word-boundary; the alignment of Rp affects the instruction timing as indi- cated in Machine States, below. The second word of the MMFM instruction is a binary-mask representation of the registers in the list. The R bit (bit 4) in the first word indicates which register file is affected; the bits that are set to 1 in the mask indicate which registers are restored. The bit assignments in the mask are: SP A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 or SP B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 BO 15(MSB) O(LSB) 12-109 MMFM Move Multiple Registers from Memory Machine States Cache Enabled Rp Aligned: 3 + 4n + (2) Rp Nonaligned: 3 + 6n + (4) Cache Disabled 11 + 4n 13 + 6n Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples This example restores several B-file registers: MMFM B0,B1,B2,B3,B7,B12,B13,B14,SP This instruction uses register BO as the stack pointer. Assume that BO = 00010000h; this is the address of the top of the stack. MMFM moves the data at this location into the LSW of the SP (which is the highest order register listed in this example). Assume that memory contains the following values before instruction execution: Address Data Address Data 000100F0h 1 1 1 1 h 00010070h CCCCh 000100E0h 01B1h 00010060h BCBCh 000100D0h 2222h 0001 0050h DDDDh 0001 OOCOh 0B2B2h 0001 0040h BDBDh 000100B0h 3333h 0001 0030h EEEEh 0001 OOAOh 03B3h 00010020h BEBEh 0001 0090h 7777h 0001 001 Oh FFFFh 0001 0080h B7B7h 00010000h BFBFh After the MMFM instruction is executed, the registers in the list have the following values: BO - 0001 01 OOh B1 = 1111B1B1h B2 = 2222B2B2h B4 = 3333B3B3h B8 = 7777B7B7h B12 = CCCCBCBCh B13 = DDDDBDBDh B14 = EEEEBEBEh SP - FFFFBFBFh The other B-file registers (which weren't specified in the register list) are not affected by this instruction. Note that BO now contains the value 101 OOh; the last part of the data that was restored was for B1, and BO points to the word past that data. 12-110 Move Multiple Registers to Memory MMTM M MTM Rp, register list For each register R/?in the register list, Rp - 32 -» Rp 32 bits of data at the address specified in R/7 Rp 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 10 110 R Rd binary representation of the register list Syntax Execution Instruction Words Description MMTM stores the contents of a specified list of either A or B file registers (not both) in memory. • The Rp operand is a register that points to the first location in a block of memory. • The register list is a list of registers that are separated by commas (such as A0, A1, A9). These are the registers that MMTM stores in memory. The MMTM and MMFM instructions are "stack" instructions for storing multiple registers in memory and then retrieving their values. Both in- structions use Rp as a "stack pointer" that contains the bit address of the top of the stack. The stack grows toward lower addresses so that the bot- tom of the stack is the highest address in the stack. MMTM stores the re- gisters in memory. Before a register's contents are "pushed" onto the stack, the Rp is decremented by 32 bits; the register is then pushed, LSW first. Thus, at the outset of the MMTM instruction, Rp must contain an incre- mented value. This value is the address where you want to store the LSW of the lowest-order register, plus 32 bits; this assures that Rp is predecre- mented to point to the correct location in memory. When MMTM execution is complete, the contents of the lowest-order reg- ister in the list reside at the highest address in the memory "stack," and Rp points to the address of the highest-order register in the list. Rp and the registers in the list must all be in the same register file. The re- gisters in the list can be specified in any order; the lowest order register is always saved first. Don't include Rp as one of the registers in the register list, because this produces unpredictable results. The original contents of Rp should be aligned on a word boundary; the alignment of Rp affects the instruction timing as shown in Machine States, below. The second word of the MMFM instruction is a binary-mask representation of the registers in the list. The R bit (bit 4) in the first word indicates which register file is affected; the bits that are set to 1 in the mask indicate which registers are restored. The bit assignments in the mask are: A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 SP or B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 SP 15(MSB) 0(LSB) 12-111 MMTM Move Multiple Registers to Memory Machine States Status Bits Examples Cache Enabled Rp Aligned: 2 + 4n + (2) Rp Nonaligned: 2 + 10n + (8) Cache Disabled 8 + 4n + 2 10(n + 1) N C z V Set to the sign of the result of - Rp. (This value is typically 1 if the original contents of Rp are positive; otherwise, it is 0. The only ex- ceptions to this are when Rp=80000000h, N is set to 0, and when Rp=0, N is set to 1.) Unaffected Unaffected Unaffected This example saves the values of several A-file registers in memory: MMTM A1,A0,A2,A4,A8,A12,A13,A14,SP This instruction uses register A1 as the stack pointer. Assume that A1 = 100000h before instruction execution; this value is decremented by 32 to point to the address where the contents of A0 (the lowest order register in the list) are stored. Assume that the registers in the list contain the fol- lowing values before instruction execution: A0 = OOOOAOAOh A12 - CCCCACACh A2 - 2220A2A2h A13 - DDDDADADh A4 = 4444A4A4h A14 = EEEEAEAEh A8 = 8888A8A8h SP = FFFFAFAFh MMTM saves these register values in memory as sho\ Address Data Address Data OOOFFFOOh AFAFh 000FFF80h A8A8h OOOFFFIOh FFFFh 000FFF90h 8888h 000FFF20h AEAEh OOOFFFAOh A4A4h 000FFF30h EEEEh OOOFFFBOh 4444h 000FFF40h ADADh OOOFFFCOh A2A2h 000FFF50h DDDDh OOOFFFDOh 2222h 000FFF60h ACACh OOOFFFEOh AOAOh 000FFF70h CCCCh OOOFFFFOh OOOOh After instruction execution, register A1 = OOOFFFOOh. Note that A1 now contains the value OFFFOOh; this is the address of the last portion of register data that is saved. 12-112 Modulus - Signed MODS Syntax Execution Instruction Words Description Machine States Status Bits MODS Rs.Rd Rd mod Rs -» Rd 15 14 13 12 11 10 9 8 1 110 110 Rs R Rd MODS performs a 32-bit signed divide of the 32-bit dividend in the desti- nation register by the 32-bit value in the source register, and returns a 32-bit remainder in the destination register. The remainder is the same sign as the dividend. The original contents of the destination register are always overwritten. Rs and Rd must be in the same register file. 40.43 (normal case) 41 .44 if result - 80000000 3,6 if Rs - N Unaffected C Unaffected Z Unaffected if RS=0, 1 if quotient is 0, otherwise V 7 if the quotient overflows (cannot be represented by 32 bits), oth- erwise The following conditions set the overflow flag: • The divisor is • The quotient cannot be contained within 32 bits Examples Code Before After AO A1 IMCZV AO MODS A0 ,A1 OOOOOOOOh OOOOOOOOh 0x01 OOOOOOOOh MODS A0 ,A1 OOOOOOOOh 00000007 h 0x01 00000007 h MODS AO f Al OOOOOOOOh FFFFFFF9h 0x01 FFFFFFF9h MODS AO ,A1 00000004h 00000008h 0x10 OOOOOOOOh MODS AO ,A1 00000004h 00000007 h 0x00 00000003h MODS AO ,A1 00000004h OOOOOOOOh 0x10 OOOOOOOOh MODS AO ,A1 00000004h FFFFFFF9h 1x00 FFFFFFFDh MODS AO ,A1 00000004h FFFFFFF8h 0x10 OOOOOOOOh MODS AO Al FFFFFFFCh 00000008h 0x10 OOOOOOOOh MODS AO Al FFFFFFFCh 00000007 h 0x00 00000003h MODS AO Al FFFFFFFCh OOOOOOOOh 0x10 OOOOOOOOh MODS AO Al FFFFFFFCh FFFFFFF9h 1x00 FFFFFFFDh MODS AO Al FFFFFFFCh FFFFFFF8h 0x10 OOOOOOOOh 12-113 MODU Modulus - Unsigned Syntax Execution Instruction Words Description Machine States Status Bits Examples MODU Rs, Rd Rd mod Rs -► Rd 15 14 13 12 11 10 9 8 1 110 111 Rs R Rd MODU performs a 32-bit unsigned divide of the 32-bit dividend in the destination register by the 32-bit value in the source register, and returns a 32-bit remainder in the destination register. The original contents of the destination register are always overwritten. Rs and Rd must be in the same register file. 35,38 3,6 if Rs = N Unaffected C Unaffected Z Unaffected if RS=0, 7 if quotient is 0, otherwise V 7 if divisor Rs equals 0, otherwise Code Before After AO A1 NCZV A1 MODU A0 ,A1 OOOOOOOOh OOOOOOOOh xx01 OOOOOOOOh MODU A0 ,A1 OOOOOOOOh 00000007 h xx01 00000007 h MODU A0 ,A1 OOOOOOOOh FFFFFFF9h xx01 FFFFFFF9h MODU AO ,A1 00000004h 00000008h xx10 OOOOOOOOh MODU A0 ,A1 00000004h 00000007h xxOO 00000003h MODU A0 ,A1 00000004h OOOOOOOOh xx10 OOOOOOOOh MODU AO ,A1 00000004h FFFFFFF9h xxOO 00000001 h 12-114 Move Byte - Register to Indirect MOVB Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVB Rs, *Rd 8 LSBsof Rs -» *Rd 15 14 13 12 11 10 9 8 1 10 1 10 Rs R Rd MOVB moves a byte from the source register to the memory address con- tained in the destination register. The source operand byte is right justified in the source register; only the 8 LSBs of the register are moved. The me- mory address is a bit address and the field size for the move is 8 bits. Rs and Rd must be in the same register file. 1 +(3),7 (when the destination address is aligned on a byte boundary) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address Data 5000h OOOOh 501 Oh OOOOh Code Before After AO A1 @5000h @5010h MOVB A0, *A1 89ABCDEFh 00005000h OOEFh OOOOh MOVB AO, *A1 89ABCDEFh 00005001 h 01DEh OOOOh MOVB A0, *A1 89ABCDEFh 00005009h ODEOOh 0001 h MOVB AO, *A1 89ABCDEFh 0000500Ch FOOOh OOOEh 12-115 MOVB Move Byte - Register to Indirect with Offset Syntax Execution /nstruct/on Words Description MOVB Rs, *Rd(offset) 8 LSBs of Rs -► *Rd + offset Machine States Status Bits Examples 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 Rs R Rd offset MOVB moves a byte from the source register to the destination memory address. The source operand byte is right justified in the source register; only the 8 LSBs of the register are moved. The destination memory address is a bit address and is formed by adding the contents of the specified reg- ister to the signed 16-bit offset. This is a field move, and the field size for the move is 8 bits. Rs and Rd must be in the same register file. 3+(3),9 (when the destination address is aligned on a byte boundary) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: After A1 @10000h @10010h 00010000h00EFh OOOOh 00010000h01DEh OOOOh 0001 OOOOh DEOOh 0001 h 0001 OOOOh FOOOh OOOEh 00008001 hOOEFh OOOOh 00018000h00EFh OOOOh Address Data 1 OOOOh OOOOh 1 001 Oh OOOOh Code Before AO MOVB AO, *A1(0) 89ABCDEFh MOVB AO, *A1(1) 89ABCDEFh MOVB AO, *A1(9) 89ABCDEFh MOVB AO, *A1(12) 89ABCDEFh MOVB AO, *A1(32767) 89ABCDEFh MOVB AO, *Al(-32768) 89ABCDEFh 12-116 Move Byte - Register to Absolute MOVB Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVB Rs. *D Address 8 LSBs of Rs -► DAddress 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 10 1111 R Rs 16 LSBs of destination address 16 MSBs of destination address MOVB moves a byte from the source register to the destination memory address. The source operand byte is right justified in the source register; only the 8 LSBs of the register are moved. The specified destination mem- ory address is a bit address and the field size for the move is 8 bits. Rs and Rd must be in the same register file. 1 +(3), 7 (when the destination address is aligned on a byte boundary) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address Data 5000h OOOOh 501 Oh OOOOh Code Before After AO a 5000 h @5010h MOVB A0 @5000h 89ABCDEFh OOEFh OOOOh MOVB A0 @5001h 89ABCDEFh 01DEh OOOOh MOVB A0 @5009h 89ABCDEFh DEOOh 0001 h MOVB A0 @500Ch 89ABCDEFh FOOOh OOOEh 12-117 MOVB Move Byte - Indirect to Register Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVB *Rs, Rd byte at * Rs -► Rd 15 14 13 12 11 10 9 8 1 10 111 Rs R Rd MOVB moves a byte from the memory address contained in the source re- gister to the destination register. The source memory address is a bit ad- dress and the field size for the move is 8 bits. When the byte is moved into the destination register, it is right justified and sign extended to 32 bits. This instruction also performs an implicit compare to of the field data. Rs and Rd must be in the same register file. 3,6 (when the source data is aligned on a byte boundary) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the sign-extended data moved into register is negative, otherwise C Unaffected Z 7 if the sign-extended data moved into register is 0, otherwise V Assume that memory contains the following values before instruction exe- cution: Address Data 5000h OOEFh 501 Oh 89ABh Code Before A0 After A1 IMCZV MOVB *A0 ,A1 00005000h FFFFFFEFh 1x00 MOVB *A0 ,A1 00005001 h 0000007 7 h 0x00 MOVB *A0 ,A1 00005008h OOOOOOOOh 0x10 MOVB *A0 ,A1 0000500Ch FFFFFFBOh 1x00 12-118 Move Byte - Indirect to Indirect MOVB Syntax Execution instruction Words Description Machine States Status Bits Examples MOVB *Rs, *Rd byte at * Rs -♦ * Rd 15 14 13 12 11 10 9 8 1 10 1110 Rs R Rd MOVB moves a byte from the source memory address to the destination memory address. The source address is specified by the contents of Rs, and the destination address is specified by the contents of Rd. Both memory addresses are bit addresses and the field size for the move is 8 bits. Rs and Rd must be in the same register file. 3 + (3), 7 (when the source data and destination address are aligned on byte boundaries) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address 5000h 501 Oh 6000h 601 Oh Data CDEF 89AB 0000 0000 Code MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB MOVB *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 *A0,*A1 Before AO 00005000h 00005000h 00005000h 00005000h 00005001 h 00005001 h 00005001 h 00005001 h 00005009h 00005009h 00005009h 00005009h 0000500Ch 0000500Ch 0000500Ch 0000500Ch After A1 00006000h 00006001 h 00006009h 0000600Ch 00006000h 00006001 h 00006009h 0000600Ch 00006000h 00006001 h 00006009h 0000600Ch 00006000h 00006001 h 00006009h 0000600Ch @6000h OOEFh 01DEh DEOOh FOOOh 00F7h 01EEh EEOOh 7000h 00E6h 01CCh CCOOh 6000h OOBCh 0178h 7800h COOOh @6010h OOOOh OOOOh 0001 h 000 Eh OOOOh OOOOh 0001 h OOOFh OOOOh OOOOh 0001 h 000 Eh OOOOh OOOOh 0001 h 000 Bh 12-119 MOVB Move Byte - Indirect with Offset to Register Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVB *Rs(offset), Rd byte at (*Rs + offset) -» Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 Rs R Rd offset MOVB moves a byte from the source memory address to the destination register. The source memory address is a bit address and is formed by ad- ding the contents of the specified register to the signed 16-bit offset. The field size is 8 bits. When the byte is moved into the destination register, it is right justified and sign extended to 32 bits. This instruction also performs an implicit compare to of the field data. Rs and Rd must be in the same register file. 5,1 1 (when the source data is aligned on a byte boundary) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the sign -extended data moved into register is negative, otherwise C Unaffected Z /if the sign -extended data moved into register is 0, otherwise V Assume that memory contains the following values before instruction exe- cution: Address 1 OOOOh 1001 Oh Code Data OOEFh 89ABh Before After MOVB *A0(0) ,A1 MOVB *A0(1) ,A1 MOVB *A0(8) ,A1 MOVB *A0(12) ,A1 MOVB *A0( 32767) ,A1 MOVB *A0(-32768) ,A1 A0 A1 IMCZV 0001 OOOOh FFFFFFEFh 1x00 0001 OOOOh 00000077 h 0x00 0001 OOOOh OOOOOOOOh 0x10 0001 OOOOh FFFFFFBOh 1x00 00008001 h FFFFFFEFh 1x00 0001 8000h FFFFFFEFh 1x00 12-120 Move Byte - Indirect with Offset to Indirect with Offset MOVB Syntax Execution Instruction Words Description Machine States Status Bits MOVB *Rs(S Offset), *Rd(DOffset) byte at (*Rs + SOffset) -» (*Rd + DOffset) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 Rs R Rd source offset destination offset MOVB moves a byte from the source memory address to the destination memory address. Both the source and destination memory addresses are bit addresses and are formed by adding the contents of the specified regis- ter to its respective signed 1 6-bit offset. The field size is 8 bits. Rs and Rd must be in the same register file. 5 + (3),9 (when the source data and destination address are aligned on byte boundaries) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-121 MOVB Move Byte - Indirect with Offset to Indirect with Offset Examples Assume that memory contains the following values before instruction exe- cution: Address Data 1 OOOOh CDEFh 1001 Oh 89ABh 11000h OOOOh 11 01 Oh OOOOh Code Before i &fter AO A1 anoooh @11010h MOVB *A0 0) ,*A1(0) 0001 OOOOh 0001 1 OOOh OOEFh OOOOh MOVB *A0 0) ,*A1(1) 0001 OOOOh 0001 1 OOOh 01DEh OOOOh MOVB *A0 0) ,*A1(9) 0001 OOOOh 0001 1 OOOh DEOOh 0001 h MOVB *A0 0) ,*A1(12) 0001 OOOOh 0001 1 OOOh FOOOh OOOEh MOVB *A0 0) ,*A1(32767) 0001 OOOOh 00009001 h OOEFh OOOOh MOVB *A0 0) ,*Al(-32768) 0001 OOOOh 0001 9000h OOEFh OOOOh MOVB *A0 12) ,*A1(0) 0001 OOOOh 0001 1 OOOh OOBCh OOOOh MOVB *A0 12) ,*A1(1) 0001 OOOOh 0001 1 OOOh 0178h OOOOh MOVB *A0 12) ,*A1(9) 0001 OOOOh 0001 1 OOOh 7800h 0001 h MOVB *A0 12) ,*A1(12) 0001 OOOOh 0001 1 OOOh COOOh 000 Bh MOVB *A0 12) ,*A1(32767) 0001 OOOOh 00009001 h OOBCh OOOOh MOVB *A0 12) ,*Al(-32768) 0001 OOOOh 0001 9000h OOBCh OOOOh MOVB *A0 32767) ,*A1(0) 00008001 h 0001 1 OOOh OOEFh OOOOh MOVB *A0 32767) ,*A1(1) 00008001 h 0001 1 OOOh 01DEh OOOOh MOVB *A0 32767) ,*A1(9) 00008001 h 0001 1 OOOh DEOOh 0001 h MOVB *A0 32767) ,*A1(12) 00008001 h 0001 1 OOOh FOOOh OOOEh MOVB *A0 32767) ,*A1(32767) 00008001 h 00009001 h OOEFh OOOOh MOVB *A0 32767) ,*Al(-32678) 00008001 h 0001 9000h OOEFh OOOOh MOVB *A0 -32768) ,*A1(0) 0001 8000h 0001 1 OOOh OOEFh OOOOh MOVB *A0 -32768) ,*A1(1) 0001 8000h 0001 1 OOOh 01DEh OOOOh MOVB *A0 -32768) ,*A1(9) 0001 8000h 0001 1 OOOh DEOOh 0001 h MOVB *A0 -32768) ,*A1(12) 0001 8000h 0001 1 OOOh FOOOh OOOEh MOVB *A0 -32768) ,*A1(32767) 0001 8000h 00009001 h OOEFh OOOOh MOVB *A0 -32768) ,*Al(-32678) 0001 8000h 0001 9000h OOEFh OOOOh 12-122 Move Byte - Absolute to Register MOVB Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVB QSAddress, Rd byte at SAddress -» Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 111111 R Rd 16 LSBs of source address 16 MSBs of source address MOVB moves a byte from the source memory address to the destination register. The specified source memory address is a bit address and the field size for the move is 8 bits. When the byte is moved into the destination register, it is right justified and sign extended to 32 bits. This instruction also performs an implicit compare to of the field data. Rs and Rd must be in the same register file. 5,14 (when the source data is aligned on a byte boundary) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the sign-extended data moved into register is negative, otherwise C Unaffected Z 1 if the sign -extended data moved into register is 0, otherwise V Assume that memory contains the following values before instruction exe- cution: Address Data 1 OOOOh OOEFh 1001 Oh 89ABh Code After A1 NCZV MOVB @10000h ,A1 FFFFFFEFh 1x00 MOVB @10001h ,A1 00000077 h 0x00 MOVB @10008h ,A1 OOOOOOOOh 0x10 MOVB @1000Ch ,A1 FFFFFFBOh 1x00 12-123 MOVB Move Byte - Absolute to Absolute Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVB ®S Address, QDAddress byte at S Address -» D Address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 110 1 16 LSBs of source address 16 MSBs of source address 16 LSBs of destination address 16 MSBs of destination address MOVB moves a byte from the source memory address to the destination memory address. Both the source and destination addresses are interpreted as bit addresses and the field size for the move is 8 bits. 7 + (3),25 (when the source data and destination address are aligned on byte boundaries) For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address Data 10000h CDEFh 1001 Oh 89ABh 1 1 OOOh OOOOh 1101 Oh OOOOh 12-124 Move Byte - Absolute to Absolute MOVB Code After @11000h @H010h MOVB @10000h,@11000h OOEFh OOOOh MOVB @lO000h,@11001h 01DEh OOOOh MOVB @10000h,@11009h DEOOh 0001 h MOVB @10000h,@1100Ch FOOOh OOOEh MOVB @10001h,@11000h 00F7h OOOOh MOVB @10001h,@11001h 01EEh OOOOh MOVB §10001h,@11009h EEOOh 0001 h MOVB @10001h,@1100Ch 7000h OOOFh MOVB @10009h,§11000h 00E6h OOOOh MOVB §10009h,§11001h 01CCh OOOOh MOVB @10009h,@11009h CCOOh 0001 h MOVB @10009h,@1100Ch 6000h OOOEh MOVB @1000Ch,§11000h OOBCh OOOOh MOVB @1000Ch,@11001h 0178h OOOOh MOVB @1000Ch,@11009h 7800h 0001 h MOVB @1000Ch,@1100Ch COOOh 000 Bh 12-125 MOVE Move - Register to Register Syntax Execution Instruction Words Description Fields Machine States Status Bits Examples MOVE Rs, Rd Rs - Rd 15 14 13 12 11 10 9 8 1 10 11 M Rs R Rd MOVE moves the 32 bits of data from the source register to the destination register. Note that this is not a field move; therefore, the field size has no effect. The source and destination registers can be any of the 31 locations in the on-chip register file. Note that this is the only MOVE instruction that allows the source and destination registers to be in different files. This in- struction also performs an implicit compare to of the register data. The assembler sets bit 9 (the M bit) in the instruction word to specify whether the move is within a register file or if it crosses the register files. The assembler sets M to if the source and destination registers are in the same file; it sets M to 1 if the registers are in different files. The assembler sets bit 4 (the R bit) in the instruction word to specify which file the registers are in. The assembler sets R to if the registers are in file A; it sets R to 1 if the registers are in file B. Note that when M=0, R specifies the register file for both registers; if M : R specifies the register file for the source register 1,4 N /if the 32-bit data moved is negative, otherwise C Unaffected Z /if the 32-bit data moved is 0, otherwise V = 1, Code Before After AO A1 Bl NCZV MOVE AO Al OOOOFFFFh OOOOFFFFh xxxxxxxxh 0x00 MOVE AO Al OOOOOOOOh OOOOOOOOh xxxxxxxxh 0x10 MOVE AO Al FFFFFFFFh FFFFFFFFh xxxxxxxxh 1x00 MOVE AO Bl OOOOFFFFh xxxxxxxxh OOOOFFFFh 0x00 MOVE AO Bl OOOOOOOOh xxxxxxxxh OOOOOOOOh 0x10 MOVE AO Bl FFFFFFFFh xxxxxxxxh FFFFFFFFh 1x00 12-126 Move Field - Register to Indirect MOVE Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVE Rs,*Rd[.F] field in Rs -» *Rd 15 14 13 12 11 10 9 8 1 1 F Rs R Rd MOVE moves a field from the source register to the memory address con- tained in the destination register. This memory address is a bit address. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FS0 F=1 selects FS1 The SETF instruction sets the field size and extension, in the same register file. Rs and Rd must be The following typical cases assume that the destination address is aligned on a 16-bit boundary: 16- Bit Field 1+(1),5 32-Bit Field 1+<3).7 For other cases, see MOVE and MOVB Instructions Timing, Section 1 3.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address Data 1 5500h OOOOh 1551 Oh OOOOh 1 5520h OOOOh Register AO = FFFFFFFFh Code Before After A1 FSO/1 @15500h §1551 Oh @15520h MOVE AO *A1 0001 5500h 5/x 001 Fh OOOOh OOOOh MOVE AO *A1 1 00015503h x/8 07F8h OOOOh OOOOh MOVE AO *A1 0001 5508h 13/x FFOOh 001 Fh OOOOh MOVE AO *A1 1 0001550Bh x/16 F800h 07FFh OOOOh MOVE AO *A1 0001550Dh 19/x EOOOh FFFFh OOOOh MOVE AO *A1 1 0001 550Ch x/24 FOOOh FFFFh OOOFh MOVE AO *A1 0001 551 2h 27/x OOOOh FFFCh 1FFFh MOVE AO, *A1, 1 0001 551 Oh x/32 OOOOh FFFFh FFFFh 12-127 MOVE Move Field - Register to Indirect (Postincrement) Syntax MOVE Rs, *Rd+ [. F] Execution field in Rs -» *Rd Rd + field size -► Rd Instruction Words Description Machine States Status Bits Examples 15 14 13 12 11 10 9 8 1 1 1 F Rs R Rd MOVE moves a field from the source register to the memory address con- tained in the destination register. This memory address is a bit address. After the move, the contents of the destination register are postincremented by the selected field size. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source regis- ter. The optional F parameter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension, in the same register file. Rs and Rd must be The following typical cases assume that the destination address is aligned on a 16-bit boundary: 16-Bit Field 1+(1),5 32- Bit Field 1+(3),7 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address Data 1 5500h OOOOh 1551 Oh OOOOh 1 5520h OOOOh Register AO = FFFFFFFFh 12-128 Move Field - Register to Indirect (Postincrement) MOVE Code Before After A1 FSO/1 A1 @15500h @15510h @15520h MOVE AO *A1+ 0001 5528h 5/x 0001 552 Dh OOOOh OOOOh 1F00h MOVE AO *A1+ 1 0001 5525h x/8 0001552Dh OOOOh OOOOh 1FE0h MOVE AO *A1+ 0001 5520h 13/x 0001552Dh OOOOh OOOOh 1FFFh MOVE AO, *A1+ 1 0001 551 Dh x/16 0001552Dh OOOOh EOOOh 1FFFh MOVE AO *A1+ 0001 551 6h 19/x 00015529h OOOOh FFCOh 01FFh MOVE AO *A1+ 1 0001 5507 h x/24 0001 551 Fh FF80h 7FFFh OOOOh MOVE AO *A1+ 0001 5507h 27/x 0001 551 Fh FF80h FFFFh 0003h MOVE AO *A1+ 1 0001 5500h x/32 0001 5520h FFFFh FFFFh OOOOh 12-129 MOVE Move Field - Register to Indirect (Predecrement) Syntax Execution MOVE Rs.-*Rd[,F] Rd - field size -» Rd field in Rs -+ *Rd Instruction Words Description Machine States Status Bits Examples 15 14 13 12 11 10 9 8 1 10 10 F Rs R Rd MOVE moves a field from the source register to the memory address con- tained in the destination register; the destination address is predecremented by the field size. The memory address is a bit address. Before the move, the field size is subtracted from the contents of the destination register to determine the location that the field is moved to. (This value is also the fi- nal value for the register.) The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FS0 F=1 selects FS1 The SETF instruction sets the field size and extension, in the same register file. Rs and Rd must be The following typical cases assume that the destination address is aligned on a 16-bit boundary: 16-Bit Field 2+(1),6 32-Bit Field 2 + (3),8 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address 1 5500h 1551 Oh 15520h Data OOOOh OOOOh OOOOh Register A0 = FFFFFFFFh 12-130 Move Field - Register to Indirect (Predecrement) MOVE Code Before After A1 FSO/1 A1 @15500h @15510h @15520h MOVE AO, -*A1 0001 530h 5/x 0001 52Bh OOOOh OOOOh F800h MOVE AO, -*A1 1 0001 52Dh x/8 0001 525h OOOOh OOOOh 1FE0h MOVE AO, -*A1 0001 528h 13/x 0001 51 Bh OOOOh F800h OOFFh MOVE AO, -*A1 1 0001 528h x/16 0001 51 8h OOOOh FFOOh OOFFh MOVE AO, -*A1 0001 523h 19/x 0001 51 Oh OOOOh FFFFh 0007 h MOVE AO, -*A1 1 0001 520h x/24 0001 508h FFOOh FFFFh OOOOh MOVE AO, -*A1 0001 524h 27/x 0001 509h FEOOh FFFFh OOOFh MOVE AO, -*A1 1 0001 520h x/32 0001 500h FFFFh FFFFh OOOOh 12-131 MOVE Move Field - Register to Indirect with Offset Syntax Execution Instruction Words Description Machine States Status Bits MOVE Rs, *Rd( offset) [. F] field in Rs -* *(Rd + offset) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 F Rs R Rd offset MOVE moves a field from the source register to the destination memory memory address. The destination memory address is a bit address and is formed by adding the contents of the destination register to the signed 16-bit offset. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F parameter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension, in the same register file. Rs and Rd must be The following typical cases assume that the destination address is aligned on a 16-bit boundary: 16-Bit Field 3+(1),7 32-Bit Field 3 + (3),9 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-132 Move Field - Register to Indirect with Offset MOVE Examples Assume that memory contains the following values before instruction exe- cution: Address Data 15530h OOOOh 15540h OOOOh 1 5550h OOOOh Register AO = FFFFFFFFh Code Before After A1 FSO/1 @15530h @15540h @15550h MOVE AO *Al(OOOOh) ,1 0001 5530h x/1 0001 h OOOOh OOOOh MOVE AO *Al(0001h) ,0 0001552Fh 5/x 001 Fh OOOOh OOOOh MOVE AO *Al(000Fh) ,0 0001552Dh 8/x FOOOh OOOFh OOOOh MOVE AO *Al(0020h) ,1 0001 551 Ch x/1 3 FOOOh 01FFh OOOOh MOVE AO *Al(00FFh) ,0 0001 5435h 16/x FFFOh OOOFh OOOOh MOVE AO *Al(0FFFh) ,0 0001 4531 h 19/x FFFFh 0007 h OOOOh MOVE AO *Al(7FFFh) ,1 0000D531 h x/22 FFFFh 003 Fh OOOOh MOVE AO *Al(0FFF2h) ,1 0001 5540h x/25 FFFCh 07FFh OOOOh MOVE AO *Al(8000h) ,0 0001 D530h 27/x FFFFh 07FFh OOOOh MOVE AO *Al(0FFF0h) ,0 0001 5540h 31 /x FFFFh 7FFFh OOOOh MOVE AO *Al(0FFECh) ,1 0001 5548h x/31 FFFOh FFFFh 0007 h MOVE AO *Al(0FFECh) ,0 0001 554Dh 32/x FEOOh FFFFh 01FFh MOVE AO *Al(001Dh) ,0 0001 5520h 32/x EOOOh FFFFh 1FFFh MOVE AO *Al(0020h) ,1 0001 5520h x/32 OOOOh FFFFh FFFFh 12-133 MOVE Move Field - Register to Absolute Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVE Rs, WAddress [, F] field in Rs -*■ DAddress 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 F 110 R Rs 16 LSBs of destination address 16 MSBs of destination address MOVE moves a field from the source register to the destination memory address. The specified destination memory address is a linear bit address. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 SETF sets the field size and extension. The following typical cases assume that the destination address is aligned on a 16-bit boundary: 16-Bit Field 3+(1),7 32-Bit Field 3 + (3),9 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains these values before instruction execution: Address 1 5500h 1551 Oh 1 5520h Data OOOOh OOOOh OOOOh Register A0 = FFFFFFFFh Code Before After FSO/1 @15500h @15510h @15520h MOVE AO @15500h, 5/x 001 Fh OOOOh OOOOh MOVE AO @15503h ( 1 x/8 07F8h OOOOh OOOOh MOVE AO @15508h, 13/x FFOOh 001 Fh OOOOh MOVE AO @1550Bh, 1 x/16 F800h 07FFh OOOOh MOVE AO p @1550Dh, 19/x EOOOh FFFFh OOOOh MOVE AO r @15510h, 1 x/24 OOOOh FFFFh OOFFh MOVE AO ©1551211, 27/x OOOOh FFFCh 1FFFh MOVE AO r @1550Ch, 1 x/32 FOOOh FFFFh OFFFh 12-134 Move Field - Indirect to Register MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE *Rs,Rd[,F] field at *Rs -* Rd 15 14 13 12 11 10 9 8 1 1 1 F Rs R Rd MOVE moves a field from the source memory address to the destination register. The contents of the source register specify the address of the field. When the field is moved into the destination register, it is right justified and sign extended or zero extended to 32 bits, according to the value of FE. This instruction also performs an implicit compare to of the field data. The field size for the move is 1-32 bits, depending on the selected field size; the optional F parameter determines the field size and extension for the move: F=0 selects FS0 F=1 selects FS1 The SETF instruction sets the field size and extension. Rs and Rd must be in the same register file. The following typical cases assume that the source data is aligned on a 16-bit boundary: 16-Bit Field 3,6 32-Bit Field 5,8 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the field -extended data moved to register is negative, otherwise C Unaffected Z 7 if the field-extended data moved to register is 0, otherwise V 12-135 MOVE Move Field - Indirect to Register Examples Assume that memory contains the following values before instruction exe- cution: Address Data 1 5500h 7770h 1551 Oh 7777h Register AO = 0001 5500h Code Before After FSO/1 FEO/1 A1 IMCZV MOVE *A0,A1, ,1 x/1 x/1 OOOOOOOOh 0x10 MOVE *A0,A1, ,0 5/x 0/x 0000001 Oh 0x00 MOVE *A0,A1, rl x/5 x/1 FFFFFFFOh 1x00 MOVE *A0,A1 / -0 12/x 1/x 00000770h 0x00 MOVE *A0,A1, ,1 x/1 2 x/0 00000770h 0x00 MOVE *A0,A1, ,0 18/x 0/x 00037770h 0x00 MOVE *A0,A1, ,1 x/1 8 x/1 FFFF7770h 1x00 MOVE *A0,A1, ,0 27/x 1/x FF777770h 1x00 MOVE ♦AC^Al, ,1 x/27 x/0 07777770h 0x00 MOVE *A0,A1, ,0 31 /x 0/x 77777770h 0x00 MOVE *A0,A1, rl x/31 x/1 F7777770h 1x00 MOVE *A0,A1, ,0 32/x x/x 77777770h 0x00 12-136 Move Field - Indirect to Indirect MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE *Rs,*Rd[,F] field at *Rs -» *Rd 15 14 13 12 11 10 9 8 1 10 10 F Rs R Rd MOVE moves a field from a source address to a destination address. Both memory addresses are bit addresses; the source register contains the ad- dress of the field and the destination register specifies the address that the field is moved to. The field size for the move is 1-32 bits, depending on the selected field size; the optional F parameter determines the field size and extension for the move: F=0 selects FS0 F=1 selects FS1 SETF sets the field size and extension, gister file. Rs and Rd must be in the same re- The following typical cases assume that the source data and the destination address are aligned on 16-bit boundaries: 16-Bit Field 3 + (1),7 32-Bit Field 5 + (3),11 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-137 MOVE Move Field - Indirect to Indirect Examples Assume that memory contains the following values before instruction exe- cution: Add ress Data Address Data 15500h FFFFh 15530h OOOOh 1551 Oh FFFFh 1 5540h OOOOh 15520h FFFFh 15550h OOOOh Code Before After AO A1 FSO/1 @15530h @1 5540h @15550h MOVE *A0, ,*A1, ,1 0001 5500h 0001 5530h x/1 0001 h OOOOh OOOOh MOVE *A0, .*A1, ,0 0001 5500h 0001 5534h 5/x 01F0h OOOOh OOOOh MOVE *A0, . *A1, rl 0001 5500h 0001 553Ah x/10 FCOOh 000 Fh OOOOh MOVE *A0, , *A1, ,0 0001 5500h 0001 553Fh 19/x 8000h FFFFh 0003h MOVE *A0, ,*A1, rl 0001 5504h 0001 5530h x/7 007Fh OOOOh OOOOh MOVE *A0, ,*A1, rO 0001 550Ah 0001 5530h 13/x 1FFFh OOOOh OOOOh MOVE *A0 < ,*A1, rl 0001550Dh 0001 5534h x/8 OFFOh OOOOh OOOOh MOVE *A0, ,*A1, rO 0001550Dh 0001 5530h 28/x FFFFh OFFFh OOOOh MOVE *A0, ,*A1, ,1 0001 5505h 0001 5535h x/23 FFEOh OFFFh OOOOh MOVE *A0, ,*A1, ,0 0001 5508h 0001 5536h 31 /x FFCOh FFFFh 001 Fh MOVE *A0, .*A1 1 rl 0001 5508h 0001 5531 h x/31 FFFEh FFFFh OOOOh MOVE *A0, ,*A1, rO 0001 550Ah 0001 5530h 32/x FFFFh FFFFh OOOOh MOVE *A0, . *A1, rO 0001 5500h 0001 553Ah x/32 FCOOh FFFFh 03FFh 12-138 Move Field - Indirect (Postincrement) to Register MOVE Syntax MOVE *Rs+,Rd[.F] Execution field at *Rs -+ Rd Rs + field size -* Rs Instruction Words Description Machine States Status Bits 15 14 13 12 11 10 9 8 1 10 10 1 F Rs R Rd MOVE moves a field from memory to the destination register. The source register contains the address of the field; after the move, the contents of the source register are incremented by the field size. When the field is moved into the destination register, it is right justified and sign extended or zero extended, as specified by the selected field extension. This instruction also performs an implicit compare to of the field data. The field size for the move is 1-32 bits, depending on the selected field size; the optional F parameter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. Rs and Rd must be in the same register file. The following typical cases assume that the source data is aligned on a 16-bit boundary: 16-Bit Field 3,6 32-Bit Field 5,8 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the field-extended data moved to register is negative, otherwise C Unaffected Z 7 if the field-extended data moved to register is 0, O otherwise V 12-139 MOVE Move Field - Indirect (Postincrement) to Register Examples Assume that memory contains the following values before instruction exe- cution: Address Data 1 5500h 7770h 1551 Oh 7777h Register AO = 0001 5500h Code Before After FSO/1 FEO/1 AO A1 NCZV MOVE *A0+, r Al,l x/1 x/0 0001 5501 h OOOOOOOOh 0x10 MOVE *A0+, ,A1,1 x/5 x/0 0001 5505h 0000001 Oh 0x00 MOVE *A0+, ,A1,0 5/x 1/x 0001 5505h FFFFFFFOh 1x00 MOVE *A0+, P A1,0 12/x 0/x 0001 550Ch 00000770h 0x00 MOVE *A0+, ,A1,1 x/1 2 x/1 0001 550Ch 00000770h 0x00 MOVE *A0+, ,A1,0 18/x 1/x 0001 551 2h FFFF7770h 1x00 MOVE *A0+ ( ,A1,1 x/1 8 x/0 0001 551 2h 00037770h 0x00 MOVE *A0+, ,A1,0 27/x 0/x 0001 551 Bh 07777770h 0x00 MOVE *A0+, ,A1,1 x/27 x/1 0001 551 Bh FF777770h 1x00 MOVE *A0+ ,A1,0 31 /x 1/x 0001 551 Fh F7777770h 1x00 MOVE *A0+ ( ,A1,1 x/31 x/0 0001 551 Fh 77777770h 0x00 MOVE *A0+, ,A1,0 32/x x/x 0001 5520h 77777770h 0x00 12-140 Move Field - Indirect (Postincrement) to Indirect (Postincrement) MOVE Syntax MOVE *Rs+, *Rd+ [. F] Execution field at *Rs -» *Rd Rs + field size -» Rs Rd + field size ->• Rd Instruction Words Description Machine States Status Bits 15 14 13 12 11 10 9 8 1 10 110 F Rs R Rd MOVE moves a field from one memory address to another. The source re- gister contains the bit address of the field; the destination register contains the bit address of field's destination. After the move, the contents of both instructions are incremented by the field size. The field size for the move is 1-32 bits, depending on the selected field size; the optional F parameter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. If Rs and Rd specify the same register, the data read from the location pointed to by the original contents of Rs is written to the location pointed to by the incremented value of Rs(Rd). Rs and Rd must be in the same register file. The following typical cases assume that the source data and the destination address are aligned on 16-bit boundaries: 16-Bit Field 4,7 32-Bit Field 6 + (2),11 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-141 MOVE Move Field - Indirect (Postincrement) to Indirect (Postincrement) Examples Assume that memory contains the following values before instruction exe- cution: Address Data Address Data 1 5500h FFFFh 15530h OOOOh 1551 Oh FFFFh 15540h OOOOh 1 5520h FFFFh 15550h OOOOh MOVE *A0+ ■,*A1+, ,F Before After F AO A1 FS0/1 AO A1 I @15530h @15540h @15550h 1 00015500h 0001553Dh x/1 0001 5501 h 0001553Eh 2000h OOOOh OOOOh 0001 5505h 0001 5538h 5/x 0001 550Ah 0001553Dh 1F00h OOOOh OOOOh 1 0001 550Ah 0001 553Fh x/10 0001 551 4h 0001 5549h 8000h 01FFh OOOOh 0001550Dh 0001 5530h 19/x 0001 5520h 0001 5543h FFFFh 0007 h OOOOh 1 0001 551 Oh 0001 5532h x/7 0001 551 7h 00015539h 01FCh OOOOh OOOOh 0001 551 1h 0001 553Ah 13/x 0001 551 Eh 0001 5547h FCOOh 007 Fh OOOOh 1 0001 551 3h 0001 553 Fh x/8 0001 551 Bh 0001 5547h 8000h 007Fh OOOOh 0001 551 Oh 0001 553Ah 28/x 0001 552Ch 0001 5556h FCOOh FFFFh 003Fh 1 0001 551 8h 0001 5534h x/23 0001552Fh 0001554Bh FFFOh 07FFh OOOOh 0001 551 Oh 0001 5530h 31 /x 0001552Fh 0001 554Fh FFFFh 7FFFh OOOOh 1 0001 551 1 h 0001553Dh x/31 0001 5530h 0001555Ch EOOOh FFFFh OFFFh 0001 551 Oh 0001 553Fh 32/x 0001 5530h 0001555Fh 8000h FFFFh 7FFFh 1 0001 5500h 0001 5530h x/32 0001 5520h 0001 5550h FFFFh FFFFh OOOOh 12-142 Move Field - Indirect (Predecrement) to Register MOVE Syntax Execution MOVE -*Rs,Rd[,F] Rs - field size field at *Rs -> Rs Rd Instruction Words Description Machine States Status Bits 15 14 13 12 11 10 9 8 1 10 10 1 F Rs R Rd MOVE moves a field from memory to the destination register. The source register contains a bit address; before the move, the contents of the source register are decremented by the field size to form the address of the field. (This value is also the final value for the register.) The field size for the move is 1-32 bits, depending on the selected field size; the optional F parameter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. When the field is moved into the destination register, it is right justified and sign extended or zero extended to 32 bits according to the value of FE for the particular F bit selected. This instruction also performs an implicit compare to of the field data. Rs and Rd must be in the same register file. If Rs and Rd are the same re- gister, the pointer information is overwritten by the data fetched. The following typical cases assume that the source data is aligned on a 16-bit boundary: 16-Bit Field 4,7 32-Bit Field 6,9 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the field-extended data moved to register is negative, otherwise C Unaffected Z /if the field-extended data moved to register is 0, otherwise V 12-143 MOVE Move Field - Indirect (Predecrement) to Register Examples Assume that memory contains the following values before instruction exe- cution: Address Data 1 5500h 7770h 1551 Oh 7777h Register AO = 00015520h Code Before After FSO/1 FEO/1 AO A1 NCZV MOVE -*A0, ,A1, ,1 x/1 x/0 0001 551 Fh OOOOOOOOh 0x10 MOVE -*A0, ,A1, ,0 5/x 1/x 0001 551 Bh 0000000 Eh 0x00 MOVE -*A0, ,A1, ,i x/5 x/0 0001 551 Bh 0000000 Eh 0x00 MOVE -*A0, ,A1, ,0 12/x 0/x 0001 551 4h 00000777h 0x00 MOVE -*A0, r Al 1 ,i x/1 2 x/1 0001 551 4h 00000777 h 0x00 MOVE -*A0, -Al, ,0 18/x 1/x 0001550Eh OOOIDDDDh 0x00 MOVE -*A0, ,A1, , 1 x/1 8 x/0 0001 550Eh OOOIDDDDh 0x00 MOVE -*A0, rAl, ,0 27/x 0/x 0001 5505h 03BBBBBBh 0x00 MOVE -*A0 ; P A1, rl x/27 x/1 0001 5505h 03BBBBBBh 0x00 MOVE -*A0, ,A1, ,0 31 /x 1/x 0001 5501 h 3BBBBBB8h 0x00 MOVE -*A0, ,A1, ,1 x/31 x/0 0001 5501 h 3BBBBBB8h 0x00 MOVE -*A0, rAl, rO 32/x x/x 0001 5500h 77777770h 0x00 12-144 Move Field - Indirect (Predecrement) to Indirect (Predecrement) MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE -*Rs,-*Rd [.F] Rs - field size -* Rs Rd - field size -» Rd (field) *Rs - (field) *Rd 15 14 13 12 11 10 9 8 1 10 10 10 F Rs R Rd MOVE moves a field from one memory address to another. Both registers contain bit addresses; before the move, the contents of both registers are decremented by the field size. The source register then contains the address of the field, and the destination register specifies the destination address for the move. The field size for the move is 1-32 bits, depending on the selected field size; the optional F parameter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. Rs and Rd must be in the same register file. If Rs and Rd are the same re- gister, then the final contents of the register are its original contents decre- mented by twice the field size. The following typical cases assume that the source data and the destination address are aligned on 16-bit boundaries: 16-Bit Field 4+(1),8 32-Bit Field 6 + (3),12 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-145 MOVE Move Field - Indirect (Predecrement) to Indirect (Predecrement) Examples Assume that memory contains the following values before instruction exe- cution: Address Data Add ress Data 1 5500h FFFFh 1 5530h OOOOh 1551 Oh FFFFh 1 5540h OOOOh 1 5520h FFFFh 1 5550h OOOOh MOVE -*A0, -*A1,F Before After F AO A1 FS0/1 AO A1 ( ai5530h @15540h @15550l 1 0001 5501 h 0001 5531 h x/1 0001 5500h 0001 5530h 0001 h OOOOh OOOOh 0001 5505h 0001 5539h 5/x 0001 5500h 0001 5534h 01F0h OOOOh OOOOh 1 0001 550Ah 0001 5544h x/10 0001 550h0 0001 553Ah FCOOh OOOFh OOOOh 0001 551 3h 0001 5552h 19/x 0001 5500h 0001553Fh 8000h FFFFh 0003h 1 0001550Bh 00015537h x/7 0001 5504h 0001 5530h 007Fh OOOOh OOOOh 0001 551 7h 0001553Dh 13/x 0001 550Ah 0001 5530h 1FFFh OOOOh OOOOh 1 0001 551 5h 0001553Ch x/8 0001550Dh 0001 5534h OFFOh OOOOh OOOOh 00015529h 0001 554Ch 28/x 0001550Dh 0001 5530h FFFFh OFFFh OOOOh 1 0001 551 Ch 0001 554Ch x/23 0001 5505h 0001 5535h FFEOh OFFFh OOOOh 00015527h 0001 5555h 31 /x 0001 5508h 0001 5536h FFCOh FFFFh 001 Fh 1 00015527h 0001 5550h x/31 0001 5508h 0001 5531 h FFFEh FFFFh OOOOh 0001552Ah 0001 5550h 32/x 0001 550Ah 0001 5530h FFFFh FFFFh OOOOh 1 0001 5520h 0001 555Ah x/32 00015500h 0001 553Ah FCOOh FFFFh 03FFh 12-146 Move Field - Indirect with Offset to Register MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE *Rs(offset). Rd [, FJ field at (*Rs + offset) -* Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 F Rs R Rd offset This MOVE instruction moves a field from a memory address to the desti- nation register. The address of the source data is formed by adding a signed, 16-bit offset to the contents of Rs. When the field is moved into the destination register, it is right justified and sign extended or zero ex- tended to 32 bits, according to the value of the current FE bit. This in- struction also performs an implicit compare to of the field data. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. Rs and Rd must be in the same register file. The following typical cases assume that the source data is aligned on a 16-bit boundary: 16-Bit Field 5,11 32-Bit Field 7,13 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the field-extended data moved to register is negative, otherwise C Unaffected Z 7 if the field-extended data moved to register is 0, otherwise V 12-147 MOVE Move Field - Indirect with Offset to Register Examples Assume that memory contains the following values before instruction exe- cution: Address Data 1 5530h 3333h 1 5540h 4444h 1 5550h 5555h Code Before After AO FS0/1 FE0/1 A1 NCZV. MOVE *A0(0000h) ,A1,1 0001 5530h x/1 x/1 FFFFFFFFh 1x00 MOVE *A0(0003h) ,A1,1 0001 552Fh x/2 x/0 OOOOOOOOh 0x10 MOVE *A0(0001h) ,A1,0 0001 552Fh 5/x 0/x 0000001 3 h 0x00 MOVE *AO(OOOFh) ,A1,0 0001552Dh 8/x 1/x 00000043 h 0x00 MOVE *A0(0020h) ,A1,1 0001 551 Ch x/1 3 x/0 00000443h 0x00 MOVE *AO(OOFFh) ,A1,0 0001 5435h 16/x 1/x 00004333h 0x00 MOVE *AO(OFFFh) ,A1,0 0001 4531 h 19/x 1/x FFFC3333h 1x00 MOVE *A0(7FFFh) ,A1,1 0000D531 h x/22 x/1 00043333h 0x00 MOVE *A0(0FFF2h) ,A1,1 0001 5540h x/25 x/0 01110CCCh 0x00 MOVE *A0(8000h) ,A1,0 0001 D530h 27/x 1/x FC443333h 1x00 MOVE *AO(OFFFOh) ,A1,0 0001 5540h 31 /x 0/x 44443333h 0x00 MOVE *AO(OFFEOh) ,A1,1 0001 5558h x/31 x/1 D5444433h 1x00 MOVE *AO(OFFECh) ,A1,0 0001 554Dh 32/x 0/x AAA2221 9h 1x00 MOVE *A0(001Dh) ,A1,0 0001 5520h 32/x 1/x AAAA2221 h 1x00 MOVE *A0(0020h) ,A1,1 0001 5520h x/32 x/0 55554444h 0x00 12-148 Move Field - Indirect with Offset to Indirect (Postincrement) MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE *Rs(offset), *Rd+ [. F] field at (*Rs + offset) -> *Rd Rd + field size -♦ Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 F Rs R Rd offset MOVE moves a field from the one memory location to another. Both the source and destination registers contain bit addresses. The source memory address is formed by adding the contents of the source register to the signed 16-bit offset. The destination register contains the address of the field's destination; after the move, the contents of Rd are incremented by the selected field size. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. Rs and Rd must be in the same register file. The following typical cases assume that the source data and the destination address are aligned on 16-bit boundaries: 16- Bit Field 5 + (1),12 32- Bit Field 7 + (3),16 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-149 MOVE Move Field - Indirect with Offset to Indirect (Postincrement) Examples Assume that memory contains the following values before instruction exe- cution: Address Data Address Data 1 5500h OOOOh 1 5530h 3333h 1551 Oh OOOOh 1 5540h 4444h 1 5520h OOOOh 1 5550h 5555h Code Before After @15500h @15520h AO A1 FSO/1 A1 @15510h MOVE *A0(0000h) ,*A1+,1 0001 5530h 001 5500h x/1 0001 5501 h 0001 h OOOOh OOOOh MOVE *A0(0001h),*Al+,l 0001 552 Fh 00015504h 5/x 00015509h 0130h OOOOh OOOOh MOVE *AO(OOOFh) ,*A1+,1 0001 552 Dh 0001550Ch 8/x 0001 551 4h 3000h 0004h OOOOh MOVE *A0(0020h) ,*A1+,1 0001 551 Ch 0001 55 JDh x/1 3 0001551Ah6000h 0088h OOOOh MOVE *AO(OOFFh) ,*A1+,1 0001 5535h 0001550Ch16/x 0001 551 Ch3000h 0433h OOOOh MOVE *AO(OFFFh) ,*A1+,1 0001 5531 h 0001 551 Oh 19/x 00015523h OOOOh 3333h 0004h MOVE *A0(7FFFh) ,*A1+,1 0000D531 h 0001 5508h x/22 0001 551 Eh 3300h 0433h OOOOh MOVE *A0(0FFF2h) ,*A1+,1 0001 5540h 0015500h x/25 0001 551 9h 0CCCh0111h OOOOh MOVE *A0(8000h),*Al+,l 0001 D530h 0001 5503h 27/x 0001 551 Eh 9998h 2221 h OOOOh MOVE *AO(OFFFOh) ,*A1+,1 0001 5540h 0001 5501 h 31 /x 0001 552Ah 6666h 8888h OOOOh MOVE *AO(OFFEOh) ,*A1+,1 0001 5558h 0001 5508h x/31 00015527h 3300h 4444h 0055h MOVE *AO(OFFECh) ,A1+,1 0001 554Dh 0001 550Ah 32/x 0001 5528h 3200h 4444h 0155h MOVE *A0(001Dh) ,A1+,1 0001 5520h 0001 551 Oh 32/x 00015530h OOOOh 2221 h AAAAh MOVE *A0(0020h) ,A1+,1 0001 5520h 0001 551 Oh x/32 00015530h OOOOh 4444h 5555h 12-150 Move Field - Indirect with Offset to Indirect with Offset MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE *Rs(SOffset). *Rd(DOffset) [. F] field at (*Rs + SOffset) -* (*Rd + DOffset) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 F Rs R Rd source offset destination offset This MOVE instruction moves a field from one memory location to another. Both the source and destination registers contain bit addresses. The ad- dress of the source address is formed by adding a signed 16-bit offset to the contents of the source register. The address of the destination location is formed by adding a signed 1 6-bit offset to the contents of the destination register. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. Rs and Rd must be in the same register file. The following typical cases assume that the source data and the destination address are aligned on 16-bit boundaries: 16-Bit Field 5 + (1),15 32-Bit Field 7 + (3),19 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-151 MOVE Move Field - Indirect with Offset to Indirect with Offset Examples Code Assume that memory contains the following values before instruction exe- cution: Address Data 15530h 3333h 1 5540h 4444h 15550h 5555h Address Data 1 5500h OOOOh 1551 Oh OOOOh 1 5520h OOOOh MOVE *A0( OOOOh) , MOVE *A0(0001h) , MOVE *A0(000Fh) , MOVE *A0(0020h) , MOVE *AO(OOFFh) , MOVE *AO(OFFFh) , MOVE *A0(7FFFh) , MOVE *A0(0FFF2h) MOVE *A0(8000h) , MOVE *A0(0FFF0h) MOVE *A0(0FFE0h) MOVE *A0(0FFECh) MOVE *A0(001Dh) , MOVE *A0(0020h) , *Al(0000h) ,1 *Al(0000h) ,0 *Al(000Fh) ,0 *Al(001Dh) ,1 *Al(0FFF8h) ,0 *Al(0FFFh) ,0 *Al(8000h) ,1 ,*Al(7FFFh) ,1 *Al(0020h) ,0 ,*Al(0010h) ,0 ,*Al(0FFE0h) ,1 ,*Al(0FFECh) ,0 *Al(0020h) ,0 *Al(0020h) ,1 Before AO 0001 5530h 0001552Fh 0001 552 Dh 0001 551 Ch 0001 5435h 0001 4531 h 0000D531h 0001 5540h 0001 D530h 0001 5540h 00015558h 0001554Dh 0001 5520h 0001 5520h After @1 5500h @15520h A1 FSO/1 §1551 Oh 001 5500h x/1 0001 h OOOOh OOOOh 0001 5504h 5/x 0130h OOOOh OOOOh 000154FDh 8/x 3000h 0004h OOOOh 0001 54F0h x/1 3 5000h 0088h OOOOh 0001 551 4h 16/x 3000h 0433h OOOOh 0001 451 1h 19/x OOOOh 3333h 0004h 0001 D508h x/22 3300h 0433h OOOOh 0000D501h x/25 0CCCh0111h OOOOh 000154E3h 27/x 9998h 2221 h OOOOh 000154F1h 31 /x 6666h 8888h OOOOh 00015528h x/31 3300h 4444h 0055h 0001 551 Dh 32/x 3200h 4444h 0155h 0001 54F0h 32/x OOOOh 2221 h AAAAh 0001 54F0h x/32 OOOOh 4444h 5555h 12-152 Move Field - Absolute to Register MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE @SA ddress, Rd [. F] field at SAddress -» Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 F 110 1 R Rd 16 LSBs of source address 16 MSBs of source address This MOVE instruction moves a field from memory to the destination reg- ister. The field data for the move is contained at a source-memory bit ad- dress. When the field is moved into the destination register, it is right justified and sign extended or zero extended to 32 bits according to the selected value of FE. This instruction also performs an implicit compare to of the field data. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. The following typical cases assume that the source data is aligned on a 16-bit boundary: 16-Bit Field 5,15 32-Bit Field 7,13 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N 7 if the field -extended data moved to register is negative, otherwise C Unaffected Z 7 if the field-extended data moved to register is 0, otherwise V 12-153 MOVE Move Field - Absolute to Register Examples Assume that memory contains the following values before instruction exe- cution: Address Data 15500h 7770h 1551 Oh 7777h Code Before After FEO/1 FSO/1 A1 NCZV MOVE @15500h,Al,l x/0 x/1 OOOOOOOOh 0x10 MOVE @15500h,Al,0 0/x 5/x 0000001 Oh 0x00 MOVE @15503h,Al,l x/1 x/5 0000000 Eh 0x00 MOVE §15500h,Al,0 0/x 12/x 00000770h 0x00 MOVE @1550Dh,Al,l x/1 x/1 2 FFFFFBBBh 1x00 MOVE @15504h,Al,0 1/x 18/x FFFF7777h 1x00 MOVE @15500h,Al,l x/0 x/1 8 00037770h 0x00 MOVE @15500h,Al,0 0/x 27/x 07777770h 0x00 MOVE @15500h,Al,l x/1 x/27 FF777770h 1x00 MOVE §15501h,Al,0 0/x 30/x 3BBBBBB8h 0x00 MOVE @15501h,Al,l x/1 x/30 FBBBBBB8h 1x00 MOVE @15500h,Al,0 x/x 32/x 77777770h 0x00 12-154 Move Field -Absolute to Indirect (Postincrement) MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE QSAddress, *Rd+ [. F] *Rd field at SAddress Rd + field size - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 F R Rd 16 LSBs of source address 1 6 MSBs of source address This MOVE instruction moves a field from one location in memory to an- other. The source address is a 32-bit address; the destination address is specified by the contents of Rd. After the move, the contents of the desti- nation register are incremented by the field size. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FS0 F=1 selects FS1 The SETF instruction sets the field size and extension. Rs and Rd must be in the same register file. The following typical cases assume that the source data and the destination address are aligned on 16-bit boundaries: 16-Bit Field 5+(1),15 32-Bit Field 7 + (3),19 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-155 MOVE Move Field - Absolute to Indirect (Postincrement) Examples Assume that memory contains the following values before instruction exe- cution: Address Data Address Data 1 5500h FFFFh 15530h OOOOh t 1551 Oh FFFFh 15540h OOOOh i 1 5520h FFFFh 15550h OOOOh i Code Before After @15500h @15520h AO A1 FEO/1 AT @15510h MOVE §15500, *A1+,1 00015530h 0001 5531 h x/1 0001 5531 h 0001 h OOOOh OOOOh MOVE §15500, *Al+,0 0001 5534h 0001 5539h 5/x 0001 5539h 01F0h OOOOh OOOOh MOVE §15500, *A1+,1 0001553Ah 0001 5544h x/10 0001 5544h FCOOh OOOFh OOOOh MOVE §15500, *Al+,0 0001 553Fh 0001 5552h 19/x 0001 5552h 8000h FFFFh 0003h MOVE §15504, *A1+,1 0001 5530h 00015537h x/7 0001 5537h 007 Fh OOOOh OOOOh MOVE §1550A, *Al+,0 00015530h 0001553Dh 13/x 0001 553 Dh 1FFFh OOOOh OOOOh MOVE §1550D, *A1+,1 00015534h 0001 5536h x/8 0001 5536h OFFOh OOOOh OOOOh MOVE §1550D, ,*Al+,0 0001 5530h 0001 554Ch 28/x 0001 554Ch FFFFh OFFFh OOOOh MOVE §15505, *A1+,1 0001 5535h 0001 554 Dh x/23 0001554Dh FFEOh OFFFh OOOOh MOVE §15508, *Al+,0 0001 5536h 0001 5555h 31 /x 0001 5555h FFCOh FFFFh 001 Fh MOVE §15508, *A1+,1 0001 5531 h 0001 5548h x/31 0001 5548h FFFEh FFFFh OOOOh MOVE §1550A, *Al+,0 00015530h 0001 5550h 32/x 0001 5550h FFFFh FFFFh OOOOh MOVE §15500, *A1+,1 0001553Ah 0001 555Ah x/32 0001 555Ah FCOOh FFFFh 03FFh 12-156 Move Field - Absolute to Absolute MOVE Syntax Execution Instruction Words Description Machine States Status Bits MOVE QSAddress, QDAddress [. F] field at SAddress -» DAddress 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 F 1 1 1 16 LSBs of source address 16 MSBs of source address 16 LSBs of destination address 16 MSBs of destination address This MOVE instruction moves a field from one location in memory to an- other. Both memory addresses are 32- bit addresses. The field size for the move is 1-32 bits, depending on the selected field size; the field is right justified within the source register. The optional F param- eter determines the field size and extension for the move: F=0 selects FSO F=1 selects FS1 The SETF instruction sets the field size and extension. The following typical cases assume that the source data and the destination address are aligned on 16-bit boundaries: 16- Bit Field 7 + (1),12 32-Bit Field 9+(3),27 For other cases, see MOVE and MOVB Instructions Timing, Section 13.2. N Unaffected C Unaffected Z Unaffected V Unaffected 12-157 MOVE Move Field - Absolute to Absolute Examples Assume that memory contains the following values before instruction exe- cution: Address Data 1 5500h FFFFh 1551 Oh FFFFh 15520h FFFFh 1 5530h OOOOh 1 5540h OOOOh 1 5550h OOOOh Code Before After FSO/1 @15530h @15540h @15550h MOVE @15500h, ,@15530h, ,1 x/1 0001 h OOOOh OOOOh MOVE @15500h, ,@15534h, .0 5/x 01F0h OOOOh OOOOh MOVE @15500h, ,@1553Ah, .1 x/10 FCOOh 000 Fh OOOOh MOVE @ 15 500b, ,@1553Fh, .0 19/x 8000h FFFFh 0003 h MOVE @15504h, ,@15530h, ,1 x/7 007 Fh OOOOh OOOOh MOVE @1550Ah, ,§1553011, ,0 13/x 1FFFh OOOOh OOOOh MOVE 01550011, ,@15534h, ,1 x/8 OFFOh OOOOh OOOOh MOVE (§1550011, r @15530h, ,0 28/x FFFFh OFFFh OOOOh MOVE (91550511, ,@15535h, ,1 x/23 FFEOh OFFFh OOOOh MOVE (§1550811, ,@15536h, ,0 31 /x FFCOh FFFFh 001 Fh MOVE @ 1550811, ,@15531h, ,1 x/31 FFFEh FFFFh OOOOh MOVE @1550Ah, ,@15530h, .0 32/x FFFFh FFFFh OOOOh MOVE @15500h, ,@1553Ah, ,0 x/32 FCOOh FFFFh 03FFh 12-158 Move Immediate - 16 Bits MOVI Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVI /W,Rdf,\NJ IW - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 111 R Rd 16-bit value MOVI stores a 16-bit, sign -extended immediate value in the destination register. (/I/I/ in the instruction syntax represents the 16-bit value.) The assembler uses the short form if the immediate value has been previ- ously defined and is in the range -32,768 through 32,767. You can force the assembler to use the short form by following the register operand with ,W: MOVI IW,Rd,W The assembler truncates the upper bits and issue an appropriate warning message. 2,8 N 7 if the data being moved is negative, otherwise C Unaffected Z 7 if the data being moved is 0, otherwise V Code After AO NCZV MOVI 32767, AO 00007FFFh 0x00 MOVI 1,A0 00000001 h 0x00 MOVI 0,A0 OOOOOOOOh 0x10 MOVI -1,A0 FFFFFFFFh 1x00 MOVI -32768, AO FFFF8000h 1x00 MOVI 0000h,A0 OOOOOOOOh 0x10 MOVI 7FFFh,AO 00007FFFh 0x00 12-159 MOVI Move Immediate - 32 Bits Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVI /L,Rd[,LJ IL - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 111 1 R Rd 16 LSBsof IL 16 MSBsof IL MOVI stores a 32-bit immediate value in the destination register. {IL in the instruction syntax represents the 32- bit value.) The assembler uses this opcode if it cannot use the movi iw,Rd opcode, or if the long opcode is forced by following the register operand with ,L: MOVI IL,Rd,L 3,12 N 7 if the data being moved is negative, otherwise C Unaffected Z /if the data being moved is 0, otherwise V Code After A0 NCZV MOVI 2147483647, A0 7FFFFFFFh 0x00 MOVI 32768, A0 00008000h 0x00 MOVI -32769, A0 FFFF7FFFh 1x00 MOVI -2147483648, A0 80000000h 1x00 MOVI 8000h,A0 00008000h 0x00 MOVI 0FFFFFFFFh,A0 FFFFFFFFh 1x00 MOVI 0FFFFh,A0,L FFFFFFFFh 1x00 12-160 Move Constant (5 Bits) MOVK Syntax Execution Instruction Words Description Machine States Status Bits Examples MOVK K.Rd K -•> Rd 15 14 13 12 11 10 9 8 1 110 K R Rd MOVK stores a 5-bit constant in the destination register. (K in the in- struction syntax represents the constant.) The constant is treated as an unsigned number in the range 1-32, where K = in the opcode corre- sponds to a value of 32. The resulting constant value is zero extended to 32 bits. Note that you cannot set a register to with this instruction. You can clear a register by XORing the register with itself; use clr Rd (an alternate mnemonic for XOR) to accomplish this. Both these methods alter the Z bit (set it to 1). 1,4 N Unaffected C Unaffected Z Unaffected V Unaffected Code After A0 00000001 h 00000008h 0000001 Oh 00000020h MOVK 1,A0 MOVK 8,A0 MOVK 16,A0 MOVK 32,A0 12-161 MOVX Move X Half of Register Syntax Execution Instruction Words Description MOVX Rs, Rd RsX - RdX 15 14 13 12 11 10 9 8 1 1110 110 Rs R Rd MOVX moves the X half of the source register (16 LSBs) to the X half of the destination register. The Y halves of both registers are unaffected. You an also use the MOVX and MOVY instructions for handling packed 16-bit quantities and XY addresses. You can use the RL instruction to swap the contents of X and Y. Rs and Rd must be in the same register file. Machine States 1,4 Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples Code Before After A0 A1 A1 MOVX A0,A1 OOOOOOOOh FFFFFFFFh FFFFOOOOh MOVX A0,A1 12345678h OOOOOOOOh 00005678h MOVX A0,AI FFFFFFFFh OOOOOOOOh OOOOFFFFh 12-162 Move Y Half of Register MOW Syntax Execution Instruction Words Description Machine States Status Bits Examples MOW Rs.Rd RsY - RdY 15 14 13 12 11 10 9 8 1 1110 111 Rs R Rd MOW moves the Y half of the source register (16 MSBs) to the Y half of the destination register. The X halves of both registers are unaffected. You an also use the MOVX and MOVY instructions for handling packed 16-bit quantities and XY addresses. You can use the RL instruction to swap the contents of X and Y. Rs and Rd must be in the same register file. 1,4 N Unaffected C Unaffected Z Unaffected V Unaffected Code MOVY A0,A1 MOVY A0,A1 MOVY A0,A1 Before AO OOOOOOOOh 12345678h FFFFFFFFh A1 FFFFFFFFh OOOOOOOOh OOOOOOOOh After Al OOOOFFFFh 1 2340000h FFFFOOOOh 12-163 MPYS Multiply Registers - Signed Syntax Execution MPYS Rs,Rd Rd Even: Rd Odd: Rs x Rd Rs x Rd Rd:Rd + 1 Rd Instruction Words Description 15 14 13 12 11 10 9 8 1 10 1110 Rs R Rd MPYS performs a signed multiply of a variably-sized field in the source re- gister by the 32 bits in the destination register. This produces a 32-bit to a 64-bit result, depending on the register and field definitions. Note that Rs and Rd must be in the same register file. The value of field size 1 (FS1 ) defines the size of the multiplier in Rs. FS1 may have any even value n from 2 to 32 (that is, n = 2, 4, 6 ... 30, 32). The instruction executes a 32-bit-by-/7-bit multiply- multiplying the 32 bits in Rd by the n bits in Rs. All values are signed. The MSB of the source field (bit n - 1 in Rs) defines the sign of the field; the bits to the left of bit n are ignored. The MSB of Rd defines the sign of the multiplicand. Contents of Rs (n = FS1): 31 n /i-1 Contents of Rd: 31 ignored T sign bit n-bit multiplier T sign bit 32-bit multiplicand MPYS has two modes, depending on whether Rd is even or odd: • Rd Even: MPYS multiplies the contents of Rd by the /7-bit field in Rs, and stores the result in two consecutive registers, Rd and Rd + 1. (For example, if Rd = B4, the result is stored in registers B4 and B5.) The result is sign extended and right justified; the 32 MSBs are stored in Rd and the 32 LSBs are stored in Rd + 1 . Note that all 32 bits of both registers are used, regardless of the field size of the multiply. Do not use A14 or B14 as the destination register, because Rd + 1 (A15 or B15) is the stack pointer register (SP). It is not desirable to write over the contents of the SP. Contents of Rd (even register): Contents of Rd+1 (odd register): 31 31 sign n MSBs of result 32 LSBs of result Rd Odd: MPYS multiplies the contents of Rd by the /7-bit field in Rs, and stores the 32 LSBs of the result in Rd; Rs is not changed. If the result is greater than 32 bits, the extra MSBs are discarded, regardless of the field size. Contents of Rd (odd register): 31 32 MSBs are discarded 32 LSBs of result 12-164 Multiply Registers - Signed MPYS Machine States 5 + FS1 /2, 8 + FS1 /2 Status Bits N 7 if the result is negative, otherwise C Unaffected Z 7 if the result is 0, otherwise V Unaffected Example 1 mpys ai, ao Before After AO A1 FS1 AO A1 NCZV OOOOOOOOh OOOOOOOOh 32 OOOOOOOOh OOOOOOOOh Ox1x 7FFFFFFFh 7FFFFFFFh 32 3FFFFFFFh 00000001 h OxOx 7FFFFFFFh FFFFFFFFh 32 FFFFFFFFh 80000001 h 1xOx FFFFFFFFh 7FFFFFFFh 32 FFFFFFFFh 80000001 h 1xOx FFFFFFFFh FFFFFFFFh 32 OOOOOOOOh 00000001 h OxOx 80000000h 7FFFFFFFh 32 COOOOOOOh 80000000h 1xOx 80000000h 80000000h 32 40000000h OOOOOOOOh OxOx 80000001 h 80000000h 32 3FFFFFFFh 80000000h OxOx 80401 56 Fh 7FF3B074h 32 C0262CDCh 53E486F8h 1xOx 80401 56 Fh 7FF3B074h 24 000624B1 h 53E486F8h OxOx 80401 56 Fh 7FF3B074h 20 FFFE28B2h 594486 F8h 1xOx 80401 56 Fh 7FF3B074h 16 000027 B2h 17EC86F8h OxOx 80401 56Fh 7FF3B074h 14 000007 C2h 1 C0206F8h OxOx 80401 56 Fh 7FF3B074h 8 FFFFFFC6h 1 D0766F8h 1xOx 80401 56 Fh 7FF3B074h 6 00000005h FCFF3BF8h OxOx 80401 56 Fh 7FF3B074h 4 FFFFFFFEh 01 0041 58h 1xOx 80401 56 Fh 7FF3B074h 2 OOOOOOOOh OOOOOOOOh 0x1 x Example 2 mpys ao,ai Before After AO A1 FS1 AO A1 NCZV OOOOOOOOh OOOOOOOOh 32 unchanged OOOOOOOOh Ox1x 7FFFFFFFh 7FFFFFFFh 32 unchanged 00000001 h OxOx 7FFFFFFFh 7FFFFFFFh 32 unchanged 80000001 h 1xOx FFFFFFFFh 7FFFFFFFh 32 unchanged 80000001 h 1xOx FFFFFFFFh FFFFFFFFh 32 unchanged 00000001 h OxOx 80000000h 7FFFFFFFh 32 unchanged 80000000h 1xOx 80000000h 80000000h 32 unchanged OOOOOOOOh OxOx 80000001 h 80000000h 32 unchanged 80000000h OxOx 7FF3B074h 80401 056h 32 unchanged 53E486F8h 1xOx 7FF3B074h 80401 056h 24 unchanged 53E486F8h OxOx 7FF3B074h 80401 056h 20 unchanged 594486F8h 1xOx 7FF3B074h 80401 056h 16 unchanged 17EC86F8h OxOx 7FF3B074h 80401 056h 14 unchanged 1 C0206F8h OxOx 7FF3B074h 80401 056h 8 unchanged 1 D0766F8h 1xOx 7FF3B074h 80401 056 h 6 unchanged FCFF3BF8h OxOx 7FF3B074h 80401 056h 4 unchanged 01 0041 58h 1xOx 7FF3B074h 80401 056h 2 unchanged OOOOOOOOh Ox1x 12-165 MPYU Multiply Registers - Unsigned Syntax Execution MPYU Rs.Rd Rd Even: Rs x Rd Rd Odd: Rs x Rd Rd:Rd + 1 Rd Instruction Words Description 15 14 13 12 11 10 9 8 10 1111 Rs R Rd MPYU performs an unsigned multiply of a variably-sized field in the source register by the 32 bits in the destination register. This produces a 32-bit to a 64-bit result, depending on the register and field definitions. Note that Rs and Rd must be in the same register file. The value of field size 1 (FS1 ) defines the size of the multiplier in Rs. FS1 may have any even value n from 2 to 32 (that is, n = 2, 4, 6 ... 30, 32). The instruction executes a 32-bit-by-n-bit multiply- multiplying the 32 bits in Rd by the n bits in Rs. All values are unsigned. Contents of Rs (n = FS1): 31 n n-1 Contents of Rd: 31 ignored n-bit multiplier 32-bit multiplicand MPYS has two modes, depending on whether Rd is even or odd: • Rd Even: MPYU multiplies the contents of Rd by the /7-bit field in Rs, and stores the result in two consecutive registers, Rd and Rd + 1. (For example, if Rd = B4, the result is stored in registers B4 and B5.) The result is zero extended and right justified; the 32 MSBs are stored in Rd and the 32 LSBs are stored in Rd + 1 . Note that all 32 bits of both registers are used, regardless of the field size of the multiply. Do not use A14 or B14 as the destination register, because Rd + 1 (A1 5 or B1 5) is the stack pointer register (SP). It is not desirable to write over the contents of the SP. Contents of Rd (even register): Contents of Rd+1 (odd register): 31 31 0s n MSBs of result 32 LSBs of result Rd Odd: MPYU multiplies the contents of Rd by the /7-bit field in Rs, and stores the 32 LSBs of the result in Rd; Rs is not changed. If the result is greater than 32 bits, the extra MSBs are discarded, regardless of the field size. Contents of Rd (odd register): 31 32 MSBs are discarded 32 LSBs of result 12-166 Multiply Registers - Unsigned MPYU Machine States Rs nonnegative: 5 + FS1/2, 8 + FS1/2 Rs negative: 6 + FS1/2, 9 + FS1/2 Status Bits N Unaffected C Unaffected Z 7 if the resu It is 0, otherwise V Unaffected Example 1 MPYU A1,A0 Before After AO A1 FS1 AO A1 NCZV FFFFOOOOh 1 OOOOOOOh 32 OFFFFOOOh OOOOOOOOh xxOx FFFFOOOOh 1 0001 01 Oh 32 1000000Fh EFFOOOOOh xxOx FFFFOOOOh 1 0001 01 Oh 16 00001 00 Fh EFFOOOOOh xxOx FFFFOOOOh 1 0001 01 Oh 8 0000000 Fh FFFOOOOOh xxOx FFFFOOOOh 10001 01 Oh 4 OOOOOOOOh OOOOOOOOh xxlx 08001 056h 0003B074h 32 00001 D83h DC4486F8h xxOx 08001 056h 0003B074h 16 00000583h AB4286F8h xxOx 08001 056h 0003B074h 14 000001 83h A31786F8h xxOx 08001 056h 0003B074h 8 00000003h A00766F8h xxOx 08001 056h 0003B074h 6 00000001 h A00351 78h xxOx 08001 056h 0003B074h 4 OOOOOOOOh 200041 58h xxOx 08001 056h 0003B074h 2 OOOOOOOOh OOOOOOOOh xxlx Example 2 Before MPYU A0,A1 After AO A1 FS1 AO A1 NCZV 1 OOOOOOOh FFFFOOOOh 32 unchanged OOOOOOOOh xxOx 10001 01 Oh FFFFOOOOh 32 unchanged EFFOOOOOh xxOx 10001 01 Oh FFFFOOOOh 16 unchanged EFFOOOOOh xxOx 10001 01 Oh FFFFOOOOh 8 unchanged FFFOOOOOh xxOx 10001 01 Oh FFFFOOOOh 4 unchanged OOOOOOOOh xxlx 0003B074h 08001 056h 32 unchanged DC4486F8h xxOx 0003B074h 08001 056h 16 unchanged AB4286F8h xxOx 0003B074h 08001 056h 14 unchanged A31 786F8h xxOx 0003B074h 08001 056h 8 unchanged A00766F8h xxOx 0003B074h 08001 056h 6 unchanged A00351 78h xxOx 0003B074h 08001 056h 4 unchanged 200041 58h xxOx 0003B074h 08001 056h 2 unchanged OOOOOOOOh xxlx 12-167 NEG Negate Register Syntax NEG Rd Execution 2s complement of Rd -*■ Rd Instruction Words 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00000011101R Rd Description NEG stores the 2s complement of the contents of the destination register back into the destination register. Machine States 1,4 Status Bits N 7 if the result is negative, otherwise C 7 if there is a borrow (Rd * 0), otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow (Rd = 80000000h), otherwise Examples Code Before After AO NCZV AO neg ao OOOOOOOOh 0010 OOOOOOOOh NEG AO 55555555h 1100 AAAAAAABh NEG AO 7FFFFFFFh 1100 80000001 h neg AO 80000000h 1101 80000000h NEG AO 80000001 h 0100 7FFFFFFFh NEG AO FFFFFFFFh 0100 00000001 h 12-168 Negate Register with Borrow NEGB Syntax Execution Instruction Words Description Machine States Status Bits Examples NEGB Rd (2s complement of Rd) - C Rd 15 14 13 12 11 10 9 8 1 1 1 1 1 R Rd NEGB takes the 2s complement of the destination register's contents and decrements by 1 if the borrow bit (C) is set; the result is stored in the des- tination register. This instruction can be used in sequence with itself and with the NEG instruction for negating multiple-register quantities. 1,4 N 7 if the result is negative, otherwise C 7 if there is a borrow, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Code Before After AO C IMCZV AO NEGB A0 OOOOOOOOh 0010 OOOOOOOOh NEGB A0 OOOOOOOOh 1 1100 FFFFFFFFh NEGB A0 55555555h 1100 AAAAAAABh NEGB A0 55555555h 1 1100 AAAAAAAAh NEGB AO 7FFFFFFFh 1100 80000001 h NEGB AO 7FFFFFFFh 1 1100 80000000h NEGB AO 80000000h 1101 80000000h NEGB AO 80000000h 1 0100 7FFFFFFFh NEGB AO 80000001 h 0100 7FFFFFFFh NEGB AO 80000001 h 1 0100 7FFFFFFEh NEGB AO FFFFFFFFh 0100 00000001 h NEGB AO FFFFFFFFh 1 0110 OOOOOOOOh 12-169 NOP No Operation Syntax Execution Instruction Words Description NOP No operation 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 The program counter is incremented to point to the next instruction. The processor status is otherwise unaffected. You an use the NOP instruction to pad loops and perform other timing functions. Machine States 1,4 Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Example Code Before After PC nop 00020000h PC 0002001 Oh 12-170 Complement Register NOT Syntax Execution Instruction Words Description Machine States Status Bits Examples NOT Rd NOT Rd -* Rd 15 14 13 12 11 10 9 8 1 1 1 1 R Rd NOT stores the 1s complement of the destination register's contents back into the destination register. 1,4 N Unaffected C Unaffected Z /if the result is 0, otherwise V Unaffected Code Before After AO NCZV AO NOT A0 OOOOOOOOh xxOx FFFFFFFFh NOT A0 55555555h xx Ox AAAAAAAAh NOT AO FFFFFFFFh xxlx OOOOOOOOh NOT AO 80000000h xxOx 7FFFFFFFh 12-171 OR OR Registers Syntax Execution Instruction Words Description Machine States Status Bits Examples OR Rs.Rd Rs OR Rd - Rd 15 14 13 12 11 10 9 8 1 10 10 10 Rs R Rd This instruction bitwise-ORs the contents of the source register with -the contents of the destination register; the result is stored in the destination register. Rs and Rd must be in the same register file. 1,4 N Unaffected C Unaffected Z 7 if the result is 0, otherwise V Unaffected Code Before After A0 A1 A1 NCZV OR A0 rAl FFFFFFFFh OOOOOOOOh FFFFFFFFh xxOx OR A0 r Al OOOOOOOOh FFFFFFFFh FFFFFFFFh xxOx OR A0 rAl 55555555h AAAAAAAAh FFFFFFFFh xxOx OR A0 rAl OOOOOOOOh OOOOOOOOh OOOOOOOOh xxlx 12-172 OR Immediate (32 Bits) ORI Syntax Execution /nstruct/on Words Description Machine States Status Bits Examples ORI IL. Rd ILOR Rd - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1110 1 R Rd 16 LSBsof IL 16 MSBsof IL This instruction bitwise-ORs a 32-bit immediate value with the contents of the destination register and stores the result in the destination register. {IL in the syntax represents the 32-bit value.) 3,12 N Unaffected C Unaffected Z /if the result is 0, otherwise V Unaffected Code ORI 0FFFFFFFFh,A0 ORI 0O000OOOh,AO ORI OAAAAAAAAh , A0 ORI 00000000h,A0 Before AO OOOOOOOOh FFFFFFFFh 55555555h OOOOOOOOh After AO FFFFFFFFh FFFFFFFFh FFFFFFFFh OOOOOOOOh IMCZV xxOx xxOx xxOx xxlx 12-173 PIXBLT Pixel Block Transfer - Binary to Linear Syntax Execution Instruction Words Description Implied Operands PIXBLT B, L binary pixel array -*■ linear pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 This PIXBLT instruction expands, transfers, and processes a binary source pixel array with a destination pixel array. This instruction operates on two-dimensional arrays of pixels using linear starting addresses for both the source and the destination. The source pixel array is treated as a one bit per pixel array. As the PixBIt proceeds, the source pixels are expanded and then combined with the corresponding destination pixels based on the selected graphics operations. Note that the parameters are entered exactly as shown in the syntax; that is, the instruction is entered as pixblt b,l. The first parameter, B, indi- cates that the starting address of the source array is a linear address but the source array is a binary array. The second parameter, L, indicates that the starting address of the destination array is a linear address. The following set of implied operands govern the operation of the instruction and define the source and destination arrays. B File Registers Register Name Format Description BOt SADDR Linear Source pixel array starting address B1 SPTCH Linear Source pixel array pitch B2t DADDR Linear Destination pixel array starting address B3 DPTCH Linear Destination pixel array pitch B7 DYDX XY Pixel array dimensions (rowsxolumns) B8 COLOR0 Pixel Background expansion color B9 COLOR1 Pixel Foreground expansion color B10-B14t Reserved registers I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) T -Transparency operation C00001 50h PSIZE Pixel size (1,2,4,8,16) C00001 60h PMASK Plane mask - pixel format t These registers are changed by PIXBLT execution. Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXBLT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an instruction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. 12-174 Pixel Block Transfer - Binary to Linear PIXBLT Source Array The source pixel array for the expand operation is defined by the contents of the SADDR, SPTCH, and DYDX registers: • At the outset of the instruction, SADDR contains the linear address of the pixel with the lowest address in the array. During instruction execution, SADDR points to the address of the next set of 32 pixels to be read from the source array. When the transfer is complete, SADDR points to the linear address of the first pixel on the next row of pixels that would have been moved if the block transfer continued. • SPTCH contains the linear difference in the starting addresses of ad- jacent rows of the source array. For this PIXBLT instruction, SPTCH can be any value. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays. The DY portion of DYDX contains the number of rows in the array; the DX portion contains the number of pixels per row. Source Expansion The actual values of the source pixels are determined by the interaction of the source array with the contents of the COLOR1 and COLORO registers. In the expansion operation, a 1 bit in the source array selects a pixel from the COLOR1 register for operation on the destination array. A bit in the source array selects a COLORO pixel for this purpose. The pixels selected from the COLOR1 and COLORO registers are those that align directly with their intended position in the destination array word. The location of the destination pixel block is defined by the contents of the DADDR, DPTCH, and DYDX registers: • At the outset of the instruction, DADDR contains the linear address of the pixel with the lowest address in the array. During instruction execution, DADDR points to the next pixel (or word of pixels) to be modified in the destination array. When the block transfer is com- plete, DADDR points to the linear address of the first pixel on the next row of pixels that would have been moved if the block transfer continued. • DPTCH contains the linear difference in the starting addresses of ad- jacent rows of the destination array (typically this is the screen pitch). DPTCH must be a multiple of 1 6. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays. The DY portion of DYDX contains the number of rows in the array; the DX portion contains the number of pixels per row. Corner Adjust No corner adjust is performed for this instruction PBH and PBV are' ignored. The pixel transfer simply proceeds in the order of increasing linear addresses. Destination Array Window Checking You cannot use window checking with this PixBIt instruction. The con- tents of the WSTART and WEND registers are ignored. 12-175 PIXBLT Pixel Block Transfer - Binary to Linear Pixel Processing You can select a pixel processing option for this instruction by setting the PPOP bits in the CONTROL register. The pixel processing operation is applied to expanded pixels as they are processed with the destination array; that is, the data is first expanded and then processed. There are 1 6 Boolean and 6 arithmetic operations; the default case at reset is the replace (S -* D) operation. The 6 arithmetic operations do not operate with pixel sizes of one or two bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) pixels after it expands and processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. Interrupts This instruction can be interrupted at a word or row boundary of the desti- nation array. When the PixBIt is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on the stack. At this time, DPTCH, SPTCH, and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modi- fied after the interrupt is processed. SADDR points to the address of the next 32 pixels to be read from the source array after the interrupt is proc- essed. The PIXBLT instruction uses several I/O and B-file registers as implied op- erands. If an interrupt service routine modifies a register that the PIXBLT uses as an implied operand, you must restore that register to the value it had when the routine began, before returning from the routine. (You can use the MMFM and MMTM instructions to save and restore the B-file regis- ters.) In order to maintain compatibility with future TMS340 devices, use only the RETI instruction to return from an interrupt routine. Shift Register Transfers If the SRT bit in the DPYCTL I/O register is set, each memory read or write initiated by the PixBIt generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers. (Not all VRAMs support this capability.) Machine States Status Bits Examples See PIXBLT Expand Instructions Timing, Section 13.5. N Undefined C Undefined Z Undefined V Undefined Before executing the PIXBLT instruction, load the implied operand registers with appropriate values. These PIXBLT examples use the following implied operand setup: Register File B: SADDR (BO) - 00002030h SPTCH (B1) = 000001 OOh DADDR (B2) = 00033000h I/O Registers: PSIZE =001 Oh 12-176 Pixel Block Transfer - Binary to Linear PIXBLT DPTCH (B3) DYDX (B7) COLORO (B8) COLOR1 (B9) = 00001 OOOh = 0002001 Oh - FEDCFEDCh = BA98BA98h Additional implied operand values are listed with each example. For this example, assume that memory contains the following data before instruction execution. Linear Data Address 02000h xxxxh, xxxxh, xxxxh, 1234h, xxxxh, xxxxh, xxxxh, xxxxh 02080h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 021 OOh xxxxh, xxxxh, xxxxh, 5678h, xxxxh, xxxxh, xxxxh, xxxxh 021 80h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 33000h FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh 33080h FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh 34000h FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh 34080h FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh Example 1 This example uses the replace (S instruction execution, PMASK - PP=00000). -* D) pixel processing operation. Before OOOOh and CONTROL - OOOOh (T=0, After instruction execution, memory contains the following values: Linear Address 33000h 33080h 34000h 34080h Data FEDCh, FEDCh, BA98h, FEDCh, BA98h, BA98h, FEDCh, FEDCh FEDCh, BA98h, FEDCh, FEDCh, BA98h, FEDCh, FEDCh, FEDCh FEDCh, FEDCh, FEDCh, BA98h, BA98h, BA98h, BA98h, FEDCh FEDCh, BA98h, BA98h, FEDCh, BA98h, FEDCh, BA98h, FEDCh Example 2 This example uses the (D - S) struction execution, PMASK PP = 10010). D pixel processing operation. Before in- OOOOh and CONTROL = 4800h (T=0, After instruction execution, memory contains the following values: Linear Address 33000h 33080h Data 0123h, 0123h, 4567h, 0123h, 4567h, 4567h, 0123h, 0123h 0123h, 4567h, 0123h, 0123h, 4567h, 0123h, 0123h, 0123h 34000h 0123h, 0123h, 0123h, 4567h, 4567h, 4567h, 4567h, 0123h 34080h 0123h, 4567h, 4567h, 0123h, 4567h, 0123h, 4567h, 0123h 12-177 PIXBLT Pixel Block Transfer - Binary to Linear Example 3 This example uses transparency with COLORO = OOOOOOOOh. Before in- struction execution, PMASK - OOOOh and CONTROL = 0020h (T=1, W=00, PP=00000). After instruction execution, memory contains the following values: Linear Data Address 33000h FFFFh, FFFFh, BA98h, FFFFh, BA98h, BA98h, FFFFh, FFFFh 33080h FFFFh, BA98h, FFFFh, FFFFh, BA98h, FFFFh, FFFFh, FFFFh 34000h FFFFh, FFFFh, FFFFh, BA98h, BA98h, BA98h, BA98h, FFFFh 34080h FFFFh, BA98h, BA98h, FFFFh, BA98h, FFFFh, BA98h, FFFFh Example 4 This example uses plane masking the four LSBs are masked. Before instruction execution, PMASK = OOOFh and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: Linear Address 33000h 33080h 34000h 34080h Data FEDFh, FEDFh, BA9Fh, FEDFh, BA9Fh, BA9Fh, FEDFh, FEDFh FEDFh, BA9Fh, FEDFh, FEDFh, BA9Fh, FEDFh, FEDFh, FEDFh FEDFh, FEDFh, FEDFh, BA9Fh, BA9Fh, BA9Fh, BA9Fh, FEDFh FEDFh, BA9Fh, BA9Fh, FEDFh, BA9Fh, FEDFh, BA9Fh, FEDFh 12-178 Pixel Block Transfer - Binary to XY PIXBLT Syntax Execution Instruction Words Description Implied Operands PIXBLT B, XY binary pixel array -» XY pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 This PIXBLT instruction expands, transfers, and processes a binary source pixel array with a destination pixel array. This instruction operates on two-dimensional arrays of pixels using a linear starting address for the source and an XY address for the destination. The source pixel array is treated as a one bit per pixel array. As the PixBIt pro- ceeds, the source pixels are expanded and then combined with the corre- sponding destination pixels based on the selected graphics operations. Note that the parameters are entered exactly as shown in the syntax; that is, the instruction is entered as pixblt b,xy. The first parameter, B, indi- cates that the starting address of the source array is a linear address but the source array is a binary array. The second parameter, XY, indicates that the starting address of the destination array is an XY address. The following set of implied operands govern the operation of the in- struction and define the source and destination arrays. B File Registers Register Name Format Description BOt SADDR Linear Source pixel array starting address B1 SPTCH Linear Source pixel array pitch B2tt DADDR XY Destination pixel array starting address B3 DPTCH Linear Destination pixel array pitch B4 OFFSET Linear Screen origin (0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner B7* DYDX XY Pixel array dimensions (rowsxolumns) B8 COLOR0 Pixel Background expansion color B9 COLOR1 Pixel Foreground expansion color B10-B14t Reserved registers I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) W -Window clipping or pick operation T -Transparency operation C0000130h CONVSP XY-to-linear conversion (source pitch) Used for source preclipping. C00001 40h CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,6,8,16) C0000160h PMASK Plane mask - pixel format 1" These registers are changed t Used for common rectangle by PIXBLT execution. function with window hit operation (W=1). 12-179 PIXBLT Pixel Block Transfer - Binary to XY Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXBLT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an instruction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. Source Array The source pixel array for the expand operation is defined by the contents of the SADDR, SPTCH, DYDX, and (possibly) CONVSP registers: • At the outset of the instruction, SADDR contains the linear address of the pixel with the lowest address in the array. During instruction execution, SADDR points to the address of the next set of 32 pixels to be read from the source array. When the block transfer is complete, SADDR points to the linear address of the first pixel on the next row of pixels that would have been moved if the block transfer continued. • SPTCH contains the linear difference in the starting addresses of ad- jacent rows of the source array. SPTCH can be any value for this PIXBLT. For window clipping, SPTCH must be a power of two, and CONVSP must be set to correspond to the SPTCH value. • CONVSP is calculated by taking the LMO of SPTCH; this value is used for the XY calculations involved in XY addressing and window clipping. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays in pixels. The DY portion of DYDX contains the number of rows in the array; the the DX portion contains the number of pixels per row. Source Expansion Destination Array The actual values of the source pixels are determined by the interaction of the source array with contents of the COLOR1 and COLORO registers. In the expansion operation, a 1 bit in the source array selects a pixel from the COLOR1 register for operation on the destination array. A bit in the source array selects a COLORO pixel for this purpose. The pixels selected from the COLOR1 and COLORO registers are those that align directly with their intended position in the destination array word. The location of the destination pixel block is defined by the contents of the DADDR, DPTCH, CONVDP, OFFSET, and DYDX registers: • At the outset of the instruction, DADDR contains the XY address of the pixel with the lowest address in the array; it is used with OFFSET and CONVDP to calculate the linear address of the array. During in- struction execution, DADDR points to the linear address of next pixel (or word of pixels) to be modified in the destination array. When the block transfer is complete, DADDR points to the linear address of the first pixel on the next row of pixels that would have been moved if the block transfer continued. • DPTCH contains the linear difference in the starting addresses of ad- jacent rows of the destination array (typically this is the screen pitch). DPTCH must be a power of two (greater than or equal to 16) and CONVDP must be set to correspond to the DPTCH value. 12-180 Pixel Block Transfer - Binary to XY PIXBLT • CONVDP is determined by taking the LMO of the DPTCH register; this value is used for the XY calculations involved in XY addressing and window clipping. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays. The DY portion of DYDX contains the number of rows in the array; the DX portion contains the number of pixels per row. Corner Adjust No corner adjust is performed for this instruction. The transfer executes in the order of increasing linear addresses. PBH and PBV are ignored. Window Checking You can use window checking with this instruction by setting the W bits in the CONTROL register to the desired value. If you select window checking mode 1, 2, or 3, the WSTART and WEND registers define the XY starting and ending corners of a rectangular window. Pixel Processing No windowing. are unaffected. The entire pixel array is drawn and the WVP and V bits 1 Window hit. No pixels are drawn. The V bit is set to if any portion of the destination array lies within the window. Otherwise, the V bit is set to1. If the V bit is set to 0, the DADDR and DYDX registers are modified to correspond to the common rectangle formed by the intersection of the destination array with the rectangular window. DADDR is set to the XY address of the pixel in the starting corner of the common rectangle. DYDX is set to the X and Y dimensions of the common rectangle. If the V bit is set to 1 , the array lies entirely outside the window, and the values of DADDR and DYDX are indeterminate. 2 Window miss. If the array lies entirely within the active window, it is drawn and the V bit is set to 0. Otherwise, no pixels are drawn, the V and WVP bits are set to 1 , and the instruction is aborted. 3 Window clip. The source and destination arrays are preclipped to the window dimensions. Only those pixels that lie within the common rec- tangle (corresponding to the intersection of the specified array and the window) are drawn. If any preclipping is required, the V bit is set to 1 . You can select a pixel processing option for this instruction by setting the PPOP bits in the CONTROL register. The pixel processing operation is applied to expanded pixels as they are processed with the destination array; that is, the data is first expanded and then processed. There are 1 6 Boolean and 6 arithmetic operations; the default case at reset is the S -» D operation. The 6 arithmetic operations do not operate with pixel sizes of one or two bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) pixels after it expands and processes the source data. At reset, the default case for transparency is off. 12-181 PIXBLT Pixel Block Transfer - Binary to XY Plane Mask The plane mask is enabled for this instruction. Interrupts This instruction can be interrupted at a word or row boundary of the desti- nation array. When the PixBIt is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on the stack. At this time, DPTCH, SPTCH, and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modi- fied after the interrupt is processed. SADDR points to the address of the next 32 pixels to be read from the source array after the interrupt is proc- essed. The PIXBLT instruction uses several I/O and B-file registers as implied op- erands. If an interrupt service routine modifies a register that the PIXBLT uses as an implied operand, you must restore that register to the value it had when the routine began, before returning from the routine. (You can use the MMFM and MMTM instructions to save and restore the B-file regis- ters.) In order to maintain compatibility with future TMS340 devices, use only the RETI instruction to return from an interrupt routine. Shift Register Transfers If the SRT bit in the DPYCTL I/O register is set, each memory read or write initiated by the PixBIt generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers. (Not all VRAMs support this capability.) Machine States Status Bits See PIXBLT Expand Instructions Timing, Section 13.5. N Undefined C Undefined Z Undefined V 7 if a window violation occurs, otherwise; undefined if window checking is not enabled (W=00) 12-182 Pixel Block Transfer - Binary to XY PIXBLT Examples Before executing a PIXBLT instruction, load the implied operand registers with appropriate values. These PIXBLT examples use the following implied operand setup. Register File B: SADDR (BO) SPTCH(B1) DADDR (B2) = DPTCH (B3) OFFSET (B4) = WSTART (B5) = WEND (B6) DYDX (B7) COLORO (B8) = COLOR1 (B9) = 0000201 Oh 0000001 Oh 00300022h 00001 OOOh 0001 OOOOh 00000026 h 00400050h 0004001 Oh OOOOOOOOh 7C7C7C7Ch I/O Registers: PSIZE = 0008h CONVSP = 001 Bh CONVDP = 001 3h Additional implied operand values are listed with each example. For this example, assume that memory contains the following data before instruction execution. Linear Address 2000h xxxxh, 40000h to 43200h FFFFh Data 01 23h, 4567h, 89ABh, CDEFh, xxxxh, xxxxh, xxxxh Example 1 This example uses the replace (S -* D) pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: Linear Data Address 401 OOh FFFFh, 7C7Ch, OOOOh, 7C00h, OOOOh, 007Ch, OOOOh, OOOOh 401 80h OOOOh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh 41 1 0Oh FFFFh, 7C7Ch, 007Ch, 7C00h, 007Ch, 007Ch, 007Ch, OOOOh 41180h 007Ch, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh 421 OOh FFFFh, 7C7Ch, 7C00h, 7C00h, 7C00h, 007Ch, 7C00h, OOOOh 421 80h 7C00h, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh 431 OOh FFFFh, 7C7Ch, 7C7Ch, 7C00h, 7C7Ch, 007Ch, 7C7Ch, OOOOh 431 80h 7C7Ch, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh, FFFFh 12-183 PIXBLT Pixel Block Transfer - Binary to XY Example 2 Example 3 XY Addressing yt Addr&ss Y 222222222222222233333 01 23456789ABCDEF01 234 A d 30 FF FF 7C 7C 00 00 00 7C 00 00 7C 00 00 00 00 00 00 00 FF FF FF d r 31 FF FF 7C 7C 7C 00 00 7C 7C 00 7C 00 7C 00 00 00 7C 00 FF FF FF e s 32 FF FF 7C 7C 00 7C 00 7C 00 7C 7C 00 00 7C 00 00 00 7C FF FF FF s 33 FF FF 7C 7C 7C 7C 00 7C 7C 7C 7C 00 7C 7C 00 00 7C 7C FF FF FF This example uses the XOR pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 2800h (T=0, W=00, PP=01010). After instruction execution, memory contains the following values: X Address Y 222222222222222233333 01 23456789ABCDEF01 234 A d 30 FF FF 83 83 FF FF FF 83 FF FF 83 FF FF FF FF FF FF FF FF FF FF d r 31 FF FF 83 83 83 FF FF 83 83 FF 83 FF 83 FF FF FF 83 FF FF FF FF e s 32 FF FF 83 83 FF 83 FF 83 FF 83 83 FF FF 83 FF FF FF 83 FF FF FF s 33 FF FF 83 83 83 83 FF 83 83 83 83 FF 83 83 FF FF 83 83 FF FF FF This example uses transparency. Before instruction execution, PMASK = OOOOh and CONTROL = 0020h (T=1, W=00, PP=00000). After instruction execution, memory contains the following values: X AddrGss Y 222222222222222233333 01 23456789ABCDEF01 234 A d 30 FF FF 7C 7C FF FF FF 7C FF FF 7C FF FF FF FF FF FF FF FF FF FF d r 31 FF FF 7C 7C 7C FF FF 7C 7C FF 7C FF 7C FF FF FF 7C FF FF FF FF s 32 FF FF 7C 7C FF 7C FF 7C FF 7C 7C FF FF 7C FF FF FF 7C FF FF FF s 33 FF FF 7C 7C 7C 7C FF 7C 7C 7C 7C FF 7C 7C FF FF 7C 7C FF FF FF 12-184 Pixel Block Transfer - Binary to XY PIXBLT Example 4 This example uses window operation 3 (clipped destination). Before in- struction execution, PMASK - OOOOh and CONTROL = OOCOh (T=0, W=11, PP=00000). After instruction execution, memory contains the following values: X Address Y 222222222222222233333 01 23456789ABCDEF01 234 A d 30 FF FF FF FF FF FF 00 7C 00 00 7C 00 00 00 00 00 00 00 FF FF FF d r 31 FF FF FF FF FF FF 00 7C 7C 00 7C 00 7C 00 00 00 7C 00 FF FF FF s 32 FF FF FF FF FF FF 00 7C 00 7C 7C 00 00 7C 00 00 00 7C FF FF FF s 33 FF FF FF FF FF FF 00 7C 7C 7C 7C 00 7C 7C 00 00 7C 7C FF FF FF Example 5 This example uses plane masking; the four LSBs of each pixel are masked. Before instruction execution, PMASK = OFOFh and CONTROL = 0020h (T=1, W=00, PP=00000). After instruction execution, memory contains the following values: X Address Y 222222222222222233333 01 23456789ABCDEF01 234 A d 30 FF FF 7F 7F FF FF FF 7F FF FF 7F FF FF FF FF FF FF FF FF FF FF d r 31 FF FF 7F 7F 7F FF FF 7F 7F FF 7F FF 7F FF FF FF 7F FF FF FF FF e s 32 FF FF 7F 7F FF 7F FF 7F FF 7F 7F FF FF 7F FF FF FF 7F FF FF FF 33 FF FF 7F 7F 7F 7F FF 7F 7F 7F 7F FF 7F 7F FF FF 7F 7F FF FF FF 12-185 PIXBLT Pixel Block Transfer - Binary to XY Example 6 This example shows how to use the PIXBLT B,XY instruction's window preclipping capabilitied when the source pitch is not a power of 2. Assume that the registers have been loaded as follows: BO = linear start address of source bitmap Bl = SPTCH (no restrictions) B2 = start y coord, ytop in 16 MSBs , start x coord. xleft in 16 LSBs B3 = DPTCH (must be power of 2) B4 = OFFSET B5 = WSTART B6 = WEND B7 = DY::DX (array height in 16 MSBs, array width in 16 LSBs) B8 = COLORO B9 = COLOR1 FS1 >= 16 (assume multiplier for MPYS below is less than 16 bits) CONVSP will not be used. Implied operands in other I/O registers (incl. CONVDP) are valid. Window option = 3 —color— expand : MOVY B2,B10 SUBXY B5,B10 JRYNN INWINDOW * Need to clip destination array MOVY B5,B2 SRA 16, BIO MOVE B1,B11 MPYS B10,B11 SUB B11,B0 SLL 16, BIO ADDXY B10,B7 JRLS DONE * PIXBLT instruction will do any INWINDOW : PIXBLT B,XY * Restore registers and return DONE: RETS .end ; copy ytop ;window y overlap = ytop - ystart ;jump if ytop below top of window to top edge of clipping window ;clip ytop to top of window ; shift y overlap to 16 LSBs ;copy SPTCH ;(y overlap) * SPTCH ;clip SADDR to top of window ; shift y overlap to 16 MSBs ;clip DY to top of window ;done if DY<=0 (completely ; above window) additional clipping required ; color expand bitmap to screen ;done 12-186 Pixel Block Transfer - Linear to Linear PIXBLT Syntax Execution Instruction Words Description Implied Operands PIXBLT L, L linear pixel array -+ linear pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 The PIXBLT instruction transfers and processes a source pixel array with a destination pixel array. This instruction operates on two-dimensional arrays of pixels using linear starting addresses for both the source and the destination. As the PixBIt proceeds, the source pixels are combined with the corresponding destina- tion pixels based on the selected graphics operations. Note that the parameters are entered exactly as shown in the syntax; that is, the instruction is entered as pixblt l,l. The first parameter, L, indi- cates that the starting address of the source array is a linear address; the second parameter, L, indicates that the starting address of the destination array is also a linear address. The following set of implied operands govern the operation of the in- struction and define the source and destination arrays. B File Registers Register Name Format Description BOTt SADDR Linear Source pixel array starting address Bit SPTCH Linear Source pixel array pitch B2« DADDR Linear Destination pixel array starting address B3 DPTCH Linear Destination pixel array pitch B7 DYDX XY Pixel array dimensions (rowsxolumns) B10-B141" Reserved registers I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) T -Transparency operation PBH- PixBIt horizontal direction PBV- PixBIt vertical direction C00001 50h PSIZE Pixel size (1,2,4,8.16) C00001 60h PMASK Plane mask - pixel format t These registers are changed by PIXBLT execution. t You must adjust SADDR and DADDR to correspond to the corner selected by the values of PBH and PBV. See Corner Adjust below for additional information. Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXBLT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an instruction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. 12-187 PIXBLT Pixel Block Transfer - Linear to Linear Source Array The source pixel array for the processing operation is defined by the con- tents of the SADDR, SPTCH, and DYDX registers: • At the outset of the instruction, SADDR contains the linear address of the pixel at the appropriate starting corner of the array as deter- mined by the PBH and PBV bits in the CONTROL I/O register. (See Corner Adjust below.) During instruction execution, SADDR points to the next pixel (or word of pixels) to be read from the source array. When the block transfer is complete, SADDR points to the starting address of the next set of 32 pixels that would have been moved had the block transfer continued. • SPTCH contains the linear difference in the starting addresses of ad- jacent rows of the source array. SPTCH must be a multiple of 1 6. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays. The DY portion of DYDX contains the number of rows in the array; the DX portion contains the number of pixels per row. Destination Array The location of the destination pixel array is defined by the contents of the DADDR, DPTCH, and DYDX registers: • At the outset of the instruction, DADDR contains the linear address of the pixel at the appropriate starting corner of the array as deter- mined by the PBH and PBV bits in the CONTROL I/O register. (See Corner Adjust below.) During instruction execution, DADDR points to the next pixel (or word of pixels) to be modified in the des- tination array. When the block transfer is complete, DADDR points to the linear address of the first pixel on the next row of pixels that would have been moved had the block transfer continued. • DPTCH contains the linear difference in the starting addresses of ad- jacent rows of the destination array. DPTCH must be a multiple of 16. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays in pixels. The DY portion of DYDX contains the number of rows in the array, while the DX portion contains the num- ber of columns. Corner Adjust The PBH and PBV bits in the CONTROL I/O register govern the direction of the PixBlt. If the source and destination arrays overlap, then PBH and PBV should be set to prevent any portion of the source array from being overwritten before it is moved. Note that this PIXBLT's comer adjustment is unique. The PBH and PBV bits control the direction of the PIXBLT; however, the adjustment of SADDR and DADDR to point to the appropriate starting corner is not au- tomatic. You must explicitly set these two registers to point to the selected starting corners of the source and destination arrays, respectively, as indi- cated by PBH and PBV. This facility allows you to use corner adjust for screen definitions that do not lend themselves to XY addressing (those not binary powers of two). In effect, you supply your own corner adjust oper- ation in software and the PixBlt instruction provides directional control. 12-188 Pixel Block Transfer - Linear to Linear PIXBLT • For PBH = and PBV = 0, set SADDR and DADDR as they are normally set for linear PixBlts. Set both registers to correspond to the linear address of the first pixel on the first line of the array (that is, the pixel with the lowest address). • For PBH = and PBV = 1, set SADDR and DADDR to correspond to the linear address of the first pixel on the last line of the array. In other words, SADDR = (linear address of 1st source pixel) + [(DY-1) x SPTCH)] and DADDR = (linear address of 1st destination pixel) + [(DY-1) x DPTCH)] • For PBH = 1 and PBV = 0, set SADDR and DADDR to correspond to the linear address of the pixel following the last pixel on the first line of the array. In other words, SADDR = (linear address of 1st source pixel) + (DX x PSIZE) and DADDR - (linear address of 1st destination pixel) + (DX x PSIZE) For PBH = 1 and PBV = 1, set SADDR and DADDR to correspond to the linear address of the pixel following the last pixel on the last line of the array. In other words, SADDR = (linear address of 1st source pixel) + (DX x PSIZE) + [(DY-1) x SPTCH)] and DADDR = (linear address of 1st destination pixel) + [(DY-1) x DPTCH)] + (DX x PSIZE) Window Checking Pixel Processing Window operations are not enabled for this instruction. The contents of the WSTART and WEND registers are ignored. You can select a pixel processing option for this instruction by setting the PPOP bits in the CONTROL register. The pixel processing option is applied to pixels as they are processed with the destination array. Note that the data is read through the plane mask and then processed. There are 16 Boolean and 6 arithmetic operations; the default case at reset is the replace (S -*• D) operation. The 6 arithmetic operations do not operate with pixel sizes of 1 or 2 bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) pixels after it expands and processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. 12-189 PIXBLT Pixel Block Transfer - Linear to Linear Interrupts This instruction can be interrupted at a word or row boundary of the desti- nation array. When the PixBIt is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on the stack. At this time, DPTCH, SPTCH, and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modi- fied after the interrupt is processed. SADDR points to the address of the next 32 pixels to be read from the source array after the interrupt is proc- essed. The PIXBLT instruction uses several I/O and B-file registers as implied op- erands. If an interrupt service routine modifies a register that the PIXBLT uses as an implied operand, you must restore that register to the value it had when the routine began, before returning from the routine. (You can use the MMFM and MMTM instructions to save and restore the B-file regis- ters.) In order to maintain compatibility with future TMS340 devices, use only the RETI instruction to return from an interrupt routine. Shift Register Transfers If the SRT bit in the DPYCTL I/O register is set, each memory read or write initiated by the PixBIt generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers. (Not all VRAMs support this capability.) Machine States Status Bits Examples See Section 13.4, PIXBLT Instructions Timing. N Undefined C Undefined Z Undefined V Undefined Before executing a PIXBLT instruction, load the implied operand registers with appropriate values. These PIXBLT examples use the following implied operand setup. Register File B: SADDR (BO) SPTCH (B1) DADDR (B2) DPTCH (B3) OFFSET (B4) DYDX (B7) 00002004h 00000080h 00002228h 00000080h OOOOOOOOh 0002000 Dh I/O Registers: PSIZE = 0004h Additional implied operand values are listed with each example. For these examples, assume that memory contains the following data before instruction execution. Linear Data Address 02000h OOOxh, 1 1 1 1 h. 2222h, xx33h, xxxxh. xxxxh, xxxxh, xxxxh 02080h OOOxh, 1 11 1 h. 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 021 OOh xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh. xxxxh. xxxxh 021 80h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 02200h xxxxh, xxxxh, FFxxh, FFFFh, FFFFh, xFFFh, xxxxh. xxxxh 02280h xxxxh, xxxxh, FFxxh, FFFFh, FFFFh, xFFFh, xxxxh, xxxxh 02300h xxxxh, xxxxh, xxxxh, xxxxh. xxxxh. xxxxh. xxxxh, xxxxh 12-190 Pixel Block Trans fer - Linear to Linear PIXBLT Example 7 This example uses the rep/ace (S -* D) pixel processing operation . Before instruction execution, PMASK - OOOOh and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values Linear Data Address 02000h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 02080h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 021 OOh xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh. xxxxh 021 80h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh. xxxxh 02200h xxxxh, xxxxh, OOxxh, 111 Oh, 2221 h, x332h, xxxxh. xxxxh 02280h xxxxh, xxxxh, OOxxh, 11 1 0h, 2221 h, x332h, xxxxh. xxxxh 02300h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh Example 2 This example uses the (D - S) -*■ D pixel processing operation. Before in- struction execution, PMASK = OOOOh and CONTROL = 4800h (T=0, W=00, PP = 10010). After instruction execution, memory contains the following values: Linear Data Address 02000h OOOxh, 1 1 1 1 h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 02080h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 021 OOh xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 021 80h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 02200h xxxxh, xxxxh, FFxxh, EEEFh, DDDEh,xCCDh, xxxxh, xxxxh 02280h xxxxh, xxxxh, FFxxh, EEEFh, DDDEh,xCCDh, xxxxh, xxxxh 02300h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh Example 3 This example uses transparency. Before instruction execution, PMASK = OOOOh and CONTROL - 0020h (T=1, W=00, PP=00000). After instruction execution, memory contains the following values: Linear Data Address 02000h OOOxh, 1111 h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 02080h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 021 OOh xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 021 80h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 02200h xxxxh, xxxxh, 0FFxxh,111Fh, 2221 h, x332h, xxxxh, xxxxh 02280h xxxxh, xxxxh, 0FFxxh,111Fh, 2221 h, x332h, xxxxh, xxxxh 02300h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 12-191 PIXBLT Pixel Block Transfer - Linear to Linear Example 4 This example uses plane masking (the MSB of each pixel is masked). Be- fore instruction execution, PMASK = 8888h and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: Data Linear Address 02000h OOOxh, 02080h OOOxh, 021 OOh xxxxh, 021 80h xxxxh, 02200h xxxxh, 02280h xxxxh, 02300h xxxxh. 1111h, 2222h, 1111 h, 2222h, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, 88xxh, xxxxh, 88xxh, xxxxh, xxxxh, xx33h, xx33h, xxxxh, xxxxh, 9998h, 9998h, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, AAA9h, AAA9h, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xBBAh, xBBAh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh xxxxh xxxxh xxxxh xxxxh xxxxh xxxxh 12-192 Pixel Block Transfer - Linear to XY PIXBLT Syntax Execution Instruction Words Description Implied Operands PIXBLT L, XY linear pixel array -»• XY pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 The PIXBLT instruction transfers and processes a source pixel array with a destination pixel array. This instruction operates on two-dimensional arrays of pixels using a linear starting address for the source array and an XY address for the destination array. As the PixBIt proceeds, the source pixels are combined with the corresponding destination pixels based on the selected graphics operations. Note that the parameters are entered exactly as shown in the syntax; that is, the instruction is entered as pixblt l,xy. The first parameter, L, indi- cates that the starting address of the source array is a linear address; the second parameter, XY, indicates that the starting address of the destination array is an XY address. The following set of implied operands govern the operation of the in- struction and define the source and destination arrays. B File Registers Register Name Format Description BOt SADDR Linear Source pixel array starting address B1 SPTCH Linear Source pixel array pitch B2« DADDR XY Destination pixel array starting address B3 DPTCH Linear Destination pixel array pitch B4 OFFSET Linear Screen origin (0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner B7* DYDX XY Pixel array dimensions (rows:columns) B10-B14t Reserved registers I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) W -Window operations T -Transparency operation PBH- PixBIt horizontal direction PBV- PixBIt vertical direction C0000130h CONVSP XY-to-linear conversion (source pitch) Used for preclipping and corner adjust C0000140h CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C0000160h PMASK Plane mask - pixel format t These registers are changed $ Used for common rectangle by PIXBLT execution, function with window pick. Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the 12-193 PIXBLT Pixel Block Transfer - Linear to XY PIXBLT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an instruction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. Source Array The source pixel array for the processing operation is defined by the con- tents of the SADDR, SPTCH, DYDX, and (possibly) CONVSP registers: • At the outset of the instruction, SADDR contains the linear address of the pixel with the lowest address in the array. During instruction execution, SADDR points to the next pixel (or word of pixels) to be accessed in the source array. When the block transfer is complete, SADDR points to the linear address of the first pixel on the next row of pixels that would have been moved had the block transfer contin- ued. • SPTCH contains the linear difference in the starting addresses of ad- jacent rows of the source array. SPTCH must be a multiple of 16. For window clipping or corner adjust, SPTCH must be a power of two and CONVSP must be set to correspond to the SPTCH value. • CONVSP is determined by taking the LMO of the SPTCH register; this value is used for the XY calculations involved in window clipping and corner adjust. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays. The DY portion of DYDX contains the number of rows in the array; the DX portion contains the number of pixels per row. Destination Array The location of the destination pixel array is defined by the contents of the DADDR, DPTCH, CONVDP, OFFSET, and DYDX registers: • At the outset of the instruction, DADDR contains the XY address of the pixel with the lowest address in the array; it is used with OFFSET and CONVDP to calculate the linear address of the starting location of the array. During instruction execution, DADDR points to the lin- ear address of next pixel (or word of pixels) to be accessed in the destination array. When the block transfer is complete, DADDR points to the linear address of the first pixel on the next row of pixels that would have been moved had the block transfer continued. • DPTCH contains the linear difference in the starting addresses of ad- jacent rows of the destination array (typically this is the screen pitch). DPTCH must be a power of two (greater than or equal to 16). • CONVDP must be set to correspond to the DPTCH value. CONVDP is determined by taking The LMO of the DPTCH register; this value is used for the XY calculations involved in XY addressing, window clipping and corner adjust. 12-194 Pixel Block Transfer - Linear to XY PIXBLT • DYDX specifies the dimensions of both the source and destination arrays in pixels. The DY portion of DYDX contains the number of rows in the array, while the DX portion contains the number of col- umns. Corner Adjust The PBH and PBV bits in the CONTROL I/O register govern the direction of the PixBlt. If the source and destination arrays overlap, then PBH and PBV should be set to prevent any portion of the source array from being overwritten before it is moved. This PixBlt performs the corner adjust function automatically under the control of the PBH and PBV bits. If PBV=1, SPTCH must be a power of two and CONVSP should be valid. The SADDR and DADDR registers should be set to correspond to the ap- propriate format address of the first pixel on the first line of the source (linear) and destination (XY) arrays, respectively. Window Checking Pixel Processing You can use window checking with this instruction by setting the W bits in the CONTROL register to the desired value. If you select window checking mode 1, 2, or 3, the WSTART and WEND registers define the XY starting and ending corners of a rectangular window. No windowing. The entire pixel array is drawn and the WVP and V bits are unaffected. 1 Window hit. No pixels are drawn. The V bit is set to if any portion of the destination array lies within the window. Otherwise, the V bit is set to1. If the V bit is set to 0, the DADDR and DYDX registers are modified to correspond to the common rectangle formed by the intersection of the destination array with the rectangular window. DADDR is set to the XY address of the pixel in the starting corner of the common rectangle. DYDX is set to the X and Y dimensions of the common rectangle. If the V bit is set to 1 , the array lies entirely outside the window, and the values of DADDR and DYDX are indeterminate. 2 Window miss. If the array lies entirely within the active window, it is drawn and the V bit is set to 0. Otherwise, no pixels are drawn, the V and WVP bits are set to 1 , and the instruction is aborted. 3 Window clip. The source and destination arrays are preclipped to the window dimensions. Only those pixels that lie within the common rec- tangle (corresponding to the intersection of the specified array and the window) are drawn. If any preclipping is required, the V bit is set to 1 . You can select a pixel processing option to use with this instruction by setting the PPOP bits in the CONTROL register. The pixel processing op- eration is applied to pixels as they are processed with the destination array. Note that the data is read through the plane mask and then processed. There are 16 Boolean and 6 arithmetic operations; the default case at reset is the replace (S -* D) operation. The 6 arithmetic operations do not op- erate with pixel sizes of 1 or 2 bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. 12-195 PIXBLT Pixel Block Transfer - Linear to XY Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) pixels after it expands and processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. Interrupts This instruction can be interrupted at a word or row boundary of the desti- nation array. When the PixBIt is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on the stack. At this time, DPTCH, SPTCH, and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modi- fied after the interrupt is processed. SADDR points to the address of the next 32 pixels to be read from the source array after the interrupt is proc- essed. The PIXBLT instruction uses several I/O and B-file registers as implied op- erands. If an interrupt service routine modifies a register that the PIXBLT uses as an implied operand, you must restore that register to the value it had when the routine began, before returning from the routine. (You can use the MMFM and MMTM instructions to save and restore the B-file regis- ters.) In order to maintain compatibility with future TMS340 devices, use only the RETI instruction to return from an interrupt routine. Shift Register Transfers If the SRT bit in the DPYCTL I/O register is set, each memory read or write initiated by the PixBIt generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers (the TMS4461 VRAM supports this capability). Machine States Status Bits See PIXBLT Instructions Timing, Section 13.4. N Undefined C Undefined Z Undefined V If window clipping is enabled - 1 if a window violation occurs, oth- erwise; undefined if window clipping not enabled (W=002) 12-196 Pixel Block Transfer - Linear to XY PIXBLT Examples Example 1 Before executing a PIXBLT instruction, load the implied operand registers with appropriate values. These PIXBLT examples use the following implied operand setup. Register File B: I/O Registers: SADDR (BO) = 00002004h CONVDP =0017h SPTCH (B1) = 00000080h PSIZE = 0004h DADDR (B2) = 00520007h PMASK = OOOOh DPTCH (B3) = 000001 OOh CONTROL = OOOOh OFFSET (B4) = 0001 OOOOh (W=00, T=0, PP=00000) WSTART (B5) - 0030000Ch WEND (B6) = 0053001 4h DYDX (B7) = 0003001 6h Additional implied operand values are listed with each example. For this example, assume that memory contains the following data before instruction execution. Linear Data Address 02000h 321 Oh, 7654h, BA98h, FEDCh,3210h, 7654h, BA98h, FEDCh 02080h 321 Oh, 7654h, BA98h, FEDCh, 321 Oh, 7654h, BA98h, FEDCh 021 OOh 321 Oh, 7654h, BA98h, FEDCh, 321 Oh, 7654h, BA98h, FEDCh 1 5200h to 1 5480h 8888h This example uses the replace (S -* D) pixel processing operation. Before instruction execution, PMASK = 7777h and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: Linear Data Address 15200h 8888h, 1888h, 5432h, 9876h, DCBAh,10FEh, 5432h, 8886h 15300h 8888h, 1888h, 5432h, 9876h, DCBAh,10FEh, 5432h, 8886h 15400h 8888h, 1888h, 5432h, 9876h, DCBAh,10FEh, 5432h, 8886h XY Addressing X Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 52 88888881 23456789ABCDEF01 23458888 d r 53 88888881 23456789ABCDEF01 23458888 e s 54 88888881 23456789ABCDEF01 23458888 s 12-197 PIXBLT Pixel Block Transfer - Linear to XY Example 2 This example uses the (D subs S) -*■ D pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 4C00h (T=0, W=00, PP = 10011). After instruction execution, memory contains the following values: X Addr&ss Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 52 88888887654321000000008765432888 d r 53 88888887654321000000008765432888 e s 54 88888887654321000000008765432888 s Example 3 This example uses transparency with the (D subs S) -* D pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 4C20h (T=1, W=00, PP=10011). After instruction execution, memory contains the following values: X Add ross Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 52 88888887654321888888888765432888 d r 53 88888887654321888888888765432888 e s 54 88888887654321888888888765432888 s Example 4 This example uses window operation 3 (the destination is clipped). Before instruction execution, PMASK = OOOOh and CONTROL = OOCOh (T=0, W=11, PP =00000). After instruction execution, memory contains the following values: Y X Address 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF d 52 8888888888886789ABCDE88888888888 d r 53 8 8 88888888886789ABCDE88888888888 e s 54 88888888888888888888888888888888 12-198 Pixel Block Transfer - Linear to XY PIXBLT Example 5 This example uses plane masking (the most significant bit is masked). Be- fore instruction execution, PMASK = 8888h and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: X Ad dross Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 52 88888889ABCDEF89ABCDEF89ABCDE888 d r 53 88888889ABCDEF89ABCDEF89ABCDE888 e s 54 88888889ABCDEF89ABCDEF89ABCDE888 s 12-199 PIXBLT Pixel Block Transfer - XY to Linear Syntax Execution Instruction Words Description Implied Operands PIXBLT XY, L XY pixel array -» linear pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 The PIXBLT instruction transfers and processes a source pixel array with a destination pixel array. This instruction operates on two-dimensional arrays of pixels using an XY starting address for the source pixel array and a linear address for the des- tination array. As the PixBIt proceeds, the source pixels are combined with the corresponding destination pixels based on the selected graphics oper- ations. Note that the parameters are entered exactly as shown in the syntax; that is, the instruction is entered as pixblt xy,l. The first parameter, XY, in- dicates that the starting address of the source array is an XY address; the second parameter, L, indicates that the starting address of the destination array is a linear address. The following set of implied operands govern the operation of the in- struction and define the source and destination arrays. B File Registers Register Name Format Description BOt SADDR XY Source pixel array starting address B1 SPTCH Linear Source pixel array pitch B2t DADDR Linear Destination pixel array starting address B3 DPTCH Linear Destination pixel array pitch B4 OFFSET Linear Screen origin (0,0) B7 DYDX XY Pixel array dimensions (rowsxolumns) B10-B14t Reserved registers I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP -Pixel processing operations (22 options) T -Transparency operation PBH -PixBIt horizontal direction PBV -PixBIt vertical direction C00001 30h CONVSP XY-to-linear conversion (source pitch) Used for XY operations C0000140h CONVDP XY-to-linear conversion (destination pitch) Used for XY operations C00001 50h PSIZE Pixel size (1,2,4,8,16) C00001 60h PMASK Plane mask - pixel format t These registers are changed by PIXBLT execution. 12-200 Pixel Block Transfer - XY to Linear PIXBLT Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXBLT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an instruction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. Source Array The source pixel array for the processing operation is defined by the con- tents of the SADDR, SPTCH, CONVSP, OFFSET, and DYDX registers: • At the outset of the instruction, SADDR contains the XY address of the pixel with the lowest address in the array; it is used with OFFSET and CONVSP to calculate the linear address of the starting location of the array. During instruction execution, SADDR points to the next pixel (or word of pixels) to be accessed from the source array. When the block transfer is complete, SADDR points to the linear address of the first pixel on the next row of pixels that would have been moved had the block transfer continued. • SPTCH contains the linear difference in the starting addresses of ad- jacent rows of the source array (typically this is the screen pitch). SPTCH must be a power of two (greater than or equal to 16) unless only one line is moved and CONVSP must be set to correspond to the SPTCH value. • CONVSP is determined by taking the LMO of the SPTCH register; this value is used for the XY calculations involved in XY addressing, win- dow clipping and corner adjust. • DYDX specifies the dimensions, in pixels, of both the source and destination arrays. The DY portion of DYDX contains the number of rows in the array, while the DX portion contains the number of col- umns. Destination Array The location of the destination pixel array is defined by the contents of the DADDR, DPTCH, DYDX, and (potentially) CONVDP registers: • At the outset of the instruction, DADDR contains the linear address of the pixel with the lowest address in the array. During instruction execution, DADDR points to the next pixel (or word of pixels) to be modified in the destination array. When the block transfer is com- plete, DADDR points to the linear address of the first pixel on the next row of pixels that would have been moved had the block trans- fer continued. • DPTCH contains the linear difference in the starting addresses of ad- jacent rows of the destination array. DPTCH must be a multiple of 16. For window clipping or corner adjust, DPTCH must be a power of two and CONVDP must be set to correspond to the DPTCH value. 12-201 PIXBLT Pixel Block Transfer - XY to Linear • CONVDP is determined by taking the LMO of the DPTCH register; this value is used for the XY calculations involved in window clipping and corner adjust. • DYDX specifies the dimensions of both the source and destination arrays in pixels. The DY portion of DYDX contains the number of rows in the array; the DX portion contains the number of columns. Corner Adjust The PBH and PBV bits in the CONTROL I/O register govern the direction of the PixBlt. If the source and destination arrays overlap, then PBH and PBV should be set to prevent any portion of the source array from being overwritten before it is moved. This PixBlt performs the corner adjust function automatically under the control of the PBH and PBV bits. If PBV=1, DPTCH must be a power of two and CONVDP must be valid. The SADDR and DADDR registers should be set to correspond to the appro- priate format address of the first pixel on the first line of the source (XY) and destination (linear) arrays, respectively. Window Checking Pixel Processing Transparency Plane Mask Interrupts Window operations are not enabled for this instruction. WSTART and WEND registers are ignored. The contents of the You can select a pixel processing option to use with this instruction by setting the PPOP bits in the CONTROL register. The pixel processing op- eration is applied to pixels as they are processed with the destination array. Note that the data is read through the plane mask and then processed. There are 16 Boolean and 6 arithmetic operations; the default case at reset is the S -» D operation. The 6 arithmetic operations do not operate with pixel sizes of one or two bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) pixels after it expands and processes the source data. At reset, the default case for transparency is off. The plane mask is enabled for this instruction. This instruction can be interrupted at a word or row boundary of the desti- nation array. When the PixBlt is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on the stack. At this time, DPTCH, SPTCH, and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modi- fied after the interrupt is processed. SADDR points to the address of the next 32 pixels to be read from the source array after the interrupt is proc- essed. The PIXBLT instruction uses several I/O and B-file registers as implied op- erands. If an interrupt service routine modifies a register that the PIXBLT uses as an implied operand, you must restore that register to the value it had when the routine began, before returning from the routine. (You can use the MMFM and MMTM instructions to save and restore the B-file regis- 12-202 Pixel Block Transfer - XY to Linear PIXBLT ters.) In order to maintain compatibility with future TMS340 devices, use only the RETI instruction to return from an interrupt routine. Shift Register Transfers If the SRT bit in the DPYCTL I/O register is set, each memory read or write initiated by the PixBIt generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers (not all VRAMs support this capability). Machine States Status Bits Examples See PIXBLT Instructions Timing, Section 13.4. N Undefined C Undefined Z Undefined V Undefined Before executing a PIXBLT instruction, load the implied operand registers with appropriate values. These PIXBLT examples use the following implied operand setup. Register File B: SADDR (BO) SPTCH(B1) DADDR (B2) DPTCH (B3) OFFSET (B4) DYDX (B7) 00400001 h = 00000080h - 00002228h - 00000080h = OOOOOOOOh = 0002000 Dh I/O Registers: CONVSP = 001 8h PSIZE = 0004h Additional implied operand values are listed with each example. For this example, assume that memory contains the following data before instruction execution. Linear Data Address 02000h OOOxh, Illlh, 2222h, xx33h. xxxxh. xxxxh. xxxxh. xxxxh 02080h OOOxh, Illlh, 2222h, xx33h, xxxxh, xxxxh, xxxxh. xxxxh 021 OOh xxxxh, xxxxh. xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 021 80h xxxxh, xxxxh, xxxxh. xxxxh, xxxxh, xxxxh, xxxxh. xxxxh 02200h xxxxh, xxxxh, FFxxh, FFFFh, FFFFh, xFFFh, xxxxh. xxxxh 02280h xxxxh, xxxxh, FFxxh, FFFFh, FFFFh, xFFFh, xxxxh. xxxxh 02300h xxxxh. xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh. xxxxh 12-203 PIXBLT Pixel Block Transfer - XY to Linear Example 1 This example uses the replace (S -► D) pixel processing operation . Before instruction execution, PMASK = OOOOh and CONTROL = OOOOh (T=0, W=00, PP =00000). After instruction execution, memory contains the followinc I values: Linear Data Address 02000h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 02080h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh. xxxxh. xxxxh 021 OOh xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh. xxxxh 021 80h xxxxh, xxxxh, xxxxh. xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 02200h xxxxh, xxxxh, OOxxh, 1110h, 2221 h, x332h, xxxxh, xxxxh 02280h xxxxh, xxxxh, OOxxh, 1110h, 2221 h, x332h, xxxxh. xxxxh 02300h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh Example 2 This example uses the 0s -* D pixel processing operation. Before in- struction execution, PMASK = OOOOh and CONTROL = OCOOh (T=0, W=00, PP=00011). After instruction execution, memory contains the followinc I values: Linear Data Address 02000h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh. xxxxh, xxxxh 02080h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 021 OOh xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 021 80h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 02200h xxxxh, xxxxh, OOxxh, OOOOh, OOOOh, xOOOh, xxxxh, xxxxh 02280h xxxxh, xxxxh, OOxxh, OOOOh, OOOOh, xOOOh, xxxxh, xxxxh 02300h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh. xxxxh, xxxxh Example 3 This example uses transparency. Before instruction execution, PMASK = OOOOh and CONTROL = 0200h (T=1, W=00, PP=00000] I. After instruction execution, memory contains the followinc I values: Linear Data Address 02000h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh. xxxxh 02080h OOOxh, 1111h, 2222h, xx33h, xxxxh, xxxxh, xxxxh, xxxxh 021 OOh xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 021 80h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 02200h xxxxh, xxxxh, FFxxh, 111 Fh, 2221 h, x332h, xxxxh. xxxxh 02280h xxxxh, xxxxh, FFxxh, 111 Fh, 2221 h, x332h, xxxxh, xxxxh 02300h xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh 12-204 Pixel Block Transfer - XY to Linear PIXBLT Example 4 This example uses plane masking the two MSBs of each pixel are masked. Before instruction execution, PMASK = CCCCh and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: Data Linear Address 02000h OOOxh 02080h OOOxh 021 OOh xxxxh, 021 80h xxxxh, 02200h xxxxh, 02280h xxxxh, 02300h xxxxh, 1111h, 2222h, 1111h, 2222h, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, CCxxh, xxxxh, CCxxh, xxxxh, xxxxh, xx33h, xxxxh, xx33h, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, DDDCh£EEDh, DDDCh£EEDh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xxxxh, xFFEh, xFFEh, xxxxh, xxxxh, xxxxh xxxxh, xxxxh xxxxh, xxxxh xxxxh, xxxxh xxxxh, xxxxh xxxxh, xxxxh xxxxh, xxxxh 12-205 PIXBLT Pixel Block Transfer - XY to XY Syntax Execution Instruction Words Description Implied Operands PIXBLT XY, XY XY pixel array -* XY pixel array (with processing) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 The PIXBLT instruction transfers and processes a source pixel array with a destination pixel array. This instruction operates on two-dimensional arrays of pixels using XY starting addresses for both the source and destination pixel arrays. As the PixBIt proceeds, the source pixels are combined with the corresponding destination pixels based on the selected graphics operations. Note that the parameters are entered exactly as shown in the syntax; that is, the instruction is entered as pixblt xy,xy. The first XY indicates that the starting address of the source array is an XY address; the second XY indicates that the starting address of the destination array is also an XY address. The following set of implied operands govern the operation of the in- struction and define the source and destination arrays. B File Registers Register Name Format Description BOt SADDR XY Source pixel array starting address B1 SPTCH Linear Source pixel array pitch B2t* DADDR XY Destination pixel array starting address B3 DPTCH Linear Destination pixel array pitch B4 OFFSET Linear Screen origin (0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner B7* DYDX XY Pixel array dimensions (rowsxolumns) B10-B14t Reserved registers I/O Registers Address Name Description and Elements (Bits) COOOOOBOh CONTROL PP - Pixel processing operations (22 options) W -Window clipping or pick operation T -Transparency operation PBH- PixBIt horizontal direction PBV- PixBIt vertical direction C00001 30h CONVSP XY-to-linear conversion (source pitch) C0000140h CONVDP XY-to- linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C00001 60h PMASK Plane mask - pixel format t These registers are changed $ Used for common rectangle by PIXBLT execution, function with window pick. 12-206 Pixel Block Transfer - XY to XY PIXBLT Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXBLT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an instruction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. Source Array The source pixel array for the processing operation is defined by the con- tents of the SADDR, SPTCH, CONVSP, OFFSET, and DYDX registers: • At the outset of the instruction, SADDR contains the XY address of the pixel with the lowest address in the array; it is used with OFFSET and CONVSP to calculate the linear address of the starting location of the array. During instruction execution, SADDR points to the next pixel (or word of pixels) to be read from the source array. When the block transfer is complete, SADDR points to the linear address of the first pixel on the next row of pixels that would have been moved had the block transfer continued. • SPTCH contains the linear difference in the starting addresses of ad- jacent rows of the source array (typically this is the screen pitch). SPTCH must be a power of two (greater than or equal to 16) and CONVSP must be set to correspond to the SPTCH value. • CONVSP is determined by taking the LMO of the SPTCH register; this value is used for the XY calculations involved in XY addressing, win- dow clipping and corner adjust. • DYDX specifies the dimensions of both the source and destination arrays in pixels. The DY portion of DYDX contains the number of rows in the array, while the DX portion contains the number of col- umns. Destination Array The location of the destination pixel array is defined by the contents of the DADDR, DPTCH, CONVDP, OFFSET, and DYDX registers: • At the outset of the instruction, DADDR contains the XY address of the pixel with the lowest address in the array; it is used with OFFSET and CONVDP to calculate the linear address of the starting location of the array. During instruction execution, DADDR points to the next pixel (or word of pixels) to be read from the destination array. When the block transfer is complete, DADDR points to the linear address of the first pixel on the next row of pixels that would have been moved had the block transfer continued. • DPTCH contains the linear difference in the starting addresses of ad- jacent rows of the destination array (typically this is the screen pitch). DPTCH must be a power of two (greater than or equal to 16) and CONVDP must be set to correspond to the DPTCH value. 12-207 PIXBLT Pixel Block Transfer - XY to XY Window Checking CONVDP is determined by taking the LMO of the DPTCH register; this value is used for the XY calculations involved in XY addressing, window clipping and corner adjust. DYDX specifies the dimensions of both the source and destination arrays in pixels. The DY portion of DYDX contains the number of rows in the array, while the DX portion contains the number of col- umns. You can use window checking with this instruction by setting the W bits in the CONTROL register to the desired value. If you select window checking mode 1 , 2, or 3, the WSTART and WEND registers define the XY starting and ending corners of a rectangular window. No windowing. are unaffected. The entire pixel array is drawn and the WVP and V bits 1 Window hit. No pixels are drawn. The V bit is set to if any portion of the destination array lies within the window; otherwise, the V bit is set to 1 . If the V bit is set to 0, the DADDR and DYDX registers are modified to correspond to the common rectangle formed by the intersection of the destination array with the rectangular window. DADDR is set to the XY address of the pixel in the starting corner of the common rectangle. DYDX is set to the X and Y dimensions of the common rectangle. If the V bit is set to 1 , the array lies entirely outside the window, and the values of DADDR and DYDX are indeterminate. 2 Window miss. If the array lies entirely within the active window, it is drawn and the V bit is set to 0; otherwise, no pixels are drawn, the V and WVP bits are set to 1 , and the instruction is aborted. 3 Window clip. The source and destination arrays are preclipped to the window dimensions. Only those pixels that lie within the common rec- tangle (corresponding to the intersection of the specified array and the window) are drawn. If any preclipping is required, the V bit is set to 1 . Pixel Processing You can select a pixel processing option to use with this instruction by setting the PPOP bits in the CONTROL register. The pixel processing op- eration is applied to pixels as they are processed with the destination array. Note that the data is read through the plane mask and then processed. There are 16 Boolean and 6 arithmetic operations; the default case at reset is the replace (S -* D) operation. The 6 arithmetic operations do not op- erate with pixel sizes of one or two bits per pixel. For more information, see Section 7.7, Pixel Processing, on page 7-15. Corner Adjust The PBH and PBV bits in the CONTROL I/O register govern the direction of the PixBlt. If the source and destination arrays overlap, then PBH and PBV should be set to prevent any portion of the source array from being overwritten before it is moved. This PixBlt performs the corner adjust 12-208 Pixel Block Transfer - XY to XY PIXBLT function automatically under the control of the PBH and PBV bits. The SADDR and DADDR registers should be set to correspond to the appro- priate format address of the first pixel on the first line of the source (XY) and destination (XY) arrays, respectively. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) pixels after it expands and processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. Interrupts This instruction can be interrupted at a word or row boundary of the desti- nation array. When the PixBIt is interrupted, the TMS34010 sets the PBX bit in the status register and then pushes the status register on the stack. At this time, DPTCH, SPTCH, and B10-B14 contain intermediate values. DADDR points to the linear address of the next word of pixels to be modi- fied after the interrupt is processed. SADDR points to the address of the next 32 pixels to be read from the source array after the interrupt is proc- essed. The PIXBLT instruction uses several I/O and B-file registers as implied op- erands. If an interrupt service routine modifies a register that the PIXBLT uses as an implied operand, you must restore that register to the value it had when the routine began, before returning from the routine. (You can use the MMFM and MMTM instructions to save and restore the B-file regis- ters.) In order to maintain compatibility with future TMS340 devices, use only the RETI instruction to return from an interrupt routine. Shift Register Transfers If the SRT bit in the DPYCTL I/O register is set, each memory read or write initiated by the PixBIt generates a shift register transfer read or write cycle at the selected address. This operation can be used for bulk memory clears or transfers. (Not all VRAMs support this capability.) Machine States Status Bits See Section 13.4, PIXBLT Instructions Timing. N Unaffected C Unaffected Z Unaffected V If window clipping is enabled - 1 if a window violation occurs, oth- erwise; unaffected if window clipping not enabled 12-209 PIXBLT Pixel Block Transfer - XY to XY Examples Example 1 Before executing a PIXBLT instruction, load the implied operand registers with appropriate values. These PIXBLT examples use the following implied operand setup. Register File B: SADDR (BO) = 00200004h SPTCH (B1) DADDR (B2) DPTCH (B3) 0FFSET(B4) WSTART(B5) WEND (B6) DYDX (B7) - 00000200h = 0041 0004h = 00000200h = 0001 OOOOh = 00300009h - 0042001 2h = 0003001 6h I/O Registers: CONVSP =0016h CONVDP =0016h PSIZE = 0004h PMASK = OOOOh CONTROL = OOOOh (W=00, T=0, PP=00000) Additional implied operand values are listed with each example. For this example, assume that memory contains the following data before in- struction execution. Linear Data Address 14000h 321 Oh, 7654h, 0BA98hFEDCh, 321 Oh, 7654h, 0BA98hFEDCh 14200h 321 Oh, 7654h, 0BA98hFEDCh,3210h, 7654h, 0BA98hFEDCh 14400h 321 Oh, 7654h, 0BA98hFEDCh, 321 Oh, 7654h, 0BA98hFEDCh 1 8200h to 1 8680h 3333h This example uses the replace (S -+D) pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: Linear Data Address 18200h 3333h, 7654h, BA98h, FEDCh,3210h, 7654h, 3398h, 3333h 18400h 3333h, 7654h, BA98h, FEDCh, 321 Oh, 7654h, 3398h, 3333h 18600h 3333h, 7654h, BA98h, FEDCh, 321 Oh, 7654h, 3398h, 3333h XY Addressing X Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 41 3333456789ABCDEF01 23456789333333 d r 42 3333456789ABCDEF01 23456789333333 e s 43 3333456789ABCDEF01 23456789333333 s 12-210 Pixel Block Transfer - XY to XY PIXBLT Example 2 This example uses the (D adds S) -*■ D pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 4400h (T=0, W=00, PP = 10001). After instruction execution, memory contains the following values: X Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 41 3333789ABCDEFFFF3456789ABC333333 d r 42 3333789ABCDEFFFF3456789ABC333333 e s 43 3333789ABCDEFFFF3456789ABC333333 s Example 3 This example uses transparency and the (D SUBS S) -* D pixel processing operation. Before instruction execution, PMASK = OOOOh and CONTROL = 4C20h (T=1, W=00, PP=1001 1 ). After instruction execution, memory contains the following values: X Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 41 33333333333333333213333333333333 d r 42 33333333333333333213333333333333 e s 43 33333333333333333213333333333333 s Example 4 This example uses window operation 3 (the destination is clipped). Before instruction execution, PMASK = OOOOh and CONTROL = OOCOh (T=0, W=11, PP=00000). After instruction execution, memory contains the following values: v Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 41 3333333339ABCDEF01 23333333333333 d r 42 3333333339ABCDEF01 23333333333333 e s 43 33333333333333333333333333333333 s 12-211 PIXBLT Pixel Block Transfer - XY to XY Example 5 This example uses plane masking the third least significant bit is masked. Before instruction execution, PMASK = 5555h and CONTROL - OOOOh (T=0, W=00, PP=00000). After instruction execution, memory contains the following values: X Address Y 00000000000000001111111111111111 01 23456789ABCDEF01 23456789ABCDEF A d 41 3333113399BB99BB1133113399333333 d r 42 33331 1 3399BB99BB1 1 331 1 3399333333 e s 43 33331 1 3399BB99BB1 1 331 1 3399333333 s 12-212 Pixel Transfer - Register to Indirect PIXT Syntax Execution Instruction Words Description implied Operands Pixel Processing Window Checking PIXT Rs, *Rd pixel in Rs -» *Rd (Note that Rd contains a linear address.) 15 14 13 12 11 10 9 8 7 1 111110 Rs R Rd This PIXT instruction transfers a pixel from a register to memory. The source pixel is the 1, 2, 4, 8, or 16 LSBs of the source register, depending on the pixel size specified in the PSIZE I/O register. The destination register contains a linear address; the source pixel is transferred to this memory lo- cation. Rs and Rd must be in the same register file. I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) T -Transparency operation C00001 50h PSIZE Pixel size (1,2,4,6,8,16) C00001 60h PMASK Plane mask - pixel format Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. You can select a pixel processing option to use with this instruction by setting the PPOP bits in the CONTROL register. The pixel processing op- eration is applied to the pixel as it is transferred to the destination location. The default case at reset is the replace option. For more information, see Section 7.7, Pixel Processing, on page 7-15. Window checking cannot be used with this instruction, ignored. The W bits are Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. 12-213 PIXT Pixel Transfer - Register to Indirect Machine States Pixel Processing Operation PSIZE Replace Boolean ADD ADDS SUB SUBS MIN/MAX 1 ,2,4,8 16 2+(3),8 2+(1),6 4+(3),10 4+(1),8 4+(3),11 4+(1),8 5+(3),11 5 + (1),9 5+(3),12 5 + (1),9 6 + (3),11 6+(1),10 5+(3),10 5 + (1),9 Status Bits N Unaffected C Unaffected z Unaffected V Unaffected Examples pi XT ao,*ai Before After AO A1 @20500h FSIZE PP T PMASK @20500h D OOOOFFFFh 00020500h OOOOh 0001 h 00000 OOOOh 0001 h 1) OOOOFFFFh 00020500h OOOOh 0002h 00000 OOOOh 0003h D OOOOFFFFh 00020500h OOOOh 0004h 00000 OOOOh OOOFh 1) OOOOFFFFh 00020500h OOOOh 0008h 00000 OOOOh OOFFh 1) OOOOFFFFh 00020500h OOOOh 001 Oh 00000 OOOOh FFFFh 1) 00000006h 00020508h OOOOh 0004h 00000 OOOOh 0600h 2) 00000006h 00020508h 0300h 0004h 01010 OOOOh 0500h 3) 00000006h 00020508h 0100h 0004h 00001 OOOOh OOOOh 4) 00000006h 00020508h 0100h 0004h 00001 1 OOOOh 0100h 5) 00000006h 00020508h OOOOh 0004h 00000 AAAAh 0400h Notes: 1) S replaces D 2) (SXOR D) r ^places D 3) (SAND D) = = 0, transparency is Dff, D is r eplaced 4) (S + D) = 0, transparency is on, D is not replaced 5) S replaces unmasked bits of D 12-214 Pixel Transfer - Register to Indirect XY PIXT Syntax Execution Instruction Words Description Implied Operands Window Checking PIXT Rs, *Rd.XY (Note that Rd contains an XY address.) pixel in Rs - *Rd.XY 15 14 13 12 11 10 9 8 7 1 11110 Rs R Rd This PIXT instruction transfers a pixel from a register to memory. The source pixel is the 1, 2, 4, 8, or 16 LSBs of the source register, depending on the pixel size specified in the PSIZE I/O register. The destination register contains an XY address; the X value occupies the 16 LSBs of the register and the Y value occupies the 16 MSBs. The source pixel is moved to the XY address specified in Rd. Rs and Rd must be in the same register file. B File Registers Register Name Format Description B3 DPTCH Linear Destination pitch B4 OFFSET Linear Screen origin (0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) W -Window clipping or pick operation T -Transparency operation C0000140h CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C0000160h PMASK Plane mask- pixel format Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. You can use window checking with this instruction by setting the W bits in the CONTROL register to the desired value. If you select window checking mode 1, 2, or 3, the WSTART and WEND registers define the XY starting and ending corners of a rectangular window. When an attempt is made to write a pixel inside or outside a window, the results depend on the selected window checking mode: 12-215 PIXT Pixel Transfer - Register to Indirect XY No window checking. unaffected. The pixel is drawn and the WVP and V bits are 1 Window hit. No pixels are drawn. The V bit is set to if the pixel lies within the window; otherwise, it is set to 1 . 2 Window miss. If the pixel lies outside the window, the V and WVP bits are set to 1 and the instruction is aborted (no pixels are drawn). Other- wise, the pixel is drawn and the V bit is set to 0. 3 Window dip. If the pixel lies outside the window, the V bit is set to 1 and the instruction is aborted (no pixels are drawn). Otherwise, the pixel is drawn and the V bit is set to 0. For more information, see Section 7.10, Window Checking, on page 7-26. You can select a pixel processing option to use with this instruction by setting the PPOP bits in the CONTROL register. The pixel processing op- eration is applied to the pixel as it is transferred to the destination location. The default case at reset is the rep/ace option. For more information, see Section 7.7, Pixel Processing, on page 7-15. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. Machine States Pixel Processing Pixel Processing Operation Window Violation PSIZE Replace Boolean ADD ADDS SUB SUBS MIN/MAX W=1 W=2 W=3 1,2,4,8 16 4+(3),10 4+(1),8 6+(3),12 6+(1),10 6+(3),12 6 + (1),10 7 + (3),13 7 + (1),11 7+(3),13 7 + (1),11 8+(3),14 8+(1),12 7 + (3),13 7 + (1),11 6,9 6,9 6,9 6,9 4,7 4,7 Status Bits N Unaffected C Unaffected Z Unaffected V /if the pixel lies outside the window and W=1 , W=2, or W=3, oth- erwise. Unaffected if W=0. 12-216 Pixel Transfer - Register to Indirect XY PIXT Examples Before executing a PIXT instruction, load the implied operand registers with appropriate values. These PIXT examples use the following implied oper- and setup. Register File B: I/O Registers DPTCH (B3) 00000800h CONVDP = 0014h OFFSET (B4) = OOOOOOOOh WSTART (B5) = 00300020h WEND (B6) 005001 42h PIXT A0,*A1.XY Before After AO A1 @20500h PSIZE PP w T PMASK @20500h 1) OOOOFFFFh 00400500h OOOOh 0001 h 00000 00 OOOOh 0001 h 1) OOOOFFFFh 00400280h OOOOh 0002h 00000 00 OOOOh 0003h 1) OOOOFFFFh 004001 40h OOOOh 0004h 00000 00 OOOOh OOOFh 1) OOOOFFFFh 004000A0h OOOOh 0008h 00000 00 OOOOh OOFFh 1) OOOOFFFFh 00400050h OOOOh 001 Oh 00000 00 OOOOh FFFFh 1) 00000006 h 004001 42h OOOOh 0004h 00000 00 OOOOh 0600h 2) 00000006 h 004001 42h 0300h 0004 h 01010 00 OOOOh 0500h 3) 00000006 h 004001 42h 0100h 0004h 00001 00 OOOOh OOOOh 4) 00000006 h 004001 42h 0100h 0004 h 00001 00 1 OOOOh 0100h 5) 00000006 h 004001 42h OOOOh 0004h 00000 00 AAAAh 0400h 6) 00000006 h 004001 42h OOOOh 0004h 00000 11 OOOOh 0600h 7) 00000006 h 004001 43h OOOOh 0004h 00000 11 OOOOh OOOOh 8) 00000006 h 004001 43h OOOOh 0004h 00000 10 OOOOh OOOOh XY Address in A1 = Linear Address 20500h Notes: 1 ) S replaces D 2) (S XOR D) replaces D 3) (S AND D) = 0, transparency is off, D is replaced 4) (S + D) = 0, transparency is on, D not replaced 5) S replaces unmasked bits of D 6) Window Option = 3, D inside window, S replaces D 7) Window Option = 3, D outside window, D not replaced, V bit set in status register 8) Window Option = 2, D outside window, D not replaced, WV interrupt generated, V bit set in status register 12-217 PIXT Pixel Transfer - Indirect to Register Syntax Execution Instruction Words Description Implied Operands Window Checking Pixel Processing PIXT *Rs. Rd (Note that Rs contains a linear address.) pixel at *Rs -+ Rd 15 14 13 12 11 10 9 8 7 1 111110 1 Rs R Rd This PIXT instruction transfers a pixel from memory to a register. The source register contains a linear address; the pixel at this address is trans- ferred into the destination register. When the pixel is moved into Rd, it is right justified and zero extended to 32 bits according to the pixel size spe- cified in the PSIZE I/O register. Rs and Rd must be in the same register file. I/O Registers Address Name Description and Elements (Bits) C00001 50h PSIZE Pixel size (1,2,4,6,8,16) C0000160h PMASK Plane mask - pixel format Due to the pipelining of memory writes, the last I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. Window checking cannot be used with this instruction. The W bits are ignored. Pixel processing cannot be used with this instruction. Transparency Transparency cannot be used with this instruction. Plane Mask The plane mask is enabled for this instruction. Machine States 4,7 Status Bits N Undefined C Undefined Z Undefined V Set to 1 if the pixel is 1 , set to if the pixel is 12-218 Pixel Transfer - Indirect to Register PIXT Examples Assume that memory contains the following values: Address Data @20500h OFFFFh @20510h 3333h PIXT *A0,A1 Before After AO PSIZE PMASK A1 00020500h 0001 h 0000 h 00000001 h 00020500h 0001 h FFFFh OOOOOOOOh 00020500h 0002h OOOOh 00000003h 00020500h 0002h 5555h 00000002h 00020500h 0004h OOOOh 0000000 Fh 0002051 Oh 0004h 9999h 00000002h 00020500h 0008h OOOOh 000000 FFh 0002051 Oh 0008h 5454h 00000023h 00020500h 001 Oh OOOOh OOOOFFFFh 00020500h 001 Oh BA98h 00004567h 0002051 Oh 001 Oh BA98h 000001 23h 12-219 PIXT Pixel Transfer - Indirect to Indirect Syntax Execution Instruct/on Words Description Implied Operands Pixel Processing Window Checking PIXT *Rs. *Rd (Note that Rs and Rd contain linear addresses.) pixel at *Rs ■* *Rd 15 14 13 12 11 10 9 8 7 6 E 1 1111110 Rs R Rd This PIXT instruction transfers a pixel from one memory location to another. The source and destination registers both contain linear addresses. The address in Rs is the address of the source pixel; the pixel is moved into the address in Rd. Rs and Rd must be in the same register file. I/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) T -Transparency operation C00001 50h PSIZE Pixel size (1,2,4,6,8,16) C00001 60h PMASK Plane mask - pixel format Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. You can select a pixel processing option to use with this instruction by setting the PPOP bits in the CONTROL register. The pixel processing op- eration is applied to the pixel as it is transferred to the destination location. The default case at reset is the replace option. For more information, see Section 7.7, Pixel Processing, on page 7-15. Window checking cannot be used with this instruction, ignored. The W bits are Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. 12-220 Pixel Transfer - Indirect to Indirect PIXT Machine States Pixel Processing Operation Window Violation PSIZE Replace Boolean ADD ADDS SUB SUBS MIN/MAX W=1 W=2 W=3 1,2,4,8 16 4 + (3),10 4+(1),8 6 + (3),12 6 + (1),10 6 + (3),12 6 + (1),10 7 + (3),13 7 + (1),11 7 + (3),13 7 + (1),11 8 + (3),14 8 + (1),12 7 + (3),13 7 + (1),11 - - - Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples PIXT *A0,*A1 Before After AO A1 @20500h PSIZE PP T PMASK @20500h @20510h 1) 00020500h 00020508h 000 Fh 0001 h 00000 OOOOh 010Fh xxxx 1) 00020500h 00020508h OOOFh 0002h 00000 OOOOh 030Fh xxxx 1) 00020500h 00020508h OOOFh 0004h 00000 OOOOh OFOFh xxxx 1) 00020500h 00020508h OOEFh 0008h 00000 OOOOh EFEFh xxxx 1) 00020500h 00020508h 1234h 001 Oh 00000 OOOOh 3434h xx12h 2) 00020500h 00020508h 030Fh 0004h 01010 OOOOh OCOFh xxxx 3) 00020500h 00020508h 010Eh 0004h 00001 OOOOh OOOEh xxxx 4) 00020500h 00020508h 020Eh 0004h 00001 1 OOOOh 020 Eh xxxx 5) 00020500h 00020508h Notes: 1 ) S replaces OOOFh D 0004h 00000 AAAAh 050Fh xxxx 2) (S XOR D) replaces D 3) (SANDD ) - 0, transparency is off D is replaced 4) (S + D) = 0, transparency s on, D not replaced 5) S replaces unmasked bits of D 12-221 PIXT Pixel Transfer - Indirect XY to Register Syntax Execution Instruction Words Description Implied Operands Window Checking Pixel Processing PIXT *Rs.XY,Rd (Note that Rs contains an XY address.) pixel at *Rs.XY - Rd 15 14 13 12 11 10 9 8 7 1 11110 1 Rs R Rd This PIXT instruction transfers a pixel from a memory location to a register. The source register contains an XY address; the X value occupies the 16 LSBs of the register and the Y value occupies the 16 MSBs. The address in Rs is the address of the source pixel; this pixel is moved into the desti- nation register. When the pixel is moved into Rd, it is right justified and zero extended to 32 bits according to the pixel size specified in the PSIZE I/O register. Rs and Rd must be in the same register file. B File Registers Register Name Format Description B1 SPTCH Linear Source pitch B4 OFFSET Linear Screen origin (0,0) I/O Registers Address Name Description and Elements (Bits) C00001 30h CONVSP XY-to- linear conversion (source pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C0000160h PMASK Plane mask - pixel format Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. Window checking cannot be used with this instruction, ignored. The W bits are Pixel processing cannot be used with this instruction. Transparency Transparency cannot be used with this instruction. Plane Mask The plane mask is enabled for this instruction. Machine States 6,9 12-222 Pixel Transfer - Indirect XY to Register PIXT Status Bits N Undefined C Undefined Z Undefined V Set to 1 if the pixel is 1 , set to if the pixel is 0. Examples These PIXT examples use the following implied operand setup. Register File B: DPTCH (B3) - 800h OFFSET (B4) = OOOOOOOOh I/O Registers: CONVSP = 001 4h Assume that memory address @20500h contains CF3Fh before instruction execution. PIXT *A0.XY Al Before After AO PSIZE PMASK Al 00400500h 0001 h OOOOh 00000001 h 00400500h 0001 h FFFFh OOOOOOOOh 00400280h 0002h OOOOh 00000003h 00400280h 0002h AAAAh 00000001 h 004001 40h 0004h OOOOh OOOOOOOFh 004001 40h 0004h 9999h 00000006 h 004000A0h 0008h OOOOh 0000003 Fh 004000A0h 0008h 8989h 00000036 h 00400050h 001 Oh OOOOh 0000CF3Fh 00400050h 001 Oh 731 Oh 00008C2Fh Note: The XY addresses stored in register A1 in these examples translate to the linear memory address 20500h. The pitch of the source was not changed for any of these examples. 12-223 PIXT Pixel Transfer - Indirect XY to Indirect XY Syntax Execution Instruction Words Description Implied Operands Window Checking PIXT *Rs.XY, *Ftd.XY (Note that Rs and Rd contain XY addresses.) pixel at *Rs.XY - *Rd.XY 15 14 13 12 11 10 9 8 7 6 1 11110 10 Rs R Rd This PIXT instruction transfers a pixel from one memory location to another. The source and destination registers both contain XY addresses; the X value occupies the 16 LSBs of the register and the Y value occupies the 16 MSBs. Rs contains the address of the source pixel; Rd contains the address where the pixel is moved. Rs and Rd must be in the same register file. B File Registers Register Name Format Description B1 SPTCH Linear Source pitch B3 DPTCH Linear Destination pitch B4 OFFSET Linear Screen origin (0,0) B5 WSTART XY Window starting corner B6 WEND XY Window ending corner i/O Registers Address Name Description and Elements (Bits) COOOOOOBOh CONTROL PP- Pixel processing operations (22 options) W -Window clipping or pick operation T -Transparency operation C0000130h CONVSP XY-to- linear conversion (source pitch) COOOOUOh CONVDP XY-to-linear conversion (destination pitch) C00001 50h PSIZE Pixel size (1,2,4,8,16) C0000160h PMASK Plane mask- pixel format Due to the pipelining of memory writes, the fast I/O register that you write to may not, in some cases, contain the desired value when you execute the PIXT instruction. To ensure that this register contains the correct value for execution, you may want to follow the write to that location with an in- struction that reads the same location (such as a MOVE SAddress,Rd in- struction). For more information, refer to Section 6.2, Latency of Writes to I/O Registers. You can use window checking with this instruction by setting the W bits in the CONTROL register to the desired value. If you select window checking mode 1, 2, or 3, the WSTART and WEND registers define the XY starting and ending corners of a rectangular window. When an attempt is made to write a pixel inside or outside a window, the results depend on the selected window checking mode: 12-224 Pixel Transfer - Indirect XY to Indirect XY PIXT No window checking. unaffected. The pixel is drawn and the WVP and V bits are 1 Window hit. No pixels are drawn. The V bit is set to if the pixel lies within the window; otherwise, it is set to 1 . 2 Window miss. If the pixel lies outside the window, the V and WVP bits are set to 1 and the instruction is aborted (no pixels are drawn). Other- wise, the pixel is drawn and the V bit is set to 0. 3 Window clip. If the pixel lies outside the window, the V bit is set to 1 and the instruction is aborted (no pixels are drawn). Otherwise, the pixel is drawn and the V bit is set to 0. For more information, see Section 7.10, Window Checking, on page 7-25. You can select a pixel processing option to use with this instruction by setting the PPOP bits in the CONTROL register. The pixel processing op- eration is applied to the pixel as it is transferred to the destination location. The default case at reset is the replace option. For more information, see Section 7.7, Pixel Processing, on page 7-1 5. Transparency You can enable transparency for this instruction by setting the T bit in the CONTROL I/O register to 1. The TMS34010 checks for (transparent) source pixels after it processes the source data. At reset, the default case for transparency is off. Plane Mask The plane mask is enabled for this instruction. Machine States Pixel Processing Pixel Processing Operation Window Violation PSIZE Replace Boolean ADD ADDS SUB SUBS MIN/MAX W=1 W=2 W=3 1,2,4,8 16 7 + (3),13 7 + (1),11 9 + (3),15 9 + (1),13 9 + (3),15 9+(1),13 I0+(3),16 I0 + (1),14 I0+(3),16 I0+(1),14 11+(3),17 11+(1),15 10 + (3),16 10 + (1),14 - 8,11 8,11 6,9 6,9 Status Bits Examples N Unaffected C Unaffected Z Unaffected V 7 if the pixel lies outside the window and W=1, W=2, or W=3, oth- erwise. Unaffected if W=0. These PIXT examples use the following implied operand setup. Register File B: SPTCH (B1) DPTCH (B3) OFFSET (B4) WSTART (B5) = WEND (B6) 800h 800h OOOOOOOOh 00300020h 005001 42h I/O Registers: CONVSP = 001 4h CONVDP = 001 4h PIXT *A0.XY *A1.XY 12-225 PIXT Pixel Transfer - Indirect XY to Indirect XY Before After AO A1 @20500h PSIZE PP W T PMASK @20500h @20510h 1) 00400500h 00400508h OOOFh 0001 h 00000 00 OOOOh 010Fh xxxx 1) 00400280h 00400284h OOOFh 0002h 00000 00 OOOOh 030Fh xxxx 1) 004001 40h 004001 42h OOOFh 0004h 00000 00 OOOOh OFOFh xxxx 1) 004000A0h 004000A1 h OOEFh 0008 h 00000 00 OOOOh EFEFh xxxx 1) 00400050h 00400051 h CDEFh 001 Oh 00000 00 OOOOh CDEFh CDEFh 2) 004001 40h 004001 42h 0306h 0004h 01010 00 OOOOh 0506h xxxx 3) 004001 40h 004001 42h 0106h 0004h 00001 00 OOOOh 0006h xxxx 4) 004001 40h 004001 42h 0106h 0004h 10001 00 1 OOOOh 0106h xxxx 5) 004001 40h 004001 42h 0006h 0004h 00000 00 AAAAh 0406h xxxx 6) 004001 40h 004001 42h 0006h 0004h 00000 11 OOOOh 0606h xxxx 7) 004001 40h 004001 43h 0006 h 0004h 00000 11 OOOOh 0006h xxxx 8) 004001 40h 004001 43h 0006 h 0004h 00000 10 OOOOh 0006 h xxxx XY Address in AO = Linear Address 20500h Notes: 1 ) S replaces D 2) (S XOR D) replaces D 3) (S AND D) = 0, transparency is off, D is replaced 4) (S + D) = 0, transparency is on, D not replaced 5) S replaces unmasked bits of D 6) Window Option = 3, D inside window, S replaces D 7) Window Option = 3, D outside window, D not replaced, V bit set in status register 8) Window Option = 2, D outside window, D not replaced, WV interrupt generated, V bit set in status register 12-226 Pop Status Register from Stack POPST Syntax Execution Instruction Words Description Machine States Status Bits Examples POPST *SP+ -* ST 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 POPST pops the status register from the stack and increments the SP by 32 after the status register is removed from the stack. 313029282726 25242322212019 18 17 16 15 14 13 12 1110 9 876643210 N C Z V fctt* p B X I E R08WV6d IE F81 F E FSO Status Register 8,11 (SP aligned) 10,13 (SP nonaligned) N Set from bit 31 of stack status. C Set from bit 30 of stack status. Z Set from bit 29 of stack status. V Set from bit 28 of stack status. IE Set from bit 21 of stack status. Assume that memory contains the following values before instruction exe- cution: Address Data OFFOOOOOh 001 Oh 0FF00010h COOOh Code Before After S P ST S P popst OFFOOOOOh C0000010h 0FF00020h 12-227 PUSHST Push Status Register onto Stack Syntax Execution Instruction Words Description PUSHST ST - -*SP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 PUSHST writes the status register contents to the address contained in the SP-32. 31302928272625242322212019 18 17 16 15 1413 121110 9 876543210 N C z V fttt p B X fta* I E fflMNM¥Mt F E 1 F81 F E FS0 Status Register Machine States 2+(3),8 (SP aligned) 2+(8),13 (SP nonaligned) Status Bits IM Unaffected C Unaffected Z Unaffected V Unaffected Example Code Before After PUSHST SP ST SP 0FF00020h C0000010h OFFOOOOOh Memory contains the following values after instruction execution Address 0FF00010h 0FF00020h Data 001 Oh COOOh 12-228 Copy Register into Status PUTST Syntax Execution Instruction Words Description Machine States Status Bits Example PUTST Rs Rs - ST 15 14 13 12 11 1C ) 9 8 7 6 5 4 3 2 1 00000001101 R Rs PUTST copies the contents of the specified register into the status register. 31302928272625242322212019 18 17 16 15 14 13 121110 9 876543210 N C z V ■h p B X ftw I E ftMHKVOd F E 1 F81 F E FS0 Status Register 3,6 N C z V IE Set to value of bit 31 in source register Set to value of bit 30 in source register Set to value of bit 29 in source register Set to value of bit 28 in source register Set to value of bit 21 in source register Code PUTST A0 Before A0 C000001 Oh ST xxxxxxxxh After ST C000001 Oh 12-229 RETI Return from Interrupt Syntax Execution Instruction Words Description Machine States Status Bits Interrupts RETI *SP+ *SP+ ST PC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 RETI returns to an interrupted routine from an interrupt service routine. The instruction restores the ST and PC to their original values that were stored on the system stack. The stack is located in external memory and the top is indicated by the stack pointer (SP). The stack grows in the direction of decreasing linear address. The ST and PC are popped from the stack and the SP is incremented by 32 after each register is removed from the stack. Note: If the PBX status bit is set in the restored ST value, then the bit is cleared and a PIXBLT or FILL is resumed, depending on the values stored in the B-file registers. The CONTROL register and any B-file registers modified by an interrupt routine should be restored before RETI is executed. Otherwise, inter- rupted PIXBLT and FILL instructions may not resume execution cor- rectly. 11,14 (aligned stack) 15,18 (nonaligned stack) N Copy of corresponding bit in stack location C Copy of corresponding bit in stack location Z Copy of corresponding bit in stack location V Copy of corresponding bit in stack location IE Copy of corresponding bit in stack location If the IE bit in the restored ST is a 1, interrupts are enabled by the time the RETI instruction finishes executing. If an interrupt request is active during the last state of the RETI instruction, and the interrupt is enabled in the INTENB register, the interrupt will be taken immediately following the RETI. Since interrupts are level -triggered, the interrupt service routine should write to the interrupting device to clear the interrupt request before execut- ing an RETI. The following example shows a typical interrupt service rou- tine; in this example, the symbol device is the symbolic address of the interrupting device. 12-230 Return from Interrupt RETi CLR AO MOVE AO, ©DEVICE RETI ** In this example, the interrupt request is cleared by the MOVE instruction, which writes a to the device address. Examples Assume that memory contains the following values before instruction exe- cution: Address Data CCCOOOOh 001 Oh CCC001 Oh COOOh CCC0020h FFFOh CCC0030h 0044h Code Before After SP ST PC SP reti CCCOOOOh C0000010h 0044FFF0h CCC0040h 12-231 RETS Return from Subroutine Syntax Execution Instruction Words Description Machine States Status Bits Examples RETS [N] *SP - PC (/V defaults to 0) SP + 32+ 16/V- SP 15 14 13 12 11 10 9 8 1 1 RETS returns from a subroutine by popping the program counter from the stack and optionally incrementing the stack pointer. The N parameter is optional; it can be a value between and 32 that indi- cates a number of words that are added to the stack pointer. If N is speci- fied, the stack pointer is incremented by 32 + 16/V. If N is not specified, the stack is incremented by 32. Execution then continues according to the PC value loaded. 7,1 (Aligned stack) 9,12 (Unaligned stack) N Unaffected C Unaffected Z Unaffected V Unaffected Assume that memory contains the following values before instruction exe- cution: Address Data OFFOOOOOh OFFFOh 0FF00010h 0001 h Code Before After SP PC SP RETS OFFOOOOOh 0001 FFFOh 0FF00020h RETS 1 OFFOOOOOh 0001 FFFOh 0FF00030h RETS 2 OFFOOOOOh 0001 FFFOh 0FF00040h RETS 16 OFFOOOOOh 0001 FFFOh 0FF00120h RETS 31 OFFOOOOOh 0001 FFFOh 0FF00210h 12-232 Store Revision Number REV Syntax Execution Instruction Words Description REV Rd revision number Rd 15 14 13 12 11 10 9 8 1 1 R Rd REV stores the revision number of the TMS340 family device in the desti- nation register. The revision number information is stored in the following format: 31 16 15 3 2 undefined 00 0000000000 1 undefined Machine States 1,4 Status Bits N Unaffected C Unaffected Z Unaffected V Unaffected Examples Code Before After REVA1 A1 OFFFFFFFFh A1 00000008 h 12-233 RL Rotate Left - Constant Syntax Execution Instruction Words Description Machine States Status Bits Examples RL K, Rd left- rotate Rd by K Rd 15 14 13 12 11 10 9 8 1 110 K R Rd RL left-rotates the contents of the destination register by a specified num- ber of bits. (This rotation is a barrel shift.) The rotate count is specified by a 5-bit immediate value, or constant; this produces a rotation amount of to 31 bits. (K in the syntax represents the 5- bit constant.) This is a circular rotate so that bits shifted out the MSB are shifted into the LSB. c 31 Ih r ^ LS8 The assembler only accepts absolute expressions for the rotate count. If the specified rotation value is greater than 31, the assembler issues a warning and set the K field in the opcode to the 5 LSBs of K. The carry bit is set to the value of the last bit that is shifted out of the MSB (this value is the same as the final value of the LSB). You can use a rotate count of to clear the carry and test a register for simultaneously. 1,4 N Unaffected C Set to value of last bit rotated out, for rotate count of Z 1 if result is 0, otherwise V Unaffected Code Before After A1 NCZV A1 RL 0,A1 0000000 Fh xOOx OOOOOOOFh RL 1,A1 FOOOOOOOh x10x E0000001 h RL 4,A1 FOOOOOOOh x10x OOOOOOOFh RL 5,A1 FOOOOOOOh xOOx 0000001 Eh RL 30, Al FOOOOOOOh x10x 3C0OOO00h RL 5,A1 OOOOOOOOh x01x OOOOOOOOh 12-234 Rotate Left - Register RL Syntax Execution Instruction Words Operands Description Machine States Status Bits Examples RL Rs.Rd left- rotate Rd by 5 LSBs of Rs -► Rd 15 14 13 12 11 10 9 8 1 110 10 Rs R Rd Rs The five LSBs of the source register specify the left rotate count (a value from to 31 ). The 27 MSBs are ignored. RL left-rotates the contents of the destination register by a specified num- ber of bits. (This rotation is a barrel shift.) The rotate count is specified by the 5 LSBs of Rs (the 27 MSBs are ignored); this produces a rotation amount between and 31 bits. This is a circular rotate; the bits that are shifted out of the MSB of Rd are shifted into the LSB. L> 31 Yi MSB LSB Note that the you must designate Rs with a keyword or symbol which has been defined to be a register, for example, A9; otherwise, the assembler uses the RL K,Rd instruction. The carry bit is set to the value of the last bit that is shifted out of the MSB (this value is the same as the final value of the LSB). Rs and Rd must be in the same register file. 1,4 N Unaffected C Set to value of last bit rotated out, for rotate count of Z 7 if result is 0, otherwise V Unaffected Code Before After 5 LSBs A0 A1 NCZV A1 RL A0 rAl 00000 OOOOOOOFh xOOx OOOOOOOFh RL A0 rAl 00100 FOOOOOOOh x10x OOOOOOOFh RL A0 ,A1 00101 FOOOOOOOh xOOx 0000001 Eh RL A0 rAl 11111 FOOOOOOOh xOOx 78000000h RL A0 rAl xxxxx OOOOOOOOh x01x OOOOOOOOh 12-235 SETC Set Carry Syntax Execution Instruction Words Description SETC 1 -• C 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 SETC sets the carry bit (C) in the status register to 1 . The rest of the status register is unaffected. This instruction is useful for returning a true/false value (in the carry bit) from a subroutine without using a general-purpose register. Machine States 1,4 Status Bits N Unaffected C / Z Un affected V Unaffected Examples Code Before ST NCZV SETC OOOOOOOOh 0000 SETC B000001 Oh 1011 SETC 4000001 Fh 0100 After ST NCZV 40000000h 01 00 F000001 Oh 1111 4000001 Fh 0100 12-236 Set Field Parameters SETF Syntax Execution Instruction Words Description Machine States Status Bits Examples SETF FS,FE[,F] FS, FE - ST 15 14 13 12 11 10 9 8 1 1 F 1 1 FE FS SETF loads specified field size (FS) and field extension (FE) values into the status register; depending on the value of the F parameter, this information sets the field size and extension for either field or field 1 . (The remainder of the status register is not affected.) 31302928272625242322212019 18 17 16 15 1413 12 1110 9 876543210 N C Z V Rear P B X R«8 I E fteiewdd F E 1 FS1 F E F80 Status Register • The FS parameter is a value between 1 and 32; it selects the field size. (Note that an FS value of in the opcode corresponds to an actual selected field size of 32.) • The FE parameter is a value of or 1 : FE=0 selects zero extension for a field. FE=1 selects sign extension for a field. • The F parameter is optional; the default value for F is 0. The F value determines whether the SETF instruction sets the field size and ex- tension for field or for field 1 . F=0 selects FS0, FE0 to be altered. F=1 selects FS1, FE1 to be altered. Each MOVE instruction also has an F parameter that selects the field size and extension of either field or field 1 for the individual move. You can use the SETF instruction to prepare for MOVE instructions. 1.4 for F=0 2.5 for F = 1 N Unaffected C Unaffected Z Unaffected V Unaffected Code SETF 32,0,0 SETF 32,1,0 SETF 31,1,0 SETF 16,0,0 SETF 32,0,1 SETF 32,1,1 SETF 31,1,1 SETF 16,0,1 Before ST xxxxxOOOh xxxxxOOOh xxxxxOOOh xxxxxOOOh xxxxxOOOh xxxxxOOOh xxxxxOOOh xxxxxOOOh After ST xxxxxOOOh xxxxx020h xxxxx03Fh xxxxxOI Oh xxxxxOOOh xxxxx800h xxxxxFCOh xxxxx400h 12-237 SEXT Sign Extend to Long Syntax Execution Instruction Words Description SEXT Rd[,F] field in Rd -* sign -extended field Rd 15 14 13 12 11 10 9 8 1 1 F 10 R Rd Machine States Status Bits Examples SEXT sign extends the right-justified field contained in the destination re- gister by copying the MSB of the field data into all the nonfield bits of the destination register. The size of the field is determined by the current field size. The optional F parameter, which must be specified as a or a 1, se- lects the field size: F=0 selects FS0 for the field size. F=1 selects FS1 for the field size. The default value for F is 0. 3,6 N /if the result is negative, otherwise C Unaffected Z /if the result is 0, otherwise V Unaffected Code Before After FS0/1 A0 IMCZV A0 SEXT AO 17/x 00008000h OxOx 00008000h SEXT A0 16/x 00008000h 1x0x FFFF8000h SEXT A0 15/x 00008000h 0x1 x OOOOOOOOh SEXT AO 1 x/17 00008000h Ox Ox 00008000h SEXT A0 1 x/16 00008000h 1x0x FFFF8000h SEXT A0 1 x/15 00008000h 0x1x OOOOOOOOh 12-238 Shift Left Arithmetic - Constant SLA Syntax Execution Instruction Words Description Machine States Status Bits Examples SLA K, Rd left-shift Rd by K - Rd 15 14 13 12 11 10 9 8 1 1 K R Rd SLA left-shifts the contents of the destination register by a specified num- ber of bits. The shift count is specified by a 5-bit constant (K in the syn- tax); this is a value between and 31 . As shown in the diagram, 0s are shifted into the least significant bits. The last bit shifted out of the destination register (the original value of bit 32-/Q is shifted into the carry bit. If either the new sign bit (N) or any of the bits shifted out of the register differ from the original sign bit, the over- flow bit (V) is set. MSB L88 The assembler accepts only absolute expressions for the shift count. If the shift count is greater than 31, the assembler issues a warning and sets the K field in the opcode to the 5 LSBs of K. Note that SLA executes slower than SLL because it provides overflow de- tection. 3,6 N C z V 1 if the result is negative, otherwise Set to the value of last bit shifted out, for shift count of 7 if a result generated, otherwise 1 if the MSB changes during shift operation, otherwise Code SLA SLA SLA SLA SLA SLA SLA SLA SLA SLA 0,A1 0,A1 1,A1 2,A1 2,A1 3,A1 5,A1 30, Al 31, Al 31, Al Before A1 33333333h CCCCCCCCh CCCCCCCCh 33333333h CCCCCCCCh CCCCCCCCh CCCCCCCCh CCCCCCCCh CCCCCCCCh OOOOOOOOh After Al 33333333h CCCCCCCCh 99999998h CCCCCCCCh 33333330h 66666660h 99999980h OOOOOOOOh OOOOOOOOh OOOOOOOOh IMCZV 0000 1000 1100 1001 0101 0001 1101 0111 0011 0010 12-239 SLA Shift Left Arithmetic - Register Syntax Execution Instruction Words Description SLA Rs.Rd left-shift Rd by 5 LSBs of Rs Rd 15 14 13 12 11 10 9 8 1 110 Rs R Rd SLA left-shifts the contents of the destination register by a specified num- ber of bits. The shift count is specified by the 5 LSBs of Rs (the 27 MSBs are ignored); this produces a shift count from to 31 . The last bit shifted out of the destination register (the original value of bit 32-/C) is shifted into the carry bit. If either the new sign bit (N) or any of the bits shifted out of the register differ from the original sign bit, the over- flow bit (V) is set. MSB L8B Note that you must designate Rs with a keyword or symbol which has been defined to be a register, for example, A9; otherwise, the assembler uses uses the SLA K,Rd instruction. Rs and Rd must be in the same register file. Note that SLA executes slower than SLL because it provides overflow de- tection. Machine States 3,6 Status Bits N 1 if the resu It is negative, otherwise C Set to value of last bit shifted out, for shift count of Z 7 if the resu It is 0, otherwise V /if the MSB changes during shift operation, otherwise Examples Code Before After 5 LSBs A0 A1 A1 NCZV SLA A0,A1 00000 33333333h 33333333h 0000 SLA A0,A1 00000 CCCCCCCCh CCCCCCCCh 1000 SLA A0,A1 00001 CCCCCCCCh 99999998h 1100 SLA A0,A1 00010 33333333h CCCCCCCCh 1001 SLA A0,A1 00010 CCCCCCCCh 33333330h 0101 SLA A0,A1 00011 CCCCCCCCh 66666660h 0001 SLA A0,A1 00101 CCCCCCCCh 99999980h 1101 SLA A0,A1 11110 CCCCCCCCh OOOOOOOOh 0111 SLA A0,A1 11111 CCCCCCCCh OOOOOOOOh 0011 SLA A0,A1 11111 OOOOOOOOh OOOOOOOOh 0010 12-240 Shift Left Logical - Constant SLL Syntax Execution Instruction Words Description Machine States Status Bits Examples SLL K.Rd left-shift Rd by K Rd 15 14 13 12 11 10 9 8 1 1 K R Rd SLL left-shifts the contents of the destination register by a specified number of bits. The shift count is specified by a 5-bit constant (K in the syntax.), which is a value between and 31 . The last bit shifted out of the destination register (the original value of bit 32-/C) is shifted into the carry bit. 0s are shifted into the least significant bits. This instruction differs from the SLA instruction only in its effect on the overflow (V) bit. c 3KM6B) 8hift «- 00.68) ]— The assembler only accepts absolute expressions for the shift count. If the specified shift count is greater than 31 , the assembler issues a warning and sets the K field in the opcode to the 5 LSBs of K. 1,4 N Unaffected C /to the value of last bit shifted out, for shift count of Z 7 if the result is 0, otherwise V Unaffected Code Before After Al Al NCZV SLL 0,A1 OOOOOOOOh OOOOOOOOh x01x SLL 0,A1 88888888h 88888888h xOOx SLL 1,A1 88888888h 11111110h x10x SLL 4,A1 88888888h 88888880h xOOx SLL 30, Al FFFFFFFCh OOOOOOOOh x11x SLL 31, Al FFFFFFFCh OOOOOOOOh x01x 12-241 SLL Shift Left Logical - Register Syntax Execution Instruction Words Description SLL Rs.Rd left-shift Rd by 5 LSBs of Rs Rd 15 14 13 12 11 10 9 8 110 1 Rs R Rd SLL left-shifts the contents of the destination register by a specified number of bits. The shift count is specified by the 5 LSBs of Rs (the 27 MSBs are ignored); this produces a shift count between and 31 . The last bit shifted out of the destination register (the original value of bit 32-/Q is shifted into the carry bit. 0s are shifted into the least significant bits. This instruction differs from the SLA instruction only in its effect on the overflow (V) bit. C I 3KM6B) (XLSB) Shift «- Machine States Status Bits Examples Note that you must designate Rs with a keyword or symbol which has been defined to be a register, for example, A9; otherwise, the assembler uses the SLA K,Rd instruction. Rs and Rd must be in the same register file. 1,4 N Unaffected C Set to the value of last bit shifted out, for shift value of Z 7 if the result is 0, otherwise V Unaffected Code Before After 5 LSBs A0 A1 A1 NCZV SLL A0,A1 00000 OOOOOOOOh OOOOOOOOh x01x SLL A0,A1 00000 88888888h 88888888h xOOx SLL A0,A1 00001 88888888h 11111110h x10x SLL A0,A1 00100 88888888h 88888880h xOOx SLL A0,A1 11110 FFFFFFFCh OOOOOOOOh x11x SLL A0,A1 11111 FFFFFFFCh OOOOOOOOh x01x 12-242 Shift Right Arithmetic - Constant SRA Syntax Execution Instruction Words Description Machine States Status Bits Examples SRA K, Rd right-shift Rd by K Rd 15 14 13 12 11 10 9 8 1 10 10 2s complement of K R Rd SRA right-shifts the contents of the destination register by a specified number of bits. The shift count is specified by the 2s complement of a 5-bit immediate value, or constant; this produces a shift count of to 31 . (K in the syntax represents this 5-bit constant). The last bit shifted out of the destination register (the original value of bit K-*\) is shifted into the carry bit. The sign bit (MSB) is extended into the most significant bits. 31 30 * S' ■> Shift MSB L8B -0 The assembler only accepts absolute expressions for the shift count. If the specified shift count is greater than 31, the assembler issues a warning and sets the K field in the opcode to the 2s complement of the 5 LSBs of K. 1,4 N 7 if the result is negative, otherwise C Set to the value of last bit shifted out, for shift count of Z 7 if the result is 0, otherwise V Unaffected Code Before After A1 A1 NCZV SRA 0,A1 OOOOOOOOh OOOOOOOOh 001 x SRA 0,A1 FFFFOOOOh FFFFOOOOh 100x SRA 8,A1 7FFF0000h 007FFF00h OOOx SRA 8,A1 FFFFOOOOh FFFFFFOOh 100x SRA 30,A1 7FFF0000h 00000001 h 01 Ox SRA 31, Al 7FFF0000h OOOOOOOOh 01 1x SRA 31, Al FFFFOOOOh FFFFFFFFh 11 Ox 12-243 SRA Shift Right Arithmetic - Register Syntax Execution Instruction Words Description Machine States Status Bits Examples SRA Rs.Rd right-shift Rd by 2s complement of 5 LSBs in Rs 15 14 13 12 11 10 9 8 7 6 5 Rd 1 110 10 Rs R Rd SRA right-shifts the contents of the destination register by a specified number of bits. The shift amount is specified by the 2s complement of the 5 LSBs of Rs (the 27 MSBs of Rs are ignored); this produces a shift count between and 31 . The last bit shifted out of the destination register (the original value of bit K-1) is shifted into the carry bit. The sign bit (MSB) is extended into the most significant bits. 31 30 d 6> ■* Shift MSB L6B -D You must specify Rs with a keyword or a symbol which has been defined to be a register, for example, A9; otherwise, the assembler uses the SRA K,Rd instruction. Rs and Rd must be in the same register file. 1,4 N 7 if the result is negative, otherwise C Set to the value of last bit shifted out, for shift count of Z 7 if the result is 0, otherwise V Unaffected Code Before After 5 LSBs A0 A1 A1 IMCZV SRA A0 ,A1 00000 OOOOOOOOh OOOOOOOOh 001 x SRA A0 ,A1 00000 FFFFOOOOh FFFFOOOOh 100x SRA A0 ,A1 11111 7FFF0000h 3FFF8000h OOOx SRA A0 ,A1 11111 FFFFOOOOh FFFF8000h 100x SRA A0 ,A1 11000 7FFF0000h 007FFF00h OOOx SRA A0 rAl 11000 FFFFOOOOh FFFFFFOOh 100x SRA A0 rAl 00010 7FFF0000h 00000001 h 01 Ox SRA A0 rAl 00001 7FFF0000h OOOOOOOOh 01 1x SRA A0 rAl 00001 FFFFOOOOh FFFFFFFFh 11 Ox 12-244 Shift Right Logical - Constant SRL Syntax Execution Instruction Words Description Machine States Status Bits Examples SRL K.Rd right-shift Rd by 2s complement of K 15 14 13 12 11 10 9 8 Rd 1 10 1 1 2s complement of K R Rd SRL right-shifts the contents of the destination register by a specified number of bits. The shift amount is specified by the 2s complement of a 5-bit immediate value; this produces a shift count between and 31. (K in the syntax represents the immediate value, or constant.) The last bit shifted out of the destination register (the original value of bit KA ) is shifted into the carry bit. 0s are shifted into the most significant bits. 31 -► Shift <] MSB LSB The assembler accepts only absolute expressions for the shift count. If the specified shift amount is greater than 31 , the assembler issues a warning and set the K field in the opcode to the 2s complement of the 5 LSBs of K. 1,4 N Unaffected C Set to the value of last bit shifted out, for shift count of Z 7 if the result is 0, otherwise V Unaffected Code Before After A1 A1 NCZV SRL 0,A1 OOOOOOOOh OOOOOOOOh x01x SRL 0,A1 7FFFFFFFh 7FFFFFFFh xOOx SRL 1,A1 7FFFFFFFh 3FFFFFFFh x10x SRL 8,A1 7FFF0000h 007FFF00h xOOx SRL 30, Al 7FFF0000h 00000001 h x10x SRL 31, Al 7FFF0000h OOOOOOOOh x1 1x SRL 31,A1 3FFF0000h OOOOOOOOh x01x 12-245 SRL Shift Right Logical - Register Syntax Execution Instruction Words Description Machine States Status Bits Examples SRL Rs.Rd right-shift Rd by 2s complement of 5 LSBs in Rs 15 14 13 12 11 10 9 8 7 6 5 Rd 110 11 Rs R Rd SRL right-shifts the contents of the destination register by a specified number of bits. The shift amount is specified by the 2s complement of the 5 LSBs of Rs (the 27 MSBs of Rs are ignored); this produces a shift value of to 31 . The last bit shifted out of the destination register (the original value of bit /f-1 ) is shifted into the carry bit. 0s are shifted into the most significant bits. 31 -► 6Mtt }— WVQO LGB You must specify Rs with a keyword or symbol which has been defined to be a register, for example, A9; otherwise, the assembler uses the SRL K,Rd instruction. Rs and Rd must be in the same register file. 1,4 N Unaffected C Set to the value of last bit shifted out, for shift count of Z 7 if the result is 0, otherwise V Unaffected Code Before After 5 LSBs A0 A1 A1 NCZV SRL A0,A1 00000 OOOOOOOOh OOOOOOOOh x01x SRL A0,A1 00000 7FFFFFFFh 7FFFFFFFh xOOx SRL A0,A1 11111 7FFFFFFFh 3FFFFFFFh x10x SRL A0,A1 11000 7FFF0000h 007FFF00h xOOx SRL A0,A1 00010 7FFF0000h 00000001 h x10x SRL A0,A1 00001 7FFF0000h OOOOOOOOh x11x SRL A0,A1 00001 3FFF0000h OOOOOOOOh x01x 12-246 Subtract Registers SUB Syntax Execution Instruction Words Description SUB Rs.Rd Rd - Rs - Rd 15 14 13 12 11 10 9 8 1 10 10 Rs R Rd Machine States Status Bits Examples SUB subtracts the contents of the source register from the contents of the destination register and stores the result in the destination register. You can accomplish multiple-precision arithmetic by using SUB in con- junction with the SUBB instruction. Rs and Rd must be in the same register file. 1,4 N 7 if the result is negative, otherwise C /if there is a borrow, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Code Before After A0 Al NCZV A0 SUB Al ,A0 7FFFFFF2h 7FFFFFF1h 0000 00000001 h SUB Al ,A0 7FFFFFF2h 7FFFFFF2h 0010 OOOOOOOOh SUB Al r A0 7FFFFFF1h 7FFFFFF2h 1100 FFFFFFFFh SUB Al ,A0 7FFFFFF1h FFFFFFFFh 0100 7FFFFFF2h SUB Al ,A0 7FFFFFFFh FFFFFFFFh 1101 80000000h SUB Al ,A0 FFFFFFFDh FFFFFFFFh 1100 FFFFFFFEh SUB Al ,A0 FFFFFFFDh FFFFFFFDh 0010 OOOOOOOOh SUB Al r A0 FFFFFFFEh FFFFFFFDh 0000 00000001 h SUB Al ,A0 FFFFFFFFh 00000001 h 1000 FFFFFFFEh SUB Al P A0 80000000h 00000001 h 0001 7FFFFFFFh 12-247 SUBB Subtract Registers with Borrov Syntax Execution Instruction Words Description SUBB Rs.Rd Rd - Rs - C -+ Rd (the carry bit acts as a borrow) 15 14 13 12 11 10 9 8 7 6 5 1 1 1 Rs Rd SUBB subtracts both the contents of the source register and the carry t from the contents of the destination register, and stores the result in tl destination register. You can use this instruction with the SUB, SUBK, and SUBI instructioi for extended -precision arithmetic. Rs and Rd must be in the same register file. Machine States 1,4 Status Bits N 7 if the result is negative, otherwise C /if there s a borrow, otherwise Z 7 if the result is 0, otherwise V 7 if there s an overflow, otherwise Examples Code Before After C AO A1 IMCZV SUBB A1,A0 00000002 h 00000001 h 0000 SUBB A1,A0 1 00000002h 00000001 h 0010 SUBB A1,A0 00000002 h 00000002h 0010 SUBB A1,A0 1 00000002h 00000002h 1100 SUBB A1,A0 00000002h 00000003 h 1100 SUBB A1,A0 7FFFFFFEh FFFFFFFFh 0100 SUBB A1,A0 7FFFFFFEh FFFFFFFEh 1101 SUBB A1,A0 1 7FFFFFFEh FFFFFFFEh 0100 SUBB A1,A0 FFFFFFFEh FFFFFFFFh 1100 SUBB A1,A0 FFFFFFFEh FFFFFFFEh 0010 SUBB A1,A0 1 FFFFFFFEh FFFFFFFEh 1100 SUBB A1,A0 FFFFFFFEh FFFFFFFDh 0000 SUBB A1,A0 1 FFFFFFFEh FFFFFFFDh 0010 SUBB A1,A0 80000001 h 00000001 h 1000 SUBB A1,A0 1 80000001 h 00000001 h 0001 SUBB A1,A0 80000001 h 00000002h 0001 12-248 Subtract Immediate - 16 Bits SUBI Syntax Execution Instruction Words Description Machine States Status Bits Examples SUBI /W,Rd[,\N] Rd - IW - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 11111 R Rd 1s complement of IW SUBI subtracts a sign-extended, 16-bit immediate value from the contents of the destination register, and stores the result in the destination register. (The IW in the syntax represents a sign-extended, 16-bit immediate value.) The assembler uses this form of the SUBI instruction if the immediate value was previously defined and is in the range -32,768 to 32,767. You can force the assembler to use the short form by by following the register op- erand with ,W: SUBI IW,Rd,W The assembler truncates any upper bits and issues an appropriate warning message. You can accomplish multiple-precision arithmetic by using SUBI in conjunction with the SUBB instruction. 2,8 N C z V 7 if the result is negative, otherwise 7 if a borrow is generated, otherwise 7 if the result is 0, otherwise 7 if there is an overflow, otherwise Code SUBI SUBI SUBI SUBI SUBI SUBI SUBI SUBI SUBI SUBI Before After 32765, A0 32766, A0 32767, A0 32766, A0 32767, A0 -32766, A0 -32767, A0 -32768, A0 -32767, A0 -32768, A0 A0 A0 NCZV 00007 FFEh 00000001 h 0000 00007FFEh OOOOOOOOh 0010 00007FFEh FFFFFFFFh 1100 80007FFEh 80000000h 1000 80007FFEh 7FFFFFFFh 0001 FFFF8001h FFFFFFFFh 1100 FFFF8001h OOOOOOOOh 0010 FFFF8001h 00000001 h 0000 FFFF8000h 7FFFFFFFh 0100 7FFF8000h 80000000h 1101 12-249 SUBI Subtract Immediate - 32 Bits Syntax Execution Instruction Words Description Machine States Status Bits Examples SUBI IL,Rd[,\.] Rd - IL - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 R Rd 1 s complement of 1 6 LSBs of IL 1s complement of 16 MSBs of IL SUBI subtracts a signed 32-bit immediate value from the contents of the destination register, and stores the result in the destination register. (The IL in the syntax represents a signed 32-bit immediate value.) The assembler uses this version of the SUBI instruction if it cannot use the SUBI IW,Rd opcode, or if you request the long opcode by following the register operand with ,L: SUBI IL,Rd,L You can accomplish multiple-precision arithmetic by using SUBI in con- junction with the SUBB instruction. 3,12 N /if the result is negative, otherwise C /if there is a borrow, otherwise Z /if the result is 0, otherwise V /if there is an overflow, otherwise Code Before After A0 AO NCZV SUBI 2147483647, A0 7FFFFFFFh OOOOOOOOh 0010 SUBI 32768, A0 00008001 h 00000001 h 0000 SUBI 32769, A0 00008001 h OOOOOOOOh 0010 SUBI 32770, A0 00008001 h FFFFFFFFh 1100 SUBI 32768, A0 80008000h 80000000h 1000 SUBI 32769, A0 80008000h 7FFFFFFFh 0001 SUBI -2147483648, AO 80000000h OOOOOOOOh 0010 SUBI -32769, A0 FFFF7FFEh FFFFFFFFh 1100 SUBI -32770, A0 FFFF7FFEh OOOOOOOOh 0010 SUBI -32771, A0 FFFF7FFEh 00000001 h 0000 SUBI -32770, A0 7FFF7FFDh 7FFFFFFFh 0100 SUBI -32771, A0 7FFF7FFDh 80000000h 1101 12-250 Subtract Constant SUBK Syntax Execution Instruction Words Description SUBK K, Rd Rd - K -> Rd 15 14 13 12 11 10 9 8 1 1 1 K R Rd SUBK subtracts the 5-bit constant from the contents of the destination re- gister; the result is stored in the destination register. The K in the syntax represents a constant that is treated as an unsigned number in the range 1-32. Note that K=0 in the opcode corresponds to the value 32; the as- sembler converts the value 32 to 0. The assembler issues an error if you try to subtract from a register. You can accomplish multiple-precision arithmetic by using SUBK in con- junction with the SUBB instruction. Machine States 1,4 Status Bits N /if the result is negative, otherwise C 7 if there is a borrow, otherwise Z 7 if the result is 0, otherwise V 7 if there is an overflow, otherwise Examples Code Before After SUBK 5,A0 SUBK 9,A0 SUBK 32, A0 SUBK 1,A0 A0 00000009h 00000009h 00000009h 80000000h A0 IMCVZ 00000004h0000 00000000h0010 FFFFFFE9h1100 7FFFFFFFh0001 12-251 SUBXY Subtract Registers in XY Mode Syntax Execution SUBXY Rs.Rd RdX - RsX -> RdX RdY - RsY - RdY Instruction Words Description 15 14 13 12 11 10 9 8 1 1110 1 Rs R Rd Machine States Status Bits Examples SUBXY subtracts the source X and Y values individually from the destina- tion X and Y values; the result is stored in the destination register. You can use this instruction for manipulating XY addresses; it is particularly useful for incremental figure drawing. These addresses are stored as XY pairs in the register file. Rs and Rd must be in the same register file. 1,4 N /if source X field = destination X field, otherwise C /if source Y field > destination Y field, otherwise Z /if source Y field = destination Y field, otherwise V /if source X field > destination X field, otherwise Code Before After A0 Al A0 IMCZV SUBXY Al P A0 00090009h 0001 0001 h 00080008 h 0000 SUBXY Al ,A0 00090009h 00090001 h 00000008h 0010 SUBXY Al ,A0 00090009h 0001 0009h 00080000h 1000 SUBXY Al ,A0 00090009h 00090009h OOOOOOOOh 1010 SUBXY Al ,A0 00090009h 0000001 Oh 0009FFF9h 0001 SUBXY Al r A0 00090009h 0009001 Oh 0000FFF9h 0011 SUBXY Al P A0 00090009 h 00100000h FFF90009h 0100 SUBXY Al ,A0 00090009h 001 00009 h FFF90000h 1100 SUBXY Al P A0 00090009h 001 0001 Oh FFF9FFF9h 0101 12-252 Software Interrupt TRAP Syntax Execution TRAP N PC - -*SP ST - -*SP trap vector N -+ PC Instruction Words Description 15 14 13 12 11 10 9 8 1 1 1 N TRAP executes a software interrupt. The N parameter is a trap number from to 31 that selects the trap to be executed. During a software interrupt, • The return address (the address of next instruction) is pushed on the stack. • The status register is pushed on the stack. • The IE (interrupt enable) bit in ST is set to 0, disabling maskable in- terrupts, and ST is set to 0000001 Oh. • Finally, the trap vector is loaded into the PC. The TMS34010 generates the trap vector addresses as shown below: Trap Number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Address >FFFF FFEO Reset >FFFF FFCO ml >FFFF FFAO IWrS >FFFF FF80 >FFFF FF60 >FFFF FF40 Traps 3-7 >FFFF FF20 >FFFF FFOO X >FFFF FEEO NMI >FFFF FBCO HI >FFFF FEAO W >FFFF FE80 WV >FFFF FE60 . k >FFFF FE40 >FFFF FE20 >FFFF FEOO >FFFF FDEO >FFFF FDCO >FFFF FDAO >FFFF FD80 >FFFF FD60 >FFFF FD40 — Traps 12-29 - >FFFF FD20 >FFFF FDOO >FFFF FCEO >FFFF FCCO >FFFF FCAO >FFFF FC80 >FFFF FC60 >FFFF FC40 ' ' >FFFF FC20 ILL DP >FFFF FCOO Trap 31 4 -12^— -► Reset External Interrupt 1 External Interrupt 2 Non Maskable Interrupt Host Interrupt Display Interrupt Window Violation Illegal Opcode The stack, which is located in external memory, grows toward lower ad- dresses. The PC and ST are pushed on the stack MSW first, and the SP is predecremented before each word is loaded onto the stack. 12-253 TRAP Software Interrupt Notes: 1 . The level trap differs from all other traps; it does not save the old status register or program counter. This may be useful in cases where the stack pointer is corrupted or uninitialized; such a situ- ation could cause an erroneous write. 2. The IMMI bit does not affect the operation of TRAP 8. For more information, refer to Section 8 (Interrupts, Traps, and Reset). Machine States 16,19 (SP aligned) 30,33 (SP nonaligned) Status Bits N C Z V Examples Code TRAP TRAP i Before PC xxxxxxxxh xxxxxxxxh SP 80000000h 80000000h PC FFFFFFEOh FFFFFFCOh After SP 80000000h 7FFFFFC0h ST 0000001 Oh 0000001 Oh TRAP TRAP 30 31 xxxxxxxxh xxxxxxxxh 80000000h 80000000h FFFFFC20h FFFFFCOOh 7FFFFFC0h 7FFFFFC0h 0000001 Oh 0000001 Oh 12-254 Exclusive-OR Registers XOR Syntax Execution Instruction Words Description Machine States Status Bits Examples XOR Rs.Rd Rs XOR Rd - Rd 15 14 13 12 11 10 9 8 1 10 10 11 Rs R Rd XOR bitwise-exclusive-ORs the contents of the source register with the contents of the destination register, and stores the result in the destination register. You can use this instruction to clear registers (for example, xor bo, bo); the CLR instruction also supports this function. Rs and Rd must be in the same register file. 1,4 N Unaffected C Unaffected Z 7 if the result is 0, otherwise V Unaffected Code Before After A0 A1 NCZV A1 XOR A0 rAl FFFFFFFFh OOOOOOOOh xxOx FFFFFFFFh XOR A0 ,A1 FFFFFFFFh AAAAAAAAh xxOx 55555555h XOR A0 rAl FFFFFFFFh FFFFFFFFh xxlx OOOOOOOOh 12-255 XORI Exclusive-OR Immediate Value Syntax Execution Instruction Words XORI IL.Rd IL XOR Rd - Rd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1111 R Rd 16 LSBsof IL 16 MSBsof IL Description Machine States Status Bits Examples XORI bitwise exclusive ORs a 32-bit immediate data with the contents of the destination register and stores the result in the destination register. (The IL parameter in the syntax above represents a 32-bit immediate value.) 3,12 N Unaffected C Unaffected Z 7 if the result is 0, otherwise V Unaffected Code XORI XORI XORI XORI XORI 0FFFFFFFFh,A0 0FFFFFFFFh,A0 0FFFFFFFFh,A0 00000000h,A0 00000000h,A0 Before A0 OOOOOOOOh AAAAAAAAh FFFFFFFFh OOOOOOOOh FFFFFFFFh After IMCZV xxOx xxOx xxlx xxlx xxOx AO FFFFFFFFh 55555555h OOOOOOOOh OOOOOOOOh FFFFFFFFh 12-256 Zero Extend to Long ZEXT Syntax Execution instruction Words Description Machine States Status Bits Examples ZEXT Rdf.FJ field in Rd -» zero-extended field Rd 15 14 13 12 11 10 9 8 1 F 10 1 R Rd ZEXT zero extends a right-justified field in the destination register by zero- ing all the nonfield bits in Rd. The size of the field is determined by the current field size. The optional F parameter, which must be specified as a or a 1 , selects the field size: F=0 selects FS0 for the field size. F=1 selects FS1 for the field size. The default value for F is 0. 1,4 N Unaffected C Unaffected Z 7 if the result is 0, otherwise V Unaffected Code Before After FS0 FS1 A0 INICZV AO ZEXT A0,0 32 X FFFFFFFFh xxOx FFFFFFFFh ZEXT A0,0 31 X FFFFFFFFh xxOx 7FFFFFFFh ZEXT A0,0 1 X FFFFFFFFh xxOx 00000001 h ZEXT A0,0 16 X FFFFOOOOh xxlx OOOOOOOOh ZEXT A0,1 X 16 FFFFOOOOh xx1 X OOOOOOOOh 12-257 Instruction Set 12-258 Section 13 Instruction Timings Section 12, The TMS34010 Instruction Set, describes each TMS34010 as- sembly language instruction, including instruction cycle timings. This section provides details pertaining to instruction timings for the following groups of instructions: Section Page 13.1 General Instructions 13-2 13.2 MOVE and MOVB Instructions 13-4 13.3 FILL Instructions 13-10 13.4 PIXBLT Instructions 13-18 13.5 PIXBLT Expand Instructions 13-31 13-1 Instruction Timings - General Instructions 13.1 General Instructions Note: General instructions include all TMS34010 instructions except MOVEs, MOVBs, FILLs, PIXBLTs, and LINE. Each instruction description in Section 12 contains a Machine States field that describes the instruction execution time in terms of the machine state. A machine state is the fundamental time unit of the processor. Logically, it is the time required to decode, interpret, and execute a single microinstruction in- ternal to the CPU. Physically, a TMS34010 machine state is equal to a single local clock period (the time from one LCLK1 low-to- high transition to the next). For example, this value is 160 nanoseconds for a TMS34010 clocked at 50 MHz, and 200 nanoseconds for a 40- MHz TMS34010. The descriptions in the instruction discussions appear as: Machine States cache hit case, cache disabled case These two values represent the number of CPU states required to execute the instruction for each of two cases: • The cache hit case gives the number of execution states if the in- struction and its extension words reside entirely in cache. Thus, only actual execution states (using the CPU) and external memory cycles for data transfer are counted with the instruction. • The cache disabled case gives the number of execution states if the cache is disabled when the instruction is executed. In this case, external memory cycles for fetching the instruction word and any extension words are counted with the instruction in addition to states through the CPU and memory states for data transfer. Cache is usually only disabled during debugging. Cache disabled timing is not necessarily worst case timing. It may sometimes be exceeded when the cache is enabled but the instruction is not in the cache (this is known as a cache miss). 13.1.1 Best Case Timing - Considering Hidden States Best case timing occurs when an instruction is executed entirely in parallel with the end of a previous instruction. According to some microprocessor conventions, many TMS34010 instructions would have a best case timing of states. Since this is unrealistic, the convention used here assigns a finite (nonzero) timing value but allows for instruction overlap by using the concept of hidden states. Hidden states are memory write cycles that occur at the end of a given in- struction. Parallelism is achieved when the CPU is executing instructions at the same time the memory controller is writing to memory. The machine states consumed by the instructions that the CPU is executing hide the machine 13-2 Instruction Timings - General Instructions states consumed by the write cycles. These hidden machine states are not counted against the instruction that incurs them, but are counted against subsequent instructions. If an instruction uses the local bus before all of the hidden cycles have been overlapped by subsequent instructions, that in- struction must wait for the hidden cycles to complete. Up to nine machine states may be hidden by write cycles incurred by a single instruction. In the timing charts in this section and in the Machine States portions of the instruction descriptions, hidden states are indicated by parentheses as shown below: Machine States cache hit case+ (hidden states), cache disabled case 13.1.2 Other Effects on Instruction Timing Instruction timing varies, depending on: • Whether the cache is enabled. • Whether the instruction and extension words are in cache or not. • The field size and the word alignment of memory data manipulated by the instruction. The timing for some instructions (particularly the MOVE, MOVEB, LINE, FILL, and PIXBLT instructions) is affected by the values of implied operands and on the alignment and field sizes of any associated memory accesses. In addition, several system -dependent factors that are not included in timing values may further influence the instruction timings: Wait states on the local memory bus Host accesses via the host port Display refresh operations DRAM refresh operations HOLD/HLDA accesses 13-3 Instruction Timings - MOVE and MOVB Instructions 13.2 MOVE and MOVB Instructions Timings for MOVE and MOVB instructions are in the following tables: Table Page 13-1 MOVE and MOVB Memory-to- Register Timings 13-5 13-2 MOVE and MOVB Register-to- Memory Timings 13-6 13-4 MOVE Memory-to- Memory Timings 13-7 MOVE and MOVB instructions are field operations, so their timings are af- fected by factors such as memory address, field size, and field extensions. These factors define the field alignment, which in turn defines the number of memory states required to insert or extract the field from memory. Figure 13-1 illustrates seven cases of alignment, labelled A-G, that are used in the MOVE and MOVB timing tables. Case A E WordN I 16-Blt Field-*! Case B <[ E WordN FteW-H Word K- Field *=3 leld-H WordN H — Reld— HT Case C | Word N+1 WordN J* 32-Blt Field -A Case D I Word N+1 WordN I ]t Field -H Case E | Word N+1 I WordN I "J Case F { Word N+1 | WordN | E Field H CaseQ | Word N+2 I Word N+1 - Field- Word N =a — Figure 13-1. Field Alignments in Memory Case A A 16-bit field is aligned on word boundaries. Cases B1-B3 The field length is less than 1 6 bits. • In Case B1, the field starting address is not aligned to a word boundary, although the end of the field coincides with the end of the word. 13-4 Instruction Timings - MOVE and MOVB Instructions • In Case B2, the field starting address is aligned to a word boundary, but the end of the field does not coincide with the end of the word. • In Case B3, the field length is 14 bits or less, and neither the start nor the end of the field is aligned to a word boundary. Case C A 32-bit field is aligned on word boundaries. Case D The field size is greater than 16 bits. The field starting address is not aligned to a word boundary, although the end of the field coincides with the end of a word. Case E The field size is greater than 1 6 bits. The field starting address is aligned to a word boundary, but the end of the field does not coin- cide with the end of a word. Case F The field straddles the boundary between two words. Neither the start nor the end of the field is aligned to a word boundary. Case G The field size ranges from 18 to 32 bits, and the field straddles two word boundaries. Neither the start nor the end of the field is aligned to a word boundary. 13.2.1 Moves Between Registers and Memory Table 13-1 lists the timing for memory-to-register moves for each case of the destination alignment in Figure 13-1. Table 13-2 lists the timing for regis- ter-to-memory moves. Note that there are no hidden states for memory-to- register moves. Table 13-1. MOVE and MOVB Memory-to- Register Timings Instruction Field Alignment Type A or B C, D, E, F G MOVB *Rs,Rd 3,6 5,8 - MOVB *Rs(offset), Rd 5,11 7,13 - MOVB ^Address, Rd 5,14 7,16 - MOVE *Rs,Rd 3,6 5,8 7,10 MOVE *Rs+, Rd 3,6 5,8 7,10 MOVE -*Rs.Rd 4,7 6,9 8,11 MOVE *Rs( offset). Rd 5,11 7,13 9,15 MOVE ^Address, Rd 5,14 7,16 9,18 Notes: 1 . Add 1 state to MOVES for sign extension. 2. The first number specifies the number of cycles required when the entire in- struction is contained within cache (cache hit case). The second number specifies the number of cycles required when the cache is disabled (cache disabled case). 13-5 Instruction Timings - MOVE and MOVB Instructions Table 13-2. MOVE and MOVB Register-to- Memory Timings Instruction Field Alignment Type A B or C D or E F G MOVB Rs, *Rd - 1+(3),7 - 1+(7),11 - MOVB Rs, *Rd(offset) - 3+(3),7 - 3 + (7),13 - MOVB Rs. ^Address - 1+(3),7 - 3+(7),13 - MOVE Rs, *Rd 1+(1),5 1+(3),7 1+(5),9 1+(7),11 1+(9),13 MOVE Rs, *Rd+ 1+(1),5 1+(3),7 1+(5),9 1+(7),11 1+(9),13 MOVE Rs, -*Rd 2+(1),6 2 + (3),8 2 + (5),10 2 + (7),12 2 + (9),14 MOVE Rs, *Rd(offset) 3+(1),9 3+(3),12 3+(5),14 3 + (7),13 3+(9),18 MOVE Rs, ^Address 3+(1),13 3 + (3),15 3 + (5),17 3 + (7),19 3 + (9),21 Note: The first number specifies the number of cycles required when the entire instruction is contained within cache (cache hit case). The second number specifies the number of cycles required when the cache is disabled (cache disabled case). Hidden states are indicated by parentheses. 13.2.2 Memory-to-Memory Moves Table 13-4 lists memory-to-memory move timings for each combination of source and destination alignment. Table 13-3 lists numeric indices which are used in Table 13-4. The indices are associated with each source and desti- nation alignment j>air (the alignments are shown in Figure 13-1 on page 1 3-4). To use these tables: 1 ) Determine the source and destination alignment, 2) Locate the alignment and its index in Table 1 3-3, and 3) Use the index to select the correct column for a particular MOVE addressing mode in Table 13-4. Table 13-3. Alignment Indices for Memory-to-Memory Moves Source Field Alignment Destination Field Alignment A B C D E F G A 1 - - - - 3 - B - 2 - - - 3 - C - - 6 - - - 9 D - - - 7 7 8 9 E - - - 7 7 8 9 F 4 5 - 7 7 8 9 G - - 10 11 11 12 13 13-6 Instruction Timings - MOVE and MOVB Instructions Table 13-4. MOVE Memory-to-Memory Timings Instruction Memory-to-Memory Index - Source to Destination 1 2 3 4 5 6 7 MOVB *Rs, *Rd - 3+(3),7 3 + (7),13 - 5+(3),11 - - MOVB *Rs(offset), *Rd(offset) - 5+(3),7 5+(7),21 - 6 + (3),13 - - MOVB @SAddr, @DAddr - 7 + (3),7 7 + (7),29 - 6+(3),12 - - MOVE *Rs, *Rd 3+(1),7 3 + (3),9 3+(7),13 5+(1),9 5 + (3),11 5 + (3),11 5 + (5),13 MOVE *Rs+, *Rd+ 4,7 4 + (2),9 4+(6),13 6,9 6+(2),11 6 + (2),11 6 + (4),13 MOVE -*/?s, -*Rd 4+(1),8 4+(3),10 4+(7),14 6 + (1),10 6+(3),12 6+(3),12 6 + (5),14 MOVE *Rs(offset), *Rd+ 5 + (1),12 5 + (3),14 5+(7),18 7 + (1),14 7 + (3),16 7 + (3),13 7 + (5),15 MOVE *Rs(offset), *RQ '(offset) 5+(1),15 5+(3),17 5+(7),21 7 + (1),17 7 + (3),19 7 + (3),16 7 + (5),18 MOVE QSAddr, *Rd+ 5 + (1),15 5+(3),17 5 + (7),21 7 + (1),17 7 + (3),19 7 + (3),16 7 + (5),18 MOVE @SAddr, QDAddr 7 + (1),23 7 + (3),25 7 + (7),29 9+(1),25 9 + (3),27 9 + (3),24 9 + (5),26 Instruction Memory-to-Memory Index - Source to Destination 8 9 10 11 12 13 MOVB */?s, *Rd 5+(7),15 - - - - - MOVB *Rs(offset), *Rd(offset) 7 + (7),19 - - - - - MOVB QSAddr, QDAddr 9 + (7),27 - - - - - MOVE */?s, */? ^161h Figure 13-3. Destination Location, Alignment E 13-8 Instruction Timings - MOVE and MOVB Instructions 3) Find the alignment index for the combination of the source alignment and the destination alignment. Table 13-3 (page 13-6) shows the source-to-destination alignment in- dices. The correct index for the combination of source alignment G with destination alignment E is index 11. 4) Find the index for this instruction in Table 13-4 (page 13-7). The example instruction, move @0E5h, @l6lh, corresponds to MOVE @SAddr,@Daddr in Table 13-4. Follow this row in the table across to the entry beneath column 11. The timing listed in this entry, 11 + (5),31, is the timing for the example instruction. Thus, this MOVE example consumes 1 1 machine states (plus 5 hidden states) if this code resides in cache. If the instruction cache is not enabled, this ex- ample consumes 31 machine states. The memory accesses at the end of the MOVE consume 5 machine states, which may be hidden by subsequent cache-resident instructions. This example is for a memory-to-memory move. If you want to determine the timing for a memory-to-register or a register-to-memory move, use Table 1 3-2 or Table 13-1. 13-9 Instruction Timings - FILL Instructions 13.3 FILL Instructions The total time for the FILL instruction is determined by adding a setup time to a transfer time: FILL time = FILL setup time + FILL transfer time • The setup sequence executes an initialization sequence, performing any necessary setup operations and translations. (This may include XY-to-linear conversions and window preclipping.) The result of the setup includes the dimensions of the array that is to be moved. • The transfer sequence performs the actual data transfer from the source register to the destination array. FILL setup and transfer timings are in the following tables: Table Pacie 13-5 FILL Setup Time 13-10 1 3-6 FILL Transfer Timingt 13-11 13.3.1 FILL Setup Time FILL setup time is the overhead incurred by the FILL instructions from per- forming initialization, XY conversions, and window operations. Window op- erations are performed before the FILL transfer begins. Window options that affect FILL setup timing include: • No window clipping (W=0) • A window clip that requires no change (array fits) • A window clip that affects the starting pointer (start adjust) • A window clip that affects the array transfer dimensions (dimension adjust) • A window clip that affects both the starting and the ending pointers (adjust both) • A window miss requesting an interrupt • A window hit Table 13-5 illustrates the effects of windowing operations on FILL setup tim- ing. Corner adjust operations have no effect on FILL setup timing. Table 13-5. FILL Setup Time Window Operation Corner Adjust Instruction W=0 Array Fits Start Adjust Dimens Adjust Adjust Both Miss Hit II II OQ GO O.O. PBH=0 PBV=1 PBH=1 PBV=1 FILL L 4 - - - - - - - - - FILL XY 6 9 16 12 20 - - - - - Note: These timings are for the cache hit case; add 3 machine states for cache disabled timing. For example, a FILL XY with preclipping that requires both the starting and ending array corners to be adjusted would consume 20 states of setup time. 13-10 Instruction Timings - FILL Instructions 13.3.2 FILL Transfer Timing Table 13-6 lists FILL transfer timings. Transfer timing is the time required (in addition to the setup time) to execute the actual data transfer to memory. Transfer timing is based on several parameters such as the number of rows in the adjusted array (L), the number of words affected per row (N), graphics operations (G), and four possible destination array alignments (A, B, C, and D). These factors are described in the list that follows the table. Table 13-6. FILL Transfer Timingt Line Length Array Alignments A B C D Short (A/=1) 0+G)L + 2 (2+G)Z. + 2 (2+G)L + 1 (2+G)Z. + 1 Medium (/V=2) (2+2G)L + 2 (3+2G)L + 2 (3+2G)L + 2 {A+2G)L + 1 Long (/V>3) (1 +NG)L + 2 (2+NG)L + 5 (3+NG)L + 2 (A+NG)L + 1 t Subtract any alignment/graphics adjustment from these values Key: L Number of rows (see page 1 3-1 1 ) N Number of words per row (see page 1 3-1 2) G Value derived from selected graphics operation (see Table 13-7 on page 13-13) 13.3.2. 1 Number of Rows in the Adjusted Array (L) The working dimensions (L rows x M pixels) for the fill are determined by the originally supplied destination pointer (DADDR) and dimensions (DYDX) in conjunction with window preclipping. 13.3.2.2 Alignment of Leading and Trailing Words in Rows After clipping, the data transfer portion of the FILL treats the array as a series of L rows of M pixels. These M pixels are spread across N words in each row of the destination array. Figure 13-4 illustrates a single row of a destination array in memory. The FILL algorithm resolves rows into three portions: 1 ) The leading edge at the beginning of the row 2) The center N-2 words of the row 3) The trailing edge at the end of the row Leading Pixels Word Boundaries N Words -Center N-2 Words - M Pixels Trailing Pixels Figure 13-4. Pixel Block Alignment in X 13-11 Instruction Timings - FILL Instructions As Figure 13-4 shows, a row of N words includes one word each for the leading and trailing parts of the transfer and N-2 words for the center portion. The FILL always transfers the center portion of the row as a series of 16-bit words. Thus, the alignment of the leading and trailing words in the row characterize the alignment type of the array. Figure 13-5 illustrates the four possible alignments (A, B, C, and D) of destination array rows within pixel blocks in memory. •N Words - • 4 Word Boundaries - i i Alignment A Leading 14 Center N-2 Words v Trailing Alignment B Algnment C Alignment D Leading + Center N-2 Words * Trailing Leading « Center N-2 Words ►{ TraiBng Leading |« Center N-2 Words ►[ Trailing -N Words - Figure 13-5. Pixel Block Alignments Word alignment is constant from row to row because DPTCH is constrained to be a multiple of 16 for most FILLs. If a FILL is only one pixel wide, and all the rows are contained in single words in memory, DPTCH may be any value. If DPTCH is not a multiple of 16, word alignment may vary between cases B, C, and D. Average timing for this situation may be derived using alignment C. Worst case timing for this situation may be derived using alignment D. 13.3.2.3 Row Length (Number of Words N per Row) Row length is determined by a combination of the computed array pointer value in DADDR, the clipped DX dimension, and the pixel size stored in the PSIZE register. The data transfer algorithm breaks down into one of three cases, short, medium, or long, according to the number of words N in a row. These three cases include: • Short case. The destination array row occupies only one word in me- mory (/V=1). In this case, only one write (or read -modify- write) opera- tion is required to place the row into the destination array. Alignment 13-12 Instruction Timings - FILL Instructions for the short case is either type A for exactly aligned arrays or type B, C, or D for nonaligned arrays (which require a read-modify- write). • Medium case. The destination row occupies two words in memory (/V=2). In this case, the row has no center portion and the array align- ment is determined by the alignments of the first and last words in the row. • Long case. The destination row occupies all or part of at least three words (N>3). This is the general case for array alignment discussions. 13.3.2.4 Transfer Direction in X Transfer direction does not apply to FILLs. FILL transfers proceed a single word of pixels at a time in the order of increasing X and increasing Y. This corresponds to a transfer from left-to-right and top-to-bottom for the default screen orientation. 13.3.2.5 Selected Graphics Operations (G) Graphics operations such as plane masking, transparency, and pixel process- ing influence FILL transfer timing because the destination pixels must be read before they are replaced. However, the effects of these operations vary be- cause they are performed by different portions of the TMS34010 hardware. For instance, plane masking, transparency, and field insertion are all performed by the TMS34010 memory controller; any combination of these operations uses 2 machine states for each word written. Pixel processing, on the other hand, is performed by the TMS34010 CPU, and requires 2, 4, 5, or 6 states per word (independently of other operations). The minimum cycle time for any graphics operation, then, is 2 machine states (one memory cycle) using the pixel processing replace operation, with plane masking and transparency disabled. Table 1 3-7 shows these values. Table 13-7. Timing Values per Word for Graphics Operations (G) Pixel Processing Operation Graphics Operation Replace Other Booleans or ADD ADDS,SUB MAX, or MIN SUBS No plane masking or transparency^. 2 4 5 6 Read-modify-write, plane masking, or transparency 4 6 7 8 13-13 Instruction Timings - FILL Instructions 1 3.3.2.6 Alignment/ Graphics Adjustment An additional adjustment may be necessary when plane masking or transpar- ency are enabled and the alignment type is B, C, or D. As the second line of Table 13-7 shows, if a particular word in a destination row has already been read as part of a read-modify-write operation, no additional states are re- quired to perform plane masking or transparency for that word. Since the alignment types with misaligned edges (B, C, and D) already assume a RMW (read-modify-write) on their respective edges, the effect of plane masking or transparency can be ignored for these edges. That is, after you have calculated the timing using the proper value for the graphics operation, you can subtract 2 states (cases B and C) or 4 states (case D) per row from the transfer timings for the respective alignment cases. Case A requires no adjustment. 13.3.3 FILL Timing Examples To determine the timing for a FILL instruction, add the FILL setup value to the FILL transfer value and subtract the alignment adjustment: FILL time = FILL setup time + FILL transfer time - alignment adjustment FILL setup timings, transfer timings, and the effects of graphics operations are listed in the following tables: Table Page 13-5 FILL Setup Time 13-10 1 3-6 FILL Transfer Timingt 1 3-1 1 13-7 Timing Values per Word for Graphics Operations (G) 13-13 The following three examples illustrate timing for a FILL XY. The setup and transfer timings for these examples are the same, except each uses a different graphics operation. Figure 13-7 illustrates the destination array and window used in these examples, as defined by the implied operands in Figure 13-6. Note that the shaded portion is the area of intersection. **************************************************** * Implied operand setup for FILL examples (assume * * that the B register names and I/O register names * * are equated with the proper registers) * **************************************************** MOVI 004400E4h, DADDR ; X=228, Y=68 MOVI 800h, DPTCH ; X extent = 512 pixels ; (at 4 bits per pixel) CLR OFFSET MOVI 004900EBh, WSTART ; X=235, Y=73 MOVI 005F0140h, WEND ; X=320, Y=95 MOVI 0014003Ch, DYDX ; DX=60, DY=20 MOVI 4h, A0 MOVE A0, @PSIZE ; Pixel size = 4 bits MOVI 14h, A0 MOVE A0, @CONVDP ; (LMO DPTCH) MOVI OCh, A0 MOVE A0, ©CONTROL ; W=3, T=0, PPOP=0 CLR A0 MOVE A0, @PMASK ; Disable plane masking Figure 13-6. Implied Operand Setup for FILL Example 13-14 Instruction Timings - FILL Instructions Bran word boundary DADDR _&a_ • pixels per word (320,73) .=13.52-14 y-WEND (320,45) (235,05) Figure 13-7. FILL XY Timing Example Follow these steps to determine the number of machine states consumed by this example: 1 ) Determine the setup time; refer to Table 1 3-5 on page 13-10. Setup time comprehends the time required for windowing operations. These examples use window preclipping (W bits=3); this option re- quires the starting corner to be adjusted. As Table 13-5 (page 13-10) shows, the setup time for a FILL XY with a starting corner adjust is 16 machine states. 2) Determine the transfer time; refer to Table 13-6 on page 13-11. Transfer time is affected by the number of words per row, line length, and graphics operations. a) Number of words per row: As Figure 13-7 shows, adjusting the array by clipping it to the window dimensions produces a new Y dimension, so L (the number of rows in the adjusted array) equals 15. b) Line length: Adjusting the array to fit the window also produces a new X dimension of 53 pixels. The number of pixels divided by the pixel size yields the number of words N per row; 53 divided by 4 produces 1 3.25, so /V=1 4. Since N is greater than 3, this exam- ple conforms to the long case. The trailing edge is word aligned but the leading edge is not, so the alignment type is C. As Table 13-6 shows, the transfer time for a FILL XY with these char- acteristics is (3+NG)L + 2. The only variable in the following three examples is G, which represents the selected graphics operations. 13-15 Instruction Timings - FILL Instructions Example 13-1. Replace, No Transparency, No Plane Masking The implied operand setup in Figure 13-6 selects the following graphics options: • Pixel processing replace operation (PPOP=0), • No transparency, and • No plane masking. According to Table 13-7 (page 13-13), variable G = 2. The FILL timing for this instruction is determined as follows: FILL time = FILL setup time + FILL transfer time = Adjust pointer + [3+(NxG)]L + 2 = 16 + [(3 + (14x2)]15 + 2 = 483 states The FILL writes 795 pixels in these 483 states. (The portion of the array lying within the window contains 795 pixels.) Example 13-2. MAX, No Transparency, No Plane Masking Select the pixel processing MAX option (be sure to retain the values of the W bits and the T bit, which are also in the CONTROL register): MOVI 50C0h, AO MOVE AO, @CONTROL MAX, W=3, T=0 These instructions, in combination with the implied operand setup in Figure 13-6, select the following graphics options: • Pixel processing MAX operation (PPOP=14h), • No transparency, and • No plane masking. According to Table 1 3-7, variable G = 5. The FILL timing is now calculated as: FILL time = FILL setup time + FILL transfer time = Adjust pointer + [3 + (NxG)]L + 2 = 16 + [3 + (5x14)]15 + 2 = 1 ,1 1 3 states This FILL example consumes 1 ,1 1 3 machine states. 13-16 Instruction Timings - FILL Instructions Example 13-3. XNOR with Transparency and Plane Masking Select the pixel processing XNOR operation and enable transparency and plane masking: MOVI 14E0h, AO MOVE AO , ©CONTROL ; XNOR, W=3, 1=1 MOVI llllh, AO MOVE AO , @PMASK ; Use a plane mask These instructions, in combination with the implied operand setup in Figure 13-6, select the following graphics options: • Pixel processing XNOR operation (PPOP^OBh), • No transparency, and • No plane masking. According to Table 13-7, variable G = 6. If plane masking or transparency is enabled, you must consider the array alignment in the timing. This example conforms to alignment type C (as shown in Figure 13-5 on page 13-12), which incurs a read-modify-write at the leading edge of each row. The extra read in the RMW can be used by the plane masking or transparency hardware, so an alignment/graphics adjustment is necessary. The adjustment negates the effect of the extra read cycles in each row that are attributed to the graphics operations. For this example, the amount subtracted is 1L (the number of machine states for a read cycle times the number of rows). The FILL timing is now calculated as: FILL time = FILL setup time + FILL transfer time - adjustment = Adjust pointer + [3+(/VxG)]Z. + 2 - 2L = 16 + [3 + (6x14)]15 + 2 - (2x15) = 1 ,293 states This FILL example consumes 1 ,293 machine states. 13.3.4 Interrupt Effects on FILL Tinning A FILL instruction can be interrupted on a word boundary during the transfer portion of the FILL algorithm. It can also be interrupted at the end of each row. The context of the FILL is saved in reserved registers, and the PBX bit is set in the copy of the status register that is pushed onto the stack. The worst case latency caused by an interrupt is 20 machine states for the interrupt to be recognized. The time for the context switch must be added to this. See Section 8.5.1, Interrupt Latency (page 8-6) for context switch information. 13-17 Instruction Timings - PIXBLT Instructions 13.4 PIXBLT Instructions PIXBLT instructions covered in this section include: PIXBLT L,L PIXBLT XY,L PIXBLT L,XY PIXBLT XY,XY (PIXBLT B,L and PIXBLT B,XY are discussed in Section 13.5.) The total PIXBLT instruction timing is obtained by adding a setup time to a transfer time: PIXBLT time = PIXBLT setup time + PIXBLT transfer time • The setup sequence executes an initialization sequence, performing any necessary setup operations and translations. (This includes XY- to-linear conversion and window preclipping.) The result of the setup includes the dimensions of the source array. • The transfer sequence performs the actual data transfer from the source array to the destination array. PIXBLT setup and transfer timings are in the following tables: Tdblfi PdQG 13-8 PIXBLT Setup Time 13-18 1 3-9 PIXBLT Transfer Timingt 1 3-20 13.4.1 PIXBLT Setup Time Table 13-8 lists PIXBLT setup times. Setup time is the overhead incurred by the PIXBLT instructions in performing initialization, XY conversions, window options, and corner adjust. Setup time is affected by both the window and corner adjust operations. The effects of these operations are described in the list that follows Table 1 3-8. Table 13-8. PIXBLT Setup Time Window Operation Corner Adjust Instruction W=0 Array Fits Start Adjust Dimens Adjust Adjust Both Miss Hit PBH=1 PBV=0 PBH=0 PBV=1 PBH=1 PBV=1 PIXBLT L, L 7 - - - - - - - - - PIXBLT XY, L 9 - - - - - - + 1 +2 +4 PIXBLT L, XY 9 12 19 15 23 - - + 1 +2 +4 PIXBLT XY. XY 12 15 22 18 26 - - + 1 +2 +4 For example, consider a PIXBLT XY,XY instruction with preclipping that re- quires both the starting and ending array corners to be adjusted (PBH = 1 and PBV=0). The setup timing for this example would be 26 + 1 =27 states. 13-18 Instruction Timings - PIXBLT Instructions 13.4.1.1 Window Operations Window operations are performed before the PIXBLT transfer begins. Win- dow options that affect PIXBLT setup timing include: • No window checking (W=0) • A window clip that requires no change (array fits) • A window clip that affects the starting pointer (start adjust) • A window clip that affects the array transfer dimensions (dimension adjust) • A window clip that affects both the starting and ending pointers (adjust both) • A window miss that requests an interrupt • A window hit 13.4. 1.2 Corner Adjust (PBH and PBV) The TMS34010 may need to adjust the starting corner of the source and des- tination arrays for the PIXBLT L,XY, PIXBLT XY,L, and PIXBLT XY,XY in- structions. The default starting corner is the upper left corner of the array. This can be altered by changing the values of the PBH and PBV (PIXBLT hori- zontal and vertical) bits. Possible corner adjustments (with default origin ORG=0) include: • No corner adjust (PBH=0, PBV=0) • Adjust to upper right corner (PBH = 1, PBV=0) • Adjust to lower left corner (PBH=0, PBV=1 ) • Adjust to lower right corner (PBH = 1, PBV=1) The TMS34010 adjusts corners before PIXBLT execution begins. For each combination of PBH and PBV, the TMS34010 adjusts the source and desti- nation starting address pointers to point to the appropriate corner of the arrays. This assures that the same pixel block is moved, despite the difference in X and Y transfer directions. The original source and destination pointers must be supplied through soft- ware. The pointers should indicate the least significant pixel in the array, ex- cept for PIXBLT L,L For this instruction, the PBH and PBV bits affect only the direction of the move; the TMS34010 does not adjust the starting corner. 13-19 Instruction Timings - PIXBLT Instructions 13.4.2 PIXBLT Transfer Timing Table 13-9 lists PIXBLT transfer timings. Transfer timing is the time required (in addition to the setup time) to execute the actual data transfer to memory. Transfer timing is affected by several factors, including the number of rows in the adjusted array (L), the number of words affected per row (N), graphics operations (G), and four possible destination array alignments (A, B, C, and D). These factors are described in the list that follows the table. Table 13-9. PIXBLT Transfer Timingt PBH = Row Lengths and Alignment Destination Array Alignment A B C D Short (/V=1) D > S D < S (6+4)/. + 5 (6+4)/. + 5 (6+6)/. + 3 (6+6)/. + 3 (6+6)/. + 3 (6+6)/. + 3 (6+6)/ + 3 (6+6)/ + 3 Medium (A/ =2 D > S D < S [2+(4+26)]Z. + 5 [4+(4+2G)]Z. + 4 [4+(4+2G)H + 3 [6+(4+26)]Z. + 2 [4+(4+26)]Z. + 5 [6+(4+26)]Z. + 4 [6 + (4+26)]Z. + 3 [8+(4+26)]Z + 2 Long (/V>3) D > S D < S [(2+6J/VH + 5 [2+(2G)N]L + 4 [2+(2+6)/V]Z. + 3 [4+(26)/VJZ. + 2 [2+(2 + 6)/V]Z. + 5 [4+(26)/V]Z. + 4 [2+(4+6)/V]Z + 3 [6+(2G)N]L + 2 PBH= 1 Row Lengths and Alignment Destination Array Alignment A B C D Short (/V=1) D > S D S D < S [2+(4+26)]Z. + 4 [4+(4+26)]Z. + 5 [4+(4+26)]/l + 3 [5+(4+26)]/. + 4 [4+(4+26)]Z. + 4 [6 + (4+26)]Z. + 5 [6 + (4+26)]Z. + 3 [7 + (4+26)]Z. + 4 Long (/V>3) D > S D S Subtract any alignment/graphics adjustment from these values Number of rows in the array (see page 13-20) Number of destination words per row (see page 1 3-22) Value dependent on selected graphics operation (see Table 13-10 on page 13-24) First destination to source alignment case (see page 1 3-22) D3). This is the general case for array alignment discussions. 13-22 Instruction Timings - PiXBLT Instructions 13.4.2.4 Relative Alignment of Source Rows to Destination Rows The alignment of the leading pixels in a source row with respect to a destina- tion row influences PIXBLT transfer timing. This alignment determines whether one or two words are required from the source array to fully write the first word of the destination array. This initial condition can be divided into two cases: D>.S The four LSBs of the destination address are greater than the four LSBs of the source address. This implies that the amount of data available from the first word of the source array exceeds the amount needed to write to the first word of the destination array. The write to the destination array can proceed immediately. DS). • Destination array alignment: The trailing edge is word aligned but the leading edge is not, so the alignment type is C. As Table 13-9 shows, the transfer time for this PIXBLT instruction is [5+{2+G)N]L + 4. The only variable in the following three examples is G, which represents the selected graphics operations. Example 13-4. Replace, No Transparency, No Plane Masking The implied operand setup in Figure 13-11 selects the following graphics options: • Pixel processing replace operation (PPOP=0), • No transparency, and • No plane masking. According to Table 13-10 on page 13-24, variable G = 2. The total ma- chine states required for this instruction are: PIXBLT time = PIXBLT setup time + PIXBLT transfer time -9 + 4 + [5 + {2+G)N]L + 4 = 13 + (5 + 4x14)x15 + 4 - 932 states The instruction in this example consumes 932 machine states. 13-28 Instruction Timings - PIXBLT Instructions Example 13-5. MAX Option, No Transparency, No Plane Masking Select the pixel processing MAX option (be sure to retain the values of the W bits and the T bit, which are also in the CONTROL register): MOVI 50C0h, AO MOVE AO , ©CONTROL ; MAX, W=3, T=0 These instructions, in combination with the implied operand setup in Figure 1 3-1 1 , select the following graphics options: • Pixel processing MAX operation (PPOP = 14h), • No transparency, and • No plane masking. According to Table 13-10, variable G = 5. Thus, the timing equation be- comes: PIXBLT time = PIXBLT setup time + PIXBLT transfer time = 9 + 4 + [5+(2+G)N]L + 4 = 13 +(5 + 7x14)x15 + 4 = 1 562 states The instruction in this example consumes 1 ,562 machine states. 13-29 Instruction Timings - PIXBLT Instructions Example 13-6. XNOR with Transparency and Plane Masking Select the pixel processing XNOR operation and enable transparency and plane masking: MOVI 14E0h, AO MOVE AO, @CONTROL MOVI llllh, AO MOVE AO, @PMASK XNOR, W=3, T=l Use a plane mask These instructions, in combination with the implied operand setup in Figure 13-11, select the following graphics options: • Pixel processing XNOR operation (PPOP=05h), • No transparency, and • No plane masking. According to Table 13-10, variable G = 6. If plane masking or transparency is enabled, you must consider the array alignment in the timing. Alignment type C incurs a read-modify-write at the leading edge of each row. The extra read included in the RMW can be used by the plane masking or transparency hardware, so an alignment/graphics adjustment is necessary. The adjustment negates the effect of the extra read cycles in each row that are attributed to the graphics operations. For this example, the amount subtracted is 2Z. (the number of machine states for a read cycle times the number of rows). The timing is now calculated as: PIXBLT time = PIXBLT setup time+ = 9 + 4 + = 13 + = 1 772 states PIXBLT transfer time - adjustment [5+(2+G)N]L + 4 - 2L (5 + 8x14)x15 + 4 - (2x15) The instruction in this example consumes 1,772 machine states. 13.4.4 The Effect of Interrupts on PIXBLT Instructions The PIXBLT instruction may be interrupted on a destination word boundary during the transfer portion of the algorithm. It may also be interrupted at the end of any row in the array. The context of the PIXBLT is saved in reserved registers. The PBX bit is set in the copy of the ST register that is pushed to the stack. The worst case latency caused by an interrupt is 20 machine states for the interrupt to be recognized. The time for the context switch must be added to this; see Section 8.5.1, Interrupt Latency (page 8-6) for context switch timing. 13-30 Instruction Timings - PIXBLT Expand Instructions 13.5 PIXBLT Expand Instructions PIXBLT expand instructions include: • PIXBLT B,L • PIXBLT B,XY To determine PIXBLT expand instruction timing, add a setup time to a transfer time: PIXBLT time = PIXBLT setup time + PIXBLT transfer time • The setup sequence executes an initialization sequence, performing any necessary setup operations and translations. (This includes XY- to-linear conversion and window preclipping.) The result of the setup includes the dimensions of the source array. • The transfer sequence performs the actual data transfer from the source array to the destination array. PIXBLT setup and transfer timings are in the following tables: Table Page 13-11 PIXBLT Expand Setup Time 13-32 13-12 PIXBLT Expand Transfer Timingt 13-32 13.5.1 PIXBLT Setup Time PIXBLT setup time is the overhead incurred by the PIXBLT instructions from performing initialization, XY conversions, and window operations. Window operations are performed before the PIXBLT transfer begins. Win- dow options that affect PIXBLT setup timing include: No window checking (W=0) A window clip that requires no change (array fits) A window clip that affects the starting pointer (adjust start) A window clip that affects the array transfer dimensions (dimension adjust) A window clip that affects both the starting and ending pointers (adjust both) A window miss that requests an interrupt A window hit able 13-11 shows the effect of these options on the PIXBLT setup time. Corner adjust operations have no effect on PIXBLT setup timing. 13-31 Instruction Timings - PIXBLT Expand Instructions Table 13-11. PIXBLT Expand Setup Time Window Operation Corner Adjust Instruction W=0 Array Fits Start Adjust Dimens Adjust Adjust Both Miss Hit PBH=1 PBV=0 PBH=0 PBV=1 PBH=1 PBV=1 PIXBLT B, L 4 - - - - - - - - - PIXBLT B, XY 6 9 17 12 21 - - - - - For example, a PIXBLT B,XY with the preclipping option requiring an adjust- ment to the end corner of the array requires 1 2 states of setup time. 13.5.2 PIXBLT Transfer Timing Table 13-12 shows transfer timing for PIXBLT expand instructions. Transfer timing is the time required (in addition to the setup time) to execute the actual data transfer to memory. Transfer timing is affected by several factors, in- cluding the number of rows in the adjusted array (L), the number of words affected per row (/V), graphics operations (G), the four possible destination array alignments (A, B, C, and D), and the arrangement of words in source rows. These factors are described in the list that follows the table. Table 13-12. PIXBLT Expand Transfer Timingt Destination Alignment Transfer Timing Short case (3+2R+G)L + 3 Medium case Alignment A or C Alignment B or D {3+2R+NG)L + 3 (B+2R+NG)L + 3 Long case Alignment A Alignment D [(3+2R+2GP)S + 2V + NG]L+ 3 i(8+2R+2GP)S + 2V + YG + 8]L+ 3 T Subtract any alignment/graphics adjustment from these values Key: Number of rows in the array (below) Number of destination words per row (see page 13-33) Number of source words involved in set (see page 13-33) Number of 32-bit sets in long source rows (DX/32), except for the case of an even number of sets; in this case, S is the number of 32-bit sets minus 1 (DX/32 - 1) (see page 13-35) Number of source words involved in reading source pixels at end of row after all the complete 32-bit sets have been transferred P Current pixel size Value dependent on selected graphics operations (see Table 13-13) Number of remaining destination words affected in a given row after S 32-bit sets are written 13-32 Instruction Timings - PIXBLT Expand Instructions 13.5.2. 1 Number of Rows in the Array (L) The working dimensions (L rows x N words) for the block transfer are deter- mined by the original destination pointer (DADDR) and dimensions (DYDX) in conjunction with window preclipping. The symbol L is used to represent the number of rows in the clipped destination array. 13.5.2.2 Alignment of Leading and Trailing words in Rows After clipping, the data transfer portion of the PIXBLT treats the array as a se- ries of L rows of M pixels. These R pixels are spread across N words in each row of the destination array. N and L affect the transfer timing. This alignment does not vary from row to row because DPTCH is constrained to be a multiple of 16 for binary PIXBLTs. Figure 13-13 illustrates a single row of a destination array in memory. PIXBLT algorithm resolves rows into three portions: 1 ) The leading edge at the beginning of the row 2) The center N-2 words of the row 3) The trailing edge at the end of the row The i i i Word Boundaries M Mtardft ' i i i Lead ing lis i i - Center N-2 Words ►; \ railing PIX( i i Ixete ( Figi ire i 13-13. Pixel Block Alignment in X As Figure 13-13 shows, a row of N words includes one word each for the leading and trailing parts of the transfer and N-2 words for the center portion. PIXBLT expand instructions always transfer the center portion of the row as a series of 16 bit words, and are not affected by the alignment of the leading word. Thus, the alignment of the trailing words in the row characterize the alignment type for the row. Figure 13-14 illustrates the four possible align- ments (A, B, C, and D) of a row in the destination array. 13-33 Instruction Timings - PIXBLT Expand instructions ■N Words- • « Word Boundaries - Alignment A • Leading j« Center N-2 Words >j Trading Alignment B ; Leading «« Center N-2 Words ►• Trailing Alignment C I • Leading •< Center N-2 Words - Alignment D j j j Leading j* Center N-2 Words ►! Trailing -N Words - Figure 13-14. Pixel Block Row Alignments 73.5.2.3 Row Length (N Words per Row) Row length is determined by a combination of the computed array pointer value in DADDR, the clipped DX dimension, and the pixel size stored in the PSIZE register. The data transfer algorithm breaks down into one of three cases, short, medium, or long, according to the number of words N in a row. These three cases include: Short case. A row of source array pixels is contained in 1 6 bits or less and the expanded data involves only one word of the destination array per row (/V=1 ). Alignment does not affect the short case. Medium case. A row of source array pixels is contained in 32 bits or less but the expanded data involves more than one word of the destina- tion array per row {N>*\). In this case, the array alignment is determined by the alignments of the last word in the row. Thus, alignments A,C and B,D have equal transfer timings. Long case. A row of source array pixels is contained in more than 32 bits. The expanded data involves multiple words in the destination array row. In this case, the array alignment is determined by the alignments of the last word in the row. Thus, alignments A and B and alignments C and D have equal transfer timings. 13-34 Instruction Timings - PIXBLT Expand Instructions Note that the timings for the short and medium row lengths are not affected by the alignment of the first word on each row of the destination array. That is, the destination array row transfer can start with either a write or a read- modify-write. The long case is treated as a series of 32-pixel medium cases followed by a short case (if necessary) at the end of each row. Each 32-pixel set is expanded and written to the destination in a serial fashion, without op- timizing for beginning and ending alignments. Thus, the timing for the long case becomes a product of the number of 32-pixel sets (S) and the timing for each set, plus the timing for expanding any remaining segment of the source array (less than or equal to 32 bits) that is left in the row. Note that the re- maining segment of the source array may have an alignment type (B or C) that is different from the preceding 32-bit sets. 13.5.2.4 Arrangement of Source Rows As discussed in the Row Length section, the number of bits in a row of the source array affects the time required to perform the PIXBLT transfer algorithm. The short and medium cases have explicit timings based on the number of words read from the source row, R. Note that the timings for the short and medium row lengths are not affected by the alignment of the last word on each row of the destination array. That is, the destination array row transfer can either end with a write or a read-modify-write. The long case is treated as a series of 32-pixel segments. Each 32-pixel set is expanded and written to the destination in a serial fashion without opti- mizing for beginning and ending alignments for the source or destination. The final portion of the transfer may be up to a 32-pixel "partial" segment. Thus, the timing for the long case becomes a product of the timing for each set and the number of 32-pixel sets (5), plus the timing for expanding any remaining segment of the source array (up to 32 bits). Note that the alignment of the remaining segment of the source array is determined by the original (clipped) source array alignment. The PIXBLT does not attempt to optimize read operations from the source ar- ray; therefore, depending on the alignment of the source array, either two or three words may need to be read in order to obtain a 32-bit set of source pixels for expansion. This value, R, is the number of source words involved in a 32-bit set of source pixels and may be either two or three. The timings are affected by R as wells as the number of such complete 32-bit sets S in a source row. The bits remaining after all of the complete 32-bit sets on a row have been moved are transferred. Depending on the number of remaining bits and the alignment of the source array, either one, two, or three words may need to be read in order to obtain the remaining set of source pixels for expansion. This value, V, is the number of of source words read to obtain the final segment while Y is is the number of destination words involved for this fragment. 13-35 Instruction Timings - PIXBLT Expand Instructions 13.5.2.5 Transfer Direction in X (PBH Bit) These PIXBLT instructions proceed a single word of pixels at a time in the di- rection of increasing X and increasing Y. This corresponds to left-to-right and top-to-bottom for the default screen orientation. Setting the PBH and PBV bits has no effect. 13.5.2.6 Selected Graphics Options (G) Graphics operations such as plane masking, transparency, and pixel process- ing influence PIXBLT transfer timing because the destination pixels must be read before they are replaced. However, the effects of these operations are performed by different parts of the TMS34010 hardware. For instance, plane masking, transparency, and field insertion are all performed by the TMS34010 memory controller hardware; any combination of these operations uses 2 ma- chine states for each word written. Pixel processing, on the other hand, is performed by the TMS34010 CPU, and requires 2, 4, 5, or 6 states per word independent of other operations. The minimum time for any graphics opera- tion, then, is 2 machine states (one memory cycle) using the replace oper- ation with plane masking and transparency disabled. These values are shown in Table 13-13. Table 13-13. Timing Values per Word for Graphics Operations (G) Pixel Processing Operation Graphics Operation Replace Other Booleans or ADD ADDS, SUB MAX or MIN SUBS No plane masking or transparency 2 4 5 6 Read-modify-write, plane masking, or transparency 4 6 7 8 13.5.2.7 Alignment/ Graphics Adjustment An additional adjustment may be necessary when plane masking or transpar- ency are enabled and the alignment type is B, C, or D. As the second line of Table 13-13 shows, if a particular word in a destination row has already been read as part of a read-modify-write operation, no additional states are re- quired to perform plane masking or transparency for that word. Since the alignment types with misaligned edges (B, C, and D) already assume a RMW (read-modify-write) on their respective edges, the effect of plane masking or transparency can be ignored for these edges. That is, after you have calculated the timing using the proper value for the graphics operation, you can subtract 2 states (cases B and C) or 4 states (case D) per row from the row timings for the respective alignment cases. Case A requires no adjustment. 13-36 Instruction Timings - PIXBLT Expand Instructions 13.5.3 PIXBLT Timing Examples PIXBLT timing is calculated by adding the PIXBLT setup value to the PIXBLT transfer value: PIXBLT time = PIXBLT setup time + PIXBLT transfer time - alignment adjustment PIXBLT setup timings, transfer timings, and the effects of graphics operations are listed in the following tables: Table Page 13-11 PIXBLT Expand Setup Time 1 3-32 13-12 PIXBLT Expand Transfer Timingt 1 3-32 13-13 Timing Values per Word for Graphics Operations (G) 1 3-36 The following three examples illustrate timing for a PIXBLT B,XY that ex- pands a 10-by-10 font (Z.=10) into eight bits per pixel with color. The setup and transfer timings for these examples are the same, except each uses a dif- ferent graphics operation. Figure 13-16 illustrates the destination array and window used in these examples, as defined by the implied operands in Figure 13-15. The shaded portion in Figure 1 3-1 6 is the destination array. *************************************************** * Implied op erand setup for PIXBLT B, XY examples * * (assume that B register and I/O regiser names * * are equate d to with proper registers) * *************************************************** MOVI 0003E2E8h, SADDR } linear address MOVI OOADOh, SPTCH r X extent = 2768 pixels MOVI 0032010Bh, DADDR i X=267, Y= 50 MOVI 800h, DPTCH 7 X extent =512 pixels MOVI 00040000h, OFFSET CLR WSTART ; ignored MOVI OlOOOlOOh, WEND / ignored MOVI OOOAOOOAh, DYDX ; DX=10, DY=10 MOVI 8h, AO MOVE AO, §PSIZE } Pixel size = 8 bits MOVI 14h, AO MOVE AO, §CONVDP MOVE AO, @CONVSP r ignored CLR AO MOVE AO, @PMASK MOVI 0300h, AO MOVE AO, ©CONTROL 7 W=0 , T=0 , PP=0 , PBH= 1 , PBV=1 Figure 13-15. Implied Operand Setup for PIXBLT-Expand Examples 13-37 Instruction Timings - PIXBLT Expand instructions -2,768 pixels per row- SADDR- ■10- t 10 1 » • ■•••••• DADDR Figure 13-16. PIXBLT B,XY Timing Example Follow these steps to determine the number of machine states consumed in these PIXBLT examples: 1) Determine the setup time; refer to Table 13-11 (page 13-32). Setup time comprehends the machine states consumed by windowing and corner adjust operations; a) Windowing: Is not enabled for this example. b) Comer adjust: PBH and PBV are ignored. As Table 13-11 shows, the setup time for this PIXBLT is 6 machine states. 2) Determine the transfer time; refer to Table 13-12 (page 13-32). Transfer time comprehends the number and alignment of rows in the array, row length, the direction of the move, and the graphics operations. a) b) c) d) Number of words per row: The source is part of a packed font. The source array starts in the middle of a word and extends into the next word, so two words are read for each row of the font (R-2). Number of rows in the array: The Y dimension is 10 (Z. = 10). Neither the leading nor the trailing edges are word aligned, so the alignment type is D. Array alignment: The X dimension is 10 pixels wide, but with alignment type D, an extra word is involved for both the leading and trailing pixels; the pixel size is eight, so 12 divided by 2 (two pixels per word) produces /V=6. Since the width is less than 32 pixels (10), but more than one word of the destination is affected, this example is a medium case. 13-38 Instruction Timings - PIXBLT Expand Instructions As Table 13-1 2 shows, the transfer timing is (5+2/?+2G/V)Z. + 3. The only variable in the timing for these three examples is the selected graphics operations. Example 13-7. Replace, No Transparency, No Plane Masking The implied operand setup in Figure 13-15 selects the following graphics options: • Pixel processing replace operation (PPOP=0), • No transparency, and • No plane masking. According to Table 13-13, variable G = 2. The total machine states re- quired for this instruction are: PIXBLT time = PIXBLT setup time + PIXBLT transfer time = 6 + (5+2R+NG)L + 3 = 6 + (5 + 2x2 + 6x2)x10 + 3 = 21 9 states This examples consumes 219 machine states as it reads, expands, and writes these 1 00 pixels. Example 13-8. MAX, No Transparency, No Plane Masking Select the pixel processing MAX option (be sure to retain the values of the W bits and the T bit, which are also in the CONTROL register): MOVI MOVE 50C0h, A0 A0 , @CONTROL MAX, W=3, T=0 These instructions, in combination with the implied operand setup in Figure 13-15, select the following graphics options: • Pixel processing MAX operation (PPOP = 14h), • No transparency, and • No plane masking. According to Table 13-13, variable 6=5; the timing equation becomes: PIXBLT time = PIXBLT setup time + PIXBLT transfer time = 6 + (5+2R+NG)L + 3 = 6 + (5 + 2x2 + 6x5)x10 + 3 = 399 states The instruction in this example consumes 399 machine states. 13-39 Instruction Timings - PIXBLT Expand Instructions Example 13-9. XNOR with Transparency and Plane Masking Select the pixel processing XNOR operation and enable transparency and plane masking: MOVI 14E0h, AO MOVE AO, ©CONTROL ; XNOR, W=3, T=l MOVI llllh, AO MOVE AO , @PMASK ; Use a plane mask These instructions, in combination with the implied operand setup in Figure 13-15, select the following graphics options: • Pixel processing XNOR operation (PPOP=05h), • No transparency, and • No plane masking. According to Table 13-13, variable G = 6. If plane masking or transparency is enabled, you must consider the array alignment in the timing. Alignment type D incurs a read-modify-write at the leading and trailing edges of each row. The extra read included in the RMW can be used by the plane masking or transparency hardware, so an alignment/graphics adjustment is necessary. The adjustment negates the effect of the extra read cycles in each row that are attributed to the graphics operations. For this example, the amount subtracted is AL (the number of machine states for a read cycle times 2 times the number of rows). The timing is now calculated as: PIXBLT time ment PIXBLT setup time+ PIXBLT transfer time - adjust- = 6 = 6 = 419 states + (5+2R+NG)L +3 -4Z. + (5 + 2x2 + 6x6)x10+3-(4x10) The instruction in this example consumes 41 9 machine states. 13.5.4 The Effect of Interrupts The PIXBLT instruction may be interrupted on a destination word boundary during the transfer portion of the algorithm. It may also be interrupted at the end of any row in the array. The context of the PIXBLT is saved in reserved registers. The PBX bit is set in the copy of the ST register that is pushed to the stack. The worst case latency caused by an interrupt is 20 machine states for the interrupt to be recognized. The time for the context switch must be added to this; see Section 8.5.1, Interrupt Latency (page 8-6) for context switch timings. 13-40 Appendix A TMS34010 Data Sheet A-1 Appendix A - TMS34010 Data Sheet A-2 TMS34010 GRAPHICS SYSTEM PROCESSOR JANUARY 1986 - REVISED JUNE 1988 Instruction Cycle Time: - 132 ns . . . (TMS340 10-60) - 160 ns . . . (TMS34010-50) - 200 ns . . . (TMS340 10-40) • Fully Programmable 32-Bit General-Purpose Processor with 1 28-Megabyte Address Range • Pixel Processing, XY Addressing, and Window Checking Built into the Instruction Set • Programmable 1, 2, 4, 8, or 16-Bit Pixel Size with 16 Boolean and 6 Arithmetic Pixel Processing Options (Raster-Ops) • 30 General-Purpose 32-bit Registers and 32-bit Stack Pointer • 256-Byte LRU On-Chip Instruction Cache • Direct Interfacing to Both Conventional DRAM and Multiport Video RAM • Dedicated 8/16-Bit Host Processor Interface and HOLD/HLDA Interface >" \ a , £ i!= * FN PACKAGE (TOP VIEW) W C/5 (J) \ I I I < \w I 05 OF <-> _l D O i It li > LAD0 ]io LAD1 ]n LAD2pl2 LAD3 LAD4 ]13 ]14 LAD5 ]15 LAD6[]l6 LAD7 VSS LAD8 LAD9 LAD 10 LAD 11 LAD 12 LAD 13 LAD 14 317 ]18 ]19 ]20 321 ]22 ]23 ]24 ]25 LAD15]26 JL_I1_I1_JL_I1_I 9 8 7 6 5 4 3 2 1 68 67 66 65 64 63 62 61 27 28 29 30 31 l-» c-i i-i r-i r-i 32 331 nnr 60 C HD0 59[HD1 58[HD2 57CHD3 56 C HD4 55 [ HD5 54 C HD6 53 C HD7 52 C V S S . 51 C HD8 50 [ HD9 49 C HD10 48 [ HD11 47 [ HD12 46 C HD13 45 C HD14 44 C HD15 I- 35 36 37 38 39 40 41 42 43 S n-ir-inr-ir-ii-ii-ir-in f O «- «N <> c> ■x! (_>*:* 7 7 7 > > < I > m • Programmable C RT Control (HSYNC, VSYNC, BLANK) • High-Level Language Support • Full Line of Hardware and Software Development Tools Including a "C" Compiler • 68-Leaded Packaging (PLCC) • 5-Volt CMOS Technology description The TMS34010 Graphics System Processor (GSP) is an advanced high-performance CMOS 32-bit microprocessor optimized for graphics display systems. With a built-in instruction cache, the ability to simultaneously access memory and registers, and an instruction set designed specifically for raster graphics operation, the TMS34010 provides user-programmable control of the CRT interface as well as the memory interface (both standard DRAM and multiport video RAM). The 1 -gigabit address space is completely bit- addressable on bit boundaries using variable width data fields (1 to 32 bits). Additional graphics addressing modes support 1 , 2, 4, 8, and 1 6-bit wide pixels. The TMS3401 is exceptionally well-supported by graphics software interface standards such as CGI/VDI, DGIS, and MS-Windows, as well as a full line of hardware and software support tools. Current support is highlighted in the TMS3401 Third Party Reference Guide (literature number SPVB066A). architecture The TMS34010 is a CMOS 32-bit processor with hardware support for graphics operations such as PixBlts (raster ops) and curve-drawing algorithms. Also included is a complete set of general-purpose instructions with addressing tuned to support high-level languages. In addition to its ability to address a large external memory range, the TMS34010 contains 30 general-purpose 32-bit registers, a hardware stack pointer This document contains information oh products in more than one phase of development. The stetus of each device is indicated on the pagels) specifying its electrical characteristics. Texas ^» Instruments POST OFFICE BOX 1443 • HOUSTON, TEXAS 77001 Copyright © 1 986, Texas Instruments Incorporated A-3 TMS34010 GRAPHICS SYSTEM PROCESSOR and a 256-byte instruction cache. On-chip functions include 28 programmable I/O registers that contain CRT control, input/output control, and instruction parameters. The TMS3401 directly interfaces to dynamic RAMs and video RAMs and generates video monitor control signals. It also accommodates a conventional HOLD/HLDA shared access as well as a separate, generalized interface for communicating with any standard host processor. pin descriptions PIN I/O DESCRIPTION NAME NUMBER Host Interface Bus Pins HCS 66 I Host chip select HD0-HD15 44-51, 53-60 I/O Host bidirectional data bus HFSO, HFS1 67, 68 I Host function select HINT 42 Host interrupt request HLDS 63 I Host lower data select HUDS 62 I Host upper data select HRDY 43 64 65 I I Host ready Host read strobe Host write strobe HREAD HWRITE Local Bus Interface Pins RAS 38 Local row-address strobe CAS 39 Local column-address strobe DDOUT 36 Local data direction out DEN 37 Local data enable LAD0-LAD15 10-17, 19-26 I/O Local address/data bus LAL 34 Local address latched LCLK1, LCLK2 28, 29 Local output clocks LINT1, ONT2 6, 7 I Local interrupt request pins LRDY 9 I Local ready TR/QE 41 Local shift register transfer or output enable W 40 Local write strobe INCLK 5 I Input clock Hold and Emulation HOLD 8 I Hold request RUN/EMU 2 33 I Run/Not emulate Hold acknowledge or emulate acknowledge HLDA/EMUA 32 30 I/O Blanking Horizontal sync Video Timing Signals BLANK HSYNC VCLK 4 31 I I/O Video clock Vertical sync VSYNC 3 I Reset Miscellaneous RESET vcc 27, 61 I Nominal 5-volt power supply vss 1, 18, 35, 52 I Ground A-4 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR system block diagram GRAPHICS SYSTEM PROCESSOR CHIP BOUNDARY TO HOST PROCESSOR k HOST BUS i> HOST-GRAPHICS INTERFACE c DRAM- REFRESH CONTROL GRAPHICS PROCESSOR ^> CONVENTIONAL DRAMS PROGRAM AND \y£ DATA STORAGE GRAPHICS MEMORY BUS nrji SCREEN- REFRESH CONTROL 7% > CRT TIMING CONTROL 1 J I J FRAME BUFFER 1 — / VIDEO RAMS TO * >CRT MONITOR EXTERNAL INTERRUPT REQUESTS RESET HOST INTERFACE BUS SYNC AND BLANKING I I I I I I I/O REGISTERS INTERRUPT REGISTERS HOST INTERFACE REGISTERS VIDEO TIMING REGISTERS LOCAL MEMOR> CONTROL REGISTERS i i£ INSTRUCTION CACHE PROGRAM COUNTER STATUS REGISTER STACK POINTER INSTRUCTION DECODE ■+-•- LL MICROCONTROL ROM L J EXECUTION UNIT LOCAL MEMORY CONTROL LOGIC AND BUFFERS IF INTERNAL CLOCK CIRCUITRY * £ CLOCK OUTPUTS CLOCK INPUTS LOCAL MEMORY INTERFACE BUS FIGURE 1. TMS34010 INTERNAL ARCHITECTURE Texas ^» Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-5 TMS34010 GRAPHICS SYSTEM PROCESSOR The TMS34010 provides single-cycle execution of most common integer arithmetic and Boolean operations from its instruction cache. Additionally, the TMS34010 incorporates a hardware barrel shifter that provides a single-state bidirectional shift and rotate function for 1 to 32 bits. A microcoded local memory controller supports pipelined memory write operations of variable-size fields that can be performed in parallel with subsequent instruction execution. TMS34010 graphics processing hardware supports pixel and pixel-array processing capabilities for both monochrome and color systems that have a variety of pixel sizes. The hardware incorporates two-operand raster operations with Boolean and arithmetic operations, XY addressing, window clipping, window checking operations, 1 to n bits per pixel transforms, transparency, and plane masking. The architecture further supports operations on single pixels (PIXT instructions) or on two-dimensional pixel arrays of arbitrary size (PixBlts). The TMS3401 0's flexible graphics processing capabilities allow software-based graphics algorithms without sacrificing performance. These algorithms include: arbitrary window size, custom incremental curve drawing, and two-operand raster operations. register files Boolean, arithmetic, byte, and field move instructions operate on data within the TMS34010's general- purpose register files. The TMS3401 contains thirty-one 32-bit registers, including a system stack pointer (SP). The SP is accessible to both Register File A and B as the sixteenth register. Transfers between registers and memory are facilitated via a complete set of field MOVE instructions with selectable field sizes. Transfers between registers are facilitated via the MOVE instruction. The fifteen general-purpose registers in Register File A are used for high-level language support and assembly language programming. The fifteen registers in Register File B are dedicated to special functions during PixBlts and other pixel operations, but can be used as general-purpose registers at other times. A-6 Texas ,, ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR 31 (MSB) AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 AVI A12 A13 A14 SP O(LSB) STACK POINTER 31 (MSB) BO B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 SP SADDR O(LSB) SOURCE ADDRESS (PIXBLTS) SPTCH 1 DPTCH COLORO TEMPORARY REGISTER TEMPORARY REGISTER TEMPORARY REGISTER TEMPORARY REGISTER TEMPORARY REGISTER STACK POINTER SOURCE PITCH DESTINATION ADDRESS (PIXBLTS AND FILLS) DESTINATION PITCH OFFSET WINDOW START WINDOW END DELTA Y/ DELTA X COLORO (BINARY PIXBLTS) COLOR1 (BINARY PIXBLTS. FILLS AND DRAV) THESE ARE USED AS TEMPORARY > STORAGE FOR PIXBLT AND FILL INSTRUCTIONS. FIGURE 2. REGISTER FILES A AND B program counter (PC) The TMS34010's 32-bit program counter register points to the next instruction-stream word to be fetched. Since instruction words are aligned to 16-bit boundaries, the four LSBs of the PC are always zero. instruction cache An on-chip instruction cache contains 256 bytes of RAM and provides fast access to instructions. It operates automatically and is transparent to software. The cache is divided into four 64-byte segments. Associated with each segment is a 23-bit segment address register to identify the addresses in memory corresponding to the current contents of the cache segment. Each cache segment is further partitioned into eight subsegments of four words each. Each subsegment has associated with it a present (P) flag to indicate whether the subsegment contains valid data. Texas "** Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-7 TMS34010 GRAPHICS SYSTEM PROCESSOR SEGMENT START ADDRESS S S A REG S T E R p FLAGS DATA REGISTERS SUBSEGMENT SUBSEGMENT 1 SUBSEGMENT 2 SUBSEGMENT 3 SUBSEGMENT 4 SUBSEGMENT 5 SUBSEGMENT 6 SUBSEGMENT 7 > SEGMENT SSA REGISTER 1 SUBSEGMENT SUBSEGMENT 1 SUBSEGMENT 2 SUBSEGMENT 3 SUBSEGMENT 4 SUBSEGMENT 5 SUBSEGMENT 6 SUBSEGMENT 7 WORD WORD 1 WORD 2 WORD 3 SUBSEGMENT 2 OF SEGMENT 1 SSA REGISTER 2 I I I I I I I I I I I I I I SSA REGISTER 3 SUBSEGMENT SUBSEGMENT 1 SUBSEGMENT 2 SUBSEGMENT 3 SUBSEGMENT 4 SUBSEGMENT 5 SUBSEGMENT 6 SUBSEGMENT 7 > SEGMENT 2 SUBSEGMENT SUBSEGMENT 1 SUBSEGMENT 2 SUBSEGMENT 3 SUBSEGMENT 4 SUBSEGMENT 5 SUBSEGMENT 6 SUBSEGMENT 7 6 7 FIGURE 3. INSTRUCTION CACHE MOST RECENTLY-* USED LEAST RECENTLY-* USED LRU STACK > SEGMENT 3 A-8 Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR The cache is loaded only when an instruction requested by the TMS3401 is not already contained within the cache. A least-recently-used (LRU) algorithm is used to determine which of the four segments of the cache is overwritten with the new data. For this purpose, an internal four-by-two LRU stack is used to keep track of cache usage. status register The status register (ST) is a special-purpose 32-bit register dedicated to status codes set by the results of implicit and explicit compare operations and parameters used to specify the length and behavior of fields and 1. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 6 5 4 3 2 1 N • Sign bit C - Carry bit Z - Zero bit V - Overflow bit PBX - PixBIt executing IE - Interrupt enable bit FE1 - Field extension bit 1 FS1 - Field size bit 1 FEO - Field extension bit FSO - Field size bit FIGURE 4. STATUS REGISTER fields, bytes, pixels, and pixel arrays A 26-bit address output by the TMS3401 selects a 1 6-bit word of physical memory; logically, however, the TMS34010 views memory data as fields addressable at the bit level. Primitive data types supported by the TMS34010 include: bytes, pixels, two 1- to 32-bit fields, and user-defined pixel arrays. Fields and 1 are specified independently to be from 1 to 32 bits in length. Bytes are special 8-bit cases of the field data type, while pixels are 1, 2, 4, 8 or 16 bits in length. In general, fields (including bytes) may start and terminate on arbitrary bit boundaries; pixels must pack evenly into 16-bit words. pixel operations Pixel arrays are two-dimensional data types of user-defined width, height, pixel depth (number of bits per pixel), and pitch (distance between rows). A pixel or pixel array may be accessed by means of either its memory address or its XY coordinates. Transfers of individual pixels or pixel blocks are influenced by the pixel processing, transparency, window checking, plane masking, or corner adjust operations selected. I/O registers The GSP contains an on-chip block of twenty-eight 16-bit I/O registers mapped into the TMS34010's memory address space. They can be accessed either by the TMS34010's CPU or by the host processor via the host interface. The I/O registers contain control parameters necessary to configure the operation of the following interfaces: interface to host processor (5 I/O registers), interface to local memory (6 registers), video timing and screen refresh functions (15 registers), and externally and internally generated interrupts (2 registers). The I/O registers also furnish status information on these interfaces. Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-9 TMS34010 GRAPHICS SYSTEM PROCESSOR ADDRESS OCOOOOIFOh OCOOOOIEOh OCOOOOIDOh OCOOOOICOh OCOOOOIBOh OCOOOOIAOh 0C0000190h 0C0000180h OC0000170h OC0000160h OC0000150h OC0000140h 0C0000130h 0C0000120h ocoooonoh OCOOOOIOOh OCOOOOOFOh OCOOOOOEOh OCOOOOODOh OCOOOOOCOh OCOOOOOBOh OCOOOOOAOh OC0000090h 0C0000080h 0C0000070H 0C0000060h 0C0000050H 0C0000040h 0C0000030h 0C0000020h OCOOOOOIOh OCOOOOOOOh - t - RESERVED = J = REFCNT DPYADR VCOUNT HCOUNT DPYTAP PMASK CONVDP CONVSP HSTADRH HSTADRL HSTDATA CONTROL VTOTAL HTOTAL HSBLNK HEBLNK HESYNC DRAM REFRESH COUNT DISPLAY ADDRESS VERTICAL COUNT HORIZONTAL COUNT DISPLAY TAP POINT PLANE MASK PIXEL SIZE CONVERSION (DESTINATION PITCH) CONVERSION (SOURCE PITCH) INTERRUPT PENDING INTERRUPT ENABLE HOST CONTROL (8 MSB'S) HOST CONTROL (8 LSB'S) HOST ADDRESS (16 MSB'S) HOST ADDRESS (16 LSB'S) HOST DATA CONTROL DISPLAY INTERRUPT DISPLAY START DISPLAY CONTROL VIDEO TOTAL VERTICAL START BLANK VERTICAL END BLANK VERTICAL END SYNC HORIZONTAL TOTAL HORIZONTAL START BLANK HORIZONTAL END BLANK HORIZONTAL END SYNC FIGURE 5. I/O REGISTERS host interface registers The host interface registers are provided for communications between the TMS34010 and the host processor. The registers are mapped into five of the I/O register locations accessible to the TMS34010. These same registers are mapped into four locations in the GSP interface to the host. One of the registers is devoted to host interface control functions such as the passing of interrupt requests and 3-bit status codes from host to TMS34010 and from TMS34010 to host. Other control functions available to the host processor include flushing the instruction cache, halting the TMS34010, and transmitting a non-maskable interrupt request to the TMS34010. A-10 Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR The remaining host registers are used for block transfers between the TMS34010 and host processor. The host uses these registers to indirectly access blocks within the TMS34010's local memory. Two of the 16-bit registers contain the 32-bit address of the current word location in memory. Another 16-bit register buffers data transferred to and from the memory by the host processor. The host interface can be programmed to automatically increment the pointer address following each transfer to provide the host with rapid access to a block of sequential addresses. memory interface control registers Six of the I/O registers are dedicated to various local memory interface functions including: • Frequency and type of DRAM refresh cycles • Pixel size • Masking (write protection) of individual color planes • Various pixel access control parameters — Window checking mode — Boolean or arithmetic pixel processing operation — Transparency — PixBIt direction control video timing and screen refresh Fourteen I/O registers are dedicated to video timing and screen refres h functio ns. The TMS3401 generates the horizontal sync (HSYNC), vertical sync (VSYNC), and blanking (BLANK) signals used to drive a video monitor in a graphics system. These signals are controlled by means of a set of programmable video timing I/O registers and are based on the input video clock, VCLK. VCLK does not have to be synchronous with respect to INCLK, the TMS34010's CPU input clock. The TMS34010 directly supports multiport video RAMs (VRAMs) by generating the memory-to-register load cycles necessary to refresh the display being shown on the video monitor. The memory locations from which display information is taken, as well as the number of horizontal scan lines displayed between memory-to-register load cycles, are programmable. VRAM tap point addresses are also fully programmable to support horizontal panning. The TMS34010 supports various screen resolutions and either interlaced or noninterlaced video. The TMS34010 can optionally be programmed to synchronize to externally generated sync signals so that graphics images created by the TMS34010 can be superimposed upon images created externally. The external sync mode can also be used to synchronize the video signals generated by two or more TMS3401 chips in a multiple-TMS34010 graphics system. interrupt interface registers Two dedicated I/O registers monitor and mask interrupt requests to the TMS3401 0, including two externally generated interrupts and three internally generated interrupts. An internal interrupt request can be generated on one of the following conditions: • Window violation: an attempt has been made to write a pixel to a location inside or outside a specified window boundary. • Host interrupt: the host processor has set the interrupt request bit in the host control register. • Display interrupt: a specified line number in the frame has been displayed on the screen. A nonmaskable interrupt occurs when the host processor sets a particular control bit in the host interface registers. The TMS34010 reset function is controlled by a dedicated pin. Texas ** A11 Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR memory controller/local memory interface The memory controller manages the TMS3401 0's interface to the local memory and automatically performs the bit alignment and masking necessary to access data located at arbitrary bit boundaries within memory. The memory controller operates autonomously with respect to the CPU. It has a "write queue" one field (1 to 32 bits) deep that permits it to complete the memory cycles necessary to insert the field into memory without delaying the execution of subsequent instructions. Only when a second memory operation is required before the memory controller has completed the first operation is the TMS3401 forced to defer instruction execution. The TMS34010 directly interfaces to all standard dynamic RAMs and, in particular to JEDEC standard 64K and 256K video RAMs such as the TMS4161 and TMS4461 Multiport VRAMs. The TMS34010 memory interface consists of a triple-multiplexed address/data bus plus the associated control signals. Row address, column address, and data are mul tiplex ed over the s ame address/data lines. DRAM refresh is supported with a variety of modes including CAS-before-RAS refresh. TMS34010 memory map From the programmer's point of view, the TMS3401 treats data and instructions as residing in the same memory space. BIT 232 _t (LAST BIT IN MEMORY) ADDRESS OFFFFFFFOh OFFFFFCOOh OFFFFFBFOh OFFFFEOOOh OFFFFDFFOh 0C0002000h OCOOOIFFOh 0C0000200h OCOOOOIFOh OCOOOOOOOh OBFFFFFFOh OOOOOOOOOh *-. 64 WORDS 512 WORDS 226 _ 1024 WORDS 512 WORDS O*. VVUI 3x226 WORDS !! -16- INTERRUPT VECTORS GENERAL USE INTERNAL I/O REGISTERS GENERAL USE V BIT (FIRST BIT IN MEMORY) FIGURE 6. MEMORY MAP A-12 Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR instruction set The TMS34O10 instructions fall into three categories. The graphics instructions manipulate pixel data, accessed via memory addresses or XY coordinates. They provide support for graphics operations such as array and raster ops, pixel processing, windowing, plane masking, and transparency. The move instructions comprehend bit addressing and field operations; they manipulate fields of data using linear addressing for transfer to and from memory and the register file. The TMS34010 general-purpose instructions provide a complete set of arithmetic and Boolean operations on the register file as well as general program control and data processing. Partial timing information is provided in the table below. The two values given for jump instructions in the Minimum Cycles column indicate the jump and no-jump conditions, respectively. Full timing information can be obtained in the TMS34010 User's Guide (number SPVU001A). The following abbreviations are used below in the opcodes: S (source register), D (destination register), R (register file select), F (field select), K (constant), M (cross A/B file boundary), Z (draw option), code (jump select code), X (don't care), N (trap select and stack adjust), RS (source register), RD (destination register), xxxx (address displacement), IL (32-bit immediate operand), and IW (16-bit immediate operand). GRAPHICS INSTRUCTIONS SYNTAX ADDXY Rs, Rd CMPXY Rs, Rd CPW Rs, Rd CVXYL Rs, Rd DRAV Rs, Rd FILLL FILL XY LINEZ MOVX Rs, Rd MOVY Rs, Rd PIXBLT B,L PIXBLT B,XY PIXBLT L,L PIXBLT L,XY PIXBLT XY, L PIXBLT XY.XY PIXT Rs,*Rd PIXT Rs,*Rd.XY PIXT *Rs, Rd PIXT *Rs,*Rd PIXT # Rs.XY, Rd PIXT *Rs.XY,*Rd.XY SUBXY Rs,Rd DESCRIPTION Add Registers in XY Mode Compare X and Y Halves of Registers Compare Point to Window Convert XY Address to Linear Address Draw and Advance Fill Array with Processed Pixels: Linear Fill Array with Processed Pixels: XY Line Draw Move X Half of Register Move Y Half of Register Pixel Block Transfer: Binary to Linear Pixel Block Transfer and Expand: Binary to XY Pixel Block Transfer: Linear to Linear Pixel Block Transfer: Linear to XY Pixel Block Transfer: XY to Linear Pixel Block Transfer: XY to XY Pixel Transfer: Register to Indirect Pixel Transfer: Register to Indirect XY Pixel Transfer: Indirect to Register Pixel Transfer: Indirect to Indirect Pixel Transfer: Indirect XY to Register Pixel Transfer: Indirect XY to Indirect XY Subtract Registers in XY Mode '•'Number of cycles depends on pixel size and/or pixel array size and graphics option NO. MINIMUM STATUS rORDS CYCLES 16-BIT OPCODE BITS MSB LSB 1 1 1110 OOOS SSSR DDDD N C z v 1 3 1110 010S SSSR DDDD N C z v 1 1 1110 011S SSSR DDDD - - - v 1 3 1110 100S SSSR DDDD - - - - 1 t 1111 011S SSSR DDDD - - - v 1 T 0000 1111 1100 0000 - - _ _ 1 t 0000 1111 1110 0000 - - - v 1 t 1101 1111 Z001 1010 - - - v 1 1 1110 110S SSSR DDDD - - - - 1 1 1110 111S SSSR DDDD - - _ _ 1 t 0000 1111 1000 0000 - - - - 1 t 0000 1111 1010 0000 - - - v 1 t 0000 1111 0000 0000 - - - - 1 t 0000 1111 0010 0000 - - - v 1 t 0000 1111 0100 0000 - - - - 1 t 0000 1111 0110 0000 - - - v 1 t 1111 100S SSSR DDDD - - - - 1 t 1111 OOOS SSSR DDDD - - - v 1 4 1111 101S SSSR DDDD - - _ _ 1 t 1111 110S SSSR DDDD - - - - 1 6 1111 001 S SSSR DDDD - - - - 1 t 1111 010S SSSR DDDD - - - v 1 1 1110 001 s SSSR DDDD N c z v option selected. See TMS34010 User' sGuide(SPVUOOIA). Texas ^* Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-13 TMS34010 GRAPHICS SYSTEM PROCESSOR MOVE INSTRUCTIONS SYNTAX MOVB Rs,*Rd MOVB *Rs,Rd MOVB *Rs,*Rd MOVB Rs,*Rd(off set) MOVB *Rs(offset),Rd MOVB *Rs(offset), # Rd(offset) MOVB MOVB MOVB MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE MOVE Rs,@Daddress @Saddress,Rd Rs,Rd Rs,*Rd,F Rs,-*Rd,F Rs,*Rd + ,F *Rs,Rd,F -*Rs,Rd,F *Rs + ,Rd,F *Rs,*Rd,F -*Rs,-*Rd,F *Rs + ,*Rd + ,F Rs,*Rd(offset),F *Rs(offset),Rd,F *Rs(offset),*Rd + ,F MOVE *Rs(offset),*Rdloffset),F MOVE Rs,@Daddress,F MOVE @Saddress,Rd,F MOVE @Saddress,*Rd + ,F MOVE @Saddress,@Daddress,F DESCRIPTION Move Byte: Register to Indirect Move Byte: Indirect to Register Move Byte: Indirect to Indirect Move Byte: Register to Indirect with offset. Move Byte: Indirect with offset, to Register Move Byte: Ind. with offset, to Ind. with offset. Move Byte: Register to Absolute Move Byte: Absolute to Register Move Byte: Absolute to Absolute Move Register to Register Move Field: Register to Indirect Move Field: Register to Indirect (pre-dec) Move Field: Register to Indirect (post-inc) Move Field: Indirect to Register Move Field: Indirect (pre-dec) to Register Move Field: Indirect (post-inc) to Register Move Field: Indirect to Indirect Move Field: Ind. (pre-dec) to Ind. (pre-dec) Move Field: Ind. (post-inc) to Ind. (post-inc) Move Field: Register to Indirect with offset. Move Field: Indirect with offset, to Register Move Field: Ind. with offset, to Ind. (post-inc) Move Field: Ind. with offset, to Ind. with offset. Move Field: Register to Absolute Move Field: Absolute to Register Move Field: Absolute to Indirect (post-inc) Move Field: Absolute to Absolute NO. MINIMUM WORDS CYCLES STATUS 16-BIT OPCODE BITS MSB LSB 1000 110S SSSR DDDD 1000 111S SSSR DDDD N - Z 1001 110S SSSR DDDD 1010 110S SSSR DDDD 1010 1 1 1S SSSR DDDD N - Z O 1011 110S SSSR DDDD - - 0000 0101 11 1R SSSS - - 0000 01 1 1 111R DDDD N - Z 0000 001 1 0100 0000 - - 0100 11 MS SSSR DDDD N - Z 1000 OOFS SSSR DDDD - - 1010 OOFS SSSR DDDD - - 1001 OOFS SSSR DDDD - - 1000 01 FS SSSR DDDD N - z 1010 01FS SSSR DDDD N - z 1001 01 FS SSSR DDDD N - z 1000 10FS SSSR DDDD - — - 1010 10FS SSSR DDDD - — - 1001 10FS SSSR DDDD - — - 1011 OOFS SSSR DDDD - — - 1011 01FS SSSR DDDD N - z 1101 OOFS SSSR DDDD - 1011 10FS SSSR DDDD - 0000 01 F1 100R SSSS - 0000 01 F1 101 R DDDD N 1101 01 FO 000R DDDD - 0000 01 F1 1100 0000 - ^Number of cycles depends on field size and alignment. See TMS34010 User's Guide (SPVU001A). A-14 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR GENERAL INSTRUCTIONS ABS Rd ADD Rs.Rd ADDC Rs.Rd ADDI IW.Rd ADDI IL,Rd ADDK K,Rd AND Rs.Rd ANDI IL.Rd ANDN Rs.Rd ANDNI IL.Rd BTST K.Rd BTST Rs.Rd CLR Rd CLRC CMP Rs.Rd CMPI IW.Rd CMPI IL.Rd DEC Rd DINT DIVS Rs.Rd DIVU Rs.Rd EINT EXGF Rd.F LMO Rs.Rd MMFM Rs.Register List MMTM Rd, Register List MODS Rs.Rd MODU Rs.Rd MOVI IW.Rd MOVI IL.Rd MOVK K.Rd MPYS Rs.Rd MPYU Rs.Rd NEG Rd NEGB Rd NOP NOT Rd OR Rs.Rd ORI IL.Rd RL K.Rd RL Rs.Rd SETC SETF FS.FE.F SEXT Rd.F NO. MINIMUM STATUS DESCRIPTION WORDS CYCLES 16-BIT OPCODE BITS MSB LSB Store Absolute Value 1 0000 0011 100R DDDD N - z Add Registers 1 0100 ooos SSSR DDDD N C z V Add Register with Carry 1 0100 001 s SSSR DDDD N c z V Add Immediate (16 Bits) 2 2 0000 1011 OOOR DDDD N c z V Add Immediate (32 Bits) 3 3 0000 1011 001 R DDDD N c z V Add Constant (5 Bits) 1 0001 OOKK KKKR DDDD N c z V AND Registers 1 0101 ooos SSSR DDDD - - z - AND Immediate (32 Bits) 3 3 0000 1011 100R DDDD - - z - AND Register with Complement 1 0101 001 s SSSR DDDD - - z - AND Not Immediate (32 Bits) 3 3 0000 1011 100R DDDD - - z - Test Register Bit - Constant 1 0001 11KK KKKR DDDD - - z - Test Register Bit - Register 2 0100 101S SSSR DDDD - - z - Clear Register 1 0101 011D DDDR DDDD - - - - Clear Carry 1 0000 0011 0010 0000 - - - Compare Registers 1 0100 100S SSSR DDDD N c z V Compare Immediate (16 Bits) 2 2 0000 1011 010R DDDD N c z V Compare Immediate (32 Bits) 3 3 0000 1011 011R DDDD N c z V Decrement Register 1 0001 0100 001 R DDDD - - - - Disable Interrupts 3 0000 0011 0110 0000 - - - - Divide Registers Signed 40 0101 100S SSSR DDDD N - z V Divide Registers Unsigned 37 0101 101S SSSR DDDD - - z V Enable Interrupts 3 0000 1101 0110 0000 - - - - Exchange Field Size 1 1101 01F1 OOOR DDDD - - - - Leftmost One 1 0110 101S SSSR DDDD - - z - Move Multiple Registers from Memory 2 t 0000 1001 101R DDDD - - - - Move Multiple Registers to Memory 2 t 0000 1001 100R DDDD - - - - Modulus Signed 40 0110 110S SSSR DDDD N - z V Modulus Unsigned 35 0110 111S SSSR DDDD - - z V Move Immediate (16 Bits) 2 2 0000 1001 110R DDDD N - z Move Immediate (32 Bits) 3 3 0000 1001 111R DDDD N - z Move Constant (5 Bits) 0001 10KK KKKR DDDD - - - - Multiply Registers (Signed) _ FS1 5 + — 0101 110S SSSR DDDD N - z - Multiply Registers (Unsigned) c FS1 5 + — 0101 111S SSSR DDDD - - z - Negate Register 0000 0011 101R DDDD N c z V Negate Register with Borrow 0000 0011 110R DDDD N c z V No operation 0000 0011 0000 0000 - - - - Complement Register 0000 0011 111R DDDD - - z - OR Registers 0101 010S SSSR DDDD - - z - OR Immediate (32 bits) 3 0000 1011 101R DDDD - - z - Rotate Left - Constant 0011 OOKK KKKR DDDD - c z - Rotate Left - Register 0110 100S SSSR DDDD - c z - Set Carry 0000 1101 1110 0000 - 1 - - Set Field Parameters 1,2 0000 01F1 01 FS SSSS - - - - Sign Extend to Long 3 0000 01F1 OOOR DDDD N - z - t Number of cycles depends on number of registers in list and stack alignment. See TMS34010 User's Guide (SPVU001A). Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON, TEXAS 77001 A-15 TMS34010 GRAPHICS SYSTEM PROCESSOR SLA K,Rd SLA Rs,Rd SLL K,Rd SLL Rs,Rd SRA K,Rd SRA Rs.Rd SRL K,Rd SRL Rs,Rd SUB Rs,Rd SUBB Rs,Rd SUBI IW,Rd SUBI IL,Rd SUBK K,Rd XOR Rs,Rd XORI IL,Rd ZEXT Rd,F CALL Rs CALLA Address CALLR Address DSJ Rd,Address DSJEQ Rd,Address DSJNE Rd,Address DSJS Rd.Address EMU EXGPC Rd GETPC Rd GETST Rd JAcc Address JRcc Address JRcc Address JUMP Rs POPST PUSHST PUTST Rs RETI RETS (N) REV Rd TRAP N DESCRIPTION Shift Left Arithmetic - Constant Shift Left Arithmetic - Register Shift Left Logical - Constant Shift Left Logical - Register Shift Right Arithmetic - Constant Shift Right Arithmetic - Register Shift Right Logical - Constant Shift Right Logical - Register Subtract Registers Subtract Registers with Borrow Subtract Immediate (16 Bits) Subtract Immediate (32 Bits) Subtract Immediate (5 Bits) Exclusively OR Registers Exclusively OR Immediate Value (32 Bits) Zero Extend to Long NO. IV iiNirv WORDS I CYCL 1 3 1 1 1 1 1 3 1 1 1 1 1 1 1 1 2 1 1 1 1 2 3 1 3 1 1 3 1 1 3 1 16-BIT OPCODE MSB LSB 0010 OOKK KKKR DDDD N 0110 OOOS SSSR DDDD N 0010 01 KK KKKR DDDD - 0110 001 S SSSR DDDD - 0010 10KK KKKR DDDD N 0110 01 OS SSSR DDDD N 0010 11KK KKKR DDDD - 0110 01 1S SSSR DDDD - 0100 01 OS SSSR DDDD N 0100 01 1S SSSR DDDD N 0000 1011 111R DDDD N 0000 1101 OOOR DDDD N 0001 01 KK KKKR DDDD N 0101 01 1S SSSR DDDD - 0000 1011 110D DDDD - 0000 01 F1 001 R DDDD - STATUS BITS PROGRAM CONTROL AND CONTEXT SWITCHING DESCRIPTION Call Subroutine Indirect Call Subroutine Absolute Call Subroutine Relative Decrement Register and Skip Jump Conditionally Decrement Register and Skip Jump Conditionally Decrement Register and Skip Jump Decrement Register and Skip Jump - Short Initiate Emulation Exchange Program Counter with Register Get Program Counter into Register Get Status Register into Register Jump Absolute Conditional Jump Relative Conditional Jump Relative Conditional - Short Jump Indirect Pop Status Register from Stack Push Status Register onto Stack Copy Register into Status Return from Interrupt Return from Subroutine Get Revision Number Software Interrupt NO. MINIMUM STATUS WORDS CYCLES* 16-BIT OPCODE BITS MSB LSB 1 6 0000 1001 001 R DDDD - - - - 3 6 0000 1101 0101 1111 - - - - 2 5 0000 1101 0011 1111 - - - - 2 3,2 0000 1101 100R DDDD - - - - 2 3,2 0000 1101 101R DDDD - - - - 2 3,2 0000 1101 110R DDDD - - - - 1 2,3 0011 1Dxx xxxR DDDD - - - - 1 6 0000 0001 0000 0000 - - - - 1 2 0000 0001 001 R DDDD - - - - 1 1 0000 0001 010R DDDD - - - - 1 1 0000 0001 100R DDDD - - - - 3 3,4 1100 code 1000 0000 - - - - 2 3,2 1100 code 0000 0000 - - - - 1 2,1 1100 code xxxx xxxx - - - - 1 2 0000 0001 011R DDDD - - - - 1 8 0000 0001 1100 0000 - - - - 1 2 0000 0001 1110 0000 - - - - 1 3 0000 0001 101R DDDD N C z V 1 11 0000 1001 0100 0000 N c z V 1 7 0000 1001 011N NNNN - - - - 1 1 0000 0000 001 R DDDD - - - - 1 16 0000 1001 OOON NNNN '''Where two numbers appear, the first number assumes that the jump is taken, and the second assumes that the jump is not taken. A-16 Texas ,| ^» Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR development systems and software support Texas Instruments, together with third party suppliers, offers a full range of hardware and software development tools for the TMS34010. The support environment is aimed at four areas of support with the key tools based on the IBM PC, DEC VAX, SUN, MAC II, APOLLO and Tl Professional computers: DESIGNER TOOLS Hardware XDS-22 Real Time Emulator (with PC-based Debugger Interface) PC Software Development Board (with Debugger Interface) Software Assembly Language Package, including: Assembler, Linker, Archiver, ROM Object Format Converter , Software Simulator (PC only) Graphics/Math Function Library Bit-Mapped Font Library CCITT Data Compression/Decompression Function Library 851 4A Emulation Function Library Languages C Compiler Package including: TMS34010 C Compiler Runtime Support Systems Window Management Support Image Processing Support Graphics Interfaces and Standards Debugger Adaptation Software Further support is provided through a network of Regional Technology Centers (RTCs). Texas ^» Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-17 TMS34010 GRAPHICS SYSTEM PROCESSOR TMS340 FAMILY HARDWARE AND SOFTWARE SUPPORT SILICON Graphics System Processor 68-Pin PLCC Video System Controller 68-Pin PLCC Color Palette 22-Pin DIP 64Kx1 Multiport Memory 22-Lead PLCC 1120 and 150 ns) 64Kx1 Multiport Memory 22-Pin DIP (120 and 150 ns) 64Kx4 Multiport Memory 24-Pin DIP (120 and 150 ns) SOFTWARE TOOLS TMS34010 Assembler Package: Assembler, Linker, Archiver, Object Format Converter, Simulator TMS34010 Assembler Package: Assembler, Linker, Archiver, Object Format Converter TMS34010 C Compiler Package Combination packages: Assembler, Linker, Archiver, Object Format Converter, Simulator, C Compiler with runtime support TMS34010 Graphics/Math Function Library TMS34010 Bit-Mapped Font Library TMS34010 CCITT Function Library TMS34010 PC Debugger Development Package (For Internal Use) TMS34010 PC Debuffer Development Package (For Resale) HARDWARE TOOLS TMS34010 XDS-22 Real-Time Emulator with BT&T Color Graphics Controller Board (TMS34061, TMS34070) TMS34010 Software Development Board PART NUMBER TMS34010FNL TMS34061FNL TMS34070NL TMS4161FML TMS4161NL TMS4461NL OPERATING COMPUTER SYSTEM PART NUMBER IBM/TI PC MS-DOS 2.11 + TMDS3440808002 VAX VMS TMDS3440200059 VAX ULTRIX TMDS3440200069 VAX System V TMDS3440200089 HP System V TMDS3440500089 Sun System V TMDS3440550086 Mac 11 MPW TMDS3440560021 Apollo System V TMDS3440570088 IBM/TI PC MS-DOS 2.11 + TMDS3440805002 VAX VMS TMDS3440205059 VAX ULTRIX TMDS3440205069 VAX System V TMDS3440205089 HP System V TMDS3440505089 Sun System V TMDS3440555086 Mac II MPW TMDS3440565021 Apollo System V TMDS3440575088 IBM/TI PC MS-DOS 2.11 + TMDS3440804003 IBM/TI PC - Source TMDS3440802202 VAX - Source TMDS3440802208 IBM/TI PC MS-DOS 2.11 + TMDS3440802302 VAX ALL TMDS3440202308 IBM/TI PC MS-DOS 2.11 + TMDS3440802102 VAX All TMDS3440202108 851 4/A Emulation LibraHyVIDS- IBM/TIPC, MS-DOS 2.11 + 3440 8020 02 IBM/TI PC MS-DOS 2.11 + TMDS3440806002 IBM/TI PC MS-DOS 2.11 + TMDS3440806003 COMPUTER VERSION PART NUMBER U.S. TMDS3469910000 Europe TMDS3469981000 IBM/TI PC TMDS347 1804000 IBM/TI PC TMDS34 11804420 DESIGN KITS TMS340 Graphics Design Kit, including TMS34061, TMS34070, TMS4161s TMS34010 Graphics Design Kit, including TMS34010, TMS34070, TMS4461s, PC Assembler PART NUMBER TMS340GDK TMS34010GDK A-18 Texas *^* Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR reset Reset puts the TM S34010 into a known initial state. It is entered when the input signal at the RESET pin is asserted low. RESET must remain active low for a minimum of 40 local clock (LCLK1 and LCLK2) periods to ensure that the TMS34010 has sufficient time to establish its initial internal state. While RESET remains asserted, all outputs are in a known state, no DRAM-refresh cycles take place, and no screen-refresh cycles are performed. At the low-to-high transition of the RESET signal, the state of the HCS input determines whether the TMS34010 will be halted or begin executing instructions. The TMS34010 may be in one of two modes, host-present or self-bootstrap mode. 1 . Host-Present Mode If HCS is high at the end of reset, TMS34010 instruction execution is halted and remains halted until the host clears the HLT (halt) bit in HSTCTL (host control register). Following reset, the eight RAS-only refresh cycles required to initialize the dynami c RA Ms are performed automatically by the TMS34010 memory control logic. As soon as the eight RAS-only cycles are completed, the host is allowed access to TMS3401 memory. At this time, the TMS3401 begins to automatically perform DRAM refresh cycles at regular intervals. The TMS34010 remains halted until the host clears the HLT bit. Only then does the GSP fetch the level-0 vector address from location OFFFFFFEOh and begin executing its reset service routine. 2. Self-Bootstrap Mode If HCS is low at the end of reset, the TMS34010 first performs the eight RAS-only refresh cycles required to initialize the DRAMs. Immediately following the eight RAS-only cycles, the TMS34010 fetches the level-0 vector address from location OFFFFFFEOh, and begins executing its reset service routine. Unlike other interrupts and software traps, reset does not save previous ST or PC values. This is because the value of the stack pointer just before a reset is generally not valid, and saving its value on the stack is unnecessary. A TRAP instruction, which uses the same vector address as reset, similarly does not save the ST or PC values. asserting reset A r eset is in itiated by asserting the RESET input pin at its active-low level. To reset the TMS3401 at power up, RESET must remain active low for a minimum of 40 local clock periods after power levels have become stable. At times other than power up, the TMS34010 is also reset by holding RESET low for a minimum of 40 clock perio ds. The 40-clock interval is required to bring TMS34010 internal circuitry to a known initial state. While RESET remains asserted, the output and bidirectional signals are driven to a known state. The TMS34010 drives its RAS signal inactive high as long as RESET remains low. The specifications for cer tain D RAM and VRAM devices, including the TMS41 61, TMS4164 and TMS4464 d evices, require that the RAS signal be driven inacti ve-hig h for 1 00 microseconds during system reset. Holding RESET low for 1 50 microseconds will cause the RAS signal to remain high for the 100 microseconds required to bring the memory devices to their initial sta tes. DR AMs such as the TMS4256 specify an initial RAS high time of 200 microseconds, requiring that RE SET b e held low for 250 microseconds. In general, holding RESET low for f microseconds ensures that RAS remains high initially for r-50 microseconds. Texas ^r A19 Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR suspension of DRAM-refresh cycles during reset An active-low l evel at the RESET pin is considered to be a power-up condition, and DRAM refresh is not performed until RESET goes inactive high. Consequently, the previous contents of the local memory may not be valid after a reset. initial state following reset While the RESET pin is asserted low, the TMS3401 0's output and bidirectional pins are forced to the states listed below. INITIAL STATE OF PINS FOLLOWING A RESET OUTPUTS DRIVEN TO HIGH LEVEL OUTPUTS DRIVEN TO LOW LEVEL BIDIRECTIONAL PINS DRIVEN TO HIGH IMPEDANCE DDOUT HRDY DEN LAL TR/QE RAS CAS W HINT BLANK HSYNC VSYNC HD0-HD15 LAD0-LAD15 HLDA/EMUA Immediately following reset, all I/O registers are cleared (set to Oh ), with the possible exception of the HLT bit in t he HST CTL register. The HLT bit is set to 1 if HCS is high just prior to the low-to-high transition of RESET. Just prior to execution of the first instruction in the reset routine, the TMS34010's internal registers are in the following state: • General-purpose register files A and B are uninitialized. • The ST is set to 0000001 Oh. • The PC contains the 32-bit vector fetched from memory address OFFFFFFEOh. TMS34010 local memory interface The TMS34010 local memory interface consists of a triple-multiplexed address/data bus on which row addresses, column addresses, and data are transmitted. The associated memory control signals support direct interfacing to both DRAMs and VRAMs. At the beginning of a typical memory cycle, the address is output in multiplexed fashion as a row address followed by a column address. The remainder of the cycle is used to transfer data between the TMS34010 and memory. A-20 Texas ^» Instruments POST OFFICE BOX 1443 • HOUSTON, TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR TMS34010 local memory interface The TMS34010 local memory interface consists of a triple-multiplexed address/data bus on which row addresses, column addresses, and data are transmitted. The associated memory control signals support direct interfacing to both DRAMs and VRAMs. At the beginning of a typical memory cycle, the address is output in multiplexed fashion as a row address followed by a column address. The remainder of the cycle is used to transfer data between the TMS34010 and memory. TMS34010 32-BIT MEMORY ADDRESS r t BIT 31 (MSB) RF = jAQ = TR = 16-BIT DATA WORD BIT (LSB) BIT 15 (MSB) BITO (LSB) DRAM-REFRESH BUS STATUS BIT INSTRUCTION ACQUISITION BUS STATUS BIT VRAM SHIFT-REGISTER-TRANSFER BUS STATUS BIT FIGURE 7. TRIPLE MULTIPLEXING OF ADDRESSES AND DATA The following types of me mory cycles are supported: re ad, w rite, VR AM m emory-to-shift-register, VRAM shift-register-to-memory, RAS-only DRAM refresh and CAS-before-RAS DRAM refresh. The functional timing for these cycles is shown in the next six figures. Each memory cycle is a minimum of two machine states (a state is one local clock period) in duration. The seventh figure indicates the timing signals output during an internal cycle, i.e., a cycle during which no memory access takes place. An internal cycle is one state in duration. During a memory cycle, the row address, column address, and data are transmitted over the same physical bus lines. The manner in which logical addresses are output at the memory interface makes external multiplexing hardware unnecessary, while supporting a wide variety of memory configurations. For example, in Figure 7, 16 consecutive address bits (5 through 20) are output on LAD1-LAD8 during the row and column address times. Output along with the address are bus status signals that indicate when DRAM refresh cycles, screen refresh (VRAM memory-to-shift-register) cycles, and instruction fetch cycles are occurring. Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-21 TMS34010 GRAPHICS SYSTEM PROCESSOR The following remarks apply to memory timing in general. A row a ddress is output on LADO-LAD15 at the start of the cycle, and is valid before and after the fall of RAS. Next a column addre ss is output on LADO-LAD1 5. The colum n add ress is valid briefly before and after the falling edge of LAL, but is not valid at the falling edge of CAS. The column address i s clo cked into an external transparent latch (e.g., a 74AS373 octal latch) on the falling edge of LAL to provide the hold time on the column address required for dynamic RAMs and video RAMs. A transparent latch is required in order that the row address be available at the outputs of the latch during the start of the cycle. Very large memory configurations may require external buffering of data lines. The DEN signal serves as the drive-enable signal to external bidirectional buffers, e.g., 74AS245 octal buffers. The DDOUT signal serves as the direction control for the buffers. When an I/O register is addres sed b y the TMS34010, a special memory read or write cycle is performed. During this cycle, the external RAS signal falls, but the external CAS remains inactive-high for the duration of the cycle. The timing shown in the first six functional timing diagrams assumes that the LRDY input remains high during the cycle. The LRDY pin is pulled low by slower memories requiring a longer cycle time. The TMS34010 samples the LRDY input at the end of Q1, as indicated in the figures. If LRDY is low, the TMS34010 inserts an additional state, called a "wait" state, into the cycle. Wait states continue to be inserted until LRDY is sampled at a high level. The cycle then completes in the manner indicated in the functional timing diagrams. A wait state is one local clock period in duration. Three additional timing diagrams provide examples of cycles extended by wait states. The LRDY input is ignored by the TMS34010 during internal cycles. A hold/hold acknowledge capability is also built into the local memory interface to allow external devices to request control of the bus. After acknowledging a hold request, the TMS34010 releases the bus by driving its address/data bus and control outputs into high impedance. A-22 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON, TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR write cycle timing Q1 j Q2 I Q3 j Q4 j Q1 I Q2 j Q3 I Q4 I ! I I ! I ! 1 Q1 j I I LCLK1 / I K i ! V \ K \ i i j i i i ! i j i > ill i i i iii i ! i LCLK2 V i Ki i i/ M I | iii | i iii I I ! I i i ! i ! i ! i LAD0-LAD15 X bow X col X data X RAS i k i i i i i y\ i i i i i i i r i LAL / i ! i ki i i i ! / i r j j "j" j j r j CAS i i I i K i i i V \ ' ! ' ! L ! ! ' j W i ; iii K i \ y i ' ■ ^^^i^^^^ ' TR/QE DEN V | ! | k i ! i i \f~ DDOUT —l 7 I 1 I 1 I 1 1 I Texas "^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-23 TMS34010 GRAPHICS SYSTEM PROCESSOR read cycle timing Y LAD0-LAD15 V V Y i V \ K Q3 Q4 I Q1 I iv X -(HIGH)- K Y > \ K Y k !v \ N < / / > V V V Q1 ! V c A-24 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR memory-to-register cycle timing V LAD0-LAD15 7 !y V X k k 7 7 Q4 I Q1 I I i\ 7- Y -(HIGH)- K X N. lv V Q4 I Q1 V ¥ V V Y V yz Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-25 TMS34010 GRAPHICS SYSTEM PROCESSOR register-to-memory cycle timing Y LAD0-LAD15 RAS V V \ V V K K Q4 | Q1 K X i\ V Y X V V K K UNDEFINED / V Q4 | Q1 Y V V *= A-26 Texas ^» Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR RAS-only DRAM refresh cycle timing 1 i 1 i i 1 i 1 1 i | 0.1 0.2 | Q3 Q4 Q1 | Q2 Q3 | Q4 | Q1 j 1 [J | ' j | ""'/ i K j j V ! |\ ! j 1/ j r < i > i r < ■ i ii < > i ii -i V \ Ki | V \ Ki i y i | i ii! ' i ' ! ' i i l ' l ' ' ' ' ! i ! i M.AD15 | V ROW V UNDEFINED V I f j 'I 1 i ' i'i ' I I I III I I l|l | "i i i\ i i i i i V\ i i i i i ill i i i|i i • i i iii i i iii i ■=!/ I i ! M ! ! I I !/ i I I I III I I III I I I I III I I III I I ' III I III I CAS I | I III I I I | I | I I I III I I III I I I I III I I III I I ' ill I III I w i I i ill i i i i i i i i i ill i i iii i i i I ill i i ill i i i ' i i i i i i i i TR/QE I | I I I I I I I I I I I I I III I I l|l | I I I III I I l|l | I I i ' j ' ' I ' DEN | !/ ' I'I I I I I I I I II !'l I ! Ill I I | I ' ' ' ' ' DDOUT | | / | I I I I I I | I | ! i! ! i ! I ! Ill ! i i i iii i i iii i Texas ^* Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-27 TMS34010 GRAPHICS SYSTEM PROCESSOR CAS-before-RAS refresh cycle timing I Q1 j Q2 I Q3 Q4 J Q1 I Q2 j Q3 | Q4 ' ! ' ! Q1 j LCLK1 / | \ ! V i \ \ \ I j I 1 i i i | I i LCLK2 j \J j \| | V \ K| j I I ! ! i ! i ! i ! LAD0-LAD15 I V ROW V UNDEFINED V ii | i i | RAS | | I \i 1 j i W ii i i r i «|/ | k_, / I r j ' ii i i I CAS j l\ | i ! j I \\f DEN I |/ I DDOUT I | / j A-28 Texas y ^* Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR internal cycles back to back V LCLK2 LAD0-LAD15 7 TR/QE Q2 K V X I I ■!>!!■! iii LCLK2 J \J "~K ■ / k i !/ 1 |\ i v I r I i i i l — r f I ; LAD0-LAD7 j V i /icvyyvvvvs ^Q^^_ \AjU\syyvvv i r RAS I | i h i i i i i LAL _j/ j "T^ i | V \ CAS j | i L ! \\ ! S 1 i I TR/QE | I j 1 ! i I ! A I K\ \ \ i i i i DEN | j/ i 1 i ! i /j i DDOUT J j / 1 k i i ' V~ i 1 i i ! LRDY OXXXXX DON'T CARE >OcW<^ XXXXXXaaaaaaaaAXXXXXA ^*^ W™M Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-31 TMS34010 GRAPHICS SYSTEM PROCESSOR register-to-memory cycle with one wait state - WAIT ST ATE - Q1 | Q2 | Q3 | Q4 | Q1 Q2 | Q3 | Q4 | Q1 Q2 | Q3 I Q4 | Q1 | Q2 LCLK2 CAS i ' ' | Y ROW ii i i i i \XjTT VcolV undefined \f \ 1 1 1 1 1 1 I i L J/ \ \ -V i ! "Xl i i ! i i \ y \ ^^ i 1 1 1 1 1 1 1 j ! I i * ^i ! i ! i i A i 1 /\\\\\\ i K i i ! 1/ i i i 4-h 1 V ! MwMm^\mmw mm^m A-32 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR absolute maximum ratings over operating free-air temperature range + Supply voltage, Vcc 7 V Input voltage range -0.3 V to 20 V Off-state output voltage range -2Vto7V Operating free-air temperature range 0°C to 70 °C Storage temperature range - 10°C to 1 50 °C f Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only. Functional operation of the device at these or any other conditions beyond those indicated in the "Recommended Operating Conditions" section of this specification is not implied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability. Voltage values are with respect to the Vss pi ns of tne chip. recommended operating conditions MIN NOM MAX UNIT V CC Supply voltage 4.75 5.0 5.25 V Vss Supply voltage* V 'OH High-level output current -400 lib. 'OL Low-level output current 2.0* mA Ta Operating free-air temperature 70 °C *Care should be taken by card designers to provide a minimum inductance path between the Vss P' ns ant ^ system ground in order to minimize Vss rioise. ^Output current of 2.0 mA is sufficient to drive five low-power Schottky TTL loads or 1 advanced low-power Schottky TTL loads (worst case). DC electrical characteristics PARAMETER TEST CONDITIONS MIN* TYP* MAX* UNIT High-level input Vm§ voltage, TTL-level signal All inputs except INCLK V CC = 5.0 V 2.2 Vcc + 0.3 V INCLK 3.0 Vcc + 0.3 Low-level input V||_ voltage, TTL-level signal All inputs except INCLK -0.3 0.8 V INCLK -0.3 0.8 High-level output voltage, 0H TTL-level signal V CC = m ' n ' Iqh = max ' 2.6 V Low-level output voltage, Vol TTL-level signal Vcc = max ' 'OL = rnax. 0.6 V High-impedance leakage current, bidirectional pins Vcc = max V = 2.8 V 20 ^A Vq = 0.6 V -20 l| Input current All inputs except RUN/EMU5 v l=Vss to V CC ±20 /•A 'CC Supply current Vcc = max < 40 MHz 125 mA Vcc = max, 50 MHz 150 Vcc = max ' 60 MHz 175 C| Input capacitance 10 PF Output capacitance (except Cn address/data lines) 10 pF g CC o LU o z 1 < *For conditions shown as "min" or "max," use the appropriate value specified under "Recommended Operating Conditions.' * All typical values are at Vcc = 5 V, Ta = 25°C. ^RUN/EMU will be no-connected in a typical configuration. The nominal pull-up current will be 250 >tA. ADVANCE INFORMATION concerns new products in the sampling or preproduction phase of development. Characteristic data and other specifications are subject to change without notice. Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-33 TMS34010 GRAPHICS SYSTEM PROCESSOR ADVANCE INFORMATION NOTE Advance information notices apply only to the TMS340 10-60. signal transition levels ._ 2.6 V \ 2.0 V -V--0.8 V ^ 0.6 V > I z o m O 30 FIGURE 8. TTL-LEVEL OUTPUTS TTL-level outputs are driven to a minimum logic-high level of 2.6 volts and to a maximum logic-low level of 0.6 volts. Output transition times are specified as follows. For a high-to-low transition on a TTL-compatible output signal, the level at which the output is said to be "no longer high" is 2.0 volts, and the level at which the output is said to be "low" is 0.8 volts. For a low-to-high transition, the level at which the output is said to be "no longer low" is 0.8 volts, and the level at which the output is said to be "high" is 2.0 volts. 2.2 v .0.8 V FIGURE 9. TTL-LEVEL INPUTS Transition times for TTL-compatible inputs are specified as follows. For a high-to-low transition on an input signal, the level at which the input is said to be "no longer high" is 2.2 volts, and the level at which the input is said to be "low" is 0.8 volts. For a low-to-high transition on an input signal, the level at which the input is said to be "no longer low" is 0.8 volts, and the level at which the input is said to be "high" is 2.2 volts. fe test measurement TZ The test load circuit shown in Figure 10 represents the programmable load of the tester pin electronics, 2s which are used to verify timing parameters of TMS34010 output signals. TESTER PIN ELECTRONICS VLOAD o I Where: lOL = 2.0 mA DC level verification (all outputs) 'OH = 400 /iA (all outputs) VLOAD = 1.5 V DC level verification 0.7 V Timing verification Cj = 65 pF typical load circuit capacitance FIGURE 10. TEST LOAD CIRCUIT A-34 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR timing parameter symbology Timing parameter symbols have been created in accordance with JEDEC Standard 1 00. In order to shorten the symbols, some of the pin names and other related terminology have been abbreviated as follows: AL C CA CK CK1 CK2 CS D DD EN F HK HR LAL CAS Column address LCLK1 and LCLK2 LCLK1 LCLK 2 HCS Data DDOUT DEN HFSO, HFS1 HLDA /EMUA HOLD HS HSYNC or VSYNC ICK INCLK LR LRDY QE TR/QE, when used as output enable R RAS RA Row address RS HREAD RY HRDY S HREAD or HWRITE TR TR/QE, when used as shift register enable VCK VCLK W W WS HWRITE Lowercase subscripts and their meaning are: a access time c cycle time (period) d delay time h hold time su setup time t transition time w pulse duration (width) The following additional letters and symbols and their meaning are: High Low Valid High impedance No longer low No longer high Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-35 TMS34010 GRAPHICS SYSTEM PROCESSOR ADVANCE INFORMATION > I Z o m O J3 O host interface timing parameters The timing parameters for host interface signals are shown in the next four figures. The purpose of these figures and the accompanying table is to quantify the timing relationships among the various signals. The explanation of the logical relationships among signals will be found in the TMS34010 User's Guide (number SPVU001A). The write stobe referred to in the following table is the enabling signal during a write to one of the host interface registers (see comment 2 on the next page). Similarly, the read strobe is the enabling signal during a read. Quarter clock time tQ, which appears in the following table, is one quarter of a local output clock period, or twice the input clock period, t C (|CK)- NO. PARAMETER TMS340 10-40 TMS340 10-50 TMS340 10-60 UNIT MIN MAX MIN MAX 1 10 10 ns Setup time of HWRITE/HREAD high or HFSO, su(FV-SL) HFS1 va|jd tQ read or wrjte strobel 2 tdlWSL-DV) Delay from write strobe i to data in valid, write cycle 2tQ 2tQ ns 3 Delay from read or write strobe low to next d(SL-SL) rea(j Qr Wfjte strobei 7t Q +10 7t Q +10 ns 4 twISL) Duration of read or write strobe low 80 80 ns 5 Delay from read or write strobe high to next td(SH-SL) read Qr wrjte strobei 60 60 ns 6 thIWSH-DV) Hold time of data in valid after write strobe high, write cycle 10 10 ns 7 10 10 ns Hold time of HWRITE/HREAD high or HFSO, th(SH-FV) HFS1 va|jd gfter regd Qr wrjte strobe high 8 Hold time of data high impedance after read strobei, th < RSL " DZ > read cycle 0§ 0§ ns 9 Delay from read strobe low to data out valid, td(RSL-DV) regd cyc|e wjth no wajt 90 90 ns 10 thIRSH-DV) Hold ^ me °f data out valid after read strobet, read cycle ns 11 Delay from read strobe high to data out high impedance, td(RSH-DZ) readcyc|e 30 § 30 5 ns 12 t n (CSL-RYH) Hold time of HRDY high after HCSI, cycle with wait ns 13 tdlCSL-RYL) Delay from HCS low to HRDY low, cycle with wait 40 40 ns 14 tw(RYL) Pulse duration of HRDY low, cycle with wait t t ns 15 td(RYL-RYH) Delay from HRDY-t to HRDY high, cycle with wait 0* 0* ns 16 Hold time of write strobe low after HRDYT, th(RYH-WSL) wrjte cyc|e wjth wajt 40 40 ns 17 td(RYH-DV) Delay from HRDYT to data out valid, read cycle with wait 40 40 ns 18 Hold time of read strobe low after HRDYT, th(RYH-RSL) regd cyc|e wjth wajt 40 40 ns NOTE: Advance information notices apply only to the TMS340 10-60. t Parameter 1 4 is a function of local bus memory contention. This parameter is not tested. Refer to the TMS34010 User's Guide for details. ^Parameter 1 5 is specified as minimum ns to indicate that a low-going pulse on HRDY can be arbitrarily narrow. §These values are derived from characterization and are not tested. A-36 Texas *^* Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR general comments on host interface timing The following general comments apply to host interface timing: 1. The HRDY signal is enabled by an active-low level on the HCS input. When HCS is inactive-high, HRD Y is forced high regardless of the internal state of the device. Low-going transient pulses on HCS may result in low-going transient pulses on HRDY, but otherwise have no effect unless accompanied by active levels on other control signals. 2. A host interf ace w rite cycle occurs when HCS, HWRITE, and HLDS are low, or when HCS, HWRITE, and HUDS are low. The combination of these signals defines a write strobe. In either case, the last of the three signals to make the high-to-low transition is the strobe (write strobe) that begins the cycle. The first of the three signals to make the low -to-h igh tra nsition ends the c ycle. Similarly , a host inte rface read cycle occurs when HCS, HREAD, and HLDS are low, or when HCS, HREAD, and HUDS are low. The combination at these signals define a read strobe. In either case, the last of the three signals to make the high-to-low transition is the strobe (read strobe) that begins the cycle. The first of the three signals to make the low-to-high transition ends the cycle. All access times are specified with respect to the strobing edges that begin and end the cycle. 3. During a host interface read or write, HWRITE and HREAD must not be active-low simultaneously. 4. Host interface input signals HCS, HUDS, HLDS, HFSO, HFS1, HREAD, and HWRITE are assumed to be asynchronous with respect to the output clocks LCLK1 and LCLK2. host interface timing: write cycle with no wait HFSO, HFS1 5C VALID FUNCTION SELECT ^ I M- HCS. H WRITE , HLDS, HDDS ! C Ti /* — * — -\. I-2- VALID DATA IN . Texas ^r Instruments aj/ POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR host interface timing: read cycle with no wait HFSO, HFS1 VALID FUNCTION SELECT HCS, HREAD , HLDS. HUDS HD0-HD15 I I I LT — " -**< X 34- lsi /: -h (*-ii*j VALID DATA OUT > X host interface timing: write cycle with wait HFSO. HFS1 $&c VALID FUNCTION SELECT wm 1* »l 1 I j«*-7-H HREAD _/ I 1 \ I*- 1 -"H \ .- I IM- =r> — * ' HWRITE. HLDS. HUDS ! L ^LJ^- 1 »: ic i ■■' HCS ft 4 :3r k_ I r*- — M-13 ■J I J N — ft —14 — N *• i I i HRDY I I I I h»-2 i i i i H — M-6 1 i HD0-HD15 MMMZ VALID DATA IN mm A-38 Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR host interface timing: read cycle with wait HFSO. HFS1 $£L VALID FUNCTION SELECT mm i N-1 I -■J I U— 7 — 1 i i 3£ 1: I I 1 1 U— 7 — 1 ?. HWRITE -3 M I — 4 "*U 5 _^V_ HREAD HLDS. HUDS 1 U- -3 ;i HCS i r^ n — 4 i 2-N — i — 1 — 1 1 1 1 r*— — fc+-13 fm 18- 1 1 i - HRDY ( 1 1 1 1 1 1 1 \* H - ! il i 1 r B »| n hH-17-l «i ooowwwm- VALID "W DATA OUT Jf. % ttm ywm Texas ^» Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-39 TMS34010 GRAPHICS SYSTEM PROCESSOR ADVANCE INFORMATION reset timing > I z o m O 30 The timing parameters for device reset are show n in the next t wo figures. The pur pose of thes e figu res is to quantify the timing relationships among the RESET, HCS, and LCLK1 signals. RESET and HCS are asynchronous inputs that are internally synchronized by latches internal to the TMS34010. The timing relationships specified for these signals relative to LCLK1 need be met only to guarantee recognition of a transition of one of these signals at a particular clock edge. The explanation of the logical relationships among signals will be found in the TMS34010 User's Guide. Quarter clock time tQ which appears in the following table, is one quarter of a local output clock period, or twice the input clock period, t c (iCK)- NO. PARAMETER TMS340 10-40 TMS340 10-50 TMS340 10-60 UNIT MIN MAX MIN MAX 19 Duration of HCS low to configure GSP to run wl ' in self-bootstrap mode 4tQ + 55 4tQ + 55 ns 20 8tQ + 55 8tQ + 55 ns Setup time of HCS low to RESETt to configure tsulCSL-REH) the GSp t() mn jn self . b00tstrap mode 21 160tQ-40 160t Q -40 ns Duration of RESET low to ensure that GSP w(REL) is properly reset 22 4tQ-50 t 410-50* ns Delay from HCST to RESET high, end of reset, d(CSH-REH) tQ con f jgure GSP t0 run in self-bootstrap mode 23 40* 40* ns Setup time of RESET valid to LCLKU to " guarantee recognition at a particular clock edge 24 10* 10* ns Hold time of RESET valid after LCLK1 low to guarantee recognition at a particular clock edge 25 Setup time of HCS valid to LCLK1 1 to - guarantee recognition at a particular clock edge 40* 40* ns 26 Hold time of HCS valid after LCLK1 low to th(CKIL-CSV) guarantee recognition at a particular clock edge 10* 10* ns NOTE: Advance information notices apply only to the TMS34010-60. * Parameter 22 is the maximum amount by which the RESET low-to-high transition can be delayed after the HCS low-to-high transition and still guarantee that the GSP is configured to run in self-bootstrap mode (HLT bit = 0) following the end of reset. HCS may be held low for some time past the low-to-high RESET transition, and will be ignored by the GSP for 1 7 local clock periods following the clock edge at which the low-to-high RESET transition is detected. Following completion of the eight RAS-only cycles that automatically follow reset, however, a low HCS level will be interpreted as a chip select. * RESET and HCS are asynchronous inputs. The specified setup and hold times of these signals with respect to the high-to-low transition of LCLK1 need be met only to guarantee that a transition of RESET or HCS is detected by the device at a particular clock edge. reset: asynchronous timing relationships \ £ \r IT A-40 Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 ADVANCE INFORMATION TMS34010 GRAPHICS SYSTEM PROCESSOR reset: synchronous timing relationships LCLK1 RESET* HCS* \ 23-p- H I I ' !- -4-24 x vALD y T~X 26-j-i H | |- -4-26 x vali ° y ^RESET and HCS are asynchronous inputs. The specified setup and hold times of RESET or HCS with respect to the high-to-low LCLK1 transition must be met only to guarantee that a RESET or HCS transition is detected by the device at a particular clock edge. local bus timing parameters The following six figures show the timing parameters for the signals of the local memory interface bus, often simply referred to as the local bus. The purpose of these figures and the accompanying tables is to quantify the timing relationships among the various signals. The explanation of the logical relationships among signals will be found in the TMS34010 User's Guide (number SPVU001). A number of parameter values are expressed in terms of quarter clock time tQ, which is one quarter of a local clock period, or twice the input clock period, t c (|CK)- Input clock INCLK is divided internally by 8 to produce output clocks LCLK1 and LCLK2. Transitions of the other local interface output signals are also generated as delays from INCLK transitions. The divide- down logic that converts INCLK to the internal clocks used to generate LCLK1 and LCLK2 introduces significant propagation delays from the transitions of INCLK to the corresponding transitions of LCLK1 and LCLK2. While the frequency of INCLK is precisely eight times the frequency of LCLK1 or LCLK2, no timing relationship other than the frequency is specified between transitions of input clock INCLK and transitions of the output clocks LCLK1 and LCLK2. NO. PARAMETER TMS340 10-40 TMS340 10-50 TMS340 10-60 UNIT MIN MAX MIN MAX MIN MAX 27 tcdCK) Period of INCLK 25 62.5 20 62.5 16.5 62.5 ns 28 tw(ICKH) Pulse duration of INCLK high 8* 8* 6.5* ns 29 twOCKL) Pulse duration of INCLK low 8* 8* 6.5* ns 30 tt(ICK) Transition time (rise and fall) of INCLK 2t 8t 2* 8 + 2* 8t ns g O LU O z 1 < NOTE: Advance information notices apply only to the TMS34010-60. *These values are based on computer simulation and are not tested. *This pulse width is tested at 1 .4 volts. local bus timing: input clock Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-41 TMS34010 GRAPHICS SYSTEM PROCESSOR ADVANCE INFORMATION > Z O m -n O local bus timing parameters (continued) Quarter clock time tQ, which appears in the following table, is one quarter of a local output clock period, or 2t c (|CK)- NO. PARAMETER TMS340 10-40 TMS340 10-50 TMS340 10-60 UNIT MIN MAX MIN MAX 31 tc(CK) Period of local clocks LCLK1 and LCLK2 StcdCK) 1 StcdCK) 1 ns 32 tw(CKH) Pulse duration of local clock high 2t Q -10 2t Q -10 ns 33 tw(CKL) Pulse duration of local clock low 2t Q -10 2t Q -10 ns 34 t h(CK1H-CK2L) Hold time of LCLK2 low after LCLK1 high tQ-10 tQ-10 ns 35 t h(CK1L-CK2H) Hold time of LCLK2 high after LCLK1 low tQ-10 tQ-10 ns 36 t h(CK2H-CK1H) Hold time of LCLK1 high after LCLK2 high tQ-10 tQ-10 ns 37 t h(CK2L-CK1L) Hold time of LCLK1 low after LCLK2 low tQ-10 tQ-10 ns 38 t h(CK1H-CK2H) Hold time of LCLK2 high after LCLK1 high 3tQ-10 3tQ-10 ns 39 t h(CK1L-CK2U Hold time of LCLK2 low after LCLK1 low 3t Q -10 3tQ-10 ns 40 t h(CK2H-CK1L) Hold tim e of LCLK1 low after LCLK2 high 3t Q -10 3t Q -10 ns 41 t h(CK2L-CK1H) Hold tirr, e of LCLK1 high after LCLK2 low 3t Q -10 3tQ-10 ns 42 t t Transition time (rise and fall) of LCLK1 or LCLK2 10 10 ns 43 t su(RAV-CK2H) Setup time of row address valid to LCLK2T 4t Q -25 4tQ-15 ns 44 t su(CAV-CK2H) Setup time of column address valid to LCLK2T 2t Q -25 2t Q -15 ns 45 t su(LRV-CK2H) Setup time of LRDY valid to LCLK2T 30* 30* ns 46 t h(CK2H-LRV) Hold time of LRDY v a |id after LCLK2 high 0* 0* ns 47 tsu(RAV-CKIL) Setup time of row address valid to LCLKU tQ-25 tQ-15 ns 48 tsu(CAV-CKIH) Setup time of column address valid to LCLK1T tQ-25 tQ-15 ns 49 t su(ALH-CK1L) Setup time of LAL high to LCLK1I 2t Q -20 2t Q -10 ns NOTE: Advance information notices apply only to the TMS34010-60. T This is a functional minimum and is not tested. This parameter can also be specified as 4tQ. *LRDY is a synchronous input sampled during the low-to-high transition of LCLK2. The specified setup and hold times must be met for the device to operate properly. A-42 Texas "^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR local bus timing: output clock and LRDY signal Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-43 TMS34010 GRAPHICS SYSTEM PROCESSOR ADVANCE INFORMATION NO. PARAMETER TMS340 10-40 TMS34010-50 TMS34010-60 UNIT MIN MAX MIN MAX MIN MAX 50 td(R|_-RL) Delav Trom RASi to RASi 8t Q t 8t Q t 8t Q t ns 51 Setup time of row address tsu(RAV-RL) va||dtoBSgl tQ-20 tQ-15 tQ-15 ns 52 Hold time of row address valid th(RL-RAV) afterR AS, ow tQ-20 tQ-10 tQ-5 ns 53 tw(RH) Pulse duration, RAS high 3tQ-20 3t Q -10 3t Q -5 ns 54 tw(RL) Pulse duration, RAS low 5tQ-20 5t Q -10 5t Q -10 ns 55 Setup time of column address tsu Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-45 TMS34010 GRAPHICS SYSTEM PROCESSOR ADVANCE INFORMATION local bus timing parameters (continued) Quarter clock time tQ, which appears in the following table, is one quarter of a local output clock period, or 2t c (iCK)- > I z o m O O NO. PARAMETER TMS340 10-40 TMS34010-50 TMS34010-60 UNIT MIN MAX MIN MAX 74 Setup time of W low to RASi, shift register tsu(WL-RL) transfercycle tQ-20 tQ-10 ns 75 Hold time of W low after RAS low, shift thlRL-WL) ' ' register transfer cycle to -20 tQ-10 ns 76 Setup time of TR/QE low to RASI, shift tsulTRL-RL) register transfer cycle tQ-20 tQ-10 ns 77 Hold time of TR/QE low after RAS low, shift h(RL-TRL) register transfer cycle 4tQ-20 4tQ-10 ns 78 Hold time of TR/5E low after CAS low, shift h(C - RL) register transfer cycle 2t Q -20 2t Q -10 ns 79 Setup time of TR/QE high to RAST, shift tsu(TRH-RH) register transfer cycle tQ-20 tQ-10 ns 80 Setup time of TR/QE high to CAST, shift tsu(TRH-CH) register transfer cycle 1.5tQ-25 1.5t Q -10 ns NOTES: 1. Advance information notices apply only to the TMS34010-60. 2. Parameters 81 and 82 intentionally omitted. local bus timing parameters: shift register transfer cycle | Q1 I Q2 I Q3 I Q4 I Q1 I Q2 Q4 LADO- LAD15 RAS X ROW )GEX X \ 74— K- X 76— M M / \ \ -M-75 y 79 -K \ / / X TR/QE \ I I -M I ¥ X A-46 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 ADVANCE INFORMATION TMS34010 GRAPHICS SYSTEM PROCESSOR local bus timing parameters (continued) Quarter clock time tQ, which appears in the following table, is one quarter of a local output clock period, or 2t c (iCK)- NO. PARAMETER TMS340 10-40 TMS340 10-50 TMS340 10-60 UNIT MIN MAX MIN MAX 83 Access time from RAS low to data ta(RL-DV) jn vg|jd rea(J cyc , e 5.5tQ-40t 5.5tQ-25* ns 84 l su(CH-ALH) Setup time of CAS high to LALT 0.5tQ-15 0.5tQ-10 ns 85 tsulENH-ALH) Setup time of DEN high to LALT 0.5tQ-15 0.5tQ-10 ns 86 Access time from CAS low to data a(CL-DV) jn vg|jd regd cyc|e 3.5tQ-40 t 3.5tQ-25 t ns 87 Hold time of data in valid after CAST, th(CH - DV > read cycle ns 88 Hold time of row address high impedance after h(CH-RAZ) c -^g hjgh en(J Qf read cyc|e 1.5t Q -10* 1.5tQ-10* ns 89 Hold time of TR/QE low after CAS low, th T^¥ X -119- -105- \ }i Y — 109- ■115- ■116- J*117*-! K *P ■108- r y DDOUT / A-50 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 ADVANCE INFORMATION TMS34010 GRAPHICS SYSTEM PROCESSOR local bus timing parameters (continued) Quarter clock time tQ, which appears in the following table, is one quarter of a local output clock period, or 2t c (lCK)- NO. PARAMETER TMS340 10-40 TMS340 10-50 TMS340 10-60 UNIT MIN MAX MIN MAX 120 t su(HRV-CK2H) Setup time of HOLD valid to LCLK21 50* 40* ns 121 t h(CK2H-HRV) Ho| d tim e of HOLD valid after LCLK2 high o* 0* ns 122 tQ-20 tQ-10 ns Setup time of HLDA/EMUA output valid tsu(HKV-CK2L> befofe LCLK2 , 123 tQ-15 tQ-15 ns t h(CK2L-HKL) Hold time of HLDA/EMUA low, after LCLK2 low 124 Delay from LCLK2 high to LAD pins high td(CK2H-DZl impedance, bus release 30* 30* ns 125 tsu(RH-CKIH) Setup time of RAS high to LCLK1 1 tQ-20 tQ-10 ns 126 Hold time of RAS driven high after LCLK1 th(CKIH-RH) .. . . . high, bus release tQ-10* tQ-10* ns 127 Delay from LCLK2 high to RAS high impedance, td(CK2H-RZ) busre|ease 30* 30* ns 128 t su(ALH-CK2H) Setup time of LAL high to LCLK21 tQ-20 tQ-10 ns 129 Hold time of LAL driven high after LCLK1 1, th(CKIL-ALH) busrelease -5* -5* ns 130 Delay from LCLK1 low to LAL high impedance, td(CKIL-ALZ) busre|ease 30* 30* ns 131 Setup time of CAS, W, and TR/QE high tsu(CH-CKIH) toLCLKU 0.5t Q -15 0.5tQ-10 ns 132 Hold time of CAS, W, and TR/QE h(CK1H-CH) hjgh gfter LCLK1 high bus re | ease tQ-10* tQ-10* ns 133 Delay from LCLK2 high to CAS, W, and TR/QE td(CK2H-CZ) high impedance, bus release 30* 30* ns 134 t su(ENH-CK2H) Setup time of DEN or DDOUT high to LCLK1 1 tQ-20 tQ-10 ns 135 Hold time of DEN and DDOUT high after th(CK2H-ENH) LCLK1l , busrelease t Q -10* tQ-10* ns 136 Delay from LCLK1 low to DEN and DDOUT high impedance, bus release 30* 30* ns 137 Hold time of LAD bus high impedance th(CK2H-DZ) afterLCLK2t -5* -5* ns 138 Hold time of RAS, CAS, W, LAL, and TR/QE h(CK2H-RZ) hjgh i m pe dance after L ci_K1 1 -5* -5* ns 139 Delay from LCLK1 high to RAS, CAS, W, LAL, d(CK1H-RH) and jp/QE driven high( resume bus contro | 30 30 ns 140 Hold time of RAS high after LCLK2 high, th(CK2H-RH) resumes bus control tQ-15 tQ-10 ns 141 Hold time of CAS, W, and TR/QE high h(CK2H-CH) after LCLK2 h igh, resume bus control -5* -5* ns NOTE: Advance information notices apply only to the TMS340 10-60. *HOLD is a synchronous input sampled during the low-to-high transition of LCLK2. The specified setup and hold times must be met for the device to operation properly. *These values are derived from characterization and are not tested. Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-51 TMS34010 GRAPHICS SYSTEM PROCESSOR GSP releases control of local bus LCLK2 HLDA/EMUA LAD0-LAD15 RAS CAS,JW TR/QE DEN, DDOUT Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 y \ / k / \ X z IK ■122— ») | 123 M V 125-+* *\ z Z 124 i r i m — il / > •126 pr h-l- l l l l 4— ^i ' i i i Z r 133-|^ — »| ■ 132 T-*ii 1 I — I — i 1 Hl-Z— •■j-129 130 z ■135 H I I A-52 Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR GSP resumes control of local bus 0.3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 l"*-120-»j ' A ^ v / 7 X HLDA/EMUA LAD0-LAD15 RAS DEN, DD0UT CAS, W TR/QE 122-+* f\ 7! \ / 7 ^ J i 123 ! -I ijr- —r 142- i I I _L I, X ^c M M-140 X Jr ,38 ~H i, . 139-*||}»=J 138-H It 1 39 -Ji j Hr X Texas ^^ Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-53 TMS34010 GRAPHICS SYSTEM PROCESSOR ADVANCE INFORMATION local bus timing parameters (continued) Quarter clock time tQ, which appears in the following table, is one quarter of a local output clock cycle, or 2t c (|CK)- NO. PARAMETER TMS340 10-40 TMS340 10-50 TMS340 10-60 UNIT MIN MAX MIN MAX 142 Hold time of DEN, DDOUT high impedance th(CK2H-ENZ) gfter LCLK2 high _ resU me bus control -5t -5t ns 143 Delay from LCLK2 high to DEN, and DDOUT td(CK2H-ENH) drjven hjgh resume bus contro | 30 30 ns 144 Setup time of row address valid to RAS1, tsu(RAV-RL) CAS-before-RAS refresh 2t Q -25 2t Q -15 ns 145 Hold time of row address valid after RAS low, th(RL-RAV) CAS-before-RAS refresh to -20 tQ-10 ns > 146 Pulse duration, RAS high, start of *w(RH) CAS-before-RAS refresh 4tQ-20 4t Q -10 ns I z o m 147 Pulse duration, RAS low, CAS-before-RAS tw(RL » refresh 4t Q -20 4t Q -10 ns 148 Setup time of row address valid to LAL1, tsu(RAV-ALL) cAS. before _RAS refresh tQ-20 tQ-15 ns 149 Hold time of row address valid after LAL low, th(ALL-RAV) CAS-before-RAS refresh 2t Q -20 2t Q -10 ns Z -n 150 Hold time of RAS high after LAL low, th(ALL-RH) CAS-before-RAS refresh tQ-20 tQ-10 ns O 30 151 Setup time of RAS high to LALt, tsu(RH-ALH) CAS-before-RAS refresh tQ-20 tQ-10 ns 2 o z 152 Setup time of LAL high to CAS1, tsu(ALH-CL) CAS-before-RAS refresh tQ-20 tQ-10 ns 153 Setup time of CAS low to LALI, tsu(CL-ALL) CAS-before-RAS refresh tQ-20 tQ-10 ns 154 Setup time of RAS high to CAS1, tsu(RH-CL) CAS-before-RAS refresh 2t Q -20 2t Q -10 ns 155 Setup time of CAS low to RAS I, tsu I I— H K-168 1 ," — I z o m VCLK j{ — \ f^^Ji \ r -213- ■214- -215— H VSYNC (INPUTS) \ f (NOTE 1) (NOTE 2) NOTES: 1 . If the falling edge of the sync signal occures more than t n (sv-VCH) P ast VCLK edge A, and at least t su (sv-VCH) before edge B, the transition will be detected at edge B instead of edge A. 2. If the rising edge of the sync signal occurs more than t n (s\/-VCH) P as * VCLK edge C, and at least t su (sv-VCH) before edge D, the transition will be detected at edge D instead of edge C. o O A-60 Texas ' < ^« Instruments POST OFFICE BOX 1443 • HOUSTON, TEXAS 77001 TMS34010 GRAPHICS SYSTEM PROCESSOR 4.50 (0.177) 4,24 (0.167) 2,79 (0.110) -2,41 (0.095) 1,35 (0.053) 1.19 (0.047) MECHANICAL DATA •0.25 (0.010) R MAX IN 3 PLACES T 1,27 (0.050) T.P. (SEE NOTE B) 23.62 (0.930) 23,11 (0.910) (AT SEATING PLANE) 0,94 (0.037) 0,69 (0.027) SEATING PLANE nsrcsror™ 24.33 (0.956) 24,13 (0.950) 25,27 (0.995) (SEE NOTE A)- J 25,27 (0.995) 25,02 (0.985) 24,33 (0.956) 24,13 (0.950) (SEE NOTE A) 1,22 (0.048) 25.02 (0.985) 0, 81 (0.032) 66 (0.026) 52 (0.060) MIN 1,07 (0.042) 0,64 (0.025) MIN 0,36 (0.014) LEAD DETAIL NOTES: A. Centerline of center pin each side is within 0,10 (0.004) of package centerline as determined by this dimension. B. Location of each pin is within 0,127 (0.005) of true position with respect to center pin on each side. ALL LINEAR DIMENSIONS ARE IN MILLIMETERS AND PARENTHETICALLY IN INCHES. Texas ^« Instruments POST OFFICE BOX 1443 • HOUSTON. TEXAS 77001 A-61 Printed in U.S.A. SPVS002B Appendix B System Design Considerations Please read these emulation guidelines before starting a system design that requires use of an XDS emulator. In-circuit emulators place added constraints on the system hardware and software design; the XDS TMS34010 emulator minimizes these constraints as much as possible. Many of the emulator signals come directly from the device itself keeping the delays to a minimum. The information provided in this appendix will allow your design to be compatible with the TMS34010 XDS emulator. Topics in this section include: Section Page B.1 Pin Loading B-2 B.2 Signal Timing and Delay B-4 B.3 Transmission Line Phenomena B-5 B.4 Host Port Operation B-5 B.5 Reset Buffering B-5 B.6 Local Ready Timing B-6 B.7 Memory Substitution B-6 B.8 Write Protecting Memory B-6 B.9 Tracing and Cache B-7 B-1 Appendix B - System Design Considerations B.1 Pin Loading The loading provided by the emulator differs from the device loading; in some cases, this additional loading can cause a system to fail or pass. For instance, within the emulator the VCLK and INCLK clocks are buffered by an AS157 device. If the target clocks are driven by an AS driver over a long distance, the system may operate satisfactorily with the emulator's loading. When the de- vice is used, the clocks can ring, causing the system to fail. To minimize ringing caused by the emulator, all the outputs and l/Os are ter- minated with 22-ohm series resistors. Most of the signals are connected di- rectly to the target connector to minimize the added delays. Table B-1 shows the device loads that are placed on the emulator pins. In Table B-1, pin refers to the emulator target pin. An arrow (-►) indicates that the specified device drives the device(s) it the arrow points to. Devices in parallel are separated by commas; devices in series are in brackets. As an example, consider LADO; the pin connects to a 22-ohm series resistor, and the other side of the resistor is connected to an ALS245, AS573, and the TMS34010. Table B-1. Loading Pin Signal I/O Loading 1 v S s 2 RUN/EMU pin, 4.7KPU, ALS08 3 RESET I pin, 4.7KPU, TIBPAL-12, TMS9901, ALS574, AS257 -► [ALS08 + AS04 + ALS08 + AS874 + AS04] -» TMS34010 4 VCLK I pin, 330PU, 510PD, A5157 -► TMS34010 5 INCLK I pin -> [AS157] -> TMS34010 6 osrn I pin, 4.7KPU ■* [AS257] -► TMS34010 7 UNT2 I pin, 4.7KPU -* [AS257] -» TMS34010 8 HOLD I pin, 4.7KPU, AS874, TMS34010 9 LRDY pin, 4.7KPU, [TIBPAL-12] -+TMS34010 10 LADO I/O pin -♦ [22S] -+ ALS245, AS573, TMS34010 11 LAD1 I/O pin -* [22S] -»• ALS245, AS573, TMS34010 12 LAD2 I/O pin -* [22S] -» ALS245, AS573, TMS34010 13 LAD3 I/O pin -+ [22S] -► ALS245, AS573, TMS34010 14 LAD4 I/O pin -► [22S] -* ALS245, AS573, TMS34010 15 LAD5 I/O pin -» [22S] -+ ALS245, AS573, TMS34010 16 LAD6 I/O pin -» [22S] -» ALS245, AS573, TMS34010 17 LAD7 I/O pin -» [22S] -* ALS245, AS573, TMS34010 IS V55 19 LAD8 I/O pin -* [22S] -*■ ALS245, AS573, TMS34010 PD - Pull down PU - Pull up S - Series resistor [ ] - Devices in series pin - Emulator target cable pin B-2 Appendix B - System Design Considerations Table B-1. Loading (Continued) Pin Signal I/O Loading 20 LAD9 I/O pin -* [22S] -» ALS245, AS573, TMS3401 21 LAD 10 I/O pin -» [22S] -*■ ALS245, AS573, TMS34010 22 LAD11 I/O pin -* [22S] -► ALS245, AS573, TMS34010 23 LAD12 I/O pin -► [22S] -► ALS245, AS573, TMS3401 24 LAD13 I/O pin -» [22S] -► ALS245, AS573, TMS3401 25 LAD 14 I/O pin -► [22S] -♦ ALS245, AS573, TMS3401 26 LAD15 I/O pin -► [22S] -* ALS245, AS573, TMS34010 27 v C c 28 LCLK1 O TMS3401 0, AS244, AS04 -* [22S] -» pin 29 LCLK2 TMS34010, AS244 -» [22S] -» pin 30 HSYNC I/O TMS34010, ALS573 -► [22S] -» pin 31 VSYNC I/O TMS34010, ALS573 -+ [22S] -» pin 32 BLANK TMS34010, ALS573 -» [22S] -» pin 33 HLDA/EMU TMS34010 -♦ [AS08 + 10S] -♦ pin 34 LAL TMS34010, 100KPU, AS11, AS04 -»• [22S] -» pin 35 v S s 36 DDOUT TMS34010 -► [TIBPAL-12 + 22S] -» pin 37 DEN TMS34010 -» [TIBPAL-12 + 22S] -► pin 38 RS5 TMS34010 AS157, 100KPU -♦ [22S] -* pin 39 EaS TMS34010 -» [TIBPAL-12 + 22S] -» pin 40 WRITE TMS34010 -» [TIBPAL-12 + 22S] -♦ pin 41 TR/QE TMS34010 -» [TIBPAL-12 + 22S] -> AL244, pin 42 HINT TMS3401 ALS244 -» [22S] -» pin 43 HRDY TMS3401 -» [AS08 + 1 0S] -*• pin 44 HAD15 I/O TMS34010-* [22S] -» pin 45 HAD14 I/O TMS34010-* [22S] -♦ pin 46 HAD13 I/O TMS34010-* [22S] -» pin 47 HAD12 I/O TMS34010 -» [22S] -► pin 48 HAD11 I/O TMS34010-» [22S] -* pin 49 HAD10 I/O TMS34010-> [22S] -♦ pin 50 HAD9 I/O TMS34010 -» [22S] -» pin 51 HAD8 I/O TMS34010 -» [22S] -» pin 52 v S s PD - Pull down PU - Pull up S - Series resistor [ ] - Devices in series pin - Emulator target cable pin B-3 Appendix B - System Design Considerations Table B-1. Loading (Concluded) Pin Signal I/O Loading 53 HAD7 I/O TMS34010 -» [22S] -> pin 54 HAD6 I/O TMS34010 -» [22S] -» pin 55 HAD5 I/O TMS34010-* [22S] -» pin 56 HAD4 I/O TMS34010-* [22S] -» pin 57 HAD3 I/O TMS34010-* [22S] -» pin 58 HAD2 I/O TMS34010-> [22S] -^ pin 59 HAD1 I/O TMS34010 -♦ [22S] -» pin 60 HADO I/O TMS34010 -► [22S] -> pin 61 v C c 62 HUDS pin, 100KPU, TMS34010 63 HLbS pin, 100KPU, TMS34010 64 HP.EAD pin, 100KPU, ALS573, TMS34010 65 HwftlTfc pin, 100KPU, AS573, TMS34010 66 TTU5 pin, 4.7KPU -» [AS232 + AS08 + TMS34010] -♦ ALSOO, ALS74, TIB PAL- 12, LS02 67 HFSO pin, 100KPU, ALS573, TMS34010 68 HFS1 pin, 100KPU, ALS573, TMS34010 PD - Pull down PU-Pull up S - Series resistor [ ] - Devices in series pin - Emulator target cable pin B.2 Signal Timing and Delay The target cable delays all signal timings by approximately four nanoseconds; the following signals impose an additional delay: Signal Delay CAS 12ns Signal Delay VCLK 6ns INCLK 6ns LINT1 6ns LINT2 6ns DDOUT 12ns DEN 12ns WRITE TR/QE LRDY HRDY HCS 12ns 12ns 12ns 6ns 12ns Remember these additional delays when you are calculating system timings. The cable delays should cancel out when comparing the signal to the clock; for instance, the clock is delayed by four nanoseconds and so is the address. The pr oblem comes from setup times required by the TMS34010. For in- stance, CAS out is delayed by 16 nanoseconds and data-in is delayed by four nanoseconds. This 20 nanoseconds must be a dded to the memory access time. For this reason, it is important not to use CAS to control LRDY. Both B-4 Appendix B - System Design Considerations LRDY and CAS are delayed by 12 nanoseconds; combined, this adds 24 na- noseconds to the LRDY setup, which violates the device requirements. B.3 Transmission Line Phenomena Since the XDS target cable is approximately 20 inches long, use of advanced CMOS or fast/advanced Schottky-TTL may cause line reflections (ringing above input thresholds) on input lines to the XDS. Series termination resistors (22 to 68 ohms) can help to eliminate this problem. In some cases where significant additional signal length is added to XDS outputs, the series resis- tors on the XDS may not be sufficient to control reflections. In this case, ad- ditional corrective actions may be necessary. B.4 Host Port Operation The emulator host port supports two modes of operation: • The first mode blocks the host port while the emulator is in control mode (that is, not running) and when the XDS emulator requires its internal TMS34010 as a resource. Systems that access the host port when in control mode have HRDY inactive when they start an access and remain inactive until the emulator is put into run mode. This is a problem for PCs because they use DMA cycles to perform DRAM refresh and are prevented from performing any further memory cycles. • The second mode of operation allows host accesses while the emulator is in control mode. When the emulator is halted, a snapshot is taken of the I/O registers before transferring control to the user. While halted, the host has access to the TMS34010's I/O registers and memory space. Data read from the I/O and memory space may not represent the actual data as the host can be changing the data through the host port. Data written through the XDS user interface to any I/O registers or memory locations used by the host port can cause unpredictable results. This mode is the typical dual-allocation problem that is prevalent in multiport memory systems. B.5 Reset Buffering The RESET input from the target system is buffered so that reset cannot abort a memory cycle that is in progress. This is nece ssary to preve nt corruption of the substitution memory. Reset is ANDed wit h RAS an d CA S and clocked on the rising edge of LCLK1 . If reset is active and RAS a nd CAS are inactive, then reset is applied to the proce ssor. While the RESET input is active, internal emulator logic provides CAS -before- RAS refreshes for emulator memory, but not for your system memory; target memory is not refreshed during reset. Therefore, you shouldn't perform a target reset following a download of object code into target memory, because this may destroy the contents of target me- mory. B-5 Appendix B - System Design Considerations If the tar get sy stem also generates a reset during the emulator-TMS34010 re- set, and HCS is high (which, under normal circumstances, would halt the TMS34010), the emulator reset takes precedence and does not halt the TMS34010. B.6 Local Ready Timing The ready l ogic requires special attention; the target system should not depend on having CAS to clear ready. This can cause a deadlock situa tion if the me- mory is write protected. In this case, the emulator blo cks t he CAS output to the target and the target system is locked waiting for CAS to release LRDY. Thus, if you are working with the emulat or an d write- protecting memory, your ready logic should use a combination of RAS and clock delays instead of CAS. B.7 Memory Substitution The 256K bytes of substitution memory is implemented with two banks of 64Kx4 DRAMs. This memory can be mapped on 2K word boundaries. The memory can be selected as write-only using the memory protect feature de- scribed below. When a memory access is made that is mapped into substi- tution memory the signals are modified as follows: • DEN, CAS, WR, and TR/QE are blocked from going active. • Ready is accepted from the target to allow adding wait states to the substitution memory. Ready should not be controlled by DEN, CAS, WR or TR/QE because these sig- nals are blocked and a deadlock condition would take place. All the other signals operate as though a standard memory cycle were taking place. Be aware that when you're using substitution memory, it can only be accessed by the processor and host port and cannot be accessed when the TMS3 4010 is p ut in to hold. The target system should not drive the LAD bus unless CAS and DEN are active. B.8 Write Protecting Memory The emulator allows memory to be write- protected in blocks of 2048 words. The memory can be external memory as well as the sub stitut ion memory. The memory write operations are inhibited by blocking the CAS o utpu t. As with the substitution memory, ready should not be controlled by CAS because a deadlock condition will take place. External system memory is only write protected from CPU and host accesses and not DMA accesses initiated with a HOLD/HOLDA sequence. B-6 Appendix B - System Design Considerations B.9 Tracing and Cache Please note that the breakpoint trace and timing capabilities are used to mon- itor bus activity. The TMS3401 0's pipelined-cache-based architecture fetches the current instruction and the three associated instructions in the cache sub- segment when a cache miss occurs. This is indicated as four fetches even though only one instruction may be executed. Also, when the cache is ena- bled, code already located in cache does not generate any instruction-fetch activity on the memory bus when it is executed. If you want to create a com- plete trace history, run the TMS34010 with cache disabled. By disabling cache, all instructions executed are moved over the external memory bus every time they are executed, allowing them to be captured in the trace buffer. B-7 Appendix B - System Design Considerations B-8 Appendix C Software Compatibility with Future GSPs This appendix provides guidelines for writing TMS34010 programs that will be compatible with future versions of TMS340xO devices. In some cases, following these guidelines may not produce the fastest TMS34010 code; however, your code should run without modification on future GSPs. These guidelines cover several areas: Section Page C.1 General Guidelines C-2 C.2 Graphics Compatibility C-2 C.3 Memory Map Compatibility C-3 C.4 I/O Register and Video Timing Compatibility C-4 C.5 Interrupts Compatibility C-4 C.6 Host Interface Compatibility C-5 C-1 Appendix C - Software Compatibility with Future GSPs C.1 General Guidelines • Future GSPs may have different instruction execution times than the TMS34010 has; therefore, timing loops based on TMS34010 instruction execution time may not be compatible with future GSPs. Even if future devices are generally faster than the TMS34010, specific cases may run slower. To avoid this, timing could be bas ed on DP YINT (the display interrupt) or on an external time source (via LINT1 or LINT2). Note that if you use DPYINT, you must consider different display resolutions and refresh rates. • For optimum performance on future GSPs, align data on 32-bit bound- aries (instead of 16-bit boundaries). This could reduce the number of memory cycles for future GSPs, and in most cases will have little impact on the TMS34010. In particular, keeping the stack pointer (SP) aligned to 32-bit boundaries will speed up subroutine calls and interrupts. • Future GSPs may use the reserved bits in the status register and in the I/O registers. During context switches, the values of reserved bits should be saved and restored as if they were valid; do not assume that these bits have known values. If you don't follow this guideline, your code may inadvertently enable/disable new options or features. Unless otherwise noted in this user's guide, when reserved bits have a value of 0, they will cause future GSPs to behave like the TMS34010. However, you should not set these bits to 0, because this may incorrectly reset a bit. • Use the REV instruction to determine which version of the GSP you are using. You can use this instruction to decide whether to enable or dis- able version -dependent code. • Instruction cache statistics characteristics (including cache size, loading order, number of bytes loaded per cache miss, and time per cache fetch) may differ between versions of GSPs. Code should not depend on the state of any of these characteristics. C.2 Graphics Compatibility Extend the values in the COLOR0 and COLOR1 registers to 32 bits. The TMS34010 uses only the 16 LSBs of these registers; future GSPs may use all 32 bits. Treat the PMASK register as a 32-bit register. The TMS34010 uses only the 16 bits at address 0C0000160h; however, future GSPs may also use the 1 6 bits at address 0C00001 70h. Whenever x/ ou save/restore the value at 0C0000160h, you should also save/restore the value at 0C00001 70h. When you save/restore the graphics context (this includes all graphics operations control registers), you should also save/restore the I/O reg- C-2 Appendix C - Software Compatibility with Future GSPs isters that are reserved in the TMS34010 I/O register map (addresses 0C00001 30h-0C00001 AOh) . • At initialization, load register B1 3 with all 1 s. Future GSPs may use B1 3 as a pattern register; if you don't set B13 to the suggested value, future devices may draw a patterned line where the TMS34010 would draw a solid line. • If an instruction uses the CONVSP register, then SPTCH (B1) must agree with CONVSP (the 5 LSBs of CONVSP must equal the 1s com- plement of log2 SPTCH, which is given by the LMO of SPTCH). Future GSPs may have instructions that use SPTCH to determine the pitch val- ues instead of using CONVSP; that is, the instruction may perform the log2 conversion automatically. Set the 11 MSBs of CONVSP to 0; the TMS34010 ignores the values of these bits, but future GSPs may use these bits. • If an instruction uses the CONVDP register, then DPTCH (B3) must agree with CONVDP (the 5 LSBs of CONVDP must equal the 1s com- plement of log2 DPTCH, which is given by the LMO of DPTCH). Future GSPs may have instructions that use DPTCH to determine the pitch va- lues instead of using CONVDP; that is, the instruction may perform the log2 conversion automatically. Set the 11 MSBs of CONVDP to 0; the TMS34010 ignores the values of these bits, but future GSPs may use these bits. C.3 Memory Map Compatibility • The 32 16-bit words following the TMS34010 I/O registers (addresses 0C0000200h-0C00003F0h) are currently reserved. Future GSPs may use these addresses for additional I/O registers, so do not write code that uses these addresses. • Do not use any reserved addresses in the TMS34010 memory map; fu- ture GSPs may use these locations. Specifically, address OFFFFEOOOh, which is currently reserved, may be used for system configuration infor- mation. C-3 Appendix C - Software Compatibility with Future GSPs C.4 I/O Register and Video Timing Compatibility • Future GSPs may use different I/O registers to control video timing and VRAM shift register control. The vertical and horizontal counters may still be accessible at their current locations. DPYADR, DPYCTL, DPYSTRT, and DPYTAP may have new functions and/or addresses. HESYNC, HEBLNK, HSBLNK, HTOTAL, VESYNC, VEBLNK, VSBLNK, and VTOTAL may have similar functions but different addresses. These video control functions may be redefined so that future GSPs can take advantage of new advances in video RAM technology. • Code that accesses video timing registers should be separated from other code so that you can easily replace it. • Future GSPs may use different DRAM refresh methods; the TMS34010 provides control every 32 or 64 CPU cycles, and it may be necessary to have more control. C.5 Interrupts Compatibility • Interrupt service routines should not make assumptions about the state of the stack (except for the location of the ST and the PC). Future GSPs may push additional parameters or status information on the stack before pushing the PC and ST. Note: You must use RETI to return from an interrupt service routine. This en- sures that any additional parameters that future GSPs may push on the stack will also be popped from the stack, and also ensures that the correct internal registers will be restored. PIXBLT interruption may behave differently on future GSPs. An inter- rupted PIXBLT may store status information on the stack instead of in registers, and different information may be stored. Note: Do not modify values stored in the register file by an interrupted PIXBLT. Future GSPs may not use this information or these locations. • Opcodes that the TMS34010 flags as illegal may be valid opcodes for future GSPs. Therefore, if you want to use a software trap, use the TRAP instruction instead of an illegal opcode. • Traps 3-7 and 1 2-1 5 are reserved for future interrupts. C-4 Appendix C - Software Compatibility with Future GSPs C.6 Host Interface Compatibility • Certain features of the TMS34010 host interface may need to be imple- mented in external hardware for future GSPs. However, the host inter- face registers and their functions will remain the same so that TMS3401 code that uses these registers will be compatible with future GSPs. • Code written for a host processor that accesses the GSP host interface may have to be modified to comprehend a modified host interface. C-5 Appendix C - Software Compatibility with Future GSPs C-6 Appendix D Glossary aliasing: A stairstep effect on a raster display of a line or arc segment. antialiasing: A method for reducing the severity of aliasing effects seen in lines and edges drawn on a bit-mapped display device. This method adjusts the intensity of a pixel used to represent a portion of a line or edge according to the pixel's distance from the line or edge. Antialiasing requires that the display device be capable of producing one or more intermediate intensity levels between bright and off. asynchronous communications: A method of transmitting data in which the timing of character placement of connecting transmitting lines is not crit- ical. The transmitted characters are preceded by a start and followed by a stop bit, thus permitting the interval between characters to vary. aspect ratio: The ratio of width to height. For the rectangular picture transmitted by a television station, the aspect ratio is 4:3. back porch: The portion of a horizontal blanking pulse that follows the trailing edge of the horizontal synchronizing pulse. background illumination: The average brightness of a screen. bandwidth: The number of bits per second that can be transferred by a device. binary array: Alternate name for a two-dimensional bit map in which each pixel is represented as single bit. BitBIt: Bit aligned block transfer. Transfer of a rectangular array of pixel information from one location in a bitmap to another with potential of applying 1 of 16 boolean operators during the transfer. bit map: 1 . The digital representation of an image in which bits are mapped to pixels. 2. A block of memory used to hold raster images in a device-specific format. bit plane: Hardware used as a storage medium for a bit map. black level: The amplitude of the composite signal at which the beam of the picture tube is extinguished (becomes black) to blank retrace of the beam. This level is established at 75% of the signal amplitude. blanking signal: Pulses used to extinguish the scanning beam during hor- izontal and vertical retrace periods. D-1 Appendix D - Glossary breakpoint: A place in a routine specified by an instruction, instruction di- git, or other condition, where the routine may be interrupted by external in- tervention or by a monitor routine. clipping: Removing parts of display elements that lie outside a given boun- dary, usually a window or a viewport. composite video: The color-picture signal plus all blanking and synchro- nizing signals. The signal includes luminance and chrominance signals, verti- cal- and horizontal-sync pulses, vertical- and horizontal-sync pulses, vertical-and horizontal-blanking pulses, and the color-burst signal. DAC: Digital-to-analog converter. A device that converts a digital input code to an analog output voltage or current. The analog output level repres- ents the value of the digital input code. direct access: Pertaining to the process of obtaining data from, or placing data into, storage where the time required for such access is independent of the location of the data most recently obtained or placed in storage. display area: The rectangular part of the physical display screen in which information coded in conformance with a video encoding standard is visibly displayed. The display area does not include the border area. display element: A basic graphic element that can be used to construct a display image. display memory: The area of memory which is used to hold the graphics image output to the video monitor. display pitch: The difference in memory addresses between two pixels that appear in vertically adjacent positions (one directly above the other) on the screen. display unit: A device which provides a visual representation of data. dot clock: The dot clock cycles the rate at which video data is output to a CRT monitor. DRAM refresh: The operation of maintaining data stored in dynamic RAMs. Data are stored in dynamic RAms as electrical charges across a grid of capacitive cells. The charge stored in a cell will leak off over time. execution unit: The portion of a central processing unit that actually exe- cutes the data operations specified by program instructions. field: 1. A group of contiguous bits in a register or memory dedicated to a particular function or representing a single entity. 2. A software-configurable data type in the TMS34010 whose length can be programmed to be any value in the range 1 to 32 bits. fill: Solid coloring or shading of a display surface, often achieved as a pat- tern of horizontal segments. frame: 1 . The time required to refresh an entire screen. 2. The screen image output during a single vertical sweep. D-2 Appendix D - Glossary frame buffer: A portion of memory used to buffer rasterized data to be output to a CRT display monitor. The contents of the frame buffer are often referred to as the bit map of the display and contain the logical pixels corre- sponding to the points on the monitor screen. front porch: The portion of a horizontal blanking pulse that precedes the leading edge of the horizontal sync pulse. GKS: Graphical Kernel System. An application programmer's standard in- terface to a graphics display. glue logic: The small- and medium-scale-integrated devices necessary to complete the interface between two or more large or very- large-scale inte- grated devices. gray scale: A scale of light intensities from black to white. GSP: Graphics System Processor. A single-chip device embodying all the processing power and control capabilities necessary to manage a high- performance bit-mapped graphics system. The TMS34010 is the first such device. high-impedance: The third state of a three-state output driver, in which the output is driven neither high or low but behaves as an open connection. hold signal: A signal from a device capable of controlling a processor bus (for example, a processor or a DMA controller) which the device sends to a bus arbiter to request control of the bus. Typically, the arbiter signals the granting of the request by sending a hold-acknowledgement signal to the re- questing device. hold time: The minimum amount of time that valid data must be present at an input after the device is clocked to ensure proper data acceptance. horizontal blanking interval: The time during which the display is blanked to cover the horizontal retracing of the electron beam. horizontal sync: The synchronization signal that enables horizontal retrace of the electron beam of a CRT display. icon: A graphic symbol representing a menu item. interlaced scanning: A system of TV-picture scanning. Odd-numbered scanning lines, which make up an odd field, are interlaced with the even- numbered lines of an even field. The two interlaced fields constitute one frame. In effect, the number of transmitted pictures is doubled, thus reducing flicker. lookup table: A table used during scan conversion of the digital image that converts color-map addresses into the actual color values displayed. LRU: Least- recently- used cache-replacement algorithm. When a cache miss occurs, a cache-replacement algorithm selects which cache segment will be overwritten, based on the likelihood that the data in the discarded segment will not be needed again for some time. The LRU algorithm selects the seg- ment which was used least recently. D-3 Appendix D - Glossary mask: A pattern of characters that is used to control the retention or elimi- nation of portions of another pattern of characters. memory map: A map of memory space partitioned into functional blocks. monotonicity: The quality of proceeding in a uniform manner. For exam- ple, the analog level output from a DAC should increase with each increase in the value of the digital input code. multiplexing: Refers to a process of transmitting more than one set of sig- nals at a time over a single wire or communications link. NABTS: North American Broadcast Teletext Specification NAPLPS: Abbreviation for the North American Presentation Level Protocol Syntax, which is a proposed standard for Videotex services. nonmaskable interrupt: An interrupt request that cannot be disabled. NMI: Nonmaskable interrupt. The NMI is an interrupt that is permanently enabled; it cannot be disabled. NTSC: Abbreviation for the National Television System Committee, a group representing a wide range of interests in the television broadcast and video industry. The NTSC is instrumental in developing standards. operand: That which is operated upon. An operand is usually identified by an address part of an instruction. origin: The zero intersection of X and Y axes from which all points are cal- culated. overlay: The plane of a graphics display that can be superimposed on an- other plane. pack: To compress data in a storage medium by eliminating redundant in- formation in such a way that the original data can later be recovered. palette: A digital lookup table used in a computer graphics display for translating data from the bit map into the pixel values to be shown on the display. pan: Apparent horizontal or vertical movement of a computer graphics screen (or window) over an image contained in a frame buffer that is too large to be completely displayed in a single static picture. phase: The time interval for each clock period in a system is divided into two phases. One phase corresponds to the time the clock signal is high, and the other phase corresponds to the time the clock signal is low. PHIGS: The programmer's Hierarchical Interactive Graphics Standard pipelining: A design technique for reducing the effective propagation delay per operation by partitioning the operation into a series of stages, each of which performs a portion of the operation. A series of data is typically clocked through the pipeline in sequential fashion, advancing one stage per clock pe- riod. D-4 Appendix D - Glossary pitch: The difference in starting addresses of two adjacent rows of pixels in a two-dimensional pixel array. pixel: Picture element. 1 . The smallest controllable point of light on a CRT display screen. 2. In a bit-mapped display, the logical data structure that contains the attributes to be shown at the corresponding physical pixel posi- tion on the CRT display screen. pixel processing operation: A specified Boolean or arithemetic operation used to combine two pixel values (source and destination). PixBIt: (Abbreviation of Pixel Block transfer) Operations on arrays of pixels in which each pixel is represented by one or more bits. PixBIt operations are a superset of BitBIt operations, and include not only the commonly-used boolean functions, but also integer arithmetic and other multi-bit operations. plane: (Also bit plane or color plane.) A plane is a bit-map layer in a display device with multiple bits per pixel. If the pixel size is n bits, and the bits in each pixel are numbered to /7-1 , plane is made up of bits numbered from all the pixels, and the plane /7-1 is made up of bits numbered /7-1 from all the pixels. A layered graphics display allows planes or groups of planes to be manipulated independently of the other planes. primary colors: A set of three colors from which all other colors may be regarded as derived; hence, any of a set of visual stimuli from which all colors may be produced by mixture. Each primary color must be different from the others, and a combination of two primaries must be capable of producing a third. In color television, the three primary colors are red, green and blue. propagation delay: The time required for a change in logic level at an input to a circuit to be translated into a resulting change at an output. protocol: A set of rules, formats, and procedures governing the exchange of information between peer processes at the same level. pulse width: Pulse width, T w . The time interval between specified refer- ence points on the leading and trailing edges of the pulse waveform. Random Access Memory (RAM): A memory from which all information can be obtained at the output with approximately the same time delay by choosing an address randomly and without first searching through a vast amount of irrelevant data. raster: A rectangular grid of picture elements whose intensity levels are manipulated to represent images. In a bit-mapped display, the bits within a portion of the memory referred to as the frame buffer are mapped to the raster pattern of a CRT monitor. raster display: A CRT display generated by an electron beam that illumi- nates the CRT by sweeping the beam horizontally across the phosphor surface in a predetermined pattern, providing substantially uniform coverage of the display area. raster graphics: Computer graphics in which a display image is composed of an array of pixels arranged in rows and columns. D-5 Appendix D - Glossary Raster-Op: The arithmetic or logical combination operation that takes place during the transfer of pixel arrays from one location to another. raster scan: The grid pattern traced by the electron beam on the face of the CRT in a television or similar raster-scan display device. ready signal: A signal from a memory or a memory-mapped peripheral that informs the processor when it is ready to complete a memory cycle. Slower memories or memory-mapped peripherals must extend the length of the me- mory cycle by negating the ready signal (in other words, by sending the pro- cessor a "not ready" signal until such time as the cycle can be completed. resolution: The number of visible distinguishable units in the device coor- dinate space. refresh: Method which restores charge on capacitance which deteriorates because of leakage. reset: To restore to normal action. resolution: The number of visible distinguishable units in the device coor- dinate space. retrace: The line traced by the scanning beam or beams of a picture tube as it travels from the end of one horizontal line or field to the beginning of the next line or field. RGB monitor: Red-Green-Blue Monitor. An RGB monitor is a CRT moni- tor capable of displaying colors and having separate inputs for the three sig- nals used to drive the red, green and blue guns of the CRT. relative coordinates: Location of a point relative to another data point. rotate: To transform a display or display item by revolving it around a spe- cified axis or center point. scale: A size change made by multiplying or dividing the coordinate dimen- sions by a constant value. scale factor: The value by which you divide or multiply the display dimen- sions in a scaling operation. scaling: Enlarging or reducing all or part of a display image by multiplying the coordinates of display elements by a constant value. scan line: A horizontal line traced across a CRT by the electron beam in a television or similar raster-scan device. screen refresh: The operation of dumping the contents of the frame buffer to a CRT monitor in synchronization with the movement of the electron beam. segment: A collection of display elements that can be manipulated as a unit. sequencing: Control method used to cause a set of steps to occur in a particular order. D-6 Appendix D - Glossary setup time: The minimum amount of time that valid data must be present at an input before the device is clocked to ensure proper data acceptance. shift register transfer: A transfer between the RAM storage and internal shift register in a video RAM. sprite: A graphic object of a specified pattern appearing on its plane in a position determined by a single coordinate pair, specifying the sprite's location on the screen in the horizontal and vertical axis. stairstepping: A visual effect seen in bit-mapped display devices which produce images by brightening or dimming individual picture elements (or pixels) contained in a two-dimensional grid of such elements. Stairstepping (also called aliasing) is the rough or jagged appearance of lines and edges which are not perfectly horizontal or vertical, resulting from transitions of the line or edge from one row or column of elements to another. superimposed: Refers to the process that moves data from one location to another, superimposing bits or characters on the contents of specified lo- cations. tap point: The column address provided to a VRAM during a memory-to- shift -register cycle. The column address specifies the point at which the shift register is to be "tapped;" in other words, which cell of the shift register is to be connected to the serial output of the VRAM. trace: A line of the graphics display. transformation: Geometric alteration of a graphics display, such as scaling, translation, or rotation. transparency: When a pixel with the attribute of transparency is written 10 the screen, it is effectively invisible, and does not alter that portion of the screen it is written to. For example, in a pixel array containing the pattern for the letter A all pixels surrounding the A pattern could be given a special value indicating that they are transparent. When the array is written to the screen, the A pattern, but not the pixels in the rectangle containing it, would be in- visible. VDI: Virtual Device Interface. The standard interface between the device- independent and the device-dependent levels of a graphics system. VDM: Virtual Device Metafile. A standard mechanism for retaining and and transporting graphics data and control information at the level of the Virtual Device Interface. vertical blanking interval: The time during which the display is blanked to cover the vertical retracing of the electron beam. vertical blanking pulse: A positive or negative pulse developed during vertical retrace and appearing at the end of each field. It is used to blank out scanning lines during the vertical retrace interval. vertical sync: The synchronization signal that enables vertical retrace of the electron beam of a CRT display. video display processor: A microprocessor device dedicated to the tasks of display memory management (storage, retrieval, and refresh) and gener- D-7 Appendix D - Glossary ation of all required video, control, and synchronization signals required by a TV display or CRT monitor. video overlay: The mixing of one video signal with another such that parts of the image carried by the first signal replace the corresponding parts of the image carried by the second signal. video RAM, VRAM: Video Random-Access Memory. A dual-ported me- mory device for computer graphics applications, containing two interfaces; one interface to allow a processor to read or write data from an internal mem- ory array; a second interface to provide a serial stream of screen refresh data to a CRT display device. viewport: The specified window on the display surface that marks the limits of a display. virtual coordinate system: A coordinate system created by mapping a portion of the world coordinate system to the space available on your device. virtual space: Space referenced with the coordinates defined by the appli- cation. wait state: A clock period inserted into a memory cycle in order to permit accesses of slower memories and slower memory-mapped peripherals. window: A specified rectangular area of a virtual space shown on the dis- play. window clipping: Allowing text and graphics drawing to occur only within a specified rectangular window on the screen. wire frame: A three-dimensional image displayed as a series of line seg- ments outlining its surface. zoom: To scale a display or display item so it is magnified or reduced on the screen. D-8 Index ABS instruction 1 2-35 absolute branch 5-19 absolute operands 12-5 ADD instruction 12-36 add with saturation 7-16 AD DC instruction 12-37 ADDI instruction 12-38, 12-39 ADDK instruction 12-40 addressing 3-2-3-3 addressing modes 12-4 AD DXY instruction 12-41 A-file registers 5-2 airbrush effect 7-23 ALU 1-6 AND instruction 12-42 AN Dl instruction 12-43 ANDN instruction 12-44 AN DN I instruction 12-45 antialiasing 7-23 applications 1 -8 arithmetic instructions 12-19 array pitch 4-16 B background color register 5-15 bank selection 1 1 -25 barrel shifter 1 -6 B-file re gisters 5-3,5-5-5-17 BLANK 2-9,9-3 blanking 2-9, 6-27, 6-29, 6-49, 6-51 block diagram 1 -5 Boolean operations 7-17 Boolean pixel processing 6-13 Bresenham line algorithm 7-2,7-10 BTST instruction 1 2-46, 1 2-47 bulk initialization of VRAMs 9-1 8, 9-26 bus request priorities 11-4 bus request signal 2-10 byte addressing 1 0-20 bytes 4-1 B0 (SADDR) 5-6 B1 (SPTCH) 5-7 B10 (COUNT) 5-17 B11 (INC1) 5-17 B12(INC2) 5-17 B13(PATTRN) 5-17 B13(TEMP) 5-17 B2 (DADDR) 5-8 B3 (DPTCH) 5-10 B4 (OFFSET) 5-11 B5 (WSTART) 5-12 B6(WEND) 5-13 B7 (DYDX) 5-14 B8 (COLOR0) 5-15 B9(COLOR1) 5-16 Cbit 5-18 C compiler 1-12 cache disable 6-14 cache hit 5-22 cache miss 5-22 cache replacement algorithm 5-21 CALL instruction 12-48 CALLA instruction 1 2-49 CALLR instruction 12-50 Carte sian coordinates 4-16 CAS 2-7, 1 1 -2 CD bit 5-24,6-11,6-14 CF bit 5-23, 5-24, 6-32, 6-33 chip select pin 2-5 clearing... a register 1 2-51 the carry bit 12-52 clock timing logic 1-7 CLR instruction 12-51 CLRC instruction 12-52 CMP instruction 12-53 CMPI instruction 12-54, 12-55 CM PXY instruction 12-56 Cohen-Sutherland algorithm 7-30 color planes 7-12 color-expand operation 7-5 COLOR0 register 5-15 COLOR1 register 5-16 lndex-1 column address strobe 2-7 compare instructions 12-19 compare point to window 7-3 context switching instructions CONTROL 6-11 CONTROL register 6-11 CONVDP 7-4 CONVDP register 4-1 2, 6-1 5 conversion factor 6-1 5, 6-1 6 CONVSP 7-4 CONVSP register 4-1 2, 6-1 6 COUNT register 5-17 CPW instruction 12-57 CVXYL instruction 12-59 12-29 refresh cycles 6-11 refresh interval 6-46 refresh rate 6-11 DRAM refresh 11-11,11- DRAV instruction 12-67 draw and advance 7-10 DSJ instruction 12-70 DSJEQ instruction 12-71 DSJ NE instruction 12-73 DSJS instruction 12-75 DUDATEbits 6-19,6-20 DXVbit 6-19,6-22 DYDX register 5-14 12,11-25 DADDR register 5-8 data enable pin 2-7 data paths 1 -6, 5-25 data select pins 2-5 data structures bytes 4-1 fields 4-1,4-2-4-5 pixel arrays 4-1 pixels 4-1,4-6-4-10 DDOUT 2-7,11-2 DEC instruction 12-61 DEN 2-7,11-2 destination address register 5-8 destination conversion factor 6-15 destination pitch register 5-10 development tools list 1 -3 DIE bit 6-40 DINT instruction 12-62 DIP bit 6-41 direct operands display interrupt display memory display pitch 4 6-16,9-18 DIVS instruction DIVU instruction dot rate 9-14 DPTCH register DPYADR register DPYCTL register DPYINT register DPYSTRT register 6-24 DPYTAP register 6-25 DRAM 6-11,11-5 12-6 8-5,9-13 9-1 8 10,5-7,5-10,6-15, 12-63 12-65 5-10,6-15 6-17 6-19 6-23 El NT instruction 12-76 EMU instruction 12-77 emulation 2-10 enabling interrupts 12-76 ENVbit 6-19 EXGF instruction 12-78 EXG PC instruction 12-79 external interlaced video 9-17 external interrupts 8-3 external synchronization 9-15 external video 6-19 FE bit 4-2 FEObit 5-18 FE1 bit 5-18 field size 5-18,5-19 fields 4-1,4-2-4-5 addressing 4-2 alignment 4-3 extraction 4-2 insertion 4-2, 4-5 size 4-2 fill 7-5 FILL instruction 1 2-80, 1 2-84 font library 1-12 foreground color register 5-16 ccn A-O ■18 FS0 bits 5- FS1 4-2 FS1 bits 5-18 function select pins 2-5 lndex-2 general-purpose register files 1 -5, 5-2- 5-17 GETPC instruction 12-89 GETST instruction 12-90 graphics instructions 1 2-26 graphics standards 1 -2 H halt latency 1 0-1 9 halt program execution 6-35 HCOUNT register 6-26 HCS 2-5,10-2 HD0-HD15 2-6,10-2 HEBLNK register 6-27 HESYNC register 6-28 HFSO, HFS1 2-5,10-2 hidden states 1 3-2 HIE b it 6-40 HINT 2-6,10-2 HIP bi t 6-41 HLDA/EMUA 2-10 HLDS 2-5,10-2 HLT b it 5-23, 6-3, 6-32, 6-35 HOLD 2-10 hol d and emulatio n signals 2-4,2-10 HLDA /EMUA 2-10 HOLD 2.-10 RUN/EMU 2-10 hold interface 11-18 hold request 11-4 horizontal back porch 9-5 horizontal front porch 9-5 horizontal sync 2-9 horizontal timing 9-12 horizontal timing registers HCOUNT 6-26, 9-4 HEBLNK 6-27,9-4 HESYNC 6-28, 9-4 HSBLNK 6-29, 9-4 HTOTAL 6-39, 9-4 horizontal video timing 9-6, 9-7 host interface 10-1,1 0-24 bandwidth 10-22 data transfer 1 0-8 indirect accesses of local memory 10-11 reads and writes 1 0-4 ready signal to host 1 0-8 registers 6-7 HSTADRH 10-3 HSTADRH register 6-30 HSTADRL 6-31,10-3 HSTCTL 10-3 HSTCTLH 6-32,10-3 HSTCTLL 6-36,10-3 HSTDATA 6-38,10-3 selection 10-2 signals 10-2 timing examples 10-5 host inter face bus pins 2-3, 2-5 HCS 2-5 HD0-HD15 2-6 HFS0 ,HFS1 2-5 HTNT 2-6 HLDS 2-5 HRDY 2-6 HREA D 2-5 HUPS 2-5 HWRITE 2-5 host interrupt 8-5 host read/write strobes 2-5 host-present mode 8-10, 8-1 3 HRDY 2-6,10-2,10-8 HREAD 2-5,10-2 HSBLNK register 6-29 HSDbit 6-19 HSTADRH register 6-30 HSTADRL register 6-31 HSTCTLH register 6-32 HSTCTLL register 6-36 HSTDAT A register 6-38 HSYNC 2-9, 6-22, 6-26, 9-3 HTOTA L register 6-39 HUPS 2-5,10-2 HWRITE 2-5,10-2 I I/O registers 1 -6, 6-1 -6-52 addressing 6-2 at reset 6-3 host interface registers 6-7 interrupt interface registers 6-8 latency of writes 6-4 local memory interface registers 6-8 memory map 6-2 summary 6-5 video timing and screen refresh regis- ters 6-9 IE bit 5-18 illegal opcode interrupts 8-9 illegal operand 8-5 lndex-3 immediate operands 12-4 implied graphics operands 5-5 INC instruction 12-91 INCLK 2-7,11-2 INCRbit 6-32,6-34,10-11 incremental algorithms 7-10 INCWbit 6-32,6-35,10-11 INC1 register 5-17 I NC2 register 5-17 indirect accesses of local memory 1 0-1 1 indirect branch 5-19 indirect operands 1 2-7, 1 2-8, 1 2-9, 12-10, 12-11 in XY mode 12-11 with offset 12-8 with postincrement 1 2-9 with predecrement 12-10 input clock 2-7 instruction cache 1 -6, 5-20-5-25 cache disable 6-14 cache flush 6-33 cache hit 5-22 cache miss 5-22 cache replacement algorithm 5-21 disabling 5-24 downloading new code 5-23 flushing 5-23 LRU stack 5-21 operation 5-22 P flag 5-22 segment miss 5-22 segments 5-21 SSA register 5-21 subsegment miss 5-22 instruction set 12-1 addressing modes 12-4 arithmetic instructions 12-19 compare instructions 12-19 condition codes 12-31 graphics instructions 12-26 jump instructions 12-30 logical instructions 12-19 move instructions 12-20 operand formats 1 2-4 program control instructions 1 2-29 shift instructions 1 2-32 instruction words 5-20 INTENB register 6-40 nterlaced display 9-25 registers 6-8 INTENB 6-40,8-3 INTPEND 6-41,8-3 interruptible instructions 7-8 interrupts 2-6,8-1-8-8 display interrupt 6-23, 8-5, 9-1 3 enable bit 5-18 external interrupts 8-3 host interrupt 8-5 host interrupt request signal 2-6 IE bit 5-18 illegal opcode interrupts 8-9 illegal operand 8-5 INTENB 6-40 internal interrupts 8-5 interrupt request pins 8-3 interrupt requests 6-37 INTIN bit 6-37 INTOUT bit 6-37 INTPEND 6-41 local interrupt request signals 2-8 nonmaskable interrupt 6-32, 6-33, 8-5 priorities 8-2, 8-5 processing 8-6 registers 8-3 RESET 2-11 stack operations 3-8 vector addresses 8-2 window interrupt 8-5 intersecting rectangles 7-3 INTIN bit 6-36, 6-37 INTOUT bit 6-36, 6-37 INTPEND register 6-12, 6-41 nternal interrupts nterrupt interface u- 1 i , »- 1 / 8-5 JAcc instruction 12-92 JRcc instruction 1 2-94, 1 2-96 JUMP instruction 12-98 jump instructions 12-30 K lra\i faaturac nf tha TMCJ/inifl 1 -"i lndex-4 LRDY 2-8,11-2 LAPP- LAD 15 2-8,11-2 LAL 2-7,11-2 LBL bit 6-32, 6-34 LCLK1,LCLK2 2-8,11-2 LCSTRT bits 6-24 line clipping 7-29 LINE instruction 12-99 linear addres sing 4-10 LINT1,LINT2 2-8,8-3,11-2 LMO instruction 12-108 LNCNTbits 6-17,6-24 local address/data bus 2-8 local memory interface 11-1, 11 -30 addressing mechanisms 1 1 -23 hold interface timing 11-18 I/O register access cycles 11-13 internal cycles 11-13 memory bus request priorities 11-4 read cycle 11-8 read-modify-write operations 11-15 registers 6-8 CONTROL 6-11,11-3 CONVDP 6-15,11-3 CONVSP 6-16,11-3 PMASK 6-43,11-3 PSIZE 6-45,11-3 REFCNT 6-46,11-3 register-transfer cycles 11-9 signals 11-2 timing 11-5-11-22 wait states 11-16 write cycle 11-7 loca l mem ory interface pins 2-4, 2-7-2-8 CAS 2-7 DDOUT 2-7 DEN 2-7 INCLK 2-7 LAD0-LAD15 2-8 LAL 2-7 LCLK 1 ,LCLK 2 2-8 LINT1,LINT2 2-8 LRD Y 2-8 RAS_2-7 TR/QE 2-7 W 2-7 local read/write strobes 2-7 logical instructions 12-19 logical pixels 4-6 M MAX operation 7-16 memory bus request priorities memory map 3-4 message buffers 6-36, 6-37 microcontrol ROM 1 -7 midpoint subdivision 7-30 MIN operation 7-16 MMFM instruction 12-109 MMTM instruction MODS instruction MODU instruction MOVB instruction 11-4 12-111 12-113 12-114 12-115,12-116, 12- 1 1 7, 1 2-1 1 8, 1 2-1 1 9, 1 2-1 20, 1 2-1 21 , 12-123,12-124 MOVE instruction 1 2-1 26, 1 2-1 27, 1 2- 1 28, 1 2-1 30, 1 2-1 32, 1 2-1 34, 1 2-1 35, 12-137, 12-139, 12-141, 12-143, 12- 1 45, 1 2-1 47, 1 2-1 49, 1 2-1 51 , 1 2-1 53, 1 2-1 55, 1 2-1 57, 1 2-1 59, 1 2-1 60 move instructions 1 2-20 MOVK instruction 12-161 MOVX instruction 12-162 MOVY instruction 12-163 MPYS instruction 12-164 MPYU instruction 12-166 MSGIN bits 6-36 MSGOUT bits 6-36, 6-37 multiple-GSP systems 9-15 N N bit 5-18 NEG instruction 12-168 N EG B instruction 12-169 NIL bit 6-19,6-22 NMI bit 6-32 non-branch 5-19 noninterlaced video 9-9 nonmaskable interrupt 6-8, 6-32, 8-5 nonmaskable interrupt mode 6-33 NOP instruction 12-170 NOT instruction 12-171 lndex-5 OFFSET register 4-12,5-11 on-screen memory 9-18 OR instruction 12-172 ORG bit 6-19,6-20 ORI instruction 12-173 outcode 7-30 output clocks 2-8 P flag 5-22 panning 9-25 PATTRN register 5-17 PBH bit 6-11,6-12 PBVbit 6-11,6-13 PBXbit 5-18 PC 5-19 pick window 7-26 picture elements 4-6 pin descriptions 2-2 pinout 2-2 pitch 7-4 pitch conversion factors 4-12 PixBIt direction 6-13 PIXBLT instruction 1 2-1 74, 1 2-1 79, 12-187, 12-193, 12-200, 12-206 PixBlts 4-15,7-4 pixel array 4-15 pixel block transfers 4-1 5, 7-4 pixel processing 6-1 3, 7-1 5 pixels 4-1,4-6-4-10 addressing 4-6 on the screen 4-7 pixel size 6-45 PSIZE register 6-45 representation in a register 4-6 size 4-6 storage in memory 4-7 XY addressing 4-8 PIXT instructions 1 2-21 3, 1 2-21 5, 1 2- 218, 12-220, 12-222, 12-224 plane mask 7-12 plane masking 6-43 DIV/IACIf K^nio+ar a A"3 POPST instruction 12-227 postclipping 7-29 PPbit 6-11 PPOPbits 6-13 preclipping 7-29 program control instructions 1 2-29 program counter 1 -5, 5-1 9 PSIZE register 4-12,6-45 PUSHST instruction 12-228 PUTST instruction 12-229 R RAS 2-7,11-2 REFCNT register 6-46 references 1-11 register file A 5-2 register file B 5-3, 5-5-5-1 7 register-direct operands 12-6 related documentation 1-12 relative branch 5-19 replace operation 7-18 RESET 2-11,8-10-8-13 effect on cache 5-21 effect on instruction cache 8-1 1 effect on TMS3401 registers 8-12 effects on I/O registers 6-3 HLT bit 6-35 RETIinstruction 12-230 RETS instruction 12-232 REV instruction 12-233 RINTVLbits 6-46 RL instruction 1 2-234, 1 2-235 row address strobe 2-7 row and column addressing 1 1 -6 ROWADR bits 6-46 RRbi t 6- 11 RUN/EMU 2-10 SADDR register 5-6 scan line counter 6-17 screen origin 4-8,6-19,6-20 screen refresh 6-21 , 6-24, 9-1 -9-27 screen refresh enable 6-19 screen size limits 9-2 screen - ref res h add ress 6-17 screen -refresh cycles 9-18 SDB 1-12 segment miss 5-22 self- bootstrap mode 8-10, 8-1 3 self-modifying code 5-23 S ETC instruction 12-236 SETF instruction 1 2-237 SEXT instruction 12-238 shift instructions 1 2-32 lndex-6 shift register transfer enable pin 2-7 shift register transfers 6-1 9 sign (N) bit 5-18 SLA instruction 1 2-239, 1 2-240 SLL instruction 1 2-241 , 1 2-242 software development board 1-12 software traps 8-9 source address register 5-6 source conversion factor 6-16 source pitch register 5-7 SP 1-6,3-6,5-2,5-4 SPTCH register 5-7, 6-16 SRA instruction 1 2-243, 1 2-244 SREbit 6-19,6-21 SRFADR bits 6-17,6-24 SRL instruction 1 2-245, 1 2-246 SRSTRT bits 6-24 SRTbit 6-19,6-21 SSA register 5-21 ST 5-18 stack 3-6-3-1 1 multiple- register operations 3-8 operation during a subroutine 3-9 operation during interrupts 3-9 structure 3-7 32-bit register operations 3-8 stack pointer 5-2, 5-4 starting address of array 4-15, 7-7 starting corner selection 7-7 status register 1 -5, 5-1 8-5-1 9 strobes 10-4 SUB instruction 12-247 SUBB instruction 12-248 SUBI instruction 1 2-249, 1 2-250 SUBK instruction 12-251 subroutine calls 1 2-48, 1 2-49, 1 2-50 subsegment miss 5-22 subtract with saturation 7-16 SUBXY instruction 12-252 Tbit 6-11 tap point register 6-25 TEMP register 5-17 TR/QE 2-7,11-2 transparency 7-11 enabling (Tbit) 6-12 TRAP 8-9 TRAP instruction 1 2-253 traps 8-9 two-dimensional arrays 4-15,7-4 V Vbit 5-18 and window checking 7-25 VCLK 2-9, 9-3 VCOUNT register 6-23, 6-48 VEBLNK register 6-49 vector addresses 8-2 vertical back porch 9-5 vertical front porch 9-5 vertical sync 2-9 vertical timing registers VCOUNT 6-48, 9-4 VEBLNK 6-49, 9-4 VESYNC 6-50, 9-4 VSBLNK 6-51,9-4 VTOTAL 6-52, 9-4 vertical video timing 9-8-9-12 VESYNC register 6-50 video clock 2-9 video enable 6-19 video timing 9-1-9-27 video timing and screen refresh display address 6-1 7, 6-1 9 display interrupt 6-23 registers 6-9 DPYADR 6-17 DPYCTL 6-19 DPYINT 6-23 DPYSTRT 6-24 DPYTAP 6-25 HCOUNT 6-26, 9-4 HEBLNK 6-27,9-4 HESYNC 6-28,9-4 HSBLNK 6-29,9-4 HTOTAL 6-39, 9-4 VCOUNT 6-48, 9-4 VEBLNK 6-49, 9-4 VESYNC 6-50, 9-4 VSBLNK 6-51,9-4 VTOTAL 6-52, 9-4 video timing signals 9-3 vide o timing signals 2-4, 2-9 BLANK 2-9 HSYNC 2-9 VCLK 2-9 VSYNC 2-9 VRAM 11-5 VRAMs 6-9,9-18 bulk initialization 9-26 tap point address 6-25 VSBLNK register 6-51 lndex-7 VSYNC 2-9, 6-22, 9-3 VTOTAL register 6-52 w W 2-7,11-2 Wbit 6-11,6-12 WEND register 5-13 window checking 4-1 6, 6-1 2, 7-25 window clipping 7-27 window end address register 5-1 3 window hit detection 7-26 window interrupt 8-5 window miss detection 7-27 window start address register 5-12 windows 5-12,5-13 WEND register 5-13 WSTART register 5-12 WSTART register 5-12 WVE bit 6-40 WVP bit 6-41 X XOR instruction 12-255 XORI instruction 12-256 XY addressing 4-8,4-10,4-11,4-14, 5-14 benefits 4-11 DYDX register 5-14 format 4-11 OFFSET register 5-1 1 XY-to-linear conversion 4-1 2, 6-1 5, 6-16 X1 E bit 6-40 X1 P bit 6-41 X2E bit 6-40 X2P bit 6-41 X3E bit 6-40 X3P bit 6-41 Zbit 5-18 ZEXT instruction 12-257 lndex-8 August 1988 Reader Response Card TMS34010 User's Guide We want to provide you with the best documentation possible - please help us by answering these questions and returning this card. Is this manual adequate in helping you to understand the TMS34010 and how to use it within a system? Please explain. How do you use this book - did you (or will you) read it from front to back, or do you use it mainly as a reference? Are the descriptions of graphics operations (transparency, pixel processing, XY addressing, etc.) clear and complete? Is the Instruction Set (Section 12) clear? Is it easy to use as a reference? What kinds of examples would you like to be included in this manual? What information would you add to or delete from the Reference Card? What would you add or change that would make this manual more accurate or easy to read? Additional comments: Thank you for taking the time to fill out this card. Your Name: Company and Application: NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES BUSINESS REPLY MAIL FIRST-CLASS MAIL PERMIT NO. 6189 HOUSTON, TEXAS POSTAGE WILL BE PAID BY ADDRESSEE Technical Publications Manager Texas Instruments Incorporated Semiconductor Group M/S 640 P.O. Box 1443 Houston, Texas 77251-9879 II.,.II..,I..I.I.I.I.,..I!I.I..I..I.Im.II.I,.,I,I.I Texas Instruments Printed in U.S.A., August 1988 1604899-9703 SPVU001A