OSBORNE 16-Bit Microprocessor Handbook OSBORNE 16-Bit Microprocessor Handbook OSBORNE/McGraw-Hili Berkeley, California Copyright © 1981, 1979, 1978, 1976, 1975 by McGraw-Hili, Inc. All rights reserved. Printed in the United States of America. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or Otherwise without the prior written permission of the publishers. Published by OSBORNE/McGraw-Hili 630 Bancroft Way Berkeley, California 94710 U.S.A. For information on translations and book distributors outside of the U. S. A. , please write OSBORNE/McGraw-Hili at the above address. 123456789 KPKP 8987654321 ISBN 0-931988-43-8 Cover design by Marc Miyashiro. Contributing Authors The following persons have contributed to the writing of sections of this book in addition to its principal authors. Bob Abramovitz Janice K. Enger Curtis A. Ingraham Susanna Jacobson Patrick L. McGuire Contents 1. The National Semiconductor PACE and INS8900 1-1 PACE and INS8900 Microcomputer System Overviews 1-2 INS8900 and PACE Timing and Instruction Execution 1-11 The INS8900 and PACE Instruction Set 1-11 The PACE DP8302 System Timing Element (STE) 1-35 The PACE Bidirectional Transceiver Element (BTE) 1-36 Using Other Microcomputer Support Devices with the PACE and INS8900 1-38 Data Sheets 1-D1 2. The General Instrument CP1600 2-1 CP1600 Instruction Timing and Execution 2-10 The CP1600 Instruction Set 2-16 Support Devices that may be used with the CP1600 2-27 The CP1680 Input/Output Buffer (lOB) 2-30 Data Sheets 2-01 3. The Texas Instruments TMS 9900, TMS 9980, and TMS 9440 Products 3-1 The TMS 9900 Microprocessor 3-2 TMS 9900 Timing and Instruction Execution 3-15 The TMS 9900 Instruction Set 3-35 The TMS 9980A and the TMS 9981 Microprocessors 3-44 The TMS 9940 Single-Chip Microcomputers 3-52 The TIM 9904 Four-Phase Clock Generator/Driver 3-67 The TMS 9901 Programmable System Interface (PSI) 3-70 The TMS 9902 Asynchronous Communications Controller 3-82 The TMS 9903 Synchronous Communications Controller 3-95 Data Sheets 3-D 1 4. Single Chip Nova Minicomputer Central Processing Units 4-1 A Product Overview 4-2 CPU Logic and Instruction Execution 4-18 9440 Timing and Instruction Execution 4-24 The MicroNova and 9440 Instruction Sets 4-35 9440-Nova Bus Interface 4-77 Data Sheets 4-01 5. The Intel 8086 5-1 The 8086 CPU 5-4 8086 Timing and Instruction Execution 5-30 The 8086 Instruction Set 5-47 The 8088 CPU 5-87 The Intel 8284 Clock Generator/Driver 5-91 The Intel 8288 Bus Controller 5-98 The 8282/8283 8-Bit Input/Output Latch 5-102 The 8286/8287 8-Bit Bidirectional Bus Transceivers 5-104 Some 8086 Microprocessor Bus Configurations 5-105 Data Sheets 5-D1 6. The Zilog Z8000 Series 6-1 The Z8001 and Z8002 CPUs 6-3 Z8001 and Z8002 Timing and Instruction Execution 6-23 The Z8000 Instruction Set 6-36 Data Sheets 6-D1 ix 7. The Motorola MC68000 7-1 MC68000 Pins and Signals 7-9 The MC68000 Instruction Set 7-38 Interfacing the MC68000 with 6800 Peripherals 7-44 Data Sheets 7-01 8. 2900 Series Chip Slice Products 8-1 The 2901. 2901 A. and 2901 B Microprocessor Slice 8-2 The 2903 Microprocessor Slice 8-40 The 2902 Carry Look-Ahead Device 8-87 The 2909 and 2911 Microprogram Sequencers 8-92 The 2910 Microprogram Sequencer 8-110 The 2930 and 2932 Program Control Units 22-125 Data Sheets 8-01 x INTRODUCTION This is one o'f two books that replace An Introduction to Microcomputers: Volume 2 - Some Real Microprocessors. That volume went through several printings and in 1978 was printed loose-leaf. Six bimonthly updates to the loose-leaf ver- sion were published in 1979 and early 1980 to provide information on newly introduced microcomputer devices. The loose-leaf version proved, however, to be quite unpopular with bookstores because of packaging and handling con- siderations. It also became more and more difficult to maintain a timely flow-of the bimonthly updates. For these reasons, Volume 2 is being replaced by two bound paperback books: the Osborne 4 & 8-Bit Microprocessor Handbook and the Osborne 16-Bit Microprocessor Handbook. Together these handbooks include all of the information that was contained in Volume 2 and the six updates. All known errors have been corrected and new data sheets have been added to the two handbooks. We have divided Volume 2 into two separate handbooks because the single-volume ver- sion would be over 1800 pages in length and rather difficult to bind. In addition, the devices lend themselves to this grouping since the 16-bit microprocessors are generally much more powerful than the four- and eight-bit microprocessors, and thus are directed toward different applications. Volume 2 was part of a four-volume Introduction to Microcomputers series: Volume 0 - The Beginner's Book was written for readers who know nothing about computers. Volume 1 - Basic Concepts provides a detailed explanation of microprocessor concepts including number systems, addressing modes, typical instruction sets, input/output techniques, and so on. The device descrip- tions in the 4 & 8-Bit Microprocessor Handbook and the 16-Bit Microprocessor Handbook assume that you have a working knowledge of the general concepts presented in Volume 1, and we will occasionally make references to material presented in Volume 1. Volume 2 - Some Real Microprocessors, which is being replaced by these handbooks. Volume 3 - Some Real Support Devices, which describes general support devices that may be used with any microprocessor. Some dedicated support devices are the 4 & 8-Bit Microprocessor Handbook and the 16-Bit Microprocessor Handbook. We define a "dedicated" support device as one best used with its parent microprocessor. We define a "general" support device as one that can be used with any microprocessor. We will occasionally make reference in this book to some of the general support devices in Volume 3. When designing a system based on one of the microprocessors described in this handbook, you should not auto- matically assume that the dedicated support devices described in this book are the only ones or the best ones to use with a particular microprocessor: you should always check the functionally equivalent parts de- scribed in Volume 3 In addition to this Introduction to Microcomputers series, we have begun publishing other individual handbooks. The first two handbooks of this series are: The 8089110 Processor Handbook, which includes the 8289 bus arbiter, and the CRT Controller Handbook, which describes five LSI CRT controller devices. This individual handbook approach w'ill be used in the future to maintain a convenient flow of detailed, objective information on new microprocessors and related support devices. SIGNAL CONVENTIONS Signals may be active high, active low or active in two states. An active high signal is one Which, in the high state, causes events to occur, while in the low state has no significance. A signal that is active low causes events to occur when in the low state, but has no significance in the high state. A signal that has two active states will cause two different types of events to occur, depending upon whether the signal is high or low; this signal has no inactive state. Within this book a signal that is active low has a bar placed over the signal name. For example, WR identifies a "write strobe" signal which is pulsed low when data is ready for external logic to receive. A signal that is active high or has two active states has no bar over the signal name. xi TIMING DIAGRAM CONVENTIONS Timing diagrams play an important part in the description of any microprocessor or support device. Timing diagrams are therefore used extensively in this book. All timing diagrams observe the following conventions: 1) A low signal level is equivalent to no voltage. A high signal level is equivalent to voltage present: Voltage present No voltage I 2) A single signal making a low-to-high transition like this: high low I 3) A single signal making a high-to-Iow transition is illustrated like this: high \ low 4) When using two or more parallel signals exist. the notation: r= signals change I states that one or more of the parallel signals change level. but the transition (high-to low or low-to-high) is unspecified). 5) A three-state single signal is shown floating thus: ~-------~ Signal floating 6) A three-state bus containing two or more signals is shown floating thus: _______r---~~---4~------ floating 7) When one signal condition triggers other signal changes. an arrow indicates the relationship as follows: Cond'bon ~ h". J Causes change here xii Thus a signal making a low-to-high transition would be illustrated triggering another signal making a high-to-Iow transition as follows: -~----- A signal making a high-to-Iow transition triggering a bus change of state would be illustrated as follows: c::::..- x 8) When two or more conditions must exist in order to trigger another logic event. the following illustration is used: The,. ~ cond;tio", ) cause change here Thus a low-to-high transition of one signal occurring while another signal is low would be illustrated triggering a third event as follows: 9) When a single triggering condition causes two or more events to occur, the following illustration is used: condition This ~ causes these changes xiii Thus a low-to-high transition of one signal triggering changes in two other signal levels would be illustrated as follows: 10) All signal level changes are shown as square waves. Thus rise and fall times are ignored. These times are given in the data sheets which appear at the end of every chapter. INSTRUCTION SET CONVENTIONS Every microcomputer instruction set is described with two tables. One table identifies the operations which occur when the instruction set is executed, while the second table defines object codes and instruction times. Because of the wide differences that exist between one instruction set and another, we have elected not to use a single set of codes and symbols to describe the operations for all instructions in all instruction sets. We believe any type of universal convention is like to confuse rather than clarify; therefore each instruction set table is preceded by a list of symbols as used within the table alone. A short benchmark program is given to illustrate each instruction set. Some comments regarding benchmark programs in general are, however, in order. We are not attempting to highlight strengths or weaknesses of different devices, nor does this book make any attempt to comparative analyses, since the criteria which make one microcomputer better than another are simply too dependent on the application. Consider an application which requires relatively high speed processing. The only important cri- COMPARATIVE terion will be program execution speed, which may limit the choice to just one of the microcom- ANALYSIS puters we are describing. Execution speeds of all of the microcomputers may, on the other hand, be quite adequate for a second application; in this case, price may be the only overriding factor. In a third application, a manufacturer may have already invested in a great deal of engineering development expense, using one particular microcomputer that was available in quantity ear- lier than any others; the advantages or disadvantages of using a different microcomputer, based on minor cost of per- formance advantages, will likely be overwhelmed by the extra expense and time delays involved with switching in midstream. And what about benchmark programs 7 There have been a number of benchmark programs in the literature, purporting to show the strengths or weaknesses of one microcomputer versus another; individual manufacturers have added to the confusion by putting out their own competing benchmarks, aimed at showing their product to be superior to an immediate rival. Benchmark programs are misleading, irrelevant and worthless for these reasons: 1) In a majority of microcomputer applications, program execution speed, and minor variations in program length, are simply overwhelmed by pricing considerations. 2) Even assuming that for some specific application, program length and execution speed are important, trivial changes in the benchmark program definition can profoundly alter the results that are obtained. This is one point we will demonstrate in this book, while describing individual instruction sets. 3) Benchmark programs are invariable written by the smartest programmers in an organization, and they take an enormous amount of time to ensure programming accuracy and excellence. This is not the level at which any user should anticipate "run of the mill" programmers working; indeed, a far more realistic evaluation of a microcomputer's instruction set could be generated by giving an average programmer too little time in which to implement an incompletely defined benchmark. This will more closely approximate the working conditions under which real products are developed. Of course, defining the "average programmer," "too little time" and an "incomplete specification" are all sufficiently subjective that they defy resolution. xiv We will demonstrate the capriciousness of benchmark programs via the following benchmark program: Raw data has been input to a general purpose input buffer. beginning at IOBUF. This raw data is to be moved to a permanent table. which may be partially filled; the raw data is to be stored in the data table starting with the first unfilled byte. The benchmark may be illustrated as follows: r-----.... TABLE HOW THIS BOOK HAS BEEN PRINTED Notice that text in this book has been printed in boldface type and lightface type. This has been done to help you skip those parts of the book that cover subject matter with which you are familiar. You can be sure that lightface type only expands on information presented in the previous boldface type. Therefore. only read boldface type until you reach a subject about which you want to know more. at which point start reading the lightface type. xv Chapter 1 THE NATIONAL SEMICONDUCTOR PACE AND INS8900 PACE was developed by National Semiconductor as a single-chip implementation of its multi-chip IMP-16. Since it was the first 16-bit. single-chip microprocessor. PACE is the first 16-bit microprocessor described in this book. As might be expected of an early entry product. PACE had a number of problems - both in design and fabrication technology - which limited its acceptance. Therefore the INS8900 was recently introduced by National Semiconduc- tor. The INS8900 is a redesigned. NMOS PACE. with internal logic problems resolved. In this chapter we will describe both PACE and the INS8900. Specifically. we will identify the problems faced by a PACE user. which have been eliminated in the INS8900. PACE and the INS8900 are 16-bit microprocessors because they handle data in 16-bit units. In many ways. however. the internal architecture of PACE and the INS8900 have an 8-bit orientation; this is something you should keep in mind while reading this chapter. because it does result in PACE and the INS8900 having program execution speeds that are comparable to. rather than being significantly faster than. the 8-bit microprocessors we have described in earlier chap- ters. The only current manufacturer for PACE and the INS8900 is: NATIONAL SEMICONDUCTOR. INC. 2900 Semiconductor Drive Santa Clara. CA 95050 There are agreements between Rockwell International and National Semiconductor and between Signetics and National Semiconductor to exchange microcomputer technical information and to produce each other's products. At the present time, neither Signetics nor Rockwell International has elected to second source PACE or the INS8900, and it is extremely unlikely that they will since both PACE and the INS8900 are products with limited futures. The amount of support that National Semiconductor provides is rapidly declining as newer, more powerful 16-bit microprocessors enter the marketplace. As shown in Figure 1-1, a typical PACE microcomputer will consist of a mixture of special-purpose PACE support devices and standard devices. The PACE microcomputer devices described in this chapter consist of: • The PACE CPU • The System Timing Element (STE). which generates clock signals for PACE and the system. • The Bidirectional Transceiver Element (BTE). which converts the MOS-Ievel PACE signals to TTL-level signals for other devices. The BTE is 8 bits wide. The INS8900 needs a clock generator; a 2 MHz crystal and a 74C04 inverter are recommended. Otherwise. there are no special INS8900 support devices; in fact. you can easily use any NMOS support devices described in Volume 3 with the INS8900. Specifically. the STE and BTE devices cannot be used with the INS8900. because they provide MOS-to-TTL signal level conversions for PACE PACE requires +5V. +8V and -12V power supplies. The +8V is a substrate vcltage require- PACE/INS8900 ment of the CPU and can be derived from the +5V power using a few discrete components. POWER SU PPL Y Therefore, a system can be implemented using only two primary power supplies: +5V and EXECUTION -12V. The INS8900 also uses three power supplies: +12V. +5V and -8V. SPEED The INS8900 uses a 500 nanosecond clock to provide typical instruction execution times in the range of 8 to 20 microseconds. PACE (tPC-16A/520D) uses a 750 nanosecond clock to provide typical instruction execution times in the range of 12 to 30 microseconds. 1 ·1 Before making direct comparisons of these instruction execution times with those of other devices. however. note carefully that because of the 16-bit architecture of PACE and the INS8900. it may take many instructions on another microcomputer to perform the same operations as a single INS8900/PACE instruction. MOS level signals are input and output by PACE. TTL level signals are input and output by the PACE/INS8900 INS8900. LOGIC LEVEL P-channel silicon gate. MOS/lSI technology is used with PACE. N-channel MOS technology is used by the INS8900. PACE AND INS8900 MICROCOMPUTER SYSTEM OVERVIEWS Figure 1-1 conceptually illustrates a PACE system. Figure 1-2 conceptually illustrates an INS8900 system. As with any mini- or microcomputer system, the CPU outputs data, address, and control signals. In the case of PACE and the INS8900, the data and address signals use the same bus lines; therefore, they are said to be multiplexed. Timing signals needed by PACE are generated by the System Timing Element (STE). SYSTEM TIMING PACE signals are all MOS level; the STE therefore generates two sets of timing signals; ELEMENT (STE) one set are MOS level for PACE, the other set are TTL level for external logic. BIDIRECTIONAL Since PACE signals are MOS level, Bidirectional Transceiver Elements (BTEs) must be TRANSCEIVER present to translate outgoing signals from MOS to TTL levels, and to translate incoming ELEMENT (BTE) signals from TTL to MOS levels. BTEs are quite indiscriminating in the signals they translate: in either direction. any signal arriving at an input pin is faithfully reproduced at the corres- ponding output pin. Control signal options allow a BTE to operate bidirectionally. to drive output Signals only. or to place both the MOS and TTL outputs in a high-impedance mode. Since the BTE is 8 bits wide. two BTEs operating bidirectionally provide buffering for the 16-bit Address/Data Bus. A third BTE. operating in the drive-only mode. pro- vides buffering for the PACE control signals (NADS. ODS. IDS. and Flags). A complete TTL level bus is created by combining BTE outputs with the TTL level timing signals output by the STE. Remember. though. that the 16 address/data lines are multiplexed. External logic that can demultiplex these lines and that can respond to the PACE timing and con- trol signal logic can connect directly to the TTL level address/data lines. For example. National Semiconductor provides ROM and RAM devices with on-chip address latches: these devices can interface directly to the TTL level bus. If memory devices or I/O ports are used that cannot demultiplex the address/data lines. you must ADDRESS provide separate logic to perform this function. No special PACE family devices are available for LATCHES this purpose: however. standard logic devices can be used. For example. two hex flip-flop devices AND and a quad flip-flop device would provide a latched 16-bit Address Bus. Two 8212 I/O ports could DECODERS also be used to latch the 16 bits of address information. The PACE Address Data Strobe (NADS) signal can be used as the ClK input to the flip-flops or as the STB input to the 8212s. The PACE Address Data Strobe (NADS) signal can be used as the ClK input to the flip-flops. In many systems this is the most effective approach since a latched Address Bus allows you to use simpler address decoding techniques to generate memory chip enable and I/O port select Signals. Figure 1-2 illustrates an INS8900 microcomputer system. logic is quite elementary - and equivalent to that which you would expect with any other microcomputer. Control Bus. Data Bus. and Address Bus lines are buffered using INS8208 bidirectional buffers. These are National Semiconductor standard catalog devices. recommended by National Semiconductor and illustrated in their literature: however. any other buffer would do equally well. The Data/Address Bus is shown being demultiplexed by 8212s to create separate Data and Address Busses. This again is straightforward logic. 1-2 INTERRUPT AND JUMP CONDITIONS - PACE STE () " ADDR/DATA CONTROL ~ '4-.../ BTE (2) BTE :;:; TTL LEVEL TIMING/CONTROL If .. RAM WITH ROM WITH ADDRESS ADDRESS LATCHES LATCHES TTL LEVEL ADDRESS/DATA ADDRESS I/O PORT LATCHES •••••• , ••4) AND/OR :i :.--".. 8212, 8255 DECODERS ··· ... ~ : · ·: .: : ! : i " MEMORY WITHOUT ADDRESS LATCHES TTL LEVEL ADDRESS DATA ~V, ~V, SENSE CONTROL ADDRESS DATA LINES LINES LINES LINES IN OUT OUT IN/OUT Figure 1-1. A National Semiconductor PACE Microcomputer System 1-3 SENSE LINES IN CONTROL BUS INS8900 TWO INS8208s nnOi 74C04 TWO INVERTER INS8212s ROM RAM PERIPHERAL Figure 1-2. A National Semiconductor INS8900 Microcomputer System INS8900 PROGRAMMABLE REGISTERS The INS8900 (and PACE) has four 16-bit Accumulators and a 16-bit Program Counter; these registers may be il- lustrated as follows: ACO Primary Accumulator AC1 Secondary Accumulator AC2 Secondary Accumulators AC3 and Index Registers PC Program Counter Accumulator ACO may be likened to a primary Accumulator as described for our hypothetical microcomputer in Volume 1. Accumulator AC1 is a secondary Accumulator. Accumulators AC2 and AC3 are equivalent to a combination of secondary Accumulators and Index registers. Recall from Volume 1, Chapter 6 that an Index register differs from a Data Counter in that the Index register contents are added to a displacement (which is provided by a memory reference instruction) in order to determine the effective memory address. The Program Counter serves the same function in an INS8900 system as it does in our hypothetical microcom- puter described in Volume 1. Figure 1-3 illustrates that part of our general microcomputer system logic which has been implemented in the INS8900 microprocessor. 1-4 Clock Logic Interface Logic Interface Logic Programmable Read Only I/O Ports Timers Memory Figure 1-3. Logic of the INS8900 Microprocessor INS8900 STACK A Stack is provided on the INS8900 (and PACE) chip. The Stack is 16 bits wide and 10 words deep. The Stack is not a cascade stack. as described in Volume 1. Chapter 6; rather. chip logic maintains its own Stack Pointer to identify the next free Stack word. The Stack Pointer is automatically incremented and decremented in response to Push and Pull operations. Stack Push and Pull operations are initiated by CPU logic during execution of Jump-to-Subroutine (JSR) and Return-from-Subroutine (RTS) instructions. and during interrupt processing. to automatically save and restore the Program Counter. In addition. the Stack can be used for temporary storage of data or status information. There are instructions which allow you to transfer words between the Stack and any Accumulator. or the Status and Control Flag register. This capability can significantly reduce the number of memory accesses required (thus increasing system speed) and can also reduce read/write memory requirements since intermediate values can be stored on trh-.e.S..t.a-.c..k_ _ _.. Whenever the Stack becomes completely filled or emptied. an Interrupt Request is INS8900 AND generated on the INS8900 chip. If you have enabled Stack Interrupts. program execution will PACE STACK be suspended. allowing you to deal with the situation. A Stack Fu II condition will indicate that INTERRUPTS it is time to dump data accumulated on the Stack out to read/write memory. 1-5 INS8900 AND PACE ADDRESSING MODES Most INS8900 (and PACE) memory reference instructions use either direct or direct, indexed addressing. A few instructions also offer indirect addressing and pre-indexed, indirect addressing. Refer to Volume 1, Chapter 6 for a description of these addressing modes. All memory reference instructions have the following object code format: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ~ Bit No. I I I I I f IxlRf I I I I I f I I '~....~.~,. - ........~~r-~-y~~~....___ ..~~......~/ l - ' - - - - - - - - - Address displacement { Addressing mode selection J 00 = Base Page address --------------- 11 + CYCLES DURATION I RESUME NORMAL OPN -:_ ",:.. _ . - - - DRIVEN LOW EXTERNALLY ~~f~I--~mm~ .. ~ ..._ _ _ _ _ _ _ _ _ _ _ _ _....J DRIVEN HIGH EXTERNALLY .. ""'" NHALT (OR USING INTL. PULLUP) 1-----:::: 3 ClK CYCLES o~ 5+te CYCLES 2: 4 CYCLES ....I ....I ~ CO NT CONTINUE DRIVEN EXTERNALLY .....f - -.........--CONTINUE DRIVEN BY PACE - - - - -__........----~ CONTINUE (EXTERNAL CIRCUITS HIGH IMPEDANCE) DRIVEN EXTERNAUY ~: 1. EXTERNAUY GENERATED TTL INPUTS OVERRIDE PACE MOS OUTPUTS. 2, ~ CROSSHATCH INDICATES "DON'T ~ CARE" INPUT STATE. 3. te = DURATION OF EXTEND DURING PACE I/O CYCLES. TIMING ASSUMES NO OTHER EXTENDS AND NO SUSPENDS. Figure 1-10. Timing Diagram for Processor Stall USing NHALT and CONTIN Signals But we must have a way of determining whether the CPU is going to be using the System Busses. There are several methods of making this determination; we will conceptually examine each of them within the context of three different DMA schemes: 1) DMA block data transfers initiated by the CPU 2) DMA block data transfers initiated by external logic 3) Cycle-stealing DMA transfers From a hardware point of view, the simplest method of implementing DMA in a PACE or CPU INS8900 system is to have the CPU initiate block transfers of data. Consider the following INITIATED approach. The CPU will treat an external DMA controller as a peripheral device and will estab- DMA BLOCK lish initial conditions such as starting address, word count. and direction (memory read or DATA TRANSFERS write). This information can be passed to the controller by treating its registers as memory locations and using Store instructions to write into the registers. When the required information has been passed, the CPU simply executes a Halt instruction. As we described earlier, when a Halt instruction is executed, the NHAL T control output line from the CPU is driven low (7/8 duty cycle). This signal could thus be used by the DMA con- troller as an indication that the CPU will not be using the System Bus and the DMA transfer can begin. When the transfer is completed, the DMA controller will use the CONTIN input to the CPU, as shown in Figure 1-9 , to terminate the Halt instruction. Normal CPU operation will then resume. 1-16 Most microprocessor.s have a Bus Request input signal that can be used by external logic to re- DMA BLOCK quest access to the System Busses. In a PACE or INS8900 system. the NHAL T input signal DATA TRANSFERS can be used to force the CPU into a Processor Stall. as described earlier. and thus free INITIATED BY the System Busses for DMA operations. The Acknowledge Interrupt (ACK INT) pulse on EXTERNAL LOGIC the CONTIN output line shown in Figure 1-10 is then equivalent to a Bus Grant signal. IN PACE AND and the DMA controller may begin the data transfer. When the transfer is complete. the INS8900 CONTIN line is used as a control input line to the CPU to terminate the Processor Stall. SYSTEMS Cycle-stealing DMA operations typically transfer a single word via the System Busses during a CYCLE-STEALING brief interval when the CPU is not using the busses. With this method. CPU operations need DMA IN PACE not be stopped; instead. they are only slowed down slightly. or in some cases not affected at AND INS8900 all. In order to implement cycle-stealing DMA. external logic must have a way of detect- SYSTEMS ing those time intervals when the CPU will not be using the System Busses. There are' ' - - - - - - - -... two ways that this can be accomplished with the INS8900 or PACE CPU. The first method involves the use of the EX- TEND input signal to the CPU to suppress or suspend input/output operations; the second method uses a special tech- nique to sense when the CPU is beginning an internal (non-I/O) machine cycle. Earlier we described how to use the EXTEND input signal to lengthen the CPU input/output cy- EXTEND USED cles. The EXTEND signal can also be used to prevent the CPU from beginning an I/O cycle. and TO SUSPEND thus ensure that the System Busses will be available to external devices for DMA operations. INS8900 AND PACE I/O Figure 1-11 illustrates both uses of the EXTEND signal. The CPU looks at the EXTEND input sig- DURING DMA nal at internal clock phases T1 and T6. Notice that during I/O cycles the IDS or ODS signal goes OPERATIONS high at the beginning of T6 and low at the beginning of T1. If EXTEND is high during T6. then ex- tra clock cycles are inserted after T8; this is the method that would be used to lengthen an I/O cy- cle. If EXTEND is high during T1. then extra clock cycles are inserted between T3 and T4; this is the method we would use for DMA operations. The trailing edge of IDS/ODS indicates that the CPU has just completed an I/O cycle and is therefore not using the System Busses at this instant. By setting EXTEND high at this time. we suppress the beginning of another I/O cycle while we use the busses for a DMA transfer. Notice that we are merely lengthening the beginning of the machine cycle. and thus delaying that part of the machine cycle where the CPU might begin I/O activity. We do not know whether the current machine cycle will be an internal machine cycle or an I/O cycle. and we do not care. We have merely stolen the busses by slowing down the CPU. 750 nsec 1.5 j1.sec InternalI . I ~ ~ I I.. ~I Clock Phase :T1 T2 T3 T4 T5 T6 T7 T8 EEl T1 T2 T3 E E T4 T5 T6 T7 T81T1 T2 T3 E E E E T4 T5 T61 I , I I I IDS/ODS I j...---"" CPU I/O CYCLE CPU I/O CYCLE CPU I/O CYCLE EXTENDED ONE CLOCK DELAYED ONE CLOCK DELAYED TWO CLOCK PERIOD PERIOD PERIODS !.. .1 C .l BUS I AVAILABLE 1.5 j1.sec 2.25 j1.Sec Figure 1-11. Using PACE EXTEND Signal for Cycle-Stealing DMA 1-17 There are two draw\Jacks inherent in the EXTEND method of cycle-stealing DMA. First. whenever we use the System Busses for a DMA transfer. we slow down the operation of the CPU. Second. we must wait until the CPU has just com- pleted an input/output cycle before we can perform the cycle steal. Since only about one-third of the CPU machine cy- cles are used for 110. this means that bus access for DMA will be quite limited. Both of these drawbacks can be elimi- nated if we can find some technique for determining when the CPU is performing an internal (non-I/O) machine cycle. We could then use the System Busses any time that the CPU is not using them (which is more than 60% of the time) and we could perform the 'DMA transfer without slowing down CPU operations. We shall now describe just such a technique. We stated earlier in this chapter that the internal clock phases (T1 through T8) are not availa- CYCLE-STEALING ble to external logic. However. National Semiconductor data sheets include a figure that shows DMA DURING circuits for internal drivers and receivers. A detailed examination of this figure reveals a very INS8900 AND interesting and useful fact: the JC13 (Jump Condition 13) pin on the CPU is intended as an in- PACE INTERNAL put signal: but because of the way in which the receiver for this signal is designed. it also pro- MACHINE CYCLES duces an output pulse on the JC13 pin during every machine cycle. The output pulse occurs during T4 of each machine cycle. and we can use this fact to design a very efficient cycle-stealing DMA arrangement. ~~-------------------------------------------------- BUS REQUEST (From DMA Device) NADS D Q ~----------------------~~~BUsGRANT (To DMA Device) CLR CLK DIVIDE-BY -FOUR CLR NINIT -----------------1........-------------' TCLK--------------------------------------------------~ (From STE) Figure 1-12. Idealized Circuit for Cycle-Stealing DMA During INS8900 and PACE Internal Machine Cycles Figure 1-12 shows a circuit that uses the output pulse provided by JC13 to implement cycle-stealing DMA. Recall that the CPU sends out a negative-going NADS pu Ise at T4 of every input/output cycle. This NADS signal is ANDed in our circuit with an external device's DMA Bus Request and applied to the D input of a flip-flop. The JC13 output pulse. which also occurs at T4. is inverted via a transistor and applied to the clock input of the flip-flop. Thus. if NADS is high at T4 (indicating that the current CPU machine cycle is not an I/O cycle) the flip-flop will be set if there is a Bus Request present. The output of this flip-flop is then used by external logic as a Bus Grant signal and the DMA transfer can be in- 1-18 itiated. Since we do not know whether or not the next cycle will be a CPU I/O cycle. we must terminate DMA activity on the bus prior to the next T4 time. In Figure 1-12. this is accomplished using a divide-by-four counter. The ClK input to the counter is a combination of the Bus Grant signal and the TClK signal which is available from the PACE STE. This results in the timing shown in Figure 1-13. Notice that this scheme makes the bus available for about 7/8 of a machine cycle. or approximately 2.25 microseconds. If you refer back to Figure 14-10 you will notice that this is about the same length of time as was obtained by using the maximum du ration of EXTEND. So. we have not in- creased the maximum time available for a DMA transfer. But. we have made two significant gains: DMA transfers can occur more frequently. and these transfers do not slow down CPU operations. We must add a final note of caution to the description of this otherwise straightforward DMA technique. There are several critical timing paths in the idealized circuit shown in Figure 1-12. Both the JC 13 pulse and the NADS signal occur at T4. although the trailing edge of NADS does occur slightly after the trailing edge of JC13. Therefore. the com- ponents used to provide ClK and D inputs to the flip-flop must be selected carefully to ensure that there is not a race condition. Additionally. we have shown the Bus Grant signal being reset at the end of T3. Since the leading edge of NADS occurs at T4. this timing relationship can be critical. However. if external devices such as address latches and decoders use the trailing edge of NADS. this timing should present no problems. T3 T4 T5 T6 T7 TB T1 T2 T3 T4 T5 T6 T7 TB T1 T2 T3 T4 T5 NClK (TClK*) ClK (TClK) JC13 ~~ ____________~r-\~ ______________________ T1 NADS BUS REO BUS GRANT ~ 2.25 fLsec for DMA Transfer Figure 1-13. Timing for Cycle-Stealing DMA During INS8900 and PACE Internal Machine Cycle THE INS8900 AND PACE INTERRUPT SYSTEM The INS8900 and PACE CPUs have complete on-chip interrupt systems. Six separate levels of interrupts are provided: one internal and five external interrupt request inputs. including a non-maskable input. Priority logic is provided on the CPU. and all interrupts are vectored. thus eliminating any polling requirements. Because of the various ways in which interrupts can be initiated. and also because of a few problems that exist in the PACE in- terrupt system. we will divide our description of the system into three parts: 1) Low priority external interrupts 2) Internal (Stack) interrupts 3) Non-maskable (Level 0) interrupts But first. let us take an overview of the INS8900 and PACE interrupt system. 1-19 IRO INT ENABLE lEN INTERRUPT LEVEL 0 (TO CPU'S INTERNAL INTERRUPT CONTROL CIRCUIT) " REQUEST (lRO) NHALT .-. J "" STACK FULL OR EMPTY INT REQ (INTERNAL TO PACE) , s i'"" R IR1 t-H f- ~ IE1 4 ~ NIR2 )-[>0- S j INTERRUPT IE2 ..... .- R IR2 ~ .... ~ .... PRIORITY ENCODER .f POINTEA ADDRESS ~ - ) ( NIR3 }[>0- S IR3 i'"" R IE3 NIR4 )-£>0- S IR4 .... R IE4 ( NIR5 )-1>0- S IR5 R i'"" IE5 Figure 1-14. Internal View of INS8900 and PACE Interrupt System 1-20 Figu re 1-14 depicts the interrupt log ic that is contained on the CPU. The highest priority in-· I NS8900 terrupt request is the non-maskable Level 0 interrupt request, which is initiated using AND PACE the NHALT control input to the CPU. The lowest priority interrupt request is NIR5. INTERRUPT PR.IORITIES The Stack Interrupt and each of the four lower-priority external interrupt requests can be individually enabled or disabled by setting or clearing associated bits (lE1 - IE5) in the ENABLING AND Status and Control Flag register. Notice in Figure 1-14 that these bits are shown as provid- DISABLING ing the 'R' input to a latch. The'S' input to each of these latches is the actual interrupt request INS8900 AND line. The significance of this is rather subtle. It means that an interrupt request need not supply PACE INTERRUPTS a continuous low level until it is acknowledged. Instead, any pulse exceeding one PACE clock period will set the associated interrupt request latch: this allows narrow timing or control pulses to be used as interrupt request inputs. Note, however, that the 'R' input to the latches overrides the'S' input. Therefore, if the individual Interrupt Enable flag is reset. it not only prevents the latch from being set by interrupt re- quests, it will also clear a previously latched request that mayor may not have been serviced. If this logic is not clear to you, you shou Id study the characteristics of the RS flip-flop. A master interrupt enable (lEN) flag is also provided in the Status and Control Flag register. lEN must be set true to allow any of the latched interrupt requests to be recognized by the CPU. The CPU checks for interrupts at the beginning of every instruction fetch. If an interrupt request is INS8900 AND present (and enabled!. the instruction fetch is aborted, the contents of the Program Counter are PACE pushed onto the Stack, and the master interrupt enable (lEN) is set low. The CPU then loads the INTERRUPT Program Counter with the address vector for your interrupt service routine and executes the in- RESPONSE struction contained at that address. (We'll describe the address vectors in the next paragraph.) The interrupt request just described requires a total of 28 clock cycles from the time the interrupt is recognized by the CPU until the time when the first instruction of your interrupt service routine begins execution. Memory locations 000216 through 000816 are used as pointer locations or address vectors. INS8900 You load each of these locations with the starting address of the interrupt service routine for each AND PACE interrupt as follows: INTERRUPT POINTERS MEMORY LOCATION INTERRUPT POINTER FOR 2 Stack Interrupt 3 NIR2 4 NIR3 5 NIR4 6 NIR5 7 Level 0 Program Counter Pointer l Special 8 Level 0 Interrupt Origin r case The level 0 interrupt is a special case which we will describe on its own. But first let us look at interrupts in general. When the CPU responds to an interrupt. it loads the Program Counter with the contents of memory locations 2 through 6, depending on the specific level of interrupt that is being acknowledged. Control is thus vectored to the proper ser- vice routine. Suppose, for example, memory location 4 contains the value 2A3016. If an interrupt request occurring at pin NIR3 is acknowledged, then during the acknowledge process the contents of the Program Counter are saved on the Stack, following which the value 2A3016 is loaded into the Program Counter. Had the value 472816 been in memory location 4, then 472816 would have been loaded into the Program Counter instead of 2A3016. Thus. whatever memo- ry address is stored in the memory location associated with the interrupt being acknowledged. this address will be loaded into the Program Counter, becoming the starting address for the specific interrupt service routine to be ex- ecuted. As part of the interrupt response we've just described. the CPU sends out a low-going pulse on INS8900 the CONTIN line. Refer back to Figure 1-10 and associated text for a description of the ACK AND PACE INT pulse. The last instruction executed by your interrupt service routine must be a Return- INTERRUPT from-Interrupt (RT!) instruction. This instruction sets lEN high to re-enable interrupts. then ACKNOWLEDGE pulls the top of the Stack into the Program Counter. This returns program control to the point AND RETURN where it was interrupted. The RTI instruction does not clear the internal Interrupt Request FROM INTERRUPT latch; therefore your interrupt service routine must reset the latch (using a Pulse Flag instruc- tion), or the same interrupt request will still be present after the RTI instruction has been executed. Once the latch has been cleared. it can then be re-enabled for subsequent interrupt requests. 1-21 The interrupt sequence does not save the contents of any registers except the Program Counter. If SAVING the program that was interrupted requires that the contents of CPU registers be saved and then INS8900 AND restored. your interrupt service routine must perform these operations. PACE CPU REGISTERS The CPU's response to a Stack interrupt is as described for external interrupts. However. the inter- DURING rupt request is generated internally by the CPU chip; it can be caused either by a Stack Full or a INTERRUPTS Stack Empty condition. Remember that the 10-word Stack is part of the CPU chip. It consists of an internal RAM and a pointer that can address Stack words 0 through 9. A Stack Empty interrupt re- INS8900 AND quest is generated whenever the pointer is at 0 and a Pull instruction is executed. A Stack Full in- PACE STACK terrupt request occurs when the pointer is at 7 (eight entries on the Stack) and a Push instruction INTERRUPTS is executed to fill the ninth word. The tenth word of the Stack will then be used as part of the in- terrupt response to store the Program Counter contents. Unless you intend to extend the Stack out into main memory. your application program will not require a Stack Empty or Full interrupt. These interrupts become error conditions and can be avoided by careful programming. If your program is treating the Stack Empty and Stack Fu II interrupts as error conditions. then you can disable Stack in- terrupts. in which case the full ten words of the Stack are available for nested interrupts and subroutines. Of course. this means that a Stack Full or Empty condition. should it occur. will become an undetected error. with unpredictable consequences. When using PACE. but not the INS8900. there is an additional reason for not using the Stack in- PACE terrupt capability unless you really need it. PACE has an internal circuit problem that can cause STACK improper interrupt response. If a Stack interrupt request occurs at the same time as an NIR3 INTERRUPT or NIR5 interrupt request, the Stack interrupt address vector will be incorrectly accessed PROBLEMS from location 0 instead of location 2. The solution recommended in PACE literature is to load both of these locations with the Stack interrupt vector. This apparently straightforward solution is complicated by the fact that location 0 also happens to be the initialization address; whenever the CPU is initialized. the first instruction ex- ecuted is the one that is contained in location O. Thus. the word in location 0 must serve a dual purpose: 1) It serves as an instruction whenever the CPU is initialized. 2) It serves as an address vector if a Stack interrupt occurs at the same time as NIR3 or NIR4. Here's an example. The object code for a Copy Flags to Register (CFR) instruction is 040016. So. if locations 0 and 2 both contain a value of 040016 the problem is solved. Your Stack interrupt service routine would have to begin at memory address 040016. but you would be correctly vectored to that address regardless of whether or not the inter- rupt error we've just described occurs. On initialization. the first instruction executed would be the CFR instruction: this is not a very useful initialization instruction. but at least no damage is done. For a fuller discussion of this interrupt problem and the solution. refer to PACE literature. Also keep in mind that the problem has been fixed in the INS8900. The non-maskable (Level 0) interrupt cannot be disabled and differs from the other interrupt levels both in the way it is initiated and in the way the CPU responds to it. The Level 0 interrupt request is initiated using the NHALT control input signal in com- INS8900 bination with the CONTIN input line. Figure 1-15 shows the timing relationships bet- AND PACE ween NHAL T and CONTIN that are required to initiate the non-maskable interrupt. If you NON-MASKABLE compare this figure with Figure 1-10. you will notice that the Level 0 interrupt request and (LEVEL 0) the Processor Stall begin in exactly the same way; NHAL T is driven low by external logic and INTERRUPT held low for some time after a low-going pulse (ACK INT) has been sent out on the CONTIN line. The only difference between the two operations is towards the end of the timing sequence. For a Processor Stall. NHALT is allowed to return high whi.le CONTIN is still high; for a Level 0 interrupt. the CONTIN line must be driven low by external logic before the NHAL T line is allowed to go high. This critical timing sequence is the only way that the CPU has to differentiate between a Processor Stall and a Level 0 interrupt. Notice that this Level 0 interrupt timing sequence never requires external logic to drive CONTIN high. Therefore. if you're using the CONTIN line for any of its other multi- ple functions (including the ACK INT output pulse) you can merely tie CONTIN to ground and Use NHALT to initiate the Level 0 interrupt. The response of the CPU to the Level 0 interrupt is subtly different from its response to INS8900 other interrupts. These subtle differences are related to the slightly different purpose of a non- AND PACE maskable interrupt versus a normal program interrupt request. A non-maskable interrupt is LEVEL 0 typically used only when there is a catastrophic error or failure (such as loss of power) or to imple- INTERRUPT ment a control panel for program development or debug purposes. Both of these uses require that RESPONSE an asynchronous. unplanned program termination have a minimum effect upon system status; that is. you want to leave behind a picture of the system as it looked immediately before the program termination oc- curred. 1-22 I--- > +'e o 11 cycusi® CYCUS1 ~ 8 +'e ~DRIVENLOWEXTERNALLY .,- ~U NHALT DRIVEN HIGH EXTERNALLY (OR USING INTERNAL PULLUP) I 5 CLOCK CYCLE MIN. I o INTERRUPT RESP. TIME 0) .. So 15 + 21e CYCLES0 __ J > 5 + 1e CYCLES ~ ..J ~ W - J $. 3 CLK ~ CYCLES • ACK .• I I ~ ~ \ ~ CONT APPROX.2 1/2+te0~ ~ I I CLOCK CYCLES CONTINUE DRIVEN EXTERNALLY CONTINUE DRIVEN BY PACE CONTINUE DRIVEN I I - EXTERNALLY EXECUTION EXECUTION SUSPENDED INTERRUPT SERVICE STARTS - I I - I - I - NOTES: 1. EXTERNALLY GENERATED TTL INPUTS OVERRIDE PACE MOS OUTPUTS 2. ~ CROSSHATCH INDICATES "DON'T ~ CARF'INPUT STATE. 3. te = DURATION OF EXTEND DURING PACE I/O CYCLES. TIMING ASSUMES NO OTHER EXTENDS AND NO SUSPENDS Figure 1-15. Initiating INS8900 and PACE Level 0 Interrupt Using NHALT and CONTIN Signals Remember that other levels of interrupts store the contents of the Program Counter or the Stack and reset the lEN flag in the Status and Control Flag register. This sequence obviously alters the "picture" of the CPU, since both Stack con- tents and Status and Control Flag register contents are changed. To avoid this, the Level 0 interrupt response by the CPU uses an external memory location to store the contents of the Program Counter. Memory location 000716 holds the address of the memory word where the Program Counter will be stored. The contents of the Status and Control Flag register are unaltered. CPU internal circuitry resets an "IRO INT ENABLE flag to prevent another interrupt from being recognized (refer to Figure 1-16). but this is not discernible to you. After the Program Counter has been saved in the designated memory location, the instruction contained in memory location 000816 is executed: this is the first instruc- tion of your Level 0 interrupt service routine. Suppose, for example, that memory location 000716 contains the value FF0016. Following a Level 0 interrupt request. the Program Counter contents will be stored in location FFO016. Follow- ing the Level 0 interrupt acknowledge, the actual instruction stored in memory location 000816 is executed. Note that the Level 0 interrupt acknowledge sequence has not altered anything within the CPU that is discernible to you or to a program: the Stack, Accumulators, and Status and Control Flag register are all unchanged. Additionally, avoiding use of the Stack ensures that there will not be a Stack overflow - and in consequence a Stack interrupt will not be generated by this interrupt response sequence. The normal Return-from-Interrupt (RTIl instruction that must be executed at the end of your inter- RETURN FROM rupt service routine causes the Program Counter to be restored from the Stack Since the Level 0 PACE LEVEL 0 interrupt sequence does not utilize the Stack to store the Program Counter, a different tech- INTERRUPT nique must be used to return control to the interrupted program. First you must execute a Set Flag (SFLG) or Pulse Flag (PFLG) instruction, referencing bit 15 in the Status and Control Flag register. This bit always appears to be set to a '1', but must be referenced in this case to enable lower levels of interrupts. Next you must ex- 1-23 ecute a Jump Indirect (JMP@) through the location pointed to by the contents of memory location 000716 to restore the original Program Counter contents. PACE. but not the INS8900. has some Level 0 interrupt circuit problems. PACE LEVEL 0 If a Level 0 interrupt occurs within the 12-clock-cycle period following the recognition of INTERRUPT any other interrupt, PACE will either perform a Processor Stall (which we described earlier) PROBLEMS or PACE will execute the Level 0 interrupt - but using the wrong pointer address. In short. you don't know what might happen under these circumstances. There is a solution for this prob- lem. It requires that external logic allow NHALT to be applied to the PACE CPU only while the NADS signal is present. provided no Acknowledge Interrupt (ACK INT) has occurred since the last NADS pulse. ACK INT is accompanied by a negative-going pulse on the CONTIN line. Sound complicated? It is. The circuit shown in Figure 1-16 is reproduced from PACE literature and solves the problem we've just described. We won't attempt to describe here how this circuit solves the problem. Note that this circuit only takes care of Level 0 in- terrupt problems; if you also want to use NHAL T and CONTIN to cause a Processor Stall. you must design additional ex- ternal logic. Once again, we must advise that these interrupt system problems exist in PACE CPU chips. The INS8900 has none of these problems. THE INS8900 AND PACE INSTRUCTION SET Table 1-1 summarizes the INS8900 and PACE instruction set. The primary memory reference instructions have typical minicomputer addressing modes. These instructions will also be used as I/O instructions. since external devices are identified via selected memory addresses . ...._ _ _ _ _'" In Table 1-1 . "direct addressing options" means the instruction can reference memory using any INS8900 of the direct or direct indexed addressing options described earlier. AND PACE DIRECT "Indirect addressing options" similarly specifies any of the indirect addressing options described ADDRESSING earlier. OPTIONS Both Branch and Skip instructions are provided. and each differs significantly from the philoso- phies described in Volume 1, Chapter 6. There are 16 conditions that can cause a Branch, as shown in Table 1-3 . Notice that three of the conditions are deter- mined by external inputs JC 13. 14. and 15. If a Branch-on-Condition is true. then the displacement which is added to the Program Counter is an 8-bit signed binary number as described in Volume 1. Chapter 6. There are three varieties of Skip-on-Condition instructions. SKNE. SKG and SKAZ compare the contents of an Ac- cumulator to a memory location which is addressed using direct or direct indexed addressing. Based on the results of the comparison. the instruction following the Skip mayor may not be executed. These three instructions are therefore combined Skip and Memory Reference instructions. ISZ and DSZ identify a memory location using direct or direct indexed addressing; the contents of the addressed memory location are incremented (ISZ) or decremented (for DSZ); if after the increment or decrement operation the memory location contains a 0 value. then the Skip is performed. The AISZ instruction adds an 8-bit. signed binary number to the contents of an Accumulator; if the result is 0, a Skip is performed. These Skip instructions will be very familiar to minicomputer programmers. and on most microcomputers are equivalent to a secondary Memory Reference or Immediate Operate instruction. followed by a Branch-on-Condition in- struction. 1-24 LEVEL 0 INTERRUPT REQUEST v NOTE: If the Level 0 Interrupt request has not already been reset to a logic '1' level before lACK goes to a logic T, then lACK should be used to reset the request signal. '/27476 FFl 10S----0I Q ....- - - - - -... 8094 NHALT lK - CLR 0 '/27476 '/.74L74 7404 FF2 FF3 NAOS CP Q CP Q K PACE CLR SET - 'V'/V-O lK +5 CLR 0 '/274L74 FF4 lACK (normally '0') Q 74L08 CONTIN ODS· INIT· Figure 1-16. Circuit to Prevent Conflicts Between PACE Level 0 Interrupts and Lower Priority Interrupts 1-25 The following symbols are used in Table 1-1 : ACO Accumulator 0 C Carry status CC 4-bit Condition Code described in Table 15-3 D Any Destination register DATA8 8-bit binary data unit DISP(X) Direct or indexed addressing operands as explained in the text. @DISP(X) Indirect addressing operands as explained in the text. EA The effective address generated by the specified operands. f 4-bit quantity selecting a bit in the Flag Word. FW Flag Word described in the text. lEN Interrupt Enable status I A 1-bit unit determining whether LINK is included in the shift/rotate. L Link status n Seven bits determining how many single bit shift/rotates are performed. o Overflow status PC Program Counter Any register of the Accumu lator: ACO. AC 1. AC2 or AC3 S Any Source register ST Top word of on-chip Stack. x < y.z > Bits y through z of the quantity x. For example. r< 7.0> is the low-order byte of the specified register. [ ] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. £[ ]] Implied memory addressing; the contents of the memory location designated by the contents of a register. A Logical AND V Logical OR .:v- Logical Exclusive-OR Data is transferred in the direction of the arrow. Data is exchanged between the two locations designated on either side of the arrow. Under the heading of STATUSES in Table 1-1 . an X indicates statuses which are modified in the course of the instruc- tion's execution. If there is no X. it means that the status maintains the value it had before the instruction was ex- ecuted. 1-26 Table 1-1. INS8900 and PACE Instruction Set Summary STATUSES TYPE MNEMONIC OPERAND(SI BYTES OPERAnON PERFORMED c 0 L LD r.DISP(X) 2 [rl-[EA] w Load any Accumulator, direct addressing options. 0 LD O,@DISP(X) 2 [ACO]-[EA] zw Load Primary Accumulator, indirect addressing options. > II: II: W 0 ST r,DISP(X) 2 [EA]-[rl ~ -- ::; ~ ;; c( Store any Accumulator. direct addressing options. ii: > Z ST O,@IDISP(X) 2 [ EA]-[ACO] Q. II: c( 0 Store Primary Accumulator, indirect addressing options. :!: W LSEX O,DISP(X) 2 [ACO]-[ EA](sign extended) :!: Load a signed byte into Primary Accumulator; extend sign bit into high order byte. Direct addressing options. ADD r.DISP(X) 2 X X [r]-[r]+[EA] w _ N -..J oz WI- Add to any Accumulator. direct addressing options. DEC A O,DISP(X) 2 X X [ACO]-[ ACO]-:-l EA]-.- [C) > W c( II: II: II: Add decimal with Carry to any Accumulator, direct addressing options. c( ~ ~ SUBB O,DISP(X) 2 X [ACO]-[ACO] - [EA].+lC] o W 0 X Z II: > Subtract from Primary Accumulator with borrow, direct addressing options. o > II: o II: 0 AND O,DISP(X) 2 [ACO]-[ACO]/\ [EA] ~ ~ ! AND with Primary Accumulator, direct addressing options. w:!: OR O,DISP(X) 2 [ACO]-[ ACO] V [EA] :!:- OR with Primary Accumulator, direct addressing options. _LI r,DATA8 2 [r< 7,0>]- DATA8 (sign extended) W Load immediate into any Accumulator. DATA8 is an 8-bit signed binary value. The sign bit I- is propagated through 8 high order bits. e( C W JMP DISP(X) 2 [PC]-EA :!: Jump by loading the effective difect address into the Program Counter. ~ JMP @DISP(X) 2 [PC]-EA Jump by loading the effective indirect address into the Program Counter. ... -_._-- ------ --------- - - - - - - _ . _ - -- Table 1-1. INS8900 and PACE Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(SI BYTES OPERATION PERFORMED C 0 L JSR DISP(XI 2 [STl-[ PCl [PC]-EA I&IQ 1-1&1 Jump to subroutine direct. As JMP direct. but push old Program Counter contents onto ~i Stack. ~~ JSR @OISP(X) 2 [STJ-[ PC] [PC]-EA ~O -g Jump to subroutine indirect. As JMP indirect. but push old Program Counter contents onto Stack. 1&1 CAl r.DATAB 2 [rl-[ r] +DATAB (sign extended) 1-1&1 Complement contents of any register. then add immediate data. c( ..... Q~ ~ 1&11&1 co ~o. ~O Zz SOC CC.DISP 2 If CC true: then [PCJ- EA 00 Branch on CC true. as defined in Table 14-3. iSE ZQ c(Z a:0 II:IU 1&1 U SKNE r.DISP(X) 2 If [rl " [EA]: then [PC]-[ PC] + 1 Z 1&1 Skip if any Accumulator not equal. a:o.i= If [ACO] > [EA]: then [PC]-[PC]+ 1 SKG O.DISP(X) 2 ~i2~ ~U) ..... Skip if Primary Accumulator greater. >01&1 SKAZ O.DISP(X) 2 If ([ ACO] /\ (EA]) = 0: then [PC]-[ PC] + 1 a:ZI&I Oc(5!l Skip if AND with Primary Accumulator is zero. ~ 1&1 ~ Table 1-1. 'INS8900 and PACE Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED C o L ISZ DISP(X) 2 [EA]-[ EA]+, >~w!!: If [EA] = 0; then [PC]-[ PC]+ 1 a:21-~ OWc(U) Increment memory. skip if zero. ::!ia:a: O DSZ DISP(X) [EA]-[ EA] - , ~~~~ a: If [EA] = 0; then [PC]-[ PC] + 1 Decrement memory. skip if zero. ~~!!: AISZ r.DATA8 [rl-[ r]+DATA8 Q~~ If [r] =0; then [PC]-[PC]+l wwO Add immediate to any Accumulator. Skip if zero. DATA8 is an 8·bit signed binary immedi- ::!ia.Z ~Oc( ate data value. ..., ~ CD a:www a: RCPY S.D [D]-[S] 1-1-> Move contents of any Accumulator (S) to any Accumulator (D). SS~ ww RXCH S.D [D]--[S] a: a: Exchange contents of any Accumulators. w RADD S.D x x [D]-[S]+[D] ~ .a: Binary add any Accumulator to any Accumulator. a:w wa. RADC S.D 2 x x [D]-[S1+[D]+[C] 1-0 Binary add with Carry any Accumulator to any Accumulator. ~a: RAND S.D [D]-[S] 1\ [D) ~w WI- a:U) AND any Accumulator with any Accumulator. (; RXOR S.D [D]-[S] ¥[D] w a: Exclusive-OR any Accumulator with any Accumulator. a:w SHL r.n.1 2 x Shift any Accumulator left n bits. Simple if 1 = 0; through Link if 1 = 1. ~~ U)a: SHR r.n.1 2 X Shift any Accumulator left n bits. Simple if 1 = O. through Link if , = 1. (;~ ROL r.n.' 2 X As SHL. but rotate. ~O ROR r.n.1 X As SHR. but rotate. Table 1-1. INS8900 and PACE Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED C 0 L PUSH r 2 [ST]-[r] Push any Accumulator contents onto Stack. PUSHF 2 [ST1-[FW] Push flags onto Stack. PULL r 2 [r1-[ST] ~ Pull top of Stack into any Accumulator. u PULLF 2 X X X [FW]-[ST1 ~ en Pull top of Stack into flags. XCHRS r 2 [ST1--[r] Exchange contents of any Accumulator with top of Stack. .... RTS DISP 2 [PC]-[ ST1 + DISP Return from subroutine. Move sum of DISP and top of Stack to PC. DISP is an a-bit signed iN o binary number. I- ~ RTI DISP 2 [PC]-[ ST]+ DISP :I II: [IEN]-1 II: w Return from interrupt. Like RTS. but enable interrupts. I- ~ CFR r 2 [r1-[FWI Copy flags to any Accumulator. CRF r 2 X X X [FW]-Er1 en :::I Move any Accumulator contents to flags. I- c( SFLG f 2 [FW1-1 I- en Set flag I to 1. (f= 0 to 15). PFLG f 2 [ FW < f>]- 1 for lour clock periods Pulse flag f (invert flag status for four clock periods). (f = 0 to 15). HALT 2 Halt The following symbols are used in Table 1-2: aa Two bits choosing the destination register. bb Two bits choosing the Index register cccc Four bits choosing the Condition Code. See Table 1-3. ee Two bits choosing the source register. ffff Four bits selecting a bit in the Flag Word. One bit determining whether Link is included in a shift or rotate. nnnnnnn Seven bits determining how many single bit shifts or rotates are performed. pp 8-bit signed displacement 00 Eight bits of immediate data x A "don't care" bit xx A "don't care" byte Table 1-2. INS8900 and PACE Instruction Set Object Codes MACHINE CYCLES INSTRUCTION OBJECT CODE BYTES TOTAL INTERNAL INPUT OUTPUT ADD r,DISP(X) 1110aabb 2 4 2 2 pp AISZ r,DATA8 0111"108a 2 5/6 4/5 1 GG AND O,DISP(X) 101010bb 2 4 2 2 pp BOC CC,DISP 0100cccc 2 5/6 4/5 1 pp CAl r,DATA8 011100aa 2 5 4 1 GO CFR f 000001aa 2 4 3 1 XX CRF f 000010aa 2 4 3 1 XX DECA O,DISP(X) 100010bb 2 7 5 2 pp DSZ DISP(X) 101011bb 2 7/8 4/5 2 1 pp HALT ()()()()()()xx 2 - 1 XX ISZ DISP(X) 100011bb 2 7/8 4/5 2 1 pp JMP DISP(X) 000110bb 2 4 3 1 pp JMP ((/lOISP(X) 100110bb 2 4 2 2 pp JSR DISP(X) 000101bb 2 5 4 1 pp JSR ~IJOISP(X) 100101bb 2 5 3 2 pp LD r,DISP(X) 1tOOaabb 2 4 2 2 pp LD O,OOISP(X) 101000bb 2 5 2 3 pp LI r,DATA8 010100aa 2 4 3 1 00 LSEX O,DISP(X) 101111bb 2 4 2 2 pp OR O,DISP(X) 10100tbb 2 4 2 2 pp 1-31 Table 1-2. INS8900 and PACE Instruction Set Object Codes (Continued) MACHINE CYCLES INSTRUCTION OBJECT CODE BYTES TOTAL INTERNAL INf:»UT OUTPUT PFLG f oollffff 2 6 5 1 Oxxxxxxx PULL r 01100laa 2 4 3 1 XX PULLF 000looxx 2 4 3 1 XX PUSH r 011000aa 2 4 3 1 XX PUSHF 0000llxx 2 4 3 1 XX RADC S,D 0011101aa 2 4 3 1 eexxxxxx RADD S,D 011010aa 2 4 3 1 eexxxxxx RAND S,D 010101aa 2 4 3 1 eexxxxxx RCPY S,D 010111aa 2 4 3 1 eexxxxxx ROL r,n,1 ool000aa 2 5+3n 4+3n 1 nnnnnnni ROR r,n,1 00loolaa 2 5 + 3n 4+3n 1 nnnnnnni RTI 011111xx 2 6 5 1 pp RTS 100000xx 2 5 4 1 PP RXCH S,D 011011aa 2 6 5 1 eexxxxxx RXOR S,D 010110aa 2 4 3 1 eexxxxxx SFLG f oollffff 2 5 4 1 1xxxxxxx SHL r,n,1 oo1010aa 2 5+ 3n 4+3n 1 nnnnnnni SHR r,n,1 oo1011aa 2 5+3n 4+3n 1 nnnnnnni SKAZ O,DISP(X) 101110bb 2 5/6 3/4 2 PP SKG O,DISP(X) 100lllbb 2 7/8 5/6 2 pp " SKNE r,DISP(X) 1111aabb 2 5/6 3/4 2 PP ST r,DISP(X) 1101aabb 2 4 2 1 1 PP ST O,@\DISP (X) 101100bb 2 4 1 2 1 pp SUBB O,DISP(X) 1ool00bb 2 4 2 2 PP XCHRS r 000lllaa 2 6 5 1 XX ·AII instructions may take additional cycles if Extend Read and Extend Write are implemented. 1-32 Table 1-3. Branch Conditions for INS8900 and PACE BOC Instruction Condition Mnemonic Condition Code (CC) 0000 STFL Stack Full (contains nine or more words). 0001 REOO (ACO) equal to zero (see Note 1). 0010 PSIGN (ACO) has positive sign (see Note 2). 0011 BITO Bit 0 of ACO true. 0100 BIT1 Bit 1 of ACO true. 0101 NREOO (ACO) is nonzero (see Note 1). 0110 BIT2 Bit 2 of ACO is true. 0111 CONTIN CONTIN (continue) input is true. 1000 LINK LINK is true. 1001 lEN lEN is true. 1010 CARRY CARRY is true. 1011 NSIGN (ACO) has negative sign (see Note 2). 1100 OVF OVF is true. 1101 JC13 JC 13 input is true (see Note 3). 1110 JC14 JC 14 input is true. 1111 JC15 JC15 input is true. NOTES: 1. If selected data length is 8 bits, only bits 0 through 7 of ACO are tested. 2. Bit 7 is sign bit (instead of bit 15) if selected data length is 8 bits. 3. JC13 is used by INS8900 and PACE Microprocessor Development System and is not accessible during prototyping. THE BENCHMARK PROGRAM For PACE, our standard benchmark program adopts this modified form: LD 2,IOBUF LOAD I/O BUFFER ADDRESS INTO AC2 LD O,@TABLE LOAD ADDRESS OF FIRST FREE TABLE BYTE RCPY 0,3 MOVE TO AC3 LOOP LD 0,0(2) LOAD NEXT BYTE FROM I/O BUFFER ST 0,0(3) STORE IN NEXT TABLE BYTE AISZ 2,1 INCREMENT AC2 AISZ 3,1 INCREMENT AC3 DSZ 10CNT DECREMENT I/O BUFFER LENGTH. SKIP IF ZERO JMP LOOP RETURN FOR MORE BYTES RCPY 3,0 MOVE AC3 CONTENTS TO ACO ST O,@TABLE RESTORE ADDRESS OF FIRST FREE TABLE BYTE In order to take advantage of INS8900 and PACE indirect addressing, three memory locations are reserved on page 0 as follows: 10BUF holds the beginning address of the I/O buffer. TABLE holds the address of the first free byte in the permanent data table. 10CNT holds the number of data words in the I/O buffer. 1-33 Memory, as organized for the benchmark program will look like this: -; :::~ I~;; I} Memory Data on Base Page ~ IOCNT - - -. . 0012 0013 '''' S-Start 0014 = ; I i I • of I/O ..... I • ~Start Data of Table I I YYYV ~"'t .......... T_ of Data Suppose the benchmark program rules arbitrarily require that a displacement be stored in the first word of the data ta- ble, and that this displacement be added to the address of the first word of the data table in order to compute the ad- dress of the first free data table word: ~ Fnt data table wom . ~ tab~ DISP Rm .... data won! Now the instructions: LD O,@TABLE LOAD ADDRESS OF FIRST FREE TABLE BYTE RCPY 0,3 MOVE TO AC3 must be replaced by these instructions: LD 3,TABLE LOAD BEGINNING ADDRESS OF DATA TABLE LD 0,0(3) LOAD DISPLACEMENT TO FIRST FREE TABLE WORD RADD 0,3 ADD DISPLACEMENT TO AC3 The new displacement must be restored to the first data table word. The instructions: RCPY 3,0 MOVE AC3 CONTENTS TO ACO ST O,@TABLE RESTORE ADDRESS OF FIRST FREE TABLE BYTE 1-34 must be replaced by these instructions: LD O,TABLE LOAD BEGINNING ADDRESS OF DATA TABLE IN ACO CAl 0,1 FORM TWOS COMPLEMENT RADD 0,3 SUBTRACT ACO FROM AC3 TO FORM DISPLACEMENT RCPY 3,0 MOVE DISPLACEMENT TO ACO LD 3,TABLE LOAD BEGINNING ADDRESS OF DATA TABLE IN AC3 ST 0,0(3) SAVE DISPLACEMENT IN FIRST FREE TABLE WORD Forcing an INS8900/PACE programmer to conform to programming logic suited to some other microcomputer's in- struction set only proves that the two microcomputers have different instruction sets. THE PACE DP8302 SYSTEM TIMING ELEMENT (STE) The STE is a very elementary clock device used with PACE, but not with the INS8900; it accepts inputs from an external crystal and generates the MOS clock signals for PACE, plus a pair of TTL-level clock outputs that can be used for synchronizing system operations. Figure 1-17 illustrates the pin assignments of the STE. 1 16 VCC 2 15 CK Xl X2 - 3 STE 14 CLK NCLK 4 13 EXTC - 5 DP8302 12 VGG TCLK TCLK* 6 7 11 10 - NCK LCK GND 8 9 LCK* PIN NAME DESCRIPTION TYPE Xl. X2 External crystal connections Input CLK. NCLK Damped MOS clocks to PACE Output CK.NCK Undamped MOS clocks to PACE Output TCLK. TCLK* TTL clocks to microcomputer system Output EXTC Extemal oscillator option Input LCK. LCK* Non-overlap capacitor connection VCC·VGG Power and Ground Figure 1-17. DP8302 System Timing Element (STE) Pins and Signals The frequency of the MOS clocks output by the STE is one-half the input crystal frequency. The STE is designed to operate with a 2.6667 MHz crystal. The MOS clock frequency is thus 1.3333 MHz which results in a clock period (tp) of 750 nanoseconds (tp = 1/f); this is the optimal clock period for the PACE CPU. Two pairs of MOS clock outputs are generated by the STE; NCLK/NCLK* and NCK/NCK*. The first pair of outputs contain a 25 n series of damping resistor; typically, these outputs will be used in circuit board layouts where the STE- to-PACE interconnect lines are less than two inches. The other MOS outputs, NCK and NCK*, are undamped. and you can select some other value of series damping resistors that might be better suited for your particular board layout. In addition to the +5V and -12V power supplies typically needed with MOS devices, the GENERATING PACE CPU has a third power supply requirement: a substrate bias voltage (Vaa) of +8V THE PACE must be applied to the CPU chip. Since it is unlikely that any other devices in your microcom- SuaSTRATE puter system would require this voltage level. the need for a third external system power source BIAS can be eliminated by providing a voltage converter circuit. Figure 1-18 shows a circuit that VOLTAGE generates the required Vaa voltage level; the circuit requires only a few components and uses one of the STE's TTL clock outputs as a 'charge pump' for the circuit. 1-35 PACE (+8V) 23 STE VBB .. O.lf1-F lN914 7 I ....r. 1- TCLK- -:::~ lN914 t:; ~ LM103 0 3V '"' . C) +5V Figure 1-18. Circuit to Generate Substrate Bias Voltage (VBB) for PACE CPU THE PACE BIDIRECTIONAL TRANSCEIVER ELEMENT (BTE) The DP8300 BTE is an 8-bit device that provides an interface between the PACE MOS-Ievel signals and the TTL-level signals required by other devices in a microcomputer system (the BTE is not used in INS8900 systems). If you refer to Figure 1-1 at the beginning of this chapter. you will see that a typical PACE microcomputer system requires three BTEs: two are used to buffer the CPU's 16 address/data lines. and the third is used as a TTL driver for the CPU's control signal outputs (NADS. ODS. IDS. F11 - F14). Figure 1-19 shows the pin assignments for the BTE. MBI/O 00 .. 2 1 24 23 VCC BOI/O 00 MBI/O 01 3 22 - - BOI/O 01 MBI/O 02 4 21 .. BOI/O 02 -- - MBI/O 03 5 20 BOI/O 03 MBI/004 MBI/O 05 .. 6 7 BTE 19 18 --'" BOI/O 04 BOI/O 05 MBI/O 06 8 17 BOI/0 06 MBI/O 07 9 10 16 15 - BOI/O 07 CEl WBO- GNO 11 12 14 13 -- CE2- STR- PIN NAME DESCRIPTION TYPE MBIIO 00 - 07 MOS Bus Data Lines Input/Output BOI/O 00 - 07 TTL Bus Data Lines Input/Output CE1. CE2-. Mode Control Signals Input STR-. WBO- VCC·GNO + 5V Power. and Ground Figure 1-19 BTE Signals and Pin Assignments 1-36 Table 1-4 summarizes the operating modes of the BTE. BTE MODE WBD* is the main mode control signal; when this signal is low, the other control signals are ig- ~~~T:~L nored and the BTE simply converts the MOS signals from the CPU into TTL-level output signals. The TTL outputs have a high fan-out capability and can service up to thirty 50 milliampere loads. The BTE used to buffer the PACE control signals normally operates continuously in this 'drive-only' mode (Mode 1) and is kept in this mode by simply connecting the WBD* signal to ground. The BTEs used to buffer bidirectional (address/data) lines must be switched back and forth between Modes 1 and 2; Mode 1 is used for CPU data output and Mode 2 for CPU data input. The simplest way of accomplishing this is to continuously enable the CE1, CE2*, and STR* controls by connecting them to appropriate logic levels (+5V or ground) and then use the WBD* signal for directional control. For example, in a PACE system, the IDS signal from the CPU could be used as the input to WBD*. During a PACE data input cycle, IDS will go high at the appropriate portion of the cycle and place the BTE in Mode 2; IDS is low at all other times and the BTE will operate in Mode 1. Table 1-4. PACE BTE Truth Table MODE CONTROL INPUTS MODE DESCRIPTION # CE1 CE2* STR* WBD* Receive MOS signals and 1 X X X 0 drive TTL signals Receive TTL signals and 2 1 0 0 1 drive MOS signals 0 0 0 1 Outputs in 3 0 1 0 1 high-impedance state 1 1 0 1 On positive-edge transition of STR*, latch into Mode 2 4 X X 1 1 or 3 as determined by state of CE1 and CE2* X = don't care +5V 15 CEl t - - -... BTE 105-----"' BUS GRANT _ _ _..._ _ _ _~l-4_t CE2* 13 STR* t---~ - Figure 1-20. Signal Connections to Control BTE in a DMA System 1-37 In a DMA or multiprocessor we will need to use BTE Mode 3 to place the BTE outputs in a high-impedance state and thus free the System Busses for use by other devices. In such a system an externally generated Bus Grant sig- nal could be used to place the BTE in Mode 3. Figure 1-20 illustrates one method of doing this: whenever the BUS GRANT signal is high. the BTE is in Mode 3. At other times the IDS signal operates as we've just described to switch the BTE back and forth between Modes 1 and 2. The fourth BTE mode uses a negative-to-positive transition on the STR* input to latch the state of CE1 and CE2*, and then places the BTE in either Mode 2 or Mode 3. This latch mode function might be useful when the BTE is used as a simple input buffer. For example. in a system with multiplexed address/data lines (such as PACE). address outputs could be applied to CEl and CE2*. and an address strobe signal (such as NADS) connected to STR*. Then. when the BTE is selected by the appropriate address bits. the trailing edge of the strobe signal will gate TTL data through the BTE and apply the data to the MOS lines of the CPU. When the BTE is not selected (addressed). its outputs will be in the high impedance state (Mode 3). USING OTHER MICROCOMPUTER SUPPORT DEVICES WITH THE PACE AND INS8900 The INS8900 CPU has numerous control signals which allow general purpose microcomputer support devices to be included in an INS8900system. Let us see how 8080A support devices might be used with the INS8900 CPU. First, we'll take an overview of the general CPU-to-device interface that all the 8080A family of devices expect. All of the 8080A family devices require that address information (or enabling/select signals derived from the ad- dress lines) be valid during the data transfer (read/write) portion of an input/output cycle. Recall that the INS8900 data lines are multiplexed: at the beginning of an input/output cycle. the data lines are used to output address informa- tion; the address information is then removed and the data lines are used for the actual input or output of data during the latter portion of the I/O cycle. Thus, the first thing we must do to interface the INS8900 to an 8080A family device is DEMULTIPLEXING to demultiplex the INS8900 address/data lines. There are several different approaches THEINS8900 that we can use to accomplish the required demultiplexing. ADDRESS/DATA LINES The most obvious way is to use D-type flip-flops or data registers with the INS8900 NADS signal as the clock pulse. Here are some of the standard 7400 family devices that might be used: ·7475 Double 2-Bit Gated Latches with Q and Q Outputs ·7477 Double 2-Bit Gated Latches with Q Output Only • 74100 Double 4-Bit Gated Latches ·74166 Dual 4-Bit Gated Latches with Clear ·74174 Hex D-Type Flip-Flops with Common Clock and Clear ·74175 Quad D-Type Flip-Flops with Common Clock and Clear Some of these devices require that the NADS signal be inverted to provide the necessary clocking Signal. Remember. though. that PACE address information is valid during both the leading edge (high-to-Iow transition) and trailing edge (Iow-to-high transition) of NADS; this generally simplifies the demultiplexing operation. In many systems you will not need to latch all16 bits of address information since it would be an unusual applica- tion that required all of the 64K of address space that this provides. There will usually be some tradeoff between system address requirements (how many system devices require a latched Address Bus) and the type and amount of address decoding required. When a fully latched Address Bus is provided. then simpler nonlatched address decoders can be used. In fact. often address bits can then be used directly as device select signals. or simple AND/OR gate combina- tions can perform the decoding. The alternative method of demultiplexing the address/data lines is to use address decoding devices that are clocked by the NADS signal and provide latched outputs. These latched outputs can then be used as the device/chip select Signals during I/O cycles. Many systems will use some combination of a fully latched Address Bus and simple or latched address decoders. In the discussions that follow, we will not generally describe in detail the method used to obtain the required addressing or select/enabling signals, since the method used is so dependent on the particular system that you are designing. 1-38 Once the INS8900 address/data lines have been demultiplexed, the only major con- INS8900 CONTROL siderations we are left with are to ensure that the input/output control signals are of SIGNAL POLARITY the proper polarity, and to verify that there are no timing problems. We will see that CONSIDERATIONS generally the INS8900 I/O control signals must be inverted to operate with the 8080A family of devices. although the 8212 offers us a choice of using the IDS and ODS signals. in either their original or in- verted form. Now we will provide a few specific examples of how devices from the 8080A family can be used with the INS8900 CPU. In our first example the 8212 I/O Port is used as a simple input port by the INS8900 CPU. THE 8212 USED The interconnections required are shown in the following figure: AS A SIMPLE INPUT PORT IN AN INS8900 SYSTEM DOO DIO Data to Data from INS8900 CPU external logic (System Bus) D07 DI7 Derived from - - - -. . a Ds1 8212 Address Lines 1 0 S - - - -......... DS2 (from INS89(0) Tie MD to Ground. Now STB clocks latches and DSi. DS2 enable buffers. NADS STB MD (from INS89(0) cur NINIT-------~ -- Here, the INS8900 Address Strobe signal (NADS) is inverted and used as the STB input to the 8212. Since MD is tied to ground, the STB signal clocks the data into the 8212: this will occur every time the INS8900 performs an input/output cycle, but the latched data will only be placed on the System Bus when the 8212 is selected. We accomplish device selection by applying a negative-true decoded address signal to the OS 1 input and then using the INS8900 IDS strobe signal as the DS2 input. Now, whenever the proper address is decoded, the IDS signal will cause the data that was previously latched by NADS to be placed on the System Bus for input to the INS8900. The timing would look like this: NADS STB DIO - DI7 OS2 (IDS) r----, 000- 007 Latched data output onto System Bus 1-39 Notice that the data from external logic will be latched whenever NADS occurs. The actual selection of the 8212 and input of the latched data to the INS8900 might not occur for quite some time. Frequently, this arrangement will be completely acceptable. If not. then an input-with-handshaking arrangement. which we will describe next. might pro- vide a better solution. Before we proceed to our next example. let us make one more general comment about interfacing devices to the INS8900 CPU. The INS8900 is a 16-bit microcomputer: it can transfer 16 bits of parallel data in a single input or output cycle. All of the other devices that we will be discussing are 8-bit devices. Frequently. you may not need the full width of the 16-bit Data Bus when transferring data between the CPU and external logic. In these cases, you can simply connect the data lines to/from the support device to the less significant data lines (DO - 07) of the INS8900 System Bus, as we have shown in our first example. Masking of the unused, more significant data bits would then be handled under program control. When you are going to utilize the full 16 bits of the Data Bus. you merely connect two 8-bit devices in parallel. as described in more detail for the CP1600 in Chapter 2. One device would be connected as we've already de- scribed; the data lines of the other device would then be connected to the more significant bits (08 - 015) of the System Bus. All other connections to the two devices (device select signals. strobe signals. etc.) would be identical. In this example. we will use the 8212 interrupt request signal INT to establish an input THE 8212 USED port with handshaking. The connection diagram is very similar to our first exam.ple: IN AN INS8900 SYSTEM FOR INPUT WITH HANDSHAKING 000 010 Data to 0 ata from ·· INS8900 CPU e xternal logic (System Bus) 007 · 017 Derived from Address Lines -'" - ,... Dsi 8212 STB External logic strobes d ata into latches IDS OS2 (from INS8900) Tie MO to Ground. Now STB clocks latches and 'i5s'l OS2 enable buffers toINS8900 INT MO Interrupt or Jump Condition 1 Input Pin Here. the device select signals are the same as in our first example. However, instead of using the INS8900 NADS signal to clock data into the latches, we will require external logic to input the STB signal when it has data ready. When the data has been latched. the 8212 will output the INT signal. which will be used as the in- put to one of the INS8900 CPU interrupt request lines (NIR2 - NIR5) or Jump Condition inputs (JC13 - JC15). The CPU,will then execute a service routine program that will include an instruction to read the data from the input port. This instruction will send out the input port's address, thus generating the DS 1 signal. and then gate the latched 1-40 data onto the System Bus when the IDS signal is generated. When the latched data is read out of the 8212. the INT sig- nal returns high to complete the transaction. This sequence is summarized by the following timing diagram Data latched by external logic 010 - 017 STB ----' OS2 (lOSl DOO - 007 .. ..------------ --------.. ............--.... Interrupt request or ~~ , ~~-- .. ..........- ~ Jump condition input onto System Bus to INS8900 CPU Using the 8212 as an output port in an INS8900 system requires a simple reversal of the THE 8212 USED connections we have described in the two preceding examples. and we will now use the AS AN OUTPUT ODS (Output Data Strobe) signal from the INS8900 instead of the IDS signal. PORT IN AN INS8900 SYSTEM 010 000 Data from Data to external INS8900 CPU logic (System Busl 017 007 8212 DsT Select signals generated ODS by external logic STB OS2 (from INS8900) Select Signal MO M To external logic •• - derived from Address Lines :• ~ ______J• to INS8900 interrupt lines or JC inputs 1-41 When the output port's address is sent out and decoded from the Address Bus, one input to the AND gate is enabled. The ODS signal then goes high to generate the STB signal and latch the contents of the system Data Bus into the 8212. This will cause the INT signal to go low and inform external logic that data has been loaded into the output port. The external logic will then generate the DS1 and DS2 signals to gate the data out of the latches. When the data has been gated out. the TNT signal will return high. This low-to-high transition could be used as an interrupt request or jump con- dition input to an INS8900 to enable output of new data. Notice that if we continuously enable the 8212 outputs by tying CST to ground and DS2 to +5V, then whenever the INS8900 loads a new data word into the latch, it will be immediately output to external logic. This approach may be more advantageous in some applications. Although the 8255 Programmable Peripheral Interface (PPl) is a more complicated 8255 PPI device than the 8212, interfacing the 8255 to an INS8900 CPU is no more complicated DEVICES (from a hardware point of view) than the INS8900-to-8212 interfaces we've described. USED IN This is due to the programmability of the 8255; mode control is performed by your pro- AN INS8900 gram instead of by hardwired signals. Let us look at an example to illustrate this point: SYSTEM DO To/From INS8900 CPU (System Bus) 07 Decoded Select - - - - -....,..;;.11 CS signal derived from Address Bus 8255 To/From AO Extemal Logic From latched { Address Bus ------1 A1 l iDS AD From INS8900 CPU ODS WR RESET NINIT The CS signal selects the 8255 and this signal would typically be the output of an address decoder. The AO and A 1 inputs select one of the three I/O ports (A, B or C) or the 8255 Control registers. The RD and WR control sig- nals are obtained by simply inverting the IDS and ODS signals from PACE. A generalized timing diagram for in- put/output operations would look like this: NADS ~ CS·AO·A1 _ _ _ _ _.. Select Device and Port Select IDS (ODS) _ _ _ _ _ _ _ _ _ _ ~ m~ ~ Data transferred ? 1-42 If two· 8255s are used in parallel to provide 16-bit I/O ports. there is one special con- TWO 8255 sideration beyond the general rules that we discussed earlier. Recall that mode control of DEVICES USED the 8255 is accomplished by writing data into one 8-bit Control register within the FOR 16-BIT device. When wired in parallel. one 8255 would be connected to bits 0 - 7 of the system I/O PORTS Data Bus. and the other 8255 would be connected to bits 8 - 15. Therefore. when we WITH INS8900 send out a 16-bit control word from the INS8900 CPU to establish the desired mode of operation. the upper and lower bytes of the word must be identical. THE 8251 USART AND 8253 From a hardware point of view. interfacing either of these devices to an INS8900 CPU is PROGRAMMABLE no different than interfacing an 8255 PPI to the INS8900. All we need to do is invert the COUNTERITIMER IDS and ODS signals from the CPU to obtain RD and WR (or lOR and lOW) signals. and USED IN INS8900 provide chip select and latched address bits for input to the devices. All other interfacing SYSTEMS and usage considerations are software functions and are described in Chapter 4. We will not describe them here since those portions of the device descriptions apply regardless of the CPUbeilig used. We will conclude our discussion of the use of 8080A devices in INS8900 systems by INS8900 AND comparing INS8900 System Bus signals with those of 8080A systems. This comparison 8080A SYSTEM will be a useful guide for interfacing any 8080A device to an INS8900 system. Table BUSSES 1-5 is a summary of INS8900 System Bus signals and the corresponding signals availa- COMPARED ble in 8080A systems. Two separate columns are provided for 8080A signals: the first ap- plies strictly to the 8080A CPU; the right-hand column refers to the Signals present in a typical three-chip 8080A system consisting of the CPU, a~ 8228 System Controller, and an 8224 Clock Generator and Driver. Since we have already discussed these signals in preceding paragraphs, we won't perform an item-by-item analysis of the table. Nonetheless, there are a few signals in this table that do need additional explanation. We have included the INS8900 BPS signal in the I/O Control Signal group although it is not the type of signal you would normally classify within this group. However. you will recall that when the BPS input is high. the INS8900 operates in a Base-Page-Split mode; base page then consists of the top 128 words of memory and the bottom 128 words of memory. In our earlier discussion of the BPS Signal. we described how this mode can be used to simplify ad- dressing of I/O devices. If you refer back to that discussion, you will see that by doing a little address decoding we can come up with a signal that will tell us when the INS8900 is addressing an I/O device (as opposed to memory). Let us call this decoded signal '1/0 Device' (100). Now, we can combine this decoded signal with IDS and ODS as shown below to generate signals equivalent to the 8080A liaR and tlow signals. IDS -----------~--"" ~--------------------VOR 1/00 - - - - - - - - - - _ OOS----------------~---L __~ K>----------------------I/OW And if we invert the 1/00 signal we can generate the 8080A MEMR.and MEMW signals. 10S-...;....---------,.--"""" K>-----------------------~ 1 / 0 0 - - -..... ~---------------MEMW OOS~-----------------_1L- __~ 1-43 One other portion of Table 1-5 requires some explanation. Notice that we have not drawn a line to separate the I/O control signals from the DMA-Related Signals. We've done this intentionally because there is some overlap- ping of functions with some of these signal,. For example, the INS8900 EXTEND 'signal can be used either to extend I/O cycles or to suspend I/O to allow DMA operations. We've also compared the INS8900 NHAl T output signal to the 8080A WAIT signal. This comparison is valid if limited to the CPU Halt state initiated in either system by a Halt instruc- tion. However, in 8080A systems the WAIT signal is also an acknowledgement to the READY or RDYIN input signals. There is no comparable EXTEND acknowledgement signal in PACE systems. The 6800 family includes many devices that might be useful in INS8900 systems, Unfor- 6800 SUPPORT tunately. all of these devices have one common requirement which effectively makes them DEVICES NOT incompatible for use in an INS8900 system. That requirement is enabling input signal E which COMPATIBLE should more accurately be described as a synchronizing signal. In 6800 systems. E is usually WITH INS8900 generated by ANDing one of the primary system clock signals (<1>2) with the Valid Memory Address signal (VMA) from the 6800 CPU. The clock period of the resulting E signal can be no less than one microse- cond. The clock signals (ClK and NClK) used in PACE systems. however. cannot have a clock period greater than 850 nanoseconds. and therefore cannot be used to simulate the 6800 2 signal. Therefore. we cannot recommend using 6800 family devices in an INS8900 system. Table 1-5. Comparing INS8900 System Busses to 8080A System Busses INS8900 8080A 8080A SYSTEM SYSTEM BUS SYSTEM CPU (CPU. 8228. 8224) SIGNALS SIGNALS SIGNALS Bidirectional 000 - 015 00- 07 DBO - DB7 Data Bus (16 Bits) (8 Bits) (8 Bits) Address Bus 000 - 015 AO-A15 AO-A15 Address information must be demultiplexed from Data Bus Control Bus NADS Strobe signal used by external logic to demultiplex - - I/O add'ress from Control Data Bus Signals IDS DBIN MEMR and 1I0R ODS WR M"EMW 'and iiOw BPS. - EXTEND READY RDYIN NHALT (output) WAIT WAIT NHALT and HOLD HOLD DMA- CONTIN il"lputs Related CONTIN HLDA HLDA Signals tACi<: INT o~tput) - - BUS EN NIR2 - NIR5 INT INT. CONTIN DO and SYNC (ACK INT output) INTA Interrupt - INTE INTE Signals Non-maskable Interrupt (CONTIN and - - NHALT inputs) Initialize NINIT RESET RESIN Jump Condition JC13-JC15 Inputs - - Control Flag F11 - F14 Outputs - - 1-44 DATA SHEETS This section contains specific electrical and timing data for the following devices: PACE CPU INS8900 PACE STE PACE BTE 1-01 PACE CPU r - -;;,;;;.;- -- - - - - ;;;;v;;'--' ~~ v.. v. ~ ~.~ .. ,,:'·1~ ""~~ v. ~ ....... 'DS -r-r FI1-Fl. I ~l I -L '. ,I I v. v.. I 4leu: .,.IT IV.. Y rl '. (un.ol ~ l I : ~ :v..-f :::i~r-l .'M I ~ L _____ ~'!!·~~ _____ ..J III·'"·,,,·,,CT'''' r . ,• • i f FIGURE 4. PACE Driver and Receiver Equivalent Circuits external clock timing PACE requires non·overlapping true and complemented clock inputs as shown in Figure 5. Refer to Electrical Characteristics for timing specifications. where: tp' CLOCK PERIOD 'NOVA' 'NOVB' CLOCK NONOVERLAP 'WCLK • 'WNCLK = CLOCK WIDTH FIGURE 5. External Clock Timing We reprint data sheets on pages 1-02 through 1-017 by permission of National Semiconductor Corporation. 1-D2 PACE CPU For systems utilizing memories with access times greater In DMA or multiprocessor systems it may be desirable than 2 clock periods it may be desirable to use the to prevent I/O operations by PACE when the bus is in EXTEND input to lengthen the I/O cycle by multiples use by another device. This may be done by using the of the clock period. Timing for this is shown in Figure 9. EXTEND signal immediately following an IDS or ODS In the case of either input or output operations. the as shown in Figure 10. Alternatively. the extend timing extend. should be brought true prior to the end of of Figure 9 may be used. as the extend function occurs internal phase 6. The timing shown in Figure 9 will independent of whether there is an I/O operation. that provide the minimum extend of one clock period. Hold- is. whenever the internal clock phase 6 occurs. ing EXTEND true for n additional clock periods longer will cause an extension of n + 1 clock periods. 00::.. ~POWE".OCLOC'SST"LE CLOC ~ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ .'.IT~~ ~'~l_____ll~.========~,,~cL~o~c'~'E~R,~oo~s========~.1 ••os~ L ~~~'~2--------------------- FIGURE 6. Initialization Timing .OOREa DATA ~~ ,~~ 'ACE _____....;O!.!!uT!!:.u!!!TS!.!.~CT~'VE~____~F=t~~oDiiuy;TPuiiTTSS;HiiG'GHiH'Mi"'~EO~••~CE~=======ti.=_ OUTPUT 1_1DC --.+1 I-toc TRA::~:: TRANSISTOR Off TRANSISTOR ON TRANSISTOR OFF -h. __ 1;:1 I::;! _-'-IN'UT'UffEADISA'LED~MOA'AVAll~ ~~...d?@&J - i ~'oo -41 I~ 'os ...,,'-...._ ....,"" .... _............ 1@J"'f:J:J...+,1=.0..,..-------- 1...... cI. . , . . . .....""' .... ,.,trtftCl ••1y.tMy".nDlftlllai.... IIf...Hy ·vl. . . . . . . . . ·V.-2.lSVlttlmt.... d'IIIIC"''',nput Figure 7. Address Output and Data Input Timing AOOR£SS OATA :-100 au::;! ~:~ ....._________~ OATAVAlIO--~~---- OOS V'UO --:11-_.00_ _ _ _ _ _ __ FIGURE 8. Data Output Timing 1-03 PACE CPU EXTRA CLOCK CYCLEISIOUE INTERNAL I I TO EXTEND ClOCKP:;lS:~~~ ClK_~~~~\- ADOO"::: -+_.......JI%1t:.:1 HADS PACE OUTPUTS ACTIVE E%t HIGH IMPEDANCE a PACE PUllU' TRANSISTOR OFF 1.:21 ON ~ INPUT DATA DISAIIlED DATA VALID OUTPUT DATA I?I DATA VALID t::a. ODS/IDS I?I 1%1- ~ I-IEH ---j __ tes EXTEND ~~ -I-'ES FIGURE 9. Extend I/O Signal Timing absolute maximum ratings All Input or Output Voltages with +0.3V to -21.5V Storage Temperature Range _65°C to +150°C Respect to Most Positive Supply Lead Temperature (Soldering, 10 300°C Voltage (VaB) seconds) Operating Temperature Range electrical characteristics (TA = o°c to +70°C, vss = +5V ±5%, vGG = -12V ±5%, vaa = vss + 3V ±0.5V) PARAMETER OUTPUT SPECIFICATIONS I CONDITIONS I MIN I MAX I UNITS 000-015, F11-F14, OOS, lOS, NAOS (These are open drain outputs which may be used to drive OS3608 sense amplifiers, or may be used with pull- down resistors to provide a voltage output.) Logic "1" Output Current (Except F11-F14) VOUT = 204V -1.0 -5.0 rnA Logic "1" Output Current, F11-F14 (Note 7) VOUT = 204V -0.7 -5.0 rnA Logic "0" Output Current VGG"';; VOUT:« VSS ±10 p.A NHALT, CONTIN (Low Power TTL Output.) Logic "1" Output Voltage lOUT = -650p.A 2.4 V Logic "0" Output Voltage lOUT = 300p.A 004 V INPUT SPECIFICATIONS 000-015, NIR2-NIR5, EXTENO, JC13-JC15, CONTIN, NINIT, NHALT (These are TTL compatible inputs.) (Note 2) Logic "1" Input Voltage VSS-1 VSS+0.3 V Logic "0" Input Voltage VSS-7 VSS-4 V Pullup Transistor "ON" Resistance VIN = VSS-1V 7 kD (000-015) (Note 3) Pullup Transistor "ON" Resistance VIN = VSS-1V 5 kD (all others) Logic "0" Input Current (000-015) VIN=Oo4 -1.8 rnA Logic "0" Input Current (NHAL T, CONTIN) VIN=Oo4 -12 rnA Logic "0" Input Current (all others) VIN=Oo4 -3.6 rnA Capacitance, Input and Output (except clocks) VIN = VSS, fT = 500 kHz 20 pF BPS (This is a MOS Level Input.) (Note 4) Logic "1" Input Voltage VSS-1 VSS+0.3 V Logic "0" Input Voltage VGG VSS-7 V Logic "1" Input Current VIN = VSS-1V 100 JJ.A CLK, NCLK (These are MOS Clock Inputs) Clock "1" Voltage (Note 5) VSS-1 VSS+0.3 V Clock "0" Voltage VGG VGG+ 1 V Input Capacitance (Note 6) 30 150 pF Bias Supply Current VBB = VSS +3.0V 100 JJ.A VGG Supply Current tp = .65p.s, T A = 25°C 40 rnA VSS Supply Current tp = .65p.s, T A = 25°C 85 rnA 1-D4 PACE CPU EXTRA CLOCK CYCLE!SIDUE INTERNAL l--~ , , CLOCK PHASE FIGURE 10. Suspend I/O Signal Timing TIMING SPECIFICATIONS (See Figures 5 to 10 for additional timing information.) ClK, NClK (See Figure 5) (Referenced to 10% and 90% Amplitude) Rise and Fall Time (t r , tf) 10 50 ns Clock Width (tw ClK tw NClK) 300 375 ns Clock Non-Overlap (tNOVA, tNOVS) 5 ns Clock Period (t p ) .65 .8 ps EXTEND Individual Extend Duration 2 ps Extend Setup Time (tES) (Note 10) 100 ns Extend Hold Time (tEH) (Note 13) 20 ns Propagation Delay (tOO) NHAlT, CONTIN (Note 9) Cl = 20 pF 200 ns NADS, IDS, ODS, 000-015 (Note 8) VOUT= 2.4V 100 ns 000-015 Input Setup Time (tOS) (Note 11) 200 ns Hold Time (tOH) (Note 12) o ns Turn-on or Turn-off Time of Pullup 150 ns Transistor (toe) (Note 13) Fll-F14 Pulse Flag (PFlG) Pulse Width 4tp -300 4tp +300 ns NINIT Initialization Pulse Width 8 clock periods NIR2-NIR5 Input Pulse Width to Set latch 1 clock periods Note 1: Maximum ratings indicate limits beyond which permanent damage may occur. Continuous operation at these limits is not intended and should be limited to those conditions specified under de electrical characteristics. Note 2: Pullup transistor provided on chip (See Figure 4.) Note 3: Pullup transistors on JC13, JC14, JC15 are turned on one out of 8 clock intervals. Pullup transistors on 000-015 are turned on during last clock period of Input Data Strobe (IDS). Other pullup transistors are on continuously when in data input mode. Note 4: Pulldown transistor provided on chip. Note 5: Clamp diodes and series damping resistors may be required to prevent clock overshoot. Note 6: Capacitance is not constant and varies with clock voltage and internal state of processor. Note 7: For VSS ;;. VOUT ;;. 2.0V output current is a linear function of VOUT. Note 8: Delay measured from valid logic level on clock edge initiating change to valid current output level Note 9: Delay measured from valid logic leilel on clock edge initiating change to valid voltage output level. Note 10: With respect to rising edge of NClK. (See Figure 9 and 10.) Note 11: With respect to falling edge of elK. (See Figure 7.) Note 12: With respect to the valid "0" level on the falling edge of Input Data Strobe (IDS). (See Figure 7.) Note 13: With respect to valid logic level of appropriate clock. 1-05 INS8900 Absolute Maximwn Ratings Voltage at Any Pin with Resepct to Most Negative Supply (VSS) . . . . . . . . . . . . . . . . -0.3 V to +20V Operating Temperature Range . . . . . . . . . . . . . . . . O°C to +70°C Storage Temperature Range. . . . . . . . . . . . . . . . -65°C to +150°C Lead Temperature (soldering, 10 seconds) . . . . . . . . . . . . +300°C Electrical Characteristics (TA = o°c to +70°C, VSS= ov, Voo = +12V ± 5%, VCC = +5V ± 5%, VSS = -8V ± 5%) Symbol Parameter Conditions Min Max Units OUTPUT SPECIFICATIONS 000-015, Fll-F14, OOS, IDS, NAOS (These are low-power Schottky·compatible push-pull outputs.) VOH Logic "1" Output Voltage lOUT = -500}JA 2.4 V VOL Logic "0" Output Voltage lOUT = 900}JA 0.4 V NHAL T, CONTIN (low-power Schottky outputs) VOH Logic "1" Output Voltage lOUT = -250}JA 2.4 V VOL Logic "0" Output Voltage lOUT = 600}JA 0.4 V INPUT SPECIFICATIONS 000-015, NIR2-NIR5, EXTENO, JC13-JC15, NINIT, CaNTIN, NHALT (low-power Schottky inputs) VIH Logic ''1'' Input Voltage 2.4 VCC+ 1 V VIL Logic "0" Input Voltage -1.0 +0.8 V. IL Input Leakage Current (except NHAL T, CaNTIN, JC13-JC15) VSS ~ VIN ~ VCC + 1 40 }JA IlL Logic "0" Input Current, NHALT, CONTIN (Note 2) VIN=0.4V -7.0 mA IlL Logic "0" Input Current, JC13-JC15 (Note 2) VIN = 0.4V -3.0 mA SPS (This is an MOS level input.) VIH Logic "1" Input Voltage VOO-l VOO+ 1 V VIL Logic "0" Input Voltage -1.0 +0.8 V IIH Logic "1" Input Current (Note 3) VIN = 13.6V 750 }JA CLKX (This is an MaS level input.) VCIL Clock "0" Voltage -1.0 +0.8 V VCIH Clock "1" Voltage VOO-l VOO+ 1 V CIN Input Capacitance 20 pF 100 Average Supply Current (VOO) (Note 4) tp = 500 ns, T A = 25°C 100 mA ICC Average Supply Current (Vec) (Note 4) tp = 500 ns, T A = 25°C 10 mA IBB Average Supply Current (VBB) VSB=-8V -200 }JA 1-06 INS8900 Tining Specifications Symbol Parameter Conditions Min Max Units CLKX t r , tf Rise and Fall Times (Note 5) 5 30 ns (Referenced to 10% and 90% amplitude) tp Clock Period 500 650 ns tCLK, tNCLK Pulse Width (Referenced to 50% amplitude) tp/2 - 5% tp/2 + 5% ns EXTENO Individual Extend Duration 2 ps tES Extend Setup Time (Note 6) 70 ns tEH Extend Hold Time (Note 6) 120 ns Propagation Oelay tOOl NHALT, CONTIN (Note 7) CL = 40pF, 200 ns 1 low-power Schottky load tD02 NAOS, IDS, ODS, 000-015 (Note 7) CL=40pF,1INS820810ad 200 ns 000-015 tDS Input Setup Time (Note 6) 50 ns tOH Hold Time (Note 8) 0 ns tFW Fll-F14 Pulse Flag (PFLG) Pulse Width 4tp - 300 4tp + 300 ns tNW NINIT Initialization Pulse Width 8 tp tlRW NIR2-NIR5 Input Pulse Width to Set Latch 1 tp Note 1: Maximum ratings indicate limits beyond which permanent damage may occur. Continuous operation at these limits is not intended and should be limited to those conditions specified under DC electrical characteristics. Note 2: NHAL T, CONTIN, and JC13-JC15 logic "0" input currents specified when the internal chip loads are putting out a logic "1." Note 3: Pull-down transistor provided on chip. Note 4: Supply currents measured with 40 pF and I NS8208 loads. Note 5: Clamp diode and series damping resistor may be required to prevent clock overshoot. Note 6: Measured with respect to appropriate valid logic level of CLKX. Note 7: Delay measured from valid logic level on CLKX edge initiating change to valid output voltage level. Note 8: With respect to the valid "0" level on the falling edge of Input Data Strobe (I DS>' Note 9: Typical load circuit: INS8900 RL = 3.6k (3.3k for testing) CL=40pF VREF = 1.72V _ VREF Note 10: Typical output delay versus load capacitance CL Note 11: Typical VDD supply current versus temperature. for load circuit in Note 9: 250 ~ 125.0 200 100.0 ~ C ~ 150 I!> 25'C oS '"'" 75.0 -~ 100 ~ 50.0 ~ - I r- - I 25.0 l- . 50 - I I I I I I 120 140 160 180 200 220 0 25 50 75 100 100 (ns) TEMP I'C) 1-07 INS8900 Tming Waveforms ~ J jJ:tNCLK:f.!l-tCLK-! ttl- -ltrl- Figure 1. External Clock Timing (CLKXI POWER AID POWER AND CLDCK$STABLE CLDCICS IIIIT I- INW • CLOCK PE'1!,DS MINIMUM~ I I- 16-24 CLOCK PERIODS ~--u IADS~ L ~: ~~~----------------------------------------------- Figure 2. Initialization Timing IITERIAL CLOCKPNASE CLKX ADDIIE. DATA IADI j--tDD I--tDD ~o~u~~~U~n~A~~~IV!E·~________~~::::::::::::~~~~~~~;:::::::::::=t~__~____ '= 'ACE _________ DUTPUT II _ I I P u r IUFFER DIUILED ~~7-_t~DD~________________~~ IDD IDI ______________________________ ~ .. ·VII MUST IE AT THE CORRECT LOGIC LEVEL AT THIS TIME. 10TE: .. IOU ARE REFEREICED TO VALID LOGIC LEVELS ON CLOCK IIPUT. IITERNAL CLOCK PHASES ARE SHOWW FOR REFEREICE OILY; THEY ARE lOT AVAILAILE EXTERIALL Y. Figure 3. Add.... Output and Data Input Timing 1-08 INS8900 lining Wavefonns (continued) INTERNAL CLOCK PHASE M':~~~~_\'-----'_I~t~ \---1 I \ ~ NADS t§j ~@J----++-~~-tDD---++--11-----t-F- OU~!~! ~~ ~~ ______________________ -J§__f.::::::::::::::::~DruAUTiAVVAlAL~ID~::::::::::::::=ta~~~ _____ VALID I-toD ODS _ _ _ _ _ _ _ _ _ _ _ _ _....I:l§Jo;:.] -Ii m ~ I-tDD Figure 4. Data Output Timing EXTRA CLOCK, i CYCLES DUE TO EXTEND INTERNAL E E CLOCK PHASE CLKX ADDRESS DATA-1_ _ _ ~ NADS PACE OUTPUTS -I__________.....;.;:AC:.;T.;.;IV.;.E_________....:.:JI INPUT_~-----~~~L------~~~~~~~~~~~~~~~~~~~~~~-- DATA DISABLED OUTPUT DATA -1_----------------------........:4 ODS/IDS _1-_____________________........:4 Figure 5. Extend I/O Signal Timing INTERNAL CLOCK PHASE CLKX DATA NADS IDS/ODS EXTEND __ ~~~~~~~~~ri~~~~~~~~------------------------- Figure 6. Suspend I/O Signal Timing 1-09 INS8900 Tming Wavefonns (continued) r->II+leCYCLES~1 NHALT ... •• 1-----DR1VEN LOW EXTERNALL Y - - - - - - 1 1 - - ,,:,.;':;~.~,::,"n:::.:.'<";;',,: 'n::.:-::L.~: .. 3 CLK CYCLES =1 1- I--- .. 15 + 2 Ie CYCLES~I 5 CLOCK CYCLES MIN INTERRUPT RE5I' TIME I--- ~ CONTIN NOTES: 1. EXTERNAllY GENERATED TIL INPUTS OVERRIDE PACE OUTPUTS. 2. III CROSSHATCH INDICATES "DON'T CARE"INPUT STATE. @Ie' DURATION OF EXTEND DURING PACE 110 CYCLES TIMING ASSUMES NO OTHER EXTENDS AND NO SUSPENDS. Figure 7. Relative Timing for Level-O Interrupt Generation --t- PROCESSOR STAll DURATIDN-l- RESUME NORMAL O P N - I EXECUTION -I--EXECUTION SUSPENDED > 11 + Ie CYCLES-=----l @ ~ . I---- APPROX 4 CYCLES NHALT L.._ _ _ _ _ _ _ _ _ _::::::::::::::~t--- D(~I:~~I:~~N~~~t~~~~~ 1-;. 5 + Ie CYCLES@..!--;' 4 CYCLES---l CONTIN @ --1 I I ~ !--APPRDX 2% + Ie CLOCK CYCLES EXTERNAll Y I CONTINUE DRIVEN ......._ - - - - CONTINUE DRIVEN BY PACE _ _ _ _ _ _ -CDNTINUE DRIVEN_ (EXTERNAL CIRCUITS HIGH IMPEDANCE) , EXTERNALL Y NOTES: 1. EXTERNAllY GENERATED TIL INPUTS OVERRIDE PACE OUTPUTS. 2. ~ CROSSHATCH INDICATES "DON'T CARE"INPUT STATE. @Ie+ DURATION OF EXTEND DURING PACE 110 CYCLES TIMING ASSUMES NO OTHER EXTENDS AND NO SUSPENDS. Figure 8. Relative Timing for Processor Stall The architecture of the INS8900 (shown in Figure 9) Stack full/stack empty interrupts are provided to facili- features a number of resources to minimize system pro- tate off-chip stack storage in those applications where gram and read/write storage, increase throughput, and additional stack capacity is desirable. reduce the amount and cost of external support hard- ware. Principal resources that allow these efficiencies to A six-level vectored priority interrupt system internal to be achieved include: the chip provides automatic interrupt identification, eliminating both program storage overhead and the time Four 16-bit general purpose working registers available normally required to poll peripherals in order to identify to the user reduce the number of memory load and store the interrupting device. operations associated with saving temporary and inter- Three sense inputs and four control flag outputs allow mediate results in system memory. the user to respond directly to specific combinations of An independent 16-bit status and control flag register status present in the microprocessor-based system, thus automatically and continuously preserves system status. eliminating costly hardware, program overhead, and The user may operate on its contents as data, allowing throughput associated with implementing these func- masking, testing, and modification of several bit fields tions over the system data bus. simultaneously. A comprehensive set of input/output control signals provided by the internal control logic simplifies inter- A ten-word U6-bid last-in, first-out (LIFO) stack faces to memory and peripherals and allows flexible inherently decreases response time to interrupts while control of I NS8900 operations. eliminating both program and read/write system storage overhead associated with storing stack information Single-phase 2.0 MHz clock input is easily generated with outside the microprocessor chip. a minimum of external components. 1-010 PACE STE recommended crystal specifications • AT-cut crystal • 2.6667 MHz ± 0.1%, fundamental mode • 5 mW maximum • 150 n maximum series resistance timing diagram tTDz TClKO TClK tPll -tPHZ 911% NClK OR NCK ClK OR CK 90% 911% -tpw TIMES FOR NCLK, NCK, ClK, AND CK MEASURED AT 111% AND 911% Figure 2. 1-011 PACE STE absolute maximum ratings [1] operating conditions Supply Voltage (Vee) . . . . . . . . . . . . . . . . . . . 7.0 V Min. Max. Units (VGG) . . . . . . . . . . . . . . . . . -15.0 V Supply Voltage (Vee! 4.75 5.25 V Input Voltage . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 V (VGG) -11.40 -12.6 V Storage Temperature . . . . . . . . . . . . -65°C to +150°C Temperature 0 +70 °c lead Temperature (soldering, 10 seconds) ..... 300°C dc electrical characteristics (Notes 2 and 3) Parameter Conditions Min. Typ. Max. Units OUTPUT SPECIFICATIONS: T ClK, T ClK* (TTL Clocks) VOH logic "1" Output Voltage Vee =4.75V IOH=-1mA 3.65 4.25 V VOL logic "0" Output Voltage Vee = 4.75V 10L = 32mA 0.25 0.4 V los Output Short Circuit Current (Note 4), Vee = 5.25 V, Vo = 0 -10 -33 -55 mA CK, NCK, ClK, NClK VOH logic "1" Output Voltage IOH = -100~A Vee - 0.9 4.5 V VOL logic "0" Output Voltage Vee= 4.75V I 10L = 100~ VGG + 0.1 VGG+ 0.25 V VGG=-11.4V I 10L = 5mA VGG + 0.2 VGG +0.5 V INPUT SPECIFICATIONS: EXTC V IH logic "1" Input Voltage 2.0 V IIH logic "1" Input Current Vee = 5.25V I VIN=2.4V 40 ~ I VIN = 5.5V 1.0 mA V IL logic "0" Input Voltage 0.8 V IlL logic "0" Input Current Vee = 5.25V V IL = 0.4V -0.9 -1.6 mA VeLAMP Input Clamp Diode Vee = 4.75V IlL = -12mA -0.8 -1.5 V POWER SUPPLY CURRENT lee Supply Current from Vee Vee = 5.25V 20 30 mA IGG Supply Current from VGG VGG = -12.6V -40 -55 mA ac electrical characteristics Crystal Freauency at 2.6667 MHz I A = O°C to +70°C, Vec - VGG = +17V ± 5% Limits Test Symbol Parameter Units Min. Typ. Max. Conditions tNOV1' tNov2 Non-Overlap Time 5 12 ns See Note 5 tpw MOS Clocks Pulse Width (NClK, ClK, NCK, CK) 300 320 ns See Note 5 tR MOS Clocks Rise Time (NClK, ClK, NCK, CK) 40 ns See Note 5 tF MOS Clocks Fall Time (NCLK, ClK, NCK, CK) 40 ns See Note 5 tPH1' tPH2 TTL Clocks to MOS Clocks High Level Delay -40 40 ns See Note 5 tPL1' tPL2 TTL Clocks to MOS Clocks Low Level Delay 80 ns See Note 5 tTD1' tTD2 TTL Clock to TTL Clock Delay -25 25 ns See Note 5 tSTART Time Delay from Last Power Applied to MOS Clocks Stabilized 100 ms See Figure 7 Not..: 1. "Absolute Maximum Ratings" are those values beyond which the safety of the device cannot be guaranteed. They are not meant to imply that the devices should be operated at these limits. The table of "Electrical Characteristics" provides conditions for actual device operation. 2. Unless otherwise specified, minImax limits apply across the O°C to +70°C temperature range and VCC = 4.75 V to 5.25 V, VGG = -11.4 V to -12.6 V power supply range. All typical, are given for Vce = 5.0V, VGG = -12V, and TA = +25°C. 3. All currents into device pins are shown as positive; currents out of davice pins are shown as negative. All voltages are references to ground unless otherwise noted. 4. Only one output at a time should be shorted. 5. The test conditions for measuring AC parameters are shown in Figures 2 and 3, with C1 = C2 = 60 pF, C3 = 80 pF, CNOV = 60 pF. Load conditions for MOS clocks and TTL clocks are shown in Figures 4 and 5. Including probe and jig capacitance, CL 1 = 20 to 80 pF, and CL2 =40pF. 1-012 PACE STE test conditions NCLK, NCK, CLK, CK LOAD TCLK*, TCLK LOAD OUTPUT UNDER TEST VCC OUTPUT L". UNDER TEST RL = 390n r'u" Cl = C2 = 60pF, C3 = 80pF, CNOV = 60pF* * ALL CAPACITD RS ARE ±5% Figure 3. Figure 4. Figure 5. typical characteristics TYPICAL NON·OVERLAP TIME VS. NON-OVERLAP CAPACITOR 80 VC~=5 J VGG=-12V CLI = 80pF TA=25° ./V VCC 0 0 / VGG 0 l/ 0 V NCLK, 0 V CLK, NCK, V OR CK 25 50 75 100 125 150 175 200 ..--ISTART_ CNOV(Pf) NDN·OVERLAP CAPACITANCE Figure 6. Figure 7. 1-013 PACE BTE/S absolute maximum ratings (Note 1) recommended operating conditions Supply Voltage 7V MIN MAX UNITS Input Voltage (All Inputs Except MBIIO Input Active) 5.5V Supply Voltage (VCC) 4.75 5.25 V Output Voltage 5.5V MaS Bus Input Current ±10mA Temperature (T A) 0 +70 °c Storage Temperature --65°C to +150°C Lead Temperature (Soldering, 10 seconds) 300°C dc electrical characteristics (Notes 2 and 3) PARAMETER TTL BUS PORT (BDI/O 00-07) I CONDITIONS I MIN I TYP I MAX I UNITS VIH Logical "1" Input Voltage 2.0 V VIL Logical "0" Input Voltage O.S V VOH Logical "1" Output Voltage WBO* = O.SV, 10H=-1 mA VCC-l.l VCc-O·S V MBI/O = 0.5 mA 10H = -5.2 mA 2.4 3.7 V VOL Logical "0" Output Voltage WBO* = O.BV, 10l = 20 mA 0.25 0.4 V MBI/O = 100pA 10L = 50 mA 0.4 0.5 V lOS Output Short Circuit Current WBO* = O.BV, MBI/O = 0.5 mA, -10 -35 -75 mA VOUT = OV, VCC = 5.25V, (Note 4) IIH Logical "1" Input Current WBO* = 2V, VIH = 2.4V SO pA II Input Current at Maximum WBO* = 2V, VIH = 5.5V, 1 mA Input Voltage VCC = 5.25V IlL Logical "0" Input Current WBO* = 2V, VIL = 0.4V -10 -250 /J. A VCLAMP Input Clamp Voltage WBO* = 2V, liN = -12 mA --0.2 -1.5 V 100 Outputllnput Bus Oisable Current WBO* = STR* = 2V, BOliO = 0.4V -BO SO /J. A to 4V, VCC = 5.25V MOS BUS PORT (MBI/O 00-07) 10 Logical "0" Input Current WBO* = O.BV, 10L(TTL) = 50 rnA, -5.0 0.10 mA VOL::; 0.5V, (Note 5) 11 Logical "1" Input Current WBO* = O.BV, 10H(TTL) = -1 rnA, 0.50 5.0 mA VOH ~VCC-l.1V, (Notes 5 and 6) Vo Logical "0" Input Voltage WBO* = O.BV, 10L(TTL) = 50 rnA, O.S V VOL ::;0.5V Vl Logical "1" Input Voltage WBO* = O.BV, 10H(TTL) = -1 rnA, 2.0 1.5 V VOH ~ VCC - 1.1V VOH Logical "1" Output Voltage WBO* = CEl = BOliO = 2V, 2.4 3.3 V IOH(MOS) = -1 mA, CE2* = STR* = O.BV VOL Logical "0" Output Voltage WBO* = CEl = 2V, 10L(MOS) = 0.2B 0.5 V 5 rnA, CE2* = STR* = BOliO = O.BV lOS Output Short Circuit Current WBO* = CEl = BOliO = 2V, -7 -15 -45 mA VCC = 5.25V, VOUT = OV, STR* = CE2* = O.BV, (Note 4) VCLAMP Input Clamp Voltage liN = -12 rnA -1.5 V 100 Outputllnput Bus Oisable Current MBI/O = O.4V to 4V, VCC = 5.25V -BO BO /J.A CONTROL INPUTS (WBD*, CE1, CE2*, STR*) VIH Logical "1" Input Voltage 2.0 V VIL Logical "0" Input Voltage O.S V IIH logical "1" Input Current VIN = 2.4V 20 pA 11 Input Current at Maximum VIN = 5.5V 1.0 mA Input Voltage 1-014 r PACE BTE/S -- dc electrical characteristics (Continued) (Notes 2 and 3) PARAMETER CONTROL INPUTS (WBD*, CE1, CE2*, STR*) I (continued) CONDITIONS I MIN I TYP I MAX I UNITS IlL Logical "0" Input Current V,N = O.4V -250 -400 JiA VCLAMP Input Clamp Voltage liN = -12 rnA --0.85 -1.5 V POWER SUPPLY CURRENT ICC Power Supply Current VCC = 5.25V 70 110 rnA Note 1: "Absolute Maximum Ratings" are those values beyond which the safety of the device cannot be guaranteed. They are not meant to imply that the devices should be operated at these limits. The table of "Electrical Characteristics" provides conditions for actual device operation. Note 2: Unless otherwise specified, minImax limits apply across the O°C to +70°C temperature range and the 4.75V to 5.25V power supply range. All typicals are given for VCC = 5V and T A = 25°C. Note 3: All currents into device pins are shown as positive, out of device pins are negative. All voltages are referenced to ground unless otherwise noted. Note 4: Only one output at a time should be shorted. Note 5: The MBI/O Input Characteristic Graph illustrates this parameter and defines the regions of guaranteed logical "0" and logical ", .. out- puts. See equivalent input structure for clarification. When the MBI/O input is loaded with a high impedance source (open), the TTL output will be in the logic "0" state. Note 6: The maximum MOS bus positive input current specification is intended to define the upper limit on guaranteed input clamp operation. At higher input currents (up to the absolute maximum rating) clamp operation is not guaranteed but TTL bus logic state is valid and no device damage will occur. Note 7: In most applications the MOS bus data lines are higher impedance and more sensitive to noise coupling than TTL bus lines. Conservative design practice would dictate routing MOS bus lines away from high speed, low impedance TTL lines and MOS clock lines or providing a ground shield when they are adjacent. ac electrical cha racteristics VCC = 5V ±5%, T A = o°c to +70°C PARAMETER CONDITIONS MIN TYP MAX UNITS DATA TRANSFER SPECIFICATIONS Receiving Mode (BOliO Bus to MBIIO Bus) WBD* = 3V, CL = 15 pF, tpdO 17 40 ns R L = 1 kn, (Figures 4 and 6) tpd1 20 40 ns Driving Mode (MBI/O Bus to WBD* = CEl = OV, tpdO 40 60 ns BOliO Bus) STR* = CE2* = 3V, tpd1 40 60 ns CL = 50 pF, R L = 100 n, (Figures 3 and 5) TRANSCEIVE~ MODE SPECIFICATIONS Select Bus tDS Chip Enable Data Set-Up (Figure 1) 45 23 ns tDH Chip Enable Data Hold (Figure 1) 0 ns tES Set-Up (Figure 1) 0 ns TTL Data Bus (BOlIO 00-07) tBO 00 Bus Data Output Disable CL = 5 pF, RL = 100 n, (Figure 1) 5 20 50 ns tBO OE Bus Data Output Enable CL = 50 pF, RL = 100 n, (Figure 1) 25 80 ns tBO IE Bus Data Input Enable (Figure 1) 30 ns tBO 10 Bus Data Input Disable (Figure 1) 30 ns MOS Data Bus (MBI/O 00-07) tMB 00 MOS Bus Output Disable CL = 15 pF, RL = 1 kn. (Figure 1) 15 50 100 ns tMB OE MOS Bus Output Enable CL = 15 pF. RL = 1 kn. (Figure 1) 50 100 ns tMB 10 MOS Bus Input Disable (Figure 1) 55 ns tMB IE MOS Bus Input Enable (Figure 1) 20 ns Select Bus tCLR Clear Previous Chip Enable I (Figure 2) I I 25 I 50 I ns 1-015 PACE STE/S switching' time waveforms and ac test circuits STR* C E Z · - - - - -....... CEI-------' WID' TTL DATA IUS --------------+- .MOS DATA BUS FIGURE 1 STR'~1I% CEZ' 3V CEIOV----------------~----------------------------------------- t.L.:---1 WID' TTL DATA BUS ----------+~ MUS OATA BUS ----------~ FIGURE 2 VCC=SV INPUTIOV~ O.'PF 100 WAVEFORM SV (NOTE I) SV OV INPUT T OUTPUT PdltpdO OUTPUT VOH VOL ~ 1.5V FIGURE 3. BOlIO Bus I.SV ALL DIODES ARE IN31114 *This input network simulates the actual drive characteristic of the PACE outputs FIGURE 5. MBIIO to BOlIO ac Loads VCC =sv INPUT3V~ WAVEFORM1.5V I.SV (NOTE 1) OV 'tpdO ~UTPUT VOH VOL ~ 1.5V FIGURE 4. MBIIO Bus I.SV ALL DIODES ARE IN3064 FIGURE 6. BOlIO to MBIIO ae Loads Note 1: Freq = 1 MHz, duty cycle = 50%, tR = tF :s:. 10 ns (refer to Figures 5 and 6). Note 2: All capacitance values include probe and jig capacitance (refer to Figures 5 and 6). 1-016 PACE BTE/S typical performance characteristics MOS Bus Input Characteristic MOS Bus Input Characteristic MOS Bus Voltagl! Threshold 0.8 Vee = 5V C oS 0.6 C oS STANDARD OUTPUT LOAj'NG , I- I- z 0.4 Z IC IC = u l- ...= 02 IC IC = u I- ...= TA =1 70'e --- f-TA ~ 25'e TA = ode z z 'I I I I I -0.2 o L-...l-.....~::t:::=:L____L-...J 0.5 1.0 1.5 2.0 2.5 3.0 o 0.5 1.0 1.5 2.0 2.5 3.0 1.2 1.3 1.4 1.5 1.6 1.7 1.8 INPUT VOLTAGE (VI INPUT VOLTAGE (V) INPUT VOLTAGE (VI MOS BUS MOS BUS MOS BUS Low-Lavel Output Voltage MOS Bus Current Threshold TTL Bus Threshold Characteristic vs Output Current TTL Bus 3.5 50 3.0 TA = 70'e I TA = o'e 40 r--r--1i--1i---J'Hi----l ~ 2.5 to I 30 1--1--1r--~f-H'----!---l ~ 2.0 I- :::> 1.5 - TA =25'e 20 I- :::> 1.0 Vee 15V '" 0.5 I I STANDARD OUTPUT LOADING OL--J.L.oCLI...-_I...----'I....----I 120 140 160 lBO 200 220 1.1 1.2 1.3 1.4 1.5 1.6 1.7 o 0.1 02 0.3 0.4 0.5 INPUT CURRENT (IlA) INPUT VOLTAGE (V) lOW·lEVEl OUTPUT VOLTAGE (V) MOS BUS ITLBUS TIL BUS High-Level Output Voltage Output Current vs Output Voltage Low-Lavel Output Voltage vs Output Current TTL Bus High Impedance State TTL Bus vs Output Current MOS Bus Vee = 5V 10 TA = 25'C !'I.. c oS I- en :::> '"I'\.r-... Z II: = II: U I- :::> ~ -5 '\ I\. -10 o O'--_ILU._L...----'L...----'L...----I o -10 -20 -3~ -40 -1 0 10 o 0.1 0.2 0.3 0.4 0.5 HIGH LEVEL OUTPUT CURRENT (rnA) OUTPUT VOLTAGE (V) lOW lEVEL OUTPUT VOLTAGE (V) TTL BUS ITlBUS MOS BUS Output Current vs Output High-Level Output Voltage Voltage High Impedance vs Output Current MOS Bus State MOS Bus 4.0 ~ Vee ~ 5V 10 , 3.5 TA=25'C- to r""\. c ~ 3.0 oS > 2.5 "" I- Z ...= I- IC I- 2.0 IC :::> :::> '" 1.5 I\. I- :::> ; '\. -5 '"= I- 1.0 % to 0.5 r\. i: o '\. o -4 -8 -12 -16 -20 -2 HIGH LEVEL OUTPUT CURRENT (rnA) OUTPUT VOL TAGE (V) MOS BUS MOS BUS 1-017 Chapter 2 THE GENERAL INSTRUMENT CP1600 The CP1600 and the TMS 9900 were the first two NMOS 16-bit microprocessors commercially available. Even a superficial inspection of the CP1600 shows it to be more powerful than the National Semiconductor PACE (or 8900). yet the CP1600 is not widely used. This is because General Instrument does not support the CP1600 tothe extent that National Semiconductor originally supported PACE. or most manufacturers support their 8-bit microprocessors. General Instrument's marketing philosophy has been to seek out very high-volume customers; General Instru- ment supports low-volume customers only to the extent that this support would not require substantial investment on the part of General Instrument. From the viewpoint of the low-volume microprocessor user. General Instrument's marketing philosophy is unfortunate. The CP1600 is an ideal microprocessor for the more sophisticated video games that are appearing. and its rich instruc- tion set and capable architecture make it an ideal choice for data processing terminals and home computer systems. However. due to its limited support. potential low-volume CP1600 customers are likely to choose another equally capa- ble product. Three CP1600 parts are available, differentiated only by the clock speeds for which they have been designed. The CP1600 requires a 3.3 MHz. two-phase clock and generates a 600 nanosecond machine cycle time. The CP1600 requires a 4 MHz. two-phase clock and generates a 500 nanosecond machine cycle time. The CP161 0 requires a 2 MHz. two-phase clock and generates a 1 microsecond cycle time. In addition to the CP1600 microprocessors themselves, the CP1680 Input/Output Buffer (lOB) is described in this chapter. Additional support devices for the CP1600 may be found in An Introduction to Microcomputers: Volume 3 - Some Real Support Devices. The sole sou rce for the CP 1600 is: GENERAL INSTRUMENT Microelectronics Division 600 West John Street Hicksville. New York 11802 There is no second source for the CP1600. General Instrument has a policy of discouraging second sources for its product line. The CP1600 is fabricated using NMOS ion implant LSI technology; the device is packaged as a 40-pin DIP. Three power supplies are required: +12V. +5V and -3V. THE CP1600 MICROCOMPUTER SYSTEM OVERVIEW Logic of our general microcomputer system which has been implemented by the CP1600 CPU is illustrated in Figure 2-1. Observe that the CP1600 requires external logic to create its various timing and clock signals. Some bus interface logic is shown as absent because a number of devices must surround the CP1600; these in- clude: 1) An address buffer. since data and addresses are multiplexed on a single 16-bit bus. 2) Buffer amplifiers to provide the power required by the type of memory and I/O devices that will normally be con- nected to a CP1600 CPU. 3) A one-of-eight decoder chip to create eight individual control Signals out of three controls output by the CP 1600. 4) A one-of-sixteen multiplex chip to funnel sixteen external status Signals into the CP1600 if using external branches. 2-1 Were you to compare Figure 2-1 with an equivalent figure for a low-end microprocessor such as the SC/MP (which is described in Chapter 3 of the Osborne 4 & 8-Bit Microprocessor Handbook{Osborne/McGraw-Hill, 1980), the CP1600 might appear to offer fewer logic functions; but within the functions it does provide, the CP1600 provides considerably more logic and program execution capabilities. Where low-end microprocessors choose to condense, onto a single chip, simple implementations of different logic functions, high-end products such as the CP1600 choose to provide more devices - with greater capabilities on each device. Clock Logic CP 1600 CPU o CP1680 I/O Buffer Interface Logic Programmable I/O Ports Timers Figure 2 -1. Logic of the CP 1600 CPU and CP 1680 1/0 Buffer 2-2 CP1600 PROGRAMMABLE REGISTERS The CP1600 has eight 16-bit programmable registers. which may be illustrated as follows: RO R1 R2 } Deta Counters R3 General Purpose registers R4 } Data Counters with R5 auto-increment R6 Stack Pointer R7 Program Counter The way in which the registers illustrated above are used is unusual when compared to other microcomputers de- scribed in this book. All eight 16-bit registers can be addressed as though they were general purpose registers; however. only Register RO has no other assigned function. We may therefore look upon Register RO as the Primary Ac- cumulator for this CPU. Registers R1. R2. and R3 serve as general purpose registers. but may also be used as Data Counters. In addition to serving as general purpose registers. R4 and R5 may be used as auto-incrementing Data Counters. Memory reference instructions that identify Register R4 or R5 as holding the implied memory address will cause the contents of Register R4 or R5 to be incremented - after the memory reference instructions have completed execution. Registers R6 and R7. in addition to being accessible as general purpose registers. also serve as a Stack Pointer and a Program Counter. respectively. Having the Stack Pointer accessible as a general purpose register makes it quite simple to maintain more than one Stack in external memory; also. you can easily address the Stack as data memory using the Stack Pointer as a Data Counter. Having the Program Counter accessible as a general purpose register can be useful when executing various types of conditional branch logic. While having the Stack Pointer and the Program Counter accessible as though they were general purpose registers may appear strange. this is a feature of the PDP-11 minicomputer - and is a very powerful programming tool. CP1600 MEMORY ADDRESSING MODE The CP1600 addresses memory and 1/0 devices within a single address space. When referencing external memory. you can use direct addressing. implied addressing. or implied addressing with auto-increment. Direct addressing instructions are all two or more words long. where the second or last CP1600 DIRECT word of the instruction object code provides a 16-bit direct address. ADDRESSING CP 1600 direct addressing instructions are complicated by the fact that CP 1600 program memory is frequently only 10 bits wide. That is to say. even though the CP1600 is a 16-bit microprocessor. its instruc- tion object codes are only 10 bits wide. If program memory is only 10 bits wide. then direct addresses will only be 10 bits wide. A 1O-bit direct address will access the first 1024 words of memory only. 2-3 Were you to implement a 16-bit wide program memory. then you could directly address up to 65.536 words of memo- ry; however. six bits of the first object program word for every instruction in program memory would be wasted. This may be illustrated as follows: Program Memory 15 10-9 o ~ Bit Number Three memory ....1------"'"'7"- reference instructions that specify direct addressing Six unused bits in each· of these memory locations Two single word instructions Instructions that reference memory using implied addressing identify general purpose CP1600 Register R1, R2, or R3 as containing the implied address. IMPLIED ADDRESSING A memory reference instruction which identifies Register R4 or R5 as providing the external memory address will always cause Register R4 or R5 contents to be incremented following the memory access; thus you have implied memory addressing with auto-increment. Memory reference instructions that specify implied memory addressing via Register 1, 2, 3, 4, or 5 can access 8-bit memory. An SDBD instruction executed directly before a valid memory reference instruction forces the memory reference instruction to access memory one byte at a time. If implied memory addressing via Register 1. 2. or 3 is specified. then the same byte of memory will be accessed twice. For an instruction that loads the contents of data memory into Register RO. this may be illustrated as follows: Memory } SOBD MVI R1.RO Program memory Rol yy PPQQ XXYY } Data memory 2-4 If Register R4 or R5 provides the implied memory address for the instruction which follows an SDBD instruction. then the implied memory address is incremented twice. and two sequential low-order bytes of data are accessed. For an in- struction which loads data into Register RD. this may be illustrated as follows: Memory Program memory RO ~--~--- ... R5 I PP Data memory " The SDBD instruction may also precede an immediate instruction. Now the immediate data will be fetched from the low-order byte of the next two sequential program memory locations. This may be illustrated as follows: Memory MVII XXYY.RO Without the preceding SDBD instruction. an immediate instruction will access the next single program memory word to find the required immediate data. Ten or more bits of immediate data will be accessed. depending on the width of program memory words. The CP1600 has no Stack reference instructions such as a Push or Pull; rather, a variety of CP1600 memory reference instructions can identify Register R6 as providing the implied address. STACK When Register R6 provides the implied address. it is treated as an upward migrating Stack ADDRESSING Pointer. When a memory write operation specifies Register R6 as providing the implied memory address. Register R6 contents will be incremented following the memory write. A memory read instruction that specifies Register R6 as providing the implied memory address will cause the contents of Register R6 to be decre- mented before the read operation occu rs. An unusual feature of the CP1600 is the fact that a variety of secondary memory reference instructions can also reference memory via the Stack Pointer. When these instructions are executed. Register R6 contents are decre- mented before the memory access occurs - as though a Pull operation from the Stack were being executed. Logically. Register R6. the Stack Pointer. is being handled as though it were a Data Counter with post-increment and pre-decrement. 2-5 Jump instructions use direct memory addressing. Jump instructions are all three words long. The direct address is computed from the second and third memory words as follows: 98765432 0 - --- 0 0 0 0 0 0 0 1 0 0 JR or JSR x X A A A A A A y y Word 2 B B B B B B B B B B - ~ Word 3 AAAAAABBBBBBBBBB Jump address (binary) yy are enable/disable bits for interrupts xx identify the register where the return address will be stored for JSR xx and yy are described in detail in Table 2-4. You can enable or disable interrupts whenever you execute a Jump or Jump-to-Subroutine instruction. The only difference between a Jump instruction and a Jump-to-Subroutine instruction is that the Jump-to-Subroutine instruction saves the Program Counter contents in Register 4, 5, or 6. The two high-order bits (xx) or the second Jump- to-Subroutine object code word specifies which of the three registers will be used to hold the return address. Jump-to-Subroutine instructions, like the Jump instruction, allow direct memory addressing only. CP1600 STATUS AND CONTROL FLAGS The CP1600 CPU has four of the standard status flags; in addition, it has some unusual control signals. These are the four standard status flags: Sign (5), This status is set equal to the high-order bit of any arithmetic operation result. Zero (Z). This status is set to 1 when any instruction's execution creates a zero result. The status is set to 0 for a nonzero result. The Carry (C) and Overflow (0) statuses are standard carry and overflow, as described in Volume 1. Four control signals (EBCAO - EVCA3) are output during a Branch-on-External (BEXT) instruction. The'se four sig- nals are output to reflect the low-order four bits of the SEXT instruction's object code. External logic receives these four signals and (depending on their state), mayor may not return a high input via ESC!. If ESC I is returned high, then the SEXT instruction will perform a branch: if ESCI is returned low. then the SEXT instruction will cause the next sequential instruction to be executed. The four control signals ESCAO - EBCA3 therefore provide the CP1600 with a means of test- ing 16 external conditions. CP1600 CPU PINS AND SIGNALS CP1600 CPU pins and signals are illustrated in Figure 2-2. DO - 015 is a multiplexed Address and Data Bus. Given a total of 40 pins in a package, CP1600 designers have been forced to share 16 pins between addresses and data. Three control signals, BDIR, BC1, and BC2, identify the traffic on the Address/Data Bus. External logic (one MSI chip) must decode these three signals to create eight control signals, as summarized in Table 2-1. Remaining signals may be divided into four groups: timing, status/control, interrupt, and OMA. Two timing clock signals are required: <1>1 and <1>2. These are complementary clock signals which may be illustrated as follows: <1>1 --1 \ I \ I L <1>2 \ " , , _ _~I \ I \~_.,Jr 2-6 ESCI 1 40 PCiT MSYNc' 2 39 GNO BCl 3 38 «111 BC2 4 37 «112 BDIR 5 36 YeO 015 6 35 VBB 014 34 VCC 013 33 BOROY 012 9 32 STPST 011 10 CPl600 31 BUsRQ 010 11 CPU 30 HALT, 09 12 29 BUSAK OS 13 28 iNiR 00 14 27 iNTRM 01 15 26 TCI 07 16 25 EBCAO D6 17 24 EBCAl 06 18 23 EBCA2 04 19 22 EBCA3 03 20 21 02 Pin Name Description Type 00-015 Data and Address Bus Tristate. Bidirectional BDIR. BCl. BC2 Bus control signals Output cl»1. «112 Clock signals Input MSYNC Master Synchronization Input EBCAO - EBCA3 External branch condition address lines Output ESCI External branch condition input Input PCiT Program Counter inhibit/software Input interrupt signal BDROY WAiT Input STPST CPU stop or stan on high-to-Iow transition Input HALT Halt state signal Output iNTR. iNTRM Interrupt request lines Input TCI Terminate current interrupt Output ijSiiQ Bus request Input "BUSAK External bus control acknowtedge Output VB8.VCC.VOO.GNO Power and Ground Figure 2-2. CP1600 CPU Signals and Pin Assignments MiYNC is a somewhat unusual signal. as compared to other microcomputer clock signals in this book. Following powerup. MSYNC must be held low for at least 10 milliseconds. On the subsequent riSing edge of MSYNC. logic inter- nal to the CP1600 CPU will synchronize the <1>1 and <1>2 clock signals to start a new machine cycle. Most of the CPU devices we have described in this book use a reset signal. or have internal powerup logic which performs this clock synchronization. Now consider the status and control signals. First of all. there are the four control outputs which we have already described: EBCAO - EBCA3. There is one con- ditional Branch instruction (BEXT) which will only branch if a high signal is input via EBCI. When the BEXT in- struction is executed. the low-order four BEXT instruction object code bits are output via EBCAO - EBCA3. External logic is supposed to decode these four signals by whatever means are appropriate - and thence determine whether ESCI should be input high or low. A high input. as we have just stated. will result in a branch: a lowinput will cause the next sequential instruction to be executed. In reality. there is no connection within CP1600 CPU logic between the EBCI input and the four EBCAO - EBCA3 out- puts. So far as external logic is concerned. the execution of a BEXT instruction is identified by signal levels output and maintained on the EBCAO - EBCA3 outputs. while the EBCI input determines whether a branch will or will not occur. How external logic chooses to determine whether EBCI will be set high or low is entirely up to external logic. The only vital function served by ESCAO - EBCA3 is to identify the instant at which a BEXT instruction is executed. Another unusual control signal provided by the CP1600 is PCIT; this is a bidirectional Signal. When input low. this Signal prevents the Program Counter from being incremented following an instruction fetch. This Signal is also output as a low pulse following execution of a software interrupt instruction. Instruction timing separates the active input and 2-7 active output of this signal: providing external logic adheres to timing requirements, a conflict between input and out- put logic will never arise. BDRDY is equivalent to the WAIT signal we have described for a number of other microcomputers. BDRDY is in- put low by any external logic which requires more time in order to respond to an 1/0 access. Recall that the CP1600 uses a single address space to reference memory or I/O devices. The 'SDR]jy signal causes the CPU to enter a Wait state for as long as B"i5'RI)V is being input low: however, during the Wait state CPU logic is not refreshed. Thus a Wait state cannot last for more than 40 microseconds, or the contents of internal CPU locations will be lost. STPST, a Halt/Reset input, is an edge-triggered signal. When external logic inputs a high-to-Iow transition via STPST, the CPU will complete execution of any interrupt instruction, then will enter a Halt state and output HALT high. If a non-interruptable instruction is being executed, then the Halt state will not being until completion of next interruptable instruction's execution. The Halt state will last until external logic inputs another high-to-Iow STPST transition, at which time the Halt output will be returned low and normal programming execution will continue. Execution of the HL T instruction also causes the CP1600 to enter a Halt state, as described above. Let us now look at interrupt signals. The CP1600 has two interrupt request inputs -INTR and INTRM. INTR has higher priority than INTRM. INTR can- not be disabled. Typically, TNiI1 will be used to trigger an interrupt upon power failure or other catastrophes. The interrupt acknowledge signal is created by external logic which must decode the BC1, BC2, and BDIR sig- nals, as shown in Table 2 -1. Observe that there are, in fact. two interrupt acknowledge signals: the first (I NT AK) acknowledges the interrupt itself, while the second (DAB) is used as a strobe for external logic to return an interrupt ad- dress vector. The interrupt sequence is described later in this chapter. The CP1600 has two additional interrupt-related signals which are unusual when compared to other microcomputers described in this book. TCI is output high when an End-of-Interrupt instruction is executed. This signal makes it easy for external log ic to generate interrupt priorities which extend across the execution of an interrupt service routine. Table 2-1. CP1600 Bus Control Signals BC1 BC2 BDIR SIGNAL FUNCTION 0 0 0 NACT The CPU is inactive and the Datal Address Bus is in a high impe- dance state. 0 0 1 BAR A memory address must be input to the CPU via the DatalAddress Bus. 0 1 0 lAB Acknowledged external interrupt requesting logic must place the starting address for the interrupt service routine on the Address Bus. 0 1 1 DWS Data write strobe for external memory. 1 0 0 ADAR This signal identifies a time interval during which the DatalAddress Bus is floated, while data input on the Data Bus is being interpreted as the effective memory address during a direct memory addressing operation. 1 0 1 DW The CPU is writing data into external memory. DW will precede DWS by one machine cycle. 1 1 0 DTB This is a read strobe which external memory or I/O logic can use in order to place data on the Datal Address Bus. 1 1 1 INTAK This is an interrupt acknowledge signal. It is followed by lAD which is a strobe telling the external logic which is being acknowledged to identify itself by placing an address vector on the DatalAddress Bus. 2-8 MC MC T1 T2 T3 T4 T1 T2 T3 T4 BC 1,BC2,BDIR OO-D15 ---51~-+-----l~- Undefined Data Data state Output Input preceding data output Figure 2-3. CP1600 Machine Cycles and Bus Timing BAR NACT DTB MC1 MC2 MC3 T1 T2 T3 T4 T1 T2 T3 T4 T1 T2 T3 T4 <1>1 BC1 BC2 ~ ____ __ __________-+______________J ~ ~ BDIR DO-D15---~ Instruction Instruction address out object code in Figure 2-4. CP1600 Instruction Fetch Timing 2-9 INSTRUCTION FETCH MEMORY READ BAR NACT DTB BAR NACT DTB NACT MCl MC M~ MCl MC2 MC3 lT4 Tl\ T2: T3; T4 Tl,:T21:T31'T4 TliI T2,I T3,I T4 Tl'T2, , I I I I I I I I I I I I I I I I I I I I Tl: T2 :T3:-T4 Tl: T2 :T3: T4 T1\ T21T3 T3 ,T4 I I I I I I " I I I I I I , I I '" Instruction Instruction Data address out Data in address out object code in Figure 2-5. CP 1600 Timing for Memory Read I nstruction with Implied Memory Addressing CP1600 INSTRUCTION TIMING AND EXECUTION CP1600 instructions are executed as a sequence of machine cycles. Each machine cycle has four clock periods, as illustrated in Figure 2-3. Machine cycles are identified by their cycle number and by the levels of the BC1. BC2. and BDIR signals. Each of the eight level combinations is given a name. taken from Table 2-1. This name becomes the name of the machine cycle. Thus in Figure 2-4. and in subsequent instruction timing illustrations. each machine cy- cle is identified by a signal name from Table 2-1. Figure 2-3 shows general case timing for data output or input on the Data/Address Bus. In between data input or out- put operations the bus is floated. CP1600 MEMORY ACCESS TIMING Figure 2-4 illustrates instruction fetch timing for a CP1600 instruction's execution. Three machine cycles are re- quired. During the first mac.hine cycle an address is output. Nothing happens during the second machine cycle: it is a "time spacing" machine cycle that routinely separates two CP1600 Bus access machine cycles. The object code for the accessed instruction is returned during the third machine cycle. Figure 2-5 illustrates timing for the simplest memory read instruction's execution. In this .case the data memory address is taken from one of the CPU registers. There is no difference between timing for the three machine cycles of an instruction fetch or a data memory read. As illustrated in Figure 2-5. a simple memory read instruction's execution consists of two three-machine cycle memory read operations. separated by a spacing no operation machine cycle. 2-10 INSTRUCTION FETCH MEMORY WRITE BAR NACT DTB BAR NACT DW DWS NACT MCl MC2 MC3 MCl MC2 MC3 MC4 I I , I I I I, I I 1 I I I. I I I I I I I I I I ., I I I " I I I I ,I I I ,I I I I Tl :T2:T3:T4 Tli T2,T3.T4 Tl, T2, T3. T4 Tl, T2, T3,T4 Tl,T21 T3 1T4 Tl, T2, T3, T4 Tl, T2. T3, T4 Tl, T21 T3.T4 I I I , ,. I I I I I 'I • I I' I I I Instruction Instruction Data address out Data out address out object code in Figure 2-6. CP1600 Timing for Memory Write Instruction with Implied Memory Addressing Figure 2-6 illustrates timing for a simple CP1600 memory write instruction execution. Data is output for two machine cycles. giving external logic ample time to respond to the data output. External logic uses the DWS machine cycle as a write strobe. Any memory reference instruction that specifies direct memory addressing will require one three-clock-period machine cycle to fetch each word of the instruction object code: an NACT clock period will separate each machine cycle. After the first instruction fetch machine cycle. an ADAR-NACT clock period combination will be inserted in the second (and third. if present) instruction fetch machine cycle. During an ADAR clock period. BC1 is high. while BC2 and BDIR are low. No other control signals are active. Thus. for a two-word memory read or memory write instruction that specifies direct addressing, the following clock periods and machine cycles will be required for instruction ex- ecution: Direct Addressing Direct Addressing Memory Read Memory Write Machine Cycles Machine Cycle BAR } Fetch first instruction { BAR NACT "~-------object code word ------t.~ NACT DTB DTB ~NACT NACT ..4.-----Spacing machine c y c l e - - - - - -... ~~~~} NACT ..'4.----Fetch second object code word instruction------t.~{ ~~~~ NACT DTB DTB NACT .......- - - - - Spacing machine cycle------.~ NACT BAR } Memory read Memory write { BAR NACT .....---machine cycle .~ NACT machine cycle---__ DTB DW DWS 2-11 BAR NACT NACT <1>2 BC1 -----------------+------------ BC2 BOIR BOROY Figure 2-7. CP1600 Wait State Timing THE CP1600 WAIT STATE The CP1600 has a Wait state equivalent to those described for other microcomputers in this book. External logic that requires more time to respond to an access must input BDRDY low before the end of the BAR machine cycle. during which an address is output and the device is selected. Timing is illustrated in Figure 2-7. If you examine Figures 2-4, 2-5 and 2-6. you will see that an address is output during a BAR machine cycle to initi- ate any external device access. The BAR machine cycle is always followed by an NACT machine cycle; in the middle of T1 during this NACT machine cycle, the CP1600 samples BDRDY. If ~ is low. then a sequence of NACT machine cycles occurs. In the middle of T4 for every NACT machine cycle, the CP1600 samples BDRDY again. Upon detecting BDRDY high, the CP1600 resumes instruction execution with a DTB machine cycle. A Wait state must last for less than 40 microseconds, since the CP1600 is a dynamic device. THE CP1600 HALT STATE The CP1600 has a Halt state which may follow execution of the Halt instruction, or may be initiated by external logic. When the Halt instruction is executed. then. following the instruction fetch machine cycle, the HALT signal is output high and a sequence of NACT machine cycles is executed. External logic initiates a Halt state by making the STPST input undergo a high-to-Iow transition. Following execution of the next interruptable instruction. a Halt state begins. The HALT signal is output high and a sequence of NACT machine cycles is executed. A Halt state, whether it is initiated by execution of a Halt instruction or by a high-to-Iow transition of STPST. must be terminated by a high-to-Iow transition of STPST. This will cause the Halt state to end at the conclusion of the next NACT machine cycle. Timing for a Halt state which is initiated and terminated by STPST may be illustrated as follows: STPST{L-_ _l ~ HALT ~~-------------------------------------------~~-------- Next interruptable ~ \. y ) 1 instruction's / \ execution HALT STATE Next NACT machine ends here cycle ends here 2-12 ThePerFsignal as an input inhibits CP1600 Program Counter increment logic. Thus. external CP1600 logic can input PCIT low - in which case the same instruction will be continuously re-executed PCIT until PC IT goes high again. However. PCIT should only change levels while the CPU has been SIGNAL halted. Thus. PCIT and STPST should be used together as follows: PCIT REQUEST STPST PCIT CP1600 INITIALIZATION SEQUENCE The CP1600 is initialized by inputting the MSYNC signal low for a minimum of 10 milliseconds after power is first applied to the CPU. ' MSYNC must make a low-to-high transition. marking the end of the initialization. on a rising edge of the «1>1 clock sig- nal. On the next rising edge of «1>1. instruction execution will begin. This may be illustrated as follows: I I Ii: I T1 : T2 I T3 I T4 I <1>, MSYNC When instruction execution begins. interrupts are disabled. The following sequence of machine cycles is executed: NACT lAB -4--- Read Datal Address Bus and load into Program Counter NACT NACT NACT BAR-4-- Output Program Counter contents to fetch first instruction NACT DTB etc During the lAB machine cycle. external logic must supply a 16-bit address at DO - 015. Your external logic must pro- vide this address. which in the simplest case may be 0000 by grounding the bus. or FFFF16 by tying it to +5V following a startup. The address which is input at lAB is output at BAR. initiating program execution. CP1600 DMA LOGIC CP1600 DMA logic is quite standard. When external logic wishes to transfer data under DMA control, it inputs BUSRQ low. At the conclusion of the next interruptable instruction's execution, the CPU floats the Data/Address Bus and enters a Wait state, during which a sequence of NACT machine cycles is executed. BUSAK is output low at the beginning of the first NACT machine cycle. The NACT machine cycles that occur during a DMA operation refresh the CPU. NACT machine cycles that occur during a'Wait state do not refresh the CPU. This means that any number of NACTmachine cycles can occur during a DMA break. while a Wait state must be shorter than 40 microseconds. The DMA break ends when external logic inputs BUSRO high again. BUSRO is sampled during T1 of every DMA NACT machine cycle. When BUSRO is sampled high. two additional NACT machine cycles are executed. then BUSAK is out- put high and normal program execution resumes. DMA timing is illustrated in Figure 2-8. 2-13 Last machine cycle of an interruptable instruction's execution NACT NACT NACT NACT BAR I I I I I I I I I I I I I I T11 I T4 n I T2 I T3 I T4 n I I T3 I T4 T11 T2 I T3 I T4 n I T2 I T3 I T4 I I ,I I I I I I 1 I I I 1 BC 1,BC2,BOIR -------------i~~~~----------~~------~~~~------------~--- BUSRQ BUSAK Figure 2-8. CP1600 DMA Timing INTAK NACT ow OWS NACT lAB NACT X 4 BAR I I I I I I I I 'I I I I I I I I I I I I I I I I I I I I. I " I I I I I I T1, T2: T31 T4 T11 T2 I T31T4 nIT2 I T31T4 TlI T2 JT3 1T4 T11 T21 T31T4 TlI T21 T31T4 T11 T2 I T4 1 I I I I I 1 I I I I I I I I I I 1 I <1>1 <1>2 BC1) \ I \ BC2 J \ I \ BOIR} \ I , II ~~--a 0 Output t t Current Program External Start executing Stack Counter contents logic inputs interrupt Pointer written to memory starting service routine stack address for interrupt service routine Figure 2-9. CP1600 Interrupt Service Routine Initialization 2-14 INSTRUCTION FETCH INSTRUCTION EXECUTE/FETCH BAR NACT DTB BAR NACT DTB NACT MCl MC2 MC3 MCl MC2 MC3 , I I " I I I I I t I I I I I I I I I I Tl:T2:T3:T4 T1:T2:T3:T4 Tll, T2 ~I T3:T4 Tl:I T2 lT3 ;T4 I I Tl :T2: T31T4 Tll T2: T3:T4 T11 T21 T3:T4 II I I I I II I I I' I I I Instruction TCI instruction Next instruction Next instruction address out object code in address out object code in Figure 2-10. CP1600Timing for TCllnstruction's Execution THE CP1600 INTERRUPT LOGIC The CP1600 uses a vectored interrupt processing system. External logic requests an interrupt by inputting a low signal at either the INTR or INTRM pins. Following the execution of the next interruptable instruction. the CP1600 acknowledges the interrupt by pushing Register R7 contents (the Program Counter) onto the Stack; then the CP1600 outputs 111. followed by 010 at BC1. BC2. and BOIR. External logic must respond by placing 16 bits of data on the Data/Address Bus. These 16 bits of data will be loaded into Register R7. the Program Counter. thus causing program execution to branch to an interrupt service routine dedicated to the interrupt. Timing is illustrated in Figure 2-9. The PCIT signal is output low following execution of a software interrupt instruction (SIN). This is the only microcom- puter described in this book which allows external logic to respond to a software interrupt in this fashion. Allowing ex- ternal logic to respond to a software interrupt only makes sense when you anticipate your product being used in a minicomputer-like environment. Typically. the software interrupt will interface to logic of a front panel or console. When an SIN instruction is executed. a one-machine cycle low PC IT pulse is output. You may. if you wish. end an interrupt service routine by executing a Terminate Current Interrupt (TCI) instruction. in which case the TCI signal will be output high. Timing for TCI is given in Figure 2-10. Following an interrupt acknowledge. the interrupt service routine must execute instructions in order to disable inter- rupts and save the contents of registers on the Stack. The exception is Register R7. the Program Counter. which is auto- matically pushed onto the Stack following an interrupt acknowledge. External logic is entirely responsible for any type of interrupt priority arbitration which may occur. and for the genera- tion of the interrupt vector address which must be input following an interrupt acknowledge. 2-15 It is quite easy to generate signals equ iva lent to other microcomputer system busses from the CP1600 System Bus. Therefore, you can use parts described in Volume 3 to handle CP1600 interrupt requirements. THE CP1600 INSTRUCTION SET The CP1600 instruction set is relatively straightforward. Addressing modes, which we have already described, are sim- ple, and instructions are typical of those we have seen and described for other microcomputers. Unusual features relat- ing to addressing modes available with individual instructions are summarized in Table 2-2, which describes the CP1600 instruction set. If you have never programmed a PDP-11 minicomputer, then you should pay particular attention to program- ming techniques that result from the Stack Pointer and Program Counter being accessed as general purpose registers. A wide variety of Register Operate instructions allow you to compute data and load the result directly into Register R7, the Program Counter. In effect these become computed Jump instructions. The ability to manipulate Register R6, the Stack Pointer, as though it were a general purpose register means that it is easy to maintain a number of different Stacks in external read/write memory. The Jump-to-Subroutine instruction has a minicomputer flavor to it. Rather than saving the return address on the Stack, Register R7 contents are moved to General Purpose Register R4 or R5. A number of minicomputers will save a subroutine return address in a general purpose register in this fashion. The problem with this logic is that you must ex- ecute an additional instruction within the subroutine to save the return address on the Stack if you are going to use nesting subroutines. If you are passing subroutine parameters, however, this is an excellent arrangement for the Jump- to-Subroutine instruction places the address of the parameter list directly in a Data Counter with auto-increment. We have described the concept of parameter passing in Volume 1, Chapter 7. Note that the CP 1600 instruction set lacks a logical OR. In Tables 2-2 and 2-4, instruction length is given in terms of "words" rather than "bytes", as we have done in pre- vious chapters. Since only the lower 10 bits of the CP1600 object code are presently used, system configurations need not have the full 16-bit word size. Hence a "word" may be 10 to 16 bits wide, depending on the implementation. The following notation is used in Table 2-2: ADDR One word of direct address condCondition on which a branch may be taken. Table 1-3 lists all 14 branch conditions. DATA One word of immediate data. DISP One word displacement. See Table 2-4 for location of sign bit. E External branch condition. EBCAO-3 The external branch condition address lines: EBCAO, EBCA 1, EBCA2, and EBCA3. EBCI The external branch condition input line. LABEL A 16-bit direct address, target of a Jump instruction. See Table 2-4 for the bit format. PC IT The software interrupt output line. RB General Purpose Register R4, R5, or R6. RD One of the general purpose registers, used as a destination for operation results. RM One of the general purpose registers used as a Data Counter, R4 or R5, if specified, is auto-incremented after the memory access. R6 is incremented after a write, and decremented before a read. RR General Purpose Register RO, R1, R2, or R3. RS One of the general purpose registers, used as the source of an operand. Statuses: S the Sign status C the Carry status Z the Zero status o the Overflow status The following symbols are used in the STATUSES column: X the status flag is affected by the operation °a blank means the status flag is not affected the operation clears the status flag 1 the operation sets the flag 2 the Overflow flag is affected only on 2-bit shifts or rotates 2-16 SW The Status Word. whose bits correspond to the condition of the status flags in the following way: 3 2 1 0 .... Bit No IsI z laic I Status Word When the status word is copied into a register. it goes to the upper half of each byte: [SW] When the status word is loaded from a register. it comes from the upper half of the lower byte: ~11-5----------------8·1-7--~::::rr~-4~3------~ol ~~3~~---o~1 [RS] [SW] x Bits y through z of the Register x. For example. R7 < 15.8 > represents the upper byte of the Program Counter (.2) Indicates that the operand ".2" is optional A low pulse [ ] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. [[ ]] Implied memory addressing: the contents of the memory location designated by the contents of a register. A Logical AND -¥- Logical Exclusive-OR ± Addition or subtraction of a displacement. depending on the sign bit in the object code. Data is transferred in the direction of the arrow. 2-17 Table 2-2. CP1600 Instruction Set Summary sTAtuses OPERATION PE~FORMED TYPE MNEMONIC OPERAND(S) WORDS S Z C 0 MVI ADDR,RD 2 [RD]-[ADDR] Load register from memory, using direct addressing. O~II.I MVI@ RM,RD 1 [RD]-[[RM)) ::::0(,) Load register from memory, using implied addressing. >~z ~~ffi MVO RS,ADDR 2 [ADDR]-[RS] ~Q~ Store register to memory, using direct addressing. a::Za:: MVO@ RSJIM 1 [[RM))-[RS] ILc( Stbre register to memory, using implied addressing. If RS=R4, R5, R6 or R7, then RS=RM Is not supported. ADD ADDR,RD 2 X X X X [RD]-[RD)+ [ADDR] Add memory contents to register, using direct addressing. 11.1 (,) ADD@ RM,Rt) 1 X X X X [RD]-[RD]+ [[RM)) ~ Z .... 11.1 a:: X X X Add memory contents to register, using implied addressing. co 11.1 u. SUB ADDR,RD 2 X [RD]-[RD] - [ADDR] 11.1 a:: Subtract memory tontents from registEir, using direct addressing. SUB@ RM,RD 1 X X X X [RD]-[RD] - [[RM]] > a:: 0 Subtract memory contents from register, using implied addressing. ~ CMP ADDR,RS 2 X X X X [RS] - [ADDR] 11.1 :E Compare memory contents with registers, u$ing direct addressing. Only the status flags are Q affected. Z CMP@ RM,RS 1 X X X X [RS] - [(RM)) c( Compare memory contents with register's, using implied addressing. Only the status flags are g affected. AND ADDR,RO 2 X X [RD]-[RD] A [AOOR] > II! c( AND memory contents with those of register, using direct addressing. Q AND@ RM;RD 1 X X z tRD]-[RD) A [[RM)) 0 AND memory contents with those of register, using implied addressing. (,) w XOR ADDR,RD 2 X X [RD]-[RD]-¥- [ADDR] en Exclusive-OR memory contents with those of register, using direct addressing. XOR@ RM,RD 1 X X [RD]-[ RO].y. [[ RM)) Exclusive-OR memory contents with those of register, using implied addressing. Table 2-2. CP1600 Instruction Set Summary (Continued) STATUSES OPERATION PERFORMED TYPE MNEMONIC OPERAND(S) WORDS S Z C 0 w MVII DATA,RD 2 [RD]~DATA ~ 0( Q Load immediate to specified register. w MVOI RS,DATA 2 [[R7] + l1~[AS] ~ Store contents of specified register in immediate field of MVOI instruction, This is only possible if ~ program memory is reed/write memory (rather than ROM). I ! ADDI DATA,RD 2 X X X X [RD]~[RD] + DATA w ~ Add immediate to specified register. 0( a: SUBI DATA,RD 2 X X X X [RD]~[RD] - DATA w A. 0 Subtract immediate data froni specified register. w CMPI DATA,RS 2 X X X X [RD]-DATA ~ 0( Compare immediate data with contents of specified register. Only the status flags are affected. t;-J is w ANDI DATA,RD 2 X X [RD]~[RD] A DATA I CD ~ AND immediate data with contents of specified register. ~ XORI DATA,RD 2 X X [RD]~[RDl¥DATA Exclusive-OR immediate data wit., contents of specified register. J LABEL 3 [R7]~LABEL Jump to given address. I A. JR AS 1 X X [R7]~[RS] :i! Jump to address contained in specified register. ..., :;) JSR RB,LABEL 3 [RB]~[R7l; [R7]~LABEL Jump to given address, saving Program Counter in A4, R5, or AS. B DISP 2 [R71~[R7] + 2±DISP Branch relative to Program Counter contents. z Z Bcond DISP 2 If cond is true, [A7]~[ A71 + 2±DISP o 0 Branch relative on given condition; otherwise, execute next sequential instruction. ~ E I BEXT DISP,E 2 EBCAO-3 ~E; Z Q 0( Z If EBCI=l, [R7]~[R7]+2±DISP a: 0 III 0 Branch relative if external condition is true. Table 2-2. CP1600 Instruction Set Summary (Continued) STATUSES OPERATION PERFORMED TYPE MNEMONIC OPERAND(S) WORDS S Z C 0 MOVR RS,RD 1 X x [RD]-[RS] Move contents of source register to destination register. a:'" ",'" ADDR RS,RD 1 XX X X [RD]-[RS]+ [RD] ... C en a: Add contents of specified registers. -'" c,,1L "'0 SUBR RS,RD 1 XX X X [RD]-[ RD] - [RS] lIFe Subtract contents of source register from those of destination register. a:Z RS,RD 1 ~C CMPR X X X X [RD]- [RS] !!~ Compera registera' contents. Only the status flags ara affected. &!o a::I ANDR RS,RD 1 X X [RD]-[RD] A [RS] AND contents of specified registers. XORR RS,RD 1 X X [RD]-[RD].y.[RS] Exclu,ive-OR contents of specified registera. II-) N o CLRR RD 1 0 1 [RD]-[RD] V [RD] Clear specified register. TSTR RS 1 XX [RS]-[RS] Test contents of specified register. INCR RD 1 X X [RD]-[RD]+l '"~ DECR RD 1 X X Incremant contents of specified register. [RD]-[RD] - 1 '"IL0 RD 1 X X Decrement contants of specified ragister. COMR [RD]-[RD] a: '"... en NEGR RD 1 X X X X Complement contents of specified ragister (ones complement). [RD]-[RD] + 1 C; Nagate contents of specified register (twOI complement). '" a: ADCR RD 1 X X X X [RD]-[RD]+ [e) Add Carry bit to lpecified regilter contentl. SLL RR(.2) 1 X X 115 + - - 01+-0 [RR] Shift logical left one or two bitl, clearing bit 0 (and bit 1 if Ihifting twice). Table 2-2. CP1600 Instruction Set Summary (Continued) STATUSES OPERATION PERFORMED TYPE MNEMONIC OPERAND lSi WORDS S Z C 0 RLC RRI.2) 1 xX X 2 L(D:(@]H15 - [RR] oiJ Rotate left one bit through Carry, or rotate 2 bits left through Overflow and Carry. SLLC RRI.2) 1 X X X 2 ~[[JH15'- 0 .... 0 [RR] Shift logical left one bit into Carry, clearing bit 0, or shift left two bits into Overflow and Carry, Q w clearing bits 0 and 1. :;) z x x ~ a' SLR RRI.2) 1 i= 0 ..... 15 N z [RR] 0 N ..... 9 w Shift logical right.one or two bits, clearing bit 15 (and bit 14 if shifting twice). ~ RRI.2) SAR 1 X X 00( a: w "- 0 dj [RR] .0' a: Shift arithmetic right one or two bits, copying high order bit. w ~ 4ciirm~15 o~ II) C; RRC RRI.2) 1 X X X 2 w a: .. [RR] Rotate right one bit through Carry, or rotate. two bits right through Overflow and Carry. SARC RRI.2) 1 X X X 2 dE oK(2]M:D [RR] Shift arithmetic 'right one bit into Carry,. or two bits into Overflow and Carry. SlNAP RRI.2) 1 X X 11,g D. [RR] Swap bytes of register once, or twice. Table 2-2. CP1600 Instruction Set Summary (Continued) STATUSES OPERATION PERFORMED TYPE MNEMONIC OPERAND IS) WORDS S Z C 0 :.t PSHR RS 1 Separate mnemonics for MVO@ RS,R6. y c( I- PULR RD 1 Separate mne~nics for MVI@R6,RD. m SIN (2) 1 PCiT'- lS Software interrupt. EIS 1 Enable interrupt syetem. l- lL DIS 1 Disable interrupt system. ::I a: TCI 1 Terminate current interrupt. a: w JE LABEL 3 Jump to given address and enable interrupt system. I- ~ JD LABEL 3 Jump to given address and disable interrupt system. JSRE RB,LABEL 3 Jump to given address, saving Program Counter in R4, R5 or R6, and enable interrupt system. JSRD RB,LABEL 3 Jump to given address, saving Program Counter in R4, R5 or R6, and disable interrupt system. ':" N N GSWD RD 1 [RD<15,12»-[SW); [RD<7.4»-[SW) Place Status Word in upper half of each byte of the specified register. RD may be RO, Rl, R2 or R3. CI) ::I RSWD RS 1 X X X X [SW]-[RS<7,4» I- c( Load Status Word from bits 7 through 4 of the specified register. I- CLRC 0 m 1 [C)-O Clear Carry. SETC 1 1 [C)-I Set Carry. NOPP 2 No Operation. NOP (2) 1 HLT 1 Halt after executing next instruction. SDBD 1 Set double byte data mode for next instruction, which must be of one of the following types; Primary or sacondary I/O or memory reference Immediate or immediate operate If implied addressing through R I, R2, or R3 is used, the same byte will be accessad twice; address- ing through R4, R5, or R7 will give bytes from the addressed location and that addressed after auto-increment. Direct addressing and Stack addressing are not allowed in double byte mode. Table 2-3. CP1600 Branch Conditions and Corresponding Codes OBJECT CODE MNEMONIC BRANCH CONDITION DESIGNATION C C= 1 0001 LGT Carry (logical greater than) NC c=o 1001 liT No Carry (logical less than) OV 0= 1 0010 Overflow NOV 0=0 1010 No overflow PI.. s=o 0011 Plus MI 5 = 1 1011 Minus ZE Z = 1 0100 EO Zero (equal) NZE Z =0 1100 NEQ Nonzero (not equal) LT 5VO=1 0101 Less than GE 5 .... 0=0 1101 Greater than or equal LE ZV(5 .... 0) = 1 0110 Less than or equal GT ZV(5 .... 0) =0 1110 Greater than USC C.... S = 1 0111 Unequal sign and cany ESC C .... 5 =0 1111 Equal sign and cany The following notation is used in Table 2-4: Where ten digits are shown. they are the ten low-order bits of a 10 to 16-bit word. (Word size depends on the system implementation.) Where four digits are shown. they represent the hexadecimal notation for an entire word (10 to 16 bits). bb Two bits indicating one of the first three general purpose registers: 00 = RO 01 = R1 10 = R2 cccc Four bits giving the branch condition. as shown in Table 2-3. ddd Three bits indicating a destination register. RD: 000 = RO 001 = R1 010 = R2 011 = R3 100 = R4 101 = R5 110 = R6 111 = R7 eeee Four bits giving the external branch condition. E. Control signals EBCAO-EBCA3 reflect the state of these four bits. 1111 One word of immediate data (10 or 16 bits) 2-23 mmm Three bits indicating a Data Counter Register RM: 000 = RO 001 = Rl 010 = R2 all = R3 100 = R4 101 = R5 110 = R6 111 = R7 m One bit indicating the number of rotates or shifts: a one bit position 1 two bit positions p One bit of immediate address P One hexadecimal digit (4 bits) of immediate address rr Two bits indicating one of the first four general purpose registers: 00 = RO 01 = Rl 10 = R2 11 = R3 sss Three bits indicating a source register. RS: 000 = RO 001 = Rl 010 = R2 011 = R3 100 = R4 101 = R5 110 = R6 111 = R7 z Sign of the displacement: a add the displacement to PC contents 1 subtract the displacement from PC contents In the "Machine Cycles" column. when two numbers are given with one slash between them (e.g .. 7/9). execution time depends on whether or not a branch is taken. When two numbers are given. separated by two slashes (such as 81/11). execution time depends on which register contains the implied address. THE BENCHMARK PROGRAM For the CP1600 our benchmark program may be illustrated as follows: MVII IOBUF.R4 LOAD THE I/O BUFFER STARTING ADDRESS INTO R4 MVII TABLE.Rl LOAD THE TABLE STARTING ADDRESS INTO Rl MVI@ Rl.R5 LOAD ADDRESS OF FIRST FREE TABLE WORD INTO R5 MVII CNT.R2 LOAD WORD COUNT INTO R2 LOOP MVI@ R4.RO LOAD NEXT DATA WORD FROM 10BUF MVO@ RO.R5 STORE IN NEXT TABLE WORD DECR R2 DECREMENT WORD COUNT BNZE LOOP RETURN IF NOT END MVO@ R5.Rl RETURN ADDRESS OF NEXT FREE TABLE BYTE This benchmark program makes very few assumptions. The input table IOBUF and the data table TABLE can have any length. and can reside anywhere in memory. The address of the first free word in TABLE is stored in the first word of the TABLE. 2-24 Table 2-4. CP1600 Instruction Set Object Codes MACHINE MACHINE INSTRUCTION OBJECT CODE WORDS CYCLES INSTRUCTION OBJECT CODE WORDS CYCLES ADCR RD 000010lddd 1 6 JSRE RB.LABEL 0004 3 12 ADD ADDR.RD 1011000ddd 2 10 bbppppppOl PPPP PPPP ADD@ RM.RD 1011mmmddd 1 8/ /11 MOVR RS.RD oo10sssddd 1 6/ /7 ADDI DATA.RD 1011111ddd 2 8 MVI ADDR.RD 10 1OOOOddd 2 10 1111 PPPP ADDR RS.RD oo11sssddd 1 6 MVI', RM.RD 1010mmmddd 1 8/ /11 AND ADDR.RD lll0000ddd .. pppp 2 10 MVII DATA.RD 1010111ddd 2 8 AND@ RM.RD 1111 IllOmmmddd 1 8/ /11 MVO RS.ADDR loolooosss 2 11 ANDI DATARD 1110111ddd 2 8 PPPP 1111 MVO@ RS.RM lOOlmmmsss 1 9 ANDR RS.RD 0110sssddd 1 6 MVOI RS.DATA lOO1111sss 2 9 B DISP l000z00000 2 7/9 1111 PPPP NEGR RD 0000 1OOddd 1 6 Beond DISP looozOcccc 2 7/9 NOP (2) 000011010m 1 6 PPPP NOPP l000z0 1000 2 7 BEXT DISP.E looozleeee 2 7/9 PPPP PPPP PSHR RS loolllOsss 1 9 CLRC 0006 1 4 PULR RD 1010110ddd 1 11 CLRR'RD 0111dddddd 1 6 RLC RRI.2) 0001 0 IOmrr 1 6/8 CMP ADDR.RS 1101000sss 2 10 RRC RRI.2) ooo1110mrr 1 6/8 PPPP RSWD RS 0000111sss 1 6 CMP@ RM.RS 1101mmmsss 1 8//11 SAR RRI.2) ooo1101mrr 1 6/8. CMPI DATA.RS 1101111sss 2 8 SARC RRI.2) ooo1111mrr 1 6/8 1111 SDBD 0001 1 4 CMPR RS.RD 0101sssddd 1 6 SETC 0007 1 4 COMR RD 00000llddd 1 6 SIN (2) 000011011m 1 6 DECR RD 00000IOddd 1 6 SLL RRI.2) 0001 00 1mrr 1 6/8 DIS 0003 1 4 SLLC RRI.2) ooo1011mrr 1 6/8 EIS 0002 1 4 SLR RRI.2) ooollOOmrr 1 6/8 GSWD RR 0000lloorr 1 6 SUB ADDR.RD l100000ddd 2 10 HLT 0000 1 4 PPPP INCR RD 000000lddd 1 6 SUB@ RM.RD lloommmddd 1 8/ /11 J LABEL 0004 3 12 SUBT DATA.RD lloolllddd 2 8 llppppppOO 1111 PPPP SUBR RS.RD 0100sssddd 1 6 JD LABEL 0004 3 12 SWAP RRI.2) ooolOOOnrr 1 6/8 l1ppppppl0 TCI 0005 1 4 PPPP TSTR RS 00 1Ossssss 1 6//7 JE LABEL 0004 3 12 XOR ADDR.RD llll000ddd 2 10 l1ppppppOl PPPP PPPP XOR@ RM.RD llllmmmddd 1 8/ /11 JR RS oo10sss111 1 7 XORI DATA.RD l111111ddd 2 8 JSR RB.LABEL 0004 3 12 1111 bbppppppOO XORR RSiRD 0111sssddd 1 6 PPPP JSRD RB.LABEL 0004 3 12 bbppppppl0 PPPP 2-25 CP1600 8080A System Bus System Bus Signals Signals .. .-.. ..- Latched AO -· -- ...- - Address DO -. Buffer A15 ··· 4 015 ··· .. -· - MUX - -- Latched -== .. := - ! DO 07 High-order byte - -- -- Data DO Low-order 4 Buffer .~ .~ - : :: 07 byte BAR OTB .,... .-- ..., OWS ...... BC1 --- lAB ...., BC2 - 1 of 8 Decoder INTAK - .- -.. """ BOIR AOAR - - ON NACT - -- ,.... INTR INT INTRM -- ;;t - INT - .. BUSRQ - BUSEN 40 .--- HOLD - - - ,.... ROYIN ~ L?r ---' -.. WAIT MSYNC -----------------------------------------------------------------~~--------... RESET STSTP 4 HALT TCI EBCAO EBCA3 EBCI ... Figure 2-11. CP1600 to 8080A Bus Conversion 2-26 SUPPORT DEVICES THAT MAY BE USED WITH THE CP1600 A CP1600 microcomputer system with any significant capabilities will use support devices of some other microprocessor. Parallel 110 capability is available with the CP1680, (described next!. but priority interrupt logic, DMA logic, and serial I/O logic, to mention just a few common options, may need additional support devices. Fortunately, it is quite easy to generate an 8080A-compatible system bus from the CP1600 system bus. Logic is illustrated in Figure 2-11. The CP1600A is the fastest version of the CP1600 CPU; it runs with a 500 nanosecond machine cycle. The CP1600 machine cycle is equivalent to an 8080A clock period. Since the standard 8080A clock period is also 500 nanoseconds, no speed conflicts will arise. The bus-to-bus interface logic illustrated in Figure 2 -11 is self-evident with the exception of bus demultiplexing logic. The CP1600 Data/Address Bus is shown buffered by a demultiplexing buffer that is connected to two latched buffers. One of the latched buffers accepts the demultiplexer outputs only when a valid address is being output as identified by BAR high. The second latched buffer may be a bidirectional latched buffer. or it may be two unidirectional latched buffers. Three latching strobes are required: DTS, lAB, and DWS. DTB and lAB are data input strobes. DTB strobes data input that is to be interpreted as data, while lAB stroves data in- put that is to be interpreted as an address. So far as external logic is concerned, both of these signals are simple data in- put strobes. We could therefor~ generate a single data input strobe as the OR of DTB and lAB. When this data input strobe is high, information on the 8080A System Bus side of the latched data buffer must be input to the buffer; this data must simultaneously be transmitted to the multiplexer. DWS is the data output strobe. When high, this signal must strobe data from the multiplexer to the latched data buffer; this latched data must immediately appear at the 8080A System Bus side of the latched data buffer. Since the CP1600 uses a 16-bit Data Bus, you will probably have to generate two external device data busses; a high- order byte bus and a low-order byte bus. All external devices that transmit or receive parallel data must be present in duplicate. For example, were 8255 parallel interface devices to be present the following connections would be re- quired: .- WR -. AD -- h ·..... DO 07 --: ·.--.. 08 -- I~ ~ 015 - = • -:..AO A1 -- -= - ·.-- A2 - I, t - A15 Device Select .. ,.. , Logic 60 07 DO 07 I' -- .. -- .- -- -- - ..- -- -.... PA high PA low WR - WR -- - - -- 1m -- ..-- RD PB high -- - 8255 PPI AO - AO 8255 PPI - PBlow - ..- A1 -- - A1 -- PC high -- - CE -- - CE -- -.. PC low 2-27 The CP1600 and MC6800 system busses are singularly incompatible. You should not attempt to use MC6800 support devices with the CP1600. ro 1 40 INTRQ IMSKO 2 39 IMSKI 00 3 38 BC1 01 4 37 BC2 02 5 36 BOIR 03 6 35 CE 04 7 34 ERROR 05 8 33 VCC 06 9 32 GNO 07 10 CP1680 31 VOD CKi 11 lOB 30 PE PCLR 12 29 AR PDO 13 28 PD15 PD1 14 27 PD14 P02 15 26 PD13 P03 16 25 P012 P04 17 24 PD11 PD5 18 23 PD10 PD6 19 22 PD9 PD7 20 21 PD8 Pin Name Description Type DO - 07 CPU Data/Address Bus Bidirectional, tristate PDO - P015 Peripheral I/O Port Bidirectional BOlA. BC 1, BC2 Bus Control signals Input CK1 Clock signal Input "IT Chip Enable Input PE I/O handshake control Output AR I/O handshake control Input INTRQ Interrupt request Output Tel Terminate current interrupt Input IMSKI Daisy chain priority Input IMSKO Daisy chain priority Output ERROR Error interrupt request Input PCLR Reset Input VCC, VDO' GND Power, Ground Figure 2-12. CP1680 lOB Signals and Pin Assignments 2-28 =rt-01~~1 .. DATA READ ..J , I II I - . , , :~~S EBCI~ .~DO EBCAO....-- EBCA 1""4--- ., T , T • •• D7 EBCA2........- "D8 EBCA3........- PCIT .......... BDRDY~ I .1 1 1 1 liT •• 11 liT, 11 liT :~~~ 1:.,dIII II III .!lIfh II III .!lIftT II III~ic STPST~ BUSRO----., BUSAK""4--- N I HALT........- N INTRM~ co [ DEVICE SELECT ] o~I•• "I ~ uw CKI Ta-- IINTR: B&!~~ Bel PC 1680 PCLR - lOB - IMSKI IMSKO -- t·; ii + o o 0.. LO ~ ~ a:a:w 04:0.. a: ffi Figure 2-13. A CP1600-CP1680 Microcomputer Configuration THE CP1680 INPUT/OUTPUT BUFFER (lOB) The CP1680 lOB is a parallel I/O device designed specifically for the CP1600 CPU. This device provides a single 16-bit parallel I/O port, which may optionally be configured as two 8-bit I/O ports. Primitive handshaking control signals are available with the parallel I/O logic. Elementary interval timer and prioritized interrupt logic is also provided. Figure 2-1 also illustrates that part of our general microcomputer system logic which has been implemented on the CP1680 lOB. The CP1600 lOB is packaged as a 40-pin DIP. It requires two power supplies. +5V and +12V. All inputs are TTL com- patible. The device is implemented using N-channel MOS technology. Figure 2-13 illustrates a CP1600 microcomputer system with three CP1680 lOB devices in the configuration. CP1680 lOB PINS AND SIGNALS The CP1680 lOB pins and signals are illustrated in Figure 2-12. We will summarize these signals and the func- tions they serve before examining device operations in detail. Let us begin by looking at the interface between the CP1680 lOB and the CP1600 CPU. DO - 07 provide an 8-bitparallel Data/Address Bus via which all communications between the CPU and lOB oc- cur. This bus must connect to the low-order eight bits of the 16-bit CPU Datal Address Bus. The three bus control signals, BC1, BC2, and BDIR, connect the CP1680 to the CP1600 as illustrated in Figure 2-13. The CP1680 lOB decodes these three bus control signals internally. A clock input is required by the CP1680. This clock input (CK1) is used by internal logic to determine when BC1, BC2, and BDIR are valid. CK1 must have the following wave form: , I I I' I T1 I T2 I T3 I T4 T1 I T2 I T3 I T4 I I' I I I CK 1 must be derived from the CP1600 clock signals by external logic. Let us now look at the interface between external logic and the CP1680 lOB. POO - PD15 provide a 16-bit parallel I/O port which can optionally be configured as CP1600 I/O two 8-bit I/O ports. While POO - P015 are in theory bidirectional. these pins are more ac- PORT PIN curately described as pseudo-bidirectional. This is because when a zero has been written CHARACTERISTICS to one of these pins. the output can sink 1.6 mA for an output voltage of +O.5V. External logic will have a hard time overcoming this sink in order to pull the pin high. In contrast. when a 1 is written to one of these pins. the output sources just 1OOJ.J.A at +5V. External logic will have little problem sinking 100J.J.A in order to pull a pin low. Therefore. you should output a 1 to any pin that is subsequently to receive input data. External logic will then leave the pin high when inputting 1. while pulling the pin low to input O. The handshaking control signals which link the CP1680 lOB with external logic are PE and AR. PE is a control signal which is output by the CP1680. and AR is a control signal which is input to the CP1680. Now consider CP1680 interrupt signals. An interrupt request is transmitted to the CP1600 CPU via INTRQ. The CPU acknowledges the interrupt via the INTAK combination of BOIR, BC1, and BC2. TCI must be output low by the CPU at the end of the interrupt ser- vice routine. This signal is required by CP1680 interrupt logic. which uses the low TCI pulse in its priority arbitration. as described later in this chapter. 2-30 Interrupts may be generated by conditions internal to the CP 1680. or by a low input at ERROR. The ERROR input is reserved for error conditions detected by external logic. IMSKI and IMSKO are interrupt priority input and interrupt priority output signals, respectively. These signals are used to generate daisy chain interrupt priorities between CP1680 lOB devices. as illustrated in Figure 2 -13. We will describe CP1680 interrupt priorities in more detail later in this chapter. 'MCLR is the master reset control input for the CP1680. This Signal must be input low for at least 10 milliseconds in order to reset the CP1680 lOB. CP1680 ADDRESSABLE REGISTERS The CP1680 has eight addressable locations, which may be illustrated as follows: Control Data. low PDO - PD15 Data. high Timer. low DO - 07 Timer, high I/O interrupt vector Timer interrupt vector Error interrupt vector These eight addressable locations are all 8-bit registers; they are addressed using the first eight addresses in a 256-ad- dress block. as follows: Register Address Control o Data buffer. low-order byte 1 Data buffer. high-order byte 2 Timer. low-order byte 3 Timer. high-order byte 4 I/O interrupt vector 5 Timer interrupt vector 6 Error interrupt vector 7 2-31 The actual 256 addresses will be identified by the eight high-order CP1600 Data/Address Bus lines. which will be used to create CP1680 device select logic. This device select logic creates CE(the chip enable signal); it may be illustrated as follows: --- -- • D~ -:: --- ..:.07 .- •· 08 - 015 ,. ,. I XXXXXXXX r causes CE low DO - - - 07 at CP1680 ~ xxxxxxxx OOOOOY Y Y Valid CP1680 addresses T T ' " - - - - - May be 000,001,010,011, 100, 101, 110, 111 {May have any 8-bit pattern that device select logic has been designed to create CE low in response to. THE CP1680 CONTROL REGISTER We will summarize the individual bits of the CP1680 control register before describing the operations they control. Here are CP1680 Control register bit assignments: 6 5 4 3 o ~BitNo. 1 11111 fT I r- CP 1680 Control register j j I j j j J' , {0- Parallel I/O active } This is called the 1 _ Parallel I/O inactive Ready bit. PE=Ready ERROR input signal level held here 0- PDO-PD15 configured as two 8-bit ports {1 - PDO-PD15 configured as one 16-bit port {o1 -- Disable parallel I/O and Error interrupts Enable parallel I/O and Error interrupts {o1 -- Disable timer interrupts Enable timer interrupts {o1 -- Enable Disable clock logic clock logic Parity of 08-015 byte} 0 = even parity Parity of 00-07 byte 1 = odd parity 2-32 Bit 0 is always the complement of the PE control output. This bit may be interrogated by the CPU. If parallel data transfer interrupts are disabled. this allows the CPU to poll on status when monitoring parallel data transfers. PE signal levels are illustrated in Figures 2-14 and 2-15. Bit 1 reflects the level of the ERROR input. If parallel data transfer interrupt logic is disabled. then the Error interrupt logic is also disabled. thus. the CPU must also examine the Error status bit when polling the CP 1680. Bit 2 determines whether PDO - PD15 will act as a single 16-bit I/O port. or as two 8-bit I/O ports. This is only important when outputting data. Control register bits 3 and 4 are used to enable and disable parallel data transfer and Error interrupt logic. and timer in- terrupt logic. Control register bit 5 is used .to enable and disable CP1680 interval timer logic. If this bit is O. the interval timer will not decrement. Bits 6 and 7 report the parity of the high-order byte and low-order byte for data that is input or output via PD~ - PD15. 0 indicates even parity while 1 indicates odd parity. All Control register bits may be written into or read. You should be very careful when setting or resetting individual bits not to simultaneously modify other Control register bits. This means you should use a three-instruction sequence with an AND or OR mask to set or reset any Control register bit. For details see Volume 1. Basic Concepts. CP1680 DATA TRANSFER OPERATIONS The CPU inputs and outputs data via the CP1680 lOB by executing MVI and MVO instructions, respectively. The CPU must access the CP1680 in byte mode. since an 8-bit Data/Address Bus (DO - 07) connects the CPU and the CP1680 lOB. Whether the I/O port PD~ - PD15 is configured as a single 16-bit port or as two 8-bit ports has no bearing on the fact that the CPU must access the CP1680 in byte mode. The most efficient way of accessing the CP1680 is by using the SDBD instruction with implied memory ad- dressing. Consider data input. If PD~ - PD15 is configured as two 8-bit I/O ports and you wish to access just one of these I/O ports. then you can use implied memory addressing via R1. R2. or R3. We may illustrate input from the high- order byte of I/O Port PD8 - PD15 as follows: Register 01 PDQ - P07 RO 4F DO - 07 R1 2E 02 ---.-- Register 02 CP1600 CPU CE 2-33 If PDO - PD15 are configured as two 8-bit I/O ports or ·as a single 16-bit I/O port. and you want to read both I/O ports. then you should use the SDBD instruction with implied memory addressing via R4 or R5. This may be illustrated as follows: PDO - PD7 RO R4 CP1600 CPU CE 2E generates CE=O Control register bit 2 configures PDO - PD15 as a single 16-bit I/O port or as two 8-bit I/O ports. Given the fact that MVI and MVO instructions (in byte mode) should be used to access the CP1680. when should these accesses occur? The answer is that the PE and AR signals control event sequences. Consider parallel data input, as illustrated in Figure 2-14. When the CPU is ready to input data in resets the Control register READY bit low. This forces the PE output high - - - -_ _ _ _ _ _ _ __. Extemal logic uses PE high to trigger data transfer to the PD1680. Extemal logic signals the end of data input by inputting AR low - - - - - PE INTAK Figure 2-14. PD1680 Handshaking with Data Input 2-34 When the CPU is ready to receive data. it resets Control register bit 0 to 0; this forces the PE control signal high. When external logic senses PE high. it must transmit data to the PD~ - PD15 I/O port. At this point it makes no difference whether pins have been configured as two 8-bit ports or as a single 16-bit port. External logic will pu II to ground selected high pins. while leaving other high pins alone. When external logic has completed data input. it sig- nals the fact by inputting AR low. It is the high-to-Iow transition of the AR control input which indicates the presence of new data for the CPU to read. When Ali makes its high-to-Iow transition. PE also makes a high-ta-Iow transition. and Control register bit 0 is set to 1. If interrupts have been enabled. then an interrupt is requested via INTRO. Figure 2-14 assumes that interrupts have been enabled; therefore INTRQ is shown making a high-to-Iow transition. The CPU will acknowledge the interrupt request. as described earlier in this chapter. by outputting INTAK via BC1. 8C2. and BOIR. Logic internal to the CP1680 uses INTAK to reset INTRO high again. There are many ways in which external logic can determine when to set AR high again. In Figure 2-14 we show exter- nal logic using PE to set A11 high. Clearly. when PE makes a low-to-high transition. the CPU must have acknowledged AR low; therefore external logic can now set AR high. Now that AR is high again. external logic can input new data. An alternative scheme would be for external logic to constantly hold AR low. using the level of the PE output to determine when new data could be transmitted. When PE is high. external logic will transmit new data to the CP1680 once. As soon as it transmits new data. external logic will strobe the data with a short. high AR pulse. then wait for PE to go low and high again before inputting more data. This may be illustrated as follows: CPU ready Extemal CPU is Extemal for input logic inputs ready logic inputs data again data for input Data output handshaking is illustrated in Figure 2 -15. :hen CPU outputs data, PE is automatically set DO - 07 L .~.nal. Extemallogic uses PE high as a "valid data ready" Aft., """,;,. th;, / ' " Ali low \ PE INTAk Figure 2-15. P01680 Handshaking for Data Output 2-35 The most important point to note is that there is no control bit which specifies data input mode or data output mode. Thus, the signal sequences we described for data input and those we are about to describe for data out- put occur automatically; the input or output mode is purely a function of CPU and external logic interpretation. Whenever the CPU outputs data to the PD 1680, the arrival of data forces PE output high. If PDO - PD 15 has been con- figured as two 8-bit ports, then the arrival of a single data byte to either port will cause PE to be output high. If PDO - PD15 is configured as a single 16-bit 1/0 port then PD will not be output high until two bytes of data have been received from the CPU by the PD1680. Once PE is output high, nothing more happens until external logic responds. External logic cannot tell by the simple in- spection of any control signals whether a data input operation or a data output operation is in progress. It is up to you, when designing your system, to dedicate CP1680 devices to input or output: or you must generate your own identifica- tion logic in the event that a CP1680 lOB is bidirectional. In Figure 2-15 we simply assume that external logic knows data is to be read, and knows whether the data is 16 bits or 8 bits wide. Furthermore, if the data is 8 bits wide, external logic must know which 8 bits to read. In any event. when external logic has completed its undefined operations, it must input AR low. The high-to-Iow transition of AA forces PE low again. and if interrupts are enabled, an interrupt will be re- quested via INTRO. When the CPU acknowledges the interrupt by outputting INT AK via BC 1, BC2. and BDIA. the PD1680 uses the INTAK pulse to reset INTRQ high. The method used by external logic to reset AR high again is undefined. In Figure 2-15, we show PE going high as the trigger which external logic uses to reset AJ1 high. This is clearly a viable scheme; PE will not go high again until fresh data has been output at which point it is safe to assume that the CPU knows prior data has been read by external logic. It would be equally viable for external logic to hold AR continuously low, transmitting a short high pulse whenever it reads data. This may be illustrated as follows: PE CPU has CPU has output logic has output data read data more data Because there are no control signals which identify the PD1680 operating in input mode or output mode, there is no straightforward scheme for handling bidirectional data transfers with a single PD1680 device. THE CP1680 INTERVAL TIMER The CP1680 has very elementary interval timer logic. A 16-bit Timer register, addressed as two separate 8-bit loca- tions, decrements once every eight CK1 pulses, providing the timer has been enabled. You enable and disable timer logic via Control register bit 5. As a separate event timer interrupts may be disabled via Control register bit 4. If timer interrupts are enabled, then when the timer decrements to 0, an interrupt request will occur. (Timer interrupt logic is described with other CP1680 interrupt logic later in this chapter.) If timer interrupts are not enabled, then the timer it- self is effectively disabled, since you cannot test any timer status flag to see if the timer timed out: nor can you ac- curately read the contents of the Timer registers on the fly, since there is no protection against reading timer contents while it is in the process of being decremented. The only timer programmable option you have is to load an initial value before the timer is enabled. The timer has no buffer; therefore, once it times out it begins decrementing again, if still enabled, beginning with the value FFFF16. This may be illustrated as follows: Time intervals f t ~XXXX*S*CKl t Load TImer starting value XXXX , ~I" Time out. Restart t FFFF*S*CKl , ~I" Time out. Restart FFFF*S*CKl ~ t TIme out. Restart and start TImer 2-36 The only accurate long time intervals you can compute are exact multiples of FFFF16 • 8 • CK 1. The CP1600A uses a 4MHz two-phase clock. which generates a 500 nanosecond cycle time. Thus. CK1 equals 500 nanoseconds. and long CP1600A time intervals must be an exact multiple of 262.144 milliseconds - the time it will take for the cou nter to decrement from FFFF16 to 0000. The CP1600 uses a 3.3MHz two-phase clock. which generates a 600 nanosecond cycle time; therefore. long time.inter- vals must be exact multiples of 314.572 milliseconds. The CP161 O. which runs on a 2MHz two-phase clock and has a one microsecond cycle time. will compute long time in- tervals that are exact multiples of 524.288 milliseconds. You cannot attempt to generate clock periods that are multiples of shorter time intervals by loading some initial value into the timer following each time out an unknown amount of time will elapse between the interval timer interrupt oc- curring and being acknowledged. The length of this unknown period of time will depend on the number of non-inter- ruptable instructions which may be executing in sequence when the interrupt request first occurs. plus any higher priority interrupts which may exist. Therefore. if you load an initial value into the timer. it should be to compute an isol- ated time interval only. Here is an appropriate instruction sequence: MVI 10B.RO ;INPUT CONTROL REGISTER CONTENTS ANDI CFH.RO ;ZERO BITS 4 AND 5 MVO RO.IOB ;RETURN TO CONTROL REGISTER MVII 2AH.RO ;TRANSMIT LOW-ORDER TIMER MVO RO.IOB+3 ;INITIAL BYTE MVII 34H.RO ;TRANSMIT HIGH-ORDER TIMER MVO RO.JOB+4 ;INITIAL BYTE MVI 10B.RO ;LOAD PRIOR CONTROL REGISTER CONTENTS ADDI 30H.RO ; SET BITS 4 AND 5 MVO RO.IOB ;START TIMER The instruction sequence above begins with three instructions that load the CP1680 Control register contents into Register RO. Bits 4 and 5 are zeroed. then the result is returned to the Control register. Thus. the timer and timer inter- rupts are disabled. We do not bother with an SDBD instruction. Since the data source is eight bits wide. only the low- order byte of Register RO will be significant. This being the case. we can use an 8-bit immediate AND mask to modify Register RO contents before returning the low-order byte to the Control register. Next. we load the initial timer value. one byte at a time. into Register RO. Each byte is written out to the appropriate half of the Control register. Once again we do not need to use the SDBD instruction. Since an 8-bit data path connects the CPU to the 1680 lOB. only the low-order byte of Register RO will be significant during the data output. Finally. we start the timer by loading Control register contents into Register RO. setting bits 4 and 5 to 1 and writing back the resu It. When you write into the Timer registers. you clear any timer interrupt requests which may at that time be pending. CP1680 INTERRUPT LOGIC A CP1680 lOB will generate an interrupt request by outputting a low signal at 1NiliQ if anyone of these three conditions occurs: 1) A low input at ERROR. External logic can request an interrupt via the CP1680 using the ERROR input. 2) The AR handshaking control input makes a high-to-Iow transition. This is illustrated in Figures 2-14 and 2-15. 3) The Interval Timer decrements from 1 to O. Recall that there are two separate interrupt enable/disable control bits in the Control register. One control bit applies to the Interval Timer. while the other control bit applies to both the AR handshaking and ~ interrupts. Interrupt priorities among the three sources within a single CP1680 lOB are as follows: ERROR highest AR handshaking Timer lowest When more than one CP1680 lOB is present In a CP1600 microcomputer system, then daisy chain priority is im- plemented using the MSKI input signal and the MSKO output signal. Signal connections are illustrated in Figure 2 -13. The manner in which interrupt priorities are handled by the CP1680 is a little unusual. Two or more CP1680 devices may combine their interrupt request signals. which are wired ORed and input to the CP1600 via INTRO. The CP1600 acknowledges an interrupt via the INTAK combination of BC1. BC2. and BDIR. We de- 2-37 scribed this process earlier in the chapter. All CP1680 devices simultaneously receive the INTAK combination; however. a CP1680 which is acknowledged raises its IMSKO signal high. causing it to become the IMSKI input to the next CP1680 in the daisy chain. Any device that receives a high IMSKI input ignores the interrupt acknowledge. Thus. only the highest priority. interrupt requesting CP1680 device in the daisy chain will process the interrupt acknowledge. However. it takes a finite amount of time for IMSKO high signals to propagate as IMSKI signals. and thus ripple through the daisy chain. Consequently. a maximum of eight CP1680 devices may be present in the daisy chain. A ninth device will receive its IMSKI high signal too late and will respond to an interrupt acknowledge. CP1680 lOB devices maintain their interrupt priority status until they receive a high TCI pulse. At that time. prior inter- rupt priorities are reset at all devices. and new priority arbitration begins. Thus. when using CP1680 lOB devices. you are required to end all interrupt service routines by executing a TCi instruction. Note that if one CP1680 lOB has more than one active interrupt request (for example. an ERROR interrupt request and a timer interrupt request), then this internal interrupt priority will take precedence over the daisy chain interrupt priority. That is to say. the ERROR interrupt request will be acknowledged and serviced first. After the next TCI instruction is ex- ecuted. the timer interrupt request will be serviced before any interrupt request from a lower priority CP1680 device is acknowledged. Every CP1680 device has three 8-bit Interrupt Vector registers. one dedicated to each of the three interrupt sources. These three Interrupt Vector registers were illustrated earlier in the chapter. Following an interrupt acknowledge. when the lAB combination appears at BC1, BC2. and BDIR, the contents of the Interrupt Vector register for the highest priority active interrupt will be returned to the CPU. Interrupt acknowledge timing is il- lustrated in Figure 2-9. At the interrupt service location a Jump-to-Subroutine instruction will probably be stored. Since the Jump-to-Subroutine object code is three words long. a maximum of 85 interrupts can be origined in the first 256 words of memory. This is more than sufficient. since only eight CP1680 devices with 24 interrupts can be sup- ported in a single daisy chain. 2-38 DATA SHEETS This section contains specific electrical and timing data for the following devices: • CP1600 CPU • CP1600A CPU ·CP1610CPU • lOB 1680 I/O Buffer 2-01 CP1600·CP1600A·CP1610 IUS TIMING DIAGRAM JS CONTROL 1m BAR @ NACT @ DTB @ IIACT @ BAR @ DO-DI5 ~ +--+ FlOAT x::x .... FLOAT -=x +--+ OUTPUT INPUT OUTPUT PC+I TO PROGRAM COUNTER IEXT INSTRUCTION FETCH DISPLACEMENT E3~3A!XXXXXXX UNDEFINED ~STABLE AS LONG AS ADDRESS IS STMILE ; I I---tAI ~ EBCI: • DON'T CARE • O-DOth CARE-; ....... VWD INPUT THROUGHOUT TSI TYPICAL INSTRUCTION SEQUENCE ~IJlCYCLE~ ~~A~A~~~A~R~~ tcv----t I tBI-l ~ -i t-tB2 I 1 1 ,...-------i I ~-----~ 00-015 : ~ B~ ~s W INPUT CHANGING FROM OUTPUT CHAHGING FROM INSTRUCTION FLOAT IIOOE TO VALID OUTPUT IIOOE TO OR DATA OUTPUT IIODE FLOAT IIOOE OPERANO BRANCH ON EXTERNAL CONDITION INSTRUCTION Data sheets on pages 2-02 through 2-06 reprinted by permission of General Instrument Corporation, 2-02 CP1600 ELECTRICAL CHARACTERISTICS (CP1600) Maximum Rating.· "Exceeding these ratings could cause Vo o, Vce, GNO and all other input/output voltages permanent damage to these devices. with respect to Vaa . . . . . . . . . . . . -0.3V to +18.0V Functional operation at these conditions is Storage Temperature . . . . . . . . . . . . -55 0 C to +150 0 C Operating Temperature . . . . . . . . . . . . . O°C to +70°C not implied-operating conditions are specified below. Standard Condition.: (unless otherwise noted) Voo=+12V±5%, 70mA(typ), 110mA(max.) VBa= -3V±10%, 0.2mA(typ) ,2mA(max.) Vce=+5V±5%, 12mA(typ) , 2SmA(max.) Operating Temperature (T A)=O° C to +70° C Characterlltlc Sym Min Typ·· Max Units Condltlonl DC CHARACTERISTICS Clock Inputl High VIHC 10.4 - Voo V Low VILC 0 - 0.6 V Logic Inputs Low VIL 0 - 0.65 V High (All Lines except BOROY) VIH 2.4 - Vcc V High (Bus Data Ready Line See Note) VIHa 3.0 - Vee V Logic Outputl High VOH 2.4 Vee - V IOH = 1oo~ Low (Data Bus Lines 00-015) VOL - - 0.5 V IOL = 1.6mA Low (Bus Control Lines, BC1,BC2,BOIR) VOL - - 0.45 V IOL = 2.0mA Low (All Others) VOL - - 0.45 V IOL = 1.6mA AC CHARACTERISTICS Clock Pulse Inputs, 1/>1 or 1/>2 Pulse Width t1/>2, tl/>2 120 - ns Skew (1/>1, 1/>2 delay) t12, t21 0 - - ns Clock Period tcy 0.3 - 2.0 ",s Rise & Fall Times tr,tf - - 15 ns Malter SYNC: Delay from I/> tms - - 30 ns DO-D15 BUI Signall Output delay from 1/>1 (float to output) tBO - - 120 ns 1 TTL Load & 25 pF Output delay from 1/>2 (output to float) t BF - 50 - ns Input setup time before 1/>1 t B1 0 - ns Input hold time after 1/>1 tB2 10 - - ns Bu. Control Signall BC1,BC2,BDIR Output delay from 1/>1 t DC - - 120 ns BUSAK Output delay from 1/>1 t BU - 150 - ns TCI Output delay from 4>1 tro - 200 - ns TCI Pulse Width trw - 300 - ns EBCA output delay from BEXT input tOE - - 150 ns EBCA wait time for EBCI input tAl - - 400 ns CAPACITANCE TA=+25°C; Voo=+12V; Vee = +5V; VBB =-3V; tl/>1 t ct>2 = 120ns 1/>1, 1/>2 Clock Input capacitance C1/>1,C1/>2 - 20 30 pF Input CapaCitance 00-015 CIN - 6 12 pF All Other - - 5 10 pF Output CapaCitance 00-015 in high impedance state Co - 8 15 pF '"Typical values are at +25°C and nominal Voltages. NOTE: The Bus Data ReaOY(BOROY) line is sampled during time period TSI after a BAR or AOAR bus control signal. BOROY must go low requesting a wait state 50 ns before the end of TS1 and remain low for 50 ns minimum. BOROY may go high asynchronously. In response to BOROY, the CPU will extend bus cycles by adding additional microcycles up to a maximum of 40 ",sec duration. 2-03 CP1600A ELECTRICAL CHARACTERISTICS (CP1600A) Maximum Ratings· "Exceeding these ratings could cause Voo, Vee, GNO and all other inpuVoutput voltages permanent damage to these devices. with respect to Vaa . . . . . . . . . . . . -0.3V to +18.0V Functional operation at these conditions is Storage Temperature . . . . . . . . . . . . -55°C to +150°C not implied-operating conditions are Operating Temperature . . . . . . . . . . . . . O°C to +70°C specified below. Standard Conditions: (unless otherwise noted) Voo=+12V±5%, 70mA(typ) ,14OmA(max.) VBa= -3V±10%, 0.2mA(typ) , 2mA(max.) Vee=+5V±5%, 12mA(typ) ,25mA(max.) Operating Temperature (TA)=O°C to +70°C Characteristic Sym Min Typ·" Max Units Condillons OC CHARACTERISTICS Clock Inputs High VIHe 10.4 - Voo V Low VILe 0 - 0.6 V Logic Inputs Low VIL 0 - 0.65 V High (All Lines except BDROY) VIH 2.4 - Vee V High (Bus Oata Ready Line See Note) VIHB 3.0 - Vee V Logic Outputs High VOH 2.4 Vee V 10H = l001lA Low (Oata Bus Lines 00-015) VOL - - 0.5 V 10l= 1.6mA Low (Bus Control Lines, BC1,BC2,BDIR) VOL - - 0.45 V 10l= 2.0mA Low (All Others) VOL - - 0.45 V 10l= 1.6mA AC CHARACTERISTICS Clock Pul.. Inputs, .p1 or .p2 Pulse Width t.p2, t.p2 95 - ns Skew (411, 412 delay) t12, t21 0 - - ns Clock Period tcy 0.25 - 2.0 ~s Rise & Fall Times tr, tf - - 15 ns MMterSYNC: Delay from 41 tms - - 30 ns 00-015 Bus Signals Output delay from 411 (float to output) tBO - - 95 ns 1 TTL Load & 25 pF Output delay from .p2 (output to float) t BF - 50 - ns Input setup time before 411 t B1 0 - - ns Input hold time after 4>1 tB2 10 - - ns Bus Control Signals BC1,BC2,BDIR Output delay from 411 t DC - - 200 ns BUSAK Output delay from 411 t BU - 150 - ns TCI Output delay from 4>1 tTO - 200 - ns TCI Pulse Width tTW - 300 - ns EBCA output delay from BEXT input tOE - - 150 ns EBCA wait time for EBCI input tAl - - 400 ns CAPACITANCE TA=+25°C; Voo=+12V; V ec =+5V; VBB=-3V; t'4>l t tP2 = 120ns .pl, .p2 Clock I nput capacitance C4>l,C4I~ - 20 30 pF Input Capacitance 00-015 CIN - 6 12 pF All Other - - 5 10 pF Output Capacitance 00-015 in high impedance state Co - 8 15 pF ""Typical values are at +25°C and nominal voltages. NOTE: The Bus Oata ReaOY(BOROY) line is sampled during time period TSI after a BAR or ADAR bus control signal. BOROY must go low requesting a wait state 50 ns before the end of TSl and remain low for 50 ns minimum. BDROY may go high asynchronously. In response to BDRDY, the CPU will extend bus cycles by adding additional microcycles up to a maximum of 40 ~sec duration. 2-04 CP1610 ELECTRICAL CHARACTERISTICS (CP1610) Maximum Ratings· ·Exceeding these ratings could cause Vo D , Vee, GNO and all other input/output voltages permanent damage to these devices. with respect to VBB • • • • • • • • • • • • -0.3V to +18.0V Functional operation at these conditions is Storage Temperature . . . . . . . . . . . . -55° C to +150° C Operating Temperature . . . . . . . . . . . . . O°C to +70°C not implied-operating conditions are specified below. Standard Conditions: (unless otherwise noted) Voo=+11V±5%. 70mA(typ). 110mA(max.) VBB= -3V±10%. 0.2mA(tYPI .2mA(max.) Vee=+5V±5%. 12mA(typ) .25mA(max.) Operating Temperature (TA)=O°C to +70°C Characteristic Sym Min Typ·' Max Units Conditions DC CHARACTERISTICS Clock Inputs High VlHe 10.0 - Voo V Low VILe 0 - 0.6 V Input current - - - 15 mA VIHC = Voo-1 Logic Inputs Low VIL 0 - 0.65 V High (All Lines except BOROY) VIH 2.4 - Vee V High (Bus Data Ready Line See Note) VIHB 3.0 - Vee V Logic Outputs High VOH 2.4 Vee - V 10H = 1001tA Low (Data Bus Lines 00-015) VOL - - 0.5 V 10L= 1.6mA Low (Bus Control Lines. BC1.BC2,BOIR) VOL - - 0.45 V 10L= 2.0mA Low (All Others) VOL - - 0.45 V 10L= 1.6mA AC CHARACTERISTICS Clock Pulse Inputs, eIl1 or eIl2 Pulse Width tell2. tell2 250 - ns Skew (eIl1. eIl2 delay) t12, t21 0 - - ns Clock Period tcy 0.5 - .2.0 p's Rise & Fall Times tr, tf - - 15 ns Master SYNC: Delay from ell tms - - 30 ns 00-015 Bus Signals Output delay from .p1 (float to output) tBO - - 200 ns 1 TTL Load & 25 pF Output delay from .p2 (output to float) t BF - 50 - ns Input setup time before eIl1 t B1 0 - - ns Input hold time after eIl1 tB2 10 - - ns Bus Control Signals BC1,BC2,BOIR Output delay from .p1 t DC - - 200 ns BUSAK Output delay from .p1 t BU - 150 - ns TCI Output delay from eIl1 tTO - 200 - ns TCI Pulse Width tTw - 300 - ns EBCA output delay from BEXT input EBCA wait time for EBCI input tOE tAl - - - - 150 400 ns ns , CAPACITANCE TA=+25°C; Voo=+12V; Vee = +5V; VBB =-3V; t'4>1 t eIl2 = 120ns eIl1, eIl2 Clock Input capacitance Cq>1, C4>2 - 20 30 pF Input capacitance 00-015 CIN - 6 12 pF All Other - - 5 10 pF Output CapaCitance 00-015 in high impedance state Co - 8 15 pF ·'Typical values are at +25°C and nominal voltages. NOTE: The Bus Data ReaOY(BDROY) line is sampled during time period TSI after a BAR or ADAR bus control signal. BDRDY must go low requesting a wait state 50 ns before the end of TS1 and remain low for 50 ns minimum. BOROY may go high asynchronously. In response to BDROY, the CPU will extend bus cycles by adding additional microcycles up to a maximum of 40 p'sec duration. 2-05 1081680 ELECTRICAL CHARACTERISTICS Maximum Ratings· Voo and Vee and all other input/output voltages with respect to GNO ........................................... -0.3Vto+18V Storage Temperature ..................................... -55° C to +150° C 'Exceeding these ratings could cause Operati ng Tem peratu re ....................................... 0° C to +70° C permanent damage. Functional operation of this device at these conditions is not Standard Conditions (unless otherwise noted) implied-operating ranges are specified below. All voltages referenced to GNO Voo = +12V ± 5% Vee = +5V ±5% Operating Temperature (T A) = 0° C to +70° C Characteristic Symbol Min Typ·· Max Unit Condition DC CHARACTERISTICS Clock Input: High Vihc 2.4 - Voo V Low Vilc 0 - .5 V Logic Inputs: High Vih 2.4 - Vee V Low Vii 0 - .65 V Logic Outputs: High Voh 2.4 Vce - V loh = 100pA Low Vol - - .5 V 101 = 1.SmA AC CHARACTERISTICS Clock Inputs CK1 Clock period tpc 0.4 - 4.0 I1S Clock width tcl 70 - - ns Rise & Fall times tcr,tcf - - 10 ns CAPACITANCE (TA = 25°C, Voo = +12V, Vee = +5V) Input Capacitance: 00-07 Cin - 6 12 pF Yin =OV All others - 5 10 pF Yin = OV Output Capacitance: Cout - 8 15 pF "Typical values are at +25° C and nominal voltages. TIMING DIAGRAM H~ H ~ H H / .. t~e .. / wo -U tef ----ll+:----ll--- ter U u I tel BOIR BC2.BC1 -'J I / -+l toe I+- '"-_ _ _ _ _ __ Note: CK1' not drawn to scale. CIRCUIT DESCRIPTION Register Address Description This circuit is designed to provide all the data buffering and N Control Register control functions required when interfacing the Series 1600 N+1 Data Register Low Order 8-bits Microprocessor System to a simple peripheral device. Data is N+2 Data Register High Order 8-bits transferred to and from the peripheral on 16 bidirectional lines. N+3 Timer Low Order 8-bits each of which can be considered to be an input or output. The N+4 Timer High Order 8-bits transfer of information with the CP1600 is accomplished via an 8- N+5 Peripheral Interrupt Address Vector bit highway, the 16-bits being transferred as two 8-bit bytes. the N+6 Timer Interrupt Address Vector register addresses are assigned CP1600 memory locations. as N+7 Error Interrupt Address Vector follows (N is an arbitrary starting address): 2-06 Chapter 3 THE TEXAS INSTRUMENTS TMS 9900, TMS 9980, AND TMS 9940 PRODUCTS The TMS 9900 was the first 16-bit microprocessor that could compete effectively in the minicomputer market. In fact. the TMS 9900 is a one-chip implementation of the TM 990 series minicomputer Central Processing Units. The TMS 9900 is packaged as a 64-pin DIP; it generates signals for a 15-bit Address Bus and a separate 16-bit Data Bus, whereas other 16-bit microprocessors multiplex their Data and Address Busses. The TMS 9980 series microprocessors are 40-pin DIP versions of the TMS 9900; in order to reduce pin counts, the TMS 9980 series microprocessors access external memory via an 8-bit Data Bus and 14-bit Address Bus. The TMS 9940 is a one-chip microcomputer containing a subset of the TMS 9900 Central Processing Unit. together with on-chip memory and real- time clock logic. The TMS 9900 product line has for some time been one of the enigmas of the microprocessor industry. Even a casual examination of the TMS 9900 instruction set shows that from the programmer's viewpoint. this microprocessor was at least two years ahead of its time. While it may have had problems competing in high-volume, simple applica- tions, it was certainly the microprocessor of choice for data processing-type, program-intensive applications, yet it was not widely used in these markets. The reason for this lack of acceptance has been poor support from Texas Instruments. Texas I nstru ments initially offered little support for the TMS 9900 because this microprocessor was designed as a low- end product of the TM 990 minicomputer series. That is to say, customers were expected to develop products around the TM 990 minicomputers; then, if they chose to, they could build production models around the TMS 9900 microprocessor. This development path did not call for extensive TMS 9900 support. In all probability, Texas Instru- ments was caught by surprise by the buoyancy of the microprocessor market - as a market in its own right. Certainly, if Texas Instruments had given the TMS 9900 the same level of support that Intel gave the 8080A. we would see en- tirely different microprocessor product distributions today. But the TMS 9900 and its derivative products are powerful enough that the belated support they are now receiving from Texas Instruments will give the product line a reasonable share of future markets. Texas Instruments now provides full support for the TMS 9900 microprocessor line. TMS 9900 support devices are designed specifically for the TMS 9900 and can be used with the TMS 9900, 'TMS 9980, or TMS 9940 products. The following devices are described: The TIM 9904 Clock Generator The TMS 9901 Programmable System Interface The TMS 9902 Asynchronous Communications Controller The TMS 9903 Synchronous Communications Controller Texas Instruments is the primary manufacturer for all of the TMS 9900 series products. TMS 9900 series pro- ducts are handled out of the following Texas Instruments office: TEXAS INSTRUMENTS, INC. P.O. Box 1443 Houston. Texas 77001 Second sources for the TMS 9900 family are: AMERICAN MICROSYSTEMS, INC. 3800 Homestead Road Santa Clara. California 95051 SMC MICROSYSTEMS CORP. (TMS 9980 series only) 35 Marcus Blvd. Hauppage, N.Y. 11787 3-1 THE TMS 9900 MICROPROCESSOR The TMS 9900 is manufactured using N-channel silicon gate MOS technology. It is packaged as a 64-pin DIP. Three power supplies are required: -5V. +5V. and +12V. Using a 3 MHz clock. instruction execution times range between 3 and 10 microseconds. A TMS 9900 FUNCTIONAL OVERVIEW Figure 3-1 illustrates that part of our general microcomputer system logic which is implemented by the TMS 9900 CPU. The most important features of Figure 3-1 are: • The absence of programmable registers • The presence of significant interrupt handling logic • The presence of serial-to-parallel data conversion logic • The absence of I/O port interface logic Clock Logie Accumulator Registerlsl Programmable I/O Ports Timers Figure 3-1. Logic of the TMS 9900 CPU 3-2 Let us first consider the manner in which the TMS 9900 handles programmable registers. TMS 9900 PROGRAMMABLE REGISTERS Within the logic of the TMS 9900 itself. there are just three 16-bit programmable registers: a Program Counter. a Workspace register. and a Status register. The Program Counter and Status register are straightforward. The Program Counter contains the address of the next instruction to be executed. The Status register maintains various statuses. which we describe later in this chapter. The Workspace register is a unique and powerful programming feature of the TMS 9900. This register identifies the first of sixteen 16-bit memory locations which act as .16 General Purpose registers. This may be illustrated as follows: lS-BIT MEMORY Special Functions LOCATION Any memory HIGH- LOW- ~~--------~~~------~, xxxx addresses ., xxxx xxx x + 2 ORDER BYTE ~~ I I --- ORDER BYTE l' ...IIi!. RO Rl RO cannot be an Index register . Shift instruction will seek shift WP count in low-order four RO bits if xxxx + 4 R2 instruction object code specifies xxx x + 6 R3 o shifts. xxx x + 8 I R4 xxx x + A : R5 xxxx + C I RS xxxx+ E J R7 xxxx+ 10 I R8 xxxx + 12 : R9 xxx x + 14 I Rl0 xxx x + 16 : Rll Subroutine return address or XOP eftective address xxxx + 18 I R12 CRU Bit address R13 Save old WP xxxx + lA • xxxx + lC i R14 Save old PC xxxx + lE I R15 Save old ST Some of the 16 registers serve special functions, as defined by the text on the right-hand side of the illustration above. For the moment. do not attempt to understand these special functions. They are described later in the chapter. In TMS 9900 microcomputer systems, external memory consists of 16-bit memory words. TMS 9900 Each 16-bit memory word has its own memory address. Within the TMS 9900 CPU, MEMORY however, memory is addressed as a sequence of 8-bit locations. For this to occu r. the CPU ADDRESSES 3-3 generates an internal 16-bit memory address; the high-order 15 bits of the internal memory ad- dress create the external memory addresses. This may be illustrated as follows: This 16-bit address is created ( ~ ................ .............. by program logic to address 65536 bytes These 15 address bits are output ~~~ ~ ~ to access 32768 external, 16-bit memory words I Byte Discrimination Bit A ......_ _ _ _ _ _ _ _ _)__ .Y 0 = Even Byte Lts!1 1 = Odd Byte ~5 14 13 12 11 10 9 ~SB . -. 8 - - 7 6 5 4 3 2 .- 1 I-0 Bit No. I I I 1 J Memory Address I nside the CPU tL I I I I I I I I 11 I 1 j~ j ~ j ~~ . ~ ~ • j, . ~ ~ j~ j AO (LSB) A1 A2 A3 A4 A5 A6 A7 External Address Bus A8 A9 A10 A11 A12 A13 A 14 (MSB) When designing hardware around the TMS 9900. you will implement external memory as 16-bit words. which are ad- dressed by a 15-line Address Bus. That is to say. 32.768 16-bit words may be addressed. But when you are programming the TMS 9900 you will visualize memory as 65.536 bytes. addressed by a 16-bit ad- dress. An even byte address will access the low-order byte of an external 16-bit memory word, while an odd memory address will access the high-order byte of an external 16-bit memory word. Any 16 contiguous words of read/write memory may serve as the current 16 general purpose registers for the TMS 9900. You may have as many sets of 16-bit registers as you wish, limited only by the size of implemented memory. If you are using more than one set of 16-bit registers, then at any time just one set of 16-bit registers can be selected. The WP register identifies the first of the 16 contiguous memory locations serving as the current 16 general purpose registers. Each of the 16 general purpose registers may be used to store data or addresses. Thus. each general purpose register may serve as an Accumulator or as a Data Counter. Registers R11 through R15 are used as special Pointer storage buffers; we will be describing the way in which these registers are used as the chapter proceeds. Having 16 general purpose registers in read/write memory, rather than in the CPU, is the single most important feature of TMS 9900 architecture. The advantage of having 16 general purpose registers located anywhere in read/write memory is that you can have many sets of 16 general pu rpose registers. For example. following an interrupt acknowledge. you no longer need to save the contents of general purpose registers - all you need to do is save the contents of the Program Counter. the Workspace register and the Status register. and that is done automatically by TMS 9900 interrupt handling logic. By loading new values into the Program Counter and the Workspace register. you 3-4 can begin executing a new program. accessing 16 new memory words - which will be treated as a new set of 16 general purpose registers. The disadvantage of having 16 general purpose registers in read/write memory is that no TMS 9900 microcom- puter system can be configured without read/write memory; and if you are going to use many different sets of 16- bit registers. then you are going to require a significant amount of read/write memory. Furthermore. you lose the speed associated with executing register-to-register operations; there are no source and destination locations left in the CPU. Every register access becomes a memory access. TMS 9900 literature refers to the process of switching from one set of general purpose TMS 9900 registers to another as a context switch. This terminology reflects the complete change of pro- CONTEXT gram environment that results from the switch. SWITCH Special instructions allow you to perfqrm a forward context switch or a backward context switch. During a forward context switch. you load new values into the Workspace register and Program Counter. while simultaneously saving the old Workspace register. Program Counter. and Status register contents in the new General Purpose Registers R13. R14. and R15. A backward. or reverse context switch loads the current contents of General Purpose Registers R13. R14. and R15 into the Workspace register. Program Counter. and Status register. respectively. thus returning you to your previous set of general purpose registers. You can perform context switches as often as you like and whenever you like. For example. a very effective way of using context switching is to group data into contiguous memory words which you can identify as a register set. Upon entering a subroutine. you can perform a context switch which automatically creates all necessary initial data and ad- dress values in appropriate general purpose registers. This may be illustrated as follows: MEMORY Arbitrary WORDS Memory RO Rl R2 R3 R12 R13 R14 R15 Data and parameters used by subroutine are RO stored here by the calling ~ Rl program before calling R2 the subroutine R3 R4 Rl0 3-5 As illustrated above. when you perform a forward context switch, the current Program Counter TMS 9900 contents. Status register contents. and WP register contents are saved in what will become the FORWARD new Registers R13. R14 and R15 .. respectively. Here is the exact sequence in which events oc- CONTEXT cur: SWITCH 1) The new WP register contents are loaded into the CPU and held in temporary storage. 2) The current Status register contents are written out to the memory location which will become the new Register R15. 3) The current Program Counter contents are written out to the memory location which will become the new Register R14. 4) The current WP register contents are written out to the memory location which will become the new Register R13. 5) The new WP register contents. which were held in temporary storage. are moved into the WP register. 6) The new value is loaded into the Program Counter Thus. when a forward context switch is performed. an audit trail ensures that program logic knows the exact machine state at the instant of the forward context switch. When a backward context switch occurs, the contents of the current General Purpose TMS 9900 registers R13, R14, and R15 are loaded into the WP register, the Program Counter, and the BACKWARD Status register, respectively. Thus. program logic returns to the location of the forward context CONTEXT switch SWITCH TMS 9900 MEMORY ADDRESSING MODES The TMS 9900 provides these four methods of addressing memory: 1) Direct memory addressing 2) Direct, indexed memory addressing 3) Implied memory addressing 4) Implied memory addressing with auto-increment The way in which the TMS 9900 implements these four memory addressing modes is exactly as described in Volume 1. Chapter 6. The important point to note is that the TMS 9900 looks upon its address space as consisting of 32.768 16- bit memory words which are addressed using 15. rather than 16. Address Bus lines: yet programs compute all ad- dresses as 16-bit words. This logic was described earlier. Direct memory addressing instructions provide the memory address in the second word TMS 9900 of an instruction's object code: DIRECT ADDRESSING MSB LSB 15 14 13 12 11 10 9 8 6 5 4 2 o '--BitNo. I I I II I I II I I I III I I Instruction Object Code \.------JL f Byte ;dontme, ""og~,ed CPU logl, by .... - - - - - - - - - - - - - - - - - Direct address output via Address Bus Direct, indexed memory addressing instructions provide a base address in the second TMS 9900 object code word, but they also identify a general purpose register whose contents are INDEXED to be added, as a signed binary number, to the base address. Again. the low-order bit of the ADDRESSING computed address is not output via the Address Bus. but is interpreted by CPU logic as a byte identifier. General Purpose Register RO cannot be specified as an index register. Direct. indexed addressing is very useful in a TMS 9900 microcomputer system. It allows you to address the previous set of general purpose registers. following a context switch. without knowing where the previous registers were. Sup- pose you want to access the contents of the memory word which was being used as General Purpose Register R5 3-6 before you switched to your current set of general purpose registers. Recall that the previous Workspace register con- tents are stored in your current General Purpose Register R13. You could thus address the previous General Purpose Register R5. without knowing where this general purpose register may have been. by using direct. indexed addressing as follows: Instruction Base Address Read/Write Memory ARBITRARY MEMORY ~ ADDRESSES High- Low- RO Order Byte I Order Byte ( XXXX Rl I XXXX + 2 R2 ! XXXX + 4 R3 1 XXXX + 6 R4 I XXXX + S R5 I XXXX + A R6 j XXXX + C Previous R7 : XXXX + E General RS XXXX + 10 Purpose ! R9 I XXXX + 12 registers Rl0 i XXXX + 14 Rll I XXX X + 16 XXXI( + 18 R12 i R13 I XXXX + lA XXXX + lC R14 i R15 I XQX + lE I I 1 RO yyyy Rl yvyy + 2 R2 I YVYV + 4 "R3 I yyvy + 6 R4 ~ yvyy +8 R5 I yyyy+A Current R6 i yvyy +C R7 : yyyy + E General Purpose RS I yyyy + 10 R9 I yvyy+ 1'2 registers Rl0 I vyyy + 14 Rll yyyy + 16 I R12 I yyyy + 18 R13 Xl.; I xx yvyy+ lA R14 I yvyy + lC R15 i YVYY + lE I An implied memory addressing instruction will specify one of the 16 current general pur- TMS 9900 pose registers as providing the effective memory address. IMPLIED If you specify implied memory addressing with auto-increment, then the contents of the ADDRESSING identified general purpose register will be incremented after the memory access has been performed. If the instruction specifies a byte operation. the register contents will be incremented by one; the register contents will be incremented by two after a full-word operation. 3-7 Six object code bits identify the data memory addressjng option selected by any TMS 9900 instruction that accesses data memory. The six object code bits are interpreted as follows: T R ~~ '-v--'~ L { 0000 through 1111 select the general purpose register to be ac- cessed during the memory address computation 00 - Not a memory reference instruction. The selected register is accessed directly. 01 - Implied memory addressing 10 - Direct addressing if register RO is selected. { Direct, indexed addressing otherwise. 11 - Implied memory addressing with auto-increment Two-address instructions will include 12 memory addressing option bits: MSBr--p__~~~~~~~~~~~~~~~~~~__~-.LSB I .1 I Two-address instruction object code '"-v-' ~ '"-v-' ~ TO RD TS RS ~~ Destination Source address address Some instructions allow a source to be anywhere in memory. but the destination must be a general purpose register. These object codes include TS. RS. and RD. but not TO. TMS 9900 Jump instructions use program relative. direct addressing. These are one-word TMS 9900 instructions. where the low-order byte of the instruction object code provides an 8-bit. Signed PROGRAM binary value. which is added to the incremented contents of the Program Counter. This is MEMORY straightforward program relative. direct addressing. ADDRESSING TMS 9900 I/O ADDRESSING As compared to other microcomputers described in this book. the TMS 9900 has unusual I/O logic. In addition to ad- dressing I/O devices as memory locations. you can address a separate I/O field of up to 4096 bits. Texas Instru- ments' literature refers to this field as the "Communications Register Unit" (CRU).lf you are programming a TMS 9900 microcomputer system that has already been configured by Texas Instruments. then it is justifiable to look upon the Communications Register Unit as a form of I/O port. If you are building your own interface to a TMS 9900 CPU. then instructions that are supposed to access the Communications Register Unit in reality Simply make alternative use of part of the Address Bus in conjunction with three control signals: CRUCLK. CRUIN. and CRUOUT There are two classes of TMS 9900 CRU instructions. The first class accesses individual bits (or signals). while the second class accesses bit fields that may be between 1 and 16 bits wide. There are three single-bit CRU instructions; they set. reset. or test the identified CRU bit. This is equivalent to set- ting. resetting. or testing an external signal or single I/O port bit. When a bit is to be set or reset. the new level is output via CRUOUT. and a CRUCLK pulse indicates that valid data is on the CRUOUT line. When the condition of a bit is to be input or tested. then external logic is required to return the level of the tested bit via CRUIN. 3-8 A CRU bit instruction outputs a 12-bit address which is computed as follows: Instruction Object Code. r-----------------~~--------------~\ MSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o LSB I I I II I I I IX I y Iy I y Iy I y I y Iy I General Purpose Register R12 ~~--~~~'=~~~~~~-----------~----------~ r \ MSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o LSB I I I Izlzlzlzlzlzlzlzlzlzlzlzi x X X X X Y Y Y Y Y Y y + Z Z Z Z Z Z Z Z Z Z Z Z L S u m "",,om .. effec.;'. CRU "jd"" X, Y and Z represent any binary digits The 12-bit address is output on the 12 lower-order address lines; the three higher-order address .lines are all 0 to designate a CRU address. Now during the execution of a CRU bit instruction, the address which is output is supposed to be a bit address - that is, an address identifying one bit in a possible 4096-bit fieJd. So far as external interface logic is concerned. the address can be interpreted in any way. However. data output will' occur via CRUOUT only; data is input via CRUIN, and stored in the Equal bit of the Status register. There are two multi-bit CRU instructions: one. LDCR. transfers data from an addressed memory location to any ad- dressed CRU bit field. The other. STCR. transfers data from an addressed CRU bit field to any addressed memory loca- tion. Anywhere from 1 to 16 bits of data may be transferred by the LDCR and STCR instructions Instruction object codes are interpreted as follows: MSB T R LSB .-A-.~ 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 o· Bit No, II I III III I I I I I I I Multi-bit CRU Instruction ...... - ~ ~ ~~ -~ L{These four bits identify the general purpose register which is to be used in the memory address computation 0000 = RO to 1111 = R15, / 00 - Register is the memory location 01 - Implied memory addressing via address in the register 10 - If Register RO is selected, then direct memory addressing is I specified; the direct address is in the next program memory '------.< word. If any register other than RO is selected, then direct, in- I dexed addressing is specified. The contents of the selected register are added to the contents of the next program memo- ry word. 11 - Implied memory addressing with auto-increment L . . - - - - - - - - - - C R U bit field length (0 is interpreted as 16) L -_ _ _ _ _ _ _ _ _ _ _ _ jOOll00 = LDCR 1001101 = STCR 3-9 The source/destination memory location is identified as it would be for any memory reference instruction. The address of the first CRU bit is specified by Register R12. For a multi-bit CRU instruction, the CRU bit address is in- cremented for each succeeding bit access, but the incremented address is held in a temporary storage location. The contents of Reg ister R12 are not incremented Thus, mUlti-bit CRU instructions may transfer anywhere from 1 to 16 bits between any memory location and any CRU bit field. Note that memory must be divided into 16-bit words, each of which has identified bit boundaries, but there are no equivalent bit boundaries in the CRU bit field. That is to say, any CRU bit may be identified via Register R12 as the first bit in a multi-bit field, while the length of the multi-bit field is identified by the instruction object code. This may be illustrated as follows: CRU MSB LSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Ixlxlxlxlxlxlxlxlxlxlxlxl 1 R12 r Start of CRU Bit Field MSB LSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 t, I y y < It t I CRU Instruction Object Code , End of CRU Bit Field If YYYY is 0000, the CRU bit field is assumed to be 16 bits in length. 3-10 When bits are transferred from a memory location to a CRU bit field. the contents of the memory location are not actually modified. but the transfer occurs as though bits had been right shifted out of the memory location. Bits arriving within the addressed CRU bit field are stored in sequential CRU bit locations with ascending addresses. This may be illustrated as follows: CRU Data Memory ~ ~ a Lowest CRU Bit / 1 Address xlxlxlxlxl1 11101011101111101110 a 1 \ 1 \ a 1 "~ a 0 1 -- 1 Highest CRU Bit Address Eleven bits have been transferred in the illustration above. If eight or fewer bits are transferred from a general purpose register. only the more significant byte is accessed: MSB LSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 a I x 1x 1X 11 1a 1a 11 11 1y 1y 1y 1y 1y 1y 1y 1y I General Purpose Register CRU Lowest CRU Bit Address a a Highest CRU Bit Address Our illustration shows a transfer of five bits. 3-11 If eight or fewer bits are transferred from a memory location, then the memory address will be considered a byte ad- dress rather than a word address; that is, the transfer will be from the low-order bits of the addressed byte, which may be either the upper or lower byte of a 16-bit memory word. Thus you can access the lower byte of a general purpose register by addressing it as a memory location. A data transfer from the CRU to data memory occurs as the exact logical reverse of the illustration above, except that high-order bits of the destination data memory word are zeroed if unfilled. This may be illustrated as follows: CRU Data Memory Lowest CRU Bit Address o o o Unused, Therefore Reset Highest CRU Bit Address As with data transfers from memory to the CRU, if eight or fewer bits are transferred, only a byte will be affected. This will be either the addressed memory byte: CRU Data Memory _ _- - - - - 1 0 Lowest CRU Bit Address o o Highest CRU Bit Address These Bits Reset to 0 3-12 or the high-order byte of a general purpose register: MSB LSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 0 1010 11 11 101 I 01X I X 1X 1X I X 1X 1x'ix I General Purpose Register ~j These Bits. Reset to 0 • "-- - V This Byte Unaffected ./ CRU -- 0 Lowest CRU Bit Address 1 0 1 1 Highest CRU Bit Address TMS 9900 STATUS FLAGS The TMS 9900 CPU has a 16-bit Status register which may be illustrated as follows: o 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .....--TMS 9900 Bit Number 15 14 13 12 11 10 9 8 6 4 3 o . - Our Bit Number Status register L-.._ _ _ _ _ _ _ Unused ' - - - - - - - - - - - - - XOP instruction executed ' - - - - - - - - - - - - - - Parity status - - - - - - - - - - - - - - Overflow status - - - - - - - - - - - - - - - Carry status ' - - - - - - - - - - - - - - - - - - Equal condition .....- - - - - - - - - - -_ _ _ _ _ _ Arithmetic Greater Than condition - - - - - - - - - - - - - - - - - - - Logical Greater Than condition The low-order four bits of the Status register represent an interrrupt mask which identifies the level of interrupt which is currently enabled. As the 4-bit interrupt mask would imply. 16 levels of interrupt are allowed. We will describe interrupt processing later in this chapter. The X status is set to 1 while an XOP instruction is being executed. This instruction allows you to perform a soft- ware interrupt - as described later in this chapter. The P, 0, and C are standard Parity, Overflow and Carry statuses. The Equal status (=) identifies a condition that currently exists, as the result of the execution of a previous in- struction, that will cause a Branch-if-Equal instruction to branch. A CRU bit to be tested also gets stored in the Equal status. The Logical Greater Than and Arithmetic Greater Than statuses are set or reset following arithmetic. logical. or data move operations. A Logical Greater Than treats the source data as simple, unsigned binary numbers. An Arithmetic Greater Than interprets the operand as signed binary numbers. TMS 9900 CPU PINS AND SIGNALS Figure 3-2 illustrates the pins and signals of the TMS 9900 CPU. Being a 64-pin DIP. the TMS 9900 can afford to have separate Address and Data Busses. 3-13 VBB HOLD VCC MeMEN WAIT READY mAo We HOLDA CRUCLK REsET VCC IAQ 4>1 4>2 015 (LSB) (LSB) A14 014 A13 013 A12 012 A11 011 A10 010 A9 09 A8 08 A7 07 A6 06 A5 05 A4 04 A3 03 A2 02 A1 01 (MSB) AO 00 (MSB) cI>4 Vss Vss VOO 4>3 DBIN ICO (MSB) CRUOUT IC1 CRUIN IC2 iNTREa IC3 (LSB) Pin Name Description Type AO - A14 Address Bus Tristate. output DO - 015 Data Bus Tristate. bidirectional 4>1.4>2.4>3. <1>4 Clock Signals Input MEMEN Memory Enable Tristate. output IAQ Instruction Fetch Output DBIN Data Bus In Tristate. output WE Write Enable Tristate. output READY Memory Ready Input WAIT Wait State Indicator Output CRUCLK I/O Clock Output CRUOUT Serial I/O Out Output CRUIN Serial I/O In Input iN'i'Rffi Interrupt Request Input ICO - IC3 Interrupt Code Input HOLD DMA Request Input HOLDA Hold Acknowledge Output LOAD Load Interrupt Input RESET Reset Input VBB. Vee. VDD. Vss Power and Ground reference Figure 3-2. TMS 9900 Signals and Pin Assignments 3-14 Pins AO - A 14 provide the 15-bit Address Bus. Note that Texas Instruments' literature numbers bits and pins from left to right; therefore, address line AO represents the most significant address bit, where as address line A 14 represents the least significant address bit. DO - 015 provide a 16-bit bidirectional Data Bus. Once again. DO represents the most significant data bit in Texas Instruments' literature. Remaining signals may be divided into bus control, interrupt control, and timing. External logic must provide four clock signals, cp1, <1>2, cp3, and <1>4. These are provided by the TIM 9904. described later in this chapter. Any memory access operation begins with an address being output via the Address Bus. The TMS 9900 CPU iden- tifies a stable address on the Address Bus by outputting MEMEN low. If the memory access operation is an instruction fetch, the IAQ is output high. If the memory access is a read, then the TMS 9900 outputs a high level via DBIN. Memory interface logic must in- terpret the high DBIN level as a signal to place data on the Data Bus. If the memory access is a memory write, then the TMS 9900 CPU outputs a low pulse via WE. Memory interface logic must use the low WE pulse to signal that valid data is on the Data Bus. and to store it in the addressed memory location. WE low does not last as long as DBIN high. When external logic cannot respond to a memory access in the available time, it requests a Wait state by input- ting READY low. The CPU acknowledges by outputting WAIT high. CRUCLK, CRUIN, and CRUOUT are three signals used to implement single-bit or serial data transfers via the CRU interface. CRUOUT is used to output bits of data to the I/O devices. and CRUIN is used to retrieve input data from the I/O devices. CRUCLK is active during output operations only. and defines when data bits on CRUOUT are valid. Let us now look at interrupt control signals. There is a single interrupt request input, INTREQ, which must be held low by any external device requesting an interrupt. External devices identify themselves via control signals ICO - IC3. Thus. an interrupt request must be accompanied by the appropriate input at ICO - IC3. Observe that there is no interrupt acknowledge signal. For DMA operations, external logic requests access to the System Bus by inputting HOLD low. The CPU acknowledges the Hold request by outputting HOL'DA high. LOAD is a nonmaskable interrupt. RESET is a typical system Reset signal. However. TMS 9900 Reset logic uses the device's interrupt capabilities; therefore. we will describe the Reset operation in detail when discussing TMS 9900 interrupt capabilities in general. TMS 9900 TIMING AND INSTRUCTION EXECUTION TMS instructions execute as a sequence of machine cycles, each of which contains two clock periods. Clock periods are timed by four clock signals, cp1, cp2, <1>3, and cp4, as illustrated in Figure 3-3. Note that <1>2 is the first phase of each clock period. and that <1>1 is the last phase. The simplest instruction execution machine cycle is an internal operations cycle. No external TMS 9900 bus signals are active during this machine cycle. and no memory or I/O access occurs. Timing for INTERNAL an internal operations machine cycle will consist of two clock periods, as illustrated in OPERATIONS Figure 3-3. MACHINE CYCLE MEMORY ACCESS OPERATIONS TMS 9900 memory access operations may consist of a memory read or a memory write. An instruction fetch is a minor variation of a memory read. Figure 3-4 illustrates memory read machine cycle timing. MEMEN goes low at the beginning of any memory access machine cycle and stays low for the entire machine cycle. 3-15 a..~"'---CLOCK PERIOD 1 - - -..........I.....t-----CLOCK PERIOD 2 - - -.....1 I OSC cf>2 cf>3 --------------~ cf>4 Figure 3-3. TMS 9900 Clock Periods and Timing Signals as Generated by the TIM 9904 ONE MACHINE CYCLE ~ CLOCK PERIOD 1 I CLOCK PERIOD 2 I cf>1 cp3 ---tt- oJ CP4 --+I+----.J MEMEN DBIN AO-A14 ADDRESS OUT 00-015 INPUT MODE INPUT MODE CPU READS DATA Figure 3-4. A TMS 9900 Memory Read Machine Cycle 3-16 DBIN goes high at the beginning of the memory read machine cycle and stays high for the entire machine cycle. Exter- nal logic can therefore use fVi'E'MEiij low as a memory address indicator while DBIN high identifies the read operation. A memory address is output stable on the Address Bus for the entire machine cycle. a The Data Bus operations during memory read machine cycle represent the only unusual characteristics of the machine cycle. Input data needs to be stable during the <1>1 high pulse of the second clock period. However. the Data Bus is connected to input logic for the entire memory read machine cycle and for a portion of the next machine cycle. Thus. during a memory read machine cycle. external logic cannot access the Data Bus to perform direct memory ac- cess. or any other operations. on the assumption that the Data Bus is free until Data I n becomes stable. Moreover. since the Data Busis held by data input logic of the CPU during the next machine cycle. a memory read machine cycle can- not be followed by a memory write machine cycle. A memory read machine cycle must be followed by an internal operations machine cycle. or by another memory read machine cycle, The only difference between an instruction fetch machine cycle and a memory read machine cycle is the fact that dur- ing an instruction fetch machine cycle. IAQ is output high. along with DBIN. for the duration of the machine cycle . ....I - - - - - - - - - O N E MACH I NE CYCLE --------~ CLOCK PERIOD 1 CLOCK PERIOO 2 cp1 cp2 CP3 ___-+_.1 cp4 ____ ~--------J MEMEN WE AO-A14 ADDRESS OUT 00-015 OATA OUT ----~--------------------------------------------~~----~ Figure 3-5. A TMS 9900 Memory Write Machine Cycle Memory write machine cycle timing is illustrated in Figure 3-6, In this illustration. we see that data is output sta- ble on the Data Bus for the entire duration of the memory write machine cycle. The Data Bus is not held by output logic beyond this single machine cycle. Thus. no restrictions are placed on the type of machine cycle which can follow a memory write machine cycle. Even though data output is stable for the entire memory write machine cycle. the write 3-17 enable strobe WE does not go low until close to the end of the first clock period. In many cases it is easier to use NOT DBIN as a write control signal. Here is the necessary logic: WRITE DBIN READ TMS 9900 instruction execution machine cycle sequences are not always self-evident; therefore, let us look at some memory reference examples. Memory address computations make machine cycle sequences quite complex. particularly for two-operand instruc- tions. Fortunately. the exact machine cycle sequences are rarely of any consequence to you as a programmer or logic designer. The eventual number of machine cycles required to execute an instruction (and therefore its execution time) is important. Generally stated. instruction execution proceeds as follows: TMS 9900 INSTRUCTION 1) The instruction object code is fetched. EXECUTION 2) The first operand address is computed. SEQUENCES 3) The second operand address (if there is one) is computed. 4) Any operation that may be required is performed. 5) If a result is generated. it is returned to the second operand address. Let us look at operand address computations using the ADD instruction (A) as a general example. First consider the in- struction in its simplest form - where the contents of one reg ister are added to the contents of another register: A R1.R2 Cycle Type Figure Function 1 MEMORY READ 3-4 Fetch instruction object code 2 ALU 3-3 Decode instruction 3 MEMORY READ 3-4 Fetch R1 contents 4 ALU 3-3 5 MEMORY READ 3-4 Fetch R2 contents 6 ALU 3-3 Add R1 and R2 contents 7 MEMORY WRITE 3-9 Store sum in R2 Now consider the same instruction's execution. but using implied memory addressing for the first operand: A *R1.R2 Cycle Type Figure Function 1 MEMORY READ 3-4 Fetch instruction object code 2 ALU 3-3 Decode instruction 3 MEMORY READ 3-4 Fetch R1 contents 4 ALU 3-3 Use R1 contents as a memory address (implied addressing) 5 MEMORY READ 3-4 Fetch contents of implied address location 6 ALU 3-3 7 MEMORY READ 3-4 Fetch R2 contents 8 ALU 3-3 Add data fetched in cycles 5 and 7 9 MEMORY WRITE 3-5 Store sum in R2 3-18 If the second (destination) operand uses direct addressing. here is the machine cycle sequence: A *R1.@LABEL Cycle Type Figure Function 1 MEMORY READ 3-4 Fetch instruction object code 2 ALU 3-3 Decode instruction 3 MEMORY READ 3-4 Fetch R1 contents 4 ALU 3-3 Use R1 contents as a memory address 5 MEMORY READ 3-4 Fetch contents of implied address location 6.7.8 ALU 3-3 9 MEMORY READ 3-4 Fetch the second instruction object code word; it holds the direct address 10 ALU 3-3 11 MEMORY READ 3-4 Fetch contents of directly addressed memory word 12 ALU 3-3 Add words fetched in cycles 5 and 11 13 MEMORY WRITE 3-5 Store sum in directly addressed memory word Indexed. direct addressing results in the following sequence: A *R1.@LABEL(5) Cycle Type Figure Function 1 MEMORY READ 3-4 Fetch instruction object code 2 ALU 3-3 Decode instruction 3 MEMORY READ 3-4 Fetch R1 contents 4 ALU 3-3 Use R1 contents as a memory address 5 MEMORY READ 3-4 Fetch contents of implied address location 6 ALU 3-3 7 MEMORY READ 3-4 Fetch the second instruction object code word; it holds the direct address 8 ALU 3-3 9 MEMORY READ 3-4 Fetch R5. the Index register contents 10 ALU 3-3 Add direct address and index 11 MEMORY READ 3-4 Fetch contents of memory word addressed by cycle 10 addition 12 ALU 3-3 Add memory words fetched in cycles 5 and 11 13 MEMORY WRITE 3-5 Store sum in memory word addressed by cycle 10 addition If the first operand-implied address specified an auto-increment. we must add one more machine cycle: A *R1 +.@LABEL(5) Cycle Type Figure Function 1 MEMORY READ 3-4 Fetch instruction object code 2 ALU 3-3 Decode instruction 3 MEMORY READ 3-4 Fetch R1 contents 4 ALU 3-3 Increment fetched R1 contents 5 MEMORY WRITE 3-5 Write incremented R1 contents back to R1 6 MEMORY READ 3-4 Fetch contents of implied address location 7 ALU 3-3 8 MEMORY READ 3-4 Fetch the second instruction object code word; it holds the direct address 9 ALU 3-3 10 MEMORY READ 3-4 Fetch R5. the Index register contents 11 ALU 3-3 Add direct address and index 12 MEMORY READ 3-4 Fetch contents of memory word addressed by cycle 11 addition 13 ALU 3-3 Add memory words fetched in cycles 5 and 12 14 MEMORY WRITE 3-5 Store sum in memory word addressed by cycle 11 addition MEMORY SELECT LOGIC MEMEN discriminates between memory and 1/0 accesses. It is therefore very important that MEMEN low be a necessary component for any memory select. You can map 1/0 into the memory space of the TMS 9900. This is true of any microprocessor. Memory addresses that select 1/0 devices will. of course. also require l\ii'E'MEN low as a contributor to I/O device select logic. 3-19 MEMEN as a contributor to select logic may be illustrated as follows: 1__ - CRU .. ~ SELECT LOGIC ·· SELECT TRUE ONLY IF MEMEN IS HIGH AND ~ ·-.. A12-A14 ARE 000 ~~ j~ .. - MEMEN ·- • -- AO (LSB) ..- 11.14 A11 A12 (MSB) , r MEMORY AND ··-- SELECT TRUE 0_ MEMORY MAPPED ·· ONLY IF MEMEN I/O SELECT LOGIC ··.. IS LOW The three high-order address lines. A 12. A 13. and A 14. are not used to address CRU bits. When addressing a CRU bit. these lines are all low. They are not low during execution of externally defined I/O instructions; therefore. A 12. A 13. and A 14 low must be a prerequisite for any CRU bit select. TMS 9900 I/O INSTRUCTION TIMING All TMS 9900 I/O instructions transfer serial data via the Communication Register Unit (CRU). (This excludes I/O which is addressed as TMS 9900 memory space.) There are four types of TMS 9900 I/O instructions. They are: 1) Data input. Anywhere from 1 to 16 bits of data may be transferred from the CRU bit field to memory. 2) Data output. This is the simple reverse of data input. Anywhere from 1 to 16 bits of data may be output from memory to the CRU bit field. . 3) Bit test. Any bit in the CRU bit field may be tested. The tested bit is input and stored in the Equal bit of the Status register. Thence. condition branch instructions can be used to test the bit level. 4) Externally defined I/O in8tructions~ These instructions generate I/O control signals. but they transfer no data. Timing for CRU output and input machine cycles is illustrated in Figures 3-6 and 3-7, respectively. Each of these figures shows two bits of data being transferred. (You should not attach any special significance to this fact; de- pending on the instruction being executed. anywhere from 1 to 16 bits may be transferred.) CRU machine cycles are executed contiguously. one per bit. Every CRU 1/0 instruction will require a memory reference machine cycle. together with one or more CRU machine cy- cles. For example. when an STCR instruction is executed to input data from the CRU to the CPU. the following machine cycle sequence will occur: Cycle Type Figure Function MEMORY READ 3-4 Fetch I nstruction Code 2 ALU 3-3 Decode Instruction a Cycles, where 0 ~ a ~ 4 } Obtain Destination Address 3+a MEMORY READ 3-4 Fetch Destination Memory Word Contents 4+a ALU 3-3 5+a MEMORY READ 3-4 Fetch R12 6+a ALU Compute CRU Starting Address and Prepare 7+a ALU 3-3 Control Signals i Cycles 8+a + i 9+a + i CRU IN ALU ALU 3-7 3-3 } Input i CRU Bits Load CRU Bits in Tempprary Register r Cycles 10 + a + i + r to } Fill Upper Bits of Byte or Word With Zeroes If i >8, r = 15 - i; if i ~ 8, r = 7 - i ALU 3-3 Prepare to Store Memory Word 12+a+i+r Output Assembled Word to Memory Location Whose 13+a+i+i' MEMORY WRITE 3-5 Contents Were Fetched in Machine Cycle 3 + a r M A C H I N E CYCLE' MACHINE CYCLE 2 - - 1 1CLOCK PERIOD 'I CLOCK PERIOO 2 CLOCK PERIOO , 1CLOCK.PERIOD21

1 cJ>2 cJ>3 ---to-' cJ>4 AO-A14 CRUIN CRU READS BIT CRU READS BIT Figure 3-7. Two TMS 9900 Input-from-CRU Machine Cycles An LDCR instruction outputs a sequence of 1 to 16 data bits to a CRU bit field. Here is the LDCR instruction machine cycle sequence: Cycle Type Figure Function 1 MEMORY READ 3-4 Fetch instruction object code 2 ALU 3-3 Decode instruction a Cycles where 0~a~4 } Obtain sou rce address 3+a MEMORY READ 3-4 Fetch source memory word contents 4+a to ALU 3-3 Prepare for data transmission 7+a 8+a MEMORY READ 3-4 Fetch R12 9+a ALU 3-3 Compute CRU starting address i Cycles CRU OUT 3-6} Output i bits to CRU 10+a+i ALU 3-3 Machine cycle to conclude instruction The SBO and SBZ instructions set or reset an addressed CRU bit; in essence. these instructions output one data bit. Here is the machine cycle sequence via which the bit output occurs: Cycle Type Figure Function 1 MEMORY READ 3-4 Fetch instruction object code 2 ALU 3-3 Decode instruction 3 ALU 3-3 Decode instruction 4 MEMORY READ 3-4 Fetch R12 5 ALU 3-3 Compute CRU address 6 CRU OUT 3-6 Output to addressed CRU bit The TB instruction inputs one CRU bit; its timing is identical to the SBO and SBZ instructions. except that machine cycle 6 is a CRU IN machine cycle. 3-22 The Address Bus is used in an unusual way during a CRU machine cycle. As we have already stated, the CRU bit field is 4096 bits wide - addressed by 12 of the 15 Address Bus lines. The three high-order Address Bus lines are used to identify I/O control instructions, as defined in Table 3-1. We can conclude from Table 3-1 that when MEMEN is high and the three high-order Address Bus lines are all low, an I/O transfer is occurring. Otherwise, one of five externally defined I/O control instructions is being executed. There are dedicated functions for these five I/O con- trols in TM 990 minicomputer systems; these are shown in Table 3-1. But to anyone who is simply building a microcomputer system around a TMS 9900, these five I/O states are undefined. Thus, Figure 3-8 illustrates TMS 9900 systems' bus utilization during both CRU operations and externally defined 1/0 operations. If CRU SEL and MEMEN are high, CRU Select logic will be active. Externally defined instructions output 0 on the 12 low-order Address Bus lines, AO - A 11; in addition, CRUCLK pulses are output as part of the instruction executions. CRUCLK is an active CRU output strobe only. This Signal pulses high whenever a valid level is present on the CRUOUT Signal line. There is no pulse for CRUIN. External logic must generate its own strobe if it is needed, by com- bining MEMEN high with a valid bit pattern on the Address Bus. CRU instructions that test the level of a bit are, to external logic. no different from CRU input instructions. External logic is required to return. via CRUIN the level of the selected bit The fact that the CPU interprets this input as status, rather than data, is immaterial to external logic. THE WAIT STATE Additional Wait State clock periods may be inserted between clock periods 1 and 2 of any memory access machine cy- cle. Timing is illustrated in Figure 3-9. At the rising edge of <1>1 of clock period 1, the CPU samples the READY input signal. If this signal is low, then the next clock period is a Wait clock period. During a Wait cycle, the WAIT output sig- nal is high; all other output signals hold the levels they had during clock period 1. A Wait State can last for any number of clock periods. During the ct>1 high pulse of every Wait clock period, the CPU samples the level of the READY input As soon as READY is sampled high, the Wait State ends. The next clock period becomes clock period 2 of the machine cycle, and the memory operation is completed. Table 3-1. High-Order Address Bus Line Used by TMS 9900 I/O Instructions Instruction Instruction (MSB) Function Mnemonic Type A14 A13 A12 LDCR Output 0 0 0 Output data to CRU SBO Output 0 0 0 Set CRU bit to 1 SBZ Output 0 0 0 Reset CRU bit to 0 STCR Input 0 0 0 Input data from CRU TB Test (Input) 0 0 0 Input CRU bit to Equal status bit IDLE Control 0 1 0 Enter HALT condition RSET Control 0 1 1 Reset the Interrupt mask CKOF Control 1 0 1 Real time clock on I These are CKON Control 1 1 1 1 0 1 Real time clock off I TM 990 uses. LREX Control Execute bootstrap Instructions are undefined in a TMS 9900 system. 3-23 -- A14 A13 . .. :: A12 A11 .. AO -- CRUCL.K - CRUOUT CRUIN MEMEN 7 6 - :: LREX CKON ~ 5 CKOF 4 UNUSED 3 2 -- ~ ~ RSET HALT 1 01""- - UNUSED CRU SEL t -- - CRU SELECT CRU SELECT • LOGIC SIGNALS ••• ... - If CRU SEL and "M'EiVi'EN are high, CRU Select logic will be active. Figure 3-8. TMS 9900 System Bus Utilization During I/O Operations ....t----------- ONE MACHINE CYCLE -------------t~ CLOCK PERIOD 1 I WAIT CLOCK PERIOD I WAIT CLOCK PERIOD CLOCK PERIOD 2 ¢1 ¢2 ¢3 _ _ _-, ¢4 _ _ _ _....J READY WAIT Figure 3-9. The TMS 9900 Wait State 3-24 THE HOLD STATE The TMS 9900 has a typical microcomputer Hold State, used to enable direct memory access operations. Exter- nal logic initiates a Hold State by inputting FK>m low. At the beginning of the next non-memory reference machine cycle. the CPU floats its Address and Data Busses. together with the DBIN. 'M"tMm and wt control signals. HOLDA is output high as a Hold Acknowledge. Timing is illustrated in Figure 3-10. (NON-MEMORY ICLO~~~~~IOD 'I HOLO HOLO I CLOCK PERIOO' I q,1 \ n. ._- rill}..oJ q,3 --+~ HOLOA 00-015 ---~~------ --- AO-A14, WE, } MEMEN,DBIN _-"_'" -------~~--------- ~------------~ Figure 3-10. TMS 9900 Hold State Timing The Hold State lasts until external logic raises HOLD high again. It is up to external logic to perform all operations associated with a DMA transfer. The CPU simply floats the System Bus in response to a Hold request. The only nonobvious aspect of Figure 3-10 is the fact that Data Bus timing, during normal instruction execution. differs from other System Bus signal timing. Figure 3-10 highlights this fact by showing the Data Bus floating at the beginning of the first HOLD clock period. while other signals float earlier in the preceding clock period. This is not a particularly significant event. The entire System Bus is floating once the HOLD clock period has begun. However. the actual tristate condition for any signal begins at that point in the preceding clock period when the signal is no longer being driven by current operations. THE HALT STATE The TMS 9900 IDLE I/O instruction generates a Halt State. When this instruction is executed. the CPU suspends all program ~ion and internal operations. You must terminate the Idle condition with an interrupt request or a low LOAD or RESET input. (['(5Ai) and RESET are treated as interrupts as we will describe soon.) The TMS 9900 CPU does not relinquish the System Bus while halted. That is to say. after an IDLE instruction has been executed. no System Bus lines are floated. 3-25 The IDLE instruction is usually executed when program logic requires that the CPU wait for an interrupt. or when exter- nal logic is computing a real-time interval - which will be terminated with an interrupt request. You can, if you wish, initiate a DMA transfer by executing an IDLE instruction. In order to do this, you must create a HOLD request from the Address Bus output characteristic of the IDLE instruction's execution. This may be illustrated as follows: A14 A13 A12 -..- A14 (MSB) ~13 A12 :: CRUCLK CRUCLK C) + 5V - .~ :~ I PRE "-- D Q ~ ---0 - "~ i'""\ CK 7474 HOLD Q ~ erR t END HOLD HOLD ~ - HOLDA ------------------------------------------------------~~.. HOLDA As illustrated above, the combination of 010 on the three high-order Address Bus lines, along with the CRUCLK pulse, identifies the IDLE instruction. Since the process of floating the System Bus will remove the conditions which gener- ated a Hold request. these conditions are used to clock a flip-flop. Thus, external logic which receives the Hold acknowledge signal and takes control of the System Bus must subsequently reset the Hold request flip-flop in order to remove the Hold condition. That is to say, program logic can begin a Hold state within a Halt state, but it cannot end this combination. Two steps are needed to terminate a Hold within a Halt. The Hold request must be removed, then an interrupt request must follow to terminate the Halt. TMS 9900 INTERRUPT PROCESSING LOGIC The TMS 9900 has complex and capable interrupt processing logic. Sixteen levels of external interrupt are available. Sixteen software interrupts are also available. Fifteen of the sixteen external interrupts are maskable; the nonmaskable interrupt has highest priority and is the system Reset interrupt. There is, in addition, a non-maskable Load interrupt. External interrupts may be summarized as follows: Lc5AD RESET Priority Priority 0 } Non-maskable, Equal Highest Priority Interrupts Priority 2 Priority 3 Priority 4 Priority 5 Maskable Priority 6 Levels of Priority 7 External Interrupt Priority 8 Priority 9 Priority 10 Priority 11 Priority 12 Priority 13 Priority 14 Priority 15 Lowest Priority Interrupt 3-26 External logic identifies the priority of its interrupt request via the ICO. IC1. IC2. and IC3 inputs. as follows: ICO IC1 IC2 IC3 Priority o 0 o 0 Should not be input by external logic - highest external o 0 o 1 1 o 0 1 0 2 o 0 1 1 3 o 1 o 0 4 o 1 o 1 5 o 1 1 0 6 o 1 1 1 7 1 0 o 0 8 1 0 o 1 9 1 0 1 0 10 1 0 1 1 11 1 1 o 0 12 1 1 o 1 13 1 1 1 0 14 1 1 1 1 15 lowest external Software interrupts are executed via the XOP instruction. There are, in addition, instructions that parallel the RESET and LOAD interrupts. We will describe these instructions in due course. Each one of the external interrupts has two dedicated memory words via which vectoring is TMS 9900 enabled following an interrupt acknowledge. Figure 3-11 illustrates the memory map asso- INTERRUPT ciated with interrupt vectoring. The memory addresses in Figure 3-11 are byte addresses as VECTOR MAP seen by the programmer. Remember. the low-order bit of the address shown in Figure 3-11 is not output on the Address Bus; therefore. you must divide the memory addresses shown in Figure 3-11 by 2 in order to generate the address which will be seen by external memory. The memory words dedicated to interrupt vectoring. as illustrated in Figure 3-11 . can be read-only memory. read/write memory, or any combination of the two. Obviously, read-only memory will be used in applications that have dedicated interrupt service routines for specific interrupt requests. Read/write memory might be used in minicom- puter-type applications where the interrupt response will depend on the application being serviced. Interrupt masking and priorities apply only to external interrupt requests. Interrupt masking priorities cannot be applied to software interrupts (the XOP instruction). Since program logic must generate the software interrupt pro- gram logic can equally be relied on to know which software interrupt is to be executed, and whether the software inter- rupt is allowed by current program logic. That is to say, from the programmer's viewpoint a software interrupt is simply the consequence of an XOP instruction's execution; you, as a programmer. can include an XOP instruction anywhere in a program. within or outside an interrupt service routine. XOP instructions might be used in response to error condi- tions, or to call any frequently used subroutines. Let us begin by looking at the way in which external interrupts are processed. Any external device wishing to request an interrupt must pull the INTREQ input low while simultaneously plac- ing a 4-bit code at the ICO - IC3 inputs. The CPU will acknowledge the interrupt, provided that its priority, as identified by the ICO - IC3 inputs, is enabled. The interrupt will be acknowledged at the conclusion of the cur- rently executing instruction. The BLWP and XOP instructions are exceptions; for the integrity of program logic, they demand that the next sequential instruction be executed. Therefore, ifan interrupt request occurs while either of these two instructions is being executed, the interrupt will not be acknowledged until this instruction and the next in- struction have been executed. 3-27 MEMORY MEMORY WORD CONTENT ADDRESS,. AREA DEFlNmoN 0000 WP LEVEL 0 INTERRUPT 0002 PC LEVEL 0 INTERRUPT 0004 WP LEVEL 1 INTERRUPT 0006 PC LEVE~ 1 INTERRUPT NTERRUPT VECTORS 003C WP LEVEL 15 INTERRUPT 003E PC LEVEL 15 INTERRUPT 0040 WP XOPO 0042 PC XOP 0 XOP SOFTWARE TRAP VECTORS I 007C WP XOP 15 007E PC XOP 15 0080 ·•• GENERAL MEMORY AREA MAY BE ANY GENERAL MEMORY FOR COMBINATION OF ~.DATA.AND PROGRAM SPACE WORKSPACE REGISTERS OR WORKSPACE •• • FFFC WP LOAD FUNCTION FFFE PC LOAD FUNCTION Figure 3-11. TMS 9900 Memory Map When an Interrupt Is acknowledged, the following machine cycles are executed: Cycle Type Figure Function 1 ALU 3-3 2 MEMORY READ 3-4 Move new WP register contents from vector word to temporary storage 3 ALU 3-3 4 MEMORY WRITE 3-5 Store status in new R15 5 ALU 3-3 Store ICO - IC3 levels in four low-order Status bits 6 MEMORY WRITE 3-5 Store incremented PC in new R14 7 ALU 3-3 8 MEMORY WRITE 3-5 Store old WP register contents in new R13 9 ALU 3-3 10 MEMORY READ 3-4 Fetch new PC contents from vector word 11 ALU 3-3 Fetch new WP contents from temporary storage Vector words are illustrated in Figure 3-11. 3-28 At the conclusion of the interrupt acknowledge sequence listed above. the priority of the TMS 9900 acknowledged interrupt request. less one. is recorded in the four low-order Status register bits. NESTED Thus. subsequent interrupt requests will be acknowledged only if their priority is higher than that INTERRUPT of the interrupt being serviced. That is to say. whenever an interrupt request occurs. CPU logic PRIORITIES compares the levels input at ICO - IC3 with the levels present in the four low-order Status register bits. If ICO - IC3 is not greater than the mask. then the interrupt request will be acknowledged. If ICO - IC3 is higher. then the interrupt request will not be acknowledged. Thus. In the normal course of events. TMS 9900 interrupt priority logic disables all interrupts of equal or lower priority than an acknowledged interrupt. while leaving high- er priority interrupts enabled. Priorities are maintained for the duration of the interru~t service routine. This is il- lustrated in the following figure. which you should read in the sequence ® -® -© -@- ® -® -® : o Int."upts whh priorities 5,8 and 11~~ / - - , 5 ~ 11 occur simultaneously / \1(3\ ® ., Interru!'t ~Ith, / // \\:::Y Interrupt 7. having highest priority of three pending PriOrity 5 , / interrupts (7,8 and 11) will acknowledged / immediately be acknowledged Main Program @ Interrupt with priority 7 occurs and is denied Interrupt service routine 5 completes execution @ I nterrupt service routine 2 executes The interrupt priority arbitration logic of the TMS 9900 is exceptional among microcomputers. Most microcomputers arbitrate priorities at the instant interrupts are being acknowledged. and once an interrupt has been acknowledged. all interrupts are disabled. That is to say. interrupt priorities apply only during the acknowledge process. In contrast. the TMS 9900 maintains interrupt priorities for the duration of the interrupt service routine. as illustrated above. The net effect of the interrupt response steps illustrated above is to perform a context switch while disabling all inter- rupts that have the same priority as the acknowledged interrupt. or that have a lower priority.' There are some very important and nonobvious advantages to initiating an interrupt service routine with a con- text switch. Since the 16 new memory locations that will be used as general purpose registers may lie anywhere in read/write memory. you can store parameters that will be used by the interrupt service routine. in advance of the interrupt. in those memory locations that are ultimately to serve as general purpose registers for the duration of the interrupt service routine. You can. if you wish. modify the interrupt priority scheme that will control nested interrupts. As we have already stated. if you do nothing about interrupt priorities. then any interrupt service routine may be interrupted by a higher priority external interrupt. but not by an external interrupt that has the same priority or a lower priority. If you wish to eliminate nested interrupts entirely. then the first instruction executed within an interrupt service routine must be an LlMI 0 instruction (Load Interrupt Mask Immediate). which clears the four low-order Status register bits. thus disabling all maskable interrupts. A RESET or LOAD interrupt - or a level a external interrupt request - will still be acknowledged; these should be alarm conditions and not part of the normal interrupt logiC of any microcomputer. You can execute variations of the LlMI instruction to increase or decrease the levels of priority that will be masked for the duration of any interrupt service routine (or for that matter. any subsequent instruction within the interrupt service routine) can load appropriate data into the four low-order bits of the Status register. thus changing the priority level at which all subsequent interrupt requests will be disabled. 3-29 All interrupt service routines should end with an RTWP (Return Workspace Pointer) instruction. The RTWP in- struction performs a reverse context switch. which puts the central processing unit back to the logical environment which was interrupted. Observe that since the Status register is also saved during a forward context switch. the return instruction will restore whatever level of interrupt priorities existed at the instant the interrupt was acknowledged. You can. of course. modify the contents of General Purpose Registers R13. R14. and R15 in the course of an interrupt ser- vice routine's execution. This allows program logic to alter the conditions that will be restored when the return instruc- tion executes a reverse context switch. The TMS 9901 PSI, which we describe later in this chapter, provides multiple interrupt handling for TMS 9900 series CPUs. If your system does not include a TMS 9901, then external hardware required to support multiple interrupts in a TMS 9900 microcomputer system will not be as straightforward as the software response. First of all. we must cope with the fact that if more than one interrupt request occurs TMS 9900 simultaneously. then there will be competition on the INTREO input. but there will also be MULTIPLE competition at the four priority inputs. ICO - IC3. Resolving competition on the·INTREQ input is INTERRUPT no problem; you can wire-OR interrupt requests from many devices to create the CPU input. HARDWARE But your external logic must make sure that only the highest priority combination of ICO - IC3 CONSIDERATIONS appears at the TMS 9900 inputs. One method of doing this is to use latched decoders that create a 4-bit output corresponding to the highest level input. provided that the decoder is enabled by a latching sig- nal. This may be illustrated functionally as follows: ( +5V ~~ > - INTREQ - .... - I, *u i i i<1) *n ~) TMS 9900 -_ACO AC1 ENABLE - -::. .... if (HI GHEST PRIORITY) INT 1 -: - AC2 DECODER -_AC3 -= -- INT 15 (L OWEST PRIORITY) In the illustration above. 15 external interrupt requests are input to a decoder. These interrupt requests are high true. The 15 interrupt requests are buffered. inverted. and wire-ORed to create the master interrupt request INTREO. which is input to the CPU. This master interrupt request also enables the decoder. That is to say. when the enable input to the 3-30 decoder is high, the four outputs, ICO - IC3 will be low. When the enable input to the decoder is low, ICO - IC3 will out- put a 4-bit value as follows: o .... N (") 'It It) C"I (") 'It It) W ~ 00 m.... .... o .... C"I (") ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ U U U U z z z z z z z z z z z z z z z o 0 0 0 o 0 0 0 0 0 0 0 0 0 0 0 0 0 0 000 * * * * * * * * * * * * * * o 0 o o * * * * * * * * * * * * * o 0 o 0 * * * * * * * * * * * * o o 0 000 * * * * * * * * * * * o o o 0 0 0 * * * * * * * * * * o o o 0 000 * * * * * * * * * o o 0 0 0 0 0 T * * * * * * * * 000 o 0 0 0 000 * * * * * * * o 0 o 000 0 0 0 0 * * * * * * o o o 0 0 0 0 0 000 o o 0 ~ 0 * * * * * 0 0 0 0 0 0 o 0 o 0 0 0 0 0 0 0 000 * * * * * * * o 0 0 000 0 0 0 0 0 0 0 * * o 0 000 0 0 0 0 0 0 000 * 000 000 0 0 0 0 0 0 0 0 * REPRESENTS A "DON'T CARE" BIT If you do not use the TMS 9901, Texas Instruments suggests the following circuit to accomplish priority encoding: +5V u ~ ,.. GS EI -- ..L - ..- 7 ..... 6 ..... -- iNTi (HIGHEST A2 74148 (TIM 9907) -- Ioiio.. __ • • PRIORITY) A1 .... ~ • .: AO - EO , TMS ICO 9900 ) EI ~ GS IC1 ~ 7 "'" --- A2 - 74148 ~.- IC2 INT 15 (LOWEST " ~ AO PRIORITY) 3-31 External logic must maintain its interrupt request until it receives its own specific interrupt acknowledge. This need is obvious, since an interrupt request may be denied for a long time while higher priority interrupts are being ser- viced. The problem is that the TMS 9900 has no interrupt acknowledge signals. Interrupt acknowledge signals can be generated in one of two ways: 1) By using CRU bit instructions to set and reset external flip-flops that create interrupt acknowledge signals. 2) By decoding appropriate addresses on the Address Bus Figure 3-12 illustrates two possible configurations that will allow CRU bit set and reset instructions to gener- ate interrupt acknowledge signals. The logic in Figure 3-12A generates a short interrupt acknowledge pulse. CRUOUT becomes the input to a flip-flop which is decoded to generate CRU select signals. The CRU bit select and "M'E'M'E'N are gated to the flip-flop's Clear input. Therefore, when CRU bit "n" is selected, CLR is removed and CRUOUT can be clocked through. A set bit (SBO) instruction switches the flip-flop on. As soon as the flip-flop address is removed at the end of the CRU I/O machine cycle, the flip-flop is cleared, thus terminating the interrupt acknowledge pulse. The logic illustrated in Figure 3-12A requires that you execute an SBO instruction at the beginning of every interrupt service routine in order to generate an interrupt acknowledge. You could require every interrupt service routine to con- trol the length of the interrupt acknowledge pulse by executing an SBZ instruction to terminate the pulse. Figure 3-12B shows logic to implement this scheme. When the flip-flop is selected by the appropriate CRU address, CRUCLK will clock CRUOUT to INT ACK n. At other times, CRUCLK will merely clock the flip-flop's output through, thus making no change. In this way, only SBO and SBZ instructions which address INT ACK n can set or reset the flip-flop. Figure 3-13 illustrates generation of an interrupt acknowledge signal by identifying specific addresses on the Address Bus. Following any interrupt acknowledge, specific memory locations will be accessed, as identified in Figure 3-11 ,in order to fetch the new values for the Program Counter and WP register. Figure 3-13 shows a very simple scheme whereby Address Bus lines are combined with MEMEN low to generate high pulses for the duration of a valid address. That is to say, the interrupt acknowledge signal will last for one machine cycle - the time that the valid ad- dress exists on the Address Bus. External logic which requested an interrupt removes its interrupt request and priority signals upon receiving an interrupt acknowledge. 3-32 A14 .. : A14 (MSB) A13 .. A13 A12 A11 - A12 A~1 AD 'M"EMEN T - ;;., AO (LSB) i\.1'EM'"Erij .... CRU ADDR · .... t 9 + 5V CRUBIT n SELECT .. ~ ~ ~ ADDRESS DECODE :: CRUOUT - D PRE 0 ..- INT ACK n CRUCLK . CK. 7474 Q CLR A) Logic to create a short I NT ACK n pulse bJ n SE LECT - - - 4..... -a r---------t-~ D Ot-....- _.. INT ACK n r-------~~>CK CRUOUT +5V. CRUCLK B) Logic to have a programmed INT ACK n pulse length' Figure 3-12. A TMS 9900 Interrupt Acknowledge Pulse Generated Using an SSO Instruction A14 ···· ·•- A14 A5 •·- A5 l- A4 A1 MEi\iiEN · • A1 .- A4 .. i\.1'EM'"Erij I, .... r .............. INTERRUPT n SELECT LOGIC .00000000 Y INTERRUPT ADDRESS In SELECT !...J -.. INT ACK n Figure 3-13. TMS 9900 Interrupt Acknowledge Generated by Decoding Valid Addresses 3-33 THE TMS 9900 RESET You reset the 9900 microcomputer system by inputting a low RESET signal. This signal must remain low for at least 3 clock periods. When the low RESET signal is removed, the following machine cycle sequence is ex- ecuted: Cycle Type Figure Function 1 ALU 3-3 Prepare for Level a interrupt 2 ALU 3-3 3 ALU 3-3 4 MEMORY READ 3-4 Fetch new WP register contents from memory word 000016 to temporary storage 5 ALU 3-3 6 MEMORY WRITE 3-5 Store Status register contents in new R15 7 ALU 3-3 8 MEMORY WRITE 3-5 Store Program Counter contents in new R14 9 ALU 3-3 10 MEMORY WRITE 3-5 Store old WP register contents in new R13 11 ALU 3-3 12 MEMORY READ 3-4 Fetch new Program Counter contents from memory word 000'16 13 ALU 3-3 Load WP register from temporary storage Thus. program execution begins with a program whose starting address is stored in memory word 1. The starting ad- dress for the 16 general purpose registers is stored in memory word O. The TMS 9900 has a Reset instruction (RSET). In reality. this instruction resets only the interrupt mask in the Status register; it also outputs a code on the Address Bus. as identified in Table 3-1 and illustrated in Figure 3-8. TM 990 minicomputer systems use this signal to generate a program-initiated Reset. If you are designing your own TMS 9900- based microcomputer system. you are free to use the RSET instruction in any way. THE TMS 9900 LOAD OPERATION The LOAD input to the TMS 9900 is a non-maskable, highest priority interrupt. Load must be input low for at least one instruction's duration. Since the length of an instruction can vary, you must use the IAQ signal to con- trol the LOAD input pulse width. Texas Instruments' literature recommends the following circuit: +5V C) .. ~ PRE PRE ~ 0 0 "'- D Q t-- lAO . CK 7474 ~ ~CK 7474 TMS 9900 CLR Q - CLR a J I EXTERNAL LOAD __ i:O'AD - 3-34 The CPU checks LOAD at the end of each instruction's execution. After a valid LOAD input has been acknowledged. the following machine cycle sequence is executed: Cycle Type Figure Function 1 ALU 3-3 2 MEMORY READ 3-4 Input new WP register contents from memory word 7FFE 16 to temporary storage 3 ALU 3-3 4 MEMORY WRITE 3-5 Store in new R15 5 ALU 3-3 6 MEMORY WRITE 3-5 Store incremented Program Counter contents in new R14 7 ALU 3-3 8 MEMORY WRITE 3-5 Store old WP register contents in new R13 9 ALU 3-3 10 MEMORY READ 3-4 Input new Program Counter contents from word 7FFF16 11 ALU 3-3 Load WP register from temporary storage There are two differences between Reset and Load. First. the RESET input provides a true hardware reset. syn- chronizing internal operations. as well as a level 0 interrupt; LOAD provides only a non-maskable interrupt. Sec- ond. the Reset vector in bytes 0 through 3. while the Load vector is in bytes FFFC16 through FFFF 16. In TM 990 minicomputer systems. the LREX instruction is frequently used as a software load. Output due to LREX is identified in Table 3-1 and Figure 3-8. In a TMS 9900 microcomputer system. you can use the LREX signal in any way. THE TMS 9900 INSTRUCTION SET The TMS 9900 instruction set is extremely powerful when compared to any 16-bit microprocessor described in this book. When you consider that the TMS 9900 was first manufactured in 1976•. the power of this instruction set becomes more impressive. With regard to instructions described in Table 3-2 • some explanations are required. The ABS instruction converts the contents of a memory location to their absolute value. That is to say. this instruction assumes that the memory location contains a signed binary number. If the number is positive. nothing happens. If the number is negative. the twos complement of the number is taken. A number of instructions act on specific bits within source and destination memory words. These include the SOC. SOCB. SZC. SZCB. COCo and CZC instructions. In the OPERATION PERFORMED column of Table 3-2. the word "corresponding" means that the source word bits are affected only if selected by the destination word bit pattern. For example. the SOC instruction will be interpreted as follows: Source: Destination: After SOC: Here are the new destina- tion contents. This is equivalent to an OR operation. The SOCB instruction is identical to the SOC instruction. except that only one byte is affected. This may be any memo- ry byte or the high-order byte of a general purpose register. TheSZC instruction may be illustrated as follows: Source: Destination: After SZC: 3-35 This is equivalent to complementing the source operand and then ANDing the two operands. The SZCB instruction is identical to the SZC instruction. except that only one byte is affected. The cac instruction compares Source Register 1 bits with general purpose register bits that happen to be in the same bit positions. If all corresponding general purpose register bits are also 1. then the Equal status is set. Matches are not significant in bit positions if the source register bit is O. The CZC instruction operates in the same fashion as the cac instruction. except that those source memory word bits that are 0 become significant. That is to say. if every source memory worcf 0 bit has a corresponding Workspace register 0 bit. then the Equal status is set. Matches are not significant in bit positions if the source register bit is 1. The BLWP instruction is a subroutine call accompanied by a context switch. The operand memory address identifies the first of two memory words within which the new WP register and Program Counter contents will be stored. The BLWP instruction is remarkably powerful. The subroutine call and passing parameters to the subroutine become a single operation. The memory words that are to serve as subroutine general purpose registers can be used as general data memory locations prior to the subroutine call. Thus. the subroutine finds its registers pre-loaded with data when it starts executing. The RTWP instruction should be used to return from a subroutine that is called by the BLWP instruction. One-bit position arithmetic shifts may be illustrated as follows: Right Shift Left Shift 1011010110100110 1011010110100110 ~"""""""~ 1 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 Lost """""""" Lost 0 1 1 0 1 0 1 1 0 1 0 0 110 O~ Inserted A one-bit-position logical right shift may be illustrated as follows: 1011010110100110 ,~"""""'", o 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 Lost I nserted '!I A one-bit right rotate (Shift Right Circular) may be illustrated as follows: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 You can specify any number of bits. from 1 to 15. as the number of bit positions for any TMS 9900 shift or rotate in- struction. If you specify 0 for the bit count. then the actual bit count is taken from the four low-order bits of general pur- pose Register RO. If these four low-order bits are 0000. then the bit count is assumed to be 16. 3-36 The following symbols are used in Table 3-2: AG Arithmetic Greater Than status C Carry status CNT 4-bit count field CRUA CRU base address from R12 d Destination memory word. There are five possible options for the destination memory word. They are represented by these combinations of addressing modes: Workspace Register D Implied through Workspace Register D Direct address Direct. indexed address Implied through Workspace Register D. auto-increment Workspace Register D DATA4 4-bit data unit DATA16 16-bit data unit DISP 8-bit signed displacement EQ Equal status bit of Status register G Both the AG and LG statuses LG Logical Greater Than status OP Odd Parity status OV Overflow status PC Program Counter R Any of the 16 Workspace registers Rxx Workspace register. For example. R15 is Workspace Register 15 S Source memory location. Addressing options identical to destination memory location ST Status register WP Workspace Pointer register x Bits y through z of the quantity x. For example. ([ S) * [R)) < 31.16> represents the high-order word of the product of the contents of the Source Register S and the Workspace Register R. [ ) Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. Mu Itiplication / Division A Logical AND V Logical OR -¥- Logical Exclusive-OR Data is transferred in the direction of the arrow Under the heading of STATUSES in Table 3 -2. an X indicates statuses which are modified in the course of the instruc- tion's execution. If there is no X. it means that the status maintains the value it had before the instruction was ex- ecuted. Byte-operand instructions will affect half of a 16-bit memory word. If the word is accessed as a general purpose register, then only the high-order byte will be affected. If the word is accessed as non-register memory, then the byte affected is determined by the least significant bit of the 16-bit address: 0 selects the high-order byte; 1 selects the low-order byte. 3-37 Table 3-2. TMS 9900 Instruction Set Summary STATUSES TYPE MNEMONIC OPERAND(S) BYTES G EQ C OV OP OPERATION PERFORMED I LDCR S,CNT 2 X X X* [CRUA]-[ S ] Transfer the specified number of bits from source memory word to the CRU. STCR O,CNT 2 X X X* [D ] - [ CRUA] Transfer the specified number of bits from the CRU to destination memory word. g I SBO DISP 2 [CRUA + OISP]- 1 Set bit in CRU to 1. ! SBZ DISP 2 [CRUA + DISP] - 0 i Set bit in CRU to O. I TB OISP 2 X If [CRUA+DISP] =0, then [EQ]=l;orelse [EQ]=O Test bit in CRU. i »(J w MOV S,D 2 X X [O]-[S] I a:a:z 16-bit move contents of source memory word to destination memory word. i COw ~~a: MOVB S,O 2 X X X [D]-[S] I -ww g:~~ a-bit move contents of source memory byte to destination memory byte. A S,D 2 X X X X [D]-[S]+ [D] 16-bit add contents of source memory word to contents of destination memory word. AB S,O 2 X X X X X [O]-[S]+ [0] I a-bit add contents of source memory byte to contents of destination memory byte. Co) iii ~ S S,D 2 X X X X [D]-[D]- [S] fA 00 C a: 16-bit subtract contents of source memory from contents of destination memory word. I w A- X X X X [D]-[D]- [S] 0 SB S,O 2 X > a-bit subtract contents of source memory byte from contents of destination memory byte. a: Set status flags based on 16-bit comparison of source and destination memory word contents. 0 C S,D 2 X X ::E CB S,O 2 X X X Set status flags based on a-bit comparison of source memory byte contents and destination I w ~ memory byte contents. w XOR S,R 2 X X [R]-[S]¥ [R] (J Z Exclusive-OR contents of source memory word with Workspace Register R. w a: MPY S,R 2 [R]-[([S]* [R])<31,16 >] w II. [R+ 1l-[([S]*[R])<15,O>] w a: Multiply the contents of source memory word by contents of Workspace Register R. Store most > a: significant word of result in R. Store least significant word of result in Workspace Register R + 1. 0 ~ DIV S,R 2 X [R]-([R,R + 11/ [S]Xquotient) w [R + 11-( [R,R + 111 [S]Xremainder) ::E > Divide the 32-bit quantity represented by R (high-order word) concatenated with R + 1 (low a: order) by the contents of the source memory word. Store the quotient in R, the remainder in C 0 R + 1 and set overflow if quotient will exceed 16 bits. z 0 INC 0 2 X X X X [O]-[D]+ 1 (J w Increment contents of memory word by 1. (/J INCT 0 2 X X X X [0]-[0]+2 Increment contents of memory word by 2. DEC 0 2 X X X X [0]-[0]-1 Decrement contents of memory word by 1. *OP status is affected only if between 1 and a bits are transferred. Table 3-2. TMS 9900 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED G EQ C OV OP DECT D 2 X X X X [D]-[D]-2 Decrement contents of memory word by 2. CLR D 2 [D]-OOOO is 1&1 Clear the ~~stination memory word. =:) Z SETO D 2 [D]-FFFF i= Z Set all bii~ of memory word. 0 INV D 2 X X [D]-(O] 9 Ones complement the destination memory word. W ~ NEG D 2 X X X X ,[D]-['D.J+l c( a: Twos complement the destination memory word. 1&1 A. ABS D X X [D]-I [D]I 0 2 X X > Take the absolute (unsigned) value of the destination memory word's contents. a: 0 SWPB D 2 [D<15,8>]--[0<7,O>] ~ 1&1 Exchange the high and low bytes of the memory word. - ~ 1&1 SOC S,D 2 X X If [S]=l,then [D]-l Set the bits in the destination memory word that correspond to ls in the source memory word Col CJ Z W co 1&1 a: for all 16 bits. 1&1 saCB S,O 2 X X X If [S]="l, then [O]-l u.. 1&1 Set the bits in the destination memory word that correspond to ls in the source memory word a: > a: for 8 bits. 0 SZC S,D 2 X X If [S]=l, then [D]-P ~ Clear the bits in the destination memory word that correspond to ls in the source memory word 1&1 ~ for all 16 bits. > a: SZCB S,D 2 X X X If [S]=l, then [D]-O c( Q Clear the bits in the destination memory word that correspond to ls in the source memory word Z for 8 bits. 0 U COC S,R X If for all [S]=l, [R]=l,then [EQ]-l 1&1 CI) If the bits in the Workspace Register R that correspond to the set bits in the source memory word are all ls, set the EQUAL status. CZC S,R 2 X If for all [S]=l, [R]=O, then [EO]=l If the bits in the Workspace Register ~t correspond to set bits in the source memory word are all Os, set the EQUAL status. 1&1 ~ c( LI R,DATA16 4 X X [R]-DATA16 is Load immediate to Workspace Register R. 1&1 :::E LWPI DATA 16 4 [WR]-DATA16 ~ Load immediate to Workspace Pointer Register, WR. -~-- - -- - Table 3-2. TMS 9900 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED G EO C OV OP w CI R,DATA16 4 X X Set the status flags based on 16-bit comparison between contents of Workspace Register Rand l- e( II: immediate data. w AI X [R]-[R] + DATA 16 11- R,DATA16 4 X X X 0 Add immediate to Workspace Register R contents. w I- ANDI R.DATA 16 4 X X [R]+-[R] A DATA 16 e( 0w AND immediate with Workspace Register R contents. ~ ORI R,DATA16 4 X X [R]+-[ R] V DATA 16 ;:! OR immediate with Workspace Register R contents. B S 2 [PC]+-[S] 11- ~ Branch unconditional to address in Source memory word. .., ::;) JMP D(SP 2 [PC]+-[ PC] + DISP Branch unconditional. BL S 2 [R111-[PC]+1 [PC]-[S] Branch to subroutine at address in source memory word. 2 BLWP S 2 [R13]-[WP] II: W::;) [R14]+-[ PC] 21- Col ~~ [R15]+-[ST] ~ ::;)Q [WP]+-[S] ~2 [PC]-[S+2] 1IIe( ::;) 0 ...... Branch to subroutine whose address is stored in source memory word + 1. Perform context e( (,) switch to RD address contained in source memory word. RTWP 2 X X X X X [WP]-[R13] [PC]+-[R14] [ST]-[R15] Perform a backward context switch. JEQ DISP 2 If [EO]=1; then [PC]+-[PC] +DISP Branch if equal. JNE DISP 2 If [EO]=O; then [PC]-[PC] +DISP Branch if not equal. 2 0 JGT DISP 2 If [AG]=1; then [PC]-[PC] + DISP ~ Branch on arithmetic greater than. is 2 JlT DISP 2 If [AG]=O and [EO]=O; then [PC]+-[PC] +DISP 0 Branch on arithmetic less than. (,) 2 JHE DISP 2 If [lG]=1 or [EO]=1; then [PC]+-[PC] +DISP 0 :z: Branch on logical greater than or equal. (,) If [LG]=1 and [EO]=O; then [PC]+-[PC]+DISP JH DISP 2 2 ~ Branch on logical greater than. III Jl DISP 2 If [lG]=O and [EO]=O; then [PC]-[PC] +DISP Branch on logical less than. JLE DISP 2 If [EO]=1 or [LG]=O; then [PC]+-[PC]+DISP Branch on less than or equal. Table 3-2. TMS 9900 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED G EQ C OV OP JNC DISP 2 If [C]=O; then [PC]-[PC]+DISP Branch on carry reset. ZZe OOw JNO DISP 2 If [OV]=O;then [PC]-[PC]+DISP ~Ei Branch on overflow reset. z°j:: JOC DISP 2 If [C]=l;then [PC]-[PC]+DISP ~ZZ 00 Branch on carry set. m U !:! JOP DISP 2 If [OP]=l;then [PC]-[PC]+DISP Branch on odd parity set. a: W SLA R,CNT 2 X X X X Arithmetic shift the Workspace Register R left the specified number of bits. W l- I- 0( SRA R,CNT 2 X X X Arithmetic shift the Workspace Register R right the specified number of bits. ~ ~ SRL R,CNT 2 X X X Logical shift the Workspace Register R right the specified number of bits. ~ 0 SRC R,CNT 2 X X X Rotate the Workspace Register R right the specified number of bits. STST R 2 [R]-[ST] . Store the Status register into Workspace Register R. STWP R 2 [RJ-[WP] . Store the Workspace Pointer into Workspace Register R. 01- DATA4 4 [SR<3,O>] -oATA4 ZA. L1MI w 0(;:) Load immediate data into the interrupt mask bits of the Status register. ~ 0a: ;:)IZ: XOP S,R 2 X [R13]-[WP] I-w 0(1- [R14]-[PC] I-Z 0- [R15]-[ST] [Rll]-[S] [WP]-[40,. +(4*[R))) [PC]-[41,. +(4* [R))) Perform a context switch. This is the software interrupt. W S 2 Execute the instruction represented by the data in the source location. If that instruction has im- I- X ;:) U mediate operand words, those words must be located directly after the X instruction. The instruc- W )( tion [S] will affect the status flags but its fetch will not cause IAQ to go high. W IDLE 2 CPU enters Halt state. CPU clears interrupt mask and outputs 001 on three high-order Address Bus lines. RSET 011 on three high-order Address Bus lines. > CKOF 110 out on three high-order Address Bus lines. :le o(w 101 out on three high-order Address Bus lines. CKON ZZ a:jL LREX 111 out on three high-order Address Bus lines. WW t<0 W THE BENCHMARK PROGRAM For the TMS 9900, our benchmark program may be illustrated as follows: BLWP MOVE CONTEXT SWITCH TO APPROPRIATE REGISTERS LOOP MOV @IOBUF(R11.*R2+ LOAD NEXT INPUT WORD IN NEXT TABLE WORD DEC R1 DECREMENT COUNT JNE LOOP RETURN FOR MORE RTWP RETURN FROM SUBROUTINE Let us look at how our benchmark program can collapse to just five instructions. We assume that there is some set of 16 General Purpose registers within which we store the word count and the ad- dress of the first free word in TABLE. We illustrated this idea when describing context switching earlier in the chapter. Observe that Register R1 contains the word count and is therefore used as an Index register. while Register R2 ad- dresses the first free word in TABLE. Note that the contents of Register R2 are incremented automatically when the next byte is loaded into the table. The BLWP instruction will branch to the program which performs the required data move. but simultaneously it loads the Workspace register with the appropriate initial address. We do not need to load any initial addresses or word counts into registers. since we have adopted the memory space where this data is stored to serve as our General Pur- pose registers. After the move has been completed. we do not have to update any counters or pointers. because they were updated "in situ". All we have to do upon completing the move is store the contents of the current General Purpose Registers 13 and 14 to the Workspace register and Program Counter. The following notation is used in Table 3-3: aa Two bits determining the addressing mode for the destination memory word bb Two bits determining the addressing mode for the source memory word cccccccc 8-bit Signed address displacement dddd Four bits used with aa to determine the destination memory word eeee 4-bit count field rrrr Four bits choosing the Workspace register ssss Four bits used with bb to determine the source memory word xx 16 bits of immediate data If either aa or bb is 1°2. and the corresponding register specified is 02. then an additional 16-bit direct memory address word. used in computing the effective memory address of the operand. will follow the instruction. If aa and bb are 1°2. and both corresponding register specifications are 0. then two additional 16-bit direct memory ad- dreSSing words will follow the instruction: the first will be used in computing the source address; the second will be used in computing the destination address. 3-42 Table 3-3. TMS 9900 Instruction Set Object Codes CLOCK CLOCK INSTRUCTION OBJECT CODE BYTES INSTRUCTION OBJECT CODE BYTES PERIODS· PERIODS· A S,D 1010aaddddbbssss 2 14-30 (1) JOP DISP 000lll00cccccccc 2 8/10(15) AB S,D 1011aaddddbbssss 2 14-30 (1) LDCR S,CNT 00ll00eeeebbssss 2 22-52 (11) ABS 0 0000011101aadddd 2 12-20 (6) LI R,DATA16 000000100000mr 4 12 (19) AI R,DATA16 00000o 1000 lOrrrr 4 14(17) XX XX LlMI DATA4 0000001100000000 4 16(21) ANDI R,DATA16 00000o 100 100rrrr 4 14(17) XX XX LREX 0000001111100000 2 6(14) B S 00000 1000 1bbssss 2 8-16 (7) LWPI DATA 16 0000001011100000 4 10(20) BL S 0000011010bbssss 2 12-20 (9) XX BLWP S 00000 1OOOObbssss 2 26-34 (10) MOV S,D l100aaddddbbssss 2 14-30 (1) C S,D l000aaddddbbssss 2 14-30 (1) MOVB S,D 1101aaddddbbssss 2 14-30 (1) CB S,D 100 1aaddddbbssss 2 14-30 (1) MPY S,R 00lllOrmbbssss 2 52-60 (2) CI S,D 000000101000mr 4 14 (18) NEG 0 0000010100aadddd 2 12-20 (5) XX ORI R,DATA16 000000100110mr 14(17) CKON 0000001111000000 2 6 (14) XX CKOF 0000001110100000 2 6(14) RSET 0000001101100000 2 6 (14) CLR 0 00000l00llaadddd 2 10-18 (5) RlWP 0000001110000000 2 14 (8) COC S,R 00 1OOOrmbbssss 2 10-18 (1) 5 5,0 0110aaddddbbssss 2 14-30(1) CZC S,R 00l00lrrrrbbssss 2 14-22 (1l SB S,D 0111 aaddddbbssss 2 14-30 (1) DEC 0 00000ll000aadddd 2 14-22 (5) SBO DISP 00011101cccccccc 2 12 (13) DECT 0 00000ll00laadddd 2 10-18 (5) SBZ DISP 00011110cccccccc 2 12(13) DIV S,R 00 1111 rrrrbbssss 2 10-18 (3) SETO 0 00000lll00aadddd 2 10-18 (5) IDLE 0000001101000000 2 6 (14) SLA R,CNT 0000 10 1Oeeeerrrr 2 14-52 (16) INC 0 0000010110aadddd 16-124 (5) SOC S,D l110aaddddbbssss 2 14-30(1) INCT 0 0000010111 aadddd 2 10-18 (5) 50CB S,D 1111 aaddddbbssss 2 14-30 (1) INV 0 0000010101 aadddd 2 10-18 (5) SRA R,CNT 00001000eeeerrrr 2 14-52 (16) JEQ DISP 00010011cccccccc 2 10-18 (15) SRC R,CNT 00001011eeeemr 2 14-52 (16) JGT DISP 00010101cccccccc 2 8/10 (15) SRL R,CNT 0000100 leeeemr 2 14-52 (16) JH DISP 00011011cccccccc 2 8/10 (15) STCR D,CNT 001101eeeeaadddd 2 42-60 (12) JHE DISP 00010100cccccccc 2 8/10 (15) STST R 000000101100mr 2 8(23) JL DISP 000 11010cccccccc 2 8/10 (15) STWP R 000000101010mr 2 8 (22) JLE DISP 000 100 1Occcccccc 2 8/10 (15) SWPB 0 0000011011aadddd 2 10-18 (23) JLT DISP 000l000lcccccccc 2 8/10 (15) SZC S,D ol00aaddddbbssss 2 14-30 (1) JMP DISP 000l0000cccccccc 2 10(15) SZCB 5,0 0101aaddddbbssss 2 14-30(1) JNC DISP 00010111cccccccc 2 8/10(15) TB DISP 00011111cccccccc 2 12(8) JNE DISP 00010110cccccccc 2 8/10(15) x 5 00000100 lObbssss 2 8-16 (7) JNO DISP 000ll00lcccccccc 2 8/10 (15) XOP S,R 00 10 11 rrrrbbssss 2 44-52 (4) JOC DISP 000ll000cccccccc 2 8/10 (15) XOR S,R 001010rmbbssss 2 14-22 (1) • The number in brackets identifies the instruction's machine cycle sequence, as defined in the preceding text. 3-43 The minimum and maximum number of clock periods for the execution of each instruction are shown in the CLOCK PERIODS column of Table 3-3. Remember that a machine cycle consists of two clock periods. The bracketed number after the number of clock periods identifies the machine cycle sequence. Machine cycle se- quences associated with each bracketed number are listed below. In the machine cycle list below, the follow- :ing abbreviations are used: R represents a memory read machine cycle as identified in Figure 3-4. A represents an ALU machine cycle as illustrated in Figure 3-3. W represents a memory write machine cycle as illustrated in Figure 3-5. C represents a CRU machine cycle as illustrated in Figures 3-6 and 3-7. A subscript associated with any machine cycle notation identifies that machine cycle repeated a number of times. Thus A3 is equivalent to -A-A-A-. M represents memory address computation machine cycles. Memory address computations were described earlier in this chapter. In su mmary. here are the various possibilities for M: Register addressing: R Implied memory addressing: R-A-R Implied memory addressing with auto-increment (for byte operand): R-A-W-R Implied memory addressing with auto-increment (for word operand): R-A-A-W-R Direct addressing: A-A-R-A-R Direct. indexed addressing: R-A-R-A-R (1) R-A-M-A-M-A-W (2) R-A-M-A-R-A18-W-A-W (3) R-A-M-A-R-A-A-R-Ax-W-A-W (51 ~ x :::; 35) (4) R-A-M-A3-R-A-W-A-W-A-W-A-W-A-R-A (5) R-A-M-A-W (6) R-A-M-A3-W-A (7) R-A-M-A ~) R-A-A-R-R-R-A (9) R-A-M-A-A-W (10) R-A-M-A-A-W-A-W-A-W-A-R-A (11) R-A-M-A4-R-A-C x-A (16 ~ x ~ 1) (12) R-A-M-A-R-A-A-Cx-Ay-W (16 ~ x ~ 1. 11 ~ y ~ 5) (13) R-A-A-R-A-C (14) R-A-A-C-A-A (15) R-Ax (x=3 or 4) (16) R-A-R-A-A-R-Ax-W-A (18 ~ x ~ 3) (17) R-A-A-R-R-A-W (18) R-A-R-A-R-A-A (19) R-A-A-R-A-W (20) R-A-A-R-A (21) R-A-A-R-A3 (22) R-A-A-W (23) R-A-M-A-R-A4-W THE TMS 9980A AND THE TMS 9981 MICROPROCESSORS The TMS 9980A and the TMS 9981 are low-cost variations of the TMS 9900. The principal differences be- tween the TMS 9900 series and TMS 9980 series microprocessors are summarized in Table 3-4. Differences between the TMS 9980A and the TMS 9981 are summarized in Table 3-5. This discussion of the TMS 9980 series microprocessors covers only differences as compared to the TMS 9900. The TMS 9980 series microprocessors are manufactured using N-channel silicon gate MOS technology. They are packaged as 40-pin DIPs. The TMS 9980A uses three power supplies: -5V. +5V. and +12V. The TMS 9981 useS two power supplies: +5V and +12V. Typically. a c'lock cycle time of 400 nanoseconds will be used with TMS 9980 series microprocessors. This generates instruction execution times ranging between 4 and 14 microseconds. 3-44 Figure 3-14 illustrates that part of general microcomputer system logic which is implemented by the TMS 9980 series microprocessors. This figure is identical to Figure 3~ 1. with the exception of clock logic. which is now shown present. Programmable registers are implemented and used in exactly the same way the TMS 9900 and TMS 9980 series microprocessors. Note. however. that the TMS 9980 series microprocessors address a 2048-bit CRU; therefore. bits 1 through 11 of Register R12 identify the origin of any CRU bit field. The TMS 9900 uses bits 1 through 12 of Register R12 to identify the CRU origin within a 4096-bit CRU. Table 3-4. A Summary of Differences Between the TMS 9900 and TMS 9980 Series Microprocessors FUNCTION TMS 9900 TMS 9980AITMS 9981 Addressable external memory 32.768 x 16-bit words 16.384 x 8-bit words DIP pins 64 40 Data Bus 16 bits 8 bits Address Bus 15 bits 13 bits External interrupt priorities 15 4 CRU field width 4096 bits 2048 bits Clock logic Four external inputs One external input or internal (TMS 9981 only) Table 3-5. A Summary of Differences Between the TMS 9980A and TMS 9981 Microprocessors FUNCTION TMS 9980A TMS 9981 Power supplies -5V. +5V. +12V +5V. +12V Clock logic One external input One external input or crystal only Pin incompatibility ties DO - 07. INTO - INT2. cJ>3 The TMS 9980 series microprocessors have a 14-line Address. Bus, used to address up to 16,384 bytes of memory. In contrast. the TMS 9900 addresses up to 32.768 16-bit words of external memory. Thus. TMS 9980 pro- grams address memory as bytes. while externally generated addresses also select bytes. The TMS 9900. by way of con- trast. addresses memory as bytes within the CPU. but as 16-bit words externally. The TMS 9980 series microprocessors use exactly the same memory and CRU addressing techniques as the TMS 9900. General-purpose registers are used in the same way. and instruction object codes are identical. The Status register and Status flags used by the TMS 9980 series microprocessors are identical to those which we have already described for the TMS 9900. TMS 9980 SERIES MICROPROCESSOR PINS AND SIGNALS Figure 3-15 illustrates pins and signals for the TMS 9980A. Figure 3-16 provides the same information for the TMS 9981. In both of these illustrations. signal names conform to Texas Instruments nomenclature. For the Data and Address Busses. our notation is given in brackets. Differences result from the fact that we number bits from right to left (0 being the low-order bit). while Texas Instruments numbers bits from left to right (0 becomes the high-order bit). TMS 9980AITMS 9981 pin-out differences are shaded in Figures 3-15 and 3-16 so that you can identify them quickly. For descriptions of the individual signals, refer to the earlier TMS 9900 discussion. 3-45 Accumulator Registens) Data Countens) Programmable I/O Ports Timers Memory Figure 3-14. Logic of the TMS 9980A and TMS 9981 Microprocessors 3-46 HOLD 1 40 HLDA 2 39 IAQ 3 38 (LSB) (AO) CRUOUT/A13 4 37 (A1) A12 5 36 (A2) A11 6 35 (A3) A10 7 34 (A4) A9 8 33 (LSB) (A5) A8 9 32 (A6) A7 10 TMS 31 (A7) A6 11 9980A 30 (A8) A5 12 29 (A9) A4 13 28 (A10) A3 14 27 (A11) A2 15 26 (MSB) (A12) A1 16 25 (MSB) (A13) AO 17 24 DBIN 18 23 CRUIN 19 22 (+5V) VCC 20 21 Pin Name Description Type AO-A13 Address Bus Tristate, output 00-07 Data Bus Tristate, bidirectional CKIN Clock signal in Input cJ>3 Synchronizing clock Output Memory Enable Tristate, qutput IAQ I nstruction Fetch Output DBIN Data Bus in Tristate, output WE Write Enable Tristate, output READY Memory Ready Input WAIT Wait State indicator Output CRUCLK I/O clock Output CRUOUT Serial I/O out Output CRUIN Serial I/O in Input INTO, INT1, INT2 I nterrupt request and priority Input HOLD DMA request Input HOLDA Hold acknowledge Output Power and Ground reference Figure 3-15. TMS 9980A Signals and Pin Assignments 3-47 HOLD-~" 1 HLDA~---I 2 IAQ .....1----1 3 (LSB) (AO) CRUOUT/A13~~--I 4 (A1) A12 ~---I 5 (A2) A 11 ....1----1 6 (A3) A10 ....- - - 1 7 (A4) A9 .....1----I 8 33 (A5) A8 ....- - - 1 9 32 (LSB) ( A6) A 7 .....'""----1 10 TMS 31 (A7) A6 ~I----I 11 9981 30 (A8) A5 ....-----1 12 29 (A9) A4 ....- - f 13 28 (A 1 0) A3 ....1----1 14 27 (A11) A2 ....1----4 15 26 (A12) A1 ....1----1 16 25 (MSB) (MSB) (A 13) AO ...1----1 17 24 OBI N ....I----t 18 23 CRUIN 19 22 (+5V) VCC - - - - I 20 21 Pin Name Description Type AO-A13 Address Bus Tristate, output 00-07 Data Bus Tristate, bidirectional CKIN Clock or crystal connection InptAt OSCOUT Crystal connection Output Synchronizing clock Output MEMEN Memory Enable Tristate, output IAQ I nstruction Fetch Output DBIN Data Bus in Tristate, output WE Write Enable Tristate, output READY Memory Ready Input WAIT Wait State indicator Output CRUCLK I/O clock Output CRUOUT Serial I/O out Output CRUIN Serial I/O in Input INTO, INT1, INT2 I nterrupt request and priority Input HOLD DMA request Input HOLDA Hold acknowledge Output Power and G round reference v CC' V DO' V SS Figure 3-16. TMS 9981 Signals and Pin Assignments 3-48 TMS 9980 SERIES MICROPROCESSOR TIMING AND INSTRUCTION EXECUTION The TMS 9980A and TMS 9981 microprocessors have the same signal relationships and instruction execution sequences as the TMS 9900. The few minor waveform differences are identified in the data sheets at the end of this chapter. The only significant difference between the TMS 9900 and TMS 9980 series is in clock logic. The TMS 9900 re e quires four clock inputs. as identified in Figure 3-3. The TMS 9980A requires a single clock signal. input via CKIN. The frequency of this clock input TMS 9980 must be four times the desired clock frequency. That is to say. CKIN will be divided by four in SERIES order to create one clock period. The TMS 9981 can operate with the same CKIN input as the TMS CLOCK 9980A; however. you can also connect a crystal across CKIN and OSCOUT. This may be illustrated LOGIC as follows: CKIN ~------~------------____~ D OSCOUT t-------....---------. C1 and C2 must have values between 10pf and 25pf. typically 15pf. - The crystal must be of the fundamental frequency type. The frequency will be divided by four in order to create the in- ternal clock frequency. Both the TMS 9980A and the TMS 9981 output <1>3. a synchronizing clock Signal. <1>3 is the inverse of the <1>3 clock sig- nal shown in Figure 3-3 and in subsequent timing diagrams for the TMS 9900. Thus you can create the timing diagram for any TMS 9980 operation by looking at the equivalent timing diagram for the TMS 9900 and replacing the four TMS 9900 clock signals by a single timing pulse which will be the complement of <1>3. The following operations are identical within TMS 9900 and TMS 9980 systems: • Memory references. However. note that memory reference will consist of two memory access cycles. as a 16-bit word is handled as two bytes. ·CRU I/O operations (remember that the TMS 9980 series CRU is only 2048 bits wide). ·CRU control operations ·The Wait state •The Hold state and direct memory access operations •The Halt state •The interaction of Hold and Halt states Refer to the TMS 9900 discussion for any of the above topics. TMS 9980 SERIES INTERRUPT LOGIC The TMS 9980A and TMS 9981 microprocessors support four levels of external interrupt. together with a Reset and a Load. Reset and Load are non-maskable interrupts. In contrast. the TMS 9900 supports 15 levels of external interrupt. along with Reset. The TMS 9980 series microprocessors identify external interrupts via the INTO, INT1, and INT2 inputs as shown in Table 3-6. Figure 3-17 shows the interrupt vector map. 3-49 Table 3-6. TMS 9980 Interrupts INTO INT1 INT2 I nterrupt Decoded 0 0 0 Reset 0 0 1 Reset 0 1 0 Load 0 1 1 Level 1 (Highest Priority) 1 0 0 Level 2 1 0 1 Level 3 1 1 0 Level 4 (Lowest Priority) 1 1 1 No Interrupts Observe that the TMS 9980A and the TMS 9981 have no iNTRffi input. Also. the Reset and Load non-maskable inter- rupts are decoded from the INTO - INT2 inputs. Figure 3-18 shows some pin connections for various levels of interrupt complexity in a TMS9980 series microcom- puter system. The three illustrations shown are self-evident; they simply implement the INTO - INT2 codes defined above. The TMS 9980 series microprocessors provide all 16 XOP software interrupts available with a TMS 9900. Observe that Figure 3-17 shows memory as 8-bit units in contrast to Figure 3-11, which shows memory as 16-bit units. This reflects the fact that external memory is addressed as bytes by the TMS 9980A and the TMS 9981. 3-50 Memory Memory Byte Address Content ... ~ t 0000 WP HI 0001 WP La WP Reset - Reset Vector ~ 0002 PC HI ). PC 0003 PC La (' 0004 WP - HI < ). WP 0005 WP La , Leve.! 1 Vector 0006 PC HI 0007 - > ~C t PC La ~ 0008 WP HI >WP External Interrupt. < 0009 OOOA OOOB 'PC WP PC La HI La ~ ). PC } Level 2 Vector OOOC WP HI >WP 0000 OOOE OOOF 0010 WP PC PC WP La HI La HI 1 } ; PC Level 3 Vector 0011 WP La 1 WP } Leve' 4 Veeto' Una..'oned Memo", tt 0012 0013 PC PC HI La J PC for Programs or Data L 0040 WP HI 0041 0042 0043 WP PC PC La HI La } } WP PC } xap 0 Vector xap Vectors, Use Same Memory Space as the TMS 9900 007C WP HI 0070 WP La }wp } xap 15 Vector 007E PC HI PC } PC 007F LO Unassigned Memory , . t ~wp 3FFC WP HI Loed { 3FFO 3FFE. PC 3FFF WP PC LO HI La PC } Load Vector Figure 3-17. TMS 9980 Memory Map 3-51 LEVEl.. 1 I r--f......}- INTO RES'ET r INTO INT1 TMS 9980AI TMS 9981 LEVEl.. 4 INT2 RESET INT1 TMS 9980A/ ['5Ai5 INT2 TMS 9981 A) Using Reset and One B) Using. Reset, I..oad and External Interrupt One External Interrupt Vee ) ! -d:- . ~H 7 E1 RESET ... 6 Lc5A5 5 A2 ". INTO I..EVEI..1 4 ... 3 A1 - "'" INT1 LEVEL 2 AO r- INT2 LEVEL 3 ... 2 LEVEL 4 ~ 1 SN74148 TMS 9980A/ --/P13 ---- -..-.. 15 26 -- P3/A4 -- -..-- CRUCLK/P10 16 25 P2/A3 CRUOUT/P9 - - 17 24 P1/A2 CRUIN/P8 ~ .. 18 23 -- PO/A1 (MSB) INT1/TST "R'ST'iPE -- 19 20 22 21 XTAL2 XTAL1 Pin Name Description Type PO - P31 CRU I/O pins Bidirectional INT1/TST Extemal interrupt and Test select Input INT2/PROG External interrupt and EPROM programmer Input RST/PE System reset and EPROM programmer enable Input AO - A7 External CRU bit address Output CRUCLK External CRU clock Output CRUOUT External serial I/O output Output CRUIN External serial I/O input Input TC Multiprocessor data I/O clock Bidirectional TO Multiprocessor data I/O Bidirectional EC Event counter input Input IDLE Idle state indicator Output HLD Hold request Input HLDA Hold acknowledge Output Synchronizing clock Output XTAL2, XTAL1 External crystal connections VCC1 Standby + 5V power VCC2 Normal + 5V power Vss Ground reference (In this figure, Pn and An numbering conforms to Texas Instruments' policy of beginning with N=O for the high-order bit. We use N=O for the low-order bit.) Figure 3-21. TMS 9940 Microcomputer Signals and Pin Assignments 3-58 Table 3-7 shows how the TMS 9940 interprets its 512 available bit addresses. Table 3-7. TMS 9940 CRU Bit Address Assignments CRU Read Function Write Function Address 000 to External CRU bits; the address is output via A 1-A8. Data is transferred via CRUIN, CRUOUT OFF } and CRUCLK 100 to 17F } Unused Unused 180 INTl state Unused 181 Decrementer interrupt level Clear decrementer interrupt 182 INT2 state Unused 183 Unused Configuration bit 0 (CBO) 184 Unused Configuration bit 1 (CB 1) 185 Unused Configuration bit 2 (CB2) 186 Unused Configuratiol7l bit 3 (CB3) 190 to } Decrementer register. 190 is the least significant bit and 190 is the most significant bit 190 19E Unused Timer (high) or Counter (low) select 19F Unused Unused lAO to t Multiprocessor System Interface buffer register lAF f 1 AO is the least significant bit and 1 AF is the most significant bit lBO to } General purpose flag bits lBF lCO to Identify direction for PO (via lCO) through P31 (via 1DF). } Unused 10F 1 specifies output. 0 specifies input lEO to lFF } local CRU pins (PO = lEO, P3l =I lFF The place to begin looking at Table 3-7 is at CRU bits 183, 184, 185, and 186. These four TMS 9940 CRU bits represent write-only locations which determine how the 32 CRU pins illustrated in Figure CRU BIT 3-21 will be used. UTILIZATION If you look again at Figure 3-21. you will see that PO through P17 have shared functions. P18 through P31 are simple I/O pins without other programmable options. CRU addresses 183, 184, 185 and 186 control the functions of PO through P16, as illustrated in Table 3-8. P17 options depend on real-time clock logic. which we will describe later. Let us look at the programmable options available with CRU pins PO through P31. It does not matter what options you have selected: you will actually access the 32 CRU pins PO - P31 via CRU ad- dresses 1 E016 through 1 FF 16. In the simplest case, all 32 pins, PO - P31, will be used for input or output. We call this Sim- TMS 9940 ple I/O mode. In order to use all 32 pins for data input or output. (that is. in Simple 1/0 mode). all SIMPLE four of the configuration bits. CBO. CB1. CB2. and CB3. must be O. At any time. a CRU bit can CRU I/O either input data or output data. but it cannot be used for bidirectional data transfer. You must MODE identify the direction for each pin by outputting appropriate data to CRU addresses 1C016 through 1 DF16. As shown in Table 3-7. each pin has a dedicated CRU address. beginning with pin PO controlled by 3-59 1C016 and ending with pin P31 controlled by CRU address 1DF16. A 1 written to any Direction CRU bit causes the as- sociated pin to output data only. A 0 written to any CRU Direction bit causes the associated pin to input data only. Of course. you can at any time change a pin from input to output or from output to input. under program control. by rewriting control information to Direction CRU bits 1C016 through 1 DF16. Table 3-8. TMS 9940 CRU Bits Whose Functions are Determined Under Program Control CRU Function as Configured Bit Address Pin CBO=O CBO = 1 CB1, CB2, CB3 0-7 1 EO-1 E7 23-30 PO-P7 A1-A8 No Effect 8 1E8 18 P8 CRUIN No Effect 9 1E9 17 P9 CRUOUT No Effect 10 1EA 16 P10 CRUCLK No Effect CB1 = 0 CB1 = 1 CBO, CB2, CB3 11 1EB 14 P11 TC No Effect 12 1EC 11 P12 TO No Effect CB2 =0 CB2 = 1 CBO, CB1, CB3 13 1ED 15 P13 4> No Effect CB3 = 0 CB3 = 1 CBO, CB1, CB2 14 1EE 10 P14 HLO No Effect 15 1EF 9 P15 HLOA No Effect 16 1FO 8 P16 i'i5'i:'E No Effect You will always have to define the direction of data transfer for pins P18 through P31 - assuming that you are using these pins. When pins PO through P17 are being used in any of the special ways which we are about to describe. then the data direction associated with the special operation will apply. and it makes no difference what you output to the associated Direction CRU bit. If you wish to use 266 external CRU bits, then you must set CRU bit 183 (CBO) to 1. This is TMS 9940 called I/O expansion mode. I/O expansion mode modifies the functions of pins PO through P10. CRU I/O When you use CRU addresses 00 through FF16 in I/O expansion mode. the address is output via EXPANSION pins PO - P7. which now function as CRU address lines A 1 - A8. P8. P9. and P10 serve as the stan- MODE dard CRU data transfer lines: CRUIN. CRUOUT. and CRUCLK. Timing for data input and output via these three lines has been described for the TMS 9900. Refer to the TMS 9900 description for details. In order to il- lustrate the use of external CRU, consider execution of the instructions: LI R3.>OO LOAD 1010 BINARY INTO UPPER BYTE OF R3 LI R12.>140 LOAD A BASE ADDRESS OF 82 HEX INTO R12 LDCR R3.4 OUTPUT FOUR LOW-ORDER BITS OF R3 TO CRU Note that R12 contains 014016 to represent the address 08216. since R12 bit 0 is unused; therefore the internal ad- dress is. in effect. doubled. This instruction outputs 1010 to CRU bit 08216 (0). 08316 (1). 08416 (0), and 08516(1). Since fewer than eight bits will be transferred. they will come from the upper byte of the general purpose register. This is the event sequence which occurs: 1) The address 8216 is output via A 1 - A8. Remember. Texas Instruments' literature uses 0 to represent the high- order bit therefore A 1 represents the high-order address bit. and A8 represents the low-order address bit. CRUIN is inactive. but CRUOUT is low to represent 0 while CRUCLK is pulsed high to time the 0 bit on CRUOUT. 3-60 2) The address output on A 1 1- A8 increments to 8316. and CRUOUT goes high. then CRUCLK pulses high. 3) The address on A1 - A8 increments to 8416. CRUOUT goes low again. and CRUCLK pulses high. 4) The address on A 1 - A8 increments to 8516. and CRUOUT goes high. and CRUCLK pulses high. 1010 has now been transmitted to four external CRU bits. Note that it is up to external logic to decode the CRU address output however. the Parallel System interface (which we will describe in later editions) will connect directly to the TMS 9940 Address and CRU outputs that we have just de- scribed. When you write 1 to CRU bit 18416 (CB1), pins P11 and P12 function as serial data TMS 9940 transfer pins. The purpose of this logic is to allow the TMS 9940 to operate in multi-CPU MULTIPROCESSOR configurations. This logic is very simple. You output data by writing the data to CRU bits SYSTEM 1A016 through 1AF16. This data is immediately transmitted via TD (P12) as a serial data INTERFACE stream which is clocked by TC (P11). In keeping with normal bit sequence protocol. data is transmitted low-order bit first. Thus. 16 bits of data being output may be illustrated as follows: II: II: w w o o II: II: o o ± -~ I-U CJ o ::»- I .J a. CJ 1- 0 ~tO o ... u. ... ::».J O.J « « 1-« Cl)Z II: II: -w 11 10 11 10 11 11 11 10 11 10 11 11 1 u.1- wX IW 1-> ~Dl Cl)Z -w Iw I-CI) TC TO o o o o o When a TMS 9940 has a 1 written to CB1. it can also receive data via TD. Data input is again clocked by TC. Input logic is the reverse of the output logic illustrated above; that is say. as a data stream is input. the first input bit is loaded into CRU bit 1AF16. and the sixteenth input bit is loaded into CRU bit 1A016. TMS 9940 multiprocessor system interface logic is used to transfer data from a memory location in one TMS 9940 to a memory location in another TMS 9940. You will not normally use this logic to transfer data between a TMS 9940 and external logic; the CRU serves that purpose better. There are three reasons why you may want to use the TMS 9940 multiprocessor system interface; they are: 1) To transmit status information. For example. one TMS 9940 cou Id tell another how far it has progressed through various phases of a task by transmitting a status word whose bits have some predefined interpretation. 2) To transmit data. One TMS 9940 may generate data which another TMS 9940 needs in order to execute its pro- grams. 3) To transmit instruction sequences. Instructions could be transmitted from the read-only memory (or the read/write memory) of one TMS 9940 to the read/write memory of another TMS 9940. The receiving TMS 9940 could then execute the instruction sequence out of its read/write memory. 3-61 - .... P30P31 0 'It INTi. -- - - ... m --...... TO P29 m;:- P27 - - . TC P28 en- ~ I- P26 P25 -- - :. P31 P30 0 'It ~N INTJ P27 - - ;., P29 - - - --- P28 en- P26 TO ~ P25 ~t- I- TC - --.. P31 P30 P29 0 'It m m- INT1 P27 -- 1- - -- . ;. P28 TO TC M en- ~ I- P26 P25 ~ ~ -- .. P31 - t 0 - - --.. P30 'It m INT1 1 I ~ P29 m-v P27 1 ..- =rc en- 10 11 12 13 -- P28 TO ~ I- P26 P2-S ~;- 03 02 01 00 00 ~. 4~ 12 - , ,. 74148 01 02 - -- ..:. ~ 0 11 10 74138 17 16 15 14 - ..:. TO P28 vm m-Ln P25 ~U P2S -- 04 05 06 07 P:i9 I .~ .~ I~ :. 1'30 - P31 en- ~ I- P27 il\il"1 - -... - -- ....:. ~ TC TO P28 0 'It m m-U) P25 ~. P26 1- I- P29 P27 - i. P30 P31 en- ~ l- INT~ - - r- - .... iC 0 -- .... TO P28 v ~- P25 ~ P26 -- - P29 P30 P31 " en- ~ I- P27 INTi -- l- .. - - ..-- P28 TC TO 0 'It m m-CXl P25 "'-- P26 -- P29 ;., P30 en- P27 - P31 ~ l- INT1 Figure 3-22. Handshaking Logic in a TMS 9940 Multi-Microcomputer Network Communicating via the TD Data Line 3-62 You could use the CRU to perform any of the three data transfers described above. but the multiprocessor system inter- face is somewhat easier to use. We say that data transfer via the multiprocessor system interface is "somewhat" easier to use because many problems still remain when you use the multiprocessor system interface. These problems arise from the fact that there is absolutely no handshaking protocol associated with the multiprocessor system inter- face. For example. there is absolutely no protection against two TMS 9940s simultaneously trying to output data via TO and TC. There is no predefined protocol whereby a transmitting TMS 9940 identifies the receiving TMS 9940 or the instant data has been transmitted and should be read. Any protocol is your responsibility - to be provided by logic ex- ternal to the TMS 9940s. Fortunately. this protocol is easy to implement. Figure 3-22' shows how eight TMS 9940s can communicate with each other, such that each TMS 9940 may transmit data to, or receive data from, any other TMS 9940. The logic illustrated in Figure 3-22 is more complex than the logic you would need for a small system - for example. a two-microcomputer system. or a system where there are dedicated transmitters and receivers. While Figure 3-22 shows TMS 9940s communicating with each other. you will in fact use TMS 9940s just as fre- quently with other microprocessors - such as a TMS 9900. Nevertheless. the concepts embodied in Figure 3-22 would apply. from the viewpoint of the TMS 9940. in any other configuration. Let us look at how the logic in Figure 3-22 works. The first problem we must resolve is the problem of transmission contentions. How will we make sure that one TMS 9940 does not try to transmit data while another TMS 9940 is already transmitting data? A simple scheme wou Id be to set aside a particular CRU pin to serve' as a "Busy" line. For example. every TMS 9940 could use P31 as a "Busy" output pin and P30 as a "Sense" input pin. We could wire-OR together all P31 Busy outputs and input this wire-OR to all P30 Sense inputs. Now any TMS 9940 that wishes to transmit data will read its P30 CRU bit. If this bit is O. then it will out- put 1 to P31. Outputting 1 to P31 causes all otherTMS 9940s to receive 1 at their P30 inputs. Thus. no other TMS 9940 will begin transmitting data if another TMS 9940 was in the process of transmitting data. This logic may be illustrated as follows: P31 P30 All TMS 9940s Another now receive TMS 9940 a high P30 senses pao high - so does not try to output The problem with the logic illustrated above is that two TMS 9940s could simultaneously read P30. find it was O. out- put 1 to P31. then output competing data on TO. While the chances of two microcomputers executing identical in- structions at exactly the same time are very small. a well-designed microcomputer system must account for every po- tential error. In Figure 3-22 we resolve our problem by using a 74148 8-to-3 decoder. The P31 output from every TMS 9940 is connected to a different 74148 input. The 74148 outputs. via 00.01. and 02. the line number for the highest priority active input. This three-line output is connected to the P28. P29. and P30 pins of every TMS 9940; we assume that these three pins are inputs at every TMS 9940. Now every TMS 9940 that wishes to transmit data via TO must out- put a 1 to P31. It must then input the contents of P30. P29. and P28. Upon detecting its own 10 on these three inputs. it begins data transmission. If a TMS 9940 outputs 1 via P31 and then reads in some other 10 via P30. P29. and P28. then it must wait. Here is an appropriate instruction sequence: LI R12.>3F8 LOAD P28 ADDRESS. X2. INTO R12 SBO 3 SET P31 ON LOOP STCR R2.3 INPUT P28. P29. AND P30 CI R2.ID COMPARE INPUT WITH DEVICE 10 JNE LOOP RETURN AND RE-ENTER CODE IF NOT .CORRECT 10 LI R12.>340 LOAD MPSI OUTPUT DATA BASE ADDRESS X2 LDCR R3.16 OUTPUT CONTENTS OF R3 VIA TO 3-63 Assuming that a TMS 9940 has output 1 to P31 and has received back its own 10 via P28. P29. and P30. the TMS 9940 is ready to transmit data. However. in addition to simply transmitting the data. the TMS 9940 must tell the intended recipient that the data has been transmitted. In Figure 3-22 we use a 74138 3-to-8 demu Itiplexer for this purpose. Pins P25. P26. and P27 of every TMS 9940 are outputs that connect to the 10. 11. and 12 inputs of the 74138. The transmitting TMS 9940 outputs data which will be received by every other TMS 9940; however. the transmitting TMS 9940 follows up by outputting a 3-bit code via P25. P26. and P27; this 3-bit code identifies the intended recipient. The 3-bit code is input to the 74138. which generates one of eight possible outputs. These eight outputs become external interrupt request inputs to the eight TMS 9940s. Only the single TMS 9940 will receive the data which was transmitted by the eighth TMS 9940. only one TMS 9940 will receive an interrupt request signal; this is the TMS 9940 for which the transmitted data was intended. The TMS 9940 which receives data simply executes an STRCR instruction to move the data from CRU bits 1A016 through 1AF16 to the appropriate general purpose register. CRU bit 18516. the CB2 bit. serves the very limited purpose of outputting a synchronizing TMS 9940 signal. When you output 1 to CB2. P13 ceases to be an I/O pin and instead outputs the inter- SYNC MODE nal TMS 9940 clock signal. CRU bit 18616 (CB3) controls idle and hold logic for the TMS 9940. When you write a 1 to CRU bit 18616. pins P14 and P15 act as hold request input (HLD) and hold acknowledge output (HLDA) signals. respectively. P16 generates an IDLE output. The Hold request/acknowledge logic of the TMS 9940 is quite standard. The purpose of this TMS 9940 logic is to remove the TMS 9940 from any shared busses when some other microprocessor or HOLD LOGIC microcomputer is bus master. If CB3 is 1. then a low signal arriving at the TMS 9940 HIT5 input will cause the TMS 9940 to enter a Hold state at the conclusion of the current instruction's execution. A 10w"RiJ5A out- put marks the beginning of the Hold state. The IDLE signal is output low when an IDLE instruction is executed and CB3 is 1. The only way in which you can terminate an Idle state is by requesting an interrupt via iN"fT or INT2. The TMS 9940 three-state signals are not floated in the Idle state. You must additionally enter the Hold state for this. The purpose of the IDLE instruction and signal is to enable standby power logic. This may be illustrated as follows: +5V ~------~------------------~.. V CC 1 IOLE LOW OPENS SWIT'CH I Under normal circumstances. the power supply will input power to VCC1 and VCC2. When IDLE goes low. the power input to VCC2 is switched off. While VCC1 only is receiving power. the TMS 9940 read/write memory and interrupt logic is active. but all other logic is inactive. since the interrupt logic is active. any arriving interrupt request will be acknowledged. The process of acknowledging an interrupt request sets IDLE high again. This closes the switch and restores power to VCC2. which allows the TMS 9940 to resume normal execution In the illustration above. note that IDLE is connected to"HiJ). 3-64 TMS 9940 GENERAL PURPOSE FLAGS If you look again at Table 3-7 • you will see that CRU addresses 1 BO 16 through 1 BF 16 address 16 general pur- pose flags. These general purpose flags have no special hardware functions. They are programming aids and that is all. You can write data out to these flags. and you can read back the data. How you use this data is entirely up to pro- gram logic. TMS 9940 TIMER/EVENT COUNTER LOGIC The TMS 9940 has a timer which can also be used as an event counter. CRU bit 19E16 determines whether this logic will function as a timer or as an event counter. If CRU bit 19E16 is high. then this logic serves as a Timer. If CRU bit 19E16 is low. then this logic serves as an event counter. Timer and Event Counter logic both use CRU bits 19016 through 19016 as a 14-bit register whose contents are decre- mented by Timer or Event Counter logic. This 14-bit register is buffered. That is to say. the initial value which you out- put to CRU bits 19016 through 19016 is stored in a buffer. in addition to being loaded into CRU bits 19016 through 19016. Subsequently. CRU bits 19016 through 19016 are decremented. but the buffer contents remain unaltered. When CRU bits 19016 through 19016 decrement to O. they are reloaded from the buffer. Thus Timer/Event Counter logic runs continuously. An interrupt request is generated internally when CRU bits 19016 through 19016 decrement to O. Remember. CRU bit 19016 is the low-order bit. and CRU 19016 is the high-order bit. This is the reverse of normal Texas Instruments bit numbering. where the high-order bit has the lowest bit number. However. this is consistent with the fact that Texas Instruments outputs data to the CRU low-order bit first. and addresses CRU bits in numerically ascend- ing address sequence. When you write 0 to CRU bits 19016 through 19D16. you disable Timer/Event Counter logic. When the Timer/Event Counter is operating as a timer. the 14-bit register represented by CRU bits 19016 through 19016 are decremented once every 30 internal clock oscillations. The crystal connected across XTAL 1 and XT AL2 determines clock oscillation frequency. When CRU bits 19016 through 19016 time out to zero. an interrupt request is generated. When Timer/Event Counter logic is operating as an event counter. pin P17 serves as an input. receiving the event sequence to be counted. Every low-ta-high transition of the signal input at P17 decrements the counter. Once again. when the counter counts out to O. an interrupt request occurs and the counter is reloaded from its buffer register. TMS 9940 INTERRUPT LOGIC The TMS 9940 has four external interrupts and twelve internal software interrupts. These are the four external interrupts: 1) Reset. This has highest priority. 2) A level 1 interrupt occurring at the INT1 pin. This has second highest priority. 3) A Oecrementer/Event Counter interrupt. This has third highest priority. 4) A level 2 interrupt occurring at the INT2 pin. This has lowest priority. As described for the TMS 9900. you execute XOP instructions to generate software interrupts. XOP4 through XOP15 are active. XOPO through XOP3 do not exist on the TMS 9940. TMS 9940 interrupt vectors. together with a complete TMS 9940 memory map. are illustrated in Figure 3-20. The actual interrupt acknowledge sequence for a TMS 9940 is identical to that which we have described for the TMS 9900. TMS 9940 RESET You Reset the TMS 9940 by inputting a low signal at RST/PE (pin 20). This low signal must last for at least five clock cycles. A Reset resets to 0 the contents of all pointer registers and all CRU configuration bits. Following a Reset level 0 interrupt response beg ins - which means that read-only memory bytes 0 through 3 provide the initial Program Counter and Word Pointer register contents. and therefore the address of the program which will be executed follow- ing the Reset. 3-65 Note that the TMS 9940, being a smaller and simpler system than the TMS 9900, can use elementary logic to generate an interrupt acknowledge. For the TMS 9900 we suggested an Address Bus decoding technique in order to create an interrupt acknowledge signal. For the TMS 9940 a CRU bit will do just fine. The following circuit is recommended by Texas Instruments: o a INT REa CLK 7474 Q CLR INT ACK A simple O-type flip-flop has its 0 input connected to +5V. Every time an interrupt request pulse is input to the clock pin, the Q output will go low - generating a valid interrupt request at the TMS 9940. In order to acknowledge the in- terrupt and remove the interrupt request signal. you can output a low pulse via any of the P pins. This low pulse clears the D-type flip-flop and forces Q high again. PROGRAMMING A TMS 9940E ERASABLE, PROGRAMMABLE READ-ONLY MEMORY The TMS 9940E has a transparent quartz lid over the device in its dual in-line package. In order to erase the TMS 9940E EPROM, you should expose it to a high-intensity ultraviolet light with a wavelength of 2537 angstroms. An intensity of 10 watt-seconds per square centimeter is recommended. After the TMS 9940E EPROM has been erased, all EPROM memory bits will be O. These are the steps required in order to program a TMS 9940E EPROM: 1) Reset the device. 2) Apply the first data byte - to be stored in memory location 0000 to pins P24 through P31. Remember. P24 repre- sents the most significant bit of the byte, and P31 represents the least significant bit of the byte. 3) Apply a 26-volt level to pin 20, the RST /PE pin. This being the first programming pulse, it resets the internal pro- gram memory address point at 0000 and writes the data byte at P24 through P31 into memory location O. 4) After at least 80 clock cycles, apply 26 volts to pin 37, INT2/PROG, for 50 milliseconds while changing the data byte (step 5). 5) Apply the next data byte to P24 through P31. At the high-to-Iow transition of PROG, the data will be written into the next location. 6) Remove the 26 volts from pin 37 for a minimum of 50 clock cycles. Then apply 26V to pin 37 for 50 milliseconds. 7) Return to Step 5 until all of program memory has been programmed. LOADING A PROGRAM INTO TMS 9940 READIWRITE MEMORY You can load a program directly into TMS 9940 read/write memory via pins P24(MSB) through P31 (LSB) for either the TMS 9940E or the TMS 9940M. Typically, this is done in order to load a small test program. The procedure for loading data into the TMS 9940 read/write memory is exactly as described in the previous section for loading data into EPROM. except: the 26-volt level is applied to pin 19, the TST pin, after the device has been reset by inputting a low signal to pin 20, the RST /PE pin; and the high pulses at PROG are logic '1' level rather than 26 volts. When you input data to a TMS 9940 read/write memory using the TEST pin and P24 through P31, the address pointer is initialized to address 830016. The address keeps incrementing the high-to-Iow transition of each 50 millisecond pro- gramming pulse applied at pin 37. When you finally stop applying programming pulses, the last 16 bits of data input are interpreted as the beginning address for the program to be executed. This address may point to a read/write memo- ry location, or to a read/write memory location. That is to say, the test program may be in read/write memory, in read- only memory, or in both areas. THE TMS 9940 INSTRUCTION SET The TMS 9940 instruction set is identical to the TMS 9900 instruction set, with these exceptions: 1) The RSET, CKOF, CKON and LREX instructions have been deleted. That is, all the external instructions except IDLE. 3-66 2) The XOP instructions will not work with operands 0, 1, 2, or 3. 3) There are new DCA and DCS instructions that enable 8-bit binary-coded decimal arithmetic. Assuming that you start with two valid 8-bit binary-coded decimal operands, you can add these two 8-bit operands using normal binary addition. The result will be a meaningless 8-bit number; however, if you immediately execute the DCA instruction, this meaningless 8-bit number will be converted to a meaningful 8-bit 2-BCD-digit number. DCS, likewise, allows you to perform 8-bit binary-coded decimal subtraction. Assuming that the subtrahend and mi- nuend are both valid 8-bit binary-coded decimal numbers, you perform a subtraction using binary arithmetic and you generate a meaningless 8-bit result. By executing the DCS instruction, you convert this meaningless 8-bit result into a valid 8-bit 2-BCD-digit binary-coded decimal difference. The DCA and DCS instructions both generate in the low-order eight bits of the 16-bit word. For a discussion of decimal adjust logic in BCD addition or subtraction, see Volume 1, Chapter 3. The LlIM instruction loads a 2-bit interrupt mask into the two low-order bits of the Status register. Here are the instruction object codes used by the DCA. DCS, and LlIM instructions: Clock Instruction Object Code Bytes Periods DCA r 0010110000bbssss 2 7 DCS r 0010110001 bbssss 2 7 LlIM n 001011001xxxxxnn 2 10 The object code notation above conforms to that which we have described for Table 3-3. For the LlIM instruction, x represents "don't care" bits and n represents the two binary digits that get loaded into the two low-order Status register bits. THE TIM 9904 FOUR-PHASE CLOCK GENERATOR/DRIVER This part is also given the generic TTL name: the SN74LS362. The TIM 9904 provides TMS 9900 microprocessors with the four clock signals: <1>1, <1>2, «1>3, and «1>4. These are +12V MOS driver signals. In addi- tion, four complementary +5V clock signals, «1>1, <1>2, <1>3, and «1>4, are generated for use elsewhere in a TMS 9900 microcomputer system. The TIM 9904 device may be driven by an external crystal, an external LC circuit, or a single external clock sig- nal. The TIM 9904 is manufactured using low-power Schottky technology; hence the 74LS part number It is packaged as a 20-pin DIP. All signals, other than the four MaS level clocks, are TTL-compatible. The TIM 9904 allows one asynchronous input Signal to be synchronized, via a D flip-flop, with the «1>3 signal. The syn- chronized Signal is output frequently to be used as a RESET input to the TMS 9900. Figure 3-23 illustrates TIM 9904 pins and signal assignments. The four clock signals, <1>1,<1>2, <1>3, and «1>4, conform to Figure 3-3 . «1>1, «1>2, <1>3, and ct>4 are complements of <1>1, ct>2, «1>3, and «1>4. A logic level input at D will be output at Q on the high-to-Iow transition of «1>3: cf>3 ---....I o Q 3-67 TANK 1 1 20 VCC1 (+5V) TANK2 2 19 XTAL2 GNDl 3 18 XTALl Q o -- ..- 4 5 TIM 17 16 -- ----.. OSCIN OSCOUT «1>4 ct>3 --- 6 7 9904 15 14 - <1>2 ct>1 -- .-. ct>3 8 13 VCC2 (+ 12V) «1>4 9 12 <1>1 GND 10 11 -:.. <1>2 Pin Name Description Type ct>l, ct>2, ct>3, «1>4 + 12V clocks to drive a TMS 9900 Output <1>1, ~ ct>3, Output VCC1. VCC2, GND1, GND2 Power, Ground Figure 3-23. TIM 9904 Signals and Pin Assignments OSCOUT provides a clock frequency four times that of the 1 _ _...-./ \~------------------~/ \ 4>2 ______________~1 \~ ________________ ~r_ 4>3 ______________________~/ \ 4>4~~______________________________~/ \ 3·68 When an external quartz crystal is used to drive the TIM 9904, the following connections are required: TANK 1 0.47 J.LH ......_ .......~_--1 2 19 XTAL 1 TANK 2 20 ohm to. 75 ohm crystal, ·TIM 9904 D 2 mw power dissipation. (May substitute a 0.1 J.LF capaciton) 17 OSCIN OSCIN must be tied to a high logic level for the internal clock logic to work properly. Required capacitor and inductance values are shown in the illustration above for a TMS 9900 microprocessor operating with its standard 3 MHz frequency. The crystal must have a resonant frequency of 48 MHz. For 48 MHz operation. a third overtone crystal is used. For less precise timing. the quartz crystal may be replaced with a 0.1 JLf capacitor. The LC-tuned circuit now estab- lishes the clock frequency according to the following equation: fosc = 1/(2",$) where L is the inductance. with units of Henries. and C is the capacitance with units of Farads. This includes the capacitance of the circuit into which the components are mounted. If an external clock signal is input, it must occur at OSCIN. The crystal connections XTAL 1 and XTAL2 should be connected to VCC as follows: + 5V NOT {TANK 1 20 CONNECTED TANK 2 XTAL2 2 19 TIM } TIED TO LOGIC '1' XTAL1 9904 18 OSCIN 17 CLOCK INPUT 3-69 The clock input OSCIN must have a frequency which is four times the clock period frequency and has a 25% duty cycle. Thus. for a 3 MHz frequency, a 12 MHz signal must be input via OSCIN: 1..........- - - 83.3ns "1 OSCIN --Jr---\,__________--.',..--, ______ \~ ~20.8ns~ I In TMS 9900 microcomputer systems, the 0 input is used for an asynchronous reset; Q is output as a syn- chronous reset. This may be illustrated as follows: Vee ) TIM TMS 10Kn: . 9904 9900 100.0 .AAA 0 a ..- RESET ! 1 1}LF --- - I- The illustration above shows recommended resistor and capacitor values. THE TMS 9901 PROGRAMMABLE SYSTEM INTERFACE (PSI) The TMS 9901 Programmable System Interface (PSI) is a special support part designed for the TMS 9900 series of microprocessors. This relatively primitive device uses 32 bits of the TMS 9900 CRU bit field to support parallel I/O and interrupt request logic. Programmable timer logic is also available. Figure 3-24 illustrates that part of general microcomputer system logic which has been implemented on the TMS 9901 PSI. The TMS 9901 PSI is packaged as a 40-pin DIP. It uses a single +5V power supply. All inputs and outputs are TTL-com- patible. The device is implemented using N-channel silicon gate MOS technology. 3-70 Clock Logic Arithmetic and Accumulator Logic Unit Registensl Data Countens) Stack Pointer Program Counter Read Only Memory Figure 3-24. Logic of the TMS 9901 Programmable System Interface 3-71 RS'fi CRUOUT -.. - -.. 1 2 40 39 --- -.. VCC (+5V) SO (MSB) CRUCLK CRUIN - -.-. - 3 4 5 38 37 36 -- .. PO P1 S1 iN'i'6 .. 6 35 S2 ----- -.---. iN'f5 7 34 ... INT7/P15 INT4 iNT3 -- . 8 9 33 32 INT8/P14 INT9/P13 Cii -- -- ..... 10 TMS 31 INT10/P12 INTREQ (LSB) IC3 IC2 - --- 11 12 13 9901 30 29 28 -- ..-.. -. INT11/P11 iN'fi2/P10 INT13/PS IC1 (MSB) ICO - ... 14 15 27 26 --- -- INT14/P8 P2 Vss wn 16 17 25 24 --- .. S3 S4 (LSB) ---- -....-. : - --- INT2 18 23 INT15/P7 P6 P5 -- .... 19 -20 22 21 -- - P3 P4 Pin Name Description Type CRUIN CRU data output Output CRUOUT CRU data input Input CRUCLK CRU data input strobe Input PO - P15 I/O data Input or Output iNTT -INT15 External interrupt requests Input INTREQ Interrupt request to CPU Output ICO - IC3 Interrupt priority designation Output CE Chip Enable Input SO - S4 CRU bit select Input RSTf Chip reset Input 4l Synchronizing clock signal Input VCC' Vss Power, Ground reference Figure 3-25. TMS 9901 Programmable System Interface Signals and Pin Assignments In the illustration above, Address lines have been numbered using our standard notation, whereby A 14 is the highest- order address line and AO is the lowest-order address line. This is the opposite of Texas Instruments' notation. The CRU select lines are numbered according to Texas Instruments' notation and Figure 3-25. Therefore, S4 is connected to AO, and SO is connected to A4. 3-72 TMS 9901 PSI PINS AND SIGNALS The TMS 9901 pins and signals are illustrated in Figure 3-25. The signals which connect the TMS 9901 to a TMS 9900 series microprocessor are quite straightforward; they consist of the CRU and interrupt signals. The CRU signals include CRUIN. CRUOUT. and CRUCLK. The interrupt signals consist of INTREQ. ICO, IC1, IC2, and IC3. For a description of CRU and interrupt signals, refer back to our TMS 9900 discussion. Device select logic includes a chip enable input, CE, together with five CRU bit select pins, SO - S4.a and SO - S4 will connect to the Address Bus as follows: ·· ..--:.- A14 A5 A4 - .6.3 - Ai .': A2 .r •••• r - .;: -. AD DEVICE 1 S4 SELECT S3 _ S2 ...~ TMS S1 • 9901 SO .. CE. In the illustration above, Address lines have been numbered using our standard notation. whereby A 14 is the highest- order address line and AO is the lowest-order address line. This is the opposite of Texas Instruments' notation. The CRU select lines are numbered according to Texas Instruments' notation and Figure 3-25. Therefore, S4 is connected to AO. and SO is connected to A4. 3-73 Device select logic determines the CRU address space that will be reserved for the TMS 9901 PSI. This may be illustr- ated as follows: M"E'M'EN = A13 A14 .. ~ ;, A12 ··· ·•... A11 A5 A4 ':, ... A3 A2 :-= A1 - AO r ...... l) --.. CRU DEVICE ACCESS SELECT I, I 1, EE II SO , r r •• S1 S2 S3 S4 000 n n n n n n n x x x x x ~ '---....- - -.....v-...---",?"~ These three bits zero These seven bits These five bits select and MEMEN inactive identify the a CRU bit in the (high) indicate a TMS 9901 address TMS 9901 PSI CRU address space. The high-order three address lines. which we call A 14. A 13. and A 12. are all zero during a CRU access. at which time MEMEN is inactive (high). Thus we decode address lines A 11 through A5 to select a particular TMS 9901 device. . Since the TMS 9980 uses the Address Bus differently during a CRU operation. TMS 9901 device select logic would connect to the Address Bus in a different way. The CRU bit select lines SO - S4 would be tied to lines A5 - A 1; device select logic would decode lines A11 - A6; and lines A13 and A12. along with MEMEN. would indicate a CRU access. We illustrate this as follows: MSB LSB A13 A12 A11 A10 A9 AS A7 A6 A5 A4 A3 A2 A1 AO . - Address Bus o 0 n n n n n n x x x x x ~ ~,------..--~v-~----------~~ ~'----"--~~~-------'~ These six bits identify These five bits the TMS 9901 select a CRU bit CRUOUT address space These two bits zero, along with MEi\ii"Ei\i inactive, indicate a CRU address is the complement of <1>3. For the TMS 9900. <1>3 is generated by the TMS 9904. The TMS 9980 outputs <1>3 directly. The best way of understanding the interface between a TMS 9901 and external logic is to look at functions per- formed. as illustrated in Figure 3-26. 3-74 INTERRUPT MASK BITS o SELECT BIT ICO ~--.r---, IC1.---I INTERRUPT PRIORITY IC2 .....~-....... ENCODER IC3 ~--L _ _......J INTREQ .....- - - ( CLOCK LOAD BUFFER CRUOUT - -__... CRU CRUCLK ----t. . INTERFACE~----------' CAUIN ....I---~ SO S1 ~ PO-P6 CRU S2 BIT 'S3 SELECT LOGIC S4 CE Figure 3-26. TMS 9901 PSI General Data Flows and CRU Bit Assignments 3-75 From the programmer's viewpoint. a TMS 9901 looks like 32 contiguous CRU bits. Thus. you will access any part of a TMS 9901 device's logic using CRU input and output instructions. As you read through the TMS 9901 description that follows, you should bear in mind the power of multi-bit CRU load and store instructions as they apply to TMS 9901 architecture. A single instruction transferring an appropri- ate bit pattern can frequently perform mu Itiple control and data transfer operations. The manner in which CRU bits are used by the TMS 9901 is not straightforward. This is because CRU bits share functions and pins. Functions and pins are shared in different ways. Let us first look at pin connections. CRU bits 1-6 connect to pins TNiT - INT6; thus. in interrupt mode each of these CRU bits has its own dedicated input pin. .- CRU bits 7-15 share nine input or output pins with CRU bits 23-31. CRU bits share pins as follows: Device Pins 31 7 4 ~ 34 30 8 4 ~ 33 ,. 29 28 9 10 ...,. .. ~ 32 31 27 26 25 11 12 13 ~ ~ ~ . ~ ~ ~O 29 28 24 14 4 ~ 27 23 15 ~ --I 23 I t t These CRU bits support interrupt logic These CRU bits are dedicated to data I/O Each of the CRU bits shown above shares a pin with another CRU bit. That is to say. within the illustrated CRU address range. there are two CRU bits which will access the same pin. although each CRU bit performs a different operation. Thus you use the same pin in one of two different ways. using a bit address to select one operation. This may be illustr- ated as follows: If you select CRU bit 27. ') 27 Pin 30 supports data I/O I 30 If you select CRU bit 11, and interrupt mode, .--11-....' Pin 30 serves as an interrupt request input CRU bits 16-22 connect to parallel I/O pins. These bit addresses are not shared with any other TMS 9901 functions. CRU bit 0 is a select bit that is not connected to any pin. A 1 written into this bit causes bits 1-15 to support real- time clock logic. A 0 written into CRU bit 0 selects interrupt logic. When CRU clock logic is selected. bits 1-14 function as two 14-bit real-time Clock Buffer registers -: one a read-only register. the other write-only. Real-time clock logic is separate from. and operates simultaneously with. and/or parallel 110 logic. That is to say. the process of selecting real- time clock logic does not disable any other logic. The select bit merely chooses which registers CRU addresses will ac- cess. rather than enabling or disabling any operations. TMS 9901 PSI INTERRUPT LOGIC The easiest place to start understanding the TMS 9901 is at its interrupt logic. External logic can input data to CRU bits 1-15 via their connected pins. These input data signals will be in- terpreted as interrupt requests if interrupts are enabled. If interrupts are disabled, then these CRU bits act simply as data input. 3-76 You access interrupt logic through the CRU when the select bit, CRU bit 0, contains a O. CRU bit addresses 1-15 each access separate read-only and write-only locations. The read-only location stores the sig- nal level input at the attached pin. The write-only location accesses an interrupt mask bit. This may be illustrated as follows: Write- Read- Only Only Mask Data Bit Bit N -- N - } From Pins NT 1 f4- - N +1 - I I I I I I I I CRU Bit N { -- CRU Bit N + 1 { - Signals arriving at pins connected to CRU bits 1-15 are immediately reflected by CRU bit contents: Read- Only Data I Bit I ~ 0 Low High A low level (that is. a 0 bit) is interpreted as an interrupt request. The interrupt request is passed on to the mask bit. If the mask bit contains 1. the interrupt is enabled and the interrupt request is passed on: Write- Read- Only Only Mask Data I I Bit Bit I I I· I: Interrupt -4 0 Low Request High If the mask bit is O. the interrupt request is disabled and therefore denied: Write- Read- Only Only Mask LJata Bit I I Bit I I 0 I· 0 I: Low High 3-77 Quite apart from interrupt logic. the CPU can at any time read the contents of one or more CRU bits in the address range 1-15. Here are some instructions that may access CRU bits 1-15 in various ways: LI R12.PSI+1 LOAD CRU BASE ADDRESS INTO R12 LI R1.MASK LOAD INTERRUPT MASK BITS INTO R1 LDCR R1.15 OUTPUT TO WRITE-ONLY MASK LOCATIONS STCR R2.15 INPUT CRU BITS 1 THROUGH 15 AS DATA TO R2 For some randomly selected data levels. CRU bits 1-15 may be illustrated as follows: Interrupt CRU Mask Bits Bits 1 Bits Pass on o Bits Generate Interrupt Interrupt Reque sts t Requests . 1- 1 *- 1 1 0 ..-- / 2 1 2 1 .. - 3 4 0 1 -- 3 1 0 .. ----· 4 5 1 5 1 6 0 - 6 0 ·.. 7 8 0 0 - 7 8 0 1 ---- 9 1 ... 9 10 1 --. '\- 10 0 11 1 ... 11 0 0 - 12 13 0 1 - 12 13 1 0 ... - 14 1 15 0 --- 14 0 15 1 ... · - ~Bit Number~- CRU Data to CPU - If one or more CRU bit's interrupt requests are low. and the corresponding mask bit is 1. then interrupt priority encoder logic outputs INTREQ low. Simultaneously. the level of the active interrupt request which has highest priority is iden- tified via ICO - IC3. ""iNTf. input to CRU bit 1. has highest priority; INT15. input to CRU bit 15. has lowest priority. The levels at ICO - IC3 are maintained until the interrupt request signal is removed at the external pin. or the interrupt mask bit for the level is reset to O. TMS 9901 PSI DATA INPUT AND OUTPUT You can use CRU 1/0 instructions to input, output, or test external data at CRU bits 16-31. Data is output from the CPU to the TMS 9901 via CRUOUT; it is input from the TMS 9901 to the CPU via CRUIN. Bits are addressed via SO- S4. as we have already described. Following a reset, pins connected to CRU bits 16-31 are in input mode. In this mode. external logic can assert high or low levels at connected pins. in which case one or two CRU bits will be affected: a signal input to PO - P6 will gener- ate data in CRU bits 16-22; if interrupt mode is selected (by a 0 in CRU bit OJ. a signal input to INT?IP15-INT15/P? will 3-78 generate data in two CRU bits, one in the CRU bit range 7-15, the other in CRU bit range 31-23. In interrupt mode. if the CPU inputs data from CRU bits 7-15 or 31-23. then it will input the same data. but in reverse order. This may be illustrated as follows: CRU Bits LI R12,PSI + 7 7 0 STCR Rl,9 8 0196 Loaded into R1 16 9 10 0 11 1 Pins 12 0 13 0 34 4--0 14 33 ~1 15 32 ~1 31 4--0 30 ~1 29 ..--0 28 .--0 LI R12,PSI + 23 27 4--1 23 STCR Rl,9 23 .--1 24 1 0003 Loaded into R1 16 25 0 26 0 27 28 0 29 30 31 0 Note that. as in all CRU transfers, the first CRU bit transferred goes to the least significant bit position of the destination register. As soon as the CPU outputs data to any bit capable of supporting data output. the I/O logic associated with this bit is put into output mode. In this mode, a pin will output a voltage level reflecting data in the corresponding CRU bit. External logic cannot input data to a CRU bit that is in output mode; in fact. driving input currents into an output pin may damage the TMS 9901. Once a CRU bit has been placed in output mode. it remains in output mode until the TMS 9901 is reset. That is to say, you cannot selectively return CRU bits from output mode to input mode. However, you can always read output bits back to the CPU; that is, although external logic must never attempt to input to a pin that is in output mode. the CPU can always read the contents of any 1/0 bit. whether it is an input or an output. You cannot output data via CRU bits 7-15, even though these bits are connected to the same pins as CRU bits 31-23. When you output data to CRU bits 7-15, the data is routed to one of two write-only locations, depending on the con- tents of CRU bit 0: if the select bit is 0, the data goes to interrupt mask bits 7-15; if clock mode is selected (CRU bit contains 1). the data goes to the Clock Load Buffer register (bits 7-14) and RST2 (bit 15). ° In interrupt mode you can input external data from CRU bits 1-6. Once again. you cannot output data via these CRU bit addresses, since any data output will be routed to corresponding interrupt mask bits or Clock Load Buffer bits. 3-79 TMS 9901 REAL-TIME CLOCK LOGIC If you write a 1 into CRU bit 0 of a TMS 9901 device, then CRU bits 1-14 are used as two 14-bit Clock buffers, which may be illustrated as follows: 234 5678910111213 14"-CRUBitNumber CRUOUT ---.1........._........._........._........_. . . . . _. . . .....11........._ ....."'" Clock Load Buffer MSB LSB CRUIN ~ I.... . . ._.a..-............._ ....................._ .................._ ......-...... Clock Read Buffer Besides these two buffers. real-time Clock logic contains a decrementing r,gister which we call the Clock Counter register. The CPU loads the Clock Counter register via the Clock Load Buffer. and reads the Counter contents via the Clock Read Buffer. We illustrate this in the following way: .... CLOCK CRUOUT - ....~ BUFFER REGISTER '< ~ CRU CLOCK INTERFACE COUNTER REGISTE(R "< >' I CLOCK CRUIN - A. ... I READ BUFFER The Clock Counter register decrements continuously as long as the TMS 9901 is powered up. This will cause no problems as long as the clock interrupt is disabled. When you write any non-zero value into the Clock Load Buffer (CRU bits 1-14), the Clock Counter register starts decrementing from that value. A decrement occurs once every 64 pulse which causes the Clock Counter to decrement. • An exit from clock mode. Thus, the Clock Read Buffer register is updated whenever the TMS 9901 leaves clock mode, and every time the Clock Counter decrements outside of clock mode. Beware - even if CRU bit 0 contains a 1, the TMS 9901 will exit clock mode for as long as it sees a 1 on select line SO; this will happen whether or not CE is active. Thus the Clock Read Buffer will not hold the same value indefinitely just because the TMS 9901 select bit is set. The PSI will leave clock mode whenever the CPU reads to or writes from CRU bits 16-31, or if any device accesses a memory address with a 1 on the address line connected to SO (A4 in a TMS 9900 system). The logic c'ontrolling clock mode and the Clock Read Buffer may be illustrated .as follows: DECREMENT CLOCK 7$-----1 +64 COUNTER SELECT BIT (CRU BIT 0) UPDATE CLOCK READ BUFFER SO This logic summarizes our discussion above. There are two important things to note about clock mode and Clock Read Buffer update. First. you cannot inadvertently exit clock mode while you are reading the Clock Read Buffer, since you access it as CRU bits 1-14. Second, you cannot enter clock mode solely by accessing CRU bits 0-15; SO changes clock mode only when the select bit is 1 (clock mode selected). In order to read the most recent Clock Counter value, you must do two things: • Exit clock mode so the Clock Read Buffer will receive the current Clock Counter contents. • Enter clock mode so the Clock Read Buffer will be stable during the read itself. Here is the appropriate instruction sequence: LI R12,PSI+1 LOAD PSI CRU BASE ADDRESS SBZ -1 EXIT CLOCK MODE TO UPDATE READ BUFFER SBO -1 ENTER CLOCK MODE TO STABILIZE READ BUFFER STCR R1,14 READ 14-BIT CLOCK READ BUFFER TMS 9901 RESET LOGIC You can reset a TMS 9901 in one of two ways: 1) By inputting a low signal at RSf"i. 2) By using a programmed reset via RST2, a CRU bit. In order to use RST1, a low level must be input at 'this pin for at least two clock periods. You can reset the TMS 9901 under program control only when clock mode is selected (CRU bit 0 is 0). At this time, writing a 0 to CRU bit 15 (RST2) causes the device to be reset. Thus, the following instruction sequence causes a TMS 9901 device reset: LI R12,PSI LOAD PSI CRU BASE ADDRESS SBO o ENTER CLOCK MODE SBZ 15 RESET PSI When the TMS 9901 is reset. the INTREQ signal is output high, ICO through IC3 are output low, all interrupt requests are disabled, and all I/O CRU bits are placed in input mode. 3-81 THE TMS9902 ASYNCHRONOUS COMMUNICATIONS CONTROLLER The TMS9902 microprocessor family includes two serial I/O parts. The TMS9902 is a simple, asynchronous communications device; the TMS9903 is a more powerful, recently introduced multifunction device. Both of these parts are peculiar to the TMS9900 since they communicate with the CPU via its CRU logic. The two parts are also pin-compatible; that is, the same 20-pin socket can hold either the TMS9902 (an 18-pin part) or the TMS9903. The TMS9902, which we are about to describe, offers asynchronous I/O capabilities comparable with those of parts which we describe in Volume 3. The TMS9902 lacks some features which other parts offer: 1) There are no external clocking signals for received or transmitted data. Receive and transmit rates are computed by logic internal to the TMS9902. 2) There is a single interrupt request which has no accompanying status output lines. Thus interrupt service routines must interrogate status in order to correctly service the interrupt. 3) The TMS9902 has only three Modem control lines and no other lines for handshaking with peripheral logic. One advantage of the TMS9902 is that it occupies very little board space. It is an 18-pin part the smallest serial I/O controller on the market. It requires less surrounding logic because it uses the system clock for its time base, and because it provides almost no external status or handshake lines. Another advantage of the TMS9902, when compared to other serial I/O parts, is the presence of real-time clock logic. Anyone who has worked with serial I/O logic will appreciate the ability to generate interrupt requests at fixed time in- tervals. The TMS9902 is fabricated using NMOS technology. It is packaged as an 18-pin DIP and requires a single +5V power supply. All Signals are TTL-level compatible. TMS9902 ACC PINS AND SIGNAL ASSIGNMENTS TMS9902 pins and signal assignments are illustrated in Figure 3-27. These signal assignments are the same as those of pins 1 through 9 and 12 through 20 of the TMS9903. INT 1 18 VCC (+5V) TxD 2 17 CE RxD 3 16 ~ CRUIN 4 15 CRUCLK RTS 5 TMS9902 14 SO (MSB) CTS 6 13 S1 DSR 7 12 S2 CRUOUT 8 11 S3 VSS (GND) 9 10 S4 (LSB) Pin Name Description Type CRUIN CRU data output to CPU Output CRUOUT CRU data input from CPU Input CRUCLK CRU data strobe Input CE Device select Input SO-S4 CRU bit address Input iii Synchronizing clock Input DSR Data set ready indicator Input m Request to send indicator Output CTS Clear to send indicator Input RxD Serial data in Input TxD Serial data out Output iNT Interrupt request to CPU Output VCC' VSS Power, Ground reference Figure 3-27. TMS9902 Asynchronous Communications Controller Pins and Signal Assignments 3-82 Table 3-9, 'TMS9902 Control and Status Register Bit Interpretations CRU!REGISTER CONTROL REGISTER (WRITE) STATUS REGISTER (READ) BIT NUMBER Device Reset (write 1 or 0) 31 Any interrupt pending' 30 One or more of control bits 17, 14, 13, 12, or 11 set to l' 29 DSR or CTS input level change detected, Reset by writ- ing 1 or 0 to CRU bit 21 , 28 Complement of CTS input level 27 Complement of DSR input level 26 Complement of RTS output level 25 Timer time out', Reset by writing 1 or 0 to CRU bit 20, 24 Timer overrun error', Reset by writing 10r 0 to CRU bit 20, 23 Transmit Shift register empty', Automatic reset, 22 Transmit buffer empty', Reset by writing to high-order Transmit buffer bit. Enable interrupts on DSR or CTS input level change 21 Receive buffer loaded', Reset by writing 1 or 0 to CRU (1 = enable, 0 = disable) bit 18, Enable timer interrupts 20 DSR or CTS input level change interrupt pending', Reset (1 = enable, 0 = disable) by writing 1 or 0 to CRU bit 21, Enable transmitter interrupts 19 Timer interrupt pending', Reset by writing 1 or 0 to CRU (1 = enable, 0 = disable) bit 20, Enable receive interrupts 18 (1 = enable, 0 = disable) Transmit Break 17 Transmit interrupt pending', Reset either by writing 0 to (1 = enable, 0 = disable) CRU bit 19 or by writing to high-order Transmit buffer. bit, Enable transmit I~ 16 Receive interrupt pending', Reset by writing 1 or 0 to (Complement of RTS output) CRU bit 18. Test mode select 15 RxD input level (1 = Test mode, 0 = normal operation) Write to Parameter register 14 Receive start bit detected', Reset automatically at end of received character, Write to Timer register 13 Receive first data bit detected'. Reset automatically at end of received character, Write to Receive Data Rate register 12 Receive framing error detected', Reset automatically by error free received character. Write to Transmit Data Rate register 11 Receive overrun error detected', Reset automatically by error-free received character, 10 Receive parity error detected." Reset automatically by / error-free received character, 9 Any receive error detected." Reset automatically when Status register bits 12, 11, and 10 are all 0, ~ 8 1'1 Receive Data Rate register I I 7 6 I or Transmit Data Rate register Parameter register, I 5 I Timer register, or Transmit buffer 4 > t ~ 3 2 , 1 o I '1 = "true" condition, 0 = "false" condition, 3-83 Signals that connect the TMS9902 to a TMS9900 series microprocessor include the three CRU signals CRUIN. CRUOUT. and CRUCLK. together with device select logic signals CE and SO-S4. The TMS9902 uses these sig- nals exactly as described for the TMS9901. CE must be low for the TMS9902 to be selected; if the TMS9902 is selected. then data transfers occu r via the CRUIN or CRUOUT lines. SO-S4 identify the CRU bit within the selected TMS9902. Table 3-9 summarizes the way in which the TMS9902 assigns its 32 CRU bit addresses for read and write operations. DSR. RTS. and CTS are standard handshaking control signals for communications devices. DSR is a general purpose input signal; its level is reported in Status register bit 27. You can program DSR to generate an interrupt request when it makes a high-to-Iow or low-to-high transition. However. DSR plays no part in enabling either transmit or receive logic. The TMS9902 outputs RTS low while tranSmit logic is enabled. But the transmitter will not actually start transmitting data until CTS is input low. In a standard asynchronous protocol system. TMS9902 transmit logic will output Ri'S low and sometime later receive a low CTS input - at which time it will actually start transmitting data. But if TMS9902 transmit logic finds CTS low when it outputs RTS low. it will start transmitting immediately. For a discussion of Modem handshaking control signals. see Volume 1. Chapter 5. Serial data is input via RxD and output via TxD. External logic does not provide signals that clock the serial input or output data. Instead. the CP synchronizing clock input signal is used to derive data transmit or receive rates. Usually. 3 (the complement of CPU clock <1>3). However. you may use any clock signal that satisfies the timing requirements given in the TMS9902 data sheet at the end of this chapter. TMS9902 DATA TRANSFER AND CONTROL The various addressable locations within the TMS9902 are summarized in Figure 3-28. When you write to CRU bits 31 through 11 you will always access the Control register; when you read these bits you will access the Status register. CRU bits 10 and 9 are also read-only status flags. CRU bits 0 through 7. on a read. always access the Receive buffer; but via CRU bits 0 through 10 you can send data to a variety of write-only locations. The Control register contains four address bits. each of which corresponds to one of the write-only TMS9902 locations. When an address bit is set to 1. the associated write-only register will receive REGISTER data output via CRU bits 0 through 10. If more than one write-only location is selected. then ADDRESSING the select priorities shown in Table 3-10 apply. The Transmit Buffer is selected when all four address bits contain O. If any address bit is set to 1. Status register bit 30 will also contain 1. When you write to the high-order (highest numbered) bit of the Parameter register. the Timer register. or the Receive Rate register. you automatically reset that location's address bit in the Control register. Table 3-10. TMS9902 Write-Only Register Select Scheme CRU Output Bit CRU Bits in Addressed Location Location 14 13 12 11 1 X X X Parameter register 7-0 0 1 X X Timer register 7-0 0 0 1 X· Receive Rate register 10-0 0 0 X· 1 Transmit Rate register 10-0 0 0 0 0 Transmit buffer 7-0 "X" means "does not matter" • If both bits 11 and 1 2 are set to 1, data will be written to both Rate registers at the same time. ----- - Following a device reset. all write-only location address bits in the Control register are TMS9902 DEVICE set to 1. This allows you to write data to registers in the priority order shown in Table 3-10 INITIALIZATION during the device initialization process. without having to reset individual address bits. Thus the initialization process will consist of these steps: 1) Reset the TMS9902 by writing to Control register bit 31. 2) Write to the Parameter register. 3-84 3) Write to the Interval Timer register. 4) Write to the Receive Data Rate and Transmit Data Rate registers. 5) Write to the Control register and Transmit buffer. Transmit Logic CRUOUT CRUIN Transmit TxD CRUCLK Buffer INT CPU Interface Transmit Rate CE Register· SO Logic S1 S2 S3 Status Register S4 Control Register Parameter Register· Receive Rate Register Receive RxD Buffer Receive Logic Timer Logic Figure 3-28. TMS9902 Functional Logic Texas Instruments' literature suggests an initialization instruction sequence such as the following: LI R12.CRUBS INITIALIZE CRU BASE ADDRESS IN R12 SBO 31 RESET COMMAND LDCR @CNTRL.8 LOAD PARAMETER AND RESET BIT 14 LDCR @INTVL.8 LOAD INTERVAL AND RESET BIT 13 LDCR @RDR.11 LOAD RECEIVE RATE AND RESET BIT 12 LDCR @XDR.12 LOAD TRANSMIT RATE AND RESET BIT 11 3-85 In the sequence above, CRUBS represents the base address for the 32 CRU bits in the TMS9902. Fou r memory loca- tions -labeled CNTRL. INTVL. RDR. and XDR - hold the values to be loaded into the write-only locations. Since CRU bit 11 is not reset automatically. the instruction which writes to the Transmit Data Rate register writes 12 bits. the high- order bit being a 0 for CRU bit 11. Let us now examine Control register bits in detail. TMS9902 Control register bits may be divided into interrupt enable/disable bits. write-only location address CONTROL bits. the reset control. and the test mode control. REGISTER The test mode control (bit 15) is usually left at 0: this causes normal operations to occur. When TMS9902 you set the test mode control bit to 1, RTS is internally connected to CTS and RxD is inter- TEST MODE nally connected to TxD. Also. DSR is held low internally and the interval timer operates at 32 times its normal rate. You will operate the TMS9902 in this condition only when testing its logic. You reset the TMS9902 by writing either a 0 or a 1 to Control register bit 31. You will usually begin every event sequence with a Reset. The following instructions constitute TMS9902 resets: LI R12.ACC LI R12.ACC SBO 31 or SBZ 31 ACC is a label identifying CRU bit 0 (the CRU base address) for the TMS9902. When the TMS9902 is reset, the following events occur: 1) All interrupts are disabled. 2) RTS is output high: this is the inactive state for RTS. 3) Control register bits 11. 12. 13. and 14 are set to 1. All other Control register bits are reset to O. The TMS9902 should not be accessed for a minimum of eleven clock cycles following the reset command. There are four interrupt enable control bits. They enable interrupts when set to 1 and disable TMS9902 interrupts when reset to O. INTERRUPT Control bit 21 enables CTS and DSR input signal level change interrupt requests. ENABLE Control bit 20 enables timer time out interrupt requests. Control bit 19 enables Transmit buffer empty interrupt requests. Control bit 18 enables Receive buffer full interrupt requests. In each case a Status register bit is set to identify the condition that can generate an interrupt request. But the interrupt will not actually be requested unless the associated interrupt enable control bit has been set to 1. You acknowledge any interrupt other than a transmitter interrupt by writing to the interrupt's r------. . . . TMS9902 enable control bit. To acknowledge an interrupt and leave it enabled. rewrite a 1 to the inter- INTERRUPT rupt enable control bit. To acknowledge an interrupt and then disable it. write a 0 to the inter- ACKNOWLEDGE rupt enable control bit. But remember. you must write either a 0 or a 1 to the interrupt enable control bit. since this is the mechanism used to reset the status flags that identify the interrupting condition. You acknowledge a transmitter interrupt by writing to bit 7 of the Transmit buffer. If you write a 0 to CRU bit 19. you will disable the interrupt. but you will not reset the status flag which was set by the emptying of the Transmit buffer. Control register bits 16 and 17 directly control two TMS9902 operations. Control register bit 16 is the complement of the RTS output. You must write a 1 to this bit in order to set RTS low. In order to enable transmit logic. RfS must be output low while CTS is being input low. You must leave RTS low while the transmitter is active. To disable the transmitter you raise RTS high again by writing 0 to Control register bit 16: if transmit logic is part way through transmitting a character when you write a 0 to Control register bit 16, then it will complete transmitting the character - and the character in the Transmit buffer. if the buffer is full- before outputting RTS high. Transmit break logic is controlled via Control register bit 17. When you set this bit to 1, a TMS9902 break (continuous low output) will be transmitted following the next underrun (that is, when both BREAK the Transmit register and Transmit buffer are empty). You must end the break by writing a 0 to LOGIC Control register bit 17 before you can restart transmitting by writing new data to the Transmit buffer. If you leave Control register bit 17 reset to 0, then following an underrun the transmitter will mark (output a con- tinuously high signal). You can end the mark at any time. and start transmitting a new message. by writing fresh data to the Transmit buffer. 3-86 When the break control bit is set to 1. Status register bit 30 will also contain a 1. Let us now examine Status register bits; they may be grouped as follows: TMS9902 STATUS 1) Signal level indicators REGISTER 2) Transmit operation status 3) Receive operation status 4) Timer logic 5) Interrupt logic Status register bits 27 and 28 report the complement of the DSR and CTS input signal levels. Bit 26 reports the complement of the RTS output signal level. When the DSR or CTS input changes level, bit 29 is set. You reset bit 29 by writing to Control register bit 21. There are three transmit logic status bits. Bit 22 is set when the Transmit buffer is empty. The TMS9902 bit is reset when you next write data to the Transmit buffer. Bit 23 is set when the Transmit TRANSMITTER Shift register is empty; this is an underrun condition. Following an underrun. a break or a mark STATUS will be transmitted. depending on the level of Control register bit 17. Bit 30 of the Status register contains a 1 if any of the following Control register bits are set to 1: • Bit 17. the break control bit • Bits 14. 13. 12. and 11. the write-only. location address bits Thus Status register bit 30 will be set to 1 whenever Transmit buffer loading is disabled. For receive logic. bit 21 is set when the Receive buffer is full. The CPU resets this bit by writing to TMS9902 bit 18 of the Control register: usually the program will read the contents of the Receive buffer RECEIVER before resetting the flag bit. STATUS RxD, the serial data input line level. is reported at Status register bit 15. The start of each received character is identified by Status register bits 14 and 13. When the start bit has been detected, Status register bit 14 is set. One bit time later, when the first data bit is being detected, Status register bit 13 is set. These two bits remain set until the end of the character. They are reset when the last stop bit has been detected. Framing, overrun, and parity errors are reported by Status register bits 12, 11, and 10, respectively. These error status bits. once set. remain set until an error-free character is loaded into the Receive buffer. If one or more of the three receive error conditions exist, then Status register bit 9 is set. There are two timer status bits. Whenever the timer times out, Status register bit 25 is set to TMS9902 1. This bit must be reset by writing 0 or 1 to Control register bit 20. If you do not do so before the TIMER next time out. then Status register bit 24 will be set, indicating a timer error. The timer error is STATUS also cleared by writing 0 or 1 to Control register bit 20. The four interrupt generating conditions have associated status bits which are set following an interrupt request. If the DSR or CTS input signal changes level, and the interrupt logic has been enabled, then TMS9902 Status register bit 20 is set at the time that an interrupt request is generated. INTERRUPT STATUS If a time out occurs and timer interrupts have been enabled, then Status register bit 19 is set at the time an interrupt request occurs. When the Transmit buffer becomes empty, if transmitter interrupts have been enabled, then Status register bit 17 is set at the time an interrupt request occurs. When the Receive buffer is full, if receive interrupts have been enabled, then Status register bit 16 is set at the time a receiver interrupt request is generated. If one or more of these interrupt requests are active, then Status register bit 31 is set. Interrupt status bits remain set until you reset either the status bit for the interrupting condition. or its interrupt enable bit in the Control register. In most cases. writing to the enable bit resets the status bit. For a Modem signal interrupt you must write to Control register bit 21 in order to acknowledge the interrupt. thus reset- ting the two Status register bits. For a timer interrupt you must write to Control register bit 20 to reset the interrupt. For a Transmit buffer empty interrupt you must write new data to the Transmit buffer in order to acknowledge the inter- rupt: specifically. you must write to bit 7 of the Transmit buffer. 3-87 For a Receive buffer full interrupt. you must write to Control register bit 18 in order to acknowledge the interrupt. Let us now examine Parameter register contents. After resetting the TMS9902, the next step is to identify subsequent operations by loading ap- TMS9902 propriate data into the Parameter register. Parameter register bits are interpreted as follows: PARAMETER REGISTER 6 5 432 o ~BitNo. X Parameter register ~--~--~~~--~~--~~ L{ OO - 5-bit data words 01 - 6-bit data words 10 - 7 -bit data words 11 - 8-bit data words L-_ _ _ _ _ _ _ j 0 - Divide! by 3 to generate ClK 11 - Divide by 4 to generate ClK 00 - No parity bit 01 - No parity bit 10 - Even parity bit 11 - Odd parity bit 00 - Select 11/2 stop bits 01 - Select 2 stop bits 10 - Select 1 stop bit 11 - Select 1 stop bit The options presented by the Parameter register, as illustrated above, are self-evident. with TMS9902 INTERNAL the exception of Parameter register bit 3. This bit is used to generate an internal clock sig- CLOCK SIGNAL !l81. CL~Depending on the setting of Parameter register bit 3, the ClK frequency will be TRANSMIT AND ~/3 or <1>/4. ClK is then used to specify the time interval between bit sampling for serial RECEIVE DATA data input or output. as well as the interval timer rate. The frequency of ClK should not be RATE REGISTERS greater than 1.1 MHz; therefore if is faster than 3.3 MHz, Parameter register bit 3 should be set to 1. After loading appropriate data into the Parameter register, you must load the Transmit and Receive Data Rate registers in order to specify the time interval that will separate bit sampling. Data Rate register contents are interpreted as follows: 10 9 8 6 5 4 3 o 4--BitNo. Transmit or Receive Data Rate register - - - - - - - - - - - Second scale factor (S). Can have any value in the range 1 (000000001) through 1023 (111111111) L - - - - - - - - - - - - - - - - - - - F i r s t scale factor (F). Can be 0 or 1. If F = 0, S should be ~ 4 3-88 The time interval separating serial bits transmitted or received is given by the equation: tClK x 2 x 8 F x S For example. suppose the Receive Data Rate register contains 11000111000. S = 56810 and F = 1: 11000111000 ~ L23816 ~ ~ 56810 S '---------- 1 = F If ClK = $/3. and = 3 MHz. then the serial data transfer rate will be: (1 x 106 ) + (2 x 8 x 568) = 110.04 bits per second If F = O. then the serial data transfer rate becomes: (1 x 106 ) + (2 x 8 x 568) = 880.28 bits per second Table 3-11 shows sample Data Rate register values for standard Baud rates. The assumed frequency produces very precise Baud rates; it is also within the recommended operating range of TMS9900 series parts. Table 3-11. Example of Data Rate Register Contents for Standard Baud Rates Frequency = 3. '!,!8 MHz Frequency ClK = + 3 = 1.066 MHz Data Rate Register Contents Data Rate in Decimal Bits per Second Hexadecimal F S 0 55 037 9600 0 110 06E 4800 0 220 ODC 2400 0 440 1B8 1200 0 880 370 600 1 220 4DC 300 1 440 588 150 1 600 658 110 1 880 770 75 Date Rate = ClK + (2 x 8 F x S) It is not strictly necessary to have data rates as precise as those we have shown in Table 3-11. The devices which receive data from the TMS9902 will determine how precise the transmit rate must be. TMS9902 Receive logic resynchronizes itself with the beginning of each incoming character. It does this by starting its bit-time count at a high-to-Iow transition of RxD. When the TMS9902 has counted half a bit-time. it samples RxD; if the line is still low. Receive logic assumes a valid start bit is present. It then samples the. line at single-bit-time intervals after the first sample point. until a full character has been received: Start Stop bit Character bit ~+ + 'f RxD Middle of start bit is one-half bit time from TMS9902 samples RxD at the middle of each bit this falling edge 3-89 Because of this resynchronization. no skew errors will occur as long as the transmitted bit rate is within 4% of the TMS9902 Receive data rate. TMS9902 TRANSMIT OPERATIONS Let us now examine a serial data transmit event sequence as illustrated in Figure 3-29. .... ~ ~ .~ .!!! Q) a: c: g>:o !!! ~~~ ~~ ~ °~Q.·B~::: c: 0.: .s~]!~ :!: ..Q:!:..Q U OE3l o3l ClIO) VI .0.... "l:I ~ 1CJ)a:~ 8 ~ ~£~ ~~ ~~ Q).... 0) ~ 8 ~.~ 81 8 ~ ~ IE .,-_ _. " AL .LI .. .L.. .. 1.1 -b r Tran:::it Buf:: empty:- I,{-__~----c::::::7+-~\~--- .t= 0 .. ~ II ____ ~ 11-- :a;;data Idle or Break Transmit Register empty, _ ~~ .g ~ \ Break control bit = 0 ~ en u5 One data _______ ~ character \ Move Transmit Buffer contents to Output data to Transmit register Transmit Buffer o 1/ ~~ ~ ____ ____ ~ ~_CJ).o~ B .~ ______ ____ ____ ~ ~ ~ START BIT ." ........ 'V' 0 .... .... .... "l:I en .... :.c Data Character :.c CD :Ell 1/ II ....c: ....c: 0+: '0 .eC') C')N CII CD S~ CII NN .g -.... u C. VI 0+: '2 '2 en:.c 0) 0) VI 'iii .... 'iii ....VI :.c .a CII VI CII 0 ~ .t;: en ~ E CII 0.... Figure 3-29. TMS9902 Character Transmit Event Sequence TMS9902 In this example. all operations will begin with a Reset. Remember. you reset the TMS9902 by writ- SERIAL ing a 0 or 1 to CRU bit 31. TRANSMIT EVENT Next. output appropriate codes to the Control and Parameter registers and enable appropriate in- SEQUENCE terrupts. Output Data Rate register settings. Output the first character to the Transmit Buffer register. 3-90 Transmit logic has now been initialized. You begin actual data transmission by setting RTS low. An appropriate in- itialization instruction sequence was given earlier. Setting Ri'S low enables transmit logic within the TMS9902. but actual data transmission does not begin until external logic inputs CTS low. If CTS is already low when RTS is reset low. then data transmission will begin as soon as RTS is output low. When a character is transmitted. the Transmit buffer contents are moved to the Transmit register. at which time Status register bit 22 is set. If transmit interrupt logic has been enabled. an interrupt request will occur at this time and Status register bit 17 will be set. The character is transmitted as illustrated in Figure 3-29; options are specified in the Parameter register. As soon as the character's stop bit (or bits) has been transmitted. transmission of the next data character begins. provided the CPU has by this time loaded the next data character into the Transmit buffer. The CPU will normally have plenty of time to reload the Transmit buffer. since it takes a long time. in terms of instruction execution times. to transmit a character. Note that you must write to bit 7 of the Transmit buffer in order to reset the Transmit buffer empty flag. Thus even though the character length is less than 8 bits. you will always write 8 bits to the Transmit buffer. You right-adjust Transmit buffer characters; that is. bit 0 of the Transmit buffer is always the least Significant bit of the character. If transmit interrupts have been enabled. an interrupt request will occur when Status register bit 22 is set. The CPU will respond to the interrupt request by interrogating Status register bits to identify the nature of the interrupt. Upon detecting a 1 in bit 17. the CPU will output another data character. If transmit interrupt logic has not been enabled. then the CPU must periodically poll the Status register and output the next data character upon detecting bit 22 set to 1. If the Transmit buffer is empty at the end of a data character transfer, then the TMS9902 may transmit a Break (if Control register bit 17 is 1), or it may terminate operations and go into an idle state (if Control register bit 17 is 0). The TMS9902 will transmit a Break if CTS is still low and Control register bit 17 is high. A Break is a continuous low level output via TxD. External logic interprets a Break as a signal indicating temporary suspension of data transfer. Break logic inhibits data transfers to the Transmit buffer. You must terminate a Break by resetting Control register bit 17 to O. then loading the next data character into the Transmit buffer. TMS9902 transmit logic will enter an idle state if CTS is input high by external logic or if CTS is input low. but no new data is ready to transmit and break logic is off. During this idle state TxD will be held high (marking). The level of the RTS output is not affected by a change in the m input level. If CTS goes high during a transmit operation a~ou leave RTS output low. then as soon as CTS goes low again the transmitter will be re-enabled; but if you output RTS high by writing 0 to Control register bit 16. then the CTS input will be ignored. In order to re-enable transmit logic you must output 1 to Control register bit 16. again setting RTS low. If CTS is low at this time. transmission will begin immediately; otherwise. transmission will begin as soon as CTS is input low - after RTS has again been output low. This may be illustrated as follows: Disable transmit --~-Enable Start logic; stop transmit transmitting Disable transmitting logic; start transmit at end of character. transmitting logic again Stop transmitting at end of character 3-91 r- ! e UI ::I ~ 0- o ::-:' .... II) Status register bits 21. 14. and r RESET (; n CD <" :r \ 13 all = 0 CD .." \ cO· 0- t: CQ Output Control register and ro Interrupt Enable register ?S" w ." W Status register settings c" Least significant bit Ou~put 9 bit 13 = 1 e -i \ 1____ both. Data Rate (; ~ . - register settmgs W en fA (0 (0 otv \ L (Send "Receive logic . . Ready" signal) o cUI () w ~ :J" Q) Ql (") \ ;.... CD po.) ~ :JJ Most significant bit \ til .... ~ CD ~ CD :l] (") 00 CD CD '3"::;, 0 (; <. ~ CD II) a. !!!. < 2 CD m Parity bit, if specified ~~ CD ~" ~ a. < CD Q) Q) i» CD ~ < en CD .0 ~StoPbUISI / CD .... ::I t: / til CD :::J (") CD Status register _ 0 . 13 both - bits 14 and -» C/) aJ --i ~~" o;-~ ~ :l] CD !!!. ~ ~ iii. 0 / -- a: !e CD ::I n I.-< !II --i:1] CD --i • 0:1] Status bit Q / CD 0 CD 21 = 1 ~ ~!. !:tI ~~(i Q r-::aooot Om~ G)(")fI) C:;!!!U) t__ 1.... 11 ---.. I 1 ....._ _ _ _ _ _..... ~..... -, Transmit Buffer Parameter Register Sync1 Register Sync2 Register Timer register Receive CRC Transmit CRC 3-95 .........- - TxC Transmit Logic ~-~ RTS 14o--m Transmit CRC CRUOUT CRUIN Transmit Buffer TxO CRUCLK INT CPU iP Interface Status Register CE Logic SO 51 Control Register 52 53 54 Parameter Register Sync1 Register Sync2 Register Receive Buffer RxO Received SOLC Check Character Receive CRC ....1 - - - RxC Receive Logic Timer Logic Figure 3-31. TMS9903 Synchronous Communications Controller -Functional Logic As illustrated above, there are three cyclical redundancy check characters which can be read from the TMS9903. Transmit and receive logic each compute a cyclical redundancy character (under program con troll for transmitted and received messages. In SOLe mode only, the cyclical redundancy character for a received frame is isolated by receive logic and held in a register out of which it can be read. 3-96 We will describe programming aspects of cyclical redundancy characters in more detail as the discussion of the TMS9903 proceeds. Transmit and receive logic are each buffered. Data is m9ved from the Transmit buffer to the Transmit Shift register, whence it is output serially via TxD. You have one character transmit time within which to write another character to the Transmit buffer, otherwise an underrun will occur. Characters are assembled by receive logic in the Receive Shift register: when assembled, they are transferred to the Receive buffer. You have one character receive time within which to read the contents of the Receive buffer, or else a receive overrun will occur. Data buffers within the TMS9903 are all nine bits wide; this gives you the option of appending a parity bit to any 8-bit character. The Status register is 23 bits wide, the Control register is 20 bits wide, and the Parameter register is 12 bits wide: these odd bit lengths cause no problems due to the nature of the CRU interface between the TMS9903 and the TMS9900 series microprocessor. The Sync1 and Sync2 registers hold Sync characters; in certain protocols these two registers may hold special control characters. Transmit logic may output the contents of one or both of these registers at the beginning of a message and following an underrun. Receive logic uses the contents of the Syncl register to detect Sync characters in a received data stream. You specify the number of data bits per character for received data via Parameter register bit settings. When receive logic is assembling characters in the Receive Shift register, it uses the bits-per-character specification that was in effect when the current character started to be assembled. If you change the bits-per-character specifica- tion, the change will be recognized on the next receive character boundary. The bits-per-character specification that you make in the Parameter register does not apply to transmit logic or the Sync1 and Sync2 registers. For these three registers the number of data bits you write into the register defines the number of data bits which will be transmitted. The most recently loaded Sync register determines the character length for transmission of both Sync characters. For example, if you output 6-bit characters to these three registers, then 6-bit characters are assumed by transmit logic. Likewise, if you output 9-bit characters, then transmit logic will subsequently assume 9-bit Syncl and Sync2 charac- ters. Sync1 and Sync2 registers should have the same bits-per-character specifications. However, you could, for example, output a 7-bit character to Syncl and then a 5-bit character to Sync2. If you did, the device would transmit just the lower five bits of Syncl and Sync2. You could still specify 7-bit characters to receive logic: each received character would be compared to all seven bits of Sync1. The Sync character bit length need not be the same as the bits-per'- character specification in the Parameter register or even the number of bits specified by loading the Transmit buffer. As with the Receiver, you can change the Transmit character length from character to character. As each character is shifted from the Transmit buffer to the Transmit Shift register, transmit logic attaches the bits-per-character specifica- tion to the data in the Transmit Shift register. Therefore if you subsequently change the number of bits per transmit character - namely, by loading a different-sized word into the Transmit buffer - it has no effect on the character already in the Transmit Shift register. Although Texas Instruments literature describes the TMS9903 as supporting six different modes, in fact it supports three: Asynchronous, Synchronous, and SOLC/HOLC. Asynchronous and Synchronous mode capabilities are quite standard. In Synchronous mode you can approximate IBM standard Monosync or Bisync protocols. Asynchronous mode is well suited to RS-232C and RS-449 EIA standard protocols. The TMS9903 can be operated in a point-to-point SDLC or HDLC system: also, SDLC loop mode is supported. The TMS9903, like the TMS9902, has on-chip timer logic. TMS9903 PINS AND SIGNALS TMS9903 pins and signals are illustrated in Figure 3-32. Pins 1 through 9 and 12 through 20 are functionally equivalent to TMS9902 pins 1 through 18. On its CPU interface the TMS9903 has the same standard TMS9900 Signals as the TMS9901 and TMS9903 CPU the TMS9902. These include: INTERFACE SIGNALS 1) The threestandard CRU signals: CRUIN, CRUOUT. and CRUCLK. 2) Five select lines (SO-S4) that address a 32-bit CRU field. 3-97 3) CEo an enable signal which must be low for the CPU interface to be enabled. 4) An input clock signal. normally connected to the TIM9904 ~3 clock. Refer to our earlier discussion of the TMS9901 for a description of CPU interfacing logic. INT 1 20 VCC (+5V) TxD 2 19 et RxD 3 18 System clock Input iNf Interrupt request to CPU Output Vce. VSS Power. ground reference Figure 3-32. TMS9903 Synchronous Communications Controller Pins and Signal Assignments Let us now examine transmit and receive logic signals. TMS9903 Serial data is output by transmit logic via TxD, as clocked by TxC. Data is transmitted on SERIAL 1/0 high-to-Iow transitions of"f'X'C. SIGNALS RTS and CTS are two Modem control signals associated with transmit logic. In order to transmit data you must input CTS low while transmit logic is enabled. You have the option of connecting Ri'S to transmit enable logic. If you do. RTS will be output low while transmit logic is enabled and it will be output high while transmit logic is disabled. You also have the option of selecting the RTS output level under program control. in which case RTS is disconnected from transmit enable logic. Receive logic receives data via RxD as clocked by RxC. Data is sampled on low-to-high transitions of RxC. DSR is shown in Figure 3-31 as a receive logic Modem input signal; in reality it is an unassigned input control sig- nal. The DSR signal level is reported in a Status register bit. and can generate an interrupt whenever it changes state. DSR does not contribute to receive enable logic. TMS9903 PROGRAMMABLE REGISTERS The two principal programmable registers of the TMS9903 are the Control and Status registers. We refer to these as "principal" registers because they are automatically accessed by high numbered CRU bits on any CRU access. Low numbered CRU bits transfer data to or from a variety of addressable locations. as specified by Control register bit settings. 3-98 Table 3-12. TMS9903 Synchronous Communications Controller CRU Bit Assignments When Writing to the TMS9903 MODE ... a:: iii~ C.) z C.) C.) =>~ > Z ..J a::=> U) > Q c.)z c( U) U) FUNCTION 31 X X X 1 or 0 = Reset device. 30 X X X 1 = Clear transmitter. 0 = Clear receiver. (In each case interrupts are disabled!' 29 X X X 1 = Clear transmit CRC register. 0 = Clear receive CRC register. (CRC register is reset to 0). 28 X 1 = Delete received Syncl characters (in Bisync mode only). X 1 = Inhibit transmit logic's zero bit insertion. 27 X X 1 = Load data at CRU bits 0 - 9 into Sync2 register. 26 X 1 = Load data at CRU bits 0 - 9 into Sync1 register (only for versions of Synchronous mode that use Sync1 register). X 1 = Read received check character via CRU bits 0 - 1 5. 0= Reset Status register CRU bits 13 (Check Character Buffer full), 12 (Check Character overrun) and 10 (Zero insert detect error). 25 X X X 1 = Load data output to CRU bits 0 - 8 into Transmit buffer, and update the transmit CRC. Select the transmit eRC to be read via CRU bits 0 - 15. 0= Reset Status register bits 22 and 17 .. 24 X X X 1 = Update the transmit CRC with the next output to CRU bits 0 - 9. Read transmit CRC at CRU bits 0 - 15. 23 X 1 = Transmit break (low level output) during underrun. Reset this bit to 0 before loading new data into Transmit buffer to end underrun. Cf X Specify synchronous modes' underrun options. (See text)(General and Bisync only). (C (C X 1 = Transmit Sync2 register contents following an underrun. (Typically 7F16 for an HDlC abort). X X 0= Abort transmit following an underrun and set Status register bit 23. (General only). 22 X X 1 = Enable abort interrupt and reset Status register bits 23 and 18. (General only!. o = Disable abort interrupt and reset Status register bits 23 and 18. (General only). 21 X X X 1 = Enable data set change interrupts and reset Status register bits 29 and 20. o = Disable data set change interrupts and reset Status register bits 29 and 20. 20 X X X 1 = Enable timer interrupts and reset Status register bits 25, 24 and 19. o = Disable timer interrupts and reset Status register bits 25, 24 and 19. 19 X X X 1 = Enable Transmit buffer empty interrupts. o = Disable Transmit buffer empty interrupts. 18 X X 1 = Enable Receive buffer full interrupts and reset Status register bits 21 and 11. o = Disable Receive buffer full interrupts and reset Status register bits 21 and 11. X 1 = Enable Receive buffer full, Received Check Character buffer full and received abort interrupts. Reset Status register bits 21, 14, 11 and 9. 0= Disable interrupts listed abov!J:!.eset Status register bits22.: 14, 11 and 9. 17 X X X o or 1 = Output complement via RTS and disable automatic RTS control logic. 16 X X X 1 = Enable transmitter logic. o = Disable transmitter logic after transmitting available data. 15 X X X 1 = Test mode. 0 = Normal operation. 14 X X X 1 = load data at CRU bits 0 - 11 into Control register. 13 X X X 1 = Load data at CRU bits 0 - 7 into Timer register. o = Move Timer register contents to timer and start timer. 12 X X X 1 = Update the Receive CRC with the next output to CRU bits 0 - 9. Read Receive CRC at CRU bits 0 - 15. Let us begin by examining the Control register; bit interpretations are defined in Table TMS9903 3-12. CONTROL REGISTER When you write to a TMS9903, CRU bits 31 through 12 will always access the Control register. Control register bits may be divided into the following groups: Device reset Register select • Variations within mode specifications - which are made in the Parameter register Interrupt enable/disable Direct device control In most cases. when you set or reset a TMS9903 Control register bit. this bit setting - and TMS9903 its associated logic - remains in effect until you specifically change the bit setting. When REGISTER setting a bit to select a data register. be sure to reset any select bits that were previously SELECT set. If two or more register select bits are set simultaneously. you will receive no error message. but the device will probably malfunction. Let us now examine Control register bits by group. There are three device reset CPU bits: 31. 30. and 29. When you write a 0 or a 1 to CRU bit 31. the entire device is reset; all interrupts are disabled TMS9903 and all flags and register select bits are reset to 0 (with the exception of Control register bit 14 DEVICE and Status register bit 22. which are set to 1). This causes the first data to be loaded into the RESET Parameter register, while a transmit buffer empty condition is reported in the Status register. After resetting the TMS9903 by writing a 1 or 0 to CRU bit 31 and loading the TMS9903 Parameter register (CRU bits 0 to 11). you must next clear the transmitter and INITIALIZE receiver by writing a 1 and then a 0 to CRU bit 30. (It does not matter whether you clear TRANSMIT/ transmitter or receiver logic first so long as you do clear each set of logic before attempting RECEIVE to use it.) You must also initialize CRC accumulation logic at the transmitter and the INITIALIZE receiver by writing 1 and then 0 to CRU bit 29. CRC In summary. the following steps are required to reset and initialize a TMS9903: 1) Write 1 or 0 to CRU bit 31. This resets the entire device and enables loading of the Parameter register. 2) Load the Parameter register (CRU bits 0-11l. establishing the operating mode and configuration. 3) Write 11 to CRU bits 30 and 29. This initializes the transmitter and transmitter CRC logic. 4) Write 00 to CRUbits 30 and 29. This resets the receiver and receive CRC logic. (Note that when you write to CRU bits 31, 30, and 29, you will always access Control register bits 30, 31, and 29; only CRU bits 0-11 have multiple destinations within the TMS9903.l After resetting the TMS9903 and initializing transmit/receive logic, you will next select addressable locations to read from or write to. Selecting the data location from which you will read is straightforward. Normally, CRU bits 0-8 TMS9903 will contain the Receive buffer contents, while CRU bits 9-31 are taken from the Status register. READ But you can also read one of three 16-bit CRC characters. We may illustrate TMS9903 register ad- REGISTER dressing during a CPU read as follows: ADDRESSING ! ,._---------_- , . - - - - - - - - - - - - - - - - - - - - - - - - - - - From Status register Computed CRC for received message (Control register bit 12 = 1) /..-___-'A....._ ....- -....., " , . - - - - - _...~ .....-------~ Received CRC for received 3130· • ·17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 SOLC frame (Control register IIIII IIIIIIIII IIIIIIIIII ~i:~:u~e~)CRC for transmitted ....~--- '1 T . . .T ~------- ,,/ message (Control register bit 24 or 25 = 1) Otherwise: From Receive buffer From Status register 3-100 Note carefully that in SDLC mode you can read two receive cyclical redundancy check characters: the first is computed under program control by receive logic for the received frame; the second is received at the end of the frame. The final 16 bits of the information field are the received 'cyclical redundancy character. To read the received cyclical redundancy character. set Control register bit 26 to 1. To read the cyclical redundancy character computed by receive logic for the received frame. set Control register bit 12 to 1. These two cyclical redundancy characters will be identical if a valid message was received. In Synchronous and Asynchronous modes there is no defined end-of-message. Rather. a control character in the received data stream is interpreted as an end-of-message indicator. in which case two previously received data charac- ters are interpreted as the received cyclical redundancy character. Your program logic must compare the two data characters which are being interpreted as the received CRC character with the computed check character. read from receive logic after setting Control register bit 12 to 1. When the CPU reads from the TMS9903. if Control register bits 12. 24. 25. and 26 are all reset to O. then as the default case CRU bits 0-8 are taken from the Receive buffer; higher numbered CRU bits are taken from the Status register. as always. When writing to the TMS9903. Control register address bits used to select a data location TMS9903 for the low numbered CRU bits may be illustrated as follows: WRITE REGISTER ADDRESSING 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 Ixlxlxlxl Ixlxlxl II 1 T t Control Register Control Register Bits Sync2 register (up to 1 0 bits) Sync 1 register (up to 10 bits) Transmit buffer (9 bits) (also default location) Transmit CRC register (up to 10 bits) Parameter register (12 bits) Timer register (8 bits) Receive CRC register (up to 10 bits) High numbered CRU bits always go to the Control register. Low numbered bits go to the write location whose register select bit within the Control register is 1. Following a reset. Control register bit 14 is set to 1. therefore data written to CRU bits 0-11 loads the Parameter register. When you write into the high-order Parameter register bit (bit 11). Control register bit 14 is automatically reset. But this is an exception. When you set any other register select bit in the Control register it remains set until you specifically reset it. If the Parameter register select bit (Control register bit 14) is set and you want to write to another addressable location. then you must reset Control register bit 14 to 0 when setting another select bit to 1. If all select bits in the Control register are O. then as a default case data will be written to the Transmit buffer. 3-101 You can only write into the Sync2 register in Synchronous or SOLC modes. You can only write into the Sync1 register in Synchronous mode - and only in those variations of Synchronous mode that use the Sync1 register. Variations of Synchronous mode are described later. There are two Control register bits, 28 and 23, which you use to specify variations of mode specifications. We wi" describe these two bits together with Parameter register bit settings, since Control register bits 23 and 28 are logica"y extensions of the Parameter register. Five conditions capable of requesting interrupts have separate enable bits; these are Con- TMS9903 trol register bits 22 through 18. When you write a 1 to any of these Control register bits. the INTERRUPT associated interrupt logic is enabled; when you write a 0 to that Control register bit. interrupt ENABLE/DISABLE logic is disabled. In most cases. when you write a 0 or a 1 to an enable/disable bit. you reset any associated Status register bits. Exceptions are the Transmit buffer empty status and the Received CRC register full. We will discuss individual interrupts in more detail later when looking at TMS9903 interrupt logic in general. Direct device control bits consist of transmitter control and receiver controls. Looking first at the transmitter. you must enable transmit logic, after clearing it, by setting TMS9903 Control register bit 16 to 1; transmit logic remains enabled until you reset this bit to O. Transmit TRANSMIT logic will not disable itself in the middle of transmitting a character; if you write a 0 to Control CONTROLS register bit 16 part way through a character's transmission. the character will be transmitted and transmit logic will then be disabled. If you never write to Control register bit 17 following a reset, then the RTS output signal level is automatically controlled by transmitter logic. As soon as you enable transmitter logic by writing a 1 to Control register bit 16. RTS is output low; RTS remains low until you disable transmitter logic by writing a 0 to Contro~ister bit 16. But if you !!!! write to Control register bit 17, you immediately disable the automatic control of the RTS output level. Now the RTS output level becomes the reciprocal of Control register bit 17. There are two ways in which you can include transmitted characters in any cyclical redundancy character com- putation. If you select the Transmit buffer by setting Control register bit 25 to 1. then the character which you write to the Transmit buffer is also included in the transmit cyclical redundancy character computation. If you select the Transmit buffer as the default write location (j.e .. no address bits in the Control register are set to 1). then the character which you write to the Transmit buffer will not be included in the transmit cyclical redundancy character computation unless you set Control register bit 24 to 1 and then output the character to Transmit CRC logic. That is. using bit 24 of the Control register you can write to either the Transmit buffer or to Transmit CRC logic. but not to both at the same time. When a large sequence of contiguous characters is to be included in the transmit cyclical redundancy character computation, use Control register bit 25. When characters are to be selectively included and excluded in the transmit cyclical redundancy character com- putation, use Control register bit 24. There is no receiver enable control equivalent to the transmitter enable (Control register bit 16). As TMS9903 soon as you clear receive logic. it is enabled and will begin to sample data arriving via RxO. As RECEIVE CRC each character is assembled. it is transferred to the Receive buffer. If a received character is to be included in the computed receive cyclical redundancy character. program logic must output that character to Receive CRC logic after reading it from the Receive buffer. When you set Control register bit 12. data output to CRU bits 0-9 will go to Receive CRC logic. Note that CRC logic is not necessarily connected to the transmitter or receiver. The cyclical redundancy calculation registers may be used independently of transmit or receive logic. The Test mode bit (Control register bit 15) is normally left reset to O. When you set this bit TMS9903 to 1 the following connections occur: TEST MODE 1) TxD is connected to RxO. 2) RTS is connected to CTS. and DSR is held low. 3) TxC and RxC are both connected to the timer logic clock. which operates at 32 times its normal rate. This is similar to TMS9902 Test mode. with the exception that. in the TMS9903. the timer determines Receive and Transmit data rates in Test mode. 3-102 We will next describe the Parameter register. You will normally write into this register once TMS9903 during any operation in order to define operating modes and options within these modes. PARAMETER After resetting the TMS9903 by writing to CRU bit 31. you simply output the parameter code to REGISTER CRU bits 0-11. Resetting the device automatically selects the Parameter register as the write loca- tion for the data at CRU bits 0-11. You could also select the Parameter register by writing Os to CRU bits 27. 26. 25. 24. 13. and 12. and writing a 1 to CRU bit 14. Parameter register contents are interpreted as follows: 11 10 9 8 65432 o 4 - - CRU Bit ~~~~~Io......._ ...I_. . . . . . .Io...""~""'''''''_'''''''''''1..-- Parameter register ~~~L{ o 0 0 - 5 bits/character o 0 1 - 6 bits/character o 1 0 - 7 bits/character o 1 1 - 8 bits/character 1 0 0 - 9 bits/character 0 - Divide (j) by 3 to generate timer clock .....- - - - - - - - - - { 1 - Divide by 4 to generate timer clock Non-SOLC SOLC 0 0 - No parity Point-to-point o 1 - No parity Loop master "-------------- 1 0 - Even parity Loop slave - inactive { 1 1 - Odd parity Loop slave - active o 0 0 - Synchronous - general 001 - SOLC o 1 0 - Monosync o 1 1 - Bisync 1 0 0 - Unassigned 1 0 1 - Asynchronous with two stop bits 1 1 0 - Asynchronous with one stop bit 1 1 1 - Unassigned 0 0 - CRC-16 (X 16 + X 15 + X2 + 1) 01 -CRCC-12 (X12 + X11 + X3 + X2 + X + 1) L-___________________ { 1 0 - Revised CRCC-16 (X16 + X14 + X + 1) 11 -CRC-CCIT (X16 + x12 + X5 + 1) 0 - Transmit/receive at input clock rate .....- - - - - - - - - - - - - - - - - - - - - - - { 1 - Transmit/receive at input clock rate -7- 32. and use zero-complementing NRZI encoding. Parameter register bits 6, 7, and 8 determine the operating mode for transmit and receive logic, and some op- tions within the selected mode. When you select Asynchronous mode, you also select either one or two stop bits. In Asynchronous mode, when you set Control register bit 23 to 1, then as soon as an un- TMS9903 derrun occurs transmit logic will output a continuous low level (break) on TxO. But note ASYNCHRONOUS carefully that setting Control register bit 23 to 1 does nothing until an underrun occurs. Once BREAK LOGIC an underrun does occur. you cannot load new data into the Transmit buffer until you reset Control register bit 23 to 0 to end the break. If Control register bit 23 is reset to O. then following an underrun a continuous high signal is output via TxD. You can at any time r'estart transmission by loading data into the Transmit buffer - in which case the high level output at TxD ends and the next character is transmitted according to the Asynchronous protocol options specified in the Parameter register. There are three Synchronous mode options and one SOLC mode option. These four options share Sync character logic, as shown in Table 3-13. This table applies to transmit and receive logic. Let us first consider SOLC transmit logic. 3-103 Table 3-13. TMS9903 Synchronous and SOLC Mode Sync Character and Underrun Options Parameter Underrun Fill Character Register SYNC CRU Bit MODE Character Control Register Control Register 8 7 6 CRU Bit 23 = 0 CRU Bit 23 = 1 0 0 0 Synchronous- None Abort [SYNC2] General 0 0 1 SDLC 7E16 Abort [SYNC2] 0 1 0 Synchronous- [SYNC1] [SYNC2] [SYNC2] Monosync 0 1 1 Synchronous- [SYNC 11 - [SYNC2] [SYNC 1] - [SYNC 11 [SYNC21 - [SYNC 11 Bisync [] Means: "contents of register named within brackets" Every frame must begin with a flag character, therefore 7E 16 is always output as the leading Sync TMS9903 character. You will subsequently reset Control register bit 23 to 0, since underruns are not allowed SOLC within an SOLC frame. Should an underrun occur, the transmitter will abort. outputting a con- TRANSMIT tinuous high signal and setting appropriate status bits. In order to transmit a valid end-of- OPERATION message, you must read the computed transmit check character (selected via Control register bit 24 or 25). set Control register bit 23 to 1, load a flag (7E 16) character into the Sync2 register, and output the computed transmit check character as two data bytes. Now allow an underrun to occur; the contents will be output when the un- derrun occurs. Since Sync2 contains a flag character, you will have terminated the frame by transmitting the message check character and closing flag, as required by SOLC protocol. There is another way of ending a frame's transmission. Instead of allowing an underrun and outputting the frame's closing flag from the Sync2 register, you can suppress SOLe 0 insertion by writing a 1 to Control register bit 28, then outputting the clOSing flag (or flags) as a simple se- quence of 8-bit data characters. If you are operating the TMS9903 using HOLC protocol. then you must output 7F16 as your TMS9903 abort character. To obtain a valid HOLC abort following a transmit underrun you should write HOLC ABORT the HOLC abort character to the Sync2 register, then leave Control register bit 23 set to 1 while the frame is being transmitted. Now if an underrun occurs, an HOLC abort character will be output from the Sync2 register. When detecting a new frame, SDLC receive logic synchronizes itself on flag character 7E16, TMS9903 which is also the specified Sync character. Consequently the setting of Control register bit 23 SOLC and the underrun fill character options shown in Table 3-13 do not apply. When receive logic RECEIVE detects another flag character, it assumes it has received the frame's closing flag. SOLC receive LOGIC logic can a Iso detect an abort. SOLC receive logic sets appropriate status flags and generates an interrupt request. if enabled. The three Synchronous modes shown in Table· 3-13, together with their underrun fill character options, allow you (under program control) to emulate any of the synchronous protocol options commonly encountered. External synchronization uses no leading Sync characters at the head of a message. You can TMS9103 emulate this protocol by choosing the general synchronous option. EXTERNAL SYNC LOGIC ForTMS9903 transmit logic, make sure that CTS is low before you enable the transmitter; then as soon as RTS goes low, message transmission begins. A station that receives this transmitted message can use the low RTS output as its external Sync input. TMS9903 receive logic will use the OSR Modem input as its external synchronization signal. The station which transmits the signal to the TMS9903 must generate a low OSR input just before it starts transmitting a message. The program controlling TMS9903 receive logic must detect the low '[5'S'R' input by interrogating the appropriate Status register bit. and upon detecting OSR active should start receiving. 3-104 In Monosync mode a single Sync character occurs at the head of a new message. In Bisync mode two Sync characters occur at the head of a new message. Both of these options are allowed. The Monosync mode outputs the contents of the Sync1 register at the head of a transmitted TMS9903 message and synchronizes on a received message by matching received characters against the MONOSYNC contents of the Sync1 register. lOGIC In Bisync mode Sync1 contents are output twice at the head of a transmitted message. BISYNC Receive logic assumes that a new message has been detected when two contiguous characters lOGIC match the contents of the Sync1 register. By loading appropriate data into the Sync1 and Sync2 registers you can transmit and detect ASCII. EBCDIC. or any other Sync characters. When an underrun occurs in Monosync mode. a single Sync character is output. By loading the appropriate character into the Sync2 register you can transmit and detect any underrun fill character. In the Bisync option greater underrun flexibility is needed. In some cases. following any underrun two Sync characters are transmitted; but in standard Bisync protocol DLE-SYN character combinations are output following an underrun. When Control register bit 23 equals 0 the TMS9903 will output two Sync characters from the Sync1 register. To meet the requirements of Bisync protocol you load the DLE character into the Sync2 register. load the SYN character into the Sync1 register. and leave Control register bit 23 set to 1. Other bisync logic (in particular. the generation and detection of special control character combinations) must be handled by a supervisory program. Control register bit 28 adds some flexibility to the options shown in Table 3-13. However. this control bit applies only to SOLC and Bisync modes. In SDLC mode, when Control register bit 28 is reset to O. TMS9903 transmitter logic will insert a 0 after every five consecutive 1s transmitted. Setting Control bit 28 to 1 inhibits this zero bit insertion in SOLC mode. In Bisync mode. when Control register bit 28 is set to 1 any received character that matches TMS9903 the contents of the Sync1 register is discarded. This allows you to strip received underrun SYNC STRIP Sync characters. Parameter register bits 5 and 4 serve different functions in Synchronous and SOlC modes. ,..-----, In Synchronous and Asynchronous modes Parameter register bits 5 and 4 are used to TMS9903 specify odd parity, even parity, or no parity. When parity is specified. parity bits will automat- PARITY ically be generated for data characters that are transmitted and will be tested for data characters OPTIONS received. But parity does not apply to the contents of the Sync1 or Sync2 registers. You must add your own parity bit to the contents of these registers if you want to transmit Sync characters with parity. The Sync registers are each ten bits wide so that you can add one parity bit to the longest specifiable character (nine bits). Receive logic will automatically check the parity of received Sync characters. since received logic treats all receive characters as data. InSOlC mode, Parameter register bits 5 and 4 specify Loop or Non-loop mode; in fact. they TMS9903 SOlC specify the way in which an EOP character (7F 16) is handled. CONFIGURATIONS In a point-to-point configuration the EOP character has no significance. and is ignored. As a loop master. transmit logic pays no attention to the EOP character; however. receive logic treats the EOP character as a frame's closing flag. This is necessary. since the polling EOP character which a loop master transmits around the loop will eventually be received as the closing flag for the last frame transmitted by a loop secondary. The loop slave inactive mode is selected for an SOlC loop secondary that is not transmitting data, but may be receiving data. The loop slave active mode, in contrast, is selected for a secondary station in the SOlC loop that wishes to transmit to the primary station. In loop slave inactive mode, a TMS9903 will initially retransmit received data without delay. But. upon detecting an EOP character in the received stream, the TMS9903 will introduce one bit delay before retransmitting received data. So long as you never electrically disconnect a secondary station in an SOLC loop. the inactive slave mode will take care of timing and protocol requirements of a secondary loop station coming on-line. But if you wish to electrically disconnect 3-105 a TMS9903 secondary station in an SOLC loop. you will require external logic which detours upstream data around the electrically disconnected secondary. while breaking the detour and including the secondary when it is electrically con- nected. Here is the appropriate logic: Up-loop data ----....-------------------1 RxD Down-loop data IN LOOP - - - - - -.....-cJI TxD------------------------~ You will normally leave a TMS9903 operating in loop slave active mode if it is functioning as a secondary station in an SOLC loop. You will only switch to loop slave inactive mode when the secondary station has just entered the loop and is not yet synchronized (has not received EOP). In the loop slave active mode. TMS9903 receive logic will seek the next EOP character. Upon receiving an EOP character it will convert this character to a flag. which becomes the opening flag for the frame which the station wishes to transmit to the primary. So long as a TMS9903 is left operating in loop slave active mode, it will continue to trap receive EOP characters and transmit frames behind them. When a TMS9903 has no further frames to transmit. you should leave it in loop slave active mode. but turn off the transmitter by resetting Control register bit 16 to O. For a discussion of SDLC loop secondary station logic see Chapter C1 in Volume 3. Parameter register bits 0, 1, and 2 allow you to specify 5,6, 7, 8, or 9 data bits per received TMS9903 character. Note that if parity is enabled. the parity bit is not counted in this specification. RECEIVED CHARACTER If Sync and control characters are eight bits wide, then you cannot specify less than 8-bit SIZE characters in Synchronous mode. This is because receive logic does not automatically switch from the specified bits per character to eight bits per character when receiving Sync or control characters. Moreover. a program controlling receive logic cannot make this switch. since it does not know it has received a Sync or special control character until the character is in the Receive buffer - by which time it is too late to make a change. Parameter register bit 11 allows you to transmit and receive data at the transmit and TMS9903 CLOCK receive clock rates, or at these clock rates divided by 32. This is normally a standard Syn- RATE OPTION chronous mode option. With the TMS9903 it is available in all modes: Synchronous. SOLC. NRZI SELECT and Asynchronous. This bit should be reset to 0 during operation as an SDLC loop slave. During synchronous or SDLC operation, if data is being sampled on every 32nd clock pulse (Parameter register bit 11 is 1) then NRZI encoding and decoding of serial data is assumed; that is. the data signal changes state to transmit a 0 or remains in the same state to represent a 1. Parameter register bits 9 and 10 are used to specify the cyclical redundancy character TMS9903 algorithm which will be used by transmit and receive logic. eRC OPTIONS CRC-16 is the normal algorithm used by synchronous and asynchronous protocols. CRCC-12 is the algorithm used in synchronous and asynchronous protocols with 6-bit characters. Revised CRCC-16 is the protocol frequently used in standard Bisync protocol. CRC-CCIT is the standard SDLC algorithm. Parameter register bit 3 is used by interval timer logic. This bit will be discussed later when we describe the interval timer. We will now examine TMS9903 Status register bit settings, which are summarized in Table TMS9903 3-14. Status register bits may be divided into the following groups: STATUS REGISTER • Interru pt status • Input signal levels • Transmit logic status • Receive logic status • Timer logic status 3-106 Table 3-14. TMS9903 Synchronous Communications Controller CRU Bit Assignments when Reading from the TMS9903 MODE !::ffi mm Z u u :::):E > ...I CZ::::) (I) Q Function Reset Condition U Z c( (I) 31 X X X 1 = Any interrupt pending No interrupt pending 30 X X X 1 = One or more Register Load Control flags set. No Control flag set 29 X X X 1 = 55ft or m or automatic RTS signal level change occurred Output to CRU bit 21 28 X X X Complement of ffi input 27 X X X Complement of DSR input 26 X X X RTS level under automatic control. Transmitter active state if"RTS is under program control 25 X X X 1 = Timer decremented to 0 Output to CRU bit 20 24 X X X 1 = Timer error. Bit 25 was already 1 when timer decremented to 0 Output to CRU bit 20 23 X X 1 = Abort followed an underrun (General only) Output to CRU bit 22 22 X X X 1 = Transmit buffer empty Output 0 to CRU bit 25 21 X X X 1 = Receiver buffer full Output to CRU bit 18 20 X X X 1 = Interrupt request accompanying RTS, DSR, or CTS signal level change (Bit 29 = 1) Bit 29 = 0 or Output to bit 21 19 X X X 1 = Interrupt request accompanying timer time out (Bit 25 = 1) Bit 25 = 0 or Output to bit 20 18 X X 1 = Interrupt request accompanying an abort (Bit 23 = 1)(General only) Bit 23 = 0 or Output to bit 22 Cf 17 X X X 1 = Interrupt request accompanying a Transmit buffer empty Output 0 to CRU bit 25 o ~ No active interrupting 16 X 1 = Interrupt request accompanying Receiver buffer full (Bit 21 = 1) only -...I X 1 = Interrupt request accompanying Receiver buffer full (Bit 21 = 1) x 1 = Interrupt request accompanying Receiver buffer full (Bit 21 = 1) or abort received ~ condition (Bit 14 = 1) or Closing flag received and received check character ready to be read (Bit 13 = 1) 15 IX IX I X RxD input level 14 X 1 = Start bit detected Stopbit(s) received X 1 = Abort received Output to CRU bit 18 13 IX 1 = First character data bit received Stop bit(s) received X 1 = Closing flag has been received and check character may be read Output 0 to bit 26 12 I X 1 = Receive framing error detected Error free character received X 1 = Overrun error detected - receive data overrunning previous frame's check character Output 0 to bit 26 11 IX 10 X II X X X 1 = Receive overrun error detected 1 = Receive parity error detected Output to bit 18 Valid character received X 1 = Zero insert error detected Output 0 to bit 26 9 IX IX 1 = Any receive error in most recently received character Valid character received x 1 = Flag detected Output to bit 18 The interrupt status bits include CRU bit 31, which reports any active interrupt request. and CRU bits 20 through 16, which identify individual interrupts. These status bits are self-evident. In non-vectored interrupt configurations you will test CRU bit 31 to find out if this particular TMS9903 has any active interrupt requests. In a vectored interrupt con- figuration you can ignore CRU bit 31, since the interrupt acknowledge process will identify the TMS9903 as the device with the active interrupt request. I n each case, the interrupt service routine must examine CRU bits 20 through 16 in order to determine which interrupt requests are active. The interrupt service routine must resolve its own interrupt priorities. Input Modem signals OSR and CTS modify Status register bits 27 and 28, respectively. The camp lement of the input signal level is reported. Status bit 29 is set to 1 when either ~, CTS, or automatic RTS signal level changes. This signal level change can cause an interrupt request, in which case Status register bit 20 is set. In many serial I/O devices, CTS going high in the middle of a transmit operation forces a transmit abort. while DSR going high in the middle of a receive operation disables receive logic. The TMS9903 does not make such critical decisions; the supervisory program must respond appropriately. When RTS output level is being controlled automatically, the complement of RT$ is reported in Status register bit 26. But as soon as you start controlling RTS level by writing to Control register bit 17, Status register bit 26 reports the active state of the transmitter. The serial data input signal RxO has its level reported in Status register bit 15. There are two status bits associated with transmitter logic: bit 22 reports Transmit buffer empty and bit 23 re- ports a transmitter abort (in those modes that can generate an abort). If interrupt logic for these conditions has been enabled, then Status register bits 18 andlor 17 will also be set. There are a number of Status register bit settings associated with receive logic, but there is only one interrupt status bit associated with receive logic - bit 16. Therefore you must use the various receive status bits in order to identify active error or non-error conditions within receive logic. In all modes Status register bit 21 is set when the Receive buffer is full - and should be read within one character time. In Synchronous mode, Status register bit 11 reports a receive overrun error, while Status register bit 10 reports a receive parity error. Either of these errors causes Status register bit 9 to be set. In Asynchronous mode, a receive framing error, overrun error, or parity error is reported in status bits 12, 11, and 10, respectively. Status bit 9 reports one or more of these error conditions. In Asynchronous mode, two status bits are also set at the beginning of each received character. Status bit 14 is set when a valid start bit has been detected for the character, while status bit 13 is set when the first valid data bit has been detected. In SOLC mode, a receive overrun is reported in status bit 11 and a receive zero insert error is reported in status bit 10. The receive zero insert error means that five contiguous 1 bits were received, followed by a flag character. with- out the expected zero inserted between them. Thus, status bit 10 will be set when the sequence 01111110111112 is received. While a frame is being received, Status register bit 14 is set when an abort is detected and Status register bit 9 is set when any flag character is detected. An unusual and interesting error reported in SOLC mode is the receive CRC overrun error. If a new frame's data is received before you read the previous frame's cyclical redundancy check character, then status bit 12 is set. There are two timer logic status bits; bit 25 is set to 1 whenever the timer decrements to zero. If timer interrupts have been enabled, then status bit 19 is also set. You must acknowledge a time-out before another time-out occurs. You acknowledge a time-out by outputting to Control register bit 20. If you do not do so, then on the next time-out Status register bit 24 is set. You can examine Status register bit 30 at any time to see if one or more write location select bits are set in the Control register. 3-108 TMS9903 INTERRUPT LOGIC There are seven conditions that can generate interrupt requests within the TMS9903. Three of the seven condi- tions combine to generate a single interrupt request status. Therefore, there are five interrupt request statuses for the seven interrupt generating conditions. This may be illustrated as follows: Control Status Register Status Register Interrupt Register Condition Enable Interrupt Bit No. Bit No. Bit No. Interrupt 29 - - 21 - - 20 - DSR. CTS, or automatic RTS level change 25 - - 20 - - 19 - Timer time out 22 - - 19 - - 17 - Transmit buffer empty 23 - - 22 - - 18 - Transmit abort Receive buffer full 21 End of SOlC frame 13 7 1 8 - - 1 6 - Receive interrupt Receive abort 14 The TMS9903 has no internal interrupt priority arbitration logic. When one or more conditions capable of request- ing an interrupt occur, if the interrupt has been enabled, then INT is output low and Status register bit 31 is set to 1. An interrupt service routine responding to the TMS9903 interrupt request must now interrogate Status register bits in order to determine which interrupt requests are active. Program logic is responsible for all interrupt priority arbitra- tion. These are the interrupt priorities which normally apply in serial I/O devices: 1) HIGHEST PRIORITY. Receive buffer full (Status register bits 16 and 21 set) 2) Transmit buffer empty (Status register bits 17 and 22 set) 3) Modem Signal level change (Status register bits 20 and 29 set) 4) Receive abort detected (Status register bits 16 and 14 set) 5) Transmitter abort (Status register bits 18 and 23 set) 6) End of SDLC frame detected (Status register bits 16 and 13 set) 7) LOWEST PRIORITY. Timer interrupt (Status register bits 19 and 25 set) TMS9903 INITIALIZATION PROGRAM LOGIC The first step in any TMS9903 operation is usually to initialize the device. Here are the necessary steps: ~-....;...----- 1) Reset the device by writing 0 or 1 to Control register bit 31. TMS9903 DEVICE 2) Now output appropriate Parameter register settings. INITIALIZATION 3) Output data to Control register bits 18 through 22 to enable appropriate interrupts. 4) In Synchronous and SDLC modes, load appropriate codes into the Sync2 and/or Sync1 registers. These two registers are not used in Asynchronous mode. 5) To initialize receive logic, write 0 to Control register bit 30. If cyclical redundancy is being used, initialize receive CRC logic by writing 0 to Control register bit 29. As soon as this step is complete. receive logic becomes active and starts to assemble received data. 6) To initialize transmit logic, write 1 to Control register bit 30. If cyclical redundancy is being used, initialize transmit CRC logic by writing 1 to Control register bit 29. Transmit logic is now initialized, but it is not yet enabled. 7) Transmit logic will not become active until you enable the transmitter by writing 1 to Control register bit 16. When you enable the transmitter, you should also load data into the Transmit buffer. Refer to our earlier discussion of Control register bits 25 and 24, where data output to the Transmit buffer is described, with or without associated CRC accumulation. TMS9903 ASYNCHRONOUS OPERATIONS When you select Asynchronous mode, data will be transmitted with a parity bit if selected, TMS9903 plus one or two stop bits, as specified by the Parameter register. Whenever the Transmit buffer ASYNCHRONOUS becomes empty. an interrupt request will be generated if the Transmit buffer empty interrupt TRANSMIT has been enabled, and appropriate status bits will be set - as described earlier. You have one character time within which to respond by outputting another character, or else an underrun will occur. Following an 3-109 underrun, a continuous high (marking) signal or a continuous low (break) signal will be output. depending on the set- ting of Control register bit 23. See the break discussion given earlier for details. When beginning a receive operation, sample the start bit detected status (Status register bit TMS9903 14) to identify the beginning of a new received message. This status cannot generate an inter- ASYNCHRONOUS ru pt request. To process received characters, use Receive buffer fu II interrupt request logic. As RECEIVE characters are received, program logic must read characters out of the Receive buffer within - - - - - - - -..... one character time, and check for any of the asynchronous receive error conditions by reading error Status register bits at the same time. Received data and status can be read together by reading CRU bits 0 through 15 from the TMS9903. There are no other special programming considerations associated with asynchronous operation of the TMS9903. Con- versely, any other protocol requirements must be met by the supervisory program's logic. TMS9903 SYNCHRONOUS OPERATIONS Most of the logic associated with Monosync and Bisync protocols must be provided by the supervisory program that controls TMS9903 transmit and receive operations. The only logic capabilities provided by the TMS9903 itself are the various Sync register programmable options, the error and normal operation statuses reported, and the character length definition. For a discussion of the Sync character options, refer to our earlier description of the Parameter register. For a description of the statuses reported, see the Status register discussion and interrupt logic summary. TMS9903 SOLC OPERATIONS When discussing the Parameter register we explained how you will use the Sync2 register in order to transmit and receive frames; but there are additional SOLC protocol requirements and some common protocol variations which need to be discussed. SDLC and HOLC protocols are described in Chapter C1 of Volume 3. In SOLC protocol. the first byte of every frame is the address field, while the second byte is a control field. In HOLC protocol the address field can have any length, while the control field can be either one or two bytes long. Some variations of SOLC protocol insert a logical control field after the control field; the logical control field can have any length. Address field. control field. and logical control field characters are all eight bits wide. Information field characters can have any data bit width. The number of bytes in a multibyte address or logical control field is determined by examining a specific character bit. For example, a pro- tocol may specify that the last byte of an address field will have a 1 in the low-order bit. while all prior bytes have a 0 in the low-order bit. The TMS9903 has no on-chip logic designed to handle address, control, or logical control fields. Device program- ming can specify the number of bits per character - and this specification may change from character to character- and that is all. Moreover, the supervisory program must take into account primary or secondary station logic. A supervisory program at a primary station must transmit secondary station addresses and must interpret received ad- dresses as identifying a frame's source. At a secondary station, the supervisory program must always transmit its own address at the head of a frame and must examine the address at the head of a received frame to see if the rest of the frame should be read or ignored. When the last byte of the control field (or logical control field) has been received, program logic must change the bits- per-character specification in the Parameter register before processing the first character of the information field - should the information field use a different character length. Remember, the bits-per-character specification in the Parameter register applies only to receiver logic; you specify transmit character size by the number of bits you output to the Transmit buffer. Thus it is a simple matter to change character size from character to character as protocol may require. It is also possible for a received character to have a different number of bits than a simultaneously transmitted character. TMS9903 receive logic in SOLC mode does have one very useful end-of-frame capability: the received check character (which must be the 16 data bits preceding the frame's closing flag) is automatically loaded into a received CRC register. The microprocessor can read this received check character and compare it with a computed check character. But there are some additional uses for this received CRC logic. A valid SOLC frame must have at least 32 bits between the beginning and closing flags; these bits include an 8-bit con- trol field, and a 16-bit cyclical redundancy check character. Frequently, 32-bit frames are transmitted and received to pass a command or response with no associated data. An error occurring within such a short frame can cause complex logic problems; it may be difficult to identify beginning and ending flags for subsequent frames, since the ending flag 3-110 for the short frame may go undetected. But you can use the TMS9903 receive CRC logic to identify short received frames. If you do not get a valid status indicator telling you that the received check character is available. then you know you have received a short frame. SOLe protocols allow frames to be separated by a single flag character. which serves as the closing flag for one frame and the opening flag for the next frame. Alternatively. a number of flag characters may separate two frames. Either case can be handled by the TMS9903. When describing the Parameter register. we explained how you can generate a frame's closing flag out of the Sync2 register. after allowing an underrun. or inhibit zero insertion and transmit flag characters as data. Since you can in- dividually specify characters that will or will not be included in cyclical redundancy check accumulations. processing non-data characters as though they are data characters presents no difficulties to a TMS9903. You can use either method of ending a frame to separate frames with one or more flag characters. If you have generated an end-of-frame using underrun logic. then loading the next frame's first address field byte while a single flag character is being transmitted will cause a single flag to separate the two frames. If you let the underrun last longer. then flag characters will continue to be output until you begin the next frame by writing the frame's first ad- dress field byte as data to the Transmit buffer. If you are transmitting flags as data without zero insertion. then the num- ber of flags separating frames is strictly a function of program control - but you must make certain that an underrun does not occur. Let us now examine programming requirements within an SOLC loop. There are no special programming requirements for the primary station in an SOLC loop. If you generate an abort at the end of a transmitted frame's closing flag. then the flag's trailing 0 bit. together with the first seven 1 bits of the abort. constitute an EOP character - which is transmitted around the loop in order to poll secondaries. When this EOP character returns to the primary station's receive logic. it is treated as a clos- ing flag. (Refer to our discussion of the TMS9903 Parameter register for details.) Secondary stations within the SOLC loop should be run in the SOLC loop slave inactive mode until the secondary sta- tion has become synchronized with the loop - that is. has received the EOP character and begun retransmitting with a one-bit delay. At this time. change the secondary station mode to SOLC loop slave active. In the active condition. the secondary station will seek the next EOP character arriving at RxO. If the transmitter has been enabled. the TMS9903 will convert this received EOP character to the opening flag character for the frame which it wishes to transmit. The program controlling the secondary SOLC can end the transmission with a closing flag and then an abort. or with an EOP character. The closing flag and following abort generate an EOP character for the next downstream secondary - and multiple flags between frames. A closing EOP character will be converted by the next downstream secondary to a flag or will be passed on to the primary. which interprets EOP characters at receive logic as closing flags. A closing EOP character. therefore. generates a single flag separating two transmitted frames. For a discussion of normal status and error status that may occur during transmit and receive operations. refer to our earlier description of the Status register. Also. refer to our earlier description of the Parameter register for logic which you will use to abort a mistransmitted frame. or to detect an abort in a received frame. But remember. it is en- tirely up to the supervisory program to interpret status bits and to handle aborts as required by the local system logic. TMS9903 INTERVAL TIMER LOGIC The TMS9903 has an interval timer. You initialize the interval timer by loading a timer count into the Timer register. Remember. you set Control register bit 13 to 1 in order to select the Timer register as the destination for data output via CRU bits 0 through 7. As soon as you reset Control register bit 13 to 0 you enable the timer. which starts to decrement. The rate at which the timer decrements depends on Parameter register bit 3 and Control register bit 15. Parameter register bit 3 allows you to divide the 1.4>2.4>3.4>4 -100 IlA High-level output current, IOH All others -400 IlA 4>1.4>2.4>3.4>4 4 mA Low·level output current. IOL All others 8 rnA Internal oscillator frequency. fosc 48 54 MHz External oscillator pulse width. tw(osc) 25 ns Setup time. FFO input (with respect to falling edge of 413). tsu 50 ns Hold time. F F 0 input (with respect to falling edge of 4>3). th -30 ns Operating free·air temperature. T A 0 70 'c 3-07 TIM9904 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range (Unless Otherwise Noted) PARAMETER TEST CONDITIONS MIN TYP+ MAX UNIT VIH H'gh·level input voltage 2 V Low-level FFO 0.5 VIL V Input voltage OSCIN 0.8 VT~ - VT_ HysteresIs FFO 0.4 0.8 V VIK Input clamp voltage VCC =4.75 V, VOO = 11.4 V, II = -18mA -1.5 V High-level 1, 4 Vce =4.75 V, IOH = -100 IJA VOO-2 VOO-l.5 VOO VOH V outPut voltage Other outputs V DO = 11 .4 V to 12.6 V IOH = -400 IJA 2.7 3.4 4 IOL =4 mA 0.25 0.4 Low-level VOL Vce = 4.75 V, VOO = 11.4 V 10L = 4 mA 0.25 0.4 mA output voltage Other outputs IOL=8mA 0.35 0.5 Input current at FFO VI = 7 V 0.1 II Vce = 5.25 V, VOO = 12'.6 V mA maxImum input voltage OSCIN VI = 5.5 V 0.3 High·level FFO 20 IIH Vce =5.25 V, VOO = 12.6 V, VI = 2.7 V IJA Input curren t OSCIN 60 Low·level FFO -0.4 IlL Vce = 5.25 V, VOO = 12.6 V, VI = 0.4 V mA Input current OSCIN -3.2 Short·circult All except lOS Vce = 5.25 V -20 -100 mA output current+ 1, 2, 2 high 0 5 15 ns t2L, cp3H Oelay time, <1>2 low to <1>3 high 0 5 15 ns trJ>3L cp4H Delay time, CP3 low' to 1/>4 h,gh 0 5 15 ns tcp4L,cplH Delay time, 4 low to .pl h'gh OutPllt loads: 0 5 15 ns tcp1H,4>2H Delay time, cpl high to ,p2 h,gh rJ>l,cp3,cp4: 100pF toGND 73 83 96 ns t.p2H,cp3H DeillY time, 1/>2 high to 'PJ high tP2: 200 pF to GND 73 83 96 ns tr/>3H, tP4H Delay time, tP3 high to ,p4 hiqh Others: RL = 2 kH, 73 83 96 ns tcp4H,H,CPTL Delay time, 4>n high to n TTL low -14 -4 6 ns tC>L,<1>TH Delay time, CPn low to r/>n TTl. high -29 -19 -9 ns tcp3L,OH Delay time, tP3 low to FFQ output high -18 -8 2 ns ttP3L,QL Delay time, cp310w to FFQ output low -19 -9 1 ns ttPL,OSOH Delay time, cp low to OSCOUT high -30 -20 -10 ns tcpH,OSOL Delay time, FFQ high to OSCOUT low -27 -17 -7 ns 0.7'll ~2 . ~-t¢4l'¢IH I f1 ~--4-~t¢-3'H-.-O-4H--~~.----~:--------------~ :~----------------------- a4V I I I I 0.7 V I I 0.7 V 0.7 V I I I I t¢3l,4~RI\ I ~ \~_.::.0.~7..:.V_______________..;...--~----....f--....... 1 L.. I ~ tq,H, ¢TL ---I -1 I-- t-tol,¢TH: I I I u i I U lr------~I------------------------~\ 13V 1.3V I Lf-1 I I I I --------------------~Wll i3 \JJ OSCOUT I u tq,H,bsOl-l1- 'OL.OSOLh I I v -+f tsu ...- I -.I th t-- : II ~~N~F~~U~T 1._3Jvf ____________________ I \L'_3_V____________ ~/ \~__~__~/ to3l, QH 4+--+t_----------------------------------.....!I:::;;:;;;;;, I t o 3l. QL of; ; .~.; .~.;.;p;. ;U_T:. . . _____________________ ----~l1.3 v 13 v \"'_________ SWITCHING CHARACTERISTICS, VOLTAGE WAVEFORMS 3-09 TIM9904 EQUIVALENT OF D INPUT EQUIVALENT OF OSCIN INPUT EQUIVALENT QF XTAL 1 AND XTAL 2 INPUTS Vee ----4_-- vee-......._- 20 kU NOM vee---....- - INPUT INPUT ' - - - -..... GNDt GNDt GND1 EQUIVALENT OF TYPICAL OF TYPICAL OF OSCOUT, Q, AND TANK INPUTS 1/)1, 1/)2,1/)3 AND 414 OUTPUTS ALL ~TTL OUTPUTS - - - -.......--Vee vee---....- -1~---,--,--VDD - -.......,..,.........-OUTPUT l . . - - t - - OUTPUT I NPUT-.....- .... GNDt SCHEMATICS OF INPUTS AND OUTPUTS TMS9901 TMS 9901 ELECTRICAL SPECIFICATIONS Absolute Maximum Ratings Over Operating Free Air Temperature Range (Unless Otherwise Noted)· Supply voltage, Vee ................. · ........................................... -0.3Vto 10V All inputs and output voltages ..................................................... -0.3 V to 10 V Continuous power dissipation ........................................................... 0.85 W Operating free-air temperature range ................................................. ooe to 700 e Storage temperature range .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. -65°C to 15Q"C "Stress. beyond those listed under '"Absolute Maximum Ratings'" may cause permanent damage to the device. This is a strMS rating only and functional operation of the device at IMM or any other conditions beyond those indicated in the '"ReoomrnencIed Operating Conditions'" section of this specification is not implied. Exposure to absolute maximum rated conditions for extended periods may affect device reliability. Recommended Operating Conditions· PARAMETER MIN NOM MAX UNIT Supply voltage. Vee 4.75 5.0 5.25 V Supply voltage. Vss 0 V High-level input voltage. VIH 2.0 Vee V Low-level input voltage. VIL VSS-·3 0.8 V Operating free-air temperature. TA 0 70 °e 3-D10 TMS9901 Electrical Characteristics Over Full Range of Recommended Operating Conditions (Un.... 0therwI.. Noted)· PARAMETER TEST CONDmONS MIN TVP MAX UNIT IOH- -100pA 2.4 Vcc V VOH High level output voltage IOH - -200pA 2.2 Vcc V VOL Low level output voltage IOL= 3.2mA Vss 0.4 V II Input current (any input) VI=OVtoVCC ±100 pA ICC(avl Average supply current from Vcc te(4)1 = 330 ns. TA=70·C 150 rnA CI Small signal input capacitance, any input f= 1 MHz 15 pF Timing Requirements Over Full Range of Operating Conditions PARAMETER MIN TVP MAX UNIT fe(4)) Clock cycle time 300 333 2000 ns tr<4» Clock rise time 5 40 ns tMi Clock fall time 10 40 ns tw~ Clock pulse width (high level) 225 ns tw(4)>L) Clock pulse width (~ level) 45 300 ns tw(CC) CRUCLK pulse width 100 185 ns tsu1 Setup time for CE, 50-S4, or CRUOUT before CRUCLK 100 ns tsu2 Setup time for interrupt before if> low 60 ns tsu3 Setup time for inputs before valid CRUIN 200 ns ttl Hold time for CE, 50-54, or CRUOUT after CRUCLK 60 ns ·NOTE: All voltage values are referenced to Vss. Switching Characteristics Over Full Range of Recommended Operating Conditions PARAMETER TEST CONDITION MIN TVP MAX UNIT tpd1 Propagation delay, ~ to valid CRUIN CL = 100pF 300 ns tod2 Propagation delay, 50-S4 to valid CRUIN CL - 100pF 320 ns tod3 Propagation delay, if; low to valid DiITREO, ICO-IC3 CL = 100pF 110 ns tpd Propagation delay, ~ to valid data out (PO-P15) CL = 100pF 300 ns 3-011 TMS9901 twltPU -l '- tr(t/» -I !.--II- tf(rp) ' - - - Ic(C I, cou,. {XX)(X)(X)(XXt&soDO 11,",1 ~-"'-e---B-0"R-C .£oj ''"' TIMING DIAGRAM 3-017 Chapter 4 SINGLE CHIP NOVA MINICOMPUTER CENTRAL PROCESSING UNITS In this chapter we are going to look at two microprocessors which are the world's first single chip reproductions of established 16-bit minicomputers. We are going to describe two products which reproduce, on a single chip, the logic of a Nova Central Processina Unit. Nova minicomputers are built by Data General Corporation. Data General Corporation offer a set of LSI chips centered on the MicroNova microprocessor. These chips are described quite superficially in this chapter since Data General is not actively marketing them as LSI devices. Rather, Data General favor the sale of MicroNova microcomputer systems. Fairchild manufacture the 9440 microprocessor, which is sold primarily as an LSI device. The 9440 is therefore described in some detail, together with standard Nova 1/0 bus and typical memory bus interface bus logic. The Nova minicomputer was designed as a next generation enhancement of the PDP-8. The IM6100, which is de- scribed in Chapter 13 of the Osborne 4 & 8-Bit Microprocessor Handbook is a single chip implementation of the PDP-B Central Processing Unit. If you compare the Nova architectures, which we describe in this chapter, with the IM1600, the two products will indeed look very different. But conceptually they are similar. Both the Nova and the PDP-8 Central Processing Units have few addressable registers; for computing power they rely upon instructions which may perform complex sequences of operations. Similarities between the Nova and the PDP-B will become more apparent if you compare these two devices with the CP1600 and the TMS990 - which we have described in Chapters 2 and 3, respectively. What is interesting about the Nova minicomputer is that it is one of the most popular in the world; and Data General Corporation is the second largest minicomputer manufacturer in the world. despite the fact that many aspects of the Nova Central Processing Unit may. on first inspection. appear to be very restricting. . The MicroNova is manufactured by: OAT A GENERAL CORPORATION Mail Stop 6-58 Southborough. MA 01772 The 9440 is manufactured by: FAIRCHILD SEMICONDUCTOR 464 Ellis Street Mountain View, CA 94040 The MicroNova and the 9440 are not the same; differences, however, are small. The MicroNova is equivalent to the Nova 3 minicomputer. The Nova 3 is a low-end minicomputer recently in- troduced by Data General. Although it is a low-end product it includes a number of features not found in the basic Nova arch itectu reo The 9440 reproduces basic Nova architecture - that is, the lowest common denominator of architectural features found in any Nova Central Processing Unit. As such, the 9440 lacks a number of logic features provided by the MicroNova. The 9440, however. has higher instruction execution speeds. Because the MicroNova and the 9440 are very similar. we are going to describe them together in this chapter. The MicroNova is manufactured using NMOS LSI technology. The 9440 is manufactured using Isoplanar integrated in- jection logic (l3U technology. Both products are packaged as 40-pin DIPs. The MicroNova requires four power supplies: -4.25V, +5V, +10V and +14V. The 9440 requires two power sup- plies: +5V and +350 mA. 4-1 Using a 240 nanosecond clock. the MicroNova executes instructions in 2.4 to 10 microseconds. Using a 100 nanose- cond clock. 9440 instructions will execute in 1 to 2.5 microseconds. A PRODUCT OVERVIEW Figure 4-1 illustrates that part of our general microcomputer system logic which has been implemented by the MicroNova and the 9440. Note that only the MicroNova has a Stack Pointer, and DMA logic. Most Nova minicomputers do not have a Stack; the 9440 is a reproduction of.the basic Nova architecture. which is why the 9440 lacks a Stack. The MicroNova and Nova 3 do contain Stacks. because the addition of the Stack is technologically straightforward. while the lack of a Stack had been one of the most distressing features of earlier Nova minicomputers. Both the 9440 and the MicroNova have DMA request and DMA acknowledge signals; however. in response to a DMA request. the 9440 does nothing except float the System Bus. It is up to you to provide any and all external logic needed to actually perform a data transfer via direct memory access. The MicroNova. on the other hand. executes the required sequence of I/O operations to actually perform the DMA transfer. That is why in Figure 4-1 DMA logic is shown as being present on the MicroNova but not the 9440. What about I/O ports? I/O ports interface logic is shown as absent in Figure 4-1 . The 1/0 port is a microcom- puter concept. In any microcomputer configuration. you will look upon I/O ports as the ultimate interface between the microcomputer system and external logic. You need a conduit via which data bits or signals can be transferred to. or received from logic beyond the microcomputer system. Each conduit becomes an I/O port and an I/O port becomes a set of pins. which can be addressed as a unit on a support device. Minicomputers take a conceptually different approach to 110 operations. To begin with. data is generally transferred to or from the CPU - not signals. The data finishes up on a System Bus. Therefore a minicomputer's interface with the outside world consists of an I/O System Bus and a memory System Bus. In some cases the two busses are one; in other cases. such as the Nova minicomputers. these two are sep- arate and distinct busses. Conceptually. what is important is the fact that the minicomputer anticipates transferring data via its I/O System Bus to line printers. disk units. or other substantial devices each of which is capable of having a Significant amount of local logic. Thus the System Bus is as far as the minicomputer attempts to go when defining its interface to the outside world. Figure 4-1 , including bus interface logic within the logic of the Central Processing U nit, needs some clarifica- tion. As we have just stated. the Nova minicomputer creates two separate System Busses: one for memory. the other for I/O devices. All the signals of these two busses originate at card edge pins. There is nothing very expensive about adding more pins to the edge of a card. as there is to adding more pins to a DIP. Therefore the Nova System Bus has 47 Signals. Since neither the MicroNova nor the 9440 can have 47 signals. neither of these two devices creates standard Nova System Busses; but each device creates its own System Bus which could be used to drive external logic. That is why interface logic is shown as being present in Figure 4-1. 4-2 Clock Logic MicroNova anc:f~ Logic to Handle r:':'::::::::::::::::::::) . ::::::::.:.:.:.:.:.:.:.:::: MIt;:roNova only Interrupt Requests :::~::::::::::::::::*.:. ' from Extemal Devices ~ w Figure 4-1. Logic of the Data General MicroNova and the Fairchild 9440 There is one further major difference between the MicroNova and the 9440 which is not evident from Figure 4-1. The MicroNova provides transparent dynamic memory refresh logic. The 9440 has no dynamic memory refresh logic. The MicroNova, but not the 9440, contains an elementary interval timer capability. Providing interrupt timer logic is enabled, the MicroNova will generate an interrupt request every 20,000 instruction cycles. Using a standard 8.333 MHz clock, this translates to an interrupt request occurring every 2.4 msec. Note that the MicroNova and the Nova 3 interval timer logic differ. The Nova 3 provides four programmable interval timer options; the MicroNova provides just one. NOVA PROGRAMMABLE REGISTERS These are the programmable registers of the MicroNova and the 9440: lS o ACO } Primary Accumulator AC1 AC2 Accumulator and Index register AC3 Accumulator, Index register and Subroutine Return Address register I Stack Pointer } MicroNova Only J Frame Pointer 14 o Data General literature numbers registers and memory words from left to right. rather than as illustrated above, from right to left. Also Data General is one of the few minicomputer manufacturers that uses octal numbering. In order to re- main consistent with the rest of this book, we will use hexadecimal numbers, and we will number registers from right to left; where confusions may arise, we will show both our standard numbers and Data General equivalents. ACO and AC1 are typical primary Accumulators. AC2 and AC3 may be used as Accumulators or as Index registers. The Jump-to-Subroutine instruction automatically stores the return address in AC3. If one subroutine is going to call another (j.e., you are nesting subroutines). then the calling subroutine must save the contents of AC3 before itself calling another subroutine. Only the MicroNova has a Stack Pointer. The only instructions that access the Stack Pointer are "Push" and "Pop" instructions. The MicroNova, but not the 9440, also contains a Frame Pointer register. The Frame Pointer register is an address buffer used to access the Stack. This may be illustrated as follows: MEMORY Stack Pointer identifies current top of Stack Use Fram e Pointer to hold important Stack ad dresses The Frame Pointer is a buffer register; it is not a Data Counter. There are no instructions that access the memory loca- tion addressed by the Frame Pointer. Observe that we show no programmable registers identified as Data Counters, even though in Figure 4-1 we show Data Counter logic as being present. This is because the Data Counter is another microcomputer concept - in effect. a subset of the Index register. If a memory reference instruction specifies direct. indexed addressing with a zero displace- ment. then Index Registers AC2 and AC3 are equivalent to Data Counters. 4-4 NOVA MEMORY ADDRESSING MODES Both the MicroNova and the 9440 offer the following standard Nova memory addressing modes: 1) Base page, direct addressing 2) Program relative, paged, direct addressing 3) Indirect addressing 4) Indirect addressing with auto-increment 5) Indirect addressing with auto-decrement 6) Direct, indexed addressing 7) Pre-indexed, indirect addressing These addressing modes have been described in Volume 1. Chapter 6. Nova memory addressing modes are heavily influenced by the fact that every Nova instruction generates a single 16- bit object code - just as the predecessor PDP-8 instructions each generated a single 12-bit object code. Even memory reference instructions are confined to 16 bits of object code; therefore the memory reference instruction can only pro- vide a short address displacement. Whereas PDP-8 memory reference instructions provide a 7-bit address displace- ment. the Nova provides an.8-bit address displacement. which is handled in a much more intelligent fashion. Nova instructions that use simple, direct addressing treat the 8-bit displacements as a direct, page zero ad- dress, or as a signed binary, program relative displacement. Thus you can directly address the first 256 words of memory. or you can address any location within +127 to -128 words of the memory reference instruction itself: ~ MEMORY 0000 0001 0002 yy can directly address base page . 0003 i 1000E §§ I I OOFF 0100 I (xxxx) + FFSO (FFSO = -SO) (xxxx) + FF81 (FF81 = -7F) I (xxxx) + FF82 (FF82 = -7E) Memory reference instruction ~" ,, ,-"-~ Address displacement equals vy yy can be added, as a I IVY )O(x-1 xxXx signed binary number, xxxx+ 1 to xxxx, to address program relative page (xxxx) + 70 (xxxx) + 7E (xxxx) + 7F Remember. in microcomputer applications. program relative direct addressing is fine for Jump instructions. but is of limited value when accessing data memory. When a microcomputer program is stored in read-only memory. program relative. direct addressing can be used to read constant data only. Nova instructions that specify direct, indexed addressing, compute the effective memory address as the con- tents of either AC2 or AC3, plus the 8-bit displacement provided by the instruction object code. The 8-bit dis- 4-5 placement is treated as a signed binary number. Since the Index registers are 16 bits ·wide, direct indexed addressing allows you to address any memory word. This may be illustrated as follows: Accumulator AC2 or AC3 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ~Bit No. Ixlxlxlxlxlxlx~xlxlxlxlxlxlxlxlxl Instruction Code 9 8 7 6 e x x x x x x x x x x x x x x x x z z z z z z z z y y y y y y y y Sum is the effective memory.address ' - - - - - - - -..... 0 selects AC2 1 selects AC3 Indirect addressing may be superimposed on any of the memory addressing options de- NOVA scribed thus far. Indirect addressing is identified by a "1" in bit 10 of the Memory Reference in- DIRECT struction's object code. When indirect addressing is specified, the effective memory address is the MEMORY contents of the directly addressed memory word. ADDRESSING Let us examine the various indirect addressing options. First there is page zero indirect ad- NOVA dressing: INDIRECT PAGE ZERO ADDRESSING 8 5 2 O~BitNo. ~~~~~~~~~~~~~~ ~----~----------P~Z«o '--------+-------- Indirect addressing Arbitrary Memory I~I:- 0001 0002 0003 i I 0024 1------1 0025 1236 0026 .....~----..... 0027 t - - - - - t 0030 1235 1 - - - - - 1 1236 1237 1 - - - -....... 1240 In the illustration above. arbitrary, real memory addresses have been selected to make the illustration easier to unders- tand. 4-6 Program relative, indirect addressing may be illustrated as follows: NOVA INDIRECT PROGRAM RELATIVE ADDRESSING 1216 ~----------__~~·55 ____ This instruction 126B fetched from this memory location ~------------- Program relative ----------------Indirect Arbitrary Memory MEMORY Address 1215 1216 1217 1220 1221 1222 126A 736~ 126B 126C 1260 126E 12GF 1270 7362 7363 7364 7365 7366 7367 7370 7371 7372 4-7 Indirect. indexed addressing may be illustrated as follows: NOVA INDIRECT INDEXED ADDRESSING Accumulator AC2 15 1<4 13 12 11 10 9 8 7 6 5 <4 3 2 1 0 ~ Bit No. 10101010101011101110101011111111' Instruction Code 6 5 <4 3 2 028F - - - - - -.....-0020 02BC .....- - - - - - - - - - - - Index via AC2 .....- - - - - - - - - - - - - - I n d i r e c t Arbitrary Memory MEMORY Address 02~ 0288 736" 02BC 0280 02BE 02BF 7362 7363 7364 7365 7366 7370 The illustration above arbitrarily uses indexed addressing via Accumulator AC2. Also the computed effective memory address is identical to that which was obtained in the indirect. program relative addressing illustration. Observe that Nova indirect addressing logic results in pre-indexed indirect addressing. As described in Volume 1. Chapter 6. this is less desirable than post-indexed indirect addressing. 4-8 If. and only if indirect addressing has been specified by a "1" in bit 10 of a Memory Reference in- NOVA struction's object code. then the contents of the data fetched from memory are treated as a direct MULTIPLE address. providing the high-order bit of the direct address is O. If the high-order bit of the address INDIRECT is 1. then the address is treated as another indirect address pointer. This may be illustrated as ADDRESSING follows: Interpret as. last memory adciIr.a Note carefully that multilevel indirect addressing will occur only when indirect addressing is specified in the first place. If you execute a direct memory reference instruction. data will never be interpreted as an address. The Nova indirect addr~ssing logic means that. given a 16-bit indirect address. only 15 bits actually address memory; therefore you are limited to a 32.768 word memory address space: l' 14 13 12 11 10 9 8 7 6 .5 4 3 i 1 0 ~.No. I I II I I I I I I I g--1ncInIc:t MIiNIry ~ 1 The Nova minicomputers and microcomputers also provide indirect addressing with auto-increment and auto- decrement addressing. If you indirectly address one of the eight memory locations. 001016 through 001716. then the contents of the addressed memory location are incremented at the beginning of the memory access. Thus you have in- direct addressing with auto-increment. If you indirectly address anyone of the locations. 001816 through 001 F16 then the contents of the addressed memory location will be decremented at the beginning of the memory access. Thus you have indirect addressing with auto- decrement. Neither the MicroNova nor the 9440 provide memory mapping logic. Memory mapping is a technique whereby more than 32.768 words of addressable memory may be accessed. The Nova 3 minicomputer is capable of supporting memory mapping as an option. Nova minicomputers have separate memory and I/O device spaces. I/O instructions include six NOVA I/O bits which identify one of 64 I/O devices. Because Nova minicomputers and microcomputers treat DEVICE I/O devices in a manner that differs significantly from the typical microcomputer. we will defer our ADDRESSING discussion of I/O addressing until we have looked at pins. Signals and System Busses. 4-9 NOVA STATUS FLAGS Nova minicomputers contain just one status flag, as we would define it, and that is the Carry status. Instruc- tions are able to test for a zero or nonzero condition occurring at the conclusion of an instruction's execution, but no permanent zero status flag exists. MicroNova also has these interrupt related status flags: • Interrupt Enable } • Real Time Clock Enable • Real Time Clock Request MicroNova Only • Stack Overflow Request The interrupt related status flags do not occur as addressable locations in any Status register; rather they represent flip- flops which are set or reset during the course of interrupt handling. The interrupt enable bit is a master enable which is set to 1 in order to enable all interrupts. Specific instructions allow all interrupts to be enabled or disabled. The MicroNova has a Real Time Clock interrupt enable bit and a Real Time Clock request bit. The Real Time Clock ena- ble bit must be set to 1 in order to enable Real Time Clock interrupts; as soon as a Real Time Clock interrupt occurs. the Real Time Clock enable bit and the Real Time Clock request bit are reset to O. The Stack Overflow request bit is only present in the MicroNova. since only the MicroNova has a Stack. A Stack over- flow condition occurs if. following a push operation. the incremented contents of the Stack register have zeros in the eight low-order bits. What this implies is that the Stack must reside within a 256-word memory page: Arbitrary Memory I~RYI:~ 0801 : 0802 · . 0803 §· . :08FD 08FE 08FF~ '0900 0901 • • Pushes that increment Stack Pointer ~ = . from XXFF to XYOO will cause a Stack 09FD Overflow interrupt 09FE / 09FF~ OAOO~ OA01 OA02 When a Stack overflow occurs. the Stack Overflow request bit is set to 1 and an interrupt is requested. MICRONOVA AND 9440 CPU PINS AND SIGNALS As we stated earlier in this chapter, minicomputer Central Processing Units are implemented on cards, not DIPs; therefore they usually have System Busses containing more than 40 signals. The standard Nova System 1/0 Bus contains 47 signals; furthermore, the Nova System Bus is, in effect, two busses: one communicating with memory, while a separate and distinct bus communicates with 1/0 devices: NOVA MEMORY BUS I/OBUS CPU I/O DEVICES AND MEMORY EXTERNAL LOGIC 4-10 Table 4-1 briefly defines the functions of bus signals. The I/O Bus is standard for ali Nova line computers, while the Memory Bus is different for each model. We give the Memory Bus signals of the Nova 2 in Table 4-1. Table 4-1. Nova System Bus Signals STANDARD NOVA SYSTEM I/O BUS SIGNAL DIRECTION FUNCTION OR INDICATION DsO-DS5 To Device Device selection DATAo - i5Ai'Ai5 Bidirectional Data and address lines DATOA To Device Data out to device's A buffer DAnA To Device Data in from device's A buffer DATOB To Device Data out to device's B buffer DATIB To Device Data in from device's B buffer DATOC To Device Data out to device's C buffer DATIC To Device Data in from device's t: buffer STRT To Device Start device-clear Done flag, set Busy flag and clear devi.ce's INT REO flip-flop CLR To Device Oear device's Busy and Done flags and INT REO flip-flop 10PLS To Device I/O Pulse - user-defined function Sllii To Processor Selected device's Busy flag is set SELi5 To Processor Selected device's Done flag is set RciENB To Device Enable interrupt or DMA requests iNTR To Processor Interrupt request iNi'P To Device Interrupt priority INTA To Device Interrupt acknowledge MSKO To Device Interrupt mask out 50iR To Processor Data channel request (DMA request) OCHP To Device Data channel priority OCHA To Device Data channel acknowledge DcHMo,DcHMi To Processor Data channel mode: l5CHMo DCHMI H H Data out H L Increment memory L H Data in L L Add to memory DCHI To Device Data channel in OCHO To Device Data channel out OVFLO To Device Overflow: result of memory increment or add exceeds FFFF II 10RST To Device Clear all I/O devices THE NOVA 2 MEMORY BUS SIGNAL DIRECTION FUNCTION OR INDICATION AO-A14 To Memory Memory address lines DATAO - DATA15 Bidirectional Memory data lines INHIBIT SELECT To Memory Inhibits selection of memory module BMEMEN To Memory Starts memory cycle WRITE To Memory Memory write BRMW To Memory Causes pause between read and write WE To Memory Enable write after pause in read-pause-write cycle SYNC ENABLE To Processor CPU hold control RELOAD DISABLE To Memory Inhibits loading of memory buffer WAIT To CPU Disables other memory modules during write portion of memory cycle MEM CLOCK To Memory Memory Clock EXTERNAL SELECT To Memory Allows module to be selected despite contents of address lines EXTERNAL MBLD To Memory Allows data to be stored in memory buffer without starting a memory cycle If you are using the MicroNova or 9440 in a new product. then there is no reason why you should create the standard Nova System Busses. Providing the signals generated by the MicroNova or the 9440 are adequate for your needs, you can interface external logic directly to these two devices. Let us first look at the MicroNova pins and signals, which are illustrated in Figure 4-2. Two clock signals, <1>1 and <1>2, must be input to synchronize all MicroNova logic. 4-11 The Memory Bus consists of a 16-bit Address/Data Bus, plus three control signals: SAE, P MICRONOVA and WE. MEMORY BUS The Address/Data Bus connects to pins MBO - MB 15. P is a synchronization signal. SAE is a read enable and WE is a write enable. The I/O Bus consists of just four signals: MICRONOVA I/O CLOCK synchronizes I/O transfers. I/O BUS I/O DATA1 and I/O DATA2 are bidirectional data and control signals. I/O INPUT identifies the direction of data transfers occurring via-:"I/~0~D-:"A~T~A~1 and I/O DATA2. As compared to other microcomputers described in this book. the MicroNova I/O interface is very unusual. Only the TMS 9900 I/O logic is at all similar. A 16-bit I/O data transfer occurs as two 8-bit serial units. This may be illustrated as follows: I/O CLOCK ~~~__~I_B_IT_O~I~~_T_1~I~B_IT__2~I_B_rr_3~I_B_rr_4~I_BI_T_5~I_B_rr_6~1_~_T_7JI \ ~0 I ~ 1 I ~T 2 I ~T 3 1 ~ 41 ~ 5 1 ~ 6 1~T 7 I Eight serial bits are input in less than one microsecond: therefore this method of handling I/O is as fast as the parallel data input operations described for other microcomputers. Each data transfer is preceded by one of four_codes generated by levels output via I/O DATA 1 and I/O DATA2. These are the four codes: 1/0 DATA1 I/O DATA2 INTERPRETATION Accompanying I/O low pu Ise may be used to synchronize interrupt requests and DMA requests. 1 o DMA request acknowledge. o 1 I/O data transfer. The transfer direction is specified by I/O INPUT. o o I/O command out. Thus every I/O operation will begin with I/O DATA 1 and I/O DATA2 being output during a low I/O CLOCK pulse. I/O IN- PUT will be low at this time since data is being output via I/O DATA1 and 110 DATA2. Providing 110 DATA1 andl70 DATA2 specify a data transfer to follow. the actual data transfer will occur via I/O DATA 1 and I/O DATA2 with I/O IN- PUT identifying the data transfer direction. 4-12 VBB 40 Vss (GROUND) P 39 nc WE 38 VDD SAE 4 37 HALT DCH INT 5 36 nc 'OOiNT 6 35 CLAMP VGG 7 34 nc VSS(GRO~ 8 33 PAUSE MOO 9 32 11>1 Mii1 10 31 11>2 MICRONOVA Mii2 11 30 I/O DATA1 MB3 12 29 I/O DATA2 MB4 13 28 i70iNPUT Ma5 14 27 I/O CLOCK MB6 15 26 Vss (GROUND) MB7 16 25 MiT5 VCC 17 24 Mei4 MB8 18 23 Ma1'3 MB9 19 22 Me12 MiiO 20 21 Mi1i' PIN NAME DESCRIPTION TYPE 11>1. cJI2 Clock Signals Input MeO-'MBi5 Address/Data Bus Bidirectional P Memory Synchronization Output SAE Memory Read Enable Output WE Memory Write Enable Output I/O CLOCK I/O Synchronization Bidirectional I/O DATA1. I/O DATA2 Data and Control Bidirectional i70iNfiijT Transfer Direction Output Ci:AMP Power-On Reset Input HALT CPU Halted Output i5CHiNT DMA Request Input 00iNf External Interrupt Request Input PAUsE Memory Bus Grant Output VBB VDD. VGG. Vss Power and Ground Figure 4-2. MicroNova CPU Signals and Pin Assignments There are two CPU control signals which are not part of either the Memory Bus or the I/O Bus. Following power-up, the MicroNova CPU will not perform any operation until a high input occurs at CLAMP. When CLAMP goes high. interrupts are enabled. Real Time Clock and Stack Overflow interrupt requests are cleared. and the CPU is halted. Once CLAMP has been input high. it is ignored until the MicroNova is powered down and then powered up again. The HALT signal is output by the MicroNova as a high pulse while the MicroNova CPU has been halted - either in response to execution of a Halt instruction. or following CCAi\iiP going high. There are two MicroNova signals associated with interrupt logic. DMA requests are made via DCH INT while any external interrupt is requested via EXT INT. Both the DMA request and the interrupt request must be. syn- chronized with instruction execution timing. This synchronization is provided by I/O DATA1 and I/O DATA2. as we have already described. The DMA acknowledge occurs via 1/0 DATA1 and I/O DATA2. There is no external interrupt acknowledge signal; however. such a signal can be derived from the Memory Bus. as we will describe later in this chapter. PAUSE is output low by the CPU when devices other than the CPU· are permitted to access memory. Now look at 9440 pins and signals, which are illustrated in Figure 4-3. These pins and signals create a single System Bus. No attempt is made to create separate Memory and I/O Busses. You may connect a crystal across CP and XTL in order to create a master clock signal, or you may input a clock signal via CPO 4-13 C3 1 40 MO C2 2 39 M1 C1 3 38 M2 CO 4 37 CLK OUT DCH REO 36 CP 00 6 35 XTL i'Nf'REa. 34 MA 01 8 33 SYN INTON 9 32 MBUSY GND 10 31 VCC 9440 RUN 11 30 GND IINJ 12 29 iBf5 (low-order bit) CARRY 13 28 iii14 (high-order bit) 180 14 27 iii13 iB1 15 26 IB12 iB2 16 25 IB11 IB3 17 24 IB10 184 18 23 iB9 iSs 19 22 iBii iB6 20 21 iB7 PIN NAME DESCRIPTION TYPE xn.cP Cock Signals Input SYN Synchronization Signal Output ClK OUT System Cock Output iBO -iBiS Data/ Address Bus Bidirectional MO-Mi Memory Controls Output! Input MBUSY Memory Busy Input 00.01 I/O Control Output iNiiiEQ Interrupt Request Input INTON Interrupt Enable Output OCHREQ DMA Request Input RUN CPU Running Output CARRY Carry Status Output CO-C3 Front Panel/Console Control Signals Input MR Master Reset Input IINJ. vcc. GND Power and Ground Figure 4-3. 9440 CPU Signals and Pin Assignments The 9440 generates a single synchronizing output (SYN). The CPU clock is output to the 9440 system via ClK OUT. SYSTEM BUS IBO - IB15 provides the 9440 with a multiplexed 16-bit Data and Address Bus. This bus car- ries addresses to memory and I/O devices. and it carries bidirectional data between the CPU and memory or I/O devices. IBO - IB 15 are low true; a low signal level represents a 1 bit. IBO is the high-order bus line while IB15 is the low-order bus line. This agrees with Nova conventions. This chapter, and this whole book describe the low-order bit as bit 0 - exactly the reverse of IBO - IB15. There are three control signals on the 9440 CPU-memory interface. MO is output low to identify a memory read. M1 is output low to identify a memory write. M2 is output low to identify a memory address being output. MO - M2 have open-collector outputs; you can use these lines as inputs to make the timing of a non-memory machine cycle conform to the timing of a memory cycle. We will discuss this further when we discuss 9440 timing and instruc- tion execution. External memory interface logic inputs MBUSY low while it is responding to any memory access. MBUSY is similar to the WAIT signals that we have described for other microcomputers; it can be used to make the CPU wait for slow memory to respond to a CPU access request. 4-14 The 9440 has two I/O control signals 00 and 01. These two control signals define I/O and memory accesses as follows: 01 o 00 o Instruction Fetch 01 o 00 1 Data Channel Access 01 1 00 o Execute I/O Operation 01 1 00 1 No I/O There are two signals associated with 9440 interrupt logic. An external interrupt is requested by inputting INT REO low. INT ON indicates whether or not interrupts are enabled. This signal is high when interrupts are enabled: if this sig- nal is low. interrupts are disabled. A DMA request is made by inputting DCH REQ low. The DMA request is acknowledged by 01 and 00 being output low and high. respectively. There are seven signals provided by the 9440 specifically to support a front panel or console. Two of the front panel or console signals are outputs; these are the RUN and CARRY signals. RUN is output high while the CPU is executing programs: it is output low while the CPU is halted. RUN is used to gener- ate an appropriate front-panel display light: it is also equivalent to a Halt acknowledge. as described in this book for many other microcomputers. CARRY represents the condition of the Carry status. This signal is output specifically to drive a front-panel light. Five input control signals are provided for switches on a front-panel. Four of these signals are CO. C1. C2 and C3; they perform the following operations: C3 C2 C1 CO FUNCTION 0 0 0 0 Display ACO contents at console 0 0 0 1 Display AC 1 contents at console 0 0 1 0 Display AC2 contents at console 0 0 1 1 Display AC3 contents at console 0 1 0 0 Increment Program Counter and then display contents of addressed memory word 0 1 0 1 Display contents of addressed memory word 0 1 1 0 Load memory from console switches 0 1 1 1 Halt 1 0 0 0 Deposit switches into ACO 1 0 0 1 Deposit switches into AC1 1 0 1 0 Deposit switches into AC2 1 0 1 1 Deposit switches into AC3 1 1 0 0 Load Program Counter from console switches 1 1 0 1 Continue/Run 1 1 1 0 Increment Program Counter and then load memory from console switches 1 1 1 1 No Operation The first 9440 devices decoded the C lines in a slightly different manner. The following combinations were different operations: C3 C2 C1 CO FUNCTION o 0 o Load Program Counter from console switches o 1 o Not used 1 0 1 Load memory from console switches 1 1 o Continue/Run MR is the Reset input to the 9440. When this line is pulled low: the 9440 halts immediately and clears the Interrupt Enable flip-flop. Once MR goes high. the CPU will remain in the Halt state until it receives the "Run" command from lines C3 - CO. Reset has no further effect on the 9440. It is up to your hardware to load the Program Counter by manipulating lines C3- CO and the Information Bus. 4-15 The following sequence is sufficient to start operation of a 9440 system with a "bootstrap" 9440 program in non-volatile memory: INITIALIZATION SYN C3 - CO NO OP I LOAD PC I NOOP X RUN I NO OP iBO -1815 ( STARTING ADDRESS ) ( RUN I The hardware must provide the program starting address while issuing the "Load Program Counter" command via the Clines. C line codes other than "No Operation" are held for two machine cycles to ensure that the CPU reads them. The "No Operation" code between "Load PC" and "Run" gives the CPU time to finish executing the C line command. See the data sheets at the end of this chapter for more detailed timing information. 4-16 r-Da-ta-D-u-tP-ut-T-o-~-s-tin-a-tio-n---------------------------------------------------------------------, ~ Inhibit data output option ~ Second source t r and destination Jo. _ - - - -..... Data output • r--:=:--l-..J·~D~.t~a~ou~tpu~t....~--.......L - -... ACO Arithmetic . Shifter Test ACI First source ~1~~A~C~2~~~---~~-J~ I ~ AC3 ....1 and Boolean Logic and Byte Swap Logic .-... ,.....__ Data for Skip ~T~~=l--------J i I Carry I Program Counter Test I I I :~ ~ Carry for Skip h~lc-~~--_J -ttll Carry Status 1514 13 12 11 10 8 7 6 5 4 3 2 1 0 ___ Bit No. 'II I I I I I I I I I I I I I I I It._________________________________ Arithmetic And Logic Instruction Code Figure 4-4. The Nova Arithmetic and Logic Unit 1514 13 12 1110 9 8 7 6 5 " 3 2 1 0 ~Bit No. IllS SID DITITITIH Hie elLlKIKIK Arithmetic/Logic instruction LoooNo,"' 001 Always skip 010 Skip if Carry is Zero 011 Skip if Carry is One 100 Skip on Zero result 101 Skip on nonzero result 110 Skip on either Carry or result zero 111 Skip on Carry and result both nonzero oStore result in destination Accumulator 1 Discard result ' - - - - - - - - - - 00 Preserve current Carry status 01 Zero Carry 10 Set Carry to 1 11 Complement current Carry Thase operations are performed on Carry before entering the ALU ' - - - - - - - - - - 00 No operation 01 Left rotate one bit position 10 Right rotate one bit position 11 Swap bytes These operations are performed pn the ALU output ' - - - - - - - - - - - - - 000 Complement 001 Twos Complement (Negate) 010 Move 011 Increment 100 Add Complement 101 Subtract 110 Add 111 AND OOACO Destination ACCUmUlator} 01 AC1 ' - - - - - - - - - - - - - - - - - - - - - - - - - Source Accumulator 10 AC2 11 AC3 Figure 4-5. Arithmetic/Logic Instruction Object Code Interpretation 4-17 CPU LOGIC AND INSTRUCTION EXECUTION The manner in which the Nova CPU executes instructions differs markedly from microcomputers described earlier in this book. We will therefore begin our discussion of CPU operations by looking at overall CPU architec- ture. Our discussion of Nova CPU logic is tied to instruction object code bit patterns; this happens to be the simplest way of describing the Nova CPU. We will look at instructions from a programmer's perspective when we eX'amine the Nova in- struction set. Nova instructions may be divided into these three groups: 1) Arithmetic. Boolean and logical operations which are essentially internal to the CPU. 2) Memory reference instructions which offer a variety of memory addressing modes and very little else. 3) I/O instructions which are designed to allow a considerable amount of intelligence in I/O devices. Let us examine each group of instructions and associated CPU logic. ARITHMETIC/LOGIC INSTRUCTIONS The power of the Nova CPU lies in the fact that many logic functions are implemented sequentially along a single data path through the CPU. This is illustrated in Figure 4-4. This figure shows how individual bits of arithmetic and logic instruction object codes directly identify the many options available as data makes a single tour through the CPU. Figure 4-5 provides specific arithmetic and logic instruction object code interpretations. Data to be operated on is always fetched from the Accumulators. Results are always returned to an Accumulator. For two-operand instructions. such as binary addition. the Destination Accumulator also serves as the second Source Ac- cumulator. For one-operand instructions. such as a complement. there will be one Source Accumulator and one Destination Accumulator; the same Accumulator may serve as source and destination. As the source and destination definitions would imply. the Nova has no Secondary Memory Reference (or Memory Operate) instructions as we define them; for example. you cannot directly add the contents of a memory word to the contents of an Accumulator. In addition to one or two 16-bit data words. the Carry status is input to the Arithmetic and Boolean logic unit. You may input the Carry status as is. or you may complement it. reset it to 0 or set it to 1. If you modify the Carry status. then the modified Carry status becomes the new input to the Arithmetic and Boolean logic. You may specify one of eight Arithmetic and Logic operations. The Move operation serves both as a Move and a No Operation. By specifying the same Accumulator as the source and destination for a Move. Arithmetic and Boolean logic is bypassed. Notice that only one Boolean operation. the AND. is provided. This is an inconvenience rather than a prob- lem. As discussed in Volume 1. Chapter 2. you can combine the AND and complement operations to generate an OR or an Exclusive-OR. The following Nova instruction sequences substitute for the OR and Exclusive-OR: ;OR the contents of ACX with ACY. Leave the result in ACY COM ACX.ACX Complement ACX AND ACX.ACY AND ACX with ACY. Result to ACY ADC ACX.ACY Add original ACX. Result to ACY ;Exclusive-OR ACX with ACY. Leave the result in ACY. ;ACZ is needed for temporary data storage MOV ACY,ACZ Save ACY in ACZ ANDZL ACX.ACZ Store twice ACX AND ACY in ACZ ADD ACX.ACY Add ACX to ACY SUB ACZ,ACY Subtract twice ACX AND ACY The 16-bit output from the Arithmetic and Boolean logic. together with the Carry status. passes to the Shifter and Byte Swap logic; here the 17-bit data unit may be rotated left or right. high and low-order bytes of the 16-bit data unit may be swapped. or this logic may be bypassed. The Shifter and Byte Swap logic outputs 16 bits of data. plus the Carry status. The data and the Carry status may be tested separately. and based on one of eight identifiable conditions. the Program Counter contents may be incre- mented; this provides conditional skip logic. Figure 4-5 defines the eight conditions that may cause a skip. Finally you have the option of preventing results from being stored in the Destination register; this enables conditional branch logic without modifying the contents of any Accumulator. 4-18 In summary, the five operations that can be specified by a single arithmetic/logic instruction may be illustrated as follows: Bits y through z of the quantity x. [AC] <5,0> is the low six bits of the specified Accumulator. [ ] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets, then the designated register's contents are specified. If a memory address is enclosed within the brackets, then the contents of the addressed memory location are specified. [[]] Implied memory addressing; the contents of the memory location designated by the contents of a register. A Logical AND Data is transferred in the direction of the arrow. Under the heading of STATUS in Table 4-2, an X indicates statuses which are modified in the course of the instruc- tion's execution. If there is no X, it means that the status maintains the value it had before the instruction was ex- ecuted. 4-37 Table 4-2. MicroNova and 9440 Instruction Set Summary STATUS TYPE MNEMONIC OPERAND(S) BYTES 9440 OPERATION PERFORMED C NIOIfl DEV 2 X [DEVBD) - f Set the device's Busy and Done flags according to I/O command. DIA(f) AC,DEV 2 X [AC) - [DEVA) [DEVBD) - f Read device's A buffer into Accumulator, Set the device Busy arid Done fla9s, DIB(f) AC,DEV 2 X [AC) - [DEVB] [DEVBD] - f Read device's B buffer into Accumulator, Set the device Busy arid Done. flags, DIC(f) AC,DEV 2 X [AC] - [DEVC] ~ [DEVBD) - f w CD g DOA(f} AC,DEV 2 X Read device's C buffer into Accumulator, Set the device Busy and Done flags, [DEVA) - [AC) [DEVBD) - f Write Accumulator into device's A buffer. Set the device Busy and Done flags, DOB(f) AC,DEV 2 X [DEVB) - [AC) [DEVBD) - f Write Accumulator into device's B buffer. Set the device Busy and Done flags. DOC If) AC,DEV 2 X [DEVC) - [AC) [DEVBD] - f Write the Accumulator into device's C buff~r. Set the Busy and Done flags. SKP(t) DEV 2 X If T is true for DEV, [pc) - [pc) + 1 Skip if I/O test true, 10RST X [PM]-O liON) -102 The Busy and Done flags in all I/O devices are set to O. The Priority Mask is set to 0 and interrupts are turned on. ~ _L-- Table 4-2. MicroNova and 9440 Instruction Set Summary (Continued) STATUS tyPE MNEMONIC OPERAND(S) BYTES 9440 OPERATION PERFORMED I C w »u ex:ex:z LOA AC,( ",) DISP (.IX) 2 X [AC]- [EA] «Ow Load contents of memory to Accumulator. ::!:::!:II: STA AC,( Ii) OISP (,IX) 2 f~~II: X [EA]- [AC] Store contents of Accumulator into memory. ADD(CS#) S,D(SKCND) 2 X X [0]- [0]+ [S] Add contents of Source register to contents of Destination register. Perform the specified options. SUB (CS#) S,OtSKCNO) 2 X X [0]-[0]- [5] w Subtract contents of Source register from contents of Destination register. Perform the ~ .J:o « specified options. ex: W CD w a. NEG (CStJ) S,DtSKCND) 2 X X [0] - [Si + 1 (twos complement) 0 Place twos complement of the Source register contents in the Destination register. Perform ex: w the specified options. ~ III ADC(CSti) S,OI.SKCNO) 2 X X [0]- [0]+ [5] C; w Add the ones complement of the Source tegister contents to contents of Destination register. ex: ci: Perform the specified option. w MOV(CS") 5,0 (.SKCND) 2 X X [0]-[5] ~ III C; Move contents of Source register to Destination register. Perforj'Tl the specified options. w INC (CS fI) 5,0 (.SKCND) 2 X X [0]-[5]+1 II: Place incremented Source register contents into Destination register. Perform specified options. COM (CStt) S,Oi.SKCNO) 2 X X [0]-[5] Complement the Source register contents, then move to Destination register. Perform specified options. AND (CS fI) S,OtSKCNO) 2 X X [0]- [0] A [5] AND the Source register contents with the Destination register contents. Perform specified options. Table 4-2. MicroNova and 9440 Instruction Set Summary (Continued) STATl,IS TYPE MNEMONIC OPERANDIS) BYTES 9440 OPERATION PERFORMED C a: w I- MUL 2 [ACO] -(( [ACl] * [AC2])+ [ACO)) <31,16> sw~ wI-;:) [Acll-l( [ACl] * [AC2])+ [ACO}) < 15,0> Multiply contents of AC 1 by contents of AC2 and add contents of ACO to result. a: - [PC] [(SP] +5] <15> - [C) [SP] - [Spj + 5 [FP] - [SP] Save a return block in the Stack. MTSP AC 2 [SP] - [AC1<14,0> Move the low 15 bits of the Accumulator to the Stack Pointer. MTFP At: 2 [FP] - [AC] <14,0> Move the low 15 bits of the Accumulator to the Frame Pointer. Table 4-2. MicroNova and 9440 Instruction Set Summary (Continued) STATUS TYPE MNEMONIC OPERAND(S) BYTES 9440 OPERATION PERFORMED C Q MFSP AC 2 [AC] <14,0> - [SP] w ~~ [AC] <15>-0 Uz :!i= cn Z MFFP MOve the Steck Pointer to low 15 bite of Accumulator. 0 AC 2 [AC] <14,0> - [FP] y [AC] <15>-0 Move the Frame Pointer to the Accumulator. JMP (u)DISP(,IX) 2 X [PC]-[EA] Branch unconditIoneI. JSR (u)DISP(,IX) 2 X [AC3]-[PC]+1 f" [PC] ...... [EA] ~ Branch to subroutine. Q, RET 2 X [SP] - [FP] :E [C) - [[SP)) <15> ~ "') [PC] - [[SP)) <14,0> [AC3] - [(SP] - 11 [AC2] - HSP] - 21 [ACl] - HSP] - 31 [AC2] - HSP] - 4] [SP] - [SP] - 5 Return from subroutine end pop e retum block off the Stick. w 2~ RTCEN(f) 2 X [ION] - f i=g ,J,J Eneble Reel Time Clock then let ION vie I/O commend. ~u RTCDS(f) 2 X [ION] - f a: DiAbIe R_I Time Clock then let ION vii I/O commend. Table 4-2. MicroNova and 9440 Instruction Set Summary (Continued) STATUS TYPE MNEMONIC OPERAND(S) BYTES 9440 OPERATION PERFORMED C c ISZ (II)DISPI.IX) 2 x [EA] - [EA] + 1 ~~z~ owO!- If [EA] =0 then [PC] - [PC] + 1 ~!-ci.Q Increment memory contents and skip if zero. wc(-z DSZ (II)DISPI.IX) 2 X [EA]- [EA]- 1 ~~~8 If [EA] = 0 then [PC] - [PC] + 1 0 Decrement memory contents and skip if zero. INTEN 2 X [lON]-1 Enable interrupts. Same as NIOS CPU. ~ INTDS 2 X [lON]-O 1 N Disable interrupts. Same as NIOC CPU. INTA(f) AC 2 X [AC] <5,0> -DEV !- [lON]-f a. :;) The 6-bit device code of the device closest to the CPU that is requesting an interrupt is loaded I:£: a: into the low six bits of the Accumulator. Set ION via I/O command. w !- MSKO(f) AC X [PM]- [AC] :!!: [ION]-f Move contents of Accumulator to Priority Mask. Set ION via I/O command. TRAP 2 [26,.] - [PC] [PC]- [27,.] Performs a software interrupt. SKPIt) CPU 2 X If t is true. [PC]- [PC] + 1 If interrupt or power fail condition satisfied. skip next instruction. I HALT(fI 2 X [lON]-f Set ION via I/O command. then halt. I Table 4-3. MicroNova and 9440 Instruction Set Object Codes CLOCK INSTRUCTION OBJECT CODE BYTES 9440 PERIODS ADC(CS#) S,DI.SKCND) 1ssdd 1OOrrccnwww 2 5/7 X ADDlCS#) S,DI.SKCND) 1ssdd 110rrccnwww 2 5/7 X ANDlCS#) S,DI.SKCND) 1ssdd 111 rrccnwww 2 5/7 X COMICS#) S,DI.SKCND) 1ssddOOOrrccnwww 2 5/7 X OlAf AC,DEV 011 aaOO1 ffpppppp 2 15 X DIBf AC,DEV 011aaOllffpppppp 2 15 X DICf AC,DEV 011aal0lffpppppp 2 15 X DIV 7641 2 123 DOAf AC,DEV 011aa01Offpppppp 2 10 X DOBf AC,DEV 011aa l00ffpppppp 2 10 X DOCf AC,DEV 011aallOffpppppp 2 10 X DSZ (f1:)DISPI,IX) 000llixxbbbbbbbb 2 8/10" X HALTf 011aallOffllllll 2 10 X INC(CS#) S,DI.SKCND) lssddOllrrccnwww 2 5/7 X INTAf AC 011aaOllffllllll 2 15 X INTDS 60BF 2 10 X INTEN 607F 2 10 X IORST 011aa01Offllllll 2 10 X ISZ ( f1i)DISPI,IX) 000 10ixxbbbbbbbb 2 8/10" X JMP ('f1;) DISP I,IX) OOOOOixxbbbbbbbb 2 6/8· X JSR ( f1i)DISPI,IX) 00001 ixxbbbbbbbb 2 7/9* X LOA AC (· f1i),DISP (,IX) 011aaixxbbbbbbbb 2 6/8* X MFFP AC 011 aaOOO 100000o 1 2 8 MFSP AC 011aaOl010000001 2 7 MOV(CSIf) S,DI.SKCND) lssddOl0rrccnwww 2 5/7 X MSKOf AC 011aal00ffll1111 2 10 X MTFP AC 011aaOOOOOOOOOOl 2 6 MTSP AC 011aaOl000000001 2 6 MUL 76Cl 2 86 NEG(CS11) S,DI.SKCND) 1ssddOO 1rrccnwww 2 5/7 X NIOf DEV 01100000ffpppppp 2 10 X POPA AC 011aaOl110000001 2 7 PSHA AC 011aaOl100000001 2 7 RET 6581 2 15 RTCDSf 0110101Offl11111 2 10 X RTCENf 011100lOffllllll 2 10 X SAY 6501 2 16 SKPt 01100111ttpppppp 2 15/17 X SKPT DEV 01100111ttllllll 2 15/17 X STA CPU 010aaixxbbbbbbbb 2 6/8* X SUB(CS#) AC,( ,,) DISP (,IX) 1ssdd 101 rrccnwww 2 5/7 X TRAP S,DI.SKCND) 1ssddqqqqqqq 1000 2 9 *Direct addressing. For indirect addressing, add two clock periods for each level of indirection. For auto- increment or auto- decrement locations, add three clock periods, plus two for each level of indirection. The following symbols are used in Table 4-3: aa Two bits selecting an Accumulator bbbbbbbb 8-bit signed two's complement address displacement cc Two bits selecting the carry option dd Two bits selecting the destination Accumulator ff Two bits selecting the I/O command One bit selecting indirect addressing n One bit choosing the no load option pppppp Six-bit device number rr Two bits determining the shift option ss Two bits choosing the source Accumulator 4-43 tt Two bits choosing the I/O test www Three bits selecting the skip-an-condition option xx Two bits selecting the index option Execution times shown are for MicroNova. Where two execution times are shown (for example. 5/7). the second is the instruction time if the skip or branch is taken. See Table 4-4 for 9440 execution times. Table 4-4 shows the sequences of machine cycles by which the 9440 executes instructions, interrupt and data channel requests, and commands received via lines C3 - CO. 4-44 Table 4-4.9440 Instruction Execution INSTRUCTION CYCl E TYPE AND SEQUENCE·· EXECUTION OR TIME" NO. OPERATION FETCH READ WRITE LD MAR I/O OUT I/O IN WAIT DCH (/JS) 1 Jump 1 1.5 2 Jump Indirect 3 1 2 4.5 3 Jump to Subroutine 1 1.5 4 JSR Indirect 3 1 2 4.5 5 Increment and Skip if Zero 3 1 2 4.5 6 ISZ Indirect 5 1,3 2,4 7.5 7 Decrement and Skip if Zero 3 1 2 4.5 8 DSZ Indirect 5 1,3 2,4 7.5 9 Load Accumulator 2 1 3.0 10 LOA Indirect 4 1.3 2 6.0 11 Store Accumulator 3 1 2 4.5 12 STA Indirect 5 1,3 2,4 7.5 13 Complement 1 1.5 1 .;A~!I{ 14 Negate 1.5 15 Move 1 1.5 16 Increment 1 1.5 17 Add Complement 1 1.5 18 Subtract 1 1.5 19 Add 1 1.5 20 AND 1 1.5 21 ALU with Skip 1,2 3.0 22 I/O Data In 2 1 2.5 23 1.0 Data Out 2 1 2.5 24 Skip on Busy or Done 2 1 2.5 25 Interrupt 5 3 2.4 1 7.5 26 Data Channel 1 1.0 27 Wait 1 1.0 28 Examine Accumulator 2 1 2.0 .29 Deposit Accumulator 2 1 2.0 30 Load PC 2 1 2.5 31 Examine Memory 2 1 2.5 32 Examine Next 2 1 2.5 33 Deposit Memory 3 2 1 4.0 34 Deposit Next 3 2 1 4.0 35 Continue 2 1 2.5 ·For 9440 System using ··e.g., No.6, ISZ Indirect: 2nd cycle - WRITE 4th cycle - WRITE a 10 MHz oscillator. 1st cycle - READ 3rd cycle - READ 5th cycle - FETCH Reprinted by permission of Fairchild Camera and Instrument Corporation. 4-45 !"""- I () +5V iBi -187 . G ~ Ai -A7 ... .- ..> I ) ... I LS377 Memory Address '--- 0 PRE LS74 Q IB8 - 'iB'i5 G "V CK AS - A15 . ) Bus ... r -- ~CK LS377 ~ - ~ 1 A iBO - iB7 .. A DIR G Mi50 - MD7 A .. I I(' ~ B r , '" LS245 Memory DIR G MD8 - Mi51'5 Data Bus IB8 - IB15 ... B1~ ~ A A , L r LS245 MBUSY 01 00 ;::J ~ . - ~ I MD4 - Mi59 ..) G '" CK iR4 -IR9 ... r LS378 .. iiii'i5'1O-MD15 ... G ~ iR10 - iRT5 ... r ) LS378 ~ .. ) ,J~ 01 Instruction 00 .- --.. I/O Register Address iR7 (12 bits) 1 DSO - 055 ". Bus . IBO - iB7 . DIR G A i5ATAO - DAi'A7 .. , r A LS245 B . .. 1/0 Data Bus .. A G 1 IB8 - iBi5 DIR ..L DATA8 - DA'i'A15 ... A , .. B " r ) ~ iiffi -IB15 LS245 Figure 4-18. 9440 Information Bus Demultiplexing Logic 4-46 9440 - NOVA BUS INTERFACE We will now examine logic which expands the 9440 pins and signals to the standard Nova 1/0 bus and to a typi- cal microcomputer memory bus. Table 4-1 identifies the Nova 1/0 bus that is created. We will also illustrate that part of 1/0 device interface logic which is common to any 1/0 device - that is, logic associated with Busy, Done and Interrupt flags. Our discussion of logic needed to create a memory bus is quite general. reflecting the fact that there is no standard Nova memory bus. We will therefore limit ourselves to demonstrating. in general. how typical memory bus signals may be created from 9440 signals. But we will be specific in describing logic that expands the 9440 interface to a standard Nova I/O bus. The 9440-Nova bus interface description is divided into three parts: 1) ExpanSion of the Information Bus into various Address and Data Busses required by the I/O and memory references. 2) Creation of I/O interface control signals. 3) Creation of memory interface control signals. We will examine each of the three logic expansions in turn. 9440 INFORMATION BUS EXPANSION These four busses must be created out of the bidirectional 16-bit Information Bus: 1) A bidirectional. 16-bit Memory Data Bus. 2) An output only. 15-bit Memory Address Bus. 3) A bidirectional. 16-bit I/O Data Bus. 4) An output only. 6-bit I/O Device Address Bus. We must also latch I/O instruction object codes into a buffer out of which I/O instruction code bits can be read by I/O control signal logic. The 9440 Information Bus is low true; this means a low signal level represents a binary 1, while a high signal level represents a binary O. Standard Nova 1/0 Data and Address Busses are also low true; we therefore do not need to invert signals during multiplexing and demultiplexing. There are many ways in which the 9440 Information Bus may be multiplexed to create the four required busses. We illustrate one possibility in Figure 4-18. This logic uses LS245 8-bit bidirectional tristate buffers to generate the two bidirectional Data Busses. while 8-bit and 6-bit gated. edge-triggered flip-flops create the Address Busses and the Instruction Object Code register. The Data Bus buffers each have a gate (output enable) input and a data direction input. The gate inputs are low true. Logic shown in Figure 4-18 selects the LS245 buffers while valid memory data or valid I/O data can exist. Within these select periods a data direction control signal is created to ensure that data flows in the correct direction. For the Memory Data Bus. MDO - MD15. the LS245 buffers must be selected either during a read or a write operation. as identified by MO or M1. But these two signals span addr~ and data occurring on the Information Bus. Valid data exists on the Information Bus when MBUSY is high while SYN is low: valid data from memory or CPU CPU drives address here 4-47 This timing is also illustrated in Figures 4-12 and 4-13. The logic of Figure'4-18 uses an LS74 flip-flop clocked by the low-to-high transition of MBUSY. This ensures that data is not driven in the time shaded in the preceding illustra- tion - between the high-to-Iow transition of SYN and the high-to-Iow transition of MBUSY. MO is used as the Memory Data Bus data direction control. The I/O Data Bus buffer logic is somewhat simpler. The Information Bus is dedicated to transferring I/O data for the en- tire duration of a data input or data output machine cycle, as defined by 01 high and 00 low: these two signals are therefore used to create gate (output enable) logic. The direction of the I/O data transfer is taken from IR7: this bit of the I/O instruction object code defines the direction of an I/O data transfer, as illustrated in Figure 4-18. For the Address Busses we do not use buffers: rather. we use gated-clock, edge-triggered flip-flops. This allows the ad- dress being output to be held stable on the Memory Address Bus, or the I/O Address Bus, after it is no longer on the In- formation Bus. In the case of the Memory Address Bus, the gate inputs are tied to M2, which will be low whenever a memory address is being output on the Information Bus. The high-to-Iow transition of SYN is intended to act as a memory address strobe: therefore it is inverted to clock the Memory Address Bus flip-flops when M2 is low. Observe that there are only fifteen lines on the Memory Address Bus: the high-order bit of a 16-bit memory address is reserved to indicated an in- direct address. Note also that the LS377 outputs are not tristate: therefore the Memory Address Bus will always hold the address of the most recently accessed memory location. Two LS378 6-bit gated-clock flip-flops are used to latch the lower 12 bits of instruction object codes off the Memory Data Bus, c~ati~ the I/O Address Bus and the Instruction register. The six low-order output lines provide the I/O Ad- dress Bus, SO - S5. As you can see in Figure 19-8, only the low-order 11 bits of the I/O instruction need to be decoded by I/O logic: therefore we use the 16-pin LS378 parts, rather than the 20-pin LS377s which we used for the Memory Address Bus. Like the Memory Address Bus, the Instruction register and I/O Address Bus will always hold the most re- cently latched data. The Instruction register flip-flops are clocked by the low-to-high transition of M'imSY whenever an instruction object code is on the Memory Data Bus. This condition is guaranteed by logic which enables the clock only when 01 and 00 are both low, signifying an Instruction Fetch machine cycle. If we wished to latch only I/O instruc- P tions, we could change the gate logic as follows: MDT MOO ------~ ~---..... ~ to G of each LS378 - Mg~ ; Latching the instruction object code only when its upper three bits are 011 (MOO high, MD1 and MD2 low) means that the I nstruction register will only hold I/O instructions. Latching all instructions is sufficient since an I/O execution machine cycle (01 high and 00 low) follows the fetch of an I/O instruction. Our logic will use lines 01 and 00 to indi- cate execution of an I/O instruction. Let us now examine I/O bus control signal logic. 9440-NOVA I/O BUS INTERRUPT SIGNALS Three signals on the standard Nova I/O bus are used by interrupt logic: INTR. INTA and INTP. INTR is the standard interrupt request signal. This signal can be tied directly to the9440 INT REO input. The interrupt acknowledge signal INTA is created in response to execution of the interrupt acknowledge instruction. We will describe logic which creates INTA along with other I/O bus control signals when we discuss Figure 4-19. INTP is the initial input to the highest priority device in an interrupt daisy chain. This may be illustrated as follows: INTA T I T Device Device Device atc. 1 2 3 j "PQij'f 4 4 PiN = Priority In POUT = Priority Out 4-48 INTP may be connected to the complement of the 9440 output INT ON. in which case priorities within a daisy chain will not be resolved while interrupts are disabled. Frequently the initial j5jj\j'input to a daisy chain will be tied to ground and INTP will not be used. Now interrupt priorities will be arbitrated whether or not interrupts have been enabled. As you will see. it takes very little logic to expand the 9440 interrupt signals to standard Nova I/O bus interrupt lines. But a considerable amount of interrupt-related logic must be present at external device controllers -logic which we will describe later in this chapter. 9440-NOV A DMA CONTROL SIGNALS The only DMA logic provided by the 9440 consists of a DMA request signal. DCH REO. When input low. this signal causes the 9440 to complete the instruction currently being executed. then to disable interrupts and wait. The DMA re- quest is acknowledged by outputting 01 low and 00 high. All logic which actually implements any DMA transfer must be implemented external to the 9440. We will discuss briefly what logic would be required. The Request Enable line. ROENB. goes true to permit both interrupt and DMA requests. Central DMA control logic would contain an Enable flip-flop. analogous to the CPU's Interrupt Enable flip-flop. The output of this flip-flop. ANDed with INT ON from the 9440. would I\)rovide ROENB as follows: DMAenable INT ON ---------1 D ------ RciENB The DMA request line DCHR may be connected to the 9440 DCH REO input. Thus requests will be accepted and granted by the 9440 CPU. DCHA. the acknowledgment signal. is simply decoded from lines 01 and 00: g~--------9C::)o------~ DCHP is a priority line just like INTP. DMA daisy chain priorities would be implemented similarly to interrupt priorities. The 9440 surrenders control of the System Bus when it acknowledges a DMA request; therefore external logic must perform all signal manipulations and data transfers. DCHI and DCHO. which indicate the direction of data transfer. are signals output by external DMA control logic. The DMA control logic will input DeHMO and DCHM1 from the device requesting memory access. Of the four encoded modes shown in Table 4-1. "Data Out" and "Data In" can be handled with relative ease. especially if you use an LSI chip designed for DMA control. Implementing the other two functions. "Increment Memory" and" Add to Memory". re- quires much more logic since some arithmetic is required. Indeed. a one-chip microcomputer might supply this logic. Since OVFLO is true when an "Increment Memory" or an "Add to Memory" operation produces a result greater than FFFF16. this signal would be produced by the logic which performs those operations. Figure 4-19 shows 3-to-8 and 2-to-4 decoders creating Ndva I/O Bus control signals. The signal logic directly interprets I/O instruction object code bits illustrated in Figures 4-8, 4-9, and 4-10. Note that the Instruction register bits from Figure 4-18 are low true. and that Instruction register lines are numbered according to Nova conven~ tion. where the low-order line is IR15. 4-49 iBO SELB iBi SELD SKJ5' YO C DCre iR'5 Yi DATOC 5iC iR6 B Y2 DATIe DOB iR7 A Y3 DATOB LS13S G1 Y4 om 01 OATIS DOA 00 ffi Y5 DATOA (ffij i5IA Va DATIA Y7 REffi iiITO iim 1R12 m CPU OP 10RST iR14 iRT5 DoB MSKo DiS INTA iOP B YO 10PLS iR9 A 1/2 Vi cr. LS139 CLR SKP ST 01 G Y2 STRT 00 Y3 +5V PRE CPUOP 0 Q SYN CK LS74 Prs Ci CIA 01 00 Figure 4-19. Creation of Nova I/O Bus Control Signals from 9440 Signals 4-50 Instruction object code bits are continuously read out of the Instruction register an - IR15), but I/O control sig- nals are created only during an I/O Execute machine cycle (when 01 is high and 00 is low). The logic of Figure 4-19 may be divided into these four sections: 1) Creation of simple data transfer control signals 2) Creation of I/O skip logic. 3) Creation of interrupt control signals. 4) Creation of control signals STRT, CLR and 10PLS. Let us first consider simple data transfer control signals. There are six signals: DATIA, DATIB, DATIC. DATOA. DATOB. and DATOC. These are created by the LS138 3-to-8 decode.r in Figure 4-19. and enabled when the I/O device address is other than 3F 16. If you look at Figure 4-8 you will see that instruction bits 10 and 9 (iR5 and iR'6) select one of the three registers that may exist at an I/O device, while bit 8 (iR7) differentiates between I/O data input and I/O data output. These three bits are input to the LS138 decoder so that the six data transfer signals and the Skip signal are decoded at the outputs. The decoder is enabled only during an I/O Execute machine cycle - that is. when 01 is high and 00 is low. However. if the I/O device address is 3F16. thef\ CPU OP will be true and no data transfer signal will go true. It is not strictly necessary to disable the signals with CPU OP; sirrce none of the I/O devices will be assigned the address 3F16. none of them will respond to I/O instructions with that address. The Skip control. SKP. output from the LS138 decoder. is used to enable ma and SELD onto Information Bus lines IBO and IB1. This is done using three-state buffers enabled by SKP low; the buffers in Figure 4-19 might be part of an LS 125 or an LS367 chip. SELB and SELD are inputs to the buffers. while the outputs are connected to Information Bus lines IBO and iBi'. We assume that as soon as any I/O deviCe is selected. it immediately connects its Busy and Done statuses to the SELB and SELD control lines of the I/O bus. However. SELB and SELD will not appear on Information Bus lines IBO and iBi unless a Skip I/O instruction has been executed. When an I/O instruction is executed specifying device 3F16. a set of interrupt-related I/O instructions is executed. as illustrated in Figure 4-10. Most of the instructions illl;lstrated in this figure specify events internal to the CPU. For example. "enable interrupts" and "disable interrupts" apply to CPU interrupt logic; moreover. the Skip instructions in- terrogate interrupt request status and power fail status within the CPU. "Acknowledge Interrupt" (lNTA). "Output Interrupt Mask" (MSKO) and "Clear All I/O Devices" (lORST) are the only instructions which require control signals to be generated on the I/O bus. These control signals are generated by qualifying the decoder of the in- struction bits with a device 3F16 select code. The device 3F 16 select code. CPU OP. is created by ANDing the low- order six instruction bits (lR10 through.IR15). Thus the gates producing INTA. MSKO. and 10RST are effectively switched on and off by CPU OP Note that 10RST is generated either by execution ofa "Clear I/O Devices" instruction. or by the master system Reset signal. RESET. Let us next consider logic needed to create STRT. CLR. and 10PLS. These control signals should be activated after the appropriate I/O transfer has taken place. Thus the logic in Figure 4-19 provides a gating signal. PLS. which goes low on the low-to-high transition of SYN. PLS is the IT output of the LS74 flip-flop in Figure 4-19. The timing for STRT, CLR. or. 10PLS results as follows: 10PlS. STRT. or ClR 01 00 I Instruction Fetch ~~4"'----------1/0 Execute----~I-------_tl... CPU or 1/0 Device reads data here· 4-51 The LS 139 2-to-4 decoder decodes instruction object code bits 7 and 6 (iFrn and imil. providing that the I/O instruction being executed is not an I/O Skip instruction. (The other half of the LS139 chip could be used to decode lines 01 and 00. instead of the gating logic shown in Figures 4-18 and 4-19.1 DSO Address Logic DS5 STRT Q rue BUSY CK LD74 Q ffii I/O COMPLETE +5V 10RST Q SELD CLR DONE SELECT CK LS74 Q ffii STRT SELECT 10RST PRE i5ATAii D Q iN'fR MsKo CK §YN LS74 Q +5V Figure 4-20. Busy. Done. and Interrupt Status Logic Required by I/O Device Controllers on the Nova I/O Bus NOVA I/O DEVICE CONTROLLER LOGIC Interface logic which an external device needs in order to connect to the standard Nova I/O bus depends on the nature of the external device. A minicomputer device controller may be very complex, even costing more than the minicomputer itself; that is because minicomputer devices that connect to the I/O bus are peripherals, such as printers, disks. etc. When we reduce the Nova to microprocessor terms. however. external devices con- nected to the I/O bus reduce to such primitive elements as parallel I/O ports or serial data lines. Within this 4-52 reduced context we can synthesize the minimum necessary elements of an I/O interface as consisting of three status flags: Busy, Done, and an Interrupt request. We can implement these three status flags using three LS74 flip-flops, as illustrated in Figure 4-20. Device select logic in this figure is limited to showing a select signal which will be generated true when the appropriate device code appears on the I/O device Address Bus. We have discussed I/O device select logic at various points earlier in this chapter. Let us look at the BUSY and the DONE status logic. These are the operations which may affect the condition of the BUSY and DONE statuses: 1) At the start of an I/O operation BUSY must be set while DONE is clear. This condition is identified by 01 in bits 7 and 6 (lR8 and iR9) of the I/O instruction object code, which generates the STRT control signal of the I/O bus. 2) At the completion of an operation BUSY is cleared and DONE is set. This change in status setting must be imple- mented automatically by I/O device interface logic: it alone knows when the I/O operation has been completed. 3) BUSY and DONE may be cleared by the CPU. This is specified by 10 in bits 7 and 6 (lR8 andl"R9) of the I/O instruc- tion, which generates the CLR control signal on the I/O bus. 4) There is a "Clear All I/O Devices" instruction. This instruction generates 10RST on the I/O bus: it clears BUSY and DONE statuses at all I/O devices. 5) A Master Reset must also clear the BUSY and DONE statuses. This Master Reset signal can also create 10RST, as il- lustrated in Figure 4-19. Two D-type flip-flops implement the BUSY and DONE status logic. These two D-type flip-flops are clocked by an "I/O Complete" signal which local device logic must generate. The BUSY and DONE statuses are generated by the flip- flop Q outputs which must connect to SELB and SELD, as required by I/O skip logic, which we have already described. The BUSY flip-flop uses its Set and Clear logic to control the BUSY status. The BUSY status is set by STRT and SELECT both true. This combination of STRT and SELECT sets the device BUSY status while it resets the DONE status. Either CLR and SELECT both true or 10RST true will activate the Clear input of the BUSY flip-flop. 10RST Neither of these conditions will be present when BUSY is set by the STRT pulse. Subsequently, CLR when STRT or SELECT goes false, BUSY will stay true until it is reset by "I/O Complete" or by an active Clear input. which will occur when either 10RST or both CLR and SELECT are true. STRT The DONE status is set by the "I/O Complete" pulse after BUSY has been set. Once DONE is set. it will remain true until the flip-flop is cleared. These conditions are provided by OR logic at the D input to the DONE flip-flop. The Clear input is Clctivated by anyone of the following conditions being true: 1) STRT and SELECT both true: thus the DONE status is reset at the same time as the BUSY status is set. 2) The master Reset. 10RST. 3) CLR and SELECT both true. The device interrupt may be individually disabled by a Mask Out instruction's execution: this creates the MSKO control signal used to permit the clocking of the interrupt mask flip-flops. Accompanying execution of the Mask Out instruc- tion, a 16-bit data value is output on the I/O Data Bus. An I/O Device's interrupt logic is controlled by one bit of this mask, the bit transmitted via I/O Data Bus line DATAn. Therefore DATAn becomes the D input to the interrupt mask flip-flop. A 1 in the mask bit (DATAn low) disables interrupts from the I/O device. In Figure 4-20, the Q output of the flip-flop becomes the interrupt enable signal. INT ENABLE. which gates the device's interrupt request onto INTR. The bottom flip-flop in Figure 4-20 implements interrupt logic for the I/O interface. Let us summarize the con- ditions that can affect I/O interface interrupt logic. Providing interrupts are enabled at the I/O interface, an interrupt will be requested whenever an I/O operation is completed, as identified by the DONE status going true. If INT ENABLE is true, INTR will go low as soon as the DONE status is set. Interrupt logic may be enabled by a master I/O reset therefore 10RST is connected to the flip-flop Preset input. 9440 MEMORY BUS There being no standard Nova Memory Bus, we will look at the signals available to you when you interface memory to the 9440. First return to Figure 4-18. This figure shows how stable Data and Memory Busses may be demultiplexed off the 9440 Information Bus. In order to create a Memory Bus of any type, all you need is control signals to accom- pany the Memory Data Bus and the Memory Address Bus. Figure 4-21 presents an example of memory control signals derived from 9440 signals, and Figure 4-22 shows the timing for these signals. The four D-type flip-flops of an S175 chip, along with some combinatorial logic. constitute a state machine to generate Signals required by memory and the 9440 CPU. The four flip-flops are triggered 4-53 by MEMORY CLOCK. In order that all worst-case delay times be satisfied. the frequency of MEMORY CLOCK should not exceed 23.8 MHz; if LS parts are used. the maximum worst-case MEMORY CLOCK frequency is 10.8 MHz. The com- mon clear of the four flip-flops will be activated if none of the lines MO. M1. or M2 is true. MEM ENABLE SYN ------e_---------------c. MEMORY CLOCK -----+--------------e_~ CK 1/4 S175 J----------+---t D Q t - - - - - - ADDRESS VALID CK )--------+---ID 114 S175 Q CK a t-----1~- MBtiSY 114 S175 ~~~D Qt----~ CK ENABLE ot-------, M2 ---------~~ MT -------4~_t Mo--~.....- .....- WRITE READ Figure 4-21. Memory Controls Derived from 9440 Signals Using State Machine Logic 4-54 Figure 4-22. Timing for 9440-Based Memory Controls Provided that either Mi. M1 or MO is low (signifying a memory access machine cycle) the MEM ENABLE signals will go true on the first MEMORY CLOCK after SYN goes low. MEM ENABLE will stay on until the first MEMO- RY CLOCK after SYN goes high again. On the rising edge of MEMORY CLOCK after MEM ENABLE goes on, MBUSY and ADDRESS VALID will go true. Memory control logic must return MBUSY to the CPU. since the 9440 requires interaction of the MBUSY and SYN sig- nals in order to complete memory access cycles. We discussed this earlier in this chapter. in the text accompanying Figures 4-12 and 4-13. A more complex memory interface could use MBUSY to lock out CPU memory accesses while the memory is busy -for example. while memory is responding to a direct memory access. The memory logic itself may require some signal to be true as long as a valid address is on the Memory Address Bus. Thus. our logic provides the signal ADDRESS VALID. which goes on after the contents of the Memory Address register (shown in Figure 4-18) have had time to settle. and remains until the end of the memory cycle. In Figure 4-18. the Memory Address register is clocked by the high-to-Iow transition of SYN. but a system might use the leading edge of ADDRESS VALID to clock the Memory Address register. On the MEMORY CLOCK after MBUSY goes on. the ENABLE flip-flop clocks on. If MO or Ml is low at this time, then READ or WRITE will go on and stay on until the MEMORY CLOCK after MEM ENABLE goes off. The signals READ and WRITE tell the memory chips the direction of the data transfer. Of course. different system signal and timing specifications would require different implementations of memory Sig- nals. A memory system might use one-shots or delay lines to create pulsed Signals. and simple combinatorial logic for signal levels. A state machine implementation could use a Counter or Shift register. or perhaps a field-programmable logic sequencer such as the Signetics 82S105. 4-55 DATA SHEETS This section contains specific electrical and timing data for the following devices: • MicroNova ·9440 4-01 MICRONOVA ABSOLUTE MAXIMUM RATINGS· Supply Voltage Range Vaa -2 to -7 Volts Supply Voltage Range V CC -0.3 to + 7 Volts Supply Voltage Range VDD -0.3 to ~Volts Supply Voltage Range VGG -0.3 to + 17 Volts Input Voltage Range VI -0.3 to + 7 Volts Input Current Range II o to _6_mAmps Operating Temperature Range T A o to +70 °c Storage Temperature Range T stg -55 to + 125°C Average Power Dissipation 1 Watt NOTES All voltage8 in this document are referenced to V 88 (ground). *Subjecting a circuit to conditions either outside these limits or at these limits for an extended period of time may cause irreparable damage to the circuit. As such, these ratings are not intended to be u-sed during the operation of the circuit. Operating specifications are given in the DC (STATIC) CHARACTERISTICS ,TABLE. Data sheets on pages 4-02 through 4-03 reprinted by permission of Data General Corporation. 4-D2 MICRONOVA D. C. (STATIC) CHARACTERISTICS mN601 OPERATING SPECIFICATIONS TA range_O_to~C VGG =14.1.0Volts ICC ~mAmps Average IBB Vee 5,0.25 Volts V BB = -4.25 t .25 Vol!s 100 ~mAmps Average ISS ~mAmps Average Voo = 10 • 1.0 Volts Vss = 0 - 0.0 Volts ~mAmps Average LIMITS CHARACTE R1STIC SYMBOL UNITS PINS MIN. MAX. 121,3 and 122,4 -2.0 .0.5 MB 0-1> , CLAMP -1.0 +1.0 INPUT L(YN VOLTAGE VIL Volts EXTINT. DCH INT 10 CLOCK. I 0 DATA I, -1.0 .0.5 I o DATA 2 al,3 and 122,4 +.01 MB 0-1. -2.0 INPUT CURRENT FOR mAOlps EXTINT. 0CIflN't, CLAMP -2.0 -4.0 L(YN STATE IlL I 0 CLOCK. I 0 DATA I, -2.0 -4.0 I o DATA 2 01,3 and '02,4 +13.0 +15.0 MB 0-1. , co;m; +4.25 +5.8 INPUT HIGH VOLTAGE Volts EXTINT, IlClr'lNT VIH I 0 CLOCK. I 0 DATA I, I o DATA 2 +2.5 +5.8 al,3 and 02,4 -.01 MB 0-1. -.06 INPUT CURRENT FOR mAmps 10 CLOCK. 10 DATA I, I 0 DATA 2 -1.0 HIGH STATE IIH EXTIN' . OCR INC -.02 co;m; +.001 +3.0 MB 0-1. OUTPUT LOW VOLTAGE VOL Volts I 0 INPUT: PAUSE, .0.4 SAEG. WEG. PG 1/0 CLOCK JlO DATA 1 1/0 DATA 2 +0.5 PG. I 0 INPUT +4.0 OUTPUT CURRENT FOR MB 0-1. . 1 o CLOCK LOW STATE 10L mAntps I o DATA I,. o DATA 2 +2.0 ~. SAEG. PG. HALT MB 0-1. I 0 CLOCK. I 0 DATA 1, 10 DATA 2 I 0 INPUT. PAUSE. +4.25 OUTPUT HIGH VOLTAGE VOH Volts SAEG. WEG. PG HALT C -0. -.01 M80-1. -.06 OUTPUT CURRENT FOR mAnl~ I o INPUT. PG -.02 HIGH STATE 10H 10 CLOCK. I 0 DATA 1, I 0 DATA 2, -.01 PAUSE SAEG. WEG 01,3 and .2,4 100 CLAm> INPUT CAPACIT ANCE CI pF MB 0-1. ,I o CLOCK 10 I 0 DATA 1, I 0 DATA 2 Eiffiij'f. 0CIflIrr NOTE Logic "I" is defined as the more positive voltage as are the maximum figures given under voltage limits. Logic "0" is defined as the more negative voltage as are the minimum figures given under voltage limits. Positive current, in the conventional sense, is defined as flo'wing into t,he pin. On power-up. VBB must be within its specified operating range (with respect to Vss) before any of the other power supply voltages are ap- plied to the circuit. 4-03 9440 ABSOLUTE MAXIMUM RATINGS (beyond which the useful life of the device may be impaired) Storage Temperature _65° to 15O"C Ambient Temperature Under Bias -55 to +125°C Vee Pin Potential to Ground Pin -0.5 to +6.0 V Input Voltage (de) -0.5 to +5.5 V Input Current (de) -20 to +5 mA Output Voltage (Output HIGH) -0.5 to +5.5 V Output Current (de) (Output LOW) +20 rnA Injector Current (IINJ) +500 rnA Injector Voltage (VINJ ) -0.5 to +1.5 V DC CHARACTERISTICS OVER OPERATING TEMPERATURE RANGE (0 to 75°C) hNJ(min) = 300 rnA. hNJ(max) = 400 rnA. Vee(min) = 4.75 V. Vee(max) = 5.25 V LIMITS SYMBOL CHARACTERISTIC MIN TYP MAX UNITS TEST CONDITIONS VIH Input HIGH Voltage 2.0 V Guaranteed Input HIGH Voltage VIL Input lOW Voltage 0.8 V Guaranteed Input lOW Voltage Vco Input Clamp Diode Voltage -0.9 -1.5 V Vee = 4.75 V. liN = -18 rnA IINJ = 300 mA VOH Output HIGH Voltage 2.4 3.4 V Vee = 4.75 V. IOH = -4OO,.,.A RUN. CARRY. INT ON. SYN. ClK OUT. 0 0 • 0 1 IINJ = 300 mA Q.utput.!'IGH Voltage 2.4 3.4 V Vee = 4.75 V.IOH = -1.0 rnA IBo - IB15 IINJ = 300mA ICEX Output leakage Mo. M1• M2 1.0 mA Vee = 4.75 V. VO H = 5.25 V IINJ = 300mA VOL Output lOW Voltage 0.25 0.5 V Vee = 4.75 V. 10L = 8.0 mA IINJ = 300 mA IIH Input HIGH Current _ _ _ _ _ _ _ 1.0 20 ,.,.A Vee = 5.25 V. VIN = 2.7 V Co-C3. DCH REO, INT REO, MBSY, MR IINJ = 300 mA Input HIGH Current 2.0 40 ,.,.A Vee = 5.25 V. VIN = 2.7 V CP IINJ = 300mA !!!put H..!.GH Current 5.0 100 ,.,.A Vee = 4.75 V. VIN = 2.7 V IBo - IB15 (3-State) IINJ = 300 mA Input HIGH Current 1.0 mA Vee = 4.75 V. VIN = 5.5 V All Inputs IINJ = 300mA IlL Input lOW Current -0.21 -0.36 mA Vee = 5.25V. VIN = 0.4 V All inputs except CP IINJ = 300 mA Input lOW Current -0.42 -0.72 mA Vee = 5.25 V. VIN = 0.4 V CP IINJ = 300 mA 10ZH OFF State (Hig.!!.lmp~ance) 100 ,.,.A Vee = 5.25 V. VO UT = 2.4 V Output Current IBo - IB15 IINJ = 300mA 10ZL OFF State (Hig~lmp~ance) -0.21 -0.36 mA Vee = 5.25 V. VOUT = 0.4 V Output Current IBo - IB15 IINJ = 300 mA los Output Short CircuiLCu~nt_ -15 -100 mA Vee = 5.25 V. VOUT = 0.0 V All Outputs Except Mo. M1• M2 IINJ = 300 mA Icc Supply Current 150 200 mA Vee = 5.25 V VINJ Injector Voltage 1.0 V IINJ = 300 mA Data sheets on pages 4-04 through 4-010 reprinted by permission of Fairchild Camera and Instrument Corporation. 4-04 9440 AC CHARACTERISTICS: T A = 0 to 75° C - Figures 8 & 9 LlMITS-ns SYMBOL CHARACTERISTIC NOTE MIN TYP MAX tCPSYL Propagation Delay, CLOCK to SYN going LOW 150 tCPSYH Propagation Delay, CLOCK to SYN going HIGH 160 tMBSYL Propagation Delay, MBSY going HIGH to SYN gOing LOW 70 tMBw MBSY Min Pulse Width (HIGH) 30 tMBS Set-up Time, MBSY HIGH to CLOCK -40 tMBHO Hold Time, MBSY HIGH after CLOCK 60 tCPMH Propagation Delay, CLOCK to M2, M1, Mo going HIGH 160 tCPML Propagation Delay, CLOCK to M2, M1, Mo going LOW 170 tCPOH Propagation Delay, CLOCK to 01, 00 going HIGH 160 Fig.90nly tCPOL Propagation Delay, CLOCK to 01, 00 going LOW 170 Fig. 8 Only tCPAH Propagation Delay, CLOCK to ADDRESS 180-15 going HIGH 170 tCPAL Propagation Delay, CLOCK to ADDRESS 180-15 going LOW 180 tMBAF Propagation Delay, CLOCK toADDRESS 180-15 gOing 3-state 110 tos Set-up Time, DATA 180-15 to CLOCK -110 tOHO Hold Time, DATA 180-15 after CLOCK 130 tcs Set-up Time, C3, C2, C1, Co to CLOCK -110 tCHO Hold Time, C3, C2, C1, Co after CLOCK 130 tCPRH Propagation Delay, CLOCK to RUN HIGH 160 tCPRL Propagation Delay, CLOCK to RUN LOW 170 tocs Set-up Time, DCH REO to CLOCK -110 tOCHO Hold Time, DCH REO after CLOCK 130 tiS Set-up Time, INT REO to CLOCK -100 Fig. 8 Only tlHO Hold Time, INT REO after CLOCK 120 tCPCYH Propagation Delay, CLOCK to CARRY HIGH 160 tCPCYL Propagation Delay, CLOCK to CARRY LOW 150 tCPIOH Propagation Delay, CLOCK to INT ON HIGH 200 tCPIOL Propagation Delay, CLOCK to INT ON LOW 190 NOTES: 1. The Information Bus is driven as a result of the previous cycle. 2. The Fetch and Read cycles will be stretched out for slower memories. 3. Applies to console operation using this cycle type. 4-05 9440 ·-----------------FETCHCYCLE-----------------~.I I ... ~ LrL'n..1-t.ru-t- CLKOUT " I tcPSYL~ ~ " -~ __ I...S -l -+l "'BSYL 14- ,. , I4--tcPSYH---l MBSY ....\\\\lil " 1-1- I...w~ k- " "'.HO ~ ..... "I- " --- ~tcP"H~ -lk- I--- tcPML----.J " '- JL " 00 i I4--ICPOL -...j " 0, '- _lcjAH_1 tMBAF:i los -+I 4-tDHD~ \.G) -- iio-15 ADDRESS OUT IV/, DATAl/,( DATAIN "" _IC~AL---t ..J JL --ilcs CO-3 :: X X i-ICPRL ---+-l " i--ICHO-+l RUN ,lit _ICPRH~ ------------ - - - - - - -4~- ---- '=-t~~ - - - - - - -- DCHREQ ..... 'ocs 14- CARRY :",,""-ICPCYH----.j ....-ICPCYL -\::E --J ~~ ~ " - liS ~ ~IIHO_ INTON " ""'lit MEMORY BUSY <» I4--ICPIOL --+-I ~tCP10H-----" I tiME Fig. 8 Fetch Cycle ' " " r . - - - - - - - - - - - - - - - - - - R E A D CYCLE -----------------~.I ~ ,. CLK OUT unh.h..1l..JL " .j 4-1 ... 51 ~ -+l IMBSYL 1- " 1 '4--tCPSVH ~I ~\\\\lil -I- IMBw-+l 1-4= 1_ IMBHO' """" -f- ~lcPMH--+l ~ f4--ICPML~ " MO '- .- 00 -f- _lcPOH_1 0, / " ......-......tCPAH~ b.4 BAF :i -+lIDS I-- ~loHD_1 i'io-15 ADDRESS OUT J ~DATA~ DATA IN - 4 - - tCPAL--... JL -lIes 1-. Co-3' ® !--lcHo_1 MEMORY BUSY - CO-J RUN ______________________________________________________________ DCH RED INT RED CARRV ______________________________________________________________ INTON --------------------------------------------------------- Flg.12 1/0 Out Cycle 4-08 9440 AC CHARACTERISTICS: TA = 0 to 75°C- Figures 12. 13. 14. 15 LlMITS-ns SYMBOL CHARACTERISTIC NOTE MIN TYP MAX tCPSYL Propagation Delay, CLOCK to SYN going LOW 150 tCPSYH Propagation Delay, CLOCK to SYN going HIGH 160 tCPMH Propagation Delay. CLOCK to M2, M" Mo going HIGH 160 tCPML Propagation Delay, CLOCK to M2. M" Mo going LOW 170 tCPOH Propagation Delay, CLOCK to 0,,00 going HIGH ~O tCPOL Propagation Delay, CLOCK to 0,,00 going LOW 170 tCPOH Propagation Delay, CLOCK to DATA IBo-15 going HIGH 170 tCPOL Propagation Delay, CLOCK to DATA IBo-15 going LOW 180 Fig. 12 Only tCPOF Propagation Delay, CLOCK to DATA IBo-15 going 3-state 110 tos Set-up Time, DATA IBo-15 to CLOCK -110 Fig. 13 Only tOHO Hold Time, DATA IBo-15 after CLOCK 130 tcs Set-up Time, C3, C2, C" Co to CLOCK -110 Fig. 14 Only tCHO Hold Time, C3, C2, C" Co after CLOCK 130 NOTES: 6. DUring DCH, the 94~ IS not driving the M lines An external device can control the memory when a LOW IS applied to the appropriate Milne. 7. The 9440 floats the 180-15. The Information Bus is available to the I/O devices and the memory as needed. - - - - - - - - - - - - ItO IN ------------I.~I PLA CLKOUT SYN _ _ _ _ _ of M, ---------+------~ ij,-----+-----' MO _____+-___-' OO-----+___ --tc-P-ML-~-~---------------~------ O'-----+~--t-cP-M-H~~1 ~o,~-----------------------~~~~~ co") RUN _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ _ ."i5CHiiEci iNTiiEa CARRY _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ____ INTON _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ _ Fig. 13 1/0 In Cycle 4-09 9440 t-.-----------WAIT----------_ CLK OUT 8YN ---------of Ml __________+_-------'. M' _________+_------' ~---------+--------' Oo _________~------~ 0, _ _ _ _ _ _ _ _ _ _ _ _ _- ' RUN __________________________________________________________ CARRy _________________________________________________________ INTON ______________________________________________________ Flg.14 Walt Cycle I- ~-----------DCH----------~·~I PLA CLK OUT 8YN iiiii Ml (i) ii, ilo 00 01 __________ ~--------~---------------------------------------- o iiio-15 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ~-3 _____________________________________________________________ RUN __________________________________________________________ CARRy _________________________________________________ INTON ______________________________________________________ Flg.15 Data Channel Request Cycle 4-010 Chapter 5 THE INTEL 8086 The 8086 is Intel's first 16-bit microprocessor. It is significantly more powerful than any prior microprocessor. The 8086 assembly language instruction set is upward compatible with 8080A - but at the source program level only. That is to say. every 8080A assembly language instruction can be converted into one or more 8086 assem- bly language instructions. There is no reason why anyone would try to convert 8086 assembly language instructions. one at a time. into one or more 808~A assembly language instructions. but if you did. you would soon become hopelessly tangled in conflicting memory allocations and special translation rules. That is why we say that the 8086 and 8080A assembly language instruction sets are "upward" compatible. The 8086 and 8080A assembly language instruction sets are not compatible at the object code level. which means that 8080A programs stored in read-only memory are useless in an 8086 system. The 8085 and 8080A assembly language instruction sets are identical. with the exception of the 8085 RIM and SIM in- structions. The 8085 RIM and SIM instructions cannot be translated into 8086 instructions. This is because the RIM and SIM instructions use the serial 110 logic of the 8085. which has no 8086 counterpart. Without the RIM and SIM instruc- tions. the 8085 and 8080A assembly language instruction sets are identical; therefore the 8086 assembly language instruction set must also be upward compatible with the 8086 assembly language instruction set - apart from the RIM and 81M Instructions. The 8085 and 8080A assembly language instruction sets are object code compatible - with the exception of the 8085 RIM and SIM instructions. That is to say. a program existing in read-only memory could be used with one microprocessor or the other. The 8080A assembly language instruction set is a subset of the l80 assembly language instruction set. That is to say. the l80 will execute an 8080A object program - but the reverse is not true. The 8080A cannot execute l80 programs when the full l80 instruction set is used. The 8086 assembly language instruction set is not upward compatible with the Z80 assembly language instruction set. As a historical note. it is worth mentioning that the 8008 microprocessor. which preceded the 8080A. was also com- patible only at the source program level. That is to say. there is an 8080A assembly language instruction for every 8008 assembly language instruction. but the two microprocessor object code sets are not the same. The various instruction set compatibilities that we have described may be illustrated as follows: (Excluding RIM and SIM instructions) -.. 8086 • ~ 8085 + IL _______ ______ ..JI - - Source program of lower microprocessor 8080A ~ can be assembled to generate upper microprocessor object program - - - Lower microprocessor instruction set is a + subset of upper microprocessor instruction 8008 set at the object program level 5-1 These are the most interesting innovations to be found in 8086 hardware design: 1) 8086 Central Processing Unit logic has been divided into an Execution Unit (EU) and a Bus Interface Unit (BIU). These two halves operate asynchronously. The Bus Interface Unit handles all interfaces with the external bus; it generates external memory and I/O addresses and has a 6-byte instruction object code queue. Whenever the EU needs to access memory or an I/O device, it makes a bus access request to the Bus Interface Unit. Providing the Bus Interface Unit is not currently busy, it acknowledges the bus access request from the EU. When the Bus Inter- face Unit has no active pending bus access requests from the EU, it performs instruction fetch machine cycles to fill the 6-byte instruction object code queue. The CPU takes its instruction object codes from the front of the queue. Thus instruction fetch time is largely eliminated. 2) The 8086 has been designed to work in a wide range of microcomputer system configurations, ranging from a sim- ple one-CPU system to a multiple-CPU network. To support this wide flexibility, a number of 8086 pins output alternate Signals. This may be illustrated as follows: Minimum Configurations Maximum Configurations These Signals These signals do not change do not change 8086 8086 +5 V Simple control output Complex control signals for use in one-CPU useful in multi-CPU MN/MX MN/MX system networks The same pins output these two sets of signals, based on a level of MN/MX. This wholesale re-allocation of Signals is a highly imaginative and innovative first for the microprocessor industry. 3) The 8086 has built-in logic to handle bus access priorities in multi-CPU configurations. (This is not a new concept National Semiconductor's SCIMP has had it for years.) 4) In mUlti-CPU configurations, each 8086 CPU can have its own local memory, while simultaneously sharing com- mon memory. The common memory may be shared by all CPUs, or by selected CPUs. 5) The 8086 has been designed to compete effectively in program intensive applications that have been the domain of the minicomputer. Up to a million bytes of external memory can be addressed directly. All memory addressing is base relative; this memory addressing technique naturally generates relocatable object programs. (Relocatable ob- ject programs can be moved from one memory address space to another and re-executed without modification.) Also, since the 8086 utilizes stack-relative addressing, re-entrant programs are easily written. (Re-entrant programs can be interrupted in mid-execution and re-executed. For example, a subroutine which calls itself is re-entrant a program which can be interrupted in mid-execution by an external interrupt, and then re-executed within the in- terrupt service routine, is also re-entrant. 6) The 8086 uses prefix instructions that modify the interpretation of the next instruction's object code. The 8086. like its predecessor. the 8080A. is really one component of a multiple-chip microprocessor configura- tion. In addition to the 8086 microprocessor itself. you must have an 8284 Clock Generator/Driver. Yau cau Id create the required clock Signal using alternative logic, but it would be neither practical nor economical to do so. The third device necessary in some 8086 microprocessor configurations is the 8288 Bus Controller. You will usually have an 8288 Bus Controller between an 8086 and its System Bus (or busses), just as you will usually have an 8288 System Bus controller between an 8080A and its System Bus. In the case of the 8086, however, you can dispense with the 8288 Bus Controller in Single-bus configurations - and pay no penalty for it. 5-2 The 8086 has a large family of support devices. In this chapter we describe the following support devices: • The 8284 Clock Generator/Driver • The 8288 Bus Controller • The 8282/8283 8-bit input/output latches • The 8286/8287 8-bit parallel bidirectional bus drivers The 8088. an 8-bit version of the 8086. is also described. The primary manufacturer of the 8086 is: INTEL CORPORATION 3065 Bowers Avenue Santa Clara. California 95051 Second sources are: MOSTEK CORPORATION 1215 West Crosby Road Carrollton. TX 75006 NEC MICROCOMPUTERS INC. Five Militia Drive Lexington. MA 02173 SIEMENS AG Components Group Balanstrasse 73. D8000 Munich-80. West Germany The 8086 is manufactured using N-channel depletion load. silicon gate technology. It is packaged in a 40-pin DIP. A single +5 V power supply is required. All signals. with the exception of the clock input. are TTL-level compatible. The clock input must be an MOS level signal: it is generated by the 8284 Clock Generator/Driver device. which is described later in this chapter. Instruction execution times will vary depending on how effectively instruction queuing is used. Typically. between 2 and 30 clock cycles are required to execute an instruction. Multiplication and division instructions require more execu- tion time. Clock cycles may be as short as 125 nanoseconds. An 8 MHz version of the 8086 has been announced: it is identified as the 8086-2. The 4 MHz ver- 8086 sion is called the 8086-4. The standard 5 MHz 8086 is referred to without a suffix. There is no 8086-2 difference between the three versions other than maximum allowed clock speeds. 8086-4 5-3 THE 8086 CPU Functions implemented on the 8086 microprocessor chip are illustrated in Figure 5-1. Interrupt priority arbitration logic is shown as only half present external logic. such as an 8259A. must provide a device code identifying an interrupt. but all arbitration and vectoring logic is subsequently handled by logic within the CPU. It is worth noting that bus interface logic. which is shown as present in Figure 5-1. is much more extensive than other microprocessors provide. One could rightfully demand that bus interface logic therefore be shown as absent in equiva- lent figures for other microprocessors. Clock Logic Interface Logic Programmable I/O Ports Timers Memory Figure 5-1. Logic of the Intel 8086 CPU 5-4 8086 PROGRAMMABLE REGISTERS AND ADDRESSING MODES We describe 8086 programmable registers in conjunction with 8086 addressing modes, since many 8086 pro- grammable registers are there only to support memory addressing logic. 8086 programmable registers are il- lustrated in Figure 5-2. Shaded registers are 8086 equivalents for 8080A registers. 8080A register names are shown in the left margin. Let us first examine the general purpose registers, AX, BX, ex, and OX. These locations 8086 AND are treated as four 16-bit registers or eight 8-bit registers; they also reproduce the 8080A 8080A general purpose registers as follows: REGISTERS' COMPATIBILITY AH has no 8080A equivalent. Do not confuse it with the 8080A PSW. AL is equivalent to the 8080A A register. BH is equivalent to the 8080A H register. BL is equivalent to the 8080A L register. CH is equivalent to the 8080A B register. CL is equivalent to the 8080A C register. DH is equivalent to the 8080A D register. DL is equivalent to the 8080A E register. Consistent with 8080A register utilization. register AX serves as a primary Accumulator. Input and output instructions pass data through AX (or AU in preference to other general purpose registers; also. selected instruction access AX (or AU contents only. In addition to serving as a general purpose Accumulator, register BX can serve as a base 8086 BX register when computing data memory addresses. REGISTER Register ex serves as an Accumulator; it is also used as a counter by multi-iteration instruc- 8086 ex tions; these instructions terminate execution when register CX contents increment or decrement REGISTER to O. Some 1/0 instructions move data between an identified 1/0 port and the memory location addressed by Register OX. Register DX may also serve as an Accumulator. When looking at general purpose registers AX. BX, Cx. and Ox. there is plenty of opportunity to be confused by terminology. Intel literature identifies the four 16-bit registers via the labels AX, BX, CX, and DX. Each of these 16-bit registers is subdivided by Intel literature into two 8-bit registers, as follows: 15 o +- AX bit numbers 7 07 o +- AH, AL bit numbers AH ~ I AL I AX 15 o +- BX bit numbers 7 07 o +- BH, BL bit numbers I BH 1 B7 I BX 15 o +- CX bit numbers 7 07 o +- CH, CL bit numbers I CH- - .I , -CL I CX 15 o +- OX bit numbers 7 07 o +- OH, OL bit numbers OH 1 OL I ox The 8080A Accumu lator must be reproduced by AL since selected 8080A and 8086 instructions access this register and none other. BH and BL must reproduce the 8080A Hand L registers, since only BX can contribute to an 8086 data memory address. On the surface this would appear to present a problem, since the 8080A has a limited number of instructions that use the BC and DE registers to provide 16-bit memory addresses. When 8080A source programs are reassembled to ex- ecute on an 8086 microprocessor, 8080A instructions that seek memory addresses out of the BC or OE registers become 8086 instructions that use Index registers. 5-5 15 o +- One 16-bit register 7 07 o +- Two 8-bit registers .------ A AX (= AH, AL) Primary Accumulator(s) H,L BX (= BH, BL) Accumulator(s). and Base register B,C CX (= CH, eL) Accumulator(s) and Counter register 0, F OX (= DH, DL) Accumulatorisl and I/O Data Counter ~ These names apply to 16-bit registers ' - - - - - - - 4 t - - - - - - - These names apply to 8-bit registers 15 o +- Bit number Sf' Stack Pointer (SP) } Base Pointer (BP) r-.::c._ _ _ _ _ _ _ _....,0 +- Bit number I ndex registers Source Index (Si) :=================:IDestination Index (01) r-:~~~~-""~~~"" +- Bit number PC '--'-'-'-'-'-'-'-'-'-'-'-'-'-'-'-'-""""1 Program Counter (PC) 15 0 +- Bit n·umber 8 Code Segment (CS) } Data Segment (OS) Segment registers Stack Segment (SS) Extra Segment (ES) 15 0 +- Bit number Ir ~------"'I Status Shaded registers are 8086 equivalents for 8080A registers. 8080A register names are shown in the left margin. Figure 5-2. 8086 Programmable Registers 5-6 All 8086 memory addresses are computed by summing the contents of a Segment register 8086 and an effective memory address. The effective memory address is computed via a variety of SEGMENT addressing modes, as it would be for any other microprocessor. The selected Segment register REGISTERS contents are left-shifted four bits, then added to the effective memory address to generate the ac- tual address output as follows: Segment Register contents: xxxxxxxxxxxxxxxxoooo Effective memory address: + OOOOyyyyyyyyyyyyyyyy Actual address output: XXXZZZZZZZZZZZZZyyyy x, Y and Z represent any binary digits. Thus a 20-bit memory address is computed - which allows 1.048.576 bytes of external memory to be ad- dressed directly. The Segment registers of the 8086 are unlike any other microprocessor registers described in this book. They act as base registers which can point to any memory location that lies on an address boundary that is an even multiple of 16 bytes. Using arbitrary memory addresses, this may be illustrated as follows: Memory Address 334DF16 CS Segment register - - - - . 234E016 contains 234E'6 ES Segment register --+- OA320;6 contains OA3216 OS Segment register - + ~:":"":":"":":""'""-:":""'""-'""-.0....1 021 FO 16 contains 021F'6 As illustrated above, each Segment register identifies the beginning of a 65,536-byte memory segment. Since the 8086 has four Segment registers, there will at any time be four selected 65,536-byte memory segments. The actual ad- dress output will always select a memory location within one of these four segments. For example, if an actual address output is the sum of the OS Segment register and an effective memory address, then the actual address output must select a memory location within the OS segment: that is to say, within the address range 021 F016 through 121 EF16 in the illustration above. Likewise, an actual address output. which is the sum of the CS Segment register and an effective memory address, must select a memory location within the CS segment. which in the illustration above will lie in the address range 234E016 through 3340F16. No restrictions are placed on the contents of Segment registers. Therefore, 8086 memory is not divided into 65,536- byte pages, nor do the four Segment registers have to specify non-overlapping memory spaces. Each Segment register identifies the origin of a 65,536-byte memory segment that may lie anywhere within addressable memory and mayor may not overlap with one or more other segments. Even though Segment registers can create overlapping or non-overlapping segments, they do have dedicated address- ing functions. That is to say, different types of memory accesses compute memory address within specific seg- ments. 5-7 During an instruction fetch, the Program Counter contents are added to the Code Segment 8086 CODe register (CS) contents in order to compute the memory address for the instruction to be fetched. SEGMENT This may be illustrated as follows: REGISTER AND PROGRAM i5 o COUNTER 7 07 o AX = AH+AL BX = BH+BL CX = CH+CL OX = DH+OL 15 o 5P BP 51 01 PC M M M M 15 o OMMMM C5 05 N N N N -- NNNNO PPPPM Actual program memory address output. 55 E5 M, N, and P represent any hexadecimal digits. 5-8 Any Stack instruction such as a Push. Pop. Call. or Return adds the Stack Pointer contents to 8086 STACK the Stack Segment register (55) contents in order to compute the address of the Stack location SEGMENT to be accessed. This may be illustrated as follows: AND STACK POINTER 15 0 REGISTERS 7 07 0 AX = AH+Al BX = BH+Bl CX = CH+Cl OX = OH+Ol 15 0 SP M M M M BP 51 DI PC 15 CS OS S5 N N N N OMMMM E5 NNNNO PPPPM Actual Stack operation address output. Once again. M. N. and P represent any hexadecimal digits. 5-9 Instructions that process data strings use the SI and 01 Index registers. together with the 8086 EXTRA Data Segment register (OS) and the Extra Segment register (ES), in order to identify string SEGMENT. source and destination addresses. This may be illustrated as follows: SOURCE INDEX AND 15 o DESTINATION 7 07 o INDEX AX = AH+AL REGISTERS BX = BH+BL CX = CH+CL DX = DH+DL 15 o SP BP SI J J J J Destination string address. ~ DI K K K K ..- OKKKK PC NNNNO Actual data string RRRRK .......- - address output. CS 15 0 \ Source string address. OJJJJ DS M M M M j - MMMMO l/ Actual data string SS SSSSJ .........- - address output. ~ ES N N N N J. K. M. R. and S all represent any hexadecimal digits. As the above illustration would imply. instructions that process strings require that the source and destination strings reside within a single 65.536-byte address range but not necessarily the same 65.536-byte range. 5-10 Instructions that access data memory add an effective memory address to the Data Seg- 8086 DATA ment register (OS) or the Stack Segment register (55). This may be illustrated as follows: SEGMENT AND STACK Program SEGMENT Memory. REGISTERS as addressed by PC and CS 15 o 7 07 o AX =AH+Al BX = BH+Bl CX = CH+Cl OX = OH+Ol ~ 15 0 SP i, - BP SI 01 OXXXX y y Y Y0 .....- - - Effective address segment base. PC ZZZZ X" Actual data address output. 15 o CS OS ~------------~ SS ES x, y, and Z represent any hexadecimal digits. When a data memory address is created, as illustrated above, the BX, BP, SI. and DI registers' contents, plus a displace- ment coming from the instruction object code, may contribute to the effective memory address. There are, however, very specific register and displacement combinations that can create an active memory address, as summarized in Ta- ble 5-1. Each case specifies either the DS or SS register as the default source for the segment base address. 5-11 Table 5-1. A Summary of Intel 8086 Memory Addressing Options Possible Displacements Memory Segment Base Index 16-Bit 8-Bit. Reference Register Register Register High-Order Bit None Unsigned Extended 51 X X X None OS 01 X X X (Alternate": 51 X X X CS, 55 or ES) BX 01 X X X Normal Data Memory None X X X Reference OS None None X 51 X X X 55 (Alternate" : BP 01 X X X CS, OS, or ES) None X X Stack 55 SP None String OS None 51 Data None ES 01 Instruction CS PC None Fetch Branch CS PC None X I/O Data OS OX None " The segment override allows OS or 55 to be replaced by one of the other segment registers X These are displacements that can be used to compute memory addresses. When creating any data memory address. you can add a prefix to an instruction to select a Segment register other than the default Segment register. You can only select a Segment register other than the default Segment register when ad- dressing data memory. You must live with the default Segment register when creating program memory addresses. Stack addresses. or string instruction addresses. It is very important to note that the 8086 has a whole set of data memory addressing options aimed at access- ing the Stack as though it were a data area. That is to say. in addition to the normal "Push" and "Pop" type Stack in- structions. the 8086 allows normal data memory access instructions to address the Stack. Many assembly language programmers use the Stack to store addresses. and as a general depository for data that must be transmitted between program modules. Anyone favoring this assembly language programming philosophy will be delighted with 8086 data memory addressing options. 5-12 Let us now examine the various data memory addressing options in detail. Refer to Table 5-1. In the simplest case. we have straightforward direct memory addressing. A 16":bit displace- r-----. 8086 DIRECT .. ment provided by two instruction object code bytes is added to the Data Segment register in order MEMORY to create the actual memory address. This may be illustrated as follows: ADDRESSING 15 o 7 07 o AX = AH+AL 1 - - - - - + - -........ BX = BH+BL CX = CH+CL OX = OH+OL 15 o 5P BP 1----------1 51 01 ,0 M M M M 1---------1 ,NNNNO PC M M M M PPPPM .\ Program 15 Memory C5 N N N N OS R R R R 55 PPPPM E5 o RRRRO HHLL"'-{ H L L H PPPPM+1 PPPPM+2 Actual data memory address output for direct memory addressing. ~.. 5 5 5 5 L - -...... H. L. M. N. P. R. and S all represent any hexadecimal digits. Note that a 16-bit address displacement. when stored in program memory. has the low-order byte preceding the high- order byte. This is consistent with the way the 8080A stores addresses in program memory. DS must provide the Segment base address when addressing data memory directly. as illustrated above. 5-13 Direct, indexed addressing is also provided. The SI or 01 register may be selected as the Index 8086 IMPLIED register. You have the option of adding a displacement to the contents of the selected Index MEMORY register in order to generate the effective address. If you do not add a displacement. then you ADDRESSING have, in effect, implied memory addressing via the SI or DI register. This may be illustrated as follows: 15 o 7 07 o AX = AH+AL BX = BH+BL CX = CH+CL OX = OH+OL 15 o 5P BP 51 01 PC 15 C5 05 55 R R R R - OXXXX - 5RRRRO S S 5 X 4 - - Actual data memory address output for implied memory addressing E5 (You may substitute CS, S5 or E5 for 05 by executing a 1-byte instruction prefix.) X, R. and S represent any hexad~cimal digits. If a displacement is added to the contents of the selected Index register, then you may 8086 DIRECT. specify an 8-bit displacement or a 16-bit displacement. A 16-bit displacement is stored in two INDEXED object code bytes; the low-order byte of the displacement precedes the high-order byte of the dis- ADDRESSING placement as illustrated for direct memory addressing. Wan a-bit displacement is specified. then the high-order bit of the low-order byte is propagated into the high-order byte to create a 16-bit displacement. This may be illustrated as follows: Displacements: Sign extended: 5-14 We may now illustrate direct, indexed addressing as follows: 15 o 7 07 o AX = AH+AL t----+----t BX = BH+BL CX = CH+CL t----+---......... OX = OH+OL 15 0 SP BP SI 01 PC M M M M OMMMM NNNNO P P PPM Program 15 C MemorY CS N N N N OS R R R R PPPPM SS ES Oyyyy_{ OXXXX PPPPM+1 PPPPM+2 PPPPM+3 Actual data memory address output for - - - . . Z Z Z Z Z direct, indexed memory addressing. (You may substitute CS, SS or ES for OS by executing a 1-byte instruction prefix.) M. N, p, R, X, y, and Z all represent any hexadecimal digits. YYYY is the 16-bit or 8-bit displacement taken from program memory. XXXX is the index taken from either the 01 or the SI register. The effective memory address can be computed using base relative addressing. You have '8086 BASE two sets of base relative addressing ~ptions: RELATIVE, 1) Data memory base relative addressing, which is within the DS segment (data memory). INDEXED ADDRESSING 2) Stack base relative addressing, which is in the SS segment (Stack memory). 5-15 Data memory base relative addressing uses the BX register contents to provide the base 8086 DATA for the effective address. All of the data memory addressing options thus far described MEMORY BASE are available with base relative data memory addressing. In effect, base relative data RELATIVE memory addressing merely adds the contents of the BX register to the effective memory ADDRESSING address which could otherwise have been generated. Here. for example. is an illustration of base relative direct addressing: 15 o 7 07 o AX = AH+AL BX = BH+BL K K K K CX = CH+CL OX = OH+OL ~ 15 0 SP BP SI 01 PC M M M M -- OMMMM . ~ NNNNO Program 15 0 ~ PPPPM Memory ~I-------I CS N N N N V OS R R R R SS ES ~OKKKK OHHLL R R R R 0 . . . -{ PPPPM ~---I PPPPM+1 PPPPM+2 Actual data memory address output for base relative. direct. indexed memory - - . S S S S S addressing. (You may substitute CS. ES or SS for OS by executing a 1-byte instruction prefix.) Simple. direct addressing. which we described earlier. always generated a l6-bit displacement. Base relative. direct ad- dressing allows the displacement. illustrated above as HHLL. to be a l6-bit displacement. an 8-bit displacement with sign extended. or no displacement at all. 5-16 Base relative implied data memory addressing simply adds the contents of the BX register to the selected Index register in order to compute the effective memory address. This may be illustrated as follows: 15 0 7 07 0 AX = AH+AL BX = BH+BL K K K K CX = CH+CL OX = OH+OL 15 SP BP SI 01 PC 15 OKKKK CS OXXXX OS R R R R .. RRRRO SS __- - Actual data memory address output for SSSSS ..... base relative, implied memory addre'ssing. ES (You may substitute CS, SS or ES for OS by executing a 1-byte instruction prefix.) 5-17 Base relative. direct. indexed data memory addressing may appear to be complicated. but in fact it is not. We simply add the contents of the BX register to the effective memory address. as computed for normal direct. indexed address- ing. Thus. base relative. direct. indexed data memory addressing may be illustrated as follows: 15 0 7 07 0 BX = BH+BL K K K K CX = CH+CL OX = OH+OL 15 SP BP SI 01 PC M M M M OMMMM NNNNO PPPPM 15 Program \ Memory CS N N N N OS R R R R SS PPPPM ES OKKKK { PPPPM+1 OYYYY~ PPPPM+2 OXXXX PPPPM+3 Actual data memory address output for base relative. direct. indexed memory ~ Z Z ZZ Z addressing. (You may substitute CS. S5 or ES for OS by executing a 1-byte instruction prefix.) 5-18 The 8086 also has Stack memory addressing variations of the base relative, data memory addressing options just de- scribed. Here, for example, is base relative, direct Stack memory addressing: 15 0 7 07 0 AX = AH+AL BX = BH+BL CX = CH+CL OX = OH+OL 15 0 SP BP K K K K SI 01 PC M M M M I---+-~ 0 M M M M NNNNO P P PPM Program Memory ~ 15 CS N N N N 1-------1 OS SS R R R R PPPPM ES OKKKK { PPPPM+1 o H H L L . - - 1-----1 R R R R0 PPPPM+2 Actual Stack memory address output for ~~SSSSS base relative, direct memory addressing. - -.. (You may substitute CS, ES or SS for OS by executing a 1-byte instruction prefix.! In the illustration above, the displacement HHLL must be present either as a 16-bit displacement or as an 8-bit dis- placement with sign extended. Remember, base relative, direct data memory addressing also allows no displacement. However, base relative, direct Stack memory addressing requires a displacement. These options are summarized in Ta- ble 5-1. 5-19 Here is an illustration of base relative, implied Stack memory addressing: 15 0 7 07 0 AX = AH+AL BX = BH+BL ex = CH+CL OX = OH+OL 15 0 SP BP K K K K SI 01 PC 15 CS OS SS R R R R RRRRO Actual Stack memory address output for ES SSSSS '4 base relative, implied memory addressing. (You may substitute CS, OS or ES for SS by executing a 1-byte instruction prefix.) X, R, and S represent any hexadecimal digits. 5-20 Here is an illustration of base relative. direct. indexed Stack memory addressing: 15 0 7 07 0 AX = AH+AL BX = BH+BL CX = CH+CL OX = OH+OL 15 0 SP BP K K K K 51 01 PC M M M M 1---+---+-11" 0 M M M M -------~ NNNN0 PPPPM 15 Program Memory CS N N N N t-------t OS 55 A A A A \ PPPPM ES t----tPPPPM + 1 ~ { PPPPM + 2 1------41 Actual Stack memory address output for PPPPM + 3 base relative, direct, indexed memory addressing. (You may substitute CS, OS or ES for 55 by executing a 1-byte instruction prefix.! There is one anomolous 8086 addressing mode that can cause confusion. One variation of I/O in- 8086 1/0 structions addresses an 1/0 port via the OX register. The OX register contents are output on PORT the Address Bus, to be interpreted as an liD port address. This means you can have up to 65.536 ADDRESSING I/O port addresses. Since the DX register contents are being output as an I/O port address. it is not added to any Segment register contents. Thus. the DX register outputs an address in the range 000016 through FFFF16. This is the only case in which a register's contents are output directly as an address on the Address Bus. with- out first passing through segmentation logic. All 8086 Branch-on-Condition instructions use program relative addressing. This feature 8086 allows dynamically relocatable code. The Branch-on-Condition instruction provides an 8-bit. PROGRAM signed binary displacement that is added to the contents of the Program Counter. Thus. Branch- RELATIVE on-Condition instructions have an addressing range of -128 through + 127 bytes from the loca- ADDRESSING tion of the Branch-on-Condition. The queuing of instruction object codes has no impact on Branch-an-Condition logic, or the branch addressing range. 5-21 8086 Jump and Subroutine Call instructions offer these addressing options: 1) Program relative addressing. An 8-bit or 16-bit displacement is added to the contents of the Program Counter. 2) Direct addressing. New 16-bit addresses provided by the instruction are loaded into the Program Counter and the CS Segment register. 3) Indirect addressing. Any of the data memory addressing options may be used to read data 8086 from data memory. However. the data input is interpreted as a memory address. You have two INDIRECT indirect addressing options. A single 16-bit data word may be read. in which case it is loaded ADDRESSING into the Program Counter and the Jump or Call references a memory location within the cur- rent CS segment. You can also read two 16-bit data words; the first is loaded into the Program Counter and the second is loaded into the CS Segment register. Thus you can Jump or Call indirectly any addressable memory loca- tion. 8086 STATUS The 8086 has a 16-bit Stack register with the following satus bit assignments: 15141312 11 10 9 8 7 6 5 4 3 2 1 0 +- Bit No. 1-1-1-1-1 0 I D II I Tis I z I-I A I-I pi-I C I Status register I I I I I I I t Reserved bits. normally 0 L Carry Parity Auxiliary Carry Zero Sign Trap Interrupt enable/disable Direction Overflow The Carry, Auxiliary Carry, Overflow, and Sign statuses are quite standard; see Volume 1 for a description of these statuses. The Auxiliary Carry status is identical to the 8080A status with the same name. It represents carries out of bit 3 in an 8-bit data unit as described in Volume 1. Chapter 2. Subtract instructions use twos complement arithmetic in order to subtract the minuend from the subtrahend. However, the Carry status is inverted. That is to say, following a subtract operation, the Carry status is set to 1 if there was no carry out of the high-order bit, and the Carry status is reset to 0 if there was a carry out of the high-order bit. The Carry Status therefore indicates a borrow. The Parity status is set to 1 when there is an even number of 1 bits in the result of a data operation; an odd number of 1 bits causes the Parity status to be reset to O. The Zero status is completely standard. It is set to 1 when the resu It of a data operation is zero; it is set to 0 when the result of a data operation is not zero. The Direction status determines whether string operations will auto-increment or auto-decrement the contents of I ndex registers. If the Direction status is 1. then the SI and Dllndex registers' contents will be decremented; that is to say. strings will be accessed from the highest memory address down to the lowest memory address. If the Direction status is O. th.en the SI and Dllndex register contents will be incremented; that is to say. strings will be accessed begin- ning with the lowest memory address. The Interrupt status is a master interrupt enable/disable. This status must be 1 in order to enable interrupts within the 8086. If this status is O. then all interrupts except the NMI (Non-Maskable Interrupt) will be disabled. The Trap status is a special debugging aid that puts the 8086 into a "single step" mode. The single step mode is de- scribed in detail together with 8086 interrupt logic. since it depends on this interrupt logic for its existence. The Carry, Auxiliary Carry, Parity, Sign, and Zero statuses are also found in the 8080A. The Overflow, Direction, Interrupt, and Trap statuses are new in the 8086. 5-22 8086 CPU PINS AND SIGNALS 8086 CPU pins and signals are illustrated in Figure 5-3. GND AD14 -- .. -.. 1 40 .. VCC AD15 AD13 AD12 -- ·..... 2 3 4 39 38 37 -- A16/S3 A17/S4 AD11 - - 5 36 --. A18/S5 - - · -- AD10 6 35 A19/S6 AD9 ·.. 7 34 B'FfE"/S7 - --- ·-.. AD8 MN!MX -- 8 33 AD7 ... RD --- ---.. 9 32 AD6 AD5 -- - 10 11 8086 31 30 .. RO/GTO, HOLD 'FfCi/GTf, HLDA --... ..· AD4 12 29 · LOCK, WR AD3 13 28 ·--.. 52, M/iO AD2 AD1 -- ·.. 14 15 27 26 --· Sf, DT/R' SO, DEN ADO NMI - ...- 16 17 25 24 - OSO, ALE OS1,INTA INTR ClK GND 18 19 20 23 22 21 ---- TEST READY RESET Pin Name Description Type ADO-AD15 Data/Address Bus Bidirectional, Tristate A 16/S3, A17/S4 Address/Segment Identifier Output, Tristate A18/S5 Address/Interrupt Enable Status Output, Tristate A19/S6 Address/Status Output, Tristate BHE/S7 High-order Byte/Status Output. Tristate Ri5 Read Control Output, Tristate READY Wait State Request Input TEST Wait for Test Control Input INTR Interrupt Request Input NMI Non-maskable Interrupt Request Input RESET System Reset Input ClK System Clock Input MN/MX = GND for a Maximum System Maximum { SO, 5152 Machine Cycle Status Output. Tristate System Jm/G'rn, m/GTi Local Bus Priority Control Bidirectional Signals OSO, aS1 Instruction Oueue Status Output, Tristate IOCK Bus Hold Control Output, Tristate MN/MX = VCC for a Minimum System M/IO Memory or I/O Access Output, Tristate WR Write Control .Output, Tristate Minimum ALE Address latch Enable Output. Tristate System DTiR Data Transmit/Receive Output, Tristate Signals om Data Enable Output, Tristate INTA Interrupt Acknowledge Output HOLD Hold Request Input HlDA Holr;! Acknowledge Output VCC,GND Power, Ground Figure 5-3. 8086 Pins and Signal Assignments 5-23 The 8086 outputs a 20-bit memory address. Data is accessed as 16-bit words. subdivided into a low-order byte and a high-order byte. Therefore the 8086 needs a 20-line Address Bus and a 16-line Data Bus. In order to have a 40-pin package. the low-order 16 Address Bus lines are multiplexed with the Data Bus. i'H'E may be looked upon as an additional Address Bus line, since it is used to identify the high-order byte of a memory word. while ADO identifies the low-order byte of the memory word. The four high-order Address Bus lines. together with 8HE. are multiplexed with five status I.ines. thus. we can illustrate Address Bus line multiplexing as follows: Data/Status Address Status S7 BRt High-order byte of selected word DO AO Low-order byte of selected word 16-bit data word { D1 .... 015 A1 - A15 } Address of a 16-bit word Status S3 - S6 A16 - A19 It is easy to become confused when looking at how the Address Bus, together with BHE, is used 8086 to access memory. As seen by external memory. Address Bus lines are interpreted as follows: EXTERNAL MEMORY ADDRESSING Low-order Memory .... Select byte select ~ memory logic bank AO A18 DO 07 • ... j~ • ... .. ADO :. ADO AD1 AD7 .=. -. ::: · _. , ··-- AD1 AD7 AD8 -. . .. AD8 ~ AD15 _.· -._.· j ·.-. AD15 SHE - A19 - j ··: '8HE ~ A19 ... ... ~~ ~ ~ ~ AO A18 DO 07 High-order ..- Memory select .. - byte memory Select logic bank 5-24 In the previous illustration you will see that memory is indeed organized as bytes. The data pins of the low-order byte memory bank connect to ADO-AD7. The high-order byte memory bank data pins connect to AD8-AD15. The low-order and high-order byte memory banks each have memory select logic that decodes AD1-A 19. These 19 ad- dress lines become inputs AO-A 18 at the illustrated memory select logic. Since each memory bank receives 19 address lines. select logic can address up to 524.288 (512K) bytes of memory. These two memory banks. taken together. con- stitute the advertised one million bytes of directly add ressable memory. Now. you may well ask why one should bother dividing memory into separate low-order and high-order byte banks. If a sixteen-bit word lies on an even-byte address boundary. then we could ignore the memory select logic connections to ADO and BHE. The address on AD 1-A 19 becomes an address identifying a 16-bit word. which just happens to be im- plemented as two separate 8-bit memory banks. If an 8086 16-bit memory word does lie on an even-byte address boundary. then the low-order byte address is. in fact. the only address output. BHE is pulsed low while the low-order byte address is being output. and both memory banks consider themselves selected even though (in theory) the high-order memory bank's address has not been output. To illustrate what happens. consider the memory addresses 02A4016 and 02A4116. One would normally expect the two addresses to be output sequentially in order to access the low-order byte and then the high-order byte of the 16-bit word. This may be illustrated as follows: ADO-AD7 AD8-AD15 AD16-AD19 Output Input Output Input address data address data 02A40 16 from 02A41 16 from byte byte 02A4016 02A41 16 But we could just as easily output the low-order byte address only. using BHE as an extra address line to substitute for the odd-byte address - which is never output. This may be illustrated as follows: ADO-AD7 AD8-AD15 AD16-AD19 Output address 02A4016 Assume address 02A4116 has been output 5-25 If a word lies on an odd-byte address boundary, then two byte addresses must be output to access the two halves of the 16-bit word. This may be illustrated as follows: First memory Return low- Second Return high- access is to crder byte memory order byte a byte in of 16-bit access is to a of 16-bit the high- word via byte in the word via order byte AD8-AD15 low-order ADO-AD7 memory byte memory bank. i.e. bank. i.e. an odd byte an even byte address. with address. with ADO high ADO low When a 16-bit word lies on an odd-byte address boundary. as illustrated above. the low-order byte is input first via AD8-AD15. then the high-order byte is input via ADO-AD7. Logic internal to the 8086 switches the data bytes into their correction locations. Intel could have elected to implement external memory as 16-bit words, which would eliminate BHE along with the Address Bus complexities we have just described. But this would have forced all instruction object codes, and data, to be accessed as 16-bit units. Why not do it? One of the most interesting hindsight discoveries that 8080A users have made is the fact that the 8080A is extremely efficient in its use of memory. By having a large number of 8-bit object codes. the 8080A generates object programs as compact as the most powerful minicomputers on the market. But if the 8086 is to keep 8-bit object codes. and therefore the efficient memory utilization of the 8080A. then it can no longer guarantee that data will lie on even-byte address boundaries. The first 8-bit object code will force the next in- struction or data entity to begin on an odd-byte boundary. By including BHE and the extra logic needed to access 16-bit data units origined at odd-byte boundaries. the 8086 has allowed instructions to generate 1-byte. 3-byte or other odd-byte object codes. rather than 2-byte. 4-byte. and even- byte object codes only. Simply stated, this is the trade-off: simplify memory addressing so that external memory is accessed only as 16-bit data units and you will use memory less efficiently. Intel elected to make memory addressing logic more complex and memory utilization more efficient. Moving on from the Data/Address Bus, 8086 signals may be grouped into those that do not change with system complexity, and those that do. let us first look at the unchanging signals. elK is the single clock signal output by the 8284 clock generator to synchronize all 8086 logic. READY is the Wait state request which slow external logic inputs if it requires more time to respond to an access. A high READY input occurring at the proper time early in a machine cycle causes the 8086 to extend the machine cycle by inserting Wait state clock periods. 5-26 RD is a single bus control signal that does not change with system configuration. This signal is output low when the CPU is inputting data from any external source. Even though RD is output by the same physical pin under all circumstances. this signal is functionally part of the group that changes its nature depending on signal complexity. We will therefore refer again to RD when describing the sig- nals that are a function of system complexity. There are four interrupt and interrupt-related signals. INTR is a normal interrupt request input. NMI is a non-maskable interrupt request input. RESET is a system reset signal; it must be input high to the 8284 clock generator for at least four ClK clock periods. The 8284 transmits a synchronized RESET signal to the CPU. When the 8086 is reset, the following events occur: 1) The Status register is cleared. This disables external interrupts. 2) The Program Counter and the three Segment registers. DS. SS. and ES. are cleared. 3) The CS Segment register is set to FFFF16. Following a Reset. program execution therefore restarts with the instruc- tion located at memory byte FFFF016· These reset operations take approximately 10 clock periods to occur - during which time no other operations should occur. Following power-up. at least 60 microseconds shou Id elapse before the 8086 is reset. An interrupt request via INTR should not occur sooner than 9 clock periods after the end of the 8086 device reset. An earlier interrupt request will cause one entire instruction to be executed before the interrupt request is recognized or acknowledged. A nonmaskable interrupt request should not be made during the first clock period following the end of a reset. TEST is not really an interrupt input. but it is used by program logic that otherwise would rely upon an interrupt. The 8086 has a special "Wait-for-Test" instruction that puts the CPU into an Idle state; this Idle state ends when the TEST input goes low. An 8080A (and other microprocessors) will duplicate the logic of the 8086 "Wait-for-Test" instruction by executing a "no operation" loop. which is terminated by an interrupt request: ENI Enable interrupts SELF JMP SELF Only an interrupt will terminate loop execution 5-27 There are eight pins that can output one of two signals. depending on whether MN/Mx is 8086 tied to power or ground. By having two sets of signals. the 8086 can be used in simple con- DUAL BUS figurations. best served by elementary control signals. or in complex configurations. where control COMPLEXITY signals must provide sufficient information to resolve the contentions and access conflicts that complex microcomputer systems may encounter. The two sets of signals may be illustrated as follows: Minimum Maximum Systems Systems MN/MX = Vee MN/MX = GND M/TIS DT/R - - - - S2 51 0 O'[.·.;.g.·.P. . . . . H· .•. .•. ... ..·.0•. . ;. . .· •. .·• ..1 :0;:;::":)::1'::: DEN SO 0 1 1.. :il:> I I I N 0 0 T R IN A INTA OS1 0 0 1 ALE OSO 0 1 0 1 N a Q Q 0 8 E B 0 P S WR LOCK HOLD RO/GTO HLDA RO/GTl Let us first look at the simple set of control signals that are output when MN/MX is con- 8086 SIMPLE nected to +6 V. These are completely standard microprocessor control signals. CONTROL Since data and addresses are multiplexed on a single bus. ALE is output high to identify a valid SIGNALS memory address. When data are being transmitted or received via the Data/Address Bus. WR is pulsed low to identify data output. while RD is pulsed low as a request for external logic to place data on the Data/Address Bus. We have already described RD. It is not one of the changing signals: nevertheless. it is used by both simple and complex system busses. For a read or write operation. M/IO indicates whether memory (M/IO high) or an I/O port (M/IO low) is being ac- cessed. DTIR and DEN are two new control Signals not found in earlier Intel microprocessors. These two control signals have been designed specifically to control 8286/8287-type bidirectional transceivers. DTIff identifies the data direction. while DEN is the output enable. The 8286 and 8287 transceivers are described later in this chapter. HOLD and HLDA are standard hold request!8cknowledge signals. When external logic inputs HOLD high. the 8086 CPU enters a Hold state upon completing the current instruction's execution: the 8086 acknowledges the Hold State by outputting HLDA high. We will describe the Hold state in more detail later in the chapter. Let us now look at the complex System Bus that is generated when MN/MX is tied to 8086 COMPLEX ground. Control signals are output as a three-signal combination. decoded by a 3-to-8 decoder. CONTROL and a two-signal combination. decoded by a 2-to-4 decoder. Complex System Bus signals have SIGNALS been designed to act as inputs to an 8288 Bus Controller. S2. ST. and SO are decoded to provide eight separate control signals. However. the simple system signals M/IO. DT/R and DEN represent a subset of the eight S2. ST. and SO combinations. In our earlier illustration. we identify this simple system subset by shading the applicable complex system S2. ST. and SO levels. 5-28 The eight combinations of 52. 51. and SO generate the following control signals: S2 51 so 0 0 0 INTA Interrupt acknowledge 0 0 1 lOR I/O device read 0 1 0 lOW I/O device write 0 1 1 HALT CPU has executed a HALT instruction and is in the Halt state 1 0 0 IFETCH The CPU is fetching an instruction object code byte 1 0 1 MEMR Memory read 1 1 0 MEMW Memory write 1 1 1 NONE The System Bus is inactive The control signal descriptions above use the words "read" and "write" as seen by the CPU. That is to say, a .. read" operation moves data from a memory device or 1/0 port to the CPU, while a "write" operation moves data from the CPU to a memory location or I/O port. 050 and 051 combine to identify conditions within the 8086 instruction object code queue - which we will describe soon. The QSO and QS1 combinations are interpreted as follows: QSO 051 o o NOOP No operation. This is the default case o 1 OB1 The first instruction object code in the queue is being executed 1 o OE The queue is empty 1 1 OBS An instruction object code other than the first one in the queue is being executed Observe that the simple bus signals INTA and ALE do not correspond to any combination of OSO and 051. This is in contrast to MilO, DT IR and DEN, which constitute a subset of 52, ST, and SO. LOCK, RO/GTO, and RO/GT1 are not related to their simple system equivalent signals: WR. HOLD, and HLDA. LOCK. iiO/GTO. and RQ/GT1 provide the 8086 with its System Bus priority and control logic in complex configurations. LOCK is output high to prevent the 8086 from losing bus control while executing a sequence of machine cycles that must not be interrupted. Typically these will be a memory access combination of read-modify-write machine cycles. where an error could result if the CPU lost bus control after the read and before the write. RO/GW and RQ/GT1 are two-bus priority, bidirectional type signals. They are used to determine which CPU in a multi- CPU configuration will at any time have control of a shared bus. We will discuss these signals in more detail later in the chapter when looking at the capabilities of the 8086 in mUlti-CPU shared bus configurations. 5-29 8086 TIMING AND INSTRUCTION EXECUTION The most important concept to understand when looking at 8086 instruction execution tim- 8086 ing is the fact the 8086 bus control logic has been separated from the 8086 instruction ex- EXECUTION ecution logic. That is to say, the 8086 has an Execution Unit (EU), and a Bus Interface Unit UNIT (EU) (BIU). - - - - -.. The Execution Unit (EU) contains Data and Address registers, the Arithmetic and Logic Unit, 8086 BUS plus the Control Unit. The Bus Interface Unit (BIU) contains bus interface logic, Segment INTERFACE registers, memory addressing logic, and a six-byte instruction object code queue. This may UNIT (BIU) be illustrated as follows: ---, I AH AL I PC 1 BH BL I CS 0000 I CH CL I OS 0000 I OH OL I 55 0000 1 SP I ES 0000 I BP I .oj I 51 I I 01 I I ~ n I I , Bus Control Logic 18086 I Bus ~ II' :1 I .oj ). I I Arithmetic and Logic I 1 I Unit (ALU) I 2 I Instruction I --=> Control Unit 3 (CU) I object code I 4 queue I Status I 5 I 6 I -- Instruction Reg. ~ ~ I I 1 I I L __________ --L __ ....JI The Execution Unit (EU) and the Bus Interface Unit (BIU) operate asynchronously. Whenever 8086 the Execution Unit is ready to execute a new instruction. it fetches the instruction object code INSTRUCTION from the front of the Bus Interface Unit instruction queue. then it executes the instruction in some QUEUE number of clock periods that have nothing to do with machine cycles. If the instruction object code queue is empty. then the Bus Interface Unit (BIU) executes an instruction fetch machine cycle - and the CPU waits for the instruction object code to be fetched. But the queue will rarely be empty. for reasons that will soon become apparent; therefore. the EU will usually not have to wait while an instruction fetch is executed. 5-30 If memory or an I/O device must be accessed in the course of executing an instruction, then the EU informs the BIU of its needs. The BIU executes an appropriate external access machine cycle in response to the EU demand . ..--_....... The Bus Interface Unit (BIU). for its part. is independent of the Execution Unit (EU). and attempts to 8086 _-... keep the six-byte queue filled with instruction object codes. If two or more of these six bytes are INSTRUCTION empty, then the Bus Interface Unit (BIU) executes instruction fetch machine cycles - providing QUEUE the EU does not have an active request for bus access pending. If the EU issues a request for bus - - - - - -..... access while the BIU is in the middle of an instruction fetch machine cycle, then the BIU will complete the instruction fetch machine cycle before honoring the EU bus access request. 8086 BUS CYCLES If we look at the way clock logic is used by the 8086, the term "machine cycle" no longer applies. The EU does not use machine cycles; it executes instructions in some number of clock periods that are not subject to any type of machine cycle grouping. The only time clock periods are grouped is when the bus control logic wishes to access memory or I/O devices. Each access requires four clock periods. This is the minimum amount of time required to han- dle the normal bus protocol that accompanies any transfer of information between a microprocessor and logic beyond the microprocessor. Since this is the only time the 8086 groups clock periods, it is more accurate to talk about 8086 bus cycles, rather than machine cycles. Figure 5-4 illustrates two 8086 bus cycles executed back-to-back. In common with machine cycles, 8086 bus cycles, as illustrated in Figure 5-4 assign individual clock periods to time specific events. Memory and I/O device addresses are output on the Data/Address Bus during T1. Data is transferred between the 8086 and memory or I/O devices during T3 and T4. If these two clock periods provide external logic with insufficient time to respond to an access, then Wait state clock periods (TW) may be inserted bet- ween T3 and T 4· T2 is a buffer clock period during which the Data/Address Bus stops outputting an address and starts outputting or in- putting data. During T4 the CPU identifies the status of the next bus cycle or clock period. In simple configurations when MN/MX is tied to +5 V, DT /A is the only external signal that changes state during T4. When MN/MX is tied to ground, SO, S 1, and S2 change state during T4. Thus, by examining these three status outputs, external logic knows whether to expect another bus cycle. and, if so, what type of bus cycle. Now if you look at Figure 5-4, there is very little about it that differentiates an 8086 bus cycle from any other microprocessor's machine cycle. The characteristic of the bus cycle that differentiates it from standard machine cycles is the fact that bus cycles occur only on demand. :,... ... . - - - - - BUS CYCLE ---------i~ 4 J - - - - - - - BUS CYCLE ------I~ ....: .. . .,: : T1 T2 T3 T4 i T1 T2 T3 T4 i V//////A r//////A Output address ~ V///////1 ~ ~ r///////1 ~ duringT1 Turn Bus around duringT2 VlllmllllllJ/j t'lll/7lllllJll Perform memory V/I/I/III//IIII VI//I/I///////A accesses during T3 +L----------------~' W a i t •..__-----periods state clock In complex systems, status output in T4 identifies subsequent operations. Figure 5-4. Two 8086 Bus Cycles 5-31 8086 INSTRUCTION QUEUE Consider what happens when an instruction is executed. Beginning with the simplest case, the instruction ob- ject code queue within the Bus Interface Unit will be empty. When the EU requests an object code byte there is none, so the BIU executes a bus cycle that fetches the first byte of the instruction object code: Tl CLK I I I I ~ Bus cycle fetches first object code byte Let us assume that this particular instruction requires two bytes of object code: keeping things simple. we will illustrate another instruction cycle executed immediately to fetch the next instruction byte: Tl i T3 IT4 Tl : T2 : T3 : T4 I I CLK I I I I I I ~~ Bus cycle fetches Bus cycle fetches first object code second object byte code byte Let us suppose that this instruction reads a word of data from memory. then performs an arithmetic operation using this data. The instruction is going to require some number of clock periods to compute the effective address for the data memory location to be accessed (we will assume seven clock periods are needed). Some additional number of clock periods will also be needed to perform the arithmetic operation (we will assume nine clock periods). In a normal microprocessor. this instruction might be executed as the following sequence of machine cycles: Machine Cycle 1 Machine Cycle 2 Machine Cycle 3 Machine Cycle 4 Machine Cycle 5 Tl : T2 i T3 : T4 Tl I T2 I T3 I T4 Tl I T2 1 T3 : T4 Tl: T2 : T3 : T4 Tl: T2 I T3 : T4 I I I I I I I: I I 1 CLK Fetch first Fetch second Compute data Compute data Fetch data object code object code memory memory from memory byte byte address address Machine Cycle 6 Long Machine Cycle 7 Machine Cycle 8 Tl : T2 : T4 1 Tl i T3 i T41 T5 Tl I I 1 I 1 ClK Execute arithmetic operation in a standard machine cycle Start executing next instruction by I and a long machine cycle fetching object I code byte 5-32 But the 8086. having asynchronous CPU and Bus Control Unit logic. will use clock periods to execute the instruction il- lustrated above as follows: Bus Cycle 1 Bus Cycle 2 Bus Cycle 3 Bus Cycle 4 Bus Cycle 4 Tl I T2 : T3 Tl I T2 I T3 I T4 Tl I T2 I T3 I T4 Tl : T2 : T3 : T4 T1 I I i I I : I I I ClK EU EU asks for an The EU needs a The EU computes a data memory The EU waits for the object code byte. second object address in 7 clock periods. At the requested data to be There is none. so code byte. end of the 7th clock period the fetched by the BIU the BIU fetches CPU requests bus access. one. BIU BIU fetches a BIU fetches a Since the EU is not demanding BIU fetches data byte of object second byte of bus access. the BIU fetches the from memory code in one object code in next two object code bytes and location addressed bus cycle. one bus cycle. stores them in the queue. At the by the CPU. end of bus cycle 4 the EU is requesting bus access. so the BIU services the EU. Bus Cycle 5 Bus Cycle 6 Bus Cycle 7 Tl Tl I T2 i T3 : T4 Tl: T2 I T3 : T4 I I I ClK etc. I Ti Ti Ti Ti Ti Ti : Ti Ti: Ti , I EU The EU uses nine clock periods to execute : The EU takes the etc. the required arithmetic operation. I next object code , byte from the I BI U queue and , starts executing the ! next instruction. BIU The BIU continues executing bus cycles to etc. I fill the instruction object code queue. 5-33 Now. the illustration above is not accurate because. you will recall. the 8086 fetches data in 16-bit increments. pro- vided the data address lies on an even-byte boundary. Also. the BIU fetches instruction bytes and loads them into the queue only when there are at least two free bytes in the queue. Let us assume that all data does lie on even-byte boun- daries. This is how our timing will now look: Bus Cycle 1 Bus Cycle 2 Bus Cycle 3 Bus Cycle 4 Bus Cycle 4 Tl : T4 Tl : T2 : T3 I I I T4 I Tl : T2 : T3 : T4 I Tl: T2 I : T4 I T1: T2 : T3 i T4 Ti I I Ti Ti I ClK EU EU asks for an The EU computes a data memory The EU waits for the The EU uses 9 clock periods to execute object code byte. address in 7 clock periods. At the requested data to be the arithmetic operation. There are none. end of the 7th clock period the fetched by the BI U. so the BI U exe- EU requests bus access. cutes a bus cycle. BIU BI U fetches two BI U fetches four bytes of object code BI U fetches data The BIU fetches I The BIU is idle. bytes of object in two bus cycles and stores them in from memory two more bytes code in one bus the queue. which has two empty location addressed of object code and cycle. The CPU takes both of I bytes left. Iby the EU. stores them in the queue which is them. so the now full. queue is imme- diately emptied. I Ti Ti I Ti Ti I ClK etc. I I Ti EU t The EU ends instruction execution and fetches one byte of object code from queue to execute next instruction. BI U The BI U remains idle since only one byte of queue is empty. There are some important points to note regarding 8086 bus cycle timing. Bus cycles are a Bus Interface Unit (BIU) phenomenon. So far as the EU logic is concerned. bus cycles do not exist. The EU experiences periods of activity while executing in- structions. and periods of inactivity while waiting for instruction object codes or data that the BIU must process via bus cycles. Periods of EU activity are timed by a sequence of clock periods. The EU makes no attempt to group clock periods into machine cycles. nor do EU clock periods have to occur in any special numeric combinations. The EU asks for memory operands before it needs them. so unless the BIU cannot get immediate bus access the max- imum EU wait time is one clock cycle for bus access. So far as the BIU is concerned. clock periods are grouped into bus cycles only when data must be transferred to or from the 8086. First priority is given to a bus access request coming from the EU. If the EU is not requesting bus access. then the BIU executes instruction fetch bus cycles until the queue is full. These are the prerequisites for the BIU to ex- ecute an instruction fetch bus cycle: 1) The clock period that initiates the bus cycle would otherwise be an idle clock period. 2) The EU does not have an active bus access request pending. 3) There are at least two bytes empty in the queue. If the queue is full. then the BIU ceases to execute bus cycles; as illustrated above. a sequence of idle clock periods oc- curs. 5-34 Note that the CPU may have to wait for bus access. In the illustrations above, the EU requires seven clock periods in order to compute a data memory address. At the end of the seventh clock period, the EU issues a bus access request to the BIU. But at this time the BIU is part way through executing an instruction fetch bus cycle. The BIU completes the in- struction fetch bus cycle, then honors the EU bus access request. In the final illustration above, no bus cycle accompanies the beginning of a new instruction's execution. We are assum- ing that the next instruction executed has one byte of object code. This object code byte is fetched from the front of the queue - which then has just one empty byte. No bus cycle is executed to fetch the instruction object code, since it is taken out of the queue. Subsequently, the BIU does not execute an instruction fetch bus cycle since there is only one empty byte; there must be at least two empty bytes in the queue before the BIU will execute an instruction fetch bus cycle. Based on the foregoing discussion of 8086 instruction fetch queuing, we can see that the 8086 has essentially eliminated instruction fetch time. The only time the EU will have to wait while the BIU fetches instruction object codes is when a Branch-on-Condition instruction causes execution to branch out of the queue sequence, or when (for any reason) the memory accesses accompanying an instruction's execution are so dense that the BIU has insufficient idle clock periods within which to insert instruction fetch bus cycles. 8086 MEMORY AND 1/0 DEVICE READ BUS CYCLE FOR MINIMUM MODE Figure 5-5 shows timing for an 8086 memory read bus cycle when MNiMX equals +5 V; that is to say, for the minimum mode bus configuration. I~ One Bus Cycle ·1 T1 T2 I T3 T4 ClK ADO-AD15 A16-A19 BHE ALE MilO RD DT/R DEN Trailing edge of ALE latches address Figure 5-5. 8086 Memory Read Bus Cycle for a Minimum Mode System (MN/MX = +5 V) 5-35 The memory or I/O device address is output via the Address Bus BHE during clock period T 1. ADO-AD15 starts floating in T2 while turning around internal pin logic so that data can be input during T3 and T4. Address lines A 16 through A 19 are all low when an I/O device address is being output. These address lines output status during T2. T3. and T4. Close to the end of T4. A 16 through A 19 start to float. BHE timing follows Address lines A 16-A 19; that is to say. BHE is output low for the time that A 16 through A 19 is out- putting an address. The trailing edge of the high ALE pulse should be used as the "valid address" strobe. If your 8086 configuration demultiplexes the Data and Address Busses. then the Address Bus demultiplexing buffers should be the "pass through" type and use the high-to-Iow transition of ALE as their latching strobe. Remaining control signals consist of M/i5 and RD. which are directed at external memory or 1/0 devices. plus DTIAand DEN. which are directed at bus buffers. M/iO differentiates between a memory access and an I/O device access. M/IO will be high for a memory access bus cy- cle; it will be low for an 1/0 device access bus cycle. M/i5 will contribute to memory and I/O device select logic when memory and I/O devices have similar addresses. RD is pulsed low as a memory or I/O device read strobe. The addressed memory device must use this low signal to place data on ADO - AD 15. DT /R and DEN are control signals designed to control bidirectional latched buffers on the Data Bus. DT IR is output low for the entire memory or I/O device read bus cycle; it should be used to turn the latched buffers around so that they will transmit data to the CPU. DEN subsequently acts as a latching strobe. These two signals have been designed specifically to work with the 8286 and 8287 Data Bus transceivers; however. their logic is quite general. There is no difference between external timing for an instruction fetch or memory read bus cycle. Given the pipelining instruction fetch logic of the 8086. this makes sense. The only timing difference between a memory read bus cycle and an I/O device input bus cycle occurs at the M/ffi signal. This signal will be low for the duration of an I/O input bus cycle. whereas in Figure 5-5 it is shown high for the duration of a memory read bus cycle. Except for this difference, Figure 5-5 also illustrates I/O input bus cycle timing for a simple 8086 configuration. During any simple configuration memory access operation, the following status is output on address lines A 16 through A 19: A 19/56 - Always 0 A 18/S5 - Interrupt enable status A17/S4- 0 0 1 A 16/S3 - 0 1 0 1 t L- 1I Data segment access cOde segment access or no access _____ L... Stack segment access ~------- Extra segment access The interrupt enable status appearing on A 18 may be used to illuminate an indicator on a control panel. should there be one. This indicator will show whether interrupts are enabled or disabled at any time. This status has no other value. S3 and 54 together identify the memory segment which is being accessed. This is not very useful information. Even a code segment access cannot be interpreted as an instruction fetch. since data can be addressed out of the pro- gram segment. 8086 MEMORY OR I/O DEVICE WRITE BUS CYCLE FOR MINIMUM MODE Figure 5-6 illustrates timing for an 8086 memory or I/O device write bus cycle when the 8086 is operating in a minimum mode with MN/MX tied to +5 V. Address output logic is identical in read and write bus cycles. As was the case for a read bus cycle. the address is out- put on the Address Bus. together with BHE. during T 1. External logic should use the high-to-Iow transition of the ALE pulse in order to latch a valid address. During T2. ADO - AD15 switches to outputting data. while A16 - A19 outputs status. The same status is output in read and write bus cycles. M/iO is output high for the duration of a memory write bus cycle; it is output low for the dUration of an I/O device write bus cycle. WR is output low beginning early in T2 and ending shortly after T3. Note that RD does not go low for a read bus cycle until halfway through T2. 5-36 For an 8286 or 8287 Bus Transceiver, or any similar device, DT/A" is output high for the entire duration of the write bus cycle. This conditions the device to transmit data from the CPU to external logic. DEN is the chip enable signal provided for the bus transceiver. DEN is output high from the end of T1 until the end of T4. Note that this high pulse is longer than the DEN pulse accompanying a read bus cycle. \- One Bus Cycle .\ T1 T2 I T3 T4 I ClK ADO-AD15 Data Out A16-A19 Status Out BHE ALE MIlO WR DT/R DEN Trailing edge of ALE latches address Figure 5-6. 8086 Memory Write Bus Cycle for a Minimum Mode System (MN/MX = +5 V) An I/O write bus cycle has timing identical to Figure 5-6, except that the M1i5 Signal will be low for the duration of the bus cycle, rather than high as shown in Figure 5-6. Wherever a memory word and an I/O port may have the same ad- dress, M1i5 must contribute to device select logic in order to discriminate between memory and I/O devices. The status output on A 16-A 19 is no more usefu I in a write bus cycle than it is in a read bus cycle. 8086 READ AND WRITE BUS CYCLES FOR MAXIMUM MODE It is not very rewarding looking at maximum mode memory or I/O access bus cycle timing, if we look at timing for an 8086 device on its own. This is because in maximum mode, with MN/MX tied to ground, the 8086 has been designed to operate with the 8288 Bus Controller. Figure 5-7 and 5-8 provide maximum mode timing for the 8086 on its own when executing read or write bus cycles. Only the status signal levels differentiate memory or I/O access bus cycles. Timing for the Address/Data Bus is identical in minimum and maximum modes. The read strobe RD does not change. However, remaining control Signals become control inputs to the 8288 Bus Controller. 5-37 Observe that OSO and OS1 change levels on a clock period by clock period basis in order to identify events for in- dividual clock periods. SO, Sf, and S2 hold their levels from shortly before T 1 until shortly after the end of T2· li-oI•. . . . - - - - - - - - - - - - o n e Bus c y c l e - - - - - - - - - - - - - o . , j l T1 T2 T3 T4 CLK ADO-AD15 _ _......J....._ _... A 16-A 19 ---...o+---C QSO,QS1 SO,S1,S2 Figure 5-7. 8086 Memory or I/O Read Bus Cycle for a Maximum Mode System (MN/MX = 0 V) li-oI•. . . . . - - - - - - - - - - - - - o n e Bus C y c l e - - - - - - - - - - - - . J T1 T2 I T3 T4 ,.---",,1 CLK ADO-AD 15 -"""---4 Address Out Data Out A16-A19 - - t - - - 1 Address Out Status Out QSO,QSl Figure 5-8. 8086 Memory or liD Write Bus Cycle for a Maximum Mode System (MN/MX = 0 V) 5-38 The 8288 Bus Controller. described later in this chapter. decodes SO. 51. and S2 in order to generate control signals that are comparable to those illustrated in Figures 5-5 and 5-6. For a complete discussion of bus cycle timing in com- plex 8086 microcomputer configurations. see the discussion of 8288 Bus Controller. THE 8086 WAIT STATE 8086 Wait state logic is independent of the MN/MX pin connection and the external access bus cycle being ex- ecuted.ln any bus cycle it is possible to insert one or more Wait clock periods (Twl between T3 and T4. In order to ex- tend a bus cycle with Wait clock periods. external logic must input a low READY signal during T2 of the bus cycle which is to be extended. The READY input to the 8086 must be synchronized with the falling edge of ClK at the end of T2; this synchronized READY input is created by the 8284 clock generator. External logic will normally input an asynchronous READY to the 8284 clock device. which outputs a synchronous READY for the 8086. Wait clock periods will continue to be inserted to the bus cycle until READY goes high again. Timing is illustrated in Figure 5-9. All out- put signal levels are maintained for the duration of the Wait state. THE 8086 HOLD STATE The 8086 can be forced into a Hold state, at which time all three-state signals are floated. The 8086 Hold state is used to enable direct memory access logic, and in addition to disable inactive 8086 devices when more than one CPU accesses the same System Bus in a mUlti-CPU configuration. In a minimum mode configuration, when MN/MX is tied to +5 V, the 8086 has a traditional 8086 HOLD Hold request input (HOLD) and a Hold Acknowledge output (HLDA). Upon receiving a high IN MINIMUM HOLD input. the 8086 will complete execution of its current instruction bus cycle before entering MODE SYSTEM the Hold sate and outputting HlDA high. Timing may be illustrated as follows: T40rTi elK HOLD HlDA The 8086 samples the HOLD input on the low-to-high transition of ClK. Therefore. HOLD must make its transitions away from this sampling point that is to say. HOLD must be stable when ClK is making its low-to-high transition. The 8086 will acknowledge the Hold request by making HlDA high during any idle clock period. or at the end of a bus cycle. If a bus cycle is being executed when a Hold request occurs. the Hold request will not be acknowledged until the end of T4 for the currently executing bus cycle. The Hold state will last until the HOLD input goes low again. The 8086 continues to sample the HOLD input on all low- to-high transitions of ClK; therefore. HOLD must make its high-to-Iow transition away from the rising edge of ClK. When HOLD goes low. the Hold state will immediately end and HlDA will be forced low again. In 8086 maximum mode configurations where MN/MX is tied to ground. the HOLD and HlDA 8086 HOLD pins convert to bidirectional type control signals. There are two bidirectional signals; RO/GTO and IN MAXIMUM RO/GT1. RO/GTO has higher priority than RO/GT1. MODE SYSTEM 5-39 T1 T2 T3 TW T4 elK RDY READY ROY comes from external logic to the 8284 clock. READY comes from the 8284 clock, goes to the 8086. Figure 5-9. The 8086 READY Input and Wait States Any external logic that wishes to put an 8086 CPU into the Hold state transmits a low pulse to RO/GTO or RO/GT1, The 8086 CPU will acknowledge this Hold request immediately. if a bus cycle is not being executed. or at the conclusion of a currently executing bus cycle. The 8086 acknowledges the Hold request transmitting by a low pulse via the same ROI GT line; simultaneously the 8086 floats its three-state bus lines. External logic must allow atl~~t~~ clock period to elpase following the Hold Acknowledge pulse. before attempting to input via the same pin. External logic terminates the Hold state by inputting another low pulse. Timing may be illustrated as follows: : T4 or Ti I-- Hold State---j I I I eLK RQ/GT @ 0 ® In the illustration above. ® identifies the instant at which external logic requests a Hold state by transmitting a low pulse via either RO/GT line. The 8086 samples RO/GT on the rising edge of ClK; therefore. all signal transitions on RO/GT must occur away from the ClK low-to-high transitions. The 8086 will now acknowledge a Hold request during a bus cycle, If a bus cycle is in progress. then the Hold acknowledge will occur at the end of the bus cycle - that is to say. at the end of T4. If a bus cycle is not in progress. then the Hold request will be acknowledged immediately. In the illustration above. @ identifies the low pulse the 8086 will output as its Hold acknowledge, The Hold state will last until external logic again transmits a low pulse via RO/GT. This is identified above as ©Once again the 8086 samples RO/GT on the rising edge of ClK; therefore. RO/GT should be stable at this time, When the 8086 enters the Hold state. it continues executing instructions it takes out of the pipeline. until a bus access is required. When the EU requires a bus access. it stops operating until the end of the Hold state - at which time its bus access request will be honored by the Bus Interface Unit In the event that Hold requests occur simultaneously on RQ/GTO and RQ/GT1. the acknowledge pulse will be output on RQ/GTO. RO/GT1 will not be acknowledged until the Hold state initiated via RO/GTO has ended. When one Hold state ends. another Hold state can begin immediately for either of these reasons: 1) RO/GT1 was active when RO/GTO was acknowledged; the RO/GT1 Hold request. being of lower priority. was denied and is pending, 2) While the 8086 was in a Hold state. a new hold request occurs on the other RO/GT line. If a new hold request occurs while the 8086 is in Hold state. priorities no longer apply. For example. if the CPU has acknowledged a Hold request occurring at RO/GT1 and is in a Hold state. then it will deny a new Hold request arriving via RO/GfO until the current Hold state has ended, 5-40 If there is an active Hold request when the CPU ends a Hold state. then the CPU will immediately acknowledge the pending Hold request. This may be illustrated as follows: Hold for RQ/GT1 in progress Hold for RQ/GTO in progress Low pulse input at and immediately RQ/GTO stand RQ/GTO Hold When a Hold state ends. if the CPU has a bus access request pending. then the CPU bus access request will be denied until all active Hold requests have been acknowledged. Note that there are no 8086 instructions that specifically affect the level of RO/GTO or RO/GT1. That is to say. external logic is entirely responsible for the interfaces to these two signals. We will discuss RO/GTO and RO/GT1 in more detail later in this chapter when we look at some multiple CPU 8086 con- figurations. THE 8086 HALT STATE The 8086 enters a Halt state after a HALT instruction is executed. In the Halt state no signals are floated, and undefined data is output on the Data/Address Bus. No bus cycles can be executed while the 8086 is in the Halt state. . When a Halt instruction is executed. a bus cycle initiates the Halt state. This Halt state initializing bus cycle has nothing to do with instruction fetch logic. If the Halt instruction object code is fetched by the CPU from the queue. then there will be no preceding instruction fetch bus cycle. If the Halt instruction must be fetched from memory because the queue is empty. or is at the conditional end of a Branch-on-Condition. then the Halt initializing bus cycle will be pre- ceded by an instruction fetch bus cycle. For a simple system, the HALT initialization bus cycle is given by Figure 5-5, except that RD, M/IO, DT/R and DEN are not active. ALE is active, although the address output has no meaning. For a complex system, the HALT initializing bus cycle is illustrated in Figure 5-10. The Halt state combination occurring at SO. ST. and 52 causes the 8288 Bus Controller to issue an ALE pulse before entering the Halt state: however. the occurrence of ALE could not be deduced simply by looking at 8086 timing. 5-41 I· I I One Bus Cycle I -I CLK-\ T1 T2 T3 I T4 I I I I I I I I ~ J I L ?- \ ADO-AD15 , -., \ I '\ \ Undefined Data A16-A19 ) ,I \ \ \ \ Undefined Data I \ "" SHE OSO, OS1 \ / so,51 \~ I t " 52 \ J Figure 5-10. 8086 HALT Instruction and Bus Cycle Timing for a Complex Bus Configuration The Halt state is terminated by an interrupt request or a Reset. You can freely enter and leave a Hold state within an 8086 Halt state via any of the means that we have just de- scribed. The fact that the 8086 is in the Halt state in no way modifies Hold logic. THE 8086 LOCK A potential for serious error exists in the Hold request/acknowledge logic of the 8086. The 8086 will acknowledge a Hold request occurring on the RQ/GTO or RQ/GT1 lines at the end of the current bus cy- cle, if one is being executed. or at the next idle clock period. if a bus cycle is not being executed. The 8086 does not wait until the conclusion of the current instruction's execution before acknowledging the Hold request. Therefore, if an instruction reads the contents of a memory location (or I/O port), modifies these contents, then writes it back, a Hold state may separate the read bus cycle from the write bus cycle: I Read from memory location X Modify data I Write back to location X I HOLD STATE This can cause unexpected errors. If the 8086 enters a Hold state after reading memory location X contents and before writing these contents back. then it is possible for external logic - either direct memory access logic or another Central Processing Unit - to modify the contents of memory location X while the 8086 is in the Hold state. Now when the 8086 writes back the modified word. it may destroy data that should have been preserved. 5-42 If a 16-bit data word lies on an odd-byte boundary. it will require two bus cycles to access the data word. Under normal circumstances. a Hold request could be acknowledged between the first and second memory access bus cycles. But what if the word being accessed gets modified during the Hold state? If the Hold state splits two memory read bus cy- cles. this is what the CPU is going to read: 7 o 7 o '~,--.. ----~~~--------~~,-- High-order byte .... --,~ Low-order byte was read after Hold was read before Hold and is modified and is not modified If a Hold state splits two memory write bus cycles. this is what ultimately gets written: 7 o7 o I '-,----v ~L, ___-.~___. . ._"J High-order byte Low-order byte is written after Hold was written before Hold and is not modified and gets modified You use the 8086 LOCK instruction in order to prevent the types of errors described above. When a LOCK instruction is executed, the LOCK signal is low for the duration of the next sequential instruc- tion's execution. Also, while the next sequential instruction is being executed, a Hold request will not be acknowledged. You cannot extend protection against a Hold acknowledge beyond a single instruction's execution. For example. sup- pose you have two instructions. each of which is preceded by a Lock: LOCK AND MEMX.AX LOCK OR MEMX. BX In the instruction sequence above. MEMX is a label which represents the address of a memory location. The contents of this memory location are ANDed with a mask stored in AX. then ORed with a mask stored in BX. The contents of MEMX are read. modified. and written back at each step. Now. you may wish to inhibit Hold logic for both the AND and the OR operation. You cannot do so using the LOCK in- struction. The first LOCK instruction will protect the following AND instruction from being interrupted by a Hold state: however. any pending Hold state will be acknowledged before the second LOCK instruction is executed. Each LOCK instruction extends protection against a Hold Acknowledge for the duration of the next sequential instruc- tion only. The fact that the following instruction is also a LOCK is irrelevant. The second LOCK instruction will be the first instruction executed following the Hold state. and it will guarantee that no new Hold state begins until it. and the OR instruction. have both been executed. You can use the LOCK instruction and signal to identify individual instruction execution 8086 SINGLE times. If for any reason external logic needs to know the execution time for certain instructions. INSTRUCTION then by preceding these instructions with a LOCK instruction you will generate a high pulse on TIME the LOCK output. The width of this high pulse exactly equals the execution time of the instruction IDENTIFIED which follows the LOCK. THE 8086 PROCESSOR WAIT FOR TEST STATE The 8086 has a program-initiated Wait state that external logic must terminate via the TEST input signal. The WAIT instruction initiates this Wait state. After the WAIT instruction is executed. the 8086 generates an endless se- quence of idle clock periods. This sequence lasts until external logic inputs a low signal at the TEST input. TEST must be high for at least four clock periods. While the endless sequence of idle clock pulses is being executed. the System Bus is not floated and the Bus Interface Unit may execute memory read bus cycles in order to fill up the instruction object code queue. 5-43 The processor Wait state can be used to synchronize an 8086 with any external time sequence. For example, you could start two programs, executing in two separate 8086 systems, at exactly the same time, by preceding each pro- gram with a Wait instruction. If both 8086's receive low TEST inputs simultaneously, then both microprocessors will start executing their programs at the same instant. THE 8086 PROCESSOR ESCAPE The 8086 has a special escape instruction (ESC) intended for use in mUlti-CPU configurations. When the ESC instruc- tion is executed. the contents of an addressed memory location are input to the CPU. but the input data is not stored anywhere. The purpose of the ESC instruction is to place the addressed data on the Data/Address Bus so that any other microprocessor (or external logic) connected to the Data/Address Bus can receive the data. We will examine the value of the ESC instruction later in the chapter when looking at the 8086 in multiple CPU configurations. THE 8086 RESET OPERATION The 8086 has an asynchronous RESET input. This signal can be forced high at any time in order to reset the 8086. The high RESET must be at .least four clock cycles long. The 8086 terminates all current operations as soon as the RESET input makes a low-to-high transition. Nothing more happens until the RESET signal subsequently makes a high-to-Iow transition. It then takes approximately ten clock periods in order to execute the following operations: 1) The Status register is cleared. Among other things. this resets the interrupt enable flag to 0, thus disabling inter- rupts. 2) The CS Segment register is set to FFFF16. 3) The OS, SS, and ES Segment registers and the Program Counter are all reset to O. 4) Program execution begins. Since the CS Segment register contains FFFF16 and the Program Counter contains 0, the first instruction executed is taken from memory location FFFF016. 8086 INTERRUPT PROCESSING The 8086 allows interrupts to originate in one of three ways: 1) From software or within program logic. 2) From external logic as a nonmaskable interrupt. 3) From external logic as a maskable interrupt. There is, in addition, a special "single step" condition that makes use of interrupt logic. We will describe single step- ping after our discussion of interrupt logic. In the event that two or more of the three interrupt types occur simultaneously, software generated interrupts have the highest priority and maskable interrupts have the lowest priority. These are the ways in which a software interrupt request may occur: 8086 SOFTWARE 1) Following an attempt to divide by O. A special divide by 0 interrupt request will occur any INTERRUPTS time the divide instruction is executed with a 0 dividend. 2) Following execution of an Interrupt instruction (lNT). 3) Following execution of an Interrupt-on-Overflow instruction (INTO) - if the Overflow status is set. A nonmaskable interrupt request is initiated when external logic transmits a low-to-high 8086 NON- transition to the NMI pin. This is an edge-triggered Signal. A nonmaskable interrupt has lower MASKABLE priority than a software interrupt. but higher priority than a maskable interrupt. INTERRUPT A maskableinterrupt request will be generated when external logic transmits a high level to 8086 the INTR pin. This input is level sensitive; it is the high level at INTR that causes the interrupt re- MASKABLE quests to occur. INTERRUPT Central to all 8086 interrupt processing is a Vector table that can be up to 1024 bytes in 8086 length, occupying absolute memory addresses 00000 through 003FF 16. This Vector table con- INTERRUPT sists of up to 256 four-byte entries. Each entry contains two 16-bit addresses that get loaded into VECTOR the CS Segment register and the Program Counter. TABLE Figure 5-11 illustrates the 8086 Interrupt Vector table. 5-44 A number of the Vector table entries serve specific interrupts. Other entries are reserved by Intel and should be avoided if compatibility with Intel software is desired. These entries are identified in Figure 5-11. As illus- trated in Figure 5-11, 32 of the 256 interrupt vectors are not available to external logic; that leaves 224 vec- tors available to maskable external interrupts - which is plenty. Taking each of the three interrupt types in turn, let us examine the interrupt acknowledge p...r_o_c_e_s_s._ _ __ When any of the software interrupts are acknowledged, the following steps occur: 8086 SOFTWARE 1) The Status register contents are pushed onto the Stack; Stack Pointer contents. in conse- INTERRUPT quence. are decremented by two. 2) The Interrupt and Test status flags are cleared; this disables maskable interrupts and single step logic (which we describe after our discussion of interrupt logic). 3) The CS Segment register contents are pushed onto the Stack; Stack Pointer contents. in consequence. are decre- mented by two. 4) The new CS Segment register contents are taken from the appropriate interrupt vector location. With the excep- tion of the INT instruction. software-generated interrupts have dedicated vector locations as illustrated in Figure 5-11. The INT instruction allows anyone of the 256 vector locations to be selected; a default option selects Vec- tor 3. • 5) The Program Counter contents are pushed onto the Stack; Stack Pointer contents are decremented by two. 6) The new Program Counter contents are taken from the interrupt vector. When a nonmaskable interrupt is acknowledged, the following events occur: 8086 NONMASKABLE 1) The Status register contents are pushed onto the Stack. The Stack Pointer contents are INTERRUPT decremented by two. 2) The Interrupt and Test statuses are reset to 0; this disables nonmaskable interrupts and single stepping mode. 3) The CS Segment register and Program Counter are reloaded from Interrupt Vector 2. See Figure 5-11. When a maskable interrupt is acknowledged, the following steps occur: ------.... 8086 1) Two interrupt acknowledge bus cycles are executed by the Bus Interface Unit of the 8086. An MASKABLE interrupt acknowledge bus cycle is identical to the memory read bus cycles. as illustrated in INTERRUPT Figures 5-5 and 5-7. with the exception that an interrupt acknowledge low pulse replaces the memory read low pulse. For a minimum mode system. INTA will provide the low RD pulse shown in Figure 5-5. Figure 5-7 accura.tely illustrates timing for an interrupt acknowledge bus cycle in a maximum mode system; however. SO. ST. and S2 will all be low. identifying an interrupt acknowledge. whereas a read I/O port or read memory status combination would be output otherwise. LOCK is low beginning at T2 of the first interrupt acknowledge bus cycle and ending at T2 of the second interrupt acknowledge bus cycle. This may be illustrated as follows: I. Bus Cycle 1 .. I.. Bus Cycle 2 ·1 I T1 , T2 , T3 , T4 I Tl I T2 I T3 I T4 I ClK I I I I I I I I I LOCK 2) The acknowledged external device must send back a byte of data on lines ADO-AD7 in response to the second in- terrupt acknowledge bus cycle. This data byte is interpreted as a pointer into the interrupt vector. Multiplying this 8-bit value by 4 creates the correct beginning address for the interrupt vector. 3) The Status register contents are pushed onto the Stack. 4) The Interrupt and Test flags in the Status register are cleared. This disables further maskable interrupts and single step logic. 5) The CS Segment register contents are pushed onto the Stack. 6) The next CS Segment register contents are taken from the interrupt vector location identified in Step 2. 7) The Program Counter contents are pushed onto the Stack. 5-45 Memory Interrupt Addresses Vector Table 00000 00002 00004 CSO PCO CSl t VeeW 0 - D;v;de by 0 Vector 1 - Single step 00006 PCl mode 00008 OOOOA CS2 PC2 } Vector 2 - ~onmaskable Interrupt OOOOC CS3 } Vector 3 -INT software OOOOE PC3 interrupt (default option) 00010 00012 CS4 PC4 } Vector 4 - ~NTO software Interrupt 00014 CS5 00016 PC5 } Vector 5 I I I • I I 00078 CS30 Reserved by Intel } Vector 3010 0007A PC30 0007C 0007E CS31 PC31 f Veeto, 3 t 10 00080 CS32 Vector 3210 00082 PC32 00084 CS33 } Vector 3310 00086 PC33 I I User vectors I I 003F8 CS254 > Vector 25410 003FA PC254 003FC CS255 Vector 25510 003FE PC255 , I I Interrupt acknowledge sequence of I I events is (D-@-@-@ ® - CSN - PCN @ CS Register ~ Shaded row applies to EA and LABEL. X These are displacements that can be used to compute memory addresses. 5-56 The following abbreviations are used in Tables 5-4 and 5-5: AH Accumulator. high-order byte AL Accumulator. low-order byte AL7 The value of register AL high-order bit (0 or 1) extended to a byte (0016 or FF16) AX Accumulator. both bytes AX15 The value of register AH high-order bit (0 or 1) extended to a 16-bit word (000016 or FFFF16) BD The destination is a byte operand (used only by the Assembler) BH B register. high-order byte BL B register. low-order byte BRANCH Program memory direct address. used in Branch addressing option shown in Tables 5-1 and 5-2 BS The source is a byte operand (used only by the Assembler) BX B register. both bytes C Carry status CH C register. high-order byte CL C register. low-order byte CS Code Segment register CX C register. both bytes DADDR Da\a memory address operands identified in Table 5-3 DATA8 Eight bits of immediate data DATA 16 16 bits of immediate data DH D register. high-order byte DI Destination Index register DISP An 8-bit or 16-bit signed displacement DISP8 An 8-bit signed displacement DL D register. low-order byte DS Data Segment register DX D register. both bytes EA Effective data memory address using any of the memory addressing options identified in Table 5-2 ES Extra Segment register I Status flag set to 1 I/D Increment/decrement selector for string operations; increment if D is O. decrement if D is 1 LABEL Direct data memory address. as identified in Table 5-2 N A number between 0 and 7 o Status flag reset to 0 OEA Offset data memory address used to compute EA: EA =OEA + [DS] * 16 PC Program Counter PDX I/O port addressed by OX register contents; port number can range from 0 through 65.536 PORT A label identifying an I/O port number in the range 0 through 25510 RB Anyone of the eight byte registers: AH. AL. BH. BL. CH. CL. DH. or OL RBD Any RB register as a destination RBS Any RB register as a source RW Anyone of the eight 16-bit registers: AX. BX. CX. DX. SP. SP. SI. or DI RWD Any RW register as a destination RWS Any RW register as a source SEGM Label identifying a 16-bit value loaded into the CS Segment register to execute a segment jump SFR Status Flags register SI Source Index register SP Stack Pointer SR Anyone of the Segment registers CS. DS. ES. or SS SS Stack Segment register 5-57 U Status flag modified. but undefined V Any number in the range a through 25510 X Status flag modified to reflect resu It WD The destination is a word operand (used only by the Assembled WS The source is a word operand (used only by the Assembler) [[ ]] Contents of the memory location addressed by the contents of the location enclosed in the double brackets [] The contents of the location enclosed in the brackets Data on the right-hand side of the arrow is moved to the location on the left-hand side of the arrow Contents of locations on each side of < - - are exchanged The twos complement of the value under the - 1= Not equal to INSTRUCTION EXECUTION TIMES AND CODES Table 5-5 lists instructions in alphabetical order. showing object codes and execution times. for the 8086 and the 8088. expressed in whole clock cycles. Execution time is the time required from beginning execution of an instruction that is in the queue to beginning execution of the next instruction in the queue. The time required to place an instruc- tion from memory into the queue (instruction fetch time) is not shown in the table; because of queuing. instruction fetch time occurs concurrently with instruction execution time and thus has no effect on overall timing. except as specifically noted in the table. Instruction object codes are represented as two hexadecimal digits for instruction bytes without variations. Instruction object codes are represented as eight binary digits for instruction bytes with variations for the instruction. The following notation is used in Tables 5-4 and 5-5: [] indicate an optional object code byte a one bit choosing length: a in bit position a=O specifies 1 data byte; a= 1 specifies 2 data bytes in bit position 1 a=O specifies 2 data bytes: a=1 specifies 1 data byte aa two bits choosing address length: no DISP = 00 one DISP byte = 01 two DISP bytes = 10. or 00 with bbb = 110 11 causes bbb to select a register. using the 3-bit code given below for reg. bbb three bits choosing addressing mode: 000 EA = (BX) + (SI) + DISP 001 EA = (BX) + (DI) + DISP 010 EA = (BP) + (SI) + DISP 011 EA = (BP) + (DI) + DISP 100 EA = (SI) + DISP 101 EA = (DI) + DISP 110 EA = (BP) + DISP 111 EA = (BX) + DISP DISP represents two hexadecimal digit memory displacement ddd represents three binary digits identifying a destination register (see reg.) rr two binary digits identifying a segment register: 00 = ES 01 = CS 10 = SS 11 = DS reg three binary digits identifying a register: 16-bit 8-bit 000 = AX AL 001 = CX CL 010 = DX DL 011 = BX BL 100 = SP AH 101 = BP CH 110 = SI DH 111 = DI BH 5-58 sss represents three binary digits identifying a source register (see reg) PPOO represents four hexadecimal digit memory address v one bit choosing shift length: o count = 1 1 count = (eU x "don't care" bit yy represents two hexadecimal data digits yyyy represents four hexadecimal data digits one bit where z XOR (ZF) = 1 terminates loop Execution time is less than or equal to instruction fetch time. Includes up to eight clock cycles of overhead on each transfer due to queue maintenance. For conditional jumps, the lesser figure is when the test fails (no jump taken). Effective Address calculation and extra clock cycles: Extra Clock Periods bbb EA 8086(1) 8088(2) 000 (BX) + (SI) 7 7 000 (BX) + (SI) + 0lSP8 11 11 000 (BX) + (SI) + OISP 16 11 15 001 (BX) + (01) a a 001 (BX) + (01) + 0lSP8 12 12 001 (BX) + (01) + OISP 16 12 16 010 (BP) + (SI) a 8 010 (BP) + (SI) + olspa 12 12 010 (BP) + (SI) + OISP 1 6 12 16 011 (BP) + (01) 7 7 011 (BP) + (01) + olspa 11 11 011 (BP) + (01) + OISP 16 11 15 100 (SI) ir (01) or (BO) 5 5 101 or (BX) 110 + olspa 9 9 111 + 0lSP16 9 13 a-bit immediate 6 6 1 6-bit immediate 6 10 (1 ) Add another 4 clock cycles for each 1 6-bit operand or an odd address boundary. (2) Add anoter 4 clock cycles for each 1 6-bit operand. Substitute the clock cycles shown above wherever EA appears in Tables 5-4 and 5-5. 5-59 Table 5-4. A Summary of 8086 and 8088 Instructions GI Statuses a. > Mnemonid Operand Is) Object Code Clock Cycles Operation Performed t- O D I T S Z APe IN AL,PORT E4 YY 10 [AL) - [PORT) Load one byte of data from 1/0 port PORT into AL IN AL.[OX) EC 1 8 [AL)- [POX) Load into AL one byte of data from 1/0 port whose address is held in the OX register IN AX,PORT E5 YY 10 [ALI - [PORT). [AH) - [PORT + 1) Load 16 bits of data into AX, AL receives data from 1/0 port PORT, AH receives data from 1/0 port PORT + 1 IN AX,[OX) ED 8 [AL) - [POX), [AH) - [POX+ 1) Load 16 bits of data into AX, AL receives data from 1/0 port whose address is held in the OX register. AH receives data from the 1/0 port whose address is g OUT AL,PORT E6 YY 10 one higher [PORT) - [AL) Output one byte of data from register AL to 1/0 port PORT OUT AL,[OX) EE 1 8 [POX)- [ALI Output one byte of data from register AL to the 1/0 port whose address is held in the OX register U1 OUT AX,PORT E7 YY 10 [PORT) - [ALI. [PORT + 1) - [AH) m o Output 16 bits of data. The AL register contents are output to 1/0 port PORT. The AH register contents are output to 1/0 port PORT + 1 OUT AX,[OX) EF 8 [PORT) - [POXI. [PORT + 1) - [POX+ 1) Output 16 bits of data. The AL register contents are output to the 1/0 port whose address is held in the OX register. The AH register contents is output to the 1/0 port whose address is one higher LOS RW,OAOOR C5 aasssbbb 16+EA [RW)- [EAI. [OS)- [EA+2) [OISPJ[OISP) Load 16 bits of data from the memory word addressed by OAOOR into GI register RW. Load 16 bits of data from the next sequential memory word into Col c the OS register f LEA RW,OAOOR 80 aasssbbb 2+EA [RW)-OEA .; II: [OISP)[OISP) Load into RW the 1 6-bit address displacement which, when added to the ~ segment register contents, creates the effective data memory address 0 LES RW,OAOOR C4 aasssbbb 16+EA [RW)- [EAI. [ES)- [EA+2) E GI [DISP][DISP) Load 16 bits of data from the memory word addressed by DADDR into ~ register RW. Load 16 bits of data from the next sequential memory word into ~ III the ES register .5 MOV RB,OAOOR 8A aadddbbb 8+EA [RBI- [EAI A: [OISP)[OISP) Load one byte of data from the data memory location addressed by OAOOR to register RB Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) • ~nemonic Operandls) D. Object Code Clock Cycles Statuses Operation Performed ~ o D I T, S; Z A P C MOV RW,DADDR 8B aadddbbb 8+EA [RW] -[EA) [DISP][DISP) Load 16 bits of data from the data memory word addressed by DADDR to register RW MOV DADDR,RB 88 aasssbbb 9+EA [EA] - [RBJ [DISP][DISP] Store the data byte from register RB in the memory byte addressed by DADDR MOV DADDR,RW 89 aasssbbb 9+EA .[EA] -[RW] [DISP][DISP] Store the 16-bit data word from register RW in the memory word addressed by DAD DR MOV AL,LABEL AO PPQQ 10 [AL] - [EA] Load the data memory byte directly addressed by LABEL into register AL MOV AX,LABEL A1 PPQQ 10 [AX] - [EA] Load the 16-bit data memory word directly addressed by LABEL into register AX :a., MOV LABEL,AL A2 PPQQ 10 [EA] - [AL] ~ Store the 8-bit contents of register AL into the data memory byte directly ad- c:: ~0 dressed by LABEL MOV LABEL,AX A3 PPQQ 10 [EA] - [AX] 2 U1 ., Store the 16-bit contents of register AX into the data memory word directly ~ Co) c:: addressed by LABEL ! MOV SR,DADDR 8E aaOrrbbb 8+EA [SR] - [EA] ., of II: [DISP][DISP] Load into Segment register. SR the contents of the 1 6-bit memory word ad- > dressed by DADDR 0 MOV DADDR,SR 8C aaOrrbbb 9+EA [EA]- [SR] .,E [DISP][DISP] Store the contents of Segment register SR in the 16-bit memory location ad- :E dresed by DADDR > l& XCHG RB,DADDR 86 aaregbbb 17+EA [RB] - - [EA) 'E A. [DISP][DISP) Exchange a byte of data between register RB and the data memory location addressed by DADDR XCHG RW,DADDR 87 aaregbbb 17+EA [RW]-[EA] [DISP][DISP] Exchange 16 bits of data between register RW and the data memory location addressed by DADDR XLAT D7 11 [AL] - [[AL] + [BX)) Load into AL the data byte stored in the memory location addressed by sum- ming initial AL contents with ex contents Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) GI Statuses Q. > Mnemonic Operand(s) Object Code Clock Cycles Operation Performed ~ 0 D I T 5 Z A P C ADC RB,DADDR 12 aadddbbb 9+EA X X X X X [RB] - [EA] + [RB] + [C] X [DISPJ[DISP] Add the contents of the data byte addressed by DAD DR, plus the Carry status, to register RB ADC RW,DADDR 13 aadddbbb 9+EA X X X X X X [RW] - [EA] + [RW] + [C] [DISPJ[DISP] Add the contents of the 16-bit data word addressed by DADDR, plus the Car- ry status, to register RW ADC DADDR,RB 10 aasssbbb 16+EA X X X X X X [EA] - [EA] + [RB] + [C] [DISP][DISP] Add the 8-bit contents of register RB, plus the Carry status, to the data memory byte addressed by DADDR ADC DADDR,RW 11 aasssbbb 16+EA X X X X X X [EA] - [EA] + [RW] + [C] [DISP][DISP] Add the 16-bit contents of register RW, plus the Carry status, to the data '$ word addressed by DADDR I!GI ADD RB,DADDR 02 aadddbbb 9+EA X X X X X X [RB] - [EA] + [RB] Q. 0 [DISP)[DISP] Add the contents of the data byte addressed by DADDR to register RB ~ ADD RW,DADDR 03 aadddbbb 9+EA X X X X X X [RW] - [EA] + [RW] 0 [DISPJ[DISP] Add the contents of the 16-bit word addressed by DADDR to register RW E GI ADD DADDR,RB 00 aasssbbb 16+EA X X X X X X [EA] - [EA] + [RB] U1 ~ [DISP)[DISP] Add the a-bit contents of register RB to the data memory byte addressed by m ~ GI u c DADDR !!! ADD DADDR,RW 01 aasssbbb 16+EA X X X X X X [EA] - [EA] + [RW] .!GI [DISP][DISP] Add the 16-bit contents of register RW to the data memory word addressed a: by DADDR ~ AND RB,DADDR 22 aadddbbb 9+EA 0 X X U X 0 [RB] - [EA] AND [RB] E [DISP][DISP] AND the 8-bit contents of register RB with the data memory byte addressed GI ~ by DADDR. Store the result in RB ~ AND RW,DADDR 23 aadddbbb 9+EA 0 X X U X 0 [RW] - [EA) AND [RW] IV "uc 0 [DISP)[DISP] AND the 1 6-bit contents of register RW with the data memory word ad- dressed by DADDR. Store the result in RW GI (I) AND DADDR,RB 20 aasssbbb 16+EA 0 X X U X 0 [EA] - [EA) AND [RB) [DISP)[DISP] AND the 8-bit contents of register RB with the data memory byte addressed by DADDR. Store the result in the addressed data memory byte AND DADDR,RW 21 aasssbbb 16+EA 0 X X U X 0 [EA] - [EA] AND [RW] [DISP)[DISP] AND the 1 6-bit contents of register RW with the data memory word ad- dressed by DADDR. Store the result in the addressed data memory word CMP RB,DADDR 3A aadddbbb 9+EA X X X X X' X [RB] - [EA] [DISP][DISP] Subtract the contents of the data memory byte addressed by DADDR from the contents of register RB. Discard the result, but adjust status flags CMP RW,DADDR 38 aadddbbb 9+EA X X X X X X [RW] - [EA] [DISP][DISP] Subtract the 1 6-bit contents of the data memory word addressed by DADDR from the contents of register RW. Discard the result, but adjust status flags Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) Q) a. Statuses > Mnemonic Operand(s) Object Code Clock Cycles Operation Performed ~ 0 D I T S Z A P C CMP DADDR.RB 38 aasssbbb 9+EA X X X X X X [EA] - [RB] [DISP][DISP] Subtract the 8-bit contents of register RB from the data memory byte ad- dressed by DADDR. Discard the result, but adjust status flags CMP DADDR.RW 39 aasssbbb 9+EA X X X X X X [EA] - [RW] [DISP][DISP] Subtract the 16-bit contents of register RW from the data memory word ad- dressed by DADDR. Discard the result. but adjust status flags DEC DADDR 1111111a 15+EA X X X X X rEA] - [EA] - 1 aa001bbb Decrement the contents of the memory location addressed by DADDR. De- [DISP][DISP] pending on the prior definition of DADDR. an 8-bit or a 16-bit memory loca- ;; tion may be decremented CD AX.DADDR F6 aa110bbb (S6-96 )+EA U U U U U U [AX] - [AX]/[EA] DIV ·Sc= [DISP][DISP] Divide the 16-bit contents of register AX by the S-bit contents of the memory 0 byte addressed by DADDR. Store the integer quotient in AL and the remainder ~ in AH. If the quotient is greater than FF16. execute a "divide by 0" interrupt '! DIV OX. DAD DR F7 aa110bbb (150-16S)+EA U U U U U U [OX] [AX] - [OX] [AX]/[EA] f CD [DISP][DISP] Divide the 32-bit contents of registers OX (high-order) and AX !low-order) by a. the 16-bit contents of the memory word addressed by DADDR. Store the in- C C11 > teger quotient in AX and the remainder in OX. If the quotient is greater than 0, ~ FFFF 16. execute a "divide by 0" interrupt W E CD [AX] - [AX]/[EA] IDIV AX.DADDR F6 aa111bbb (107-11S)8+EA U U U U U U ~ [DISP][DISP] Divide the 16-bit contents of register AX by the 8-bit contents of the memory CD u byte addressed by DAD DR. treating both contents as signed binary numbers. c G) Store the quotient, as a signed binary number. in AL. Store the remainder. as .!CD an unsigned binary number. in AH. If the quotient is greater than 7F 16. or less II: than -S016. execute a "divide by 0" interrupt ~ [OX] [AX] - [OX] [AXl![EA] 0 IDIV DX.DADDR F7 aa111bbb (171)-190)+EA U U U U U U E G) [DISP][DISP] Divide the 32-bit contents of register OX (high-order) and AX !low-order) by ~ the 16-bit contents of the memory word addressed by DADDR. Treat both ~ contents as signed binary numbers. Store the quotient. as a signed binary III "a c number. in AX. Store the remainder. as an unsigned binary number. in AH. If 0 u G) the quotient is greater than 7FFF16. or less than -S00016. execute a "divide CI) by 0" interrupt IMUL ALDADDR F6 aa101bbb (S6-104)+EA X U U U U )( [AX] - [AL] • [EA] [DISP][DISP] Multiply the S-bit contents of register AL by the contents of the memory byte addressed by DADDR. Treat both numbers as signed binary numbers. Store the 16-bit product in AX IMUL AX.DADDR F7 aa101bbb (134-160)+EA X U U U U X [OX] [AX] - [AX] • [EA] [DISP][DISP] Multiply the 16-bit contents of register AX by the 16-bit contents of the memory word addressed by DADDR. Treat both numbers as signed binary numbers. Store the 32-bit product in DX (high-order word) and AX !low-order word) Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) & Statuses >- Mnemonic Operand(.) Object Code Clock Cycle. Operation Performed ~ o D I T S· Z A P C: INC DADDR 1111111a 15+EA X X X X X [EA] +- [EA] + 1 a8000bb Increment the contents of the memory location addressed by DADDR. De- [DISP}(DISP] pending on the prior definition of DAD DR. an 8-bit or a 16-bit memory loca- tion may be incremented MUL AL.DADDR FS a8100bbb (7S-831+EA 'X U U U U X [AX] +- [All • [EA] [DISP][DISP] Multiply the 8-bit contents of register AL by the contents of the m~mory byte addressed by DADDR. Treat both numbers as unsigned binary numbers. Store the 1S-bit product in AX MUL F7 F7 aa100bbb (124-1391+EA X U U U U X [OX) [AX) +- [AX) • [EA) [DISP][DISP] Multiply the 16-bit contents of register AX by the 16-bit contents of the ~ Gl ~ memory word addressed by DADDR. Treat both numbers as unsigned binary c +: numbers. Store the 32-bit product in DX (high-order word) and AX (low-order c ..; word) 0 ~ DADDR [EA) +- rEAl NEG 1111011a 16+EA X X X X X X aa011bb Twos complement the contents of the addressed memory location. Depend- [DISP][DISP] ing on the prior definition of DADDR. an 8-bit or 16-bit memory location may Q. 0 be twos complemented (J1 I >- NOT DADDR 1111011a 16+EA [EA] +- NOT [EA] m ~ -1=0 E aa010bbb Ones complement the contents of the addressed memory location. Depending Gl [DISP][DISP] on the prior definition of DADDR. an 8-bit or 16-bit memory location may be ! ones complemented Gl u [RB] +- [EA] OR [RB] c OR RB.DADDR OA aadddbbb 9+EA X X X U X X ~ [DISP)[DISP] OR the 8-bit contents of register RB with the data memory byte addressed by DADDR. Store the result in RB II: OR RW.DADDR OB aadddbbb 9+EA X X X U X X [RW) +- [EA) OR [RW) ~ 0 [DISP][DISP] OR the 1S-bit contents of register RW with the data memory word addressed E Gl by DADDR. Store the result in RW ~ DADDR.RB 08 aasssbbb X X X U X X [EA) +- [EA) OR [RB) OR 1S+EA ~ III [DISP][DISP) OR the 8-bit contents of register RB with the data memory byte addressed by " c 0 u DADDR. Store the result in the data memory byte [EA] +- [EA) OR [RW) Gl OR DADDR.RW 09 aasssbbb 16+EA X X X U X X en [DISP][DISP) OR the 16-bit contents of register RW with the data memory word addressed by DADDR. Store the result in the data memory word ---- Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) Statu.e. t>- ~nemonic Operand(s) Object Code Clock Cycles Operation Performed I- o D I T S Z A P C RCL DADDR.N 110100va N=1 X X Rotate the contents of the data memory location addressed by DADDR left aa011bbb 15+EA; through the Carry status. If N = 1. then rotate one bit position. If N =CL. then [DISP](DISP] N>1 register CL contents provide the number of bit positions. Depending on prior 4N+20+EA definition. DADDR may address a byte: ROL DADDR.N 110100va aaOOObbb I IT~ I [EA] Jj ~ • or DADDR may address a word: rg ~ .!c 6 0 [EA) 9 i ;a. [EA+1] 0 (J1 ~ m (J1 • E RCR DADDR.N 110100va aaOO1bbb N=1 15+EA X X As RCL. but rotate right ! [DISP](DISP] • Co) c i ~ ROL DADDR.N 110100va aaOOObbb [DISP](DISP] N>1 4N+20+EA X X Rotate the contents of the data memory location addressed by DAD DR left. Move the left most bit.into the Carry status. If N = 1. then rotate one bit posi- tion. If N = CL. then register CL contents provides the number of bit positions. ~ 0 Depending on prior definition. DAD DR may address a byte: E :e• all ~ EJ... I [EA] b 'a C 0 Co) • + (I) or DADDR may address a word: EJ4 !~ 6 [EAI [EA+1] Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) G Statuses ~ Mnemonic Operand(s) Object Code Clock Cycles Operation Performed t- O D I T S Z A P C DADDR.N 110100va N=1 15+EA X X As ROl. but rotate right aaOO1bbb [DISP][DISP] SAL Shift the contents of the data memory location addressed by DADDR left. Move the left most bit into the Carry status. If N = 1. then shift one bit posi- tion. If N = Cl. then register Cl contents provides the number of bit positions. Depending on prior definition. DADDR may address a byte: ;; G &-I [EA] 1-- 0 -!= ~ or DADDR may address a word:. 0 g ~ 2 i [EA] ;Q. 0 Cf ~ [EA+1] m E m G ~ SAR DADDR.N 110100va N=1 15+EA; X X X U X X As SAL. but shift right and propagate sign: G u aa111bbb N>1 ~ ! [DISPJ[DISP] .4N+20+EA -.J ~ .!G [EA] CC ~ or q E G ~ :E [EA] ~ III 'tI ~ 0 u [EA+1] G (/) SBB RB,DADDR 1A aaddd bbb 9+EA X X X X X X [RB] - [RB] - [EA] - [C] [DISPJ[DISP] Subtract the contents of the data byte addressed by DAD DR from the con- tents of a-bit register RB, using twos complement arithmetic. Decrement the result in RB if the Carry status was initially set SBB RW,DADDR 1B aadddbbb 9+EA X X X X X X [AW) - [RW) - [EA) - [e) [DISPJ[DISP] Subtract the contents of the 16-bit data word addressed by DAD DR from the contents of the 16-bit register RW, using twos complement arithmetic. Decrement the result in RW if the Carry status was initially set Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) Statuses I G) Q. Mnemonic Operand(s) Object Code Clock Cycles Operation Performed ~ o D I T S Z A P C SBB DADDA,AB 18 aasssbbb 16+EA X X X X X X [EA] - [EA] - [AB] - [C] I [DISP][DISP] Subtract the contents of 8-bit register AB from the data byte addressed by ! DADDA, using twos complement arithmetic. Decrement the result in data I memory if the Carry status was initially set SBB DADDA,AW 19 aasssbbb 16+EA X X X X X X [EA]- [EA] - [AW] - [C] I [DISP][DISP] Subtract the contents of 16-bit register AW from the 16-bit data word ad- dressed by DADDA, using twos complement arithmetic. Decrement the result in data memory if the Carry status was initially set SHL DADDA,N X X X U X X This is an alternate mnemonic for SAL ~ SHA DADDA,N 110100va N=1 15+EA; X X X U X X As SAL, but shift right: CD ~ aa1p1bb N>1 ·Sc [DISP][DISP] O~ f---.E] 4N+20+EA 0 [EA] g 1 or q 1!! G) ~ Q. 0 [EA] U'1 a, ~ -.,j E G) ~ [EA+1] G) u c ...! CD G) SUB AB,DADDA 2A aadddbbb [DISP][DISP] 9+EA X X X X X X [RB] - [RB] - [EA] Subtract the contents of the data memory byte addressed by DADDR from the a: ~ contents of a-bit register AB, using twos complement arithmetic 0 E SUB AW,DADDA 2B aadddbbb 9+EA X X X X X X [AW] - [AW] - [EA] CD [DISP][DISP] Subtract the contents of the 1 6-bit data memory word addressed by DADDA ~ from the contents of l6-bit register AW, using twos complement arithmetic ~ III SUB DADDR,AB 28 aasssbbb l6+EA X X X X X X [EA] - [EA] - [AB] "a c [DISP][DISP] o Subtract the contents of 8-bit register AB from the data memory byte ad- u G) (/) dressed by DADDA, using twos complement arithmetic SUB DADDR,RW 29 aasssbbb l6+EA X X X X X X [EA) - [EA) - [AW] [DISP][DISP) Subtract the contents of l6-bit register AW from the l6-bit data memory word addressed by DADDA, using twos complement arithmetic TEST DADDR,RB 84 aaregbbb 9+EA 0 X X U X 0 [EA) AND [RB) [DISP][DISP] AND the 8-bit contents of the data memory location addressed by DADDR with the contents of 8-bit register RB. Discard the result, but adjust status flags appropriately ---- Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) G Statuses Q. > Mnemonic Operand(s) Object Code Clock Cycles Operation Performed ~ o 0 I T S Z A P C TEST DADDR,RW 85 aareg bbb 9+EA 0 X X U X 0 [EA] AND [RW] [DISP][DISP] AND the 16-bit contents of the data memory word addressed by DAD DR with the contents of 16-bit register RW. Discard the result, but adjust status flags CD- u'a appropriately _.... c G CD= .. C CD'- XOR RB,DADDR 32 aadddbbb 9+EA 0 X X U X o [RB] ....... [RB] XOR [EA] Exclusive OR the 8-bit contents of register RB with the data memory byte ad- CDC [DISP][DISP] a: o dressed by DADDR. Store the result in RB >y ~"i e .... XOR RW,DADDR 33 aadddbbb 9+EA 0 X X U X o [RW] ....... [RW] XOR [EA] GI! [DISP][DISP] Exclusive OR the 16-bit contents of register RW with the 16-bit data memory ~~ word addressed by DADDR. Store the result in RW ~O 0 [EA] ....... [RB] XOR [EA] XOR DADDR.RB 30 aasssbbb 16+EA 0 X X U X ~~ [DISP][DISP] Exclusive OR the 8-bit contents of register RB with the data memory byte ad- 5e U'CD dressed by DADDR. Store the result in the addressed data memory byte CD'~ 0 _ XOR DADDR,RW 31 aasssbbb 16+EA 0 X X U X 0 [EA] ....... [RW] XOR [EA] [DISP][DISP] Exclusive OR the 16-bit contents of register RW with the data memory word addressed by DADDR. Store the result in the addressed data memory word C1I MOV DADDR, C6 aaOOObbb 10+EA [EA] ....... DATA8 c'n DATA8 [DISP][DISP] yy Load the immediate data byte OAT A8 into the data memory byte addressed 00 by DADDR ! MOV DADDR, C7 aaOOObbb 10+EA [EA] ....... DATA16 II :sCD DATA16 [DISP][DISP] YYYY Load the immediate 1 6-bit data word OAT A 16 into the data memory word E addressed by DADDR oS MOV RB,DATA8 10110ddd YY 4* [RB] ....... DATA8 Load the immediate data byte DAT A8 into 8-bit register RB MOV RW,DATA16 10111ddd YYYY 4* [RW] ....... DATA16 Load the immediate 16-bit data word DATA 16 into 16-bit register RW JMP BRANCH 111010a1 15** [PC] ....... [PC] + DISP DISP [DISP] Jump direct to program memory location identified by label BRANCH. The displacement DISP which must be added to the Program Counter will be com- puted as an 8-bit or 16-bit signed binary number, as needed, by the assembler JMP BRANCH, EA PPOO PPOO 15*· [PC] - DATA16, [CS] - DATA16 Q. SEGM Jump direct into a new segment. BRANCH is a label which becomes a 16-bit E .., :s unsigned data value which is loaded into PC. SEGM is a label which becomes another 16-bit unsigned data value that is loaded into the CS segment register JMP DADDR FF aa100bbb 18+EA** [PC] ....... [EA] [DISP][DISP] Jump indirect in current segment. The 16~bit contents of the data memory word addressed by DAD DR is loaded into PC Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) Statuses "D. iMnemonic Operandls) Object Code Clock Cycles Operation Performed ~ o D I TS Z A P C JMP DADDR.CS FF aa101bbb 24+EA" [PC) - [EAI. [CS) - [EA+2) ...c [DISP] [DISP] Jump indirect into a new segment. The 16-bit contents of the data memory 0 g word addressed by DADDRis loaded into PC. The next sequential 16-bit data a. memory word's contents is loaded into the CS segment register ..,E:;, JMP RW FF 11100reg 11 [PC]- [RW] Jump to memory location whose address is contained in register RW. CALL BRANCH E8 DISP DISP 1S"" liSP]] - [PCI. [SP] - [SP] - 2. [PC] - [PC] + DISP Call a subroutine in the current program segment using direct addressing CALL BRANCH. SA PPQQ PPQQ 28"" liSP]] - [CSI. [SP] - [SP] -2. liSP]] - [PC]. [SP] - [SP] -2. [PC] - SEGM DATA16. [CS] - DATA 16 Call a subroutine in another program segment using direct addressing. BRANCH and SEGM are labels that become different 16-bit data words; they are loaded into PC and CS. respectively CALL DADDR FF aa010bbb 21 +EA"" liSP)) ..... [PC). [SP) - [SP) -2. [PC)- [EA) [DISP][DISP] Call a subroutine in the current program segment using indirect addressing. c.n The address of the subroutine called is stored in the 16-bit data memory m co word addressed by DADDR ~ CALL DADDR.CS FF aa011bbb 37+EA"" IISP]]- [CSI. [SP] - [S2] -2. liSP]] - [PC]. [SP]- [SP] -2. [PC] - [EAI. [DISP][DISP] [CS]- [EA+2] " II: 'a Call a subroutine in a different program segment using indirect addressing. c ca The addre~s of the subroutine called is stored in the 16-bit data memory word addressed by DADDR. The new CS register contents is stored in the ii Co) next sequential program memory word '"S:;, CALL RW FF 11010reg 16"" [SP] - [PC].[SP] - [SP-21. [PC] ..... [RW] Call a subroutine whose address is contained in register RW. e .&:I RET C3 8"" [PC] - [[SP]]. [SP] ..... [SP] + 2 :;, en Return from a subroutine in the current segment RET CS CB 12"" [PC]- [[SP]1. [SP] ..... [SP] +2. [CS]- liSP]]. [SP] ..... [SP] +2 Return from a subroutine in another segment RET DATA16 C2 YYYY 17"" [PC]"'" IISP]]. [SP]- [SP] +2 +DATA16 Return from a subroutine in the current segment and add an immediate dis- placement to SP RET CS.DATA16 CA YYYY 18"" [PC]- [[SP)1. [SP) - [SP) +2. [CS)- liSP]]. [SP) ..... [SP) +2 +DATA16 Return from a subroutine in another segment and add an immediate displace- ment to SP Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) II Statuses a. Mnemonic Operand(s) Object Code Clock Cycles Operation Performed > t- O D I T S Z A P C ADD AL,DATAS 04 yy 4· X X X X X X [AL] - [All + DAT AS Add S-bit immediate data to the AL register ADD AX,DATA16 05 YYYY 4· X X X X X X [AX)- [AX) + DATA16 Add 16-bit immediate data to the AX register ADD RB,DATAS SO 11 OOOddd YY 4· X X X X X X [RB) - [RB] + DAT AS Add S-bit immediate data to the RB register ADD RW,DATA16 S1 11000ddd 4· X X X X X X [RW]- [RW] + DATA16 YYYY Add 16-bit immediate data to the RW register ADD DADDR, SO aaOOObbb 17+EA X X X X X X [EA] - [EA] + DAT AS DATAS [DISP][DISP] YY Add S-bit immediate data to the data memory byte addressed by DADDR ADD DADDR, S1 aaOOObbb 17+EA X X X X X X [EA] - [EA] + DATA16 DATA16 [DISP][DISP) YYYY Add 16-bit immediate data to the data memory word addressed by DADDR ADe AL,DATAS 14 YY 4· X X X X X X [AL] - [AL] + DAT AS + [e] Add S-bit immediate data, plus carry, to the AL register ADe AX,DATA16 15 YYYY 4· X X X X X X [AX]- [AX] + DATA16 + [e] Add 16-bit immediate data, plus carry, to the AX register ADe B,DATAS SO 11010ddd YY 4· X X X X X X [RB] - [RB] + DAT AS + [e] ! ?' f Add S-bit immediate data, plus carry, to the RB register ...., G a. ADe RW,DATA16 S1 11010ddd 4· X X X X X X [RW]- [RW] + DATA16 + [e] o 0 YYYY Add 16-bit immediate data, plus carry, to the RW register !l1li ADe DADDR, SO aa010bbb 17+EA X X X X X X [EA] - [EA] + DATA8 + [e] :sG DATA8 [DISP][DISP] YY Add 8-bit immediate data, plus carry, to the data memory byte addressed by E DADDR -E ADe DADDR, S1 aa010bbb 17+EA X X X X X [EA] - [EA] + DATA16 + [e] DATA16 [DISP][DISP] YYYY Add 16-bit immediate data, plus carry, to the data memory word addressed by DADDR AND AL,DATAS 24 YY 4· 0 X X U X 0 [ALI - [ALI AND DAT AS AND S-bit immediate data with AL register contents AND AX,DATA16 25 YYYY 4· 0 X X U X 0 [AX]- [AX] AND DATA16 AND 16-bit immediate data with AX register contents AND RB,DATAS SO 11100ddd YY 4· 0 X X U X 0 [RB] - [RB] AND DAT AS AND 8-bit immediate data with RB register contents AND RW,DATA16 S1 11100ddd 4· 0 X X U X 0 [RW]- [RW] AND DATA16 YYYY AND 16-bit immediate data with RW register contents AND DADDR,8 80 aa100bbb 17+EA 0 X X U X 0 [EA] - [EA] AND DAT A8 [DISP][DISP] YY AND 8-bit immediate data with contents of data memory byte addressed by DADDR AND DADDR, 81 aa100bbb 17+EA 0 X X U X 0 [EA]- [EA] AND DATA16 DATA16 [DISP][DISP] YYYY AND 1 6-bit immediate data with contents of 1 6-bit data memory word ad- dressed by DADDR Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) G) Statuses CL Operation Performed >- Mnemonic Operand(s). Object Code Clock Cycles ~ 0 D I T S Z A P C I CMP Al,DATA8 3C YY 4· X X X X X X [All - DATA8 I Subtract 8-bit immediate data from Al register contents. Discard result, but adjust status flags CMP AX,DATA16. 3D YYYY 4· X X X X X X [AX] - DATA16 Subtract 16-bit immediate data from AX register contents. Discard result, but adjust status flags CMP RB,DATA8 80 11111 ddd YY 4· X X X X X X [RB] - DATA8 Subtract S-bit immediate data from RB register contents. Discard result, but adjust status flags CMP RW,DATA16t 100000a1 4· X X X X X X [RW] - DATA16 1111ddd Subtract 16-bit immediate data from RW register contents. Discard result, YY [YY) but adjust status flags CMP DADDR, 80 aa111bbb 10+EA X X X X X X [EA] - DATA8 DATA8 [DISP)[DISP] YY Subtract 8-bit immediate data from contents of data memory byte addressed by DADDR. Discard result, but adjust status flags ;:; G) CMP DADDR, 100000a1 10+EA X X X X X x. [EA] - DATA16 :I DATA16 aa111bbb Subtract 16-bit immediate data from contents of 16-bit data memory word 'Sc cr g 0 OR Al,DATA8 [DISP)[DISPI'YY\[YY] OC YY 4· 0 X addressed by DADDR. Discard result, but adjust status flags X U X o [All - [All OR OAT A8 """ ~ ! OR 8-bit immediate data with Al register contents I! G) OR AX,DATA16· 00 YYYY 4· 0 X X U X 0 [AX] - [AX] OR DATA16 CL 0 OR 16-bit immediate data with AX register contents !III OR RB,DATA8 80 11001ddd YY 4· 0 X X U X 0 [RB] - [RB] OR OAT A8 :s G) OR 8-bit immediate data with RB register contents e OR RW,DATA16 81 11001ddd 4· 0 X X U X 0 [RW]- [RW] OR DATA 16 .5 YYYY OR 16-bit immediate data with RW register contents OR DADDR, 80 aa001bbb 17+EA 0 X X U' X 0 [EA] - [EA] OR DATA S DATAS [DISP)[DISP] YY OR S-bit immediate ata with contents of data memory byte addressed by DADDR OR DADDR, 81 aa001bbb 17+EA 0 X X U X 0 [EA] - [EA] OR DATA16 DATA16 [DISP)[DISP) OR 16-bit immediate data with contents of 16-bit data memory word ad- YYYY dressed by DADDR SBB Al.DATAS 1C YY 4· X X X X X X [Al] - [Al] - OAT A8 - [e] Subtract S-bit immediate signed binary data from Al register contents using twos complement arithmetic. If the Carry status was originally 1 decrement the result SBB AX,DATA16: 10 YYYY 4· X. X X, X X X [AX) - [AX) - OATA16 - [C) Subtract 16-bit immediate signed binary data from AX register contents using twos complement arithmetic. If the Carry status was originally 1 decre- ment the result Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) II Statuses Q. > Mnemonic Operand(s) Object Code Clock Cycles Operation Performed ... 0 D I T S Z A P C SBB RB,DATA8 80 11011ddd YY 4' X X X X X X [RB) +- [RB) - DAT A8 - [C) Subtract 8-bit immediate signed binary data from RB register contents using twos complement arithmetic. If the Carry status was originally 1 decrement the result SBB RW,DATA16 100000al 4' X X X X X X [RW] +- [RW] - DATA 16 - [C] 11011ddd Subtract 16-bit immediate signed binary data from RW register contents yy [YY] using twos complement arithmetic. If the Carry status was originally 1 decre- ment the result SBB DAD DR, 80 aaOllbbb 17+EA X X X X X X [EA] +- [EA] - DATA8 - [e] DATA8 [DISP)[DISP] YY Subtract 8-bit immediate signed binary data from contents of data memory byte addressed by DAD DR using twos complement arithmetic. If the Carry status was originally 1 decrement the result SBB DAD DR, 100000al 17+EA X X X X X X [EA] +- [EA] - DATA 16 - [e] DATA16 aaOl1bbb Subtract 16-bit immediate signed binary data from contents of l6-bit data [DISP)[DISP)YY [YY) memory word addressed by DADDR using twos complement arithmetic. If the ~ G) :I Carry status was originally 1 decrement the result 'Sc SUB AL,DATA8 2C YY 4' X X X X X X [ALI +- [ALI - DA T A8 Cf' -..J y 0 Subtract the 8-bit immediate signed binary data from AL register contents using twos complement arithmetic '" $ fG) SUB AX,DATA16 2D YYYY 4' X X X X X X [AX] +- [AX] - DATA16 Q. Subtract the 16-bit immediate signed binary data from AX register contents 0 using twos complement arithmetic $ SUB RB,DATA8 80 lll01ddd YY 4" X X X X X X [RB] +- [RB] - DA T A8 III :s G) Subtract the 8-bit immediate signed binary data from RB register contents E using twos complement arithmetic .5 SUB RW,DATA16 81 11101ddd 4' X X X X X X [RW] +- [RW] - DATA16 YYYY Subtract the 16-bit immediate signed binary data from RW register contents using twos complement arithmetic SUB DADDR, 80 aal0lbbb 17+EA X X X X X X [EA] +- [EA] - DA T A8 DATA8 [DISP)[DISP] YY Subtract the 8-bit immediate signed binary data from the contents of the data memory byte addressed by DADDR using twos complement arithmetic SUB DADDR, 100000al 17+EA X X X X X X [EA] +- [EA] - DATA 16 DATA16 aal 01 bbb Subtract the 16-bit immediate Signed binary data from the contents of the [OISP][DISP]YY [YY] 0 16-bit data memory word addressed by DADDR using twos complement arithmetic TEST AL,DATA8 A8 YY 4' X X U X 0 [All AND DAT A8 AND the 8-bit immediate data and AL register contents. Discard the result but adjust status s -- Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) Statuse, ! Mnemonic Operand(s) . ~ Object Code, Clock Cycles o D I T S Z A P C· Operation Performed TEST AX,DATA16 AS YYYY 4- 0 X X U X 0 [AX] AND DATA16 AND the 16-bit immediate data and AX register contents. Discard the result but adjust status flags TEST RB,DATAS F6 11 OOOddd YY 5- 0 X X U X 0 [RB] AND OAT AS AND the S-bit immediate data and RB register contents. Discard the result but adjust status flags TEST RW,DATA16 F7 11000ddd 5- 0 X X U X 0 [RW] AND DATA16 YYYY AND the 16-bit immediate data and RW register contents. Discard the result but adjust status flags ;:; TEST DADDR, F6 aaOOObbb 11+EA 0 X X U X 0 [EA] AND OAT AS Q) ~ DATAS [DISP][DISP] YY AND the 8-bit immediate data and the contents of the data memory location ..;c addressed by DADDR. Discard the result but adjust status flags 0 g TEST DADDR, F7 aaOOObbb 11+EA 0 X X U X 0 [EA] AND DATA16 $ DATA16 [DISP][DISP] YYYY AND the 16-bit immediate data and the contents of the 16-bit data memory IV Ii~ word addressed by DADDR. Discard the result but adjust status flags XOR AL,DATA8 34 YY 4- 0 X X U X 0 [All - [All XOR OAT A8 0 $ Exclusive OR 8-bit immediate data with AL register contents c.n IV :s XOR AX,DATA16 35 YYYY 4- 0 X. X U X 0 [AX] - [AX] XOR DATA16 ..:... Q) Exclusive OR 16-bit immediate data with AX register contents w E XOR RB,DATAS SO 1111 Oddd YY 4- 0 X X U X 0 [REt] - [RB] XOR OAT AS .E Exclusive OR 8-bit immediate data with RB register contents XOR RW,DATA16 S1 11110ddd 4- 0 X X U X 0 {RW]- [RW] XOR DATA16 YYYY Exclusive OR 16-bit immediate data with RW register contents XOR DADDR, SO aa010bbb 17+EA 0 X X U X 0 [EA] - [EA] XOR OAT AS DATAS [DlsP][DISP] YY Exclusive OR S-bit immediate data with contents of the data memory byte ad- dressed by DADDR XOR DADDR, 81 aa010bbb 17+EA 0 X X U X 0 [EA] - [EA] XOR DATA16 DATA16 [DISP][DISP] Exclusive OR 16-bit immediate data with contents of the 16-bit data memory YYYY word addressed by DADDR LOOP DISPS E2 DISP 5 or 17-- [eX] - [CX] -1 If [CX] i= 0 then [PC] - [PC] + DISPS c Decrement CX register and branch if CX contents are not 0 ~ LOOPE DISP8 E1 DISP 6 or 1S-- [CX] - [CX] -1 If [CX] i= 0 and [Z] = 1 then [PC] + DlsPS :sc Decrement eX register and branch if CX contents is not 0 and Z status is 1 0 (.) LOOPNE DlsPS EO DlsP 5 or 1S-- [CX] - [CX] -1 If [CX] i= 0 and [Z] = 0 then [PC] - [PC] + DISP8 c Decrement CX register and branch if CX contents is not 0 and Z status is 0 0 ~ LOOPNZ DIsP8 See LOOPNE u c LOOPZ DlsPS See LOOPE I! ID JA DISP8 77 DISP 4 or 16-- [PC] - [PC] + DISPS Branch if C or Z is 0 Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) CD Statuses a. > Mnemonic Operand(s) Object Code Clock Cycles Operation Performed ~ 0 0 I T S Z A P C JAE DISPB 73 DISP 4 or 16" [PC] +- [PC] + DISPS Branch if C is 0 JB DISPB 72 DISP 4 or 16" [PC] + - [PC] + DISP8 Branch if C is 1 JBE DISPB 76 DISP 4 or 16" [PC] +- [PC] + DISPS Branch if C or Z is 1 JCXZ DISPB E3 DISP 6 or lS" [PC] + - [PC] + DISP8 Branch if the CX register contents is 0 JE DISP8 74 DISP 4 or 16" [PC] + - [PC] + DISPS Branch if Z is 1 JG DISPS 7F DISP 4 or 16" [PC] + - [PC] + DISPS Branch if Z is 0 or the Sand 0 statuses are the same JGE DISPB 7D DISP 4 or 16" [PC] + - [PC] + DISPS Branch if the Sand 0 statuses are the same -:aCD JL DISPB 7C DISP 4 or 16" [PC] + - [PC] + DISPB .. :::s c c 0 JLE DISPB 7E DISP 4 or 16" Branch if the Sand 0 statuses differ [PC] + - [PC] + DISPS C11 I g Branch if Z is 1 or the Sand 0 statuses differ -.,j c JNA DISPB See JBE ~ ~ JNAE DISP8 See JB :ac JNB DISP8 See JAE 0 u JNBE DISP8 See JA c JNE DISP8 75 DISP 4 or 16" [PC] + - [PC] + DISP8 0 s:u Branch if Z is 0 c JNG DISP8 See JLE f JNGE l1li DISP8 See JL JNL DISPS See JGE jnle disp8 See JG JNO DISP8 71 DISP 4 or 16" [PC] + - [PC] + DISP8 Branch if 0 is 0 JNP DISP8 7B DISP 4 or 16" [PC] + - [PC] + DISP8 Branch if P is 0 JNS DISP8 79 DISP 4 or 16" [PC] +- [PC] + DISP8 Branch if S is 0 JNZ DISPS See JNE JO DISP8 70 DISP 4 or 16"" [PC] +- [PC] + DISPS Branch if 0 is 1 JP DISP8 7A DISP 4 or 16" [PC] + - [PC] + DISP8 Branch if P is 1 JPE DISP8 See JP -- Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) CD Statuses a. > Mnemonic Operand Is) Object Code Clock Cycles Operation Performed ~ 0 D I T S Z A P C ..,l JPO 0lSP8 See JNP c 0 JS 0lSP8 780lSP 4 or 16" [PC] ...... IPC] + 0lSP8 9 (,) Branch if S is 1 0 JZ DlSP8 See JE ID MOV RBO.RBS 8A11dddsss 2' [RBO] ...... [RBS] Move the contents of any RB register to any RB register CD MOV RWO.RWS 8B 11dddsss 2' [RWO] ...... [RWS] > 0 Move the contents of any RW register to any RW register .. 2 ! MOV SR.RW 8E 11 Orrsss 2' [SR] ...... [RWS] Move the contents of any RW register to any Segment register II) '61 MOV RW.SR 8C 110rrddd 2' [RWO] ...... [SR] CD a:: Move the contents of any Segment register to any RW register . ! I XCHG AX.RW 10010reg 3' [AX] ...... - [RW] Exchange the contents of AX and any RW register II) '61 XCHG RB.RB 86 11 regreg 4' [RB] ...... - [RB] CD a:: Exchange the contents of any two RB registers CTI XCHG RW.RW 87 11regreg 4' [RW] ...... - [RW] ~ Exchange the contents of any two RW registers CTI CMPS BO.BS A6 22 X I/O X X X X X [[SI11 - [[01]]. [SIl ...... [SIl ± 1. [Oil ...... [Oil ± 1 Compare the data bytes addressed by the SI and 01 Index registers using string data addressing' CMPS WO.WS A7 22 X /0 X X X X X [[5111 - [[01]1. [SIl ...... [SIl ± 2. [01] ...... [Oil ± 2 Compare the 16-bit data words addressed by the 51 and 01 Index registers using string data addressing' ~ ~ LOOS BO.BS AC 12 I/O [All ...... [[5111. [SIl ...... [SIl ± 1 II II Move a data byte from the location addressed by the 51 Index register to the CI) "tI AL register using string data addressing c . II LOOS WO.WS AO 12 I/O [AX] ...... [[5111. [SIl ...... [SIl ± 1 Move a data word from the 16-bit location addressed by the 51 Index register -!c to the AX register using string data addressing I! MOVS BO.BS A4 18 I/O [[0111 ...... [[51]]. [SIl ...... [SIl ± 1. [01]""" [Oil ± 1 ~ ~ Move a data byte from the location addressed by the 51 Index register to the u 0 extra segment location addressed by the 01 register using string data address- iii ing' MOVS WO.WS A5 18 I/O [[Olll ...... [[5111. [SIl ...... [51] ± 2. [01] ...... [Oil ± 2 Move a 1 6-bit data word from the location addressed by the 51 Index register to the extra segment location addressed by the 01 Index register using string data addressing' • For these instructions. the default destination segment register cannot be overri,den. Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) CD Statuses ...~ Mnemonic Operand(s) Object Code Clock Cycles 0 0 I T S Z A P C Operation Performed REP N 1111001z +2 per loop I/O Repeat the next sequential instruction (which must be a Block Transfer and Search instruction) until CX contents decrements to O. Decrement CX con- ;; CD ~ tents on each repeat. If the next instruction is CMPB, CMPW, SCAB, or ~c SCAW then repeat until CX contents decrements to 0 or Z status does not 0 equal N .g SCAS BO,BS AE X I/O X X X X [AL] - [[Dill, [Oil - [Oil ± 1 15 X .c Compare AL register contents with the extra segment data byte addressed by 2 a! CD the 01 Index register using string data addressing en SCAS WO,WS AF X I/O X X [AX] - [[Dill, [Oil - [Oil ± 2 'a 15 X X X C a! Compare AX register contents with the extra segment 1 6-bit data ord ad- • '; c ! STOS BO,BS AA 11 X I/O X X X X X dressed by the 01 Index register using string data addressing [[0111 - [AL), [Oil - [Oil ± 1 Store the AL register contents in the extra segment data memory byte ad- ~ ~ dressed by the 01 Index register using string data addressing u 0 STOS WO,WS AB 11 X I/O X X X X X [[0111 - [AXI. [Oil - [Oil ± 2 iii Store the AX register contents in the extra segment 16-bit data memory word addressed by the 01 Index register using string data addressing cr AOC RBO,RBS 12 11dddsss 3' X X X X X X [RBO) - [RBO] + [RBS) + [C] """ en Add the 8-bit contents of register RBS, plus the Carry status, to register RBO AOC RWO,RWS 13 11 dddsss . 3' X X X X X X [RWO) - [RWO] + [RWS] + [C] Add the 16-bit contents of register RWS. plus the Carry status. to register RWO ADD RBO.RBS 02 11dddsss 3' X X X X X X [RBO) - [RBO] + [RBS) . CD ! ADD RWO.RWS 03 11dddsss 3' X X X X X X Add the 8-bit contents of register RBS to register RBO [RWO) - [RWO) + [RWS) & Add the 16-bit contents of register RWS to register RWO 0 RBO.RBS 22 11dddsss 3' 0 X X U X o [RBO] - [RBO] AND [RBS] ... AND !1ft AND the 8-bit contents of register RBS with register RBO '51 AND RWO.RWS 23 11dddsss 3' 0 X X U X 0 [RWO] - [RWO] AND [RWS) CD a: AND the 1 6-bit contents of register RWS with register RWO I CBW 98 2' [AH]- [AL7) ! 1ft Extend AL sign bit into AH '51 CMP RBO.RBS 3A 11dddsss 3' X X X X X X [RBO] - {RBS] CD a: Subtract the contents of register RBO from register RBS. Discard the result. but adjust status flags eMP RWO.RWS 3B 11dddsss 3' X X X X X X [RWO] - [RWS] Subtract the contents of register RWO from register RWS. Discard the result, but adjust status flags CWO 99 5 [OX) - [AX15) Extend AX sign bit into OX - - Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) ~• Statu.e. ...> !Mnemonic Operand(.) Object Code Clock Cycle. o D I T S Z A P C Operation Performed OIV RBS F6 11110555 80-90 U U U U U u [AX] +- [AX]/[RBS] Divide the 16-bit contents of AX by the 8-bit contents of RBS. Store the in- teger quotient in AL and the remainder in AH. If the quotient is greater than FF16. execute a "divide by 0" interrupt DIV RWS F7 1111 Osss 144-162 U U U U U u [DX) [AX) +- [DX) [AX)/[RWS] Divide the 32-bit contents of registers DX (high-order) and AX (low-order) by the 16-bit contents of RWS. Store the integer quotient in AX and the re- mainder in DX. If the quotient is greater than FFFF16. execute a "divide by 0" interrupt IDIV RBS F6 11111 sss 101-112 U U U U U U [AX] +- [AX]/[RBS] Divide the 16-bit contents of register AX by the 8-bit contents of RBS. treat- ing both contents as signed binary numbers. Store the quotient. as a signed binary number. in AL. Store the remainder. as an unsigned binary number. in ~ AX. Store the remainder. as an unsigned binary number. in AH. If the quotient •~ is greater than 7F16. or less than -8016. execute a "divide by 0" interrupt 'Sc IOIV RWS F7 11111 sss 165-184 U U U U U U [OX] [AX] +- [OX] [AXlI[RWS] 0 g Divide the 32-bit contents of registerl>X (high-order) and AX (low-order) by cr ! the 16-bit contents of RWS. Treat both contents as signed binary numbers. "" \!! • CL Store the quotient. as a signed binary number. in AX. Store the remainder. as an unsigned binary number. in AH. If the quotient is greater than 7FFF16. or .. 0 ! IMUL RBS F6 11101 sss 80-98 X U U U U X less than -800016. execute a "divide by 0" interrupt [AX) +- [AL) " [RBS) II) '81 • II: Multiply the 8-bit contents of register AL by the contents of RBS. Treat both .. ! I IMUL RWS F7 11101 sss 128-154 X U U U U X, numbers as signed binary numbers. Store the 16-bit product in AX [DX) [AX) +- [AX)" [RWS) II) Multiply the 16-bit contents of register AX by the 16-bit contents of RWS. '81 • II: Treat both numbers as signed binary numbers. Store the 32-bit product in DX (high-order word) and AX (low-order word) MUL RBS F6 11100sss 70-17 X U U U U X [AX] - [AL] " [RBS] Multiply the 8-bit contents of register AL by the contents of RBS. Treat both numbers as unsigned binary numbers. Store the 16-bit product in AX MUL RWS F7 11100sss 118-133 X U. U UU X [DX) [AX) - [AX] .. [RWS) Multiply the l6-bit contents of register AX by the 16-bit contents of RWS. Treat both numbers as unsigned binary numbers. Store th,e 32-bit product in DX (high-order word) and AX (low-order word) OR RBD.RBS OA 11dddsss 3" 0 X X U X 0 [RBD] - [RBD] OR [RBS] OR the 8-bit contents of register RBS with register RBD OR RWD.RWS OB l1dddsss 3" 0 X X U X 0\ [RWD]- [RWD] OR [RWS] OR the l6-bit contents of register RWS with register RWD Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) Statuses t> Mnemonic Operand(s) Object Code Clock Cycles Operation Performed t- O 0 I T S Z A P C SBB RBD.RBS lA lldddsss 3' X X X X X X [RBD) - [RBD) - [RBS) ~ [C) Subtract the 8-bit contents of register RBS from RBD using twos complement arithmetic. If the Carry status was originally 1 decrement the result SBB RWD.RWS lB lldddsss 3' X X X X X X [RWD) - [RWD) - [RWS) - [C) ~ CD Subtract the lS-bit contents of register RWS from RWD using twos comple- :::I ~c ment arithmetic. If the Carry status was originally 1 decrement the result 0 SUB RBD.RBS 2A lldddsss 3' X X X X X X [RBD) - [RBD) - [RBS) g Subtract the 8-bit contents of register RBS from RBD using twos complement ! arithmetic f SUB RWD.RWS 2B 11 dddsss 3' X X X X X X [RWD) - [RWD) - [RWS) CD a. 0 Subtract the lS-bit contents of register RWS from RWD using twos comple- ... ment arithmetic !III TEST RBD.RBS 8411regreg 3' 0 X X U X 0 [RBD) AND [RBS) "61 CD AND the a-bit contents of register d and register RBS. Discard the result. but II: ...I adjust status flags $ TEST RWD.RWS 85 11 regreg 3' 0 X X U X 0 [RWD) AND [RWS) III "61 AND the lS-bit contents of register RWD and register RWS. Discard the Q) cr..... II: XOR RBD.RBS 30 lldddsss 3' 0 X X U X 0 result. but adjust status flags [RBD) - [RBD) XOR [RBS) co E~clusi~e OR the 8-bit contents of register RBS with register RBD XOR RWD.RWS 31 lldddsss 3' 0 X X U X 0 [RWD) - [RWD) XOR [RWS) ~xclusive OR the 16-bit contents of register RWS with register RWD AAA 37 4' U U U X U X ASC" adjust AI register contents for addition (as described in accompanying text) AAD D50A SO U X X U X U Decimal adjust dividend in AL prior to dividing an unpacked decimal divisor. to generate an unpacked decimal quotient. (See accompanying text for details) AAM D40A 83 U X X U X U After multiplying 0 unpacked decimal operands. adjust product in AX to ! become an unpacked decimal result. (See accompanying text for details) f Q) a. AAS 3F 4· U U U X U X After subtracting two unpacked decimal numbers. adjust the difference in AL 0 so that it too is an unpacked decimal number. (See accompanying text for !III details) "61 DAA 27 4' U X X X X X After adding two packed decimal numbers. adjust the sum in AL so that it too CD II: is a packed decimal number. (See accompanying text for details) DAS 2F 4' U X X X X X After subtracting two packed decimal numbers. adjust the difference in AL so that it too is a packed decimal number. (See accompanying text for details) DEC RB FE 11001ddd 3' X X X X X [RB] - [RB] -1 Decrement the 8-bit contents of register RB DEC RW 01001ddd 2' X X X X X [RW) - [RW) -1 Decrement the 1S-bit contents of register RW Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) GJ Statuses ~ Mnemonic Operand(s) Object Code Clock Cycles Operation Performed t- O 0 I T S Z A P C INC RB FE 11000ddd 3- X, X X X X [RB] - [RB] + 1 Increment the a-bit contents of register RB INC RW 01000ddd 2- X X X X X [RW] - [RW] + 1 Increm..!!!! the 16-bit contents of register RW NEG RB F611011ddd 3- X X X X X X [RB] - [RB] + 1 Twos ~Iement the a-bit contents of register RB NEG RW F7 11011ddd 3- X X X X X X [RW] - [RW] + 1 Twos complement the 16-bit contents of register RW NOT RB F6 11010ddd 3- [RB] - [RBi -:aGJ Ones c1 4N+8 X X X X register as illustrated for memory operate Rotate right the a-bit contents of RB register, or the 16-bit contents of RW co a: ROR RW,N ~ 10100v1 11001ddd X X register, as illustrated for memory operate SAL RB,N 110100vO 11100ddd X X X U X X Shift left the a-bit contents of RB register, or the 16-bit contents of RW SAL RW,N ~ 10l00v1 11100ddd X X X U X X register, as illustrated for memory operate SAR RB,N 110100vO f1111ddd X X X U X X Shift right the a-bit contents of register RB, or the l6-bit contents of register SAR RW,N ~ 10100v1 1llllddd X X X U X X RW, as illustrated for memory operate SHL RB,N X X X U X X See SAL SHL RW,N X X X U X· X See SAL SHR RB,N 110100vO 11101ddd N=l 2- X X X U X X Shift right the a-bit contents of register RB, or the 16-bit contents of register SHR RW,N ~ 10100vl 1ll0lddd N>1 4N+8 X X U X X RW, as illustra!ed for memory operate POP DADDR SF aaOOObbb 17+EA [EA] - [[SPll,' [SP] ..:... [SP] + 2 [DISP][DISP] Load the 16-bit Stack word, addressed using Stack addressing, into the 16- bit data memory word addressed by DADDR. Increment SP by 2 POP RW 01011ddd 8 [RW or SR] - [[SP]], [SP] - [SP] + 2 POP SR 000rr111 a Load the 16-bit Stack word, addressed using Stack addressing, into the ~ u specified 16-bit register. Increment SP by 2. S POPF 90 8. X X X X X_ .X XX X [SFR] - [[SPll, [SP] - [SP] + 2 en Load the 16-bit Stack word, addressed using Stack addressing, into the Status Flags register PUSH DADDR FF aa1l0bbb 16+EA [SP] - [SP] - 2, [[SP]] - [EA] [DISP][DISP] Store the 1 6-bit contents of the data memory word addressed by DADDR in the 16-bit Stack word addressed using Stack addressinQ.' Decrement SP by 2 - - Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) .,a. Statuses > Mnemonic Operand(s) Object Code Clock Cycles Operation Performed I- 0 0 I T S Z A P C PUSH RW 01010rrr 11 [SP) +- [SP) -2, [(SPII +- [RW or SR) ....c PUSH SR 000rr110 10 Store the contents of the specified 1 6-bit register in the 16-bit Stack word 0 g addressed using Stack addressing. Decrement SP by 2 ~ PUSHF 9C 10 [SP) +- [SP) +2, [[SPII - [SFR) u ca Store the Status flags register contents in the 16-bit Stack word addressed U; using Stack addressing. Decrement SP by 2 INT 3 CC 52 0 0 Execute a software interrupt and vector through table entry 3 J!! INT V CD YY 51 0 0 Execute a software interrupt and vector through table entry V a. E INTO CE 4 or 53 0 0 If the 0 status is 1, execute a software interrupt and vector through table en- ! try 1016 .E IRET CF 24 Return from interrupt service routine CLC Fa 2· 0 [C)-O Clear Carry status CLD FC 2· 0 [0)-0 Clear Decrement/Increment select CLI FA 2· 0 (1)-0 U1 cO Clea!:..!r'terrupt enable status, disabling all interrupts o CMC F5 2· X [C) -[C) Complement Carry status LAHF 9F 4· Transfer flags to AH register as follows: 7 6 5 4 3 2 1 0 Bit no. 1/1 I I I II I III AH register af! S Z 0 A 0 P I C U) SAHF 9E 4· X X X X X Transfer AH register contents to status flags as follows: 7 6 5 4 3 2 1 0 Bit no. I IIIII II S Z A P C IAH register STC F9 2· 1 [C)-1 Set Carry status to 1 STD FD 2· 1 (0)-1 Set Decrement/Increment status to 1 STI FB 2· 1 (1)-1 Set interrupt enable status to 1, enabling all interrupts Table 5-4. A Summary of 8086 and 8088 Instructions (Continued) II Statuses a. IMnemonlc! Operand(s) Object Code Clock Cycles Operation Performed >- I- 0 D I T S Z A P C ESC DADDA 11011xxx 8+EA 7 - [EA) aaxxxbbb The contents of the data memory location addressed by DADO A is read out of [DISP][DISP) memory and placed on the data bus; however, it is not input to the CPU HI-T F4 2" CPU Halt ~ LOCK FO 2" Guarantee the CPU bus control during execution of the next sequential in- -S struction 0 SEG SA 001reg110 +2 The next sequential allowed memory reference instruction accesses the seg- ment identified by Segment register SA. See Table 20-1 for allowed memory reference instructions WAIT 98 3+5n CPU enters the WAIT state until TEST pin receives a high input signal NOP 90 3" No operation (This is the same object code as XCHG, AX, AX.) C11 ~ i I I Table 5-5. 8086 and 8088 Instruction Mnemonics Clock Instruction Object Code Bytes Periods AAA 37 1 4- AAD D50A 2 60 AAM D40A 2 S3 AAS 3F 1 4- ADC AL,DATAS 14 YY 2 4- ADC AX,DATA16 15 YYYY 3 4- ADC DADDR,DATAS SO aa010bbb 3,4 or 5 17+EA [DISP) [DISP) YY ADC DADDR,DAT A 16 1 OOOOOa 1 aaO 1Obbb 3,4,5 or 6 17+EA [DISP) [DISP) YY[YY) ADC DADDR,RB 10 aasssbbb 2,3, or 4 16+EA [DISP) [DISP) ADC DADDR,RW 11 aasssbbb 2,3 or 4 16+EA [DISP) [DISP) ADC RB,DADDR 12 aadddbbb 2,3 or 4 9+EA [DISP) [DISP) ADC RB,DATAS SO 11010ddd YY 3 4- ADC RBD,RBS 12 11dddsss 2 3- ADC RW,DADDR 13 aadddbbb 2,3 or 4 9+EA [DISP) [DISP) ADC RW,DATA16 100000a111010ddd 3 or 4 4- YY[YY) ADC RWD,RWS 13 11dddsss 2 3- ADD AL,DATAS 04 YY 2 4- ADD AX,DATA16 05 YYYY 3 4- ADD DADDR,DAT AS SO aaOOObbb 3,4 or 5 17+EA [DISP) [DlSP] YY ADD DADDR,DAT A 16 1OOOOOa 1 aaOOObbb 3,4,5 or 6 17+EA [DISP) [DISP) YY[YY) ADD DADDR,RB 00 aasssbbb 2,3 or 4 16+EA [DISP) [DISP) ADD DADDR,RW 01 aasssbbb 2,3 or 4 16+EA [DISP) [DISP) ADD RB,DADDR 02 aadddbbb 2,3 or 4 9+EA [DISP) [DlSP] ADD RB,DATAS SO 11 OOOddd YY 3 4" ADD RBD,RBS 02 11dddsss 2 3" ADD RW,DADDR 03 aadddbbb 2,3 or 4 9+EA [DISP) [DISP) ADD RW,DATA16 100000a1 11000ddd 3 or 4 4" YY[YY) ADD RWD,RWS 03 11dddsss 2 3" AND AL,DATAS 24 YY 2 4" AND AX,DATA16 25 YYYY 3 4" AND DADDR,DATAS SO aa100bbb 3,4 or 5 17+EA [DISP) [DISP) YY AND DADDR,DAT A 1"6 81 aa100bbb 4,5 or 6 17+EA [DISP) [DISP] YYYY) AND DADDR,RB 20 aasssbbb 2; 3 or 4 16+EA [DISP] [DISP] AND DADDR,RW 21 aasssbbb 2,3 or 4 16+EA [DISP) [DISP] AND RB,DADDR 22 aadddbbb 2,3 or 4 9+EA [DISP) [DISP] AND RB,DATAS SO 111 OOOdddYY 3 4" AND RBD,RBS 22 11dddsss 23- 5-82 Table 5-5. 8086 and 8088 Instruction Mnemonics (Continued) Clock Instruction Object Code Bytes Periods AND RW,DADDR 23 aadddbbb 2,3 or 4 9+EA [DISP) [DISP) AND RW,DATA16 S1 11100sss YYYY 4 4- AND RWD,RWS 23 11dddsss 2 3- CALL SRANCH ES DISP DISP 3 19-- CALL BRANCH,SEGM 9A PPOOPPOO 5 2S-- CALL DADDR FF aa010bbb 2,3 or 4 21+EA [DISP) [DISP) CALL DADDR,CS FF aa011 bbb 2,3 or 4 37+EA-- [DISP) [DISP) CALL RW FF 11010reg 2 16-- CBW 9S 1 2 CLC FS 1 2- CLD FC 1 2- CLI FA 1 2- CMC F5 1 2- CMP AL,DATAS 3C YY 2 4- CMP AX,PATA16 3D YYYY 3 4- CMP DADDR,DAT A8 SO aalll bbb 3,4 or 5 10+EA [DISP) [DISP) YY CMP DADDR,DAT A 16 1 OOOOOa 1 aa 11 bbb 3,4,5 or 6 10+EA [DISP) [DISP) YY[YY) CMP DADDR,RB 3S aasssbbb 2,3 or 4 9+EA [DISP) [DISP) CMP DADDR,RW 39 aasssbbb 2,3 or 4 9+EA [DISP] [DISP] CMP RB,DADDR 3A aadddbbb 2,3 or 4 9+EA [DISP] [DISP) CMP RB,DATAS SO 11 111 ddd YY 3 4- CMP RBD,RBS 3A l1dddsss 2 3- CMP RW,DADDR 3B aadddbbb 2,3 or 4 9+EA [DISP] [DISP] CMP RW,DATA16 1OOOOOa 1 11111 ddd 3 or 4 4- YY[YY] CMP RWD,RWS 3B l1dddsss 2 3- CMPS BD,BS A6 1 22 CMPS WD,WS A7 1 22 CWO 99 1 5 DAA 27 1 4- DAS 2F 1 4- DEC DADDR 1111 lllaa aaOOlbbb 2,3 or 4 15+EA [DISP) [DISP] DEC RB FE 11001ddd 2 3- DEC RW 01001ddd 1 2- DIV (S-bit) AX,DADDR F6 aa110bbb 2,3 or 4 (S6-96)+EA [DISP] [DISP] DIV (16-bit) DX,DADDR F7 aal10bbb 2,3 or 4 (150-16S)+EA [DISP] [DISP] DIV RBS F6 11110sss 2 80-90 DIV RWS F7 11110sss 2 144-162 ESC DADDR 11 011 xxx aaxxxbbb 2,3 or 4 8+EA [DISP) [DISP] ESC RW 11011 xxx 11xxxreg 2 2 HLT F4 1 2- 5-83 Table 5-5. 8086 and 8088 Instruction Mnemonics (Continued) Clock Instruction Object Code Bytes Periods IDIV AX.DADDR FS aa111bbb 2.3 or 4 (107-118)+EA [DISP) [DISP) IDIV DX.DADDR F7 aa111 bbb 2.3 or 4 (171-190)+EA [DISP) [DISP) IDIV RBS FS 11111sss 2 101-112 IDIV RWS F7 11111 SSS 2 165-184 IMUL AL.DADDR FS aa101bbb 2.3 or 4 (8S-104)+EA [DISP) [DISP] IMUL AX.DADDR F7 aa101bbb 2.3 or 4 (134-1S0)+EA [DISP) [DISP) IMUL RBS FS 11101sss 2 80-98 IMUL RWS F711101sS5 2 128-154 IN AL[DX] EC 1 8 IN AL.PORT E4 YY 2 10 IN AX.[DX) ED 1 8 IN AX.PORT E5 YY 2 10 INC DAD DR 1111111 a aaOOObbb 2.3 or 4 15+EA [DISP) [DISP] INC RB FE 11000ddd 2 3 0 INC RW 01000ddd 1 2 0 INT 3 CC 1 52 INT V CD YY 2 51 INTO CE 1 4 or 53 IRET CF 1 24 JA/JNBE DISP8 17 DISP 2 4 or 1s 00 JAE/JNB DISP8 73 DISP 2 4 or 16. 0 JB/JNAE DISP8 7i DISP 2 4 or 1s 00 JBE/JNA DISP8 7 DISP 2 4 or 1S· 0 JCXZ DISPS 63DISP 2 S or 18. 0 JE/JZ DISPS 74DISP 2 4 or 1s 00 JG/JNLE DISPS 7F DISP 2 4 or 1S· 0 JGE/JNL DISPS 7DDISP 2 4 or 1S· 0 JL/JNGE DISPS 7C DISP 2 4 or 1s 00 JLE/JNG DISPS 7E DISP 2 4 or 1S· 0 JMP BRANCH 111010a 1 DISP [DISP) 2 or 3 15" JMP BRANCH.SEGM EA PPOO PPOO 5 15 00 JMP DADDR FF aa100bbb 2.3 or 4 1S+EA [DISP) [DISP] JMP DADDR.CS FF aa101bbb 23 or 4 24+EA [DISP] [DISP) JMP RW FF 11100reg 2 11 JNE/JNZ DISPS 75DISP 2 4 or 1S· 0 JNO DISPS 71DISP 2 4 or 16 00 JNP/JPO DISPS 6S DISP 2 4 or 1S· 0 JNS DISP8 79DISP 2 4 or 1s 00 JO DlSPS 70DISP 2 4 or 1s 00 JP/JPE DISPS 7A DISP 2 4 or 1s 00 JS DISPS 7S DISP 2 4 or 1s 00 LAHF 9F 1 4 0 LOS RW.DADDR C5 aadddbbb 2.3 or 4 16+EA [DISP] [DISP] LEA RW.DADDR SO aadddbbb 2.3 or 4 2+EA [DISP) [DISP) LES RW.DADDR C4 aadddbbb 2.3 or 4 4 or 16 00 [DISP] [DISP] LOCK FO 1 2 0 5-84 Table 5-5. 8086 and 8088 Instruction Mnemonics (Continued) Clock Instruction Object Code Bytes Periods LODS BS AC 1 12 LODS WS AD 1 12 LOOP DISP8 E2DISP 2 5 or 11** LOOPE/LOOPZ DISP8 E1DISP 2 6 or 18** LOOPNE/LOOPNZ DISP8 EO DISP 2 5 or 19** MOV AL.LABEL AO PPQQ 3 10 MOV AX. LABEL Al PPQQ 3 10 MOV DADDR.DAT A8 C6 aaOOObbb 3.4 or 5 10+EA [DISP] [DISP] YY MOV DADDR.DAT A 16 C7 aaOOObbb 4.5 or 6 10+EA [DISP] [DISP] YYYY MOV DADDR.RB 88 aasssbbb 2.3 or 4 9+EA [DISP] (DlSP] MOV DADDR.RW 89 aasssbbb 2.3 or 4 9+EA [DISP] [DISP] MOV DADDR.SR 8C aaOrrbbb 2.3 or 4 9+EA [DISP] [DISP] MOV LABEL.AL A2 PPQQ 3 10 MOV LABEL.AX A 3 PPQQ 3 10 MOV RB.DADDR 8A aadddbbb 2.3 or 4 8+EA [DISP] [DISP] MOV RB.DATA8 10110ddd YY 2 4* MOV RBD.RBS 8A lldddsss 2 2* MOV RW.DADDR 8B aadddbbb 2.3 or 4 8+EA [DISP] [DISP] MOV RW.DATA16 10111 ddd YYYY 3 4* MOV RW.SR 8C 110rrsss 2 * MOV RWD.RWS 8B 11dddsss 2 * MOV SR.DADDR 8E aaOrrbbb 2.3 or 4 8+EA [DISP] [DISP] MOV SR.RW 8E 11 Orrsss 2 * MOVS BD.BS A4 1 18 MOVS WD.WS A5 1 18 MUL (8-bit) AL.DADDR F6 aa100bbb 2.3 or 4 (76-831+EA [DISP] [DISP] MUL (16-bit) AX.DADDR F7 aa100bbb 2.3 or 4 (124-139)+EA [DISP] [DISP] MUL RBS F6 11100sss 2 70-71 MUL RWS F7 11100 2 118-133 NEG DADDR 1111 011 a aaO 11 bbb 2.3 or 4 16+EA [DISP] [DISP] NEG RB F5 11011ddd 2 3* NEG RW F711011ddd 2 3* NOP 90 1 3* NOT DADDR 1111 011 a aaO 1Obbb 2.3 or 4 16+EA [DISP] [DISP] NOT RB F611010sss 2 3* NOT RW F711010sss 2 3* OR AL.DATA8 OC YY 2 4· OR AX.DATA16 00 YYYY 3 4* OR DADDR.DAT A8 80 aaOOlbbb 3.4 or 5 17+EA [DISP] [DISP] YY OR DADDR,DAT A 16 81 aaOOlbbb 4.5 or 6 17+EA [DISP] [DISP] YYYY 5-85 Table 5-5. 8086 and 8088 Instruction Mnemonics (Continued) Object Code Bytes Clock Instruction Periods OR DADDR,RB OB aasssbbb 2,3 or 4 16+EA [DISP] [DISP] OR DADDR,RW 09 aasssbbb 2,3 or 4 16+EA OR RB,DADDR OA aadddbbb 2,3 or 4 9+EA [DISP] [DISP] OR RB,DATAB BO 11001ddd YY 3 4" OR RBD,RBS OA lldddsss 2 3" OR RW,DADDR OB aadddbbb 2,3 or 4 9+EA [DISP] [DISP] OR RW,DATA16 81 11001ddd YYYY 4 4" OR RWD,RWS OB lldddsss 2 3" OUT Al,[DX] EE 1 8 OUT Al,PORT E6 YY 2 10 OUT AX,[DX] EF 1 8 OUT AX,PORT E7 YY 2 10 POP DADDR 8F aaOOObbb 2,3 or 4 17+EA [DISP] [DISP] POP RW 01011ddd 1 B POP SR OOOrrlll 1 B POPF 9D 1 B PUSH DADDR FF aall0bbb 2,3 or 4 16+EA [DISP] [DISP] PUSH RW 01010sss 1 11 PUSH SR 000rrll0 1 10 PUSHF 9C 1 10 RCl DADDR,N 110100va aaOl Obbb 2,3 or 4 N=l 15+EA [DISP] [DISP] N> 4N+20+EA RCl RB,N 11 01 OOvO 1 101 Osss 2 N=l 2" N>14N+B RCl RW,N 11 01 OOv 1 1 10 1Osss 2 RCR DADDR,N 110100va aaOllbbb 2,3 or 4 N=l 15+EA [DISP] [DISP] N> 4N+20+EA RCR RB,N 11 01 OOvO 1 10 11 sss 2 N=l 2" N> 1 4N+B REP N 1111001z 1 +2 RET C3 1 8"" RET CS CB 1 12"" RET CS,DATA16 CA YYYY 3 lB"" RET DATA16 C2 YYYY 3 17"" ROL DADDR,N 1 101 OOva aaOOObbb 2,3 or 4 N=l 15+EA [DISP] [DISP] N>l 4N+20+EA ROl RB,N 110100vO 11000ddd 2 N=l 2" N>4N + B ROl RW,N 1 101 OOv 1 11000ddd 2 ROR DADDR,N 110100va aaOOlbbb 2,3 or 4 N=l 15+EA [DISP] [DISP] N>l 4N+20+EA ROR RB,N 1 101 OOvO 11 001 ddd 2 N=12" N>14N+B ROR RW,N 1 101 OOv 1 11001 ddd 2 SAHF 9E 1 4" SALISHL DADDR,N 110100va aal00bbb 2,3 or 4 N=l 15+EA [DISP] [DISP] N> 1 4N+20+EA SALISHL RB,N 1 101 OOvO 111 OOddd 2 N=l 2" N>14N+B SALlSHl RW,N 110100vl 11100ddd 2 5-86 Table 5-5. 8086 and 8088 Instruction Mnemonics (Continued) Clock Instruction Object Code Bytes Periods SAR DADDR,N 11 01 OOva aa 111 bbb 2,3 or 4 N=1 15+EA [DISP] [DISP] N>l 4N+20+EA SAR RS,N 11 0 1OOvO 11111 ddd 2 N=12" N> 1 4N+8 SAR RW,N 11 0 1OOv 1 111 11 ddd 2 SSS Al,DATAB 1C yy 2 4" SSS AX,DATA16 1D YYYY 3 4" SSS DADDR,DAT A8 80 aa011bbb 3,4 or 5 17+EA [DISP] [DISP] YY SSS DADDR,DATA16 1OOOOOa 1 aaO 11 bbb 3,4,5 or 6 17+EA [DISP] [DISP] YY[YY] SSB DADDR,RB 18 aasssbbb 2,3 or 4 16+EA [DISP] [DISP] SSB DADDR,RW 19 aasssbbb 2,3 or 4 16+EA [DISP] [DISP] SSB RB,DADDR 1A aadddbbb 2,3 or 4 9+EA [DISP] [DISP] SSB RB,DATA8 80 11 011 ddd YY 3 4" SBB RBD,RBS 1A 11dddsss 2 3" SSB RW,DADDR lS aadddbbb 2,3 or 4 9+EA [DISP] [DISP] SBB RW,DATA16 100000a111011ddd 3 or 4 4" YY[YY] SSB RWD,RWS 1S 11dddsss 2 3" SCAS BD AE 1 15 SCAS WD AF 1 15 SEG Prefix SR 001 rrl 01 1 +2 SHR DADDR,N 110100va aal 01 bbb 2,3 or 4 N=l 15+EA [DISP] [DISP] N> 1 4N+20+EA SHR RS,N 110100vO 11101 ddd 2 N=l 2" N>14N+B SHR RW,N 1 101 OOv 1 111 01 ddd 2 STC F9 1 2" STD FD 1 2" STI FS 1 2" STOS BD AA 1 11 STOS WD AB 1 11 SUB Al,DATAB 2C YY 2 4" SUB AX,DATA16 2D YYYY 3 4" SUB DADDR,DATA8 80 aal01bbb 3,4 or 5 17+EA [DISP] [DlSP] YY SUS DADDR,DATA16 100000a1 aa1 01 bbb 3,4,5 or 6 17+EA [DISP] [DISP] YY[YY] SUB DADDR,RB 28 aasssbbb 2,3 or 4 16+EA [DISP] [DISP] SUB DADDR,RW 29 aasssbbb 2,3 or 4 16+EA [DISP] [DISP] SUB RB,DADDR 2A aadddbbb 2,3 or 4 9+EA [DISP] [DISP] SUS RB,DATAS SO 111 01 ddd YY 3 4" SUB RBD,RBS 2A 11dddsss 2 3" SUB RW,DADDR 2B aadddbbb 2,3 or 4 9+EA [DISP] [DlSP] SUB RW,DATA16 100000alll101ddd 3 or 4 4" YY[YY] SUB RWD,RWS 2S 11dddsss 2 3" 5-87 Table 5-5. 8086 and 8088 Instruction Mnemonics (Continued) Clock Instruction Object Code Bytes Periods TEST AL,DATA8 A8 yy 2 4- TEST AX,DATA16 A9 YYYY 3 4- TEST DADDR,DATA8 F6 aaOOObbb 3,4 or 5 11+EA [DISP] [DISP] YY TEST DADDR,DAT A 16 F7 aaOOObbb 4,5 or 6 11 +EA [DISP] [DISP] YYYY TEST DADDR,RB 84 aaregbbb 2,3 or 4 9+EA [DISP] [DISP] TEST DADDR,RW 85 aaregbbb 2,3 or 4 9+EA [DISP] [DISP] TEST RB,DATA8 F6 1000reg YY 3 5* TEST RBD,RBS 84 11 regreg 2 3* TEST RW,DATA16 F7 11 OOOreg YYYY 4 5- TEST RWD,RWS 85 11 regreg 2 3* WAIT 9B 1 3+5n XCHG AX,RW 10010reg 1 3* XCHG RB,DADDR 86 aaregbbb 2,3 or 4 17+EA [DISP] [DISP] XCHG RB,RB 86 11 regreg 2 4* XCHG RW,DADDR 87 aaregbbb 2,3 or 4 17+EA [DISP] [DISP] XCHG RW,RW 87 11 regreg 2 4* XLAT 07 1 11 XOR AL,DATA8 34 YY 2 4* XOR AX,DATA16 36 YYYY 3 4* XOR DADDR,DATA8 80 aa010bbb 3,4 or 5 17+EA [DISP] [DISP] YY XOR DADDR,DATA 16 81 aa010bbb 4,5 or 6 17+EA [DISP] [DISP] YYYY XOR DADDR,RB 30 aasssbbb 2,3 or 4 16+EA [DISP] [DISP] XOR DADDR,RW 31 aasssbbb 2,3 or 4 16+EA [DISP] [DISP] XOR RB,DADDR 32 aadddbbb 2,3 or 4 9+EA [DISP] [DISP] XOR RB,DATA8 80 1111 Oddd YY 3 4- XOR RBD,RBS 32 11dddsss 2 3* XOR RW,DADDR 33 aadddbbb 2,3 or 4 16+EA [DISP] [DISP] XOR RW,DATA16 81 11110ddd YYYY 4 4* XOR RWD,RWS 33 11dddsss 2 3* 5-88 Table 5-6. 8086 and 8088 Instruction Object Codes Object Code Mnemonic Byte 1 Byte 2 Other Bytes 00 aasssbbb [DISP)[DISP] ADD RBD/DADDR.RBS 01 aasssbbb [DISP][DISP] ADD RWD/DADDR.RWS 02 aadddbbb [DISP][DISP] ADD RBD.DADDR/RBS 03 aadddbbb [DISP)[DISP] ADD RWD.DADDR/RWS 04 yy ADD AL.DATAS 05 yy yy ADD AX.DATA16 06 PUSH ES 07 POP ES OS aasssbbb [DISP][DISP] OR RBD/DADDR.RBS 09 aasssbbb [DISP)[DISP] OR RWD/DADDR.RWS OA aadddbbb [DISP)[DISP] OR RBD.DADDR/RBS OB aadddbbb [DISP][DISP] OR RWD.DADDR/RWS OC yy OR Al.DATAS OD yy yy OR AX.DATA16 OE PUSH CS OF Not used (POP CS) 10 aasssbbb [DISP)[DISP] ADC RBD/DADDR.RBS 11 aasssbbb [DISP][DISP] ADC RWD/DADDR.RWS 12 aadddbbb [DISP)[DISP] ADC RBD.DADDR/RBS 13 aadddbbb [DISP][DISP] ADC RWD.DADDR/RWS 14 yy ADC Al.DATAS 15 yy yy ADC AL.DATA16 16 PUSH SS 17 POP SS 1S aasssbbb [DISP)[DISP] SBB RBD/DADDR.RBS 19 aasssbbb [DISP)[DISP] SBB RWD/DADDR.RWS 1A aadddbbb [DISP)[DISP] SBB RBD.DADDR/RBS 1B aadddbbb [DISP)[DISPI SBB RWD.DADDR/RWS 1C yy SBB AL.DATAS 1D yy yy SBB AX.DATA16 1E PUSH DS 1F POP DS 20 aasssbbb [DISP)[DISP] AND RBD/DADDR.RBS 21 aasssbbb [DISP)[DISP] AND RWD/DADDR.RWS 22 aadddbbb [DISP)[DISP] AND RBD .DADDR/RBS 23 aadddbbb [DISP)[DISP] AND RWD.DADDR/RWS 24 yy AND AL.DATAS 25 yy yy AND AX.DATA16 26 SEG ES 27 DAA 2S aasssbbb [DISP][DISP] SUB RBD/DADDR.RBS 29 aasssbbb [DISP)[DISP] SUB RWD/DADDR.RWS 2A aadddbbb [DISP][DISP] SUB RBD.DADDR/RBS 2B aadddbbb [DISP)[DISP] SUB RWD.DADDR/RWS 2C yy SUB AL.DATAS 2D yy yy SUB AX.DATA16 2E SEG CS 2F DAS 30 aasssbbb [DISP][DISP] XOR RBD/DADDR.RBS 31 aasssbbb [DISP)[DISP] XOR RWD/DADDR.RWS 32 aadddbbb [DISP)[DISP] XOR RBD.DADDR/RBS 33 aadddbbb [DISP)[DISP] XOR RWD.DADDR/RWS 34 yy XOR Al.DATAS 35 yy yy XOR AX.DATA16 36 SEG SS 5-89 Table 5-6. 8086 and 8088 Instruction Object Codes (Continued) Object Code Mnemonic Byte 1 Byte 2 Other Bytes 37 AAA 38 aasssbbb [DISP)[DISP] CMP RBD/DADDR.RBS 39 aasssbbb [DISP][DISP] CMP RWD/DADDR.RWS 3A aadddbbb [DISP][DISP] CMP RBD.DADDR/RBS 3B aadddbtlb [DISP][DISP] CMP RWD.DADDR/RWS 3C yy CMP AL.DATA8 3D yy yy CMP AX.DATA16 3E SEG OS 3F AAS 40 INC AX 41 INC CX 42 INC OX 43 INC BX 44 INC SP 45 INC BP 46 INC SI 47 INC 01 48 DEC AX 49 DEC CX 4A DEC OX 4B DEC BX 4C DEC SP 40 DEC BP 4E DEC SI 4F DEC 01 50 PUSH AX 51 PUSH CX 52 PUSH OX 53 PUSH BX 54 PUSH SP 55 PUSH BP 56 PUSH SI 57 PUSH 01 58 POP AX 59 POP CX 5A POP OX 5B POP BX 5C POP SP 50 POP BP 5E POP SI 5F POP 01 60-6F Not used 70 DISP JO DISP8 71 DISP JNO DISP8 72 DISP JB or JNAE or JC DISP8 73 DISP JNB or JAE or JNC DISP8 74 DISP JE or JZ DISP8 75 DISP JNE or JNZ DISP8 76 DISP JBE or JNA DISP8 77 DISP JNBE or JA DISP8 78 DISP JS DISP8 79 DISP JNS DISP8 7A DISP JP or JPE DISP8 7B DISP JNP or JPO DISP8 7C DISP JL or JNGE DISP8 5-90 Table 5-6. 8086 and 8088 Instruction Object Codes (Continued) Object Code Mnemonic Byte 1 Byte 2 Other Bytes 70 DISP JLE or JGE DISP8 7E DISP JLE or JNG DISP8 7F DISP JNLE or JG DISP8 80 aaOOObbb [DISP][DISP] yy ADD RBD/DADDR,DA T A8 80 aa001bbb [DISP][DISP] YY OR RBD/DADDR,DAT A8 80 aa010bbb [DISP][DISP] yy ADC RBD/DADDR,DAT A8 80 aa011 bbb [DISP][DISP] YY SBB RBD/DADDR,DAT A8 80 aa100bbb [DISP][DISP] YY AND RBD/DADDR,DA T A8 80 aa101 bbb [DISP][DISP] YY SUB RBD/DADDR,DAT A8 80 aa110bbb [DISP][DISP] YY XOR RBD/DADDR,DAT A8 80 aa111bbb [DISP][DISP] YY CMP RBD/DADDR,DATA8 81 aaOOObbb [DISP][DISP] YYYY ADD RWD/DADDR,DATA 16 81 aa001bbb [DISP][DISP] YYYY OR RWD/DADDR,DATA 16 81 aa010bbb [DISP][DISP] YYYY ADC RWD/DADDR,DATA 16 81 aa011bbb [DISP][DISP] YYYY SBB RWD/DADDR,DATA 16 81 aa100bbb [DISP][DISP] YYYY AND RWD/DADDR,DATA 16 81 aa101bbb [DISP][DISP] YYYY SUB RWD/DADDR,DATA 16 81 aa110bbb [DISP][DISP] YYYY XOR RWD/DADDR,DATA 16 81 aa111 bbb [DISP][DISP] YYYY CMP RWD/DADDR,DATA 16 82 aaOOObbb [DISP][DISP] YY ADD RBD/DADDR,DAT A8 82 xxOO1xxx Not used 82 aa010bbb [DISP][DISP] YY ADC RBD/DADDR,DAT A8 82 aa011 bbb [DISP][DISP] YY SBB RBD/DADDR,DAT A8 82 xx100xxx Not used 82 aa101 bbb [DISP][DISP] YY SUB RBD/DADDR,DAT A8 82 xx110xxx Not used 82 aa111 bbb [DISP][DISP] YY CMP RBD/DADDR,DAT A8 83 aaOOObbb [DISP][DISP] YYYY ADD RWD/DADDR,DATA 16 83 xx001xxx Not used 83 aa010bbb [DISP][DISP] YYYY ADC RWD/DADDR,DATA 16 83 aa011bbb [DISP][DISP] YYYY SBB RWD/DADDR,DATA16 83 xx100xxx Not used 83 aa101bbb [DISP][DISP] YYYY SUB RWD/DADDR,DATA 16 83 xx110xxx Not used 83 aa111bbb [DISP][DISP] YYYY CMP RWD/DADDR,DATA 16 84 aasssbbb [DISP][DISP] TEST RBD/DADDR,RBS 85 aasssbbb [DISP][DISP] TEST RWD/DADDR,RWS 86 aadddbbb [DISP][DISP] XCHG RBD/DADDR,RBS 87 aadddbbb [DISP][DISP] XCHG RWD/DADDR,RWS 88 aasssbbb [DISP][DISP] MOV RBD/DADDR,RBS 89 aasssbbb [DISP][DISP] MOV RWD/DADDR,RWS 8A aadddbbb [DISP][DISP] MOV RBD,DADDR/RBS 8B aadddbbb [DISP][DISP] MOV RWD,DADDR/RWS 8C aaOrrbbb [DISP] [DISP] MOV RWD/DADDR,SR 8C xx1 xxxxx Not used 80 aadddbbb [DISP][DISP] LEA RWD,DADDR 8E aaOrrbbb [DISP][DISP] MOV SR,RWD/DADDR 8E xx1 xxxxx Not used 8F aaOOObbb [DISP][DISP] POP RWD/DADDR 8F xx001xxx Not used to 8F xx111xxx Not used 90 XCHG AX,AX (NOP) 91 XCHG AX,CX 92 XCHG AX,DX 93 XCHG AX,BX 94 XCHG AX,SP 5-91 Table 5-6. 8086 and 8088 Instruction Object Codes (Continued) Object Code Mnemonic Byte 1 Byte 2 Other Bytes 95 XCGH AX,BP 96 XCHG AX,SI 97 XCHG AX,DI 9S CBW 99 CWO 9A PP OOPPOO CALL BRANCH,SEGM 9B WAIT 9C PUSHF 90 POPF 9E SAHF 9F LAHF AO PP 00 MOV AL,LABEl A1 PP 00 MOV AX,LABEl A2 PP 00 MOV LABEL,AL A3 PP 00 MOV LABEL,AX A4 MOVS BD,BS A5 MOVS WD,WS A6 CMPS BD,BS A7 CMPS WD,WS AS yy TEST AL,DATAS A9 yy yy TEST AX,DATA16 AA STOS BD AB STOS WD AC LODS BS AD LODS WS AE SCAS BD AF SCAS WD BO yy MOV AL,DATAS B1 yy MOV CL,DATAS B2 yy MOV DL,DATAS B3 yy MOV BL,DATAS B4 yy MOV AH,DATAS B5 yy MOV CH,DATAS B6 yy MOV DH,DATAS B7 yy MOV BH,DATAS BS yy yy MOV AX,DATA16 B9 yy yy MOV CX,DATA16 BA yy yy MOV DX,DATA16 BB yy yy MOV BX,DATA16 BC yy yy MOV SP,DATA16 BD yy yy MOV BP,DATA16 BE yy yy MOV SI,DATA16 BF yy yy MOV DI,DATA16 CO-C1 Not used C2 yy yy RET CS,DATA16 C3 RET C4 aadddbbb [DISP][DISP] LES RWD,DADDR C5 aadddbbb [DISP][DISP] LEA RWD,DADDR C6 aaOOObbb [DISP][DISP] YY MOV DADDR,DAT A8 C6 xxOO1xxx Not used to C6 xx111xxx Not used C7 aaOOObbb [DISP][DISP] YYYY MOV DADDR,DAT A 1 6 C7 xx001xxx Not used to C7 xx111xxx Not used C8-C9 Not used 5-92 Table 5-6. 8086 and 8088 Instruction Object Codes (Continued) Object Code Mnemonic Byte 1 Byte 2 Other Bytes CA yy yy RET CS.DATA16 CB RET CC INT 3 CD yy INT V CE INTO CF IRET DO aaOOObbb [DISPJ[DISP) ROL RBD/DADDR.1 DO aa001bbb [DISP)[DISP) ROR RBD/DADDR.1 DO aa010bbb [DISPJ[DlSP) Ret RBD/DAODR.1 DO aa011bbb [DISP)[DISP) RCR RBD/DADDR, 1 DO aa100bbb [DISPJ[DISP) SAL or SHL RBD/DADDR.1 DO aa101bb1 [DISP)[DlSP) SHR RBD/DADDR.1 DO xx110xxx Not used DO aa111 bbb [DISPJ[DISP) SAR RBD/DADDR.1 D1 aaOOObbb [DISP) [DISP) ROL RWD/DADDR.1 D1 aa001bbb [DISP)[DlSP) ROR RWD/DADOR.1 D1 aa010bbb [DISP)[DISP) RCL RWD/DADDR.1 D1 aa011bbb [DISP)[DISP) RCR RWD/DADOR.1 D1 aa100bbb [DISP)[DISP) SAL or SHL RWD/DADOR,1 D1 aa101bbb [DISP)[DISP) SHR RWD/DADDR.1 D1 xx110xxx Not used D1 aa111bbb [DISP)[DISP) SAR RWD/DADDR.1 02 aaOOObbb [OISP)[OISP) ROL RBD/OAODR.N 02 aa001bbb [OISP)[DISP) ROR RBD/OADDR.N 02 aa010bbb [DISP)[DlSP) RCL RBD/DADDR.N 02 aa011bbb [DISP)[DISP) RCR RBD/OAODR,N 02 aa100bbb [DISP) [DISP) SAL or SHL RBD/DAODR,N 02 aa101bbb [DISP)[DISP) SHR RBD/DADDR,N 02 xx110xxx 02 aa111 bbb [OISP) [DISP) SAR RBD/DAODR,N D3 aaOOObbb [DISP)[DISP) ROL RWD/DADDR,N 03 aa001bbb [DISP)[DISP) ROR RWD/DADDR,N D3 aa010bbb [DISP)[DISP) RCL RWD/DADDR,N D3 aa011bbb [DISP)[DISP) RCR RWD/DADDR,N D3 aa100bbb [DISP)[DISP) SAL or SHL RWD/DADDR,N D3 aa1 01 bbb [DISP)[DISP) SHR RWD/DADOR.N 03 xx110xxx Not used D3 aa111bbb [DISP)[DISP) SAR RWD/DADDR.N 04 OA AAM D5 OA AAD 06 Not used D7 XLAT D8-DF aaxxxbbb [DISP)[DISP) ESC DADDR EO OISP LOOPNE or LOOPNZ DISP8 E1 DlSP LOOPE or LOOPZ DISP8 E2 DISP LOOP DISP8 E3 DISP JCXZ DISP8 E4 yy IN AL.PORT E5 yy IN AX,PORT E6 yy OUT AL,PORT E7 yy OUT AX,PORT E8 DISP DISP CALL BRANCH E9 DISP DISP JMP BRANCH EA PP QQ PPQQ JMP BRANCH,SEGM EB DISP JMP BRANCH 5-93 Table 5-6. 8086 and 8088 Instruction Object Codes (Continued) Object Code Mnemonic Byte 1 Byte 2 Other Bytes EC IN Al,DX ED IN AX,DX EE OUT Al,DX EF OUT AX,DX FO lOCK F1 Not used F2 REPNE or REPNZ F3 REP or REPE or REPZ F4 HlT F5 CMC F6 aaOOObbb [DISP][DISP] YY TEST RBD/DADDR,DAT A8 F6 xx001xxx Not used F6 aa010bbb [DISP][DISP] NOT RBD/DADDR F6 aa011 bbb [DISP][DISP] NEG RBD/DADDR F6 aa100bbb [DISP][DISP] MUl RBD/DADDR F6 aa1 01 bbb [DISP][DISP] IMUl RBD/DADDR F6 aa110bbb [DISP][DISP] DIV RBD/DADDR F6 aa111bbb [DISP][DISP] IDIV RBD/DADDR F7 aaOOObbb [DISP][DISP] YYYY TEST RWD/DADDR,DAT A 1 6 F7 xx001 xxx Not used F7 aa010bbb [DISP][DISP] NOT RWD/DADDR F7 aa011bbb [DISP][DISP] NEG RWD/DADDR F7 aa100bbb [DISP][DISP] MUl RWD/DADDR F7 aa101bbb [DISP][DISP] IMUl RWD/DADDR F7 aa110bbb [DISP][DISP] DIV RWD/DADDR F7 aa111 bbb [DISP][DISP] IDIV RWD/DADDR F8 ClC F9 STC FA Cli FB 511 FC CLD FD STD FE aaOOObbb [DISP][DISP] INC RBD/DADDR FE aa001bbb [DISP][DISP] DEC RBD/DADDR FE xx001 xxx Not used to FE xx111xxx Not used FF aaOOObbb [DISP][DISP] INC DADDR FF aa001bbb [DISP][DISP] DEC DADDR FF aa010bbb [DISP][DISP] CAll RW/DADDR FF aa011 bbb [DISP][DISP] CAll DADDR,CS FF aa100bbb [DISP][DISP] JMP RW/DADDR FF aa1 01 bbb [DISP][DISP] JMP DADDR,CS FF aa110bbb [DISP][DISP] PUSH DADDR FF xx111 xxx Not used 5-94 Table 5-7. 8080A to 8086 Instruction Mapping 8080A Equivalent 8086 8080A Equivalent 808~ Instruction Instructionls) Instruction I nstructi on Is) IN DEV IN PORT RC JNB next-inst OUT DEV OUT PORT RET RNC JB next-inst LDAX B· MOV SI,CX RET LODB RZ JNZ next-inst LDAX 0 MOV SI,DX RET LODB RNZ JZ next-inst STAX B MOV DI,CX RET STOB RM JNS next-inst STAX 0 MOV DI,DX RET STOB RP JS next-inst MOV REG,M MOV RB,DADDR RET MOV M,REG MOV DADDR,RB RPE JPO next-inst LOA ADDR MOV AL,LABEL RET STA AD DR MOV LABEL,AL RPO JPE next-inst LHLD AD DR MOV BX,DADDR RET SHLD ADDR MOV DADDR,BX ADI DATA ADD AL,DATAS ADD M ADD AL,DADDR ACI DATA ADC AL,DATAS ADC M ADC AL,DADDR SUI DATA SUB AL,DATAS SUB M SUB AL,DADDR SBI DATA SBB AL,DATAS SBB M SBB AL,DADDR ANI DATA AND AL,DATAS ANA M AND AL,DADDR XRI DATA XOR AL,DATAS XRA M XOR AL,DADDR ORI DATA OR AL,DATAS ORA M OR AL,DADDR CPI DATA CMP AL,DATAS CMP M CMP AL,DADDR INR M INC DADDR JC ADDR JB DISPS··· OCR M DEC DADDR JNC ADDR JNB DISPS JZ ADDR JZ DISPS LXI RP,DATA16 MOV RW,DATA16 JNZ ADDR JNZ DISPS JP AD DR JNS DISPS MVI M,DATA MOV DADDR,DAT AS JM ADDR JS DISPS MVI REG,DATA MOV RB,DATAS JPE ADDR JPE DISPS JMP AD DR JMP BRANCW· JPO ADDR JPO DISPS PCHL JMP BX MOV d,s MOV RBD,RBS CALL AD DR CALL BRANCH XCHG XCHG DX,BX CC ADDR JNB next-inst SPHL MOV SP,BX CALL BRANCH CNC AD DR JB next-inst ADD REG ADD AL,RBS CALL BRANCH ADC REG ADC AL,RBS CZ ADDR JNZ next-inst SUB REG SUB AL,RBS CALL BRANCH SSB REG SBB AL,RBS CNZ ADDR JZ next-inst ANA REG AND AL,RBS CALL BRANCH XRA REG XOR AL,RBS CP ADDR JS next-inst ORA REG OR AL,RBS CALL BRANCH CMP REG CMP AL,RBS CM ADDR JNS next-inst DAD RP LAHF CALL BRANCH ADD BX,RW CPE ADDR JPO next-inst RCR AL CALL BRANCH SAHF CPO ADDR JPE next-inst RCL AL CALL BRANCH or ADD BX,RW lunlike .DAD RET RET will affect AF,PF,SF, and ZF) 5-95 Table 5-7. 8080A to 8086 Instruction Mapping (Continued) 8080A Equivalent 8086 8080A Equivalent 8086 Instruction Instruction(s) Instruction Instruction(s) INR REG INC RB PUSH RP PUSH RW DCR REG DEC RB PUSH PSW LAHF CMA NOT AL PUSH AX DAA DAA POP RP POP RW RLC ROL AL POP PSW POP AX RRC ROR AL SAHF RAL RCL AL XTHL POP SI RAR RCR AL XCHG BX,SI INX RP LAHF PUSH SI SAHF EI STI or INC RW (unlike INX - will DI CLI affect AF, PF, SF, and ZF) RST N CALL S'N DCX RP LAHF DEC RW STC STC SAHF CMC CMC or DEC RW (unlike DCX - will affect AF, PF, SF, and ZF) NOP XCHG AX,AX HLT HLT 'SOSOA registers map into SOS6 registers as follows: 8080A 8086 8080A 8086 A AL L BL B CH BC CX C CL DE DX D DH HL BX E DL SP SP H BH PC IP "Addresses on SOS6 jumps and calls are adjusted tb be self-relative. "'Conditional jumps to a location out of the short self-relative range must be implemented by using a reversed-sense conditional jump around a normal jump to the location, e.g.: JC ADDR becomes JNB next-inst JMP BRANCH Refer to Table 4-4 for a complete description of SOSA mnemonics shown above. Refer to Table 20-4 for a complete description of SOS6 mnemonics shown above. 5-96 THE 8088 CPU The 8088 is an 8086 microprocessor with an 8-bit Data Bus. The two parts are otherwise identical. Therefore we will describe differences between the 8088 and the 8086 in the text which follows. If you are going to use the 8088. first read the description of the 8086 given at the beginning of this chapter. then note differences as described below. 8088 PROGRAMMABLE REGISTERS AND ADDRESSING MODES 8088 programmable registers and addressing modes are identical to the 8086 in every way. 8088 CPU PINS AND SIGNALS 8088 CPU pins and signals are illustrated in Figure 5-12. As compared to the 8086 pins and signals illustrated in Figure 5-3, only pin 34 differs. For the 8086. pin 34 outputs BHE. This signal discriminates between the high-order byte and the low-order byte on the 16-bit 8086 Data Bus. Since the 8088 has an 8-bit Data Bus. BHE and associated logic is irrelevant. The 8088 outputs maximum mode SSO status at pin 34. The 101M signal has opposite polarity for the 8088, as compared to the 8086. This makes the 8088 compatible with the 8086. Combining 101M, DT/R, and SSO, 8088 bus cycles can be decoded as follows: 10/M Dr/A" sso 0 0 0 Code segment access 0 0 1 Memory read 0 0 Memory write 0 1 No operations 0 0 Interrupt acknowledge 0 1 I/O read 0 I/O write Halt Since the 8088 has no BHE signal. nor need for any such signal. the discussion of external memory addressing and BHE given for the 8086 will not apply to the 8088. 5-97 GND A14 A13 ---- -.. 1 2 3 40 39 38 VCC --- A16/S3 A15 - .. -.. A18/S5 A12 4 37 A17/S4 -.. - A11 ..... ~ 5 36 A10 A9 -- -.....-.. 6 7 35 34 .. A19/S6 SSO A8 8 33 -- MN/MX AD7 AD6 AD5 --- - --.. --.. ~- 9 10 11 8088 CPU 32 31 30 -- .....-. lm/GTT: - RD F«l/GTO. HOLD HLDA AD4 AD3 --- --..- 12 13 29 28 -- LOCK. WR 52.IO/M AD2 AD1 -- -...-. 14 15 27 26 ---.. ~- Sl.DTlR ~.ImJ ---- ADO 16 25 OSO, ALE NMI 17 24 OS1, iN'fA INTR CLK .. 18 19 23 22 --- TEST READY - ~ GND 20 21 ..... RESET Pin Name Description Type ADO-AD7 Address/Data Bus Bidirectional. Tristate A8-A15 Address Bus Output. Tristate A 16/S3. A 17 /S4 Address/Segment Identifier Output. Tristate A18/S5 Address/Interrupt Enable Status Output. Tristate A19/S6 Address/Status Output. Tristate SSO Status Output Output. Tristate RD Read Control Output. Tristate READY Wait State Request Input TEST Wait for Test Control Input INTR Interrupt Request Input NMI Non-maskable Interrupt Request Input RESET System Reset Input CLK System Clock Input MN!MX = GND for a Maximum System Maximum { 'SO. ST. 52 Machine Cycle Status Output. Tristate System RO/GTO. RO/GT1 Local Bus Priority Control Bidirectional Signals OSO.OS1 Instruction Oueue Status Output LOCK Bus Hold Control Output. Tristate MN/MX = VCC for a Minimum System 101M" Memory or I/O Access Output. Tristate WR Write Control Output. Tristate Minimum ALE Address Latch Enable Output System DTIR Data Transmit/Receive Output. Tristate Signals DEN Data Enable Output. Tristate INTA Interrupt Acknowledge Output HOLD Hold Request Input HLDA Hold Acknowledge Output VCC.GND Power. Ground Figure 5-12. 8088 Pins and Signal Assignments 5-98 8088 TIMING AND INSTRUCTION EXECUTION The 8088 has a 4 byte instruction object code queue; the 8086. in contrast. has a 6 byte in- 8088 struction object code queue. The 8088 will start executing instruction fetch bus cycles to INSTRUCTION fill its 4 byte queue as soon as one or more queue bytes are empty. The 8086. in contrast. QUEUE will not start pre-fetching instruction object code bytes until two or more of its 6 queue bytes .....- - - - - -...... are empty. The description of bus cycles and queue logic given for the 8086 otherwise applies directly to the 8088. 8088 MEMORY AND I/O DEVICE ACCESS BUS CYCLES Bus cycle timing for the 8088 and the 8086 differ only at the multiplexed Data/Address Bus lines. Timing differences are confined to the eight Address Bus lines A8-A 15 and may be illustrated as follows: : T1 T2 I T3 I T4 : I 1 8~~:8A:~~~~; ~I; Add~s O~1 I elK- I I I I \ Dat:O~ \ ~ 1! 80: 8:D:~ : : 8088 AOO-AD7. 'Of: A~~s Om 3) . • Add,.ss 0"(: D.~ In ~ 1~ j j !E: CD ~ - Apart from the fact that the 8088 has no BHE signal, all timing for signals other than the Data/Address Bus is identical for the 8086 and the 8088. 5-99 THE 8088 HALT STATE When operating in minimum mode. the 8088 delays the ALE pulse by one clock period as compared to 8086 tim- ing. This may be illustrated as follows: T1 T2 T3 TH TH elK 101M sso OllA ALE HALT Halt state logic and timing is otherwise identical for the 8086 and the 8088. OTHER 8086 COMPATIBLE 8088 LOGIC 8086 and 8088 logic is absolutely identical for the following states and logic: • The Wait state • The Hold state • RQ/GT logic • Lock logic • Wait for test state • Processor escape • Device reset • Interrupt processing • Single stepping mode THE 8088 INSTRUCTION SET The 8086 and 8088 instruction sets, listed in Table 5-4, are identical with the exception of execution times. Since the 8088 has an 8-bit bus, two bus cycles will have to be executed wherever the 8086 would have executed a single bus cycle to fetch 16 bits of data. Table 5-5 provides execution times for the 8086 and the 8088. 5-100 THE INTEL 8284 CLOCK GENERATOR/DRIVER The 8284 Clock Generator/Driver is a standard component that will be present in every 8086 microcomputer system. In a mtiltimicroprocessor system. each 8086 microprocessor will have its own 8284 Clock Genera- tor/Driver. While one could conceivably have a single 8284 servicing more than one 8086 microprocessor, it will rarely make any economic sense to design a system in this fashion. Logic implemented on the 8284 Clock Generator/Driver corresponds generally to the block labeled clock logic in Figure 5-1. To be completely accurate, however. a small portion of the bus interface logic should also be illustrated as provided by the 8284 device. Figure 5-13 illustrates 8284 device internal logic. The 8284 is manufactured using bipolar technology. It is packaged as an 18-pin DIP. All signals are TTL-level compati- ble. 8284 CLOCK GENERATOR/DRIVER PINS AND SIGNALS 8284 device pins and signals are illustrated in Figure 5-14. Figure 5-20 illustrates the 8284 device in a single 8086 microprocessor configuration. Signals may be divided between timing and control logic. Clock frequency is controlled by a crystal connected across the X1 and X2 pins. Clock frequency must be exactly three times the required clock period. Since the standard 8086 clock period is 200 nanoseconds, a 15 MHz crystal fre- quency is required. If an overtone mode crystal is employed, then it must be supported by an external LC network connected to TANK to insure oscillation of the overtone frequency. This is standard clock logic practice; for the 8284 it is il- lustrated along with other normal connections in Figure 5-15. You have the option of connecting a crystal across Xl and X2 in order to generate a fundamental frequency, or you can inputthe fundamental frequency via EFI. The level of F/C determines whether an external crystal or a signal in- put will provide the fundamental frequency. If FIE is high, then the fundamental frequency is taken from the EFI in- put. If Fie is low, then the crystal connected across Xl and X2 provides the fundamental frequency. Three clock outputs are generated: 1) ClK is an MOS level signal designed to meet the requirements of the 8086. 2) PClK Is a TTL level clock signal. output for support circuits. PClK runs at half the frequency of ClK. 3) OSC is an oscillator output running at the crystal or EFI input frequency. These timing signals may be illustrated as follows: 2 3 4 5 6 7 8 9 10 etc. EFlor Crystal OSC ClK PClK 5-101 RES 0 Q RESET .ff CK X1 XTAl X2 OSCILLATOR OSC TANK ClK +3 +2 Fie SYNC SYNC PClK EFI CSYNC RDY1 READY AEN1 SYNC READY lOGIC AEN2 RDY2 Figure 5-13. Logic of the 8284 Clock Generator and Driver 5-102 CSYNC PCLK -- -- - . 1 2 18 17 ---- VCC (+5 V) X1 AEN1 RDY1 .. 3 4 16 15 --- X2 TANK READY - - 5 8284 14 -- -- EFI RDY2 .. 6 13 Fie -- - AEN2 7 12 OSC ClK GND 8 9 11 10 -- .. RES RESET Pin Name Description Type RESET Control Signal Output to 8086 Output RES Reset Logic Input Input RDY1.RDY2 Wait State Ready Inputs Input AEN1. AEN2 Address Enable Qualifiers for RDY1 and RDY2 Input READY Control Signal Output to 8086 Output X1. X2 External Crystal Connections Input TANK Overtone Crystal Tank Circuit Connection Input EFI Alternate Clock Input Input Fie Clock Source Select Input ClK MOS level Clock Signal to 8086 Output PClK TTL Clock for Peripherals Output OSC Crystal Oscillator Output Output CSYNC Clock Synchronizer Input VCC.GND Power. Ground Figure 5-14. 8284 Clock Generator and Driver Pins and Signal Assignments 5-103 XTAl ..dl§ Cx Xl X2 RDYl asc asc R~DYand READY ~nable { AENl ClK ClK Inputs RDY2 PClK PClK AEN2 READY READY RESET RESET 8284 ...-_..-------tRES RESET) I CR _ _---tF/C ..,:_:_IY_NC...-_--.. r --, Tank circuit used with overtone I I crystals only. I I I CT I I I I I I I L.. --J Notes: 1. Cx should be 3 to 10 pF 2. Cc (when used) should be 1 to 10 nF 3. CR and RR determine Reset time constant 1 4. CT and l T determine tank frequency: fo = ---V-==lT=C·T=- Figure 5-15. Normal 8284 Clock Generator Circuit 5-104 In multi-CPU configurations you will probably need to synchronize all 8086 clock signals. SYNCHRONIZING You use the CSYNC signal for this purpose. When CSYNC is input high. logic internal to the MULTI-8086 8284 Clock Generator/Driver is stopped. When CSYNC subsequently goes low. clock outputs CLOCK restart. If the same CSYNC signal is input to a number of 8284 devices that receive the same SIGNALS EFI input, then all microprocessors in a multi-CPU configuration will be exactly synchronized. Appropriate logic is illustrated in Figure 5-16. Note that you cannot use individual crystals for 8284 Clock Generator/Drivers that are supposed to be synchronized with each; minor variations in crystal frequency. which must occur. will quickly distort clock Signal synchronization. You can use a crystal to generate the fundamental frequency for one 8284 Clock Generator/Driver. then use the OSC output of this Clock Generator/Driver as the EFI input to other 8284 Clock Generator/Drivers. The 8086 requires its RESET input to be synchronized with clock logic. The 8284 will 18086 receive an asynchronous Reset input at RES and will generate synchronized RESET output, RESET which the 8086 requires. Appropriate logic is illustrated in Figure 5-15. Timing is illustrated in ''__ _ _ _ ___ the data sheets at the end of the chapter. The 8284 RES input need not make a sharp transition. The 8284 inputs RES to a Schmit trigger that generates the RESET output. RES can make a slow low-to-high transition. We have described earlier in this chapter how external logic can extend a bus cycle by inserting 8284 Waitclock periods between T3 and T4. Figure 5-9 illustrates the READY input that controls Wait WAIT STATE states within the 8086 bus controller. As illustrated in Figure 5-9. the 8086 READY input must be LOGIC synchronized with the clock signal. The 8284 Clock Generator/Driver outputs an appropriately. - - - - - - - synchronized READY signal to the 8086. The 8284 creates its READY output from one of two inputs: RDY1 or RDY2. The 8284 has two READY inputs to support MULTIBUS configurations. A single 8086 may connect to two sepa- rate System Busses. Memory or I/O devices attached to either bus may wish to create a Wait state within a bus cycle. Each System Bus may therefore have its own READY line. In order to arbitrate bus priorities. RDY1 and RDY2 have companion enable signals AEN1 and AEN2. respectively. The 8284 will respond to RDY1 only when AEN1 is low. Similarly. the 8284 will respond to RDY2 only when AEN2 is low. AEN1 and AEN2 are general bus priority signals you must generate through your own bus priority arbitration logic. We will describe these two Signals. and methods of generating them. later in this chapter. 5-105 1~tL T Master Synchronizer - D 7474 Q ..- 0 7474 Q -- Xl CSYNC X2 ~ CLK ~ CLK 8284 .- OSC ....... r CSYNC Input to other 8284 devices r EFI input to other 8284 devices Figure 5-16. Clock Synchronization Logic in a Multi-CPU 8086 Configuration 5-106 THE INTEL 8288 BUS CONTROLLER In configurations where the MN/MX signal is low, you must use an 8288 Bus Controller in order to decode the SO, ST, and S2 status lines, and thus create System Bus control signals. You can also use the 8288 Bus Con- troller in order to connect more than one processor to a single System Bus, or in order to create more than one System Bus for a single 8086. Although the primary purpose of the 8288 Bus Controller is to decode the three status signals SO, S1, and S2, a simple 1-of-8 decoder could accomplish this limited task. The 8288 has these additional capabilities: 1) The 8288 can generate control signals for a System Bus or an liD device only bus. 2) You can float a System Bus's control signals to enable direct memory access, or to arbitrate bus priorities. 3) The two Write control lines have alternate advanced outputs designed for slow memories or liD devices. 4) You can suppress control signals as a means of implementing memory protect logic in multi-bus or multimicroprocessor configurations. 5) The 8288 generates control signals needed by line drivers. 6) The 8288 generates control signals needed by simple or complex interrupt logic. The 8288 Bus Controller is manufactured using bipolar technology. It is packaged as a 20-pin DIP. All signals are TTL- level compatible. 8288 BUS CONTROLLER SIGNALS AND PIN ASSIGNMENTS Figure 5-17 illustrates 8288 Bus Controller signals and pin assignments. Figure 5-21 illustrates an 8288 within an 8086 microcomputer system. Control signals are generated from SO, S1, and S2 as follows: 80 81 82 8086 8288 Control Output 0 0 0 Interrupt acknowledge INTA and MCE 0 0 1 I/O read 10RC 0 1 0 I/O write 10WC, AIOWC 0 1 1 Halt None 1 0 0 Instruction fetch MRDC 1 0 1 Memory read MRDC 1 1 0 Memory write MWTC,AMWC 1 1 1 No operation None 5-107 lOB ClK 51 --- ... ... 1 2 3 20 19 18 -- - ... VCC (+5 V) SO ~ --- .. ~ DT/R 4 8288 17 MCE/PDEN ALE 5 Bus 16 DEN ... - -..- AEN 6 Controller 15 CEN MROC" -- 7 14 INTA lJI.Wr: - 8 13 mAC MWTC GND - 9 10 12 11 AIOWC mwc Pin Name Description Type "SO.'ST.~ Bus Cycle State Signals Input ClK TTL Clock Signal Input A£F1 Bus Priority Control/Enable Input CEN Command Enable Input lOB Mode Control Input JXRU"C" Memory Read Strobe Output. Tristate ~ Memory Write Strobe Output. Tristate 1JAWC Early Memory Write Strobe Output. Tristate mAC I/O Read Strobe Output. Tristate mwc I/O Write Strobe Output, Tristate AiOWC Early I/O Write Strobe Output, Tristate TFJ"fA Interrupt Acknowledge Output, Tristate MCE/PDEN Cascade/Peripheral Data Enable Output ALE Address latch Enable Output DT/R Data Direction Control Output DEN Data Buffer Enable Output VCC,GND Power, Ground Figure 5-17. 8288 Bus Controller Pins and Signal Assignments 5-108 8288 and 8086 control signal timing is essentially the same. For details. see the data sheets given at the end of this chapter. If you look again at the Read and Write bus cycle timing descriptions given earlier in this chapter 8288 for the 8086 you will see that Read control signals pulse low approximately one clock period ADVANCED earlier than Write control signals. The 8288 creates two alternate Write control signals whose WRITE timing is the same as the Read control signals. These alternative Write control signals are re- CONTROL ferred to as advanced Write control signals. because they go low one clock pulse in advance of the SIGNALS standard Write control signals. We can thus summarize 8288 System Bus control signals as follows: MRDC is the memory read control. MWTC is the memory write control. AMWC is a memory write control whose timing conforms to MRDC. INTA is a memory read control signal that is output during the two interrupt acknowledge bus cycles. 10RC is an I/O device read control signal. 10WC is an I/O device write control signal. AIOWC is an alternative I/O device write control signal with timing that conforms to 10RC. Devices connected to a bus are likely to use 10WC and MWTC or AIOWC and AMWC. but not all four signals. That is. you will use either the normal write control signals or you will use the advanced write control signals. All 8288 control signals are tristate. They can be disabled and thus disconnected from the System Bus. You have two control options that modify the control signal logic of the 8288 Bus Controller. Using the lOB pin, you can operate the 8288 device in I/O bus mode or in System Bus mode. Using the CEN pin, you can suppress control signals. Let us examine each of these capabilities in turn. When the lOB pin receives a high input. the 8288 Bus Controller generates an I/O bus. lOB high 8288 I/O floats MflDC. MWTC. and 7f.MWC all of the time but outputs INTA. 10RC. 10WC. and AIOWC. In BUS MODE I/O bus mode. these four I/O control signals cannot be floated. Since the four I/O control lines will always be active. it is assumed that the I/O bus generated by an 8288 is a logic bus. You cannot share this local I/O bus with another microprocessor. The 8288 I/O bus has two control signals. PDEN and DTIR. which drive I/O ports and line drivers. DTIA. which we have described for the 8086. is used to control a bidirectional bus driver. When high. DT/R puts the bus driver in output mode. while when low. DTIff puts the bus driver in input mode. PDEN pulses low as a data enable signal. PDEN is equivalent to DEN. the standard bus data enable signal output by the 8086. When lOB is low. a normal System Bus is generated. All seven control signals are active: however. AEN is a bus enable control (much as the BUSEN input is used by the 8228 Bus Controller in an 8080A system). AEN is inactive when lOB is high and an I/O bus is being generated. AEN is active only when lOB is low and a System Bus is generated. When lOB is low and AEN is high. all contro~nals are floated. When lOB is low and AEN is low. control signals are connected to the System Bus. You will use AEN to implement bus priority arbitration logic. or direct memory access logic. as described later in this chapter. CEN is used to disable, but not float, control signals. CEN can be used when an 8288 is 8288 BUS generating a System Bus or an I/O bus. CEN will normally be high. When CEN is low, control CONTROLLER signals are inactive. CEN does not float signals; it just disables the logic that might other- MEMORY wise have made a control signal pulse low. PROTECT Table 5-8 summarizes the effect of lOB and CEN on control signals generated by the 8288 Bus Controller. 5-109 Table 5-8. Effect of lOB. CEN. and AEN on Control Signals Output by the 8288 Bus Controller Control Unit Effect on Control Output i"NTA. iOR'C. iOWC. AffiWc MiffiC. MWTC. AMWC lOB CEN AEN Mode Floated? Active? Mode Floated? Active? 0 0 0 System Floated Active System Floated Active 0 0 1 System Floated Inactive System Floated Inactive 0 1 0 System Connected Active System Connected Active 0 1 1 System Connected Inactive System Connected Inactive 1 0 0 1/0 Floated Active Not Used Floated Inactive 1 0 1 1/0 Floated Active Not Used Floated Inactive 1 1 0 1/0 Connected Active Not Used Floated Inactive 1 1 1 1/0 Connected Active Not Used Floated Inactive The CEN control enables memory mapping. Here are some possibilities: 1) In multi-bus configurations. one block of memory addresses may access memory on two or more busses. In order to avoid contentions, you can use the CEN signal to selectively disable busses so that only one bus will actually res- pond when the 8086 accesses duplicated memory addresses. 2) Privileged memory is frequently present in large microcomputer systems. Privileged memory is likely to become more common in microcomputer systems as they grow larger. Privileged memory is memory that can be accessed only under special circumstances. Frequently, system programs are run out of privileged memory, while applica- tion programs are run out of non-privileged memory. This prevents errors in application programs from destroying system programs; it also prevents unauthorized access of reserved memory spaces. DTIR and DEN, the two standard buffer control signals, are generated by the 8288 when it is creating a normal System Bus. These two control signals. when generated by the 8288 Bus Controller. are identical in form and purpose to the signals that the 8086 creates. DT/R determines the data direction for bidirectional buffers, while DEN is a latch- ing strobe. The 8288 generates two interrupt control signals: INTA and MCE. INTA is active on a 8288 BUS System Bus or an I/O Bus. MCE shares a pin with PDEN and is active only on a System Bus. CONTROLLER As we discussed earlier in this chapter. the 8086 executes two bus cycles when acknowledging INTERRUPT an interrupt. During each bus cycle. INTA is output as a low read pulse. On the second low INTA SIGNALS pulse. the acknowledged device must return an 8-bit code. which the 8086 uses as an interrupt vector. The INT A control signal generated by the 8288 Bus Controller is identical to the 8086 INT A control signal and serves the same purpose. on a System Bus or an I/O Bus. The MCE control signal has been added for use in large 8086 microcomputer systems that use a variation of the 8259A Priority Interrupt Control Unit. When you have a master 8259A Priority Interrupt Control Unit and slave 8259A Priority Interrupt Control Units. you will use MCE as a control to the master. while INT A becomes a control to slaves. The 8086 version of the 8259A Priority Interrupt Control Unit is not described in this chapter. 5-110 THE 8282/8283 8-BIT INPUT/OUTPUT LATCH These are simple unidirectional 8-bit latch buffers. The 8283 inverts inputs in order to create outputs; the 8282 does not. That is the only difference between these two devices. Both devices have three-state outputs. When a device is not selected, its outputs are floated. These devices are manufactured using bipolar technology. All signals are TTL-level compatible. Outputs have a high drive capability. as defined in the data sheets at the end of this chapter. The devices are packaged as 20-pin DIPs. THE 8282/8283 INPUT/OUTPUT LATCH PINS AND SIGNAL ASSIGNMENTS Figure 5-18 illustrates the pins and signal assignments for the 8282 and 8283 8-bit input/output latches. Data must be input at 010-017. When STS is high. the internal latches appear transparent and data on the output pins track data on the input pins. The transition from high to low of STS latches the data. The outputs remain stable while STS is low. Data that is latched internally is output when OE is low. The 8282 outputs data unaltered. while the 8283 inverts the data. Were you to simply ground DE and tie STS to +5 V. the 8282 or 8283 I/O ports will function as simple bus drivers. The outputs will continuously track the inputs. but will support heavier signal loads. If you tie STS high. but use the low DE pulse. then input data is constantly available but outputs only become valid while DE is low. Timing may be illustrated as follows: DIO-DI7 5-111 010 -:-. 1 20 - Vee (+5 VI ..... 000 011 012 -- 2 3 19 18 - 003 001 013 014 -.. 4 5 8282 or 17 16 002 -.. 004 ~- 015 016 ---- 6 7 8283 15 14 :. - 005 --- 006 -- 017 8 13 or 9 12 007 GNO 10 11 - STB 'in Name Description Type 010-017 Data Input Input 000-007 Data Output Output. Tristate ~ Output Enable Input STB Input Data Strobe Input Vee· GNO Power. Ground Figure 5-18. 8282 and 8283 Input/Output Latch Pins and Signal Assignments When the Strobe and Output Enable signal are both active. I/O port logic may be illustrated as follows: DtO-Dt7 STB Latches A B e A 5-112 AO --- :.- ~ 1 20 -- -- A1 -- - 2 19 --- - Vee BO - - A2 3 18 B1 A3 - - 4 8286 17 --- ---- B2 --- --- A4 5 16 B3 ---- - or .~ A5 6 8287 15 B4 - -- -- --.. A6 7 14 B5 A7 8 13 B6 OE 9 12 B7 GND 10 11 -- T Pin Name Description Type AO-A7 Local Bus Bidirectional, Tristate BO-B7 System Bus Bidirectional, Tristate OE Output Enable Input T Direction Select Input Vee,GND Power, Ground Figure 5-19. 8286 and 8287 Bidirectional Bus Transceiver Pins and Signal Assignments THE 8286/8287 8-BIT BIDIRECTIONAL BUS TRANSCEIVERS These two devices are used to buffer bidirectional lines on a System Bus. The 8286 transmits data unaltered, while the 8287 inverts the data. The two devices are otherwise the same. The 8286 and 8287 bidirectional bus drivers are manufactured using bipolar technology. All pins are TTL-level com- patible. The devices are packaged as 20-pin DIPs. 8286 AND 8287 BIDIRECTIONAL BUS TRANSCEIVER PINS AND SIGNAL ASSIGNMENTS Figure 5-19 illustrates pins and signal assignments for the 8286 and 8287 bidirectional bus drivers. AO-A7 constitute eight parallel data lines that connect with the microprocessor Data/Address Bus. BO-B7 con- stitute eight equivalent lines that connect with the System Bus. System Bus outputs have a higher line drive capability (as defined in the data sheets at the end of this chapter); otherwise. there is no difference between the two busses. When the T input is low, data arriving at the B pins is output via the A pins. When T is high, data arriving at the A pins are output via the B pins. The actual data transfer occurs only while OE is low. When used as an 8086 Data Bus transceiver. T should be connected to DTfR and OE connected to DEN. 5-113 SOME 8086 MICROPROCESSOR BUS CONFIGURATIONS We are now going to look at some 8086 microprocessor bus configurations. The flexibility of the 8086 gives rise to such a bewildering array of system configuration possibilities that a whole book could be written on the subject. We are going to fulfill the more limited objective of identifying possibilities. Figure 5-20 illustrates the simplest case. Here we are using the 8086 to generate a simple microcomputer system. Addresses taken off the bidirectional 8086 Data/Address Bus are unidirectional. We therefore use 8282 I/O ports to latch addresses of the 8086 Data/Address Bus.·ln Figure 5-20 we show just two 8282 I/O ports generating a 16-line Address Bus. Address lines A 16 through A 19 are wasted. By adding one' more 8282 I/O port to the logic in Figure 5-37, you could include the four missing Address Bus lines. In Figure 5-20, we ground the Output Enable inputs of the 8282 I/O ports; the Address Bus will therefore never be floated. We use the 8086 ALE pulse to strobe addresses into the 8282 I/O ports. Since the Data Bus is bidirectional. we use 8286 bidirectional Bus Transceivers in order to create a separate Data Bus from the 8086 Address/Data Bus. Two 8286 bidirectional Bus Transceivers are required to create the 16-line Data Bus. We can use the DT!R and DEN outputs of the 8086 as the 8286 T and CS inputs. We can now illustrate timing for creation of the Address Bus and Data Bus during a read bus cycle, as follows: T1 T2 T3 T4 eLK AOO-AO 15--4-.....,1---1 M~--""+--(= 8282 01 ' - -_ _.....~-....J and 8286A) ~------" ALE M/iO OT/R (= 8286 T) (= AOO- 8282 0 1 - - - - 4 Address Out ....------,0.-015) ~--4_--...., 828200 Address Out AO-A15 8286 B Oata In 00-015 (= AOO- 8286A-------------~~~_ _ _D_a_ta_l_n_ _ _~----------AD15) 5-114 M/TO INTA ~ ADO ~ - +DE RD WR - \ AO r AD7 A7 8282 DE A8 ALE ST~ A15 t.: 8282 SHE V ~DO J\ DO \ 8086 KAD7 / 07 ~T/R TV 8286 .--l... - DB Vee MN/MX DEN DE DE --+ 015 AAD8 ~ 8286 V 1\ AD15 / 'I y >- 0 f- :.£ UJ --l AEN1 -L< ~ 2S. r~ ES X1 X2 =-:-= Figure 5-20. Generating a System Bus for a Simple 8086 Configuration The simple system illustrated in Figure 5-20 will not make use of the dual READY clock logic. A single READY input is connected to RDY 1, and both of the READY enables are grou nded. Thus, the 8086 READY input will be created directly from the 8284 RDY1 input. Figure 5-21 illustrates a slightly more complex 8086 microcomputer configuration. Figure 5-21 uses an 8288 Bus Controller to generate System Bus control signals. The DEN, DTlA, and ALE control outputs, which in Figure 5-20 were generated by the 8086 microprocessor, are now generated by the 8288 Bus Controller. As a stand-alone microcomputer configuration, Figure 5-21 offers little or no a,dvantage over Figure 5-20. In a Single bus, single 8086 microcomputer configuration, there is no compelling reason to use the 8288 Bus Controller. All it does is add an extra component to the system without offering any significant ,logic enhancement. 5-115 so S1 52 8288 lOB GND DEN DT/R & c ~ elK ADO AO - AD7 A7 ~STB • 8282 llE A8 ~ STB A15 8282 AD8 SHE AD15. J3HE .ADO ADO = DO 8086 -"'D7 AD7 D7 8286 ~ T D8 J* GND MN/MX AD8 OE ~ AD~ 8286 D15 AD15 IA015 >- Cl I- W ::.! ....J ~:,~~~ rTAVAl- RDY (8284 Input} SEE NOTE 5 I ''f. ' ""\' Vt - :...11'-::1- !--TClR1X fR'::'C::-I - \ II ~-----t-" ] 1,---+",,\ 1 -TCHRYX TRYHCH~I I - 1\ -TClAZ TDVCl-- '-TCLDX~1 1 ~ ,;' ' - r:{ """- - \I A07-ADo I\. AD AD ' DATA IN FLOAT I'-- -TRHAV---l "J--I" /' RO READ CYCLE (NOTE I} ('NIl. INn c VOH} .=L r-""",, TRlRH f---..;,", TCHCTV OT/R ' '\ '--------------r--+---~--- __ r--~-J ""'''- {/ ""'''- )Qlr-+L--_____ Figure 11: 8088 Bus'Tlmlng - Minimum Mode System 5-D12 8088 ClK (828~ Output) [.0,-." --+--+------ WRITE ~~~~~ I DE .. ViR -+----1-----.----1-.. 1---11--- ~ __~--------------~-JI AD7-ADo DT/R INTA CYCLE NOTES 1.3 (RD. W1i - VOH) SOFTWARE HALT - DEN.iiD,Wii.INTA = VOH AD7-ADo INVALID ADDRESS SOFTWARE HALT TClAV NOTES: I. All SIGNALS SWITCH BETWEEN VOH AND VOl UNLESS OTHERWISE SPECIFIED. 2. RDY IS SAMPLED NEAR THE END OF T2. T3. Tw TO DETERMINE IF Tw MACHINES STATES ARE TO BE INSERTED. 3. TWO INTA CYCLES RUN BACK·TO-BACK. THE 11088 LOCAL ADDAIDATA BUS IS FLOATING DURING BOTH INTA CYCLES. CONTROL SIGNALS ARE SHOWN FOR THE SECOND INTA CYCLE. ~. SIGNALS AT 8214 ARE SHOWN FOR REFERENCE ONLY. 5. All TIMING MEASUREMENTS ARE MADE AT I.SV UNLESS OTHERWISE NOTED. Figure 12. 8088 Bus Timing - Minimum Mode System (cont.) 5-D13 8088 8088 MAX MODE SYSTEM (USING 8288 BUS CONTROLLER) TIMING REQUIREMENTS Symbol P.r. meter Min. Max. Unlls Te.t Conditions TCLCL CLK Cycle Period 200 500 ns TCLCH CLK Low Time ('hTCLCL)-15 ns TCHCL CLK High Time ('IJTCLCL) + 2 ns TCH1CH2 CLK Rise Time 10 ns From 1.0V to 3.5V -- ----_. - - - - - - - - - TCL2CLI CLK Fall Time 10 ns From 35V to 1.0V -- TOVCL Data In Setup Time 30 ns TCLDX Data In Hold Time 10 ns TR1VCL ROY Setup Time into 8284 (See Notes 1. 2) 35 ns TCLRIX ROY Hold Time into 8284 (See Notes 1,2) 0 ns TRYHCH READY Setup Time InlO 8088 (,hTCLCL)-15 ns TCHRYX READY Hold Time IOto 8088 30 ns TRYLCL READY Inactive to CLK (See Note 4) -8 ns TlNVCH Setup Time lor Recognition (INTR. NMI. TESn (See Note 2) 30 ns TGVCH RQ/GT Setup Time 30 ns -- f - - - TCHGX RQ Hold Time into 8086 40 ns TIMING RESPONSES Symbol P.r.meter Min. MIX. Unll. Tilt Conditions TCLML Command Active Delay (See Note 1) 10 35 ns TCLMH Command Inactive Delay (See Note 1) 10 35 ns TRYHSH READY Active to Status Passive (See Note 3) 110 ns TCHSV Status Active Delay 10 110 ns TCLSH Status Inactive Delay 10 130 ns Adaress Valid Delay 15 110 ns -- TCLAV TCLAX Address Hold Time 10 ns TCLAZ Address Float Delay TCLAX 80 ns TSVLH Status Valid to ALE High (See Note 1) 15 ns TSVMCH Status Valid to MCE High (See Note 1) 15 ns CLK Low to ALE Valid (See Note 1) -- TCLLH 15 ns CLK Low to MCE High (See Note 1) -- TCLMCH 15 ns - - ------ TCHLL ALE Inactive Delay (See Note 1) 15 ns CL = 2().100 pF lor -- ali 8088 Outputs TCLMCL MCE Inactive Delay (See Note 1) 15 ns Data Valid Delay 15 110 ns -- in addition to TCLDV internal loads TCHDX Data Hold Time 10 ns TCVNV Control Active Delay (See Note 1) 5 45 ns TCVNX Control Inactive Delay (See Note 1) 10 45 ns -- TAZRL Address Float to Read Active 0 ns -- TCLRL RD Active Delay 10 165 ns - - - - - -1 - - - - - TCLRH RD Inactive Delay 10 150 ns ---- TRHAV RD Inactive to Next Address Active TCLCL-45 ns .. _._----- TCHDTL Direction Control Active Delay (See Note 1) 50 ns --f-----.- i TCHDTH Direction Control Inactive Delay (See Note 1) 30 ns --- - - - - - - TCLGL GT Active Delay 110 ns -- f--- - - - . - - - - - - - - - - - 1 - - - - - - - - TCLGH GT Inactive Delay 85 ns -- - - . - - - - - - - - - ----_._._--- ---.- - TRLRH RD Width 2TCLCL-75 ns NOTES: 1. Signal at 8284 or 8288 shown lor relerence only. 2. Setup requirement lor asynchronous signal only to guarantee recognition at next CLK. 3. A~lies only to T3 and wait states. 4. Applies only to T2 state (8 ns into T3 state). 5-014 8088 T, T, ClK VCl OSo.OS, S"S"So (EXCEPT HAL T) SEE NO!F 5 I ALE (8288 OUTPUT) tROY (8284 INPUT) I READY (8088 INPUT) I READ CYCLE TClAV--i RD I TCHDTL -I DTiA TClMH __ I 8288 OUTPUTS SEE NOTES 5,8 It MRDC OR IOhc DEN TCVNX- I Figure 13.8088 Bus Timing - Maximum Mode System (Using 8288) 5-D15 8088 C1.K Ii. s,. iii (EXCEPT HALTJ WAITE CYCLE AO,-AOO DEN .2811 OUIPUI'S SEE NOTES 5,8 AiiWC 011 AiOWC INTA CYCLE A,.-Aa (SEE NOTES 3.4) FLOAT AO,·AOo TSVMCH r-- I MCEI PlmI TCLMCH- DT/Ii 82. OUIPUI'S SEE NOTES 5.6 \ INTA DEN TCVNX- :W-~::N _ vOL;RI).~.IOJIe.iIW'fe.AM\vC.~.AroWC.iffn.. =VOH AD, - ADo. A" - Aa INVALID ADDRESS TCLAV ~ /------~\------- \1...._ _ _ _ _.....J. \. _ _ _ _ _ _ s..s..~ NOTES: 1. ALL SIGNALS SWITCH BETWEEN VO H AND VOL UNLESS OTHERWISE SPECIFIED 2. ROY IS SAMPLED NEAR THE END OF T2. T,. Tw TO DETERMINE IF Tw MACHINES STATES ARE TO BE INSERTED. 3. CASCADE ADDRESS IS VALID BETWEEN FIRST AND SECOND INTA CYCLES 4. TWO INTA CYCLES RUN BACK·TO·BACK. THE 808a LOCAL ADORIDATA BUS IS flOATING DURING BOTIi INTA CYCLES. CONTROL FOR POINTER ADDRESS IS SHOWN FOR SECOND INTA CYCLE. 5. SIGNALS AT 828< OR 8288 ARE SHOWN FOR REFERENCE ONLY . •. TliE ISSUANCE OF THE 8288 COMMAND AND CONTROL SIGNALS (MIf!le. MWTl: . .{'f;lWt. IOIIC. roWC.lIOWl:. TRn AND DEN)' . GS THE ACTIVE HIGH 1288 CEN 7. All TIMING MEASUREMENTS ARE MADE AT , .5V UNLESS OTHERWISE NOTED. a. STATUS INACTIVE IN STATE JUST PRIOR TO T•. 5-016 8088 NOTE: 1. SETUP REQUIREMENTS FOA ASYNCHRONOUS SIGNALS ONLY TO GUARANTEE RECOGNITION AT NEXT elK Figure 15. Asynchronous Signal Recognition ~- Any CLK Cr~ __ ~_Any CLK cye;=! CLK I~ }-----I ---1 TeLAV 1-- --tTClAVr: Figure 16. Bus Lock Signal Timing (Maximum Mode Only) ,,,~""D-L ~ 'CLGH ~_ +-- "CLCL-- _.-=\ V i:---,'c"H ' ; ; . , _I'CLG',__ l :_TCLGH 1 ,---+------\ ~ ' PULSE' : . ~': PULSE' - - -_.' COPROCESSOR . ; PULSE :I . COPROCESSOR RO. \ I RELEASE Ct- AOIGT; IOI1G1 P'.YIOUS gran. --, TCLAZ A,oIIo· A,,,.,, Au-Ai A"'-ADo ~~ ~----------------------~ ~---(S-EE~N~OT~E-'I---------J NOTE: 1. THE COf'JIOCUIOIII; IllAY NOT DRIVE THE .UsaE' OUTSIOE THE KEQtOH SHOWN WITHOUT ftllKING CONTENTION. Figure 17. Request/Grant Sequence Timing (Maximum Mode Only) "\J'C "CLKCYCU- r-"A -~ I·~ Clk I -.. I -THVeH (SEE NOTE 't HOLO~ ~I._H:LH.V \i~j,J, I , \ ~------------~~----~ ,~------~ ~ _____________~~____~ 1'~--~T~CL~Al~ _ _ _ _ _~,~__________~ COPROCESSOR Figure 18. Hold/Hold Acknowledge Timing (Minimum Mode Only) 5·017 8282/8283 ABSOLUTE MAXIMUM RATINGS· Temperature Under Bias .•.•.....•.....•. O·C to 70'C "NOTICE: Stresses above those listed under "Absolute Maximum Ratings" Storage Temperature .•.... , ...... - 6SoC to + 1S0·C may cause permanent damage to the device. This is a stress rating on:,. and functional operattoh of the device at these or any other conditions above All Output and Supply Voltages ........ - O.SV to + 7V those ;ndicated in the operational sections of this specification is hot All Input Voltages .............. " •• - 1.0V to + S.SV implied. Exposure to absolute maximum rating conditions for extended Power Dissipation .......................... 1 Watt periods may affect device reliability. D.C. CHARACTERISTICS Conditions: Vee = 5V ± 10%, TA = ooe to 70 0 e Symbol Parameter Min Max Units Test Conditions Ve Input Clamp Voltage -1 V Ie = -S mA Icc Power Supply Current 160 mA IF Forward Input Current -0.2 mA V F = 0.45V IR Reverse Input Current 50 JAA VA = S.2SV VOL Output Low Voltage .45 V IOL = 32 mA VOH Output High Voltage 2.4 V IOH = -5 mA 10FF Output Off Current ± 50 JAA V OFF = 0.45 to 5.25V Vil Input Low Voltage 0.8 V Vee= 5.0V See Note 1 V IH Input High Voltage 2.0 V Vee= 5.0V See Note 1 F= 1 MHz C IN Input Capacitance 12 pF VBIAS= 2.5V, Vce= 5V TA=2SoC Not••: 1. Output loading 10l =32 mAo IOH = - 5 mA, Cl = 300 pF A.C. CHARACTERISTICS Conditions: Vee = 5V ± 10%, TA = ooe to 70 0 e Loading: Outputs - 10l = 32 mA, 10H = - 5 mA, C l = 300 pF Symbol Parameter Min Max Units Test Conditions TIVOV Input to Output Delay (See Note 1) -Inverting 22 ns - Non-Inverting 30 ns TSHOV STB to Output Delay -Inverting 40 ns - Non-Inverting 45 ns TEHOZ Output Disable Time 18 ns TELOV Output Enable Time 10 30 ns TIVSL Input to STB Setup Time 0 ns TSLIX Input to STB Hold Time 25 ns TSHSL STB High Time 15 ns NOTE: 1. See waveforms and test load circuit on following page. 5-018 8282/8283 INPUTS '" ' 1=r~'==tm"-l)K 3~~~+",,----1,---_______ I I o,,~:--I-ii----1l-T-IV·-o'-1-l-~---------i'"o,;=,~ _,::~{'------- ---t------''t..l....__-=--------------' VOL ,-.lV f..--- TSHOV _ SEE NOTE 1 NOTE: 1.8283 ONLY - OUTPUT MAY BE MOMENTARILY INVALID FOLLOWING THE HIGH GOING STB TRANSITION. 2. ALL TIMING MEASUREMENTS ARE MADE AT 1.5V UNLESS OTHERWISE NOTED, 1.SV 1.SV 2.14V - 33Q 180Q S2.7Q OUT - ~ .111 Q 20 pF LOAD 50 8282 U III /I) Z >- C oJ III Q 10 pF LOAD Figure 5. Output Delay VI. Capacitance 5-D20 8284 ABSOLUTE MAXIMUM RATINGS· Temperature Under Bias ....•..•••....... O·C to 70·C 'NO TlCE: Stresses above those listed under "Absolute Maximum Ratings" Storage Temperature ..••.•••...•• - 65·C to + 150·C may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or any other conditions above All Output and Supply Voltages ••.•.... - 0.5V to + 7V those indicated in the operational sections of this specification is no' All Input Voltages •......•....••.... - 1.0V to + 5.5V implied. Exposure to absolute maximum rating conditions for extended Power Dissipation •....•••.•....••.......... 1 Watt . periods may affect device reliability. D.C. CHARACTERISTICS Conditions: T,,=O·C to 70·C; Vcc=5V± 10% Symbol Parameter Min Max Units Test Conditions IF Forward Input Current -0.5 mA VF=0.45V IR Reverse Input Current 50 ~ V A = 5.25V Vc Input Forward Clamp Voltage -1.0 V Ic= -5 mA Icc Power Supply Current 140 mA V ,L Input lOW Voltage 0.8 V Vcc= 5.0V V,H Input HIGH Voltage 2.0 V V cc =5.0V V Reset Input HIGH Voltage 2.6 V Vce= 5.0V 'HR VOL Output lOW Voltage 0.45 V 5 mA .- VOH Output HIGH Voltage ClK 4 V -1 mA Other Outputs 2.4 V -1 mA VIHR-V,LA RES Input HystereSiS 0.25 V Vce= 5.0V A.C. CHARACTERISTICS Conditions: TA=O·C to 70·C; Vcc=5V± 10% TIMING REQUIREMENTS Symbol Plramlt.r MIn MIX Unit. T•• t CondItIon. TEHEL External' Frequency High Time 13 ns 90% - 90% Y,N TELEH External Frequency low Time 13 ns 10% - 10% Y,N TElEl EFI Period TEHEL + TElEH .;. d ns (Note 1) XTAl Frequency 12 25 MHz TRtVCl ROYI. ROY2 Set·Up to ClK 35 ns TCLA1X AOYI. ROY2 Hold to ClK 0 ns TAtVRtV ArfIT. ArR!Set·Up to ROYI. ROY2 15 ns -- TClA1X AENI. AEN2 Hold to ClK 0 ns ----- - TYHEH CSYNC Set·Up to EFI 20 ns TEHYl CSYNC Hold to EFI 20 ns TYHYl CSYNC Width 2 TELEL ns TllHCl RES Set·Up to ClK 65 ns (Note 2) TClllH IiiES Hold to ClK 20 ns (Note 2) 5-021 8284 TIMING RESPONSES Symbol Parameter Min Mill Units T.. t Condition. TClCl ClK Cycle Period 125 ns ------ TCHCl ClK High Time (tI3TCLCl) + 2.0 n~ Fig. 3 & Fig. 4 TClCH ClK low Time ('I3TClCl) - 15.0 ns -- Fig. 3 & Fig. 4 TCHICH2 ClK Riae or Fan Time 10 ns 10V to 3.5V TCl2ClI .-- TPHPl PCLK High Time TClCl- 20 ns TPlPH PCLK low Time TClCL- 20 ns TRYlCl Ready Inacllve to ClK (See Note 4) -8 ns Fig. 5 & Fig. 6 TRYHCH Ready Active 10 ClK (See Note 3) ('hTCLCl)-15.0 ns Ftg. 5 & Fig. 6 TClil ClK to Reset Delay 40 ns TClPH ClK to PClK High Delay 22 na TClPl ClK to PClK low Delay 22 na f---- TOlCH OSC to ClK High Delay -5 12 na TOlCl OSC to ClK low Delay 2 20 na Notal! 1. ~ .. EFI rlae (5 na max) + EFI fan (6 na max). 2. ee! up and hold only necesaary to guarantee recognition at next clock. 3: Applies only to T3 and TW atates. 4. Applle. only to T2 states. osc cu, 0 PClK 0 ROY.2 I --'\---- "EN,.2 I --+----. ·~~·I~·,:~:. TEHYL CSYNC I _TClltH-~TItHCl- m I TYHYL "ESET 0 ALL TIMING MEASUREMENTS ARE MADE AT 1 S YOLTS. UNLESS OTHERWISE HOTED A.C. TEST CIRCUITS 5-D22 8286/8287 ABSOLUTE MAXIMUM RATINGS· Temperature Under Bias ................. O·C to 70·C 'NO TICE: Stresses above those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and Storage Temperature ............. -65·C to + 150·C functtonal operatton of the device at these or any other conditions above All Output and Supply Voltages ........ - 0.5V to + 7V those indicated In the operattonal sections of this specification is not All Input Voltages .................. - 1.0V to + 5.5V Implied. Exposure to absolute maximum rating conditions for extended power Dissipation .......................... 1 Watt periods may affect deVice reliability D.C. CHARACTERISTICS FOR 828618287 Conditions: Vcc = 5V ±10% TA = DoC to 70°C Symbol Parameter Min Max Units Test Conditions Ve Input Clamp Voltage -1 V le= -5 mA Icc Power Supply Current-8287 130 mA -8286 160 mA IF Forward Input Current -0.2 mA V F = 0.45V IR Reverse Input Current 50 IJ.A VR=5.25V VOL Output Low Voltage -BOutputs .45 V IOL = 32 rnA -A Outputs .45 V IOL = 16 rnA VOH Output High Voltage -BOutputs 2.4 V IOH=-5 rnA -AOutputs 2.4 V IOH= -1 rnA 10FF Output Off Curwnt IF VOFF =0.45V IOFF Output Off Current IR VOFF=5.25V VIL Input Low Voltage -A Side 0.8 V Vee= 5.0V, See Note 1 -8 Side 0.9 V Vee= 5.0V, See Note 1 - VIH Input High Voltage 2.0 V Vee= 5.0V, See Note 1 F= 1 MHz GIN Input Capacitance 12 pF V BIAS = 2.5V, Vee= 5V TA =25·C Note: 1. B Outputs - 1m = 32 mA, IOH = -5 mA. CL = 300 pF A Outputs - 1m = 16 mAo IOH = -1 mAo CL = 100 pF A.C. CHARACTERISTICS FOR 828618287 Conditions: Vee = 5V ±10%, TA = O°C to 70°C Loading: B Outputs - IOL = 32 rnA, IOH = -5 rnA, CL = 300 pF A Outputs - IOL = 16 mA, IOH = -1 rnA, CL = 100 pF Symbol Parameter Min Max Units Test Conditions TIVOV Input to Output Delay Inverting 22 ns (See Note 1) Non,lnverting 30 ns TEHTV Transmit/Receive Hold Time TEHOZ ns TTVEL Transmit/Receive Setup 30 ns TEHOZ Output Disable Time 18 ns TELOV Output Enable Time 10 30 ns Note: 1. See waveforms and test load circuit on following page. 5-D23 8286/8287 INPUTS \'1 J~ C= OE / \ J ~'------ -Tivov- ,.-_________ ---+__ TEHOZ ! VOH - .1V TELOV- 1-. OUTPUTS \V l ______ I J~'--_ _ _ _ _ _ _ _ _-+j_ _ , VOL+.1V 1·---TEHTV ----I ,-. TTVEL __________________________________________~r-------------- NOTE: 1. ALL TIMING MEASUREMENTS ARE MADE AT 1.5V UNLE'SS OTHERWISE NOTED. 8286/8287 TIMING 5-024 8286/8287 50 50 8217 40 40 u III 30 z ~ II 20 10 pF LOAD pF LOAD Figure 4. Output Delay VI. Capacitance 1.5V 1.5V 2.14V OUT ~'" OUT ~H' OUT ~~" r 300PF 3-STATE TO VOL r 100PF 3·STATE TO VOL r 300PF SWITCHING B OUTPUT A OUTPUT B OUTPUT 1.5V 1.SV 2.28V OUT ~'U' OUT ~- OUT ~"~ I 300 pF )'STATE TO VOH r 100PF )'STATE TO VOH r 100PF SWITCHING B OUTPUT A OUTPUT A OUTPUT Figure 5. Telt Load Circuit' 5-D25 8288 ABSOLUTE MAXIMUM RA TlNGS· 'NOTICE: Stresses above those listed under "Absolute Maximum Ratings" Temperature Under Bias .O·C to 70·C may cause permanent damage to the device. This is a stress rating only and Storage Temperature ... -65·Cto +150·C functional operation of the device at these or any other conditions above All Output and Supply Voltages. - 0.5V to + 7V those indicated in the operational sections of this specification is not All Input Voltages. . ..... -1.l. to +5.5V implied. Exposure to absolute maximum rating conditions for extended power Dissipation. . 1.5 Watt periods may affect device reliability. D.C. CHARACTERISTICS Conditions: Vcc = 5V ± 10%, T A =O·C to 70·C Symbol Parameter Min Vc Input Clamp Voltage ~_________p_ow_e_r_S~up~p_l~y~C_U_r_re_nt_______________+------~----------+_----____~-----------.------~ IF Forward Input Current IR Reverse Input Current VOL Output low Voltage-Command Outputs Control Outputs Output High Voltage- Command Outputs 2.4 Control Outputs 2.4 Input low Voltage VIH Input High Voltage 2.0. ---------~--~--~----~----------------~----~~---------4----~---t------------------1 _ _IO_F_F____ L-. Output Off Currenl A.C, CHARACTERISTICS Conditions: Vcc=5V ±10%, T A =0·Ct070·C TIMING REQUIREMENTS .-- ------ - --. r-'--- ------------------,--------,--------------,---------r-----------------------" Symbol Parameter Min Ma. Unit Loading ~----------_1-------------------.---~-------~--------------~-------~----------~-------1 TCLCl ClK Cycle Period 125 ns f----.-----f-----------------------~------~I_--------------+---------_+_-------------------I TClCH CLK low Time 66 ns f - - - - - - - - - - - - - --- --·-----jf---------------~--------+_---------·---------I TCHCl ClK High Time 40 ns t--- - - - - - - -----.---- - ----------I-----~- ------~·--------t__--·-----------------I TSVCH Status Active Setup Time 65 ns t - - -------1----------------- -----t-------+-------+----f------------I TCHSV Status Active Hold Time 10 ns ------ - - - - - - 1 - - - - - - - - -.-- f--- . t- TSHCL Status Inactive Setup Time 55 ns t - - - - - - - - - - - - - - - - - . - - - - - - - -----:- --t-------------+--------+--------------------I TCLSH Status Inactive Hold Time 10 ns - - - - - -----._. - - - - - - _ .. - ----_._--_._--- TIMING RESPONSES Symbot Paremeter Min Mu Unit Loading TCVNV Control Active Delay 45 ns TCVNX Control Inactive Delay 10 45 ns ~ClLH. TClMCH ALE MCE Active Delay (from ClK) 15 ns t--- TSV~!i:. ~~~~_._ f-~MCE A:_tl::':E.e~y (from ~~~u:.::s.:...) ___ +-______+-_____:::..____---<~.....:..:~......, 15 ns TCHll ALE Inactive Delay 15 ns IORC "ROC } TClMl Command Active Delay 10 35 ns IOL=32 mA MWTC TClMH Command Inactive Delay 10 35 ns IOWC IOH= -5 mA TCHDTl Direction ContrOl Active Delay 50 ns INTA CL=300 pF TCHDTH Direction Control Inactive Delay 30 ns AMWC AlOWC TAElCH Command Enable Time 40 ns TAEHCZ Command Disable Time 40 ns I Inl = 16mA TAElCV Enable Delay Time 115 200 ns Other { 10H= -1 mA TAEVNV AEN to DEN 20 ns CL=80 pF TCEVNV CEN to DEN, PDEN 20 ns TCElRH CEN to Command TCLML ns 5-D26 8288 STATE - - - T 4 - ---T1 T2------+ T3-- --. 1--- --- T4 ------- - -TClCl~ eLK In~ I--TClCH- ~ lr'\ L riL-JV\ lL- TCHSV- I- - TSVCH - TCHCl~ - - ~y"'~ l7 TSHCl \ \ 1\ 1\ I ,.~ I x~ WRITE ADDRESS/DATA CD rr VALID DATA VALID TCLlH- L TSVlHI.-TCHLl ALE - rTCLMH I v / - -TClML ~ i--TCLMl \ r\ \ IV - I-- TCVNV I ) V ) J TCVNX- 1--- ) I ) TCVNV- f-- I DEN (WRITE) V \ J 1\ i - f--- TCVNX PDEN(WRITE) ! V I I J I ___0- TCHDTH- J-:::' I DT/Ii (READ) (INTA) ---- IJ J1 TCHDTL MCE TClMCH-1 I/li@ I r ~ I ;-j \ f- TCVNX TCHDTH~ L - .--TSVMCH 1. ADDAESSIDATA IM1$IS SHOWN ONLY FOR AEFEREfojCE PURPOSES 2. UAOtHG EDGE OF ALE ...... 0 Met: IS OETERMIH[O 8Y' THi FALLING EDGE Of CUt OR STATUS OOING ACTIVE. Wt1tCI1EV£A OCCURS LAST So AU TlWINQ trUASUftEM[NTS AM ""DE AT LSv V"'tlESS $P£CIFIEO OTHERWISE 8288 Timing Diagram 5-027 8288 eEN DEN DEN, PDEN Qualification Timing CO~~::~------------------------------~ CEN----------------------------~T~C~EL~A~H-JI NOTE: CEN MUST IE lOW OR VALID PRIOR TO T2 TO PREVENT THE COMMAND FROM BEING GENERATED. 8288 Addre.. Enable (AEN) Timing (3-State Enable/Disable) 1.SV 1.SV 2.14V 2.28V OUT ~'~ OUT ~n' OUT ~Q" OUT ~"" I*PF I*PF r*PF r~PF COMMAND OUTPUT 3·STATE TO HIGH '·STATE TO LOW CONTROL OUTPUT TEST LOAD TEST LOAD Test Load Circuit. - 3 State Command Output Te.t Load 5-028 Chapter 6 THE ZILOG Z8000 SERIES The Z8000 series of microprocessors represent Zilog's first 16-bit products. The Z8000 is the second of the new 16-bit microprocessor generation. Inters 8086. described in Chapter 5. was the first product to appear. Motorola's MC68000 will likely be the next. Two Z8000 series microprocessors have been announced. The l8002 is a 40-pin package device capable of ad- dressing up to 65.536 bytes of external memory. The l8001 is a 48-pin package.device capable of addressing up to eight million bytes of external memory. organized as segments of 65.536 bytes. A third device. the Z801 0 Segmenta- tion and Memory Manager. is a companion to the Z8001. The Z801 0 allows memory segments to be dynamically al/o- cated under program control anywhere within the eight million bytes of addressable memory. The Z8000 series microprocessors are upward compatible at the source program level with the 8080A ~nd the l80. The following is a comparison of interesting Z8000 and 8086 innovations: 1) Z8000 microprocessors do not pipeline instruction object codes. but under some circumstances they do overlap the next instruction's fetch with the prior instruction's execute. In contrast. the 8086 has a 6-byte object code pipeline. which. with associated instruction fetch overlap timing. effectively eliminates instruction fetCh times. 2) The Z8001 and the Z8002 can be visualized as supporting complex and simple microcomputer configurations. respectively. In contrast. a single 8086 can operate either in complex mode. comparable to the Z8001. or in simPle mode. comparable to the Z8002. 3) Both the Z8001 and the Z8002 have built-in logic to handle bus access priorities,in multi-CPU configurations. The 8086 has equivalent logic. 4) In multi-CPU configurations. each Z8000 series CPU can have its own local memory. while simultaneously sharing common memory. The common memory may be shared by all CPUs or by selected CPUs. In this respect. the 8086 and the Z8000 series are comparable. 5) The Z8001 can address up to eight million bytes of external memory. With the help of the Z801 0 Segmentation and Memory Management Device. this large external memory can be accessed as up to 128 relocatable segments. where each segment can have up to 65.536 bytes of external memory. The 8086 offers similar relocatable seg- ments without relying on an additional memory management device; however. the 8086 can directly address only one million bytes of external memory and can only manipulate four segments at a time. 6) Both Z8000 series microprocessors can be operated in separate "System" and "Normal" modes. Certain privileged instructions. including all I/O instructions. can be executed in System mode only. System and Normal modes have separate Stacks. with separate Stack Pointers. Thus. in program-intensive applications. systems software. executed in System mode. can be separated from application programs. executed in Normal mode. The 8086 offers no equivalent logic. 7) The Z8000 has sixteen 16-bit registers that can alternatively be accessed as 8-bit or 32-bit registers. Fifteen of the 16-bit registers can function as index registers. The 8086. in contrast. has four 16-bit registers. plus three separate 16-bit index registers. The prime sou rce for the Z8000 series is: ZILOG. INC. 10460 Bubb Road Cupertino. CA 95014 6-1 Second sources include: ADVANCED MICRO DEVICES 901 Thompson Place Sunnyvale. CA 94086 SGS-ATES COMPONENTI ELETTRONICI SPA 20019 Castelletto d i Settimo Agrate (Milano) Italy The Z8000 series microprocessors are manufactured using N-channel silicon gate MOS technology. The Z8001 is packaged as a 48-pin DIP. The Z8002 is packaged as a 40-pin DIP. Both devices require a single +5 V power supply. All signals are TTL-level compatible. The Z8000 requires an external clock with up to 4 MHz frequency. Instructions execute in a minimum of three clock periods. The maximum number of clock periods is approximately 20; however. a number of instructions require more time to execute a variety of complex operations. 6-2 THE Z8001 AND Z8002 CPU'S Because these two versions of the Z8000 CPU are so similar. we will describe them together. Functions imple- mented by Z8000 series microprocessor chips are. in terms of our general illustration. equivalent to those of the 8086. as illustrated in Figure 5-1. Z8001 AND Z8002 PROGRAMMABLE REGISTERS Programmable registers for the Z8001 and Z8002 microprocessors are illustrated in Figures 6-1 and 6-2, respectively. Registers RO through R16 can be used as general purpose accumulators. Registers R1 through R16 can. in addi- tion. function as index registers. Register RD is the only general purpose register which cannot function as an index register. Both the Z8001 and the Z8002 can be operated in System mode or Normal mode. A Z8000 status flag setting determines the mode of operation. System mode will normally be used by SYSTEM AND operating system software; Normal mode will be used by application programs. A number of NORMAL instructions. including all I/O instructions. are privileged. and consequently can be executed in MODES System mode only. System and Normal modes have separate Stack Pointers. These are Z8000 STACK shown in Figures 6-1 and 6-2 by Sand N suffixes. which represent "System" and "Normal" POINTERS modes. respectively. For the ZaOD2. the single 16-bit register R15 serves as the Stack Pointer. For the ZaDD" two 16-bit registers are needed to implement a Stack Pointer. since memory addresses may be up to 23 bits wide. Registers R14 and R15 are used. Instructions that access 16-bit registers do not make any special allowance for R15 and/or R14 functioning as Stack Pointers. Thus. the Stack Pointer can be accessed as a general purpose register/accumulator, or it can be used as the Index register for indexed memory addressing. The fact that there are separate System and Normal mode Stack Pointers is inconsequential when these registers are being accessed as accumulators or index registers. Depending on the currently selected mode. one or the other Stack Pointer will be accessible. This may be illustrated as follows: Normal System Mode Mode R11 .----1 R11 1-----1 .-----1 R12 .-----1 R12 .----1 R13 R14 (or R14N) ~----I R13 R14 (or R14S) ~--~ L.-_ _...... R15N .-----1 R15S Whenever two 16-bit registers provide a memory address for the Z8001. register bits Z8001 32-BIT are utilized as follows: ADDRESS REPRESENTATION 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 " ' - B i t No. r-o""'T'---s-e-gm-e-nt-N-o-.---"I~o"l~o"lr--o-ll""'""o""'l-0""'1-0""'1-0""'-0-1 Register RN holds the _ ....._ _ _ _ _ _ _ _ _ _....................................._ ...._.&.._.&.._ .......... 7-bit segment number in bits 8-14. Other register bits are O. Offset ..._ _ _ _ _ _ _ _ _ _ _ _ ___________ ~_ I Register RN+ 1 holds the 16-bit offset. or address within the segment identified in Register RN. 6-3 15 14 13 12 11 10 9 S 7 6 5 4 3 2 o ~ Bit No. (for all registers) RO - Accumulator R1 R2 R3 R4 R5 R6 Accumulators and R7 Index Registers RS R9 R10 R11 R12 R13 R14S R14N System and Normal Stack Pointers. Accumulators and Index Registers R15S R15N b.b.b.b.b.b.b.b.~~~.lli~b..lli~b.~iill } Flags and Control Wo", ~~~~~~~iJi.i.~;;';';~,;,J } P"'.n1m Counte' } New P",• .am Status A'ea Po;n'e' I Refresh Counter Figure 6-1. Za001 Microprocessor Programmable Registers 6-4 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o 4 - - - - Bit No. (for all registers) RO - Accumulator R4 R5 R6 R7 Accumulators and Index Registers R8 R9 R10 R11 R12 R13 R14 R 15S } System and Normal Stack Pointers, R 15N Accumulators and Index Registers Flags and Control Word Program Counter New Program Status Area Pointer Refresh Counter Figure 6-2. Z8002 Microprocessor Programmable Registers 6-5 The segment number and offset translate into a 23-bit memory address as follows: A22} Memory Segment 23-bit .,....-_~A16 Memory .-+-~~ A 15 } 16-bit Address Offset '1---~AO Thus. the Z8001 Stack Pointer is shown in Figure 6-1 with bits 8 through 14 of Register R14 pro- Z8000 viding the segment number. while the whole of Register R15 provides the segment offset. The STACK Z8002 Stack Pointer. shown in Figure 6-2. is a simple 16-bit address register. POINTER The Program Counter is a simple 16-bit register for the Z8002. but for the Z8001 two 16-bit words Z8000 are used. with the 23-bit address divided into a segment number and an offset. as illustrated PROGRAM above. COUNTER The Z8000 addresses memory as bytes; however 16-bit words must originate on even byte address bound- aries. That is why the Z8001 uses two 16-bit words to generate extended memory addresses. even though only 23 bits of address are required. 23-bit addresses could be implemented in three bytes. rather than in two 16-bit words; however. this would complicate pushing and popping memory addresses. Were the addresses implemented as three bytes. all Stack operations would require three byte pushes or three byte pops. By making all addresses occupy two 16- bit words. Stack operations are reduced to two word pushes or two word pops which require no more time than three byte pushes or pops. The Flags and Control Word provide. the Z8001 and the Z8002 with Status and Control bits. Bits are interpreted as follows: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o '-"-BitNo. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -- Reserved word. l8001 only NV . ~EG ~/N 0 V 0 0 0 C l S P/O DA H 0 0 ~ Flags and Control Word (FCW) .~ IE ~ IE .~ A~ ~ ~ .~ .f Auxiliary Carry Decimal Adjust Parity or Overflow Sign lero Carry Non-vectored interrupt enable/disable Vectored interrupt enable/disable System/normal mode select Segmentation mode select (Z8001 only) Always 0 for Z8002 6-6 The Parity, Overflow, Sign, Zero, and Carry statuses are absolutely standard. Parity and Overflow share a status bit. The Parity status is modified by logical instructions which test the parity of byte data. This status is set to 1 for even parity; it is cleared for odd parity. The Overflow status is equal to the Exclusive OR of carries out of the high-order and penultimate bits following arithmetic and logical operations. The Sign status is set to the value of the high-order result bit following arithmetic operations. The Zero status is set to 1 when the result of an operation is 0; it is reset to 0 otherwise. The Carry status reports carries out of the high-order bit following arithmetic operations. This status is also used by most shift and rotate instructions. Most microprocessor instructions routinely modify status bits. whether or not such modifications are relevant to the operation performed. zaooo status logic generally follows the PDP-11 minicomputer. but the zaooo has a few anomalies. You should therefore consult Table 6-3. which summarizes the zaooo instruction set. in order to deter- mine how a particular status is affected by the execution of any specific instruction. The Auxiliary Carry and Decimal Adjust status flags differ somewhat from normal use. These flags are modified by byte arithmetic instructions in order to make binary coded decimal arithmetic possible. You cannot set or reset these two Status flags using any of the status bit control instructions. and reading the value of these flags provides little useful information. The assembly language programmer should ignore these two flags. NVIE and VIE are used to enable and disable non-vectored interrupts and vectored interrupts, respectively. You enable interrupts by setting the appropriate status bit to 1. and you disable interrupts by resetting the appropriate status bit to O. The SIN status flag is used to switch between System and Normal modes. When this bit is 1. zaooo microprocessors operate in System mode. When this bit is O. zaooo microprocessors operate in Normal mode. Recall that System and Normal modes have their own separate Stack Pointers; also. certain privileged instructions can only be executed in System mode. The SEG status is used by the Z8001 microprocessor only. When this bit is set to 1, the Z8001 operates in Seg- mented mode; when this bit is set to 0, the Z8001 operates in Nonsegmented mode. In Segmented mode. all Za001 addresses are computed 23 bits wide. using two 16-bit memory Z8001 words as previously illustrated. Za001 Nonsegmented. Normal mode is directly equivalent to SEGMENTED Za002 Normal mode operations. Za001 Nonsegmented System mode is not exactly equivalent to MODE Za002 System mode; differences occur in interrupt acknowledge stack handling. as explained later in this chapter. Thus Za002 Normal mode programs can be executed within any single segment of Za001 memo- ry. The Za001 carries an unused word as a companion to the Flag and Control Word. since all Za001 automatic Stack operations push and pop data in word pairs. Status in the Flag and Control Word must also be pushed and popped as a 32-bit unit - hence the unused companion word. 6-7 The New Program Status Area Pointer is used by interrupt logic. It consists of one or two 16-bit Z8000 NEW words. as illustrated in Figures 6-1 and 6-2. PROGRAM Following any interrupt acknowledge. a vector address is created using the New Program Status STATUS AREA Area Pointer and a 9- or 1O-bit displacement provided by interrupt acknowledge logic. as follows: POINTER ze001 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o .--BitNo. P-~----------~------~~~~~--~~--~~~ o Segment No. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 SN6 SNO A15 A11 A10 AO Interrupt Vector Address zeOO2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 4--BitNo. Upper Offset Displacement A15 A10 A9 AO ,/ Interrupt Vector Address Although the Z8002 uses just one byte of its New Program Status Area Pointer. 16 bits are provided. since all Z8002 automatic Stack operations push and pop 16-bit words. Likewise. the Z8001 New Program Status Area Pointer uses two 16-bit words. where a Single 16-bit word would suffice. to accommodate automatic Stack handling logic which pushes and pops data in 32-bit increments. The Refresh Counter will be described later. along with memory refresh. 6-8 Z8000 REGISTER DESIGNATIONS Z8000 series microprocessor Instructions access a-bit, 16-bit, or 32-blt registers, as illustrated in Figure 6-3. Register designations used by Zilog assembly language mnemonics are shown in this figure. Byte Instructions access sixteen 8-bit registers. illustrated in Figure 6-3 by RHO through RL7. Z8000 BYTE REGISTERS Word Instructions access the sixteen 16-bit registers RO through R16. Z8000 16-BIT REGISTERS Long word instructions access general purpose registers in pairs. Eight 32-bit registers are Z8000 32-BIT therefore available. shown in Figure 6-3 as RRO through RR14. REGISTERS Most Z8000 series instructions that access memory or registers have a word version and a byte version. A limited number of instructions have a long word version. Multiplication and division Instructions sometimes use 64-bit registers, Shown in Figure 6-3 as RQO through RQ12. Z8001 AND Z8002 MEMORY ADDRESSING MODES Most Z8001 memory addreSSing modes have two forms: one for Nonsegmented mode, the other for Seg- mented mode. When operating in Nonsegmented mode. all Z8001 memory reference instructions compute nonsegmented memory addresses: the offset address is modified. but the segment number is not altered. When operating in Segmented mode. l8001 memory reference instructions compute segmented memory addresses. provided the instruction also has a segmented memory addressing option. But there are some memory reference in- structions that have no segmented option: these instructions compute nonsegmented memory addresses. even for a l8001 operating in Segmented mode. A segmented memory reference Instruction computes new values for the segment number and offset addre.s. The Z8002 Program Counter is a Single. 16-bit register. equ iva lent to the l8001 Program Counter Offset register. l8002 memory reference instructions therefore compute nonsegmented memory addresses only. In the discussion which follows. we will illustrate l8000 memory addressing options for Segmented and Nonseg- men ted modes. In Segmented mode the base address always specifies the segment. The base address may Z8001 occupy two 16-bit words: BASE ADDRESS Word or Register Number 15 14 13 12 11 10 9 a 7 6 5 4 3 2 1 0 -4--Bit No. Segment No. 1 0 10 I 0 I 0 , 0 I 0 , 0 '0 I} Long form segmented mode base address n + 1 ..1__________1_6_-B_i_t_o_ff_s_et_ _ _ _ _ _ _ _ _ _..1 (not in instruction) 'I Instruction word 15 14 1 3 12 11 10 9 a 7 6 5 4 3 2 1 0 " - Bit No. p I...- -........se-gm-e-nt-No-.--'-0-'-0-'-0-'-0-'-0....'-0....'-0-' 0..... Long form segmented mode base address p+1 I 16-Bit Offset I (in instruction) or it may occupy a single 16-bit instruction word: 15 14 13 12 11 10 9 a 7 6 5 4 3 2 0 - 4 - - Bit No. r -o..... '---S-e-g-m-e-n-t-N-O-.--.....,r------a--b-it-O-ff-se-t----.. Short form segmented I • . mode base address 6-9 Z8002 Z8001 15 8 7 o ...--Bit No.--"15 8 7 o 'RO} r:~rS~!lrs {RO ~~ RRO Rl R1 ROO ~::} RR2 {:: ---------------------------- ::} RR4 {::~ R04 ::} RRS {:: ---------------- :: } RR8 { :: R08 ~~~~~~..::~} RR,O {R:::"""""""",!!"""",!!,,!,!, ---------------------------- ~R12 }RR12{ R12~ ......................................................................"""R13 R13 h±~~~;lliiilll R012 ~~~~JI} C:~~::"'!., { [_:':~':i o i o·: .. ...... ;: _~G_i':'...:",........'..,'"';... !:""":·:_:;'"",""...' ....' '.... ... '_1,2"",::,;:,:,·':;;;""'·'....• .' 1} P",.,am Co,n'., { :::~~::______ 1".... .... :}.... iOOiOOi .....____________......... . .,;,........ . .,;,. . . ,;,. . . ,;,.__.;.;:.;a} N;;:.~;::.m {~~~~. . . Figure 6-3. Various Register Designations for the Za001 and Za002 Microprocessors 6-10 The index or displacement portion of a memory address never specifies the memory segment. The index is always a single 16-bit value for any Z8000 microprocessor. operating in any mode. The displacement may be an 8-bit. 12-bit. or 16-bit value: but once again. it is the same for all Z8000 microprocessors. and all modes of operation. Thus. in Segmented mode. there is a clear difference between a base address and an index or displacement. In Non- segmented mode. there being no segment number. there is no difference between a base address and an index. Most Z8000 series memory reference instructions access data memory using implied. direct. or indexed memo- ry addressing. Z8002 implied memory addressing may be illustrated as follows: Z8000 16-bit IMPLIED Registers Memory MEMORY ADDRESSING ....._ _...... RN-1 xxxx RN -4--lnstruction RN+1 specifies xxxx-l 1---+--1 1----1 memory address xxxx .....-+_......-RN+2 in register RN. 1-----1 Memory byte xxx x is accessed. x represents any hexadecimal digit ---- Bytes The Z8001 uses only nonsegmented implied memory reference instructions to access data memory. The Z8001 does not use either short or long segmented implied memory addressing to access data memory. Z8001 implied memory ad- dressing may therefore be illustrated as follows: 16-bit Registers Memory RN-1 ss xxxx-1 1----1 1----1 RN ..._Instruction specifies ss xxxx 1-~f---IRN+1 memory address is register RN. Memory byte ss xxxx is accessed. t ~ ____ ss xxxx+3 I Bytes Segment number ss is current contents of Program Counter s and x represent any hexadecimal digits Segment register. 6-11 Some Za001 program memory reference instructions (such as the subroutine call) use long segmented implied memory addressing. which may be illustrated as· follows: 16-Bit Program Registers Memory RRN-l ~----I ss 00 RRN -4- Instruction specifies memory address in ss xxxx-l ss xxxx ~--- t-----I .. Register RN. Memory RRN+l 1---\---1 byte xxxx in segment ss is accessed. ~ Bytes s and x represent any hexadecimal digits. RRN is a 32-bit register designation. We will now examine direct memory addressing. For the Za002. direct memory addressing may be illustrated as follows: Z8002 DIRECT Memory MEMORY ADDRESSING The direct address xxxx is pppp "'___ _ _-I PPPP+ 1 r I Instruction code provided by the instruction pppp+2 xx Direct Address object code pppp+3 t----:x;-x_--t xxxx ~--- .. xxxx+l xxxx+2 .----1 t-----11 x and p represent any hexadecimal digits Note that the direct address xxxx. being a 16-bit value. must start at a memory byte with an even address. This require- ment is illustrated above by the address pppp+2. Furthermore. the high-order byte of a 16-bit memory word is at the lower address. preceding the low-order byte: Program High-order Low-order PPPP Memory t-----I PPPP+ 1 t - - - - - t -- -- byte hh byte II 16-bit data from memory pppp+2 hh 1 - - - - -..... pppp+3 II pppp+4 t-----I 6-12 A Za001 direct memory address may be nonsegmented, short segmented, or long segmented. Nonsegmented Za001 direct memory address logic is as illustrated above for a Za002 direct memory address, except that the most re- cently computed segmented number is output from the Program Counter Segment register via the seven Za001 seg- ment number lines. Long segmented Za001 direct memory addressing may be illustrated as follows: Za001 LONG SEGMENTED Memory DIRECT MEMORY ADDRESSING tt pppp } Instruction code tt pppp+1 tt pppp+2 ss The direct address xxxx, in segment tt pppp+3 tt pppp+4 00 xx J Long ",gment.d direct address ss, is provided by the instruction tt pppp+5 xx object code •• •• SSXXXX_1~ ss xxxx ss xxxx+ 1 sand t are any hexadecimal digits that specify a segment number in the range 00 through 7F 16. P and x are any hexadecimal digits that specify a memory address within a segment. We can illustrate a short segmented Za001 direct memory addessing as follows: Z8002 SHORT SEGMENTED DIRECT MEMORY Memory Segment Number ADDRESSING ~ tt pppp } t - - - - - I Instruction code ss'- tt pppp+ 1 Offset " ' - " ' tt pppp+2 ~--- ss .. } Short segmented OOxx_ tt pppp+3 xx direct address The direct address tt pppp+4 I-~~"""" OOxx, in segment ss, is provided by the instruction object code • • SSOOXX_1~' ss OOxx • ss 00xx+1 sand t are any hexadecimal digits that specify a segment number in the range 00 through 7F 16· P and x are any hexadecimal digits that specify an offset, or memory address within the segment. 6-13 Z8001 and Z8002 indexed memory addressing adds the contents of an index register to a direct address. 16-bit registers Rl through R15 can function as index registers. Register RO cannot function as an index register. The direct address provides the base to which an index is added. Z8002 indexed addressing may be illustrated as follows: Z8002 INDEXED l6-bit ADDRESSING Registers Memory RN-l pppp t----f } Instruction code RN yyyy pppp+l RN+l pppp+2 xx } Direct t---\:-oof pppp+3 xx Address xxxx + yvyy zzzz .. zzzz-l zzzz zzzz+l P. x. y and z represent any hexadecimal digits. The selected memory address zzzz is the sum of the direct address xxxx. which is provided by the instruction ob ject code. and the index yyyy. The instruction code specifies Register RN as the Index register. The illustration applies also to nonsegmented laOOl indexed addressing. but for the laOOl a segment number (ss) would precede the computed address zzzz. Since no segment is computed by the laOOl in Nonsegmented mode. ss would be the current contents of the Program Counter Segment register. Here is an illustration of Z8001 short segmented indexed addressing: Z8001 SHORT SEGMENTED l6-bit INDEXED Registers Memory ADDRESSING tt pppp } Instruction code RN-l tt pppp+l RN yyyy tt pppp+2 ss Short segmented RN+l xx } direct address .....--,.---t ss OOxx + yyyy ss zzzz-l ~zzzz ~ ss zzzz .....- - - f ..... --~ :=J ss zzzz+l Segment digits are not 4 affected by this addition. Any carry out of high-order digit addition will be lost. The effective memory address ss zzzz is not the simple sum of ss OOxx and yyyy. The segment number ss is output directly on the segment number pins. bypassing the address addition. OOxx and yyyy are added to create zzzz. the offset. which is output on the Address Bus. In the event that adding OOxx to yyyy generates a carry out of the high- order bit. this carry is lost. Thus the offset addition wraps around from FFFF16 to 000016. without incrementing the segment number. 6-14 Long segmented Z8001 indexed addressing uses a four-byte direct address. with a 16- Z8001 LONG bit offset. as follows: SEGMENTED INDEXED ADDRESSING The computed offset zzzz becomes the sum of xxxx and yyyy. Note that long segmented indexed addressing offers the same addressing range as short segmented indexed addressing: the index, on its own, can address the entire offset space of 65,536 bytes. Therefore, the one-byte short segmented base address offset is no handicap. Suppose, for example, you use indexed addressing to access a data ta- ble in the middle of a segment. Using long segmented indexed addressing, the base of the data table might be provided by the direct address offset. while the Index register provides the displacement into the selected table: Memory Table Origin xxxx from--~t----t xxxx base address Displacement into table from Index register yyyy Memory ..... But you could just as easily have the index originate at the base of the segment: Table n --Start of Segment Base address 0000 offset = 00 I I Displacement into : : table, from segment origin, in Index register 11 Start of Table xxxx yyyy A few l8001 and l8002 instructions access data memory using base relative addressing, Z8000 BASE wherein the contents of an Index register are added to a base address, which is also held in RELATIVE CPU registers. Therefore, l8000 base relative addressing might also be called "implied, in- ADDRESSING dexed" addressing. Z8000 IMPLIED INDEXED ADDRESSING 6-15 Z8002 base relative addressing may be illustrated as follows: 16-bit Registers Memory RM-1 RM ......-- xxx x ....... xxxx I---~-I RM+1 ......___....... T--------- zzzz-1 zzzz - - - - . , . zzzz 1 - - -....... zzzz+1 I---....-t RN-1~_........... RN YYYY Index RN+1 "-v-" I----t Byte x, Y and z represent any hexadecimal digits The instruction object code must specify the register number from which the base address and the index are taken. In Nonsegmented mode there is no difference between a base address and an index; each is a single l6-bit value. The effective memory address zzzz is simply the sum of any two l6-bit registers' contents. The illustration above applies also to nonsegmented laOOl base relative addressing. However, for the la001 the memory segment ss, currently in the Program Counter Segment register, is output via the seven la001 segment num- ber lines. Consider next Z8001 segmented base relative addressing. The base address specifies the Z8001 SHORT segment. thus the base address and the index differ. Short segmented base relative addressing SEGMENTED may be illustrated as follows: BASE RELATIVE 16-bit ADDRESSING Registers Memory RM-1 ......- - - - 1 RM ss xx ss OOxx 1--_--1 RM+1~__~~____- - + yyyy S5 zzzz-1 1 - - -....... ~~~sszzzzl-_ _--1 ss zzzz+1 1 - - -....... RN-1 I-~,,"....-t RN yyyy Index RN+1 ......- -....... ~ Byte Segment number Offset x, y and z represent any hexadecimal digits specifying offsets, or addresses within memory segment ss. ss can have any value in the range 00 through 7F16' The index is added to the base address USing the same mechanism described earlier for short segmented indexed ad- dreSSing. The discussion of addressing range given for Short segmented indexed addressing applies also to short seg- mented base relative addressing. 6-16 Long segmented base relative addressing may be illustrated as follows: . Z8001 LONG 16-bit SEGMENTED Registers Memory BASE RELATIVE R::~ l~-ss-o-o-'" ADDRESSING ss zzzz-1 xxxx ss zzzz ~-- .... ss xxx x RRM+1 + yyyy sszzzz+1 ......_ _--1 ~~ ----" RN-1 ......---jl--o--l ~ RN vyyy Index Byte ......- - - - 1 RN+1 ......- - - - 1 Segment number Offset x, y and z represent any hexadecimal digits specifying an offset address within memory segment ss. RRM designates a 32-bit register, while RN designates a 16-bit register. These registers are specified by the instruction object code. Some program memory reference instructions use program relative addressing. A displace- Z8002 ment provided by the instruction object code is added, as a signed binary number, to the PROGRAM contents of the Program Counter. For the Z8002 this may be illustrated as follows: RELATIVE Program ADDRESSING . Memory "",,,+4 - d d d d t 2 s • I I I xxxx xxxx+1 lop~. Program relative xxxx+2 dd signed binary addreSSing range xxxx+3 dd displacement C xxxx+4 + dddd ... 1--_-- xxxx+4 I I I I XXXX+4+ddddt2~ In the illustration above. dddd is divided by 2 to show the addressing range of a program relative address; this is because dddd is a signed binary number. Therefore. half of the possible values will increase the address in the Program Counter (xxxx+4); the other half will decrease this address. Depending on the instruction. dddd may be an 8. 12. or 16-bit signed binary value. This displacement is added to the contents of the Program Counter after the Program Counter has been incremented to address the first byte of the next sequential instruction. This is illustrated above as location xxxx+4. Some program relative instructions (such as Jump Relative) have the displacement included in the op-code word. sav- ing memory space and execution time for short displacements. In these instructions the first byte of the next sequential instruction would be xxxx+2. instead of xxxx+4 as illustrated above. 6-17 za001 program relative addressing, in Segmented or Nonsegmented mode, follows the il- Z8001 PROGRAM lustration above; however, the Program Counter also specifies the memory segment. The dis- RELATIVE placement is added to the Za001 Program Counter Offset register. The Za001 Program ADDRESSING Counter Segment register is not changed. Thus the displacement for a program relative memo- ry address cannot cross a segment boundary. A few Z8000 jump instructions use indirect memory addressing. That is to say, the con- Z8000 INDIRECT tents of the addressed memory location are loaded into the Program Counter. Very few MEMORY microprocessors provide indirect addressing. See Volume 1, Chapter 6 for a detailed descrip- ADDRESSING tion of this addressing mode. The Z8000 instruction set includes a number of memory reference instructions with Z8000 AUTO- auto-increment and auto-decrement. An implied memory address held in a 16-bit register is INCREMENT incremented or decremented following an instruction's execution, thus leaving the address AND DECREMENT pointing to the next sequential memory location in a table or string. The Z8000 Stack decrements the Stack Pointer before a push and increments the Stack Pointer following a pop. In other words, the beginning of the Stack has the highest memory address, and the current top of Stack has the lowest memory address. Z8001 AND Z8002 PINS AND SIGNALS Signals and pin assignments for the two Z8000 series microprocessors are illustrated in Figure 6-4. ADO-AD16 is a multiplexed 16-bit Data/Address Bus. AS is an address strobe which is pulsed low while an ad- dress is being output. OS is a data strobe which is pulsed low while data is being output or input. STO-ST3 are four machine cycle status Signals whose output levels further Iyyyyl Abort if IPpppqqqq\ > Ixxxxyyyyl 6-38 The multiply instruction also has word and long word versions. The multiplicand is held in CPU Z8000 registers. The multiplier may be held in data memory. in CPU registers. or it may be provided im- MULTIPLY mediately by the multiply instruction. The product is returned in CPU registers. The word option INSTRUCTION may be illustrated as follows: 16-bit 16-bit Register. or Registers 2 memory bytes {R:~~pppp yyyy RR~ zm emz . ~ yyvy ppppqqqq P. q. y. and z represent any hexadecimal digits. RR represents a 32-bit register pair. as illustrated in Figure 6-3. Long word multiplication may be illustrated as follows: 16-bit 32-bit Register. or Registers 4 memory bytes xxxx yyyy P. q. s. t. v. w. x. and y represent any hexadecimal digts. RQ represents a 64-bit register. as illustrated in Figure 6-3. The multiply instruction treats all numbers as signed binary values. Status flags are adjusted as follows: Carry (CI. C is set for overflow or underflow. For word multiplication. underflow occurs if the answer is less than -2 15 ; overflow occurs if the answer is 2 15 or more. For long word multiplication. underflow occurs if the product is less than -2 31 ; overflow occurs if the product is 231 or more. Carry is cleared if there is no underflow or overflow. Zero (Z). The Zero status is set if the result is 0; it is cleared otherwise. Sign (S). The Sign status is set for a negative result; it is reset otherwise. The Overflow status is always cleared. The LOPS instruction is somewhat unusual in that it loads both the Program Counter and the Flag Z8000 LDPS and Control Word. Data is taken from memory as follows: INSTRUCTION Non-Segmented Segmented (Memory bytes) (Memory bytes) FCW (HI) 00 FCW (LO) 00 PC (HI) FCW (HI) PC (LO) FCW (LO) PCSEG(HI) PCSEG(LO PCOFF(HI) PCOFF(LO) The LDPS jump instruction uses indirect memory addressing. 6-39 A subroutine CALL can use segmented implied memory addressing: Z8000 SUBROUTINE RN~ CALL RR { RN+'~ The System Call instruction generates an interrupt acknowledge sequence. You will recall Z8000 from the discussion of Z8000 interrupt acknowledge logic given earlier in this chapter that an in- SYSTEM terrupt identifier is pushed onto the Stack during every interrupt acknowledge sequence. For the CALL System Call instruction, this identifier is the System Call instruction object code; the low-order byte is an 8-bit immediate data value which you specify in the instruction operand. This may be illustrated as follows: SC xx ~ 7F xX16 Note that the JP conditional jump instruction can use segmented implied memory ad- Z8000 dressing. As we might expect from a Zilog high-end microprocessor, the Z8000 has a CONDITIONAL large number of block transfer and search instructions. These instructions come in JUMP groups of eight. For each type of instruction there are four word versions and four comparable INSTRUCTIONS byte versions. The four versions include an increment. an increment and repeat. a decrement. Z8000 BLOCK and a decrement and repeat. See our earlier discussion of block transfer I/O instructions for a TRANSFER general description of these four variations. INSTRUCTIONS The LDM block transfer instructions move data between a number of 16-bit registers and memory. You can transfer data from memory words to 16-bit registers or from 16-bit registers to memory words. You can transfer from 1 to 16 words in a Single execution. Register addressing is wrap-around. For example, the in- struction: LDM R13.THERE,6 will transfer six words of data from memory to registers. in the following sequence: Memory THERE R13 THERE+2 R14 THERE+4 R15 THERE+6 RO THERE+8 R1 THERE+10 R2 Among the block transfer and search instructions there is a group of translate instructions. These are table look-up in- structions; they work as follows: TRxB @RM.@RN.RW 16-bit Registers 8-bit Memory RM I. • popp ppp-1 .....- -....... • RN ~ ----I xxxx -----~ .--r xxxx + yy zzzz---......~ zzzz+1 .....- -....... RW is decremented and RM is incremented or decremented, depending on the instruction. 6-40 As illustrated above. the contents of the destination memory location serve as an 8-bit index into a memory table. The contents of the addressed table byte replace the index. RH1 is used. and left with an undefined value. Translate instruc- tions are typically used to convert characters from one code to another. For example. a single translate instruction could convert an EBCDIC character to an ASCII character. In this case the EBCDIC character code would constitute an index into a 256-byte ASCII code table. At the location specified by the EBCDIC code. you would store the ASCII equivalent. Executing a translate instruction would then cause the ASCII equivalent of an EBCDIC code to be loaded into the memory location in which the EBCDIC code had been stored. A variation of the Translate instruction is a Translate-and-Test. which loads the addressed table byte into Register RH1. but leaves it there. The Z flag is set if RH1 is O. and Overflow is set if the counter decrements to O. ~!""""""'~~........- .. There are a deceptively large number of shift Instructions listed in the register operate Z8000 SHIFT group. In fact, the only difference between an arithmetic and a logical left shift lies in the INSTRUCTIONS Overflow status. For an arithmetic shift this status is set if the high-order (Sign) bit changes following the shift; the Overflow status is cleared otherwise. Following a logical shift the Overflow status is undefined. For right shifts the Sign bit is replicated for arithmetic shifts. while zeros are filled in for logical shifts. The only difference between a dynamic shift and a non-dynamic shift is in the location of the shift bit count. A dynamic shift takes its bit count from a CPU register. A non-dynamic shift takes its bit count from immediate data provided by the instruction operand. r--------. Note from our earUer discussion of the Z8000 Stack that the Stack address is incre- Z8000 STACK mented for a pop and decremented for a push. In other words. the bottom of the Stack has INSTRUCTIONS the highest memory address. and the top of the Stack has the lowest memory address. Four instructions control the MI input and MO output signals. They are MBIT, MREQ, Z8000 MRES, and MSET. MIANDMO MBIT simply inverts the level of the Mi input and returns it in the Sign status. INSTRUCTIONS MRES outputs a high signal via MO. while MSET outputs a low signal via MO. 6-41 MREQ uses MI and MO to request external access. This instruction uses Zero and Sign statuses. MREQ execution logic may be illustrated as follows: z=o Yes 5=0 MO= 1 MO=O Decrement Counter to 0 Yes 5=0 MO=O 5=1 Z=l When the MREQ instruction begins execution, the Zero status is cleared; it is set to 1 after MREQ has completed execu- tion if a request was signalled. The MI input is tested to see if the external resource being arbitrated is available. If MI is low, then the resource is not available; MO is output high and the Sign status is reset to O. If MI is being input high, then the external resource is available. MO is output low, then a time delay is inserted by decrementing the contents of a 16-bit register to O. This delay gives external logic time to receive and propagate MO. External logic must acknowledge the resource request by inputting MI low. In response to MI low, MREQ sets the SJ.9.!! status and the Zero status to 1. But if MI is still high after the counter has decremented to 0, then MREQ outputs MO high, resets the Sign status to 0, and sets the Zero status to 1. Therefore, following execution of the MREQ instruction, CPU logic interprets results as follows: Sign Zero MO o o o No request made o o 1 Not possible o ~} :::U:::s:~ede but not granted 1 o 1 1 o 1 o 1 1 1 1 1 Request made and granted 6-42 THE BENCHMARK PROGRAM The Z8000 can execute our benchmark program using just three instructions. We assume the following memory map: l6-bit Memory Locations NLOC IOBUF t------I NLOC+2 FREE t------I NLOC+4 COUNT · I IOB~~ I I Words • • I • IOBUF+NB · I • • • These words must be moved TABLE§ '- ·• .• 'REE'a';'" .,. • I Tobie Wo", s I , • • Using the LDM Multiple Register Load instruction. we can initialize the addresses and word count in appropriate registers for an LDIR Block Transfer and Repeat instruction. Finally. we update the address of the first free table word. Here is the necessary instruction sequence: !LOAD 10BUF STARTING ADDRESS INTO R1. TABLE STARTING !ADDRESS INTO R2. WORD COUNT INTO R3 LDM R1. NLOC. 3 LDIR @R2. @R1. R3 !MOVE DATA BLOCK LD NLOC+2. R2 !UPDATE ADDRESS OF FIRST FREE WORD IN TABLE NLOC DA 10BUF !I/O BUFFER BASE ADDRESS DA FREE !DATA TABLE FIRST FREE WORD ADDRESS DA COUNT !WORD COUNT 6-43 The nomenclature used to identify Z8000 registers is given in Figure 6-3. The following abbreviation. are u.ed in Table. 6-3, 6-4, and 6-5: addr any 16-bit nonsegmented address addrls any 32-bit long segmented address addrss any 16-bit short segmented address adrsx one of six standard memory addressing modes b8 immediate value in the range 0-7 b16 immediate value in the range 0-15 cc condition codes. as summarized in Table 6-2 data8 8-bit immediate data value data16 16-bit immediate data value data32 32-bit immediate data value disp address displacement FCW the Flags and Control Word FLAGS low-order byte of FCW flag any or all of C. S. P. O. Z int either or both of NVI. VI ioaddr an I/O device 16-bit address (I/O) an identifier specifying that the prior address is an I/O address MI the MI signal input level MO the MO signal output level MSB the most significant (high-order) bit of any data value n16 immediate value in the range 1-16 NSPOFF Normal Stack Pointer offset NSPSEG Normal Stack Pointer segment PC Program Counter PCOFF Program Counter offset PCSEG Program Counter segment PSAPOFF Program Status Area Pointer offset PSAPSEG Program Status Area Pointer segment rb any byte register rbd any byte register serving as a destination rbs any byte register serving as a source REFRESH Refresh Counter ri any 16-bit index register rid any 16-bit register providing implied destination address ris any 16-bit register providing implied source address rid any 32-bit register serving as a source rls any 32-bit register serving as a source rqd any 64-bit register serving as a destination rw any 16-bit register rwd any 16-bit register serving as a destination rws any 16-bit register serving as a source SP Stack Pointer (R15 or RR14) 6-44 Object Code b - immediate value corresponding to b8 or b16 c - condition code (see Table 6-2) d - destination register f - code for flags operated on: CZSP/V i-index or implied register. If i = 0 no register is specified n - immediate value corresponding to n16 pppp - 16-bit address word or most significant word of 32-bit address qqqq - least significant word of 32-bit address r - register 0000 = RO. RRO. ROO. or RHO 0001 = Rt or RH1 0111 = R7. or RH7 1000 = R8. RR8. R08. or RLO 1110 = R14. RR14. or RL6 1111 = R15 or RL 7 s - source register ttttttt - 7-bit unsigned displacement vv - code for interrupts (VI and/or NV\) xx - 8-bit address displacement xxx - 12-bit address displacement xxxx - 16-bit address displacement yy - 8-bit immediate data yyyy - 16-bit immediate data or most significant word of 32-bit data zzzz - least significant word of 32-bit immediate data Statuses The Z8000 has the following status flags: C - Carry status Z - Zero status S - Sign status P - Parity status o - Overflow status D - Decimal-Adjust H - Half-Carry The following symbols are used in the Status columns: x - flag is affected by operation (blank) - flag is not affected by operation 1 - flag is set by operation o - flag is reset by operation U - flag is unknown after operation [ [] ] contents of the memory location or I/O port whose address is contained in the designated register [] contents of memory location. I/O port. or register data is transferred in the direction of the arrow data is exchanged between the designated locations on both sides of the arrows V logical OR A ~g~aIAND E9 logical Exclusive OR 6-45 Instruction Mnemonics: The fixed part of an assembly language instruction is shown in UPPER CASE. the variable part (immediate data. register name. etc.) is shown in lower case. Instruction Object Codes: Instruction words are shown as hexadecimal digits with 4-bit variable fields indicated by lower case letters (e.g .. 67ib). Instruction words with variable fields that are not multiples of 4 bits are shown as a pair of hexadecimal digits followed by 8 binary bits (e.g., 7C 000001 vv) Instruction Execution Times: Tables 6-3 and 6-4 list instruction execution times in clock cycles. Real time is obtained by dividing the number of clock cycles by the clock speed. When several possible execution times are indicated (i.e .. 15-19) the number of clock cycles depends on addressing and segmentation modes. The relationship is as follows: Clock Cycles = x-y Addressing Mode Clock Cycles 2) addr x 3) addrss y-3 4) addrls y-1 5) addr(ri) x+1 6) addrss(ril y-3 7) addrls(ril y For two execution times (i.e .. 10, 15) the first is for Nonsegmented mode. the second for Segmented mode. Instruction times which depend on condition flags are indicated with a slash (i.e., 10. 15/7) with the first time(s) for condition met and the second for condition not met. Table 6-2. Condition Codes Used by the zaooo Assembly Language Instruction Set Code CC Value Meaning Status Conditions - 8 Always true Any C Carry 7 C=1 ULT Unsigned less than EQ Equal 6 Z=1 Z Zero GE 9 Signed greater than or equal S$O=O GT A Signed greater than Z V (S E9 0) = 0 LE 2 Signed less than or equal Z V (S E9 0) = 1 LT 1 Signed less than S{90=O MI 5 Minus S=1 NC No Carry F C=O UGE Unsigned greater than or equal NE Not equal E Z=O NZ Not zero NOV No overflow C PIO = 0 PO Parity is odd PE Parity is even 4 PIO = 1 OV Overflow PL 0 Plus S=O UGT B Unsigned greater than CVZ=O ULE 3 Unsigned less than or equal CVZ=1 6-46 Table 6-3. A Summary of the Z8000 Instruction Set Clock Status Type Mnemonic Operand(s) Op Code Operation Performed >-= ID Cycles H D 0 P S Z C IW rwd,@rw 30sd 2 10 [rwdl - [[rwllU/O) IN" rwd,ioaddr 3Bd4 pppp 4 12 [rwdl- [ioaddrlU/O) Input to 16-bit register rwd a data word from the 1/0 port addressed directly by ioaddr, or implied by rw. INB" rwd,@rw 3Csd 2 10 [rbdl- [[rwllU/O) INB" rwd,ioaddr 3Ad4 pppp 4 12 [rbdl - [ioaddrlU/O) Input to 8-bit register rbd a data byte from the 1/0 port addressed directly by ioaddr, or implied by rw. INO" @rid,@ris,rw 3Bs8 Ord8 4 21 X [[ridll- [[risllU/O). [ridl- [ridl- 2. [rwl- [rwl- 1 If [rwl = 0 then 0 = 1. Otherwise 0 = O. INOB" @rid,@ris,rw 3As8 Ord8 4 21 X [[ridll- [[risllU/O). [ridl - [ridl - 1. [rwl - [rwl - 1 If [rwl = 0 then 0 = 1. Otherwise 0 = O. Input a 16-bit data word (for INO) or a data byte (for INOB) from the 1/0 port implied by ris to the memory word (for INO) or byte (for INOB) implied by rid. Decrement the implied memory address in rid by 2 (for INO) or by 1 (for INOB). Decrement the 16-bit counter rw by 1. If rw m contains 0, set the Overflow status. ~ g INOR" @rid,@ris,rw 3Bs8 OrdO 4 21/10"" X [[ridll - [[risl](I/O). [ridl - [ridl- 2. [rwl - [rwl - 1 -...I If [rwl = 0 then 0 = 1. Otherwise reexecute. ~ INORB" @rid,@ris,rw 3As8 OrdO 4 21/10"" X [[ridll- [[risllU/O). [ridl- [ridl- 1. [rwl- [rwl- 1 If [rwl = 0 then 0 = 1. Otherwise reexecute. INOR and INORB are identical to INO and INOB, respectively, except that INOR and INORB are reexecuted until [rwl = O. INI" @rid,@ris,rw 3BsO Ord8 4 21 X [[ridll- [[risllU/O). [ridl- [ridl + 2. [rwl- [rwl-l If [rwl = 0 then 0 = 1. Otherwise 0 = O. INIB" @rid,@ris,rw 3AsO Ord8 4 21 X [[ridll- [[risllU/O). [ridl- [ridl + 1. [rwl- [rwl- 1 If [rwl = 0 then 0 = 1. Otherwise 0 = O. INI and INIB are identical to INO and INOB, respectively, except that rid is incremented. INIR" @rid,@ris,rw 3BsO OrdO 4 21/10"" X [[ridll- [[risllU/O). [ridl- [ridl + 2. [rwl- [rwl- 1 If [rwl = 0 then 0 = 1. Otherwise reexecute. INIRB" @rid,@ris,rw 3AsO OrdO 4 21/10"" X [[ridll - [[risllU/O). [ridl - [ridl + 1. [rwl - [rwl - 1 If Irwl = 0 then 0 = 1. Otherwise reexecute. INIR and INIRB are iden- tical to INO and INOB, respectively, except that rid is incremented; also INIR and INIRB are reexecuted until [rwl = O. OTOR" @rid,@ris,rw 3BsA OrdO 4 21/10"" X [[ridllU/O) - [[risll. [risl- [risl- 2. [rwl- [rwl- 1 If [rwll=O then reexecute. If [rwl = 0 then 0 = 1 and end execution. " Privileged instruction - can be executed only in system mode. "" Number of clock cycles depends on the number of repetitions for n/m""; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )I"m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) III Clock Status Type Mnemonic Operand(s) Op Code !>- Operation Performed III Cycles H D 0 P S Z C OTORB' @rid,@ris,rw 3AsA OrdO 4 21110" X [[ridl)(l/O) - [[ris]]. [risl- [risl- 1. [rwl- [rwl- 1 If [rwlI=O then reexecute. If [rwl = 0 then 0 = 1 and end execution. Output a block of 1S-bit words (for OTOR) or 8-bit bytes (for OTORB) from memory to an I/O port. rw specifies the number of words or bytes. Memory is addressed, using implied memory addressing, by 1S-bit register ris, which is decremented after each output. 1S-bit register rid specifies the 110 port. OTIR' @rid,@ris,rw 3Bs2 OrdO 4 21/10" X [[ridIW/O) - [[risll. [risl - [risl + 2. [rwl - [rwl - 1 If [rwll= 0 then reexecute. If [rwl = 0 then 0 = 1 and end execution. OTIRB' @rid,@ris,rw 3As2 OrdO 4 21/10" X [[rid]]U/O) - [[ris]]. [risl- [risl + 1. [rwl- [rwl- 1 If [rwll=O then reexecute. If Irwl = 0 then 0 = 1 and end execution. OTIR and OTIRB are identical to OTOR and OTORB, respectively, ex- cept that OTIR and OTIRB increment the memory address in ris. OUT' @rw,rws 3Fds 2 10 [[rwlHl/O) - Irwsl OUT" ioaddr,rws 3BsS pppp 4 12 [ioaddr)(l/O) - [rwsl ~ Output the data word from 1S-bit register rws to the I/O port ad- .. G 0) ~ c dressed directly by ioaddr or implied by rw. ~ c OUTB' @rw,rbs 3Eds 2 10 [[rwl)(l/O) - [rbsl 00 0 g OUTS' ioaddr,rbs 3AsS pppp 4 12 [ioaddr](l/O) - [rbsl g Output the data byte from 8-bit register rbs to the I/O port addressed directly by ioaddr or implied by rw. OUTO' @rid,@ris,rw 3SsA Orda 4 21 X [[ridIW/O) - [[ris]]. [risl- [risl- 2. [rwl- [rwl- 1 If [rwl = 0 then 0 = 1; otherwise 0 = O. OUTOB' @rid,@ris,rw 3AsA Orda 4 21 X [[ridIW/O) - [[ris]]. [risl- [risl- 1. [rwl- [rwl- 1 If [rwl = 0 then 0 = 1; otherwise 0 = O. Output a data word (for OUTO) or byte (for OUTOS) from the memory location addressed by 16-bit register ris to the I/O port addressed by 16-bit register rid. Oecrement ris by 2 (for OUTO) or 1 (for OUTOS). Oecrement the counter 16-bit register rw. OUTI' @rid,@ris,rw 3Bs2 Orda 4 21 X [[ridl)(l/O) - [[ris]]. [risl- [risl + 2. [rwl- [rwl- 1. If [rwl = 0 then 0 = 1; otherwise 0 = O. OUTIB' @rid,@ris,rw 3As2 Orda 4 21 X [[ridIW/O) - [[ris]]. [risl - Iris] + 1. [rwl - [rwl - 1. If [rwl = Othen 0 = 1; otherwise 0 = O. OUTI and OUTIS are identi- cal to OUTO and OUTDS, respectively, except that the memory ad- dress in ris is incremented. . .. Number Privileged instruction - can be executed only in system mode . of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )'m. - - - - Table 6-3. A Summary of the Z8000 Instruction Set (Continued) t• Clock Status Type' Mnemonic Operand Is) OpCode Operation Performed III Cycles D 0 P S Z C H SIW rwd,ioaddr 3Bd5 pppp 4 12 These instructions output "special 1/0" status via STO - ST3; other- SINB· rbd,ioaddr 3Ad5 pppp 4 12 wise, they are identical to 1/0 instructions as follows: SIND· @rid,@ris,rw 3Bs9 Ord8 4 21 X SIN - IN(l) SINB - INBll) SINOB· @rid,@ris,rw 3As9 Ord8 4 21 X SIND -INO SINOB -INOB SINOR· . @rid,@ris,rw 3Bs9 OrdO 4 21/10·· X SINOR -INOR SINORB - INORB SINORB· @rid,@ris,rw 3As9 OrdO 4 21110·· X SINI-INI SINIB -INIB SINI" @rid,@ris,rw 3Bsl Ord8 4 21 X SINIR -INIR SINIRB - INIRB 1 ~ SINIB· SINIR· @rid,@ris,rw @rid,@ris,rw 3Asl 3Bsl Ord8 OrdO 4 4 21 21/10·· X X SOTOR - OTOR SOTIR - OTIR OOTORB - OTO'iB SOTIRB - OTiMo c ~ SINIRB· @rid,@ris,rw 3Asl OrdO 4 21/10·· SOUT - OUTll) SOUTB - OUTBll) c X 0 g SOTOR· @rid,@ris,rw 3BsB OrdO 4 21/10·· X SOUTO - OUTO SOUTOB - OUTOB SOTORS· @rid,@ris,rw 3AsB OrdO 4 21110·· g SOTIR· @rid,@ris,rw 3Bs3 OrdO 4 21/10·· X X SOUTI - OUTI SOUTIS - OUTIB (1 )Only the direct addre~sing option exists for the special 110 version of, SOTIRB· @rid,@ris,rw 3As3 OrdO 4 21/10·· X this instruction. SOUr- ioaddr,rws 3Ss7 pppp 4 12 SOUTS· ioaddr,rbs 3As7 pppp 4 12 en SOUTO· @rid,@ris,rw 3SsS Ord8 4 21 X ~ SOUTOB· @rid,@ris,rw 3AsB Ord8 4 21 X co @rid,@ris,rw 3Bs3 Orda SOUTI 4 21 X SOUTIS @rid,@ris,rw 3As3 Ord8 4 21 X LO rwd,adrsx 61id pppp qqqq 4/6 9-13 [rwdl - [adrsxl LO rwd,@ris 21id 2 7 [rwd] - Urisll G) Load data from the 1 6-bit memory word addressed by adrsx or Iris] u into 16-bit register rwd. cG) LO rwd,risldisp) 31id xxxx 4 14 [rwd] - Uris] + disp] ~ II: Load into 16-bit register rwd the contents of the 16-bit memory word ~ addressed using base relative addressing. 0 LO rwd,rislrw) 71id OrOO 4 14 [rwd]- Uris] + [rwll E G) Load into 16-bit register rwd the contents of the 16-bit memory word ~ addressed using implied, indexed addressing. ~ III LOS rbd,adrsx 60id pppp qqqq 4/6 9-13 [rbdl - [adrsxl .5 LOS rbd,@ris 20id 2 7 [rbd] - [[ris]] ~ Load into 8-bit register rbd the contents of the memory byte ad- dressed by adrsx or Iris]. . .. Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m··; n =minimum number of clock cycles and m = number of clock cycles added for each additional repeti tion of operation. The number of clock cycles for an instruction which repeats k times is n + Ik-l ).m. - - - - - ---- ---- Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Status Type Mnemonic Operand Is) Op Code t'" III Clock Cycles H D 0 P S Z C Operation Performed LOB rbd,risldisp) 30id xxxx 4 14 [rbd] - [[ris] + disp] Load into 8-bit register rbd the contents of the memory byte ad- dressed using base relative addressing. I..,OB rbd,ris(rw) 70id OrOO 4 14 [rbd]- [[ris] + [rwll Load into 8-bitregister rbd the contents of the memory byte ad.- dressed using implied, indexed addressing. LOL rld,adrsx 54id pppp qqqq 4/6 12-16 [rid] - [adrsx] LOL rld,@ris 14id 2 11 [rld]-Urisll Load into 32-bit register rid the contents of the 32-bit memory loca- tion addressed by adrsx or [ris]. LOL rld,ris(disp) 35id xxx x 4 17 [rid] - [[ris] + disp] -:ae := Load into 32-bit register rid the contents of the 32-bit memory loca- !c tion addressed using base relative addressing. 0 LOL rld,ris(rw) 75id OrOO 4 17 [rid] - Uris] + [ridll g Load into 32-bit register rid the contents of the 32-bit memory loca- eu c tion addressed using implied, indexed addressing. Cf UI o i a: LO LO adrsx,rws @rid,rws 6Fis 2Fds pppp qqqq 4/6 2 11-15 8 [adrsx) - [rws) [[ridll - [rws] Store data from 16-bit register rws into memory word addressed by ~ adrsx or [rid]. E e LO rid(disp),rws 33is xxxx 4 14 [[rid) + disp) - [rws) :E Store data from 16-bit register rws into memory word addressed ~ using base relative addressing. as .5 LO rid(rw),rws 73is OrOO 4 14 [[rid] + [rwll- [rws] Ii: Store data from 16-bit register rws into memory word addressed using implied, indexed addressing. LOB adrsx,rbs 6Eis pppp qqqq 4/6 11-15 [adrsx] +- [rbs] LOB @rid,rbs 2Eds 2 8 [[ridll +- [rbs] Store data from 8-bit register rbs into memory byte addressed by adrsx or [rid]. LOB rid(disp),rbs 32is xxxx 4 14 [[rid) + disp) +- [rbs) Store data from 8-bit register rbs into memory byte addressed using base relative addressing. " Privileged instruction - can be executed only in system mode. "" Number of clock cycles depends on the number of repetitions for n/m""; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1) om. Table 6-3. A Summary of the zeooo Instruction Set (Continued) I/) Status Type Mnemonic Operand(s) Op Code ...> CD Clock Cycles Operation Performed ID H D 0 P S Z C LOB rid(rw),rbs 72is OrOO 4 14 [[rid] + [rwll- [rbs] Store data from 8-bit register rbs into memory byte addressed using implied, indexed addressing. LOL adrsx,rls 50is pppp qqqq 4/6 14-18 [adrsx] - [rls] LOL @rid,rls 1Ods 2 11 [[ridll - [rls] Store data from 32-bit register rls into 32-bit memory long word ad- dressed by adrsx or [rid]. LOL rid(disp),rls 37is xxxx 4 17 [[rid] + disp] - [rls] Store data from 32-bit register rls into 32-bit memory long word ad- dressed using base relative addressing. LOL rid(rw),rls 77is OrOO 4 17 [[rid] + [rwll- Iris] '::a Store data from 32-bit register rls into 32-bit memory long word ad- CD ~ dressed using implied, indexed addressing. 'Sc LOA rwd,adrsx 76id pppp 4 12-13 [rwd] - adrsx 0 y Load the unsegmented address into 16-bit register rwd. CD pppp qqqq 4/6 [rid] - adrsx u LOA rld,adrsx 76id 15-16 c f Load the segmented address, in segmented address format, into 32- ...~ C11 .;a: LOA rwd,ris(disp) 34id xxx x 4 15 bit register rid. [rwd] - Iris] + disp ~ LOA rld,ris(disp) 34id xxxx 4 15 [rid] - Iris] + disp 0 E Load the base relative address into 1 6-bit register rwd (nonseg- CD ~ mented mode) or 32-bit register rid (segmented model. ~ LOA rwd,ris(rw) 74id OrOO 4 15 [rwd]- Iris] + [rw] III .E LOA rld,ris(rw) 74id OrOO 4 15 [rid] - Iris] + [rw] A: Load the implied, indexed memory address into 16-bit regiser rwd (nonsegmented mode) or 32-bit register rid (segmented mode). LOAR rwd,disp16 340d xxx x 4 15 [rwd] - [PC] + disp16 Load the program relative memory address into 16-bit register rwd. LOAR rld,disp16 340d xxxx 4 15 [rld]- [PC] + disp16 Load the program relative segmented memory address, in segmented format. into 32-bit register rid. LOR rwd,disp16 310d xxx x 4 14 [rwd] - [[PC] + disp16] I LORB rbd,disp16 300d xxxx 4 14 [rbd) - [[PC] + disp16] ... I I Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repeti1tion of operation. The number of clock cycles for an instruction which repeats k times is n + (k-l ).m. - - - - ---- ----- -- i Table 6-3. A Summary of the zaooo Instruction Set (Continued) III Status Type Mnemonic Operand(s) Op Code ;. CD Clock Cycles Operation Performed H 0 0 P S Z C LDRL rld.disp16 350d xxx x 4 17 [rldl- [[PCl + disp16l "Iii Load the memory word (for LOR). byte (for LOR B) or long word (for ~! LDRU addressed using program relative addressing into the 16-bit. o c E '+I 8-bit or 32-bit register. • c ~~ LOR disp16.rws 330s xxxx 4 14 ([PC] + disp16] - [rws] ~-; E C .- ~ U III A.o! . ~ II: LDRB LDRL disp16.rbs disp16.rls 320s 370s xxxx xxxx 4 4 14 17 [[PC] + disp16] - [rbsl ([PC] + disp16] - [rls] Load the register word (for LOR). byte (for LDRB) or long word (for LDRL) into the memory location addressed using program relative ad- dressing. ADD rwd.@ris 01id 2 7 X X X X [rwdl - [rwdl + [[risll ADD rwd.adrsx 41id pppp qqqq 4/6 9-13 X X X X [rwdl - [rwdl + [adrsxl Add the contents of the addressed memory word to the 1 6-bit destination register. ADDB rbd.@ris OOid 2 7 X 0 X X X X [rbdl - [rbd] + [[risll ADDB rbd.adrsx 40id pppp qqqq 4/6 9-13 X 0 X X X X [rbd] - [rbdl + [adrsxl m (" Add the contents of the addressed memory byte to the 8-bit destina- G N U tion register. C ! AOOL rld.@ris 16id 2 14 X X X X [rid] - [rid] + [(risll ....• ADDL rld.adrsx 56id pppp qqqq 4/6 15-19 X X X X [rid] - [rid] + [adrsx] II: • Add the contents of the addressed memory long word to the 32-bit ~ 0 destination register. E ~ • AND AND rwd.@ris rwd.adrsx 07id 47id pppp 2 qqqq 4/6 7 9-13 X X X X [rwd] - [rbd] AND [[risll [rwdl - [rbd] AND [adrsx] ~ AND contents of destination 16-bit register with contents of memory III "e0 U ANDB rbd.@ris 06id 2 7 X X X word. [rbdl - [rbdl AND [[risll U) • ANDB rbd.adrsx 46id pppp qqqq 4/6 9-13 X X X [rbdl - [rbdl AND [adrsx] AND contents of destination 8-bit register with contents of memory byte. CLR @rid ODd8 2 8 [[ridll-O CLR adrsx 4Di8 pppp qqqq 4/6 11-15 [adrsxl-O Clear the memory word. CLRB @rid OCd8 2 8 ([(ridll - 0 ... Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-l ).m. Table G-3. A Summary of the Z8000 Instruction Set (Continued) !• Clock Status Type Mnemonic Operand(s) Op Code Operation Performed > Cycles III H D 0 P S Z C CU~B adrsx 4Ci8 pppp qqqq 4/6 11-15 [adrsx) - 0 Clear the memory byte. COM @rid ODdO 2 12 X X [[ridlJ - [[ridlJ COM adrsx 4DiO pppp qqqq 4/6 15-19 X X [adrsx) - [adrsx) Ones complement the memory word. COMB @rid OCdO 2 12 X X X ([ridlJ - [[ridlJ COMB adrsx 4CiO pppp qqqq 4/6 15-19 X X X [adrsx) - [adrsx) Ones complement the memory byte. CP rwd,@ris OBid 2 7 X X X X [rwd) - [[rislJ CP rwd,adrsx 4Bid pppp qqqq 4/6 9-13 X X X X [rwd) - [adrsx) ;; • ~ CPB CPB rbd,@ris rbd,adrsx OAid 4Aid pppp 2 qqqq 4/6 7 X X X X X X X X [rbd) - [[ris)J [rbd) - [adrsx) -sc CPL rld,@ris 10id 2 9-13 14 X X X X [rid) - [[rislJ 0 9 CPL rld,adrsx 50id pppp qqqq 4/6' 15-19 X X X X [rid) - [adrsx) •c u Compare contents of register and memory location. Do not modify e contents of register or memory location, but set status flags. Use 16- 0) a, i II: bit register/memory word for CP, 8-bit register/memory byte for CPB, 32-bit register/memory long word for CPL. ~ Co) CP @rid,data 1 6 ODdl yyyy 4 11 X X X X [[ridlJ - data 16 E CP adrsx,data 16 4Di1 yyyy 6/8 14-18 X X X X [adrsx) - data 1 6 • ~ pppp qqqq ~ CPB @rid,data8 OCd1 yyOO 4 11 X X X X. [[ridlJ - data8 III CPB adrsx,data8 4Cil yyOO 6/8 14-18 X X X X [adrsx) - data8 "u c 0 pppp qqqq Compare contents of memory location with immediate data. Do not • (I) modify memory location, but set status flags. Use 16-bit memory word for CP, 8-bit memory byte for CPB. DEC @rid,n16 2Bdn 2 11 X X X [[ridlJ - [[ridlJ - n 1 6 DEC adrsx,n16 6Bin pppp qqqq 4/6 13-17 X X X [adrsx) - [adrsx) - n 16 DECB @rid,n16 2Adn 2 11 X X X [[ridlJ - [[ridlJ - n 16 DECB adrsx,n16 ·6Ain pppp qqqq 4/6 13-17 X X X [adrsx) - [adrsx) - n 16 Subtract the immediate value n 1 6 from the memory word (for DEC) or memory byte (for DECB) addressed by adrsx or [rid). Values in the range 1-1 6 are subtracted. . Privileged instruction - can be executed only in system mode . .- Number of clock cycles depends on the number of repetitions for n/m--; n =minimum number of clock cycles and m = number of clock cycles added for each additional repeti.tion of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )-m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) (I) Clock Status Type Mnemonic Operand(s) Op Code S Operation Performed >- Cycles III H D 0 P S Z C DIV rld.@ris lBid 2 note 1 X X X X O;y'do } DIV rld.adrsx 5Bid pppp qqqq 4/6 note 1 X X X X Divide see text for a discussion of these instructions DIVL rqd.@ris lAid 2 note 1 X X X X Divide long DIVL rqd.adrsx 5Aid pppp qqqq 4/6 note 1 X X X X Divide long EX rwd.adrsx 6Did pppp qqqq 4/6 15-19 [rwd) - - [adrsx) EX rwd.@ris 2Dsd 2 12 [rwd) - - ([ris)) EXB rbd.adrsx 6Cid pppp qqqq 4/6 15-19 [rbd) - - [adrsx) EXB rbd.@ris 2Csd 2 12 [rbd) - - ([ris)) Exchange contents of the addressed memory location with the selected register. Use 8-bit (for EXB) or 16-bit (for EX) registers and :a memory locations. " ~ c INC @rid.n16 29dn 2 11 X X X [[rid)) - [[rid)) + n 1 6 'i0 INC adrsx.n16 69in pppp qqqq 4/6 13-17 X X X [adrsx) - [adrsx) + n 1 6 g INCB @rid.n16 28dn 2 11 X X X [[rid)) - ([rid)) + n 1 6 " Co) c INCB adrsx.n16 68in pppp qqqq 4/6 13-17 X X X [adrsx) - [adrsx) + n 1 6 e Add the immediate value n 16 to the memory word (for INC) or memo- C» I " '; a:: ry byte (for INCB) addressed by adrsx or [rid). Values in the range 1 - U'I 16 are added. ~ ~ MULT rld.@ris 19id 2 note 2 0 'X X X Multlp'y } E MULT rld.adrsx 59id pppp qqqq 4/6 note 2 0 X X X Multi I . . . . " ~ MULTL rqd.@ris 18id 2 note 2 0 X X X py Multiply long see text for a diSCUSSion of these instructions ~ MULTL rqd.adrsx 58id pppp qqqq 4/6 note 2 0 X X X Multiply long III 'a NEG @rid ODd2 2 12 X X X X [[rid)) - - ([rid)) c 0 Co) NEG adrsx 4Di2 pppp qqqq 4/6 15-19 X X X X !adrsxl - - !adrsxl " U) NEGB @rid OCd2 2' 12 X X X X ([rid)) - - ([rid)) NEGB adrsx 4Ci2 pppp qqqq 4/6 15-19 X X X X [adrsx) - - [adrsx) Replace the contents of the memory word (for NEG) or byte (for NEGB) addressed by adrsx or [rid) with its twos complement. OR rwd.@ris 05id ,2 7 X X !rwd) - [rwd) OR ([ris)) OR rwd.adrsx 45id pppp qqqq 4/6 9-13 X X [rwd) - [rwd) OR [adrsx) OR the contents of the specified 16-bit register and memory word. Place the result in the 16-bit register. ORB rbd.@ris 04id 2 7 X X X [rbd) - [rbd) OR ([ris)) - Privileged instruction - can be executed only in system mode. -- Number of clock cycles depends on the number of repetitions for n/m--; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-l )-m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Type Mnemonic Operand Is) Op Code .. S Clock Status Operation Performed >- Cycles III H D 0 P S Z C ORB rbd,adrsx 44id pppp qqqq 4/6 9-13 X X X [rbd] - [rbd] OR [adrsx] OR the contents of the specified 8-bit register and memory byte. Place the result in the 8-bit register. SUB rwd,@ris 03id 2 7 X X X X [rwd) - [rwd) - [[ris)] SUB rwd,adrsx 43id pppp qqqq 4/6 9-13 X X X X [rwd) - [rwd] - [adrsx) SUBB rbd,@ris 02id 2 7 X 1 X X X X [rbd) - [rbd) - [[ris)] SUBB rbd,adrsx 42id pppp qqqq 4/6 9-13 X 1 X X X X [rbdt - [rbd) - [adrsx) SUBL rld,@ris 12id 2 14 X X X X [rid) - [rid) - [[ris)) SUBL rld,adrsx 52id pppp qqqq 4/6 15-19 X X X X [rid) - [rid] - [adrsx) Subtract the contents of the addressed memory location from the -:0 selected destination register. Use 8-bit (for SUBB), 16-bit (for SUB) • ~ c or 32-bit (for SUBL) memory locations and registers. ';0 c TEST @rid ODd4 2 a X X X [[rid)) OR 0 0 9 TEST adrsx 4Di4 pppp qqqq 4/6 11-15 X X X [adrsx] OR 0 •0 c TESTB TESTB @rid adrsx OCd4 4Ci4 pppp 2 qqqq 4/6 a 11-15 X X X X X X X X [[ridll OR 0 [adrsx) OR 0 ! Cf> C11 .;a:: TESTL TESTL @rid adrsx lCdO 5CiO pppp 2 qqqq 4/6 13 16-20 X X X X X X [[ridll OR 0 [adrsx) OR 0 C11 ~ OR the specified memory contents with O. Set status flags. Use a 16- 0 E bit location for TEST, an 8-bit location for TESTB, and a 32-bit loca- :E• tion for TESTL. ~ TSET @rid ODd6 2 11 X [s] - [[rid)](MSB). [[rid)] - FFFF III [s) - [adrsx](MSB). [adrsx) - FFFF 'a TSET adrsx 4Di6 pppp qqqq 4/6 14-18 X c [s)- [[rid)](MSB). [[rid)] - FF 0 TSETB @rid OCd6 2 11 X 0 • en TSETB adrsx 4Ci6 pppp qqqq 4/6 14-18 X [s) - [adrsx](MSB). [adrsx) - FF Move the most significant bit of the memory word (for TSET) or byte (for TSETB) to the sign status. Then fill the word or byte with 1 bits. XOR rwd,@ris 09id 2 7 X X [rwd) - [rwd) XOR [[ris)) XOR rwd,adrsx 49id pppp qqqq 4/6 9-13 X X [rwd) - [rwd) XOR [adrsx) XORB rbd,@ris Oaid 2 7 X X X [rbd) - [rbd) XOR [[risll XORB rbd,adrsx 48id pppp qqqq 4/6 9-13 X X X [rbd) - [rbd) XOR [adrsx) Exclusive OR the contents of the addressed memory location and register. Store the result in the register. Use 16-bit memory and ::tI registers for XOR. Use a-bit memory and registers for XORB. CD ~ }> c< '02- Q.c: .. . Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m··; n =minimum number of clock cycles and m = number of clock cycles added for each additional repet ition co!!t3 ~(1)t1) of operation. The number of clock cycles for an instruction which repeats k times is n + (k-l )·m. COO)/I.) Table 6-3. A Summary of the zaooo Instruction Set (Continued) I/) Status Type Mnemonic Operand(s) Op Code ...>- a! Clock Cycles Operation Performed III H 0 0 P S Z C LO rwd,data16 210d yyyy 4 7 [rwd] - data 16 Load 16-bit immediate data into 16-bit register rwd. LO @rid,data 1 6 OOd5 yyyy 4 11 [(rid]] - data 1 6 LO adrsx,data 1 6 40i5 yyyy 6/8 14-18 [adrsx] - data 16 pppp qqqq Load 16-bit immediate data into memory word addressed by adrsx or [rid]. LOB rbd,data8 Cdyy 2 5 [rbd] - data8 !III Load immediate data byte into 8-bit register rbd. :a! LOB @rid,data8 OCd5 yyOO 4 11 [(rid]] - data8 E LOB adrsx,data8 4Ci5 yyOO 6/8 14-18 [adrsx] - data8 .5 pppp qqqq Load immediate data byte into memory byte addressed by adrsx or [rid]. LOL rld,data32 140d yyyy zzzz 6 11 [rid] - data32 Load 32-bit immediate data into 32-bit register rid. LOK rwd,b16 BOdb 2 5 [rwd]-b16 Load the immediate 4-bit value b16 into the low-order four bits of C» rwd. Clear the remaining twelve bits of rwd. a.C» PUSH (See Stack operations). JP ,@rid 1Ed8 2 10,15 [PC]- [(rid]] JP ,adrsx 5Ei8 pppp qqqq .4/6 7-11 [PC] - [adrsx] Jump to the specified memory location. This is the same as a condi- tional jump with cc = always true. JR ,disp E8xx 2 6 [PC] - [PC] + (disp-2) Jump program relative. PC is incremented to the next sequential in- struction before disp-2 is added as a signed binary number. This is a. the same as a conditional jump relative with cc = always true (blank). .,E :::J LOPS- @ris 39s0 2 12 X X X X X X X [FCW] - [(ris]]. [PC] - [(ris] + 1] (nonsegmented) 16 X X X X X X X [FCWRES1- [[ris]]. [FCW1- [[ris1 + 11. [PCSEG1- [[ris] + 21 [PCOFF] - [[ris] +3 ] (segmented) LOPS- adrsx 79iO pppp qqqq 4/6 16-17 X X X X X X X [FCW] - [adrsx]. [PC] - [adrsx+ 1] (nonsegmented) I 20-23 X X X X X X X [FCWRES1 - [adrsx1. [FCW1 - [adrsx+ 11. [PCSEG1 - ladrsx+21 [PCOFF]- [adrsx+3] (segmented) Load program status and jump as described in accompanying text. - P,;v;le..d ;n.truc';on - c.n be e,ecuted only ;n .ys.em mode. I -- Number of clock cycles depends on the number of repetitions for n/m--; n =minimum number of clock cycles and m = number of clock cycles added for each additional repeti1tion of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )-m. Table 6-3. A Summary of the zaooo Instruction Set (Continued) Statu. Type. Mnemonic Operand(.) Op Code S">- Clock Operation Performed ID Cycle. H D 0 P S Z C CALL @rid 1FdO 2. 10.15 (1) or (2). [PC] - [[ridll c a• II: CALL CALR adrsx disp 5FiO Dxxx pppp qqqq 4/6 2 12-21 10.15 (1) or (2). [PC] - [adrsx] (1) or (2). [PC] - [PC] - disp-2 Program relative memory address. Call the addressed subroutine. saving information on the Stack as .,c "a follows: 'i (1) [SP] - [SP] - 2. [(SPll - [PC] 16-bit PC (nonsegmented) CJ (2) [SP] - [SP] - 4. [[SPll - [PC] 32-bit PC (segmented) "c ',j:l RET cc 9EOc 2 10.1317 If cc is "true" then [PC] - [{SPll.[SP] - [SP] + 2 (for nonsegmented) or [SP] - [~P] + 4. (for segmented). ~ .a ~ If the condition code specified by cc is "true". return from subroutine . U) System subroutine call. See accompanying text for a description of this SC data8 7Fyy 2 33.39 instruction. ADD rwd.data16 010d yyyy 4 7 X X X X [rwd] - [rwd] + data 16 ADDB rbd.data8 OOOd yyOO 4 7 ·X 0 X X X X [rbd] - [rbd] + data8 ADDL rld.data32 160d yyyy zzzz 6 14 X X X X [rid] - [rid] + data32 Add immediate data to the destination register. Use 32-bit en data/register for ADDL. 16-bit data/register for ADD. 8-bit I (J'I data/register for ADDB. ..... AND rwd.data16 070d yyyy 4 7 X X [rwd] - [rwd] AND data 16 ANDB rbd.data8 060d yyOO 4 7 X X X [rbd] - [rbd] AND data8 ! AND immediate data with destination register contents. Use 16-bit ! & data/register for AND. 8-bit data/register for ANDB. 0 CP rwd.data16 OBOd yyyy 4 7 X X X X [rwd] - data 16 Sall Compare 16-bit register contents with immediate 16-bit data. Do not is modify register contents. but save Status flags. " E CPB rbd.dataS OAOd yyOO 4 7 X X X X [rbd] - dataS .5 Compare 8-bit register contents with immediate 8-bit data. Do not modify register contents. but save Status flags. CPL rld.data32 100d yyyy zzzz 6 14 X X X X [rid] - data32 Compare 32-bit register contents with immediate 32-bit data. Do not modify register contents. but save Status flags. CP (See secondary memory reference for memory-immediate compare in- structions.) DIV rld.data16 1BOd yyyy 4 note 1 X X X X Divide } see accompanying text for a discussion of these DIVL rqd.data32 1AOd yyyy zzzz 6 note 1 X X X X Divide long instructions - Privileged instruction - can be executed only in system mode. -- Number of clock cycles depends on the number of repetitions for n/m--; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1)-m. - - - - - - - - ----------- - Table 6-3. A Summary of the Z8000 Instruction Set (Continued) 10 Clock Status Type Mnemonic Operand(s) Op Code S Operation Performed > Cycles ID H 0 0 P S Z C MULT rld,data16 190d yyyy 4 note 2 0 X X X 'Multiply } see accompanying text for a discussion of these MULTL rqd,data32 180d yyyy zzzz 6 note 2 0 X X X Multiply long instructions OR rwd,data16 050d yyyy 4 7 X X [rwd) +- [rwd) OR data 16 OR the contents of the specified 16-bit register with the immediate ~ • :::s c ORB rbd,data8 040d yyOO 4 7 X X X data word . [rbd) +- [rbd) OR data8 .~ c OR the contents of the specified B-bit register with the immediate 0 g data byte. S SUB rwd,data16 030d yyyy 4 7 X X X X [rwd) +- [rwd) - data 16 t!CD SUBB . rbd,data8 020d yyOO 4 X 1 X X X X [rbd) +- [rbd) - data8 7 a. 0 SUBL rld,data32 120d yyyy zzzz 6 14 X X X X [rid) + - [rid) - data32 S «I Subtract immediate data from the destination register. Use 32-bit =sCD data/register for SUBL, 16-bit data/register for SUB, 8-bit E data/register for SUBB. .5 XOR rwd,data16 090d yyyy 4 7 X X [rwd) +- [rwd] XOR data 1 6 XORB rbd,data8 080d yyOO 4 7 X X X [rbd) +- [rbd] XOR data8 en Exclusive-OR the contents of the register with immediate data. Store U, the result in the register. Use 16-bit register and data for XOR. Use 8- (X) bit register and data for XORB. DJNZ rw,disp Fr 1ttttttt 2 11 [rw] +- [rw) - 1. [PC) +- [PC] + 2. If [rw] is not 0, then [PC) + - [PC] - [disp-2) DBJNZ rb,disp Fr Ottttttt 2 11 [rb] +- [rb] - 1. [PC] +- [PC) + 2. If [rb] is not 0, then c [PC) +- [PC] - [disp-2] .~ ;; Decrement a 16-bit register (for DJNZ) or an 8-bit register (for DB- c JNZ). Increment the Program Counter as per normal operation. If the 0 (J decremented register contents is not 0, then subtract twice the dis- c 0 placement, as an unsigned binary number, from the incremented Pro- a. E gram Counter, causing a branch back to a lower program memory ad- :::s dress. If the decremented register contents is 0, continue execution ~ ~ with the next instruction. u c t! ID - Privileged instruction - can be executed only in system mode. , -- Numba, of clock cvcles depend. on the numba, of ,e.e';';on. fo, n/m"; n =mlnlmum num"'" of clock CVcle. and m = numba, of clock cvcle. added fo, each addltl""al ",pell lion . of operation. The number of clock cycles for an instruction which repeats k times is n + (k-l) om. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Status !" Clock Type Mnemonic Operand(s) Op Code Operation Performed > Cycles CD H D 0 P S Z C ;; JP cC,@rid 1Edc 2 10,15/7 If cc is true, [PC) - [[rid]] 6a,"::~ JP cC,adrsx 5Eic pppp qqqq 4/6 7-11 If cc is true, [PC) - [adrsx) Jump to the memory location specified by adrsx or [rid] if condition E c: ~ 0 code cc is true. ::!y .c c: JR cC,disp Ecxx 2 6 If cc is true, [PC) - [PC) + (disp-2) u 0 Ii :E Jump program relative if condition code is true. PC is incremented to ~ 'a CD c: address the next sequential instruction before disp-2 is added as a 0 U signed binary number. EX rwd,rws AOsd 2 6 [rwd] - - [rws) CD EXB rbd,rbs ACsd 2 6 [rbd] - - [rbs] I > 0 Exchange registers' contents for 16-bit (EX) or 8-bit (EXB) registers. i::E LO rwd,rws A1sd 2 3 [rwd) - [rws] " ,- CD~ rbd,rbs AOsd 2 3 CII .. LOB [rbd) - [rbs] CD " II: "a. CD LOL rld,rls 94sd 2 5 [rid) - [rls) II: Move data between any two 16-bit registers (for LO), 8-bit registers (for LOB) or 32-bit registers (for LOll. Cf> (,J'I CPO rwd,@ris,rw,cc BBs8 Ordc 4 20 X U X U [rwd] - [[ris]]. If cc true, Z = 1. If cc false, Z = 0 CD [ris]- [ris]- 2. [rw]- [rw)- 1. If [rwl = 0,0 = 1 otherwise 0 = O. CPOB rbd,@ris,rw,cc BAs8 Ordc 4 20 X U X U [rbd] - [[ris]]. If cc true, Z = 1. If cc false, Z = O. [ris]- Iris) - 1. [rw]- [rw]- 1. If [rwl = 0,0 = 1 otherwiseO = O. .c Search a string for a condition. Compare a word in rwd (for CPO) or a ~ byte in rbd (for CPOB) with the next word (for CPD) or byte (for CPDB) II CD en in a memory string, using implied memory addressing. Register and 'a memory contents are not modified, nor are Status flags changed, but c: II ~ status conditions are compared with cc. If cc is true, Z is set to 1; -!c: otherwise Z is reset to O. Decrement the implied memory address in ! ris by 2 for CPD, or by 1 for CPDB. Decrement 16-bit counter rw by 1. ~ If rw is 0, set 0 to 1; otherwise reset 0 to O. ~ CPDR rwd,@ris,rw,cc BBsC Ordc 4 20/9-- X U X U See CPD. S 20/9-- ii CPDRB rbd,@ris,rw,cc BAsC Ordc 4 X U X U See CPOB. CPO and CPOB are identical to CPO and CPOB, respectively, except that instruction execution is repeated until either Z or 0 status is 1. In- terrupts will be acknowledged between reexecutions. - Privileged instruction - can be executed only in system mode. -- Number of clock cycles depends on the number of repetitions for n/m--; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )-m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) In Clock Status Type Mnemonic Operand(s) Op Code t CD Cycles H D 0 P S Z C Operation Performed CPI rwd,@ris,rw,cc BBsO Ordc 4 20 X U X U [rwdl - [[ris]]. If cc true, Z = 1. If cc false, Z = O. [risl- [risl + 2. [rwl- [rwl- 1. If [rwl = 0, 0 = 1; otherwise 0 = O. CPIB rbd,@ris,rw,cc BAsO Ordc 4 20 X U X U [rbdl - [[ris]]. If cc true, Z = 1. If cc false, Z = O. [risl - [risl + 1. [rwl - [rwl - 1. If [rwl = 0, 0 = 1; otherwise 0 = O. CPI and CPIB are identical to CPO and CPOB, respectively, except that the implied memory address in ris is incremented by 2 for CPI, or by 1 for CPIB. CPIR rwd,@ris,rw,cc BBs4 Ordc 4 20/9·· X U X U See CPI. CPIRB rbd,@ris,rw,cc BAs4 Ordc 4 20/9·· X U X U See CPIB. CPIR and CPIRB are identical to CPO and CPDB, respectively, except that the implied memory address in ris is incremented by 2 for CPI, or -:sII :s by 1 for CPIB, and instruction execution is repeated until either Z or 0 !c status is 1. Interrupts will be acknowleged between reexecutions. 0 CPSO @rid,@ris,rw,cc BBsA Ordc 4 25 X U X U [[rid]] - [[ris]]. If cc true, Z = 1. If cc false, Z = O. ~ [ridl- [ridl- 2. [risl- [risl- 2. [rwl- [rwl- 1. ~ If [rwl = 0,0 = 1; otherwise 0 = o. .,e CPSOB @rid,@ris,rw,cc BAsA Ordc 4 25 X U X U [[rid]] - [[risll. If cc true, Z = 1. If cc false, Z = O. ~ II CI) en oa [ridl - [ridl - 1. [risl - [risl - 1. [rwl - [rwl - 1. o c., If [rwl = 0, 0 = 1; otherwise 0 = O. .! In Compare two strings for a condition. Compare the next word (for c CPSO) or byte (for CPSOB) in a source string with the next word (for ! CPSO) or byte (for CPSOB) in a destination string. Both strings are ad- ~ dressed using implied memory addressing. No memory contents are 8 modified, nor are any Status flags changed, but status conditions are iii compared with cc. If cc is true, Z is set to 1. Otherwise Z is reset to O. Decrement the implied memory addresses in ris and rid by 2 for CPSD, or by 1 for CPSOB. Decrement 16-bit counter rw by 1. If rw is 0, set 0 to 1. Otherwise reset 0 to O. CPSDR @rid,@ris,rw,cc BBsE Ordc 4 25/14·· X U X U See CPSD. CPSDRB @rid,@ris,rw,cc BAsE Ordc 4 25/14·· X U 'X U See CPSDB. CPSDR and CPSDRB are identical to CPSD and CPSDB, respectively, except that the instructions are reexecuted until either Z or 0 status is 1. Interrupts are acknowleged between reexecutions. ... Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m··; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 ).m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Status Type I Mnemonic Operand(s) Op Code t ID Clock Cycles H DIOIPISlzlC Operation Performed CPSI @rid,@ris,rw,cc;1 BBs2 Ordc 4 25 X U I X I U I [[ridll- [[risll. If cc is true Z = 1. If cc is false, Z = o. [rid] +- [rid] + 2. [ris] +- [ris] + 2. [rw] +- [rw] - 1. If [rw] = 0,0 = 1; otherwise 0 = O. CPSIB l@rid,@ris,rw,cc:1 BAs2 Ordc 4 I 25 X U I X I U I [[ridll - Uris]]. If cc is true, Z = 1 . If cc is false, Z = O. [rid] - [rid] + 1. Iris] - Iris] + 1. [rw] - [rw] - 1. If trw] = 0,0 = 1; otherwise 0 = O. CPSI and CPSIB are identical to CPSD and CPS DB, respectively, ex- cept that the implied memory addresses in rid and ris are incremented by 2 (for CPS!) or by 1 (for CPSIB). CPSIR CPSIRB I@rid,@ris,rw,ccl BBs6 @rid,@ris,rw,cc BAs6 Ordc Ordc 4 4 I 25/14** 25/14** X X U U III X . X· U See CPSI. USee CPSIB. i~ CPSIR and CPSIRB are identical to CPSD and CPSDB, respectively, ~ except that the implied memory addresses in rid and ris are incre- g mented by 2 (for CPSIR) or by 1 (for CPSIRB) and the instructions are ~ reexecuted until either Z or 0 status is 1. Interrupts are acknowleged .I: f between reexecutions. ca 0) GI LDD I @rid,@ris,rw I BBsS Ord8 4 I 20 X [(ridll - [(ris]]. [rid] - [rid] - 2. Iris] - [ris] - 2. m ..... en ~ [rw]- [rw]- 1. If [rw] = 0,0 = 1; otherwise 0 = O. ca LDDB I @rid,@ris,rw 'BAs9 Ord8 4 I 20 X [(ridll - [[risll. [rid] - [rid] - 1. [ris] - [ris] - 1. [rw]- [rw]- 1. If [rw] = 0,0 = 1; otherwise 0 = O. ~ .;c Transfer a word (for LDD) or a byte (for LDDB) from the memory loca- ~ tion addressed by register ris to the memory location addressed by .JJt rid. Decrement addresses in rid and ris by 2 (for LDD) or 1 (for LDDB). g Decrement the counter rw by 1. If rw contains 0, set the Overflow ii status to 1. LDDR @rid,@ris,rw I BBs9 OrdO 4 20/9** [[ridll - [[risll. [rid] - [rid] - 2. Iris] - Iris] - 2. [rw]- [rw]- 1. If [rw] :1=0, reexecute. If [rwl = 0, 0 = 1 and end execution. LDDRB @rid,@ris,rw I BAsS OrdO 4 20/S** [(ridll - [[risll. [rid] - [rid] - 1. Iris] - [ris] - 1. [rwl- [rwl - 1. If [rw] :1=0, reexecute. If [rw] = 0,0 = 1 and end execution. LDDR and LDDRB are identical to LDD and LDDB, respectively, except that LDDR and LDDRB reexecute until rw has decremented to O. LDI @rid,@ris,rw I BBs 1 Ord8 4 20 X [[ridll - [(risll. [rid] - [rid] + 2. [ris] - [ris] + 2. [rw]- [rw]- 1. If [rw] = 0 then 0 = 1; otherwise 0 = O. * Privileged instruction - can be executed only in system mode. Number of clock cycles depends on the number of repetitions for n/m**; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )*m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) 10 Clock Status Type Mnemonic Operand(s) Op Code ! Operation Performed > Cycles CD H D 0 P S Z C LOIB @rid,@ris,rw BAs1 Ord8 4 20 X [[ridll - [[ris]). [rid] - [rid] + 1. [ris] - [ris] + 1. [rw] - [rwl - 1. If [rwl = 0, then 0 = 1; otherwise 0 = O. LOI and LOIB are identical to LOO and LOOB, respectively, except that the source and destination addresses ris and rid are incremented by 2 (for LOn or 1 (for LOIB). LOIR @rid,@ris,rw BBs1 OrdO 4 20/9" 1 [[ridll- [[risll. [ridl- [ridl + 2. [risl- [risl + 2. [rwl - [rwl - 1. If [rwl #= 0 then reexecute. If [rwl = 0 then 0 = 1 and end execution. LOIRB @rid,@ris,rw BAs1 OrdO 4 20/9" 1 [[ridll- [[risll. [ridl- [ridl + 1. [risl- [risl + 1. [rwl- [rwl - 1. If [rwl #=0 then reexecute. ;; If [rwl = 0 then 0 = 1 and end execution. • ~ LDiR and LOIRB are identical to LOO and LOOB, respectively, except ·ac that the source and destination addresses ris and rid are incremented; 0 also, LOIR and LOIRB are reexecuted until rw decrements to O. Y LDM rwd,@ris.n16 1 Cs1 OdOn 4 14/3" [rwdl - [[risll do n 16 times incrementing register and memory ad- .c 2 dresses • IV en LDM rwd,adrsx,n 16 5Ci1 OdOn 6/8 17-21/3" [rwd] - [adrsx] do n 1 6 times incrementing register and memory ad- m i') en ~ pppp qqqq dresses .. c II $. Move a block of n 1 6 memory words from memory to 1 6-bit registers. adrsx or @ris addresses the first, lowest addressed memory word. 10 c rwd addresses the first 16-bit register. n16 can have any value from t! 1 to 16. (See accompanying text for more details.) t- ~ u LOM @ris,rws,n16 1Cd9 OsOn 4 14/3" ([risll - [rwsl do n16 times incrementing register and memory ad- 0 dresses iii LDM adrsx,rws,n 1 6 5Ci9 OsOn 6/8 17-2113" [adrsxl - [rwsl do n16 times incrementing register and memory ad- pppp qqqq dresses This instruction is identical to the one above, except that data moves from registers to memory. Register contents are not affected. TROB @rid,@ris,rw B8d8 OrsO 4 25 X U ([ridll- [[ris] + IIridlll. [rw]- [rwl- 1. [ridl- [ridl- 1. Translate a memory byte, as described in the accompanying text. Decrement the destination address in rid and the'byte counter in rw. If rw = 0, set 0 to 1. If rw #= 0, reset 0 to O. Byte register RH 1 contents is lost. I ... Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 ).m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) I) Clock Status Type Mnemonic Operand(s) Op Code S Operation Performed > Cycles H D C CD 0 P S Z TRDRB @rid,@ris,rw B8de OrsO 4 25/14·· 1 U ([rid]) - ([ris] + ([rid]]]. [rw] - [rw] - 1. [rid] - [rid] - 1. If [rw] = 0,0 = 1 and end execution. If [rw] #:0, reexecute. This instruction is identical to TRDB, except the instruction is reex- ecuted until [rw] = O. TRIB @rid,@ris,rw B8dO OrsO 4 25 X U ([rid)) - [[ris] + [[rid]]]. [rw] - [rw] - 1. [rid] - [rid] + 1 TRIB is identical to TRDB except that the destination address in rid is incremented. TRIRB @rid,@ris,rw B8d4 OrsO 4 25/14·· 1 U [[rid)) - [[ris] + [[rid]]]. [rw] - [rw] - 1. [rid] - [rid] + 1. If [rw] = 0, 0 = 1 and end execution. If [rw] #: 0, reexecute. TRIRB is identical to TRDB except that the destination address in rid is incremented; also, TRIRB is reexecuted until [rw] = O. -:aII TRTDB @rid,@ris,rw B8dA OrsO 4 25 X X [RH1)- [[ris] + [[rid]]]. [rw] - [rw]- 1. [rid] - [rid)- 1. :::s Load a table byte into 8-bit register RH 1, as described in the accom- ~e 0 panying text. Reset Z status to 0 if [RH 1] #: O. Set Z status to 1 if Y [RH 1] = O. Decrement destination address rid and byte counter rw. If ~ e rw = 0, 0 = 1. If rw #: 0, 0 = o. 0) II II TRTDRB @rid,@ris,rw B8dE OrsE 4 25/14·· X X [RH 1] - [[ris) + [[ridnJ. [rw] - [rw] - 1. [rid] - [rid] - 1 0, en If [rw] = 0,0 = 1.lf [rw] #:0, 0 = O. If [RH1] = 0, Z = 1; otherwise Co) 'a e II Z = O. TRTDRB is identical to TRTDB except that TRTDRB is re- ... executed until 0 = 1 or Z = O. .! I) e TRTIB @rid,@ris,rw B8d2 OrsO 4 25 X X [RH 1] - [[ris] + [[rid]]]. [rw] - [rw] - 1. [rid] - [rid] + 1 ! TRTIB is identical to TRTDB except that TRTIB increments the t- .Jt. destination address in rid . S TRTIRB @rid,@ris,rw B8d6 OrsE 4 25/14·· X 'X [RH1] - [[ris] + [[rid]]]. [rw] - [rw) - 1. [rid] - [rid] + 1 iii If [rw] = 0,0 = 1. If [rw] #:0, 0 = O. If [RH1] = 0, Z = 1; otherwise Z = O. TRTlRB is identical to TRTDB except that TRTIRB ~ncrements the destination address in rid and reexecutes until 0 = 1 or Z = O. :tJ ~ ... 1> c< Privileged instruction - can be executed only in system mode . 'Ost Q.c: Number of clock cycles depends on the number of repetitions for n/m··; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition 00 111 3 of operation. The number of clock cycles for an instruction which repeats k times is n + (k-' ).m. !,.iCD - Operation Performed ID Cycles H D 0 P S Z C ADC rwd,rws B5sd 2 5 X X X X [rwd) - [rwd) + [rws) + C ADCB rbd,rbs B4sd 2 5 X 0 X X X X [rbd] - [rbd] + [rbs] + C Add the source register contents plus the initial Carry to the destina- tion register. Use 16-bit registers for ADC. Use 8-bit registers for ADCB. ADD rwd,rws 81sd 2 4 X X X X [rwd) - [rwd) + [rws) ADDB rbd,rbs 80sd 2 4 X 0 X X X X [rbd) - [rbd) + [rbs) ADDL rld,rls 96sd 2 8 X X X X [rid) - [rid) + [rls) Add the Source register contents to the Destination register. Use 32- bit registers for ADDL, 16-bit registers for ADD and 8-bit registers for ADDB. AND rwd,rws 87sd 2 4 X X [rwd)- [rwd) AND [rws) ANDB rbd,rbs 86sd 2 4 X X X [rbd) - [rbd) AND [rbs) ! AND the Source register contents with the Destination register con- I! II tents. Use 16-bit registers for AND and 8-bit registers for ANDB. a. 0 CP rwd,rws 8Bsd 2 4 X X X X [rwd) - [rws) CJ) 0, i (I) Compare 16-bit register contents by subtracting the Source register "m from the Destination register values. Do not modify any register con- ~ II IE: tents, but set Status flags. i (I) CPB rbd,rbs 8Asd 2 4 X X X X [rbdl - [rbsl Compare 8-bit register contents by subtracting the Source register "m II from the Destination register values. Do not modify any register con- IE: tents, but set Status flags. CPL rld,rls 90sd 2 8 X X X X [rid) - [rlsl Compare 32-bit register contents by subtracting the Source register from the Destination register values. Do not modify any register con- tents, but set Status flags. DIV rld,rws 9Bsd 2 note 1 X X X X Divide }see text for a discussion of these instructions OIVL rqd,rls 9Asd 2 note 1 X X X X Divide long MULT rld,rws 99sd 2 note 2 0 X X X MUltiPlY} see text f or a d'Iscusslon . 0 f th ese'instructions . MULTL rqd,rls 98sd 2 note 2 0 X X X Multiply long - Privileged instruction - can be executed only in system mode. -- Number of clock cycles depends on the number of repetitions for n/m--; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )-m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) IfI Status Type.. Mnemonic Operand(s) Op Code ;. III Clock Cycles HIDIOIPlslZIC Operation Performed OR rwd,rws 85sd 2 4 [rwd] - [rwd] OR [rws] XIX ORB rbd,rbs 84sd 2 4 XIX X [rbd] - [rbd] OR [rbs] OR the contents of the Source register with the Destination register contents. Use 1 6-bit registers for OR and 8-bit register for ORB. RLDB rbd,rbs BEsd 2 9 U I IXI X Left rotate BCD digits in two 8-bit registers specified by rbd and rbs. The same register cannot be specified for rbd and rbs. Digits are ro- tated as follows: ~ Gl :s !c: rbd 76543210 ----- -I 76543210 I I I I I I I I I I I I I I I I I Irbs -..- •.--~ ---- , o g S + 1+'--------1 m !Gl RRDB rbd,rbs BCsd 2 9 U XIX Right rotate BCD digits in two 8-bit registers specified by rbd and rbs. m UI a. o The same register cannot be specified for rbd and rbs. Digits are ro- tated as follows: ! _L III '61 ~ S ~ 76543210 -L 7 6 543 2 1 0 -- IfI '61 II II: rbdl I I I I I I I I I I I I I I I I ,rbs -..---..-- '----~+I + SBC SBCB rwd,rws rbd,rbs B7sd B6sd 2 2 5 5 X 11 1X x X X I I I X X X X [rwd] - [rwd] - [rws] - C [rbd] - [rbd] - [rbs] - C Subtract the Source register contents, plus the initial Carry, from the Destination register contents using twos complement arithmetic. Use 16-bit registers for SBC. Use 8-bit registers for SBCB. • Privileged instruction - can be executed only in system mode. Number of clock cycles depends on the number of repetitions for n/m··; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 ).m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Status Type Mnemonic Operand Is) Op Code !'" Clock Operation Performed > Cycles III H 0 0 P S Z C SUB rwd,rws 83sd 2 4 X X X X [rwd] - [rwd] - [rws] ! SUBB rbd,rbs 82sd 2 4 X 1 X X X X [rbd] - [rbd] - [rbs] i 0_ SUBl rld,rls 92sd 2 8 X X X X [rid] - [rid] - [rls] Subtract the Source register contents from the Destination register. !1 '" ~ c Use 32-bit registers for SUBl, 16-bit registers for SUB, 8-bit registers for SUBB. '61 II C I:C 0 XOR rwd,rws 89sd 2 4 X X [rwd] - [rwd] XOR [rws] .(,) S- XORB rbd,rbs 88sd 2 4 X X X [rbd] - [rbd] XOR [rbs] Exclusive-OR the contents of Source and Destination registers. Store '"II '61 the result in the Destination register. Use 16-bit registers for XOR. I:C Use 8-bit registers for XORB. ClR rwd 8Dd8 2 7 [rwd]-O Clear the Selected Word register. ClRB rbd 8Cd8 2 7 [rbd]-O Clear the Selected Byte register. m COM rwd 8DdO 2 7 [rwd] - [rWcI] en m Complement the Selected Word register. COMB rbd 8CdO 2 7 [rbd] - [rbd] Complement the Selected Byte register. DAB rbd BOdO 2 5 X X X Decimal adjust contents of 8-bit register rbd. ! DEC rwd,n16 ABdn 2 4 X X X [rwd] - [rwd] - n 1 6 f II DECB rbd,n16 AAdn 2 4 X X X [rbd] - [rbd] - n 1 6 Q. 0 ! .. Subtract the immediate value n 16 from a 16-bit register (for DEC) or an 8-bit register (for DECB). '"'iiiII EXTS rid B1dA 2 11 Bits 16 to 31 of [rid] - bit 15 of [rid]. I:C The sign bit of the low-order word of the register pair is copied into all bits of the high-order word of the register pair. EXTSB rwd BldO 2 11 Bits 8 to 1 5 of [rwd] - bit 7 of [rwd] The sign bit of the low-order byte of the register is copied into all bits of the high-order byte of the register. EXTSL rqd Bld7 2 11 Bits 32 to 63 of [rqd] - bit 31 of [rqd] The sign bit of the low-order register pair of the Quadruple register is copied into all bits of the high-order register pair. " Privileged instruction - can be executed only in system mode. "" Number of clock cycles depends on the number of repetitions for n/m""; n =minimum number of clock cycles and m = number of clock cycles added for each additional ~epetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )"m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Type Mnemonic Operand(s) Op Code III S Clock Status Operation Performed I > Cycles C III H D 0 P S Z INC rwd,n16 A9dn 2 4 X X X [rwd] - [rwd] + n 16 INCB rbd,n16 A8dn 2 4 X X X [rbd] +- [rbd] + n 1 6 Add the immediate value n 16 to a 16-bit register (for INC) or an 8-bit register (for INCB). NEG rwd 8Dd2 2 7 X X X X [rwd] +- - [fwd] NEGB rbd 8Cd2 2 7 X X X X [rbd] - - [rbd] Replace the contents of the 1 6-bit register (for NEG) or 8-bit register (for NEGB) with its twos complement. RL rwd,1 B3d8 2 6 X X X X Left rotate contents of word (for RU or byte (for RLB) register, n bits RL rwd,2 B3dA 2 7 X X X X (n = 1 or 2), as follows: RLB rbd,1 B2d8 2 6 X X X X ~ I I I I I I I I I I I I I I 13J RLB rbd,2 B2dA 2 7 X X X X ~ GI :::s c ~ I I I I I I I~ :;::; c 0 0) g m ..,J ! t! See accompanying text for a discussion of the Overflow status for all GI a. Register Operate shift and rotate instructions. 0 ... RLC rwd,1 B3dO 2 6 X X X X Left rotate through Calrry contents of word (for RLC) or byte (for SIII RLC rwd,2 B3d2 2 7 X X X X RLCB) register, n bits (n = 1 or 2), as follows: .& GI RLCB rbd,1 B2dO 2 6 X X X X a: Lm-i I I I I I I I I I I I I I I I;J RLCB rbd,2 B2d2 2 7 X X X X ~ I I I I I I I~ • P··I d . f an be executed only in system mode. nVI ege Instruc Ion - c .. f Im o ,. n =minimum number of clock I •• Number of clock cycles depends on the number of. repetlt~ons ~~ n ~ats k times is n + (k-1). eyc es and m = number of clock cycles added for each additional repeti tion h of operation. The number of clock cycles for an instruction w IC re m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Type I Mnemonic I Operand(s) 1/1 Clock Status Operation Performed Op Code t III Cycles H 0 0 P S Z C RR rwd,1 B3dC 2 6 X X X Right rotate contents of word (for RR) or byte (for RRB) register, n bits X RR rwd,2 B3dE 2 7 X X X X (n = 1 or 2), as follows: RRB rbd,1 B2dC 2 6 X X X liJ X RRB rbd,2 B2dE 2 7 X X X X rn-4 I I RRC rwd,1 B3d4 2 6 X X X X m-41 I I 1 I~ Right rotate through Carry contents of word (for RRC) or byte (for RRC rwd,2 B3d6 2 7 X X X X RRCB) register, n bits (n = 1 or 2), as follows: RRCB rbd,1 B2d4 2 6 X X X X ~ G) = ~c 0 ~ RRCB rbd,2 B2d6 2 7 X X X X [ffi:F liJ en m 00 ! I! G) I§:tl I I I --1+1 a. 0 "- .SOA rwd,rw B3dB OrOO 4 18/3" X X X X Shift arithmetic the contents of a byte (for SOAB) word (for SOA) or !1/1 rbd,rw OrOO 18/3" X X X X long word (for SOAL) register. [rwJ specifies the number of shift bit SOAB B2dB 4 '61 G) SOAL rld,rw B3dF OrOO 4 18/3" X X X X positions, and the direction (+ for left shift, - for right shift). 0 shift a:: is allowed; it causes no shift, but sets status. [rwJ value range is -8 to +8 for SOAB. -16 to + 16 for SOA -32 to +32 for SOAL. Bits 0 to 4 of [rwl are active, with bit 15 used for sign. Shifts occur as fu follows: R;ght Left ~I I :J--f£] 0--lII:!: ]-r I ~O 7 6 2 0 --SOAB- 7 6 2 0 1514 2 1 0 --SOA- 1514 2 1 0 31 30 2 1 0 --SOAL - 31 30 2 1 0 Bit Numbers Bit Numbers • Privileged instruction - can be executed only in system mode. Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 )·m. Copyright © 1 979 McGraw-Hili, Inc. Table 6-3, A Summary of the Z8000 Instruction Set (Continued) Type I Mnemonic I Operand(s) Op Code = Clock Status Operation Performed I :- Cycles HIDIOIPISIZIC SOL rwd,rw B3d3 OrOO 4 18/3·· u X SOL, SOLB and SOLL are equivalent to SOA, SOAB and SOAL, SOLB rbd,rw B2d3 OrOO 4 18/3. 0 u XIX X X X respectively, but they perform logical right shifts, Left shifts are iden- SOLL rld,rw B3d7 OrOO 4 18/3 0 • u X X X tical. Shifts may be illustrated as follows: Right Left m~1 I I J.--E£] [§MIl~1 I~ 7 6 2 0 -SOLB --+ 7 6 2 0 1514 2 0 - SOL--+ 1514 2 0 31 30 2 0 - SOLL--+ 3130 2 0 SLA rwd,data16 B3d9 yyyy 4 16/3·· X X x X SLA, SLAB and SLAL are identical to SOA, SOAB and SOAL, respec- SLAB rbd,data16 B2d9 yyyy 4 16/3·· X X X X tively, when these instructions are performing left shifts, except that SLAL rld,data16 B3dO yyyy 4 16/3 0 • X X X X SLA, SLAB and SLAL specify the shift bit count immediately. 1 'S= c SLL rwd,data16 B3d1 yyyy 4 16/3·· u X X X SLL, SLLB and SLLL are identical to SOL, SOLB and SOLL, respec- o SLLB rbd,data16 " B2d1 yyyy 4 16/3·· u X X X tively, when these instructions are performing left shifts, except that g 0) SLLL rld,data16 B3d5 yyyy 4 16/3 00 u X X X SLL, SLLB and SLLL specify the shift bit count immediately. m co ! ! & SRA rwd,data16 B3d9 yyyy 4 16/3 00 o X X X SRA, SRAB and SRAL are identical to SOA, SOAB and SDAL, respec- o SRAB rbd,data16 B2d9 yyyy 4 16/3·· o X X X tively, when these instructions are performing right shifts, except that ... !III SRAL rld,data16 B3dO yyyy 4 16/3·· o X X X SRA, SRAB, and SRAL specify the shift bit count immediately. '61 ~ SRL rwd,data16 B3d1 yyyy 4 16/3·· u X X X SRL, SRLB, and SRLL are identical to SOL, SOLB, and SOLL, respec- SRLB rbd,data16 B2d1 yyyy 4 16/3·· u X X X tively, when these instructions are performing right shifts, except that SRLL rld,data16 B3d5 yyyy 4 16/3·· u X X X SRL, SRLB and SRLL specify the shift bit count immediately. TSET rwd 80d6 2 7 X [s]- [rwd)(MSB),[rwd]- FFFF TSETB rbd 8Cd6 2 7 X [s]- [rbd](MSB), [rbd] - FF Move the most significant bit of the 16-bit register (for TSET) or 8-bit TEST TESTB TESTL rwd rbd rid 80d4 8Cd4 9CdO 2 2 2 7 7 13 XIXXIXX X [rbd] OR 0 X X [rwd] OR 0 X X I register (TSETB) to the Sign status. Then fill the register with 1 bits. [rid] OR 0 OR the specified register contents with O. Set Status flags based on :u CD the result. Test a 32-bit register for TESTL, a 16-bit register for TEST ~ and an 8-bit register for TESTB. }> c< • Privileged instruction - can be executed only in system mode. '02- Q.c: .. Number of clock cycles depends on the number of repetitions for n/m··; n =minimum number of clock cycles and m = number of clock cycles added for each additional repeti'tion qo~i of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1).m, .... coo)'" Table 6-3. A Summary of the zaooo Instruction Set (Continued) II) Clock Status Type Mnemonic Operand(s) Op Code S Operation Performed >- Cycles H D ID 0 P S Z C LOCTL' NSPSEG,rws 70sE 2 7 [NSPSEG] - [rws] LOCTL' rwd,NSPSEG 70d6 2 7 [rwd] - [NSPSEG] Transfer data between a 16-bit register and tahe Z8001 normal Stack Pointer Segment Address register (R 14N). LOCTL' NSPOFF,rws 70sF 2 7 [NSPOFF] - [rws] LOCTL' rwd,NSPOFF 70d7 2 7 [rwd] - [NSPOFF] Transfer data between a 16-bit register and the normal Stack Pointer Address register (R15N). POP rwdl@ris 97sd 2 8 [rwd] - [[ris]], Iris] - Iris] + 2 POP @rid,@ris 17sd 2 12 [[rid]] - [[ris]!. Iris] - Iris] + 2 POP adrsx,@ris 57si pppp qqqq 4/6 15-19 [adrsx] - [[ris]!. Iris] - Iris] + 2 Pop the memory word addressed by ris, the designated Stack Pointer. Any register with the exception of RO (for non segmented) or RRO (for segmented) can be designated as the Stack Pointer. The popped word is loaded into a 16-bit register, or the memory location addressed by adrsx or [rid]. 0) POPL rld,@ris 95id 2 12 [rid] - [[ris]], Iris] - Iris] + 4 ~ .!.J u POPL @rid,@ris 15id 2 19 [[rid]] - [[ris]], Iris] - [risl + 4 o S (I) POPL adrsx,@ris 55si pppp qqqq 4/6 22-26 [adrsxl - [[ris]], Iris] - Iris] + 4 POPL is identical to POP, except that a 32-bit long word is popped. PUSH @rid,rws 93is 2 9 [ridl- [rid]- 2.[[rid]]- [rws] PUSH @rid,@ris 13is 2 13 [rid] - [rid] - 2. [[rid]] - [[ris]] PUSH @rid,adrsx 53di pppp qqqq 4/6 13-17 [rid]- [rid] - 2. [[rid]]- [adrsx] PUSH @rid,data 16 OOd9 yyyy 4 12 [rid] - [rid] - 2. [[rid]] - data16 Push a 16-bit word onto a memory stack addressed by rid, the desig- nated Stack Pointer. Any register with the exception of RO (for non- segmented) or RRO (for segmented) can be designated as the Stack Pointer. The pushed word can come from a register, the memory word addressed by adrsx or Iris!. or it may be immediate data. PUSHL @rid,rls 91is 2 12 [rid] - [rid] - 4. [[rid]] - [rls] PUSHL @rid,@ris 11 is 2 20 [rid] - [rid] - 4. [[rid]] - [[ris]] PUSHL @rid,adrsx 51di pppp qqqq 4/6 20-24 [rid] - [rid] - 4. [[rid]] - [adrsx] PUSHL is identical to PUSH except that a 32-bit long word is pushed, also there is no immediate version of PUSHL. • Privileged instruction - can be executed only in system mode. •• Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repeti tion of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1).m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) Type Mnemonic Operand(s) Op Code .." III >- m Clock Cycles H D 0 Status P S Z C Operation Performed BIT rwd,b16 A7db 2 4 X Z - NOT bit b16 of [rwdl BIT @rid,b16 27ib 2 8 X Z - NOT bit b16 of [[rid]] BIT adrsx,b16 67ib pppp qqqq 4/6 10-14 X Z - NOT bit b 16 of [adrsxl BIT rwd,rws 270s OdOO 4 10 X Z - NOT bit [rwsl of [rwdl Set the Z status to the complement of the specified bit, which may be in a 16-bit register or memory word. The bit may be specified im- mediately, or for a register it may be specified by the low-order four bits of a 16-bit register. BITB rbd,b8 A6db 2 4 X Z - NOT bit b8 of [rbdl BITB @rid,b8 26ib 2 8 X Z - NOT bit b8 of [[rid]] BITB adrsx,b8 66ib pppp qqqq 4/6 10-14 X Z - NOT bit b8 of [adrsxl BITB rbd,rws 260s OdOO 4 10 X Z - NOT bit [rwsl of [rbdl Set the Z status to the complement of the specified bit, which may be in an 8-bit register or memory byte. The bit may be specified im- fII mediately, or for a register it may be specified by the low-order three c 0 bits of one of the registers RO - R7. 0) '+l ! RES rwd,b16 A3db 2 4 Bit b16 of [rwdl - 0 .!.J 0" RES @rid,b16 23ib 2 11 Bit b16 of [[rid]]- 0 .a. iD RES RES adrsx,b16 rwd,rws 63ib 230s pppp OdOO qqqq 4/6 4 13-17 10 Bit b 16 of [adrsxl - 0 Bit [rwsl of [rwdl +- 0 Clear the specified bit, which may be in a 16-bit register or memory word. The bit may be specified immediately, or for a register it may be specified by the low-order four bits of a 16-bit register. RESB rbd,b8 A2db 2 4 Bit b8 of [rbdl +- 0 RESB @rid,b8 22ib 2 11 Bit b8 of [[rid]] - 0 RESB adrsx,b8 62ib pppp qqqq 4/6 13-17 Bit b8 of [adrsxl - 0 RESB rbd,rws 220s OdOO 4 10 Bit [rwsl of [rbdl - 0 Clear the specified bit, which may be in an 8-bit register or memory byte. The bit may be specified immediately, or for a register it may be specified by the low-order three bits of one of the registers AO - A7. ... Privileged instruction - cali be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n ~ (k-11.m. Table 6-3. A Summary of the Z8000 Instruction Set (Continued) 1/1 Status Type Mnemonic Operand(s) Op Code ; III Clock Cycles H D 0 P S Z C Operation Performed ~ SET rwd,b16 A5db 2 4 Bit b16 of [rwd)- 1 G> :s SET @rid,b16 25ib 2 11 Bit b16 of [[rid]) - 1 ~c SET adrsx,b16 65ib pppp qqqq 4/6 13-17 Bit b 16 of [adrsx] - 1 0 SET rwd,rws 250s OdOO 4 10 Bit [rws) of [rwd) - 1 g 1/1 SETB rbd,b8 A4db 2 4 Bit b8 of [rbd] c SETB @rid,b8 24ib 2 11 Bit b8 of [[rid]] ~ SETB adrsx,b8 64ib pppp qqqq 4/6 13-17 Bit b8 of [adrsx] t! G> SETB rbd,rws 240s OdOO 4 10 Bit [rws] of [rbd] .. 0 iii a. SET and SETB instructions are equivalent to RES and RESB instruc- tions, respectively, except that the selected bit is set. 01' int 7C OOOOOOvv 2 6 Oisable the indicated interrupt(s). Either or both of VI and NVI may be indicated. EI' int 7C 00000lvv 2 6 Enable the indicated interrupt(s). Either or both of VI and NVI may be indicated. IRET' 7BOO 2 13,16 X X X X X X X [SP)- [SP] + 2. [FCW]- [[SP]]: [SP]- [SP) + 2. [PC]- [[SP]] [SP) - [SP] + 2. (Nonsegmented) ~ [SP] - [SP] + 2. [FCW] - [[SP]]. [SP] - [SP) + 2. [PC] - [[SP]] ...... N [SP] - [SP] + 4. (Segmented) Return from interrupt. Pop and discard identifier word. Pop flag and control word. Pop Program Counter. . a. LOCTL' LOCTL' PSAPSEG,rws rwd,PSAPSEG 70sC 70d4 2 2 7 7 [PSAPSEG] - [rws] [rwd] - [PSAPSEG] E These two instructions transfer data between the 28001 Program ! .s Status Area Pointer Segment register, and a 16-bit general purpose register. LOCTL' PSAPOFF,rws 70s0 2 7 [PSAPOFF] - [rws] LOCTL' rwd,PSAPOFF 70d5 2 7 [rwd] - [PSAPOFF] These two instructions transfer data between the Program Status Area Pointer and a 16-bit general purpose register. ... Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-l )'m. -- Table 6-3. A Summary of the Z8000 Instruction Set (Continued) I/) Clock Status Type Mnemonic Operand(s) Op Code t CD Cycles H D 0 P S Z C Operation Performed COMFLG flag 80f5 2 7 X X X X X Complement each status named in the operand. Any or all of C, Z, S, P, or 0 may be named in any order. LOCTL' FCW,rws 70sA 2 7 X X X X X X X [FCW) - [rws) Load register contents into FCW. Unassigned bits of FCW are not affected. LOCTL' rwd,FeW 70d2 2 7 [rwd] - [FeW] Load Few contents into selected register. Unassigned bits of FeW are reset to 0 in rwd. LOeTLB FLAGS,rbs 8es9 2 7 X X X X X X X [FLAGS] - [rbs] Load byte register contents into low-order byte of FeW. Bits 0 and 1, which are unassigned, are not affected. LOeTLB rbd,FLAGS 8ed1 2 7 [rbd] - [FLAGS] Load the low-order byte of FCW into byte register rbd. Bits 0 and 1 of rbd are reset to O. RESFLG flag 80f3 2 7 X X X X X Reset to 0 each status named in the operand. SETFLG flag 80f1 2 7 X X X X X Set to 1 each status named in the operand. ~ I/) -....I ~ TCC cC,rwd AFdc 2 5 If cc is "true" then set bit 0 of Register rwd. Otherwise reset bit 0 of W S (I) Register rwd. TeeB cC,rbd AEdc 2 5 If cc is "true" then set bit 0 of Register rbd. Otherwise reset bit 0 of Register rbd. . .. Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m"; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-11·m. - - - - - Table 6-3. A Summary of the Z8000 Instruction Set (Continued) CII Status Clock Type Mnemonic Operand(s) Op Code t III Cycles H D 0 P S Z C Operation Performed HALT 7AOO 2 8/3"" Halt CPU until reset or interrupt LDCTL" REFRESH,rws 7DsB 2 7 [REFRESH I - [rwsl Transfer the contents of the specified 16-bit register into the Dynamic Memory Refresh Control register. LDCTL" rwd,REFRESH 7Dd3 2 7 [rwdl-[REFRESHI Transfer the contents of the Dynamic Memory Refresh Control. register to the specified 16-bit register. MBIT" 7BOA 2 7 X [SI-Mi - _I Set Sign status to 1 if MI is input low (1). Reset Sign status to 0 if MI is input high (01. MREQ" rwd 7BdD 2 12/7"" X X [ZI- O. If Mi = 1 then [SI- 0 and [MOI- O. If Mi = 0 then [MOI- 1. Decrement [rwdl to O. If Mi is still 0 then [SI - O. [MOl - O. gc If Mi is now 1 then [SI - 1. 0 [ZI-1. 0 CII Execute a multi-micro bus request, as described in accompanying ~ C» III text. .:., "c MRES" 7B09 2 5 [MOI-O .J:I. III j Output MO high. Go MSET" 7B08 2 5 [MOI-1 ~ Output MO low. e fi NOP 8007 2 7 No operation. 0 " Privileged instruction - can be executed only in system mode. "" Number of clock cycles depends on the number of repetitions for n/m""; n =minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-11"m. Table 6-4. Z8000 Instruction Set Object Codes Clock Clock Mnemonic Object Code Bytes Mnemonic Object Code Bytes Cycles Cycles AOC rwd,rws B5sd 2 5 CALR disp Oxxx 2 10/15 AOCB rbd,rbs B4sd 2 5 CLR adrsx 40i8 4/6 11-15 ADD rwd,adrsx 41id 4/6 9-13 pppp pppp qqqq qqqq rwd 80d8 2 7 rwd,data16 010d 4 7 @rid OOdB 2 8 yyyy CLRB adrsx 4Ci8 4/6 11-15 rwd,rws B1sd 2 4 pppp rwd,@ris 01id 2 7 qqqq AOOB rbd,adrsx 40id 4/6 9-13 rbd BCdB 2 7 pppp @rid OCdB 2 B qqqq COM adrsx 40iO 4/6 15-19 rbd,dataB OOOd 4 7 pppp yyOO qqqq rbd,rbs BOsd 2 4 rwd BOdO 2 7 rbd,@ris OOid 2 7 @rid OOdO 2 12 AOOL rld,adrsx 56id 4/6 15-19 COMB adrsx 4CiO 4/6 15-19 pppp pppp qqqq qqqq rld,data32 160d 6 14 rbd BCdO 2 7 yyyy @rid OCdO 2 12 zzzz COMFLG flag BOf5 2 7 rld,rls 96sd 2 8 CP adrsx,data 16 4Di1 6/B 14-18 rld,@ris 16id 2 14 yyyy AND rwd,adrsx 47id 4/6 9-13 pppp pppp qqqq qqqq rwd,adrsx 4Bid 4/6 9-13 rwd,data16 070d 4 7 pppp yyyy qqqq rwd,rws B7sd 2 4 rwd,data16 OBOd 4 7 rwd,@ris 07id 2 7 yyyy ANOB rbd,adrsx 46id 4/6 9-13 rwd,rws BBsd 2 4 pppp rwd,@ris OBid 2 7 qqqq @rid,data16 00d1 4 11 rbd,dataB 060d 4 7 yyyy yyOO CPB adrSX,data8 4Ci1 6/B 14-18 rbd,rbs B6sd 2 4 yyOO rbd,@ris 06id 2 7 pppp BIT adrsx,b16 67ib 4/6 10-14 qqqq pppp rbd,adrsx 4Aid 4/6 9-13 qqqq pppp rwd,b16 A7db 2 4 qqqq @rid,b16 27ib 2 8 rbd,dataB OAOd 4 7 rwd,rws 270s 4 10 yyOO OdOO rbd,rbs BAsd 2 4 BITB adrsx,bB 66ib 4/6 10-14 rbd,@ris OAid 2 7 pppp @rid,dataB OCd1 4 11 qqqq yyOO rbd,b8 A6db 2 4 CPL rld,adrsx 50id 4/6 15-19 @rid,bB 26ib 2 B pppp rbd,rws 260s 4 10 qqqq OdOO rld,data32 100d 6 14 CALL adrsx 5FiO 4/6 12-21 yyyy pppp zzzz qqqq rld,rls 90sd 2 B @rid 1FdO 2 10/15 rld,@ris 10id 2 14 6-75 Table 6-4. zaooo Instruction Set Object Codes (Continued) Clock Clock Mnemonic Object Code Bytes Mnemonic Object Code Bytes Cycles Cycles CPO rwd,@ris,rw,cc BBsS 4 20 DIVL rqd,adrsx 5Aid 4/6 note 1 Ordc pppp CPOB rbd,@ris,rw,cc BAsS 4 20 qqqq Ordc rqd,data32 1AOd 6 note 1 CPOR rwd,@ris,rw,cc BBsC 4 20/9" yyyy Ordc zzzz CPORB rbd,@ris,rw,cc BAsC 4 20/9" rqd,rls 9Asd 2 note 1 Ordc rqd,@ris 1Aid 2 note 1 CPI rwd,@ris,rw,cc BBsO 4 20 DJNZ rw,disp Fr Ottttttt 2 11 Ordc DBJNZ rb,disp Fr 1ttttttt 2 11 CPIB rbd,@ris,rw,cc BAsO 4 20 'EI int 7C 00OOO1vv 2 6 Ordc EX rwd,adrsx 6Did 4/6 15-19 CPIR rwd,@ris,rw,cc BBs4 4 20/S" pppp Ordc qqqq CPIRB rbd,@ris,rw,cc BAs4 4 20/9" rwd,rws ADsd 2 6 Ordc rwd,@ris 2Dsd 2 12 CPSD @rid,@riS,rw,cc BBsA 4 25 EXB rbd,adrsx 6Cid 4/6 15-19 Ordc pppp CPSDB @rid,@ris,rw,cc BAsA 4 25 qqqq Ordc rbd,rbs ACsd 2 6 CPSDR @rid,@ris,rw,cc BBsE 4 25/14" rbd,@ris 2Csd 2 12 Ordc EXTS rid B1dA 2 11 CPSDRB @rid,@ris,rw,cc BAsE 4 25/14" EXTSB rwd 81dO 2 11 Ordc EXTSL rqd B1d7 2 11 CPSI @rid,@ris,rw,cc BBs2 4 25 'HALT 7AOO 2 S/3" Ordc 'IN rwd,ioaddr 3Bd4 4 12 CPSIB @rid,@ris,rw,cc BAs2 4 25 pppp Ordc rwd,@rw 3Dsd 2 10 CPSIR @rid,@riS,rw,cc BBs6 4 25/14" 'INB rbd,ioaddr 3Ad4 4 12 Ordc pppp CPSIRB @rid,@ris,rw,cc BAs6 4 25/14" rbd,@rw 3Csd 2 10 Ordc INC adrsx,n16 69in 4/6 13-17 DAB rbd BOdO 2 5 pppp DEC adrsx,n16 6Bin 4/6 13-17 qqqq pppp rwd,n16 A9dn 2 4 qqqq @rid,n16 29dn 2 11 rwd,n16 ABdn 2 4 INCB adrsx,n16 6Sin 4/6 13-17 @rid,n16 2Bdn 2 11 pppp DECB adrsx,n16 6Ain 4/6 13-17 qqqq pppp rbd,n16 A8dn 2 4 qqqq @rid,n16 2Sdn 2 11 rbd,n16 AAdn 2 4 'INO @rid,@ris,rw 3Bs8 4 21 @rid,n16 2Adn 2 11 Ord8 '01 int 7C OOOOOOvv 2 6 'INDB @rid,@ris,rw 3As8 4 21 DIV rld,adrsx 5Bid 4/6 note 1 Ord8 pppp 'INOR @rid,@ris,rw 3BsS 4 21110" qqqq OrdO rld,data16 1BOd 4 note 1 'INORB @rid,@riS,rw 3As8 4 21110" yyyy OrdO rld,rws SBsd 2 note 1 'INI @rid,@ris,rw 3BsO 4 21 rld,@ris 1Bid 2 note 1 Ord8 . .. Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m"; n = minimum number of clock cycles and m = number of clock cycles added for each 'additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k- H ·m. 6-76 Table 6-4. Z8000 Instruction Set Object Codes (Continued) Clock Clock Mnemonic Object Code Bytes Mnemonic Object Code Bytes Cycles Cycles ·INIB @rid,@ris,rw 3AsO 4 21 LOB rbd,ris(rw) 70id 4 14 Ord8 (Cont.) OrOO ·INIR @rid,@ris,rw 3BsO 4 21/10·· rbd,@ris 20id 2 7 OrdO rid(disp),rbs 32is 4 14 ·INIRB @rid,@ris,rw 3AsO 4 21/10·· xxxx OrdO rid(rw),rbs 72is 4 14 ·IRET 7BOO 2 13,16 OrOO JP cC,adrsx 5Eic 4/6 7-11 @rid,data8 OCd5 4 11 pppp yyOO qqqq @rid,rbs 2Eds 2 8 cC,@rid 1Edc 2 10,15/7 LOL adrsx,rls 50is 4/6 14-18 JR cC,disp Ecxx 2 6 pppp LO adrsx,data 16 40i5 6/8 14-18 qqqq yyyy rld,adrsx 54id 4/6 12-16 pppp pppp qqqq qqqq adrsx,rws 6Fis 4/6 11-15 rld,data32 140d 6 11 pppp yyyy qqqq zzzz rwd,adrsx 61id 4/6 9-13 rld,rls 94sd 2 5 pppp rld,ris(disp) 35id 4 17 qqqq xxx x rwd,data16 210d 4 7 rld,ris(rw) 75id 4 17 yyyy OrOO rwd,rws A1sd 2 3 rld,@ris 14id 2 11 rwd,ris (disp) 31id 4 14 rid(disp),rls 37is 4 17 xxx x xxxx rwd.ris(rw) 71id 4 14 rid(rwl,rls 77is 4 17 OrOO OrOO rwd,@ris 21id 2 7 @rid.rls 10ds 2 11 rid (displ.rws 33is 4 14 LOA rld,adrsx 76id 4/6 13-16 xxx x pppp rid (rwl.rws 73is 4 14 qqqq OrOO rld,ris(disp) 34id 4 15 @rid,data 16 OOd5 4 11 xxxx yyyy rld.ris(rw) 74id 4 15 @rid.rws 2Fds 2 8 OrOO LOB adrsx,data8 4Ci5 6/8 14-18 rwd.adrsx 76id 4 12-13 yyOO pppp pppp rwd.ris(disp) 34id 4 15 qqqq xxxx adrsx,rbs 6Eis 4/6 11-15 rwd.ris(rw) 74id 4 15 pppp OrOO qqqq LOAR rld,disp 340d 4 15 rbd,adrsx 60id 4/6 9-13 xxxx pppp rwd.disp 340d 4 15 qqqq xxxx rbd,data8 Cdyy 2 5 rbd,rbs AOsd 2 3 rbd,ris(disp) 30id 4 14 xxxx . .. Privileged instruction - can be executed only in system mode . Number of clock cycles depends on the number of repetitions for n/m··; n = minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 ).m. 6-77 Table 6-4. Z8000 Instruction Set Object Codes (Continued) Clock Clock Mnemonic Object Code Bytes Mnemonic Object Code Bytes Cycles Cycles 'LDcn FCW,rws 70sA 2 7 LORB disp,rbs 320d 4 14 NSPOFF,rws 70sF 2 7 xxxx NSPSEG,rws 70sE 2 7 rbd,disp 300d 4 14 PSAPOFF,rws 70s0 2 7 xxxx PSAPSEG,rws 70sC 2 7 LORL disp,rls 370s 4 17 REFRESH,rws 70sB 2 7 xxxx rwd,FCW 70d2 2 7 rld,disp 350d 4 17 rwd,NSPOFF 70d7 2 7 xxxx rwd,NSPSEG 70d6 2 7 'MBIT 7BOA 2 7 rwd,PSAPOFF 70d5 2 7 'MREQ rwd 7BdO 2 12/7" rwd,PSAPSEG 70d4 2 7 'MRES 7B09 2 5 rwd,REFRESH 70d3 2 7 'MSET 7B08 2 5 LOClLB FLAGS,rbs 8Cs9 2 7 MULT rld,adrsx 59id 4/6 note 2 rbs,FLAGS 8Cd1 2 7 pppp LOO @rid,@ris,rw BBs9 4 20 qqqq Ord8 rld,data16 190d 4 note 2 L008 @rid,@ris,rw BAs9 4 20 yyyy Ord8 rld,rws 99sd 2 note 2 LOOR @rid,@ris,rw BBs9 4 20/9" rld,@ris 19id 2 note 2 OrdO MULTL rqd,adrsx 58id 4/6 note 2 LOORB @rid,@ris,rw BAs9 4 20/9" pppp OrdO qqqq LOI @rid,@ris,rw BBs1 4 20 rqd,data32 180d 6 note 2 Ord8 yyyy LOIB @rid,@ris,rw BAs 1 4 20 zzzz Ord8 rqd,rls 98sd 2 note 2 LOIR @rid,@ris,rw BBs1 4 20/9" rqd,@ris 18id 2 note 2 OrdO NEG adrsx 40i2 4/6 15-19 LOIRB @rid,@ris,rw BAs1 4 20/9" pppp OrdO qqqq LOK rwd,b16 BOdb 2 5 rwd 80d2 2 7 LOM adrsx,rws,n 1 6 5Ci9 6/8 17-21/3*· @rid 00d2 2 12 OsOn NEGB adrsx 4Ci2 4/6 15-19 pppp pppp qqqq qqqq rwd,adrsx,n 1 6 5Ci1 6/8 ~7-21/3*' rbd 8Cd2 2 7 OdOn @rid OCd2 2 12 pppp NOP 8007 2 7 qqqq OR rwd,adrsx 45id 4/6 9-13 rwd,@ris,n 16 1Cs1 4 14/3" pppp OdOn qqqq @rid,rws,n16 1Cd9 4 14/3" rwd,data16 050d 4 7 OsOn yyyy 'LOPS adrsx 79iO 4/6 16-23 rwd,rws 85sd 2 4 pppp rwd,@ris 05id 2 7 qqqq @ris 39s0 2 12,16 LOR disp,rws 330s 4 14 xxxx rwd,disp 310d 4 14 xxxx , Privileged instruction - can be executed only in system mode. " Number of clock cycles depends on the number of repetitions for n/m"; n = minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 I,m. 6-78 Table 6-4. Z8000 Instruction Set Object Codes (Continued) Clock Clock Mnemonic Object Code Bytes Mnemonic Object Code Bytes Cycles Cycles ORB rbd,adrsx 44id 4/6 9-13 RES adrsx,b16 63ib 4/6 13-17 pppp pppp qqqq qqqq rbd,data8 040d 4 7 rwd,b16 A3db 2 4 yyOO rwd,rws 230s 4 10 rbd,rbs 84sd 2 4 OdOO rbd,@ris 04id 2 7 @rid,b16 23ib 2 11 'OTOR @rid,@ris,rw 3BsA 4 21/10" RESB adrsx,b8 62ib 4/6 13-17 OrdO pppp 'OTORB @rid,@ris,rw 3AsA 4 21/10" qqqq OrdO rbd,b8 A2db 2 4 'OTIR @rid,@ris,rw 3Bs2 4 21/10" rbd,rws 220s 4 10 OrdO OdOO 'OTIRB @rid,@ris,rw 3As2 4 21/10" @rid,b8 22ib 2 11 OrdO RESFLG flag 80f3 2 7 'OUT ioaddr,rws 3Bs6 4 12 RET cc 9EOc 2 10,13/7 pppp RL rwd,1 B3d8 2 6 @rw,rws 3Fds 2 10 rwd,2 B3dA 2 7 'OUTB ioaddr,rbs 3As6 4 12 RLB rbd,1 B2d8 2 6 pppp rbd,2 B2dA 2 7 @rw,rbs 3Eds 2 10 RLC rwd,1 B3dO 2 6 'OUTO @rid,@ris,rw 3BsA 4 21 rwd,2 B3d2 2 7 Ord8 RLCB rbd,1 B2dO 2 6 'OUTOB @rid,@ris,rw 3AsA 4 21 rbd,2 B2d2 2 7 Ord8 RLOB rbd,rbs BEsd 2 9 'OUTI @rid,@ris,rw 3Bs2 4 21 RR rwd,1 B3dC 2 6 Ord8 rwd,2 B3dE 2 7 'OUTIB @rid,@ris,rw 3As2 4 21 RRB rbd,1 B2dC 2 6 Ord8 rbd,2 B2dE 2 7 POP adrsx,@ris 57si 4/6 15-19 RRC rwd,1 B3d4 2 6 pppp rwd,2 B3d6 2 7 qqqq RRCB rbd,1 B2d4 2 6 rwd,@ris 97sd 2 8 rbd,2 B2d6 2 7 @rid,@ris 17sd 2 12 RROB rbd,rbs BCsd 2 9 POPL adrsx,@ris 55si 4/6 22-26 SBC rwd,rws B7sd 2 5 pppp SBCB rbd,rbs B6sd 2 5 qqqq SC data8 7Fyy 2 33,39 rld,@ris 95id 2 12 SOA rwd,rw B3dB 4 18/3" @rid,@ris 15id 2 19 OrOO PUSH @rid,adrsx 53di 4/6 13-7 SOAB rbd,rw B2dB 4 18/3" pppp OrOO qqqq SOAL rld,rw B3dF 4 18/3" @rid,data1 6 OOd9 4 12 OrOO yyyy SOL rwd,rw B3d3 4 18/3" @rid,rws 93is 2 9 orOo @rid,@ris 13is 2 13 SOLB rbd,rw B2d3 4 18/3" PUSHL @rid,adrsx 51di 4/6 20-24 OrOO pppp SOLL rld,rw B3d7 4 18/3" qqqq Oroa @rid,rls 91is 2 12 @rid,@ris 11 is 2 20 . Privileged instruction - can be executed only in system mode . ,. Number of clock cycles depends on the number of repetitions for n/m"; n = minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-11.m. 6-79 Table 6-4. Z8000 Instruction Set Object Codes (Continued) Clock Clock Mnemonic Object Code Bytes Mnemonic Object Code Bytes Cycles Cycles SET adrsx,b16 65ib 4/6 13-17 'SOTIA @rid,@ris,rw 3Bs3 4 21/10" pppp OrdO qqqq 'SOTIAB @rid,@ris,rw 3As3 4 21/10" rwd,b16 A5db 2 4 OrdO rwd,rws 2505 4 10 'SOUT ioaddr,rws 3Bs7 4 12 OdOO pppp @rid,b16 25ib 2 11 'SOUTB ioaddr,rbs 3As7 4 12 SETB adrsx,b8 64ib 4/6 13-17 pppp pppp 'SOUTO @rid,@ris,rw 3BsB 4 21 qqqq OrdB rbd,b8 A4db 2 4 'SOUTDB @rid,@ris,rw 3AsB 4 21 rbd,rws 240s 4 10 OrdB OdOO 'SOUTI @rid,@ris,rw 3Bs3 4 21 @rid,b8 24ib 2 11 OrdB SETFLG flag 8Df1 2 7 'SOUTIB @rid,@ris,rw 3As3 4 21 'SIN rwd,ioaddr 3Bd5 4 12 OrdB pppp SAA rwd,data16 B3d9 4 16/3" 'SINB rbd,ioaddr 3Ad5 4 12 yyyy pppp SAAB rbd,data16 B2d9 4 16/3" 'SIND @rid,@ris.rw 3Bs9 4 21 yyyy Ord8 SAAL rld,data16 B3dD 4 16/3" 'SINDB @rid,@ris,rw 3As9 4 21 yyyy Ord8 SAL rwd,data16 B3d1 4 16/3" 'SINDA @rid,@ris,rw 3Bs9 4 21/10" yyyy OrdO SALB rbd,data16 B2d1 4 16/3" 'SINDAB @rid,@ris,rw 3As9 4 21/10" yyyy OrdO SALL rld.data16 B3d5 4 16/3" 'SINI @rid,@riS,rw 3Bs1 4 21 yyyy Ord8 SUB rwd,adrsx 43id 4/6 9-13 'SINIB @rid,@ris,rw 3As1 4 21 pppp Ord8 qqqq 'SINIA @rid,@ris.rw 3Bs1 4 21/10" rwd,data16 030d 4 7 OrdO yyyy 'SINIAB @rid.@riS,rw 3As1 4 21/10" rwd,rws 83sd 2 4 OrdO rwd.@ris 03id 2 7 SLA rwd,data16 B3d9 4 16/3" SUBB rbd,adrsx 42id 4/6 9-13 yyyy pppp SLAB rbd,data16 B2d9 4 16/3" qqqq yyyy rbd,data8 020d 4 7 SLAL rld,data16 B3dC 4 16/3" yyOO yyyy rbd,rbs 82sd 2 4 SLL rwd.data16 B3d1 4 16/3" rbd,@ris 02id 2 7 yyyy SUBL rld,adrsx 52id 4/6 15-19 SLLB rbd,data16 B2d1 4 16/3" pppp yyyy qqqq SLLL rld.data16 B3d5 4 16/3" rld,data32 120d 6 14 yyyy yyyy 'SOTDA @rid,@riS,rw 3BsB 4 21/10" zzzz OrdO rld,rls 92sd 2 8 'SOTDAB @rid,@ris.rw 3AsB 4 21/10" rld,@ris 12id 2 14 OrdO TCC cC,rwd AFdc 2 5 , Privileged instruction - can be executed only in system mode. " Number of clock cycles depends on the number of repetitions for n/m"; n = minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + (k-1 I,m. 6-80 Table 6-4. Z8000 Instruction Set Object Codes (Continued) Clock Clock Mnemonic Object Code Bytes Mnemonic Object Code Bytes Cycles Cycles TCCB cC,rbd AEdc 2 5 TRTIB @rid,@ris,rw B8d2 4 25 TEST adrsx 4Di4 4/6 11-15 OrsO pppp TRTIRB @rid,@ris,rw B8d6 4 25/14*- qqqq OrsE rwd 8Dd4 2 7 TSET adrsx 4Di6 4/6 14-18 @rid ODd4 2 8 pppp TESTB adrsx 4Ci4 4/6 11-15 qqqq pppp rwd 8Dd6 2 7 qqqq @rid ODd6 2 11 rbd 8Cd4 2 7 TSETB adrsx 4Ci6 4/6 14-18 @rid OCd4 2 8 pppp TESTL adrsx 5CiO 4/6 16-20 qqqq pppp rbd 8Cd6 2 7 qqqq @rid OCd6 2 11 rid 9CdO 2 13 XOR rwd,adrsx 49id 4/6 9-13 @rid 1CdO 2 13 pppp TRDB @rid,@ris,rw B8d8 4 25 qqqq OrsO rwd,data16 090d 4 7 TRDRB @rid,@ris,rw B8dC 4 25/14-- yyyy OrsO rwd,rws 89sd 2 4 TRIB @rid,@ris,rw B8dO 4 25 rwd,@ris 09id 2 7 OrsO XORB rbd,adrsx 48id 4/6 9-13 TRIRB @rid,@ris,rw B8d4 4 25/14** pppp OrsO qqqq TRTDB @rid,@ris,rw B8dA 4 25 rbd,data8 080d 4 7 OrsO yyOO TRTDRB @rid,@ris,rw B8dE 4 25/14-* rbd,rbs 88sd 2 4 OrsE rbd,@ris 08id 2 7 * Privileged instruction - can be executed only in system mode. *" Number of clock cycles depends on the number of repetitions for n/m**; n = minimum number of clock cycles and m = number of clock cycles added for each additional repetition of operation. The number of clock cycles for an instruction which repeats k times is n + {k-1 )·m. Note 1 DIV DIVL Divisor Not Divisor is Dividend Not Divisor Dividend Aborted Zero Too Large Aborted is Zero Too Large adrsx 96-100 14-18 26-29 724-728 31-35 52-56 All Others 95 13 25 723 30 51 Note 2 MULl MULTL Multiplier Multiplier Multiplier Normal Normal is Zero is Zero adrsx 71-75 19-22 283 + 7-m - 287 + 7*m 31-35 All Others 70 18 282 + 7*m 30 6-81 Table 6-5. zaooo Object Codes Object Code Instruction Object Code Instruction OOOd yyOO ADDB rbd.data8 1Aid DIVL rqd,@ris OOid ADDB rbd.@ris 1BOd yyyy DIV rld.data16 010d yyyy ADD rwd.data16 1Bid DIV rld.@ris 01id ADD rwd.@ris 1CdO TESTL @rid 020d yyOO SUBB rbd.data8 1Cs10dOn LDM rwd,@ris.n 16 02id SUBB rbd.@ris 1Cd90s0n LDM @rid.rws,n1 6 030d yyyy SUB rwd.data16 1Dds LDL @rid,rls 03id SUB rwd.@ris 1Edc JP cc.@rid 040d yyOO ORB rbd.data8 1FdO CALL @rid 04id ORB rbd.@ris 20id LOB rbd,@ris 050d yyyy OR rwd.data16 210d yyyy LD rwd,data16 05id OR rwd.@ris 21id LD rwd,@ris 060d yyOO ANDB rbd.data8 220s OdOO RESB rbd,rws 06id ANDB rbd.@ris 22ib RESB @rid,b8 070d yyyy AND rwd.data16 230s OdOO RES rwd,rws 07id AND rwd.@ris 23ib RES @rid.b16 080d yyOO XORB rbd,data8 240s OdOO SETB rbd,rws 08id XORB rbd,@ris 24ib SETB @rid,b8 090d yyyy XOR rwd,data16 250s OdOO SET rwd,rws 09id XOR rwd,@ris 25ib SET @rid,b16 OAOd yyOO CPB rbd,data8 260s OdOO BITB rbd.rws OAid CPB rbd,@ris 26ib BITB @rid,b8 OBOd yyyy CP rwd,data16 270s OdOO BIT rwd.rws OBid CP rwd.@ris 27ib BIT @rid,b16 OCdO COMB @rid 28dn INCB @rid,n16 OCd1 yyOO CPB @rid.data8 29dn INC @rid,n16 OCd2 NEGB @rid 2Adn DECB @rid,n16 OCd4 TESTB @rid 2Bdn DEC @rid,n16 OCd5 yyOO LOB @rid.data8 2Csd EXB rbd.@ris OCd6 TSETB @rid 2Dsd EX rwd,@ris OCd8 CLRB @rid 2Eds LOB @rid,rbs ODdO COM @rid 2Fds LD @rid,rws ODd1 yyyy CP @rid.data 1 6 300d xxxx LDRB rbd,disp ODd2 NEG @rid 30id xxxx LOB rbd.ris(disp) ODd4 TEST @rid 310d xxx x LOR rwd,disp ODd5 yyyy LD @rid.data 1 6 31 id xxxx LD rwd,ris (disp) ODd6 TSET @rid 320s xxxx LDRB disp,rbs ODd8 CLR @rid 32is xxxx LOB ridldisp),rbs ODd9 yyyy PUSH @rid,data1 6 330s xxxx LOR disp.rws 100d yyyy zzzz CPL rld,data32 33is xxxx LD ridldisp).rws toid CPL rld,@ris 340d xxxx LDAR rld,disp 11 is PUSHL @rid.@ris rwd,disp 120d yyyy zzzz SUBL rld,data32 34id xxxx LOA rld.risldisp) 12id SUBL rld.@ris rwd.ris(disp) 13is PUSH @rid,@ris 350d xxxx LDRL rld,disp 140d yyyy zzzz LDL rld.data32 35id xxx x LDL rld,ris Idisp) 14id LDL rld.@ris 370s xxxx LDRL disp,rls 15id POPL @rid,@ris 37is xxxx LDL ridldisp).rls 160d yyyy zzzz ADDL rld.data32 39s0 LOPS @ris 16id ADDL rld,@ris 3AsO OrdO INIRB @rid,@ris.rw 17sd POP @rid,@ris 3AsO Ord8 INIB @rid.@ris,rw 180d yyyy zzzz MULTL rqd.data32 3As1 OrdO SINIRB @rid.@ris,rw 18id MULTL rqd,@ris 3As1 Ord8 SINIB @rid,@ris.rw 190d yyyy MULT rld,data16 3As20rdO OTIRB @rid,@ris.rw 19id MULT rld.@ris 3As20rd8 OUTIB @rid.@ris.rw 1AOd yyyy zzzz DIVL rqd.data32 3As30rdO SOTIRB @rid.@ris,rw 6-82 Table 6-5. Z8000 Object Codes (Continued) Object Code Instruction Object Code Instruction 3As30rdS SOUTIB @rid.@ris.rw 4Ci6 pppp qqqq TSETB adrsx 3Ad4 PPPP INB rbd.ioaddr 4CiS pppp qqqq CLRB adrsx 3Ad5 pppp SINB rbd.ioaddr 40iO pppp qqqq COM adrsx 3As6 PPPP OUTB ioaddr.rbs 40i1 yyyy CP adrsx.data 16 3As7 pppp SOUTB ioaddr.rbs pppp qqqq 3AsS OrdO INORB @rid.@ris.rw 40i2 pppp qqqq NEG adrsx 3AsS OrdS INOB @rid.@ris.rw 40i4 pppp qqqq TEST adrsx 3AsS OrdO SINORB @rid.@ris.rw 40i5 yyyy LO adrsx.data 1 6 3AsS OrdS SINOB @rid.@ris.rw pppp qqqq 3AsA OrdO OTORB @rid.@ris.rw 40i6 pppp qqqq TSET adrsx 3AsA OrdS OUTOB @rid.@ris.rw 40iS pppp qqqq CLR adrsx 3AsB OrdO SOT ORB @rid.@ris.rw 50id pppp qqqq CPL rld.adrsx 3AsB OrdS SOUTOB @rid.@ris.rw 51 di pppp qqqq PUSHL @rid.adrsx 3BsO OrdO INIR @rid.@ris.rw 52id pppp qqqq SUBL rld.adrsx 3BsO OrdS INI @rid.@ris.rw 53di pppp qqqq PUSH @rid.adrsx 3Bs1 OrdO SINIR @rid.@ris.rw 54id pppp qqqq LOL rld.adrsx 3Bs1 OrdS SINI @rid.@ris.rw 55si pppp qqqq POPL adrsx.@ris 3Bs20rdO OTIR @rid.@ris.rw 56id pppp qqqq AOOL rld.adrsx 3Bs20rdS OUTI @rid.@ris.rw 57si pppp qqqq POP adrsx.@ris 3Bs30rdO SOTIR @rid.@ris.rw 5Sid pppp qqqq MULTL rqd.adrsx 3Bs30rdS SOUTI @rid.@ris.rw 5Sid pppp qqqq MULT rld.adrsx 3Bd4 pppp IN rwd.ioaddr 5Aid pppp qqqq OIVL rqd.adrsx 3Bd5 pppp SIN rwd.iqaddr 5Bid pppp qqqq OIV rld.adrsx 3Bs6 pppp OUT ioaddr.rws 5CiO pppp qqqq TESTL adrsx 3Bs7 pppp SOUT ioaddr.rws 5Ci1 OdOn LOM rwd.adrsx.n 16 3BsS OrdO INOR @rid.@ris.rw pppp qqqq 3BsS OrdS INO @rid.@ris.rw 5CiS OsOn LOM adrsx.rws.n 16 3BsS OrdO SINOR @rid.@ris.rw pppp qqqq 3BsS OrdS SIND @rid.@ris.rw 50is pppp qqqq LOL adrsx.rls 3BsA OrdO OTOR @rid.@ris.rw 5Eic pppp qqqq JP cc.adrsx 3BsA OrdS OUTO @rid.@ris.rw 5FiO pppp qqqq CALL adrsx 3BsB OrdO SOTOR @rid.@ris.rw 60id pppp qqqq LOB rbd.adrsx 3BsB OrdS SOUTO @rid.@ris.rw 61 id pppp qqqq LO rwd.adrsx 3Csd INB rbd.@rw 62ib pppp qqqq RESB adrsx.bS 30sd IN rwd.@rw 63ib pppp qqqq RES adrsx.b16 3Eds OUTB @rw.rbs 64ib pppp qqqq SETB adrsx.b8 3Fds OUT @rw.rws 65ib pppp qqqq SET adrsx.b16 40id pppp qqqq AOOB rbd.adrsx 66ib pppp qqqq BITB adrsx.bS 41 id pppp qqqq ADD rwd.adrsx 67ib pppp qqqq BIT adrsx.b16 42id pppp qqqq SUBB rbd.adrsx 6Sin pppp qqqq INCB adrsx.n16 43id pppp qqqq SUB rwd.adrsx 6Sin pppp qqqq INC adrsx.n16 44id pppp qqqq ORB rbd.adrsx 6Ain pppp qqqq OECB adrsx.n16 45id pppp qqqq OR rwd.adrsx 6Bin pppp qqqq DEC adrsx.n16 46id pppp qqqq ANOB rbd.adrsx 6Cid pppp qqqq EXB rbd.adrsx 47id pppp qqqq AND rwd.adrsx 60id pppp qqqq EX rwd.adrsx 4Sid pppp qqqq XORB rbd.adrsx 6Eis pppp qqqq LOB adrsx.rbs 4Sid pppp qqqq XOR rwd.adrsx 6Fis pppp qqqq LO adrsx.rws 4Aid pppp qqqq CPB rbd.adrsx 70id ora a LOB rbd.ris(rw) 4Bid pppp qqqq CP rwd.adrsx 71id OrOO LO rwd.ris(rw) 4CiO pppp qqqq COMB adrsx 72is OrOO LOB rid(rw).rbs 4Ci1 yyOO CPB adrsx.dataS 73is OrOO LO rid(rwl.rws pppp qqqq 74id OrOO LOA rld.ris(rw) 4Ci2 pppp qqqq NEGB adrsx rwd.ris(rw) 4Ci4 pppp qqqq TESTB adrsx 75id OrOO LOL rld.ris(rw) 4Ci5 yyOO LOB adrsx.dataS 76id pppp qqqq LOA rld.adrsx pppp qqqq rwd.adrsx 6-83 Table 6-5. zaooo Object Codes (Continued) Object Code Instruction Object Code Instruction 77is OrOO LOL rid(rw),rls 96sd AODL rld,rls 79iO PPPP qqqq LOPS adrsx 97sd POP rwd,@ris 7AOO HALT 98sd MULTL rqd,rls 7BOO IRET 99sd MULT rld,rws 7B08 MSET 9Asd OIVL rqd,rls 7B09 MRES 9Bsd OIV rld,rws 7BOA MBIT 9CdO TESTL rid 7BdO MREQ rwd 9EOc RET cc 7C OOOOOOvv 01 int AOsd LOB rbd,rbs 7C 000001vv EI int Alsd LO rwd,rws 7Dd2 LOCTL rwd,FCW A2db RESB rbd,b8 70d3 LOCTL rwd,REFRESH A3db RES rwd,b16 7Dd4 LOCTL rwd,PSAPSEG A4db SETB rwd,b8 70d5 LOCTL rwd,PSAPOFF A5db SET rwd,b16 70d6 LOCTL rwd,NSPSEG A6db BITB rbd,b8 70d7 LOCTL rwd,NSPOFF A7db BIT rwd,b16 70sA LOCTL FCW,rws ASdn INCB rbd,n16 70sB LOCTL REFRESH,rws A9dn INC rwd,n16 70sC LOCTL PSAPSEG,rws AAdn OECB rbd,016 70s0 LOCTL PSAPOFF,rws ABdn DEC rwd,n16 70sE LOCTL NSPSEG,rws ACsd EXB rbd,rbs 70sF LOCTL NSPOFF,rws AOsd EX rwd,rws 7Fyy SC data8 AEdc TCCB cC,rbd SOsd AOOB rbd,rbs AFdc TCC CC,rwd Slsd ADD rwd,rws BOdO DAB rbd S2sd SUBB rbd,rbs BldO EXTSB rwd S3sd SUB rwd,rws Bld7 EXTSL rqd S4sd ORB rbd,rbs BldA EXTS rid S5sd OR rwd,rws B2dO RLCB rbd,l S6sd ANOB rbd,rbs B2dl yyyy SLLB rbd,data16 S7sd AND rwd,rws B2dl yyyy SRLB rbd,data16 S8sd XORB rbd,rbs B2d2 RLCB rbd,2 S9sd XOR rwd,rws B2d30rOO SOLB rbd,rw SAsd CPB rbd,rbs B2d4 RRCB rbd,l SBsd CP rwd,rws B2d6 RRCB rbd,2 SCdO COMB rbd B2d8 RLB rbd,l SCdl LDCTLB rbd,FLAGS B2d9 yyyy SLAB rbd,data16 SCd2 NEGB rbd B2d9 yyyy SRAB rbd,data16 SCd4 TESTB rbd B2dA RLB rbd,2 SCd6 TSETB rbd B2dB OrOO SDAB rbd,rw SCdS CLRB rbd B2dC RRB rbd,l SCs9 LDCTLB FLAGS,rbs B2dE RRB rbd,2 8007 NOP B3dO RLC rwd,l SOdO COM rwd B3dl yyyy SLL rwd,data16 SOfl SETFLG flag B3dl yyyy SRL rwd~data16 SOd2 NEG rwd B3d2 RLC rwd,2 SOf3 RESFLG flag B3d30rOO SOL rwd,rw SOd4 TEST rwd B3d4 RRC rwd,l 80f5 COMFLG flag B3d5 yyyy SLLL rld,data16 80d6 TSET rwd B3d5 yyyy SRLL rld,data16 SOd8 CLR rwd B3d6 RRC rwd,2 90sd CPL rld,rls B3d70rOO SOLL rld,rw 91is PUSHL @rid,rls B3d8 RL rwd,l 92sd SUBL rld,rls B3d9 yyyy SLA rwd,data16 93is PUSH @rid,rws B3d9 yyyy SRA rwd,data16 94sd LDL rld,rls B3dA RL rwd,2 95id POPL rld,@ris B3dB OrOO SOA rwd,rw 6-84 Table 6-5. Z8000 Object Codes (Continued) Object Code Instruction Object Code Instruction B3dC RR rwd,1 BAs90rd8 LOOB @rid,@ris,rw B3dO yyyy SLAL rld,data16 BAsA Ordc CPSOB @rid,@ris,rw,cc B3dO yyyy SRAL rld,data16 BAsC Ordc CPORB rbd,@ris,rw,Cc B3dE RR rwd,2 BAsE Ordc CPSORB @rid,@ris,rw,cc B3dF OrOO SOAL rld,rw BBsO Ordc CPI rwd,@ris,rw,cc B4sd AOCa rbd,rbs BBs1 OrdO LOIR @rid,@ris,rw BSsd AOC rwd,rws BBs1 Ord8 LOI @rid,@ris,rw B6sd SBCB rbd,rbs BBs20rdc CPSI @rid,@ris,rw,Cc B7sd SBC rwd,rws BBs40rdc CPIR rwd,@ris,rw,cc B8dO OrsO TRIB @rd,@ris,rw BBs60rdc CPSIR @rid,@ris,rw,cc B8d20rsO TRTIB @rid,@ris,rw BBs80rdc CPO rwd,@ris,rw,cc B8d40rsO TRIRB @rid,@ris,rw BBs90rdO LOOR @rid,@ris,rw B8d60rsE TRTIRB @rid,@ris,rw BBs90rd8 LOO @rid,@ris,rw B8d80rsO TROB @rid,@ris,rw BBsA Ordc CPSO @rid,@ris,rw,cc B8dA OrsO TRTOB @rid,@ris,rw BBsC Ordc CPOR rwd,@ris,rw,cc B8dC OrsO TRORB @rid,@ris,rw BBsE Ordc CPSOR @rid,@ris,rw,cc B8dE OrsE TRTORB @rid,@ris,rw BCsd RROB rbd,rbs BAsO Ordc CPIB rbd,@ris,rw,cc BOdb LOK rwd,b16 BAs1 OrdO LOIRB @rid,@ris,rw BEsd RLOB rbd,rbs BAs1 Ord8 LOIB @rid,@ris,rw Cdyy LOB rbd,data8 BAs20rdc CPSIB @rid,@ris,rw,cc Oxxx CAlR disp BAs40rdc CPIRB rbd,@ris,rw,cc Ecxx JR cC,disp BAs60rdc CPSIRB @rid,@ris,rw,cc Fr Ottttttt OBJNZ rb,disp BAs80rdc CPOB rbd,@ris,rw,cc Fr 1ttttttt DJNZ rw,disp BAs90rdO LOORB @rid,@ris,rw 6-85 DATA SHEETS This section contains specific electrical and timing data for the following devices: • za001 CPU • Za002 CPU 6-D1 Z8001,Z8002 Composite AC Timing RESET x ~ ~ Diagram ~ This composite timing dia- gram does not show actual ii, NYI -> ~ timing sequences. Refer to this diagram only for the --®---- ~- detailed timing relationships of Individual edges. Use the -> ~ preceding illustrations as an ----®-- I~ explanation of the various l ~--®- ~ c: timing sequences ·0 ~ Timing measurements are made at the follOWing I~ ~ voltages High Low I~ r% Clock 40V O.SV WAIT ~ C Output Input 2.0V 2.0V o SV O.SV ~ ~ Floal :::'V ±O.5V --@--I X (6~.-- 1-L(6~ X c, ~ f( ) H~- ---q. K :P-1 -~ ~ ~ ADDRESS 1>-- ~ II -®- ~ ) DATA IN :x ®-- 1- I> ~i ~- ~- ~ DATA OUT @ -~J- ~ /j6' D K: -®- -r--- ~( _ 20 I---- ~ --@rl 1= 21 -r ... __ 'J: . . . . r"I --®- --®- f2'i' -( "1"' ... _ _ -® ~~~/ -® I---@- - ~r 32 r-~ --®- I- -®- ... _- MEMORY READ ~ -®- :=jt= t~ MEMORY WRITE ~ --® ~ '38 ,Jo!'~ ... _- ~~ INPUT/OUTPUT ~ ~ t~- - 1----- -~~ ~ INTERRUPT~ ACKNOWLEDGE '( ~~ y-:: ::::/""-- - t>-- r-®- ---@-I J/ f--@- REA:,~RT;.: NOAM"USY~ X " BYTElWOAD I Data sheets on pages 21-02 through 21-04 are reprinted by permission of Zilog, Incorporated. 6-02 zaOO1,Z8002 AC Number Symbol Parameter MiD Max Unit Electrical 1 TcC Clock Cycle Time 250 2000 ns Characteristics 2 TwCh Clock Width (High) 105 2000 ns 3 TwCl Clock Width (Low) 105 2000 ns 4 TfC Clock Fall Time 20 ns -5--TrC Clock Rise Time 20--ns- 6 TdC(SNv) Clock t to Segment Number Valid (50 pF load) 130 ns 7 TdC(SNn) Clock t to Segment Number Not Valid 20 ns 8 TdC(Bz) Clock t to Bus Float 65 ns 9 TdC(A) Clock t to Address Valid 100 ns -lO--TdC(Az)-- Clock t to Address Float 65--ns- 11 TdA(DI) Address Valid to Data In Required Valid 400 ns 12 TsDI(C) Data In to Clock I Setup, Time 70 ns 13 TdDS(A) DS t to Address Active 80 ns 14 TdC(DO) Clock t to Data Out Valid 100 ns -15--ThDI(DS)-- Data In to DS t Hold Time 0 ns- 16 TdDO(DS) Data Out Valid to DS t Delay 230 ns 17 TdA(MR) Address Valid to MREQ I Delay 55 ns 18 TdC(MR) Clock I to MREQ I Delay 80 ns 19 TwMRh MREQ Width (High) 190 ns - 20 - - TdMR(A) - - MREQ I to Address Not Active 70 ns- 21 TdDO(DSW) Data Out Valid to DS I (Write) Delay 55 ns 22 TdMR(DI) MREQ I to Data In Required Valid 330 ns 23 TdC(MR) Clock I to MREQ t Delay 80 ns 24 TdC(ASf) Clock t to AS I Delay 80 ns - 25 - - TdA(AS) - - Address Valid to AS t Delay 55 ns- 26 TdC(ASr) Clock I to AS t Delay 90 ns 27 TdAS(DI) AS ! to Data In Required Valid 290 ns 28 TdDS(AS) DS t to AS I Delay 70 ns 29 TwAS AS Width (Low) 80 ns - 30-- TdAS(A) - - AS t to Address Not Active Delay 60 ns- 31 TdAz(DSR) Address Float to DS (Read) I Delay 0 ns 32 TdAS(DSR) AS! to DS (Read) I Delay 70 ns 33 TdDSR(DI) DS (Read) I to Data In Required Valid 155 ns 34 TdC(DSr) Clock I to DS t Delay 70 ns - 35 - - TdDS(DO) - - DS t to Data Out and STATUS Not Valid 80 ns- 36 TdA(DSR) Address Valid to DS (Read) I Delay 120 ns 37 TdC(DSR) Clock t to DS (Read) I Delay 120 ns 38 TwDSR DS (Read) Width (Low) 275 ns 39 TdC(DSW) Clock I to DS (Write) I Delay 95 ns -40--TwDSW--DS (Write) Width (Low) 160 ns- 41 TdDSI(DI) DS (Input) I to Data In Required Valid 315 ns 42 TdC(DSf) Clock I to DS (I/O) I Delay 120 ns 43 TwDS DS (I/O) Width (Low) 400 ns 44 TdAS(DSA) AS t to DS (Acknowledge) I Delay 960 ns -45--TdC(DSA)-- Clock t to DS (Acknowledge) I Delay 120--ns- 46 TdDSA(DI) DS (Ack.) I to Data In Required Delay 420 ns 47 TdC(S) Clock I to Status Valid Delay 110 ns 48 TdS(AS) Status Valid to AS t Delay 40 ns 49 TsR(C) RESET to Clock t Setup Time 180 ns -50--ThR(C)--- RESET to Clock t Hold Time 0 ns- 51 TwNMI NMI Width (Low) 100 ns 52 TsNMI(C) NMI to Clock t Setup Time 140 ns 53 TsVI(C) VI, NVI to Clock t Setup Time 110 ns 54 ThV!(C) VI, NVI to Clock t Hold Time 0 ns -55--TsSGT(C)--SEGT to Clock t Setup Time 70 ns- 56 ThSGT(C) SEGT to Clock t Hold Time 0 ns 57 TsMI(C) Mi to Clock t Setup Time 180 ns 58 ThMI(C) Mi to Clock t Hold Time 0 ns 59 TdC(Mo) Clock t to Mo Delay 120 ns -60--TsSTP(C)--STOP to Clock I Setup Time 140 ns- 61 ThSTP(C) STOP to Clock I Hold Time 0 ns 62 TsWT(C) WAIT to Clock I Setup Time 70 ns 63 ThWT(C) WAIT to Clock I Hold Time 0 ns 64 TsBRQ(C) BUSRQ to Clock t Setup Time 90 ns -65--ThBRQ(C)--BUSRQ to Clock t Hold Time 0 ns- 66 TdC(BAKr) Clock t to BUSAK t Delay 100 ns 67 TdC(BAKf) Clock t to BUSAK I Delay 100 ns 6-03 Z8001,Z8002 Absolute Voltages on all inputs and outputs Stresses greater than those listed under Absolute Maxi- with respect to GND .......... -0.3 V to + 7.0 V mum Ratings may cause permanent damage to the device. Maximum This is a stress rating only; operation of the device at any Ratings Operating Ambient condition above those indicated in the operational sections Tempera ture .................. a°e to + 70°C of these specifications is not implied. Exposure to absolute maximum rating conditions for extended periods may affect Storage Temperature ........ -65°C to + 150 °e device reliability. Standard The characteristics below apply for the Test following standard test conditions, unless V"'.,K =rr! Conditions otherwise noted. All voltages are referenced to GND. Positive current flows into the refer- FROM OUTPUT UNDER TEST enced pin. Standard conditions are as follows: L +4.75 V ::5 Vcc ::5 +5.25 V 100',! ~ ~~ _ [j GND = a V All de pardmeters assume a load capacitance of 100 pF max, ex- l.j ooe ::5 TA ::5 +70 oe cept for parameter 6 (50 pF max). Timing references between two output signals assume a load difference of 50 pF max. DC Symbol Parameter Min Max Unit Condition Character- Clock Input High Voltage VCC-O.4 VCC+0.3 V Driven by External Clock Generator VCH istics VCL Clock Input Low Voltage -0.3 0.45 V Driven by External Clock Generator VlH Input High Voltage 2.0 VCC+0.3 V VlL Input Low Voltage -0.3 0.8 V VOH Output High Voltage 2.4 V IOH = -250 p.A VOL Output Low Voltage 0.4 V IOL = +2.0 rnA IlL Input Leakage ±10 p.A 0.4 :s VIN :s +2.4 V IOL Output Leakage ±10 p.A 0.4 :s VOUT :s +2.4 V ICC VCC Supply Current 300 rnA Ordering Temperature Number Part Number Package Description Information Range of Pins 28001 CPU ooe to + 70°C 48 CeramiC Segmented 16-Bit Microprocessor Z8002 CPU ooe to +70°C 40 CeramiC Non-Segmented 16-Bit Microprocessor 6-04 Chapter 7 THE MOTOROLA MC68000 The MC68000 microprocessor is Motorola's first 16-bit microprocessor. It is the third of the new generation of these devices, having been preceded by Intel's 8086 and Zilog's Z8000. The MC68000 is not program compatible with Motorola's family of 8-bit microprocessors. Motorola has opted for designing an instruction set which provides maximum power and simplicity rather than compatibility. The following is a discussion of interesting MC68000 features as compared to similar capabilities of the Z8000 and 8086: .1) The MC68000 overlaps the fetching of each instruction's object code with the decoding and execution at the two prior instructions to obtain a pipeline effect. The Z8000 uses this approach, but only under certain circumstances. On the other hand, the 8086 performs extensive pipelining using a 6-byte object code pipeline. 2) Both the 8086 and the Z8000 family of microprocessors provide methods of operating the devices in a "sim- ple" system configuration or "complex" system configuration. The 8086 accomplishes this within a Single device by having a number of dual-function pins which serve one function in simple systems and another function in complex systems. The Z8000, on the other hand, is supplied in two versions: the Z8001 for com- plex configurations and the Z8002 for simple configurations. The MC68000 is contained in a 64-pin package and therefore need not attempt to accommodate different complexities of system configurations; it is always capable of operating in what is, effectively, a "maximum" or "complex" system configuration mode. 3) The MC68000 has built-in logic to handle bus access arbitration in multi-CPU configurations. The 8086 and the Z8000 have equivalent logic. 4) The MC68000 can directly access up to 16 millio!) (16M) bytes of memory with its 24-bit Address Bus. This memory space may be expanded to 64M bytes by using the Function Code lines. In comparison, the 8086 can directly address only 64K bytes of memory but can address up to one million bytes using segment registers. The Z8000 is also limited to 64K bytes of directly addressable memory; however, the Z8001 ver- sion can address as many as 48M bytes of memory using internal segment registers and external segmenta- tion in a memory management device. 5) The MC68000 can be operated in either a "Supervisor" or a "User" mode. Certain privileged instructions can be executed in Supervisor mode only. Supervisor and User modes also have separate stack pointers. Thus, in program-intensive applications, systems software (executed in Supervisor mode) can be separated from applications programs (executed in User mode). The Z8000 series microprocessors provide similar capabilities. The Supervisor mode of the MC68000 is equivalent to the System mode of the Z8000, while the User mode of the MC68000 is equivalent to the Normal mode of the Z8000. The 8086 offers no similar operat- ing modes. . 6) The MC68000 has seventeen 32-bit registers. Eight of the registers are designated as Data registers and can be accessed as either 8, 16, or 32-bit registers. The remaining nine registers are designated as Address registers, with two of these being reserved for use as the stack pointers (Supervisor and User). The Address registers can be accessed as 16 or 32-bit registers. All of the registers can also function as Index registers. In contrast. all of the Z8000 registers are 16-bit registers, although they can be paired to operate as 32-bit registers. The 8086 has only four 16-bit registers plus three separate 16-bit Index registers. 7) The MC68000 provides separate pins for every data line and address output line. This is possible since the MC68000 is contained in a 64-pin package and as a result there is no shortage of pin connections. The Z8000 microprocessors and the 8086 are housed in smaller packages and therefore their data and address lines must share some pins. Thus the Z8000 and 8086 devices multiplex some of the data and address sig- nals on the same pins, and you must provide external logic to demultiplex these signals. 7-1 The primary source for the MC68000 is: MOTOROLA SEMICONDUCTOR, INC. 3501 Ed Bluestein Blvd. Austin, Texas 78721 The MC68000 is manufactured using N-channel HMOS process technology. The device is contained in a dual inline 64- pin package. A single +5V power supply is required and all signals are TTL-level compatible. The MC68000 requires an external clock which can be run at a maximum frequency of 8 MHz. The minimum instruc- tion execution time is four clock periods. The maximum number of clock periods for instruction execution is 158 for signed division and multiplication. THE MC68000 PROGRAMMABLE REGISTERS Figure 7-1 illustrates the registers provided by the MC68000. There are seventeen 32-bit Data and Address registers, a 32-bit Program Counter (of which only 24 bits are used) and a 16-bit Status register. The most signifi- cant difference between the registers provided by the MC68000 and those of other 16-bit microprocessors is that the Data and Address registers are all 32 bits wide. By comparison, the 8086 and Z8000 microprocessors use 16-bit wide registers. The Data registers can be used to handle 8-bit bytes, 16-bit words, or 32-bit long words. MC68000 The following illustration shows how the various sized operands are positioned within the DATA Data registers. REGISTERS Data Register (00-07) Word Operands - - - - -....... .....- - - - - - - - - - - - - Long Word Operands - - - - - - - - - - - - - + 1 8-bit byte operands occupy bits 0 through 7 of a Data register, while a word operand occupies bits 0 through 15 of a Data register. A long word operand uses all 32 bits of a Data register. When a Data register is used as a source or destination operand, only the appropriate low order portion of the register will be altered by the specified operation; the more significant bits will be unaffected. For example, if you have specified an arithmetic shift left (ASL) instruction with an operand size of eight bits, then only the least significant eight bits (bits 0-7) of the data register will be shifted: bits 8 through 31 will be unchanged by the instruction execution: 31 8 7 6 5 4 3 2 1 0 .....-Sit No. I I I I I I I II I I I I II I.. "0" I. -... - - - - - - - - - - - Unchanged - - - - - - - - - - - - 4 1 . , To Carry Flag In addition to being used as the source or destination for instructions the Data registers can also be used as index registers or data counters. 7-2 3130292827262524232221201918171615141312111098765432 1 O~BitNo.(forall I I I I I I I I I I I I I I I I I I I I I I I I I I I I I IDO registers) 101 ~============~======~====~102 ~============~======~====~103 Data ==============~~====~~====~104 Registers ~============~======~====~I D5 ~============~~====~~====~'06 ~__________________________________ ________________ ________________ ================~====~~====~ ~ ~ ~ID7 31 16 15 o lAO ~============~============~IA1 ~============~~============~'A2 ~============~~============~'A3 Address Registers ~============~~============~'A4 ~============~~============~IA5 ~====================~~====================~'A6 -----------------u;;-Sta;p~Tn;;.----.---·.---------- A7} Stack Pointers ________________ ____________ ,___ _ .!u£!'!!i~~.!:!~.!.o~~ 2423 I ~--------------~------------------15----------------8-7----------------0~ IProgram Counter ..1_____Sy_s_te_m_B,;"yt_e_____IL..._____U_se_r_B..;,y_te____.....1Status Register Figure 7-1. MC68000 Programmable Registers There are seven general purpose Address registers (AO-A6). These registers can handle MC68000 either 16-bit word or 32-bit long word operands. When you use one of these address registers ADDRESS to provide a source operand. either the low order 16 bits will be used (if a word operand has been REGISTERS specified) or the entire 32 bits will be used (if a long word operand has been specified). If the Address register is used as the source for a word operand. then the more significant 16 bits (bits 16-31) will not be affected. If an Address register is used as the destination operand. however. the contents of the entire register will be affected. regardless of whether a word or long word operand is specified. If you specify a word destination operand for an Address register. that word will be automatically sign-extended to 32 bits before it is loaded into the Address register. I I I I I. I I I I I I I I I I I I I I r~:~~::)gister 3130292827262524232221201918171615141312111098765432 1 04--BitNo. I I I I I I I I I I .- Word Operands :- !. .....- - - - - - - - - - - - - - L o n g Word O p e r a n d s - - - - - - - - - - - - - - - t - 7-3 As we have already pointed out. all of the MC6S000 Data and Address registers are 32 bits wide versus the 16-bit wide registers of the lSOOO and SOS6. Another significant difference between the MC6S000 registers and those of the SOS6 is the general purpose nature of the MC6S000 registers. This is similar to the approach taken in the lSOOO and provides the programmer with increased flexibility. Although there are minor differences between the way the Data and Address (AO-A6) registers handle various data widths. each register type may be used in similar ways. The only dedicated registers are the Stack Pointer registers (A7. Supervisor and User). the Program Counter and the Status register. Let us now examine these dedicated registers. The MC68000 can be operated in a Supervisor (or system) mode, or in a User (or normal) MC68000 mode. The state of the S-bit in the Status register determines the mode of operation for the STACK MC6S000. Supervisor mode will normally be used by operating system software; User mode will POINTERS typically be used by application programs. A number of instructions are designated as privileged and can only be executed when the processor is in Supervisor mode. The Supervisor and User modes also have sep- arate stack pointers as mentioned earlier. As you can see in Figure 7-1, both stack pointers are addressed as Address register A7. When the MC68000 is operating in the Supervisor state. the User Stack Pointer cannot be referenced. Conversely. when the MC6S000 is in the User state. the Supervisor Stack Pointer cannot be referenced. Both the User and Supervisor Stack Pointers operate in the same way: the system stacks are filled from high memory to low memory. On subroutine calls the Program Counter contents are pushed onto the appropriate system stack (Supervisor or User). The Program Counter contents will be pulled from the Stack and restored to the Program Counter on return from subroutines. Since the Program Counter is a 32-bit register, four bytes (two words) of memory will be required to save the contents of the Program Counter on the Stack. The organization of the Pro- gram Counter contents on the System Stack after a subroutine call is illustrated as follows: Memorv -----, Address , 1514131211109 817 6 5 4 3 2 1 0 04--Bit No. n PC low-order word LSB n-2 MSB PC high-order word n - 4 - E v e n Byte I Odd B y t e - Data that is pushed onto the Stack is always written to a word boundary in memory; that is. to a memory location with an even address. Therefore. when bytes of data must be pushed onto the stack they are written into the high-order half of the memory word. and the low-order half of that word (corresponding to an odd memory address) will be unchanged. The MC68000 addresses memory as either 8-bit bytes or as a 16-bit word comprised of two bytes. All words must be referenced at even address locations. Otherwise. misalignment could occur when the microprocessor attempts to perform a word operation at an odd-memory address. This same problem exists with any of the 16-bit microprocessors. but the MC6S000 is the only microprocessor which automatically checks to ensure that all word references are done at even memory addresses. If a word reference is made to an odd memory address. the MC6S000 begins an exception processing sequence. which will be described later. The following illustration shows how bytes are organized in memory: 15 14 13 12 11 10 9 8 7 6 5· 4 3 2 1 0 4 - - B i t No. Byte FFFFFE Byte FFFFFF High Memory Byte FFFFFC Byte FFFFFD Byte FFFFFA Byte FFFFFB Byte FFFFF8 Byte FFFFF9 Byte FFFfF6 Byte FFFFF7 Byte FFFFF4 Byte FFFFF5 Byte 000006 Byte 000007 Byte 000004 Byte 000005 Byte 000002 Byte 000003 Byte 000000 Byte 000001 Low Memory 7-4 You will note that the first byte in memory (address 000000) occupies the most significant byte half of a memory word. When words are stored in memory. they are only addressable at even memory addresses. as we have discussed. This can be illustrated as follows: 15141312 11 10 9 8 7 6 5 4 3 2 1 0 4----Bit No. Word FFFFFE High Memory Word FFFFFC Word FFFFFA Word FFFFF8 Word FFFFF6 Word FFFFF4 Word 000006 Word 000004 Word 000002 Word 000000 Low Memory When 32-bit long words (such as 32-bit addresses) are stored in memory. they occupy two adjacent 16-bit memory locations or four bytes. The high-order word of the long words is stored at the higher memory location. as illustrated below: 15 14 13 1 2 11 10 9 8 7 6 5 4 3 2 1 0 " " - - Bit No. ~~_ _ _ _ _ _ !'!2.h..!~!...________ High Memory Low-order LSB ~-------------------- ~---~----------------- ~~-------~~~~--------~ Low-order LSB ~~---- Long word or address 0------.. LSB Low Memory ~------------------------------~ The MC68000 provides a 16-bit Status register which is divided into two 8-bit bytes: the MC68000 System byte and the User byte. Figure 7-2 shows the bit assignments for the Status STATUS register. The Carry, Overflow, Zero, and Negative bits are the standard ones provided by REGISTER most microprocessors. The Carry (C) bit is set if there is a carry out of the most significant bit following an addition operation, or if a borrow is required from the most significant bit during a subtraction. This status bit is also modified by certain shift and rotate instructions. The Overflow (V) bit is the exclusive-OR of the carries out of the most significant and next higher-order bits of the operand following arithmetic operations. The setting of the overflow bit signifies a magnitude overflow since the result cannot be represented in the specified operand size. The Zero (Z) bit is set whenever the result otan operation is zero; it is reset otherwise. The Negative (N) bit is the equivalent of the Sign status bit provided in most microprocessors. The Negative bit is equal to the value of the most significant result bit following arithmetic operations. If a signed binary arithmetic operation is being performed. a Negative status of 0 specifies a positive or zero result. whereas a Negative status of 1 specifies a negative result. The Extend (X) bit is used in multiprecision arithmetic operations. When it is affected by an instruction, it is set to the same state as the Carry bit. The three most significant bits (bits 5, 6, and 7) of the User byte of the Status register are not currently assigned and will always be zero. 7-5 15 .... ~~--14 13 System Byte --~~~------~, 12 11 10 9 8 '1~--6..--.. 5 User Byte ~~~--------" 4 3 2 0 ______ Bit No. I T I I S I I 112111 110 I I I IxlNlzlvlCI I~ ~ " - - I I~ ./ ~ j I~ ~ t Carry Overflow Zero Negative Extend Interrupt Mask Supervisor/User Mode Select Trace Mode Figure 7-2. MC68000 Status Register Bit Assignments The System byte of the Status register contains status information that is system-related. The User byte, on the other hand, contains the Condition Code status bits (X, N, Z, V, and C) that are instruction or program related. Bits in the System byte of the Status register can only be altered when the MC68000 is in the Super- visor mode. The three least significant bits (bits 8, 9, and 10) of the Status register's System byte form the interrupt mask. The MC68000 provides seven levels of interrupts. The level of any given interrupt is decoded from the signal's three interrupt pins, which we will describe later. The interrupt priorities are numbered from 1 to 7, with level 7 having the highest priority, as shown in the following illustration: Interrupt Interrupt Mask Level 12 11 10 Level 7 1 ,, , -- Highest priority (Non-maskable) Level 6 Level 5 1 1 0 , 0 Level 4 Level 3 1 0 ,, 0 , 0 0 , --- Level 2 0 Level' 0 0 Lowest Priority Level 0 0 0 0 No Interrupt Request The level 7 interrupt is nonmaskable and thus cannot be disabled. Level 0 represents a "no interrupt request" condition. Levels 1 through 6 are the mask-enabled levels. For example, if you set the mask to 100 then only levels 5, 6, and 7 will be enabled; interrupt levels 1 through 4 are disabled and interrupt requests of those levels will be ignored. Bit 13 of the Status register is the S-bit which specifies whether the MC68000 is in the Supervisor or User mode of operation. When this bit is 1, the MC68000 is in the Supervisor mode, and when it is 0 the microprocessor is in the User mode. Recall that the Supervisor and User modes have their own separate stack pointers; also, certain pri- vileged instructions can only be executed in the Supervisor mode. The most significant bit of the Status register is the Trace mode (T) flag. If this bit is 0 then the MC68000 operates normally. If this bit is 1, however, the microprocessor is in the trace mode of operation. The trace mode is the approximate software equivalent of a hardware implemented single-step mode. After each instruction is executed in the trace mode, a trap is forced so that a debugging program can monitor the results of that instruction's execution. 7-6 Table 7-1. MC68000 Addressing Mode Summary Mode Address Formation Register Direct Addressing Data Register Direct EA = DREGn Address Register Direct EA = AREGn Register Indirect Addressing Register Indirect EA = (AREGn) Postincrement Register Indirect EA = (AREGn); Increment (AREGn) Predecrement Register Indirect Decrement (AREGn); EA = (AREGn) Register Indirect with Offset EA = (AREGn) + data 1 6 Indexed Register In':lirect with Offset EA = (AREGn) + (XREGn) + data8 Implied Register Addressing EA = SR. SP. PC Absolute Addressing Absolute Short EA = (Next word) Absolute Long EA = (Next 2 words) Program Counter Relative Addressing Relative with Offset EA = (PC) + data16 Relative with Index and Offset EA = (PC) + (XREG) + data8 Immediate Data Addressing Immediate Data = Next word or words Quick Immediate Data inherent in instruction word EA =Effective Address data8 = 8-bit offset (displacement) DREGn = Any Data Register data 16 = 1 6-bit offset (displacement) AREGn = Any Address Register SR =Status Register XREGn = Any Data or Address Register SP =Stack Pointer (User or Supervisor) used as an Index Register PC =Program Counter () =Contents of MC68000 ADDRESSING MODE SUMMARY The MC68000 provides six basic types of addressing modes. Variations within these types allow a total of four- teen different modes. as summarized in Table 7-1. At this point. we will look only briefly at the addressing modes and how they utilize the registers of the MC68000. We will discuss each of the addressing modes in detail later. just prior to our description of the instruction set. Most of the addressing modes use the 32-bit Address registers either directly or indirectly to generate the effective address. The Data registers can be used as sources for addresses in the direct addressing mode. and they can also be used as Index registers in some of the indirect addressing modes. The indirect addressing modes include post-incre- menting or pre-decrementing of an Address register; this capability makes it easy to implement stacks and queues in memory. A number of MC68000 instructions use the implied addressing mode; that is. they make implicit reference to either the Program Counter (PCl. Stack Pointer (SP) or Status Register (SR). For example. Branch. Jump. and Return instructions will all reference the Program Counter and Stack Pointer during their execution. Absolute addressing modes do not utilize the Data or Address registers. but instead form the effective address using data that follows the instruction word in the program. Program Counter relative addressing can use either a displace- ment or a displacement plus the contents of an Index register to form the effective address. The Index register can be any of the Data or Address registers. Most instructions can utilize any of the addressing modes. and address formation is always the same regardless of the instruction operation itself. These factors do much to enhance the flexibility and power of the instruction set without making the instruction set difficu It to understand. 7-7 04 - :.. 1 64 -- --- -=.- -=- 05 03 02 -=- - -: - - ::: 2 3 63 62 - - :. - 06 07 01 DO AS :: -:: -- 4 5 6 61 60 59 08 09 ;, 010 --=- .. - UDS LOS - 7 8 58 57 -- - ~ 013 011 012 R/W -::: - .. 9 56 55 .:~ 014 -- .. OTACK 10 BG BGACK -- 11 12 54 53 015 GND BR Vee ClK - 13 14 15 52 51 50 ---- A23 A22 --=.. A21 - - GNO 16 49 Vee HALT - .:: 17 MC68000 48 ----- A20 RESET VMA 18 19 47 46 A19 A18 .. E -- 20 45 .-=. A17 VPA BERR .. : 21 22 44 43 A16 A15 : IPl2 IPL1 - 23 24 42 41 ----- A14 A13 IPlO FC2 FC1 - 25 26 27 40 39 38 --. A12 A11 . A10 FCO 28 37 A9 A1 :: 29 36 .... A8 A2 :: - 30 35 --:. A7 A3 A4 - 31 32 34 33 A6 A5.. Pin Name Description Type 00-015 Data Bus Bidirectional. Tristate A1-A23 Address Bus OutPllt. Tristate AS Address Strobe Output. Tristate R/W Read/Write Control Output. Tristate UDS. lOS Upper. lower Data Strobes Output. Tristate OTACK Data Transfer Acknowledge Input FCO. FC1. FC2 Function Code (status) Outputs Output. Tristate IPLO. IPl1. IPl2 Interrupt Requests Input BERR Bus Error Input HALT Halt Processor Operation !nput/Output RESET Reset Processor or Reset External Devices Input/Output elK System Clock Input BR Bus Request Input BG Bus Grant Output B'GACi< Bus Grant Acknowledge Input E Enable (Clock) Output Output VMA Valid Memory Address Output. Tristate VPA Valid Peripheral Address Input Vee. GNO Power (+5 V) and Ground Figure 7-3. MC68000 Pins and Signal Assignments 7-8 MC68000 PINS AND SIGNALS Figure 7-3 illustrates the signals and pin assignments for the MC68000. At this point. we will briefly discuss each of these signals to provide an overview of how the MC68000 operates. We will defer a detailed discussion of signal and timing interactions until later in this chapter. 00-015 is the bidirectional 16-bit Data Bus. A 1-A23 is the output 24-bit address bus. Because the MC68000 is contained in a 64-pin package. the data and address lines need not be multiplexed onto the same pins. as is the case with the 8086 and Z8000 microprocessors. Note that AO, the least significant bit of the Address Bus, is not output; this bit is used internal to the MC68000. in conjunction with the data size specification of each instruction. to generate the UOS and iJ5S signals. The UOS (Upper Data Strobe) and LOS (Lower Data Strobe) signals determine whether data is being transferred on either the upper (most significant) byte, the low!!..!!.east significant) byte..J!!' both bytes of the 16-bit data bus. Table 7-2 defines the significance of the UDS, LOS, and Read/Write (R/W) signals in relation to the data bus. When ODs is low. data from memory with an even address is accessed and the byte of data is transferred on 08- 015. When CDs is low. a byte of data located at an odd address is accessed and the transfer occurs on 00-07. When the MC68000 is transferring a word of data (for example. when fetching an instruction) then both ODS and LOS will be low and all 16 of the data lines (DO-015) will be used for the transfer. Table 7-2. MC68000 Oata Bus Control Signal Summary UDs LOS R/W 08-015 00-07 Operation High High - .,"'.·;r:{" ••.• 'Ji:~'}i""x;"} ""';::,';:'.; .;;~L··; :,~:;'.:;. c.' .' .:.''':: •• ,:,;:.:~{·:Jt"';"C.: k.;L:";;;:<:;:;'..:·::'~::i.:,·Z;I~ ".;:;:::,t:.;.•&;.< Low Low High Data bits 8-1 5 Data bits 0- 7 Word Read High Low High ··········;·:.e:· ./·:; .:•. .:.:;:::'"•...::;.:::.q ·:.:i:· i '< /.::'::;::;., Data bits 0-7 Byte Read Low High High Data bits 8- 1 5 t;;/··.·!·:.;.·.·;:i"~;:;·!!.j~:::·.•. . :;;2·;A Byte Read Low Low Low Data bits 8-1 5 Data bits 0- 7 Word Write High Low Low Data bits 0- 7 Data bits 0-7 Byte Write Low High Low Data bits 8- 1 5 Data bits 8- 1 5 Byte Write [Z] '. No valid data output or input Table 7-3. MC68000 Function Code Summary FC2 FC1 FCO Machine Cycle Type o o o o o User data memory access o o User program memory access o o o o Supervisor data memory access 1 o Supervisor program memory access Interrupt acknowledge 1>,>,1 Reserved. currently undefined 7-9 Byte Memory with Byte Memory with Even Addresses Odd Addresses A1-A23 08-015 A 1-A23 00-07 AS - - - - 4 UOS - - - - f LOS - - - - f A1-A23~ __________ ~~ ______________________________ T-~ __ ~ 00-07 08-015 Figure 7-4. MC6S000 Interface to Memory The memory interface implied by the UDS and LOS signals is illustrated in Figure 7-4. Byte- MC68000 oriented memory with even addresses will be selected by UOS. and that memory s data lines are MEMORY connected to OS-015. LOS references byte memory with odd addresses. and its data will be INTERFACE applied to 00-07 of the Oata Bus. The AS line. shown in Figure 7-4. is the Address Strobe which is pulsed low to indicate that a valid data address is being output on the Address Bus (A 1-A23). DTACK is the Data Transfer Acknowledge input signal. This signal must be asserted by external logic during every read or write cycle. When the MC6S000 is performing a read or write cycle. it will automatically insert wait states in the cycle until the OTACK signal is received. This approach is thus the inverse of the logic used by most other microprocessors: for example. both the Z8000 and SOS6 have a "wait" input which external logic can use to extend a read or write cycle - if the wait input is not asserted. the read/write cycle will finish normally. The MC6S000 approach provides for completely asynchronous bus operations that can interface to any type of device regardless of that device's speed. This approach specifies. however. that all devices in the system must include sufficient logic to generate the i5TACK signal. FCO, FC1, and FC2 are the Function Code or processor cycle status outputs. These outputs identify the type of bus activity currently being performed by the MC68000, as summarized in Table 7-3. The Function Code outputs are valid whenever AS is true. Five different types of cycles are currently defined: access to either supervisor data memory, supervisor program memory, user data memory, or user program memory, and interrupt acknowledge cycles. Whenever the MC6S000 is involved in fetching instructions. it is considered as accessing program memory. All other memory accesses are identified as data memory accesses. The Function Code outputs could be used to separate memory into the four different categories - user versus supervisor and program versus data. Thus. by using the FC outputs an MC68000 system could directly address up to 64 megabytes of memory. with 16 megabytes devoted to each of the four defined memory categories. i'PLQ, iPL1, and IPL2 are the interrupt request inputs. These three inputs are decoded internally by the MC68000 to determine the priority level of the interrupt request. You will recall from our earlier discussion of the Status register that there is a 3-bit interrupt mask which determines what level of interrupt request will be permitted. When all three interrupt inputs are low. a non-maskable interrupt (level 7. which is the highest priority) is present. This level is always recognized by the MC6S000. When all three of the interrupt inputs are high. it indicates that no interrupt is being requested. BERR is the Bus Error input. When this signal is low the MC68000 performs a sequence (exception processing sequence) similar to that which it executes in response to an interrupt request. The purpose of the ftliI!i signal is to inform the MC68000 when an external device has not responded (using the DTACK input) within an expected amount of time during a read or write operation. Since the data transfer handshaking approach used by the MC6S000 requires all external devices to actively respond to every data transfer. the system should include a mechanism to ensure that the processor is not hung up indefinitely by a device that fails to respond. Thus external logic should be provided to monitor bus activity and which would utilize the BERR signal to inform the MC6S000 of a "failure to respond" condition. This logic would separate the preceding cause of a bus error from other causes. such as might 7-10 be generated with a Memory Management Unit (MMU). The MMU would generate BERR if an attempt was made to access protected memory. As we have already mentioned. the reaction of the MC68000 to the Bus Error input is similar to the interrupt request response. We will describe this response. termed "exception processing." in detail later in this chapter. Essentially. exception processing causes processor status information to be saved. and then allows the processor to execute a pro- gram to analyze the cause of the error. The MC68000 also provides a hardware-oriented response to a bus error: if the HALT signal is asserted in conjunction with the BERR signal. the MC68000 will automatically retry the bus cycle that produced the error. The HAi:T signal performs several functions. As we mentioned in the preceding paragraph. it can be used in con· junction with the BERR signal to initiate rerunning of bus cycles that produced bus errors. When used alone. it places the MC68000 in a Halt state where the processor is essentially inactive until the HALT signal is negated. This is the familiar Halt function provided by most microprocessors. The HALT signal is also used in conjunction with the R'E'SEi" signal to intialize the MC68000. One unusual aspect of the RESET signal is the fact that it is also an ouput signal; the MC68000 provides a RESET instruction which, when·executed. causes a low-going pulse to be output on the REffi pin. Thus. you can execute a RESET instruc- tion and use it to initialize other devices in the system without resetting the processor. HALT. like iiE'S'ET. is an output signal. If the processor ceases executing instructions - for example. if a double bus fault condition occurs - the MC68000 will output iiAi:i" low. External logic can be then used to detect this potentially catastrophic condition. ClK is the single TTL-level compatible clock from which all MC68000 internal timing is derived. iiR (Bus Request). BG (Bus Grand, and BGACK (Bus Grant Acknowledge) ar,e all bus arbitration signals. These signals are used in systems where other devices. such as DMA controllers on other processors. require control of the System Busses. External devices request access to the System Bus by asserting the BR input. The MC68000 will then always relinquish the bus after it has completed the current bus cycle. It will also output Bus Grant (BG) low to let the requesting device know that the bus will become available at the end of the current cycle: However. as we will see v:..hen we discuss the bus arbitration timing in detail. external devices or logic must monitor more than just the Bus Grant signal to determine when the bus will actually be available. The Bus Grant Acknowledge (BGACK) sig- nal must be input to the MC68000 by the device requesting the bus once that device takes control of the bus. BGACK must be held low until the device has completed its bus access operations. Thus BGACK is essentially a "bus busy" signal that lets the MC68000 (and other devices in the system) know that the bus is unavailable. The next three signals - E. VPA. and VMA - are provided so that the MC68000 can be easily interfaced to the standard and widely available 6800 family devices. 6800-based systems use a synchronous method of effecting transfers of data throughout the system. To accomplish this a system clock Enable (E) signal must be distributed to all 6800 devices in the system so that all relevant data transfers may be synchronized to this clock signal. Thus the Ena- ble (E) signal provided by the MC68000 is the equivalent of the 6800 E signal. The frequency of E is equal to one- tenth that of the ClK input to the MC68000: the period for E is equal to 10 ClK periods - E is low for six ClK cycles and is high for four ClK cycles. The Valid Peripheral Address (VPA) signal is used by 6800-type devices in the system to inform the MC68000 that a 6800-type data transfer is required. You must provide address decoding logic in the system that determines when a 6800-type device is being accessed and that generates the WA signal. When the MC68000 receives the VPA signal, it alters the data transfer timing so that it is synchronous with the Enable (E) signal. The MC68000 will then output the Valid Memory Address (VMA) signal at the appropriate time. VMA is another 6800-type sig- nal and will only be output if the VPA input signal has been asserted at the beginning of a data transfer operation. We will defer a detailed discussion of these three signals until later when we describe interfacing between the MC68000 and the 6800-family devices. MC68000 TIMING AND BUS OPERATION The basic timing for the MC68000 is quite straightforward: instruction execution consists of a combination of internal cycles and bus access cycles. The total number of clock cycles required for each instruction is defined in the instruction set summary tables later in this chapter. The number of clock cycles required to perform opera- tions internal to the MC68000 are of little interest to other devices in the system since these operations are transparent to external logic. It is only when the MC68000 requires access to the system bus for such operations as instruction fetching. operand fetching. and operand storing that external devices become involved with MC68000 timing. The MC68000 uses memory mapped I/O. Therefore, bus accesses for data transfers between the MC68000 and 7-11 I 50 I 51 I 52 I 53 I 54 55 I 56 I 57 I 50 I 51 I 52 I ClK A1-A23 R/W 08-015 00-07 FCO-FC2 Figure 7-5. MC68000 Read Word Timing memory are the same as for those between the MC68000 and I/O devices. Data transfers are defined as either read or write operations, with the transfer of data into the MC68000 defined as a "read" and the transfer of data from the MC68000 to external logic defined as a "write." Figure 7-5 illustrates the timing for a read word operation. For purposes of the following timing MC68000 discussions. each clock period is sub-divided into two states. READ During state 0 (SO) of the read word cycle. the address and data busses are in the high impedence TIMING state - the MC68000 is not using the System Bus at this point. Address information for the memory or I/O location is output at the beginning of state 1 (51) on the Address Bus (A 1-A23L Processor cycle status information is also output at this point on the FCO-FC2 pins. The Address Strobe (AS) signal is asserted at the beginning of state 2 and can be used by external logic to latch the information on the Address Bus. Simultaneously. the Upper Data Strobe (05'$') and Lower Data Strobe (Ci5$) signals are asserted to enable selection of both the most significant byte and least significant byte of a 16-bit word. You will note that these signals are not actually data "strobes" since there is no data ready to be input or output at this point; it is more accurate to think of them as memory select signals selecting the upper and/or lower byte of a 16-bit memory word. R/W is normally asserted. so this output does not change during a read cycle. The MC68000 now waits for the addressed memory or I/O device to present its data on the Data Bus. When the data is ready. the external device must assert Data Acknowledge (DT ACK) to the MC68000. The MC68000 expects DT ACK and the requested data to be present by state 5 (S5). If DTACK is not present by 55. Wait states (SW) will be automatically 7-12 inserted into the read timin~y~as illu~ted in Figure 7-6. Once DTACK is true. the read cycle continues with S5. At the end of state 6 (S6). the AS. UDS. and lOS signals are negated. At this point the incoming data on DO~Q15 is lat<;:hed into an internal MC68000 register. External devices can use the negative-to-positive transition ot" AS. 'ODS. or CDS as the indication that they can remove data from the Data Bus. TheMC68000 maintains the address information and func- tion code information through the end of state 7 (S7) to allow for signal skew within the system. Note that when the external device senses that the MC68000 has captured the data from the Data Bus (by sensing the high-going transi- tion of AS. DDS. or lOS) that device must return DT ACK high immediately so that it does not interfere with the begin- ning of the next bus cycle. If you refer to the Wait state insertion that can occur during read operations. as illustrated in Figure 7-6. you will see that the Wait states occur between state 4 and state 5. The MC68000 will maintain valid address output on the address Bus and will hold AS: ODs. and IDS low during any Wait states for as long as necessary until 5TACK is asserted. You should note that there will always be an even number of Wait states inserted; all MC68000 operations are based on a complete elK cycle and there are two "states" per ClK cycle. I 50 I 51 I 52 I 53 I 54 5W I 5W I 5W I 5W S5 I S6 I 57 I SO elK A1-A23 R/W 00-015 Figure 7-6. MC68000 Wait States During Read Operations 7-13 ClK A1-A23---{~______________~~~______________~~~______________ _--, \.... \. . .__r R/W 08-015 -------PV><.,. DO-07----------------------------~~ FCO-FC2 - - - {..._ _ _ _ _... H. ._____...)~------ Figure 7-7. MC68000 Read Byte Timing Timing for a read byte operation is illustrated in Figure 7-7. This figure shows first an even data byte and then an odd data byte being read by the MC68000. As you can see, the only difference between this timing and that illustrated for a read word operation in Figure 7-5 is that only 0i5S or rns is asserted and only eight lines of the data bus are utilized when you are reading a byte: UOS is asserted and data is on lines 08-015 when reading a byte located at an even address and IDS is asserted and data is on lines 00-07 when reading a byte located at an odd address. You should not be misled by Figure 7-7 into thinking that the MC68000 always reads two consecutive bytes - an even byte and an odd byte. We have simply shown these two read operations consecutively to illustrate timing for both. Again, if the MC68000 requires a word of data, it will utilize the entire 16-bit Oata Bus and read the full word in one operation. 7-14 Timing for a write word operation is illustrated in Figure 7-S. As was the case with read opera- MC6S000 tions. the address for the memory location or I/O device is output at the beginning of 51 along WRITE with the appropriate function code indicating the current type of processor bus cycle. If the Data TIMING Bus was utilized by the MC6S000 in the preceding cycle. the processor returns all of t.h.e data out- puts to the high impedence state during 51 and then asserts the Address Strobe (AS) signal and outputs the Read/ Write (R/W) Signal low. Once again. AS can be used to latch the address externally. and the R/W Signal indicates to memory or I/O devices that the MC6S000 will be placing data onto the Data Bus. No further Signal activity occurs until the MC6S000 outputs the data on 00-015 at the beginning of state 3 (53), The Upper and Lower Data Strobe signals (UDS. LOS) are asserted at the beginning of state 4 (54). During write operations. these two signals can be used as "strobe" signals since they indicate that the data on the Data Bus is valid. If the write operatio~roceed unim- peded. external logic must respond to the data strobe signals by asserting the Data Acknowledge (DT ACK) Signal by the beginning of state 7 (57). If DTACK is not true by the beginning of 57, Walt states are automatically inserted by the MC6S000, as illustrated in Figure 7-9. This "slow write" operation is the same as was illustrated for read operations except that the Wait states are inserted at a different point in the cycle. The MC6S000 outputs the data on 00-015 through the entire write operation. The Address Strobe (AS) and data strobes (UDS. LOS) are negated at the beginning of state 9 (59) and the Read/Write (R/W) signal is returned high at the end of S9. At that point. the Address Bus. Data Bus. and Function Code outputs are all returned to their high impedance state to free the System Bus for other uses. The external memory or I/O device that was accessed by the write operation I 50 I 51 I 52 I 53 I 54 I 55 I 56 57 I 58 I 59 I 50 I ClK A1-A23 AIW 08-015 00-07 FCO-FC2 Figure 7-S. MC6S000 Write Word Timing 7-15 elK A1-A23 R/W 00-015 - - - - -..... Figure 7-9. MC68000 Wait States During Write Operations must release the Data Acknowledge (DT ACK) signal after it has detected the positive-to-negative transition of the address or data strobe signals. This ensures that a subsequent bus cycle will not be impeded. Timing for write byte operation is illustrated in Figure 7-10. As you can see, the only difference between this opera- tion and the write word timing illustrated in Figure 7-8 is the fact that only ODs or L5S is output while a byte is being written. 7-16 MC68000 READ-MODIFY-WRITE TIMING The read-modify-write cycle provided by the MC68000 is unusual among microprocessors, although it is fre- quently provided by minicomputers. The MC68000 uses the read-modify-write cycle only during the execution of the Test and Set (TAS) instruction. This instruction reads a byte of data. sets condition codes according to the contents of that byte. sets bit 7 of the byte. and then writes it back into memory. The T AS instruction is intended to be used as a means of providing "safe" communication between microprocessors in a multi-processor system. Safe com- munication is ensured with the T AS instruction since the read-modify-write cycle is non-interruptable. ClK A1-A23--(..._ _ _ _ _ _ _~H'- _______~}- As~..._ _ _ _~1 \...._------1 R/W 08-015 ----04 00-07----------------------------~ FCO-FC2--{..._ _ _ _ _ _ _~H . . _______...J}- Figure 7-10.. MC68000 Write Byte Timing 7-17 Figure 7-11 illustrates the timing for a read-modify-write cycle. As you can see, it simply consists of the read- byte cycle followed by a standard write-byte cycle. There is one intervening clock period (58, 59) between the read and write cycles and it is during this interval that .the byte of data is modified internally for the subsequent write. Just as was the case with standard read and write. external logic must reply with OT ACK at the proper time or else Wait states will automatically be inserted to lengthen the read or write operations. Note that in Figure 7-11 we have shown that either UOS or LOS will be asserted during the read-modify-write opera- tion. Th is is because the T AS instruction always operates on a byte of data. never on a word of data. Read Modify Write CLK A1-A23 UOS or lOS R/W 00-07or ____________ 1X~~ 08-015 ~~~__.....I FCO-FC2 LJ }- ~-------------------------------- Figure 7-11. MC68000 Read-Modify-Write Timing 7-18 The MC68000 RESET OPERATION The MC68000 has an asynchronous reset input. You reset the microprocessor by holding the RESET and HALT signals low for at least 100 milliseconds. After the RESET and HALT signals are returned high, the MC68000 executes the following 'operations: 1) The MC68000 reads the first four words from memory (bytes 000000 through 000007) and uses the con- tents of these locations to load the System Stack Pointer (SSP) and Program Counter (PC). The contents of these eight bytes from the beginning of memory are used as follows: Memory 000000 2 000001 31 o 3 4 - .......- 000002 000003 SSP~I__________~____2____~____3____~~____4____~ 5 --- 000004 6 7 - 000005 000006 31 o 8 000007 peL 5 6 7 8 000008 2) The interrupt mask in the Status register is set to all ones so that only level 7 interrupts will be enabled. No other registers are affected by the reset operation: therefore, when a reset is performed after applying power to the MC68000, all registers except SSP, PC, and the Status register will contain indeterminate values. 3) Program execution begins, with the first instruction being fetched from the location indicated by the value loaded into the Program Counter. The sequence we just described is the typical externally-initiated reset operation similar to that provided by most microprocessors. You will recall, however, that the RESET pin is bidirectional; when the MC68000 executes a Reset instruction, a low-going pulse is sent out on the RESET pin. This software RESET pulse is low for 124 ClK cycles. This instruction has no effect on the internal state of the MC68000, therefore none of its internal registers are affected. In this case, the RESET signal is being used to reset all other devices within the system under the control of the MC68000. THE MC68000 HALT STATE The MC68000 can be forced into a Halt state, at which time its Address Bus, Data Bus, and Function Code out- puts (FCO-FC2) are placed in the high-impedance state. This state is similar to the Hold state of the 8086 and the Stop state of the Z8000. The Halt state can be used to disable the MC68000 and thus free the System Busses for such activities as direct memory access or mUlti-processor operations. However, since the MC68000 includes an efficient bus arbitration system, it is more likely that the Halt state will be used to implement a hardware single-step mode. Figure 7-12 illustrates the timing for the Halt operation. If the MC68000 is in the middle of a bus cycle when the HALT signal is input low, the bus cycle continues to its normal completion. At the end of the cycle the Address Bus, Data Bus, and FCO-FC2 signals are all placed in the high impedance state and the MC68000 halts. While it is in this halted condition, the processor does nothing - it merely waits for the .HAlT signal to return high. Note that the MC68000 provides no halt acknowledge indication to external logic. However, while the MC68000 is in the Halt state, its bus arbitration circuitry still operates. Since the MC68000 wiU not be using the bus while it is halted, any bus request made to the MC68000 will be granted immediately. We will defer a detailed discussion of the bus arbitration circuitry until later. When the HALT signal is returned high, the MC68000 exits the Halt state within two clock cycles and can then begin another bus cycle. The execution of most MC68000 instructions requires multiple bus cycles to fetch the instruction and operands and, possibly, to store results of the instruction. Since the MC68000 will respond to the HALT input upon completion of any bus cycle, the halt sequence can occur between two instructions or in the middle of a single instruction. Therefore, if you are using the HID input to implement a single-step mode of operation, you will be single- stepping by bus cycles rather than single-stepping by instructions. If you want to single-step by instructions, you 7-19 Completion of Halt State. Address Bus. Data Initiate next current bus cycle ---i+--Bus and FCO-FC3 put into-"'~--bus cycle high impedance state CLK A1-A23 R/W 00-015 FCO-FC3 Figure 7-12. MC68000 Halt State Timing must use the Trace function of the MC68000. This function is implemented by setting the T-bit in the Supervisor byte of the Status register. We will describe the Trace operation in detail later. The HALT signal is bidirectional and will be asserted by the MC68000 if it initiates a Halt state rather than hav- ing external logic cause the Halt. The MC68000 will automatically enter the Halt state if there is a double-bus fault (we will discuss bus errors and double-bus faults in detail later). If the MC68000 has automatically entered the Halt state, the processor will output HALT low and remain in this halted condition until an externally initiated reset opera- tion is performed using RESET. Thus, when HALT is output low by the MC68000, it indicates a catastrophic failure. THE MC68000 STOP STATE Following execution of the STOP instruction, the MC68000 microprocessor will enter a Stop state. The STOP instruction is permitted only when the MC68000 is operating in the Supervisor mode as indicated by the S-bit in the Status register. The Stop state is similar to the HALT state which we just discussed, since the microprocessor essen- tially does nothing while in this state. When the STOP instruction is executed, the Status register is loaded with a new value contained in the instruction. Next. the Program Counter is advanced to point to the next instruction and the MC68000 stops. No special signal or status is output by the MC68000 to identify that it is in the Stop state. The Stop state is ended by one of the exception conditions such as an interrupt request or a RESET. When an exception condition is detected by the MC68000, it leaves the Stop state and will process the exception condition. 7-20 THE MC68000 BUS CYCLE RERUN TIMING As we mentioned earlier, the MC68000 can respond in two ways to a System Bus error, indicated by the asser- tion of iEiiR. It can perform exception processing (which we will describe later), or it can attempt to rerun the bus cycle which caused the bus error indication. If BERR is asserted by itself, then the exception proces~~.~Jor soft- ware) method of handling the bus error is taken. However, if the BERR signal is accompanied by the HALT signal then the MC68000 recognizes this as a request to rerun the bus cycle. Figure 7-13 illustrates the timing for the bus cycle rerun operation. In this figure, we have shown a write cycle in progress, with the MC68000 waiting for the external device to respond with DT ACK so that the cycle can be completed. Instead of the expected acknowledge signal. external logic forces both the BERR and HALT signals low to indicate that the cycle was not successfully completed and that the MC68000 should rerun the cycle. The MC68000 proceeds to complete the cycle that was in progress and then enters the HALT state. The Address Bus, Data Bus, and Function Code outputs are all placed in the high impedance state and the microprocessor remains halted until both BERR and HALT are negated. Note that ~ should be negated before HALT is negated to prevent the MC68000 from interpreting the isolated BERR signal as another bus error - one that is expected to be handled in soft- ware. After HALT returns high, the MC68000 will proceed to repeat the cycle that was in progress when the rerun request was received; i.e., the same address, data, and function code information that was used in the previous bus cycle will be repeated. Write Cycle N Halt Rerun Write Cycle N I~I~I~I~I~I~I~I~I~ ClK ~ l A1-A23 Address N Address N l AS UOS/lDS R/W l l OTACK l 00-015 Oata N Oata N l l FCO-FC2 Function N Function N l BERR HALT Figure 7-13. MC68000 Rerun Bus Cycle Timing 7-21 Figure 7-13 shows the successful completion of the rerun cycle with i5TACR being received in the expected interval. Of course, this will not always be the case - the attempt to rerun the bus cycle might also result in a bus error. External logic can continue to request that the cycle be rerun an unlimited number of times, using the com- bination of BERR and HALT. You should note, however,· that if you are using the software exception processing method of handling the bus error (BERR asserted alone without HALTl. then two successive bus errors are treated as a catastrophic error and the MC68000 will automatically enter the Halt state and remain there until reset. If the MC68000 is performing a read-modify-write cycle and a bus error is encountered, it will not rerun the cycle. This is done because the read-modify-write is only used during the Test and Set (TAS) instruction. The nature of this instruction demands complete execution cycle integrity, which might be violated if any of the bus cycles were repeated. If external logic requests a rerun of the read-modify-write cycle, the MC68000 will instead perform the bus error exception processing routine, which we will describe later. MC68000 BUS ARBITRATION LOGIC The bus arbitration logic provided by the MC68000 is straightforward. The MC68000 does not prioritize requests for bus accesses by external devices. The processor assumes that it is the lowest priority device in the system since it always grants bus access to any requesting device so long as the processor is not currently using the bus itself. Thus the MC68000 allows other devices to utilize the bus between instructions and between bus cycles of a single instruction. Since there is no built-in arbitration there should be some external bus arbitration logic in a system of any complexity to prioritize requests for the System Bus so that a high priority device is not superseded by low priority devices. There are three signals associated with the bus arbitration logic: Bus Request (BR), Bus Grant (aG)' and Bus Grant Acknowledge (BGAcK). When the MC68000 is using the System Bus without competition, the input signals - BR and BGACK - will be inactive and the BG output will be negated. Figure 7-14 illustrates the timing for the bus arbitration performed by the MC68000. Bus arbitration com- mences when an external device pulls the BR input low. When the MC68000 receives a bus request it will respond by asserting BG one ClK period later. The only exception to this immediate response is when the MC68000 is in the initial stages of a bus cycle but has not yet asserted AS. In this case the MC68000 waits until one elK period after AS has been asserted before it asserts BG; the response time in this case will be a maximum of three ClK periods. Obviously, the Bus Grant signal does not indicate that the bus is available for use by the requesting device at that point - the MC68000 may still be using the bus to complete its current bus cycle. Therefore the device requesting the bus must monitor several other signals to determine when the bus is actually available for its use. First. the external device must wait until AS is negated, indicating that the MC68000 has completed the current bus cycle. The device requesting the bus must also wait until the DTACK signal is negated, since this indicates that the device involved in the current MC68000 cycle is no longer using the bus. However, in some systems it may not be necessary to monitor the DT ACK signal. This is the case when system timing is such that you are always assured that all external devices will be off the bus when AS is negated. Lastly, the requesting device must check the state of the BGACK signal. If this signal is true, it indicates that some other device in the system has already been granted use of the System Bus and has not yet finished with it. Conversely, if BGACK is false, then the System Bus will be available for use at the end of the current cycle. After all of the signal conditions we have described are met, the device requesting the bus must assert BGACK. This informs the MC68000 that the requesting device has ~aken control of the bus. You will note in Figure 7-14 that the MC68000 does not wait for the BGACK signal before it relinquishes control of the bus: the Address and Data Busses, the Function Code outputs, AS, UDS, lDS, and R/W are all placed in the high impedance state as soon as the MC68000 has completed the bus cycle that was in progress when the bus request was received. The device that is using the bus must hold BGACK low for as long as it requires the bus. While an external device has control of the bus, external logic should prevent bus conflicts by monitoring BGACK; at this point the behavior of BR and BC is unimpor- tant. However, the device using the bus should negate its BR before negating BGACK to avoid an incorrect bus request. The MC68000 will maintain its output lines in the high impedance state until BGACK is negated, indicating that the external device is through with the bus. At that point the MC68000 is free to initiate another bus cycle. Note that if another bus request is pending at that point the MC68000 will acquiesce to that bus request immediately without per- forming any bus cycles itself. 7-22 MC68000 EXCEPTION PROCESSING LOGIC All of Motorola's literature on the MC68000 refers to "exception processing" when discussing what we usually describe as the interrupt system in other microprocessors. They have chosen to use this nomenclature since the events that can cause "interrupts" in the MC68000 cover a much broader range than those usually associated with an interrupt request in a typical microprocessor. We will also use the "exception processing" nomenclature. MC68000 MC68000 initiates '-------t....--System bus available for use by external devices---+t---completes a bus cycle bus cycle ClK A1-A23 R/W 00-015 FCO-FC2 Figure 7-14. MC68000 Bus Arbitration Timing 7-23 The MC68000 provides extensive exception processing logic. This logic is similar to that provided by the 8086 and Z8000 in that a jump vector table is used to transfer program control to the appropriate handler program whenever an exception occurs. The biggest difference between the MC68000's logic and that of the Z8000 and 8086 is that the number of events that can generate an exception in the MC68000 is greater than the num- ber of events that cause interrupts in Z8000. In addition, the MC68000 provides a 7-level priority structure for external interrupt requests. Before proceeding to describe the exception processing system, let us discuss the operat- MC68000 ing modes of the MC68000, since these affect exception processing. As 'We mentioned pre- OPERATING viously. the MC68000 can operate in either a Supervisor mode or a User mode. When the MODES MC68000 is reset using the RESET input. it starts operating in the Supervisor mode. The pro- cessor remains in Supervisor mode until one of the following instructions is executed: Return from Exception (RTEL Move to Status Register (MOVE word to SR), AND Immediate to Status Register (ANDI word to SRL and Exclusive OR Immediate to Status Register (EORI word to SR). None of these instructions automatically causes the tran- sition to User mode of operation - rather. they are capable of changing the state of the S-bit in the Status register. If one of these instructions resets the S-bit. the MC68000 will begin operating in the User mode. Once the MC68000 is operating in the User mode, the only thing that can cause a transition back to the Super- visor mode is an exception. All exception processing is performed in Supervisor mode regardless of the current set- ting of the S-bit of the Status register. When the exception processing has been completed. the Return from Exception (RTE) instruction allows return to the User mode. A number of instructions. designated as "privileged." are reserved for the Supervisor mode. An attempt to execute one of these instructions in the User mode results in a "privilege violation" which is one type of exception. We will discuss these instructions and the privilege violation response later in this chapter. MC68000 EXCEPTION TYPES Exceptions originate in a variety of ways which can be divided into two general categories: 1) Internally generated exceptions that result from the execution of certain instructions. or from internally detected errors. 2) Externally generated exceptions which include bus errors. reset. and interrupt requests. The response of the MC68000 to the various types of exceptions is similar. Before we describe this response. let us look at the sources of exceptions since they go well beyond those provided by other microprocessors. MC68000 The internally generated exceptions to which the MC68000 responds can be further sub- INTERNALLY divided into three categories: internally detected errors, instruction traps, and the Trace GENERATED function. EXCEPTIONS The following are the internally detected errors which will cause the MC68000 to initiate exception processing: 1) Addressing errors. Whenever the MC68000 attempts to access word data. long word data. or an instruc- tion at an odd address. this is an address error since all such accesses must be on even address boundaries. 2) Privilege violations. Again. some instructions are reserved for use only in the Supervisor mode. Exception processing will be initiated if you attempt to execute any of the following instructions when in the User mode: STOP. RESET. RTE. MOVE to SR. AND (word) Immediate to SR. EOR (word) Immediate to SR. OR (word) Immediate to SR. MOVE USP. 3) Illegal and unimplemented opcodes. If an instruction is fetched whose bit pattern is not one of the defined instruction bit patterns for the MC68000. exception processing will be initiated. Two bit patterns are defined as unimplemented rather than illegal: if bits 15-12 are 1010 or 1111. these are treated as unimple- mented instruction opcodes. If these opcodes are fetched. special exception processing is initiated which can allow you to use these unimplemented instructions in your own software. Instruction traps are exceptions which are caused by the execution of instructions in your program. There is a standard TRAP instruction which is similar the Z8000 System Call instruction. There are four other instructions - TRAPV, CHK, DIVS, and DIVU - which will cause exception processing to be initiated if certain conditions. such as arithmetic overflows or divide by zero. are detected. The third type of internally generated exception occurs when the MC68000 is operating with the Trace func- tion. If the T-bit in the supervisor portion of the Status register is set. exception processing will be performed after each instruction. The Trace function is used for program debugging since you can analyze. by stepping through the program. the results of each instruction's execution. 7-24 There are three different types of externally generated exceptions: MC68000 1) Bus errors. When the BERR signal is pulled low by external logic (while HALT is high) EXTERNALLY exception processing is initiated. GENERATED 2) Reset. When the RESET signal is asserted by external logic, exception processing is EXCEPTIONS initiated. 3) Interrupt request. This is the most familiar form of exception processing and is initiated by external logic via the three interrupt request lines (iPLO, IPL 1, and IPL2). The different types of exceptions have different priorities, and processing of an exception MC68000 depends on its priority. The following table lists the types of exceptions according to their EXCEPTION relative priorities, and also defines when processing of each type begins. PRIORITIES Priority Exception Source Exception Processing Response RESET Abort current cycle, then Highest BERR (Bus Error) process exception Address Error Trace Complete current instruction, then Interrupt Request process exception Illegal/Unimplemented Opcode Privilege Violation TRAP, TRAPV Instruction execution initiates Lowest CHK exception processing Divide-by-zero The highest priority types of exceptions are Reset. Bus Error, and Address Error. Any of these exceptions will cause immediate termination of the current instruction, even within a bus cycle. The next group of exceptions - trace, inter- rupt requests, illegal/unimplemented instructions, and privilege violations - allow completion of the current instruc- tion before initiating exception processing. Note that interrupt requests include an additional prioritization which we discussed earlier. The lowest priority of exceptions are those that are caused by trap-type instructions. These instruc- tions can initiate exception processing as part of their normal execution. All of the instruction trap exceptions have equal priority since it is impossible for two of them to generate exceptions simultaneously. Central to the MC68000 exception processing sequence is a vector table that occupies MC68000 1024 bytes (512 sixteen-bit words) of memory. This table occupies memory addresses EXCEPTION 000000 16 through 0003FF 16 . Figure 7-15 illustrates the exception vector table. The table is VEC:rOR organized as 256 four-byte vectors. Each vector is a 32-bit address which will be loaded into the TABLE Program Counter as part of the exception processing sequence. As you can see, a number of the vector table entries serve the defined types of exceptions which we have dis- cussed. The remaining entries of the vector table are reserved for use by Motorola and should not be used by your pro- gram if compatibility with Motorola software is desired. The first 64 exception vectors have predefined uses; this leaves 192 vectors available to external interrupt requests - this should be more than enough for most applications. However, the first 64 vector locations are not protected by the MC68000; thus they can be used by external interrupts if a system requires it. MC68000 EXCEPTION PROCESSING SEQUENCES The general sequence of events performed by the MC68000 in response to an exception is the same regardless of the source of the exception. There are, however, some differences. Let us begin by examining the response to internally generated exceptions. If exception processing is initiated as a result of either the Trace function, a TRAP instruc- MC68000 tion, an illegal or unimplemented opcode, or a privilege violation, the following steps occur: INTERNALLY 1) The Status Register contents are copied into an internal register. GENERATED 2) The S-bit in the Status Register is set. thus placing the MC68000 in the Supervisor EXCEPTION mode of operation. PROCESSING 7-25 Memory Addresses 1---16 B i t s - (Hex) 000000 SSP (High) I' Reset _ Initial SSP 000002 SSP (Low) II Reset - Initial PC Vector 2 - Bus Error Vector 3 - Address Error Vector 4 - Illegal Instruction Vector 5 - Divide by 0 Vector 6 - CHK Instruction Vector 7 - TRAPV Instruction Vector B - Privilege Violation Vector 9 - Trace Vector 10,0 - Opcode 1010 Emulation I I >Vector 12 10 I Vector 11, 0 - Opcode 1111 Emulation Reserved by Motorola } Vector 23,0 } Vector 24, 0 - Spurious Interrupt ~~~~I) !jI Vector 25,0 - Levell Interrupt Vector 26,0 - Level 2 Interrupt Vector 2710 - Level 3 Interrupt Vector 28 10 - Level 4 Interrupt >ifAuto-Vectors VPA low Vector 29,0 - Level 5 Interrupt I I-;..;,o;,__~-H Vector 30 10 - Level 6 Interrupt J Vector 32,0 I Vector31,0- Level 7 Interrupt) TRAP OOOOBC .....-P-C-4-7...(H OOOOBE PC47 (Low) 9h..) -1 ..i... I I t Vector 47 10 Instruction Vectors OOOOCO 0000C2 PC48 (High) PC48 (Low) Vector 48 10 1 I Reserved by OOOOFC PC63 (High) • t Vector 63 Motorola OOOOFE ......P...C... 000100 000102 6_3...(L_O_W.. PC64 (HIgh) PC64 (Low) ).., I Vector 64 1 I l JI ) User Vectors 0003FC 0003FE [ PC255 (HIgh) PC255 (Low) J J} Vector 255 Figure 7-15. MC68000 Exception Vector Table 7-26 3) The T-bit in the Status Register is reset to disable tracing to allow for continuous execution when debug- ging using TRACE. 4) The Program Counter contents are pushed onto the Supervisor Stack. The contents of SSP will be decre- mented by four since four bytes are required to store the 32-bit contents of Pc. 5) Status register contents are pushed onto the Supervisor stack; SSP contents are decremented by two, since the Status register is a 16-bit register. 6) The new Program Counter contents are taken from the appropriate location in the interrupt vector table. 7) Instruction execution then begins at the location indicated by the new content of the Program Counter; this will be the first instruction of the exception processing program you have provided for that particular type exception. The way in which the MC68000 responds to an exception caused by a bus error or address MC68000 BUS error includes several steps in addition to those described in the preceding paragraphs. First, AND ADDRESS recall that either of these errors causes immediate termination of the bus cycle in progress. ERROR The next steps are the following: EXCEPTION 1) The contents of the Status register are copied into an internal register. PROCESSING 2) The S-bit in the Status register is set. placing the MC68000 in the Supervisor mode. 3) The T-bit in the Status register is reset to disable trace operations. 4) The contents of the Program Counter are pushed onto the Supervisor stack and the System Stack Pointer (SSP) is decremented by four. 5) The contents of the Status register are pushed onto the Supervisor stack and the contents of SSP are decre- mented by two. 6) The contents of the MC68000's instruction register, which constitute the first word of the instruction that was in progress when the bus error occurred, are pushed onto the Supervisor stack and SSP is decremented by two. 7) The 32-bit address that was being used for the bus cycle which was terminated is also pushed onto the Supervisor stack and SSP is decremented by four. 8) A word which provides information as to the type of cycle that was in progress at the time of the error is pushed onto the Supervisor stack and SSP is decremented by two. 9) The Program Counter contents are taken from the appropriate interrupt vector - either the bus error vector or address error vector of the exception vector table. 10) Instruction execution resumes at the location indicated by the new contents of the Program Counter. Figure 7-16 shows the order in which information is pushed onto the Supervisor stack as part of the exception processing for bus and address errors. The value saved for the Program Counter is advanced two to ten bytes beyond the address of the first word of the instruction where the error occurred according to the length of that instruction and its addressing information, if any. As you can see in Figure 7-16, the five least significant bits of the last word pushed onto the Stack provide infor- mation as to the type of access that was in progress when the bus error or address error occurred. The three least Significant bits are a copy of the Function Code outputs during the aborted bus cycle. Bit 3 indicates the type of pro- ceSSing that was in progress when the error occurred. This bit is set for Group 0 or 1 exception processing and reset for Group 2 exception and normal instruction processing. Bit 4 indicates whether a read (bit 4 set) or write (bit 4 reset) cycle was in progress when the error occurred. If an error occurs during the exception processing of a preceding bus error, address error, or reset operation, the MC68000 will enter the Halt state and remain there. All of the information that is pushed onto the Supervisor stack as part of the bus and address error exception processing sequence is intended to aid you in analyzing possible sources of the error. Either of these errors implies a serious system failure and it is not likely that you will be able to return to normal program execution. ,.....----"'" MC68000 An external reset causes a special type of exception processing. After the RESET input has RESET been pulsed low the following steps occur: EXCEPTION PROCESSING 1) The S-bit in the Status register is set. placing the MC68000 in the Supervisor mode. 2) The T-bit in the Status register is reset to disable the trace function. 3) All three interrupt mask bits in the Status register are set. thus specifying the interrupt priority mask at level seven. 4) The Supervisor Stack Pointer (SSP) is loaded with the contents of the first four bytes of memory (addresses 000000-000003) . 7-27 r - - - - - - - - - j 0 = Write cycle aborted l 1 = Read cycle aborted 0 = Instruction in progress "+ .1 ~ { 1 = Exception processing Fun,tion Code IFC2. FC 1. FCOI SSP after - - - -...~r_ _ _ _ _ _ _ _ _ _ _ _..!4~3~2~!.1...20~""-Bit No. exception - Lower Access Type'" I 11 I I Address t-----C-u-rr-en-t-C-y-C-le;.;.A-d-d-r-e-ss-(h-ig-hL-o-r-ld-e-'r)L.-L--I--I Current Cycle Address !low-order) Instruction Register Status Register PC (high-order word) SSP bef?re - - - - . Higher PC !low-order word) exception Address ...- - - - - - - - - - - - - - - - -..... -------16-Bit Words------- Figure 7-16. MC68000 System Stack After Bus Error or Address Error 5) The Program Counter (PC) is loaded from the next four bytes of memory (addresses 000004-000007). 6) Instruction execution commences at the address indicated by the new contents of the Program Counter. which should reference your power-up/reset initialization program. MC68000 The last type of exception processing we will discuss is the sequence initiated by the stan- INTERRUPT dard interrupt request. An external device requests an interrupt by encoding an interrupt REQUEST request level on the IPLO-lpL2 inputs. The MC68000 compares these inputs to the interrupt EXCEPTION mask bits in the Status register. If the encoded priority level is less than or equal to the one PROCESSING specified by the three-bit mask. the interrupt request will not be recognized by the MC68000.lf the encoded interrupt level is a higher priority than the level established by the interrupt mask (or if a level seven interrupt request is input) then the interrupt will be processed. The MC68000 responds to the allowed interrupt request as soon as it completes the instruction execution currently in progress. Upon completion of the current instruction, the following steps occur: 1) The contents of the Status register are saved internally. 2) The S-bit in the Status register is set. placing the MC68000 in the Supervisor mode. 3) The T-bit in the Status register is reset to disable the Trace function. 4) The interrupt mask bits in the Status register are updated to the level of the interrupt request that is encoded on the IPLO-IPL2 inputs. This allows the current interrupt to be processed without being inter- rupted by lower priority events. 5) The MC68000 then performs an interrupt acknowledge bus cycle. This cycle serves two functions; first. the processor lets the requesting device know that its interrupt request is being serviced. and second. the pro- cessor fetches an exception vector byte from the requesting device. Figure 7-17 shows the timing for this interrupt acknowledge/vector fetch cycle. This cycle is esentially a read cycle with a few minor differences. First. address lines A 1 through A3 will reflect the states of the IPLO-IPL2 inputs so that external logic can determine which interrupt request is being processed. All of the other address outputs are set dur- ing the interrupt acknowledge cycle. The requesting device responds to the MC68000 by lJlacing a byte of exception vector data on the lower half of the data bus. The Data Transfer Acknowledge (DTACK) signal is used to effect this transfer of data just as with a normal read cycle. Throughout the interrupt acknowledge cycle. the Function Code outputs (FCO-FC2) will be set high since this represents the interrupt acknowledge function code. After the vector byte has been read from the interrupting device. the MC68000 proceeds with the following exception processing steps. 6) The contents of the Program Counter are pushed onto the Supervisor stack and SSP is decremented by four. 7-28 Complete Current ----.+---Interrupt Acknowledge Bus Cycle Instruction ClK A4-A23 A1-A3 R/W 08-015 00-07 FCO-FC2 Interrupt Request ~---- No Request (lPLO = IPl1 = IPL2 = 1) Figure 7-17. MC68000 Interrupt AcknowledgeiVector Fetch Cycle 7-29 7) The contents of the Status register are pushed onto the Supervisor stack and SSP is decremented by two. 8) The Program Counter is loaded with four bytes of data from the appropriate location in the exception vector table. The address for this location is derived as shown in the following illustration: Vector No. from interrupting device--"'1...;'~~L.,..J....l.,~,.l.,..J Address Outputs ~-------Address range = 000000-0003FC----------t The eig ht bits of data that were read from the requesting device as part of the interrupt acknowledge cycle are used to form address bits A2 through A9. The two least significant bits and bits A 10 through A23 will all be set to zero. Thus, addresses 00000016 through 0003FC16 can be generated. If you refer to Figure 7-15, you will see that these are the upper and lower boundaries of the exception vector table. Under normal cir- cumstances a requesting device should limit itself to producing vectors corresponding to the address range 0000FC16 through 0003FC16 since the lower addresses in the vector table have preassigned uses. After the Program Counter has been loaded with the new value from the exception vector table, instruction execution commences at the location indicated by the new contents of the Program Counter; this will be the first instruction of your interrupt processing routine for the particular device requesting the interrupt. There are two variations to the interrupt request processing sequence we have just de- MC68000 scribed. First, if during the interrupt acknowledge bus cycle the requesting device responds SPURIOUS by asserting BERR instead of DTACK, the MC68000 treats this as an indication that the cur- INTERRUPT rent interrupt request is a spurious one, and it will use vector 24 in the exception vector table to load the Program Counter. MC68000 The second variation on interrupt request processing is the autovector response. If you refer AUTOVECTOR to Figure 7-15, you will see that seven vector locations are provided in the exception vector INTERRUPT table for autovectors, corresponding to the seven interrupt priority levels. These vectors RESPONSE will be used if the device requesting an interrupt r~nds to the interrupt acknowledge bus cycle by asserting the Valid Peripheral Address (VPA) signal instead of supplying a byte of vector data. If this occurs, the MC68000 will respond by asserting the Valid Memory Address (VMA) signal. The processor will then use the appropriate autovector from the exception vector table to obtain a new Program Counter value. This autovector response was provided specifically to emulate the interrupt timing sequence expected by 6800-family peripheral devices. The VPA/VMA sequence is the standard 6800 microprocessor interrupt sequence. Of course a non-6800- family device in the system could also exploit this autovector capability should it be advantageous. MC68000 ADDRESSING MODES The MC68000 utilizes 14 different addressing modes which can be grouped into six basic types. These are: 1) Direct Register Addressing a) Data Register Direct b) Address Register Direct 2) Direct Memory Addressing a) Absolute Short b) Absolute Long 3) Indirect Memory Addressing a) Register Indirect b) Post-increment Register Indirect c) Pre-decrement Register Indirect d) Register Indirect with Displacement e) Register Indirect with Index and Displacement 4) Implied Register Addressing 7-30 5) Program Counter Relative Addressing a) PC-relative with Displacement b) PC-relative with Index and Displacement 6) Immediate Data Addressing a) Immediate b) Quick Immediate These addressing modes help create a powerful and efficient instruction set. In particular. two useful features of the MC68000 addressing are that any address register may be used for direct or indirect addressing. and any register may be used as an index register. The general format of a single effective address instruction operation word is shown below. Thetwo least signifi- cant 3-bit fields determine the effective address. These fields are the mode field (bits 3-5) and the register field (bits 0- 21. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 ",--Bit No. IXlxlxlxlxlxlxlxlxlxlmlmlmlrlrlrl TT. - -----Re9ister Field Mode Field In some cases. the information contained in these two fields may be appended to fully specify the operand. In this case. one or two additional words are appended onto the instruction. This additional information is called the effec- tive address extension. and its format is: Operation Word 111- "E E o ::J ~ Immediate Operand (if any. one or two words) - ~ .~ c: 10 Source effective address extension . .2 E ~ 5 r--- (if any. one or two words) - Sxu..0 w- ~ Destination effective address extension (if any. one or two words) - --------16 Bits-------- We will now discuss the addressing modes in detail. The following abbreviations are used within this section. An Address register n (0 < n < 7) CCR Condition code half of the Status register dddd displacement value On Data register n (0 ~ n :; 7) EA effective address N operand size in bytes (1.2.or 4) PC Program Counter pppp qqqq xxxx yyyy any four hex digits zzzz Rn any address or data register n (0 < n ~ 7) rrr the 3-bit value of n - SP the active Stack Pointer SR Status register SSP Supervisor Stack Pointer ssss sign extension digits USP User Stack Pointer 7-31 Register Direct Addressing MC68000 This addressing mode requires that the operand involved be contained in one of the eight Data REGISTER registers or one of the eight address registers (Mode = 0012). DIRECT ADDRESSING Memory {: } ............................. } Operation word xl xl111111010To Extension word C ssxxyy ssxxyy + 1 ssxxyy + 2 • ~II I Operand (1, 2, or 4 bytes) ssxxyy + 3 ~ Byte EA = Sign extended value of the extension word = Mode 111 2 Register = 000 2 Figure 7-18. MC68000 Absolute Short Direct Memory Addressing Memory I, xlxl11111101011 >Operation word 1< pp qq >First extension word xx yy >Second extension word I' Operand (1, 2, or 4 bytes) ppqqxxyy + 2 ppqqxxyy + 3 EA = Concatenation of extension words = Mode 1112 = Register 001 2 Figure 7-19. MC68000 Absolute Long Direct Memory Addressing 7-32 Data Register Direct Address Register Direct EA =Dn EA =An = Mode 000 2 = Mode 001 2 Absolute Data Addressing MC68000 There are two forms of this addressing mode. The short form is called absolute short addressing, ABSOLUTE while the longer format is called absolute long. DATA ADDRESSING Absolute short. One extension word is necessary for this addressing mode. The address of the operand is the sign extended value of the extension word. Figure 7-18 illustrates the absolute short addressing mode. Absolute long. Two words of extension are required for this addressing mode. The address of the operand is the con- catenation of the two extension words; the first is the high-order portion, the second is the low-order portion. Figure 7- 19 illustrates the absolute long addressing mode. Register Indirect Addressing MC68000 The five variations of this addressing mode each reference an operand in memory. REGISTER Address register indirect. In this mode, the address of the operand is the contents of the INDIRECT specified Address register. Figure 7-20 illustrates the address register indirect mode. ADDRESSING Address register indirect with postincrement. In this mode, the address of the operand is the contents of the specified Address register. After the instruction using this mode is executed, the contents of this register are incremented by one, two, or four depending on the size of the operand. If the Address register is A7 (SP) then the address is incremented by two regardless of the operand size, because the Stack Pointer must be kept on a word boundary. Figure 7-21 illustrates the Address register indirect with postincrement mode. Address register indirect with predecrement. This addressing mode is similar to the previous one vvith the exception that the contents of the specified Address register are decremented before they are used to reference the operand. Address Registers Memory AO ~----------------~ l'--T"T""II"'"'T""T""'Ii""'T"-I} Operation word A1 A2 ~--------------~ A3 ~--------------~ A4 ~--------------~~ xxxxyyyy • • A5 A6 ~----------------~ xxyyyy~1 xxyyyy + 1 I Operand (1, 2, or 4 bytes) A7 ~----------------~ ~--------------~ xxyyyy + 2 xxyyyy + 3 (In this example rrr = 100) ~ EA = [An] Byte = Mode 010 2 Register n = Figure 7-20. MC68000 Address Register Indirect Memory Addressing 7-33 Address Registers Memory AO A1 ~---------------I A2 ~-----------------I A3 ~---------------I A4 ~-----------------I A5 ~-----------------L~ xxxxyyyy I I ~ 0 ..""" 11. 2. 0.4 bytesl .. A6 A7 ~---------------I ~-------------- xxyyyy + 2 (In this example rrrr = 101) xxyyyy + 3 ~ EA = [An) Byte [An) = [An) + N = Mode 011 2 Register n= Figure 7-21. MC68000 Address Register Indirect with Postincrement Addressing Address Registers Memory AO A1 t-----~x:x:xX~y:y:y~y---:::~~---------------------Jt1~~nr.r.T;1 A2 ~ ______________-a. . A3 A4 ~-----------------I I I ~-----------------I I I ~ Operand (1, 2, or 4 bytes) A5~______________~ xxyyyy - N .. A6~______________~ xxyyyy - N + 1 A7 ~-------------- xxyyyy - N + 2 (In this example rrrr = 001) xxyyyy - N + 3 [An) = [An) - N ~ EA =[An) Byte = Mode 100 2 Register n = Figure 7-22. MC68000 Address Register Indirect with Predecrement Addressing Again. if A7 is specified then the address is always decremented by two. Figure 7-22 illustrates the address register indirect with predecrement mode. Address register indirect with displacement. One word of extension is required with this addressing mode. The address of the operand is the sum of the contents of the specified Address register and the sign-extended 16-bit dis- placement word contained in the extension word. Figure 7-23 illustrates the address register indirect with displace- ment mode. Address register indirect with index and displacement. This addressing mode requires one word of extension which is formatted as shown in Figure 7-24. The operand address is the sum of the specified address register. the sign-extend 7-34 Address Registers Memory xxxxyyyy ~ .- xxxxyyyy +ssssdddd~ zzzzzzzz -.,.-..- ~ { , I xfx1110111r1 r1r dd dd ! I I operation word Displacement word ~ zzzzzzzz Operand (1, 2, or 4 bytes) zzzzzzzz + 1 zzzzzzzz + 2 (In this example rrr = 010) zzzzzzzz + 3 EA =[An] + dddd (sign extended) ~ Byte Mode = 101 2 Register n= Figure 7-23. MC68000 Address Register Indirect with Displacement Addressing 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 . . . - B i t No. ---'1 lPD-/-A""l-R-e-g-is-t-er-"I'IIW-rL"·I~o-'-lo-""lo-I"---D-is-p-la-ce-m-e-nt-l-n-te-g-e-r .t. ----------DisPlacement (-128 through + 127) Not used, always 0 L - - - - - - - - - - - - - - - - - - - - - - - I n d e x size: o sign extended low-order = integer in index register 1 long value in index = register .....- - - - - - - - - - - - - - - - - - - - - - - - - I n d e x register number .....- - - - - - - - - - - - - - - - - - - - - - - - - - - - Index register indicator: o = data register 1 address register = Figure 7-24. MC68000 Extension Word Format for Indexing 7-35 Address Registers Memory l AO~______________~ operation word A1 xx110r"r ~-----------------I _ .......fi Oo..........lr 000 A2~______________~ § p ......... ..I;L.......... Extension word A3 d d A4~ ~-----------------I ______________~ ~-"""'---I I I A5~ ______________ ~~ zzzzzz Operand (1._2. or 4 bytes) A6~_____X_x_xx_y_y_y_y~~--I A7 zzzzzz + 1 ~------------~~ zzzzzz + 2 zzzzzz + 3 Data Registers ~ Byte OO~ _____________~ 01 ppppqqqq 02 ~--------------~~ Index Size 03~______________-4 04 long (WfL = 1) short (W fL = 0) 05~ ~-----------------I _ _ _ _ _ _ _~ xxxxyyyy xxxxyyyy ~--- + ssssssdd ssssssdd 06~______________~ ~--- + ppppqqqq ssssqqqq 07~______________~ zzzzzz zzzzzz or_ -_ _ _ _ _J ' = = (In this example Of A 0 and r2r2r2 001 therefore the index register is 01 ; r, r, r, = 11 0 which indicates A6 is used) EA = [An) + [Rn) + dd (sign extended) = Mode 1102 Register = n, Figure 7-25. MC68000 Address Register Indirect with Index and Displacement .A.ddres~ing displacement integer in the least significant byte of the extension word, and the contents of the Index register. Address formation for the Address Register Indirect with Index and Displacement is illustrated in Figure 7-25. Implied Register Addressing MC68000 IMPLIED There are some instructions that implicitly refer to a specific register. These registers are the Pro- REGISTER gram Counter (PCl. the Stack Pointer (SP-SSP or USPl. and the status register (SR). Table 7-5 ADDRESSING shows those instructions in which a register holding the operand is implied. Program Counter Relative Addressing MC68000 There are two formats for PC-relative addressing. Both require one word of extension and both PROGRAM provide displacement. The second format includes indexing in additional to displacement. COUNTER RELATIVE ADDRESSING 7-36 Memory [PC]- 2 [PC] - 1 xixl1111110111o lope..,"," wend ~[PC] dd OOPPPCCC ~ [PC] + 1 dd Extension word + ssssdddd zzzzzz I I I I -c:... ''''''~ Operand (1, 2, or 4 bytes) zzzzzz + 1 zzzzzz + 2 ---- zzzzzz + 3 EA = [PC] + dddd (sign extended) Byte Mode = 1112 Register = 010 2 Figure 7-26. MC68000 Program Counter Relative Addressing DO 03 Data Registers 01 ~----------------~ 02 ~----------------~ ~----------------~L.L- ppppqqqq __--- [PC] - 2 [PC] [PC] + 1 d Memory [PC] - 1 x x 1 1 1 ~ r r r ~ 00 0 d 11 I Operation word Extension word ~----------~~~ 04 I I ~--------------~~ I I ~ Operand (1, 2, or 4 bytes) 05 ~--------------~~ ZZZZZZ 06 07 ~------------~~ zzzzzz + 1 ~----------~--~ zzzzzz + 2 zzzzzz + 3 ---- Byte OOPPPCCC + ssssssdd + ssssssdd + ppppqqqq ssssqqqq _---- -----""./ zzzzzz zzzzzz .... '-- (In this example Of A = 0 and rrrr = 011, therefore the selected index register is 03.) EA = [PC] + [Rn] + dd (sign extended) Mode=1112 Register = 011 2 Figure 7-27. MC68000 Program Counter-Relative with Index and Displacement Addressing 7-37 ____~___o..;..:;.pe_r_an_d_ _ _,,1 Extension word(s) Byte .,___o_o_o_o_o_oo_o or o.. Word ,_ _ _ _ _ _ _ _ p.e.ra.n_d_ _ _ _ _ _ _.... or Long Word t-____~O~p_e_ra-n~d~(h~i9 ..h-or-d-e-rh_a_lf~)_ _ _ _-I Operand (low order half) '-~--------------~~~--------------~~ Word EA = Not required; the operand is part of the instruction Mode =111 2 = Register 1002 Figure 7-28. MC68000 Immediate Data Addressing Extension Words The value contained in the Program Counter which is used in address calculation is the address of the extension word. PC-relative with displacement. This addressing mode generates an effective address by summing together the value of the Program Counter and the sign extended value of the extension word. Figure 7 -26 illustrates the PC-relative with displacement mode. PC-relative with index and displacement. This mode requires an extension word format similar to that required by the address register indirect with index and displacement mode (see Figure 7- 24). The address is calculated as shown in Figure 7-27. Immediate Data Addressing MC6S000 IMMEDIATE The operand for immediate data addressing is the value that immediately follows the instruction DATA word. Thus. depending on the size of the operand. either one or two extension words will be ADDRESSING necessary. as illustrated in Figure 7-28. THE MC68000 INSTRUCTION SET Table 7-6 summarizes the instruction set of the MC6S000. Instruction object codes and execution times are given alphabetically in Table 7-7. Instruction object codes are given numerically in Table 7-S. When compared to other microprocessor instruction sets, the MC6S000 instruction set might seem quite large: over 300 instructions are listed in Table 7-6. However. if you examine this table closely. you will see that slight varia- tions of the same instruction mnemonic may appear several times. These are different forms of the same instruction. There are actually 56 basic instructions provided in the MC68000. We have listed all the variations of a single instruction as though they were distinct instructions in order to make our description of the instruction set consistent with similar ones for other microprocessors. One of the most significant characteristics of the MC68000 instruction set is its orderliness. Despite its apparent complexity. this instruction set should be relatively easy to learn. since the variations are consistent and therefore pre- dictable. These variations are due to the different addressing modes available and to the MC68000's ability to handle five different data types. Since there are really only 56 basic mnemonics that you must learn. it is more likely that you will use all of the instructions in the way that they were intended and thus obtain the full power of the instruction set. Let us examine the MC6S000 instruction set by instruction categories, as given in Table 7-6. One thing to keep in mind is that the MC68000 uses memory-mapped 1/0: therefore there are no separate 1/0 instructions. The primary memory reference instructions will also be used to accomplish I/O. The basic format of all instructions is the same. The op-code for every instruction is one word. Additional extension words are required when the addressing modes specified use constants (immediate operands). absolute addresses. or 7-38 displacements. Accordingly. an instruction can be anywhere from 2 to 10 bytes in length. The number of bytes for each instruction is listed in Table 7-6. All of the primary memory reference instructions have byte, word, and long word versions. Secondary memory reference instructions can use most of the memory addressing modes. There are byte, word, and long word ver- sions of most, but not all, of these instructions. The Move instruction provided by the MC68000 allows data movement between registers. from register to memory. from memory to register. and directly from one memory location to another. The Move Multiple Registers (MOVEM) instruction allows all of the MC68000 register contents to be quickly saved in memory or restored from memory. The MC68000 does not provide a block move instruction such as those available with the 8086 and the Z8000 microprocessors. However, since the Move instructions can move data from one memory location to another. it is simple to move blocks of data by using the Move instruction in conjunction with the Decrement and Branch (DBcc) instruction. Both signed and unsigned multiply and divide instructions are included in the instruction set. In comparison. the Z8000 provided only unsigned multiplication and division. However. the Z8000 provides 32-bit multiplication and divi- sion while the MC68000 can only multiply two 16-bit operands producing a 32-bit result. or divide a 32-bit dividend by a 16-bit divisor. The divide instructions reference the dividend in one of the Data registers: the divisor may reside in memory or in another Data register. Both the divisor and the dividend are treated as signed binary numbers in the DIVS instruction and as unsigned binary numbers in the DIVU instruction. After the division instruction has been executed. the quotient is returned in the low-order half of the dividend register and the remainder is returned in the high-order half of the dividend register. The multiply instructions also have only a word version: there is no long word version. As with the division. there is a signed (MULS) and unsigned (MULU) version of the multiply instructions. One of the operands must reside in the least significant half of a Data register while the other operand can be either a memory word. the lower half of another Data register. or can consist of immediate data included as part of the instruction. Upon completion of the multiply operation. the 32-bit product is returned in the source operand Data register. The MC68000 includes standard Jump and Jump to Subroutine instructions (JMP and JSR) which use specific addresses for loading the Program Counter. There are also the Branch Always and Branch to Subroutine instruc- tions (BRA and BSR) which cause a transfer of program control relative to the Program Counter's current contents. The Trap instruction is the MC68000's equivalent of the System Call instruction provided by the Z8000. You will recall from the earlier discussion of the MC68000 exception processing logic that the Trap instruction automat- ically switches the MC68000 into the Supervisor mode. which utilizes a separate Stack Pointer to isolate the operating system from application programs. The MC68000 also provides several instructions that are specifically designed to simplify implementation of higher level languages. These instructions are unique to the MC68000. The Link (LINK) and Unlink (UNLK) instructions can be used to maintain a linked list of local data and parameter areas on the Stack and thus simplify operations where there are frequent interrupts of nested subroutines. The Link instruction uses the System Stack Pointer (SFPl. one of the other Address registers. as a "frame pointer" and a displacement value. This instruction will typically be used at the beginning of a subroutine. The Link instruction first pushes the current value of the frame pointer onto the Stack. The current value of the Stack Pointer is then loaded into the frame pointer so that it now points to the top of the current Stack. Finally. the displacement value included with the Link instruction is used to decrement the System Stack Pointer so that it is displaced to clear a space in memory for storage of such things as local variables and parameters. These variables can then be accessed via the frame pointer. The Unlink (UNLK) instruction is used to clean up the Stack at the end of a subroutine and would be executed just prior to returning to a higher level subroutine. The Unlink instruction loads the System Stack Pointer with the contents of the frame pointer. The frame pointer is then loaded with the address pulled off the Stack. Thus. both the frame pointer and the System Stack Pointer will be restored to the values they held before the subroutine was called. 7-39 ABBREVIA TIONS Following are the abbreviations used for instruction formats and operation descriptions. addr Direct address (16 or 32 bits) An Address registers. n = 0-7 (8. 16. or 32 bits. depending on the instruction size) bitb Bit number of byte 0-7 bitl Bit number of long word 0-31 cc Condition code: CC Carry clear 0100 CS Carry set 0101 EO Equal 0111 F False 0001 GE Greater than 1100 or equal GT Greater than 1110 HI High 0010 LE Less than or 1111 equal LS Low or same 0011 LT Less than 1101 MI Minus 1011 NE Not equal 0110 PL Plus 1010 T True 0000 VC No overflow 1000 VS Overflow 1001 CCR Condition Code register - the low-order byte of the Status register count Shift count (1-8) dadr Destination address. which may be any of the following addressing modes: (An) Register indirect (An)+ Register indirect with postincrement -(An) Register indirect with predecrement d16(An) Register indirect with displacement d8(An.i) Register indirect. indexed addr Direct address dAn Destination Address register. This form is used only when there are two An operands. aDn Destination Data register. This form is used only when there are two Dn operands. data3 3 bits of immediate data data8 8 bits of immediate data data16 16 bits of immediate data data32 32 bits of immediate data On Data register. n = 0-7 (8. 16. or 32 bits. depending on instruction size) d8 8-bit address displacement. Required. even if zero on indexed instructions. d16 16-bit address displacement i Index register (An or Dn) jadr Jump address - same as sadr except no (An)+ or -(An) label Address label madr Multiple-instruction address - same as dadr except no (An)+ or -(An) reg-list Register list naming one or more registers. each item in the list separated by a comma. Items may have the form: Dn Single data register An Single address register rn l-rn Range of registers rd Destination registers (dDn or dAn) rs Source register (sDn or sAn) 7-40 sadr Source address. which may be any of the following address modes: (An) Register indirect (An)+ Register indirect with postincrement -(An) Register indirect with predecrement d16(An) Register indirect with displacement d8(An.i) Register indirect. indexed addr Direct address label Program relative label (j) Program relative. indexed sAn Source Address register. This form is used only when there are two An operands. sOn Source Data register. This form is used only when there are two Dn operands. SR Status register (16 bits) USP User Stack Pointer. Note that this is Register A7. vector Trap address vector. the memory location containing the address of the Trap routine. [[J] The contents of the memory location whose address is contained in the designated register (indirect memory addressing. or implied addressing). [ ] The contents of a register or memory location (register addressing or direct memory addressing). For example: [Dn] - [[An)) indicates that the contents of the memory location addressed by Register An are loaded into Dn. whereas: [On] - [An] indicates that the contents of Register An itself are loaded into On. X Complement the value of x. x Bits y through z of x. For example. On <0-7 > means the low-order byte of Dn. If the z term is omit- ted. then only the bit selected by y is being referenced. Thus On <0> means the least significant bit of Dn. + Add Subtract x Multiply Divide 1\ Logical AND V Logical OR ¥ Logical Exclusive-OR Equals Data moves in the direction of the arrow Data are exchanged between two locations INSTRUCTION MNEMONICS Table 7-6 summarizes the MC68000 instruction set. The MNEMONIC column lists the instruction mnemonic (e.g .. MOVE. ADD. JMP). The OPERAND(s) column lists the operands used with the instruction mnemonic. The fixed part of an assembly language instruction is shown in UPPER CASE. The variable part (register number. address. immediate data. etc.) is shown in lower case. The BYTES and CLOCK CYCLES are repeated in this table for reader convenience. Refer to "Instruction Object Code Tables" and the text accompanying Table 7-7 for a description of these entries. 7-41 STATUS The effect of instruction execution on the status bits is listed in Table 7-6. The status bits are: T Trace mode S Supervisor state X Extend bit N Negative (or Sign) bit Z Zero bit V Overflow bit C Carry bit The following symbols are used in the STATUS columns: X - flag is affected by operation (blank) - flag is not affected by operation 1 - flag is set by operation o - flag is cieared by operation OPERATION PERFORMED This column shows the sequence of operations that occurs when the instruction is executed. (Instruction fetches are not shown. nor is the incrementing of the Program Counter for the purpose of instruction fetches.) Each operation is generally shown in the following form: destination source indicating that the source contents moves to the destination. replacing the destination contents. For example. the LEA instruction operation is: [An] jadr The effective address. which may be any of the jadr forms. is loaded into the specified Address register. Following the arrow sequence is a description of the operation in words. Alternate Mnemonics The MC68000 instruction set allows a choice of mnemonics for many operations. An "I" can be appended to the instruction mnemonic for an immediate operation. An "A" can be appended to the instruction mnemonic for an Address register operation. An ".S" can be appended to force a short-form conditional branch instruction. Mnemonic choices are summarized in Table 7-5 under these headings: PRIMARY MNEMONIC Lists the nominal mnemonic form ALTERNATE MNEMONIC Lists the alternate choices that can be used in place of the primary mnemonic. OPERAND Shows the operand category to which the primary and alternate mnemonics apply. xx is any allowed operand selection. DESCRIPTION Identifies the operation. For simplicity. only the primary mnemonics are shown in the instruction set tables that follow. Note that there are no mnemonic alternates for the instruction variations X (Extend). M (Multiple). and P (Peripheral Data). These suffixes cannot be omitted from their respective instruction mnemonics. Bear in mind that the assembler will select the "Quick" version of an instruction (e.g .. MOVEQ. AOOQ. SUBQ) whenever possible. Thus you can use the alternates for these mnemonics - the more general MOVE. ADD and SUB - without sacrificing any opportunities for code shortening. For example: MOVE.L #40.02 is coded as: MOVEQ #40.02 Another example: ADD #1. DO is coded as: ADOQ.W #1.00 7-42 MC68000 INSTRUCTION OBJECT CODE TABLES The object code for each MC68000 instruction is shown alphabetically by instruction mnemonic in Table 7-6. The object codes are listed in numerical order in Table 7-7. For instruction words which have no variations, object cades are represented as four hexadecimal digits; for example, 4E71. For instruction words with variation in one of the two bytes, the object code is shown as a combination of lower case variables, hex digits, and binary digits. Each byte of an instruction word in Tables 7-7 and 7-8 is subdivided into two "nibble" fields (1 nibble = 4 bits). If a single digit appears in a nibble field, it is a hexadecimal digit. If four digits, or a combination of digits and lower-case variables (for example, 1 rrr), appear in a nibble field, each digit represents a single bit. Note that some lower-case variables are used to represent hexadecimal digits rather than binary digits. When four of these hexadecimal variable characters (for example xxxx or yyyy) are used to represent a 16-bit word, they will appear grouped together in the center of the 2-byte column comprising that word. INSTRUCTION EXECUTION TIMES Table 7-7 lists the instruction execution time in clock cycles. Each cycle = 125 nanoseconds (when fCLK =8.0 MHz). The abbreviations and notations used in the "clock cycles" column are defined as follows: +ea Effective address overhead. This is the additional time required to execute the instruction for addressing modes that take longer to execute than the nominal register indirect address. The following are the addi- tional clock cycles required: Addressing Mode Additional Clock Cycles (An) o (An)+ o -(An) 2 d16(An) 5 d8(An,j) 7 addr-16-bit 5 addr-32-bit 10 label 5 label(j) 7 N For shift instructions, the number of shifts. For move multiple instructions, the number of registers being moved. The first value is for branch or trap taken, the second is for branch or trap not taken. In the case of Bcc, the first of the latter numbers is for a two-byte instruction (8-bit displacement), and the second is for a four-byte instruction (16-bit displacement). In the case of DBcc, the first of the latter numbers is for branch not taken due to condition true, and the second is for branch not taken due to counter timeout. Indicates maximum value. The lower value is for condition false (byte set to all ones); the higher value is for condition true (byte cleared to all zeroes). The following abbreviations are used in Table 7-7: a Operand addressing mode (1 bit) o = data register to data register 1 = memory to memory bbb 3 bits of immediate data. In bit operations the bit numbers 0 - 7. bbbbb Bit numbers a - 31. ccc Shift count 000 = 8 shift,S 001 = 1 shift 010 = 2 shifts 011 = 3 shifts 100 = 4 shifts 101 = 5 shifts 110 = 6 shifts 111 = 7 shifts ddd Destination register - same coding as rrr. 7-43 eeeee Source effective address (6 bits) Address Mode MODE/REGISTER [EXT] (An) 010rrr (An)+ 011 rrr -(An) 100m d16(An) 101 m xxxx d8(An,i) 110rrr a iii w 000 xx addr-16-bit 111000 pppp addr-32-bit 111001 pppp qqqq label 111010 xxxx label(j) 111011 a iii w 000 xx [EXT] One or two optional words of extension addressing that mayor may not appear, depending on the addressing mode (see the Addressing Modes description). ffffff Destination effective address - same as eeeeee except no label or label(j). gggggg Destination effective address but in a format with the MODE and REGISTER fields switched (e.g., (An)=rrrOl0). hhhhhh Multiple-destination effective address - same as ffffff except no (An)+ or -(An}.? iii Index register - same coding as rrr. jjjjjj Jump effective address - same as eeeeee except no (An)+ or -(An). kkkk Register mask list for predecrement mode, in the following format (a "1" selects the register): 1514131211109876543210 0001 D2D3D4D5D6D7AOAl A2A3A4A5A6A7 mmmm Register mask list for non-predecrement modes, in the format (a "1" selects the register): 1514131211109876543210 A7 A6 A5 A4 A3 A2 A 1 AO 07 06 D5 04 D3 D2 01 DO pppp 16-bit address word or most Significant word of 32-bit address qqqq Least significant word of 32-bit address rrr Register 000 = DO or AO 001 = Dl or Al 010 = D2 or A2 011 = 03 or A3 100 = 04 or A4 101 = D5 or A5 110 = D6 or A6 111 = D7 or A7 sss Source register - same coding as rrr t Type of register 0 = On 1 = An vvvv 4-bit vector w Index size. 0 = sign extended, low-order integer in index register 1 = long word value in Index register xx 8-bit address displacement xxxx 16-bit address displacement yy 8-bit immediate data yyyy 16-bit immediate data or most significant word of 32-bit data zzzz Least significant word of 32-bit data INTERFACING THE MC68000 WITH 6800 PERIPHERALS Many peripheral components have been developed by Motorola and other manufacturers for the 8-bit 6800 microprocessor. In general. any asynchronous peripheral device can be used with the MC68000 with only a small amount of external logic needed to meet the interface requirements (handshaking, etc.). However, the 6800-family components are based on synchronous read/write operations. This imposes certain constraints when you attempt to use a 6800 peripheral device with an asynchronous processor such as the MC68000. Obviously, it was in Motorola's interest to design the MC68000 so that it would be able to use both conventional asynchronous devices and the family of existing synchronous 6800 devices. Therefore they have included logic to simplify interfacing 6800 peripheral devices. 7-44 Again, the MC68000 performs read/write operations asynchronously. The signals involved with these operations are the strobes (AS, UDS, lOS). the R/W signal. the Data Transfer Acknowledge signal (DT ACK). and of course the address (A 1-A23) and data (00-015) signals. Three additional signals are used to perform the synchronous read/write operations required by 6800 peripheral devices. These signals are Valid Memory Address (ViViA), Valid Peripheral Address (VPA), and Enable (E). Figure 7-29 illustrates the timing of the synchronous read and write cycles. After the MC68000 has output the address on A 1-A23 and has asserted the Address Strobe (AS). external logic is expected to decode information on the address lines. If a 6800 peripheral device is being addressed, then the external logic should assert the VPA input to the MC68000. This causes the MC68000 to emulate the data transfer timing of the 6800 microprocessor. As a result, the transfer of data is synchronized with the clock signal E. The MC68000 will keep the address outputs valid throughout this cycle. During a read cycle, the 6800 peripheral device is expected to place data on tbe Data Bus when the E signal is high. Note that the Data Transfer Acknowledge (DT ACK) signal is not used since that signal implies an asynchronous transfer of data. Instead, the falling edge of E indicates that the data transfer (either read or write) has been completed. The MC68000 then proceeds to complete the cycle in the normal fashion by negating the strobe signals and returning the Address Bus to the high impedance state. You will note in Figure 7-29 that there is a difference in the total number of ClK cycles for the read and write operations. You should not infer from this that all 6800-type read operations take four more ClK cycles than write operations. That is only the case in the example shown, and has to do with the phase of E when t!:1e read or write operation was begun. In general. the E signal and the current MC68000 cycle state will not be synchronized at the outset of a 6800 reference cycle. This is because the E signal has a duty cycle of 40%: E is high for four ClK periods and low for six ClK periods. The MC68000 instruction cycles, on the other hand, vary in the number of ClK sig- nal periods needed to execute. During the write cycle we have shown in Figure 7-29, the E Signal is in synchronization with the instruction execution cycle. Thus this particular write cycle takes the minimum possible number of ClK cycles to execute. Note that the MC68000 automatically inserts wait states after the VPA signal is input. The number of wait states inserted will depend on how much time is needed in order to synchronize with the signal. The VMA signal is output by the MC68000 in response to the VPA output. At the end of the read or write cycle, the 6800 peripheral device or the address decoding logic in the system must negate the VPA Signal within one clock period after the MC68000 negates AS. Otherwise, the MC68000 will assume that the following cycle is also supposed to be a 6800-type synchronous cycle. Figure 7-30 summarizes the timing constraints of 6800 peripherals. It includes the 6800 processor signals for reference so you can compare them with those associated with the MC68000. A SIMPLE MC68000/6800 INTERFACE EXAMPLE Figure 7-31 illustrates a simple interface of two 6800 peripheral devices in an MC68000-based system. In this example, the address region 000000 16 through 7FFFFF 16 (the lower eight megabytes) is used for asynchronous devices including memory. The upper eight megabytes is used, albeit inefficiently, for the two synchronous 6800 peripheral devices. The PIA (Peripheral Interface Adaptor) is assigned addresses 800000 16 through BFFFFF 16, while the ACIA (Asynchronous Communications Interface Adaptor) is assigned addresses C00000 16 through FFFFFF 16. Interrupt request signals are connected directly to the IP'i:O and iPU input pins of the MC68000. Note that IPl2 is tied high. In this example, an interrupt from the ACIA causes if5[Q to become active thus generating an interrupt of level 1 (the lowest priority). Both PIA interrupts are connected to IPL 1. When either of these becomes active, an inter- rupt of level 2 is generated. If both the ACIA and the PIA request an interrupt simultaneously, an interrupt of level 3 would be generated. For a detailed description of how the MC68000 responds to interrupt requests, refer to our earlier discussion of MC68000 exception processing. We have also included logic that will cause the MC68000 to use its autovector capability during response to an interrupt request from one of the 6800 family devices. Recall that if the VPA signal is asserted to the MC68000 dur- ing an interrupt acknowledge cycle, then no byte of vector data need be supplied by the requesting device; instead, the MC68000 gets the appropriate autovector from the exception proceSSing vector table. 7-45 Standard Read Cycle .. I. 6800 Peripheral Read Cycle -,- 6800 Peripheral Write Cycle •I SO S2 S4 S6 ISO S2 S4 SW SW SW SW SW SW SW SW SW SW S6 ISO S2 S4 SW SW SW SW SW SW S6 ISO ClK A1-A23 AS DM"/lDS ..... R/IN ~ m OTACK 00-015 E VPA VMA Figure 7-29. MC68000 Synchronous Read/Write Timing for6aOO Peripherals so 52 54 5W SW SW SW SW SW 5W 56 so MC68000 ClK E MC6800* Peripheral* Type B ~150 os~ Type B~ 70 os ~ Type A 180 os Type A 140 os Std 270 os Std 160 os MC6800 E Clock Freq. Type MC6800 VMA, RiW I 2.0 MHz B 1.5 MHz A MC6800 Address 1.0 MHz Std ~30 os MC6800* Peripheral* ~ r--10 os Peripheral* Type B 180ns~ 10 os MC6800· MC6800 Read Data Type A 220 ns 320 ns ~~~~~~--~~ F 10 ns Peripheral MC6800 Write Data MC68000 Address MC68000 (8 MHz) t-1870s-1 Write Data * Times are given for different MC6800 device clock frequencies Figure 7-30. MC68000/6800 Interface Timing Signal Summary 7-47 +5 V o AS~----~--4~;--------------------~-" VMA~----~---~~'----------~ 00-015 1C~;J': ';,: ", ":'/:,,:L:; :: ':;;""'<:":', ':::O':,::,, :' ... i, Al-A23 r';""':" :C:;:L,'+',;'>,,!'; " .... N MC68000 I~ ~ « c" o c I~ «~ N« ~ b0c r .- r~ , ., , III 1. r ~ Ql VPA~ I~•• C;; 0 en (,) I• .s; 0 ... Ql "t:I I~ (J) 0 (J) u (J) (J) u (J) a: E u a: a: u FCO~ INTAC~ ,U ~ III 6821 PIA 6850 ACIA > III FCl - 1 1 - - - - - -...... FC2t---..........", ... Ii Ql I~ I~ I~ I~ .J:. +5V C) w a: I~ w ~ "0 0 I- IPL21-----~ ~1-------~~~~-_4~ IPLO RESET~------~.-~----~~~~~-----~---~~a.. E R/W~--------~-------~~--------~,-~:" Figure 7-31. A Simple MC68000/6800 Interface Example 7-48 Table 7-4. MC68000 Instructions Which Use Implied Registers Instruction Implied Registerls) Branch Conditional (Bee), Branch Always (BRA) PC Branch to Subroutine (BSR) PC, SP Check Register against Bounds (CHK) SSP,SR T est Condition, Decrement and Branch (DBcc) PC Signed Divide (DIVS) SSP,SR Unsigned Divide (DIVU) SSP,SR Jump (JMP) PC Jump to Subroutine (JSR) PC,SP Link and Allocate (LINK) SP Move Condition Codes (MOVE CCR) SR Move Status Register (MOVE SRI SR Move User Stack Pointer (MOVE USP) USP Push Effective Address (PEA) SP Return from Exception (RTE) PC,SP,SR Return and Restore Condition Codes (RTR) PC,SP,SR Return from Subroutine (RTS) PC, SP Trap (TRAP) SSP,SR Trap on Overflow (TRAPV) SSP,SR Unlink (UNLK) SP 7-49 Table 7-5. MC68000 Instructions Which Use Implied Registers Primary Alternate Operand Description Mnemonic Mnemonic ADD. B ADDI. B dataS,xx Add Immediate Byte ADD.W ADD XX,XX Add Word ADDA.W xX,An Add Address Register Word ADDI.W data16,xx Add Immediate Word ADD. L ADDA.L xX,An Add Address Register Long ADDI.L data32,xx Add Immediate Long ADDQ.B ADD.B data3,xx Add Quick Byte ADDQ.w ADD data3,xx Add Quick Word ADD.W ADDQ.L ADD. L data3,xx Add Quick Long AND.B ANDI.B dataS,xx AND Immediate Byte AND.w AND XX,XX AND Word ANDI.w data16,xx AND Immediate Word AND.L ANDLL data32,xx AND Immediate Long Bcc Bcc.5 xx Conditional Branch Short CLR.w CLR xx Clear Word CMP.B CMPI.B dataS,xx Compare Immediate Byte CMP.W CMP XX,XX Compare Word CMPA.w xX,An Compare Address Register Word CMPI.W data16,xx Compare Immediate Word CMP.L CMPA.L xX,An Compare Address Register Long CMPI.L data32,xx Compare Immediate Long EOR.B EORI. B dataS,xx Exclusive OR Immediate Byte EOR.W EOR XX,XX Exclusive OR Word EORI.W data16,xx Exclusive OR Immediate Word EOR. L EORI. L data32,xx Exclusive OR Immediate Long MOVE. W MOVE XX,XX Move Word MOVEA.W xX,An Move Address Register Word MOVE. L MOVEA.L xX,An Move Address Register Long MOVEQ MOVE. L dataS,xx Move Quick (always Long) OR. B ORI. B dataS,xx OR Immediate Byte OR.W OR XX,XX OR Word ORI.W data16,xx OR Immediate Word OR. L ORI. L data32,xx OR Immediate Long SUB.B SUBI. B dataS,xx Subtract Immediate Byte SUBW SUB. XX,XX Subtract Word SUBA. W xX,An Subtract Address Register Word SUBIW data16,xx Subtract Immediate Word SUB.L SUBA. L xX,An Subtract Address Register Long SUBI. L data32,xx Subtract Immediate Long SUBQ. B SUB.B data3,xx Subtract Quick Byte SUBQ. W SUB data3,xx Subtract Quick Word SUBW SUBQ.L SUB. L data3,xx Subtract Quick Long 7-50 Table 7-6. MC68000 Instruction Set Summary Status Clock Operation Performed Mnemonic Operand(s) Bytes Cycles T S X N Z V C LEA jadr,An 2.4. 2(010)+ [An] - jadr or 6 Load effective address into specified address register. The addressing size is long. although the address loaded may be byte. word. or long. depending on how it is subsequently used. 2 MOVE.B (Anl.On \ 2 8(2/0) X X 0 0 [On<0-7>] - [[An]] Register indirect (An) +.On 2 8(210) X X 0 0 [On<0-7>] - [[An]]. [An] - [An] + 1 Register indirect with postincrement 1 -(Anl.On 2 10(2/0) X X 0 0 [An] - [An] - 1. [On<0-7>] - [[An)] Register indirect with predecrement 1 d16(An),Dn I 4 12(3/0) X X 0 0 [On <0-7>] - [[AnI + d161 sadr Register indirect with displacement d8(An.il.On 4 14(3/0) X X 0 0 [On<0-7>1 - [[An] + d8 + [ill Register indirect. indexed a Dl addr.On 40r 6 4(1/0)+ X X 0 0 [On<0-7>] - [addrl Direct address I :::I Q. label.On 4 12(3/0) X X 0 0 [On<0-7>1- [[PC] + d16] I 4' Program relative 3' Dl labellil.On 4 14(3/0) [On<0-7>1 - [[PC] + d8 + [ill Program relative, indexed -< ..... 3: ~ Load byte to data register from memory location specified by any of &. ..... 3 the addressing modes above. Bits 8-31 of the data register are not S! affected . '< :Ill MOVE.B On(An) \ 2 9(1/1) X X 0 0 [[An]] - [On <0-7>1 ~ Register indirect ~ ; On,(An)+ I 2 9(1/1) X X 0 0 [[An)) - [On <0-7>1. [AnJ - [AnI + 1 :::I n Register indirect with postincrement 1 ~ On,-(An) 2 9(1/1) X X 0 0 [Anl- [AnJ- 1, [[An]] - [On<0-7>1 >dadr Register indirect with predecrement 1 On,d 16(An) I 4 13(2/1) X X 0 0 [[AnJ + d16J - [On<0-7>1 Register indirect with displacement On,d8(An, i) 4 15(211) X X 0 0 [[An] + d8 + [ill- [On <0-7>] Register indirect, indexed Dn,addr 40r 6 5(011)+ X X 0 0 [addrJ - [On<0-7>J Direct address Store byte from data register to memory location specified by any of the addressing modes above. MOVE.B sadr,dadr 2,4 5(1/1)+ X X 0 0 [dadrl - [sadrI 6,8 Store byte from specified source memory location to specified or 10 destination memory location. 1 Notes: 1. Postincrement and predecrement change by 1, unless the address register specified is the Stack Pointer (A 7), where the address is changed by 2 rather than 1 to keep the Stack Pointer on a word boundary. 2. The effective address must be on an even word boundary (0000, 0002, 0004, etc.l. 3. Postincrement and predecrement change by 2. 4. Postincrement and predecrement change by 4. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Mnemonic Operand(s) Bytes Operation Performed Cycles T S X N Z V C MOVE.w sadr. Dn 2.4 4(1/0)+ X X 0 0 [Dn<0-15>1 - [sadri or 6 Load word to data register from memory location. Bits 16-31 of the data register are not affected. 2• 3 MOVE.w sadr.An 2.4 4(110)+ [Anl<0-15>1 or 6 [An <16-31 >1- [An<15>1 Load word to address register from memory location. The sign is extended to all upper bits of the register. 2• 3 MOVE.w rs.dadr 2.4 5(0/1)+ X X 0 0 [dadrl - [rs<0-15>1 or 6 Store word to memory location from data or address register. 2• 3 MOVE.w sadr.dadr 2.4 5(0/1)+ X X 0 0 [dadrl - [sadri 6.8 Store word from source memory location to destination memory loca- or 10 tion. 2• 3 MOVE.L sadr.Dn 2.4 4(110)+ X X 0 0 [Dn<0-31>1- [sadrl or 6 Load long word to data register from memory location. 2• 3 MOVE.L sadr.An 2.4 8(2/0)+ [An <0-31 >1 - [sadrI a II> MOVE.L rs.dadr or 6 2.4 10(0/2)+ X X 0 0 Load long word to address register from memory location. 2• 4 [dadrl - [rs<0-31 >1 :::I CI. or 6 Store long word from data or address register to memory location. 2• 4 ~ MOVE.L sadr.dadr 2.4 14(112)+ [dadrl - [sadri X X 0 0 3' "U, I'J II> -< 6.8 or 10 Store long word from source memory location to destination memory location.2. 4 s: CD MOVEM.w jadr.reg-list 4.6 8 + 4n(2 + n/O)+ [reg 1 <0-15>1 - [[Anll. [reg 1 < 16-31 >1 - [reg 1 < 15>1 3 or 8 [reg2<0-15>1- [[An + 2ll.[reg2<16-31>1- [reg2<15>1 g -< [reg3<0-15>1- [[An + 4ll.[reg3<16-31>1- [reg3<15>1 :II i-ii :::I n [reg n <0-15>1- [[An + 2n-2)IUregn<16-31 >1 - [regn<15>1 CD Load multiple words from sequential memory locations to specified ('; registers. in order 00-07. AO-A 7. The sign is extended to all upper bits 0 3- of the register.2 S· c CD MOVEM.w (An)+.reg-list 4 8 + 4n(2 + n/O) [reg 1 <0-15>1 - [[Anll.[reg1 <16-31 >1- [reg 1 UAnl- e: [An + 21 [reg2<0-15>1- [[AnlJ.[reg2<16-31 >1- [reg2<15>J.[Anl- [An + 21 [reg3<0-l5>I- [[AnIUreg3<16-31 >1- [reg 3 < 15>1. [Anl- [An + 21 [regn <0-15>1 - [[Anll. [regn< 16-31 >1 - [regn< 15>J.[Anl - [An + 21 Same as above except with postincrement. 3 Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Mnemonic Operand(s) Bytes Operation Performed Cycles T S X N Z V C MOVEMW reg-list,madr 4,6 4 + 5n(1/n)+ [(Anll - [reg 1 <0-15>] or 8 [(An + 211 - [reg2<0-15>] [(An + 411 - [reg3<0-15>] [(An + (2n-2)] - [regn<0-15>] Store multiple words to sequential memory locations from specified registers, in order 00-07, AO-A7.2 MOVEMW reg-list,-(An) 4 4 + 5n(1/n)+ [An]- [An-2J.[[An11-lregn<0-15>] [An] - [An-2],[[An11 - [reg3<0-15>] [An] - [An-2],[[An11 - [reg2<0-15>] [An] - [An-2],[[An11 - [reg 1 <0-15>] 0 Store multiple words to sequential memory locations with predecre- QI :::I Q. ment to specified registers, in order A7-AO, 07-00. 2, 3 ~ ~pt ".;,te~ MOVEM.L jadr,reg-list 4,6 8 + 8n(2 + 2n/0) 3' QI or 8 -< (An)+,reg-list 4 8 + 8n(2 + 2n/0) } s.m." MOVEMW .. th.. _" 32 M' of tho .re ~ 3: reg-list.madr 4,6 4 + lOn(l/n)+ moved. 2,4 (11 Co) "g 3 reg-list,- (An) or 8 4 4 + lOn(l/n) < [On<8-15>] - [[An] + d16],[An] - [An] + 2 ::u MOVEP. W d16(Anl,On 4 16(4/0) [On<0-7>] - [[An] + d16] "it Load peripheral data bytes from alternate memory locations to data CD :::I C'I register word. The address is a byte address. 3 " n MOVEPW On,d16(An) 4 18(2/2) [[An] + d16] - [On<8-15>],[An] - [An] + 2 0 [[An] + d16] - [On<0-7>] ~ Store peripheral data bytes from data register long to alternate =' c memory locations. The address is a byte address. 3 "S: MOVEP.L dos(Anl.Dn 4 24(6/0) [On<24-31»- [(An) + d16),[An)- [An) + 2 [On<16-23>]- [[An] + d16],[An]- [An] + 2 [On<8-15>] - [[An] + d16],[An] - [An] + 2 [On<0-7>]- [[An) + d16] Load peripheral data bytes from alternate memory locations to data register long. The address is a byte address. 3 MOVEP.L Dn,d16(An) 4 28(214) [[An] + d16] - [On <24-31 >],[An] - [An] + 2 [[An) + d16)- [On < 16-23»,[An) -[An] + 2 [[An] + d16] - [On<8-15>],[An] - [An] + 2 [[An] + d16] - [On<0-7>] Store peripheral data bytes from data register long to alternate memory locations. The address is a byte address. 3 Table 1-6.. MC68000 Instruction Set Summary (Continued) Status Clock I Mnemonic Operand(s) Bytes Operation Performed Cycles T 5 X N Z V C ABeD -(sAnl.-(dAn) 2 19(3/1) X u x u X [sAnl - [sAnl - 1 [dAnl - [dAnl-1 [[dAn)] - [[dAn)] + [[sAn)] + X Add decimal memory byte to memory byte with carry (Extend bit). Both addresses are byte 1. AOO.B sadr.On 2.4 4(110)+ X X X X X [On<0-7>1 - [On<0-7>1 + [sadri or 6 Add byte to data register from memory location. Bits 8-31 of the data register are not affected. 1 AOO.B On.dadr 2.4 9(1/1)+ X X X X X [dadrl - [dadrl + [On<0-7>J or 6 Add byte to memory location from data register. 1 AOO.w sadr.On 2.4 4(110)+ X X X X X [On<0-15>1 - [On<0-15>1 + [sadrJ or 6 Add word to data register from memory location. Bits 16-31 of the data register are not affected. 2• 3 AOO.w sadr.An 2.4 8(1/0)+ [An <0-31 >1 - [An <0-31 >1 + [sadrl (sign extended) C/I CD or 6 Add word to address register from memory location. The sign of the n 0 memory word is extended to a full 32 bits for the operation. 2• 3 I = CI. I» ADD.W Dn.Dadr 2.4 9(1/1)+ X X X X X [dadrl - [dadrl + [On<0-15>J -< or 6 Add word to memory location from data register. 2. 3 3: AOO.L sadr.On 2.4 6(1/0)+ X X X X X [On <0-31 >1 - [On <0-31 >1 + [sadri CD -..J 3 or 6 Add long word to data registers from memory location. 2• 4 I I 0 U'1 ~ -< AOO.L sadr.An 2.4 6(1/0)+ [An <0-31 >1 - [An <0-31 >1 + [sadri ::u or 6 Add long word to address register from memory location. 2• 4 CD it AOO.L On.dadr 2.4 14(1/2)+ X X X X X [dadrl - [dadrl + [On <0-31 >1 iil Add long word to melnory locations from data register.2. 4 or 6 ~ CD AODX.B - (sAn). -dAn) 2 19(3/1) X X X X X [sAnJ - [sAnJ - 1 ~ [dAnJ - [dAnl - 1 CD 3 [[dAn]] - [[dAn]] + [[sAn]] + X 0 Add memory byte to memory byte with carry (Extend bitl. Both I -< addresses are byte. 1 0 'tI CD AOOX.w -(sAn).-(dAn) 2 19(3/1) X X X X X [sAnJ - [sAnJ - 2 ~ [dAnJ - [dAnJ - 2 ~ [[dAn]] - [[dAn]] + [[sAn)] + X I Add memory word to memory word with carry (Extend bit). Both address are word. 2• 3 AOOX.L -(sAn).-(?An) 2 32(5/2) X X X X X [sAnl - [sAnl - 4 [dAnl - [dAnl - 4 I [[dAn]] - [[dAn]] + [[sAn]] + X Add memory long word to memory long word with carry (Extend bid. Both addresses are long word.2. 4 ANO.B sadr.On 2.4 4(1/0)+ X X 0 0 [On<0-7>J - [On<0-7>J < [sadrJ I or 6 AND byte to data register from memory location. Bits 8-31 of the data register are not affected. 1 AND.B Dn.dadr 2.4 9(1/1)+ X X 0 0 [dadrl - [dadrl < [On<0-7>J I or 6 AND byte to memory location from data register. 1 I Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Mnemonic Operand(s) Bytes Operation Performed Cycles T S X N Z V C ANO.w sadr,On 2,4 4(1/0)+ X X 0 0 [On<0-15>1 - [On<0-15>1 /\ [sadri or6 AND word to data register from memory location. Bits 16-31 of the data register are not affected. 2, 3 ANO.W On,dadr 2,4 9(1/1)+ X X 0 0 [dadrl - [dadrl < [On<0-15>1 or 6 AND word to memory location from data register. 2, 3 ANO.L sadr,Dn 2,4 6(1/0)+ X X 0 0 [On <0-31 >1 - [On <0-31 >1 /\ [sadrI or 6 AND long word to data register from memory location. 2, 4 ANO.L On,dadr 2,4 14(1/2)+ X X 0 0 [dadr! - [dadrl < [On <0-31 >! or 6 AND long word to memory location from data register. 2, 4 CLR.B dadr 2,4 9(1/1)+ 0 1 0 0 [dadrl-O or 6 Clear memory byte to zeroes. 1 CLR.w dadr 2,4 9(1/1)+ 0 1 0 0 [dadrl - 0 CJ) or 6 Clear memory word to zeroes. 2, 3 CD n CLR.L 0 dadr 2,4 14(1/2)+ 0 1 0 0 [dadrl - 0 :::I Co or 6 Clear memory long word to zeroes. 2, 4 III -< CMP.B sa(Jr,On 2,4 4(1/0)+ X X X X [On <0-7> I - [sadrl 3: (I or 6 Compare data register byte with memory byte and set condition codes 3 accordingly. Register/memory data are not changed on any com- ...... ~ pares. 1 < sadr,On &. (71 :II !. CMP.w 2,4 or 6 4(1/0)+ X X X X [On<0-15>! - [sadrl Compare data register word with memory word and set condition CD CD codes accordingly.2, 3 :::I n CMP.w sadrAn 2,4 6(110)+ X X X X [An<0-15>1 - [sadri (I or 6 Compare address register word with memory word and set condition ~ (I codes accordingly.2, 3 3 CMP.L sadr,On 2,4 6(1/0)+ X X X X [On <0-31 >1 - [sadrI 0 -< or 6 Compare data register with memory long word and set condition 0 codes accordingly.2, 4 'C (I Ql CMP.L sadrAn 2,4 6(1/0)+ X X X X [An <0-31 >1 - [sadrI ! or 6 Compare address register with memory long word and set condition n codes accordingly.2, 4 0 ~ CMPM.B (sAn)+,(dAn)+ 2 12(3/0) X X X X [[dAnl1 - [[sAn)) 5' [dAn! - [dAn! + 1 c (I [sAn! - [sAn! + 1 !: Compare memory bytes and set condition codes accordingly. The memory data are not changed on any compares. 1 CMPM.w (sAn)+,(dAn)+ 2 12(3/0) X X X X [[dAn)) - [[sAn)) [dAn I - [dAnl + 2 [sAnl - [sAnl + 2 Compare memory words and set condition codes accordingly.2, 3 CMPM.L (sAn)+,(dAn)+ 2 20(5/0) X X X X [[dAn)) - [[sAn)) [dAnl - [dAnl + 4 [sAn! - [sAnl + 4 Compare memory long words and set condition codes accordingly.2, 4 - - - .. - Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Mnemonic Operand(s) Bytes Operation Performed Cycles T S X N Z V C OIVS sadr.On 2.4 < 158(1/0)+ X X X 0 [On<0-15>1 ~ [On <0-31 >1 +- [sadrI or 6 [On < 16-31 > I ~ remainder Divide signed numbers. Division by zero causes a TRAP. The source address is a word address. 2• 3 OIVU sadr.On 2.4 ~140(1/0)+ X X X 0 [On<0-15>1 ~ [On <0-31 >1 +- [sadrI or 6 [On<16-31 >1 ~ remainder Oivide unsigned numbers. Division by zero causes a TRAP. The source address is a word address. 2• 3 EOR.B On.dadr 2.4 9(1/1)+ X X 0 0 [dadrl ~ [dadrl ¥ [On<0-7>1 or 6 Exclusive-OR byte to memory location from data register. 1 EORW On.dadr 2.4 9(1/1)+ X X 0 0 [dadr] ~ [dadr] ¥ [On<0-15>1 or 6 Exclusive-OR word to memory location from data registers. 2• 3 Ul CD EORl On,dadr 2.4 14(1/2)+ X X 0 0 [dadrl ~ [dadr] ¥ [On<0-31 >1 () 0 or 6 Exclusive-OR long word to memory location from data register.2. 4 ::I Q. III MUlS sadr.On 2.4 <70(1/0)+ X X 0 0 [On <0-31 >1 ~ [On<0-15>1 x [sadrI -< or 6 Multiply two 16-bit signed numbers. yielding a 32-bit signed product. s:CD The source address is a word address.2. 3 3 MUlU sadr.On 2.4 <74(210)+ X X 0 0 [On <0-31 >1 ~ [On<0-15>1 x [sadrI 0 or 6 Multiply two 16-bit unsigned numbers. yielding a 32-bit unsigned pro- .....,j -< duct. The source address is a word address.2. 3 ::II u, CD it NBCO dadr 2.4 9(1/1)+ X U X U X [dadrl ~ 0 - [dadrl - X (J) Cil or 6 Negate decimal memory byte. This operation produces the tens com- ~ plement if X =0 or the nines complement if X = 1. CD NEG.B dadr 2.4 9(111)+ X X X X X [dadrl ~ 0 - [dadrl ~ CD or 6 Negate memory byte. 1 3 ~ NEGW dadr 2.4 9(1/1)+ X X X X X [dadrl ~ 0 - [dadr] '< or 6 Negate memory word.2. 3 0 "C NEG.l dadr 2.4 14(112)+ X X X X [dadrl ~ 0 - [dadrl CD X ~ or 6 Negate memory long word. 2• 4 !.. NEGX.B dadr 2.4 9(1/1)+ X X X X X [dadrl ~ 0 - [dadrl - X n 0 or 6 Negate memory byte with Extend bit. 1 ~ NEGXW dadr 2.4 9(1/1)+ X X X X X [dadrl ~ 0 - [dadr] - X 5' c or 6 Negate memory word with Extend bit.2. 3 CD e: NEGX.l dadr 2.4 14(1/2)+ X X X X X [dadr] ~ 0 - Idadrl - X or 6 Negate memory long word with Extend bit.2. 4 NOT.B dadr 2.4 9(1/1)+ X X 0 0 [dadrl ~ Idadr] or 6 Ones complement memory byte. 1 NOTW dadr 2.4 9(111)+ X X 0 0 [dadrl ~ [dadrl or 6 Ones complement memory word.2. 3 NOT.L dadr 2.4 14(1/2)+ X X 0 0 Idadr] ~ [dadr] or 6 Ones complement memory long word. 2• 4 ORB sadr,On 2,4 4(1/0)+ X X 0 0 [On<0-7>1 ~ [Dn<0-7>1 V [sadrl or 6 OR byte to data register from memory location. Bits 8-31 of the data register are not affected. 1 ORB On.dadr 2.4 9(1/1)+ X X 0 0 Idadrl ~ [dadrl V [On<0-7>1 or 6 OR byte to memory location from data register. 1 Table 7-6, MC68000 Instruction Set Summary (Continued) C' k Status Mnemonic Operand(s) Bytes C o,c Operation Performed yc es T S X N Z V C ORW sadr,On 2. 4 4(1/0)+ X X 0 0 [On<0-15>1 - [On<0-15>1 V [sadrI or 6 OR word to data register from memory location, Bits 16-31 ofthe data register are not affected,2, 3 ORW On,dadr 2,4 9(1/1)+ X X 0 0 [dadr] - [dadrJ < [On<0-15>J or 6 OR word to memory location from data register,2, 3 ORL sadr,On 2,4 6(1/0)+ X X 0 0 [On <0-31 >1 - [On <0-31 >] V [sadrI or 6 OR long word to data register from memory location,2, 4 ORL On,dadr 2,4 14(112)+ X X 0 0 [dadrl - [dadr] < [OnVO-31 >] or 6 OR long word to memory location from data register,2, 4 SBeo -(sAnl,-(dAn) 2 19(3/1) X U X U X [sAn] - [sAn] - 1 [dAn] - [dAn] - 1 [[dAn]] - [[dAn]] - [[sAn]] - X C/l Subtract decimal memory byte from memory byte with carry (Extend ~ bit), Both addresses are byte,1 ~ see dadr 2,4 9(111)+ = [dadrJ - [all 1's if cc TRUE 91 or 6 [dadr] - all O's if cc = FALSE i Set status in memory byte, 1 co SUB,B sadr,On 2,4 4(1/0)+ X X X X X [On<0-7>] - [On<0-7>] - [sadri 5 or 6 Subtract memory byte from f)yte in data register, Bits 8-31 of the data -..J -< register are not affected,1 &. ~ SUB.B On,dadr 2,4 9(1/1)+ X X X X X [dadrl - [dadrl - [On<0-7>] -..J ;; or 6 Subtract byte in data register from memory byte. 1 iil SUBW sadr,On 2,4 4(1/0)+ X X X X X [On<0-15>1 - [On<0-15>] - [sadri ~ or 6 Subtract memory word from word in data register. Bits 16-31 of the E data register are not aftected,2, 3 5 SUBW sadrAn 2,4 8(1/0)+ X X X X X [An <0-31 >] - [An <0-31 >1 - [sadri (sign extended) -< or 6 Subtract memory word from address register contents. The sign of the o "g memory word is extended to a full 32 bits for the operation,2, 3 ~ SUBW On,dadr 2,4 9(1/1)+ X X X X X [dadrl - [dadr] - [On<015>] ~ or 6 Subtract data register word from memory location word,2, 3 R SUB,L sadr,On 2,4 6(1/0)+ X X X X X [On<0-31>]-[On<0-31>]-[sadr] g or 6 Subtract memory long word from data register contentS,2, 4 g. SUB.L sadr,An 2,4 6(1/0)+ X X X X X [An<0-31>]-[An<0-31>]-[sadr] ~ or 6 Subtract memory long word from address register contents.2, 4 - SUB.L On,dadr 2,4 14(1/2)+ X X X X X [dadr] - [dadr] - [On <0-31 >] or 6 Subtract contents of data register from memory long word.2, 4 SUBX,B -(sAn).-(dAn) 2 19(3/1) X X X X X [sAn] - [sAnl - 1 [dAn] - [dAn] - 1 [[dAn]] - [[dAn]] - [[sAn]] - X Subtract memory byte from memory byte with borrow (Extend bit), Both addresses are byte. 1 SUBX.w -(sAnl,-(dAn) 2 19(3/1) X X X X X [sAn] - [sAnJ - 2 [dAnl - [dAnl - 2 [[dAn]] - [[dAn]] - [[sAn]] - X Subtract memory word from memory word with borrow (Extend bitl. Both addresses are word. 2, 3 Table 7-6. MC68000 Instruction Set Summary (Continued) Status Mnemonic Operand(s) Bytes Clock Operation Performed Cycles T S X N Z V C 2i SUBX.L -(sAnl.-(dAn) 2 32(5/2) X X X X X [sAnl - [sAnl - 4 [dAnl - [dAnl - 4 I» :::I Co [[dAn]] - [[dAn]] - [[sAn]] - X Subtract memory long word from memory long word with borrow n~ (Extend bitl. Both addresses are long word.2, 4 o 3 ~ ~ TAS dadr 2,4 11(111)+ X X 0 0 [dadr<7>1 - 1 :i" < ;Co s:CD or 6 Test status of memory byte and set high-order bit to 1. -3 TST.B dadr 2,4 4(1/0)+ X X 0 0 [dadrl - 0 0 or 6 Test status of memory byte. The byte value is not changed. -< :Jl TST.W dadr 2,4 4(1/0)+ X X 0 0 [dadrl - 0 !!. CD or 6 Test status of memory word. The word value is not changed. (; dadr 2,4 [dadrl - 0 :::I TST.L 4(1/0)+ X X 0 0 0 CD or 6 Test status of memory long word. The long word value is not changed. MOVEa data8,On 2 4(1/0) X X 0 0 [On<0-7>1- data8 [On <8-32>1 - [On <7>1 Load immediate data byte to data register. The sign is extended to all upper bits of the data register. MOVE.B data8,On 4 8(2/0) X X 0 0 [On<0-7>1 - data8 -..I Load immediate data byte to data register. Bits 8-31 of the data register are not affected. &. en MOVE.B data8,dadr 4,6 9(111)+ X X 0 0 [dadrl - [data81 or 8 Load immediate data byte into memory location. 1 MOVE.W data16,On 4 8(2/0) X X 0 0 [On<0-15>1 - data16 Load immediate data word to data register. Bits 16-31 of the data 3' register are not affected. 3 CD Co 'MOVE.W data16,An 4 8(2/0) [An <0-15>1 - data16 §" [An < 16-31 > I - [An < 15> I CD Load immediate data word to address register. The sign is extended to all upper bits of the register. MOVEW data 16,dadr 4,6 9(111)+ X X 0 0 [dadrl - data16 or 8 Load immediate data word into memory location. 2, 3 MOVE.L data32,On 6 12(3/0) X X 0 0 [On <0-31 >1 - data32 Load immediate data long word into data register. MOVE.L data32,An 6 12(3/0) [An <0-31 >1- data32 Load immediate data long word into address register. MOVE.L data32,dadr 6,8 18(2/2)+ X X 0 0 [dadrl - data32 or 10 Load immediate data long word into memory location. 2, 4 3' AOO.B data8,On 4 8(2/0) X X X X X [On<0-7>1 - [On<0-7>1 + data8 3 Add immediate data byte to data register. Bits 8-31 of the data register CD Co are not affected. iii' i AOO.B data8,dadr 4,6 13(2/1)+ X X X X X [dadrl - [dadrl + data8 0 or 8 Add immediate data byte to memory location. 1 ~ AOOW data16,On 4 8(2/0) X X X X X [On<0-15>1 - [On<0-15>1 + data16 ~ CD Add immediate data word to data register. Bits 16-31 of the data rt)~ter are not affected. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Operand(s) Clock Operation Performed Mnemonic Bytes Cycles T S X N Z V C ADD.w data16,An 4 8(210) [An <0-31> 1 - [An <0-31> 1 + data 16 (sign extended) Add immediate data word to address register. The sign of the data word is extended to a full 32 bits for the operation. ADD.w data 16,dadr 4,6 13(211)+ X X X X X [dadr] - [dadrl + data16 or 8 Add immediate data word to memory location. 2, 3 AOO.L data32,On 6 16(3/0) X X X X X [Dn<0-31 >1- [Dn<0-31 >1 + data32 Add immediate data long word to data register. ADD.L data32,An 6 16(3/0) [An <0-31 >1 - [An <0-31 >1 + data32 Add immediate data long word to address register. ADD.L data32,dadr 6,8 22(3/2)+ X X X X X [dadr] - [dadrl + data32 or 10 Add immediate data long word to memory location. 2, 4 AODQ.B data3,Dn 2 4(1/0) X X X X X [Dn<0-7>1- [On<0-7>1 + data3 Add immediate three bits to data register byte. Bits 8-31 of the data register are not affected. ADDQ.B data3,dadr 2,4 9(1/0)+ X X X X X [dadrl - [dadrl + data3 or 6 Add immediate three bits to memory byte. 1 ADDQ.W data3,Dn 2 4(1/0) X X X X X [Dn<0-15>1 - [Dn<0-15>1 + data3 3" Add immediate three bits to data register word. Bits 16-31 of the data ~ .. 3 ~ register are not affected . U1 CD .. ~. 0 ADDQ.W data3,An 2 4(1/0) [An<0-15>1 - [An<0-15>1 + data3 Add immediate three bits to address register word. Bits 16-31 of the og address register are not affected. !;: AODQ.W data3,dadr 2,4 9(1/1)+ X X X X X [dadrl - [dadrl + data3 or 6 Add immediate three bits to memory word. 2, 3 00 ADDQ.L data3,Dn 2 8(1/0) X X X X X [Dn<0-31>1- [Dn<0-31 >1 + data3 ;3. Add immediate three bits to data register long word. :i" .. c 1: ADDQ.L data3,An 2 8(1/0) [An <0-31> 1 - [An <0-31> 1 + data3 Add immediate three bits to address register long word. AOOQ.L data3,dadr 2,4 14(1/2) X X X X X [dadrl - [dadrl + data3 or 6 Add immediate three bits to memory long word. 2, 4 AND.B data8,Dn 4 8(2/0) X X 0 0 [Dn<0-7>1 - [Dn<0-7>1 A data8 AND immediate data byte to data register. Bits 8-31 of the data register are not affected. AND.B data8,dadr 4,6 13(2111+ X X 0 0 [dadrl - [dadrl A data8 or 8 AND immediate data byte to memory byte. 1 ANO.w data16,On 4 8(2/0) X X 0 0 [On<0-15>1 - [On<0-15>1 A data16 AND immediate data word to data register. Bits 16-31 of the data register are not affected. ANO.w data 16,dadr 4,6 13(2/1) X X 0 0 [dadrl - [dadrl A data16 or 8 AND immediate data word to memory word. 2. 3 AND.L data32,Dn 6 16(3/0) X X 0 0 [Dn<0-31>1- [Dn<0-31 >1 A data32 AND immediate data long word to data register. AND.L data32,dadr 6,8 22(3/2)+ X X 0 0 [dadrl - [dadrl < data32 or 10 AND immediate data long word to memory.2, 4 Table 7-6. MC68000 Instruction Set Summary (Continued) Status Mnemonic Operand(s) Bytes Clock Operation Performed Cycles T S X N Z V C CMP.B data8.Dn 4 8(210) X X X X [Dn <0-7> 1 - data8 Compare data register byte with immediate data byte and set condi- tion codes accordingly. Register data are not changed on any com- pares. CMP.B data8.dadr 4.6 8(2/0)+ X X X X [dadrl - data8 or 8 Compare memory byte with immediate data byte and set condition codes accordingly.1 CMPW data16.Dn 4 8(2/0) X X X X [Dn<0-15>1- data16 Compare data register word with immediate data word and set condi- tion codes accordingly. CMPW data16.An 4 8(210) X X X X [An < 0-15 > 1 - data 16 Compare address register word with immediate data word and set condition codes accordingly. CMPW data 16.dadr 4.6 8(2/0)+ X X X X [dadrl - data 16 or 8 Compare memory word with immediate data word and set condition codes accordingly.2. 3 CMP.l data32.Dn 6 14(3/0) X X X X [Dn<0-31 >1 - daJa32 Compare data register with immediate data long word and set condi- 3' tion codes accordingly. 3 ~ 14(3/0) ...,J Q. CMP.l data32.An 6 X X X X [An<0-31>1- data32 eno ~ ~ Compare address register with immediate data long word and set con- dition codes accordingly. 0 'C CMP.l data32.dadr 6.8 12(3/0)+ X X X X [dadrl - data32 ~ ! ~ or 10 Compare memory long word with immediate data long word and set condition codes accordingly.2. 4 n DIVS data16.Dn 4 :s; 162(210) X X X 0 [Dn<0-15>1 ~ [Dn<0-31 >1 -;- data16 ~ [Dn < 16-31 > 1 ~ remainder ~. Divide signed numbers. Division by zero causes a TRAP. ~ e: DIVU data16.Dn 4 :s; 148(210) X X X 0 [Dn<0-15>1 ~ [Dn<0-31 >1 -;- data16 [Dn< 16-31 >1 ~ remainder Divide unsigned numbers. Division by zero causes a TRAP. EORB data8.Dn 4 8(2/0) X X 0 0 [Dn<0-7>1 ~ [Dn<0-7>1 ¥data8 Exclusive-OR data byte to data register. Bits 8-31 of the data register are not affected. EOR.B data8.dadr 4.6 13(2/1)+ X X 0 0 [dadrl ~ [dadrl !oJ. data8 Exclusive-OR data byte to memory byte. 1 I or 8 EORW data16.Dn 4 8(210) X X 0 0 [Dn<0-15>1 ~ [Dn<0-15>1 !oJ. data16 Exclusive-OR data word to data register. Bits 16-31 of the data register are not affected. EORW data 16.dadr 4.6 13(211)+ X X 0 0 [dadrl ~ [dadrl !oJ. data16 or 8 Exclusive-OR immediate data word to memory word. 2• 3 EORl data32.Dn 6 16(3/0) X X 0 0 [Dn<0-31 >1 ~ [Dn>0-31 >1 ¥ data32 Exclusive-OR immediate data long word to data register. EORl data32.dadr 6.8 22(3/2)+ X X 0 0 [dadrl ~.[dadrl ¥ data32 or 10 Exclusive-OR immediate data long word to memory.2. 4 Table 7-6. MC68000 Instruction Set Summary (Continued) Clock Status Mnemonic Operand(s) Bytes Operation Performed Cycles T S X N Z V C MULS data16,On 4 ::;74(210) X X 0 0 [On<0-311 >1 - [On<0-15>1 x data16 Multiply two 16-bit signed numbers, yielding a 32-bit signed product. MULU data16,On 4 ~74(2/0) X X 0 0 [On <0-31 >1 - [On<0-15>1 x data16 Multiply two 16-bit unsigned numbers, yielding a 32-bit unsigned pro- duct. OR.B data8,On 4 8(2/0) X X 0 0 [On<0-7>1 - [On<0-7>1 V data8 OR immediate data byte to data register. Bits 8-31 of the data register are not affected. OR.B data8,dadr 4,6 13(2/1)+ X X 0 0 [dadrl - [dadrl V data8 or 8 OR immediate data byte to memory byte. 1 ORW data16,On 4 8(210) X X 0 0 [On<0-15>1 - [On<0-15>1 V data16 OR immediate data word to data register. Bits 16-31 of the data register are not affected. ORW data 16.dadr 4,6 13(2/1)+ X X 0 0 [dadrl - [dadrl V data16 or 8 OR immediate data word to memory word. 2, 3 OR.L data32,On 6 16(3/0) X X 0 0 [On <0-31 >1 - [On <0-31 >1 V data32 OR immediate data long word to data register. §' OR.L data32,dadr 6,8 22(3/2)+ X X 0 0 [dadrl - [dadrl V data32 3 or 10 OR immediate data long word to memory.2, 4 -...J 11> c. a, ~ SUB.B data8,On 4 8(2/0) X X X X X [On<0-7>1- [On<0-7>1 - data8 -- 0 '0 CD Subtract immediate data byte from data register. Bits 8-31 of the data register are not affected. SUB.B data8,dadr 4,6 13(2/1)+ X X X X X [dadrl - [dadrl - data8 ~ 11> or 8 Subtract immediate data byte from memory byte. 1 n 0 SUBW data16,On 4 8(2/0) X X X X X [On<0-15>1 - [On<0-15>1 - data16 Subtract immediate data word from data register. Bits 16-31 of the ~ ;0' data register are not affected. c 11> SUBW data 16,An 4 8(2/0) [An <0-31>1- [An<0-31>1- data16 (sign extended) e: Subtract immediate data word from address register. The sign of the data word is extended to a full 32 bits for the operation. SUBW data 16,dadr 4.6 13(2/1)+ X X X X X [dadrl - [dadrl - data16 or 8 Subtract immediate data word from memory word. 2, 3 SUB.L data32,On 6 16(3/0) X X X X X [On <0-31 >1 - [On <0-31 >1 - data32 Subtract immediate long word from data register contents. SUB.L data32.An 6 16(3/0) [An <0-31 >1 - [An <0-31 >1 - data32 Subtract immediate data long word from address register. SUB.L data32,dadr 6.8 22(3/2)+ X X X X X [dadrl - [dadrl - data32 or 10 Subtract immediate data long word from memory word. 2, 4 SUBQ.B data3,On 2 4(1/0) X X X X X [On <0-7>]- [On <0-7> I - data3 Subtract immediate three bits from data register byte. Bits 8-31 of the data register are not affected. SUBQ.B data3.dadr 2.4 9(1/1)+ X X X X X [dadrl - [dadr] - data3 or 6 Subtract immediate three bits from memory byte. 1 Table 7-6. MC68000 Instruction Set Summary (Continued) Status Mnemonic Operand(s) Bytes Clock Operation Performed Cycles T S X N Z V C SUBQ.W data3.0n 2 4(1/0) X X X X X [On<0-15>] - [On] - data3 Subtract immediate three bits from data register word. Bits 16-31 of 3' the data register are not affected. 3 CD a. SUBQ.W data3.An 2 4(1/0) [An<0-15>]- [An<0-15>] - data3 ~. Subtract immediate three bits from address register word. Bits 16-31 CD 0 of the address register are not affected. .. "C CD SUBQ.W data3.dadr 2.4 9(1/1)+ X X X X X [dadr] - [dadr] - data3 or 6 Subtract immediate three bits from memory word. 2. 3 CD SUBQ.L data3.0n 2 8(1/0) X X X X X [On<0-31>]- [On<0-31>]- data3 n- o Subtract immediate three bits from data register contents. 3- SUBQ.L data3.An 2 8(1/0) [An<0-31>]- [An<0-31>]- data3 :i' c Subtract immediate three bits from address register contents. CD 1: SUBQ.L data3.dadr 2.4 14(112)+ X X X X X [dadr] - [dadr] - data3 or 6 Subtract immediate three bits from memory long word.2. 4 BRA label 2 or 4 10(2/0) [PC] -label ~ ~ Branch unconditionally (short). ~ 3: o 'U JMP jadr 2.4 4(110)+ [PC]- jadr ::t • or 6 Jump unconditionally. -.J enN BSR label 2 or 10.8(1/0) [A7] - [A7] - 2 4 10.12(210) [[A71l- [PC] VI [PC]-Iabel c IT Branch to subroutine (short). (; JSR jadr 2.4 14(1/2)+ [A7] - [A7] - 2 S. :i' or 6 [[A7]]- [PC] CD [PC]- jadr 0 » r Jump to subroutine. .. r :::I a. RTS 2 16(4/0) [PC]- [[A7]] [A7] - [A7] + 2 l:I Return from subroutine m ~ RTR 2 20(5/0) [SR<0-4>] - [[A7<0-4>ll c: l:I [A7] - [A7] + 2 z [PC]- [[A7]] [A7] - [A71 + 2 Restore condition codes and return from subroutine. 01 Bee label 2 or 10.8(1/0) [PCI -label iii 4 10.12(2/0) Branch if condition met. ~ OBcc On.label 4 12(210) If cc then no further action. ~ g 10(210). [On<0-15>1 - [On<0-15>1 - 1 0 0 14(3/0) = If [On < 0-15 > I -1 then no further action. :::I [PCI -label a. ;:;: Test condition. decrement and branch. Loop until the specified condi- o· :::I tion is true or until the loop count is exhausted. -- Table 7-6. MC68000 Instruction Set Summary (Continued) Status Operand(sl Clock Mnemonic Bytes Operation Performed Cycles T S X N Z V C MOVE.B sOn,dOn 2 4(1/01 X X 0 0 (dOn <07> 1 - [sOn <0-7> 1 Move one byte of any data register to any data register. Bits 8-31 of the destination register are not affected. :D MOVEW rS,On 2 4(1/01 X X 0 0 [On<0-15>1 - [rs<0-15>1 CD ca Move one word of any data or address register to any data register. ~ Bits 16-31 of the destination register are not affected. !t 21 MOVEW rS,An 2 4(1/0) [An<015>1 - [rs<0-15>1 CD [An < 16-31 > ] - [An<15>] ca i Move one word of any data or address register to any address register. !t The sign is extended to all upper bits of the address register. s:: 0 MOVE.L rS,On 2 4(1/01 X X 0 0 [On <0-31> 1 - [rs<0-31 > 1 < CD Move the contents of any data or address register to any data register. MOVE.L rS,An 2 4(1/01 [An<0-31>1- [rs<0-31 >1 Move the contents of any data or address register to any address register. ABCO sOn,dOn 2 6(1/01 X u X U X [dOn <0-7>1 - [dOn <0-7>1 + [sOn <0-7>1 + X Add decimal source data register byte to destination data register byte with carry (Extend bitl. Bits 8-31 of the destination data register are not affected. "enw AOO.B sOn,dOn 2 4(1/0) X X X X X [dOn <0-7>1 - [dOn <0-7>1 + [sOn <0-7>1 Add byte from data registers to data register. Bits 8-31 of the destina- tion data register are not affected. AOOW rs,On 2 4(1/01 X X X X X [On<0-15>1 - [On<0-15>1 + [rs<0-15>1 Add word from source register to data register. Bits 16-31 of the destination data register are not affected. AOOW rS,An 2 8(1/0) [An <0-15>1 - [An <0-15>1 + [rs<0-15>1 (sign extendedl :D CD Add word from source register to address register. The sign of the ca source word is extended to a full 32 bits for the operation. 0;' i AOO.L rS,On 2 8(1/01 X X X X X [On<0-31>1- [On <0-31 >1 + [rs<0-31 >1 21 CD Add long word from source register to data register. ca AOO.L rS,An 2 8(1/0) [An <0-31 >1 - [An <0-31 >1 + rS<0-31 >1 0;' i Add long word from source register to address register. 0 AOOX.B sOn,dOn 2 4(1/01 X X X X X [dOn <0-7>1 - [dOn <0-71 + [sOn <0-7>1 + X 'C CD Add source data register byte to destination data register byte with ~ CD carry (Extend bid. Bits 8-31 of the destination data register are not affected. AOOXW sOn. dOn 2 4(1/0) X X X X X [dOn<0-15>1- [dOn<0-15>1 + [sOn<0-15>1 + X Add source data register word to destination data register word with carry (Extend bit). Bits 16-31 of the destination data register are not affected. AOOKL sOn,dOn 2 8(1/0) X X X X X [dOn <0-31 >1- [dOn <0-31 >1 + [sOn <0-31 >1 + X Add source data register long word to destination data register long word with carry (Extend bitl. ANO.B sOn,dOn 2 4(1/01 X X 0 0 IdOn<0-7>1 - [dOn <0-7>1 < [sOn<0-7>1 ANO byte from data register to data register. Bits 8-31 of the destina- tion data register are not affected. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Mnemonic Clock Operand(s) Bytes Operation Performed Cycles T S X N Z V C ANO.w sOn.dOn 2 4(1/0) X X 0 0 [dOn<0-15>1 - [dOn<0-15>1 < [sOn<0-15>1 AND word from data register to data register. Bits 16-31 of the destination data register are not affected. ANO.l sOn.dOn 2 8(110) X X 0 0 [dOn<0-31>1- [dOn <0-31 >1 < [sOn <0-31 >1 AND long word from data register to data register. CMP.B sOn.dOn 2 4(1/0) X X X X [dOn<0-7>1 - [sOn<0-7>1 Compare data register bytes and set condition codes accordingly. Register data are not changed on any compares. CMP.w rs.On 2 4(1/0) X X X X [On<0-15>1 - [rs<0-15>1 Compare data register word with register word and set condition codes accordingly. CMP.w rs.An 2 6(1/0) X X X X [An <0-15>1 - [rs<0-15> I Compare address register word with register word and set condition codes accordingly. CMP.L rs.On 2 6(1/0) X X X X [On <0-31 >1 - [rs<0-31 >1 Compare data register with register and set condition codes accor- :ID dingly. CD cg iii' CMP.l rs.An 2 6(1/0) X X X ·X [An <0-31> I - [rs<0-31 > 1 ';"l i Compare address register with register and set condition codes accor- dingly. en :II CD ~ cg OIVS sOn.dOn 2 ~158(1/0) X X X 0 [dOn<0-15>1- [dOn <0-31 >1 + [sOn<0-15>1 !a' [dOn < 016-31> I - remainder ~ Divide signed numbers. Division by zero causes a TRAP. 0 'CI OIVU sOn.dOn 2 ~140(1/0) X X X 0 [dOn<0-15>1- [dOn <0-31 >1 + [sOn<0-15>1 ~ ~ [dOn<16-31>1- remainder CD Divide unsigned numbers. Division by zero causes a TRAP. R 0 EOR.B sOn.dOn 2 4(1/0) X X 0 0 [dOn <0-7>1 - [dOn<0-7>1 ¥ [sOn <0-7>1 ~ Exclusive-OR byte from data register to data register. Bits 8-31 of the :i" destination data register are not affected. c CD ~ EORW sOn.dOn 2 4(110) X X 0 0 [dOn<0-15>1 - [dOn<0-15>1 ¥ [sOn<0-15>1 Exclusive-OR word from data register to data register. Bits 16-31 of the destination data register are not affected. EaRL sOn.dOn 2 8(1/0) X X 0 0 [dOn <0-31 >1 - [dOn <0-31 >1 ¥ [sOn <0-31 >1 Exclusive-OR long word from data register to data register. EXG rs.rd 2 6(110) [rdl-~ [rsl Exchange the contents of two registers. This is always a long word operation. MUlS sOn.dOn 2 ::;,70(110) X X 0 0 [dOn <0-31 >1 - [dOn<0-15>1 x [sOn<0-15>1 Multiply two 16-bit signed numbers. yielding a 32-bit signed product. MUlU sOn.dOn 2 ::;70(1/0) X X 0 0 [dOn<0-31>1- [dOn<0-15>1 x [sOn<0-15>1 Multiply two 16-bit unsigned numbers. yielding a 32-bit unsigned pro- duct. ORB sOn.dOn 2 4(1/0) X X 0 0 [dOn<0-7>1- [dOn<0-7>1 V [sOn<0-7>1 OR byte from data register to data register. Bits 8-31 of the 'destination dat register are not affected. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Mnemonic Operand(s) Clock Operation Performed Bytes Cycles T S X N Z V C OR.W sOn.dOn 2 4(1/0) X X 0 0 [dOn<0-15>1 - [dOn<0-15>1 V [sOn<0-15>1 OR word from data register to data register. Bits 16-31 of the destina- tion data register are not affected. ORL sOn.dOn 2 8(1/0) X X 0 0 [dOn <0-31 >1 - [dOn <0-31 >1 V [sOn <0-31 >1 OR long word from data register to data register. SBeO sOn.dOn 2 6(1/0) X U X U X [dOn<0-7>1- [dOn<0-7>1 - [sOn <0-7>1 - X Subtract decimal source· data register byte from destination data register byte with carry (Extend bit). Bits 8-31 of the destination data register are not affected. SUB.B sOn.dOn 2 4(1/0) X X X X X [dOn<0-7>1- [dOn<0-7>1 - [sOn <0-7>1 :a CD ca Subtract data register bytes. Bits 8-31 of the destination data register iii' are not affected. ; SUB.W rs.On 2 4(1/0) X X X X X [On<0-15>1 - [On<0-15>1 - [rs<0-15>1 1 CD Subtract register words. Bits 16-31 of the destination data register are ca not affected. iii' i SUBW rs.An 2 8(1/0) [An<0-15>1 - [An<0-15>1 - [rs<0-15>1 (sign extended) 0 Subtract source register word from address register. The sign of the 'C CD source word is extended to a full 32 bits for the operation. iil ; SUB.L rs.On 2 8(1/0) X X X X X [On <0-31> I - [On <0-31> 1 - [rs<0-31 > 1 -..J n Subtract source register long word from data register. m U1 0 a SUB.L rs.An 2 8(1/0) [An <0-31 >1 - [An <0-31 >1 - [rs<0-31 >1 :i' c Subtract source register long word from address register. CD S: SUBX.B sOn.dOn 2 4(1/0) X X X X X [dOn<0-7>1 - [dOn<0-7>1 - [sOn <0-7>1 - X Subtract source data register byte from destination data register byte with borrow (Extend bit). Bits 8-31 of the destination data register are not affected. SUBXW sOn.dOn 2 4(1/0) X X X X X [dOn<0-15>1- [dOn<0-15>1 - [sOn<0-15>1 - X Subtract source data register word from destination data register word with borrow (Extend bit). Bits 16-31 of the destination data registers are not affected. SUBX.L sOn.dOn 2 8(1/0) X X X X X [dOn<0-31>1- [dOn<0-31>1- [sOn<0-31>1- X Subtract source data register long word from destination data register long word with borrow (Extend bit). CLRB On 2 4(1/0) 0 1 0 0 [On<0-7>1 - 0 Clear data register byte to zeroes. Bits 8-31 of the data register are not affected. :a CLRW On 2 4(1/0) 0 1 0 0 [On<0-15> - 0 CD ca Clear data register word to zeroes. Bits 16-31 of the data register are iii' not affected. i CLRL On 2 6(1/0) 0 1 0 0 [On<0-31>1-0 0 'C CD Clear data register to zeroes iil EXTW On 2 4(1/0) X X 0 0 [On<8-15>1 - [On<7>1 ; Extend sign bit of data byte to data word size. Bits 16-31 of the data register are not affected. EXT.L On 2 4(1/0) X X 0 0 [On < 16-31 > I - [On < 15> I Extend sign bit of data word to long data word size. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Mnemonic Operand(s) Bytes. Clock Operation Performed Cycles T S X N Z V C NBCD On 2 6(1/0) X U X U X [On<0-7>1 - [On<0-7>1 - X Negate decimal register byte. Bits 8-31 of the data register are not affected. NEG.B On 2 4(1/0) X X X X X [On1 - 0 - [On<0-7>1 Negate register byte. Bits 8-31 of the data register are not affected. NEG,W On 2 4(1/0) X X X X X [On<0-15>1 - 0 - [On<0-15>1 Negate register word. Bits 16-31 of the data register are not affected. NEG.l On 2 6(1/0) X X X X X [On <0-31 >1- 0 - [On <0-31 >1 Negate register long word. NEG.B On 2 4(1/0) X X X X X [On<0-7>1 - 0 - [On <0-71 - X Negate register byte with Extend. Bits 8-31 of the data register are not affected. NEG,W On 2 4(1/0) X X X X X [On<0-15>1 - 0 - [On<0-15>1 - X Negate register word with Extend. Bits 16-31 of the data register are not affected. :D NEG.L On 2 6(1/0) =•iii' X X X X X [On <0-31 >1 - 0 - [On <0-31 >1 - X Negate register long word with Extend. i NOT.B On 2 4(1/0) X X 0 0 [On<0-7>1 - [On<0-7» '-I ~ Ones complement data register byte. Bits 8-31 of the data register are =•iii' I 0) not affected. 0) NOT.W On 2 6(1/0) X 0 [On<0-15>1 - [On<0-15» i X 0 Ones complement data register word. Bits 16-31 of the data register 0 'D are not affected. •iil ·.. NOT.l On 2 6(1/0) X X 0 0 [On<0-3>1- [On <0-31 >1 I I Ones complement data register contents. 00 Sec On 2 9(1/1) [On<0-7>1 - all l's if cc = TRUE :::I :t. [On <0-1 >1 - all O's if cc = FALSE :::I c Set status in data register byte. e:• SWAP On 2 4(1/0) X X 0 0 [On<0-15>1 -~ [On< 16-31 >1 Exchange the two 16-bit halves of a data register. TAS On 2 4(1/0) X X 0 0 [On<7>1-1 Test status of data register byte and set bit 7 to 1. TST.B On 2 4(1/0) X X 0 0 [On<0-7>1 - 0 Test status of data register byte. The data register contents are not changed. TST,W On 2 4(1/0) X X 0 0 [On<0-15>1 - 0 Test status of data register word. The data register contents are not changed. TST.l On 2 4(1/0) X X 0 0 [On<0-31» - 0 Test status of data register long word. The data register contents are not changed. --- --- Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Operation Performed Mnemonic Operand(s) Bytes Cycles T S X N Z V C ASL dadr 2,4 9(1/11+ X X X X 15 0 :r' X or 6 101 Arithmetic shift left one bit of memory word. A zero is shifted into bit O. Bit 15 is shifted into both Carry and Extend bits. 2, 3 ASL.B count,On On,dOn 2 2 6 + 2N(1/0) 6 + 2N(1/0) X X X X X X X X X X I 31 a- 8 7 0 HJ Arithmetic shift left of data register byte. The number of shifts is specified as a direct count 11-8) or in a data register (1-63). Zeroes are shifted into bit 0. Bit 7 is shifted into both Carry and Extend bits. ASL.W count,On 2 6 + 2N(1/0) X X X X X 31 16 15 0 a~ ...,j On,dOn 2 6 + 2N(1/0) X X X X X I f--.{2J en..... en :r ;: As ASL.B except shifts are for one word. ASLL count,On 2 8 + 2N(1/0) X X X X X 31 0 :r' t---m On,dOn 2 8 + 2N(1/0) X X X X X As ASL.B except shifts are for entire register. ASR dadr 2,4 9(1111+ X X X X X or 6 c5 -1: Arithemtic shift right one bit of memory word. Bit 15 is propagated to bit 14. Bit 0 is shifted into both Carry and Extend bits. 6 + 2N(1/0) X X X X X 31 8 7 ASR.B count,On 2 ° On,dOn 2 6 + 2N(1/0) X X X X X I cs----l! Arithmetic shift right of data register byte. The number of shifts is specified as a direct count 11-8) or in a data register (1-63). Bit 7 is pro- pagated to the right. Bit 0 is shifted into both Carry and Extend bits. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Operand(s) Bytes Clock Mnemonic Operation Performed Cycles T S X N Z V C ASRW count.Dn 2 6 + 2N(1/0) X X X X X 31 16 15 0 Dn.dDn 2 6 + 2N(1I0) X X X X X I EJ As ASRB except shifts are for one word. -1: ASRL count.Dn 2 8 + 2N(1/0) X X X X X 31 0 Dn.dDn 2 8 + 2N(1/0) X X X X X L5 As ASRB except shifts are for entire register. -1: dadr 9(1/1)+ X X X :r" LSL 2.4 0 X 15 0 or 6 10' Logical shift left one bit of memory word. A zero is shifted into bit O. Bit 15 is shifted into both Carry and Extend bits. (Note that LSL is iden- tical to ASL except for the Overflow condition.)2. 3 -..J m en , a-HID ::r CXl ;: LSL.B count.Dn 2 6 + 2N(1I0) X X X 0 X 31 8 7 0 Dn.dDn 2 6 + 2N(1/0) X X X 0 X n 0 a :i' c CD S: Logical shift left of data register byte. The number of shifts is specified as a direct count (1-8) or in a data register (1-63). ZeroeS are shifted into bit O. Bit 7 is shifted into both Carry and Extend bits. LSL.W count.Dn 2 6 + 2N(1/0) X X X 0 X 31 16 15 0 £l 6 + 2N(1/0) Dn.dDn 2 X X X 0 X I ~ As LSL.B except shifts are for one word. LSL.L count.Dn Dn.dDn 2 8 + 2N(1/0) 8 + 2N(1I0) X X X X X X 0 0 X X :r. 31 As lSL.B except shifts are for entire register. 0 t---[Q) Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Mnemonic Operand(s) Bytes Operation Performed Cycles T S X N Z V C LSR dadr 2,4 9(1/1)+ X X X 0 X ~ '1: or 6 Logical shift right one bit of memory word. A zero is shifted into bit 15. Bit 0 is shifted into both Carry and Extend bits. LSR.B count,On 2 6 + 2N(1/0) X X X 0 X 7 0 I r-t: On,dOn 2 6 + 2N(1/0) X X X 0 X Logical shift right of data register byte. The number of shifts is specified as a direct count 11-8) or in a data register (1-63). Zeroes are shifted into bit 7. Bit 0 is shifted into both Carry and Extend bits. LSR.W countOn 2 6 + 2N(1/0) X X X 0 X 15 0 '1: 6 + 2N(1/0) ~ On,dOn 2 X X X 0 X I '"m co en ::T As LSRB except shifts are for one word. = n LSRL count,On 2 8 + 2N(1/0) X X X 0 X 31 0 0 ~ :i" c CD S. On,dOn 2 B + 2N(1/0) X X X 0 X I2l---f As LSRB except shifts are for entire register. -1: ROL dadr 2,4 9(111)+ X X 0 X 15 0 or 6 ~. 1 Rotate left one bit of memory word. Bit 15 is shifted into bit 0 and into the Carry. ROL.B count,On 2 6 + 2N(1/0) X X 0 X 31 8 7 0 On,dOn 2 6 + 2N(1/0) X X 0 X I I-'l EJ. t Rotate left of data register byte. The number of shifts is specified as a direct count (1-8) or in a data register (1-63). Bit 7 is shifted into bit 0 I and into the Carry. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Mnemonic Operand(s) Clock Bytes Operation Performed Cycles N V T S X Z C ROL.W count.Dn 2 6 + 2N(1/0) X X 0 X 31 16 15 0 6 + 2N(1/0) X X X I I. 1 On.dOn 2 0 m1- t As ROL. B except shifts are for one word. ROL.L count.On 2 8 + 2N(1/0) X X 0 X 31 0 8 + 2N(1/0) ~. ~ On.dOn 2 X X 0 X As ROL.B except shifts are for entire register. r ROR oadr 2.4 9(111)+ X X 0 X 15 0 -~ or 6 Rotate right one bit of memory word. Bit 0 is shifted into bit 15 and into the Carry. ROR.B count.On 2 6 + 2N(1/0) X X 0 X 31 8 7 0 i" 6 + 2N(1/0) I I-~ On.dOn 2 X X 0 X " o { Rotate right of data register byte. The number of shifts is specified as a direct count (1-8) or in a data register (1-631. Bit 0 is shifted into bit 7 and into the Carry. ROR.W count.On 2 6 + 2N(1/0) X X 0 X 31 16 15 0 On.dOn 2 6 + 2N(1/0) X X 0 X I I f As ROR.B except shifts are for one word. -:rm 8 + 2N(1/0) r ROR.L count. On 2 X X 0 X 31 0 8 + 2N(1/0) .~ On.dOn 2 X X 0 X As ROR.B except shifts are for entire register. r' ROXL dadr 2.4 9(111)+ X X 0 X 15 0 ~ ~ or 6 Rotate left one bit of memory word and Extend one bit. Bit 15 is shifted into both Extend and Carry bits. The Extend bit is shifted into bit O. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Mnemonic Operand lsI Bytes Operation Performed Cycles T S X N Z V C ROXL.B count,On 2 6 + 2NI1/01 X X 0 X 31 8 7 0 I I-~ ~ On,dOn 2 6 + 2NI1/01 X X 0 X I Rotate left of data register byte with Extend. The number of shifts is specified as a direct count 11-81 or in a data register 11-631. Bit 15 is shifted into both Extend and Carry bits. The Extend bit is shifted into bit O. ROXL. W count,On 2 6 + 2NI1/01 X X 0 X 31 16 15 0 ~ )l On,dOn 2 6 + 2NI1/01 X X 0 X I I II I As ROXL.B except shifts are for one word. r ROXL.L count,On 2 8 + 2NI1/01 X X 0 X 31 0 ~ ~ On,dOn 2 8 + 2NI1/01 X X 0 X 4 As ROXL.B except shifts are for entire register. ., r ROXR dadr 2,4 911/11+ X X 0 X 15 0 ""'" en .!.J .... ::T or 6 = n 0 ~ S· ~ ~ Rotate right one bit of memory word and Extend. Bit 0 is shifted into c both Extend and Carry bits. The Extend bit is shifted into bit 15. CD S: ROXR.B count,On 2 6 + 2N(1/0) X X 0 X 31 8 7 0 On,dOn 2 6 + 2N(1/0) X X 0 X I I-I t ~ ~ Rotate right of data register byte with Extend. The number of shifts is specified as a direct count 11-8) or in a data register (1-63). Bit 0 is shifted into both Extend and Carry bits. The Extend bit is shifted into bit 7. ROXR.W count.On 2 6 + 2N(1/0) X X 0 X 31 16 15 0 6 + 2N(1/0) X X 0 On,dOn 2 X I I •I ~ As ROXR.B except shfits are for one word. ~ ~ 8 + 2N(1I0) X r 2 X 0 X 31 ROXRL count,On 0 2 8 + 2N(1/01 X X 0 X On,dOn •• ~ ~ As ROXR.B except shifts are for entire register. Table 7-6. MC68000 Instructim Set Summary (Continued) Status Mnemonic Operand(s) Bytes Clock Operation Performed Cycles T S X N Z V C BTST bitl.On 4 10(2/0) X [l] [On] On,dOn 2 6(1/0) X [l] - [dOn < [On] > ] Test a bit of a data register and reflect status in lero bit. The bit to be tested may be specified directly or in a data register (bit 0-31 in either case). BTST bitb,dadr 4,6 8(2/0)+ X [l] - [dadr < bitb >] or 8 On,dadr 2,4 4(110)+ X [l] - [dadr<[On]>] or 6 Test a bit of a memory byte and reflect status in Zero bit. The bit to be tested may be specified directly or in a data register (bit 0-7 in either case). 1 BSET bitl,On 4 12(2/0) X [ l ] - [On 1. [On] - 1 ~ On,dOn 2 8(1/0) X [l] - [dOn < [On] > 1. [dOn < [On] > - 1 3: bitb,dadr 4,6 13(2/11+ X [l] - [dadr < bitb > 1. [dadr < bitb >] - 1 III :::I or 8 is' c On,dadr 2,4 9(1/11+ X [l] - (dadr<[OnJ>1. [dadr<[On]>] ~- 1 !o· or 6 Test a bit as (BTST) and then set the specified bit. :::I BClR bitl.On 4 14(2/0) X [l] - [On1. [On] ~- 0 I On,dOn 2 8(1/0) X [l)·- [dOn<[On»l. [dOn<[On») - 0 bitb,dadr 4,6 13(2/1)+ X (ll - [dadr1. (dadr ]-O -..J or 8 .!.J On,dadr 2,4 9(1/11+ X [l] - (dadr«On]>l. [dadr«Onl>] - 0 N or 6 Test a bit (as BTST) and then clear the specified bit. BCHG bitl.On 4 12(2/0] X [l] - [On l. [On]- [On] On,dOn 2 8(1/0) X [l] - [dOn - [On] > 1. [dOn < [On] > 1. [dOn <[dOn] >l bitb,dadr 4,6 13(211) X [l] - [dadr < bitb > 1. [dadr < bitb >] - [dadr < bitb > ] or 8 On,dadr 2,4 9(1/1) X [l] - [dadr<[OnJ>l. [dadr<[On]>]- [dadr<[OnJ>] or 6 Test a bit (as BTST) and then complement the specified bit. MOVE An,USP 2 4(1/0) [USP]- [An] Move contents of address register to User Stack Pointer. This is a pri- vileged instruction. MOVE USP,An 2 4(1/0) [An] - [USP] Move contents of User Stack Pointer to address register. This is a pri- vileged instruction. LINK An,d16 4 18(212) [A7] - [A7] - 2 VI [[A711- [An] Dr n [An] - [A7] ;I; [A7] - [A7] + d16 Save the contents of the specified address register on the Stack, load I the current Stack Pointer to the specified address register, and set the Stack Pointer to point beyond the temporary stack storage area. PEA jadr 2,4 10(1/2)+ [A7] - [A7] - 2 or 6 [[A711- jadr Compute long word address and push address onto the Stack. 3 Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Operation Performed Mnemonic Operand Is) Bytes Cycles T S X N Z V C Ci UWLK An 2 12(3/0) [A7] - [An] ~.::I n~ [An] - [[A7]] [A7] - [A7] + 2 ; ~ Store the contents of the specified address register to the Stack !: Pointer (A 7) and load the specified address register from the stack. CHK data16.0n 4 49(6/3). X U U U If [On <0-15>] < 0 or [On <0-15>] > data16 12(210) then [PC] - CHK interrupt vector On.dOn 2 45(5/3), X U U U If [dOn <0-15>] < 0 or [dOn <0-15>] > [On <0-15>] 8(1/0) then [PC] - CHK interrupt vector sadr.On 2.4 45(5/3). X U U U If [On<0-15>] <0 or [On<0-15>] > [sadr] or 6 8(1/0) then [PC] - CHK interrupt vector Check register against bounds and initiate Check interrupt processing if register word is out of bounds. The upper bound is a twos comple- ~ ment integer specified as immediate data. in a data register. or in a !! memory word. 2. 3 2 37(4/3) [A7] - [A7] - 2 ~ TRAP vector 2 III [[A711- [PC] :::I CI. [A7] - [A7] - 2 ~ [[A711- [SR] iil [PCl - vector 'C ';oJ Initiate exception processing through specified vector . ..... Co) TRAPV 2 37(5/3). If Overflow = 1 then TRAP 4(110) Initiate exception processing through Overflow vector if the Overflow bit is on. RTE 2 20(5/0) X X X X X [SR] - [[A7]1. [A7] - [A7] + 2 [PC] - [[A7]l. [A7] - [A7] + 2 Return from exception. MOVE On.CCr 2 12(210) X X X X X [SR<0-4>] - [On <0-4] Move status data from data register to condition codes. MOVE sadr.CCR 2.4 12(210)+ X X X X X [SR<0-4>] [sadr<0-4>] or 6 Move status data from memory location to condition codes. The source address is a word address. 2• 3 MOVE data8.CCR 4 16(3/0) X X X X X [SR] - data8<0-4> Move immediate status data to condition codes. MOVE On.SR 2 12(2/0) X X X X X X X [SR]- [On<0-15>] Moves status word from data register to Status register. This is a pri- f MOVE sadr.SR 2.4 or 6 12(2/0)+ X X X X X X X vileged instruction. [SR] - [sadr] Move status word from memory location to Status register. This is a privileged instruction. The source address is a word address. 2• 3 MOVE data16.SR 4 16(3/0) X X X X X X X [SR] - data 16 Move immediate status word to Status register. This is a privileged instruction. MOVE SR.On 2 6(1/0) [On<0-15>] - [SR] Move contents of Status register to data register. Bits 16-31 of the data register are not affected. Table 7-6. MC68000 Instruction Set Summary (Continued) Status Clock Mnemonic Operand(s) Bytes Operation Performed Cycles T S X N Z V C MOVE SR.dadr 2.4 9(1/1)+ [dadrl - [SRI or 6 Move contents of Status register to memory location. The destination address is a word address. 2. 3 AND.B dataS.SR 4 20(3/0) X X X X X [SR<0-7>1- [SR<0-7>1 /\ dataS AND immediate data byte to low-order Status register byte. C/I AND.w data 16.SR 4 20(3/0) X X [SRI - [SRI ./\ data16 g X X X X X AND immediate data with Status register. This is a privileged Ii instruction. Ci EORB dataS.SR 4 20(3/0) X X X X X [SR<0-7>1 - [SR<0-7>1 ¥ dataS 0 aS· Exclusive-OR immediate data byte to low-order Status register byte. . c e: EORW data 16.SR 4 20(3/0) X X X X X X X [SRI - [SRI ¥ data 16 Exclusive-OR immediate data with Status register. This is a privileged instruction. ORB dataS.SR 4 20(3/0) X X X X X !SR<0-7>1- !SR<0-7>1 < dataS OR immediate data byte to low-order Status register byte. ORW data 16.SR 4 20(3/0) X X X X X X X [SRI - [SRI V data 16 OR immediate data with Status register. This is a privileged instruc- tion. ~ -..J NOP 2 4(110) No operation. ~ 3: RESET 2 132(1/0) Reset. This is a privileged instruction. iii' () STOP data16 4 S(2/0) X X X X X [SRI - data16 !!. iii Stop processor. This is a privileged instruction. .. ::I 0 Ii n ~ 2. Table 7-7. MC68000 Instruction Object Codes ABCO -(SAn),-(dAn) C 2 19(3/1) sOn,dOn C 2 6(1/0) AOO.B dataS,dadr 0 4,6,orS 13(2/1)+ dataS,On 0 4 S(2/0) On,dadr 0 2,4,or6 9(1/1)+ sadr,On 0 2,4,or6 4(1/0)+ sOn,dOn 0 2 4(110) AOO.L data32,An 0 6 16(3/0) data32,dadr 0 6, S,or 10 22(3/2)+ data32,On 0 6 16(3/0) Dn,dadr 0 2,4,or6 14(1/2)+ rS,An 0 2 S(1/0) rS,On 0 2 S(1/0) sadr,An 0 2,4,or6 6(1/0)+ sadr,On 0 2,4,or6 6(1/0)+ AOO.W data16,An 0 4 S(2/0) data 16,dadr 0 4,6,orS 13(2/1) data16,On 0 4 8(2/0) On,dadr 0 2,4,or6 9(11)+ rS,An 0 2 S(1/0) rS,On 0 2 4(110) sadr,An 0 2,4,or6 8(1/0)+ sadr,On 0 2,4,or6 4(1/0)+ ...., AOOO.B data3,dadr 5 2,4,or6 9(1/0)+ .!.J (J1 data3,On 5 2 4(1/0) AOOQ.L data3,An 5 2 8(1/0) data3,dadr 5 2,4,or6 14(1/2)+ data3,On 5 2 B(1/0) AOOO.w data3,An 5 2 4(1/0) data3,dadr 5 2,4,or6 9(1/1)+ data3,On 5 2 4(1/0) AOOX.B -(sAn),-(dAn) 0 2 19(3/11 sOn,dOn 0 2 4(1/0) AOOX.L -(sAn),-(dAn) 0 2 32(5/2) SOn,dOn 0 2 B(1/0) AOOX.w -(sAn),-(dAn) 0 2 19(3/1) sDn,dDn D 2 4(1/0) ANO.B dataS,dadr 0 4,6,orB 13(2/1)+ dataS,On 0 4 B(2/0) dataB,SR 0 4 20(3/0) Dn,dadr C 2,4,or6 9(1/1)+ sadr,On C 2,4,or6 4(1/0)+ sOn,dOn C 2 4(1/0) AND.L data32,dadr 0 6,B,orl0 22(3/2)+ data32,Dn 0 6 16(3(0) Dn,dadr C 2,4,or6 14(1/2)+ sadr,Dn C 2,4,or6 6(1/0)+ sOn,dOn C 2 B(1/0) AND.w data 16,dadr 0 4,6,orS 13(2/1)+ data16,Dn 0 4 B(2/0) data16,SR 0 4 20(3/0) On,dadr C 2,4,or6 9(1/1) sadr,Dn C 2,4,or6 4(1/0) Table 7-7. MC68000 Instruction Object Codes (Continued) sOn,dOn 2 4(1/0) ASl dadr ~~m6 9(1/1)+ ASL.B count,On 2 6 + 2N(1/0) On,dOn 2 6 + 2N(1/0) ASL.l count,On 2 8 + 2N(1/0) On,dOn 2 8 + 2N(1/0) ASL.W count,On 2 6 + 2N(1/0) On,dOn 2 6 + 2N(1IO) ASR dadr ~~m6 9(1/1)+ ASRB count,On 2 6 + 2N(1/0) On,dOn 2 6 + 2N(1/0) ASRl count,On 2 8 + 2N(1/0) On,dOn 2 8 + 2N(1/0) ASRW count,On 2 6 + 2N(1/0) On,dOn 2 6 + 2N(1/0) BCC label 4 10,12(2/0) label 2 10,18(1/0) BCHG bitb,dadr ~~m8 13(2/11+ bitl,On 4 12(2/0) On,dadr ~~m6 9(111)+ On,dOn 2 8(1/0) BClR bitb,dadr ~~m8 13(2/1)+ bitl,On 4 14(2/0) -.oJ On,dadr ~~m6 9(111)+ .:... 0) On,dOn 2 8(1/0) BCS label 4 10,12(2/0) label 2 10,18(1/0) BEQ label 4 10,12(2/0) label 2 10,8(1/0) BGE label 4 10,12(2/0) label 2 10,8(1/0) BGT label 4 10,12(2/0) label 2 10,8(1/0) BHI label 4 10,12(2/0) label 2 10,8(1/0) BlE label 4 10,12(2/0) label 2 10,8(1/0), BlS label 4 10,12(2/0) label 2 10,8(1/0) BlT label 4 10,12(2/0) 2 10,8(1/0) BMI label 4 10,12(2/0) label 2 10,8(1/0) BNE label 4 10,12(2/0) label 2 10,8(1/0) BPl label 4 10,12(2/0) label 2 10,8(1/0) BRA label 4 10(2/0) label 2 10(110) BSH bitb,dadr ~~m8 13(2/1)+ bitl,On 4 12(2/0) On,dadr ~~m6 9(1/1)+ On,dOn 2 8(1/0) Table 7-7. MC68000 Instruction Object Codes (Continued) Instruction Byte 4 Byte 5 Byte 6 Byte 7 Byte 8 Byte 9 Byte 10 Bytes Clock Cycles BSR label 6 4 10,12(2/0) label 6 2 10, B(1/0) BTST bitb,dadr 0 4,6,orB B(2/0)+ bitl,On 0 4 10(2/0) On,dadr 0 2,4,or6 4(1/0) On,dOn 0 2 6(1/0) BVC label 6 4 10,12(2/0) label 6 2 10, B(1/0) BVS label 6 4 10,12(2/0) 6 2 10,B(1/0) CHK data16,On 4 4 49(6/3),12(2/0) On,dOn 4 2 45(5/3),B(1/0) sadr,On 4 2,4,or6 45(5/3)+,Bl/0) CLR.B dadr 4 2,4,or6 9(1/1)+ On 4 2 4(1/0) ClR.l dadr 4 2,4,or6 14(1/2)+ On 4 2 6(110) ClRW dadr 4 2,4,or6 9(1/1) On 4 2 4(1/0) CMP.B dataB,dadr 0 4,6,orB B(2/0) dataB,On 0 4 B(2/0) sadr,On B 2,4,or6 4(1/0)+ sOn,dOn B 2 4(1/0) CMP.l data32,An B 6 14(3/0) ".:.. data32,dadr 0 6, B, or 10 12(3/0)+ " data32,On rS,An 0 B 6 2 14(3/0) 6(1/0) rS,On B 2 6(1/0) sadr,An B 2,4,or6 6(1/0)+ sadr,On B 2,4,or6 6(1/0)+ CMP.W data16,An B 4 B(2/0) data16,dadr 0 4,6,orB B(2/0)+ data16,On 0 4 B(2/0) rS,An B 2 6(1/0) rS,On B 2 4(1/0) sadr,An B 2,4, or6 6(1/0)+ sadr,On B 2,4,or6 4(1/0)+ CMPM. B (sAn)+,(dAn)+ B 2 12(3/0) CMPM. l (sAn)+,(dAn)+ B 2 20(5/0) CMPM.W (sAn) +, (dAn) + B 2 12(3/0) OBCC On,label 5 4 12(2/0),10(2/0),14(3/0) OBCS On,label 5 4 12(2/0),10(2/0),14(3/0) OBEQ On,label 5 4 12(2/0),10(2/0),14(3/0) OBF On,label 5 4 12(2/0),10(2/0),14(3/0) OBGE On,label 5 4 12(2/0),10(2/0),14(3/0) OBGT On,label 5 4 12(2/0),10(2/0),14(3/0) OBHI On,label 5 4 12(2/0),10(2/0),14(3/0) OBlE On,label 5 4 12(2/0),10(2/0),14(3/0) OBlS On,label 5 4 12(2/0),10(2/0),14(3/0) OBlT On,label 5 4 12(2/0),10(2/0),14(3/0) OBMI On,label 5 4 12(2/0),10(2/0),14(3/0) OBNE On,label 5 4 12(2/0),10(2/0),14(3/0) OBPl On.label 5 4 12 (2/0), 10(2/0), 14(3/0) Table 7-7. MC68000 Instruction Object Codes (Continued) Instruction OBRA On.label OBT On.label 5 4 12(2/0).10(2/0).14(3/0) OVC On.label 5 4 12(2/0).10(2/0).14(3/0) OVS On.label 5 4 12 (2/0).10(2/0),14(3/0) DIVS data16,Dn 8 4 <162(2/0) sadr,On 8 2,4,or6 <15811/0)+ sOn,dOn 8 2 <158(1/0) OIVU data16.0n 8 4 <148(2/0) sadr.On 8 2,4.or6 <140(1/0)+ sOn,dOn 8 2 <140(1/0) EOR.B data8.dadr 0 4.6.or8 13(2/1)+ data8,On 0 4 8(2/0) data8,SR 0 4 20(3/0) On.dadr 2A.or6 9(1/1)+ sOn,dOn 2 4(1/0) EOR. L data32,dadr 6,8,or10 22(3/2)+ data32,On 6 16(3/0) Dn,dadr 2.4.or6 14(1/2)+ sOn,dOn 2 8(110) EOR. W data 16,dadr 4,6,or8 13(2/1)+ data16,Dn 4 8(2/0) data16,Sr 4 20(3/0) On.dadr 2,4,or6 9(1/1)+ ...,J sOn,dDn 2 4(1/0) .!.J EXG An,An 2 6(1/0) CO An.On 2 6(110) On, An On,On 2 6(1/0) EXT.L On 2 4(1/0) EXTW On 2 4(1/0) JMP jadr 2,4.or6 4(1/0)+ JSR jadr 2.4.or6 14(1/2)+ LEA jadr.An 2.4.or6 2(0/0)+ LINK An.d16 4 18(2/2) LSL dadr E 2.4.or6 9(1/1)+ LSL.8 count. On E 2 6 + 2N(1/0) On.dOn E 2 6 + 2N(1I0) LSL.L count. On E 2 8 + 2N(1I0) On.dOn E 2 8 + 2N(1/0) LSL.W count.On E 2 6 + 2N(1/0) Dn.dOn E 2 6 + 2N(1/0) LSR dadr E 2.4.or6 9(1/1)+ LSR.B count. On 2 6 + 2N(1/0) On.dOn 2 6 + 2N(1I0) LSR.L count. On E 2 8 + 2N(1/0) On.dOn E A 2 8 + 2N(1/0) LSRW count. On E 4 2 6 + 2N(1/0) On.dOn E 6 2 6 + 2N(1/0) MOVE An.USP 6 2 4(1/0) data8.CCR F 4 16(3/0) data16.SR F 4 16(3/0) Dn.CCR C 2 12(2/0) On.SR C 2 12(2/0) Table 7-7. MC68000 Instruction Object Codes (Continued) Bytes Clock sadr,CCR 4 il~~llee_ 2,4,or6 12(2/0)+ sadr,SR SR,dadr : Ill.; ~ ~ ~II 2,4,or6 2,4,or6 12(2/0)+ 9(111)+ SR,On 4;;~C" 2 6(1/0) USP,An 2 4(110) MOVE.S dataS,On 4 it"JJ 6 . ' 1.3_ l 4 S(2/0) dataS,dadr 1.11./¥, 4,6,orS 9(1/1)+ '1 ee_ On,dadr 1 ''>'''::001111 2,4,or6 5(0/1)+ sOn,dOn sadr,dadr 1"'" 0111 2 2, 4, 6, S or 10 4(1/0) 5(111)+ ~I~ti sadr,On 2,4,or6 4(1/0)+ MOVE. L An,dadr 2,4,or6 10(0/2)+ data32,An 6 12(3/0) data32,dadr 6,S,or 10 lS(2/2)+ data32,Dn 2 .' . 3 G;,~'< 6 12(3/0) On,dadr 2 W~, 00181 2 ! . ' :gg4 . ; ; 2,4,or6 10(0/2)+ rS,An 2 4(110) ~ lo~_. rS,On 2 4(110) sadr,An 2,4,or6 S (2/0) + sadr,dadr 2 ~>,y* ggee. 2,4,6, S, or, 10 14(112)+ MOVE.W sadr,On An,dadr data16,An 2 ,'" 33 •II OOee'" + ooWij ,gg7'''1441 '" • K~ 2,4,or6 2,4,or6 4 4(1/0)+ 5(0/1)+ S(2/0) ~ ...., data 16,dadr data16,On 3 3 III gg P<0':;;; . 311 fii~ .·C¢!+~ 3 lliP;; gg Od'liil 4,6,orS 4 9(111)+ S(2/0) <0 On,dadr 2,4,or6 5(0/1)+ rS,An 3 III 4 III:; 2 4(1/0) ee_ rs,On 1 2 4(1/0) sadr,An 33'~Olee;m .011 i 2,4,or6 4(1/0)+ sadr,dadr 3 .gg 2,4, 6, S, or 10 5(0/1)+ 11~1 sadr,On 2,4,or6 4(1/0)+ MOVEM. L (An)+,reg-list 4 S + Sn(2 + 2n/0) jadr,reg-list 4,6,orS S + Sn(2 + 2n/0)+ reg-list, - (An) 4 4 + 10n(1/n) reg-list,madr 4,6,orS 4 + 10n(1/n)+ MOVEM. W (An) + ,reg-list II !C:!tf~ 10' . 4 4,6,orS S + 4n(2 + n/O) .1 jadr,reg-list 4 S + 4n(2 + n/O)+ MOVEP. L reg-list, - (An) reg-list,madr d16(An),On :liiil~:. O~! 4 ' i I I 4 4,6.orS 4 4 + 5n(1/n) 4 + 5n{1/n)+ 24(6/0) On,d16(An) o ;1\1; C 4 2S(2/4) 4 MOVEP. W d16(An),On On,d16(An) °8°ill o •. ...~~ S 1.:,0.0.: 4 16(4/0) lS(2/2) ~ MOVEQ dataS,On 2 4(110) MULS data16,On 4 <74(2/0) sadr,On 11:eel 2.4,or6 <70(1/0)+ sOn,dOn C'IIQ'C.! 2 <70(1/0) g~+~ MULU data16,On 4 <74(2/0) sadr,On 2,4,or6 <70(1/0)+ :4~00ff1 sOn,dOn 2 <70(1/0) NBCO dadr 2,4,orS 9(1/1)+ NEG.B On dadr lif) O~ff;" '~jl 2 2.4.or6 6(1/0) 9(1/1) ... Table 7-7. MC6SOOO Instruction Object Codes (Continued) Instruction Bytes Clock Cycles On 4 2 4(1/0) NEG.L dadr 4 ~~m6 14(1/2)+ On 4 2 6(1/0) NEG.w dadr 4 ~~m6 9(111) On 4 2 4(1/0) NEGX.B dadr 4 ~~m6 9(111)+ On 4 2 4(110) NEGX.L dadr 4 ~~m6 14(112)+ On 4 2 6(1/0) NEGX.w dadr 4 ~~m6 9(1/1)+ On 4 2 4(1/0) NOP 4 2 4(1/0) NOT.B dadr 4 2.4.or6 9(1/1)+ On 4 2 4(1/0) NOT.L dadr 4 2.4.or6 14(1/2)+ On 4 2 6(110) NOT.W dadr 4 2.4.or6 9(1/1)+ On 4 2 6(1/0) OR. B data8.dadr o 4.6.or8 13(2/1)+ data8.Dn o 4 8(2/0) data8.SR o 4 20(3/0) Dn..dadr 8 2.4.or6 9(111)+ sadr.Dn 8 2.4.or6 4(1/0)+ ...., sDn.dOn 8 2 4(1/0) 00 OR. L data32.dadr o 6.8, or 10 22(3/2)+ o data32.Dn o 6 16(3/0) Dn.dadr 8 2.4.or6 14(1/2)+ sadr.Dn 8 2.4.or6 6(1/0)+ sOn.dOn 8 2 8(1/0) OR. W data 16.dadr o 4.6.or8 13(2/1)+ data16.0n o 4 8(2/0) data16.SR o 4 20(3/0) Dn.dadr 8. 2.4.or6 9(1/1)+ sadr.Dn 8 2.4.or6 4(110)+ sDn.dDn 8 2 4(110) PEA jadr 4 2.4.or6 10(1/2)+ RESET 4 2 132(1/0) ROL dadr 2.4.or6 9(1/1)+ ROL.B count. On 2 6 + 2N(1/0) On.dOn 2 6 + 2N(1/0) ROL.L count. On 2 8 + 2N(1I0) Dn.dOn 2 8 + 2N(1/0) ROL.W count. On 2 6 + 2N(1/0) Dn.dOn 2 6 + 2N(1/0) ROR dadr 2.4or6 9(1/1)+ ROR.B count. On 2 6 + 2N(1/0) Dn.dDn E 2 6 + 2N(1/0) ROR.L count.Dn E 2 8 + 2N(1/0) Dn.dDn E 2 8 + 2N(1/0) RORW count.On E 2 6 + 2N(1/0) On.dOn E 2 6 + 2N(1/0) ROXL dadr E 2.4.or6 9(1111+ ROXL.B count. On 2 6 + 2N(1/0) Table 7-7. MC68000 Instruction Object Codes (Continued) Instruction Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8 Byte 9 Byte 10 Bytes Clock Cycles On,dOn 2 6 + 2N(1/0) ROXl.L count.On 2 B + 2N(1/0) On,dOn 2 B + 2N(1/0) ROXl.W count, On 2 6 + 2N(1/0) On,dOn 2 6 + 2N(1/0) ROXR dadr 2,4,or6 9(1/1)+ ROXR.B count.On E 2 6 + 2N(1/0) On,dOn E 2 6 + 2N(1/0) ROXR.L count.On E 2 B + 2N(1/0) On,dOn E 2 B + 2N(1/0) ROXR.W count, On E 2 6 + 2N(1/0} On,dOn E 2 6 + 2N(1/0) RTE 2 20(5/0) RTR 2 20(5/0) RTS 2 16(4/0) SBeo -(sAn),-(dAn) 2 19(3/1) sOn,dOn 2 6(1/0) see dadr 2,4,or6 9(1/1)+ On 5 2 6,4(110) ses dadr 5 2,4,or6 9(1/1)+ On 5 2 6,4(1/0) SEQ dadr 5 2,4,or6 9(1/1)+ On 5 2 6,4, (1/0) -...I SF dadr 5 2,4,or6 9(111)+ ~ SGE On dadr 5 5 2 2,4,or6 6,4(1/0) 9(111)+ On 5 2 6,4(1/0) SGT dadr 5 2,4,or6 9(111) On 5 2 6,4(1/0) SHI dadr 5 2,4,or6 9(111)+ On 5 2 6,4,(110) SLE dadr 5 2,4,or6 9(111)+ On 5 2 6,4(1/0) SLS dadr 5 2,4,or6 9(1/1)+ On 5 2 6,4(1/0) SLT dadr 5 2,4,or6 9(111)+ On 5 2 6,4(110) SMI dadr 5 2,4,or6 9(1/1)+ On 5 2 6,4(110) SNE dadr 5 2,4,or6 9(1/1)+ On 5 2 6,4(110) SPL dadr 5 2, 4,or 6 9(111)+ On 5 2 6,4(1/0) ST dadr 5 2,4,or6 9(1/1)+ On 2 6,4(110) STOP data16 4 B(2/0) SUB. B dataB,dadr 4,6,orB 13(2/1)+ dataB,On 4 B(2/0) On,dadr 2,4,or6 9(1/1)+ sadr,On 2,4,or6 4(1/0)+ sOn,dOn 2 4(1/0) SUB. L data32,An 6 16(3/0) data32,dadr 6,B,or 10 22(3/2)+ Table 7-7. MC68000 Instruction Object Codes (Continued) data32,On 16(3/0) On,dadr 2,4,orS 14(112)+ rS,An 2 8(1/0) rS,On 2 8(1/0) sadr,An 2,4,orS S(1/0)+ sadr,On 2,4,or6 6(110)+ SUBW data1S,An 4 8(2/0) data 1S,dadr 4,6,or8 13(2/1)+ data16,On 4 8(210) On,dadr 2,4,or6 9(1/1)+ rS,An 2 8(1/0) rS,On 2 4(1/0) sadr,An 2,4,orS 8(1/0)+ sadr,On 2,4,or6 4(1/0)+ SUBQ.B data3,dadr 2,4,or6 9(111)+ data3,On 2 4(1/0) SUBQ.L data3,An 2 8(1/0) data3,dadr 2,4,or6 14(1/2)+ data3,On 2 8(1/0) SUBQ.w data3,An 2 4(1/0) data3,dadr 2,4,or6 9(111)+ data3,On 2 4(110) SUBX.B -(sAn), -(dAn) 2 19(3/1) sOn, dOn 2 4(110) "c» N SUBX.L -(sAn),-(dAn) sOn,dOn 2 2 32(5/2) 8(1/0) SUBXW - (sAn), - (dAn) 2 19(3/1) sOn,dOn 2 4(110) svc dadr 2,4,or6 9(111)+ On 2 6,4(1/0) SVS dadr 2,4,orS 9(111)+ On 2 S,4(1/0) SWAP On 2 4(110) TAS dadr 2,4,or6 11(111)+ On 2 4(1/0) TRAP vector 2 36(4/3) TRAPV 2 37(5/3),4(1/0) TST.B dadr 2,4,or6 4(1/0)+ On 2 4(110) TST.L dadr 2,4,or6 4(1/0)+ On 2 4(1/0) TSTW dadr 2,4,orS 4(1/0)+ On 2 4(1/0) UNLK An 2 12(3/0) Table 7-8. MC68000 Object Codes in Numerical Order ORB data8,Dn ORB data8,dadr ORB data8,SR OR.w data16,on OR.w data 1 6,dadr OR.w data16,SR ORl data32,on ORl data32,dadr BTST on,don MOVEP.w d16{Anl.on BTST on,dadr BCHG on,don MOVEP.l d16{An),on BCHG on,dadr BClR on,don MOVEP.w on,d16(An) BClR on,dadr BSET on,don MOVEP.l on,d16{An) BSET on,dadr ANo.B data8,on ANo.B data8,dadr ANo.B data8,SR ANo.w data16,on ANo.w data 16,dadr ANo.w data16,SR ANo.l data32,on ANo.l data32,dadr SUB.B data8,on SUB.B data8,dadr SUB.w data16,on SUB.w data 16,dadr SUB.l data32,on SUB.l data32,dadr ADo.B dataS,on ADo.B dataS,dadr ADo.w data16,on Aoo.w data 16,dadr Aoo.l data32,on Aoo.l data32,dadr BTST bitl,on BTST bitb,dadr BCHG bitl.on BCHG bitb,dadr BClR bitl.on BClR bitb,dadr BSH bitl.on BSH bitb,dadr EOR.B dataS,on EOR.B dataS,dadr EORB dataS,SR EOR.w data16,on EOR.w data 16,dadr EOR.w data16,SR EORl data32,on EORl data32,dadr CMP.B dataS,on CMP.B dataS,dadr CMP.w data16,on CMP.w data 16,dadr CMP.l data32,on CMP.l data32,dadr MOVE.B son,don MOVE.B sadr,on MOVE.B dataS,on MOVE.B on,dadr MOVE.B sadr,dadr MOVE.B dataS,dadr MOVE.l rS,on MOVE.l sadr,Dn MOVE.l data32,Dn MOVE.l rS,An MOVE.l sadr,An 7-83 Table 7-8. MC68000 Object Codes in Numerical Order (Continued) Instruction 2 MOVE.L data32,An 2 MOVE.L rS,dadr 2 MOVE.L sadr,dadr 2 MOVE.L data32,dadr 3 MOVE.w rS,On 3 MOVE.w sadr,On 3 MOVE.w data16,On 3 4 MOVE.W rS,An 3~01ee MOVE.w sadr,An 3 . 7 MOVE.w data16,An MOVE.w rS,dadr 3." " ,',' , gOO t$$S:' 3~mggee MOVE.w sadr,dadr 3' gll MOVE.w data16,dadr 4 a NEGX.B On 40';00ft NEGX.B dadr 40::,; .," 4 NEGX.w On 40' Olff NEGX.w dadr 40'~ B NEGX.L On 40':" <.;,1 Oft NEGX.L dadr 4C;h,fl C MOVE SR,On 40,:; {llff MOVE SR,dadr 4 B CHK On,dOn 4, 10ee CHK sadr,On 4' B CHK data16,On 4 l1jj LEA jadr,An 4~,>~. 0 Q~ CLR.B On 4~ ,':; ,00ff f!:ft:: CLR.B dadr 42'"'/ 4 ~q CLR.w On 42": ',Olff CLR.w dadr 4!i:;'ir B CLR.L On 4~<::,: 10ft CLR.L dadr 44',i/ 0 NEG.B On 44~:·' :'" OOff NEG.B . dadr 4~'::i 4 NEG.w On 44 ,>;:, Olff NEG.W dadr 44·, B NEG.L On 44" 10ft NEG.L dadr 44:. c MOVE On,CCR 440 ;':,:llee MOVE sadr,CCR 44··;' F .. MOVE dataB,CCR 46 00ij.d:4 NOT.B On 46 OOft f,{ff. NOT.B dadr 46:,4~Q NOT.w On 46, ' ; 01 ft "it> NOT.w dadr 46. B . NOT.L On 4ij, ~'10ff NOT.L dadr 46,,', C MOVE On,SR 4~> 'Jlee~~ MOVE sadr,SR 4$. 'F . MOVE data16,SR 48 , 0 NBCO On 4tf , OOft ftf!·:; NBCO dadr 4fit, , ' 4 Om: SWAP On 48 ,,'. 01jj . PEA jadr 48:' . B EXT.w On 48 .10hhhlitlh MOVEM.w reg-list.madr 48," A MOVEM.W reg-list,-(An) 4$' C EXT.L On 48····. :'llh~ MOVEM.L reg -list,madr 48': ,': E ',",. MOVE. L reg-list.-(An) 4A o~. TST.B On 4A OOft ffff' . TST.B dadr 41\ 4 Om TST.w On 4A Olff ffff , (EXT) TST.w dadr 41\ 8 Orrr TST.L On 4A . 1Off ftff {E~T) TST.L dadr 4A, C Orrr TAS On 4A l1ff ffff· f~T) TAS dadr 4C '10jj W.: MOVEM.W jadr,reg-list 4C A 9$5$ MOVEM.w (An) +,reg-list 4C E Q'~s MOVEM. L (An)+.reg-list 4C, l1jj ijjj:., MOVEM. L jadr,reg-list 4C E ~~.~ MOVEM. L (An)+,reg-list 4E. 4 Ww TRAP vector 7-84 Table 7-8. MC68000 Object Codes in Numerical Order (Continued) LINK An.d16 UNlK An MOVE An.USP MOVE USP.An RESET Nap STOP data16 RTE RTS TRAPV RTR JSR jadr JMP jadr ADDQ.B data3.Dn ADDQ.B data3.dadr ADDQ.w data3.Dn ADDQ.w data3.An ADDQ.w data3.dadr ADDQ.l data3.Dn ADDQ.l data3.An ADDQ.l data3.dadr ST On DBT Dn.label ST dadr SUBQ.B data3.Dn SUBQ.B data3.dadr SUBQ.w data3.Dn SUBQ.w data3.An SUBQ.w data3.dadr SUBQ.l data3.Dn SUBQ.l data3.An SUBQ.l data3.dadr SF On DBF Dn.label SF dadr SHI On DBHI Dn.label SHI dadr SlS On DBlS Dn.label SlS dadr see On DBee Dn.label see dadr ses On DBes Dn.label ses dadr SNE On DBNE Dn.label SNE dadr SEQ On DBEQ Dn.label SEQ dadr sve On Dve Dn.label sve dadr SVS On DVS Dn.label SVS dadr SPl On DBPl Dn.label SPl dadr SMI On DBMI Dn.label SMI dadr SGE On DBGE Dn.label SGE dadr SlT On DBlT Dn.label SlT dadr SGT On DBGT Dn.label 7-85 Table 7-8. MC68000 Object Codes in Numerical Order (Continued) Instruction SGT dadr SlE On OBlE On.label SlE dadr BRA label BRA label BSR label BSR label BHI label BHI label BlS label BlS label Bee label Bee label Bes label Bes label BNE label BNE label BEQ label BEQ label Bve label Bve label BVS label BVS label BPl label BPl label BMI label BMI label BGE label BGE label BlT label BlT label BGT label BGT label BlE label BlE label MOVEQ dataS.On OR. B sOn.dOn OR.B sadr.On OR. W sOn.dOn OR.W sadr.On OR.l sOn.dOn OR.l sadr.On OIVU sOn.dOn OIVU sadr.On OIVU data 16.0n SBe sOn.dOn SBeo -(sAn).-(dAn) OR.B On.dadr OR.W On.dadr OR.l On.dadr OIVS sOn.dOn OIVS sadr.On OIVS data16.0n SUB.B sOn.dOn SUB.B sadr.On SUBW rs.On SUBW sadr.On 7-86 F Id 01 :y d m II li e 5 " )1 iE THE 2901, 2901 A, AND 2901 B MICROPRO' The 2901, 2901A, and 29018 are identical except for execution speeds. The than the 2901 ; the 2901 B is about 25% faster than the 2901 A. For details see the de The 2901 provides a 4-bit slice through the arithmetic and logic unit of a Centl the Central Processing Unit's registers may also be generated out of 2901 Ie Figures 8-1 and 8-2 functionally illustrate 2901 logic. Figure 8-1 is a variation of Figure 4-3 from Volume 1 : it illustrates 2901 logic description given in Chapter 4 of Volume 1. Figure 8-2 is a more accurate repr paths. Note that all logic and data paths in Figure 8-2 are four bits wide. 2901 logic consists of an arithmetic and logic unit. a local. two-part read/write mer and logic unit performs addition. subtraction. and the standard Boolean operati receives two inputs and generates one output. The local read/write memory storE results. In addition to the local read/write memory there is a "Q register" which is double-length operations. You may compare the 2901's 16 registers to a CPU VI usually implement a CPU's accumulator in the Q register. and you mayor may not i registers in local RAM (in general. however. you will implement these registers in You will frequently see obvious parallels between 2901 logic and CPU logic. You I understand 2901 logic; however. do not assume that these parallels translate intc The many data paths within the 2901 have been selected to link the ALU. local read output in a functionally efficient manner. Shift logic has been inserted at selected combination of data paths with ALU and shift logic minimizes the number of steps n cessing Unit functions. The few 2901 enhancements over the prior 6701 were designed specifically to redl implement typical CPU operations; and these few enhancements were sufficient t 2901 MICROPROCESSOR SLICE PINS AND SIGNALS Pins and signal assignments for the 2901 are illustrated in Figure 8-3. We will each of these signals superficially before examining device operations in detail. We may divide 2901 signals into these three categories: 1) Control inputs that are generated by a microinstruction 2) Control signals connecting 2901 slices 3) Data and status outputs First consider microinstruction-generated inputs. AO-A3 and 80-83 are two 4-bit addresses which select locations within the 29 10-18 is a 9-bit instruction code which determines data flow and arithmetic/logic. 9-bit control code can be divided into three 3-bit fields as follows: 8 7 654 3 2 o '--BitNo. I I I I I I I I I ~Instruction coe 'L4'-_ALU l ALU sourceid ALU operation destinatic 8-2 Chapter 8 2900 SERIES CHIP SLICE PRODUCTS Chip slice products represent a radical departure from the single-chip Central Processing Units that we have de- scribed up to this point. Chip slice products are. in fact. the building blocks for many Central Processing Units: they are also used to build intelligent controllers. There are·a variety of chip slice-type products on the market today; however, the 2900 series products are the clear leaders in terms of sales and customer acceptance. The 2900 series is an enhancement of the older 6700 series chip slice products, which are not described since they are now obsolete. Chip slice products are described conceptually in Chapter 4 of Voume 1 (in fact, the "general case" product de- scribed in Volume 1, Chapter 4 is a thinly disguised variation of the 2901 microprocessor slice). Therefoer, the discussion which follows assumes that you have a conceptual understanding of chip slice devices and microprogramming. If you do nto have this background, see Chapter 4 of Volume 1 before reading any further. In this chapter we will describe the following 2900 series parts: ~ The 2901. 2901 A. and 2901 B microprocessor slices • The 2902A Look-Ahead Carry Generator • The 2903 Enhanced Microprocessor Slice • The 2909A. 2910. and 2911A Microprogram Sequencers • The 2930 and 2932 Program Control Units All 2900 series devices use bipolar LSI technology. 2900 series microinstruction execution times vary with manufac- turer and device. Consult the data sheets at the end of this chapter for details. The primary source for the 2900 series chip slice products is: ADVANCED MICRO DEVICES 901 Thompson Place Sunnyvale. California 94086 Secondary sources for the 2900 series include: MOTOROLA SEMICONDUCTOR Box 20912 Phoenix. Arizona 85036 RAYTHEON SEMICONDUCTOR 350 Ellis Street Mountain View. Caiifornia 94042 NATIONAL SEMICONDUCTOR 2900 Semiconductor Drive Santa Clara. California 95050 FAIRCHILD CAMERA & INSTRUMENT CORPORATION 464 Ellis Street Mountain View. California 94042 8-1 THE 2901, 2901A, AND 29018 MICROPROCESSOR SLICE The 2901, 2901A, and 29018 are identical except for execution speeds. The 2901A is approximately 30% faster than the 2901; the 2901 B is about 25% faster than the 2901 A. For details see the data sheets at the end of this chapter. The 2901 provides a 4-bit slice through the arithmetic and logic unit of a Central Processing Unit. Some or all of the Central Processing Unit's registers may also be generated out of 2901 logic. Figures 8-1 and 8-2 functionally illustrate 2901 logic. Figure 8-1 is a variation of Figure 4-3 from Volume·1; it illustrates 2901 logic in terms of the general chip slice description given in Chapter 4 of Volume 1. Figure 8-2 is a more accurate representation of 2901 logic and data paths. Note that all logic and data paths in Figure 8-2 are four bits wide. 2901 logic consists of an arithmetic and logic unit a local. two-part read/write memory, and shift logic. The arithmetic and logic unit performs addition, subtraction, and the standard Boolean operations. The arithmetic and logic unit receives two inputs and generates one output. The local read/write memory stores data, which may be operands or results. In addition to the local read/write memory there is a "0 register" which is used as a temporary register or for double-length operations. You may compare the 2901's 16 registers to a CPU with 16 accumulators. You will not usually implement a CPU's accumulator in the 0 register, and you mayor may not implement a CPU's general purpose registers in local RAM (in general. however, you will implement these registers in .Iocal RAM). You will frequently see obvious parallels between 2901 logic and CPU logic. You may use these parallels to help you understand 2901 logic; however, do not assume that these parallels translate into CPU implementation. The many data paths within the 2901 have been selected to link the ALU, local read/write memory, data input and data output in a functionally efficient manner. Shift logic has been inserted at selected points along data paths so that the combination of data paths with ALU and shift logic minimizes the number of steps needed to create typical Central Pro- ceSSing Unit functions. The few 2901 enhancements over the prior 6701 were designed specifically to reduce the number of steps required to implement typical CPU operations; and these few enhancements were sufficient to render the 6701 obsolete. 2901 MICROPROCESSOR SLICE PINS AND SIGNALS Pins and signal assignments for the 2901 are illustrated in Figure 8-3. We will summarize functions performed by each of these signals superficially before examining device operations in detail. We may divide 2901 signals into these three categories: 1) Control inputs that are generated by a microinstruction 2) Control signals connecting 2901 slices 3) Data and status outputs First consider microinstruction-generated inputs. AO-A3 and 80-83 are two 4-bit addresses which select locations within the 2901 local 16 X 4 bit RAM. 10-18 is a 9-bit instruction code which determines data flow and arithmetic/logical operations within the 2901. This 9-bit control code can be divided into three 3-bit fields as follows: 8 7 654 3 2 o .--BitNo. I I I I I I I I I f.-,nstruction code ~t _ L '4"'--___ - ALU source identifier ALU operation identifier ALU destination identifier 8-2 Data In 16 x 4 bits of t--4 bits wide_! I I I I I 4-bit wide shifter 4-bit wide Complementer. Addition and Boolean logic (ALU Block) t wide shifter A (Direct connection from A-A to Y-Y) Figure 8-1. The 2901 Microprocessor Slice Volume 2 Rev. A. Update 2 8-3 1-79 ,....----,1>-........0 RAM3 CL~~D-_-D--I D;,octtg~JklmRr1TfD~EJJ Data Inputs 01 DO ControlD-------_t-....+__...J LeHers separated by a btoken line relate DE this figure 10 Figure 22-1 Figure 8-2. 2901 4-Bit Slice Logic 8-4 A3 .. .-.. 1 40 -- .. OE 18 ..- 1 42 -- 16 --- --- -- A2 2 39 Y3 17 2 41 AO ... - Y2 RAM3 3 40 -- --...-... A1 3 38 A1 -- ,- AO 4 37 Y1 nc 4 39 A2 16 5 36 YO RAMO 5 38 A3 ...- P -- .. 18 17 --.. ..--... 6 7 35 34 .. OVR (+5V) VCC F -- ...- 6 7 37 36 ---.. OE Y3 ...- G --.. RAM3 8 33 C(N+4) 10 8 35 Y2 RAMO 9 32 -- 11 9 34 - Y1 (+5V)VCC F -- - 10 11 2901 DIP 31 30 - F3 GND 12 CP -... 10 11 2901A FLAT 33 32 YO P .- -..-- --.. 10 12 29 CN nc 12 PACK 31 OVR -- -... ..- 11 12 CP 13 14 28 27 -.. 14 15 13 Q3 BO B1 -...- 13 14 15 30 29 28 -... C(N+4) G -- - 15 26 F3 - - --- Q3 DO B2 16 27 GND -.. 16 25 BO -- 17 24 -.. 01 B3 -- -.....- 17 26 CN B1 B2 -... 18 19 23 22 --- 02 03 QO 03 ..- 18 19 25 24 ---- 14 15 B3 20 QO 02 20 23 - 13 ~ 21 01 21 22 - DO Pin Name Description Type DO - 03 Data input Input YO - Y3 Data output Output. Tristate OE Output enable Input AO - A3 Local RAM A address Input BO - B3 Local RAM B address Input 10 -18 Instruction code Input RAMO, RAM3 Local RAM shift logic I/O Bidirectional QO,Q3 Q register shift logic I/O Bidirectional CN Carry in Input C(N+4) Carry out Output G,P Carry generate/propagate Output F Zero status Output. Open collector F3 Sign status Output OVR Overflow status Output CP Clock Input VCC,GND Power, ground Figure 8-3. 2901 A Microprocessor Slice Pins and Signal Assignments 8-5 00-03 is a data input port. All data entering a 2901 must be input via DO-D3. We include these four pins among the microinstruction-generated group since a microinstruction could indeed generate immediate data (in macro assembly language terms) to be input via DO-D3. A more common alternative might be to generate this data out of an external buffer. using microinstruction bits to enable a single output as follows: 2 to 4 Decoder ' - - - -..... D3. D2. D1. DO I--.....~ DO - D3 Enable 1 Buffer 1 Enable 2 Buffer 2 Enable 3 Buffer 3 OE is an output enable control. When OE is low. the 2901 can output data via YO-Y3. When OE is high. YO-Y3 is floated. A microinstruction must anticipate microcycles within which data output is to occur and must generate a low OE control at this time. When no data output is anticipated YO-Y3 should be floated. Let us now examine data and status output signals. As indicated in the previous paragraph. a 2901 outputs the results of internal operations via the four pins YO-V3. In addition, separate Overflow (OVR) and Zero (F) status indicators are output. These indicators are used to gener- ate standard Overflow and Zero statuses - as we will describe later. Carry Status logic and associated signals are not simple status outputs; they are more accurately represented as in- terslice connecting signals. CN is the carry in used by addition and.!ubtra£,tion. C(N+4) is the carry out generated by addition and subtraction. Carry Look-Ahead logic uses the P and G signals, together with the 2902 Carry Generator. in order to compute the carry for an arithmetic operation occurring in parallel at two or more 2901 slices. This carry logic has been described in Volume 1. Chapter 4; it is summarized later in this chapter when we describe the 2902 Carry Look-Ahead Generator. The 2901 has two sets of internal shift, logic. For multislice shifts. bits shifted -out from one slice must be shifted into the adjacent slice. QO and Q3 are the shift pins used by one set of shift logic; RAMO and RAM3 are the shift pins used by the other set of shift logic. CP is the master clock signal used to control and synchronize event sequences within the 2901. 8-6 2901 LOGIC We will now examine 2901 logic in detail. The best place to start understanding 2901 logic is at the read/write memory (local RAM): 2901 LOCAL RAM3 -"- RAM ~--\ RO/Li RAMO ./ LO/RI ?~ "-- ~ '-- ""'-- 31N MUX -- 31N MUX I- I- 31N MUX I- ~ 31N MUX .A- l Z--r----r----r----r- Z AWord Add ress roG- A1 A2o-- D-- DO 01 02 16-Bit by 4-Bit 2-Port RAM (Local RAM) 03 ~BO} ~B1 r-o B2 BWord Address A3D-- C .... New> m m all:C r-o B3 A - - - -~ ~ - - A .~ B- i - - - - - - B A Latch B Latch CLOCK CP cr---t>- E C .... New> mmmal III/ IIII 8-7 The 2901 local RAM consists of sixteen 4-bit locations. You use pins AO-A3 to identify the location from which data will be output to the A latch. This may be illustrated as follows: 3 2 0 I IA31 A21 A1 lAO Microinstruction This is the addressed location. It contains X16, which is output to the A latc h Input address in range 0- F16 X A Latch 8-8 You use pins 80-83 to identify the 4-bit location from which data will be output to the 8 latch and into which data from the ALU will be written. This may be illustrated as follows: Input data = y This is the addressed location. ~ DO 01 02 03 Y can be written into it via DO - 03. X can be read out of BO} Input { 81 82 83 ~ddress In range 0- F16 80 81 82 83 X 8 Latch 76543210 I831 82'1 81 I I I 80 A3·1 A21 A 1 lAO Microinstruction In the two illustrations above we show the A and B pin inputs coming from eight bits of a 2901 MICRO- microinstruction. This data may come from the Instruction register as well. The selected INSTRUCTION microinstruction bit numbers are not significant. The same address input at AO-A3 and 80-83 results in the same data out the A and 8 latches. In order to avoid race conditions which could result if you attempted to read and write at the same time, the clock signal CP controls event sequences as follows: CP __I .\. . _~r A and 8 Latch _ _ _ _ [!!!~~a~~~:l.._ _o_at_a_s_t_ab_l_e_....[~E~E~~~ J __ L:: o_a_ta_st_a_b_le_ _ Write Location J--y.....____ _______ J Data stable ...-I.[?;:c;a;gTn; -y...._____ Data stable .....[-O:t;;:;;-y-- _______ ~ In the timing diagram above. the A and 8 latch will receive data from the local RAM location addressed by the A and 8 address inputs. However. the A and 8 latch will only receive data from its associated RAM location while CP is high. As soon as CP goes low. and A and 8 latches hold whatever data they contained at the time CP made its high-to-Iow tran- sition. Similarly. data at the DO-D3 inputs can be written into the local RAM location addressed by the 8 address inputs while CP is low. While CP is high. the addressed local RAM location will hold whatever data it contained when CP made its low-to-high transition; thus. the addresses can be changed. These internal RAM latches cause the RAM to appear to the user as a (Iow-to-high) edge-triggered RAM. 8-9 The 2901 local RAM generates a 4-bit word through selected programmable registers of a 2901 RAM Central Processing Unit. But these sixteen local RAM locations do not represent the only place AND CPU where CPU registers can be created; that would limit you to a combined total of sixteen program- REGISTERS mable registers -which is frequently insufficient. Using register terminology from Chapters 6 and 7 of Volume 1, Primary Accumulators will most likely occupy 2901 local RAM locations; this is because Primary Accumulators are frequent sources and destinations for data operated on by the arithmetic and logic unit. Secondary Accumulators mayor may not occupy 2901 local RAM locations. Certainly if there are spare local RAM loca- tions it would make sense to allocate these to Secondary Accumulators, or fixed, "non-programmable" constants. But if there are no spare local RAM locations, then Secondary Accumulators could easily occupy external read/write memory. A 2901 can access external memory to read or write data, but this has some associated restrictions - which are de- scribed later in this chapter when we examine the 2903. Central Processing Unit registers that are normally used to compute memory addresses for the macroprogram mayor may not occupy 2901 RAM space. To the 2901 ALU, there is no difference between computing an address, or data. Adding an Index to a base address is the same as adding the contents of two Accumulators;· both are simple addition. For a simple Central Processing Unit address registers are likely to be located in the 2901 local RAM; then memory ad- dress computations and data computations must occur sequentially. In more complex Central Processing Units, you will compute assembly language memory addresses using one of the special memory addreSSing devices - the 2930 or the 2932. These devices contain their own registers; also, they compute memory addresses while the 2901 is per- forming ALU operations in parallel. Alternatively, the deSigner may choose to use a second set of 2901 s to build a high- speed memory addressing unit. In the preceding discussion we used the term "macroprogram memory address" to identify computer memory, in con- trast to memory within Central Processing Unit logic, where microinstructions are stored. If you are confused by the difference between a macroinstruction memory address and a microinstruction memory address, refer again to Chapter 4 of Volume 1. If a memory address register. such as an Index register, is also to serve as a general purpose Accumulator, it will have to be located in the 2901 local RAM. or in the external memory that accommodates Secondary Accumulators. The Instruction register will almost never be housed in local 2901 RAM. The macroinstruction object code will be held in an external buffer (the Instruction register) whose contents are decoded by logic external to the 2901 in order to trig- ger execution of appropriate microinstruction sequences. We will describe this logic later. The 00-03 inputs to the local RAM come from a 3-IN MUX. The 3-IN MUX receives the arithmetic and logic unit output, which it can shift up or down one bit position. The shift is achieved by connecting each ALU output line to three local RAM inputs. The RAMO and RAM3 pin connections of the 2901 allow you to cascade 2901 slices so that an up or down shift can be propagated through eight twelve, sixteen, or more bit positions. Beginning at the 4-bit level. we can illustrate logic for unshifted local RAM input as follows: RAMO - - - -t'" . ., i~---RAM3 :4 *i I I I r-----~ I I -- r-----r .- I i I I FO Fl F2 r-----~ I I i I I F3 ! 1 I 1 i I I 3-IN 3-IN 3-IN 3-IN MUX MUX MUX MUX t DO = FO t 01 = F1 t 02 = F2 t 03 = F3 8-10 Data shifted up one bit receives a new low-order bit from RAMO and outputs the high-order ALU product bit via RAM3 as follows: RAMO --I~~-, - -.....-~ RAM3 = F3 *t- I I -r=-.:--=-.:--~-.--,----------------~------------------------------1-+1-- ---..;+-- ---~~ I I I I r---- I -,------- F2 I r-----+--4~-+--F3 3-IN 3-IN 3-IN 3-IN MUX MUX MUX MUX DO = RAMO D1 = FO D2 = F1 D3 = F2 Similarly. a 1-bit downshift receives a new high-order bit from RAM3 and outputs the low-order product bit via RAMO as follows: RAMO = FO RAM3 ~- FO} ALU F1 F2 output F3 3-IN 3-IN 3-IN 3-IN MUX MUX MUX MUX DO = F1 D1 = F2 D2 = F3 D3 = RAM3 8-11 The Q register is a single 4-bit location with 3-IN MUX input logic similar to the local RAM input logic which we have just described. Q register logic may be illustrated as follows: FO} From F1 F2 AlU output F3 1 - (00) -T 3-IN 3-IN I 1 I (Q3) 3-IN 3-IN MUX MUX MUX MUX DO 01 02 03 Q Register QO Q1 02 03 } To ALU ;nput' a register logic is used primarily to enable double length up and down shifts which are needed by binary multiply and divide logic. Accordingly the a register 3-IN MUX receives these inputs: • The ALU output • Its own output - shifted up or down one bit position Thus fresh data entering the a register comes from the arithmetic and logic unit output. Subsequently, this data may be shifted up or down any number of bit positions by recycling the a register output back to the 3-IN MUX input shifted down one bit position: QO Q1 02 Q3 (Q3) IIIII (QO) DO 01 02 D3 or shifted up one bit position: (QO) QO Q1 Q2 Q3 \\\\\DO D1 D2 D3 (Q3) The 00 and 03 pin connections serve the same purpose for the a register shift logic as the RAMO and RAM3 pin con- nections serve for local RAM logic. 8-12 We will now examine the arithmetic and logic unit. including the following logic from Figure 8-2: c!~o-----------~-+~-+~-+~~ OE These three aspects of ALU logic are important: 1) The ALU operation which is to be performed. 2) The operands which are input to the ALU. 3) The destination for the ALU output. Shift logic lies in the path of ALU output data. therefore the destination specification includes any shift operation. Instruction code bits 10. 11. and 12 control the data input to the 2901 ALU; instruction code bits 13. 14. and 15 determine the operations which occur within the arithmetic and logic unit. Table 8-1 summarizes 10.11. and 12 interpretations. while Table 8-2 summarizes 13. 14. and 15 interpretations. Table 8-3 shows the result of 10-15 combinations. The two arithmetic and logic unit inputs are generated by a 2-IN MUX and a 3-IN MUX. The 2-IN MUX (which generates the R inputs) receives external data. or the A latch outputs from the local RAM. The 3-IN MUX (which generates the S inputs) receives the A or S latch outputs from the local RAM. or the Q register output. As an additional option. a can be inserted at the R or S inputs of the arithmetic and logic unit. Thus the following twelve Rand S input combinations cou Id be generated. R A A A A D D D D o 000 S A B Q 0 A B Q 0 A B Q 0 Used by 2901 Not used by 2901 A 3-bit input code can specify eight of the twelve input combinations illustrated above. A.A is eliminated since it is equivalent to A.S with the same address input at A and S. A.O is eliminated since it is equivalent to O.A. D.S is eliminated since it is equivalent to D.A: remember. the A and S addresses can be the same. 0.0 is eliminated since you cannot perform a useful arithmetic or logic operation on two zero operands. 8-13 Table 8-1. ALU Source Operand Control Table 8-2. 2901 ALU Function Control Micro Code ALU Source Operands Micro Code ALU Symbol Hex Hex Function 12 11 10 R S 15 14 13 Code Code 0 0 0 0 A Q 0 0 0 0 R Plus S R+S 0 0 1 1 A B 0 0 1 1 S Minus R S-R 0 1 0 2 0 Q 0 1 0 2 R Minus S R-S 0 1 1 3 0 B 0 1 1 3 R OR S RVS 1 0 0 4 0 A 1 0 0 4 RAND S RAS 1 0 1 5 0 A 1 0 1 5 RAND S RAS 1 1 0 6 0 Q 1 1 0 6 REX-OR S REBS 1 1 1 7· 0 0 1 1 1 7 REX-NOR RQfS Table 8-3. 2901 Source Operand and ALU Function Matrix ~ 1210 0 1 2 3 4 5 6 7 I~ 15 Source 4 A,a A,a o,a O,a O,A D,A D,a D,O 3 ALU Function CN=L A+Q A+B Q B A O+A O+Q 0 0 R Plus S CN=H A+Q+1 A+B+1 Q+1 B+1 A+1 0+A+1 0+Q+1 0+1 CN = L Q-A-1 B-A-1 Q-1 B-' A-' A-0-1 Q-0-1 -0-1 1 S Minus R CN=H Q-A B-A Q B A A-O Q-D -0 CN = L A-Q-1 A-B-1 -Q-1 -B-1 -A-' O-A-' O-Q-' 0-' 2 R Minus S CN=H A-Q A-B -0 -B -A O-A O-Q 0 3 R OR S· AVQ AVB 0 B A OVA OVQ 0 4 RANDS AAQ AAB 0 0 0 OAA OAQ 0 5 ii AND S AAQ AAB 0 B A DAA DAQ 0 6 REX-OR S AE9Q AE9B 0 B A OE9A OE9Q 0 7 REX-NOR S AE9Q AE9B 0 B A OE9A OEDQ 5 + = Plus; - = Minus; V = OR; A = AND; ED = EX-OR The eight ALU operations specified by 13. 14. and 15. combined with operand options. generate more than eight effec- tive operations. If you look at Table 8-3 you will see that you can increment. decrement. complement or negate data: you can simply pass data through the ALU. or you can generate a zero ALU output. Any of the functions shown in Table 8-3 can become an ALU output. You have the option of shifting these functions up or down one bit position. Instruction bits 16, 17, and 18 select the destination for ALU output, plus any shift which will be performed on the ALU output. Table 8-4 summarizes the eight destination options. 8-14 Table 8-4. ALU Destination Control RAM Q Register RAM Q Micro Code y Function Function Shifter Shifter Output 18 17 16 Hex Code Shift Load Shift Load RAMO RAM3 QO Q3 0 0 0 0 X NONE NONE F-O F X X X X 0 0 1 1 X NONE X NONE F X X X X 0 1 0 2 NONE F-B X NONE A X X X X 0 1 1 3 NONE F-B X NONE F X X X X 1 0 0 4 DOWN F/2 - B DOWN 0/2- 0 F FO IN3 00 IN3 1 0 1 5 DOWN· F/2 - B X NONE F FO IN3 00 X 1 1 0 6 UP 2F - B UP 20-0 F' INO F3 INO 03 1 1 1 7 UP 2F - B X NONE F INO F3 X 03 X = Don't care. Electrically, the shift pin is a TTL input internally connected to a three-state output which is in the high impedance state. B = Register addressed by B inputs. Up is toward MSB, Down is toward LSB. Because these options are not self-evident, they are illustrated in Figures 8-4 through 8-11. You will note that most destination codes generate a Y output. In many cases you will not wish to use this output. The OE control input. if high, disables the Y output - in which case ALU output does not appear at the Y pins. The primary purpose of destination code 0, illustrated in Figure 8-4, is to load the Q register. Destination code 1 generates a Y output only. In this case the OE control input will be low. Destination code 2. illustrated in Figure 8-6. is a little unusual. This code outputs data directly from local RAM to the Y pins: simultaneously the ALU output is loaded into local RAM. If the Program Counter is one of the sixteen general pur- pose registers, this code is used to load the Memory Address register and simultaneously update the Program Counter to point to the address of the next instruction. Destination code 3. illustrated in Figure 8-7. loads ALU outputs into local RAM and transmits ALU outputs to the Y pins. Destination codes 4. 6. 6, and 7, illustrated in Figures 8-8 through 8-11, are quite similar. These four codes output the ALU product at the Y pins and load this product into local RAM. Codes 4 and 6 also transfer Q register output back as Q register input. Codes 4 and 6 generate downshifts at the local RAM and Q register inputs. while codes 6 and 7 generate upshifts at the local RAM and Q register inputs. 8-15 3-IN ~ 3-IN .- "% MUX MUX t I Q Local RAM Register t t A Latch B Latch Data - r + If I f ,<~ , R MUX S MUX t k ~ ALU I:; Y MUX , : ~ ""' "","yo """,' ;~f¥" " "'",' ", ," ~ Figure 8-4. 2901 Destination Code 0 Data Paths 8-16 , •• t 3-IN 3-IN MUX MUX t t Q Local RAM Register t t A Latch B Latch Data _t r ~ ,r , R MUX SMUX t t ALU .. ; "I'" b Y ~ I~'b'h Ix ~:, •.".<. &~:.",., ~, Figure 8-5. 2901 Destination Code 1 Data Paths 8-17 ","',"",·',w. ",,",'. ,', "'.'.'.'''''~ I, t ,~ ; iN , 3-IN. Mix /A&~ MUX ': I , Q Local RAM Register i, t t A Latch B Latch ~I r r , ;; Data ; " t r I if R MUX S MUX ~ I' t t ALU Y MUX II ,r Figu~e 8-6, 2901 Destination Code 2 Data Paths 8-18 ,. 1 ~ ~ 3-IN 1\ X MUX i Q Local RAM Register t t A Latch B Latch Data + ~ ~ ,. ~ R MUX SMUX t t ALU ... YMUX 'We"~"~ ".,:': Figure 8-7. 2901 Destination Code 3 Data Paths 8-19 , ~ ,'" , , ,,",',' t: , ~Z.'~UX '; $fifft down i:..'';;.; \; " [:; ~; Q t>' Local RAM Register ;; :;:, ~}; '" '" t t ," ::: w A Latch B Latch Data , r + 'r ~ , ii A MUX SMUX , '" t t '" " ";cc "".:;' ALU ': '.' >"''" , ,',,,,,,.,,""",',,',' ",' . .,•••.J"... ." Figure 8-8. 2901 Destination Code 4 Data Paths 8-20 ,.w '" '" "+'"~'''''''%'''''c''' ",,, ,", "'" '" "", " n _f 3%"'~:MUX 3-IN §jffrft down MUX I t Q Local RAM Register t t A Latch B Latch Data , R MUX r t II r S MUX t t ALU ~ Y nu)( ~ :,': ~ :::'c,"""" M,":::" :"',','0« i,'L'" ":',. ,",',<:' ,'''''' .. "',,,.... ,", @<'i .',,:,"'" ...: :~'::.:"" Figure 8~9. 2901 Destination Code 5 Data Paths 8-21 Q Local RAM Register A Latch B Latch Data--+---.... R MUX S MUX ALU Figure 8-10. 2901 Destination Code 6 Data Paths 8-22 i'" '" " " " "n'"", ,,,, , , ' , ' , , ' ,'" , H " ,'h " " " " " " " , " / ) : ' .":\ ,'""",',, ,",' ,,',';, "';;, ,,:,;, ",,' x ',M'",' ,,", "",;,,;,:,;;;'1",:::;:;:;::,;, ii" : E' ~ ; , , 3-INauX 3-IN shifiiJl, MUX I l Q Local RAM Register ; ; A Latch B Latch Data--+-----, t A MUX S MUX t t ALU y ~,':J~:;, " ',""',",' ',w',,;, " " " , ",w"", ,," "',,'oW'",'" ,"'E"" '" ""'w"'>' "" ',W ,'"" H' " " " " " , " ' " "v';;;;',c; \"'",;,,'; ;W',""'W;i" ' 1!'" ,,' , , W ;""':" Figure 8-11. 2901 Destination Code 7 Data Paths 8-23 Let us now examine status logic of the 2901. You can generate Zero, Sign, Overflow and 2901 Carry statuses. The Zero, Sign and Overflow statuses are easy to understand, so we will STATUS look at them first. LOGIC Every 2901 generates an Overflow status at the OVR pin. This status is the exclusive-OR of ca- 2901 rries out of the penu Itimate bit and the high-order bit. This may be illustrated as follows: OVERFLOW STATUS 3 2 0 ",,--Bit No. C3 C2 C2 = Carry from bit 2 to bit 3 C3 = Carry out of bit 3 OVR = C2 e C3 Every 2901 generates an Overflow status; however, in a multi-2901 configuration only the high-order (or most signifi- cant) 2901 Overflow status is usually used. Lower-order 2901 Overflow status outputs can be ignored. For an 8-bit con- figuration this may be illustrated as follows: High-order : Low-order 2901 I 2901 I 7 6 5 4 I 3 2 0 ~Bit No. 00 $5 High-order OVR becomes CPU status 11 Ignore low-order OVR The Sign status wh ich is output at pin F3 is the level of the high-order ALU output bit. like the 2901 Overflow status, the Sign status is output by every 2901 in a multislice configuration; however, SIGN only the high-order 2901 Sign status is significant. For an 8-bit configuration this may be illus- STATUS trated as follows: High-order Low-order 2901 2901 I 6 5 4 I3 2 o ~BitNo. I I I I F3 = level F3 = level of bit 7. of bit 3. Use as CPU sign status The Zero status is the NOR of the four ALU output lines, FO, F1, F2, and F3. If all fou r of these 2901 outputs are 0, then the Zero status output is 1. The Zero status is an open collector Signal; ZERO therefore in multislice configurations Zero status outputs can be wire-ANDed. The AND of all Zero STATUS status outputs in a multi-2901 configuration generates the Zero status for the CPU (Zero = FO • F1 • F2 • etc.). 2901 Carry status logic is not straightforward because in a multi-2901 configuration an arithmetic 2901 operation (such as addition) should occur in parallel at each slice; but the carry from a low-order CARRY slice will not be generated in time to be accounted for by a parallel operation occurring at a high- STATUS er-order slice. This problem has been described in detail in Chapter 4 of Volume 1, therefore we will not dwell on it at this time. For now it suffices to note that you can use the CN and-C(N+4) pins of a 2901 to generate carry if you allow ample time between clock cycles for the carry to ripple up through the slices. But if you 8-24 want to perform the entire arithmetic operation optimally. you must use the propagate (Pi and generate (G) signals. in addition to CN and C(N+4). These signals are processed by the 2902 Carry Look-Ahead device. which is described later in this chapter. Table 8-10. given in the 2902 Carry Look-Ahead device discussion. summarizes the exact logic used by the 2901 to generate P. G. CN and C(N+4). The 2901 can generate a Half-Carry status. The Half-Carry status is needed by microprocessors 2901 that use binary arithmetic with decimal adjust to generate binary coded decimal logic. In an 8-bit HALF- configuration the C(N+4) output from the low-order 2901 becomes the Half-Carry status. CARRY STATUS SOME 2901 OPERATIONS In order to illustrate 2901 logic inaction, we will now show how various operations can be 2901 performed for a Central Processing Unit created using two 2901 slices. We will show the SAMPLE microcode for each operation, based on the following 34-bit microinstruction code: MICROCODE l1XX10000000XOXXXX X X X X X X X XBBBBAAAA 21201F1E1D1C1B1A191B1716151413121110 OF OEOD OC OB OA 09 OB0706050403020100 ~Microinstructionbit CYCXSI SOOEIB 17 16 15 1413121110 T1 TOM1 Me DH3DH2DHI DHODL3DL2DL1 DLOB3B2Bl BOA3A2Al AO -~TTTTT 1---' I ·Local RAM A address Local RAM B address Low-order 2901 immediate data in High-order 2901 immediate data in Source select o 0 - Immediate data from miCrocode o 1 - Data from buffer 1 1 0 - Data from buffer 2 1 1 - Data from buffer 3 Destination select (Four arbitrary destinatIons) Instruction code Output enable Shift/rotate logic control Carry in control 00 - 0 in 01 - 1 In 1 0 - source 1 in 1 1 - source 2 in The fields of the illustrated microinstruction are all self-evident. and have been described in the preceding text. with the exception of CY. CX. 51 and SO. These four bits are used by shift and rotate logic. which we are about to describe. Note that all fields. with the exception of the immediate data fields. are shared by the two 2901 devices. This is because 2901 devices operate in parallel and must perform identical operations at any instant The immediate 4-bit data fields differ since an 8-bit data field is unlike 4-bit halves. Consider shift and rotate logic (in macroprogram terms) for one or more 2901 slices. Figure 2901 SHIFT 22-12 shows one possibility using 25LS253 Dual 4 Input Multiplexers to select the correct con- AND ROTATE nections for RAMO. RAMN. 00. and ON. We refer to the high-order pins as "ON" and "RAMN" OPERATIONS since one or more slices may be present. For a single slice. RAMN and ON would become RAM3 and 03. respectively. For two 2901 slices. RAMN and ON would become RAM7 and 07. respectively The key to Figure 8-16 lies in the 17 signals which are input to the 1G and 2G pins of the 25L5253 device. Recall that 17 is one of three control signals input to the 2901 destination control logic. 17 controls shift logic at the local RAM and o register 3-IN MUX inputs. 17 is always high when a downshift occurs. 17 is always low when an upshift occurs. Thus in Figure 8-12. 17 conditions one 25LS253 device to output data. while disabling the other device. 8-25 1 yy IT sr1 rT 1 i7 T1 1 1 lG A B 2G lG A B 2G GND- lCO +5V- lCl lC2 lY 00 Low- 03 -- - 04 0(N-4) -- - -.. 0(N-3) High- ON lY lCO ~GND lCl 1--+5V lC2 CD ~ GND- lC3 GND- 2CO 25LS253 order 2901 order 2901 25LS253 lC3 ~ - 2CO ~GND +5V-=- 2Cl 2Cl ~+5V - .- RAM4 CJ) --. 2C2 2C3 2Y RAMO RAM3 RAM (N-4) - - RAM (N-3) RAMN 2Y 2C2 2C3 r4- FN I Figure 8-12. 2901 Shift and Rotate Logic Shifts do not always occur at the 2901 local RAM or Q register inputs (see Figures 8-4 through 8-11). But that is not a problem. If the low-order to high-order 25LS253 device is enabled by 17. but no shift is to occur. then the 2901 will ig- nore the active 25LS253 output. When a shift is specified by 16. 17. and 18. then the SO and S1 inputs control the output of the selected 25LS253 device - which determines the kind of shift or rotate that will occur. In this discussion of shifts and rotates, the sense of a "Ieft" or "right" shift can cause confusion since all vendor 2900 literature illustrates bit positions from right to left: Low-order High-order bit bit We have elected to make our illustrations compatible with vendor literature so that you will have less trouble connect- ing descriptions of the same parts. But in macro assembly language terms a left shift normally implies multiplication: 7 6 54 32 0 High-order Low-order bit bit while a right shift implies division: 765432 0 After right shift High-order Low-order bit bit 8-27 Given the bit numbering system used by 2900 vendor literature. the opposite shift logic would apply. That is to say. a left shift would become a divide: 0234567 Low-order High-order bit bit while a right shift becomes a multiply: o 234567 Before right shift After right shift Low-order High-order bit bit In order to avoid confusion, we shall refer to "upshifts" and "downshifts". An "upshift" causes multiplication. while a "downshift" causes division. An upshift becomes a left shift in macrolanguage terms. but looks like a right shift in 2900 vendor literature. and in the illustrations of this chapter. A downshift becomes a right shift in macrolanguage terms. but looks like a left shift in 2900 vendor literature. and in the illustrations of this chapter. We have elected to live with this confusion since it is smaller than the confusion which would arise if all our 2900 series part descriptions in- verted bit numbers and data flows with respect to vendor literature. Beginning with the simplest case. consider a simple downshift where zero is loaded into the high-order bit and the low- order bit is lost. In effect the number has been divided by two. Figure 8-13 illustrates a downshift occurring in local RAM only. 17 is-low. therefore the right-most 25LS253 device (as illustrated in Figure 8-13) is enabled. while the left-most 25LS253 device is disabled. SO and S 1 are both low. therefore 1CO is output at 1Y and 2CO is output at 2Y. Thus 0 is loaded into RAMN - and it is assumed that the three bits 16. 17. and 18 cause the downshift to occur at the local RAM 3-IN MUX logic. Note that a 0 downshift will occur in Figure 8-13 at the same time as the local RAM downshift - if 16.17. and 18 codes have enabled the Q register 3-IN MUX downshift logic. For clarity we have not shown both downshifts occurring. Were 17 high. then in Figure 8-13 an upshift would occur with 0 loaded into RAMO. and thence DO. When executing a down- or upshift, as illustrated in Figure 8-13. you could shift in 1. rather than O. by inputting SO high and S1 low. This causes 1C1 to be output at 1Y and 2C1 to be output at 2Y. Next consider a down rotate; this operation is illustrated in Figure 8-14. The only difference between the down rotate illustrated in Figure 8-14 and the downshift illustrated in Figure 8-13 is the source for the Y2 output. A high input at S 1 with a low input at SO causes 1C2 to be output at 1Y and 2C2 to be output at 2Y. 1C2 and 2C2 receive their inputs from 00 and RAMO of the low-order 2901. respectively: hence a down rotate is achieved. 8-28 17 50 51 ±±b Q314 ... Q4 Q(N-4) 14 --I Q(N-3~i9h_ QN order 2901 m lG A 1Y 25L5253 B 2G .. ~.gO.i. ~_G_+~_~_., 1C3 ~----. 2C01 ,. ;;:tC'1; GND +5V I. h-l1q~;~~~~~m~ili.~~:;::_~I;B~.~C::;~~:I'ii;:· :::;:_I'l)tj~f;0~~;~~n~.jj~: ::.:t: 2y ;'r;:;"!' "~g~ 14- co FN t..J co 1 ~ M o M q- ~ ~ 6 2Y 17 5051 ~-~ ~-~ ~r-o :E 000 t;t~4 "(N~::~J " " .... ,' 'lJ~~!'!·"'''''ffl'uN tN_31~i.1 'M'! " .' • ,' " .. " 12V:f';;f;<;'lt~' 4 ;il~.' co FN W o ;.1(,.",; " l 2V 17 SO 51 ~ M o o o M.q- ~ ~ ~ 0 ~ ~-~ ~-~ :El«-~ LJ I ecce c ! 1__ .q- ic MN .... iii~ ecce Figure 8-14. A 2901 Down Rotate You can generate an up rotate by inputting 17 high -which disables the right-most 25LS253 (as illustrated in Figure 8-14) and enables the left-most 25LS253. We need to stress again the fact that 17 has been chosen to enable the left-most 25LS253 when high. and the right- most 25LS253 when low. because this conforms to the way in which shift logic within the 2901 is controlled. Let us now examine arithmetic shifts. The difference between an arithmetic shift and a logical shift lies in the high- order bit of a binary number. which arithmetic shift logic treats as a sign bit the sign bit must be excluded from the shift. For arithmetic shifts the logic illustrated in Figure 8-12 concatenates local RAM with the Q registers to generate a double length number. For two 2901 slices this may be illustrated as follows: High-order Low-order 2901 2901 7 6 5 4 3 2 0 ....--Overall bit number I Local RAM 3 2 0 3 2 0 . . . . . - Local bit number 3 2 0 3 2 0 . - - Local bit number II Ia register 15 14 13 12 11 10 9 8 '--"Overall bit number + Sign bit When an arithmetic downshift occurs. the high-order ALU output bit - which is the signed bit - is recycled back to RAMN. thus ensuring that it is preserved through the downshift. The remainder of the arithmetic number is shifted down one bit position. with the low-order local RAM bit (output via RAMO) becoming the high-order Q register bit (via ON). This may be illustrated as follows: 1 7 6 5 4 I 3 2 0 I I f-. 00 - - . Lost a Re~ister f ON 4 1Y 1C3 2t3~ RAMN I Local RAM ~ RAMO t 15 14 13 12 I 11 10 9 8 1 High-order I Low-order 2901 I 2901 As illustrated in Figure 8-12. an arithmetic downshift is generated by 17=0. SO=1 and S1 =1. 8-31 An arithmetic upshift causes 0 to be shifted into 00 while ON, the high-order a register bit. is shifted into RAMO. This may be illustrated as follows: I I 7 6 5 4:3 2 0 I I I ~OO"'O ~ a register I I ON 2(:3 ~ 2Y lost .... RAMN.-t I local RAM ~RAMO ~ ~1-5~1-4~1-3--1~2~1-1-1~1-0~9~'-' 8 I High-order I low-order 2901 2901 Note that this arithmetic upshift does not preserve the high-order sign bit. Therefore the arithmetic upshift is really a double length logical upshift. You can easily generate double length down and up logical rotates by concatenating the a registers with the local RAM. Connect the 1C3 input of the left side 25LS253 device to the RAMN output. Connect the 2C3 input of the left side 25LS253 device to the ON output. Connect the 1C3 input of the right side 25LS253 device to the RAMO output. Connect the 2C3 input of the right side 25LS253 device to the 00 output. All of the shift and rotate logic functions we have just described, as well as the Status register and carry-in multiplexer, are contained in the 2904 Status and Shift Control Unit. This device eliminates most of the MSI. such as the two 25LS253s around the 2901 s. 8-32 Let us now look at the simple problem of loading data into a local RAM location. If the data is 2901 immediate - that is to say, if it is provided by the microinstruction itself - then the following DATA INPUT single microinstruction will load eight bits of data into the local RAM location addressed by the B address: r - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - O u t p u t result to RAM ffg .,.____ ..1__-_,:LI - - - - - - - - - - - - - - - - - - - - - - - - - - - - O R Data with 0 r - - - - - - - - - - - - - - - - - - - - - - - - - - I n p u t Data and 0 to ALU Select immediate data ill ~~,'='~ ;.0 w",'" "" ""- XXXXX011011111XXOO D D D D D D D DBBBBXXXX 21201F1E1D1C1B1A191B1716151413121110 OF OE OD OC OB OA 09 080706050403020100~Microinstructionbit CYCXS1 SOOE IB 17 16 15 1413 12 11 10 T1 TOM1 MO DH3DH2DH1 DHODL3DL2DL1 DLOB3B2B1 BOA3A2A1 AO • "--~. TT-CT'------LocaIRAMAaddress - Local RAM B address Low-order 2901 immediate data in High-order 2901 immediate data in L-_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Source select o 0 - Immediate data from microcode o 1 - Data from buffer 1 1 0 - Data from buffer 2 1 1 - Data from buffer 3 L . . . - - - - - - - - - - - - - - - - - - - , - - - - - - D e s t i n a t i o n select (Four arbitrary destinations) L - - - - - - - - - - - - - - - - - - - - - - - - - - - - I n s t r u c t i o n code L . . . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - O u t p u t enable L . . . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - S h i f t / r o t a t e logic control ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - C a r r y in control 00 - 0 in 01 - 1 in 1 0 - source 1 in 1 1 - source 2 in If the data which is to be loaded into local RAM comes from an external buffer. and we arbitrarily assume that it comes from external data buffer number 2. then the following single microinstruction will transfer the data from external buffer 2 to the local RAM location selected by the B address: r - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - O u t p u t result to RAM , - - - - - - - - - - - - - - - - - - - - - - - - - - - - O R Data with 0 ±fE r - - - - - - - - - - - - - - - - - - - - - - - - - I n p u t Data and 0 to ALU n~ I Select buffer 2 as data source ,=tr--I------~~~tl~:;;ion into which data is loaded XXXXXO 11 0 1 1 1 1 1 XX 1 0 X X X X X X X X BBBBXXXX 21201F 1E 1D 1C 1B 1A 19 1817 16 15 14 13 1211 10 OF OE OD OC OB OA 09 08 07060504030201 00 -4--Microinstruction bit CYCXS1 SOOE 18 17 16 15 1413 12 11 10 T1 TOM1 MO DH3DH2DH1 DHODL3DL2DL1 DLOB3B2B1 BOA3A2A1 AO ~.-- TTTT'-----LocalRAMAaddress - Local RAM B address Low-order 2901 immediate data in High-order 2901 immediate data in L . . . - - - - - - - - - - - - - - - - - - - - - S o u r c e select o 0 - Immediate data from microcode o 1 - Data from buffer 1 1 0 - Data from buffer 2 1 1 - Data from buffer 3 L - - - - - - - - - - - - - - - - - - - - - - - D e s t i n a t i o n select (Four arbitrary destinations) ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - I n s t r u c t i o n code ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - O u t p u t enable L - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -_ _ _ Shift/rotete logic control ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - -_ _ _ _ _ _ _ _ Carry in control 00 - 0 in 01 - 1 in 1 0 - source 1 in 1 1 - source 2 in 8-33 We described logic associated with microinstruction bits M1 and MO earlier. An arithmetic or logic operation performed on two sources taken from local RAM, with the result being output via Y to external destination number 1, requires the following single microinstruction: OutputresultviaY ,. .----- Select ALU operation ±fffi Select A and B latches as ALU operands Y output destination select Local RAM B address il,....--..-l....-..=t =L -, ," j Local RAM A address X X X X 0 0 0 1 1 1 1 0 0 1 0 1 XX X X X X X X X XBBBBAAAA 2120 1F 1E 10 1C 1B 1A 191817161514131211 10 OF OE 00 OC OB OA 09 OB 070605040302 01 OO~Microinstruction bit ""'" - - -'-1TTl~T CYCX 51 SO OE 18 17 16 15 14 13 12 11 10 T1 TO M1 MO DH3DH2 DHt DHO DL3 Dl2 DL1 DLO B3 B2 B1 BO A3 A2 A1 AO I -Local RAM A address -Local RAM B address -Low-order 2901 immediate data in High-order 2901 immediate data in -Source select o 0 - Immediate data from microcode o 1 - Data from buffer 1 1 0 - Data from buffer 2 1 1 - Data from buffer 3 Destination select (Four arbitrary destinations) Instruction code Output enable Shift/rotate logic control Canry in control 00 - 0 in 01 - 1 in 1 0 - source 1 in 1 1 - source 2 in Now consider the same operation performed on one operand taken from local RAM (as addressed by A), while the other operand is provided by the microinstruction as immediate data: the result is returned to the local RAM location ad- dressed by B. Here is the necessary microinstruction: Disable Y output Output ALU result to 8 Specify AL U operation Select immediate data and A latch as ALU operands Destination select Immediate data. second operand Result address in local RAM Operand address in local RAM I Don't care it - - - _1_ t t t , XX X X 1 0 1 1 I I 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 8 B B 8 A A A A " 21201F1E1D1C181A191B1716151413121110 OF OE 00 OC 08 OA 09 080706050403020100...-Microinstructionbit CYCX 51 SO OE 18 17 16 15 14 13 12 11 10 T1 TO M1 MO DH3DH2 DH1 DHO DL3 DL2 DL 1 OLO 83 B2 B1 80 A3 A2 A1 AO '----~----TLL- tL----- - Local RAM A address Local RAM 8 addr~ss Low-order 2901 immediate data in High-order 2901 immediate data in ' - - - - - - - - - - - - - - - - - - - - - - Source select o 0 - Immediate data from microcode o 1 - Data from buffer 1 1 0 - Data from buffer 2 1 1 - Data from buffer 3 L..-._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Destination select (Four arbitrary destinations) L..-._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Insiruction code L..-._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Output enable L..-._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Shift/rotate logic control ~----------------------------------- Carry in control 00 - 0 in 01 - 1 in 1 0 - source 1 in 1 1 - source 2 in 8-34 Two microinstructions, with appropriate looping and select logic, is all you need in order to multiply two 8-bit numbers and generate a 16-bit product. The algorithm needed for this multiplication initially stores the multiplier in the low-order eight bits of the product space with the multiplicand in a separate 8-bit storage location as follows: 7 0 • Product (initial) 15 8 7 o ~Product (final) Q B I.--Product space 7 o ~Multiplier (initial) 7 0 A J...-MultiPlicand We are going to downshift the contents of the 16-bit product space eight times. After eight shifts. the multiplier will have been shifted out and lost. Therefore the high-order eight bits of the product space will initially be assigned to the low-order eight bits of the product. as shown above. In the typical "shift" and "add" multiplication routine (which we have described in Volume 1) the multiplicand is upshifted one bit position at a time. and is added to the product whenever there is a 1 in the multiplier bit correspond- ing to the current upshift. Here is a simple illustration of two 4-bit numbers being multiplied to create an 8-bit product: 1010·0101 = 00110010 Step 1: 00000000 101':e' 0101 Step 2: 00000000 1 0"110 01010 00001010 Step 3: 00001010 n'·10 010100 Step 4: 00001010 01::01 0 0101000 00110010 The multiplicand initially corresponds to the low-order multiplier bit. The multiplicand is subsequently upshifted three times. corresponding to the three higher-order multiplier bits. Following the first and third upshift. the multiplicand is added to the product. since bits 1 and 3 of the multiplier are 1. Now instead of upshifting the multiplicand. as illustrated above. we could downshift the product's space. This may be illustrated as follows: Step 1: 00000000 101ib 0101 Step 2: 00000000 0101 00001010 Step 3: 00001010 0101 Step 4: o 0 0 0 10 10 '1>0 1 0 0101 00110010 8-35 This is the algorithm we are about to use. This algorithm allows the multiplier to be stored in half of the product space, since this space is slowly shifted out. Returning to our 8-bit X 8-bit multiplication, after the first shift the 16-bit product space will be shared by the low-order nine bits of the product and the high-order seven bits of the multiplier: 765432 0765432 0 C••, ~sNft 8 765 432 0765432 , Product Multiplier and ultimately the sixteen bits of the product space will be occupied by the 16-bit product - after the entire multiplier has been shifted out. Each time the contents of the product space are shifted down one bit position, the next low-order bit of the multiplier will be shifted out and will appear at output pin RAMO. This output is tested. If it is 1, then the multiplicand is added to the high-order eight bits of the product space {the 0 register) before the next shift occurs. The carry from the addition must become the next high-order product bit prior to the next addition. Therefore the carry is shifted into the high-order 0 register bit via 07. In this fashion, the multiplicand is added to the product in each bit position that corresponds to a 1 in the multiplier. The logic for this operation may be illustrated as follows: Since we have discussed multiplication algorithms in some detail in Volume 1, we will not spend more time in this chapter describing the theory of this multiplication algorithm. Rather. consider the following example: 2C' A4 =1C30 S~rt 0000000000101100 10100100 Step 1: 000000000010110'0-0000000000010110 Step 2: 0000000000010110---0000000000001011 Step 3: 0000000000001011-0000000000000101 10100100 1010010000000101 C=O Step 4: 101001000000010';1:-0101001000000010 10100100 1111011000000010 C=O Step 5: 1 1 1 1 0 1 1 0 0 0 0 0 0 0 1; 0 - 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 1 Step 6: o 1 1 1 1 0 1 1 0 0 0 0 0 0 01-0 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 10100100 C=O 1110000110000000 Step 7: 1 1 1 0 0 0 0 1 1 0 0 0 0 0 00:- 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 Step 8: o 1 1 1 0 0 0 0 1 1 0 0 0 0 0 -0- 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 End 0001110000110000 The algorithm above starts by downshifting 0 and B registers' contents as a single 16-bit entity. Carry, which must in- ° itially be 0, is Shifted into the high-order 0 register bit via 07, while the low-order bit of B appears at RAMO. If RAMO is 0, then must be added to O. If RAMO is 1, then the multiplier in the local RAM location with address A must be added to O. A second microinstruction accomplishes this addition. If this addition generates a carry, then the carry bit must be loaded into the next high-order product bit. By connecting the carry to 07 we make sure that any carry is loaded into the next high-order product bit on the next downshift of 0 and B registers' contents. Necessary logic is illustrated in Figure 22-15. 8-36 D 01- CP- CK 7y S,l 1s, r CY· CX T I I I T I I I GND- lCO +5V- lCl lG A B 2G lY 00 03 - ... 04 C8 07 lG A lY B 2G lCO 1Cl -=-+5V 9 -- . lC2 Low- High- lC2 GND- lC3 order 25LS253 lC3 GND- 2CO +5V- 2Cl 25LS253 2901 order 2901 2CO - 2Cl -+5V .. -- -- (X) 2C2 2C2 W --.J 2C3 2Y RAMO RAM3 RAM4 RAM7 2Y 2C3 FN I --- D O~ CP- CK ~ 4- Figure 8-15. 2901 Connections for Binary Multiplication In Figure 8-15. CX and CY high is the characteristic combination identifying binary n:tultiplication. As compared to Figure 8-12. we have modified the 1CO and 2CO inputs to the right-most 25LS253 device so that when CY and CX are both high. a downshift loads the Carry out into the high-order bit of 07. while 00 is loaded into RAM7 - and thence into the high-order bit of the local RAM location with address B. Thus a downshift treats the 0 and local RAM locations as a single 16-bit register. which. following a downshift causes a prior carry to be input at Q7 while the low-order multiplier bit is output at RAMO. Before describing the logic surrounding 11 in Figure 8-15. let us look at the two microinstructions which must be ex- ecuted sequentially within a loop in order to perform the required multiplication. First we execute a downshift microinstruction. then we execute an add microinstruction. as follows: 1Ir----+--1r---r-....--=--L==- --- -~-L-~I=-r=-===-1==- =. .=-=t- -=-_=+-_=-==-~?~~~ 11001100000011XXXX x x X x x x X XBBBBXXXX ------1TT -t-T 21201F1E1D1C1B1A191B1716151413121110 OF OE 00 OC OB OA 09 080706050403020100~Microinstructionbit CYCX 51 SO ~ 18 17 16 15 14 13 12 11 10 T1 TO Ml MO DH3DH2 DHI DHO Dl3 Dl2 Dl1 DlO B3 82 Bl BO A3 A2 Al AO . local RAM A address local RAM B address . low-order 2901 immediate data in ,High-order 2901 immediate data in ,Source select o 0 - Immediate data from microcode o 1 - Data from buffer 1 1 0 - Data from buffer 2 1 1 - Data from buffer 3 Destination select (Four arbitrary destinations) Instruction code Output enable Shift/rotate logic control Carry in control 00 - 0 in 01 - 1 in 1 0 - source 1 in 1 1 - source 2 in Multiplication specified Disable Y output Store sum in Q Add two operands o and Q or A and Q fonm AlU operands Initial multiplier/final product low-order eight bits address in local RAM Local RAM multiplicand address Don't care 1 • • l1XX10000000XOXXXX X t1 - I X X X -X X X 1 X8888AAAA , 2120 IF IE 10 lC 18 lA 191817 16 15 141312 11 10 OF OE 00 OC OB OA 09 08 07060504030201 00 4--Microinstruction bit CYCX 51 SOor 18 17 16 15 14 13 12 11 10 T1 TO Ml MO DH3DH2 DHI DHO Dl3 Dl2 Dl1 DlO 83 82 Bl 80 A3 A2 Al AO ----'-~TTTTT ·Local RAM A address ·Local RAM 8 address ,Low-order 2901 immediate data in ,High-order 2901 immediate data in ,Source select o 0 - Immediate data from microcode o 1 - Data from buffer 1 1 0 - Data from buffer 2 1 1 - Data from buffer 3 Destination select (Four arbitrary destinations) Instruction code Output enable Shift/rotate logic control Carry in control 00 - 0 in 01 - 1 in 1 0 - source 1 in 1 1 - source 2 in 8-38 The downshift microinstruction is self-evident. Note. howev~r. that RAMO must become the 11 instruction bit for the addition so that 0 will be added to Q when RAMO outputs O. while the contents of the local RAM location addressed by A are added to Q when RAMO outputs 1. But when CY and CX are not both high. binary multiplication is not in progress: therefore 11 comes directly from the microinstruction. The three NAND gates shown in Figure 8-15 provide the necessary logic. The multiplication example we have just described is a useful illustration of 2901 logic. but the2903. which we de- scribe next. performs binary multiplication and division automatically. 8-39 THE 2903 MICROPROCESSOR SLICE The 2903 is a 4-bit microprocessor slice. The 2903 is conceptually similar to the 2901, which we have already described. The 2903 has more versatile signals than the 2901, and more on-chip functions; however, the 2903 and the 2901 are driven by clocks with approximately equal frequency. But remember, the 2901A and 2901B are faster than the 2901; therefore, they are faster than a 2903 - excluding special 2903 functions. The 2903A is currently in development and, when available, will offer faster operation than the' 2903. The 2903 is not a superset of the 2901. Microprograms written for the 2903 and the 2901 will be completely different so will external logic supporting the two devices. Nor is the 2903 always the part of choice. as compared to a 2901. If your application uses a lot of complex arithmetic and logic operations. or if your application requires a large number of local registers. then the 2903 is the part of choice. But if your application stresses execution speed. then the 2901 A or 2901 B may be a better choice. 2901 and 2903 ALU logic also differ sharply. The 2903 performs operations which encompass the simple 2901 ALU functions; the 2903 also performs a separate set of more complex operations. Furthermore. 2903 ALU logic discrimi- nates between a high-order slice. a low-order slice. and an intermediate slice; 2901 logic makes no such high/intermediate/low-order distinctions. By discriminating between high-order. low-order. and intermediate slices. the 2903 is able to perform operations oil non-symmetrical data. For example. a twos complement binary number is non-symmetrical since the high-order bit is a sign bit subject to different interpretation from other bits. which are mag- nitude bits. Also. by discriminating between high-order. low-order. and intermediate slices. the 2903 makes double use of many signals; signals perform secondary functions at slices where the primary function is meaningless. For example. Carry. Generate. and Propagate signals share pins with Overflow and Sign status. since the Carry. Generate. and Pro- pagate signals are meaningless at the most significant slice. while status signals are meaningful only at the most sig- nificant slice. In the description of the 2903 which follows, we will compare and contrast the 2903 with the 2901. We will refer to the 2901 description, together with Chapter 4 of Volume 1 for all conceptual information. The 2903 is packaged as a 48-pin DIP. It uses bipolar LSI technology. A 2903 FUNCTIONAL OVERVIEW AND COMPARATIVE ANALYSIS Figures 8-16 and 8-17 functionally illustrate 2903 logic. Figure 8-16 is a variation of Figure 8-1. given earlier in this chapter. and of Figure 4-3. from Volume 1; it illustrates the 2903 in terms of the general chip slice description given in Chapter 4 of Volume 1. Figure 8-17 is a more accurate representation of 2903 logic and data paths. SuperficiaUy the 2903 and the 2901 look very similar. Both have an arithmetic and logic unit which receives two in- puts and generates a single output. Both have a 16 x 4-bit. two output-port RAM. additional local data storage in the 4- bit Q register. and two sets of shift logic. The 2903 16 x 4-bit local RAM. like the 2901. receives two 4-bit addresses - the A and B addresses. Data can be writ- ten into the 2903 local RAM location addressed by B. but only when the separate WE control input is low. The 2901 has no signal equivalent to WE. Data addressed by A and B is output to the 2903 A and B latches; but the 2903 B latch has an output enable control. OE . which must be low for the B latch contents to be passed on. The 2901 has no signal B equivalent to OE . B Both 2901 and 2903 A and B latch outputs are transmitted to the Rand S ALU input multiplexers; but that is the only similarity between the twosets of ALU input logic. The 2901 uses three instruction code bits to generate eight possible combinations of Rand S inputs. The 2903 uses one instruction code bit. together with two new control signals to select substantially different ALU operand combinations. The 2903 then makes up for the lack of operand input options with additional ALU functions. Both 2901 and 2903 ALU outputs may go to the Q register. the Y port. or the 16 X 4-bit local RAM. Like the 2901. the 2903 Q register has shift logic at its input. The 2903 also has shift logic on the local RAM data path; but 2903 shift logic precedes the Y outputs. and has a separate output enable control Signal OEy like the 2901. Perhaps the most obvious difference between the 2901 and the 2903 lies in the data input and output ports. The 2901 has a single data input port. DO-D3. and a single data output port. YO-Y3. The 2903 has the same data input port. DAO-DA3. but the 2903 has two bidirectional data output ports. DBO-DB3 and YO-Y3. 8-40 4-bit Shifter Data in or out Figure 8-16. The 2903 Microprocessor Slice 8-41 AO A Word A1 B1 BO} BWord 16 x 4-Bit 2-Port RAM Address A2 { A3 ~~ Address WE EP 00 4:. N ~13 ~t ~t -t -, DAO DAl DA2 DA3 1m DBO DB1 DB2 DB3 fA ~ 113 I R2 I R1 I RO I I so I Sl I S2 I S3 ~Io I III o Reaister ......CP OEy 11~"" "Z "1 "U SU S1 5Z 53 G/N of.r. oh oA---oA P/OVR Arithmetic and Logic Unit Z C(N+4) 5103 4 I I I III III I I L...-SIOO .11loloom mm nLOI03 Figure 8-17. 2903 4-Bit Slice Logic 01°0 1 48 01°3 EA 2 47 B3 DAO 3 46 B2 DAl 4 45 B1 DA2 5 44 BO DA3 6 43 CP 12 7 42 10 13 8 41 11 14 9 40 WRITE/MSS eN 10 39 LSS C(N+4) 11 38 lEN P/OVR 12 37 WE 2903 GND 13 36 VCC (+5V) G/N 14 35 15 OEy 15 34 16 YO 16 33 17 Yl 17 32 18 Y2 18 31 OEB Y3 19 30 AO SIOo 20 29 Al SI03 21 28 A2 Z 22 27 A3 DBO 23 26 DB3 DBl 24 25 DB2 Pin Name Description Type DAO - DA3 Data input Input DBO - DB3 Data input/output Input/output AO - A3 Local RAM A address Input BO - B3 Local RAM B address Input EA ALU R input select Input WE Local RAM write enable Input YO - Y3 Data input/output Input/output OEB RAM B output/DBO - DB3 input enable Input OEy YO - Y3 output enable Input SIOO, SI03 RAM shifter controls Bidirectional 0100, 0103 a shifter controls Bidirectional, Tristate CN Carry logic input Input C(N+4) Carry logic output Output G/N Carry look ahead generate/Negative status Output P/OVR Carry look ahead propagate/Overflow status Output Z Zero status/control Bidirectional, Open collector 10 - 18 Instruction code Input lEN Instruction enable Input LSS Least significant slice select Input WRITE/MSS Most significant slice select/Write indicator Bidirectional VCC,GND Power, Ground Figure 8-18. 2903 Microprocessor Slice Pins and Signal Assignments 8-43 2903 MICROPROCESSOR SLICE PINS AND SIGNALS Pins and signal assignments for the 2903 are illustrated in Figure 8-18. We will summarize functions per- formed by each of these signals superficially before examining device operations in detail. 2903 signals can be divided into these three categories: 1) Data inputs and outputs 2) Instruction and control inputs that are generated by a microinstruction 3) Control and status signals connecting 2903 slices. and status signals generated by 2903 slices First consider data inputs, outputs and associated address signals. AO-A3 and BO-83 are two 4-bit addresses which select locations within the 2903 local 16 x 4-bit RAM. Data may be written into the local RAM location addressed by B - but only while both WE and the clock signal, CP, are input low. While CP is high. the contents of the local RAM location addressed by AO-A3 are written into the A latch -which is therefore changing continuously. When CP goes low. the A latch contents are stable. holding whatever data was read from local RAM at the instant that CP made its high-to-Iow transition. The A latch contents are continuously output to the ALU R input multiplexer. The B latch output is enabled by the OEB control signal. When this signal is high. the B latch still receives data from the local RAM location addressed by BO-B3. but the B latch output is floated. If OE is low and the B output from local RA~s enabled. then DBO-DB3 becomes a 4-bit output. The B output ap- B pears at DBO-OB3. as illustrated earlier. When OE is high and the B latch output is disabled. DBO-DB3 becomes a 4- B bit data input. Data input via DBO-DB3 can be selected as the ALU S operand. DAO-DA3 always functions as a 4-bit data input. The R input to the ALU may be the A latch output from local RAM, or the DAO-DA3 external 2903 ALU data input. If EA is high, then DAO-DA3 is selected. If EA is low then the local RAM A latch INPUT output is selected. OPTIONS The low-order instruction code input (10) determines the ALU S input. If 10 is high. the Q register output becomes the S input to the ALU. If 10 is low. the B output from the local RAM. or data input via DBO-OB3 becomes the ALU S input. These options are summarized in Table 8-5: logically they may be illustrated as follows: A latch outPut-----~ - - - - - - - - - - - - A L U R input EA ____T __ DAO-DA3 - 8 latch output--------__1 ALU S input OE8--.....- - I D80-D83-----------------I IO---------------------~__1 Q Register output------------------~~ ALU input options are described in more detail later when we look at 2903 logic. YO-Y3, which were data output pins of the 2901, are bidirectional 2903 pins (see Figure 8-17). OEy is a control signal which enables or disables the~LU output. If OEy is low. then ALU output. after passing through the ALU shifter. appears at the YO-Y3 pins. But if OEy is high. ALU output is disabled and YO-Y3 become input pins. Data input at YO-Y3 can be written into the local RAM location addressed by BO-B3. provided WE and CP are low. 8-44 The 2903 has a 9-bit instruction code which is input via 10-18. The interpretation of this instruction code differs sharply from the 2901. Without reference to the 2901. the 2903 instruction code interpretation may be illustrated as follows: ....- - - - - - - - - - - - - - 1 6 special functions ~~ , See Table 22-8 00000. Select special functions . TI_'__ 18 171 6 \ 5 \ 4 13\ 2 \ \ 0 ~Instruction code with bit number selectALU S input See Table 22-5 Not 0 0 0 O. Select ALU simple functions See Table 22-6 Specify ALU output destination See Table 22-7 As illustrated above, the 2903 instruction code has two different interpretations. We can compare 2901 and 2903 instruction codes. but to do so we must include the EA and OES control inputs as in- struction code contributors. The two instruction codes may now be compared as follows: 2901: 18 17 16 15 14 13 12 11 10 2903: l~~ 18 17 16 15 14 13 12 11 EA 10 OES Note that OES and EA do not usually come from the microcode. 2903 instruction code interpretations are quite complex and make use of additional control and status signals. Therefore we will complete our summary of signals before examining instruction code interpretations in detail. Let us now examine status and control signals of the 2903. We have already described WE. EA. OE ' and OEy . S The 2903 has logic to discriminate between a most significant slice, a least significant slice, 2903 SLICE or an intermediate slice. SIGNIFICANCE When LSS is input low, a 2903 acts as a least significant slice. As a least significant slice, SELECT the WRITE/MSS signal becomes a WRITE output. As such. WRITE/MSS is output low for every microcycle during which data is written into local RAM. Frequently the WE inputs for all 2903 slices will be connected to the WRITE output of the least significant 2903 slice. This may be illustrated as follows: Most Least Significant Intermediate Intermediate Signficant 2903 2903 2903 2903 +5V +5V +5V LSS ~ LSS f-o LSS r--o +5V +5V r---- W/MSS 0.- W/MSS 00- W/MSS ~ W/MSS LSS ~ WE WE WE WE ~~ ~ j ~~ -~ 8-45 At intermediate and most significant slices, LSS is input high. Now the WRITE/MSS signal becomes an MSS in- put. A low MSS input selects the most significant slice, while a high MSS input selects an intermediate slice, as illustrated above. iEN is described in vendor literature as an "instruction enable" input. This may lead you to believe that it enables or disables the 10-18 instruction code inputs. but in fact the effect of iEN is more limited. When low. lEN allows data to be written into the Q register: it also enables the WRITE output at the least significant slice. When lEN is high. data cannot be written into the Q register. and the WRITE output at the least significant slice is constantly output high. If the WE inputs for all slices are connected to the WRITE output of the least significant slice. then lEN high effectively dis- connects the instruction code input. since it prevents data from being written into the Q register or local RAM: but it does not prevent an instruction from being decoded and executed by the ALU. and it does allow data to be output via the DB and/or Y pins. 2903 ALU logic has the stand~d Ca..':!y In (CN) and Carry Out (C(N+4)) signals. The 2903 also has 2903 the Carry Look-Ahead signals G and P. But if you look at the discussion of Carry Look-Ahead logic STATUS given in Chapter 4 of Volume 1 (and later in this chapter for the 2902). you will see that G and P SIGNALS outputs are not used at the most significant slice. Conversely. the Sign and Overflow status out- puts are meaningful only at the most significant slice. Therefore 2903 pins share G with the Sign status (N) and P with the Overflow status (OVR). These pins output Sign (N) and Overflow (OVR) statuses at the most significant slice: they output Carry generate (3) and propagate (P) for intermediate and least significant slices. The 2903 also has an open-collector Zero status output (Z). This Signal is output high when all ALU outputs are low. The 2903 makes additional use of its shifter signals (SIOO, 8103, QIOO, Q103) and its status signals (CN. C(N+4), N, OVR, and Z). These Signals are occasionally used in special ways by ALU operations that do not use the signals for their primary purpose. For a summary see Table 8-8 and associated text. SIOO and SI03 are ALU shifter connections. QIOO and Q103, likewise, are Q register shifter connections. These Signals allow shifts to occur across multiple slices as described for the 2901. These Signals will always be connected as follows: Most Least Significant Significant Slice Intermediate Slices Slice 0103 QI03 0100 0100 0100 5103 5100 5103 SIOO 5100 +5V CP is the master clock signal used to control and synchronize events within the 2903. 8-46 2903 LOGIC We will now examine 2903 logic in detail. The best place to start understanding 2903 logic is at the read/write memory lIocal RAM): DO 01 D2 03 A Word Address {~~---I" A2~ 16 x 4-Bit 2-Port RAM BO } B Word B1 B2 ~ Address A3 . WE A3 A2 A1 AO BO B1 B2 B3 B A Latch B Latch OEB OAO-----+-+--+~ ~~-1-~-----DBO ... DA3i OA 1 ----40-+--0 ~-+----. OB1 OA2----+... .......- - - O B 2 ....----OB3 The 2903 local RAM consists of sixteen 4-bit locations. You will use pins AO-A3 to identify the location from which data will be output at the A latch. You use pins 80-83 to identify the 4-bit location from which data may be output to the 8 latch or into which data may be written via YO-Y3. Data may be written into the local RAM location addressed by B - but only while WE and CP are input low. This may be illustrated as follows: CP BO - B3 Y Local RAM Data Stable Data Changing Data Stable RAM Location X RAM Location Y X and Yare any two hexadecimal memory addresses , High WE inhibits write As illustrated above. the contents of the local RAM location addressed by 8 are changing while WE and CP are both low. When CP goes high. contents of the addressed RAM location are stable. holding whatever data was input when CP made its low-to-high transition. If WE is high. local RAM is not accessed and its contents remain stable. Data is output from the local RAM locations addressed by A and 8 when CP is high. The contents of the local RAM loca- tion addressed by A are output to the A latch. The contents of the local RAM location addressed by B are output to the 8 latch. These outputs occur when CP is high; therefore the A and 8 latch contents are continuously changing while CP is high. but they are stable while CP is low. holding whatever data was input when CP made its high-to-Iow transi- tion. 8-47 The A latch contents are output continuously. We can therefore illustrate A latch output timing as follows: CP I \ 1 \ 1 \ r AD - A3 X P X Q X R [ A Latch Read P Read Q Q Stable Read R R Stable Local RAM ~ C E: ~ C E: ~ C E RAM Location P RAM Location Q RAM Location R P.O. and R are any three hexadecimal addresses. S represents stable data. and C represents changing data in the selected RAM location. In the illustration above. the RAM location addressed by A is shown as stable while CP is high and changing while CP is low. The stable data is output to the A latch while CP is high. The A latch contents subsequently become stable while CP is low - at which time local RAM contents are changing until RAM access time has elapsed. Thus race conditions are avoided. The A latch outputs are continuously enabled. B latch timing is a little more complex than A latch timing because the B latch has its own output enable control signal OE ' When OE B is high. the B latch output is floated. But when OE is low. the B latch outputs are enabled. B S B latch timing may be illustrated as follows: \___1 CP I \ I \_--' _______ X 80 - B3 X~_ _ _ _ _L_ _ _ _ _~I _ _ _ _ _ _ _M _ _ _ _ _ _~I N ______ B Latch Read L L Stable M Stable Read N N Stable DEB B Latch output - - - - - - - - - - - - - - - - - - . . . . . , . , . DBO - DB3 Input Input Output [M) means "contents of RAM location M". The VO- V3 input to local RAM may come from the ALU output. or from the VO-V3 pins. Unlike the 2901. there is no shifter at the local RAM input: rather. the shifter has been moved to the ALU output. and the shifter output is itself enabled or disabled by the OEy control input. If OEy isJQw. then the shifter output is enabled: it appears as output at YO-Y3 and at RAM DO-D3. But if OEy is high. YO-Y3 become input pins providing local RAM with its data input. The 2903 local RAM. like the 2901. generates a 4-bit slice through selected programmable registers of a Central Processing Unit. But it is much easier to extend 2903 local RAM using external memory. This is because the 2903 has one data input port and two bidirectional data ports situated between local RAM and the ALU. The 29705 is used as an expansion RAM. 8-48 CPU register implementation and ALU operand inputs are logically dependent on each other. since the primary func- tion of CPU registers is to store ALU source or destination data. We will therefore explore the ALU operand options available using a 2903. and see what impact these options have on register implementation . Turning to the 2903 Arithmetic and Logic Unit. these three aspects of ALU logic are im- ....------.... 2903 ARITHMETIC portant: AND LOGIC UNIT 1) The operands which are input to the ALU 2) The ALU operation which is to be performed 3) The destination for the ALU output. (The destination specification includes any shift operations.) Instruction code bit 10. together with EA and OE ' controls the data input to the 2903 ALU; instruction code bits 11 S through 14 specify simple ALU functions. while 15 through 18 specify the destination and shift operation for simple func- tions. Instruction code bits 15 through 18 may also specify special 2903 functions. Table 8-5 shows the ALU operand source options that can be specified using 10. EA. and 2903 ALU OE B , Let us now explore these options in detail, OPERAND OPTIONS Table 8-5. 2903 ALU Rand S Operand Selections Control Signal R Operand S Operand EA 10 OEa 0 0 0 A latch output B latch output 0 0 1 A latch output DBO - DB3 input 0 1 0/1 A latch output Q register output 1 0 0 DAO - DA3 input B latch output 1 0 1 DAO - DA3 input DBO - DB3 input 1 1 0/1 DAO - DA3 input Q register output 8-49 Beginning with the logically simplest case. we will assume that EA is low. so the A latch output becomes the ALU R in- put. Any of the ALU S input options could also accompany EA high. in which case DAO-DA3 becomes the ALU R input. Consider 00-03 providing the ALU S input. while DBO-DB3 is idle: DO - D3 Local RAM A Latch B Latch 1 4 t - - - - - - - OEB = 1 _ - - - - - -... DBO - DB3 DAO - DA3 _ _ _ __ ~~~QO-Q3 EA=O---t~ .....~-IO=l ALU Data paths illustrated above would probably be used by a complex ALU operation involving one source operand. This source operand comes from local RAM via the A latch. while the complex ALU operation acts on temporary data held in the 0 register. 8-50 Now consider the same data paths illustrated above. but with OE input low. so that B latch data is output via OBO- B DB3: DO - 03 L Local RAM I I A Latch B Latch ril : _ ~9 ,,- .... OEB = 1 .. DBO - DB3 f .. 00 -03 D. " DAO - DA3 0 ~ ~ EA=O - RM SM - 10 = 1 "4 " J, ALU Data being output via DBO-DB3 will probably come from a CPU register implemented in local RAM. DBO-DB3 could be connected to external read/write memory within which additional CPU registers are implemented. The direct data path from local RAM to DBO-OB3 can be used effectively to implement any register-to-register operation within a CPU. If. for example. an Accumulator or other primary register is implemented in local RAM while secondary registers are held in external RAM. then the data path illustrated above lends itself readily to register-register data transfers. which may. or may not. occur in parallel with any other CPU operation. 8-51 Now consider the data paths we just illustrated. but with EA high. so that the ALU R operand comes from the external data inputs DAO-DA3. This may be illustrated as follows: DO - D3 Local RAM A Latch B Latch .·1 ......-----_ OEB = 0 DBO - DB3 DAO - DA3 "'"-_______..... _-------.I QO - Q3 RMUX S MUX ............... 10 = 1 ALU Data input via DAO-DA3 may be immediate data coming from a microinstruction. or non-immediate data taken from any other source. DAO-DA3 may also receive its input from an external RAM within which additional CPU registers are held. 8-52 But. moving away from complex operations that may require the ALU S operand to come from the Q register. let us ex- amine some more complex data paths used by simple CPU operations. In the simplest case. the two ALU operands will come from local RAM. This may be illustrated as follows: DO - 03 Local RAM 1'/ .•4 - - - - - - - OEB = 0 Ik'}l~--------J DBO - DB3 DAO - DA3 c......_ _ _.... _---..1 00 - 03 EA= 0 ---I~ ·~:,MUX ....~-IO=O "<>;: AlU Data paths illustrated above show two ALU operands being taken from local RAM locations - probably CPU registers. 8-53 We can take the S ALU input from DBO-DB3 by inputting OE B high. thus enabling the data from the B latch. This may be illustrated as follows: DO - D3 Local RAM A Latch B Latch ....~------OEB = 1 l'Iaiiil!!BSB DBO - DB3 DAO - DA3 '--_ _ _'" _-----J 00 - 03 EA= 0 "'1---10= 0 ALU 8-54 Data entering at DBO-DB3 could be immediate data coming from a microinstruction. or data from an external RAM location being used to implement additional CPU registers. By inputting EA high. we can take. both the Rand S ALU in- puts from external RAM: DO - 03 Local RAM A Latch B Latch ....f-------- DEB = 1 DBa - DB3 DAO - DA3 .......____......., ,_---..1 00 - 03 EA = 1 RMUX $MUX ""'-10=0 AlU In the illustration above you see one of the more significant 2903 advantages. as compared to the 2901. The 2901 allows a single operand to be taken from external RAM. and that reduces the effectiveness of external RAM as a means of implementing the two-port CPU registers in a 2901 configuration. It limits you to CPU architectures that include a group of secondary registers. only one of which can provide an ALU operand during the execution of any instruction. But the 2903. by allowing external data inputs to the Rand S ALU operands. allows you to implement CPU registers in internal local RAM. or in external RAM like the 29705. without compromising register logic associated with either im- plementation. 8-55 The 2903 has local RAM addressing. The 2901 allows you to specify just two local RAM ad- 2903 dresses within a single microcycle. The A and B addresses identify the two ALU operands while LOCAL RAM the B address also identifies the destination address for the ALU product. Thus the ALU operand ADDRESSING specified by the B address must be overwritten if the ALU product is to be returned to local RAM. 2903 TWO- But the 2903 allows either two or three local RAM addl'ilsses to be specified within a single ADDRESS microcycle; you have the option of creating one. or two B addresses within a single microcycle. If TIMING you create one B address, timing may be illustrated as follows: CP \ I \'---~/ \ WRITE =WE \~-_____-II AO - A4 I I Operand R Address 80 - 84 I I Operand S and Result Address A and B provide the two local RAM addresses. As described earlier. while CP is high the contents of these two local RAM locations are output to the A and B latches. Subsequently. when CP is low. data is written back to the local RAM location addressed by B. since WE is low. In the illustration above. we show WE being driven low at the proper time by the WRITE output. WE will usually be connected to the WRITE output from the least significant 2903 slice. We generate three local RAM addresses in a single 2903 microcycle by changing the B ad- P-----... 2903 THREE- dress after reading an operand, and before writing back the result. Timing may be illustrated ADDRESS as follows: MICROCYCLE CP AO - A4 80 - 84 I Operand S Address In the illustration above we delay lEN going low until the last quarter of the microcycle. This gives external logic suffi- cient time to change the B address. While lEN is high. WRITE is held high. Thus. delaying the lEN low pulse delays the WRITE pulse - which in turn delays the WE low input until a new address is stable at B. You can generate three-ad- dress timing. as illustrated above. by changing the lEN waveform from its normal two-address shape: ~ ~~-_\ cp _ _ _\ ___ \ lEN i 8-56 to the following continuous three-address shape: CP '''--_ _'--'1 \ I I I \ I I I \ I JI I I I J.-ts~ I I 4 T -I You cannot directly drive WE from external logic in order to create a three-address microcycle since external logic may not b~le to identify mi~ycles during which....!:!2 write operation~o occur-and WE should be held high. By using lEN. and connecting WE to WRITE. you use lEN logic to provide WE with its correct shape. while you use WRITE to discriminate between microcycles within which a write should. or should not. occur. You use instruction code bits 10 through 14 to distinguish between simple ALU functions and 2903 special 2903 functions. When the five instruction code inputs 10-14 are all low. 15 through 18 are SIMPLE interpreted by the 2903 as "special function" identifiers. If one or more of the five inputs 10-14 ALU are high. then simple ALU functions are interpreted as summarized in Table 8-6. These sim- FUNCTIONS ple fLinctions are all self-evident and need no special discussion. Table 8-6. 2903 Simple ALU Function Specifications Instruction ALU Dependent Output Signals Code ALU Operation and P/OVR GIN Output C(N+4) Z 1413121110 MSS Other MSS .Other 00000 See Table 22-8 00001 A" ALU outputs high 0 0 0 N G 0 000 1 X S - R - 1 + CN C(N+4) OVR P N G z 001 0 X R - S - 1 + CN C(N+4) OVR P N G z o0 1 1 X R + S + CN C(N+4) OVR P N G z o 1 OOX S + CN C(N+4) OVR P N G z o1o1X S + CN C(N+4) OVR P N G z o1 10 X R + CN C(N+4) OVR P N G z o1 1 1X R + CN C(N+4) OVR P N G z 1 OOOX A" ALU outputs low 0 0 0 N G 1 1 001 X RAND S 0 0 0 N G z 1 o 1 0 X R EXCLUSIVE NOR S 0 0 0 N G z 1 o 1 1 X R EXCLUSIVE OR S 0 0 0 N G z 1 1 0 0 X RAND S 0 0 0 N G z 1 101 X R NOR S 0 0 0 N G z 1 1 1 OX R NAND S 0 0 0 N G z 1 1 1 1 X R OR S 0 0 0 N G z R = R operand input S = S operand input Rand S are the complements of Rand S operand inputs. respectivelv CN = Carry in. C(N+4) = Carry out MSS = Most Significant Slice Table 8-6 also summarizes output signal levels associated with each ALU operation. Additional signal levels more closely associated with the ALU destination specification are given in Table 8-7. 8-57 Table 8-7. 2903 Destination and Shift Specifications for Simple ALU Operations Instruction Shifter/Destination Summary Signal Detail Code Bits ALU Output o Register Result Y3 Y3 Y2 Y2 YO SI03 SI03 SIOO Hex 0103 0103 0100 WRITE 18 17 16 16 Shift (= Y if Shift Load MSS11 Other MSS1 Other All MSSlI Other All Code OEy = 01 o0 0 0 0 DA21 (F/2)A None Q F3 SI03 SI03 F3 F2 F1 I I FO Hi-Z Hi-Z 0 000 1 1 DL3) (F/2IL None Q SI03 SI03 F3 F3 F2 Fl I I FO Hi-Z Hi-Z 0 001 0 2 DA2) (F/2)A DL3) (Q/2)L F3 SI03 SI03 F3 F2 F1 I I FO I QO 0 001 1 3 DL3) (F/2IL DL31 (Q/2I L SI03 SI03 F3 F3 F2 F1 I I FO I QO 0 o 1 o0 4 None F None Q F3 F3 F2 F2 Fl FO I I P Hi-Z Hi-Z 0 o 1 o 1 5 None F DL31 (Q/2)L F3 F3 F2 F2 F1 FO I I P I QO 1 o 1 1 0 6 None F None F F3 F3 F2 F2 F1 FO I I P Hi-Z Hi-Z 1 o 1 1 1 7 None F None F F3 F3 F2 F2 F1 FO I I P Hi-Z Hi-Z 0 1 000 8 UA4) (2F)A None Q F3 F2 Fl Fl FO SIOO F2 F3 I Hi-Z Hi-Z 0 100 1 9 UL5) (2F)L None Q F2 F2 Fl Fl FO SIOO F3 F3 I Hi-Z Hi-Z 0 1 o 1 0 A UA4) (2F),A UL5) (2Q)L F3 F2 Fl Fl FO SIOO F2 F3 I Q3 I 0 CIO a. 1 o 1 1 B UL5) (2F}L UL5) (2Q)L F2 F2 Fl Fl FO SIOO F3 F3 I Q3 I 0 1 1 o 0 CIO C None F None Q F3 F3 F2 F2 Fl FO F3 F3 Hi-Z Hi-Z Hi-Z 1 1 1 o 1 D None F UL5) (2Q)L F3 F3 F2 F2 F1 FO F3 F3 Hi-Z Q3 1 1 1 1 1 0 E None SIOO None Q SIOO SIOO SIOO SIOO SIOO SIOO SIOO SIOO I Hi-Z Hi-Z 0 1 1 1 1 F None F None Q F3 F3 F2 F2 F1 FO F3 F3 Hi-Z Hi-Z Hi-Z 0 1) MSS = Most Significant Slice I = Input pin 2) DA = Down Arithmetic P = Parity of SI03, F3, F2, Fl, FO 3) DL = Down Logical HI-Z = High impedance 4) UA = Up Arithmetic F3, F2, F1 and FO are the four ALU output bits. F3 is the high-order bit. FO is the low-order bit. 5) UL = Up Logical - With regard to Table 8-6. note that the Carry Out signal. C(N+4). is active for arithmetic operations only. P/OVR generates an Overflow status (OVR) at the most significant slice. and a Carry propagate signal (P) at other slices. Like the Carry Out. P/OVR is active only for arithmetic operations. Unlike P/OVA. GIN is active for all ALU operations- arithmetic and logical. The most significant slice outputs the Sign status (N) which is. in fact. the level of the high- order ALU output bit. Other slices output the Carry generate signal @. For a discussion of the Carry generate and propagate signals (3 and P) refer to the 2902 description. The Zero status is active for all slices. during all simple ALU operations. The Zero status is output high when all four ALU output signals are low. The Zero status output is low otherwise. Let us now examine 2903 destination options. 2903 Table 8-7 summarizes destination and shift specifications implied by instruction code bits DESTINATION OPTIONS 16 through 18 for the simple ALU operations summarized in Table 8-6. In Table 8-7 we show the ALU output and Q register operations. together with a detailed summary of associated signal levels. The detailed signal summary is given since slice significance and shift specifications combined make signal levels less than self-evident. If you look at the signal outputs shown in the signal detail section of Table 8-7. and compare these signal outputs with the illustrations of arithmetic and logic shifts given below. then the table will be easy to understand. Note that signals SIOO. 0100. and 0103 are frequently in a high impedance state. Selected destination specifications hold WRITE high. These specifications give you the option of not writing ALU out- put into local RAM - assuming that the WE inputs are connected to the least significant slice WRITE output. Destination code E propagates the SIOO input across all Y outputs. This code is used to extend the sign of a binary number. as we will describe later. Destination codes 4. 6. 6. and 7 report parity of the ALU output at the SIOO pin. Parity is reported for the 5-bit bin- ary number given by S103. F3. F2. F1. and FO. Odd parity generates a high output at SIOO while even parity generates a low output at SIOO. Parity logic of the 2903 is cascadable across chip slices since the SIOO parity output of each slice becomes the SI03 input for the adjacent. less significant slice. The SIOO output from the least significant slice will always report the parity for the combined ALU output. We will demonstrate this multislice parity logic for the simple case of 8-bh data generated using two 2903 slices. This may be illustrated as follows: Most Significant Least Significant Slice Slice r SI03 F3 F2 A F1 FO ~~---------'~~--------" "' S100/S103F3 F2 F1 FO SIOO '\J ~...---...c/ o 1 ~?O 0 1 1 0 0 Most Significant Least Significant Slice Slice ~~---------,~~--------,,, ~~--------,~~--------~, \ J ~...---. .v SI03 F3 F2 F1 FO S100/S103 F3 F2 F1 FO SIOO o 1 ~/1 0 1 1 0 1 8-59 The ALU shifter, but not the Q shifter, gives you the option of specifying either an 2903 arithmetic or a logical shift. The Q shifter allows you to specify logical shifts only. SHIFT Logical shifts treat all bits in the same way. Thus. an 8-bit upshift may be illustrated as follows: LOGIC 7 6 5 4 3 2 o 4---Bit No. Before upshift After upshift An 8-bit downshift may be illustrated as follows: 7 6 5 4 3 2 o 4--BitNo. Before downshift After downshift An arithmetic shift assumes that the high-order bit is a sign bit - which must be excluded from any shift. Thus an 8- bit arithmetic upshift may be illustrated as follows: 7 6 5 4 3 2 o .....-BitNo. Before upshift After upshift An 8-bit arithmetic downshift may be illustrated as follows: 7 6 5 4 3 2 o 4---Bit No. Before downshift After downshift The 2903 can perform arithmetic shifts since you must identify the most significant. least significant. and intermediate 2903 slices in a multislice configuration. Thus. when you specify an arithmetic shift. logic internal to the most signifi- cant slice isolates the high-order bit from the shift. while intermediate and least significant slices perform simple logic shifts. 8-60 The 2903 ALU shifter is located on the ALU output, in front of the Y data input/output port. In contrast. the 2901 ALU shifter is located at the local RAM input. Also, the 2903 ALU shifter out- put can be enabled or disabled via the OEy control signal. Thus you have a large number of microprogram-selectable options for handling ALU output, over and above the destination op- 2903 ALU tions summarized in Table 8-7. ALU output may be transmitted to local RAM: OUTPUT A DESTINATIONS YO - Y3 <. ;'';;,T ';;'f, "'>:..;:::." .;..... ;:.:.:::;; . <>:<.:: :.:::\L~/:}!\·!;;··h:i>' .•••• M···.d <';';'::' ... .oil ~ U D -- WE=O Local RAM A B -- CP = 0 A Latch B Latch JJ- ... ) DBO - DB3 "' ;', ". it DAO - DA3 It D, ~ .. ;, U 0 QO - Q3 OEy =0 ..- Shifter EA - --- RMUX S MUX - 10 .- • "< :r '< ~ ALU . ;:~l ... l'!;";:;, <'j':.".. .:•. \. /'; ";';':.:.>"'::0:.';. :; ;: :: :>•. . p ) To Q Register 8-61 By holding WE high you can output data at the Y pins. but not write the output to local RAM: A YO - Y3 ~"\''';;:':';;, ;,V;':; '" • ~ } D Local RAM -- WE=1 A B - CP = X A latch B latch ~I~ OEB .. . } DBO - DB3 DAO - DA3 h D, :, ~ > U II 00 - 03 OEy=O - Shifter EA R MUX SMUX - 10 .> I ~ ~ '< ;, > AlU :,' "h',)" ,,;:";,;:,'\, ";, ;kf',' ," : " ' , ,,';, i i :::'\~":;:;\;'" ~l ",:;{, A.. .. ) To Q Register In either of the above cases the data may be shifted up or down. if so specified by instruction code bits 15-18 (see Table 8-7). 8-62 You can also discard the ALU output and use the Y pins as the data input port to local RAM: YO - Y3 l:t.< .. :.> ...•. . .> •... :. ~ . '::.< .... .'.:.": . ....•.....:.. ".:'.:' .. : U '\ D -- Local RAM A B -- CP = 0 A Latch B Latch ~~-~ ..) DBO - DB3 r DAO - DA3 h D, , ~\. ~ J 11 00 - 03 -- Shifter EA - R MUX S MUX - 10 J .,.,.~ '< ALU Jl .. To a Register .A. ) If WE and OEy are both high. ALU output to YO-Y3 or local RAM is discarded You can use the last two ALU destination codes shown in Table 8-7 to extend a sign bit 2903 SIGN across one or more parallel 2903 devices within a single microcycle. Since the ALU destina- EXTEND tion code is used to generate sign extend logic, this operation can occur in conjunction with LOGIC any compatible ALU operation specified by instruction code bits 14, 13, 12, and 11. ALU destination code F transmits the ALU output to the Y pins. and pulses WRITE low Assuming that OEy and WE are both .Iow. the ALU output will appear at the Y pins. and will be written into local RAM while CP is low ALU destination code E transmits the 5100 input across all four ALU output lines Again. WRITE is pulsed low: if OEy and WE are both input low. then the 5100 level is output at all Y pins. and is wntten into local RAM while CP is low 8-63 You can use this pair of ALU destination codes to extend a sign bit by applying the level of the sign bit to the SIOO input of those 2903 slices that are to extend the sign. Consider a 16-bit Central Processing Unit where the sign for the low-order byte must be extended across the high-order byte. This may be illustrated conceptually as follows: Most Least Significant Intermediate Intermediate Si~nificant Device Device Device Device 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o ....-BitNo. I zIzIzI z z zIzIzIXIy Iy Iy Iy Iy Iy Iy I Before sign extension 15 14 13 12 11 10 9 8 6 5 432 o 4 - - B i t No. y y y I I I I I y y y y After sign extension X = sign bit y = data bit Z = irrelevant bit A Central Processing Unit implemented using 2903 slices will automatically generate a sign extended ALU result for any arithmetic operation. You use sign extend logic to create data, rather than modify results of any computation. Suppose. for example. an 8-bit data input is received from an I/O port: if a 16-bit CPU is to interpret this data byte as a signed binary number. then the high-order bit must be propagated through the high-order byte of a 16-bit word as il- lustrated above. This is easily done using the E and F ALU destination codes. This is illustrated in Figure 8-19. Let us examine Figure 8-19. The two low-order 2903 slices are generating real data. These two slices therefore receive an F ALU destination code via 18-15. This destination code causes the ALU output to appear at the Y pins. and the high- order ALU output bit to appear at 5103. The two high-order 2903 slices generate the high-order byte across which the sign must be extended. These two 2903 slices therefore receive an E destination code via 18-15. The E destination code causes the 5100 input to be propagated across the ALU outputs. 8-64 z I z I I z I z Sign Out ... - - 0103 MSS 0100 SI03 2903 SIOO C(N+4) CN -- 0103 SI03 C(N+4) 0100 SIOO CN _X - 0103 SI03 C(N+4)· 0100 SIOO CN ",,"-Y - 0103 SI03 C(N+4) 0100 ~ SIOO f4- CN f - - IS +5V IS +5V LSS - OVR W/MSS () () ~ 2903 2903 2903 - N +5V W/MSS f----1. W/MSS ~~ W/MSS ~ ~ ~ ~ LSS ~ I LSS t - - LSS ~ LSSQ !e~ WE !e~ WE !e~ WE !!!~ WE ~~j + j I ! +~ t -:- 4 III - j 16-18 = 111 -- - ~ 15(3) = 0 I- 15(2) = 0 - I- 15(1) = 1 15(0) = 1 -- t- ~ ~"V'7 .,,> ."V., 'v~ Y3 - YO Y3 - YO Y3 - YO Y3 - YO XXXX XXXX XYYY YYYY MSS means Most Significant Slice IS means Intermediate Slice LSS means Least Significant Slice Y = data bit X = sign bit Figure 8-19. 2903 Sign Extend Logic 2903 SPECIAL FUNCTIONS Let us now examine special 2903 functions. These functions are summarized in Table 8-8. Special functions are implied by instruction codes bits 15 through 18 when instruction code bits 10 through 14 are all O. Nine special functions are provided; seven special function codes are unused. You should be sure not to use any of the unspecified special function codes since the 2903 device's response to these unspecified function codes is not guaranteed. Table 8-8 summarizes signal outputs and exact ALU operations associated with each of the special functions. Wherever a signal's primary purpose is meaningful. the signal is so used by a special function. Where a signal's primary purpose is not meaningful. the special function may generate an output to meet its specific needs. Do not attempt to understand ALU operations or signal utilization merely by inspecting Table 8-8. Many of the ALU operations, although absolutely accurate representations of ALU logic, rely on specific external pin connections to generate the required net effect. Signals, likewise, are used in special ways that depend not only on the special func- tion, but also on the required pin connections which have been arbitrarily selected by the 2903 designers. ALU logic and signal utilization is described in detail function by function. We will begin by examining the simpler 2903 special functions, since many of these simple special functions act as ac- cessory commands to the more complex functions. There are two normalization functions: a single length and a double length normalization. The double length normalization function is also the first twos complement divide instruction. 8-65 Table 8-8. 2903 Special Functions Summary Associated Signals Instruction Code(l) ALU Operation ALU Function SI03 P/OVR GIN Z SIOO 0103 0100 WiiiTE C(N+4) 18 17 16 15 MSS Other MSS Other MSS Other MSS IS LSS F = S + CN if Z = L 0 0 0 0 Unsigned multiply F = R + S + CN if Z = H Hi-Z I FO I 00 0 C(N+4i OVR P N G I I 00 0 0 0 1 Unused F = S + CN if Z = l 0 0 1 0 Twos' complement multiply Hi-Z I FO I 00 0 ON+4) OVA P N G I I 00 F = R + S + CN if Z = H 0 0 1 1 Unused 0 1 0 0 Increment F = 5 + 1 + CN I I P Hi-Z Hi-Z 0 C(N+41 OVR P N G Z Z Z Sign/Magnitude twos F = S + CN if Z = l 0 1 0 1 I I P Hi-Z Hi-Z 0 C(N+4' OVR P (2) G 53 I I complement F = S + CN if Z = H Twos complement multiply. F = 5 + CN if Z = l 0 1 1 0 Hi-Z I FO I 00 0 CIN+4) OVR P N G I I 00 last cycle F = S - R - 1 + CN if Z = H 0 1 1 1 Unused CD m 0> 1 0 0 0 Single length normalize F = 5 + CN F3 F3 Hi-Z 03 I 0 (3) 02(!)01 P 03 G (4) (4) (4) 1 0 0 1 Unused 1 0 1 0 Double length normalize F = S + CN R3@F3 F3 I 03 I 0 (5) F2~Fl P N G (6) (6) (6) 1 0 1 1 Unused F = S + R + CN if Z = l 1 1 a a Twos complement divide F = S - R - 1 + CN if Z = H ~ F3 I 03 I a CIN+41 OVR P N G (7) I I 1 1 a 1 Unused Twos complement divide. F = S + R + CN if Z = l 1 1 1 a F3 F3 Hi-Z 03 I 0 CIN+41 OVA P N G (7) I I final F = S - R - 1 + CN if Z = H 1 1 1 1 Unused ao, a" a, ,,'" a' •• ,", '00' a ....~ ,."" ""} 1) 10 - 14 must all be O. Hi-Z = Signal floated Fa. Fl. F2 and F3 are the four AlU output bits. Bit 3 is the high-order bit. 2) N if Z = O. S3 (i) F3 if Z = 1. I = Input signal RO. R1. R2 and R3 are the four R operand bits. Bit 0 is the low-order bit. 3) o 3 (!) 02 at MSS. CiN+4; at other slices. P = Parity of S103. Y3. Y2. Yl. YO SO. S 1. S2 and S3 are the four S operand bits. 4) Zero status for 0 register output. MSS = Most Significant Slice 5) F3 (!) F2 at MSS. CIN+41 at other slices. IS = Intermediate Slice 6) Zero status for combined. a-bit 0 register and AlU outputs. lSS = least Significant Slice 7) Sign compare output. Other = IS or LSS The normalization operation upshifts the contents of a data word until the two high- 2903 order bits have different values. Zeros are shifted into low-order bit positions. Here are NORMALIZE some normalization illustrations for 16-bit words: SPECIAL FUNCTIONS Initial Normalized 0000001011000111 0101100011100000 1110101101000101 1010110100010100 0110101101011010 0110101101011010 0000000000000000 Cannot be normalized 1111111111111111 1000000000000000 Each normalize instruction is executed in one microcycle. During this microcycle one upshift occurs if the two high- order bits of the most significant slice S ALU operand are both O. or both 1. No operation occurs if the two high-order bits differ. In order to complete the normalization process for a multibit word that has many leading 0 or 1 bits. you must re-execute the normalize instruction the required number of times to shift out leading similar bits. If. for example. there are five leading 0 bits. followed by a 1 bit. you will have to execute a normalize instruction four times before the data is normalized. On the fifth execution of the normalize instruction the data will be left unaltered. Your logic must identify the point at which data has been normalized; the normalize instruction outputs appropriate status signals to identify normalization - as we will describe shortly, If binary data is being interpreted as a signed binary number. then a positive number. after normalization. will have a 0 in the high-order bit and a 1 in the adjacent bit: 01XXX---- After normalization a negative number will have a 1 in the high-order bit and a 0 in the adjacent bit. 10XXX---- The single length normalization instruction generates a data word out of the Q registers of 2903 parallel 2903 slices. Thus. you would generate an 8-bit data word out of two parallel slices as SINGLE follows: LENGTH 7 6 4 2 o ~BitNo. NORMALIZATION ~~ I I I I I I I MSS LSS Q Q Register Register Four 2903 slices generate a 16-bit data word as follows: 15 14 13 12 11 10 9 8 6 5 4 3 0 ~ Bit No. Ll.llllUJl!LWIJ MSS Q IS Q IS LSS Q Q Register Register Register Register MSS means Most Significant Slice. IS means Intermediate Slice. LSS means Least Significant Slice. The double length normalization instruction generates a data word out of the Q register and 2903 the local RAM location addressed by B. Two 2903 slices would generate a 16-bit word as DOUBLE follows: LENGTH NORMALIZATION 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o ~BitNo. MSS LSS MSS LSS Local Local Q Q RAM RAM Register Register 8-67 There are some differences between the single and double length normalization instructions resulting from the fact that the double length normalization instruction must use local RAM, and the ALU, while the single length normalization instruction needs Q register logic only. We will therefore look at the single length normalization instruction first. The single length normalization instruction performs a number of upshifts until the most significant 2903 Q register has different values in its two high-order bits. Each upshift requires one microcycle. therefore the total execution time for the normalization instruction is variable. But the C(N+4) and OVR outputs are used to identify the last, and sec- ond to the last microcycles of the single length normalization instruction. On the second to the last cycle the OVR signal is output high; OVR therefore outputs the Exclusive-OR of 02 and 01 at the most significant slice. C(N+4). likewise. outputs the Exclusive-OR of 03 and 02 at the most significant 2903 slice. This may be illustrated as follows: o Register of Most Significant Slice .~ 103102101 J 00 1 ~ C(N+4) = 03 <±> 02 ~ OVR = 02 EE> 01 Thus C(N+4) goes high on the last microcycle of the single length normalization instruction. while OVR goes high on the previous microcycle. You cannot normalize a data word that is initially all 0 bits. Since zeros are shifted into the low-order bit position with each upshift. the normalization operation would never end. The single length normalization instruction therefore outputs a high Signal on the 0 status line and terminates in a single microcycle. For this to be possible the single length normalization instruction uses Z status logic to indicate 0 register contents. rather than ALU output. That is to say. Z is output high when all Q register bits are 0, not when all ALU outputs are O. You will now understand the special information output via C(N+4). OVR. and Z signals. as shown in Table 22-8 for the single length normalization instruction. During each microcycle of a single length normalization instruction the Q register contents are recycled through Q shifter logic. ALU logic, which would otherwise be unused, adds the contents of CN to the S operand input. This logic allows you to count the number of microcycles - and therefore upshifts - performed by the single length normalization instruction. Assuming that WE. OEy. OEB. and 10 are all low and CN is high. then the RAM location ad- dressed by B becomes a microcycle counter. This RAM location becomes the ALU S operand. and the destination for the ALU output. The ALU output is simply theS operand input incremented by 1. assuming that CN is indeed high. Single length normalization instruction pin connections are illustrated in Figure 8-20. You can. if you wish. maintain a microcycle counter in external memory by inputting the ALU S operand from DBO-083 and outputting the ALU result at YO-Y3. This requires that WE and OEB be input high. If you execute the single length normalization instruction with 10 high. then the 0 register contents also become the ALU S input. Now on each microcycle the 0 register contents. before they are upshifted. are output by the ALU to YO- Y3. and/or local RAM. optionally incremented by 1 if CN is input high. Let us now 4;txamine the double length normalization instruction. The RAM location ad- 2903 dressed by B provides the high-order half of the word being normalized. 0103 from the most DOUBLE significant 2903 slice must therefore be connected to SIOO at the least Significant 2903 slice. LENGTH Also, you cannot use ALU logic to count instruction microcycles since ALU logic con- NORMALIZATION tributes to the normalization operation. Therefore CN must be input low, and if you wish to count microcycles you must use external logic or an extra microcycle per cycle. The high-order half of the word being normalized can come from internal or external RAM. If it comes from internal RAM then the RAM location addressed by B must provide the S operand to the ALU. and must receive the ALU output. But you can also use external RAM to provide the high-order half of the word being normalized; now OBO-OB3 gener- ates the ALU S operand and the ALU output is transmitted to YO-Y3. For this to occur OEB and WE must both be high. The C(N+4) and OVR statuses identify the last and second to the last microcycles of the double length nor- malization instruction's execution - just as they do for the single length normalization instruction. The double length normalization instruction also terminates in a single microcycle when you attempt to normalize a word which is initially O. At this time the Z status is output high. For this to be possible double length normalization logic tests the combined contents of the 0 register and ALU output in order to generate a Z status - as indicated in Table 8-8. Dou- ble length normalization pin connections are illustrated in Figure 8-21. 8-68 +5V Z = 00 • 01 ••• ON Z Z Z 03 0100t----t 0103 0100 0103 0100 0103 0100 SIOOt---~ SI03 SIOO SI03 SIOO SI03 SIOO 03¥02 CNt---~ C(N+4) CN C(N+4) CN C(N+4) CN IS +5V IS +5V LSS 02¥01 OVR W/MSS 2903 2903. 2903 MSS 03 N W/MSS W/MSS 2903 LSS LSS LSS WE WE WE WE - ALU output = [S] + CN. If WE. OEB. OEy and 10 are low. [B] = [y] = [B] + CN [0] = [a] upshifted one bit MSS means Most Significant Slice [S] = S ALU input IS means Intermediate Slice [B] = Local RAM contents addressed by B LSS means Least Significant Slice [y] = y output [0] = 0 register contents Figure 8-20. 2903 Single Length Normalization Function Pin Connections Another simple 2903 special function is the Sign/Magnitude Twos Complement. This func- 2903 SIGN/ tion converts negative twos complement numbers to this positive form, while leaving posi- MAGNITUDE tive twos complement numbers alone. This may be illustrated as follows for 16-bit numbers: TWOS COMPLEMENT After Sign/Magnitude FUNCTION Initial Twos Complement 0110010111010010 0110010111010010 Unchanged positive number 1110101111010101 0001010000101011 Twos complement of negative number The 2903 uses slightly devious logic in order to implement the Sign/Magnitude Twos Complement function. This is the actual ALU algorithm executed: ALU output = [S) + CN if Z status is 0 ALU output = [S) + CN if Z status is 1 [S) means ALU S operand. S is the complement of the S operand. 8-69 +5V () Z = FO • Pi . . . FN • QO • Q1 • ON .:. ~ - z z z z- 0103 0100 0103 0100 0103 0100 QI03 0100 ~O F3 . . . SI03 SIOO SI03 SIOO SI03 SIOO SI03 SIOO --- F3 ¥F2'" C(N+4) CN C(N+4) CN C(N+4) CN C(t-.J+4) CN - 0 IS +5V IS +5V LSS F2 ¥F'4- OVR W/MSS F34-N MSS r-4. 2903 W/MSS 1..........0 () 2903 W/MSS ~ C 2903 W/MSS 2903 +5V WE LSS ~ WE LSS ~ WE LSS - WE LSS~ • I~ ~ ALU output = [S] + CN. If WE. OEB. OEy. CN and 10 are low. [B] = [y] = 2 [B] ALU output is upshifted one bit [0] = [0] upshifted one bit MSS means Most Significant Slice IS means Intermediate Slice LSS means Least Significant Slice [S] = S ALU input [B] = Local RAM contents addressed by B [y] = y output [0] = a register contents Figure 8-21. 2903 Double Length Normalization Function Pin Connections During execution of the Sign/Magnitude Twos Complement instruction. the Zero status at the most significant 2903 slice directly outputs the high-order S operand bit - which is the sign bit for a twos complement number. The Zero status becomes an input to intermediate and least significant slices. which therefore receive the sign bit from the most significant slice. For a 16-bit number this may be illustrated as follows: Most Least Significant Intermediate Significant Slice Slices Slice 15 14 13 12 11 10 9 8 6 5 4 3 2 0 4--BitNo. z=y z=y z=y z=y ! ! t Now you can connect pins of 2903 slices in any way to make use of the Sign/Magnitude Twos Complement ALU logic, but to use it for its intended purpose, the connections illustrated in Figure 8-22 are required. 8 ... 70 +5V 4) j= :~ S3 -- - - ~ Z Z Z Z - 0103 0100 0103 0100 0103 0100 0103 0100 t-- - SI03 SIOO SI03 SIOO SI03 SIOO SI03 SIOO I - - ...... - C(N+4) OVR N W/MSS MSS 2903 CN ~ C(N+4) IS 2903 CN W/MSS ~~ +5V () C(N+4) IS 2903 CN +5V C) W/MSS 1----4 C(N+4) LSS 2903 CN W/MSS +5V WE LSS r---<> WE LSS ~ WE LSS ~ WE LSS~ j,. • j,. ALU output = [S] + CN if Z = 0, or [5) + CN if Z = 1. If WE, OEB, OEy, CN and 10 are low, [B) remains unaltered if Z = 0, or [B) = [B) + 1 if Z = 1 In either case [y) = ALU output Neither ALU nor a shifter function 'OVR = 1 if ALU input is 1000····00, the most negative binary number. "N = F3 if Z = 0, or F3 E9 S3 if Z = 1 MSS means Most Significant Slice IS means Intermediate Slice LSS means Least Significant Slice [S) = S ALU input. (S) = complement of S ALU input [F) = ALU output [B) = Local RAM contents addressed by B [0) = a register contents F3 = High-order ALU output bit from most significant slice S3 = High-order ALU S operand input bit to most significant slice Figure 8-22. 2903 Sign/Magnitude Twos Complement Function Pin Connections By connecting Z to CN positive. twos complement numbers are passed unaltered through the ALU: [F) = [S] + CN if Z = 0 CN = Z. therefore [S] = [S] + 0 But a negative twos complement number is complemented and then incremented: [F) = [5] + CN if Z = 1 CN = Z. therefore [S] = [5] + CN In other words. a twos complement number is twos complemented - which generates a positive number. (If you are unclear on this twos complement logic refer to Volume 1. Chapter 2.) 8-71 The negative status, N, is output high at the most significant slice if a negative twos complement number was converted to its positive form. This is the actual logic used by the most significant 2903 slice: If Z = 0, N = F3 Z = 0 when S3 = 0, in which case [F) = [S] Therefore N = F3 = S3 = 0 If Z = 1, N = F3 E9 S3 Z = 1 when S3 = 1, in which case [F) = [S] + 1 Therefore N = F3 ~ S3 = S3 e S3 = 1 The Overflow status indicates the only overflow condition which can occur when a Sign/Magnitude Twos Comple- ment conversion is performed. There is no twos complement positive representation for the most negative twos complement number which can be represented: If [S] = 1000·····0 [F) =0111·····1 + 1, = 1000·····0 If this most negative number is received at the S operand, it is passed through unaltered and the Overflow status from the most significant slice is output high. The Sign/Magnitude Twos Complement instruction places no restrictions on where the S operand may come from. Any of the three options - external memory, local RAM, or the Q register - may provide the S operand to the ALU. The third and last of the simple 2903 special functions is the Increment. This special func- 2903 tion adds 1, plus the Carry In to the S operand. This algorithm may be illustrated as follows: INCREMENT [F) = [S] + 1 + CN FUNCTION [F) is the ALU output. [S] is the ALU S operand input. and CN is the Carry In. If CN is 0, you increment by 1; if CN is 1, you increment by 2. This is useful in byte/word machines if the Program Counter is kept in local RAM. Once again the S operand may come from external or local RAM or from the Q register. The increment special function makes no special use of status logic. 2903 Let us now look at the unsigned multiply special function. The algorithm used by the 2903 UNSIGNED to perform an unsigned multiply is exactly the same as the algorithm which we described MULTIPLY earlier in this chapter, when showing how to program an unsigned multiply for the 2901. In- itially the multiplier must be in the Q register and the multiplicand in the RAM location which provides the ALU R input. This may be external RAM connected to DAO-DA3, or local RAM addressed by A. The product will be generated in the RAM location that receives ALU output. and the Q register. The RAM location connected to ALU output may be exter- nal RAM connected to YO-Y3, or local RAM addressed by B; it ultimately holds the upper half of the product. The Q register holds the lower half of the product. The RAM location that finally holds the upper half of the product must in- itially contain O. Thus we can illustrate initial and final data locations as follows: Multiplicand Multiplier (0) Initial: R II S I Q I Product Multiplicand upper lower Final: R II S IQ I The 2903 unsigned multiply operation will multiply two 16-bit numbers to generate a 32-bit product. If you wish to multiply larger numbers you must do so in 16-bit increments and add partial products using additional microcycles. If we compare the register utilization illustrated above with the unsigned multiply description given for the 2901, the local RAM location addressed by B in the illustration above becomes the window into which the multipli- cand is added whenever a 1 bit is shifted out of the multiplier; but 2903 logic tests this bit internally, outputting the least significant Q register bit from the least significant 2903 slice via the Z status. The Z status becomes an input to the most significant and intermediate slices, so that these 2903 devices can also tell whether the multiplicand is to be added into the product window. Thus the unsigned multiply consists of 16 microcycles. In each microcycle the low- order bit of the Q register in the least significant slice is tested. If this bit is 1. the mu Itiplicand is added to the partial product. If this bit is 0, no addition is performed. Addition, if it occurs, consists of adding the ALU Rand S inputs, which probably means adding the contents of the RAM location addressed by A to the contents of the RAM location ad- dressed by B. If A and B are the Rand S ALU inputs, respectively, with the sum returned to the RAM location addressed by B, then WE, OEB. OEy. EA. and 10 must all be O. 8-72 After the low-order bit of the Q register in the least significant slice has been tested. and a conditional addition has been performed. the product space (local RAM addressed by B. and the Q register) is downshifted one bit position dur- ing the same microcycle. The Carry status following the addition is shifted into the high-order bit of the ALU output for the most significant slice. If no addition is performed. then the Carry will e_qual O. and 0 will be shifted into the high- order ALU output bit of the most Significant 2903 slice. This may be illustrated as follows: Most Significant Slice R input S input ~ ~ ----I~--I~ C(N+ 1) = C 'F2 C \ \ F3 \ \'----~. F2 F1 SIOO = FO A single microinstruction performs the actual unsigned multiplication; however. preceding instructions must load the multiplier and multiplicand into their appropriate registers. and must zero the RAM location to be used for the running partial product. Necessary pin connections in a 2903 configuration that uses the unsigned multiply function are illustrated in Figure 8-23. The use of status by the unsigned multiply function is straightforward - with the exception of the Zero status which propagates the current low-order multiplier bit to all 2903 slices as we have already described. The Carry In, CN, must be O. If it is 1 you get the wrong answer when the multiplicand is added to the product window. The Carry Out, C(N+4}, the Overflow, and the Sign status are all output by the most significant 2903 slice to reflect the result of each partial product addition. However. these statuses are useless and should be ignored. The 2903 will also perform twos complement multiplication on two 16-bit signed binary 2903 TWOS numbers to generate a 32-bit signed binary resuft. The algorithm for performing twos com- COMPLEMENT plement multiplication is essentially the same as the unsigned multiplication algorithm MULTIPLY which we have already described; the same registers are used to hold the multiplier, the FUNCTION multiplicand, and results. There are two differences between signed and unsigned multiplication; they are: 1) We must account for the sign bit of the multiplier. which is not a magnitude bit. 2) Slightly different logic is needed to generate the bit which is shifted into the high-order ALU output from the most significant 2903 slice following each downshift. The logic of twos complement multiplication using Signed binary arithmetic is readily deducible from the unsigned multiplication algorithm which we described for the 2901. together with the discussion of Signed binary arithmetic given in Chapters 2 and 3 of Volume 1. Moreover. you the user cannot modify twos complement multiply logic in any way; therefore a detailed understanding of the algorithm is of academic interest only. The algorithms for Signed and unsigned binary multiplication remain the same until the last microcycle - at which time the sign bit of the 8-73 multiplier is in the low-order bit of the product space. This may be illustrated as follows: Local RAM MSS IS IS LSS ------.. Ix/x/xlxlxlxlxlxlxlxlxlxlxlxlxlx ~......- ----~ V ~---- ------~~ window into which multiplicand is added .. generating partial product Q Register MSS IS IS LSS ~~ I X I X I X I X I X I X I X IX I X I X I X I x·1 X I X I xl S I t sign bit. last bit of multiplier, which has been downshifted out of Q register If the sign bit is 0, then the multiplier is positive and the multiplicand need not be added again to the partial product; following the next downshift the multiplication is complete. But if the sign bit is 1, then on the last microcycle the mu ltiplicand must be subtracted from the partial product before the final downshift. When the Twos Complement Multiply function is executed, following each downshift, the Exclusive-OR of the Overflow and Sign statuses is moved into the high-order bit position of the most significant 2903 slice. This en- sures that a 1 is shifted into the high-order bit position if addition generated a Carry, or if a negative result must have its sign extended. 8-74 +5V C) :: .~ - OO,LSS - - - 4,.· -. 0103 Z 0100 0103 Z 0100 0103 Z 0100 0103 Z 0100 ~OO FO, LSS - SI03 SIOO SI03 SIOO SI03 SIOO SI03 SIOO - C(N+4) CN C(N+4) IS CN +5V C(N+4) IS CN +5V C(N+4) LSS CN ~O ~ OVA . . . OVA W/MSS 2903 C) 2903 () 2903 F3'" N MSS W/MSS ~ W/MSS H W/MSS 2903 +5V LSS r--o LSS ~ LSS I-- WE WE WE WE LSS~ j h j~ j~ ALU output = [S) + CN if Z = 0, or [A) + [S) + CN if Z = 1 [F) and [0) are downshifted one bit position MSS means Most Significant Slice IS means Intermediate Slice LSS means Least Significant Slice [S) = S ALU input [A) = A ALU input [F) = ALU output (0) = 0 register contents 00 = Low-order bit of 0 register FO = Low-order bit of F register Figure 8-23. 2903 Unsigned Binary Multiply Function Pin Connections Figure 8-24 illustrates pin connections needed to execute Twos Complement Multiply and Twos Complement Multiply Last Cycle special functions. The only non-obvious aspect of Figure 8-24 is the generation of the Carry In (CN) to the least significant 2903 slice. This Carry In must be 0 until the last microcycle. at which time it must receive the Zero status. We therefore show the Twos Complement Multiply Last Cycle instruction code uniquely generating an ENABLE signal which conditions an AND gate that generates the CN input The AND gate passes through the Zero status during the Twos Complement Multiply Last Cycle instruction's execution. but at other times the AND gate does not pass the Zero status. generating a o CN input This function is provided in the 2904 logic. You must execute twos complement multiply instructions in the proper sequence in order to perform twos complement multiplication using 2903 devices You execute the Twos Complement Multiply special function fifteen times. then you execute the Twos Complement Multiply Last Cycle special function. The two microinstructions which perform the twos complement multiply and the last cycle of the twos complement multiply must of course be preceded by microinstructions that correctly load registers and zero the memory word being used for the high-order half of the product 8-75 +5V () ~~ :~ 00, L5S - - - .... 0103 Z 0100 0103 Z 0100 0103 Z 0100 0103 Z 0100 ~ - SI03 SIOO SI03 SIOO SI03 SIOO SI03 SIOO - C(N+4) CN C(N+4) lS CN +5V C(N+4) IS CN +5V C(N+4) lSS CN ---0= OV ll.- OVR () C) F3 4 - N W/MSS MSS 14- 2903 W/MSS ~ 2903 W/M5S ~~ 2903 W/M5S LSS* 2903 +5V WE lSS r--o WE lSS ~ WE l5S - WE ~ .~ j ~ ENABLE AlU output, not last cycle, = [5] + CN if Z = 0, or [R] + [5] + CN if Z = 1 [F] and [0] are downshifted one bit position AlU output, last cycle, = [5] + CN if Z = 0 or [5] - [R] - 1 + CN if Z = 1 [F] and [0] are downshifted one bit position ENABLE is high on last cycle only MSS means Most Significant Slice IS means Intermediate Slice l5S means least Significant Slice [S] = S AlU input [R] = R AlU input [F] = AlU output [OJ = aregister contents 00 = low-order bit of a register FO = low-order bit of F register Figure 8-24. 2903 Signed Binary Multiply Function Pin Connections 8-76 We will now examine the 2903 Twos Complement divide special function. 2903 TWOS COMPLEMENT You divide a divisor into a dividend. The answer is called a quotient. and there will be a remainder. DIVIDE This may be illustrated as follows: FUNCTION Quotient r = Remainder Divisor ) Dividend Conceptually the algorithm for performing binary division is very straightforward. As for decimal division. you begin at the most significant end of the dividend: 1 0 1 ... 1 1) 1 00· .. 1 1 0 1 110 ... 11 But when you perform binary division the problem reduces to comparing the magnitude of the divisor and the current dividend field: ~ .. . - . -. X .. - - . - - - DIvisor larger. X = 0 ( 101"'11)"-"-'-'-~ Divisor smaller. X = 1 - 1 0 1· .. 1 1 ~ When performing a twos complement divide we begin by subtracting the divisor from the high-order end of the divi- dend: 1 0 1 0 1 1 0 1 »):f'&it"Q;~;;1;(11 0 1 1 1 1 0 1 /10101101 Dividend most significant field 001 001 0 1--Partial remainder If the divisor is the smaller number. as it is in the illustration above. then the partial remainder is positive: we add the next dividend bit and subtract again: 10101101)1101001010111101 10101 101 001001011 10101101 This is equivalent to upshifting the combined partial remainder and dividend residue one bit position. and then subtracting the divisor again: 1 0 1 0 1 1 0 1) 1 1 01 00 1 0 1 0 1 11 1 0 1 ~10101101~ '--P-a-rt-ia-I-re-m---ainder-p 0 JJ?t 10 ~ I'-- Dividend residue ---~ 0010010110111101 001 001 0 1 1 0 1 1 1 1 0 1-Upshift combined partial ---------~11i0!...1LQOJ1_1LQO~1 remainder and dividend residue 8-77 But what happens if you get a negative result after subtracting the divisor from the current dividend field? The answer is that you must add the divisor back to the partial remainder before upshifting the dividend one bit position: and then subtract the divisor again. But in binary logic this is what happens: (Partial remainder + Divisor) x 2 - Divisor t this is the equivalent of an upshift The sequence of operations is equivalent to: Partial remainder x 2 - Divisor Therefore when you subtract the divisor and get a negative result. you simply upshift the concatenated Partial re- mainder and Dividend residue fields one bit position. then subtract the divisor on the next step. This is. in essence. the algorithm used by the 2903 to perform binary division. and is called "non-restoring" division. It is based on the Twos Complement Divide special function. which performs the following net operations: [F] = [S] + [R] if Z = 0 [F] = [S] - [R] if Z = 1 [Fl [S1. and [R] are the ALU output. S operand and R operand. respectively. The Zero status is generated by sign compare logic as the complement of the Exclusive-OR of most significant slice high-order ALU output and R operand input bits: Z = R3E9F3 Additional required conditions are that lEN be low and one of the Twos Complement Divide special functions be ex- ecuted. The sign compare level is output at the most significant 2903 Zero status and it is input to the Zero status of intermedi- ate and least significant 2903 slices. In effect. the sign compare logic compares the sign of the partial remainder with the sign of the divisor. This generates the following logic sequence: 1) If [F] and [R] signs are the same. the divisor had a smaller absolute magnitude than the dividend field from which it was subtracted. Z is therefore O. so on the next microcycle we get: [F] = [S] + [R] 2) If [F] and [R] signs differ. the divisor had a larger absolute magnitude than the dividend field from which it was subtracted. Z is therefore 1. so on the next microcycle we get: [F] = [S] - [R] The quotient bits are also determined by comparing the sign of the partial remainder with the sign of the divisor. If the signs differ. the cu rrent quotient digit is 0 because the divisor has the larger absolute value: but if the signs are the same. the current quotient digit is 1 because the divisor has the smaller absolute value. Let us now look at the exact 2903 implementation of the binary division. The two steps defined above do not take into account the first step - at which time we have no partial remainder. or ALU output. 2903 division logic therefore demands that the absolute magnitude of the divisor be greater than the absolute magnitude of the most signifi- cant half of the dividend. To ensure that the divisor does indeed have larger absolute magnitude, the algorithm illustrated in Figure 8-25 is recommended in Advanced Micro Devices' literature. We will describe this logic. even though other logic could achieve the same desired result. In order to compare the absolute magnitude of divisor and dividend. we need to work only with the most significant half of the dividend. Comparison instructions destroy the data. therefore we begin by moving the divisor and the most significant half of the dividend to temporary buffers - in all probability additional locations in local RAM. When moving the divisor to an alternate RAM location we can test the Zero status to see if the divisor is O. If it is. the division must be aborted. Next we use the Sign/Magnitude Twos Complement special function (which we have already described) to generate positive magnitudes for the copies of the divisor. and the most significant half of the dividend: now we can compare these magnitudes without bothering about sign. The Sign/Magnitude Twos Complement function. when executed. ijenerates a positive Overflow status if the data in- put is the most negative binary number allowed - in our case _2 16-. We take advantage of this Overflow status when operating on the most significant half of the dividend. If the most significant half of the dividend is -216. then the divisor cannot possibly be larger. so we downshift the entire dividend one bit position and restart. We also check the 8-78 Overflow status when performing the Sign/Magnitude Twos Complement operation on the divisor. If the divisor is _2 16, then it must be larger than the dividend, which is not -2 16, since the dividend test was made first. We therefore go straight to the division operation. If neither the divisor nor the most significant half of the dividend is -2 16 , we upshift both numbers one bit position to remove the sign bit. then subtract the most significant half of the dividend from the divisor. If the dividend is larger. it must be downshifted one bit position - and the test repeated. When the divisor is larger, we are ready to start the divi- sion. If you scale the divisor or the dividend, then the quotient must be scaled in compensation. Divisor, dividend and quo- tient scaling logic is entirely your responsibility. Combining the data preparation and division programs, the sequence of 2903 special functions shown in Table 8-9 is recommended in v~ndor literature to perform binary division. Table 8-9 shows a 16-bit divisor divided into a 32-bit dividend to generate a 16-bit quotient and a 16-bit remainder. The instruction sequence preceding the actual division instructions implement Figure 8-26 logic. These instructions need no special discussion. But we do need to clarify the manner in which status signals output by the 2903 are handled. The 2903 outputs status and data at the same time. For timing details refer to the 2903 microcycle descrip- tion given earlier in this chapter. Some 2903 functions require status output by one 2903 slice to be input to other 2903 slices within the same microcycles; for an example of this look at the way Z is used by the Twos Complement Divide special function. Status is output early enough in the microcycle for an output to become an input to another 2903 slice within the same microcycle. But external logic will not have time to process any 2903 status outputs in the process of generating 2903 inputs for the same microcycle. Status output in one microcycle must be processed by ex- ternal logic during the next microcycle. In Table 8-9 the comments associated with each microinstruction identify relevant status, if any, which is generated during the microinstruction's execution. Comments make clear the fact that the generated status must be tested during the next microcycle's execution time. Status output by the 2903 is usually tested by microprogram address generation logic. Later in this chapter, when we describe microprogram address generation devices. the consequences of testing status while executing the next microinstruction will become self-evi- dent. The three divide instructions use 2903 local RAM and Q registers as follows: Dividend Most Dividend Least Divisor register Significant Significant Half register Half register Dividend Most Divisor buffer Significant Half buffer ., Q register Remainder Quotient I The divisor and dividend require initial memory locations identified as registers in the illustration above. The divisor and the most significant half of the dividend also require temporary buffers. The contents of these buffers are destroyed in the process of comparing the divisor and dividend magnitudes. 8-79 Move the divisor and most significant half of the dividend to temporarY buffers YES Perform twos comple- ment sign/magnitude Exit convention on divisor and most significant half of dividend in temporary buffers NO Downshift YES dividend one bit position Subtract most significant half of dividend from divisor Move least significant half of dividend to Q register YES Downshift dividend one Start division bit position Figure 8-25. 2903 Binary Division Data Preparation Algorithm 8-80 Table 8-9. A Possible 2903 Twos Complement Binary Division Microprogram Microinstruction No EA CN AO - A3 BO - B3 Comment 18 - 15 14-11 10 1 4 6 0 0 0 Divisor register Divisor buffer Copy divisor to temporary buffer. (RO) (R3) 2 4 6 0 0 0 Dividend (MS) Dividend (MS) Copy dividend most significant half to temporary buffer. register (R 1) buffer (R2) 3 5 0 0 X .0 X Dividend (MS) Convert dividend (MS) from twos complement to sign/magnitude version. buffer (R2) Test OVR externally while next microinstruction is being executed. If OVR is 1, branch to subroutine that downshifts dividend. 4 5 0 0 X 0 X Divisor buffer Convert divisor (MS) from twos complement to sign/magnitude version. (R3) Test OVR externally. If OVR is 1, branch to microinstruction 9. 5 9 4 0 X 0 X Dividend (MS) Shift out sign bit of dividend (MS) half in temporary buffer. buffer (R2) 6 9 4 0 X 0 X Divisor buffer Shift out sign bit of divisor in temporary buffer. (R3) 7 F 2 0 0 1 Dividend (MS) Divisor buffer Subtract sign bit stripped divisor from sign bit stripped dividend (MS) half. buffer (R2) (R3) If Carry = 1 (dividend larger) branch to subroutine that downshifts dividend or upshifts divisor. 8 6 6 0 0 0 Dividend (LS) X Copy dividend least significant half to Q register. register (R4) 9 A· 0 0 0 0 Divisor register Dividend (MS) Double length normalize dividend in MS register and Q register. (RO) register (Rl) 10 C· 0 0 0 Z Divisor register Dividend· (MS) Execute twos complement divide instruction fourteen times. (RO) register (R 1) 11 E 0 0 0 Z Divisor register Dividend (MS) Twos complement divide final instruction. (RO) register (R 1) ·CN is connected to Z status while these two special functions are being executed. Before the actual division begins, the least significant half of the dividend is moved to the 0 register. The quotient is ultimately returned in the 0 register and the remainder in the Dividend Most Significant Half register. Taking a simple case. if local RAM is used to implement Divisor and Dividend registers and buffers. then we can illustrate local RAM and 0 registers utilization as follows: Initial: RO - Divisor R1 - Dividend. most significant half R2 - Copy of R1. dividend most significant half R3 - Copy of divisor R4 - Dividend. least significant half o - Dividend. least significant half Final: R1 - Remainder o - Ouotient The 0 register. which initially holds the least significant half of the dividend. ultimately holds the quotient. As the divi- dend is upshifted out of the Q register and into the Dividend Most Significant Half register. quotient bits get shifted into the 0 register via 00. 8-81 If you look again at Table 8-9, you will see that the actual division operation executes three functions: 1) The Double Length Normalize function. which serves as the first divide function. 2) The Twos Complement Divide function; this function is executed N-2 times. where N is the number of divisor and quotient bits. 3) A final Twos Complement Divide Correction function completes the division. Necessary pin connections for the Double Length Normalize function are given in Figure 8-21. Figure 8-26 shows necessary pin connections for the Twos Complement Divide and Twos Complement Divide Correction functions. Zero status logic is used to transmit sign compare information from the most significant 2903 slice to intermedi- ate and least significant slices. The level transmitted is the complement of the Exclusive-OR of the most significant bits of the ALU output and R operand input. This may be illustrated as follows: R3 R2 R1 RO 53 52 51 50 ALU F3 F2 F1 FO Z = R3 E& F3 This Z status logic works only when an A or C special function code is input via 18-15, and iEN is simultaneously low. The Z status also becomes the CN input to the least significant slice in order to neutralize CN within the ALU functions performed. This may be illustrated as follows: [F] [S] + [R] + CN if Z = 0 so [F] [S] + [R] if CN = Z [F] [S] - [R] - 1 + CN if Z = 1 so [F] [S] - [R] if CN =Z The Q register and ALU register are connected so that an upshift causes the high-order bit of the Q register to be input to the low-order ALU bit. The high-order ALU bit is lost. and the next quotient digit is shifted into the least significant bit of the Q register. This may be illustrated as follows: Lost bit ALU register Q register The level actually output at SI03 is also R3 e F3. This becomes the next bit shifted into the quotient. The final Twos Complement Divide Correction function forces a 1 into the low-order quotient bit. leaving the remainder adjusted accordingly. 8-82 Q3, MSS +5V ~) :~ •• -- - - F3 + R3 - ,~ Z Z Z z .... 0103 ""'""- SI03 0100 SIOO QI03 SI03 QIOO SIOO 0103 SI03 0100 SIOO QI03 SI03 QIOO SIOO kJ:: - C(N+4) CN C(N+4) IS CN +5V C(N+4) IS CN- +5V C(N+4) LSS CN - OVR 2903 () 2903 C) 2903 ~ W/MSS -N MSS W/MSS ~~ W/MSS ~ W/MSS 2903 _ LSS f-<> LSS ~ LSS ~ LSSQ WE +5V WE WE WE j j .~ ENABLE ALU output = [S) + [R) + CN if Z = 0, or [S) - [R) + CN - 1 if Z = 1 [0) is upshifted on all microcycles [F) is upshifted on twos complement divide, but not on twos complement divide last microcycle. ENABLE is high on last cycle only MSS means Most Significant Slice IS means Intermediate Slice LSS means Least Significant Slice [S) = S ALU input [R) = R ALU input [F) = ALU output [Q) = a register contents 03, R3 and F3 are most significant bits of a register, R ALU input and ALU output Figure 8-26. 2903 Signed Binary Twos Complement Divide Pin Connections Merely understanding the pin connections and functions shown in Figure 8-25 is quite straightforward. Understand- ing how binary division is performed using these pin connections, and the three binary division functions, is not self- evident. Let us therefore take a very simple example and analyze divide logic in conjunction with this example. Con- sider the following simple division: 18 16 = 3 remainder 3 ~ We have a 4-bit divisor and an 8-bit dividend which generate a 4-bit quotient and a 4-bit remainder. We must therefore execute the Double Length Normalize function, followed by two Twos Complement Divide functions, and a Twos Com- plement Divide Correction function. 8-83 For Step 1 we execute the Double Length Normalize function. This upshifts the dividend and generates the sign of the quotient at SI03 of the most significant slice. The quotient sign bit gets shifted into the low-order 0 register bit. Logic may be illustrated as follows: Step 1 [F] [R] [5] [a] 5103 z Initial a 1 1 1 aaa 1 1aaa Final 11II1I1 a a a 1 a 1 1 1 a a 1 1 a a a 0-0 SI03 is the Exclusive-OR of the most significant slice ALU output and R operand input bits. This may be illustrated as follows: Step 1 [F] [R] [5] [a] 5103 z Initial a 1 1 1 aaa 1 1aaa This SI03 logic says that when the divisor and the dividend have the same sign, the quotient is positive; the quotient is negative when the divisor and the dividend have opposite signs. What is not self-evident is the fact that we have multiplied the dividend by two before starting to work with the divisor. In consequence, we must finally upshift the quotient and the remainder to generate answers that stand numerical comparison. Moving on to Step 2, we execute the Twos Complement Divide function for the first time. The Zero status is 1: Step 1 [F] [R] [5] [a] 5103 z Initial 011100011000 Therefore, we subtract the divisor from the high-order four dividend bits. This may be illustrated as follows: z 7 Step 2 [F] [R] [5] [a] 5103 o In;t;a~/ 00 I ,/o;OjOlO 0011 ( 100 1 Final 1 1aa a111 1aaa aaaa- 0 a --'----7 This step is very logical. It is equivalent to initially subtracting the divisor from the dividend in any decimal division: 25)237642 25 -2 8-84 In our binary example the divisor is larger than the dividend. even though the dividend has been upshifted; therefore the next quotient bit shifted into the Q register is O. 0 is indeed output by the most significant slice at 5103: Step 1 [Fi [R] IS] [a] SI03 Z Initial 0001 01 1 1 0011 0000 0 !;~r:::~~o Final 0 ED In Step 3 the Twos Complement Divide function is executed a second time. The Zero status is now 0: Step 2 [F) [R] IS] [a] SI03 z Initial 000 1 0 111 00 11 0000 0 Final Therefore. during Step 3 we add the divisor to the high-order four bits of the shifted dividend. This addition. and the subsequent upshift. may be illustrated as follows: Step 3 [F) [R] IS] [a] SI03 Z ,nl"ac::;?100/ 11 0 0 Final 111101111110 0000-0 ~"--7 1 0 Adding the divisor to the upshifted dividend is also self-evident. We got a negative answer during Step 2. therefore (as described earlier) we must now compensate by adding the divisor to the upshifted dividend. The dividend is still smaller than the divisor. so once again 5103 outputs 0 at the most significant 2903 slice: Step 3 [F] [R] [S] [a] SI03 z Initial 1 10 0 0 111 1000 0000 o o Final and zero gets shifted into the Q register to become the next quotient bit. 8-85 Finally. in Step 4 we execute a Twos Complement Divide Correction function. Once again we test the Z status. which is O. therefore we add the divisor to the high-order four bits of the upshifted dividend. Together with the final shift this may be illustrated as follows: Step 4 [F] [R] [5] [0] 5103 z c; o "'"8'''''7''' 0000 0 III 0 Final 010'1 0 111 0 1 0 1 0001 -v-~ t Forced input During the final shift a 1 is forced into the quotient to become the quotient low-order bit. The four high-order dividend bits do not change. Thus our final answer is: . Quotient = 0001 Remainder = 0101 In order to test the numeric accuracy of our answer we must upshift one bit position: Quotient = 0010 Remainder = 1010 Thus. the answer is 2 with a remainder of A 16 - which is not 3 with a remainder of 3. but it is correct. You r external logic (2904) must upshift thequotient and the remainder. if your algorithm demands it. and must adjust the quotient and the remainder if your algorithm requires the remainder to be less than the divisor. 8-86 THE 2902 CARRY LOOK-AHEAD DEVICE This device serves just one function: when performing binary addition or subtraction using cascaded 2901 or 2903 systems, it creates parallel carry inputs for 4-bit slices beyond the least significant slice. Carry Look· Ahead logic has been described in detail in Volume 1, Chapter 4. We will therefore provide a simple summary of the 2902 device in this chapter, stating its logic functions, but omitting Carry Look-Ahead theory. The 2902 is packaged as a 16-pin DIP. All signals are TTL-level compatible and a single +5V power supply is required. The 2902A is a faster version of the 2902. 2902 PINS AND SIGNALS Figure. 8-27 illustrates pins and signal assignments for the 2902 Carry Look-Ahead device. Figure 22-28 shows a 2902 device connected to four parallel 2901 devices. If you replace the 2901 devices with 2903 devices, con- nections between the 2902 and the 2901 or 2903 devices do not change. 0 SO ZERO CN Sync/Enable Logic A v (} External Controls ~ CLK A- OR y v 4 ~ .. ~ Microprogram ".- PROM/ROM 4_ - I I U Microinstruction Register ~) Microprogram II Logic "11,/ Addresses "II",," Sequence 0- '-, ~ V' and Enable Status To 2901 or 2903 Controls Output Slices from 2901/2903 Figure 8-31. Function of Microprogram Sequencer Logic in a 2901 or 2903 Based System 8-93 Macroinstruction object codes have been described in considerable detail in Volume 1. Chapter 7. This discussion emphasizes the fact that macroinstruction object codes are selected to optimize Central Processing Unit operations. without regard to microprograms. or how microprograms may be stored in a memory device. This being the case. there is no chance that the op-code portion of any macroinstruction will have a bit pattern that addresses the correct microinstruction. or initial microinstruction that must be executed in response to the macroinstruction's execution. In- stead. a mapping read-only memory or a programmable logic array is used as an address translator. The mapping ROM or PLA treats the op-code portion of the macroinstruction as an input. In the ROM. the actual microprogram starting ad- dress is stored at the location addressed by the op-code bit pattern. Conceptually. this may be illustrated as follows: Assembly Language Object Code I Op Code I Data This actual bit pattern is treated as a memory Microprogram ROM address in mapping ROM The contents of the addressed memory word is the address Microinstructions of the first microinstruction to be executed in microprogram ROM The size of the mapping ROM and the width of the address which it outputs depend on the size of the microprogram- that is to say. the length of the microprogram in terms of the number of microinstructions. This may be illustrated as follows: Microinstruction bit width has no effect on mapping ROM size r~----~~~~--~--" P---------------~~~ .~ Number of microinstructions determines Size of mapping ROM --------_.. ---- •• If. for example. 256 or fewer microinstructions constitute the entire microprogram. then an 8-bit address can be output by the mapping ROM. irrespective of whether the microinstructions are 16 bits wide. 64 bits wide or have any other bit width. But. if the total length of the microprogram were 1024 microinstructions. then a 1a-bit address wou Id have to be output by the mapping ROM. 8-94 If every macroinstruction resulted in the execution of a single microinstruction. then there would be no need for 290912911 Microprogram Sequencers. The mapping ROM could output a single address to the microprogram ROM. The contents of the addressed microprogram ROM would be output to the Microinstruction register - to become the microinstruction that enables operations requ ired by the macroinstruction. But it is most unlikely that the Central Processing Unit's assembly language will consist of instructions that are all pri- mitive enough to be implemented via a single microinstruction. In particular. as Central Processing Units become more complex. an ever larger number of microinstructions may have to be executed in response to a single macroinstruction execution; and the sequence in which these microinstructions are stored may also become more complicated. The 2909 and 2911 Microprogram Sequencers provide the logic which takes you from the initial microinstruction through the microprogram. There is one very important conceptual aspect of the 2909 and 2911 Microprogram Sequencers which must be clearly understood. These Microprogram Sequencer devices are. like the 2901 and 2903. cascadable 4-bit devices. But there is no relationship between the number of 2909/2911 devices which are cascaded. 2901 or 2903 devices are cascaded to give you the required CPU word width. Two 2901/2903 devices generate an 8-bit word; four 2901/2903 devices generate a 16-bit word; eight 290112903 devices generate a 32-bit word. etc. 2909 or 2911 devices are cascaded to address the required length of microprogram memory. The number of 2909 or 2911 devices cascaded together is in no way influenced by the width of the microinstruction. or the width of the CPU word. For example. if the microprogram has 256 or fewer microinstructions. two 2909 or 2911 devices cascaded together are sufficient. This holds true whatever the microinstruction width may be. and whatever the CPU word width may be. Thus the number of parallel 2901 or 2903 slices has no bearing whatsoever on the number of parallel 2909 or 2911 devices. You cannot even generalize by stating that there will be a tendency to require more 2909/2911 devices as the number of parallel 290112903 devices increases. Rather. the width of the microinstruction will increase with the number of 290112903 devices and. as we have already stated. the width of a microinstruction has no bearing on the length of the microprogram. or the number of parallel Microprogram Sequencer devices that will be needed. 2909/2911 MICROPROGRAM SEQUENCER PINS AND SIGNALS Pins and signal assignments for the 2909 and 2911 Microprogram Sequencers are illustrated in Figure 8-32. These signals are most easily understood in conjunction with the functional logic illustrations for the two devices which are given in Figures 8-33 and 8-34. Central to the logic of 2909aild 2911 Microprogram Sequencers is the Output Multiplexer, 2909/2911 which receives four inputs. SO and S 1 are two control inputs that select an output as OUTPUT follows: SELECT SO S1 Output Multiplexer Source o 0 Microprogram Counter o 1 Address register 1 0 Stack 1 1 Direct inputs (via 00-03) We will for the moment ignore the Microprogram Counter and Stack. two data storage areas whose functions will be described shortly. 00-03 are four data input lines. Data input via these four lines can be selectedVby the Output 2909/2911 Multiplexer and output immediately (if SO and S1 are both high). IMMEDIATE DATA INPUT Data input via RO-R3 is held in the Address register. Timing for Address register access may be 2909/2911 illustrated as follows: ADDRESS REGISTER CP -----~ RO - R3 Address ADDR Register _ _ _ _ _ _ _""'_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ 8-95 RE R3 - 1 2 28 27 .. --: VCC (+5V). CP CP (+5V) VCC 1 2 20 19 PUP FE - ----- - R2 3 26 PUP RE 3 18 C(N+4) R1 4 25 - - FEC(N+4) D/R3 4 17 CN RO OR3 -- - 5 6 24 23 -- CN D/R2 D/R1 5 6 2911 16 15 OE Y3 -- ... 03 7 22 OE DIRO 7 14 Y2 2909 OR2 02 OR1 ---..- 8 9 10 21 20 19 -.- Y3 Y2 Y1 GND ZERO SO 8 9 10 13 12 11 Y1 YO 51 - -- - 01 11 18 YO ..-- ORO DO GND - -- 12 13 14 17 16 15 --- 51 SO ZERO Pin Name Description Type RO - R3 Address register input Input DO - 03 Data input Input RIDO - R/D3 Combined Address register and data input Input YO - Y3 Address output Output, Tristate ORO - OR3 Address output mask Input ZERO Zero Address output control Input RE Address register input enable Input OE Address output enable Input FE Stack enable Input PUP Stack pushlpop select Input CN Program Counter Carry in Input C(N+4) Program Counter Carry out Output SO,S1 Output select Input CP System clock Input VCC,GND Power, Ground Figure 8-32. 2909 and 2911 Microprogram Sequencer Pins and Signal Assignments 8-96 RE----------------~ Address RO-R3~ ________ ~~1 Register 00-03 __________, Microprogram Counter 50 ----~ Output Multiplexer 51~ OR3----------+------+------4---~ OR2----------+------+----~ OR1 ----------+---~ ORO - - - - - - -..... Incrementer ZERO ----------4H----...+-----~~--_ YO Y1 Y2 Y3 C(N+4) Figure 8-33. 2909 Microprogram Sequencer Functional Logic 8-97 RE ------------------~ .....I----FE Stack Po.inter .....1----PUp 4x 4-Bit Stack Microprogram RIDO - R/D3 '--________..... Counter SO ---1" Output Multiplexer S1 ZERO ----------~----~~----~~--~ ....I---CN YO Y1 Y2 Y3 C(N+4) Figure 8-34. 2911 Microprogram Sequencer Functional Logic 8-98 As illustrated above. the Address register enable signal RE must be low before data can be written into the Ad- dress register via RO-R3.lf RE is low. then data is written into the Address register when the clock signal CP makes its high-to-Iow transition. But RE has no effect on Address register output. Whether RE is low or high. the Address register contents are transmitted to the Output Multiplexer. The 2911 shares D and R inputs. Data input at RIDO-R/03 will be written into the Address register if RE is low. and will be output via the Output Multiplexer if SO and 51 are both high. Multiplexer output lines VO-V3 have their own enable signal OE. If this signal is high, VO-V3 2909/2911 outputs are floated. This allows you to disconnect Microprogram Sequencer devices from the DATA microprogram ROM. something you may do when switching to an external tester. OUTPUT The 2911 has one set of conditioning logic on the Y outputs. The 2909 has two sets of condition- 2909/2911 ing logic on the Y outputs. Both devices have a ZERO input which, when low, unilaterally OUTPUT forces the four lines VO, V1, V2, and V3 to output O. Frequently you will use the ZERO line as a ZERO restart -with an initialization microinstruction sequence origin at microinst~uction number in a CONTROL the microprogram ROM. The 2909, but not the 2911, has four mask signals, ORO, OR1, OR2, 2909 and OR3, which can individually force VO, V1, V2, and V3, respectively, low. Typically you OUTPUT will use the mask signals to implement conditional logic. For example. we have already seen how MASK the Overflow status (OVR), output by the most significant 2901 and 2903 slice. signals an over- flow or "exceptional" condition. By tying the Overflow status to ORO. you can implement microinstruction pairs. The Output Multiplexer outputs a 0 low-order microinstruction address via YO. which ORO can override and convert to 1. For an 8-bit microprogram address this may be illustrated as follows: 1-*-,...---- , . . . - - - - - - - Output by high-order 2909 Output by low-order 2909 XXXXYYYO ~ ______ +L.___ ORO to low-order 2909 can change this address bit to 1 ~I X X X X Y Y YO . . M;c",;nstruct;on exec..ed ;1 OVR ~ 0 • X X X X Y Y Y 1 . . . . - - Microinstruction executed if OVR = 1 Of course. having a mask line associated with every microinstruction address output line lets you generate more com- plex conditional logic schemes than the simple illustration above. There are two internal locations within the 2909 and the 2911 which can hold addresses. These are the Microprogram Counter and the Stack. 2909/2911 Let us first look at the Microprogram Counter. This location is equivalent to the typical Central MICROPROGRAM Processing Unit Program Counter. COUNTER When SO and S1 are both low. Microprogram Counter contents are read by the Output Multiplexer. and are output via YO-Y3. New data is written into the Microprogram Counter whenever data is input from the Output Multiplexer. whether or not the Microprogram Counter was selected as the Output Multiplexer input. Data written back to the Microprogram Counter is taken from the YO-Y3 path following the OR and AND gates. Therefore. if you use either of the output condi- tioning gates. you will also modify the Microprogram Counter contents. This. of course. is no different to a Central Pro- ceSSing Unit's Program Counter. which is also modified by a restart or jump instruction. Data being written back to the Microprogram Counter passes through an Incrementer. The Incre- 2909/2911 menter adds the CN level to data which is on its way to the Microprogram Counter. Thus if INCREMENTER CN is low. the Incrementer passes data through unmodified; but the data is incremented if CN is high. An Incrementer overflow generates a high C(N+4) output. Let us look at the various ways in which you may use Microprogram Counter logic. In the simplest case, you may wish to sequentially access a number of microinstructions. 2909/2911·· You can begin the sequence by inputting the first microinstruction address to the Address register SEQUENTIAL via RO-R3. or as immediate data via 00-03. Remember. 2909 and 2911 devices are cascadable; ADDRESSES therefore we are not limited to 4-bit addresses. The initial address. when output by the Output Multiplexer. also gets written to the Microprogram Counter. Assuming that CN is high. the address written into the 8-99 Microprogram Counter will be one more than the starting address input via RO-R3 or 00-03. For a number of subse- quent microcycles. you will continue to select the Microprogram Counter. leaving CN high. so that Microprogram Counter contents are incremented on each microcycle. Selecting addresses arbitrarily. this sequence may be illustrated as follows: Microprogram 00-03 SO .§.l CN YO-Y3 Counter Contents 30 1 1 30 31 XX 0 0 31 32 XX 0 0 32 33 XX 0 0 33 34 etc. etc. XX represents "don't care" inputs. There are some non-obvious problems that can occur when you generate sequential microinstruction addresses using Program Counter logic as illustrated above. The next very simple microprogram counter sequence involves the re-execution of a single 2909/2911 microinstruction - as you may do while performing a normalize or twos complement divide SINGLE operation using the 2903 special functions. If the Output Multiplexer selects the Microprogram INSTRUCTION Counter contents while CN is input low. then the Microprogram Counter contents will not change RE-EXECUTION on succeeding microcycles - and the same microinstruction will be executed repeatedly. You can skip a microinstruction with an even address within an otherwise consecutive in- 2909/2911 struction sequence. To do this you keep CN high. so that the Microprogram Counter increments INSTRUCTION on each microcycle. but you input a high ORO mask bit in order to skip an instruction. This may be SKIP illustrated as follows: Microprogram SO Sl CN ORO o -o - - - 0 Counter Contents 34 o o 0 35 o o 1 37 ORO forces low-order o o 0 38 address bit to 1. o o 0 39 etc. etc. You can also use mask bits to jump between microprogram pages. For example. within a 256- microinstruction program you can jump in sixteen microinstruction increments by inputting a high signal at the ORO mask bit of the high-order 2909 slice. This may be illustrated as follows: Both 2909's Most Significant 2909 Least Significant 2909 Address Microprogram Microprogram SO S1 ORO CN ORO Counter Counter 34 0 0 0 0010 1 a 0100 35 0 a 0 0010 1 0 0101 46 0 0 1 0011 1 a 01 10 47 0 0 0 0011 1 0 01 1 1 etc. By applying high inputs to other mask bits you can span almost any number of microinstructions in a Single jump. The 2909/2911 Stack has four locations. A Stack Pointer identifies the currently selected Stack location. If the Output Multiplexer receives SO low and S1 high. then it reads the contents of the currently selected Stack location and outputs this data via YO-Y3. This output address. like all other output addresses. passes through the Incrementer and is loaded into the Program Counter. 8-100 You modify the Stack Pointer address using the FE and PUP signals. FE must be low in order to modify the Stack Pointer. FE does not have to be low in order to output data from the Stack to the Output Multiplexer. When FE and PUP are both low. the Stack Pointer decrements on the low-to-high transition of CPo Timing may be il- lustrated as follows: CP PUP Decrement Sfack Pointer If FE is low and PUP is high. the Stack Pointer is incremented. then the contents of the Microprogram Counter are loaded into the newly addressed Stack register. Timing may be illustrated as follows: CP PUP Increment contents to Stack Stack Pointer The address in the Program Counter which gets written into the newly addressed Stack register will be the address which was output by the Output Multiplexer - incremented by one. assuming that CN is high. This enables traditional subroutine call and return logic. as we will see soon. The Stack Pointer is a roll-over counter. That is to say. it will decrement from 0 to 3: and it will increment from 3 to 0: This is normally not advantageous. Let us look at some of the address sequences which can be generated using the Stack. 8-101 Consider first a typical subroutine caU- in the classical assembly language sense. The 2909/2911 microinstruction which causes the subroutine call increments the Stack Pointer. Assuming that SUBROUTINE CN is high, the address of the microinstruction which causes the subroutine call is incremented by CALL one, written into the Microprogram Counter, and thence to the newly addressed Stack register, to the address of the microinstruction to which execution will return at the end of the subroutine. This sequence may be illustrated as follows: , ,, I , ,, , , ,II' , ,, With reference to the illustration above, the microinstruction which causes the subroutine call is arbitrarily assumed to reside in microprogram read-only memory location A216. Therefore the subroutine call begins with the Microprogram Sequencer outputting address A216, as illustrated above by CD For the microinstruction in location A216, only those bits that affect the Microprogram Sequencer are of interest to us. These bits cause the Microprogram Sequencer to receive high inputs at CN and PUP, with a low input at FE. This microinstruction will also provide the address for the next microinstruction, arbitrarily assumed to be 2E16 at @ in the illustration above. But this address will be output on the next microcycle. On the current microcycle, CN causes the currenfaddress (A216) to be incremented to A3...l..6. This is shown above at ® . The new incremented address A316 is written to the Microprogram Cou nter; see C§) above. Since FE is low and PUP is high, the Stack Pointer is incre- mented ( ® above) and the current Microprogram Counter contents, which is A316, is saved in the Stack. On the next microcycle the address 2E16 will be output. initiating the subroutine's execution. When the subroutine completes execution, it has the return address A316 stored at the Stack register identified by the Stack Pointer. 8-102 The final instruction of the subroutine must execute a Stack PUP and cause the Output Multiplexer to select the Stack as its input. This requires S1 to be high while SO. FE. and PUP are all low. The Output Multiplexer will read A316 from the Stack and output this address next. A316 is incremented to A416 and returned as the new Microprogram Counter contents. The Stack Pointer decrements. Thus a classical Stack-Oriented Return-from-Subroutine has been executed. A subroutine can consist of a single microinstruction. If you look again at the subroutine call illustration given earlier. the first instruction of the subroutine. which in our illustration will be the instruction stored at location 2E16. has nothing said about its Microprogram Sequencer bits. If this instruction causes a Return-from-Subroutine. then you have created a single-microinstruction subroutine. Using the Stack you can nest subroutines to a depth of four. In most microprograms. nesting 2909/2911 to a depth of fou r is perfectly adequate. SUBROUTINE NESTING A computed multidestination jump is easily implemented using a 2909 or 2911 Microprogram 2909/2911 Sequencer. A 16-way jump to individual instructions can be achieved by inputting data via ORO- MULTIPLE OR4 to the least significant 290912911. while generating more significant portions of the address JUMP from some other location. such as the Address register. 2909/2911 SYNC/ENABLE LOGIC There are innumerable ways in which the Sync/Enable logic portion of Figure 8-31 could be designed. At its most elementary level, 2909/2911 control signals will be generated (possibly from a read-only memory) based on Microinstruction register outputs which become a read-only memory address. This may be illustrated as follows: Enable/Select I FE-- PUP - RE S1 -- -- SO ZERO -- Sync/Enable ROM eN ORO -- Microinstruction OR1 -- Register OR2 OR3 - Il ROM Address 5J A 12-bit wide read-only memory would be required in the illustration above to generate eleven input signals needed by the 2909/2911. plus an Enable/Select signal for the R input 2-IN MUX. (The clock signal CP could not be generated by a ROM.) It would be possible to generate 4096 different combinations of 12 signals. Very few of these possibilities will ever be encountered. In all probability. a maximum of 32 different signal combinations may be seen. in which case a 32 x 12-bit read-only memory will suffice. with a 5-bit address provided by the Microinstruction register. Each microinstruction stored in the microprogram ROM will then contain a 5-bit address field; the address field selects one of the 32 signal combinations that define the next step of Microprogram Sequencer control inputs. Thus we are able to achieve address continuity within a microprogram. In many applications. the 29811A provides this function. But in Figure 8-31 three sets of inputs to the Sync/Enable logic section are shown. The "logic sequence and enable" control emanating from the Microinstruction register becomes the 5-bit address which we have already described. 8-103 Table 8-11. The 2903 Twos Complement Binary Division Microprogram Subroutine from Table 8-9, with 2911 Addressing Microinstruction Fields Added Microinstruction No EA CN AO-A3 80 - 83 Comment 18-1& 14-11 10 1 4 6 0 0 0 Divisor register Divisor buffer Copy divisor to temporary buffer. (RO) (R3) 2 4 6 0 0 0 Dividend (MS) Dividend (MS) Copy dividend most significant half to temporary buffer. register (Rl) buffer (R2) 3 5 0 0 X 0 X Dividend (MS) Convert dividend (MS) from twos complement to sign/magnitude version. buffer (R2) Test OVR externally while next microinstruction is being executed. If OVR is 1, branch to subroutine that downshifts dividend. 4 5 0 0 X 0 X Divisor buffer Convert divisor (MS) from twos complement to sign/magnitude version. (R3) Test OVR externally. If OVR is 1. branch to microinstruction 9. & 9 4 0 X 0 X Dividend (MS) Shift out sign bit of dividend (MS) half in temporary buffer. buffer (R2) 6 9 4 0 X 0 X Divisor buffer Shift out sign bit of divisor in temporary buffer. (R3) 7 F 2 0 0 1 Dividend (MS) Divisor buffer Subtract sign bit stripped divisor from sign bit stripped dividend (MS) half. buffer (R2) (R3) If Carry = 1 (dividend larger) branch to subroutine that downshifts dividend or upshifts divisor. S 6 6 0 0 0 Dividend (LS) X Copy dividend least significant half to Q register. register (R4) 9 A" 0 0 0 0 Divisor register Dividend (MS) Double length normalize dividend in MS register and Q register. (RO) register (Rl) 10 C" 0 0 0 Z Divisor register Dividend (MS) Execute twos complement divide instruction fourteen times. (RO) register (Rl) 11 E 0 0 0 Z Divisor register Dividend (MS) Twos complement divide final instruction. (RO) register (Rl) 'CN is connected to Z status while these two special functions are being executed. 8-104 Table 8-11. The 2903 Twos Complement Binary Division Microprogram Subroutine from Table 8-9, with 2911 Addressing Microinstruction Fields Added (Continued) Microinstruction bits covering 2903 and two 291 1 input :s (Bit positions are arbitrary and have no signlficancel 11 2903 Bits 2911 Bits iI:l ~ 2911 Addressing Operations i 18 17 16 16 14 13 12 11 10 EA CNA3A2A1AOB3B2B1 BO D7D6D6D4D3D2D1 DO RES1 SO CNFE ~ 1 2 o 1 o0 0 1 1 0 0 -....-'--.,- 4 6 0 o 1 o0 0 1 1 0 0 0 0 0 0 0 0 000000 1 --.,---.,- RO 0 o 0 1 o 0 1 0 R3 1 ~ A A A A A A AA Abort Address X X X X X X X X 0 0 0 0 1 0 --- 0 1 1 1 X 1 1 1 Z 1 1 1 X Select next sequential instruction. Load abort address into Address register. Select next sequential instruction, or abort --.,--....-' -....-'-....-' address if Z = 1 from microinstruction 1. 4 6 0 0 0 Al R2 1 1 1 1 3 4 o o --.,--...-.- o 1 0 1 5 o 1 0 1 0 0 0 0 0 0 0 0 0 0 X X 0 0 0 X X X X 0 0 1 0 -....-' A2 X X X X 0 0 1 1 X X X X X X X X S S S S S S S S 1 --- 1 0 0 1 0 0 0 1 1 1 X 1 1 1 1 1 1 X Select next sequential instruction. OVA = O. Select next sequential instruction. ----...-.- 5 0 0 0 -....-' R3 ~ Scale Dividend 1 1 1 1 1 0 1 OVA = 1. Call "scale dividend" subroutine. Subroutine 6 1o -...-.---.,- 0 1 0 1 00 0 X 0 X X X X 0 0 1 0 --.,- B B B B B B B B 1 0 0 1 1 1 X OVA = O. Select next sequential address. ~ OVR = 1. Branch to microinstraction 8. 9 4 0 0 A2 Microinstruction 1 1 1 1 1 1 X 8 Address 6 1 o 0 1 o 1 o 0 0 -....-'-...-.- 9 4 0 X 0 0 X X X X 0 0 1 1 -....-' A3 X X X X X X X X --- 1 0 0 0 1 1 1 X Select next sequential instruction. '7 8 o 1 1 1 1 ----....-' F o 1 1 -...---...-.- o0 1 0 0 2 0 1 1 0 0 0 0 0 0 1 1 0 0 0 1 --.,--....-' 0 1 A2 o0 0 1 1 R3 o 0 X X X X X X X X X X X X T T T T T T T T --- 1 0 0 1 0 0 0 1 1 1 X 1 1 1 X Select next sequential instruction. C(N+41 = O. Select next sequential instruction. ~ ~ C(N+41 = 1. Call "scale divisor or dividend" 6 6 0 0 0 R4 Scale divisor or 1 1 1 1 1 0 1 subroutine. Dividend Subroutine 9 1 0 1 A o 0 0 00 0 -....-'-....-' 0 0 0 0 0 0 o0 0 o0 0 0 1 -....-'-...-- RO Rl X X X X X X X X --- 1 0 0 0 1 1 1 X Select next sequential instruction. 10 1 1 000000 0 ----....-' C 0 0 0 0 X 0 000000 1 --.,-~ RO Rl X X X X X X X X 1 0 0 --- 0 1 0/11 X Execute this instruction 14 times, then select next sequential instruction. '1 1 1 1 ----....-' E o0 0 0 0 0 X = "Don't Care" bits 0 0 0 0 X 0 000000 -...------ AO Rl 1 X X X X X X X X --- 1 1 0 2 1 1 0 0 Return from subroutine. 8-105 Status outputs from the 2901 or 2903 devices have already been encountered; we have. for example. discussed the way in which the Overflow status may generate one of the OR mask lines. The most effective way of handling status outputs from 2901 or 2903 slices is to use the test input of 29811 A. This might be illustrated as follows: t +t , ..- 13 12 11 10 ... COUNTER LOAD ... .-- 29811A ...-.COUNTER ENABLE MAP ENABLE .-.. -..... MUX -.. TEST --.. FE PIPELINE ENABLE ... PUP .-.. -...... SO51 + OUTPUT ENABLE 2909/2911 ADDRESSING EXAMPLE We will now complete our discussion of 2909 and 2911 operations by looking at a specific example - the twos complement binary division microprogram summarized in Table 8-9. Table 8-9 shows only those microinstruction bits required by the 2903 device. In Table 8-11 we add microinstruction bits for two 2911 Microprogram Sequencers. We assume that the two 2911 Microprogram Sequencers address the 2903 twos comple- ment binary division microprogram as a subroutine. within a 256-microinstruction microprogram memory. In the lower half of Table 8-11. RAM locations used by the twos complement binary division microprogram are iden- tified using register designations "RO" through "R4". These designations represent RAM locations with addresses 0 through 4. respectively. Additional microinstruction bits added in the lower half of Table 8-11 provide the two 2911 Microprogram Sequen- cers with their data and control inputs. Eight data input bits are needed. four for each of the two 2911 Microprogram Sequencers. But since both 2911 Microprogram Sequencers will receive exactly the same control inputs. one set of control Signals is sufficient. Table 8-11 shows the six control signals RE. S1. SO. ZERO. CN. FE. and PUP being gener- ated by individual microinstruction bits. But earlierwe generated these control codes out of a read-only memory. In the discussion which follows we will compare these two methods of generating control inputs. Microinstruction 1 in Table 8-11 copies the divisor into a temporary register. If the divisor is not O. the next se- quential microinstruction must be executed. If the divisor is O. microprogram execution must be aborted. since you cannot divide by O. The most significant 2903 slice outputs Z high if the divisor is O. Z is output tow if the divisor is not O. The Z status is output at the end of the microinstruction 1 microcycle. too late to influence 2911 Microprogram Se- quencer logic. Microinstruction 1. therefore. provides the 2911 with data needed to evaluate the Z status while microinstruction 2 is executing. SO and S 1 are both low while CN is high; therefore.while microinstruction 1 is execut- ing. the 2911 Output Multiplexer selects the Microprogram Counter as its source. then increments the Microprogram Counter contents. Thus. the next sequential microinstruction. microinstruction 2. is selected. Simultaneously. microinstruction 1 inputs the abort address to the 2911 Address register. The abort address is input at DO-D7 while RE is low. If logic associated with execution of microinstruction 2 conflicted in any way with testing the Z status. then we would have to insert a dummy microinstruction in front of microinstruction 2. whose sole function would be to test the Z status. But microinstruction 2 has no such conflicting logic. so we can use its execution time to test the ZERO status generated by microinstruction 1. If this ZERO status is 1. then the abort address. input to the Address register by microinstruction 1. will be selected; execution of microinstruction 2 becomes redundant insofar as 2903 logic events are concerned. but. providing execution of microinstruction 2 is inconsequential. no harm is done. The 2911 bits provided by microinstruction 2 can be quite simple. S1 is 0 and SO is connected to the ZERO status; if the ZERO status is O. the Output Multiplexer will select the Microprogram Counter - and thus the next sequential in- struction. But if the ZERO status is 1. the Address register will be selected by the Output Multiplexer - and thus an abort will occur. In order to connect SO to a ZERO status we would probably include an additional enable bit. not shown in microinstruction 2. This enable bit. when high. will link SO to the ZERO status. but when low will cause SO to be 8-106 SO Bit _ _ I:F_-so derived directly from its microinstruction bit. This may be illustrated as follows: ENABLE - ZERO---- Addressing logic for microinstructions 3 and 4 is similar to that which we have just described for microinstruc- tions 1 and 2. Microinstruction 3 converts the most significant half of the dividend from twos complement to sign/magnitude form. If the dividend has the largest possible twos complement value. then the Overflow status is setand the dividend must be downshifted. If the dividend has any other twos complement value. the Overflow status is not set and the next sequen- tial instruction must be executed. But as we found when examining microinstruction 1. the Overflow status is gener- ated at the end of the microinstruction 3 microcycle. therefore the 2911 bits shown in Table 8-11 for microinstruction 3 simply select the next sequential microinstruction - microinstruction 4. But while microinstruction 4 is being ex- ecuted. 2911 logic tests the Overflow status generated by microinstruction 3. Now we can delay testing microinstruc- tion 3 Overflow status until microinstruction 4 has been executed because execution of microinstruction 4 does not conflict with Overflow = 1. If it did. we would have to insert a dummy microinstruction between 3 and 4 which did nothing at the 2903. but gave the 2911 an additional microcycle time within which to test the Overflow status gener- ated by microinstruction 3. and determine subsequent addressing based on Overflow status level. Since this additional dummy instruction is not needed. microinstruction 4 provides the address for the "Scale Oividend" subroutine via data bits 00-07. Two sets of control inputs are generated. If the Overflow status left over from microinstruction 3 is 0 then the control inputs to the 2911 simply select the next sequential microinstruction - microinstruction 5. But if the Over- flow status left over from microinstruction 3 is 1 then control inputs cause the 2911 to push Microprogram Counter contents onto the Stack. then have the Output Multiplexer choose as its source the address input at 00-07. Thus the scale dividend subroutine is called. If you look at the 2911 control bits of microinstruction 4 in Table 8-11. you will see that three bits. SO. S1. and FE. must change. depending on the level of the Overflow status left over from the execution of microinStruction 3. PUP need not change. since its level is not significant when OVR is low. We could control all three bit levels using an enable bit. as described for the ZERO status in microinstruction 2. But it is probably simpler and cheaper to use a read-only memory device. as suggested earlier in this chapter. Consider the following possibility: Control Bits ~ D7 D6' D5 D4 D3 D2 D1 DO A4 A3 A2 A 1 AO Microinstruction bits for 2911 ZERO-----------------+-+--+-+--+---------} OVR-------------------------r--r--r-~~~------------­ C(N+4)---------------------------~~~~~~~-------------- ;i~ess Instead of having seven separate 2911 control bits in every microinstruction. we now have five control bits. Three status bits (ZERO. OVR. and C(N+41. generated by the 2903) provide the three low-order bits for an 8-bit read-only memory address. The five microinstruction control bits. together with the three status bits generated by the 2903, create an 8-bit read-only memory address. The addressed read-only memory location outputs the seven signal levels required by the 2911. For microinstructions 1 through 4, read-only memory might arbitrarily be mapped as shown in Figure 8-35. Microinstruction 5 has 2911 addressing bits that are similar to microinstruction 4. Microinstruction 4 not only tests the Overflow status left over from microinstruction 3. but itself generates an Overflow status which must be tested while microinstruction 5 is being executed. In the event that the 2903 Overflow status generated by microinstruction 4 is low. the next sequential microinstruction. microinstruction 6. is selected. But if the Overflow status is high. then a branch to microinstruction 8 occurs. Since this is a simple branch. no push is required; therefore FE remains high in both cases. See Figure 8-35. 8-107 Address Bits from Status from Sync/Enable Microinstruction 2903 ROM Map ~ A4 A3 A2 A 1 AO ~ 0~ IffiN (j X RE S1 SO I~ eN FE ~ o o 1 o0 0 oo 01 X X X X X I-----------,~(J 0 L-_ _ _ _ _ _ _---. 1 000 1 1 00001110 1 0 2 000 I I I 2 000 o 1 X X 1 I I I I I I I I I 3 o 0 1 o 0 X X X ~---- 7 o 0 o 0 1 0 4 000 10XOX ~ o 1 0 X 1 X __ 8 1 o 0 1 0 4 5 000 o0 0 11 XOX - +_. 9 A o o 1 1 o 1 o 0 1 1 0 0 5 000 1 1 X 1 X _ B o 1 o 1 1 0 6 001 o 0 X X X ~------. C o 1 a a 1 0 7 o 0 o 0 X X X ~------. D o 1 o 1 1 0 8 o 0 010 X X ~--- E o 1 o 0 1 0 o o X X 1------, 0 -- 8 1 1 o F 1 o 1 1 0 9 o 0 o 0 X X X I----~_+. 10 o 1 o 0 1 0 10 o 0 1 0 X X 0 r--- o o 10 11 o o 0 0 1 1 0 1 X X X X 1 I-- X f- -- 11 12 13 o o 1 1 1 1 1 0 1 1 1 o o 0 1 1 - 14 o 1 o 0 1 0 -- 15 o 1 o 0 1 0 --- 16 17 o o 1 1 1 1 1 1 o o 1 1 -- 18 o 1 o 0 1 0 19 o 1 a 0 1 0 o -- 1A 1 1 1 1 0 1B o 1 1 1 1 0 1C o 1 o 0 1 0 --- 1D o 1 o 0 1 0 - 1E 1F 20 o o o 1 1 1 1 1 o 1 1 0 1 1 1 0 0 0 -- I I I I I I I I I I I I 27 o o o 1 1 1 o 28 o o o 1 1 1 o 29 o a o 1 1 1 o - ~ 2A o o o 1 1 1 o ~ 2B o o o 1 1 1 o / 2C o 1 1 1 1 o 1 , 2D o o - L-_ _ _ _ _ _ ~~ ~ 2E 2F o o 1 1 1 1 1 1 1 1 1 1 1 1 o o 1 1 1 ---------~--.\~ o o o 1 o o -- 30 1 31 o o o 1 1 1 o 32 o o o 1 o 1 o - 33 o o o 1 o .... -------~_=_~ 34 0 1 0 0 1 0 1 0 ...I----------~:-- 35 0 1 0 0 1 1 1 0 L-_ _ _ _ _ _ _~--~ 36 0 1 0 0 1 0 1 0 L-_ _ _ _ _ _ _ _~~~ 37 a 1 0 0 1 1 1 0 38 0 1 • 1 I 0 I 1 I 1 I 0 0 L-_ _ _ _ _ _ _ _ _ ~. J ,• II I I I I I I I - t 3F i 0 i 1 i 1 i 0 i 1 I 1 i 0 i 0 Figure 8-35. 2911 Sync/Enable ROM for the 2903 Twos Complement Binary Division Microprogram Subroutine 8-108 Microinstructions 6 and 7 both have very simple 2911 addressing logic. Each microinstruction chooses the next sequential microinstruction. But the Carry status generated by the 2903 following execution of microinstruction 7 must be tested by address generation logic while microinstruction 8 is being executed. The fact that microinstruction 5 can branch directly to microinstruction 8 causes no problem since microinstruction 5 will always generate a low 2903 Carry status: thereforhe Carry status testing logic which we are about to describe does no harm. If the Carry status generated by the 2903 during execution of microinstruction 7 is low. then no further divisor or divi- dend scaling is needed. and the next sequential microinstruction is selected. But if the 2903 generates a high Carry status while executing microinstruction 7. then a subroutine must be called to scale the divisor or dividend. Therefore microinstruction 8 provides the address of the scaling subroutine at the data inputs DO-D7; it generates the same two sets of 2911 control inputs which we described for microinstruction 4. However. the level of C(N+4) determines which set of 2911 control inputs are selected by microinstruction 8. See Figure 8-35. We now come to the last three microinstructions (9, 10, and 11) which together perform the actual twos com- plement binary division. Microinstruction 9 must be executed once. followed by fourteen executions of microinstruc- tion 10. and one execution of 11. Fourteen executions of microinstruction 10 are required because we are dividing a 16-bit divisor into a 32-bit dividend. From our previous discussion of the twos complement binary division algorithm. recall that microinstruction 10 must be executed N times. where the divisor has N bits and the dividend has 2N bits. Our 2911 addressing logic implements this multiple execution requirement by keeping the CN input low for thirteen executions of microinstruction 10. But this requires an external counter. Here is one possibility: A4 A 3 - -....._ ENABLE x, 4 Counter. A2 advanced A1--_-- by ENABLE AO -.r- ZERO--------~ There are innumerable ways (including the use of a 2910) in which the counting logic required to augment microinstruction 10 may be implemented. The one we have shown assigns one set of eight read-only memory ad- dresses to a preloaded counter. This preloaded counter provides the level of the low-order address bit (zero) which must be input to the 2911 select ROM. The preloaded counter decrements once every time ENABLE goes high: it outputs COUNT low until it decrements to O. Upon decrementing to 0 the counter outputs COUNT high. Apart from the external counter required by microinstruction 10. microinstructions 9 and 10 generate simple next se- quential address controls for the 2911. Microinstruction 11 causes the 2911 to pop its Stack - on the assumption that the entire twos complement binary division microprogram is itself a microprogram subroutine. Thus. if a read-only memory is used to generate 2911 control inputs Figure 8-35 illustrates the final read-only memory map and address- ing bits required for the microinstruction sequence given in Table 8-11. 8-109 THE 2910 MICROPROGRAM SEQUENCER This device is an enhancement of the 2909/2911 Microprogram Sequencers which we have just described. Here is a summary of 2910 enhancements, as compared to the 2909 and 2911: 1) The 2910 is a 12-bit device capable of addressing up to 4096 microinstructions. The 2909 and 2911 are 4-bit devices. Therefore the 2910 is equivalent to three parallel 290912911 devices. 2) The 2910 has sixteen address generation sequences, selected individually via four instruction code inputs. Many of these sixteen address generation sequences have alternate forms that depend on the level of a condition code. The 2909/2'911 has no such address generation sequences; rather. individual control signal levels (such as output selects SO and S 1. and output masks ORO-OR3) provide more primitive control of addressing logic. 3) The 2910 has three enable signals. One of the three is output low on each microcycle. You can use these enable signals to selectively strobe data out of different sources to meet the specific needs of any microcycle. The 2909 and 2911 have no such enable outputs. 4) The Address register of the 290912911 becomes an Address register or a down counter within the 2910. As a down counter. the 2910 Address register controls loop iteration. 5) The 2910 has a five-level Stack. as compared to the 2909/2911 four-level Stack. Also, the 2910 has slightly different Stack Pointer logic. The fact that the 2910 is an enhancement of the 2909/2911 does not necessarily mean that the 2910 is always the part of choice. The 2910 is more expensive. In most cases, a small microprogram consisting of 256 or fewer microinstructions is more economically served by two 2909 or 2911 devices. rather than a single 2910 device. The 2910 is packaged as a 40-pin DIP or a 42-pin flat package. The device is manufactured using bipolar technology. A single +5V power supply is required. All signals are TTL-level compatible. 2910 MICROPROGRAM SEQUENCER PINS AND SIGNALS For an overview of Microprogram Sequencer logic, and how it is used within a 2900-based system. refer to our earlier discussion of this subject given for the 290912911 devices. The discussion which follows assumes that you understand how a Microprogram Sequencer fits into a 2900-based configuration. 2910 pins and signal assignments are illustrated in Figure 8-35. Figure 8-37 illustrates 2910 functional logic. We will describe signals in conjunction with functional logic. The Output Multiplexer is central to logic of the 2910 Microprogram Sequencer. An in- 2910 struction code input via 10-13 determines which of the four possible inputs will be MICROPROGRAM selected by the Output Multiplexer. In contrast. the 2909 and 2911 have two control inputs. COUNTER SO and S 1. that determine the source which the Output Mu Itiplexer selects. 00-011 are twelve data input lines Which, like the 2911, can input data to the Address register, or to the Output Multiplexer. If RLO is low, then data input at 00-011 is loaded into the Address register on the low-to-high transition of clock signal CPo Data input via 00- 011 is selected by the Output Multiplexer when an appropriate instruction is input via 10-13. Timing for an Address register access may be illustrated as follows: CP DO - D11 Address-----------v-------~'--------------- Data Register _ _ _ _ _ _ _ _ _ _ _,,_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ The 2910 outputs the microprogram address via VO-V11. These address output lines have 2910 their own enable signal OE. If this signal is high. YO-Y11 outputs are floated. This allows you to ADDRESS disconnect Microprogram Sequencer devices from the microprogram ROM. something you will OUTPUT likely do when switching to a test program. 8-110 Y4 1 40 03 03 1 42 Y3 04 2 39 Y3 Y4 2 41 GNO Y5 3 38 02 04 3 40 02 05 4 37 Y2 Y5 4 39 Y2 VECT 5 36 01 05 5 38 01 Pi:: 6 35 Yl VECT 6 37 Yl MAP 7 34 DO PL 7 36 DO 13 8 33 YO MAP 8 35 YO 12 9 32 CI 13 9 34 CI VCC 10 2910 31 CP 12 10 2910 33 CP 11 11 DIP 30 GNO VCC 11 FLAT 32 GNO 10 12 29 OE 11 12 PACKAGE 31 OE CCEN 13 28 Yll 10 13 30 Yll CC 14 27 011 CCEN 14 29 011 RLD 15 26 Yl0 CC 15 28 Yl0 FULL 16 25 010 RLO 16 27 010 06 17 24 Y9 FULL 17 26 Y9 Y6 18 23 09 06 18 25 09 07 19 22 Y8 Y6 19 24 GNO Y7 20 21 08 07 20 23 Y8 Y7 21 22 08 Pin Name Description Type DO - 011 Combined Address register and data input Input YO - Yll Address output Output. Tristate VECT Vector address enable Output MAP Map address enable Output PI: Pipeline address enable Output RLO Address register input enable Input OE Output enable Input CI Carry in Input 10 -13 Instruction code Input CC Condition code Input CCEN Condition code enable Input FULL Stack full error indicator Output CP System clock Input VCC.GNO Power. Ground Figure 8-36. 2910 Microprogram Sequencer Pins and Signal Assignments 8-111 ~ Address Register/ Stack Zero ~ Down Counter Pointer l---- i 5- ~_ _ _ _ _ _ _ ___ _--------I.--f- by -~ , DO-Dll&~~ _-------T"""""--I~ 12-Bit_1'r-- Stack Microprogram ~ Counter ~ Output Multiplexer ~ r J'\. '" Incrementer - CI OE------------------~••~ ++++++ .- I0 ---- ::::: I1 I2 Control I3 ~ Logic - CC - - CCEN v' YO - Y11 Figure 8-37. 2910 Microprogram Sequencer Functional Logic 8-112 Note that the 2910 has no zero input control on the address output lines. nor does it have any OR mask inputs. The 2909 and 2911 have such logic on the address output path. Instead. the 2910 uses its instruction codes to generate equ iva lent addressing logic. Like the 2909 and the 2911. the 2910 has two internal locations within which addresses can be held. These are the Microprogram Counter and the Stack. The 2910 Microprogram Counter logic is functionally identical to that of the 290912911 2910 Microprogram Counter. Any address output by the output multiplexer also passes through MICROPROGRAM the incrementer, and is then stored in the Microprogram Counter. If CI is input high, then COUNTER the address output by the multiplexer is incremented by 1 before being written to the 2910 Microprogram Counter. If CI is input low. then the address is written into the Microprogram INCREMENT Counter without being incremented. The 2910 incrementer generates no Carry Out. Thus if you connect two 2910 Microprogram Sequencers in parallel. you cannot increment the resultant 24-bit Microprogram Counter contents across the low- and high-order halves of the ad- dress. But. given current microprogramming technology. this is unlikely to pose any problem. Few single microprograms have more than 4096 microinstructions. and you can use multiple 2910 Microprogram Sequencers to address large microprograms in discrete 4096-microinstruction blocks. The 2910 Microprogram Sequencer has a five-level Stack. The Stack is addressed by a Stack Pointer which initially addresses Stack Register O. Appropriate instruction codes. input via 10-13. generate Stack pushes or pops. A Stack push writes the Microprogram Counter contents to the currently selected Stack location and then increments the Stack Pointer. The Stack Pointer always points to the last word written. A Stack pop decrements the Stack Pointer. You must select the Stack as the output mu Itiplexer source in order to load the current top-of-stack plus one via the incrementer into the Microprogram Counter. If you execute more than five pushes. the Stack Pointer continues to address the last Stack location (number 4); the Microprogram Counter contents are written into this location. overwriting prior data. This will inevitably cause an error. The 2910 Stack Pointer does not wrap around. and will not increment from 4 to O. Stack full is indicated by the FULL signal. When either four words have been pushed and a fifth push is selected via 10-13 or five words have been pushed. FULL goes low. Thus it can be tested to see if the Stack is full. If you try to pop the Stack when the Stack Pointer is addressing location O. then the Stack Pointer continues to select location O. Since no data is written into the Stack following a pop. no prior information will be destroyed: however. in all probability you have a microprogramming error. No error signal is output at this time. The various addressing operations which the 2910 Microprogram Sequencer can perform 2910 are identified using an instruction code input at 10-13. CCEN (condition code enable) and CC INSTRUCTION (condition code) are two additional control inputs that in some cases modify the addressing CODES operations which the 2910 Microprogram Sequencer will perform. These six 2910 signals- 10-13. CC. and CCEN - together replace the 290912911 signals SO. S 1. ZERO. ORO-OR3. FE. and PUP. 2910 responses to 10-13 inputs are summarized in Table 8-12. As shown in this table. many -~~- 2910 .... of the responses depend on the level of the CC and CCEN inputs. Vendor literature describes CC CONDITION as a "condition code" and CCEN as an enable: however. in effect. CCEN must be low while CC CODES is high to select a "fail" condition, while any other combination of CC and CCEN input levels select a "pass" condition. Your design logic can use CC as a pass/fail selector. with CCEN as an override. This logic may be illustrated as follows: ~------- Condition Code CC _ _ _ _ _ _ _ _ CCEN --L./ In response to each instruction code input at 10-13.2910 logic performs operations which we will describe individually. Also. 2910 logic outputs low one of the three Signals PI.. MAP. or VECT. You can use these three signals as you see fit. however their intended purpose is to enable one of three possible inputs to 00-011. Figure 8-38 functionally illus- trates timing for PL. MAP. and VECT as part of the 2910 microcycle response. VECT low will normally select a restart interrupt or other special address. MAP will normally enable the mapping ROM out of which a microprogram starting address is generated in response to a macroinstruction op-code. VECT and MAP are the exceptional enable outputs. PL is the enable signal which is usually output low. This signal will likely enable the Microinstruction register. or a connected Oata register. allowing the microinstruction to determine the next data input to appear at 00-011. With reference to Figure 8-31. Figure 8-~39 identifies how VECT. MAP and PL will likely be used. 8-113 1-- One Microcycle .. 14 I One Microcycle ~I I I I I I CP~ \ ~ \ I t\ DO - 011. 10 -13 I) } I Control .! II Inputs I I '- " YO - Y11 "I ~ I pC MAP t t or VECT I I Figure 8-38. 2910 Microcycle Eve:1t Sequences 2910 MICROPROGRAM SEQUENCER INSTRUCTIONS We will now examine 2910 Microprogram Sequencer instructions in detail. First, we will describe each instruc- tion individually, then we will look at the instructions functionally, showing when instructions are likely to be used, and in what combinations. Instruction 0 (JZ) is a Jump-to-Zero instruction. This instruction forces the address to be output at YO-Y11; therefore the Microprogram Counter will subsequently hold the address 0 or 1. depending on the level of the CI input The JZ instruction also resets the Stack Pointer to O. effectively clearing the Stack. Since this instruction restarts execu- tion with the microinstruction stored at microprogram memory location O. JZ is frequently used as a power-up. reset. or Restart instruction code. Instruction 1 (CJS) is a Conditional Jump-to-Subroutine instruction. A "pass" condition pushes the current Microprogram Counter contents onto the Stack and takes the next microinstruction address from the 00-011 inputs. A "fail" condition causes the next sequential microinstruction to be executed. This may be illustrated as follows: M- Address HM" must be input at DO - 011. Address "N+ 1" is saved on the Stack. 8-114 Macroinstruction D Macroinstruction Register --------JJ -- OE Mapping PROM/ROM Restart Address Register "' II.. ~~ OE ) 2910 Microprogram Sequencer ~10 Control Inputs v J Microprogram PROM/ROM J L----t.~~M Address "P" must have been loaded "fail" "pass" Address "M" input at DO must be - 011. previously into The return address the Address register. The return address + N N+ 1 "N+ 1" is pushed onto the Stack "N+ 1" is pushed onto the Stack Instruction code 6 is a Conditional Jump Vector (CJV). It is significant principally because it is the only instruction code which generates a low VECT output. This low output usually enables a special Address register, out of which a direct memory access or interrupt address is fetched. If CC is in the "pass" condition, then the output multiplexer takes as its source DO-D11. If CC is in the "fail" condition, the next sequential instruction is executed. Instruction code 'is a Conditional Jump (JRP) which differs from the Conditional Jump-to-Subroutine (instruction code 5) only in that no push occurs. If the condition code "passes", then the microinstruction execution sequence jumps to the address which is input at DO-D11; otherwise, the microinstruction sequence jumps to the address held in the Address register. This may be illustrated as follows: I-------- have been loaded l "faW' Address uP" must P - - - - - - - - previously into the Address register. N + "pass" l. M Address "M" must be input at DO - 0 11 . Instruction code 8 is a Repeat-Loop-Until-Counter-Is-Zero (RFCT) instruction. The purpose of this instruction code is to re-execute one or more microinstructions some fixed number of times. The microinstruction loop to be re-executed has its starting address stored in the Stack. The loop count is handled by the Address register. which must be preloaded with a number that is one less than the required count. For example, if the Address register is loaded with an initial value of 8, then the microinstruction loop will be executed 9 times. Thus, you can load into the Address register values ranging between 0 and 4095 to generate counts ranging between 1 and 4096. 8-117 When the 2910 receives an RFCT instruction code, it examines the Address register contents. If the Address register does not contain 0, then the output multiplexer takes as its source the currently addressed Stack location; the Address register contents are then decremented. If the Address register contents are 0, then the output multiplexer selects the Microprogram Counter as its source; also the Stack is popped. We can illustrate the RFCT instruction code as follows: M~:=J Address "M" must have been pushed onto the Stack. Address register <: - -- N contains O. -N+ 1 ~ Pop Stack. Address register does not contain O. Decrement Address register. Now the RFCT instruction, as illustrated above, re-executes a loop if the branch address M precedes N, where N is the microprogram location. But you can push any address onto the Stack prior to executing an RFCT code. For example, RFCT could be used to branch some fixed number of times without re-executing a loop. This may be illustrated as follows: Add"", "",;,... C---- Nt ___ ---- M contains Po O. St ck. p a --N+ 1 ~ Address reg,st~r . 1 does not contain O. Decrement Address "M" must have been pushed onto the Stack. Address register and branch· to "M". Instruction code 9, the Repeat-Register-Until-Counter-Is-Zero (RPCT) instruction, is almost identical to instruc- tion code 8. RPCT again uses the Address register as a counter. If when RPCT is executed the Address register does not contain 0, then it is decremented and the output multiplexer chooses as its source an immediate address input at 00- 011. If the Address register contents are 0, then the output multiplexer selects as its source the Microprogram Counter. The Stack is not used. If the microinstruction which generates the RPCT code supplies its own address at 00-011, then this microinstruction gets re-executed the number of times specified by the Address register contents. This may be illustrated as follows: Address register contains O. Pop Stack. C-- -- Nl---, --N+1+~--~N+1 Addn>ss "N+'" must be input at DO - 011. Address register does not contain O. Decrement Address register. But a microinstruction does not have to supply its own address at 00-011 when specifying the RPCT instruction code. It can input any address at 00-011. Thus, RPCT can be used to re-execute an instruction loop, or RPCT can be used to execute any other branch some fixed number of times, as illustrated for the RFCT instruction code. Instruction code A is a Conditional Return-from-Subroutine (CRTN).lf the condition code "passes", then a Return- from-Subroutine occurs. The output multiplexer takes the currently addressed Stack register as its source, then pops the Stack. If the condition code "fails", then the next microinstruction address is taken from the Microprogram Counter. This may be illustrated as follows: I .~ "N+1" must be the address currently in the top of the Stack. N+'~ N+~'M---~ w r ' "f T' .0 8-118 Instruction code B is a Conditional Jump-and-Return instruction (CJPP). If the condition code "passes", then the Stack is popped, but the output multiplexer takes 00-011 as its source. This is equivalent to a subroutine return where the return address is not taken from the Stack, even though the Stack is popped: rather, the return address is taken from 00-011. If the condition code "fails", then normal sequential microinstruction execution occurs with the next microinstruction address being taken from the Microprogram Counter. Instruction code C is a Load Counter instruction (LDCC). When this instruction code is executed, microprogram ex- ecution continues sequentially, with the output multiplexer taking the Microprogram Counter as its source: however, data input at 00-011 is loaded into the Address register. Instruction code 0 is a Conditional End-of-Loop (LOOP). As long as the condition code "fails", the output mUltiplex- er selects the currently addressed Stack register as its source. When the condition code "passes", the Microprogram Counter is selected as the output multiplexer source and the Stack is popped. This may be illustrated as follows: M ~=:J Address "M" must l have been pushed onto the Stack. "pass'<:'~: ~ "faW' The LOOP instruction code is equivalent to the RFCT instruction code, with the condition code, rather than the Address register, determining the number of loop iterations. The LOOP instruction code does not have to be used to re-execute a loop. In the illustration above a loop is re-executed only because the address M is shown preceding N, the microinstruction address where the loop code is generated. If the address M does not precede N, then the LOOP instruction code becomes a simple conditional jump, where the jump address is held at the top of the Stack. Instruction code E is a Continue instruction (CONT). This is the normal default instruction code. It causes the next sequential microinstruction to be addressed. The output multiplexer selects the Microprogram Counter as its source. No other operations occur. Instruction code F is a three-way branch (TWB); it uses the condition code and the Address register. Whether the condition code "passes" or "fails", the Address register contents are decremented to O. If the condition code "passes", then the Stack is popped and the Microprogram Counter is selected as the output multiplexer source. If the condition code "fails", then the Stack is selected by the output multiplexer while the Address register is decrementing, but when the Address register has decremented to 0, the Stack is popped and the output multiple~er selects as its source data in- put at DO-011. These options may be illustrated as follows: M~:=:J Address register does not contain O. Decrement address register. On "pass" decrement Address "M" must have been Address register to - - -- N "fail" pushed onto the Stack. "pass" 0, then pop <·"'N+1 Stack. I~' "fail" P Address register contains O. Address "P" must be input at DO - 011. The TWB instruction code is, in effect. a conditional loop execute. While the condition code is failing, the microinstruc- tion sequence between M and N is re-executed a number of times, as defined by the Address register: microprogram execution then branches to an address input at 00-011. But any single loop iteration can be bypassed by a "pass" con- dition code: moreover, when the Address register has decremented to 0, microprogram execution can continue se- quentially, or it can branch to the address input at 00-011. 8-119 2910 MICROPROGRAM SEQUENCER ADDRESSING SEQUENCES Let us now examine some of the more common microprogram address sequences which you are likely to en- counter, and how these address sequences will be generated using a 2910 Microprogram Sequencer. A simple sequence of consecutive microinstructions represents the simplest case: Address 2910 Instruction Sequence Code Sequence N CONT N+1 CONT N+2 CO NT N+3 CONT etc etc You generate sequential microinstruction addresses. as requ ired by the sequence above. using instruction code E. with the CI input high. You will likely initialize your microprogram in one of two ways: 2910 MICROPROGRAM 1) Following a restart or special condition. use instruction code 0 (JZ); this forces a 0 output INITIALIZATION at Y. 0 or 1 can be written to the Microprogram Counter - depending on the level of the CI input. 2) At the end of an instruction fetch. use instruction code 2 (JMAP) to take the microprogram starting address from a mapping ROM. We described this instruction code earlier. The 2910 Microprogram Sequencer gives you many ways of jumping within a 2910 microprogram. Any instruction code that causes the output multiplexer to select 00-011 or the MICROPROGRAM Address register as its source can be used to generate a microprogram jump. Instruction code 3 ...J_U ______~ __M_P (CJP) jumps to the address input at 00-011 if the condition code passes. So does instruction code 6 (CJV). but instruction code 6 (CJV) outputs VECT low - and the VECT enable signal is commonly used to select a special OMA or interrupt address. Instruction code 7 (JRP) is a dual. unconditional jump; if the condition code "passes". the jump address is taken from 00-011. while the jump address is taken from the Address register if the con- dition code "fails". A microprogram subroutine is called using instruction code 5 (JSRP). This instruction code 2910 pushes the Microprogram Counter contents onto the Stack; the subroutine starting address is MICROPROGRAM taken from 00-011 if the condition code "passes". and from the Address register if the condition JUMP-TO- code "fails". The Address register must have been preloaded with an appropriate starting address SUBROUTINE if the condition code "fails". Generally. instruction code C (LOCT) is used to load the Address register. A normal Return-from-Subroutine will use instruction code A (CRTN) with the condition code held "passing". There are two types of loop you may encounter in a microprogram. You may wish to re-execute a single microinstruction, or a sequence of microinstructions some number of times. The simplest way of re-executing a single microinstruction some fixed number of times is to load the Address register with a number one less than the required count. then issue instruction code 9 (RPCT). This may be illustrated as follows: Address 2910 Instruction Sequence Code Sequence N LOCT with M-1 to 00-D11 N+ 1 (M times) RPCT with N+1 to 00-011 N+2 CONT You can alternatively use instruction code 8 (RFCT) to re-execute a single microinstruction. but the microinstruction address must be preloaded onto the Stack. 8-120 ... More frequently. instruction code 8 (RFCT) will be used at the end of a multi-microinstruction loop. This may be illus- trated as follows: Address 2910 Instruction Sequence Code Sequence N PUSH with P-1 to DO-D11 and CC "passing" N+1 CO NT Re-execute N+2 CO NT loop N+1 - to N+M+1 - P times - [ N+M CO NT N+M+1 RFCT N+M+2 CO NT As illustrated above. the microinstruction preceding the loop must input instruction code 4 (PUSH) with the condition code passing. This simultaneously loads the count into the Address register while pushing the next sequential address onto the Stack. Subsequently instruction code 8 (RFCT) decrements the Address register. selecting the address which PUSH saved on the Stack. until the Address register has decremented to O. 2910 ADDRESSING EXAMPLE As we did for the 2911 Microprogram Sequencer, we will now look again at the twos complement binary divi- sion microprogram given in Table 8-9, adding address generation microinstruction bits needed by the 2910 Microprogram Sequencer. See Table 8-13. We are going to treat the twos complement binary division microprogram as a subroutine. We assume. therefore. that microinstruction 1 is executed following a Jump-to-Subroutine instruction code input to the 2910 Microprogram Se- quencer. Microinstruction 1 inputs a CONT instruction code to 10-13 of the 2910 Microprogram Sequencer. This causes the next sequential microinstruction to be executed. Since the 2910 does not sample its DO-D11 inputs. these bits are ir- relevant. CI is input high since the 2910 Microprogram Counter contents must increment. RLD and CCEN are high since no data is to be written into the Address register. and the condition code is not used. Although microinstruction 1 itself transmits the simplest possible addressing logic to the 2910. the ZERO status output by the 2903 while microinstruction 1 is executed contributes to microinstruction 2 address generation logic. The bin- ary division subroutine must be aborted if the divisor is O. This abort condition is indicated by a ZERO status output following execution of microinstruction 1. This ZERO status is output too late during microinstruction 1's microcycle to be considered by 2910 addressing logic during execution of microinstruction 1. Therefore, in the event that the subroutine must be aborted. microinstruction 2 gets executed gratuitously. but causes an abort exit from the subroutine after its gratuitous execution. The CJP instruction code is input to the 2910 Microprogram Sequencer by microinstruction 2 in order to achieve this end. This instruction code causes the next sequential microinstruction to be addressed if the condition code "fails", while the addressing input at DO-D11 is selected if the condition code "passes". The address of the microinstruction to be selected following an abort is therefore input via bits DO-D11. In order to enable the condition code. CCEN is low. CC must be connected to the complement of Z while microinstruction 2 is being executed. This allows the ZERO status output by the execution of microinstruction 1 to generate the CC in- put during microinstruction 2 - and thus generate an abort. if needed. We do not show the logic which causes CC to be connected to the complement of the 2903 Z status. There are many ways in which such "one time" connections can be made. Possibly the simplest technique is to add microinstruction bits which enable a specific NOR gate linking the 2910 CC input with the 2903 Z output. This may be illustrated as follows: CC----~----~L_~ z----------~L_~ 8-121 Table 8-13. The 2903 Twos Complement Binary Division Microprogram Subroutine from Table 8-9, with 2910 Addressing Microinstruction Fields Added Microinstruction No EA CN AO -A3 80 - 83 Comment 18 -15 14 -11 10 1 4 6 a a a Divisor register Divisor buffer Copy divisor to temporary buffer. (Ra) (R3) 2 4 6 a a a Dividend (MS) Dividend (MS) Copy dividend most significant half to temporary buffer. register (R 1 ) buffer (R2) 3 5 a a x a x Dividend (MS) Convert dividend (MS) from twos complement to sign/magnitude version. buffer (R2) Test aVR externally w/lile next microinstruction is being executed. If OVR is 1, branch to subroutine that downshifts dividend. 4 5 a a x a x Divisor buffer Convert divisor (MS) from twos complement to sign/magnitude version. (R3) Test aVR externally. If OVR is 1, branch to microinstruction 9. 5 9 4 a x a x Dividend (MS) Shift out sign bit of dividend (MS) half in temporary buffer. buffer (R2) 6 9 4 a x a x Divisor buffer Shift out sign bit of divisor in temporary buffer. (R3) 7 F 2 a a 1 Dividend (MS) Divisor buffer Subtract sign bit stripped divisor from sign bit stripped dividend (MS) half. buffer (R2) (R3) If Carry = 1 (dividend larger) branch to subroutine that downshifts dividend or upshifts divisor. 8 6 6 a a a Dividend (LS) X Copy dividend least significant half to Q register. register (R4) 9 A* a a a a Divisor register Dividend (MS) Double length normalize dividend in MS register and Q register. (Ra) register (Rll 10 c· a a a z Divisor register Dividend (MS) Execute twos complement divide instruction fourteen times. (Ra) register (R 1l 11 E a 0 0 Z Divisor register Dividend (MS) Twos complement divide final instruction. (Ra) register (Rll 'CN is connected to Z status while these two special functions are being executed. 8-122 Table 8-13. The 2903 Twos Complement Binary Oivision Microprogram Subroutine from Table 8-9. with 2910 Addressing Microinstruction Fields Added (Continued) Mlcrol••tnlcdon bl .. covering ZII03 ond ZII10 Inpu" IBlt poold.... ore ..... ltr1Iry ond hove no .1•• 111.....1 21103BI.. Z810 BI.. -- _'-...--'- 1817181111413 IZ 11 10 Ell eN A3A2Al AOB3 BZ Bl 80 13 IZ 11 10Dll Dl0 DII DB D7 D8 DII D4 D3 DZ Dl DO o 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 lOX X X X X X X X X X X X 1 1 1 Select .ext seque.tial instruction. 4 6000 RO R3 E=CONT 111 0100011000000010010 0011A A A A A A A A A A A :;,., 0 1 1 CC is generated by 2903 Z otatus ICC = ZI. Select next ~-e- 0 0 0 - ; ; ; - -;;-~ ~'-""-----""V' sequential microinstruction unless RO from microinstruction o 1 1 1 is O.. Then abort. ----- -- Address for abort o1 0 1 0 0 0 0 0 X 0 X X X X 0 O' 1 0 1 1 lOX X X X X X X X X X X X 1 1 1 Select next sequential instruction. 5 0 R2 E = CONT 1 1 1 o1 0 1 o0 0 0 0 ---..,-.' -- 5 9 0 1 o 0 1 o 1 o 0 0 X 4 0 X 0 0 X X X X 0 0 X X X X 0 --..,-.' 0 R3 --..,-.' R2 1 1 1 0 _ ~~ 1 = CJ5 o 0 1 1 ....... 3 = CJP B - S B 5 B 5 5 5 'V V 5 5 SC81e dividend subroutine B .!....B B B 5 B 5 B 5 B ~ ~ 0 0 0 0 1 1 1 1 1 1 1 1 CC is genarated by OVA st.tus. ICC = OVRI. Select next sequential instruction unless OVR = 1. Then call uscals dividend" subroutine. CC is generated by OVA status. ICC = OVRI. Select next sequential instruction unless OVA = 1. ---- Then branch to microinstruction 8. Microinstruction 8 address 1 0 0 1 () 1 0 0 0 X 0 X X X X 0 0 1 1 1 1 lOX X X X X X X X X X X X 1 1 1 5elect next sequential instruction. --..,-.' '-...--' - - . . , - . ' 9 4 R3 E = CONT 1 1 1 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 1 1 lOX X X X X X X X X X X X 1 1 1 5elect next sequential instruction. ---..,-.' '-...--' - - . . , - . ' - - . . , - . ' F 2 0 0 1 R2 R3 E = CONT 1 1 1 -- - o 1 1 o0 1 1 0 0 6 6 0 0 0 0 0 0 1 0 0 X X X X R4 ~-.!. 1 = CJ5 T - T T T T V T T T T T ~ 0 0 1 1 1 1 CC is generated by CIN+41. ICC = CIN+4H. Select next sequential instruction unless C(N+4) = 1. Then call "scale divisor or dividend" subroutine. -- Scale divisor or dividend subroutine 1 o 1 o0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 ~~ 0 0 0...2... 0 0......2.. 1 1 0 .J... 1 1 0 Load count into address register, push . - . - . ' '-...--' A 0 0 0 0 RO Rl 4 = PU5H 'V 1 1 0 next sequential instruction address onto Count = 13 Stack and select next sequential instruction. 10 1 1 0 0 0 0 0 0 0 0 X 0 0 0 0 0 0 0 1 1 0 0 0 X X X X X X X X X X X X 1 1 1 Re-execute instruction addraosed by 5tack until count --..,-.'.-.-.' --..,-.' ' - . . . - - ' - decrements to O. - - COO 0 RO Rl 8 = RFCT 1 1 1 11 1 1 1 0 0 0 0 0 0 0 X 0 0 0 0 0 0 0 1 1 0 1 0 X X X X X X X X X X X X 1 1 1 Ratum from subroutine. - -E- . . , - 0 .' 0 0 RO '-...--' Rl A = CRTN 1 1 1 x = "Oon't Care" bits While it may appear wasteful to dedicate a single microinstruction bit to enabling such a connection. perhaps only once in an entire microprogram. in fact the economics of microprogramming often favor wasting a single bit in this way. The alternative is to have additional logic which generates a particular input, from one of a variety of outputs. de- pending on complex combinations of circumstances. To evaluate this reasonin~ look at Table 8-13. where CC may be connected at different times to a Zero. Overflow or C(N+4) status. You cannot guarantee that the CC generation logic will be a known function of any bit field within the microinstruction. since the same bit field may recur somewhere else in the microprogram without having the same CC logic requirements. Your only alternative to dedicating a microinstruction bit to each CC generation possibility would be to decode the microinstruction address itself; and that would not be simple. Microinstruction 3 is another example of a microinstruction that generates a status output which contributes to subsequent addressing logic - but not until the next microinstruction. Microinstruction 3 itself provides the 2910 with a CaNT instruction code. which together with a high CI causes the next sequential microinstruction address to be output by the 2910. The data bits 00-011 are not used; RLO and CCEN are both high (i.e .. in the "off" state). At the 2903. microinstruction 3 performs a twos complement to sign/magnitude conversion on the contents of RAM location R2. If this operation generates a high Overflow status. then R2. which contains the high-order half of the dividend. must be scaled by shifting down one bit position. The subroutine should be called. if needed. after microinstruction 3 has been executed. and before microinstruction 4 is executed. But microinstruction 3 outputs OVR too late in its microcycle for this status to contribute to the next microinstruction address. Therefore microinstruction 4 provides the 2910 with addressing logic that tests the OVR status from microinstruction 3's execution. CJS. the Conditional Jump-to- Subroutine. is specified by inputting 1 as the 2910 instruction code. The address of microinstruction 1's subroutine is held in data field bits 00-011. CCEN is output low so that CC can be tested. CC must be connected to the complemen t of the 2903 OVR status output. If CC is low - and OVR is high - then the subroutine addressed by 00-011 will be called. Otherwise. since CI is high. the 2910 will output the next sequential microinstruction address - which is the address of microinstruction 5. RLO is output high since the address at 00-011 must not be written into the Address 8-123 register. As we did in instruction 2. again in microinstruction 4 an additional microinstruction bit will likely connect CC- to-OVR via NOR gates. And once again we will choose to waste this CC-to-OVR connector bit for the vast majority of microinstructions where such a connection does not apply. While microinstruction 4 provides the 2910 with addressing inputs that test the Overflow status generated by microinstruction 3, the Overflow status itself is mQdified by the 2903 while microinstruction 4 is being ex- ecuted. This presents no timing problems. since the 2910 has stopped sampling its CC input by the time microinstruc- tion 4 modifies the Overflow status. See Figure 8-~8. Microinstruction 5 must provide the 2910 with addressing inputs that account for the Overflow status gener- ated by microinstruction 4, just as microinstruction 4 had to provide the 2910 with addressing inputs that took into account the Overflow status generated by microinstruction 3. Microinstruction 5 causes the 2910 to execute a condi- tional jump. rather than a conditional subroutine call. since a high Overflow status generated by the 2903 while execut- ing microinstruction 4 requires microinstructions 5. 6. and 7 to be bypassed. We do not bypass microinstruction 5. since it is during this microinstruction's execution that the 2910 will test the Overflow status from microinstruction 4 - and determine if a jump is required. This would present a problem if execution of microinstruction 5 upset the 2903 logic sequence; but it does not. If executed unnecessarily no harm is done. But remember. there may be circum- stances under which you may have to insert a dummy microinstruction that generates no operation at a 2903. but gives the 2910 time to test 2903 status from the previous microinstruction. In our present example microinstruction 5 inputs a CJP instruction code at 10-13 of the 2910 and the address of microinstruction 8 at DO-D11. CCEN is low so that 2910 condition code logic will sample CC. which remains connected to the 2903 OVR status. as it was during execution of microinStruction 4. RLD is high so that the address input at DO- D11 does not get written into the Address register. CI is high since the next sequential microinstruction must be selected if OVR is low - and the condition code test "fails". If the condition code test "fails" at the 2910 during execution of microinstruction 5. then microinstructions 6 and 7 are next executed sequentially. Each of these microinstructions provides the 2910 with a simple CONT input at 10-13. no data inputs. and CCEN and RLD disabled with CI high. so that the Microprogram Counter will increment Microinstruction 7 subtracts modified versions of the divisor from the dividend. If the Carry Out generated by the 2903 at C(N+4) is 1. then the divisor must be upshifted (or the dividend must be downshifted) in order to guarantee that the divisor ultimately has the larger absolute value C(N+4) is generated by the 2903 at the end of the microinstruction 7 microcycle - too late for the 2910 to take this status output into account until the next microcycle. during which microinstruction 8 is executed. In Table $~13 we show microinstruction 8 providing a Conditional-Jump-to- Subroutine input to 10-13, with a subroutine address input to 00-011. This 2910 addressing logic is identical to that which we have already described for microinstruction 4. except that the condition code CC will now be connected to the 2903 C(N+4) output - again via a special enabling microinstruction bit The fact that microinstruction 5 might have caused the 2910 to generate a branch to microinstruction 8 is not a problem. since C(N+4) will be low following execution of microinstruction 5: therefore if microinstruction 8 is executed next. the condition code must fail Microinstruction 9 is executed after microinstruction 8 - possibly with a scaling subroutine executed in between Microinstruction 9 prepares the 2910 for execution of microinstruction 10. A PUSH Instruction code is Input at 10- 14. with a count input at DO-D11. RLD is low so that the count gets written into the Address register. The 2910 then outputs the address of microinstruction 10 since CI is high - so the Microprogram Counter gets incremented MicroinstrlJction 10 outputs an RFCT instruction code to the 2910 via 10-13:This Instruction code causes the 2910 to output the address held at the top of the Stack until the Address register decrements to zero The push performed by the 2910 while microinstruction 9 was executing loaded microinstruction 10's address onto the Stack. therefore microinstruction 10 gets re-executed 13 times - for a total of 14 executions After the Address register has decremented 13 times to O. the RFCT instruction code causes the 2910 to output the next sequential instruction - that of microinstruction 11. This is the terminating microinstruction for the twos com- plement binary division microprogram subroutine Therefore a Return-from-Subroutine code. CRTN. IS transmitted to the 2910 via 10-13 In order to force a pass condition. this being a Conditional Subroutine Return Instruction. code CCEN IS output high 8-124 THE 2930 AND 2932 PROGRAM CONTROL UNITS These two parts were designed to provide assembly language instructions with their memory address genera- tion logic. The internal architecture of these two devices approximates II 2901 whose local RAM has been con- verted into a Stack, while the Q register functions as a local data register. In reality. the 2930 series devices are hybrid parts that may substitute for 2909/10/11 Microprogram Sequen- cers, or they may be used separately to implement assembly language instructions' memory addressing logic. The 2930 series devices are probably more effective as microprogram sequencers. In this role you need only make sure that timing requirements of the 2930 series devices are compatible with the 2901 or 2903 central logic you are using. But as assembly language memory address generators 2930 series devices leave a great deal to be desired. They cannot cope with indirect memory addreSSing. since by its very definition indirect memory addreSSing requires inter- mediate access of external memory. Also. most minicomputer and microcomputer assembly languages depend on an external memory stack which cannot be implemented within the small. local stack provided by 2930 series devices. Therefore. 2930 series devices do little more than add indexes to base addresses. But the value of 2930 series devices increases dramatically when you are not building a general purpose central processing unit. If you are building dedi- cated CPU-based logic that uses both microcode and higher level instructions. then you can probably avoid indirect ad- dressing. and you can work with the limited 2930 series stack. The 2930 series devices are both 4-bit slices. The 2930 is the most advanced of the two devices; it is fully cascadable and packaged as a 28-pin DIP. The 2932 device is packaged as a 20-pin DIP and is also cascadable. These two devices differ only in their internal instruction logic. Both 2930 devices are manufactured using bipolar technology: they use a single +5V power supply and have TTL-level compatible signals. 2930/32 DEVICE PINS AND SIGNALS We will describe pins and signal assignments for these two devices together, and in conjunction with their functional logic. Device pins and signals are illustrated in Figure 8-40. Functional logic is illustrated in Figure 8-41. The Adder is central to 2930 series operations. The Adder accepts one or two operands as inputs. and generates a single output. The Adder can perform three different operations: 1) It can add (with carry) the two operand inputs. CN determines the level of the carry during addition. 2) It can increment a single operand by adding CN to the operand. 3) It can output a single operand unaltered. Rand S in Figure 8-41 are the two Adder operands. The R operand can have one of three 2930 SERIES sources. The S operand can have one of four sources. An instruction code selects the source for INSTRUCTION the Rand S operands. together with Adder operations. The 2930 has a 5-bit instruction code, CODES input at 10-14. The 2932 has a 4-bit instruction code, input at 10-13. These instruction codes do more than control logic around the Adder and its inputs. they also control the Stack Accumu lator and Program Counter. as summarized in Table 8-14.. This table is keyed to the 2930. The set of 2932 instruction codes is a subset of the 2930 instruction code set. and is so identified. The 2930 allows you to enable or disable the Adder output using the output enable signal OE. The 2932 has no such output enable signal: Adder output from this device is always enabled. But when OE is input high to the 2930 the YO-Y3 outputs are floated. Data may be held in three different places within 2930 series devices: these three places are the Accumulator. the Pro- gram Counter. and the Stack. The Accumulator is a single 4-bit location that can receive data input via 00-03, or it can 2930 SERIES receive output from the Adder. The instruction code determines which of the two inputs. if ACCUMULATOR either. will be written into the Accumulator. The 2930. but not the 2932. has a separate Ac- cumulator enable control signal RE. This enable control signal is subordinate to the instruction code. The level of RE is unimportant when the instruction code specifies that data will be written into the Accumulator. For other instruction codes. a low RE input causes immediate data at 00-03 to be written into the Accumulator. 8-125 . - ...-- -- ..- 10 1 28 VCC (+5V) 10 1 20 --- 2 27 11 FULL 2 19 - -I VCC(+5V) 11 ----- -- --- EMPTY 3 26 12 CI 3 18 12 ..- ----- CI 4 25 13 C(I+4) 4 17 - 13 -- OE 5 24 14 CN 5 2932 16 DO C(I+4) 6 23 ---...... CC YO --- 6 15 01 CN YO 7 8 2930 22 21 ---- lEN RE Y1 Y2 -- 7 8 14 13 --- . 02 03 ---- -- -- Y1 9 20 DO Y3 9 12 C(N+4) Y2 10 19 - --- 01 GND 10 11 CP Y3 G 11 18 - 02 -... - 12 17 03 C(N+4) .- GND - 13 14 16 15 P CP Pin Name Description Type DO - 03 Data input Input YO - Y3 Address output Output RE Register input enable Input OE Address output enable Input 10 - 14/10 - 13 Instruction input Input lEN Instruction enable Input CC Instruction condition code Input CI Program Counter carry in Input C(I+4) Program Counter carry out Output CN Adder carry in Input C(N+4) Adder carry out Output G Adder carry generate Output P Adder carry propagate Output FULL Stack full indicator Output EMPTY Stack empty indicator Output CP Device clock Input VCC. GND Power. Ground Figure 8-40. 2930/32 Program Control Units Signals and Pin Assignments 8-126 DO - 03 h - 1 -----.. 1 . Accumulator > 17 x 4 Bit Stack - - -----.. FULL ~ lii1v: 0 0 ("< J . ,,l, ~ , 'Ii ~ ~ J R S A 3-IN MUX 4-IN MUX " ~ .. .1 R '1\ ~ S . Program 7 CN ~ Adder Counter ),~ "~ 7 (' - ::: ~ -- CI Incrementer -~ C(i+4) j II - Instruction Decoder YO - Y3 These signals are present in the 2930, but not the 2932. Figure 8-41. Functional Logic for 2930 Series Program Control Units 8-127 Table 8-14. 2930 Series Program Control Unit Instruction Codes Summary Instruction Accumulator 2932(4) Code Output New PC Stack Instructions Comment Contents atYO-V3 Contents (1) Operation No. 1413121110 No. 131211 10 0 0000 0 0 CI [D) O-[SP) 0 o0 0 0 Device resat 1 0000 1 [PC) [PC) + CI [D) None 4 o1 o0 Output p.rogram Counter contents 2 000 1 0 [R) [PC) + CI [D) None 8 1 0 0 0 Output Accumulator contents 3 000 1 1 [D) [PC) + CI [D) None Output immediete data 4 00 1 0 0 [R) + [D) + CN [PC) + CI [D) None Output sum of Accumulator contents and immediate data 5 001 0 1 [PC) + [D) + CN [PC) + CI [D) None Output sum of Program Counter and i ~ 6 7 8 00 1 1 0 00 1 1 1 o 1 00 0 [PC) + (RI + CN [S) + [D) + CN [PC) [PC) + CI [PC) + CI [PC) + CI [D) [D) [PC)· None None None 9 A 1 0.,0 1 1 0 1 0 immediata data Output sum of Program Counter and Accumulator Output sum of Stack and immediate data Output Program Counter contents and 1 ";: 9 o 1 o0 1 [R) + (D) + CN [PC) + CI [R) + [D) + CN· None unconditionally loed Accumulator Output sum of Accumulator and immediate 1 ;:, A o1o1 0 o1 o1 1 [PC) [PC) [PC) + CI [PC) + CI [OJ" [D) None PUSH [PC) F 6 1 1 1 1 o1 1 0 data. and unconditionally loed Accumulator Output Program Counter contents. Uncondition- ally loed immediate data into Accumulator Output and push Program Counter contents 8 C o1 10 0 [PC) [PC) + CI ~D) PUSH [0) 2 o0 1 0 Output Program Counter contents and push immediate data 0 01 1 0 1 [S) [PC) + CI [D) POP Pop and output Stack E o1 1 10 [PC) [PC) + CI [D) POP 3 00 1 1 Output Program Counter and pop Stack F 01 1 1 1 [PC) [PC) [D) None Output and hold Program Counter 10 1 000 0 [R) [R + CI [D) None 8 1 0 1 1 Jump to address in Accumulator 11 1 000 1 [D) [D) + CI [D) None 5 o1 0 1 Jump to address given by immediate data 12 1 0 0 1 0 0 CI [D) None Jump to "0" 13 1 00 1 1 [R) + [D) + CN [R) + [D) [0] None Jump to address given by sum of Accumulator + CN + CI and immeidate data 14 1 0 1 0 0 [PC) + [D) + CN [PC) + [D) [0] None Jump to address given by sum of Program Counter § + CN + CI contents and immediate data i 15 1 0 1 0 1 [PC) + [R] + CN [PC] + [R] [0] None C 1 1 o0 Jump to address given by sum of Program Counter + CN + CI and Accumulator contents i ~ 16 17 18 1 0 1 1 0 1 0 1 1 1 1 1 00 0 [R) [0] 0 [R) + CI [D) + CI CI [0] [D) [0] PUSH [PC) PUSH [PC) PUSH [PC) 0 1 1 o 1 Jump to subroutine addrassed by Accumulator Jump to subroutine addrassed by immediate data Jump to subroutine origined at 0 [R) + [0] + CN [R] + [D) PUSH [PC) Jump to subroutine addressed by sum of 1 19 1 1 00 1 [PC) + [0] + CN + CN + CI [PC] + [0] [D) [0] PUSH [PC) Accumulator contents and immediate data Jump to subroutine addressed by sum of J lA 1 1 0 1 0 + CN + CI Program Counter and immediate data 18 1 1 0 1 1 [PC] + [R] + CN [PC) + [R] [0] PUSH [PC) E 1 1 1 0 Jump to subroutine addressed by sum of + CN + CI Program Counter and Accumulator contents lC 1 1 1 0 0 [S] [S] + CI [0] POP 7 o1 1 1 Retum from subroutine 10 1 1 1 0 1 [S) + [0] + CN [S) + [0] [0] None Retum from subroutine to retum eddress + CN + CI plus immediate data IE 1 1 1 1 0 [PC) [PC) [D) None Output and hold Program Counter IF 1 1 1 1 1 Off 121 [PC) [D) None 1 o0 0 1 High impedance output. Hold Program Counter (1 )The Accumulator is loaded only when Ai: is input low. Exceptions are the three instructions marked •. which cause the Accumulator to be loaded unconditionally. (2lThe YO - Y3 outputs are in the high impedance state. (3)Conditional instructions execute as described only when Cc is input low. Otherwise instruction 1 is executed. These instructions are unconditional for the 2932 which has no Cc input. (4)The 2932 has no R[ input. therefore only the three instructions marked· load the Accumulator. 8-128 The Program Counter normally receives the Adder output as its new input. The Adder output 2930 SERIES mayor may not be incremented, depending on the level of the CI input. When the Adder is PROGRAM not outputting the prior Program Counter contents. loading this different output into the Program COUNTER Counter constitutes a program jump. Many instruction codes bypass this jump logic by recycling the Program Counter contents back through the incrementer while some other output is generated by the Adder. For example. one instruction code causes the Adder to output data input at 00-03. But the Program Counter contents are held unaltered. or incremented. depending on the level of the CI input. Both 2930 series devices have a 17-level Stack. Program Counter contents or data input at 2930 SERIES 00-03 can be pushed onto the Stack. The 2930 series push operation is a little unusual. The STACK, PUSH, Stack Pointer is incremented. then the selected data is written into the newly addressed Stack POP location. Thus. following a push. the Stack Pointer addresses the data most recently pushed onto the Stack. It is more traditional for the Stack Pointer to address the first free Stack location. When you pop a 2930 series Stack, you decrement the Stack Pointer contents, and that is all. Thus. in order to read data off the top of the Stack. you select an instruction code which reads data from the Stack. then you pop the Stack. The more traditional Stack architecture requires that you pop the Stack. then read data from the top of the Stack. The 2930 series Stack Pointer is not wrap-around. If the number of pushes exceeds the 2930 SERIES number of pops by more than seventeen. the Stack Pointer continues to address the topmost STACK POINTER Stack location. If you attempt to pop the Stack when the Stack Pointer is addressing location O. then it continues to address location O. When the Stack Pointer is addressing either of the two top Stack locations. the FULL signal is output low. When you execute a push while the Stack Pointer is addressing the top Stack location. data is written into this top location. over- writing whatever was there before. The 2930. but not the 2932. has a Stack Empty indicator. This signal. EMPTY. is output low following a reset. or after the lowest level Stack location has been popped. 2930 series devices are cascadable. However. the 2930 has more cascading logic than the 2932. Unlike the 2901 and the 2903. the 2930 series devices do not have Shifters along data paths. therefore the Accumulator. Stack. and Pro- gram Counter do not need parallel interconnect signals. Parallel interconnect signals are needed only to cascade the Program Counter as it increments. or the Adder following an increment or addition. For the Program Counter there is a carry input. CI. and a carry output. C(I+4). The delay between CI being input and C(I+4) being output is very short. There is plenty of time for this ripple carry to propagate through four slices. for a 16-bit address. within one microcycle. For timing details see the data sheets at the end of this chapter. Both 2930 series Adders have a carry input, Ct,!, and a carry output, C(N+4). Only the 2930 2930 SERIES has is" and Goutputs, the carry propagate and generate. Therefore only the 2930 allows you to CARRY LOGIC use a 2902 carry look-ahead generator. When using the 2932 device. you must rely on ripple car- ry. For a discussion of carry look-ahead and ripple carry. refer to the 2901 and 2902 device descriptions given earlier in this chapter. USING 2930 SERIES DEVICES You must be careful when deciding how to use 2930 device read/write locations. You should not use these loca- tions to implement CPU registers if you are designing any type of general purpose minicomputer or microcomputer. That is because you will have to perform a sequence of pushes and pops. each requiring a single microcycle. in order to select an arbitrary location. Moreover. every time you perform a push in order to increment the address. you will simultaneously write into the newly addressed location - something you may not wish to do. Thus the Stack lets you have 17 levels of subroutine within the program logic that you use to generate addresses. You can use the 2930 series Accumulator to implement a CPU register. For example. 2930 SERIES many primitive Central Processing Units have a single Index register whose contents can con- INDEX REGISTER tribute to address generation logic. but not to CPU arithmetic or logic operations. The 2930 series Accumulator would be an ideal location for such an Index register. If you are designing a special purpose Central Processing Unit using 2930 series devices. you may well be able to use the 17-level Stack to give you all the CPU registers you require. Knowing in advance the limitations of 2930 series Stack access. you can design your microprogram around these limitations so that addresses are stored in the proper serial sequence within the 2930 series Stack. 8-129 DATA SHEETS This section contains specific electrical and timing data for the following devices: • Am2901. Am2901A and Am2901 B • Am2902A Carry Look-Ahead Generator • Am2903 Enhanced Microprocessor Slice • Am2910. Am2909. and Am2911 Microprogram Sequencers • Am2930 Program Control Unit 8-01 Am2901/Am2901 A ALUSOURCE MICROCODE MICROCODE OPERANOS ALU Function Symbol Octal 0ctI01 12 11 10 R S 16 14 13 Code Code L L L 0 A a L L L 0 RPlusS R+S L L H 1 A 8 L L H 1 SMinus R S-R L H L 2 0 a L H L 2 RMinu,S R-S L H H 3 0 8 L H H 3 RORS RVS H L L 4 0 A H L L 4 RANDS RA S H L H 5 0 A H L H 5 RANDS RI\S H H L 6 0 0 H H L 6 R EX-OR S R¥S H H H 7 0 0 H H H 7 R EX·NOR S R'VS Figure 2. ALU Source Operand Control. Figure 3. ALU Function Control. MICROCODE RAM a·REG. RAM a FUNCTION FUNCTION V SHIFTER SHIFTER 0ctI01 Shift L ..d Load OUTPUT 18 17 16 Code Shift RAMo RAM3 Clo 03 L L L 0 X NONE NONE F .... O F X X X X L L H 1 X NONE X NONE F X X X X L H L 2 NONE F .... 8 X NONE A X X X X L H H 3 NONE F .... 8 X NONE F X X X X H L L 4 DOWN F/2 .... 8 DOWN 012 .... 0 F FO IN3 00 IN3 H L H 5 DOWN F/2 .... 8 X NONE F FO IN3 00 X H H L 6 UP 2F .... 8 UP 20 .... 0 F INO F3 INO 03 H H H 7 UP 2F .... 8 X NONE F INO F3 X 03 X= Don't care. Electrically, the shift pin is a TTL input Internally connected to a three·state output which is In the high· Impedance state. 8 = Register Addressed by B inputs. Up is toward MSB, Down is toward LSB. Figure4. ALU Destination Control. ~210OCTAL 0 1 2 3 4 5 6 7 CI.~ 14Source A,a A,B o,a O,B O,A D,A D,a 0,0 L 3 ALU . Function Cn-L A+O A+8 a 8 A O+A 0+0 0 0 R PlUI S Cn-H A+O+l A+8+1 0+1 8+1 A+l O+A+l 0+0+1 0+1 Cn-L O-A-l 8-A-l 0-1 8-1 A-I A-D-l 0-0-1 -0-1 1 SMinul R Cn - H O-A B-A 0 8 A A-O 0-0 -0 Cn- L A-O-l A-8-1 -0-1 -8-1 -A-l D-A-l 0-0-1 0-1 2 R MinulS Cn-H A-O A-8 -0 -8 . -A O-A 0-0 0 3 RORS AVO Av8 a 8 A OVA OVO 0 4 RANDS AMi Ai\8 0 0 0 Di\A 0110 0 5 RANDS Ai\O Ai\8 0 8 A OIlA 0110 0 6 R EX·ORS A"'O A"'8 0 8 A O"'A O¥O 0 7 REX-NORS A¥O A¥ B Q ii A O"'A O¥O 0 + * Plus; - = Minus; V = OR; 1\ = AND; V = EX·OR Figure 5. Source Operand and ALU Function Matrix. Data sheets on pages 8-02 through 8-025 Copyright © 1978 by Advanced Micro Devices, Inc. Reproduced with permission of copyright owner. 8-D2 Am2901 /2901 A SOURCE OPERANDS AND ALU FUNCTIONS Figure 5 results. This matrix fully defines the ALU/source operand function for each state. The ALU functions can also be examined on a "task" basis, There are eight source operand pairs available to the ALU as i.e., add, subtract, AND, OR, etc. In the arithmetic mode, the selected by the 10, 11, and 12 instruction inputs. The ALU can carry will affect the function performed while in the logic perform eight functions; five logic and three arithmetic. The mode, the carry will have no bearing on the ALU output. 13, 14, and 15 instruction input$ control this function selection. Figure 6 defines the various logic operations that the Am2901 A The carry input, Cn , also affects the ALU results when in the can perform and Figure 7 shows the arithmetic functions of arithmetic mode. The en input has no effect in the logic mode. the device. Both c:arry-in LOW (en = 0) and carry-in HIGH When 10 through 15 and en are viewed together, the matrix of (C n = 1) are defined in these operations. Octal Group Function 1543,1210 40 A/\O 41 A/\8 AND 45 O/\A 46 0/\0 30 AVO 31 AV8 OR 35 OVA 36 OVO 60 AVO 61 AV8 EX-OR 65 OVA Octal Cn = 0 (Low) Cn = 1 (High) 66 OVO 1543,1210 Group Function Group Function 70 AVO 0 0 A+O A+0+1 7 1 Avo8 EX-NOR 0 1 ADD A+8 ADD plus A+8+1 75 OVA OVO 0 5 O+A one O+A+l 76 0 6 O+Q 0+0+1 72 9 0 2 Q Q+l 73 8 INVERT 0 3 PASS 8 Increment 8+1 74 A 77 D o4 A A+l 0 7 0 0+1 62 0 1 2 0-1 0 63 8 PASS 1 3 Decrement 8-1 PASS 8 64 A 1 4 A-1 A 67 0 2 7 0-1 0 32 0 2 2 -Q-l -0 33 8 PASS 2 3 1'5 Compo -8-1 2'sComp. -8 34 A 2 4 -A-1 (Negate) -A 37 0 1 7 -0-1 -0 42 0 Q-A-l Q-A 1 0 43 0 "ZERO" 1 1 Subtract 8-A-1 Subtract 8-A 44 0 1 5 (1'sComp) A-0-1 (2's Comp) A-O 47 0 1 6 0-0-1 Q-O 50 A/\O 2 0 A-Q-l A-O 51 A/\8 2 1 A-8-1 A-8 MASK 55 D/\A 2 5 O-A-l O-A 56 0/\0 2 6 O-Q-l 0-0 Figure 6. ALU Logic Mode Functions. Figure 7. ALU Arithmetic Mode Functions. 8-03 Am2901 MAXIMUM RATINGS (Above which the useful life may be impaired) Storage Temperature Temperature (Ambient) Under Bias Supply Voltage to Ground Potential -0.5 V to +6.3 V DC Voltage Applied to Outputs for HIGH Output State -0.5 V to +VCC max. DC Input Voltage -0.5 V to +5.5 V DC Output Current, Into Outputs 30mA DC Input Current -30 mA to +5.0 mA OPERATING RANGE PIN Ambient Temperature Vcc I Am2901PC. DC 1 0 ° C to +70°C I 4.75 V to 5.25 V I I Am2901DM. FM I -55°C to +125°C 1 4.50 V to 5.50 V 1 STANDARD SCREENING (Conforms to MI L-STD-883 for Class C Parts) MIL-STD-883 Leyel Step Method Conditions Am2901 PC, DC Am2901DM. FM Pre-Seal Visual Inspection 2010 100% 100% 24-hour Stabilization Bake 1008 C 150°C 100% 100% -65°C to +150°C Temperature Cycle 1010 C 100% 100% 10 cycles Centrifuge 2001 B 10,OOOG 100% • 100% Fine Leak 1014 A 5 x 10 -8 atm-cc/cm 3 100% • 100% Gross Leak 1014 C2 Fluorocarbon 100% • 100% Electrical Test See below for 5004 definitions of subgroups 100% 100% Subgroups 1 and 7 Insert Additional Screening here for Class B Parts Group A Sample Tests Subgroup 1 LTPD = 5 LTPD = 5 Subgroup 2 LTPD = 7 LTPD = 7 Subgroup 3 See below for LTPD = 7 LTPD = 7 5005 Subgroup 7 definitions of subgroups LTPD = 7 LTPD = 7 Subgroup 8 LTPD = 7 LTPD = 7 Subgroup 9 LTPD = 7 LTPD = 7 'Not applicable for Am2901PC ADDITIONAL SCREENING FOR CLASS B PARTS MI L·STD·883 level Step Conditions Method Am2901DMB. FMB Burn·ln 1015 D 160 ~~~:~min. 100% Electrical Test 5004 Subgroup 1 100% Subgroup 2 100% Subgroup 3 100% Subgroup 7 100% Subgroup 9 100% Return to Group A Tests in Standard Screening ORDERING INFORMATION GROUP A SUBGROUPS (as defined in MIL·STD-883, method 5005) Subgroup Parameter Temperature Package Temperature Order DC 25°C Type Range Number DC Maximum rated temperature DC Minimum rated temperature Molded DIP O°C to +70°C AM2901PC Function 25°C Hermetic 0 IP O°C to +70°C AM2901DC Function Maximum and minimum rated Hermetic 0 IP -55°C to +125°C AM2901DM temperature Hermetic Flat Pack -55°C to +125°C AM2901FM Switching 25°C Dice O°C to +70°C AM2901XC Switching Maximum Rated Temeperature 10 11 Switching Minimum Rated Temperature 8-04 Am2901 ELECTRICAL CHARACTERISTICS OVER OPERATING RANGE (Unless Otherwise Noted) (Group A, Subgroups 1, 2 and 3) Typ. Parameters Description Test Conditions (Note 1) Min. (Note 2) Max. Units 10H = -1.6mA 2.4 YO, V" V2, V3 10H z -1.OmA. Cn +4 2.4 VCC = MIN. 10H = -800"A, OVR, P 2.4 VOH Output HIGH Voltage Volts VIN = VIH or VIL IOH = -soo"A, F3 2.4 10H = -soo"A 2.4 RAMO, 3, 00, 3 10H = -1.6mA, G 2.4 I CEX Output Leakage Current VCC = MIN., VOH = 5.5V 250 "A for F = 0 Output VIN = VIH or VIL 10L = 16mA 0.5 YO, V" V2, V3,G VCC· MIN., 10L = 10mA, Cn +4, FmO 0.5 VOL Output LOW Voltage Volts VIN = VIH or VIL 10L = S.OmA, OVR, P 0.5 10L - 6.0mA, F3 0.5 RAMO. 3. 00. 3 Input HIGH Level Guaranteed input logical HIGH VIH 2.0 Volts voltage for all inputs Input LOW Level Guaranteed input logical LOW I Military 0.7 VIL Volts voltage for,all inputs I Commercial 0.8 VI Input Clamp Voltage VCC = MIN .• liN = -ISmA -1.5 Volts Clock.OE -0.36 AO. A" A2, A3 -0.36 BO. B,. B2, B3 -0.36 VCC = MAX. 00,0,,02. 0 3 -0.72 IlL Input LOW Current mA VIN =0.5V 10,1,,12;16,IS -0.36 13. 14. 15. 17 -0.72 RAMO, 3. 00, 3 (Note 4) -O.S Cn -3.6 Clock,OE 20 Ao. A" A2, A3 20 BO. B,. B2. B3 20 DO. 0,. 02. 03 40 IIH Input HIGH Current VCC = MAX. ,.A V IN = 2.7V 10.ll.12.16. IS 20 13. 14. 15. 17 40 RAMO. 3. 00. 3 (Note 4) 100 Cn 200 II Input HIGH Current VCC = MAX .• VIlli = 5.5V 1.0 rnA YO. V,. Vo =2.4V 50 V2. V3 Vo -0.5V -50 10ZH Off State (High Impedance) VCC = MAX. Vo =2.4V 100 "A 10ZL Output Current RAMO. 3. (Note 4) 00.3 Vo -0.5V -800 (Note 4) YO. V,. V2. V3.G -15 -40 Cn+4 -15 -40 Output Short Circuit Current VCC = 5.75V lOS OVR.P -15 -40 mA (Note 3) VO=0.5V F3 -15 -40 RAMO. 3. 00. 3 -15 -40 Military 185 280 ICC Power Supply Current VCC= MAX. rnA Commercial 185 280 Notes: 1. .. For condItIons shown as MIN. or MAX .• use the appropriate value specified under Electricel Characteristics for the epplicable device type. 2. Typical limits are at Vec = S.OV. 2S·C ambient and maximum loading. 3'. Not more than one output should be shorted et a time. Duration of the short circuit test should not exceed one second. 4. These are three-state outputs internally connected to TTL inputs. Input characteristics are measured with 167SIn a state such that the three·state outpu\ is OFF. 8-05 Am2901 GUARANTEED OPERATING CONDITIONS TABLE I OVER TEMPERATURE AND VOLTAGE Tables I, II, and III below define the timing requirements of the Am2901 in a system. The Am2901 is guaranteed to function correctly over the operating range when used within CYCLE TIME AND CLOCK CHARACTERISTICS the delay and set·up time constraints of these tables for the appropriate device type. The tables are divided into three TIME Am29010C,PC Am2901 OM, FM types of parameters; clock characteristics, combinational delays Read·Modify-Write Cycle from inputs to outputs, and set-up and hold time requirements. (time from selection of 105ns 120ns The latter table defines the·time prior to the end of the cycle A, B registers to end of cycle) (i.e., clock LOW-to-HIGH transition) that each input must be stable to guarantee that the correct data is written into one of Maximum Clock Frequency to the internal registers. Shift Q Register (50% duty 9.5MHz 8.3MHz cycle) The performance of the Am2901 within the limits of these tables is guaran~ed by the testing defined as "Group A, Minimum Clock LOW Time 30ns 30ns Subgroup 9" Electrical Testing. For a copy of the tests and Minimum Clock HIGH Time 30ns 30ns limits used for subgroup 9, contact Advanced Micro Devices' Minimum Clock Period 105ns 120ns Product Marketing. TABLE" MAXIMUM COMBINATIONAL PROPAGATION DELAYS (all in ns, CL oE;; 15pF) Am2901DC, PC (O°C to +70°C; 5V ±5%) Am2901DM, FM (-55°C to +125°C; 5V ±10%) ~ Shift Shift F=O Outputs F=O Outputs F Output G,P rom Y F3 Cn +4 RL= OVR Y F3 Cn+4 G,P RL= OVR Input RAMO 00 RAMO 00 470 470 RAM3 03 RAM3 03 A,a 110 85 80 80 110 75 110 - 120 95 90 90 120 85 120 - D (arithmetic mode) 100 70 70 70 100 60 95 - 110 80 75 75 110 65 105 - D (I = X37) (Note 5) 60 50 - - 60 - 60 - 65 55 - - 65 - 65 - Cn 55 35 30 - 50 40 55 - 60 40 30 - 55 45 60 - 1012 85 65 65 65 80 65 80 - 90 70 70 70 85 70 85 - 1345 70 55 60 60 70 60 65 - 75 60 65 65 75 65 70 - 1678 55 - - - - - 45 45 60 - - - - - 50 50 OE Enable/Disable 40/25 - - - - - - - 40/25 - - - - - - - A bypassing ALU (I = 2xx) 60 - - - - - - - 65 - - - - - - - Clock I (Note 6) 115 85 100 100 110 95 105 60 125 95 110 110 120 105 115 65 SET-UP AND HOLD TIMES (all in ns) (Note 1) TABLE III Am2901 DC, PC (O°C to +70°C, 5V ±5%) Am2901 DM,FM (-55°C to +125°C, 5'1£ ±10%) From Input Notes Set-UpTime Hold Time 'Set-Up Time Hold Time A,a 2,4 105 120 tpwL + 30 0 tpwL + 30 0 Source 3,5 B Dest. 2,4 tpwL + 15 0 tpwL +15 0 D (arithmetic mode) 100 0 110 0 D (I = X37) (Note 5) 60 0 65 0 Cn 55 0 60 0 1012 85 0 90 0 1345 70 0 75 0 1678 4 tpwL + 15 0 tpwL + 15 0 RAMO, 3, 00, 3 30 0 30 0 Not.: 1. Se. Figure 11 and 12. 2. If the B addr ... i. used a. a source operand, allow for the "A, B source" set-up time; if it is used only for the destination addr•••, use the uS dest." set-up time. 3. Wh.r. two numbe .. are shown, both must be met. 4. "tpwL" i. the clock LOW time. 5. OVO is the fastest way to load the RAM from the 0 inputs. This function is obtained with I = 337. 6. Using Q register as source operand in arithmetic mode. Clock is not nqrmally in critical speed path when Q is not a source. 8-06 Am2901A ELECTRICAL CHARACTERISTICS OVER OPERATING RANGE (Unless Otherwise Noted) (Group A, Subgroups 1,2, and 3) Data in bold face is changed from Am2901 Typ. Parameters Description Test Conditions (Note 1) Min. (Note 2) Max. Units 10H = -1.6mA 2.4 Yo. Yl. Y2. Y3 10H = -1.0mA.C n +4 2.4 VCC = MIN. VOH Output HIGH Voltage 10H = -SOOI'A. OVR. P 2.4 Volts VIN.= VIH or VIL 10H - -600IlA. F3 2.4 10H - -6001'A 2.4 RAMO. 3. QO. 3 10H - -1.6mA. G 2.4 Output Leakage Current VCC = MIN .• VOH = 5.5V ICEX 250 I'A for F = 0 Output VIN = VIH or VIL IOL - 20mA (COM'L) 0.5 YO. Yl. Y2. Y3 VCC= MIN .• 10L = 16mA (MIL) 0.5 VOL Output LOW Voltage VIN = VIH G. F =0 10L = 16mA 0.5 Volts or VIL Cn+4 10L = 10mA 0.5 OVR.P 10L = S.OmA 0.5 F3. RAMO. 3. 10L = 6.0mA 0.5 QO.3 Guaranteed input logical HIGH VIH Input HIGH Level 2.0 Volts voltage for all inputs (Note 7) Guaranteed input logical LOW VIL Input LOW Level O.S Volts voltage for all inputs (Note 7) .. VI Input Clamp Voltage VCC = MIN .• liN = -ISmA -1.5 Volts Clock.OE -0.36 AO. AI. A2. A3 -0.36 SO. Bl. B2. B3 -0.36 DO. 01. 02. 03 -0.72 IlL Input LOW Current VCC = MAX .• VIN = 0.5V mA 10.ll. 12.16. I S -0.36 13. 14. 15. 17 -0.72 RAMO. 3. 00. 3 (Note 4) -O.S -~ Cn Clock.OE 20 AO. AI. A2. A3 20 BO. Bl. B2. B3 20 Input HIGH Current 00. 0 1. 0 2. 0 3 40 IIH VCC = MAX .• VIN = 2.7V 10. 11. 12. 16. IS 20 13. 14. 15. 17 40 RAMO. 3. QO. 3 (Note 4) 100 Cn 200 Input HIGH Current VCC = MAX .• VIN = 5.5V 1.0 mA YO. Yl. Vo = 2.4V 50 Y2. Y3 Vo - 0.5V -50 IOZH Off State (High Impedance) Vo - 2.4V VCC = MAX. 100 IOZL Output Current RAMO. 3 (Note 4) QO.3 Vo = 0.5V -BOO (Note 4) YO. Yl. Y2. Y3. G -30 -85 Cn+4 -30 -85 lOS Output Short Circuit Current VCC = 5.75V. Vo = 0.5V mA (Note 3) OVR.P -30 -85 F3 -30 -85 RAMO. 3. QO. 3 -30 -85 TA-25°C 160 250 TA=0°Cto+70°C 160 265 Am2901APC. DC Power Supply Current VCC= MAX. TA-+70°C 160 220 ICC mA (Note 6) (See graph) TC - _55°C to 160 280 Am2901AOM. FM +125°C TC-+125°C 160 190 Notes: 1. For conditions shown as MIN. or MAX., use the appropriate value specified under Electrical Characteristics for the applicable device type. 2. Typical limits are at Vee = 5.0V, 2SoC ambient and maximum loading. 3. Not more than one output should be shorted at a time. Duration of the short circuit test should not exceed one second. 4. These are three~state outputs internally connected to TTL inputs. Input characteristics are measured with 1678 in a state such that the three- state output is OFF. 5. "MI L" = Am2901AXM. OM. FM. "COM'L" = Am2901AXC. PC. DC. 6. Worst case ICC is at minimum temperature. 7. These input levels provide zero noise immunity and should only be tested in a static, noise-free environment. 8-07 Am2901A SWITCHING CHARACTERISTICS TABLE IV OVER OPERATING RANGE CYCLE TIME AND CLOCK CHARACTERISTICS Tables IV, V, and VI below define the timing characteristics of the Am2901 A at 25°C over the operating voltage and tempera- TIME COMMERCIAL MILITARY ture range_ The tables are divided into three types of para- meters; clock characteristics, combinational delays from inputs Read-Modify-Write Cycle to outputs, and set-up and hold time requirements_ The later (time from selection of 100 110 A, B registers to end of table defines the time prior to the end of the cycle (Le_, clock cycle) LOW-to-H IGH transition) that each input must be stable to guarantee that the correct data is written into one of the Maximum Clock Frequency to Shift Q Register (50% duty 15MHz 12MHz internal registers_ cycle) I = 432 or 632 Measurements are made at 1.5V with VI L = OVand VIH = 3.0V. Minimum Clock LOW Time 30ns 30ns For three-state disable tests, CL = 5.0pF and measurement is to O.5V change on output voltage level. Minimum Clock HIGH Time 30ns 30ns Commercial = Am2901APC, DC, XC Minimum Clock Period lOOns 110ns O°C to +70°C 4.75 to 5.25V Military = Am2901ADM, FM, XM -55°C to +125°C 4.50 to 5.50V TABLE V COMBINATIONAL PROPAGATION DELAYS (all in ns, CL = 50pF (except output disable tests)) COMMERCIAL MILITARY ~ Shift Shift F=O Outputs F=O Outputs F Output rom Y F3 C n +4 G,P RL= OVR Y F3 C n +4 G,Y- RL= OVR Input RAMO 00 RAMO 00 470 470 RAM3 03 RAM3 03 A,B 80 80 75 65 90 85 95 - 85 85 80 70 100 90 100 - o (arithmetic mode) 45 45 45 35 60 55 65 - 50 50 50 40 65 60 70 - D (I = X37) (Note 5) 40 40 - - 55 - 60 - 45 45 - - 60 - 65 - Cn 30 30 20 - 50 30 50 - 35 35 25 - 55 35 55 - 1012 55 55 50 45 70 65 75 - 60 60 55 50 75 70 80 - 1345 55 55 55 50 70 65 75 - 60 60 60 55 75 70 80 - 1678 30 - - - - - 30 30 35 - - - - - 35 35 OE Enable/Disable 35/25 - - - - - - - 40/25 - - - - - - - A bypassing ALU (I = 2xx) 45 - - - - - - - 50 - - - - - - - Clock S (Note 6) 60 60 60 50 75 70 80 30 65 65 65 55 85 75 85 35 SET-UP AND HOLD TIMES (all in ns) (Note 1) TABLE VI COMMERCIAL MILITARY From Input Notes Set-Up Time Hold Time Set-Up Time Hold Time A,B 2,4 100 110 tpw L+3O 0 tpw L+3O 0 Source 3,5 B Dest. 2,4 tpw L+16 0 tpw L+16 0 D (arithmetic mode) 70 0 75 0 0(1 = X37) (Note 5) 60 0 65 0 Cn 55 0 60 0 1012 80 0 85 0 1345 80 0 85 0 1678 4 tpw L+ 3O 0 tpw L+ 3O 0 RAMO, 3, 00, 3 25 0 25 0 Notes: 1. See Figure 1" 2_ If the 8 address is used as a source operand, allow for the "A, 8 source" set-up time; if it is used only for the destination address, use the "8 Dest" set-up time. 3. Where two numbers are shown, both must be met. 4. "tpwL" is the clock LOW time. 5. D V 0 is the fastest way to load the RAM from the D inputs. This function is obtained with 1=337. 6. Using Q register as source operand in arithmetic mode. Clock is not normally in critical speed path when Q is not a source. 8-08 Am2901A SET-UP AND HOLD TIMES (minimum cycles from each input) time prior to the clock until the hold time after the clock. The set-up times allow sufficient time to perform the correct Set-up and hold times are defined relative to the clock LOW-to- operation on the correct data so that the correct ALU data HIGH edge. Inputs must be steady at ali times from the set-up can be written into one of the registers. 30 lOll A.B 80 Figure 11. Minimum Cycle Times from Inputs. Numbers Shown are Minimum Data Stable Times for Am2901ADC, in ns. See Table III for Detailed Information. Typical Icc Versus Temperature 300 r---,----,-,-,---..., 200 .............. , ____ 1501---+--+---+"""'-+---l TYPICAL ICC ~ VCC~15.0IV 100 '------'-:---'--'----'_----' ··55 0 25 70 125 T - °c TEMPERATURE _ °c Figure 12. 8-09 Am2901B PRELIMINARY DATA ELECTRICAL CHARACTERISTICS OVER OPERATING RANGE (Unless Otherwise Noted) (Group A, Subgroups 1, 2, and 3) Typ Parameters Description Test Conditions (Note 1) Min (Note 21 Max Units 10H = -1.6mA 2.4 Yo, Yl, Y2, Y3 IOH = -1.0mA. Cn +4 2.4 VCC = MIN. VOH Output HIGH Voltage 10H = -8001lA, OVR, P 2.4 Volts VIN = VIH or VIL 10H - -6001lA, F3 2.4 10H = -6001lA 2.4 RAMO, 3, QO, 3 10H = -1.6mA, G 2.4 Output Leakage Current VCC = MIN., VOH = 5.5V 250 IlA ICEX for F = 0 Output VIN = VIH or VIL ~L - 20mA ICOM'L1 0.5 YO, Yl, Y2, Y3 VCC = MIN .. 10L = 16mA (Mill 0.5 VOL Output LOW Voltage VIN = VIH G, F = 0 10L = 16mA 0.5 Volts or VIL Cn+4 10L = 10mA 0.5 OVR,P 10L = 8.0mA 0.5 F3, RAMO, 3, 10L = 6.0mA 0.5 QO,3 Guaranteed input logical HIGH VIH Input HIGH Level 2.0 Volts voltage for all inputs (Note 71 Guaranteed input logical LOW VIL Input LOW Level O.S Volts voltage for all input~ (Note 7) VI Input Clamp Voltage VCC = MIN., liN = -lSmA -1.5 Volts Clock,OE -0.36 AO, Al, A2, A3 -0.36 BO, Bl, B2, B3 -0.36 DO, Dl, D2, D3 -0.72 IlL Input LOW Current VCC = MAX., VIN = 0.5V mA 10,11,12,16, IS -0.36 13,14,15,17 -0.72 RAMO, 3, 00, 3 (Note 4) -O.B Cn -3.6 Clock,OE 20 AO, Al, A2, A3 20 BO, Bl, B2, B3 20 Input HIGH Current DO, Dl, D2, D3 40 IIH VCC = MAX., VIN = 2.7V 10,11,12,16. IS 20 13,14,15,17 40 RAMO, 3, QO, 3 (Note 4) 100 Cn 200 II Input HIGH Current VCC - MAX., VIN = 5.5V 1.0 mA YO, Yl, Vo = 2.4V 50 Y2, Y3 Vo - 0.5V -50 10ZH Off State (High Impedance) Vo 2.4V VCC = MAX. 100 10ZL Output Current RAMO, 3 (Note 4) QO.3 VO= 0.5V -SOO (Note 4) YO, Yl, Y2, Y3, G ~30 -85 lOS Output Short Circuit Current Cn+4 -30 -85 VCC = MAX. + 0.5V, Vo = 0.5V mA (Note 3) OVR,P -30 -85 F3 -30 -85 RAMO, 3, 00, 3 -30 -85 TA-25°C 160 250 TA - O°C to +70°C 265 Am2901 BPC. DC Power Supply Current VCC = MAX. TA - +70°C 220 ICC mA (Note 6) ISee Fig. 12) TC = -55°C to 265 Am2901BDM. FM +125°C TC - +125°C 19S Notes: 1. For conditions shown as MIN. or M"AX .• USti the appropriate value specified under Electrical Characteristics for the applicable device type. 2. Typical limits are at Vee = 5.0V, 25 C ambient and maximum loading. 3. Not more than one output should be shorted at a time. Duration of the short circuit test should not exceed one second. 4. These are three-state outputs internally connected to TTL inputs_ Input characteristics are measured with 1678 in a state such that the three state output is 0 F F. 5. "MIL" = Am29018XM, OM, FM. "COM'L = Am2901 axc,·pc, DC. 6. Worst case ICC is at minimum temperature. 7. These input levels provide zero noise immunity and should only be tested in a static, noise-free environment. 8-D10 Am2901B I. Typical Room Temperature Performance A. Cycle Time and Clock Characteristics. The tables below specify the typical performance of the Am2901 B Read-Modify-Write Cycle (from selection of A, B registers at 25°C and 5.0V. All data are in ns, with inputs changing between to end of cycle.) 45ns OV and 3V at 1V/ns and measurements made at 1.5V. For guaranteed data, see following pages. Maximum Clock Frequency to shift a (50'7r duty cycle, I = 432 or 632) 33MHz Minimum Clock LOW Time lOns Minimum Clock HIGH Time lOns Minimum Clock Period SOns B. Combinational Propagation Delays. CL = SOpF ~ From Input Y F3 Cn+4 G,P F=O OVR RAMO RAM3 00 03 A, B Address 38 41 39 33 44 44 50 - 0 22 23 24 20 28 29 31 - Cn 17 19 13 - 22 19 26 - 1012 30 30 29 27 34 34 38 - 1345 32 32 30 25 32 30 34 - 1678 17 - - - - - 16 16 A Bypass ALU 22 - - - - - - - (I = 2XX) ClockS 29 31 29 23 33 35 40 19 C. Set-up and Hold Times Relative to Clock (CP) Input. ~-- ~_-y- -' CP: Input Set...up Time Ho!d Time Set-up Time I Ho!d Time Before H -+L After H -+ L Before L -+ H After L -+ H A, B Source Address 8 o (Note 3j 45 (Note 4) 0 B Destination 4 Do Not Change 0 Address 0 - - 35 0 Cn - - 26 0 1012 - - 37 0 1345 - - 38 0 1678 0 po Not Change 0 RAMO, 3, QO, 3 - - 9 0 D. Output Enable/Disable Times. Output disable tests performed with CL = SpF and measured to O.SV change of output voltage level. Notes: 1. A dash indicates a propagation delay path or set-up time constraint does not exist. 2. Certain signals must be stable during the entire clock LOW time to avoid erroneous operation. This is indicated by the phrase "do not change". 3. Source addresses must be stable prior to the clock H -+ L transition to allow time to access the source data before the latches close. The A address may then be changed. The B address could be changed if it is not a destination; i.e. if data is not being written back into the RAM. Nonnally A and B are not changed during the clock LOW time. 4. The set-up time prior to the clock L -+ H transition is to allow time for data to be accessed, passed through the ALU, and retumed to the RAM. It includes all the time from stable A and B addresses to the clock L -+ H transition, regardless of when .the clock H -+ L transition occurs. 8-D11 Am29018 I. Guaranteed Commercial A. Cycle Time and Clock Characteristics. Range Performance Read-Modify-Write Cycle (from selection of A, B registers The tables below specify the guaranteed performance of the to end of cycte.) 69ns Am2901 B over the commercial operating range of O°C to + 70°C, with Vcc from 4.7SV to S.2SV. All data are in ns, with inputs Maximum Clock Frequency to shift a (50'7. duty cycle. 16MHz I = 432 or 632) switching between OV and 3V at 1 V/ns and measurements made at 1.SV_ All outputs have maximum DC load. Minimum Clock LOW Time 30ns This data applies to the following part numbers: Am2901BPC Minimum Clock HIGH Time 30ns Am2901BDC Minimum Clock Period 69ns B. Combinational Propagation Delays. CL = 50pF ~ From Input V F3 Cn+4 G,P F=O OVR RAMO RAM3 00 03 A. B Address 60 61 59 50 70 67 71 - 0 38 36 40 33 48 44 45 - Cn 30 29 23 - 37 29 38 - 1012 50 47 45 45 56 53 57 - 1345 49 48 44 45 54 49 53 - 1678 28 - - - - - 27 27 A Bypass ALU 37 - - - - - - - (I = 2XX) ClockS 49 48 47 37 58 55 59 29 C. Set-up and Hold Times Relative to Clock (CP) Input. L- Input CP: ~K:---- ~ _------:1 Set-up Time Hold Time Set-up Time Hold Time Before H'" L After H'" L Before L'" H After L'" H A. B Source Address 20 o (Note 3) 69 (Note 4) 0 B Destination 9 Do Not Change 0 Address 0 - - 51 0 Cn - - 39 0 1012 - - 56 0 1345 - 55 0 r---- 1678 11 Do Not Change 0 RAMO. 3, aD. 3 - - 16 0 D. Output Enable/Disable Times. Output disable tests performed with C L = SpF and measured to O.SV change of output voltage level. Notes: 1. A dash indicates a propagation delay path or set-up time constraint does not exist. 2_ Certain signals must be stable during the entire clock LOW time to avoid erroneous operation. This i" indicated by the phrase "do not change" 3. Source addresses must be stable prior to the clock H ... L transition to allow time to access the source data before the latches close. The A address may then be changed. The B address could be changed if it is not a destination; i.e. if data is not being written back into the RAM. Normally A and B are not changed during the clock LOW time. 4. The set-up time prior to the ~Iock L ... H transition is to allow time for data to be accessed, passed through the ALU, and retumed to the RAM. It includes all the time from stable A and B addresses to the clock L'" H transition, regardless of when the clock H'" L transition occurs. 8-D12 Am29018 II. Am2901 B Guaranteed Military A. Cycle Time and Clock Characteristics. Range Performance Read-Modily-Write Cycle (from selection of A, B registers The tables below specify the guaranteed performance of the 88ns to end of cycle. Am2901 B over the military operating range of -55°C to + 125°C, Maximum Clock Frequency to shift a (50 rl, duty cycle, with V cc from 4.SV to S.SV. All data are in ns, with inputs switch- I ; 432 or 632) 15MHz ing between OV and 3V at 1 V/ns and measurements made at Minimum Clock LOW Time 30ns 1.SV. All outputs have maximum DC load. Minimum Clock HIGH Time 30ns This data applies to the following part numbers: Am2901 BDM Am2901BFM Minimum Clock Period 88ns B. Combinational Propagation Delays. CL = SOpF ~ RAMO QO From Input Y F3 Cn+4 G,P F=O OVR RAM3 Q3 A. B Address 82 84 80 70 90 86 94 - D 44 38 40 34 50 45 48 - Cn 34 32 24 - 38 31 39 - 1012 53 50 47 46 59 55 58 - 1345 53 50 46 45 58 50 55 - 1678 29 - - - - - 27 27 A Bypass ALU (I; 2XX) 50 - - - - - - - ClockS 53 50 49 41 63 58 61 31 ~- C. Set-up and Hold Times Relative to Clock (CP) Input. ~r Input CP: Set-up Time ~~-- Hold Time -- Set-up Time Hold Time Before H -+ L After H -+ L Before L -+ H After L -+ H A, B Source Address 20 o (Note 3) 88 (Note 4) 0 B Destination 9 Do Not Change 0 Address D - - 55 0 Cn - - 42 0 1012 - - 58 0 1345 - - 58 0 1678 14 Do Not Change 0 RAMO, 3, ao, 3 - - 18 3 L-_ D. Output Enable/Disable Times. Output disable tests performed with C L = SpF and measured to O.SV change of output voltage level. Notes: 1. A dash indicates a propagation delay path or set-up time constraint does not exist. 2. Certain signals must be stable during the entire clock LOW time to avoid erroneous operation. This is indicated by the phrase "do not change". 3. Source addresses must be stable prior to the clock H -+ L transition to allow time to access the source data before the latches close. The A address may then be changed. The B address could be changed if it is not a destination; Le. if data is not being written back into the RAM. Normally A and B are not changed during the clock LOW time. 4. The set-up time prior to the clock L -+ H transition is to allow time for data to be accessed, passed through the ALU. and retumed to the RAM. It includes all the time from stable A and B addresses to the clock l-+ H transition. regardless of when the clock H -+ L transition occurs. 8-D13 Am2902A MAXIMUM RATINGS (Above which the useful life may be impaired) Storage Temperature Temperature (Ambient) Under Bias Supply Voltage to Ground Potential -O.5V·to +7.0V DC Voltage Applied to Outputs for HIGH Output State -0.5V to +VCC max. DC Input Voltage -O.5V to +5.5V DC Output Current, I nto Outputs 30 rnA DC Input Current -30 rnA to +5.0 rnA ELECTRICAL CHARACTERISTICS OVER OPERATING TEMPERATURE RANGE (Unless Otherwise Noted) o Am2902Axe TA = oOe to +7o e Vee = 5.0V ±5% (eOM'L) MIN. = 4.75V MAX. = 5.25V Am2902AXM TA = _55°e to +125°e Vee = 5.0V ±10% (MIL) MIN. = 4.50V MAX. = 5.50V Typ. Parameters Description Test Conditions INote 1) Min. (Note 2) Max. Units VOH Output HIGH Voltage Vcc = MIN., IOH = -lmA I MIL 2.5 3.4 Volts VIN = VIH or VIL 1 COM 2.7 3.4 Vcc = MIN., IOL = 20mA 0.5 VOL Output LOW Voltage Volts VIN = VIH or VIL Guaranteed input logical HIGH VIH Input HIGH Level 2.0 Volts voltage for all inputs Guaranteed input logical LOW VIL Input LOW Level 0.8 Volts voltage for all inputs VI Input Clamp Voltage Vee, = MIN., liN = -18mA -1.2 Volts Cn -2 P3 -4 P2 -6 IlL Input LOW Current VCC = MAX., VIN = 0.5V mA PO, Pl, G3 -8 GO, G2 -14 Gl -16 Cn 50 P3 100 IIH P2 150 Input HIGH Current VCC = MA;(., VIN = 2.7V J.lA PO, Pl, G3 200 GO,G2 350 Gl 400 II Input HIGH Current VCC = MAX., VIN = 5.5V 1.0 mA Output Short Circuit ISC VCC = MAX., VOUT = O.OV -40 -100 mA (Note 3) VCC= MAX. MIL 69 99 mA All Outputs LOW COM'L 69 109 ICC Power Supply Current VCC= MA". MIL 35 mA All Ouputs HIGH COM'L 35 Notes: 1. For conditions shown as MIN. or MAX., use the appropriate value specified under Electrical Characteristics for the applicable device type. 2. Typical limits are at VCC = 5.0V, 25°C ambient and maximum loading. 3. Not more than one output should be shorted at a time. Duration of the short circuit test should not exceed one second. SWITCHING CHARACTERISTICS (TA = +25°C, Vee = 5.0V) Parameters Description Min. Typ. Max. Units Test Conditions tplH 4.5 7 G"/Pi --+ Cn+i ns tpHL 4.5 7 tplH 5 7.5 Gi/Pi--+ G ns tpHL 7 10.5 I C L = 15pF tplH 4.5 6.5 RL = 2800 Pi --+ j5 ns tpHL 6.5 10 I tplH 6.5 10 C n --+ Cn+i ns tpHL 7 10.5 8-D14 Am2903 Am2903 OPERATING RANGE PIN Temperature Vce TA = O'C to + 70'e Vee= 5.0V ::!:5o/r (MIN. = 4.75V. MAX. = 5.25V) Te = -55'Cto +125'C Vee = 5.0V ±10o/r (MIN. = 4.50V. MAX. = 5.50V) DC CHARACTERISTICS OVER OPERATING RANGE Typ. Parameters Description Test Conditions (Note 1) Min. (Note 2) Max. Units 10H = =-1.6mA 2.4 YO-Y3 • GIN Vee = MIN. 10H = =-SOO/LA VO H Output HIGH Voltage Vo~s VIN = V IH or V IL OB O_3 . PIOVA 2.4 SIOo. S10 3. 0100. 0103. WAITE. C n +4 Output Leakage Current Vee = MIN .• VO H = 5.5V ICEX 250 /LA for Z Output (Note 4) V IN = VIH or VIL Yo. Y,. Y2 IOL = 20mA (COM'L) 0.5 Y3. Z 10L = 16mA (MIL) DBa. DB,. 10L = 12mA (COM'L) 0.5 OB2. 0B 3 10L = S.OmA (MIL) I VOL Output LOW Voltage Vee = MIN. Volts VIN = VIH = or V IL GIN 10L = lSmA 0.5 P/OVA 10L = lOmA 0.5 C n + 4 • SIOo S103.0100 10L = S.OmA I 0.5 0103. WRITE . Guaranteed input logical HIGH V IH Input HIGH Level 2.0 Volts voltage for all inputs (Note '6) Guaranteed input logical LOW VIL Input LOW Level O.S Volts voltage for all inputs (Note 6) VI Input Clamp Voltage Vee = MIN .• liN = -lSmA -1.5 Volts Cn 2.50 Yo. Y,. Y2. Y3 LOS 10 • I,. 12• 13• 14. OAo. OA,. Input LOW Current VCC = MAX .• V IN = 0.5V IlL OA 2. OA3 • SIOo mA (Note 4) 0.72 S103. 0100. 0103. MSS. DBa. DB,. OB 2.OB3 All other inputs 0.36 --'". Cn 120 Yo. Y,. Y2. Y3 110 10-14. OAO-OA 3 40 IIH Input HIGH Current Vce = MAX .. V IN = 2.7V SIO o. S10 3• 0100. /LA (Note 4) 0103. OBo_3• 90 MSS All other inputs 20 II In!'lut HIGH Current Vec = MAX .• V IN = 5.5V 1.0 mA Vo = 2.4V 110 Off State YO-Y3 10ZH Vec = MAX .• Vo = 0.5V -1130 /LA (HIGH Impedance) (Note 4) 10ZL Output Current OBO_3• 0100. 0100. Vo = 2.4V . 90 SIO o • 8103. MS8/1S Vo = 0.5V -770 Output Short Circuit Vce = MAX + 0.5V los -30 -85 mA Current (Note 3) Vo = 0.5V TA = 25'C 220 335 TA = 010 70'C 350 Power Supply Current COM'L ICC Vee = MAX. TA = 70'C 291 mA (Note 5) Te = -55 to 125'C 395 MIL Te = 125'C 25S Notes: t. For conditions shown as MIN. or MAX.. use the appropriate value specified under Electrical Characteristics for the applicable device type. 2. Typical limits are at vee ~ 5.0V. 25'C ambient and maximum loading. 3. Not more than one output should be shorted at a time. Duration of the short circuit test should not exceed one second. 4. YO-3. 060-3. 510 0.3. Q100.3 and WRITE/M5S are three state outputs internally connected to TTL inputs. Z is an open-collector output internally connected to a TTL input. Input characteristics are measured under conditions such that the outputs are in the OFF state. 5. Worst case Icc is at minimum tenlperature. 6. These input levels provide zero noise immunity and should only be tested in a static. noise-free environment. 8-D15 Am2903 SWITCHING CHARACTERISTICS (Typical Room Temperature Performance) Tables I, II, and III define the nominal timing characteristics of TABLE I the Am2903 at 25°C and 5.0V. The Tables divide the Write Pulse and Clock Characteristics parameters into three types: pulse characteristics for the clock and write enable, combinational delays from input to output, Time and set-up and hold times relative to the clock and write Minimum Time CP and WE both LOW pulse. 30ns to write Measurements are made at 1.5V with V1L = OV and V1H = Minimum Clock LOW Time 30ns 3.0V. For three-state disable tests, CL '= 5.0pF and mea- surement is to 0.5V change on output voltage level. Minimum Clock HIGH Time 50ns TABLE II Combinational Propagation Delays, All In ns. Outputs Fully Loaded. CL = SOpf (except output disable tests) ~t From Input Y Cn + 4 G,P Z N OVR DB WRITE QIOo, QI0 3 SIOo SI03 SI03 (Parity) A, B Addresses 65 60 55 75 64 70 33 - - 61 69 87 (Arith. Mode) A, B Addresses 56 - 46 67 56 - 33 - - 55 64 81 (Logic Mode) DA, DB Inputs (Logic Mode) 39 - 25 48 38 - - - - 36 47 56 DA, DB Inputs 39 37 26 52 38 51 - - - 36 47 60 (Arith. Mode) EA 44 38 29 54 44 53 - - - 42 52 Cn 25 21 - 39 20 38 - - -- 21 25 48 10 39 35 24 48 37 48 - "15 - 41 46 14321 45 43 32 55 44 55 - "17 - 45 51 18765 25 - - 37 - - - 18 22 24 27 lEN - - - - - - - 10 - - - - OEB Enable/Disable - - - - - - 7 - - - - - OEY Enable/Disable 10 - - - - - - - - - - - SIO o, SI03 13 - - - - - - - - - 12 18 Clock 58 52 40 72 56 72 24 - 28 55 63 76 'Applies only when leaving special functions. TABLE III Set-Up and Hold Times (All in ns) CAUTION: READ NOTES TO TABLE III. NA = Not Applicable; no, timing constraint. HIGH-ta-LOW LOW-ta-HIGH Input With Respect to to this Signal ~- Set-up Hold -~ Set-up Hold I Comment y Clock NA NA 10 0 To store Y in RAM or 0 -- WE HIGH Clock 5 Note 2 Note 2 0 To Prevent Writing -- WE LOW Clock NA NA 30 0 To Write into RAM A,S as Sources Clock 20 0 NA NA See Note 3 B as a Destination Clock and WE both LOW To Write Data only into 0 Note 4 Note 4 0 the Correct B Address 0100 ,0103 Clock NA NA 10 0 To Shift 0 18765 Clock 30 Note 5 Note 5 0 lEN HIGH Clock 10 Note 2 Note 2 0 To Prevent Writing lEN LOW Clock NA NA 10 0 To Write into 0 8-016 Am2910 MAXIMUM RATINGS (Above which the useful life may be impaired) Storage Temperature Temperature (Ambient) Under Bias Supply Voltage to Ground Potential -0.5V to +7.0V DC Voltage Applied to Outputs for High Output State -0.5 V to Vee max. DC Input Voltage -0.5V to +5.SV DC Output Current. Into Outputs 30mA DC Input Current -30 mA to +5.0 mA ELECTRICAL CHARACTERISTICS The Following Conditions Apply Unless Otherwise Specified: o MIN. = 4.75V MAX. = 5.25V eOM'lT A = oOe to +70 e Vee = 5.0V ±5% Mil Te = -55°e to +125°e Vee = 5.0V 110% MIN. = 4.50V MAX. = 5.50V DC CHARACTERISTICS OVER OPERATING RANGE Typ. ParameJers Description Test Conditions (Note 1) Min. (Note 2) Max. Units Vec = MIN .• IOH = -1.6mA vOH Output HIGH Voltage 2.4 Volts VIN = VIH or Vil .-f-- Vce = MIN. YO-l1. IOl = 12mA I VOL Output LOW Voltage VIN = VIH or Vil I PL. VECT, MAP, FUll, IOl = SmA 0.5 Volts -'+GUaranteed Input Logical HIGH VIH Input HIGH Level (Note 4) 2.0 Volts voltage for all inputs - 1-- Guaranteed input logical lOW Vil Input lOW level (Note 4) O.S Volts voltage for all inputs .- VI Input elamp Voltage Vce = MIN., liN = -lSmA -1.5 Volts -- 00-11 -0.S7 el. CCEN -0.54 III Input lOW Current VCC = MAX., VIN = 0.5V 10-3,~,R05 -0.72 mA CC -1.31 CP -2.14 00-11 SO CI, CCEN 30 IIH Input HIGH Current Vec = MAX., VIN = 2.7V 10-3, OE. RlO 40 IJ.A CC 50 CP 100 II Input HIGH Current VCC = MAX., VIN = 5.5V 1.0 mA --_ ... _-_ .. _--- ---- Output Short Circuit Current ISC Vec=MAX. -30 -S5 mA (Note 3) IOZL Vec = MAX. VOUT = 0.5V -SO Output OFF Current IJ.A IOZH OE = 2.4V VOUT - 2.4V SO TA = 25°e 19S 320 T A - o°c to +70°C 344 Am291 OPC, DC Power Supply Current Vec = MAX TA = +70·C 2S0 mA ICC Te = -SSoC to 340 Am29100M, FM +125°C Te = +12Soe 227 Notes: 1. For conditions shown as MIN. or M AX .. use the appropriate value specified under Electrical Characteristics for the appl icable devic.8 type. 2. TYPical limits are at Vee = 5.0V. 25°e ambient and maximum loading. 3. Not mort! than one output should be shorted at a time. Duration of the short circuit test should not exceed one second. 4. These input levels provide no guaranteed noise immUnity and should only be tested In a static·, noise-free environment. INPUTS 3.0" I I CLOCK TO --OUTPUT L INPUT TO OUTPUT DELAY - See Tables A for ts and th for various inputs. See Tables B for combinational DELAV delays from clock and other inputs to outputs. See Figure 5 for timing of a typical CCU cycle. Figure 2. Switching Waveforms. 8-017 Am2910 SWITCHING CHARACTERIST1CS The tables below define the Am291 0 switching characteristics. Tables A are set-up and hold times relative to the clock LOW-to-H IGH transition. Tables B are combinational delays. Tables e are clock requirements. All measurements are made at 1.5V with input levels at OV or 3V. All values are in ns. TYPICAL ROOM TEMPERATURE CHARACTERISTICS (T A = 25°C, Vee = 5.0V, CL = 50pF) A. Set-up and Hold Times B. Combinational Delays C. Clock Requirements Input ts th Input Y PL, VECr, MAP Full Minimum Clock LOW Time 30 Di~R 9 3 Minimum Clock HIGH Time 30 DO-011 14 Di~PC 34 1 Minimum Clock Period, 1=8.9, 15 10- 13 40 27 10- 13 64 0 Minimum Clock Period, 1=14 CC 21 CC 46 0 CCEN 23 CCEN 49 LI (Clock periods for other instructions a'e CP(note) determined by external conditions'! CI 26 2 54 29 1= 8, 9,15 RLD 18 2 CP Note: These instructions are conditional on the 26 29 All other I counter. Delays from CP to outputs will be longer if the instruction prior to the clock was OE 4 or 12 or RLD was LOW. GUARANTEED ROOM TEMPERATURE CHARACTERISTICS lTA = 25°e, Vee = 5.0V, CL = 50pF) A. Set-up and Hold Times B. Combinational Delays C. Clock Requirements Input ts th Input Y Pl, VECr, MAP FiiIf Minimum Clock LOW Time Di~R Minimum Clock HIGH Time DO-Oll Di~PC Minimum Clock Period, 1=8,9,15 10- 13 10- 13 Minimum Clock Period, 1=14 CC CC CCEN (Clock periods for other instructions are CCEN CP(note) determined by external conditions.! CI 1= 8, 9, 15 RLD CP Note: These instructions are conditional 0:1 the All other I counter. Delays from CP to outputs will b,~ longer if the instruction prior to the clock was OE 4 or 12 or RLD was LOW. GUARANTEED CHARACTERtSTICS OVER COMMERCIAL OPERATING RANGE Am2910PC, DC (TA = oOe to+70°C, Vec = 4.75V to 5.25V, eL = 50pF) A. Set·up and Hold Times B. Combinational Delays C. Clock Requirements Input ts th Input Y Pl, VECT, MAP Full Minimum Clock LOW Time 50 Di~R 15 5 Minimum Clock HIGH Time 30 Do-D11 25 - - Di~PC 58 3 Minimum Clock Period, 1=8, 9,15 10-13 65 48 - 10- 13 100 0 Minimum Clock Period, 1=14 CC 45 - - CC 80 0 ei!EN 40 - - (Clock periods for other instructions are CCEN 85 0 CP(note) determined by external conditions.) CI 45 5 1= 8, 9,15 92 - - RLD 35 3 CP Note: These instructions are conditional on the 65 - 50 counter. Delays from CP to outputs will be All other I longer if the instruction prior to the clock was OE - - 4 or 12 or RLD was LOW. GUARANTEED CHARACTERISTICS OVER MILITARY OPERATING RANGE Am2910DM, FM (TC = _55°C to +125°C, Vee = 4.5V to 5.5V, CL = 50pF) A. Set·up and Hold Times B. Combinational Delays C. Clock Requirements Input ts th Input Y Pl, VECT, MAP Full Minimum Clock LOW Time Di~R Minimum Clock HIGH Time 00- 0 11 Di~PC Minimum Clock Period, 1=8,9, 15 10- 13 10. 13 Minimum Clock Pellod, 1=14 CC CC CCEN (Clock p~riods for other instructions are CCEN CP(note) determined by external conditions. I CI 1= 8, 9, 15 RLD CP Note: These instructions are conditional on the All other I counter. Delays from CP to outputs will be longer if the instruction prior to the clock was OE 4 or 12 or RLD was LOW. 8-D18 Am2909 • Am2911 OPERATION OF THE Am2909/Am2911 for the control of the push/pop stack. Figure 6 shows in detail the effect of So, S1, FE and PUP on the Am29Q9. These four Figure 5 lists the select codes for the multiplexer. The two signals define what address appears on the Y outputs and what bits applied from the microword register (and additional com· the state of all the internal registers will be following the clock binational logic for branching) determine which data source LOW-to-HIGH edge. In this illustration, the microprogram contains the address for the next microinstruction. The counter is assumed to contain initially some word J, the ad- contents of the selected source will appear on the Y outputs. dress register some word K, and the four words in the push/ Figure 5 also shows the truth table for the output control and pop stack contain Ra through Rd. Address Selection Output Control OCTAL S, So SOURCE FOR Y OUTPUTS SYMBOL ORi ZERO OE Vi 0 L L Microprogram Counter J,LPC X X H Z 1 L H Register REG X L L L 2 H L Push-Pop stack STKO H H L H 3 H H Direct inputs Di L H L Source selected by So 5, Z = HIgh Impedance Synchronous Stack Control FE PUP PUSH-POP STACK CHANGE H X No change L H Increment stack pOil'lter, then H = High push current PC onto 5TKO L = Low L L Pop stack (decrement stack pointer) X = Don't Care Figure 5. PRINCIPLE CYCLE S1, So, FE, PUP J,lPC REG STKO STK1 STK2 STK3 YOUT COMMENT USE N o0 0 0 J K Ra Rb Rc Rd J Pop Stack End N+1 - J+1 K Rb Rc Rd Ra - Loop N 000 1 J K Ra Rb Rc Rd J Set-up Push J,lPC N+1 - J+1 K J Ra Rb Rc - Loop N 001 X J K Ra Rb Rc Rd J Continue Continue N+1 - J+1 K Ra Rb Rc Rd - N o10 0 J K Ra Rb Rc Rd K Pop Stack; End N+1 - K+1 K Rb Rc Rd Ra - Use AR for Address Loop N o1 0 1 J K Ra Rb Rc Rd K Push J,lPC; JSR AR N+1 - K+1 K J Ra Rb Rc - .Jump to Address in AR N o1 1 X J K Ra Rb Rc Rd K Jump to Address in AR JMP AR N+1 - K+1 K Ra Rb Rc Rd - N 1 000 J K Ra Rb Rc Rd Ra Jump to Address in STKO; RTS N+1 - Ra+1 K Rb Rc Rd Ra - Pop Stack N 1 001 J K Ra Rb Rc Rd Ra Jump to Address in STKO; N+1 - Ra+1 K J Ra Rb Rc - Push J,lPC N 101 X J K Ra Rb Rc Rd Ra Stack Ref Jump to Address in STKO (Loop) N+1 - Ra+1 K Ra Rb Rc Rd - N 1 1 0 0 J K Ra Rb Rc Rd D Pop Stack; End N+1 - D+1 K Rb Rc Rd Ra - Jump to Address on D Loop N 1 1 0 1 J K Ra Rb Rc Rd D Jump to Address on D; N+1 - D+1 K Push J,lPC JSR D J Ra Rb Rc - N 1 1 1 X J K Ra Rb Rc Rd D Jump to Address on D JMP D N+1 - D+1 K Ra Rb Rc Rd - x = Don't care, 0 = LOW, , = HIGH, Assume C n = HIGH Note: STKO is the location addressed by the stack pointer. Figure 6. Output and Internal Next-Cycle Register States for Am2909/Am2911. 8-019 Am2909 • Am2911 Figure 7 illustrates the execution of a subroutine using the routine at A". At the time T 2, this instruction is in the IlWR, Am2909. The configuration of Figure 3 is assumed. The and the Am2909 inputs are set-up to execute the jump and instruction being executed at any given time is the one con- save the return address. The subroutine address A is applied to tained in the microword register (J.tWR). The contents of the the 0 inputs from the IlWR and appears on the Y outputs. The IlWR also controls (indirectly, perhaps) the four signals So, S1, first instruction of the subroutine, I(A), is accessed and is at FE, and PUP. The starting address of the subroutine is applied the inputs of the IlWR. On the next clock transition, I(A) is to the 0 inputs of the Am2909at the appropriate time. loaded into the IlWR for execution, and the return addr~ss J+3 is pushed onto the stack. The return instruction is exe- In the columns on the left is the sequence of microinstructions cuted at T 5. Figure 8 is a similar timing chart showing one to be executed. At address J+2, the sequence control portion subroutine linking to a second, the latter consisting of only of the microinstruction contains the comand "Jump to sub- one microinstruction. CONTROL MEMORY Execute Cycle To T, T2 T3 T4 Ts T6 T7 Ta Tg Execute Cycle Microprogram Address Sequencer Instruction Clock Signals - rL rL rL n- rL rL ru rL ruru J-1 Am2909 S,.50 0 0 3 0 0 2 0 0 TO Inputs FE H H L H H L H H T, J+1 (from PUP X X H X X L X X J+2 JSR A /lWR) D X X A X X X X X T2 T6 J+3 T7 J+4 /lPC J+1 J+2 J+3 A+1 A+2 A+3 J+4 J+5 Internal 5TKO - - - J+3 J+3 J+3 - - Registers 5TK1 - - - - - - - - 5TK2 - - - - - - - - 5TK3 - - - - - - - - A I(AI Am2909 V J+1 J+2 A A+1 A+2 J+3 J+4 J+5 A+1 Output A+2 RTS ROM (V) I(J+1) JSR A I(A) I(A+1) RTS I (J+3) I (J+4) I (J+5) Output Contents of/lWR (Instruction /lWR I(J) I(J+1) JSR A I(AI I(A+1) RTS I(J+3) I (J+4) being executed) Figure 7. Subroutine Execution. en = HIGH CONTROL MEMORV Execute Cycle TO T1 T2 T3 T4 TS TS T7 Ta Tg n.JIlJIlJrL rururu ruru ru Microprogram Execute Clock Cycle Sequencer Address Signals - Instruction J-1 - Am2909 5,.50 0 0 3 0 0 3 2 0 2 0 TO J - Inputs FE H H L H H L L H L H T, J+1 - (from PUP X X H X X H L X L X /lWR) D X X A X X B X X X X T2 J+2 JSR A Tg J+3 - - - /lPC J+1 J+2 J+3 A+1 A+2 A+3 B+1 A+4 A+5 J+4 - - 5TKO - - - J+3 J+3 J+3 A+3 J+3 J+3 - - Internal - Registers 5TK1 - - - - - - J+3 - - - - - 5TK2 - - - - - - - - - - T3 A - 5TK3 - - - - - - - - - - T4 A+1 - T5 A+2 JSR B Am2909 V J+1 J+2 A A+1 A+2 B A+3 A+4 J+3 J+4 T7 A+3 - Output TS A+4 RTS ROM (V) I(A) 1(A+1) - - I(J+1) JSR A JSR B RTS I(A+3) RTS I(J+3) I (J+4) Output - - - - Contents - - of/lWR T6 B RTS (I nstruction /lWR I(J) I(J+1) JSRA I(A) I(A+1) JSR B RTS I(A+31 RTS I(J+3) - - being - - executed) Figure 8. Two Nested Subroutines. Routine B is Only One Instruction. c n = HIGH 8-020 Am2909/Am2911 MAXIMUM RATINGS (Above which the useful life may be impaired) Storage Temperature Temperature (Ambient) Under Bias Supply Voltage to Ground Potential -0.5 V to +7.0 V DC Voltage Applied to Outputs for HIGH Output State -0.5 V to +Vcc max. DC Input Voltage -0.5 V to +7.0 V DC Output Current, Into Outputs 30mA DC Input Current -30 mA to +5.0 mA OPERATING RANGE PIN Ambient Temperature Vcc Am2909/29110C, PC 4.7SV to S.2SV Am2909/2911 OM, FM 4.S0V to S.SOV STANDARD SCREENING (Conforms to MI L-STD·883 for Class C Parts) MIL·STD·883 Level Step Method Conditions Am2909/Am2911PC. DC Am2909/Am2911DM. FM Pre·Seal Visual Inspection 2010 B 100% 100% 24·hour Stabi lization Bake 1008 C lS0°C 100% 100% -6SoC to +lS0°C Temperature Cycle 1010 C 100% 100% 10 cycles Centrifuge 2001 B 10,000 G 100% • 100% Fine Leak 1014 A S x 10-8 atm·cc/sec 100% • 100% Gross Leak 1014 C2 Fluorocarbon 100% • 100% Electrical Test See below for SOO4 100% 100% Subgroups 1 and 7 definitions of subgroups Insert Additional Screening here for Class B Parts Group A Sample Tests Subgroup 1 LTPD = S LTPO = S Subgroup 2 LTPD = 7 LTPD = 7 Subgroup 3 See below for LTPD = 7 LTPD = 7 Subgroup 7 SOOS LTPD = 7 LTPD = 7 definitions of subgroups Subgroup 8 LTPD = 7 LTPD = 7 Subgroup 9 LTPD = 7 LTPD=7 • Not applicable for Am2909PC or ADDITIONAL SCREENING FOR CLASS B PARTS Am2911PC. MI L·STD·883 Level Step Conditions Method Am2909/Am2911DMB. FMB Burn·ln 1015 12SoC D 100% 160 hours min. Electrical Test SOO4 Subgroup 1 100% Subgroup 2 100% Subgroup 3 100% Subgroup 7 100% Subgroup 9 100% Return to Group A Tests in Standard Screening GROUP A SUBGROUPS (as defined in MIL·STD-883, method 5005) Subgroup Parameter Temperature DC 2SoC DC Maximum rated temperature DC Minimum rated temperature Function 2SoC Function Maximum and minimum rated temperature Switching 2SoC 10 Switching Maximum Rated Temeperature 11 Switching Minimum Rated Temperature 8-D21 Am2909 • Am2911 ELECTRICAL CHARACTERISTICS OVER OPERATING RANGE (Unless Otherwise Noted) Typ. Paramatars Description Test Conditions (Note ,) Min. (Note 2) Max. Units VOH Output HIGH Voltage Vcc= MIN., MIL I 10H = -1.0mA 2.4 Volts VIN = VIH or VIL COM'L I 10H = -2.6mA 2.4 10L =4.0mA 0.4 VCC = MIN., 10L =S.OmA 0.45 VOL Output LOW Voltage Volts VIN = VIH or VIL 10L = 12mA 0.5 (Note 5) Guaranteed input logical HIGH VIH Input HIGH Level 2.0 Volts voltage for all inputs VIL Input LOW Level Guaranteed input logical LOW I MIL 0.7 Volts voltage for all inputs I COM'L O.S VI Input Clamp Voltage VCC = MIN., liN = -lSmA -1.5 Volts Cn -LOS VCC = MAX., IlL Input LOW Current Push/Pop, OE -0.72 rnA VIN =0.4V Others (Note 6) -0.36 Cn 40 VCC= MAX., IIH Input HIGH Current Push/Pop 40 JJA VIN = 2.7V Others (Note 6) 20 VCC= MAX., Cn, Push/Pop 0.2 II Input HIGH Current rnA VIN = 7.0V Others (Note 6) 0.1 lOS Output Short Circuit Current (Note 3) VCC = MAX. I Y O -Y 3 -30 -100 rnA 1 C n +4 -30 -S5 ICC Power Supply Currr.nt VCC = MAX. (Note 4) SO 130 rnA 10ZL VCC= MAX., VOUT=0.4V -20 Output OF F Current JJA 10ZH 0E=2.7V VOUT=2.7V 20 Notes: ,. For conditions shown as MIN. or MAX .• use the appropriate value specified under Electrical Characteristics for the applicable device tYpe. 2. Typical limits are at VCC = 5.0V. 25°C ambient and maximum loading. 3. Not more than one output should be shorted at a time. Duration of the short circuit test should not exceed one second. 4. Apply GNO to C n , RO. R" R2. R3, ORO. OR" OA 2 • OR3. DO, 0,. 02. and 03' Other inputs open. All outputs open. Measured after a LOW-to-HIGH clock transition_ 5. The 12mA guarantee applies only to YO, Y 1, y 2 and Y 3' 6. For the Am29", 0i and Ri are Internally connected. Loading is doubled (to same values as Push/Pop). f--IT::L~ I l - - - j I(T~~ 11---1 1,- ~\\\\\\\\\~t CP 3, I,-----J·ov CLOCK H TO L OCCURS - ,,\t\\ \\\ \ ·1'------ _ _ _ _ _ 1.5V ov I I ITAB~~ -----t----+I-(TA~~E 1111 III) ALL INPUTS (EXCEPT DEI I~ I :&m:::: ~ 1 INPUTSTOYorCn + 4 CLOCK TO Y; 0' Cn +4 (TABLE III (TABLE III Y OUT Cn + 4 ________-L _______________ ~~~~~~~~~~~~~__________________________ ------------- ::: VOL Figure 12. sWitching Waveforms. See Tables for Specific Values. MPR-098 8-022 Am2909 • Am2911 SWITCHING CHARACTERISTICS TABLE II OVER OPERATING RANGE MAXIMUM COMBINATIONAL PROPAGATION DELAYS Tables I. II. and III below define the timing characteristics of (all in ns. CL = 50pF (except output disable tests)) the Am2909 and Am2911 over the operating voltage and .~ temperature range. The tables are divided into three types of COMMERCIAL MILITARY parameters; clock characteristics. combinational delays from inputs to outputs. and set-up and hold time require- ments. The latter table defines the time prior to the end of Input Y Cn+4 Y Cn+4 the cycle (Le .• clock LOW-to-HIGH transition) that each 30 20 32 input must be stable to guarantee that the correct data is ~- 17 written into one of the internal registers. 50. 5 1 30 48 40 50 Measurements are made at 1.5V with V IL = OV and V IH = ORi 17 30 20 32 3.0V. For three-state disable ~ests. CL =5.0pF and measure- Cn - 14 - 16 ment is to O.5V change on output voltage level. ZERO 40 30 48 50 TABLE I OE LOW (enable) 25 - 25 - CYCLE TIME AND CLOCK CHARACTERISTICS DE HIGH (disable) 25 - 25 - TIME COMMERCIAL MILITARY Clock t 5 1 50 = LH 43 55 50 62 Minimum Clock LOW Time 30 35 Clock t 5 1 5 0 = LL 43 55 50 62 Minimum Clock HIGH Time 30 35 Clock t 5 15 0 = HL 80 95 90 102 Operating Range Part Numbers Power Supply Temperature Range Am2909PC. DC Commercial 5.0V ± 5% TA = O°C to +70°C Am2911 PC. DC Am2909DM. FM Military 5.0V ± 10% Tc = -55°C to +125°C Am2911DM TABLE III GUARANTEED SET-UP AND HOLD TIMES (all in ns) (Note 1) COMMERCIAL MILITARY From Input Notes Set-Up Time Hold Time Set-Up Time Hold Time RE 22 5 22 5 Ri 2 10 5 12 5 PU5H/POP 26 6 30 7 FE 2!3 5 30 5 Cn 28 5 30 5 Di 2 30 0 35 3 ORj 30 0 35 3 50. 5 1 45 0 50 0 ZERO 45 0 50 0 Notes: 1. All times relative to clock LOW-to-HIGH transition. 2. On Am2911. Ri and OJ are internally connected together and labeled OJ. Use Rj set·up and hold times when 0 inputs are used to load register. Metallization and Pad Layout Am2909 Am2911 25 24 23 22 21 20 19 18 17 16 26 27 28 13 DIE SIZE 0.110" X 0.160" Numbers correspond to DIP pin-out 8-D23 Am2930 MAXIMUM RATINGS (Above which the useful life may be impaired) Storage Temperature -65 to +150°C Temperature (Ambient) Under Bias -55 to +125°C Supply Voltage to Ground Potential -0.5 to + 7.0V DC Voltage Applied to Outputs for High Output State -0.5V to Vee max. DClnputVolta~g~e_______________________________________________________________________ -_O_.5__ to__+_5_.5__ V DC Output Current, Into Outputs 30mA DC Input Current -30 to +5.0mA OPERATING RANGE Part Number Temperature Vee 4.75V to 5.25V TC = -55 to +125°C 4.50V to 5.50V DC CHARACTERISTICS OVER OPERATING RANGE Typ Parameters Description Test Conditions (Note 1) Min (Note 2) Max Units Yo, Y" Y2, Y 3 G, C n + 4 , IOH = -1.6rnA 2.4 Vec = MIN., VO H Output HIGH Voltage Ci+4 Volts VIN = V IL or V IH P, FULL, IOH = -1.2rnA 2.4 EMPTY IOl = 20rnA 0.5 (COM'L) YO' Y" Y 2, Y 3 IOl = 16rnA (MIL) 0.5 Vec = MIN. G,C n +4 VOL Output LOW Voltage IOl = 16rnA 0.5 Volts VIN = VIL or V IH Ci+4 P, FULL, IOL = 12rnA 0.5 EMPTY V IH Input HIGH Level (Note 4) 2.0 Volts V il Input LOW Level (Note 4) 0.8 Volts VI Input Clamp Voltage Vec = MIN., liN = -18rnA -1.5 Volts DO-3 -.360 _..._"-_._,.".. f - - ~-"~ -~-~ 10 -. 4, RE, lEN, -.702 CP,5E IlL Input LOW Current Vec = MAX., VIN = 0.5V rnA CC -.657 Ci -2.31 Cn I -3.25 DO-3 10 - 4• RE, lEN, . --t- 20 I ~ ~ 2.7V 40 CP,5E IIH Input HIGH Current Vee MAX•• V" /LA CC 50 Ci 90 Cn 250 II Input HIGH Current Vec = MAX., VIN = 5.5V 1.0 rnA Output Short Circuit Current IsC Vee = MAX. -30 -85 rnA (Note 3) IOZl VOUT = 0.5V -50 Output OFF Current Vee = MAX., DE = 2.4V /LA IOZH VOUT = 2.4V 50 I Vee = 5.0V TA = 25°C 150 205 Te = -55 to +125°C 239 Power Supply Current _._._-- lee Te = +125°C 170 rnA (Note 5) Vee = MAX. TA = 0 to 70°C 220 TA = 70°C 185 Notes: 1. For conditions shown as MIN. or MAX., use the appropriate value specified under Electrical Characteristics for the applicable device type. 2. Typical limits are at Vee = 5.0V, 25'C ambient and maximum loading. 3. Not more than one output should be shorted at a time. Duration of the short circuit test should not exceed one second. 4. These input levels provide no gtlaranteed noise immunity and should only be tested in a static-, noise·free environment. 5. Minimum ICC is at maximum temperature. 8-D24 Am2930 Am2930 SWITCHING CHARACTERISTICS Tables A, B, e and' 0 define the timing characteristics of the Am2930. Measurements are made at 1.5V with V IL ~ OV and V IH = 3.0V. For three-state disable tests, CL = 5.0pF and measurement is to O.5V change on output voltage level. I. Typical Room Temperature Performance. Vec = 5.0V, TA = 25°C TABLE IA TABLE IC TABLE 10 Clock Characteristics. Combinational Propagation Delays. Set-up and Hold Times. All in ns. All in ns. All relative to clock Minimum Clock LOW Time 18ns Outputs fully loaded. C L = 50pF. LOW-to-HIGH transition. Minimum Clock HIGH Time 20ns r- I~ CP: Output ---' From Ci+4 CiH Set-up Hold TABLE IB Input , Y G,P Cn+4 14=L 14=H Full Empty Input Time Time Output Enable/Disable Times. 14 . 0 61 50 57 61 69 52 14 . 0 68 All in ns. CC 46 32 39 53 29 cc 53 C L = 5.0pF for output disable tests. Cn 25 17 32 lEN 39 From To Enable Disable C; 14 14 Cn 28 18 17 CP 52 40 46 33 58 40 40 C; 18 OE y CC 0 37 23 30 43 o (RE = L, 14 (Nole 1) y 39 27 lEN 27 I 14 •0 = 0-8 or 10-15) o (All other conditions) 44 14 • 0 (Nole 1) Y 57 41 t3 Note 1: "Suspend" instruction. RE II. Guaranteed Performance Over Commercial Operating Range. Vee = 4.75 to 5.25V, TA = 0 to 70 0 e TABLE IIA TABLE IIC TABLE 110 Clock Characteristics. Combinational Propagation Delays. Set-up and Hold Times. All in ns. All in ns. All relative to clock Minimum Clock lOW Time 31ns Outputs fully loaded. CL = 50pF. LOW-to-HIGH transition. Minimum Clock HIGH Time 33ns ~ ~r-­ Output From Ci+4 Ci+4 Set-up Hold TABLE liB Input y G,P Cn+4 14=L 14=H Full Empty Input Time Time Output Enable/Disable Times. 14 •0 81 67 77 80 91 69 14 . 0 114 All in ns. CC 63 45 55 72 42 CC 75 C L = 5.0pF for output disable tests. Cn 32 25 45 lEN 55 From To Enable Disable C; 22 22 Cn 43 OE y 27 26 CP 69 53 61 43 78 55 55 C; 32 5 - CC 0 49 33 40 59 o (RE = L, 25 (Note 1) y 55 37 14 . 0 = 0·8 or 10·15) lEN 40 14 •0 o (All other conditions) 66 (Note 1) y 80 55 RE 24 Note 1: "Suspend" instruction. III. Guaranteed Performance Over Military Operating Range. Vce = 4.5 to 5.5V, Te = -55 to +125°e TABLE iliA TABLE IIIC TABLE 1110 Clock Characteristics. Combinational Propagation Delays. Set-up and Hold Times. All in ns. All in ns. All relative to clock Minimum Clock LOW Time 35ns Outputs fully loaded. CL = 50pF. LOW-Io-HIGH transition. Minimum Clock HIGH Time 35ns ~ output From CiH Ci+4 , Set-up Hold TABLE IIIB Input y G,P Cn+ 4 14=L 14=H Full Empty Input Time Time Output Enable/Disable Times. 14 . 0 88 74 82 87 97 78 14 . 0 124 All in ns. CC 68 52 60 78 47 CC 80 C L = 5.0pF for output disable tests. Cn 37 30 46 lEN 69 From To Enable Disable C; 23 23 Cn 52 ~. 74 58 66 48 84 60 60 37 OE y 32 31 ~ o (RE ~ L. CC 55 38 45 - j 65 30 (Note I) y 60 42 ~0.8 or 10·15) lEN 45 14 • 0 o (All other conditions) 72 (Note 1) y 85 60 RE 29 Note 1: "Suspend" instruction. 8-025 INDEX CP1600 8255 PPI devices used with. 1-42. 1-43 direct addressing. 2-3 6800 support devices not compatible with. 1-44 implied addressing. 2-4 INS8900/PACE. See PACE/INS8900 I/O port pin characteristics. 2-30 MC68000 stack addressing. 2-5 absolute data addressing. 7-30 8086 address registers. 7-3 AX register. 5-5 autovector interrupt response. 7-27 base relative. indexed addressing. 5-15 bus and address error exception processing. 7-25 BCD addition. 5-49 data registers. 7-2 BCD division. 5-51 exception priorities. 7-23 BCD multiplication. 5-51 exception vector table. 7-23 BCD subtraction. 5-49 externally generated exceptions. 7-23 Bus Interface Unit (BIU). 5-30 immediate data addressing. 7-37 BX register. 5-5 implied register addressing. 7-32 Code Segment register. 5-8 internally generated exceptions. 7-22. 7-23 Control signals. simple and complex. 5-28 interrupt request exception processing. 7-26 CX register. 5-5 memory interface. 7-9 data memory base relative addressing. 5-16 operating modes. 7-22 Data Segment register. 5-11 program counter relative addressing. 7-32 Destination Index register. 5-10 read timing. 7-13 direct memory addressing. 5-13 register direct addressing. 7-30 dual bus complexity. 5-28 register indirect address. 7-30 DX register. 5-5 reset exception processing. 7-25 -8080A register compatibility. 5-5 spurious interrupt. 7-27 Execution Unit (EU). 5-30 Stack Pointer. 7-4 external memory addressing. 5-24 Status register. 7-5 Extra Segment register. 5-10 wait state. 7-14 hold. in min. and max. mode systems. 5-39 write timing. 7-14 implied memory addressing. 5-14 MicroNova I/O busA-12 indirect addressing. 5-22 Nova instruction queue. 5-31 addressing. 4-6-9 interrupt return. 5-46 address space. 4-23 interrupt vector table. 5-44 busy status. 4-21 I/O port addressing. 5-21 done status. 4-21 maskable interrupt. 5-44. 5-45 registers. 4-22 non-maskable interrupt. 5-44. 5-45 9440 program counter. 5-8 initialization. 4-16 program relative addressing. 5-21 instruction fetch. 4-24 reset. 5-27 I/O wait states. 4-28 Segment registers. 5-7 memory read. 4-24 software interrupts. 5-44. 5-45 system bus. 4-14 Source Index register. 5-10 Stack Pointer register. 5-9. 5-11 PACE. See a/so PACE/INS8900 Stack Segment register. 5-9 clock signals. 1-11 8212. used in INS8900 system level 0 interrupt problems. 1-24 as input port. 1-39. 1-40 stack interrupt problems. 1-22 as output port. 1-41 substrate bias voltage. generating. 1-35 8251 US ART. used in INS8900 system. 1-43 TTL-level bus. 1-2 8253 Programmable Counter/Timer. PACE/I NS8900 used in INS8900 system. 1-43 address latches and decoders. 1-2 8288 Bus Controller bidirectional transceiver element (BTE). 1-2 interrupt signals. 5-110 BTE mode control signals. 1-37 I/O bus mode. 5-109 busses. floating. 1-15 memory protect. 5-109 CONTIN signal. 1-15 write control signals. 5-109 CPU-initiated DMA block data transfers. 1-16 INS8900. See a/so PACE/INS8900 cycle-stealing DMA. 1-17. 1-18 address/data lines. demultiplexing. 1-38 data input cycle. 1-12 control signal polarity considerations. 1-39 data output cycles. 1-13 8251 and 8253 used with. 1-43 direct addressing options. 1-24 xvii PACE/INS8900 (Continued) parity options. 3-105 direct indexed addressing. 1-7 Read register addressi ng. 3-100 OMA block data transfers. 1-16. 1-17 receive eRe. 3-102 execution speed. 1-1 received character size. 3-106 Extend signal for slow I/O operations. 1-13 register select. 3-100 Extend used to suspend I/O during DMA operations. SDLC configurations. 3-105 1-17 SDLC loop. 3-111 Halt state. 1-14 SDLe receive logic. 3-104 interrupts. 1-21-23 serial I/O signals. 3-98 logic level. 1-2 Status register. 3-106 machine cycle. 1-12 sync strip. 3-105 NHALT signal. 1-15 test mode. 3-102 power supply. 1-1 transmit controls. 3-102 processor stall. 1-15 transmit operation. 3-104 registers. saving during interrupts. 1-22 Write register addressing. 3-101 return from interrupt. 1-21 TMS 9940 signal differences. 1-10 CRU bit utilization. 3-59 split base page. 1-6. 1-7 hold logic. 3-64 stack interrupts. 1-5 idle logic. 3-64 STE clock frequency. 1-35 expansion mode. 3-60 system timing element (STEl. 1-2 multiprocessor system interface. 3-61 TMS 9900 simple CRU I/O mode. 3-59 context switch. 3-5. 3-6 sync mode. 3-64 memory addresses. 3-3 TMS 9980 series clock logic. 3-49 direct addressing. 3-6 2901 indexed addressing. 3-6 ALU logic. 8- 13 instruction execution sequences. 3-18 carry status. 8-24 internal operations machine cycle. 3-15 data input. 8-33 interrupt vector map. 3-27 half-carry status. 8-25 multiple interrupt hardware considerations. 3-30 local RAM. 8-7 program memory addressing. 3-8 microcode. sample. 8-25 TMS 9902 microinstruction. 8-9 break. 3-91 multiply. 8-35 break logic. 3-86 overflow status. 8-24 Control register. 3-86 Q register. 8- 12 device initialization. 3-84 RAM and CPU registers. 8-10 error flags. 3-93 rotate operation. 8-25 internal clock signal. 3-88 sample microcode. 8-25 interrupts. 3-86. 3-87 shift operation. 8-25 receive logic. 3-92 sign status. 8-24 receiver status. 3-87 status logic. 8-24 register addressing. 3-84 zero status. 8-24 reset. 3-86 2903 Status register. 3-87 ALU functions. 8-57 test mode. 3-86 ALU input. 8-48 timer status. 3-87 ALU input options. 8-44 Transmit/Receive Data Rate register. 3-88 ALU operand options. 8-49 transmit event sequence. 3-90 ALU output destinations. 8-61 transmitter status. 3-87 ALU shifter. 8-61 TMS 9903 Arithmetic and Logic Unit (ALUl. 8-49 asynchronous break logic. 3-103 destination options. 8-59 asynchronous receive. 3-110 double length normalization. 8-67. 8-68 asynchronous transmit. 3-109 increment function. 8-72 bisync logic. 3-105 local RAM addressing. 8-56 clock rate option. 3-106 normalize special functions. 8-67 Control register. 3-100 shift logic. 8-60 CRC options. 3-106 sign extend logic. 8-63 device intialization. 3-109 signal/magnitude twos complement function. 8-69 device reset. 3-100 single length normalization. 8-7 external sync logic. 3-104 slice significance select. 8-45 HOLC abort. 3-104 status signals. 8-46 initialize CRC. 3-100 three-address microcycle. 8-56 initialize transmit/receive. 3-100 two-address timing. 8-56 interface signal. 3-97 twos complement divide function. 8-77 interrupt enable/disable. 3-102 twos complement multiply function. 8-73 modes. 3-97 unsigned multiply. 8-72 monosync logic. 3-105 2909 output mask. 8-99 NRZI select. 3-106 2909/2911 Parameter register. 3-103 Address. 8-95 xviii data output. 8-99 indirect memory addressing. 6-18 immediate data input. 8-95 instruction fetch machine cycle. 6-23 incrementer. 8-99 I/O instructions. 6-36 instruction skip. 8-100 LDPS instruction. 6-39 jump. 8-100 M1 and MO instructions. 6-41 microprogram counter. 8-99 memory interface logic. 6-20 multiple jump. 8-103 memory read machine cycle. 6-23 output select. 8-95 memory write machine cycle. 6-23 output zero control. 8-99 multiply instruction. 6-39 sequential addresses. 8-99 New Program Status Area pointer. 6-8 single instruction reexecution. 8-100 normal mode. 6-3 stack. 8-100 primary memory reference instructions. 6-37 subroutine call. 8-102 principal memory addressing modes. 6-37 subroutine nesting. 8-103 Program Counter 6-6 2910 Refresh Counter. 6-28 add ress output. 8- 11 0 secondary memory reference instructions. 6-37 condition codes. 8-113 shift instructions. 6-41 data input. 8-110 sixteen-bit registers. 6-9 increment. 8-113 software traps. 6-32 instruction codes. 8-113 Special I/O instructions. 6-37 microprogram counter. 8-110. 8-113 stack. 6-18 microprogram initialization. 8-120 stack instructions. 6-41 microprogram jump. 8-120 Stack Pointer. 6-3 microprogram jump-to-subroutine. 8-120 status. 6-6 stack. 8-113 subroutine call. 6-40 2930 series system call. 6-40 accumulator. 8-125 system mode. 6-3 carry logic. 8-129 thirty-two-bit registers. 6-9 Index register. 8-129 wait state. 6-23 instruction codes. 8-125 Z8001 Program Counter. 8-129 address representation. 6-3 Stack Pointer. 8-129 base address. 6-9 Stack. Push. Pop. 8-129 long segmented base relative addressing. 6-17 long segmented direct memory addressing. 6-13 Z8000 long segmented indexed addressing. 6-15 auto-increment. 6-18 program relative addressing. 6-18 auto-decrement. 6-18 segmented mode. 6-7 base relative addressing. 6-15 short segmented base relative addressing. 6-16 block transfer instructions. 6-40 short segmented indexed addressing. 6-14 byte registers. 6-9 Z8002 conditional jump instructions. 6-40 direct memory addressing. 6-12 divide instruction. 6-38 indexed addressing. 6-14 implied indexed addressing. 6-15 program relative addressing. 6-17 implied memory addressing. 6-11 short segmented direct memory addressing. 6-13 xix OSBORNE/McGraw-Hili Books of Interest The SOS6 Book by R. Rector and G. Alexy SOSO Programming for Logic Design by Adam Osborne 6S00 Programming for Logic Design by Adam Osborne ZSO Programming for Logic Design by Adam Osborne SOSOA/SOS5 Assembly Language Programming by L. Leventhal 6S00 Assembly Language Programming by L. Leventhal Z80 Assembly Language Programming by L. Leventhal 6502 Assembly Language Programming by L. Leventhal ZSOOO Assembly Language Programming by L. Leventhal et al. Running Wild: The Next Industrial Revolution by Adam Osborne PETICBM Personal Computer Guide - Second Edition by Adam Osborne and Carroll Donahue PET and the IEEE 4S8 Bus (GPIB) by E. Fisher and C. W. Jensen Practical Basic Programs by L. Poole et al. Some Common BASIC Programs by L. Poole and M. Borchers Payroll with Cost Accounting - CBASIC by Lon Poole et al. Accounts Payable and Accounts Receivable - CBASIC by Lon Poole et al. General Ledger - CBASIC by Lon Poole et al. Some Common Basic Programs - PETICBM edited by Lon Poole et al. OSBORNE/McGraw-H ill Microprocessor Handbook Series OSBORNE 4 & 8-Bit Microprocessor Handbook by Adam Osborne and Gerry Kane OSBORNE 16-Bit Microprocessor Handbook by Adam Osborne and Gerry Kane An Introduction to Microcomputers: Volume 3 - Some Real Support Devices by Gerry Kane and Adam Osborne 8089 I/O Processor Handbook by Adam Osborne CRT Controller Handbook by Gerry Kane 68000 Microprocessor Handbook by Gerry Kane