I 20151 Bahama Street Chatsworth, California 91311 (213}~7596 (B1B) 7()(}8700 (B1B) 341-4411 H068450 OMAC (Direct Memory Access Controller) APPLICATION NOTE #U60 .HITACHI H680DMAC-EAN When using this manual, the reader should keep the following in mind: 1. This manual may, wholly or partially, be subject to change without notice. 2. All rights reserved: No one is permitted to reproduce or duplicate, in any form, the whole or part of this manual without Hitachi's permission. 3. Hitachi will not be responsible for any damage to the user that may result from accidents or any other reasons during operation of his unit according to this manual. 4. This manual neither ensures the enforcement of any industrial properties or other rights, nor sanctions the enforcement right thereof. HD68450 DMAC The HD68450 DMAC is a 16-bit microprocessor that is bus-compatible with HMCS68000 systems, and has the following features: • 4 independent DMA channels (programmable priority order) • Maximum Transfer Rate is 4M Bytes/sec (8MHz) • Various Multi-Data-Block Transfer Modes: Continue Mode, Array Chaining Mode, and Linked Array Chaining Mode • High Reliability of Data Transfer facilitated by Error Detect, Error Interrupt Vector, and Exception features. • 16M-Byte Address Space (same as the HD68000) • Memory-to-I/O Device Transfer, Memory-to-Memory Transfer • Programmable Operation Mode and Transfer Mode • External Transfer Request, Internal Transfer Request (Auto-Request) • Programmable System Bus Bandwidth Utilization The HD68450 is also applicable in other processor systems (the 8086 system). CONTENTS page I. HD68450 DMAC Operation ................................................ . 1.1 HD68450 Operating State .. " .. , .................. , .................. , ....... I 1.2 Transfer Types ....... " . " ........... '" .. , ... , ... , ...................... , ... 1 1.3 Internal Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5 1.4 Signals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 7 1.5 Exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 8 2. System Example ............................................................. 10 3. HD68450 Transfer Operation and Circuit Examples .......................... , 13 3.1 FIFO Register Operation .................................................... 13 3.2 FC Application Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 13 3.3 DMAC Interrupt Request Examples .......................................... 13 3.4 Peripheral Control Line (PCL) Operations .................................... 16 3.5 Demultiplex Examples for Address/ Data Multiplexed Bus ................... , 17 3.6 HIBYTE Application Example ...................... ~ . . . . . . . . . . . . . . . . . . . . . . .. 17 3.7 Low Speed I/O Device Circuit Example ...................................... 18 3.8 High Speed I/O Device Circuit Example ..................................... 18 3.9 6800 Family Application Examples ........................................... 18 3.10 Encode Example for Exceptions ............................................. , 18 3.11 Priority Circuit Example (Daisy Chaining) .................................... 18 3.12 8086 System Application Examples ........................................... 18 4. HD68450 DMAC Control Program .......................................... 39 4.1 Basic Control Routine .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 39 4.2 Transfer Termination Routine ............................................... , 39 4.3 Continue Mode Program Example .......................................... , 39 4.4 A Program Example in Array Chaining Mode ............................... , 39 4.5 A Program Example in Linked Array Chaining Mode ........................ 45 5. Data Sheets ................................................................. 49 HD68450, HD68450Y DMAC ............................................... 51 HD68000 Series ............................................................. 99 I. HD684S0 DMAC Operation Auto-Request when a certain internal condition is satisfied. The R'EQ signal outputted can then inform an external device of the I.I HD684S0 Operating State start of transfer. The 2nd and succeeding operands can be trans- The H D68450 has internal control registers and performs ferred with External Request. required operations through control w"rds written into the regis- ters by the MPU. The DMAC state is divided into three modes: 1.2.2 Block Transfer Classification I) MPU Mode: A bus master (MPU, DMAC) chip-selects the The DMAC supports data block transfers by request genera- DMAC, or the MPU acknowledges the DMAC's interrupt tion methods shown in Table 1.1. request, reading or writing the contents of the DMAC's In Continue Mode, the DMAC transfers a pair of blocks internal registers. without software intervention. It can transfer multi blocks by 2) DMA Mode: The DMAC owns bus mastership, and is giving the next block information (address and word count) to transferring data or preparing for data transfer. the DMAC internal registers, and setting CNT bit again during 3) IDLE Mode: The DMAC is waiting for a transfer request or the transfer of the second block. MPU access, and most of the bus control signals are In Array Chaining Mode, the MPU prepares for the array table three-stated. (transfer address and word count listed in main memory). The DMAC transfers multi data blocks up to "2'· =64K" according to In normal operation, the DMAC transfers operands in the fol~ the order in the array. lowing sequence: Linked Array Chaining Mode is almost the same as Array Chaining Mode, except the block information in the array need (I) The initiation phase, in which the MPU sets up control regis- not be listed in the transfer order sequentially. Instead, linked ters, transfer address, and transfer counts. The DMAC is address (block information which is going to be transferred next) enabled to accept transfer request. is given as a part of the block information. (2) The transfer phase; the DMAC receives requests, transfers Examples of array tables are shown in Figure 1.2. The Linked data, and writes the transfer status into the error register and Array Chaining Mode is more flexible in composing an array internal status register after completion of the transfer. table, to change the order of transfer, or to skip blocks in the (3) The termination phase; the M PU checks the post-transfer transfer order. For example, when block #2 is skipped in Array status. Chaining Mode, block #2 address and word counts must be replaced by block #3 information in an Array Table, and the The M PU determines the operation types and checks the former block #3 must be replaced by block #4, etc. transfer state by writing and reading the contents of the internal Linked Array Chaining Mode provides an easy method of registers. changing only "block #2 information address" in block #1 infor- In addition to normal operations, bus exceptions are also mation to "block #3 information address." When one block prepared (see Chapter 1.5 Exceptions). transfer has been completed, the DMAC automatically reads the next transfer block information to the internal registers. Array 1.2 Transfer Types Chaining has 3 word read cycles, whereas Linked Array Chaining has 5 word read cycles (larger overhead). 1.2.1 Classification of the transfer modes in terms of request In Continue Mode, fewer clock cycles are required to transfer generation methods. information between the DMAC internal registers. The MPU, Transfer modes which the DMAC supports are shown in Table however, must write the next block information in those DMAC 1.1. internal registers when 3 or more blocks are transferred. The External Request is generated by asserting the R'E' I Data bus A,-A, /L CS AS 68000 bus control f.DS VDS H/\V DTACK - I/O device control Bit Bus arbitration{ BG BGACK HD68450 DMAC Interrupt reques t / { IRQ Recognition lACK OWN VAS AddreSS/Data! IIJIlYTE demultiplex DilEN DOli! BEC o DOSE] Transfer end Exception { BEC, signal BEC, llTC FC o Function cOde{ FC, Fe, II Vss 121 FIGURE 1.8 HD68450 Signal Lines outputted at the end of each block transfer in Continue Mode, simultaneously, or before ~ assertion, and the BEC values and when al\ blocks are completely transferred in Chain Modes. remain in the same level for two or more clock cycles. The HALT This signal is asserted at the same time as the last ACK signal of exception is not implemented until DTACK input. If BEC's are the transfer. DONE, therefore, is not outputted in the transfer asserted after DTACK, the bus cycle occurs normally. cycle to the memory in the very last bus cycle when the transfer is from device to memory Dual Addressing. Halt DONE is also used as an input signal in order that the I/O When Halt is asserted during DMA transfer, the DMAC relin- device informs the DMAC of the transfer completion. The quishes the bus after receiving DTACK, and after normal bus cycle DMAC monitors the signal during asserting ACK signal. After completion. The D MAC does not arbitrate the bus until HALT is the DONE assertion, the DMAC stops data transfer when the negated. operand transfer is completed, and the channel operation termi- Halt is useful in the following cases: nates. When the DMAC and I/O device simultaneously assert (I) When DMAC turns over the mastership to another bus DONE, the DONE inputted from the device is ignored. The master without changing the number of the DMAC's bus DMAC outputs DTC whenever it recognizes DTACK. In the cycles. Even when the DMAC is using the bus continuously case of a 6800 compatible device, the DMAC detects the trailing and does not relinquish it, another bus master can get the edge of E clock to output DTC. I/O devices can latch the data by mastership by halting the DMAC. In this case the DMAC using the falling edge of the DTC assertion (DTACK is also resumes the bus cycle after the bus arbitration (total number useful). The DTC negation indicates the bus cycle completion. of the DMAC's bus cycles does not change). This signal is not outputted when i5'i'ACiC. is not inputted, or if (2) When transfer "trace" is performed by executing single step exceptions are entered, in order that the I/O device can detect bus cycle. transfer abnormality. Bus error 1.5 Exceptions When an error occurs during transfer. and the DMAC can not To be sure of data transfer, the DMAC can stop the bus cycle continue the operation or can not get the correct results. Bus error and retry it, or leave the recovery to the other bus master if an is asserted to stop the transfer abnormality. abnormal transfer occurs. The Exceptions are requested by the The DMAC Bus error sequence is as follows. external devices and are encoded into 3 signals. BECO-BEC2, and (!)stops the transfer and sets COC bit and ERR bit in CS~ inputted into the DMAC. BEC exception conditions are shown in Table 1.6. o checks INT bit in CCR. If INT = I. the DMAC asserts IRQ signal to interrupt the MPU. The DMAC samples BEC signals with the rising edge of the CD Keeps the address where the bus error took place and the clock and recognizes an exception condition if the ~ signals transfer count left over in the Address Register and Transfer remain in the same level for two or more clock cycles. The DMAC Counter respectively in the channel. carries out 1rnC" exceptions only when BEC assertion starts CD relinquishes the bus without other channels' transfer requests. 8 CLK 1...S1.JLs1J"L min" 2 clocks eD I l.'~:1.5 clocks ,. BR BG 2~:l.5 cI ocks J® .- I (3) I BGACK r o C)ock---MPIJ"CyC le b) ® I\. " (a) MPU cycle (4) ® 7 BUS cycle DMAC cycle MPU cycle co 4.5 •. 5 clocks ACK (b) \ " MAX. 12.5 clocks+MPU cycle , DTC '--V'- CLK MPU cycle ., BUS Idle DMAC cycle --+- Idle +MPU cycle Cycle Steal Mode (sensed by rising edge of REQ) FIGURE 1.9 Bus Arbitration Timing TABLE 1.6 (BEC) Exception Condition Types BEC2 BECI BECo Exception Applications Conditions 1 1 1 No exceptions Usual operation 1 1 0 Halt Used when DMA trnsfer is stopped temporarily by external circuits. 1 0 1 Bus error Used when a serious system error occurs. For example, the DMAC bus cycle does not terminate. 1 0 0 Retry Used when the DMAC bus cycle has not been carried out correctly, and needs retry. 0 1 1 Relinquish Used when the MPU uses the bus before the and Retry termination of the DMAC bus cycle ,and when the DMAC cycle must be continued from the following cycle. 0 1 0 Not used -- 0 0 1 Not used -- 0 0 0 Reset Power on reset. System reset. Bus error is useful in the following cases: Relinquish and Retry can be used when the MPU service is (I) When preventing system dead lock (not receiving DTACK necessary to correctly transfer the operand after the bus cycle signal), "a watch dog timer" is used, and the Bus error is starts. If the I/O device asserts Relinquish and Retry while asserted when the time is out. . requesting an interrupt to the MPU, the DMAC releases the bus (2) When page fault is recognized in virtual memory environ- so that the M PU may service the interrupt routine, and negates ment, Bus error is asserted. Relinquish and Retry-recovering the fault with minimum over- head. The DMAC obtains the bus again and resumes the transfer. Retry When Retry is recognized during the DMAC bus cycle, the DMAC stops the bus cycle and repeats the same bus cycle right Reset after the negation of the Retry signal. During the whole sequence, When the DMAC recognizes Reset, it relinquishes the bus, the DMAC holds the bus (OWN and BGACK are kept asserting). clears GCR, and resets DCR, OCR, SCR, CCR, CSR, CPR, and When the DMAC accesses memory or device, and an error is CER of all channels. The interrupt vector registers are set to $ detected in the transferred operand, external circuitry asserts OF(HEX), un initialized interrupt vector number. Retry to transfer the operand again. For example, when an error is found through parity information during a bus cycle, or when DTACK does not return in spite of correct address, Retry can be 2. System Example performed. HD68450 DMAC in HMCS68000 is shown in Figure 2.1. Since only basic signals are shown, users are required to add Relinquish and Retry necessary circuitry to an actual system (See Chapter 3). If whole When the DMAC recognizes Relinquish and Retry, it sets all address space is managed with a memory management unit control lines, data bus, and address bus to three state, and (MMU), the MPU physical address space is the system address releases the bus temporarily. If the BEC exceptions are negated, bus. The Circuit example is shown in Figure 2.2. The MMU's the DMAC outputs BR again to get the bus mastership and page fault is encoded to be the DMAC's Bus error input signal. retries the bus cycle in which Relinquish and Retry are asserted. Refer to Chapter 3 for further examples of each circuit. 10 ,........ Do~ D" Do ~D,. - r- r- ~==;=~~====1Data & Address Bus Iv----YI Interface FDC, etc. - ~ - J., Do ""'-'D 15 -y - REQo} -- -" -------v A,~A23 HDC, etc. :=- I---- ~ ACK Channe 1 o '------- PC Lo +0 AI---A71¢==~ CS~ P r= AS Mem & MMU -RE(.!,} ~~anne 1 ASI-----l f--- AS LDSI-----l r- - LDS '-----lACK, ' - - - - - l p c I., HD6845U lJDSI-----l R/WI-------j f--- r- - lJDS IVW REQ2} channel OMAC DTACKI-----l r- - DTACK /---------;ACK '-- - FCo-FC, 1------llPi'iC"'IC,: + 2 r--- - ERROR P;lrall ed I/O Device, ~,tc . H0680UO MPU lJi)S ,...- r-- Periphr. IVW - I- DTACK - t-- VPA VMA r-- I- I- - - E - I- 1-----+---1E 3 §=r- Ene, r-- t-- t-- 1 - - - - - - 1 1 RQ .... '- '- FIGURE 2.1 Basic System Configuration 11 r5V +5V R!W 1 AS A I-A 23 23 HD68000 MPU +5V PA I -PA7 FC o-FC 2 t MMU 7 IPL o-IPL 2 0--- ~ R/W - AS 3 As-A23 16 e MAS AI-A, 5 Circuit FC o-FC 2 r-r- PA s-PA 23 16 R/W - AS FC o-FC 2 3 T r 23 AI-A 23 IRQ IRQ ~~+5V !+!iV HV~ OWN 1 ~ FAULT H068+50 OMAC ~ 7b 1 ~) .c "" --<: O2 60 BEe. D--{; 0\ 50 ~ ':s" I:Q .c BEC o 0 +0 ,... <0 '"'" ~ 30 BERR '-' "'0 "'0 '":s I:Q 2 '":s <: I:Q '0 OJ I- 10 !., .:; C I- 0 > ~~ ~ U Priority Encoder FIGURE 2.2 Conceptual Diagram of the DMAC in virtual address 12 3. "D68450 Transfer Operation and Circuit Examples assigned in a 68000 system (e.g., the supervisor data area or the user data area) becomes possible in Dual Addressing Mode. (See 3.1 FIFO Register Operation (Data Pack and Unpack) Table 3.1) As shown in Figure 3.1, the DMAC possesses a 3-byte FIFO (First In First Out) register, which reads and writes an operand in TABLE 3.1 68000 Function Code Table byte or word unit. The FIFO register makes it possible to operate on various operand sizes (abbreviated as OP), and to operate on I/O devices with various port sizes (data bus bit length, abbre- viated as P) for memory to I/O transfer. In these operations, the Function Code transfer mode is Dual Addressing. In Figure 3.1, I/O is an I/O device with P=8, and even address. Classification When the DMAC transfers operands from 1/0-1 to memory I to FC2 FCl FCO 6, it reads two byte-operands in the first and second bus cycles from 1/0-1 into the FIFO, and writes a word operand in the third bus cycle from FIFO to memory. Thus, the bus efficiency of DMA transfer is increased with PACK operation (to transfertwo 0 0 0 (Unassigned) byte-operands as one word). When the transfer is from memory 0 0 1 User Data to I/O-I, a word operand is read from memory I and 2 into the 0 1 0 User Program FIFO, and is written as two byte-operands into 1/0-1 by UNPACK operation (one word into two bytes). 0 1 1 (Unassigned) 1 0 0 (Unassigned) 3.2 FC Application Examples 1 0 1 Supe~visor Data The DMAC possesses the following three registers in each 1 1 0 Supervisor Program channel: 1 1 1 Interrupt Acknowledge • MFC (Memory Function Code register) • DFC JJ)evice Function Code register) • BFC (Base Function Code register) FCO-FC2= III indicates the interrupt acknowledge cycle. The In memory access bus cycles in both Single Addressing Mode DMAC should not output this code. When lACK input is and Dual Addressing Mode, the MFC contents are outputted asserted during DMA transfer, address error occurs. through FCO-FC2 pins at the same time as address output. In device access bus cycles in Dual Addressing Mode, the DFC 3.3 DMAC Interrupt Request Examples contents are outputted. In Array Chain and Linked Array Chain The DMAC can output ~ to request an interrupt to the Modes, the BFC contents are outputted in the bus cycles which MPU under the conditions shown in Table 3.2. "L~ means IRQ load the block information from the Array Table in memory. assertion. I RQ is asserted as long as those conditions are satisfied. Because arbitrary values can be written in those function code To negate I RQ (make "H~ level), INT bit in CCR must be reset, or registers, the data transfer between different memory spaces "FF(HEX)" must be written in CSR to reset CSR. /' • 1/0-1 I': :'\ (OP=8, P=8,A=EVEN) • 1/0-3 • DMAC r- - - - --- -- - -- - -- ----, (OP=8 or 16,P=16) ~ t:::) , , , I G) (3) (2) (i) I ,, ,, FIFO I I I I-- <=:> ® 0 ® ~ • 1/0-2 , - (OP=B, P=B, A~ ODD) ¢ (2) , ,, (t) I I ¢: ~ CD ® ® (I) (3l @ (1) ~ ,L ___________________ II ~ D. - D" data bus Do- D7 data bus "- -I (i) (2) (3) (I) (5) (6) • Mem. (OP=B or 16, P=lti) FIGURE 3.1 Data Bus Connection Example in Dual Addressing Mode 13 HV JID68000 JID68450 MPU DMAC IPLo p---~Ao IPk AI b-----~-qIRQ IPL, A. EI FIGURE 3.2 Connection Example of IRQ and lACK Various transfer examples using FIFO are given in the followings. Example 1) I/O (OP=8, P=8, A=EVEN, CD to @ )--...Memory «2) to ®) DMAC bus cycle R-B 1 byte read from I/O ( ---- I/O (OP=16 or 32, P=16, CD to ®) DMAC bus cycle R-W --- 1 word read from memory (CD (6) or I/O ( CD ® ) W-W --- 1 word write to I/O (CD ®) or memory (CD @) R-W --- 1 word read from memory ( ® ®) or I/O ( Q) ®) W-W --- 1 word write to I/O (Q) ®) or memory ( @ ®) 15 Figure 3.2 shows IRQ/lACK examples in the DMAC and the Figure 3.4 shows BIT mask example. Because an interrupt has a MPU system, where the interrupt level of the DMAC is four. higher priority than a data transfer, BG should be masked in However, this level is arbitrary. lACK cycle. When the multi block transfer is in Continue Mode or in Chaining Modes, the transfer status needs to be checked between 3.4 Peripheral Control Line (PCL) Operations block transfers in some applications. In Continue Mode, since the rn. pin of each channel can be used for four different func- BTC bit is set after the first block transfer completes, the tions realized by setting PCL bits and DTYP bits in DCR as DMAC can request interrupt according to Table 3.2. shown in Table 3.3. However, Mode 3 becomes invalid when the In Chaining Modes the DMAC cannot request interrupt at the device type is 6800, or ACK type with IrnAUY, or 68000-type in end of each block transfer. Instead, when the last block transfer AutO-Request Mode. Similarly, Mode 4 becomes invalid when completes, interrupt request is possible because the COC bit is the device type is 6800, or ACK type with READY. set. In Chaining Modes, if the DMAC needs to request interrupt In Mode I, PCT bit in CSR is set when PCL line is asserted at the end of each block transfer, circuits shown in Figure 3.3. are ("H" to "L"). Mode I is usefulto record a status change of an 1(0 required. Appropriate values have been written in BFC, MFC, device. The timing chart for setting the PCT bit is shown in Figure and DFC, and the PCL signal is formed by decoding thefunction 3.5. codes, to enable the DMAC to request interrupt. (It should be Mode 2 is the function to interrupt the MPU via the DMAC determined whether the FC's are used by the Memory Manage- from the I/O device, using the PCL signal change from "H" to ment Unit (MMU). "L". In this case, the INT bit of CCR should be set. The timing TABLE 3.2 IRQ Output Condition CCR CS R IRQ Output INT cac BTC NDT ERR ACT PCT'" PCS a x x x x x x X H 1 0 0 0 0 x 0 X H 1 1 X X X a x x L 1 0 1 0 0 1 X X L 1 0 0 0 0 X 1 X L *: When the PCL function is set on interrupt input. X: don't care. FC. FC, FC. AS 0068000 00684050 MPU LSl408 DMAC t.:>--+-d IRQ EI FIGURE 3.3 Circuit Example to Generate Interrupt at the end of each block transfer in Chaining Modes 16 . o BR HV ~ "'p---c I3G L LS 161 S HD6R450 D Q CLEAH LS74- C\ Q t= E.p ET ~ImY DMAC r-- >CK RESET ~ CLK 1 CLK FIGURE 3.4 BG input Mask example chart from PCl signal change to I RQ output is shown in Figure 3.5 Demultiplex Examples for Address/Data Multiplexed Bus 3.5. As described in Chapter 1.4, (JWliI, UAS, 1'5lffiN, and DDIR Mode 3 is used to ascertain the internal process time interval to are used for bus demultiplexing. OWN is used for bi-directional activate channels, since the STR bit of CCR is set. Table 3.4 buffer control. Signal application examples are shown in Figure shows the necessary ClK cycles in Mode 3 from the MPU write 3.6. cycle to set STR bit until start pulse output. Mode 4 aborts the current transfer. This signal is inputted 3.6 HIBYTE Application Example (Bus Matching) through Pet,and EXTERNAL ABORT ERROR is recorded in Data transfer between devices with different port sizes in Dual CER, and ERR bit is set in CSR. Timing is shown in Figure 3.5. Addressing Mode is described in Chapter 3.1. In Single TABLE 3.3 Conditions to set PCl functions DCR OCR Mode PCL Fune t i on Mode PCL,H PCL,L DTYP,H DTYP,L REQG,H 1 Status Input 0 0 x x X 2 Status Input with Interrupt 0 1 X X x 3 Start Pu I se ,Nega t ive 1/8 CLK 1 0 x 1 0 x 0 1 4 Abort In pu t 1 1 x 0 x x : don't care CLK pCL Input (Mode 1) PCT Bi t Set ----4-~.J (Mode 2) PCT Bit Set _ _ _ _ _ ~..J IRQ UJtput (Mode 4) I PCT Bit Set _ _ _ _ _ _- J ERR Bit Set ________________________________________~/ FIGURE 3.5 Timings for Mode 1,2, and 4 17 TABLE 3.4 Clock Cycles from the MPU Write Cycle Figure 3.14 shows an application of HD68A43 (FDC) and to set STR bit to output Start Pulse (Mode 3) HD68B21 (PIA). The FDC makes a request by setting TxRQ High. The negated TxRQ is inputted to PCL as READY. Trans fe r Mode CLK Numbers* 3.10 Encode Example for Exceptions No Chain 39 An Exception request is made by external circuits and is inputted into the DMAC's BEC" ~ BEC 2• Figure 3. I 5 indicates an A r ray Chain 59 encode example. Link Array Chain 61 Exception Examples: Figure 3.16 shows the bus cycle time out error example. The transfer stop example is given in Figure 3.17. *MPU write cycle: 14 clock cycles If the DMAC does not have the bus, do not input the bus DMAC memory read cycle: 4 clock cycles Exceptions. Exceptions should be inputted after the AS output (or UAS negation), as shown in Figure 3.15. Addressing Mode, HrnY'fE is used for bus matching. 3.1 I Priority Circuit Example (Daisy Chaining) Figure 3.7 gives an example of bus matching between an 8-bit When multi DMAC's are used, priority circuits like Daisy I I 0 device and a 32-bit memory system. As shown, the I I 0 device Chain are required. In the following example, the D MAC nearer must be in the lowest byte of the data bus. HIBYTE is outputted the MPU has higher priority. only when even address is accessed, and when the DMAC oper- ates byte operand in the Single Addressing Mode. See Figure 3.5. 3.12 8086 System Application Examples The example shown in Figure 3.8 is between a 16-bit II 0 device Applied in an 8086 system, the H D68450 .is superior to other and a 32-bit memory system. DMAC alternatives because of the following features: I) High speed data transfer operation by Single Addressing 3.7 Low Speed I/O Device Circuit Example Mode Figure 3.9 shows a circuit for a low speed 110 device; e.g., 2) Ease of operation for multi block transfer floppy disc controller. Figure 3.10 gives the timing chart. Since a 3) Maximum bus exception utilization DMA transfer request signal (DRQ) from a low speed 110 device Basic differences between the 8086 system and the H D68450 is generated in every D MA transfer cycle, the channel is pro- are as follows: grammed to be External Request and Cycle Steal Mode. The data I) Address bus, data bus latch timing in write cycle (memory-device) is the timing when 2) Memory Structure the write enable signal (WE) changes from "L"-"H". Data on the The H D68450 and the 8086 are different in arrangement of data bus is valid only while the data strobe signal (UDS or LDS) address and data bus. Address bus is connected to the system bus is "L"; therefore, the data latch timing must be made from DTC through LS373 latch. Data bus is connected to the system bus assertion timing ("H"-"L"). This assertion occurs at least 30ns through LS245, bi-directional transceiver. earlier than the UDS or LDS negation ("L"-"H"). BIlE .. 3.8 High Speed I/O Device Circuit Example FIFO is used as external data buffer in the example shown. ADo - AD I ~---",I Figure 3.11 shows the application of the DMAC and FIFO. Figure 3.12 gives the control timing chart in read and write cycles to FI FO. Since data of several words is continuously transferred in DMA transfer between FIFO and memory, the external request mode should be set to Burst Mode. The data write timing to FIFO is derived from DTC output, and the timing to negate Do -D '5 the Burst request from "L" to "H" is made with up I down counter. In write cycles to FIFO, the Burst request is negated synchro- nously with DTC assertion, when the counter number reaches 8086 "the operand number transferred in a burst"(" I6" in Figure 3.11). LDS LDS In read cycles from FIFO, the Burst request is negated syn- chronously with DTC when the counter number becomes two. In UDS UDS Burst Mode, the Burst request in both read and write cycles should be negated before the last transfer starts. In the last DMA A, - A7 <===============> A, - A7 transfer when TC=O (transfer words counter = 0), DONE is out- putted at the same timing as ACK. This signal is used to reset the Burst request. 3.9 6800 Family Application Examples Since 6800 family devices are given their addresses on 68000 Do -D '5 memory, and are used by memory mapping, the transfer mode is Dual Addressing. The block diagram is shown in Figure 3.13. Please note: HD68450 I) E clock is inputted from the PCL pin, and is used to syn- chronize 6800 devices and the DMAC. The H D68450 and the 8086 have different ways to address 2) 6800 devices close the data bus at the falling edge of E clock in memory. When HD68450 is used in the 8086 system, UI)S' read cycle from the 6800 device. The D MAC, however, latches (Upper Data Strobe) should be connected to AOand LDS (Lower the data when DTC is asserted. Therefore, the data outputted Data Strobe) to BHE. For data bus, the upper byte bus and the from the 6800 device needs to be latched by the external latch. lower byte bus must be switched. In this configuration, the 8086 3) For 6800 device chip select, the address decoder and the can access the internal registers of the H D68450 by the same address strobe are used. method as memory. 18 r- r- r- r OE DIR DB EN DDIR 1DIR A OE ro-ny '8 LS24.5 Do/AI8 - ~idiroctional ps-Dt;, ~~ Buffer 'll D,./A .. HV OE r- ~ ~ R/W f LS24.5 ~idiroctional R/W - HIBYTE * f-- ~ HIBYTE Buffer BGACK BGACK ~ r-- ~ L '--- LS373 D-type Latch 8 A.-AI' UAS 1=' V jG~ OE OWN ~ LS373 ~ D-type '" A IS -A23 ~ Latch 8 i:1l !! '"'"'-' al '" al :I -., '-' '" :I al A.-A, / 7 LS24.5 idiroctional 7 AI -A7 ''"" "'" al '0... ~ Buffer !!., § t "" ~ 0 u jDIR OE IDIR OE LDS LS24.5 LDS ------' Bidiroctional IUDS UDS Buffer r-- ------' • LS245 IS used as a buffer for HIBYTE signal. --- "'- "'- '"'- FIGURE 3.6 Demultiplex Examples for Time Multiplexed Bus 19 II-BUS 32 bit memory lJIIlh----< R!W ,-,n--+-< HIBYTE 31 0 LH IMH iMLi LI AI AI UDS LDS H ···0 L II MH ···0 H L ML ···1 L H L ... 1 H L 8o-S3; select input (II. MH . ML. L) 8 Bit I/O FIGURE 3.7 Bus Matching (8 bit 1/0-32 bit memory) H-BUS 32 bit memory 31 0 IH!MH!ML!LI AI DDS LDS H ···0 L II MH ···0 H L ML ···1 L H L ... 1 H. L So-§; ; select input (H, MH, ML, L) 16 Bit I/O FIGURE 3.8 Bus Matching (16 bit 1/0-32 bit memory) 20 P-----------------------------~DRQ ACK p---lr--------~--------------__qCS +5V Low Speed I/O Device AO} register Address Bus { 1\0 At select "11" data registe AI Data Bus * to negate WE when DTe is not outputted FIGURE 3.9 Low Speed I/O Device Application I I I Jf-'-\ I I I \i I I /1 I I J"- I I :::-. \1 ~ 1 ttT- I \ I I j I I data bus I I \ I I I I 1 11 J 1 I I I I DTC -;\ I I LJ I 1 1 'U 1 I ~ I I j [\ I JL " 1 \ I 1 I y ,~ ~ ", 'J . " ~ ~J I 1 I I I 1 JJ I 1 I I , \ I I 1 I 1 1 I 1"'1o...----READ eYeLE.----~o-J1 1-1 ·--WRITE eyeLE~ FIGURE 3.10 Timing chart of Fig. 3.9 21 r- r-- MPU A . y FIFO " Qo Do A I I Q15 DIS r:-AD cycle HDC • A MEM , , WRITE cycle L FIFO Do Qo I I DIs QIS DMAC .. " " ....... ........ System Bus Local Bus * Hard Disc Controller (a) System Example of FIFO used as HOC Buffers FIGURE 3. I I FIFO Application Examples 22 H/W . FIFO CLKA :-l~ ------< LOAD UP '.:l <1::::= (l.C ;~ AB tlor mUNT ~INfIDL 5V DOM'I C LS193 REQ SET HD6St50 D DMAC QA Qa ~ -.... '"1 latch S Qc } LS740 QD <~~ CK R ~ -Lr RESEr ~r ACK IYI'ACK ~+5V AS . ~HV AS LDS UDS tV LOS UDS ADDRESS A AI-A. FCo-Fe 2 <,. Aa/Do-Au ID I5 Feo-Fe! (b) Circuit Example Between the DMAC and FIFO 23 ~__________~I~---------4~--~I~h£e~L~au'ut. . ILra~n~'Ur.e.r______~~ AS ------~II~I--~----~~I~I------~/: r:--- \ =--=~f-----J..--_---"~_,.__------,J:=~=~=====:E Memory Access LDS UDS R/W Memory {~t ---~H~------~~~:====~r------~======j~ Out DTACK ,. ~l-I______---'I 'r- r ---'""'\ ACK ~I r---\~ __________~!~,- FIFO { ;~ ~ Control DIC REQ {cgWlER ------;;-f:llf---.:..:--------C-O-O)-H-I:;#" ,"". Generator REQ CI~JHEQ:, I - , ~ (a) Write (MEM-FIFO) AS I~-------------,I : \~_________________~r,-- Memory LDS I~------------I I~:~-------------\,-. ________ '--__________. J. , ---,~ , 1~~_________..Jlr~:-------------\~--------~r+---- Access UDS ---i~ , ' R/W , ~1~1-----------~r---\'------------------~:,- I~ ~ Memory Out {DTACK ---il ! \\..------------..:fr-- FIFO Out ! fData ---iJ.....:--_ _• tOut ACK ---il ~I:.========::'=~ r-I''''' : 1________-{=========~::::::: r- ~,....________________+:...J/~:......------.\ : >- l;:,"~-----(-OO-)-H---""+ FIFO co_::_:, {~ '''~I~:(OI)H Generator _ REQ -0-. i - V ~ mID, ENABLE ~P'frJ--'VVY-+5V l~CLR -------.... H~;50 AC Ko ~ ~ HR~S74 ~V PC Lo p..>--__--+____--l REQo~~-_===~,_-~------~ t L~16~~ I '-------------- ~~====tf-ri=~==V~~~~---------_r-------------l UAS 1>----~k¢l>---I A,-A" PCL, f-c AalDo-~~~~ 1-*lo~'----=~=-,ocl CO=~;Ol 1------+.10" -+--:-0-"0---=0-=,,'-------1 ~ c 'kt I-------,f:loc,--'-+-~----=-"'----------- DDIR ~~ H "r '--_.... ACK, REQ, ACK,,.. .-p-~-__l~,-<:1-'-a---..Fp_(R.f.r I 0 -D to Fig 3. 6.) 0; ~ Do-D, s --=--''---''--'-----1 DI--I--cc6- REQ, p-t- OE R/wl--~~~--~ lv H~~~OO~LKI-~~+---- LDS __ ~ E r--- VPAb-~_+~-------+-+_---_+------V~P~A__I __ ~ VMA b-+-l-l--l------___+-___-+_______VL~"'IEA__t __ ~ ~ ~--+----------+---------A~2--t I--" E '-- CS ~~------4---~ Ro- R,I-+-f-______________---j---,rf-_ _-'A-:,c..-_A...:' --j I--" 2 I RQA [)-+-I----__I X ) - - - - - - - +5 V V -.6. 11lAi'i, tNABLE ,..-;,~"......., I RQ B b-__l------I C LRj3- LSlol 2 c 'lIL~ o () FIGURE 3.14 Circuit Example of HD68450, HD68A43 (FDC) and HD68B21 (PIA) 26 VAS +r ,.... ......... HD68450 7 DMAC LSIH 60 50 BEC, D, 4 R&R BEC, D, 3 RETRY BECo Do 2 BERR 1 HALT Priority 00 Encoder EI C FIGURE 3.15 Exception Encode Example 27 RESET HD68000 MPU CLR CLR Binary Counter 4MHz ClK A A lJA NC LS393 LS393 QB Qc 1---0- QD 1 QDI---0- L..._ _.... T6 OWN D------""""l HD684:;O DMAC BEC,O----aD 2 BEC, D1 BEC o Do FIGURE 3.16 Bus Cycle Time Out Error Example 28 +5V Priori ty Encoder o LS148 ~ I HQI 1 I IlQ2 2 Do IPL o I HQ3 3 01 IPL I I HQ 4 4 O2 IPL 2 I HQ. 5 I HQ6 6 HD68000 I HQ7 7 MPU RES INTERHUPT1 INTEHHUPT2 =v- P- Do '~ ~ P-->J ---- - ,~ - k LDS L----c CS ~riori ty Encoder Il\:TEHHUPT3 -* OL8148 C I - A7 HALT to---- 1 BEHH to-- '" 2 Do I'" BEC o C 3 01 BEC I R&H Lo--- ,., 4 O2 BEC 2 C 5 +5V +5V C 6 I HD68450 DMAC L---c 7 f OWN 04 UAS ·Whe n INTERRUPT3 becomes "H"_ "L", DMA transfer is stopped. And the MPU is interrupted. T IHQ FIGURE 3.17 Transfer Stop Example 29 +.v AS B G AS BR B BO --a.J H068000 .. PRiiliii'i'\'1N • .. oom<: MPU I. t. r-- (PRIlIUTY our) (PRiORITY IN) ~O Q r-- ~ -~ '''LS3'18 ~ PIUORrlY our --<0 Q '-I--- 0 70183'18 '--- ~ -0 '--- I~ I~ ~ Igj lfil I: H068 . . 0 HOU . . O OMAC OMAC *This PRIORITY IN must be grounded. **Open collector buffer. FIGURE 3.18 Daisy Chain Example upper byte. When an operand is transferred from the I/O device to the lower byte of memory, HIBYTE signal must be used. See Chapters 3.5 and 3.6 for circuit examples of HIBYTE. Figure 3.19 shows an application example of the H D68450 in ~ 1 the 8086 system, which requires the following circuits: (I) CS, lACK GENERATOR .•. Read/Write control for SEL A,,-A 1 SEL Ao-A 1 HD68450 internal UPPER (ODD) LOWER (EVEN) registers 512kX8bi t 512kxHbi t (2) BUS ARBITER ............ 8086 bus arbitration control Ds - DI5 It lr (3) STATUS GENERATOR ..... Control for form status input to 8288 from FCO-FC2 Do -D7 (4) RDY GENERATOR ........ Synchronizing 8086 and 8086 HD68450 in internal reg- ister read / write cycles (I) CS, lACK GENERATOR Figures 3.20 and 3.21 show a circuit example and timing chart ofCSand l'i\'CK GENERATOR. CSand lACK are formed from ~ 1 the 10RC, ATOWC, and INTA outputted from 8288. The read/write cycle of the 8086 MPU to the HD68450 starts when SEL A o-A2 SEL Ao-A 22 CS, LDS, UDS, and R/W become valid, and ends when both UPPER (EVEN) LOWER (ODD) LDS and UDS become inactive. 8MX8bi t 8MX8bi t Since the H D68450 must output data to the lower byte of the data bus, both lower bytes of 8086 and HD68450 need to be Ds- D I5 U IT directly connected, and the output from 8286 must be masked to avoid bus conflict. Do-D7 (2) BUS ARBITER HD68450 Figures 3.22 and 3.23 show the bus arbiter circuit and its timing chart. As long as the HD68450 outputs BR or BGACK, bus The 8086 system allows one word operand whose upper and mastership is requested to the MPU, and bus conflict does not lower bytes are located at both contiguous and diagonal position take place. BR becomes inactive one clock after BGACK output, in memory, as in the figure at the top of page 31. HD68450 does and the bus request does not become inactive before the not allow one word operand (see (2) in the figure). However, if the HD68450 becomes bus master. operand size is programmed as a byte, and memory count is programmed as increase in Dual Addressing Mode, the "diag- onal" position can be supported by the HD68450. (3) STATUS GENERATOR Figures 3.24, 3.25 and 3.26 show the Status Generator circuit In addition to the Dual Addressing Mode (Chapter 3.1), the and the DMA read/write cycle timing charts. This circuit gener- HD68450 supports Single Addressing Mode, in which OP=P ates status signals to inform the DMAC's bus ownership to 8288. must be satisfied. For one word operand in diagonal position (2), The H D68450 outputs VCO-FC2 in every bus cycle. These values OP=P=8 is required, and the I/O device must be connected to the can be varied by writing different values into MFC, DFC, and 30 III (2) l~O 3 Z l~O 3 2 5 4 5 4 The following examples show various data transfer between memory and I/O device in Dual Addressing Mode. Example 1 Memory ~I/O (P=16, OP=16, MTC=2) Mem I/O R-W (CD I]) ) 1 word read from memory (I/O) W-W (CD ® ) word write to I/O (memory) R-W (® CIl ) I I]) I CD 1_ _ 1 ® I CD I word read from memory (I/O) CIl ® CIl ® W-W ( ® CIl ) word write to I/O (memory) Example 2 Memory ~I/O (P=16, OP=8, MTC=4) Mem I/O R-W ( CD I]) ) 1 word read from I/O [§j~ W-B ( CD ) 1 byte write to memory Rr-W (® CIl ) 1 word read from I/O ® ~-CIl ® W-W (I]) ® ) 1 word write to memory W-B ( CIl ) 1 byte wirte to memory Example 3 Memory ~ I/O (P=8, OP=8, MTC=4) R-B ( CD ) 1 byte read from I/O R-B ( I]) ) 1 byte read from I/O Mem I/O W-W ( CD I]) ) 1 word write to memory R-B ( ® ) 1 byte read from I/O II])ICDI 7 0 W-B ( ® ) 1 byte write to memory CIl ® - I CD 'V CIlI R-B ( CIl ) 1 byte read from I/O W-B ( CIl ) 1 byte write to memory 31 ".. 1 -- HV ;~~~ :: ~: nK:o ) ~ l' m ROY RESET S. 51 AMWTC DT/Ii ~ ~ 8US "" Ii AI.E ~ RDY II I 1111 - GEN. (j) ""fNfi MPU SYsTEMI ROV [,.Lll.d~±;;j· ~~===n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~5~ A ,-A, A,-Au ~=+====~t=~t====+~=+~==================:~ I- LOCK 1¢~~~~~::;;:=ri=~~~~==~~~~==~~~==:::=:~~====~=======>D.-D" +- w I\) n: ,s 1i'i'AfK Ni fAi'"K ~r RAVI IRQ i'i'DS Ws GRF.C. ii"fT;- fU:C, HDB ~. ~ 0 DMAC ~ __==------,II ROO" ACK. REQ, AC'K, R:EQ; ACk. lffi' FIGURE 3.19 Application Example of HD68450 in the 8086 System +5V ~ DMAC SELECT OWN IORC CS AIOWC R/W INTA lACK LOCK +5[ IRQ (,) (,) BHE ) l:=k ~I'f , LOS HD684t50 DMAC Ao ) < Jj UDS +5V AS FIGURE 3.20 CS and lACK Generator Ti T2 T3 TW TW TW TW T4 I r Ti ~ ~ r~ ~ ~ r "- r ~~ 1: CLK lORC ~ I I I I I AlOWC I I -I I INTA ~ I I I I I CS, lACK LDS , ODS , J' I I I I I I I ~j ., I R/W \ I I I I I I \t: k:~ 60 I I I '" .j>. DTACK NOTE 1) " i '. 35 I 1 I Ii\ 1 RDY If I ., I I I I I I 1 ASYNC I I I I ALE "L" I I I I B READY -~ I I I READ DATA fl '1 I FROM DMAC \: NOTE 2)1 I 1 I I WRITE tiATA TO DMAC 1 I 1 1 1 1 I I I I 1 I 1 1 1 NOTE I) Read and INTA cycles, consist of 13 clocks and write cycle consists of to clocks. NOTE 2) DMAC Latches the data at a falling edge of this clock. FIGURE 3.21 Timing Chart of Fig. 3.20 CLK ----------------------------------~ }---------- BG 'I4.S02 B 74.LS78 x)-~-I-IJ Q CJ1( KCLRQ R 74.LS04. FIGURE 3.22 Bus Arbitration Circuit CLK BR A B FIGURE 3.23 Bus Arbitration Timing 35 BFC (Memory Function Code register, Oevice Function Code cycle, it is possible to prolong the H068450 bus cycle by changing register and Base Function Code register). When the values in the the outputs of LS 191 to "4." table are written in the registers, 8288 outputs bus commands synchronizing with the OMAC's bus cycle, and the OMAC can (4) ROY GENERATOR address devices on the 8086 system bus. Figure 3.27 shows the ROY Generator circuit. See Figure 3.21 Figure 3.24 shows the shortest bus cycle, consisting of 5 clock for the OMAC's ROY timing. In Figure 3.27, the STEM ROY cycles. OSO-OS2 turn idle when the outputs from LS 191 are "3." signal is used when the 8086 accesses devices other than the When access to memory or I/O device is not in time for the bus H068450. "IT Sf SO 8086 STATUS 0 0 0 interrupt acknowledge -------------- lNTA output 0 0 read I/O port ---------------------- 10RC output 0 0 write I/O port --------------------- IOWC, AlOWC output 0 halt ------------------------------- None 0 0 code access ------------------------ MRDC output 1 0 1 read memory ------------------------ MRDC output 0 write memory ----------------------- MWTC, AMWTC output idle ------------------------------- None eLK I EJ CK: ~ +5V ~ -- eLK UAS LSl91 I ~ LOAD QA l- UfACK IN I Q8 t- (to Fig. 3 .27) Q Qc Qo I- t- n +5V HD68450 6;,; D\lAC Q Dt-- LS 74 Q R CK: ~ +5V ~ ~ +5V FC. 0 +5V ~ +5V , +5V~ +5V Fe, , Fe, FIGURE 3.24 Status Generator 36 r - r ~:-----r}; -r '1'1 '1'1 '1'1 '1'2 '1':1 'rw '1'4- '1'1 1'1 T2 CI.K(8Mllz) ~ 67 T' "I rI f\- I UAS I";l I J I I I \ / I i 1.00 I .;\ I I I FC.-FC z JU ~ XI I I ~NOTE I) ~NOTEJ) i I DSz,DS"DS. I 1.\ I II I I \ I I Olt ~ i!!f I I I I I ALE I I I NOtE 2) It It. I I I I I I I II :'- t- I d I I I X I '~ ~I I I I I \ I I I II I I I I I HIlI'- I I I f-it-ll I I I ~ I I' I I I I ~ -.l I DT/R I \ I I I t I I I I f1IIio1 \. ~ I tttti I I I I I I I I -~I I I I ~\ I I I DEN I I I I I I I '1 I~ I Ifiq4 I I J. I I I (DATA IN N0TJ94) I I I ~ I ~ I I I I I memory a~cess. I r'-DMAC I II " r--.... I mlll. 92 ns latches. t I I I I I '\ i!l,INOTE J) \1 i'/ I I I I I I I I I ~ I I I I I I I I I : )' I NOTE 4) I ! J I I I I I/O latch timing NOTE I) OS2, OSI and OSOcorrespond to Si, Si, and SOin the 8086 system, and are from FCO-FC20fthe DMAC. When the OMACis used, each bus cycle needs one idle state (T1), and the basic bus cycle consists of five clock cycles. NOTE 2) OWN and UAS of the OMAC are used, and ALE of the 8288 is not used to latch address AI-A23. NOTE 3) 15S2, IJS1, and DSli are used to terminate the 8288 cycle, and OTACK is used to terminate the DMAC. __ NOTE 4) Oata latch in Dual Addressing Mode, and from I/O device in Single Addressing Mode is with the falling edge of OTC. FIGURE 3.25 H068450 READ Cycle Timing Chart 37 Tl Tl Tl T2 T3 T4 Tl TI T2 CLK(8MHz) -T' I l I ' .1 r' I' I T' I r---' I T' -----.r--'i\.- I I I I I I I I I I UAS I I / ! I I I I I / I I I I I I I I I \ I L I I I I FC o - FC 2 ~ I I 1 L I I I ~I I I I DS 2 , DS, , DS o I I I \ L I i, I I \ I I I I I I I ! I I I I I ALE I I \ I I I I / L I-- I I I I L A,- A 23 I \ \ 60 I I ~ I I NOTE I) I I LDS, UDS I I I \1 I /1I I I 60 I \ I \ I, I ~I I I I I I W \ I \ DEN I I ~ - ~[ M P U MAR DAR BAR * device address table top address memor y addre ss A block A } transfer counts A MTC * BTC number of blocks being transferred memor y addre ss B transfer counts B * loaded from the array table block B -- -- devic e - I/O device or addre ss memory -- FIGURE 4.4 Transfer Example in Array Chaining Mode 46 - Bit 1.5. memory linked address X.... memory address B(H) memory address B(L) transfer counts B ~ o linked address Y(H) linked address Y(L) linked array table_ linked address Y .... memory memory address C(H) address C(L) trans er counts (; "All 0" (terminator) table top address; .... memory address A(H) memory address A(~). transfer counts A linked address X(H) linked address Y(L) I.-- HD68450 DMAC -- --- memory address C HD68000 MAR * block C t ransfer c ounts C MPU DAR device address BAR table top address :::!> ~ ~ MTC ~ * memory BTC (not used) address A -- block A transfer counts A memory address B - block B transfer counts B * loaded from i.-' array table devi ce ,.,.- address -__.}-------------------4 I/O device or memory - --- FIGURE 4.5 Linked Array Chaining Mode Transfer Examples 47 Example 4: Program Example in Linked Array Chaining Mode (corresponding to Fig. 4.5) line number comment 1 LINKA EQU *II$A89E, $1004 2 MOVE. W setting OCR, nCR 3 MOVE. B 11$04, $1006 setting SCR 4 MOVE. B II $80, $1025 setting NIV 5 MOVE. B 11$81, $1027 setting EIV Setting Transfer 6 MOVE. B 11$01, $1029 setting MEC Mode 7 MOVE. B 11$01, $1039 setting BFC 8 CLR, B $10lD setting CPR 9 MOVE. B II $FF, $1000 T'esetting CSR 10 MOVE. L IItable top address, $101C setting BAR 11 MOVE. B 11$80, $1007 setting STR bit 12 RTS returning to main routine (NOTE). The DMAC is mapped onto address from $1000 through $IOFF. • Channel 0 is used. • The same modes are set as those in example I except Linked Array Chaining Mode • In Dual Addressing Mode, DAR and DFC should be set. 48 DATA SHEETS 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 I I I I I I I I I I HD68450,HD68450Y DMAC (Direct Memory Access Controller) APRIL 1984 Microprocessor implemented systems are becoming increas- -The specifications for HD68450-10 and HD68450V10 are ingly complex, particularly with the advent of high-performance preliminary.- l6-bit MPU devices with large memory addressing capability. In order to maintain high throughput, large blocks of data must be HD68450-4, HD68450-6, moved within these systems in a quick, efficient manner with HD68450-8, HD68450-10, minimum intervention by the MPU itself. The HD684S0 Direct Memory Access Controller (DMAC) is designed specifically to complement the performance and architectural capabilities of the HD68000 MPU by providing the following features: • HMCS68000 Bus Compatible • 4 independent DMA Channels • Memory-to-Memory, Memory-to-Device, Device·to-Memory (DC-64) Transfers • MMU Compatible HD68450Y4, HD68450Y6, • Array-Chained and Linked-Array-Chained Operations HD68450Y8, • On·Chip Registers that allow Complete Software Control by HD68450Yl0, the System MPU • Interface Lines for Requesting, Acknowledging, and Incidental Control of the Peripheral Devices • Variable System Bus Bandwidth Utilization • Programmable Channel Prioritization • 2 Vectored interrupts for each Channel "y" stands for Pin Grid • Auto-Request and External-Request Transfer Modes Arrav Package. • +5 Volt Operation (PGA-68) The DMAC functions by transferring a series of operands • PROGRAMMING MODEL (data) between memory and peripheral device; operand sizes can be byte, word, or long word. A block is a sequence of opera- tions; the number of operands in a block is determined by a Status Regl5ler transfer count. A single-channel operation may involve the Error Reglsle. transfer of several blocks of data bctween memory and devicc. ConlfolReglS\e, Operallon Control RegIster • TYPE OF PRODUCTS Sequence Control Regl&ter Channel Type No. Bus Timing Packaging Control RegIster HD68450-4 4MHz ConlrOIReglsrer I} One Per DMAC Normal Interrupt Vector Error Interrupt Vector 4 Sets HD68450-6 6MHz \--..:.:.:.::.:,c:::.,,:.:.,....==---H (One Set Per Priority Register Channel) HD68450-8 8M Hz DC·64 Memory Function Codes HD68450-10 10MHz functIon Codes HD68450Y4 4MHz HD68450Y6 6MHz I" Memory Tr~nsfer Counter HD68450Y8 8MHz PGA·68 I Base Transler Counler HD68450Yl0 10MHz Memory Address Rag,ster DtlVlCI! Address RegISter Base Address flaglster 51 HD68450,HD68450Y--------------------------------------------------------------------- • PACKAGING INFORMATION (Dimensions in mm) • DC-64 (SiDE-BRAZED CERAMIC DIP) • PGA-68 (PIN GRID ARRAY PACKAGE) f-o--------- 211.2-----_____..0 ,@ .. "1-_ _ _+""'-.1. 2256- 020-03B • PIN ARRANGEMENT • HD68450 • HD68450Y oolR oBEN HIBYTE , UAS OWN BR 5 lfG A, A, A, A. 5 As , A. 51 Vee A, Vss A.ID. (Bottom View) A,ID, A,.ID, AIIID, A"/o. A"/D, A,.ID. 1 AI"s/D7 A.. /O. A"/O, 3 Au/DIO 37 Au/Oll A,./o" A" 10" Fe, 31 , A" 10,. FC._'......_ _ _ _ _ _.....r- A"/0 15 (Top View) 52 ---------------------------------------------------------------------HD68450,HD68450Y • ABSOLUTE MAXIMUM RATINGS Item Symbol . Value Unit Supply Voltage I nput Voltage Vee V in . -0.3-+7.0 -0.3 - +7.0 V V Operating Temperature Range Topr 0-+70 DC Storage Temperature T stg -55 - +150 DC • With respect to Vss (SYSTEM GNO) (NOTE) Permanent LSI damage may occur if maximum ratings are exceeded. Normal operation should be under recommended operating conditions. If these conditions are exceeded, it could affect reliability of LSI. • RECOMMENDED OPERATING CONDITIONS Item Symbol min typ max Unit Supply Voltage Vee V IH ·· 4.75 2.0 5.0 - 5.25 Vee V V I nput Voltage Operating Temperature V IL Topr · -0.3 0 - 25 0.8 70 V DC • With respect to Vss (SYSTEM GNO) • ELECTRICAL CHARACTERISTICS • DC CHARACTERISTICS (Vee = 5V ±5%, Vss = OV, Ta = O-+70DC, unless otherwise noted.) Item Symbol Test Condition min typ max Unit Input "High" Voltage V IH 2.0 - Vee V Input "low" Voltage V IL Vss-0.3 - 0.8 V ~ lACK, BG, ClK, Input leakage Current BECo - BEC 2 lin - - 10 Il A REQo- REQ 3 AI -A 7 , Do -Dis/As -A 23 , AS, UDS, lDS, R!W, UAS, Three-5tate (Off State) I nput Current DTACK, BGACK, OWN, DTC, I TSI - - 10 IlA HIBYTE, DDIR, DBEN, FCo -FC 2 Open Drain (Off State) I nput Current IREQ, DONE 1001 - - 20 IlA AI - A 7 , Do - Dis/As - A 23 , AS, (J[)S", lDS, R!W. UAS, DTACK, BGACK, BR, OWN, Output "High" Voltage DTC, HIBYTE, DDIR, DBEN, V OH 10H = -4001lA 2.4 - - V ACKo - ACK 3 , PClo - PCl 3 , FC o -FC 2 AI - A 7 , FCo - FC 2 VOL 10L = 3.2mA - - 0.5 Do - Dis/As - A 23 , AS, UDS, lOS, R/W,DTACK, B~ Output "low" Voltage OWN, DTC, HIBYTE, DDIR, VOL 10L =5.3mA - - 0.5 V DBEN, ACKo - ACK 3 , UAS, PClo - PCl 3 , BGACK IRQ, DONE VOL 10L =8.9mA - - 0.5 Power Dissipation Po f = 8 MHz,Vee =5.0 V - 1.4 W Ta = 25°C 2.0 Vin=OV, Capacitance Cin Ta = 25DC, f = 1 MHz - - 15 pF 53 HD68450.HD68450Y----------------------------------------------------~------------- LOAD A LOAD B LOAD C +5V +5V +5V Test 15000 Test 1.11kQ 7100 ~ r 130pF Point 152074 ---< ) ( >- GAS '---J '---l 'L AS -..I \ I \ r- UDS lDS R/W OWN low HIBYTE DTACK (lOry /Joz) PCL(READY) DTC ® ACKo ACK, ClK 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Figure 7 AC Electrical Waveforms - OMA Read/Write (Single Cycle with PCl) 59 HD68450,HD68450Y------------------------------------------------------------------ ClK AI -A 7 XD. - XDI5 UAS As UDS lOS R!W OWN low HIBYTE High (0) DTACK DONE IN ACK. ACK I DTC ClK 3 4 5 6 8 2 3 4 5 6 7 8 9 10 • If #6 is satisfied for both DTACK and DONE, #103 may be Ons. Figure 8 AC Electrical Waveforms - DONE Input (NOTES for Figure 3 through 8) 1) Setup time for the asynchronous inputs BG, BGACK, CS, lACK, AS, UDS, lOS, and RNi guarantees their recognition at the next falling edge of the clock. Setup time for BEC. - BEC" REO. - REO" PCl. - PCL." lITACK, and IX5l\IE guarantees their recognition at the next rising edge of the clock. 2) Timing measurements are referenced to and from a low voltage of O.B volts and a high voltage of 2.0 volts. 3) These waveforms should only be referenced in regard to the edge-to-edge measurement of the timing specifications. They are not intended as a functional description of the input and output signals. Refer to other functional descriptions and their related diagrams for device operation. 60 ------------------------------------------------------------------HD68450,HD68450Y • SIGNAL DESCRIPTION • Address Bus (AI through A7) The following section identifies the signals used in the Input/Output Three-statable DMAC. In the definitions, "MPU mode" refers to the state Active-high when the DMAC is chip selected by MPU. The term "DMA mode" refers to the state when the DMACassumes ownership of In the MPU mode, the DMAC internal registers are accessed the bus. The DMAC is in the "IDLE mode" at all other times. with these lines and LDS, UDS. The address map for these Moreover, the DMA bus cycle refers to the bus cycle that is registers is shown in Table I. During a DMA bus cycle, Al -A7 executed by the DMAC in the "DMA mode". are outputs containing the low order address bits of the location NOTE) In this data sheet, the state of the signals is being accessed. described with these words: active or assert, inactive or negate. • Function Code (FC o through FC 2 ) This is done to avoid confusion when dealing with a mixture of "active-low" and "active-high" signals. The term assert or Output Three-statable assertion is used to indicate that a signal is active or true inde- Active-high pendent of whether that voltage is low or high. The term negate or negation is used to indicate that a signal is inactive or false. These output signals provide the function codes during DMA bus cycles. They are three-stated except in the DMA bus cycles. They are used to control the HMCS68000 memories. • Clock (ClK) As-A23! <:;=:::::::>1 00-0,. Input A,-A7 '-r---."" This is the input clock to the HD68450, and should never be cs---~ terminated at any time. This clock can be different from the AS-----i MPU clock since HD68450 operates completely asynchronously. Ii5S-----i UDS-----i RIW-----i • Chip Select (CS) DTACK---~ Input BR-----I RE02 Active low irn-----I HD68450 ACi<2 BGACK-----i PCL2 DMAC This input signal is used to chip select the DMAC in "MPU" TRQ------1 RE03 mode. If the CS input is asserted during a bus cycle which is ~-----I ACK3 generated by the DMAC, the DMAC internally terminates the PCL3 OWNi-----I bus cycle and signals an address error. This function protects "liAS------1 the DMAC from accessing its own register. HI BYTE------1 Dmf • Address Strobe (AS) DDIR:-----I BECo-----i Input/Output Three-statable BEG,-----! Active low BEC2'-----! In the "MPU mode," this line is an input indicating valid FCo------1 FC,-----I address input, and during the DMA bus cycle it is an output FC2-----I indicating a valid address output from the DMAC on the address bus. The DMAC monitors these input lines during bus arbitration Vss(2) to determine the completion of the bus cycle by the MPU or other bus masters. Figure 9 I nput and Output Signals • Upper Address Strobe (UAS) • Address/Data Bus (As/Do through An/DIs) Output Three-statable Active low Input/Output Three-statable Active-high This line is an output to latch the upper address lines on the multiplexed data/address lines. It is three-stated except in the These lines are time multiplexed for the address and data "DMAmode". bus. The lines DDIR, DBEN, VAS and OWN are used to con- trol the demultiplexing of the data and address lines externally. • Own (OWN) Demultiplexing is explained in a later section. The bi-directional data bus is used to transfer data between DMAC, MPU, Output Three-statable memory and I/O devices. Active low Address lines are outputs to address memory and I/O devices. 61 HD68450,HD68450Y------------------------------------------------------------------- This line is asserted by the DMAC during DMA mode, and is In the "MPU mode", this line is an output indicating the used to control the output of the address line latch. This line completion of Read/Write bus cycle by the MPU. may also be used to control the direction of bi-directional In the "DMA mode", the DMAC monitors this line to deter- buffers when loads on AS, LDS, UDS, R/W and other signals mine when a data transfer has completed. In the event that a exceed the drive capability. It is three-stated in the "MPU bus exception is requested, except for HALT, prior to or con- mode" and the "IDLE mode" current with DTACK, the DTACK response is ignored and the bus exception is honored. In the "IDLE mode", this signal is • Data Direction (DDfR) three-stated. Outputs Three-statable • Bus Exception Controls (BECo through BEC;') Active low (when data direction is input to theDMAC) Input Active high (when the data direction is output Active low from the DMAC) These lines provide an encoded signal input.indicating an This line controls the direction of data through the bidirec- exceptional condition in the DMA bus cycle. See bus exception tional buffer which used to demultiplex the data/address lines. section for details. It is three-stated during the "IDLE mode" • Bus Request (SR) • Data Bus Enable (DBEiii) Output Output Three-statable Active low Active low This output line is used to request ownership of the bus by This line controls the output enable line of bidirectional the DMAC. buffers on the multiplexed data/address lines. It is a three-stated during the "IDLE mode". • Bus Grant (00) Input • High Byte (HlBY'fE) Active low Output Three-statable Active low This line is used to indicate to the DMAC that it is to be the next bus master. The DMAC cannot assume bus ownership until This line is used when the operand size is a byte in the single both AS and BGACK becomes inactive. Once the DMAC ac- addressing mode. It is asserted when data is present on the upper quires the bus, it does not continue to monitor the BG input. eight bits of the data bus. It is used to control the output of the bidirectional buffers which connect the upper eight bits of the • Bus Grant Acknowledge (BGACi<) data bus with the lower eight bits. It is three-stated during the "MPU mode" and the "IDLE mode." Input/Output Three-statable Active low • Read/Write (R/W) Bus Grant Acknowledge (BGACK) is a bidirectional control Input/Output Three-statable line. As an output, it is generated by the DMAC to indicate that Active low (write) it is the bus master. Active high (read) As an input, BGACK is monitored by the DMAC, in limited rate auto-request mode, to determine whether or not the This line is an input in the "MPU mode" and an output current bus master is a DMA device or not. BGACK is also during the "DMA mode". It is three-stated during the "IDLE monitored during bus arbitration in order to assume bus owner- mode". It is used to control the direction of data flow. ship. • Upper Data Strobe (UDS). Lower Data Strobe (LOS) • Interrupt Request (iRa) Input/Output Three-statable Output Open drain Active low Active low These lines are extensions of the address lines indicating This line is used to request an interrupt to the MPU. which byte or bytes of data of the addressed word are being addressed. These lines combined corresponds to address line • Interrupt Acknowledge (lACK) Ao in table 1. Input Active low • Data Transfer Acknowledge (Dl'ACi<) In pu t/ Ou tpu t Three-statable This line is an input to the DMAC indicating that the current Active low bus cycle is an interrupt acknowledge cycle by the MPU. The 62 ---------------------------------------------------------------------HD68450,HD68450Y DMAC responds the interrupt vector of the channel with the St8~a=_ (CSR) highest priority requesting an interrupt. There are two kinds of Channel Error RegIIII1' (CER) the interrupt vectors for each channel: normal (NIV) or error Device Control RlIgislfl (OCR) (EIV). lACK is not serviced if the DMAC has not generated co~:r=':st.r (OCR) IRQ. con=-~~r (SCR) con~::r~_r (CCR) • Channel Request (RE"Clo through FfE}) XDo-XD15 (External system data bus) ------«( ») DTACK \\\ or Figure 11 MPU Read from DMAC - Word 66 ------------------------------------------------------------------H068450,H068450Y Al-A23 FCo-FC2 AS ~ HI m CS m /Il \X\ R/W ~ ~ UOS m 01 \n LOS OOIR \S~ ,-u_, ,1/ III' ,~~ r- OBEN ,.----- As/Oo-A23/015 -----«( ») XOO-X015 (External System Data Bus) C--- >>> «C i5'fACj( \" fl{' Figure 12 MPU Write to OMAC - Word • Bus Arbitration The DMAC must obtain ownership of the bus in order to transfer (AS is negated), the MPU relinquishes the bus to the DMAC. data. Figure 13 indicates the DMAC bus arbitration timing. It is The DMAC asserts the bus grant acknowledge (BGACK) to completely compatible with that of HD68000 MPU. The DMAC indicate that it has the bus ownership. A half clock before asserts the Bus Request (BR) to request the bus mastership. The BGACK is asserted, the DMAC asserts OWN. OWN is kept MPU recognizes the request and asserts BG, then it grants the asserted for a half clock after BGACK is negated at the end of the ownership in the next bus cycle. After the end of the current cycle DMA cycle. BR is negated one clock after BUACK is asserted. ClK ----. I ., ¥ 1.5 - 3.5 clocks 10--- 2-3.5 clocks' I Sci (68000 output) OWN \ I~ 1rnm o clock - 1MPU Cycle ~ycIe BUS Cycle MPU Cycle U 4.5 - 5.5 clocks \ DMA Cycl. ACK max. 12.5 clocks + lMPU Cycle ClK • This case assumes that no exception condition exists and DMAC isn't accessed by MPU. Figure 13 OMAC Bus Arbitration Timing 67 HD68450,HD68450Y------------------------------------------------------------------- • Device/DMAC Communication device of the last data block. In the continue mode, DONE is Communication between peripheral devices and the DMAC is asserted for each data block. It is asserted and negated in coin- accomodatedby five signal lines. Each channel has REQ, ACK cident with the ACK line for the last data transfer to the and PCL, and the last two lines the DONE and DTC lines, are peripheral device. It is also outputted in coincident with the shared among the four channels. ACK line of the last bus cycle, in which the address is outputted (1) Request (REQ) from the DAR, in the memory-to-memory transfer (dual The peripheral devices assert REQ to request data transfers. addressing mode) that uses the ACK line. See the "Requests" section for details. The DMAC also monitors the state of the DONE line during (2) Acknowledge (ACK) the DMA bus cycle. If the device asserts DONE during ACK This line is used to implicitly address the device which is active, the DMAC will terminate the operation after the transfer transferring the data (This device is not selected by address of the current operand. If DONE is asserted on the first byte of lines.) It is also asserted when the content of DAR is out- 2 byte operation or the first word of long word operation. the putted during memory-to-memory transfer except for the auto- DMAC does not terminate the operation until the whole ope- request mode at a limited rate or at the maximum rate. rand transfer is completed. If DONE is inserted. then the DMAC (3) Peripheral Control Line (PCl) terminates the operation by clearing the ACT bit of the CSR, The function of this line is quite flexible and is determined and setting the COC and NDT bits of the CSR. If both the by the OCR (Device Control Register). DMAC and the device assert DONE, the device termination is The DlYP bits of the OCR define what type of device not recognized, but the channel operation does terminate. is on the channel. If the DTYP bits are programmed to be a DONE is outputted again for the retry exceptions bus cycles. HMCS6800 device, the PCL definition is ignored and the PCL (5) Data Transfer Complete (DTC) line is an Enable clock (E clock) input. If the DlYP bits are pro- DTC is an active low signal which is asserted when the actual grammed to be a device with READY, the PCL definition as data transfer is accomplished. It is also asserted in the bus cycle ignored and the PCL line is a ready input. when a chain information is read from memory in the Chaining PCl As a Status Input mode. However, if exceptions are generated and the DMA bus The PCL line may be programmed as a status input. The cycle terminates, DTC is not asserted. DTC is asserted one half status level of this line can be determined by the PCS bit in the clock before LDS and UDS are negated, and negated one half CSR, regardless of the PCL function determined by the OCR. clock after LDS and UDS are negated. If a negative transition occurs and remains stable for a mini- mum of two clocks, the PCT bit of the CSR is set. This PCT • Requests bit is cleared by resetting the DMAC or the writing" I" to the Requests may be externally generated by circuitry in the PCTbit. peripheral device, or internally generated by the auto-request PCl As an InterNpt mechanism. The REQG bits of the OCR determine these modes. The PeL line may be programmed to generate an interrupt The DMAC also supports an operation in which the DMAC on a negative transition. This enables an interrupt which is re- auto-requests the first transfer and then waits for the peripheral quested if the PeT bit of the" CSR is set. When using this func- device to request the following transfers. tion, it is necessary to reset the PCT bit in the CSR before the (1) Auto-request Transfers PCL bit in the DCR is set to interrupt, in order to avoid The auto-request mechanism provides generation of requests assertion ofIRQ line at this time. within the DMAC. These requests can be generated at either of PCl As a Starting Pulse two rates: maximum-rate and limited-rate. In the former case, The PCL line may be progranuned to output a starting pulse. the channel always has a request pending. This active low starting pulse is outputted when a channel is The limited rate auto-request functions by monitoring the activated. and is "Low" for a period of four clock cycles. bus utilization. PCl As an Abort Input The PeL line may be programmed to be a negative transition limited-rate Auto-request TIME-+ above input which terminates an operation by setting the ex- ternal abort error in CER. It is necessary to reset the PeT bit in Previous Next the CSR before activating the channel (Setting the ACT bit of Sample Interval Sample Interval CCR) so that the channel operation is not immediately aborted. PCl As an Enable Clock (E Clock) Input If the DTYP bits are programmed to be a HMCS6800 device, Figure 14 DMAC Sample Intervals the PeL definition is ignored and the PCL line is an Enable Clock input. The Enable clock downtime must be as long as five In the Iimited-rate auto-request the DMAC devides time into clock cycles, and must be high for a minimum of three DMAC equal length sample intervals by counting clock cycles. The end clock cycles, but need not be synchronous with the DMAC's of one sample interval makes the beginning of the next. DUring clock. a sample interval, the DMAC monitors by means of BGACK pin PCl As a READY Input the system bus activity of the DMAC and other bus master If the DTYP bits are programmed to be a device with devices. At the end of the sample interval, decision is made READY, the PeL defmition is ignored and the PeL line is a whether or not to perform the channel's data transfer during READY input. The READY is an active low input. the next sample interval. Namely, based on the activity of (4) DONE (DONE) the DMAC or other bus master devices during the current This line is an active low Input/Output signal with an open sample interval, the DMAC allows limited-rate auto-requests for drain. It is asserted when the memo~y transfer couilt is ex- some initial portion of the next sample interval. hausted in a single block transfer. In the chaining operation, The length of the sample interval, and the portion of the DONE" is asserted only at the last transfer to the peripheral sample interval during which limited·rate auto·requests can be 68 ---------------------------------------------------------------------HD68450.HD68450Y made (the limited-rate auto-request interval) are controlled by clock cycles. the BT and BR bits in the GCR. The length in clock cycles of The DMAC uses the BGACK to differentiate between the the limited-rate auto-request interval is 2(BT+4) (2 raised to the MPU bus cycle and DMAC or other bus master devices. If BT+4 power). For example, if BT equals 2 and the DMA utiliza- BGACK is active, then the DMAC assumes that the bus is used tion of the bus was low' during the previous sample interval, by a DMAC or other bus master devices. If it is inactive, then then the DMAC generates the auto-request transfers during the the DMAC assumes that it is used by the MPU. first 64 clock cycles. Maximum-rate Auto-request The ratio of the length of the sample interval to the length If the REQG bits in the OCR indicate auto-request at the of the limited-rate auto-request interval is controlled by the BR maximum rate, the DMAC acquires the bus after the start bit is bits. The ratio of the system bus utilization of the MPU to set and keeps it until the data transfer is completed. other bus master devices including he DMAC is 2(BR+ I) (2 If a request is made by another channel of higher priority, raised to the BR+ I power). If the fraction of DMA clock cycles the DMAC services that channel and then resumes the auto- during the sample interval exceeds the programmed utilization request sequence. If two or more channels are set to equal level, the DMAC will not allow limited-rate auto-requests during priority level and maximum rate auto-request, then the channels the next sample interval. will rotate in a "round robbin" fashion. For example, if BR equals 3, then at most one out of 16 If the HMCS68000 compatible device is connected to a clock cycles during a sample interval can be used by the DMAC channel, the ACK line is held inactive during an auto-request and other bus master devices, and still the DMAC would allow operation. Consequently, any channel may be used for the limited rate auto-request during the next sample interval. memory-to-memory transfer with the auto-request function in Therefore, from the viewpoint of long period, the ratio of the addition to the operation of data transfer between memory and system bus utilization of the MPU to I/O devices including the peripheral device with using the REQ pin. Refer to Figure 15 DMAC is about 16: I. The sample interval length is not a direct for the timing of the memory-to-memory transfer. In this mode, parameter, but it is equal to 2(BT+BR+5) clock cycles. Thus, the ACK, HIBYTE and DONE outputs are always inactive. the sample interval can be programmed between 32 and 2048 ClK 1 2 3 9 1011121314151617181920212223242526272829 FCo-FC2-=:JJ// XIII XIII ~ A'-A7::u~"__________~u~n~ ______________ ~uwn~ __________ ~~ A8/DO_~d:ess Out Data In Address Out Data Out /mrr- AdDress Out rrn _;;;.D;;.;at.;;.a,;.;ln;""'/T7 A23/D,s..J// VII XIII wI 'lJt1 YIIl _OOL- XDo- XD,slIllIID--<1O Oml';------- (External System Data ~~~ ~~=====~~'UL..Jll~ ill-.llI ~ AS \\\ ill \\\ m \\\ m \\\ 01 \\\ OJ \\\ ..111 \\\ ULJJJ ACK ClK 8 9 10 Read One Word I Write One Word Read One Word From Memory to Memory From Memory Figure 15 Memory-to-Memory Transfer Read-Write-Read Cycles 69 "HD68450,HD68450Y----------------------------------------------------_______________ (2) External Requests following is the description of the burst and the cycle steal If the REOG bits of the OCR indicate that the REO line modes. generates requests, the transfer requests are generated exter- Bu rst Request Recognition nally. The request line associated with each channel allows the In the burst request mode, the REO line is an active low device to externally generate requests for DMA transfers. When input. The level sampled at the rising edge of the clock. Once the device wants an operand transferred, it makes a request by the burst request is asserted, it needs to be hel,d low until the asserting the request line. The external request mode is deter- first DMA bus cycle starts in order to insure at least one data mined by the XRM bits of the OCR, which allows both burst transfer operation. In order to stop the burst mode transfer and cycle steal request modes. The burst request mode allows a after the current bu~le, the REQ line has to be negated channel to request the transfer of mUltiple operands using one clock before the DTC output clock of this cycle. Refer to consecutive bus cycles. The cycle steal request mode allows Figure 16 or the burst mode timing. a channel to request the transfer of a single operand. The MPU cycle -+-- Idle - - t - DMA cycle -+ MPU cycle or Idle --r- DMA cycle -r- Idle Figure 16 Burst Mode Request Timing (Only one channel is active) Cycle Steal Request Recognition tion terminates or until the device pauses. The device is deter- In the cycle steal request mode, the peripheral device re- mined to have paused if it does not make any requests during quests the DMA transfer by generating an falling edge at the the next full sample interval. The sample interval counter is free REO line. 111e REO line needs to be held "low" for at least 2 running and is not reset or modified by this mode of operation. clock cycles. In the cycle steal mode, if the REO line changes The sample interval counter is the same counter that is uSed for from "Higll" to "Low" between ACK output and one clock be- Limited Rate Auto Request and is programmed via the GCR. fore the clock that outputs DTC, then the next DMA transfer Figure 18 shows the request timing in the cycle steal bus is performed without relinquishing the bus. If the bus is not hold. If the REO is inputted during the hold tinle, the ACK relinquished, then maximum of 5 idle clocks is inserted between is outputted after a maximum of 7.5 clock cycles from the bus cycles. Refer to Figure 17 for the request timing of the picked-up clock. On the cycle steal with hold mode, the DMAC cycle steal mode. If the XRM bits specify cycle steal with- will hold the bus even when the transfer count is exhausted and out hold, the DMAC will relinquish the bus. If the XRM bits the last data has been transferred. If DMA transfer is requested specify cycle steal with hold, the DMAC will retain ownership. from other channels during this period, they are executed The bus is not given up for arbitration until the channel opera- normally. ClK REQ~: BR \ : LC: JUlfl.fLJ1JUlfLJUU1JlIltlJUUUlJ I ~bUS I ~ '--=F f1..Il..IlJ1JlJ r\R9IinqUishth9bU:. ___ ----1 LJ j"\ uu ,,--- BG BGACK \ : : : rna:. 5 clocks ,,_;:~-_~====~ __ ~~~lES ~s-( ACK DrC : 0 >" ""41 \ U >--C:)-"---<---!:=n-~}-- ~J U- 0----- \\ ,,--- ClK micro cleanup I11lIlI1IUUlI MPU cycle -+- Idle DMAcycle MPU cycle or Idle .~ --r---- DMA cycle Figure 17 Cycle Steal Mode Request Timing 70 ------------------------------------------------------------------HD68450,HD68450Y CLKJ1IL REO'----I BR--, BG--- BGACK ___ _'-,----I-----J ',-. ---------11-----\ - -" max. 5 clocks BUS -_--- ( } - - !f~ }-- ij" CYCLES - J II ACK DTC-------~f~J ~I~~==~~-~--~~~U-­ \L1J 'U....IJ Figure 18 Cycle Steal Bus Hold Mode Request Timing Request Recognition in Dual-address Transfers (1) Dual Addressing In the following section dual-address transfers is defined. HMCS68000 and HMCS6800 compatible devices may be Dual address transfer is an exception to the request recognition explicitly addressed. This means that before the peripheral rules in the previous paragraphs. In the cycle steal request mode, transfers data, a data register within the device must be address- when there are two or more than transfers between the DMAC ed. Because the address bus is used to address the peripheral, and the peripheral device during one operand transfer, the re- the data cannot be directly transferred to/from the memory quest is not recognized until the last transfer between the because the memory also requires addlessing. Instead, the data DMAC and the I/O device starts. is transferred from the source to the DMAC and held in an (3) Mixed Request Generation internal DMAC holding register. A second bus transfer between A single channel can mix the two request generation the DMAC and the destination is then required to complete methods. By programming the REQG bits of the OCR to "II ", the operation. Because both the source and destination of the when the channel is started, the DMAC auto-requests the first transfer are explicitly addressed, this protocol is called dual- transfer. Subsequent requests are then generated externally by addressed. the device. The ACK and PCL lines perform their normal func- HMCS68000 Compatible Device Transfers tions in this operation. In this operation, when a request is received, the bus 'is obtained and the transfer is completed using the protocol as • Data Transfers shown in Figures 19 and 20. Figures 21 through 24 show the All DMAC data transfers are assumed to be between memory transfer timings. Figure 21 and 24 show the operation when and the peripheral device. The word "memory" means a 16-bit the memory is the source and the peripheral device is the desti- HMCS68000 bus compatible device. By programming the OCR, nation. Figures 22 and 23 show the transfer in the opposite the characteristics of the peripheral device may be assigned. direction. The peripheral device is a l6-bit device in Figures 21 Each channel can communicate using any of the following and 22, and a 8-bit device in Figures 23 and 24. protocols. DTYP Device Type ao- HMCS68000 compatible deViCe} Dual Addressing 01 HMCS6800 compatible device 10 Device with ACK } Single Addressing II Device with ACK and READY 71 H D 6 8 4 5 0 , H D 6 8 4 5 0 Y - - - - - - - - - - - - - - - - - - - - - - - - - - -_ _ _ __ DMAC HMCS68000 Device Address Device 1) Set R/W to Read 2) PIIoC8 Address on A. - A.. 3) Place Function Codes on FC. -FC. 4) Assert Address Strobe (AS) 5) Assert Upper Dale Strobe (UDS) and Lower Data Strobe (LOS) 6) Assert Acknowledge (ACK) I , Present Data 1) Decode Address 2) Place Data on D. - 0 II 3) Assert Data Transfer Acknowledge (DTACK) I f Acquire Data 1) Load Data into Holding Register 2) Assert Device Transfer Complete (DTC) 3) Negate UDS and LOS 4) Negate AS, ACR andl5'fC Terminate Cycle 1) Remove Data from D. -' 0" 2) Negate"OTACK I f Slert Next Cycle Figure 19 Word Read Cycle Flowchart HMCS68000 Type Device DMAC HMCS68000 Device Address Device 1) Place Address on A. - A.. 2) Place Function Codel on FC. -FC. 3) Assert Address Strobe (A!) 4) Set RMto Write 5) Place Data on D. - 015 6) Assert Acknowledge (ACK) 7) Assert Upper Data Strobe (TIi5S) and Lower Data Strobe ('[Os) ~.------------------------------------" Accept Dale 1) Decode Address 2) Store Data on D. - 0" 3) Assert Data Transfer AcknO~edge(DTACK) I . f Term.nate Output Transfer 1) Assert Device Transfer Complete (DTC) 2) Negate UDS and LOS 3) Negate AS", AC K and D"i'C 4) Remove Data from D. - 0 15 5) Set RiW to Read Terminate JCle , Start Next Cycle 1) Negate DTACK I Figure 20 Word Write Cycle Flowchart HMCS68000 Type Device 72 -------------------------------------------------------------------HD68450,HD68450Y CLK FCo-FC, A,-A, Data In Address Out Data Out AB/Do -A23/D,s ~Ul XDo-XD,s mOl/) (External System Data Bus) UAS AS il7 UDS m UJ ~X~ £0 LOS U\ LU ~~ RW \\\ OWN DDIR ~i\ OJ DBEN ~ llJ ~~ {]j HIBYTE DTACK ~ m \\\ ~ \\\..JJ ACK i50NE CLK 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2122 23 ----r-- Read One Word -----j--- Write One Word ---r- From Memory To Device The Last Transfer Figure 21 Dual Addressing Mode, ReadlWrite Cycle, Destination = 16·bit Device, Word Operand ClK ~========~V~I~/============~ w-________ ~vull~ ____________~ AB/Do Data Out -A23/D,s 'IIIC. XDo-XD'5 (External System Data Bus) UAS AS rrr-- UDS ill 10 ill rrr-- LOS \\\ UJ \\\ rrr-- RW m II1 OWN DDIR \\\ 0/ DBEN \\\ 10 'Xl nr HiiiYi'E DTACK ~ ~\ II1 i5'fC ~ ACK \\\ DONE CLK --t--Read One Word ----t-- Write One Word From Device To Memorv The Last Transfer Figure 22 Dual Addressing Mode, ReadlWrite Cycle, Source = 16·bit Device, Word Operand 73 HD68450,HD68450Y------------------------------------------------------------------- ClK ABloo Address Out Data In Address Out Data In Address Out .....--!o~a~ta:.;O:;:;u:.!t_ _,....-- -A23/O,. ~l rur:::::::JHJ 'IlIl::::::J//I ~ XoO-Xo15 ~~U~====~lmm~U~ml~,~====~n~m~~~l~n=========/~"~ (External System Data Bus) UAS ~ \LJlJ 'LJlJ 'M-JlJ AS -11l \\\ III \\\ m \\\ III ill Ui5S -11l \\\ III \\\ rns -11l \\\ III \\\ III \\\ III RW \w\\__________ -War---\\\ OWN m>iR 01 l5BEN 11/ \\\ III \\\ or HiB'fTE" oTACK oTC ~ ClK --+-- Read One Byte ---'+---Read One Byte --+-- Write One Word From Device From Device To Memory Figure 23 Dual Addressing Mode, Read/Write Cycle Source =8-bit Device, Word Operand ClK A;;:ddiTr::,:es::..s,:;:O.;ut......:D;::a:.::ta:.,:'.:.:.n......:.;Address Out Data Out Addre.. Out Data Out ABloo --QJL:JIO -A23/O,. YDJ::::::]Jl1 1JlL...JIl1 I/lL Xoo-Xo,. =nJJ----u~I;;;m;:::::=======:n~l>----- (External System Data Bus) DAS """"LJJJ 'LJ11 'LJ11 \\L AS o Dos o ill III \\\ III ill or- ill 0/ lOS o \\\ III ill III \w\\,--_~ \S~ or- nr RW fl'T"""""W. OWN Dlmi \\\ 0/ oBEN ill III \\\ ur--'\\\ Iff HiBY'i'E DTACK 10 \\\ III \\\ \~ "D'i'C ACK ClK -+- Read One Word ----t-- Write One Byte Write One Byte . From Memory To Device To Device Figure 24 Dual Addressing Mode, Read/Write Cycle, Destination = 8-bit Device, Word Operand 74 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HD68450,HD68450Y HMCS6800 Compatible Device Transfers address) signal. Figure 25 illustrates this protocol. Refer to When a channel is programmed to perform HMCS6800 com- Figure 26 for the read cycle timing and Figure 27 for the write patible transfers, the PCL line for that channel is defined as an cycle timing. In Figure 26, the DMAC latches the data at the Enable clock input. The DMAC performs data transfers between falling edge of clock 19, so a latch to hold the data is necessary itself and the peripheral device using the HMCS6800 bus proto- as shown in Figure 47. col, with the ACK output providing the VMA (valid memory DMAC (MASTERI HMCS6800 Device Initiate Cycle 1) Start a normal Read or Write Cycle 21 Monitor Enable until it is low 31 Assert Acknowledge (ACj() I Transfer tate 11 Wait until Enable is active 21 Transfer the Data I .f Termonate Cycle 1) The master waits until Enable goes low. 21 Assert Device Transfer Complete (i5'f'C1 (On a Read cycle the data is latched as clock goes low when i5'f'C is asserted. 1 31 Negate AS, UDS, LOS, ACK andDTC • Start Next Cycle Figure 25 HMCS6800 Cycle Flowchart ClK FCo-FC2 A.-A, AslDo Address Out Data In -A23/D.s -:=:JCj/1UOllUl/WMWM/W0l0l0l XDo-XD.5 (External System Data Bus) (00/1101 UAS AS u liDS illS 0-- Rliiii OWN i5iiiR \\ DBEN HIBYTE o J DTACK ~_=::~:::~~~~:_~~\\==============~~u---- l>TC ~ ~E~) r ClK Figure 26 Dual Addressing Mode, HMCS6800 Compatible Device, Read Cycle 75 HD68450,HD68450Y------------------------------------------------------------------- ClK A./Do Jm'7mrrnr--..;,A,;;;d;:jidress Ou;:.;t:..-_ _ _ _ _ _..:D:.::a~ta:.;O:::;u:::t'___ _ _ _ _ _ __ -A23/D,. 1177JmmJ 1I'fLJJ~================~ii (External System Data Bus) XDo-XD'5 UAS -4JIOO I>------- AS ~~~ Si fl.l lACK n~ llZll R;W It UDS ~H ;; Zll em; \\\ ~~ III DDIR (ft \ DBEN r'\J\ I A16/Ds-A23/D15 fS As/Do-A15/D7 s~llll ) XDo-XD15 (External System Data Bus) ~~m7 lD DTACK $1 fJ'-- ClK u-LJl..JSS 1 2 3 4 5 30 31 32 33 34 35 36 37 38 Figure 36 MPU lACK Cycle to DMAC (3) Multiple Data Block Transfer Operation to by the base address register. The address information is When the memory transfer counter (MTC) is exhausted, the placed in the memory address register, and the count informa- channel operation still continues if the channel is set to the tion is placed in the memory transfer counter. As each chaining array chaining mode or the linked array chaining mode and the entry is fetched, the base transfer counter is decremented by chain is not exhausted. The channel operation also continues if one. After the chaining entry is fetched, the base address the continue bit (CNT) of the CCR is set. The DMAC provides register is incremented to point the next entry. When the the initialization of the memory address register and the base transfer counter reaches a terminal count of zero, the chain memory transfer counter in these cases so that the DMAC can is exhausted, and the entry just fetched determines the last transfer the multiple blocks. block of the channel operation. Continued Operation An example of the array chaining mode operation and the The continued operation is described in the Initiation and memory fonnat for supporting for array chaining is shown the Control of the Channel Operation section. in Figure 37. The array must start at an even address, or the Array Chaining entry fetch results is an address error. If a terminal count is This type of chaining uses an array in memory consisting of loaded into the memory transfer counter or the base transfer memory addresses and transfer counts. Each entry in the array counter, the count error is signaled. Since the base registers may is six bytes long and, consists of four bytes of address followed be read by the MPU, appropriate error recovery information is by two bytes of transfer count. The beginning address of this available should the DMAC encounter an error anywhere in the array is in the base address register, and the number of entries in chain. Contents of the BFC is outputted as the function code the array is in the base transfer counter. Before starting any when the DMAC is accessing the memory using the base address block transfers, the DMAC fetches the entry currently pointed register. The value of the function code registers are unchanged in the array chaining operation. 85 H068450, Ho68450Y------------------------------------------------------------------ memory Bit 15 BitO top address of -+ memory address A(H) the table memory address A(L) transfer count A memory address B(H) Array table -+ memory address B (L) transfer count B memory address C(H) memory address C (L) -- transfer count C .- r" emory... address C transfer HD6B450 DMAC block C } count C HD6BOOO ¢:/ memory MPU ~{ MAR * DAR peripheral device address BAR top address of the table MTC address A block A } transfer count A BTC * memory address B * to be loaded from the array table trensfer block B count B Note: The number of data blocks being transferred in this example is 3. ...- - peripheral device . - . - - - - - - - - - - . address-+ peripheral device or memory .- Figure 37 Transfer Example of the Array Chaining Mode Linked Array Chaining and the link address replaces the current contents of the base This type of chaining uses a list in memory consisting of address register. The channel then begins a new block transfer. memory address, transfer counts, and link addresses. Each entry As each chaining entry is fetched, the update base address in the chain list is ten bytes long, and consists of four bytes of register is examined for the terminal link which has all 32 bits memory address, two bytes of transfer count and four bytes of equal to zero. When the new base address is the terminal ad- link address. The address of the first entry in the list is in the dress, the chain is exhausted, and the entry just fetched deter- base address register, and the base transfer counter is unused. mines the last block of the channel operation. Before starting any block transfers, the DMAC fetches the An example of the linked array chaining mode operation and entry currently pointed to by the base address register. The the memory format for supporting it is shown is Figure 38. address information is placed in the memory address register, In Figure 38, the DMAC transfers data blocks in the order of the count information is placed in the memory transfer counter, Block A, Block B, and Block C. In the linked array chaining 86 -----------------------------------HD68450.HD68450Y memory Bit 15 Bit 0 link address X -+ memory address B (H) memory address B(L) transfer count B link address Y(H) link address Y (L) linked array table --+ link address Y -+ memory address C(H) memory address C (Ll transfer count C "All 0" terminator "All 0" terminator top address of the table memory address A(H) memory address A(L) transfer count A link address X(H) - link address X(L) '-""'" H068450 OMAC memory - ~"""Oo"" -+ address C H068000 MPU MAR * block C } DAR peripheral device address :::> BAR top address of the table MTC * <==> memor~ f"~",, ~M 8TC (not used) address A block A A memor~ ,.~" • to be loaded from the linked array table address B block B } oooM • peripheral ...- - device address -- peripheral device or memory Figure 38 Transfer Example of the Linked Array Chaining Mode 87 HD68450,HD68450Y------------------------------------------------------------------ mode, the BTC is not used. When the DMAC refers to the linked In order to guarantee, reliable decoding, the DMAC verifies that array table, the value of the BFC is outputted as the function the incoming code has been statable for twoDMACclock,cycles code. The values of the function code registers are unchanged before acting on it. The DMAC picks up BEC o-BEC 2 at the by the linked array chaining operation. rising edge of the clock. If BEC o-BEC 2 is asserted to the un- This type of chaining allows entries to be easily removed or defined code, the operation of the DMAC does not proceed. inserted without having to reorganize data within the chain. For example, when the DMAC is waiting for DTACK, inputting Since the end of the chain is indicated by a terminal link, the DTACK does not result in the termination of the cycle if BEC o- number of entries in the array need not be specified to the BEC 2 is asserted to the undefmed code. In addition, when the DMAC. transfer request is received, BR is not asserted if the BEC o- The linked array table must start at an even address in the BEC 2 is not set to no exception condition. linked array chaining mode. Starting the table at an odd address If exception condition, except for HALT, is inputted during results in an address error. If "0" is initially loaded to the the DMA bus cycle prior to, or in coincidence with DTACK, MTC, the count error is signaled. Because the MPU can read the DMAC terminates the current channel operation immediate- all of the DMAC registers, all necessary error recovery informa- ly. Here coincident means meeting the same set up require- tion is available to the operating system. ments for the same sampling edge of the clock. If a bus excep- The comparision of both chaining modes is shown in Table 8. tion condition exists, the DMAC does not generate any bus cycles until it is removed. However, the DMAC still recognizes Table 8 Chaining Mode Address/Count Information requests. Base Address Base Transfer Completed Chaining Mode Register Counter When Halt number of data The timing diagram of halt is shown in Figure 39. This Array Chaining address of the blocks being Base Transfer diagram shows halt being generated during a read cycle from the array table Count = 0 transferred 68000 compatible device in the dual addressing mode. If the Linked Array address of the Linked halt exception is asserted during a DMA bus cycle, the DMAC Chaining linked array (unused) does not terminate the bus cycle immediately. The DMAC table Address = 0 waits for the assertion of DTACK before terminating the bus cycle so that the bus cycle is completed normally. In (4) Bus Exception Conditions the halted state, the DMAC puts all the control signals to high The DMAC has three lines for inputting bus exception condi- impedance and relinquishes the bus to the MPU. The DMAC tions called BEC o , BEC 1> and BEC 2 • The priority encoder can does not output the BR until halt exception is negated. When be used to generate these signals externally. These lines are halt exception is negated, the DMAC acquires the bus again and encoded as shown in Table 9. proceeds the DMA operation. In order to insure a halt excep- tion operation, the BEC lines must be set to halt at least until Table 9 the assertion of DTC. BEC 2 BEC t BEC o Exception Condition If the DMAC has the bus, but is not executing any bus cycle, the DMAC relinqUishes the bus as soon as halt exception 1 1 1 No exception condition is asserted. 1 1 0 Halt 1 0 1 Bus error 1 0 0 Retry 0 1 1 Relinquish bus and retry 0 1 0 (undefined, reserved) 0 0 1 (undefined, reserved) 0 0 0 Reset 88 -------------------------------------------------------------------HD68450,HD68450Y ClK AID BUS UAS AS UDS LOS R!W ---------------------------\L__~"------,--,n ~ \\IL\\ _ _ _m \a. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __W~~~_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ OWN iJIDR ~~~________________w~ DEiEfiI ~~"________~~w~___ J HIBYTE ----------------------~~~~------------------ DTACK ~__________~~ ~~~____-wmr-- 'LlII'-,-----'"--~ \\\ Ilf ~~~ ____IIIur_ HALT (BECo-BEC2)* \\\ un f( BGACK ------------------~~--------------------- '\~ ___HJ BR BG ----------------~I'~~ _____________m ClK 67891011121314151617119221222324252627282930313233 Read Other Bus Master Write from Device I Rear~rgation I to Memory Halt Asserted ---~I'-DMA Halted .,If--- DMA cycle • BEe. - BEC, = (011) Figure 39 Halt Operation Bus Error values of the MAR, the DAR, the MTC and the BTC to the The bus error exception is generated by external circuitry values when the bus error exception occurred. 25 clocks are to indicate the current transfer cannot be successfully com- required for the error recovery cycle in the single addressing pleted and is to be aborted. The recognition of this exception mode and in the read cycle of the dual addressing mode. 29 during a DMAC bus cycle signals the internal bus error con- clocks are required in the write cycle of the dual addressing dition for the channel for which the curren t bus cycle is being mode. If the DMAC does not have any transfer request in the run. As soon as the DMAC recognizes the bus error exception, other channels after the error recovery cycle, the DMAC relin· the DMAC immediately terminates the bus cycle and proceeds quishes the bus. to the error recovery cycle. In this cycle, the DMAC adjusts the The diagram of the bus error timing is shown in Figure 40. 89 HP68450,HD68450Y------------------------------------------------------------------ ClK AID BUS UAS AS ~_____________ , \\\ UDS -'II \\\ /U""---i'~ lOS -' \\\ /U I~ R!W tllL~ or-'" _________ OWN DDIR ~ '~ DBEN tw"____________~or-"I '--- HIBYTE DTACK ~ \m \m \\\\ \\ \\\\\YII/ DTC ACK t... ,,_______ r- ll Bus Error (BE'Co-BEC2)' \\\ ClK --+-- Berr on Write to Device I- Error •r- Recovery Cycle*· Other Channels'" • BEC.-BEC, (101) = •• In the single addressing mode and in the read cycle of the dual addressing mode: 25 clocks In the write cycle of the dual addressing mode: 29 clocks ••• The DMAC keeps the bus because the other channels have requests pending. If other channels do not have requests, the DMAC relinquishes the bus after the error recovery cycle. Figure 40 Bus Error Operation Retry moved, and thus will not honor any requests until it is removed. The retry exception causes the DMAC to terminate the However, the DMAC still recognizes requests. The retry timing present operation and retry that operation when retry is re- is shown in Figure 41. 90 ----------------------------------------------------------------HD68450,HD68450Y C l K . AID BUS OAS ---m...JJ ~ '\SL-DI AS J \\\ m m 0/ ill 01'5S J ill 0/ \\\ m ~ ~~~------~----------~----------~----~---- m iT] \n al R/W \\\ m \\\ ",-- ~ DDIR ~LO=W========================================================== High OBEN --;;;;"---mm 01 \\\ HIBYTE 9 1 11 12131415161718192021 22232425262728293031 - - ! - - - - Write to Device Retry Asserted 1 Write Cycle Retry --1-1- - - • 8EC,-BEC. = (001) Figure 41 Retry Operation Relinquish and Retry (R&R) the previous operation_ The relinquish and retry exception causes the DMAC to The diagram of the relinquish and retry timing is shown in relinquish the bus and three-state all bus master controls and Figure 42_ when the exception is removed, rearbitrate for the bus to retry 91 HD68450,HD68450Y------------------------------------------------------------------ ClK AID BUS UAS AS UDS lOS R!W --------------------~~~~-------------- OWN ------------------~~~------------- -a___________ ~~ DDIR DBEN ---" HIBYTE --------------------~~I ~~ ___ '--- DTACK -.JJ " \\\\\\\\\\\\\\\\\\\\\\1' 1",,~\ DTC -------~~~I-_'r--~~ ACK _a__________ rf .III \\.....____T'-. R&R (i:lECo- BEC2)' \\\ IUlUumllm BGACK BR m BG I ClK ----+- Rearbitration Read Retry -1----- * BECo·BEC, = (110) Figure 42 Relinquish and Retry Operation Reset (iii) DTYP specifies a dual addressing mode. DPS is 16 The reset provides a means of resetting and initializing the bits, SIZE is 8 bits and REQG is "10" or "II" . DMAC If the DMAC is bus master when the reset is asserted, (iv) an undefined configuration is set in the registers. the DMAC relinquishes the bus. Reset clears GeR, OCR, OCR, The undefmed configurations are: XRM ~ 01, MAC SCR, CCR, CSR, CPR, and CER for all channels. The NIV and ~ II, DAC ~ 11, CHAIN ~ 01, and SIZE ~ II. the EIV are all set to (OF)16, which is the uninitialized interrupt (b) Operation Timing Error - An operation timing error vector number for the HD68000 MPU. MTC, MAR, DAR, BTC, occurs in the following cases: BAR, MFC, DFC, and BFC are not affected. In order to insure a (i) when the CNT bit is set after the ACT bit has been reset, BEC o - BEC 2 must be kept at "Low" level for at least set by the DMAC in the chaining mode, or when ten clocks. the STR and the ACT bits are not set. (5) Error Conditions (ii) the STR bit is set when ACT, COC, BTC, NDT or When an error is signaled on a channel, all activity on that ERR is set. channel is stopped. The ACT bit of the CSR is cleared, and the (iii) an attempt to write to the OCR, OCR, SCR, MAR, COC bit is set. The ERR bit of the CSR is set, and the error DAR, MTC, MFC, or DFC is made when the STR code is indicated in the CER. All pending operations are cleared, bit or the ACT bit is set. so that both the STR and CNT bits ofCCR are cleared. (iv) an attempt to set the CNT bit is made when the Enumerated below are the error signals and their sources. BTC and the ACT bits are set. (a) Configuration Error - This error occurs if the STR bit is (c) Address Error - An address error occurs in the following set in the following cases. cases: (i) the CNT bit is set at the same time STR bit in the (i) an odd address is set for word or long word chaining mode. operands. (ii) DTYP specifies a single addressing mode, and the (ii) CS or lACK is asserted during the DMA bus cycle. device port size is not the same as the operand size. (d) Bus Error - Bus error occurs when a bus error excep- 92 ---------------------------------------------------------------------HD68450,HD68450Y tion is signaled during a DMA bus cycle. and the channel control register. After the successful comple- (e) Count Error - A count error occurs in the following tion of any transfer, the memory and device address registers cases: points to the location of the next operand to be transferred and (i) The STR bit is set when zero is set in the MTC the memory transfer counter contains the number of operands and the MTC and the chaining mode is not used. yet to be transferred. If an error occurs during a transfer, that (ii) the STR bit is set when zero is set in STC for the transfer has not completed and the registers contain the values array chaining mode. they had before the transfer was attempted. If the channel (iii) zero is loaded from memory to the STC or the MTC operation uses chaining, the Base Address Register points to the in the chaining modes or the continue mode. next chain entry to be serviced, unless the termination occurred (f) External Abort - External abort occurs if an abort is while attempting to fetch an entry in the chain. In that case, asserted by the external circuitry when the PCL line is the Base Address Register points to the entry being fetched. configured as an abort input and the STR or the ACT However, in the case of external abort, there are cases in which bit is set. the previous values are not recovered. (g) Software abort - Software abort occurs if the SAS bit is set when the STR or the ACT bit is set. Bus Exception Operating Flow The bus exception operating flow in the case of multiple exception conditions occurring continuously in sequence is Error Recovery Procedures shown in Figure 43. Note that the DMAC can receive and exe- If an error occurs during a DMA transfer, appropriate infor- cute the next exception condition. For example, if the retry mation is available to the operating system (OS) to allow a exception occurs, and next the relinquish and retry exception software failure recovery operation. The operating system must occurs while the DMAC is waiting for the retry condition to be be able to determine how much data was transferred, where the cleared, the DMAC relinquishes the bus and waits for the data was transferred to, an what type of error occurred. exception condition to be cleared. If a bus error occurs during The information available to the operating system consists of this period, the DMAC executes the bus error exception the present value of the Memory Address, Device Address and operation. Base Address Registers, the Memory Transfer and Base Transfer The flow diagram of the normal operation without exception Counters, the channel status register, the channel error register, operation or errors is shown in Figure 44. I ANYSTATE~ RESETTING ,I ,--jALL CHANNELS NON HLT. BER. RTY. RRT Y IDLE MODE I y NON IDLE MODE WAITING FOR I ()'fACl( & HLT (DTC) BER ~ BE"CCLEAR IDLE MODE WAITING FOR ~ BEC CLEAR ~T TO RETRY 1 DMAC YIELDS BUS - --------- 1-------- ----- - -- i-- DMAC OWNS BUS REO "0' ~ "" eo, RRT. HLT RRT. HLT ~TlNGFOR: 1 DMA MODE DMA MODE BER DMA MODE NO ACTIVE NON WAITING FOR CYCLE BEC CLEAR BEC CLEAR TO RETRY RST : reset I BER. RTY I NON NON HLT : no exception : halt BER BER : bus error START RTY : retry RTY RRT : relinquish and retry REO external request DMA MODE NON REON no external request OTACK & NON START bus cycle start BUS CYCLE ACTIV (OTC) DTACK DTACK signal asserted DTC DTC signal asserted OTACK & HLT (OTC) Figure 43 Bus Exception Flow Diagram 93 HD68450,HD68450Y------------------------------------------------------------------ oMA Mode Waiting for ':Ieset All Channels Idle Mode Bus Cycle to Start Bus Cycle Start No Transfer r---------------~ r--------~ oMA Mode Bus oMA Mode Waiting for Idle Mode Cycle Active Bus Cycle to Start Figure 44 Flow of Normal Operation Without Exception or Error Condition • Channel Priorities • APPLICATIONS INFORMATION Each channel has a priority level, which is determined by the contents of the Channel Priority Register (CPR). The priority Examples of how to interface HD684S0 to a HD68000 based of a channel is a number from 0 to 3, with 0 being the highest system are shown in Figure 4S and Figure 46. pri~rity level. When mUltiple requests are pending at the DMAC, Figure 45 shows an example of how to demultiplex the the channel with the highest priority receives first service. The address/data bus. OWN and VAS are used to control 74LS373 priority of a channel is independent of the device protocol or for latching the address. DBEN and DDIR are used to control the request mechanism for that channel. If there are several the bi-directional buffer 74 LS245. requesting channels at the highest priority level, a round-robin Figure 46 shows an example of inter-device connection in resolution is used, that is, as long as these channels continue to the HMCS68000 system. have requests, the DMAC does operand transfers in rotation. Resetting the DMAC puts the priority level of all channels to "0", the highest priority level. +5V9 D :> '" 74LS04 ..... ..... ~ OWN UAS I G OE G OE 16 16 16 As/Do-A23/D15 0 QQ ~ As - A23 (Address Bus) 74LS373 x2 HD68450 +5V9 - DMAC t- ! 8 ~A DBEN G 74LS245 B~ DDIR DIR (Data Bus) ~A L--......, G 74LS245 B~ DIR Figure 45 An Example of the Demultiplexed Address Data Bus 94 -------------------------------------------HD68450,HD68450Y t"" Do D15 Do- D15 r- r- r- Data & Address Bus Interface ~ FDC, etc. -- ~ Ii I~ I~ Ii 18 '-« o :(1 0'- 0 ~ <= I--- I--- I ) '-- ~ ~ A,-A23 Do -D15 t------- L. REOO} Al-A7k::==:::::j ~ ~ ::~ == ' - - - ACKo Channel #0 MEM & MMU ~ HOC, - PClo AS -- ~ etc. AS -- ~ r------ AS L----o REO,} L DSI------I-- I---- 1-----0 LDS '-----lACK, Channel #1 UDSI-------I-- I--- r - - - UDS L-----~PCl, HD68450 c R/WI-------I -- I--- R/W - ~ ~ 1------1 REO, ~ 0 " ID .~ DMAC DTACK 1-------1 -- DTACK I--- ~~ 'E""" g 3 ~ 1+-----lACK,} Channel #2 FCo-FC,I--f-----1ri - - ~ I--- ~ ~ FCo-FC, E E c 1-------IPCl, I- ~ - - till--- ~ -L.E_R_R_O_R_ _ _ _......l S n _8e ~ 0 0 ID 0 >. u u RE03 } IRO ~ I--- ~ /"'";j! I--- 8 U) lACK IJ-- e c-J p I r--- PTI3 ,-----jACK3 Channel #3 rv;:r; _ BECo-BEC2 _ 1 - - - - - ' " Do- D15 E 'v-- E r- E 1------,V1_ .e.s.el DS ~ nD:rT7"C'Tn:--]nn-="'lr~ I~A='~_-;:A-3....j.-I-I--I~ -- ~ £- R/W ~'" .~-" DONE I~ Ig iG« lsystem Interrupt ~ -- I--- '-- I--~-----I~ CS 0. 0 CPG ~~: g liII~rl~l "-~ ~ AS Dec. RS ~~~~~r. FCo-FC, 3 -+-- ~ r- IL.:~~:O~S===~ IY-:'RES Do~D15 ¢: r- I--- 1===~~Do-D7 ~~~~ '-- A, A23 ~ ~ HD68000 -- -- 1----" ~ MPU AS I---- LDS U5S -- I---- 6800 R/W -- I---- I--+-+-+--IR/W Periphr. DTACK -- -- VPA -- f-- - VMA -- -- - E -- -- 1-----l--lE T 3 -§:= -- -- -- -- I-------/IRO The address bus and the system control bus in each device Ene. -- are omitted in this Figure. Figure 46 An Example of I nter-device Connection in the HMCS68000 System 95 H068450,H068450Y--------------------------------------------------------------------- • ATTENTION ON USAGE OMAC latches the data when orr is asserted and not at the falling edge of E clock. The 74LS373 need to be provided ex- (I) How to interface various 6800 type peripheral devices to ternally as shown in Figure 47 so that the data from the 6800 the OMAC based system. device can be held on the bus for a large period of time until When the OMAC is reading data from the 6800 device, the the OMAC can latch the correct data. E /'-------::0-0---::0:""7-----........ 00- 07 6800 Type ~-8 in= r-- cs Device ~-------;::;r~<~o~~ :g8 f-RS L ______~ AS E /'------0-0---:0:-1-7- - - - - - '........ 00- 07 6800 Type Device ." !D AS ~+5V .. l!l a '----'-----+++1 AS 8 00 ~ PCl2 '" L- +5~f ~ ~g: V ~-~~ I~ H068450 OE G r--- OMAC ~_----I1D 1Q ~ 00-D7 I I Do'--D}1.~ 0 0 -0, 8D 8Q ---v .3 ~t 74lS373 I "' As/Do 00-D15 g ~~ -A23/D15 8+ V ~ DBEN As-A23 OOIR - Figure 47 An Example of Connection with 6800 type Peripheral Devices (channel 2 and 3 are used) (2) When"external abort"is inputted during the DONE input cycle inputted at the timing described above. If PCT = I, ERR = 0, When the transfer direction is from the peripheral device to and NOT = I, then an external abort has occurred. memory and PCL signal is set to the external abort input mode (3) Multiple Errors in the dual addressing mode, the external abort will be ignored The OMAC will log the first error encountered in the channel during the subsequent write cycle from the OMAC's internal error resister. If an error is pending in the error register and holding register to memory ifJ"5ONE is inputted during the read another error is encountered the second error will not be logged. cycle from the peripheral device to the OMAC's internal holding Even though the second error is not logged in the CER, it will register. still be recognized internally and the channel will not start. In this case, the channel status register (CSR) and the (4) The use of thick wiring is recommended between Vss of the channel error register (CER) show the normal termination H068450 and the ground of the circuit board. When a socket is caused by DONE Input. The user is able to examine the PCT used to install the OMAC on the board, please make sure that bit and the ERR bit in order to detect the external abort the contact of the Vss pins are made well. 96 ------------------------------------------------------------------HD68450,HD68450Y PRECAUTIONS: 1. Extra Data Transfer In the Burst Mode 2. One Byte of Transfer Data Is Left In the DMAC In certain conditions when two or more channels are active When the DMAC is set to dual addressing mode, port size 8 and the REQ signal for the channel which is transferring in burst bits, external request mode, and data transfer from peripheral mode has negated, the transfer operation will terminate one data device to memory, the last byte of the transfer may be left inside transfer later than specified in the data sheet. The condition on the DMACs internal register without being transferred to which this occurs is shown in Figure 2. Problems may occur in memory if the transfer is stopped before the transfer count is applications that need to control exact data transfer count using exhausted. The last byte that is left inside the DMAC becomes the REQ line in the burst mode. inaccessible by the MPU. In this mode, the DMAC transfers data repeating the fol- (Countermeasure) When switching the channel of operation using the burst lowing bus cycles: request signals, negate the RE:Q signal within the period (I) READ BYTE bounded by (3) and (4) in Figure 48. (DTC falling edge may be (Byte is read from the peripheral device to DMAC) used for obtaining the timing for the negation of REQ.) (2) READ BYTE Caution must be taken when this countermeasure is used since (Byte is read from the peripheral device to DMAC) this external circuit will not be compatible with the next mask (3) WRITE WORD version which will have this anomaly fixed. (Word is written to memory from DMAC) NOTE I: If transfer request is asserted in channell, before (I) If the transfer is terminated after (I) READ BYTE (see which is I clock before DTC assertion of channel 0, the next bus NOTE·), then the byte data that was ready by (I) READ BYTE cycle should be the bus cycle for channell according to the data bus cycle is not written to memory and is left inside the DMACs sheet. However, the current DMAC transfers one more data for internal holding register. The 0 MACs internal holding register channel 0 from 13th clock as shown above, before it changes to cannot be accessed by the MPU, so that it becomes "lost." channel I. This will not occur when single addressing mode is used. So, NOTE 2: If channel I has higher priority than channel 0, then please use the single addressing mode when the transfer needs to NO extra data is transferred even if request for channel I is be terminated before the transfer is exhausted. asserted before (2). In this case, data transfer for channell starts Note:"'The methods to terminate the transfer operation before from the 13th clock as specified in the data sheet. the transfer counter becomes zero are (I) assert external "'The timing in which one extra data is transferred in the burst abort using the PCL, (2) set the SAB bit to cause software mode (the case for changing from channel 0 to channel I). abort. I 2 3 4 5 6 7 8 9 10 II 12 13 14 BUS----------~r-------~--------~ CYCL~E~__#_O____~~------~--------~ i5'fC _ _____ (Burst) __L-._ _ _--<-+______....J ""fiE"O"O CD NOTE 2 CD NOTE I Figure 48. Extra Data Transfer In the Burst Mode" 97 98 HD68000 [H068000-4, H068000-6, H068000-a H068D00-10, H068000-l2) HD68000lr [H068000Y4, H068000Y6, H068000ya H068000Yln H068000Y12) MPU (Micro Processing Unit) Advances in semiconductor technology have provided the - The specification for HD68000-10/-12 and HD68000 capability to place on a single silicon chip a microprocessor at Y4/Y6/Y8/Yl0/Y12 are preliminary. - least an order of magnitude higher in performance and circuit complexity than has been previously available. The HD68000 HD68000-4, HD68000-6. HD68000-8. is one of such VLSI microprocessors. It combines rate-of-the-art HD68000-10, HD68000-12 technology and advanced circuit design techniques with cem- puter sciences to achieve an architecturally advanced l6-bit microprocessot. The resources available to the HD68000 user consist of the following. As shown in the programming model, the HD68000 offers seventeen 32-bit registers in addition to the 32-bit program counter and a l6-bit status register. The first eight registers (00-D7) are used as data registers for byte (8-bit), word (i 6-bit), and long word (32-bit) data operations. The second set of seven registers (AO-A6) and the system stack pointer may be (DC·64) used as software stack pointers and base address registers. In addition, these registers may be used for word and long word HD68000Y4, HD68000Y6. address operations. All 17 registers may be used as index HD68000Y8, HD68000Yl0. registers. HD68000Y12 • FEATURES • 32-Bit Data and Address Registers • 16 Megabyte Direct Addressing Range • 56 Powerful Instruction Types • Operations of Five Main Data Types • Memory Mapped I/O "Y" stands for Pin Grid • 14 Addressing Modes Array Package. • Compatible with MC68000L4, MC68000L6, MC68000L8, (PGA-68) MC68000L 10 and MC68000L 12 • PROGRAMMING MODEL 31 1 15 87 o _ DO 01 - - 02 - - 03 Eight -_ - _ 04 Data Registers _ _ 05 ~ _ 06 L-____________~----~----~07 ~ EL______________ "iii:" ~~ .3,~~ L . . ._ _ _ _ _ _ _ _ _ _ _ _ _ Regine" 16 87 0 ISystem Byte: Use, Byte I Status Register 99 HD68000,HD68000Y----------------------------------------------------- • PACKAGE DIMENSIONS (Unit: mm) • DC-64 (Side-brazacl Ceramic DIP) • PGA-68 (Pin Grid Arrav) ,".. - - -.......... r i ==.~Y-----r-------~~ 32 'I-_ _ _-f~33 I 0 22.58 6.4 • 0.3 0.20-0.38 - 22"- . • PIN ARRANGEMENT O. 0, 0, 0, 0, 0, 0, 0, 0, AS 0 .. IJ15S On °u °u 0 .. °u v" A .. Vee A.. A .. Au (Bottom View) Au A!,. A .. Pin No. Function Pin No. Function PinNa. Function Pin No. Function A .. 1 N/C 18 A, 36 D, 52 A" Au 2 OTACK 19 N/C 36 AS 53 A" Au Fe, 3 8GACK 20 A,. :f1 LDS 54 All An FC, A .. 4 iR 21 A,. 36 BG 65 Vee Fe" A, 5 CLK 22 A" 39 Vee 58 Vss AI A. 8 HALT 23 A" 40 Vss 67 Au AI A1 7 liMA 24 A.. 41 RES 58 D,. A) A. 8 E 25 All 42 VPA 59 Du A• ....._ _ _ _ _ _ _ _J"" A, 9 8ERR 26 An 43 IPL, 50 0, 10 N/C 27 0" 44 IP4 61 D. (Top View) 11 FC, 28 0" 46 FC. B2 D, 12 FCo 29 0 ,• 48 N/C 63 D. 13 A. 30 D. 47 A, 64 UDS 14 A, 31 0, 48 A. 65 RM 15 Ao 32 D. 49 Ao 65 IPL. 18 Ao 33 D. 50 A,. 67 A" 17 A, 34 D, .61 Au 68 0" 100 -----------------------------------------------------------------HD68000,HD68000Y • ABSOLUTE MAXIMUM RATINGS Item Symbol Value Unit Supply Voltage Vee * -0.3 - +7.0 V Input Voltage V in * -0.3 -+7.0 V Operating Temperature Range Topr 0-+70 °c Storage Temperature Tstg -55 - +150 °c • With respect to Vss (SYSTEM GNDI (NOTE) Permanent LSI damage may occur if maximum ratings are exceeded. Normal operation should be under recommended operating conditions. If these conditions are exceeded. it cauld affect reliability of lSI. • RECOMMENDED OPERATING CONDITIONS Item Symbol min typ max Unit Supply Voltage Vee * 4.75 5.0 5.25 V V IH * 2.0 - Vee V Input Voltage V IL * -0.3 - O.B V Operating Temperature Topr 0 25 70 °c • With respect to Vss (SYSTEM GNDI • ELECTRICAL CHARACTERISTICS • DC CHARACTERISTICS (Vee = 5V ±5%, Vss = OV, Ta = 0 - +70°C, Fig. 1,2,3, unless otherwise noted.) Item Symbol Test Condition min typ max Unit Input "High" Voltage V IH 2.0 - Vee V Input "low" Voltage V IL Vss-0.3 - O.B V BERR, BGACK, BR, DTACK, Input leakage Current IPlo-TiiI., VPA, ClK lin @5.25V - - 2.5 IlA HALT, RES - - 20 Three-State (Off State) AS, A, -A.3 , Do - D,s, Input Current FC o -FC., lOS, RIW, UDS, ITSI @2.4V/0.4V - - 20 JJ.A VMA AS,A,-A~G,~~ Output "High" Voltage FCo-FC., lOS, R ,UDS, VOH IOH = -4001lA 2.4 - - V VMA E* V ee -O·75 - - HALT IOL = 1.6mA - - 0.5 Output "low" Voltage A, -An, BG, FC. -FC. VOL IOL = 3.2mA - - 0.5 V RES IOL =5.3mA - - 0.5 AS, Do -0 15 , lOS, RIW, E, UDS, VMA IOL =5.3mA - - 0.5 Power Dissipation Po f = BMHz - - 1.5 W V ln = OV, Ta = 25°C, Capacitance (Package Type Dependent) Cln f = 1 MHz - 10.0 20.0 pF * With external pull up register of 470 n +5 V +5V +5V Test 910!l 2.9k!l POint lS2074- -@ Asvnchronous Inputs )i (Note 1) ~- - HAlT/m ~ --- ~ ® 11 ~ BERR/BR (Note 2) , -@- """ ' @) .. RtW CD- ~ ~®- --@- -. """ = i-@ !- ---® r.;., =' r-- @ I. - Data Out ~ ~ Fe. -Fe. ~ Asynchronous @ Inputs >- ~ f-® ®---- I - = - @ "'" I--@- f4-®- \. I --to I--@ "'='".. ~ \ I @ (NOTE) Timing measurements are referenced to and from a low voltage of 0.8 volts and a high voltage of 2.0 volts. unless otherwise noted. Figure 6 Write Cycle Timing 105 HD68000,HD68000Y-------------------------------------------------------------- Strobes and RIW - - - - - - - - - ' 14---@--+I ~----~,®------~ BGACK---t--------------------\~~----+__,@,----~--~r---------------------r-- BG ---------~ ClK (NOTES) 1. Setup time for the asynchronous inputs BERR, BGACK, BR, DTACK, IPL. -IPl., and VPA guarantees their recognition at the next falling edge of the clock. . 2. Waveform measurements for all inputs and outputs are specified at: logic high = 2.0 volts, logic low = O.B volts . .3. These waveforms should only be referenced in regard to the edge·to-edge measurement of the timing specifications. They are not intended as a functional description of the input an output signals. Refer to other functional descriptions and their related diagrams for device operation. Figure 7 AC Electrical Waveforms - Bus Arbitration • SIGNAL DESCRIPTION ADDRESS BUS (AI through A 23 ) The following paragraphs contain a brief description of the This 23-bit, unidirectional, three-state bus is capable of input and output signals. A discussion of bus operation during addressing 8 megawords of data. It provides the address for bus the various machine cycles and operations is also given. operation during all cycles except interrupt cycles. During interrupt cycles, address lines AI, A2 , and A3 Provide infor- • SIGNAL DESCRIPTION mation about what level interrupt is being serviced while address The input and output signals can be functionally organized lines A4 through A23 are all set to a logic high. into the groups shown in Figure 8. The following paragraphs provide a brief description of the signals and also a reference DATA BUS (Do through DIS) (if applicable) to other paragraphs that contain more detail This 16-bit, bidirectional, three-state bus is the general about the function being performed. purpose data path. It can transfer and accept data in either word or byte length. During an interrupt acknowledge cycle, Vcc(2) an external device supplies the vector number on data lines 2 Do -07 • A,-A" ClK 0.-0" ASYNCHRONOUS BUS CONTROL Asynchronous data transfer' are handled using the following control signals: address strobe, read/write, upper and lower FC. Asynchronous data strobes, and data transfer acknowledge. These signals Processor { HD6BOOO Bus are explained in the following paragraphs. Status FC Control Address Strobe (AS) E BR This signal indicates that there is· a valid address on the ~ Bus HMCS6BOO{ Peripheral 1m Arbitration address bus. Control 'iiJ5A Control Read/Write (R/W) R IPl. System { ES IPL } Interrupt This signal defines the data bus transfer as a read or write Control IPL Control cycle. The R/W signal also works in conjunction with the upper and lower data strobes as explained in the following paragraph. Figure 8 Input and Output Signals 106 -- -----------------------------------------------------------------H068000,H068000Y Upper and Lower Data Strobes (UDS, LOS) Bus Request (BR) These signals control the data on the data bus, as shown This input is wire ORed with all other devices that could in Table I. When the R/W line is high, the processor will read be bus masters. This input indicates to the processor that from the data bus as indicated. When the R/W line is low, the some other device desires to become the bus master. processor will write to the data bus as shown. Bus Grant (BG) This output indicates to all other potential bus master Table 1 Data Strobe Control of Data Bus devices that the processor will release bus control at the end of the current bus cycle. UOS LOS R/W 0 8 - DIS 0 0 -0 7 High High - No valid data No valid data Bus Grant Acknowledge (BGACKI Valid data bits Valid data bits This input indicates that some other device has become the Low Low High 0-7 bus master. This signal cannot be asserted until the following 8-15 four conditions are met: High Low High No valid data Valid data bits (1) A Bus Grant has been received 0-7 (2) Address Strobe is inactive which indicates that the High High Valid data bits microprocessor is not using the bus Low B -15 No valid data (3) Data Transfer Acknowledge is inactive which indicates Low Low Low Valid data bits Valid data bits that neither memory nor peripherals are using the bus B-15 0-7 (4) Bus Grant Acknowledge is inactive which indicates that Valid data bits Valid data bits no other device is still claiming bus mastership. High Low Low 0-7* 0-7 Valid data bits Valid data bits INTERRUPT CONTROL ffii[o, IPL I • IPL2 ) Low High Low 8 -15* These input pins indicate the encoded priority level of the 8-15 device requesting an interrupt. Level seven is the highest priority • These conditions are a result of current implementation and may not while level zero indicates that no interrupts are requested. appear on future devices. The least significant bit is given in IPLo and the most significant bit is contained in IPL2 • Data Transfer Acknowledge (DTACK) SYSTEM CONTROL This input indicates that the data transfer is completed. The system control inputs are used to either reset or halt When the processor recognizes DTACK during a read cycle, the processor and to indicate to the processor that bus errors data is latched and the bus cycle terminated. When DTACK have occurred. The three system control inputs are explained is recognized during a write cycle, the bus cycle is terminated. in the following paragraphs. An active transition of data transfer acknowledge, DTACK, indicates the termination of a data transfer on the bus. Bus Error (BERR) If the system must run at a maximum rate determined by This input informs the processor that there is a problem RAM access times, the rel!ltionship between the times at which with the cycle currently being executed. Problems may be a DTACK and DATA are sampled are important. result of: All control and data lines are sampled during the H068oo0's (1) Nonresponding devices clock high time. The clock is internally buffered, which results (2) Interrupt vector number acquisition failure in some slight differences in the sampling and recognition of (3) Illegal access request as determined by a memory man- various signals. 8068000 allow BERR or ~ to be recog- agement unit nized in S4, S6, etc., which terminates the cycle·. The DTACK (4) Other application dependent errors. signal, like other control signals, is internally synchronized to The bus error signal interacts with the halt signal to deter- allow for valid operation in an asynchronous system. If the mine if exception processing should be performed or the current required setup time (#47) is met during S4, 0'l'ACi{ will be bus cycle should be retried. I recognized during S5 and S6, and data will be captured during Refer to BUS ERROR AND HALT OPERATION paragraph S6. The data must meet the required setup time (#27). for additional information about the interaction of the bus If an asynchronous control Signal does not meet the required error and halt signals. setup time, it is possible that it may not be recognized during that cycle. Because of this, asynchronous systems must not Reset (RES) allow DTACK to precede data by) more than parameter #31. This bidirectional signal line acts to reset (initiate a system Asserting DTACK (or BERR on the rising edge of a clock initialization sequence) the processor in response to an external (such as S4) after the assertion of address strobe will allow reset signal. An internally generated reset (result of a RESET a HD68000 system to run at its maximum bus rate. If setup instruction) causes all external devices to be reset and the times #27 and #47 are guaranteed, #31 may be ingnored. internal state of the processor is not affected. A total system • The mask version 68000 allowed DTACK to be recognized as early reset (processor and external devices) is the result of external as S2 (bus state 2). HALT and RESET signals applied at the same time. Refer to RESET OPERATION paragraph for additional information BUS ARBITRATION CONTROL about reset operation. These three signals form a bus arbitration circuit to deter- mine which device will be the bus master device. Halt (HALT) When this bidirectional line is driven by an external device, 107 HD68000,HD68000Y----------------------------------------------------------------- it will cause the processor to stop at the completion of the devices that there is a valid address on the address bus and the current bus cycle. When the processor has been halted using processor is synchronized to enable. This signal only responds this input, all control signals are inactive and all three~tate lines to a valid peripheral address (vpA) input which indicates that are put in their high-impedance state. Refer to BUS ERROR the peripheral is a HMCS6800 family device. AND HALT OPERATION paragraph for additional information about the interaction between the halt and bus error signals. PROCESSOR STATUS (FC o• FC!. FC 2 ) When the processor has stopped executing instructions, such These function code outputs indicate the state (user or as in a double bus fault condition, the halt line is driven by the supervisor) and the cycle type currently being executed, as processor to indicate to external devices that the processor has shown in Table 2. The information indicated.,Ey the function stopped. code outputs is valid whenever address strobe (AS) is active. HMCS6800 PERIPHERAL CONTROL Table 2 Function Code Outputs These control signals are used to allow the interfacing of FC2 FC! FCo Cycle Type synchronous HMCS6800 peripheral devices with the asynchro- nous HD68000. These signals are explained in the following Low Low Low (Undefined, Reserved) paragraphs. Low Low High User Data Low High Low User·Program Enable (E) Low High High (Undefined. Reserved) This signal is the standard enable signal common to all HMCS6800 type peripheral devices. The period for this out- High Low. Low (Undefined, Reserved) put is ten HD68000 clock periods (six clocks low; four clocks High Low High Superviser Data high). High High Low Supervisor Program Valid Peripheral Address (VPA) High High High Interrupt Acknowledge This input indicates that the device or region addressed is a HMCS6800 family device and that data transfer should. be CLOCK (CLK) synchronized with the enable (E) signal. This input also indi- The clock input is a TTL-compatible signal that is internally cates that the processor should use automatic vectoring for an buffered for development of the internal clocks needed by the interrupt. Refer to INTERFACE WITH HMCS6800 PERIPHER- processor. The clock input sha1l be a constant frequency. ALS. SIGNAL SUMMARY Valid Memory Address (VMA) Table 3 is a summary of all the signals discussed in the This output is used to indicate to HMCS6800 peripheral previous paragraphs. Table 3 Signal Summary Signal Name Mnemonic Input/Output Active State Three State Address Bus AI -A23 output high yes Data Bus Do - 015 input/output high yes Address Strobe AS output low yes ReadlWrite read-high RiW output yes write-low Upper and lower Data Strobes UDS, TI5S output low yes Data Transfer .i\cknowledge DTACK input low no Bus Request BR input low no Bus Grant BG output low no Bus Grant Acknowledge BGACK input low no Interrupt Priority level IPlo, WL" IPl, input low no Bus Error BERR input low no Reset RES input/output low no' Halt HALT input/output low no' Enable E output high no Valid Memory Address VMA output low yes Valid Peripheral Address VPA input low no Function Code Output FC o ,FC I ,FC 2 output high yes Clock ClK input hjgh no Power Input Vcc input - - Ground Vss input - - * Open drain 108 -- --------------------------------------------------------------HD68000.HD68000Y • REGISTER DESCRIPTION AND DATA ORGANIZATION • DATA ORGANIZATION IN MEMORY The following paragraphs describe the registers and data Bytes are individually addressable with the high order byte organization of the HD68000. having an even address the same as the word, as shown in Figure 9. The low order byte has an odd address that is one • OPERAND SIZE count higher than the word address. Instructions and multibyte Operand sizes are defmed as follows: a byte equals 8 bits, data are accessed only on word (even byte) boundaries. If a a word equals 16 bits, and a long word equals 32 bits. The long word datum is located at address n (n even), then the operand size for each instruction is either explicitly encoded second word of that datum is located at address n + 2. in the instruction or implicitly defmed by the instruction The data types supported by the HD68000 are: bit data, operation. All explicit instructions support byte, word or long integer data of 8, 16, or 32 bits, 32-bit addresses and binary word operands. Implicit instructions support some subset of coded decimal data. Each of these data types is put in memory , all three sizes. as shown in Figure 10. • DATA ORGANIZATION IN REGISTERS • BUS OPERATION The eight data registers support data operands of 1, 8, 16, The following paragraphs explain control signal and bus or 32 bits. The seven address registers together with the active operation during data transfer operations, bus arbitration, bus stack pointer support address operands of 32 bits. error and halt conditions, and reset operation. DATA REGISTERS • DATA TRANSFER OPERATIONS Each data register is 32 bits wide. Byte operands occupy Transfer of data between devices involve the following leads: the low order 8 bits, word operands the low order 16 bits, and (I) Address Bus Al through A23 long word operands the entire 32 bits. The least significant bit (2) Data Bus Do through 015 is addressed as bit zero; the most significant bit is addressed (3) Control Signals as bit 31. The address and data buses are separate parallel buses used When a data register is used as either a source or destination to transfer data using an asynchronous bus structure. In all operand, only the appropriate low-orderportion is changed; cycles, the bus master assumes responsibility for deskewing the remaining high-order portion is neither used nor changed. all signals it issues at both the start and end of a cycle. In addition, the bus master is responsible for deskewing the ac- ADDRESS REGISTERS knowledge and data signals from the slave device. Each address register and the stack pointer is 32 bits wide The following paragraphs explain the read, write, and read- and holds a full 32 bit address. Address registers do not support modify-write cycles. The indivisible read-modify-write cycle byte sized operands. Therefore, when an address register is used is the method used by the HD68000 for interlocked multi- as a source operand, either the low order word or the entire processor communications. long word operand is used depending upon the operation size. When an -address register is used as the destination operand, the (NOTE) The terms _rtion and negation will be used extensively. entire register is affected regardless of the operation size. If the This Is done to avoid confusion when dealing with a mixture operation size is word, any other operands are sign extended of "active-low" and "active-high" signals. :Ibe term assert or assertion Is used to indicate that a signal Is active or true in- to 32 bits before the operation is performed. dependent of whether that voltage Is low or high. The term negate or negation is used to indicate that a signal is inactive or • STATUS REGISTER false. The status register contains the interrupt mask (eitht levels available) as well as the condition codes; extend (X), negative Read Cvcle (N), zero (Z), overflow (V), and carry (C). Additional status During a read cycle, the processor receives data from memo- bits indicate that the processor is in a trace (T) mode and/or ry or a peripheral device. The processor reads bytes of data in a supervisor (S) state. in all cases. If the instruction specifies a word (or double word) operation, the processor reads both bytes. When the instruction Status Register specifies byte operation, the processor uses an internal Ao bit to determine which byte to read and then issues the data strobe required for that byte. For bytes operations, when the Ao bit equals zero, the upper data strobe is issued. When the Ao bit equals one, the lower data strobe is issued. When the data is received, the processor correctly positions it internally. A word read cycle flow chart is given in Figure 11. A byte read cycle flow chart is given in Figure 12. Read cycle timing is given in Figure 13. Figure 14 details word and byte read cycle Interrupt Mask operations. Refer to these illustrations during the following Overflow detailed. Carry Unused. read as zero. 109 HD68000,HD68000Y----------------------------------------------------------------- At state zero (SO) in the read cycle, the address bus (AI returning data transfer acknowledge. At the end of state 6 through A23 ) is in the high impedance state. A function code (beginning of state 7) incoming data is latched into an internal is asserted on the function code output line (FC o through FC 2 ). data bus holding register. The read/write (R/W) signal is switched high to indicate a read During state 7, address strobe and the upper and/or lower cycle. One half clock cycle later, at state 1, the address bus is data strobes are negated. The address bus is held valid through released from the high impedance state. The function code state 7 to allow for static memory operation and signal skew. outputs indicate which address space that this cycle will operate The read/write signal and the function code outputs also remain on. valid through state 7 to ensure a correct transfer operation. The In state 2, the address strobe (AS) is asserted to indicate that slave device keeps its data asserted until it detects the negation there is a valid address on the address bus and the upper and of either the address strobe or the upper and/or.1ower data lower data strobe (UDS, LDS) is asserted as required. The mem- strobe. The.slave device must remove its data and data transfer ory or peripheral device uses the address bus and the address acknowledge within one clock period of recognizing the nega- strobe to determine if it has been selected. The selected device tion of the address or data strobes. Note that the data bus might uses the read/write signal and the data strobe to place its infor- not become free and data transfer acknowledge might not be mation on the data bus. Concurrent with placing data on the removed until state 0 or 1. data bus, the selected device asserts data transfer acknowledge When address strobe· is negated, the slave device is released. (DTACK). Note that a slave device must remain selected as long as address Data transfer acknowledge must be present at the processor strobe is asserted to ensure the correct functioning of the read- at the start of state S or the processor will substitute wait states modify-write cycle. for states Sand 6. State 5 starts the synchronization of the 110 - - HD68000,HD68000Y 15 14 13 12 11 10 9 S 7 6 5 4 3 2 0 WOrd.OOooOO Syte 000000 SyteOOOOOl Word,OOOO02 Byte 000002 Byte 000003 Byte FFFFFE WOrdtFFFFE Byte FFFFFF <' Figure 9 Word Organization in Memory Bit Data 1 Byte ~ S Bits 7 6 5 4 3 2 0 I nteger Data 1 Byte ~ S Bits 15 14 13 12 11 10 9 S 7 6 5 4 3 2 0 SyteO Byte 1 n+l n IMSB LSBI n+2 Syte2 Byte 3 n+3 I 1 Word = 16 Bits 15 14 13 12 11 10 9 S 7 6 5 4 3 2 0 ::I~' ~'I Word 0 n+l Word 1 n+3 Word 2 n+5 1 Long Word = 32 Bits 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 n MSS High Order n+l 1--- Long Word 0 - - - - - - - - - - - - - - - - - : . . . . - - - - - - - - - - - n+2 Low Order LSB n+3 n+4 n+5 ---Long Word 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - n+6 n+7 n+S n+9 - - -Long Word 2-- - - - - - - - - - - - - - - - - - - - - - - - - - - - n+l0 n+11 Addresses 1 Address = 32 Bits 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 n MSB High Order n+l - - Address 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - n+2 low Order LSB n+3 n+4 n+5 - - Address 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - n+6 n+7 n+8 __ .Address2. __________________________ - - - - n+9 n+l0 n+l1 MSB = Most Significant Bit LSB = Least Significant Bit Decimal Data 2 Binary Coded Decimal Digits = 1 Byte 15 14 13 12 11 10 9 'S 7 6 5 4 3 2 1 0 n MSD n+l BCDO BCDI BCD2 BCD3 LSD n+2 BCD4 BCD5 SCD6 BCD7 n+3 .. MSD = Most S,gnificant DIgIt LSD = Least Significant Digit Figure 10 Data Organization in Memory 111 HD68000,HD68000Y------------------------------- BUS MASTER SLAVE BUS MASTER SLAVE Address Device Address Device 11 Set R/Wto Read 1) Set R!W to Reed 2) Place Function Code on FC. - FC2 2) Place Function Code on FC. - FC. 3) Place Address on AI - A.. 3) Place Address on AI - An 4) Assert Addre•• Strobe (AS) 4) Assert Address Strobe (AS) 5) Assert Upper Data Strobe (iJDS) and Low- 5) Assert Upper Data Strobe (iJi5S) or Lower er Data Strobe (lOS) (besed on A.) Data Strobe (lOS) I I Input Data Input Data 1) Decode Address 2) Place Data on D. - 0, or D. - DIS (based 1) Decode Address on UDS or lOS) 21 Place Data on D. - DIS 3) Assert Data Transfer Acknowledge 3) Assert Data Transfer Acknowledge (i5fACi() (DTACKI l Acquire Data Acquire Data 1) latch Data 1) Latch Data 2) Negate ~ or IDS 2) Negate ~ and IDS 3) Negate AS 3) Negate~ ~ 1 Terminate Cycle Terminate Cycle 1) Remove Data from D. - 0, or D. - DIS 11 Remove Data from D. - DIS 2) Negate DTACK 2) Negate DTACK r Start Next Cycle r Start Next Cycle Figure 11 Word Read Cycle Flow Chart Figure 12 Byte Read Cycle Flow Chart so S1 S2 S3 S4 S5 S6 S7 SO S1 S2 S3 S4 S5 S6 S7 SO S1 S2 S3 S4 w w w w S5 S6 S7 ClK ASI~~~----~~~------~~~------------~~ \ ~------------~~ ~______-JI UDS / \ LOS / \ I Figure 13 Read and Write Cycle Timing Diagram 112 -----------------------------------------------------------------HD68000,HD68000Y ClK A I ...... A t3 A.' H H I >- AS ;---\ I \ I \ r- UDS I \ I \ r- lOS I \ I \ I R/W DTACK J \ ;---\ I \ I 0 8 -DIS :J < > < r- D. -0, => ( ) ( > FC. -FC, ::::x X X x::= + -- • Internal Signal Only f- -- -- Word Read - - +--- -Odd Byte Read- - Even Byte Read ---1 Figure 14 Word and Byte Read Cycle Timing Diagram Write Cycle read/write signal and the data strobes to take its information During a write cycle, the processor sends data to memory from the data bus. The selected device asserts data transfer or a peripheral device_ The processor writes bytes of data in acknowledge (DTACK) when it has successfully stored the data. all cases_ If the instruction specifies a word operation, the pro- Data transfer acknowledge must be present at the processor cessor writes both bytes. When the instruction specifies a byte at the start of state 5 or the processor will substitute wait states operation, the processor uses an internal Ao bit to determine for states 5 and 6. State 5 starts the synchronization of the which byte to write and then issues the data strobe required returning data transfer acknowledge. for that byte. For byte operations, when the Ao bit equals zero, During state 7, address strobe and the upper and/or lower the upper data strobe is issued. When the Ao bit equals one, data strobes are negated. The address and data buses are held the lower data strobe is issued. A word write cycle flow chart is valid through state 7 to allow for static memory operation and given in Figure 15. A byte write cycle flow chart is given in signal skew. The read/write signal and the function code outputs Figure 16. Write cycle timing is given in Figure 13. Figure 17 also remain valid through state 7 to ensure a correct transfer details word and byte write cycle operation. Refer to these operation. The slave device keeps its data transfer acknowledge illustrations during the following detailed discussion. asserted until it detects the negation of either the address strobe At state zero (SO) in the write cycle, the address bus (AI or the upper and/or lower data strobe. The slave device must through A23 ) is in the high impedance state. A function code is remove its data transfer acknowledge within one clock period asserted on the function code output line (FC o through FC 2 ). after recognizing the negation of the address or data strobes. Note that the processor releases the data bus at the end of state (NOTE) The read/write (R/W) signal remains high until state 2 to pre- 7 but that data transfer acknowledge might not be removed vent bus conflicts with preceding read cycles. The data bus is until state 0 or I. When address strobe is negated, the slave not driven until state 3. device is released. One half clock later, at state 1, the address bus is released from the high impedance state. The function code outputs indicate which address space that this cycle will operate on. Read-Modify-Write Cycle In state 2, the address strobe (AS) is asserted to indicate The read-modify-write cycle performs a read, modifies the that there is a valid address on the address bus. The memory data in the arithmetic-logic unit, and writes the data back to the or peripheral device uses the address bus and the address strobe same address. In the HD68000 this cycle is indivisible in that to determine if it has been selected. During state 2, the read/ the address strobe is asserted throughout the entire cycle. The write signal is switched low to indicate a write cycle. When test and set (TAS) instruction uses this cycle to provide mean- external processor data bus buffers are required, the read/write ingful communication between processors in a multiple pro- line provides sufficient directional control. Data is not asserted cessor environment. This instruction is the only instruction that during this state to allow sufficient turn around time for ex- uses the read-modify-write cycle and since the test and set in- ternal data buffers (if used). Data is asserted onto the data bus struction only operates on bytes, all read-modify-write cycles during state 3. are byte operations. A read-modify-write cycle flow chart is In state 4, the data strobes are asserted as required to indi- given in Figure 18 and a timing diagram is given in Figure 19. cate that the data bus is stable. The selected device uses the Refer to these illustrations during the following detailed discus- 113 HD68000.HD68000Y--------------------------------------------~~-------------- sions. of the returning data transfer acknowledge for the write portion At state zero (SO) in the read-modify-write cycle, the address of the cycle. The bus interface circuitry issues requests for bus (AI through Al3 ) is in the high impedance state. A function subsequent internal cycles during state 18. code is asserted on the function code output line (FC o through During state 19, address strobe and the upper or lower data FC l ). The read/write (R/'ii) signal is switched high to indicate strobe is negated. The address and data buses are held valid a read cycle. One half clock cycle later, at state 1, the address through state 19 to allow for static memory operation and bus is released from the high impedance state. The function signal skew. The read/write signal and the function code outputs code outputs indicate which address space that this cycle will also remain valid through state 19 to ensure a correct transfer operate on. operation. The slave device keeps its data transfer acknowledge In state 2, the address strobe (AS) is asserted to indicate that asserted until it detects the negation of either the address strobe there is a valid address on the address bus and the upper or or the upper or lower data strobe. The slave device must remove lower data strobe (UDS, LOS) is asserted as required. The mem- its data transfer acknowledge within once clock period after ory or peripheral device uses the address bus and the address recognizing the negation of the address or data strobes. Note strobe to determine if it has been selected. The selected device that the processor releases the data bus at the end of state 19 uses the read/write signal and the data strobe to place its infor· but that data transfer acknowledge might not be removed until mation on the data bus. Concurrent with placing data on the state 0 or 1. When address strobe is negated the slave device is data bus, the selected device asserts data transfer acknowledge released. (DTACK). Data transfer acknowledge must be present at the processor at the start of state 5 or the processor will substitute wait stat!ls for states 5 and 6. State 5 starts the synchronization of the returning data transfer acknowledge. At the end of state 6 • BUS ARBITRATION (beginning of state 7) incoming data is latched into an internal Bus arbitration is a technique used by master-type devices data bus holding register. to request, be granted, and acknowledge bus mastership. In its During state 7, the upper or lower data strobe is negated. simples form, it consists of: The address bus, address strobe, read/write signal, and function (I) Asserting a bus mastership request. code outputs remain as they were in preparation for the write' (2) Receiving a grant that the bus is available at the end of portion of the cycle. The slave device keeps its data asserted the current cycle. until it detects the negation of the upper or lower data strobe. (3) Acknowledging that mastership has been assumed. The slave device must remove its data and data transfer ac- F:igure 20 is a flow chart showing the detail involved in a knowledge within one clock period of recognizing the negation request from a single device. Figure 21 is a timing diagram of the data strobes. Internal modification of data may occur for the same operations. This technique allows processing of from state 8 to state 11. bus requests during data transfer cycles. (NOTE) The read/write signal remains high until state 14 to prevent bus The timing diagram shows that the bus request is negated conflicts with the preceding read portion of the cycle and the data bus is not asserted by the processor until state 15. at the time that an acknowledge is asserted. This type of oper- ation would be true for a system consisting of the processor In state 14, the read/write signal is switched low to indicate and one device capable of bus mastership. In systems having a write cycle. When external processor data bus buffers are a number of devices capable of bus mastership, the bus request required, the read/write line provides sufficient directional line from each device is wire ORed to the processor. In this control. Data is not asserted during this state to allow sufficient system, it is easy to see that there could be more that one bus turn around time for external data buffers (if used). Data is request being made. The timing diagram shows that the bus asserted onto the data bus during state 15. grant signal is negated a few clock cycles after the transition In state 16, the data strobe is asserted as required to indicate of the acknowledge (BGACK) signal. that the data bus is stable. The selected device uses the read/ However, if the bus requests are still pending, the processor write signal and the data strobe to take its information from the will assert another bus grant within a few clock cycles after data bus. The selected device asserts data transfer acknowledge it was negated. This additional assertion of bus grant allows (DTACK) when it has successfully stored its data. external arbitration circuitry to select the next bus master Data transfer acknowledge must be present at the processor before the current bus master has completed its requirements. at the start of state 17 or the processor will substitute wait The following paragraphs provide additional information about states for states 17 and 18. State 17 starts the synchronization the three steps in the arbitration process. 114 -------------------------------HD68000,HD68000Y BUS MASTER SLAVE BUS MASTER SLAVE Address Device 1) Place Function Code on FC. - FC, Address Device 2) Place Address on AI"'" Au 1) Place Function Code on FC. - FC, 3) Assert Add ress Strobe (AS) 2) Place Address on A, - Au 4) Set R/iN to Write 3) Assert Address strobe (AS) 5) Place Data on Do ..... 0, or Os ..... DIS (according 4) Set R /W to Write to Au) 5) Place Data on D. - 0" 6) Assert Upper Data Strobe ('liDS) or lower 6) Assert Upper Data Strobe (iJEiS) and Data Strobe ([OS) (based on A.) Lower Data Strobe ([OS) 1 1 Input Data Input Data 1) Decode Address 1) Decode Address 2) Store Data on D. - 0, if [[is is asserted 2) Store Data on D. - 0" Store Data on D. - 0" if ODS is asserted 3) Assert Data Transfer Acknowledge (DTACJ<) 3) Assert Data Transfer Acknowledge IDTACK) Terminate Output Transfer 1) Negate UDS and lOS ~ Terminate Output Transfer 2) Negate AS 1) Negate iJDS and lOS 2) Negate AS 3) Remove Data from D. - 0" 4) Set R/W to Read 3) Remove Data from D. - 0, or D. - DIS 4) Set RIW to Read I 1 Terminate Cycle Terminate Cycle 1) Negate~ 1) Negate D'fACK I Start Next Cycle Start Next Cycle Figure 15 Word Write Cycle Flow Chart Figure 16 Byte Write Cycle Flow Chart SO SI S2 S3 54 55 56 57 SO SI 52 53 54 55 S6 S7 50 SI S2 53 54 55 S6 57 ClK A." A5~ I \ I \ r- UDS \ I \ r- lD5 \ I \ I RIWJ\ 1\ 1\ r DTACK \ I \ I \ r ) D. -0 15 < > < > < ~ 0.-0, ) ( ( ~ > > < FC. -FC, :x "Internal Signal Only X X > I- - - - Word Write - -- + -- Odd Byte Write - - - + -- Even Byte Write - - --I Figure 17 Word and Byte Write Cycle Timing Diagram 115 HD68000,HD68000Y------------------------------- BUS MASTER SLAVE Add.... Device 11 Set R/W to Read 21 Place Function Code on FC. - FC2 Input Data 31 Place Address on AI - Au 41 Assert Add .... Strobe (ASI 11 Decode Add .... 51 Assert Upper Data Strobe (UDSI or 21 Place Data on O. -0, or O. -0 .. Lower Data Strobe (~l 31 Assert Data Transfer Acknowledge (oTACKI 11 Latch Data i Acquire Data 21 Negate tm'S" or ~ 31 Start Data Modification Terminata Cycle 1) Remove Data from O. - 0, or o. - 0 .. 21 Negate~ 11 Set R/W to Writa i Start Output Transfer 21 Place oeta on O. - 0, or O. - 0 .. 31 Assert Upper Data Strobe (UoSl or Lower 11 Strobe Data on O. - 0, or O. - 0 .. Data Strobe (rDJ) 21 Assert Data Transfer Acknowledge (oTACKI Termlnata Output Transfer Nagata OM or 1:DI 1') 21 NegateAS 31 Remove Data from O. -0, or O. -0 .. 41 Set R/W to Reed Termlnata Cycle 11 Negate~ I Start Next Cycle Figure 18 Read·Modify-Write Cycle Flow Chart CLK Uos or res ----"'\ '~______~============~ I __JI '\.. __ ..J,r--- R/W-----=======~-,....~~~~------~\==~--~r-- ~ ---~, I 'r__ o. - 0, orO. -0.. FC.- FC2 ::x______________________________________x::: ( ) ( }--- r-- ---------- Indivisible Cycle - - - - - - - - - - ~ Figure 19 Read-Modify·Write Cycle Timing Diagram 116 -----------------------------------------------------------------HD68000,HD68000Y PROCESSOR REQUESTING OEVICE Requesting the Bus External devices capable of becoming bus masters request Request the Bus the bus by asserting the bus request (BR) signal_ This is a wire 1) Assert Bus Request (BR) ORed signal (although it need not be constructed from open I collector devices) that indicates to the processor that some external device requires control of the external bus_ The pro- Grant Bus Arbitration cessor is effectively at a lower bus priority level that the ex- 1) Assert Bus Grant (BGI ternal device and will relinquish the bus after it has completed ~I--------------, the last bus cycle it has started_ ~ When no acknowledge is received before the bus request signal goes inactive, the processor will continue processing Acknowledge Bus Mastersh ip 1) External arbitration determines next bus when it detects that the bus request is inactive _ This allows master ordinary processing to continue if the arbitration circuitry 2) Next bus master waits for current cvcle to responded to noise inadvertently. complete 3) Next bus master asserts Bus Grant Receiving the Bus Grant Acknowledge (BGACK) to become new master The processor asserts bus grant (BG) as soon as possible_ 4) Bus master negates BR Normally this is immediately after internal synchronization. I The only exception to this occurs when the processor has made an internal decision to execute the next bus cycle but has not progressed far enough into the cycle to have asserted the address Terminate Arbitration strobe (AS) signal. In this case, bus grant will not be asserted 1) Negate BG (and wait for BGACK to be until one clock after address strobe is asserted to indicate to negated) external devices that a bus cycle is being executed. The bus grant signal may be routed through a daisy-(;hained network or through a specific priority-encoded network. The Operate as Bus Master processor is not affected by the external method of arbitration 11 Perform Data Transfers (Read and Write as long as the protocol is obeyed. cycles) according to the same rules the pro- cessor uses. Acknowledgement of Mastership Upon receiving a bus grant, the requesting device waits Release Bus Mastership until address strobe, data transfer acknowledge, and bus grant 11 Negate BGACK acknowledge are negated before issuing its own BGACK. The negation of the address strobe indicates that the previous master has completed its cycle, the negation of bus grant Re-Arbitrate or Resume Processor acknowledge indicates that the previous master has released Operation the bus. (While address strobe is asserted no device is allowed to "break into" a cycle.) The negation of data transfer acknowl- edge indicates the previous slave has terminated its connection Figure 20 Bus Arbitration Cycle Flow Chart to the previous master. Note that in some applications data CLK AS LDS/UDS R/W DTACK Do -015 FC. -FC, BR I ~--------~\~==~-----~I ~ BGAcK \ , I r---------~\====~~I I ,"----- Processor - - +-- -+- - - -- DMA Device -+--- Processor - - - DMA Device - - - - Figure 21 Bus Arbitration Cycle Timing Diagram 117 HD68000,HD68000Y----------------------------------------~-------------------- transfer acknowledge might not enter into this function. Gen- acknowledge pins respectively. The bus grant output is lebeled eral purpose devices would then be connected such that they G and the internal three-state control signal T. If T is true, the were only dependent on address strobe. When bus grant ac- address, data, function code line, and control buses are placed knowledge is issued the device is bus master until it negates in a high-impedance state when AS is negated. All signals are bus grant acknowledge. Bus grant acknowledge should not be shown in positive logic (active high) regardless of their true negated until after the bus cycle{s) is (are) completed. Bus active voltage level. mastership is terminated at the negation of bus grant acknowl- State changes (valid outputs) occur on the next rising edge edge. after the internal signal is valid. The bus request from the granted device should be drop- A timing diagram of the bus arbitration sequence during a ped after bus grant acknowledge is asserted. If a bus request processor bus cycle is shown in Figure 24. The bus arbitration is still pending, another bus grant will be asserted within a few sequence while the bus is inactive (i.e., executing internal clocks of the negation of bus grant. Refer to Bus Arbitration operations such as a multiply instruction) is shown in Figure 25. Control section. Note that the processor does not perform If a bus request is made at a time when the MPU has already any external bus cycles before it re-asserts bus grant. ~un a bus cycle but AS has not been asserted (bus state SO), BG will not be asserted on the next rising edge. Instead, BG will • BUS ARBITRATION CONTROL be delayed until the second rising edge following it's internal The bus arbitration control unit in· the HD68000 is im- assertion. This sequence is shown in Figure 26. plemented with a fmite state machine. A state diagram of this machine is shown in Figure 22. All asynchronous signals to the • BUS ERROR AND HALT OPERATION HD68000 are synchronized before being used internally. This In a bus architecture that requires a handshake from an ex- synchronization is accomplished in a maximum of one cycle ternal device, the possibility exists that the handshake might not of the system clock, assuming that the asynchronous input occur. Since different systems will require a different maximum setup time (#47) has been met (see Figure 23). The input response time, a bus error input is provided. External circuitry signal is sampled on the falling edge of the clock and is valid must be used to determine the duration between address strobe internally after the next falling edge. and data transfer acknowledge before issuing a bus e~ror sign;d. As shown in Figure 22, input signals labeled R and A are When a bus error signal is received, the processor has two internally synchronized on the bus request and bus grant options initiate a bus error exception sequence or try running the bus cycle again. RA 1 Internal Signal v a l i d - - - - - - - - . External Signal samPled. + ClK BR (Externall-----" @ BR U n t e r n a l l - - - - - - - - - - - - t - , Asychronous Input Delay' • This delay time is equal to parameter #33, tCHGL' R - Bus Request Internal A - Bus Grant Acknowledge Internal G - Bus Grant Figure 23 Timing Relationship of External Asynchronous T • Three-State Control to Bus Control logic I nputs to I nternlll Signals X • Don't Care • State machine will not changa state if bus is in SO. Refer to BUS ARBITRATION CONTROL for additional information. Figure 22 State Diagram of HD68000 Bus Arbitration Unit 118 -----------------------------------------------------------------HD68000,HD68000Y Processor starts next bus CYClefl Bus released from three state and BGACK negated internalll BGACK sampled BGACK negated ClK 50 51 52 53 54 55 56 57 50 51 52 53 54 55 56 57 50 51 BR - - - - - - - , / BG=========~~~~~S\:::~=~--~I BGACK \ ~ _ _ _...J/ A. -Au ( ) ( A5 \~ _ _ __JI'--------------~~ ___~I U05 \ I' ~ r---- l05 \ f"'\ ~ r---- FC.-FC, -=:::::x~~~~~~~)======~( RtW = , , ~~~~~C~ o. - OTACK ~\<======/~------------------------__~\~:c====:J;---- 0.. _____________ ( ) r--- ( .. Processor _I" Alternate Bus Master _I.. Processor .. Figure 24 Bus Arbitration During Processor Bus Cycle .~ ....... ,~ ~'" -~, ,-.~ ow ,~",'. BGACK negated BR valid internal BR sampled I BR asserted ClK W~~~S4~~D W~~~54 BR BG-------------~=======\------J \ I \ I BGACK \ I A5~ A.-A,. , --<[~====;t:====~=========~(~~= ~ I U05~~=====~fl---------~~----------------~~ l05~ __________________ Ir----------~ ~~ FC. -FC, :x ) ( RtW-------------~'----------~----- OTACK \ I '--- 0.-0 .. -------:----~::::==}_--~~~~------------:: Processor Bus Inactive __~:_~_._------------~~~:: Alternate Bus Master Processor - -I" "I- "I" Figure 25 Bus Arbitration with Bus Inactive 119 HD68000.HD68000Y-------------------------------------------------------------- SA, so 81 82 83 S4 S5 56 87 I SO 81 82 S3 S4 85 56 87 SO 81 BG \ I BGACK \ I A,-A.. < > < >-C A8 \ I' r--"\ I U08 \ I' ~ I iJ5S \ I' r---""\ I FC. -Fe. =:J< > ( x:: RiW \ I i5'i'ACK \ I \ I 0.-0" .. Processor ( -I- ) Altarnate Bus Master -I- ( Proceaor >--• Figure 26 Bus Arbitration During Processor Bus Cycle Special Case Exception Sequence (3) Reading the bus error vector table entry When the bus error signal is asserted, the current bus cycle (4) Executing the bus error handler routine is tenninated. If BERR is asserted before the falling edge of The stacking of the program counter and the status register S4, AS will be negated in S7 in either a read or write cycle. is the same as if an interrupt had occurred. Several additional As long as BERR remains asserted, the data and address buses items are stacked when a bus error occurs. These items are used will be in the high-impedance state. When BERR is negated, to determine the nature of the error and correct it, if possible. the processor will begin stacking for exception processing. The bus error vector is vector number two located at address Figure 27 is a timing diagram for the exception sequence. 5000008. The processor loads the new program counter from The sequence is composed of the following elements. this location. A software bus error handler routine is then (1) Stacking,the program counter and status register executed by the processor. Refer to EXCEPTION PROCESS· (2) Stacking the error information ING for additional information. 120 -----------------------------------------------------------------HD6S000,HD6S000Y Re-Running the Bus Cycle same function codes, the same data (for a write operation), and When, during a bus cycle, the processor receives a bus error the same controls. The bus error signal should be removed at signal and the halt pin is being driven by an external device, least one clock cycle before the halt signal is removed. the processor enters the re-run sequence. Figure 28 is a timing diagram for re-running the bus cycle. (NOTE) The processor will not re-run a read-modify-write cycle. This The processor terminates the bus cycle, then puts the address restriction is made to guarantee that the entire cycle runs cor- rectly and that the write operation of a Test-and-Set operation and data output lines in the high-impedance state. The processor is performed without ever releasing AS. If BERR and HALT remains "halted," and will not run another bus cycle until the are asserted during a read-modify-write bus cycle, a bus error halt signal is removed by external logic. Then the processor operation results. will re-run the previous bus cycle using the same address, the ClK AS ______\~----------------------------JI \ loS/UoS Rm \ /"'--- \ '-- oTACK--------------------------------------------------~ 0.-0" ::~::::~(~~~~~~~~~~~~~~~~~~2:::::j ( ::::::x: FC. - FC, BERR==~====================~\-------------~~== HAlT-------------~==============~--- L--Initiat~ r- - Read . - - Response Fallure- - -+- . - - - Bus Error oetectlon- - - ~- _1_ Initiate Bus - - - - - --- Error Stacking Figure 27 Sus Error Timing Diagram \'-_ _ _~I r-------------------------~\ /~--- ~- - - - - Reed - - - ~- - - - - - - Halt- - - - - - +- -- - Rerun- - --.\ Figure 28 Re-Run Bus Cycle Timing Information 121 HD68000,HD68000Y------------------------------- The processor terminates the bus cycle, then puts the ad- This is required for correct performance of the re-run bus dress, data and function code output lines in the high-impedance cycle operation. state. The processor remains "halted," and will not run another While the processor is honoring the halt request, bus arbitra- bus cycle until the halt signal is removed by external logic. Then tion performs as usual. That is, halting has no effect on bus the processor will re-run the previous bus cycle using the same arbitration. It is the bus arbitration function that removes the address, the same function codes, the same data (for a write control signals from the bus. operation), and the same controls. The bus error signal should The halt function and the hardware trace capability allow be removed before the halt signal is removed. the hardware debugger to trace single bus cycles or single in- structions at a time. These processor capabilities, along with Halt Operation with No Bus Error a software debugging package, give total debugging flexibility. The halt input signal to the HD68000 perform a Halt/Run/ Single-Step function in a similar fashion to the HMCS6800 Doubla Bus Faults halt function. The halt and run modes are somewhat self ex- When a bus error exception occurs, the processor will at- planatory in that when the halt signal is constantly active the tempt to stack several words containing information about processor "halts" (does nothing) and when the halt signal is the state of the machine. If a bus error exception occurs during constantly inactive the processor "runs" (does something). the stacking operation, there have been two bus errors in a row. The single-step mode is derived from correctly timed transi- This is commonly referred to as a double bus fault. When a tions on the halt signal input. It forces the processor to execute double bus fault occurs, the processor will halt. Once a bus a single bus cycle by entering the "run" mode until the pro- error exception has occurred, any bus error exception occurring cessor starts a bus cycle then changing to the "halt" mode. before the execution of the next instruction constitutes a dou- Thus, the single-step mode allows the user to proceed through ble bus fault. (and therefore debug) processor operations one bus cycle at a Note that a bus cycle which is re-run does not constitute a time. bus error exception, and does not contribute to a double bus Figure 29 details the timing required for correct single-step fault. Note also that this means that as long as the external operations. Some care must be exercised to avoid harmful hardware requests it, the processor will continue to re-run interactions between the bus error signal and the halt pin the same bus cycle. when using the single cycle mode as a debugging tool. This The bus error pin also has an effect on processor operation is also true of interactions between the halt and reset lines after the processor receives an external reset input. The pro- since these can reset the machine. cessor reads the vector table after a reset to determine the ad- When the processor completes a bus cycle after recognizing dress to start program execution. If a bus error occurs while that the halt signal is active, most three-state signals are put reading the vector table (or at any time before the flfSt instruc- in the high-impedance state. These include: tion is executed), the processor react,s as if a double bus fault (J) Address lines has occurred and it halts. Only an external reset will start a (2) Data lines halted processor. ClK AI-Au AS \ 1 \1.-_ _ _--11 ~-----------------~\ I~---- lDS/UOS \ 1 RIW OTACK \ 1 0.-0 .. ( ) FC. -FC. ::x X HALT \ 1 I-- - --Read- - - +- - - - -Halt'- - - -+-- - -Read- - - . , Figure 29 Halt Signal Timing Characteristics 122 ----------------------------------------------------------------HD68000,HD68000Y +5V RUN/SINGLE STEP HALT (To Processor). * OPEN COLLECTOR DEVICE SINGLE STEP a STEP K ~I----"" AS" (From Processor) RESET Figure 30 Simplified Single-Step Circuit • THE RELATIONSHIP OF DTACK, BERR, AND HALT may precede HALT which allows fully asynchronous assertion)" In order to properly control termination of a bus cycle for a Table 4 details the resulting bus cycle termination under re-run or a bus error condition, DTACK, BERR, and HALT various combinations of control signal sequences. The nega- should be asserted and negated on the rising edge of the tion of these same control signals under several conditions is H068000 clock. This will assure that when two signals are shown in Table 5 (DTACK is assumed to be negated normal- asserted simultaneously, the required setup time (#47) for ly in all cases; for best results, both DTACK and BERR should both of them will be met during the same bus state. be negated when address strobe is negated.) This, or some equivalent precaution, should be designed Example A: A system uses a watch-dog timer to terminate external to the HD68000. Parameter #48 is intended to ensure ~ to un-populated address space. The timer asserts this operation in a totally asynchronous system, and may be DTACK and BERR simultaneously after timeo{)ut. (case 4) ignored if the above conditions are met. Example B: A system uses error detection on RAM con- The preferred bus cycle terminations may be summarized tents. Designer may (a) delay DTACK until data verified, and as follows (case numbers refer to Table 4): return BERR and HALT simultaneously to re-run error cycle Normal Termination: DTACK occurs first (case 1). (case 6), or if valid, return DTACK; (b) delay DTACK until Halt Termination: HALT is asserted at same time, or data verified. and return BERR at same time as DTACK if precedes DTACK (no BERR) cases 2 and 3. data in error(case 4); (c) return D'fACK prior to data verifica- Bus Error Termination: BERR is asserted in lieu of, at same tion, as described in previous section. If data invalid, BERR is time, or preceding DTACK (case 4); BERR negated at same asserted (case 1) in next cycle. Error.nandling software must time,orafterDTACK. know how to recover error cycle. Re-Run Termination: HALT and BERR asserted at the same time, or before DTACK (cases 6 and 7); HALT must be * For the mask version 68000, HALT and BERR must be asserted at negated at least I cycle after BERR. (Case 5 indicates BERR tile same time. 123 HD68000,HD68000Y----------------------------------------------------------------- Table 4 DTACK, BERR, HALT Assertion Results Asserted on Risi ng Case No. Control Signal Edge of State Result N N+2 DTACK A S 1 BERR NA X Normal cycle terminate and continue. HALT NA X DTACK A S 2 BERR NA X Normal cycle terminate and halt. Continue when HALT removed. HALT A S DTACK NA A 3 BERR NA NA Normal cycle terminate and halt. Continue when HALT removed. HALT A S DTACK X X 4 BERR A S Terminate and take bus error trap. HALT NA NA DTACK NA X 5 BERR A S Terminate and re-run*. HALT NA A DTACK X X 6 BERR A S Terminate and re-run. HALT A S DTACK NA X 7 BEAR NA A Terminate and re-run when HALT removed. HALT A S Legend: • For the mask version 68000, unpredictable results, no re-run, no error N - The number of the current even bus state (e.g., 54, 56, etc.) trap; usuallv traps to vector number O. A - Signal is asserted in this bus state N A - Signal is not asserted in this state X - Don't care S - Signal was asserted in previous state and remains asserted in this state Table 5 BERR and HALT Negation Results Conditions of Negated on Rising Termination in Control Signal Edge of State Results - Next Cycle Table A N N+2 Bus Error BERR • or •• Takes bus error trap. HALT • or Re-run BERR HALT •• or • Illegal sequence; usually traps to vector number O. Re-run BERR • Re,runs the bus cycle. RA[j • Normal B'Elm' • • May lengthen next cycle. HALT • or Normal BERR HALT • or • none If next cycle is started it will be terminated as a bus error. • RESET OPERATION registers are affected by the reset sequence. The reset signal is a bidirectional signal that allows either the When a RESET sequence is executed, the processor drives processor or an external signal to reset the system. Figure 31 the reset pin for 124 clock pulses. In this case, the processor is a timing diagram for reset operations. Both the halt and reset is trying to reset the rest of the system. Therefore, there is lines must be applied to ensure total reset of the processor. no effect on the internal state of the processor. All of the When the reset and halt lines are driven by an external processor's internal registers and the status register are un- device, it is recognized as an entire, system reset, including affected by the execution of a RESET instruction. All external the processor. The processor responds by reading the reset devices connected to the reset line should be reset at the com- vector table entry (vector unumber zero, address $000000) pletion of the RESET instruction. and loads it into the supervisor stack pointer (SSP). Vector Asserting the Reset and Halt pins for 10 clock cycles will table entry number one at address $000004 is read next and cause a processor reset, except when Vee is initially applied loaded into the program counter. The processor initializes to the processor. In this case, an external reset must be applied the status register to an interrupt level of seven. No other for 100 milliseconds. 124 ------------------------------·-----------------------------------HD68000,HD68000Y CLK Plus 5' Volts Vee t > 100 Millis.conds--!,...._ _ _ _ _ _ _ _ _ _ _ _ __ RES1~-------------------II~------------------ HALT ______________________ ,~ ~ 1----1 t <4 Bus Cycl.s (21 (61 (NOTESI 11 Internal start-up tim. 41 PC High r.ad in here Bus State Unknown: ~ 21 SSP High read in here 51 PC Low read in here 31 SSP Low read in here 61 First instruction fetched here. All Control Signals Inactive. Data Bus In Read Mode: >--< Figure 31 Reset Operation Timing Diagram • PROCESSING STATES • PRIVILEGE STATES This section describes the HD68000 which are outside the' The processor operates in one of two states of privilege: normal processing associated with the execution of instructions. the "user" state or the "supervisor" state. The privilege state The functions of the bits in the supervisor portion of the status determines which operations are legal, is used by the external register are covered: the supervisor/user bit, the trace enable bit, memory management device to control and translate accesses, and the processor interrupt priority mask. Finally, the sequence and is used to choose between the supervisor stack pointer of memory references and actions taken by the processor on and the user stack pointer in instruction references. exception conditions is detailed. The privileges state is a mechanism for providing security The HD68oo0 is always in one of three processing states: in a computer system. Programs should access only their own normal, exception, or halted. The normal processing state is code and data areas, and ought to be restricted from accessing that associated with instruction execution; the memory ref- information which they do not need and must not modify. erences are to fetch instructions and operands, and to store The privilege mechanism provides security by allowing results. A special case of the normal state is the stopped state most programs to execute in user state. In this state, the ac- which the processor enters when a STOP instruction is exe- cesses are controlled, and the effects on other parts of the cuted. In this state, no further memory references are made. system are limited. The operating system executes in the super- The exception processing state is associated with interrupts, visor state, has access to all resources, and performs the over- trap instructions, tracing and other exceptional conditions. head tasks for the user state programs. The exception may be internally generated by an instruction or by an unusual condition arising during the execution of SUPERVISOR STATE an instruction. Externally, exception processing can be forced The supervisor state is the higher state of privilege. For by an interrupt, by a bus error, or by a reset. Exception process- instruction execution, the supervisor state is determined by ing is designed to provide an efficient context switch so that the S-bit of the status register; if the S-bit is asserted (high), the processor may handle unusual conditions. the processor is in the supervisor state. All instructions can be The halted processing state is an indication of catastrophic executed in the supervisor state. The bus cycles generated by hardware failure. For example, if during the exception pro- instructions executed in the supervisor state are classified as cessing of a bus error another bus error occurs, the processor supervisor references. While the processor is in the supervisor assumes that the system is unusable and halts. Only an external privilege state, those instructions which use either the system reset can restart a halted processor. Note that a processor in the stack pointer implicitly or address register seven explicitly stopped state is not in the halted state, nor vice versa. access the supervisor stack pointer. All exception processing is done in the supervisor state, regardless of the setting of the S-bit. The bus cycles generated during exception processing are classified as supervisor refer- PROCESSING STATES ences. All stacking operations during exception processing use the supervisor stack pointer. INSTRUCTION NORMAL EXECUTION (INCLUDING STOP) USER STATE The user state is the lower state of privilege. For instruction INTERRUPTS execution, the user state is determined by the S-bit of the status EXCEPTION TRAPS register; if the S-bit is negated (low), the processor is executing TRACING ETC. instructions in the user state. HARDWARE HALT Most instructions execute the same in user state as in the HALTED DOUBLE BUS FAULT supervisor state. However, some instructions which have im- portant system effects are made privileged. User programs are not permitted to execute the STOP instruction, or the 125 HD68000,HD68000Y----------------------------------------------------------------- RESET instruction. To ensure that a user program cannot • EXCEPTION PROCESSING enter the supervisor state except in a controlled manner, the Before discussing the details of interrupts, traps, and tracing, instructions which modify the whole status register are privi- a general description of exception processing is in order. The leged. To aid in debugging programs which are to be used as processing of an exception occurs in four steps, with variations operating systems, the move to user stack pointer (MOVE for different exception causes. During the flIst step, a tem- USP) and move from user stack pointer (MOVE from USP) porary copy of the status register is made, and the status register instructions are also privileged. is set for exception processing. In the second step the exception The bus cycles generated by an instruction executed in vector is determined, and the third step is the saving of the user state are classifred as user state references. This allows current processor context. In the fourth step a new context is an external memory management device to translate the ad- obtained, and the processor switches to instruction processing. dress and to control access to protected portions of the address space. While the processor is in the user privilege state, those EXCEPTION VECTORS instructions which use either the system stack pointer im- Exception vectors are memory locations from which the plicitly, or address register seven explicitly, access the use stack processor fetches the address of a routine which will handle pointer. that exception. All exception vectors are two words in length (Figure 32), except for the reset vector, which is four words. PRIVILEGE STATE CHANGES All exception vectors lie in the supervisor data space, except Once the processor is in the user state and executing instruc- for the reset vector which is in the supervisor program space. tions, only exception processing can change the privilege state. A vector number is an eight-bit number which, when multiplied During exception processing, the current setting of the S-bit by four, gives the address of an exception vector. Vector num- of the status register is saved and the S-bit is asserted, putting bers are generated internally or externally depending on the the processing in the supervisor state. Therefore, when instruc- cause of the exception. In the· case of interrupts, during the tion execution resumes at the address specified to process the interrupt acknowledge bus cycle, a peripheral provides an 8-bit exception, the processor is in the supervisor privilege state. vector number (Figure 33) to the processor on data bus lines Do through D7 • The processor translates the vector number into a full 24-bit address, as shown in Figure 34. The memory USER/SUPERVISOR MODES layout for exception vectors is given in Table 7. As shown in Table 7, the memory layout is 512 words TRANSITION ONLY MAY OCCUR DURING EXCEPTION PROCESSING long (1024 bytes). It starts at address 0 and proceeds through address 1023. This provides 255 unique vectors; some of these are reserved for TRAPS and other system functions. Of the 255, there are 192 reserved for user interrupt vectors. However, there is no protection on the flISt 64 entries, so user interrupt vectors may overlap at the discretion of the systems designer. KINDS OF EXCEPTIONS Exceptions can be generated by either internal or external TRANSITION MAYBE MADE BY: causes. The externally generated exceptions are the interrupts RTE; MOVE, ANDI, EORI TO STATUS WORD and the bus error and reset requests. The interrupts are requests from peripheral devices for processor action while the bus error and reset inputs are used for access control and processor REFERENCE CLASSIFICATION restart. The internally generated exceptions come from instruc- When the processor makes a reference, it classifies the kind tions, or from address error or tracing. The trap (TRAP), trap of reference being made, using the encoding on the three func- on overflow (TRAPV), check register against bounds (CHK) tion code output lines. This allows external translation of ad- and divide (DIY) instructions all can generate exceptions as dresses, control of access, and differentiation of special pro- part of their instruction execution. In addition, illegal instruc- cessor states, such as interrupt acknowledge. Table 6 lists the tions, word fetches from odd addresses and privilege violations classification of references. cause exceptions. Tracing behaves like a very high priority, internally generated interrupt after each instruction execution. Table 6 Reference Classification EXCEPTION PROCESSING SEQUENCE Function Code Output Exception processing occurs in four identiftable steps. In Reference Class FC z FC 1 FC o the flIst step, an internal copy is made of the status register. 0 0 0 (Unassigned) After the copy is made, the S-bit is asserted, putting the pro- cessor into the supervisor privilege state. Also, the T-bit is 0 0 1 User Data negated which will allow the exception handler to execute 0 1 0 User Program unhindered by tracing. For the reset and interrupt exceptions, 0 1 1 (Unassigned) the interrupt priority mask is also updated. In the second step, the vector number of the exception is 1 0 0 (Unassigned) determined. For interrupts, the vector number is obtained by 1 0 1 Supervisor Data a processor fetch, classified as an interrupt acknowledge. For 1 1 0 Supervisor Program all other exceptions, internal logic provides the vector number. 1 1 1 Interrupt Acknowledge This vector number is then used to generate the address of the exception vector. 126 -----------------------------------------------------------------HD68000,HD68000Y Word 0 New Program Counter (High) AO=O,Al=O Word 1 New Program Counter (Low) AO=O,Al=1 Figure 32 Exception Vector Format 015 0807 DO Ignored Where: v7 is the MSB of the Vector Number vO is the LSB of the Vector Number Figure 33 Peripheral Vector Number Format A23 Al0 A9 A8 A7 A6 A5 A4 A3 A2 Al AO All Zeroes Figure 34 Address Translated From 8-Bit Vector Number Table 7 Exception Vector Assignment Vector Address Assignment Number(s) Dec Hex Space 0 0 000 SP Reset: Initial SSP - 4 004 SP Reset: Initial PC 2 8 008 SO Bus Error 3 12 OOC SO Address Error 4 16 010 SO Illegal Instruction 5 20 014 SO Zero Divide 6 24 018 SO CH K Instruction 7 28 01C SO TRAPV Instruction 8 32 020 SO Privilege Violation 9 36 024 SO Trace 10 40 028 SO Line 1010 Emulator 11 44 02C SO Line 1111 Emulator 12" 48 030 SO (UnaSSigned, reserved) 13" 52 034 SO (UnaSSigned, reserved) 14" 56 038 SO (Unassigned, reserved) 15 60 03C SO Uninitialized Interrupt Vector 64 04C 16 - 23" SO (Unassigned, reserved) 95 05F 24 96 060 SO Spurious Interrupt 25 100 064 SO Level 1 Interrupt Autovector 26 104 068 SO Level 2 Interrupt Autovector 27 108 06C SO Level 3 Interrupt Autovector 28 112 070 SO Level 4 Interrupt Autovector 29 116 074 SO Level 5 Interrupt Autovector 30 120 078 SO Level 6 Interrupt Autovector 31 124 07C SO Level 7 Interrupt Autovector 128 080 32-47 SO TRAP Instruction Vectors 191 OBF 192 oeo (Unassigned, reserved) 48-63" SO 255 OFF 256 100 64-255 SO User Interrupt Vectors 1023 3FF SP: Supervisor program, SO: Supervisor data • Vector numbers 12, 13, 14, 16 through 23 and 48 through 63 are reserved for future enhancements by Hitachi. No user peripheral devices should be assigned these numbers. 127 HD68000,HD68000Y The third step is to save the current processor status, ex- error. Additional information defining the current context is cept for the reset exception. The current program counter stacked for the bus error and address error exceptions. value and the saved copy of the status register are stacked The last step is the same for all exceptions. The new program using the supervisor stack pointer. The program counter value counter value is fetched from the exception vector. The pro- stacked usually points to the next unexecuted instruction, cessor then resumes instruction execution. Then instruction however for bus error and address error, the value stacked at the address given in the exception vector is fetched, and for the program counter is unpredictable, and may be incre- normal instruction decoding and execution is started. mented from the address of the instruction which caused the Figure 35 Exception Processing Sequence (Not Reset) 128 --- - -----------------------------------------------------------------HD68000.HD68000Y MULTIPLE EXCEPTIONS RECOGNITION TIMES OF EXCEPTIONS. These paragraphs descnbe the processing which occurs HALT. AND BUS ARBITRATION when multiple exceptions arise simultaneously. Exceptions END OF A CLOCK CYCLE can be grouped according to their occurrence and priority. The RESET Group 0 exceptions are reset, bus error, and address error. END OF A BUS CYCLE These exceptions cause the instruction currently being executed ADDRESS ERROR to be aborted, and the exeception processing to commence BUS ERROR within two clock cycles. The Group I exceptions are trace and HALT BUS ARBITRATION interrupt, as well as the privilege violations and illegal instruc- END OF AN INSTRUCTION CYCLE tions. These exceptions allow the current instruction to execute TRACE EXCEPTION to completion, but preempt the execution of the next instruc- INTERRUPT EXCEPTIONS tion by forcing exception processing to occur (privilege viola- ILLEGAL INSTRUCTION UNIMPLEMENTED INSTRUCTION tions and illegal instructions are detected when they are the PRIVILEGE VIOLATION next instruction to be executed). The Group 2 exceptions WITHIN AN INSTRUCTION CYCLE occur as part of the normal processing of instructions. The TRAP. TRAPV TRAP, TRAPV, CIIK, and zero divide exceptions are in this CHK ZERO DIVIDE group. For these exceptions, the normal execution of an instruc- tion may lead to exception processing. Group 0 exceptions have highest priority, while Group 2 exceptions have lowest priority. Within Group 0, reset has • EXCEPTION PROCESSING DETAILED DISCUSSION highest priority, followed by address error and then bus error. Exceptions have a number of sources, and each exception Within .Group I, trace has priority over external interrupts, has processing which is peculiar to it. The following paragraphs which in tum takes priority over illegal instruction and privi- detail the sources of exceptions, how each arises, and how each lege violation. Since only one instruction can be executed at is processed. a time, there is no priority relation within Group 2. The priority relation between two exceptions determines RESET which is taken, or taken fust, if the conditions for both arise The reset input provides the highest exception level. The simultaneously. Therefore, if a bus error occurs during a TRAP processing of the reset signal is designed for system initiation, instruction, the bus error takes precedence, and the TRAP and recovery from catastrophic failure. Any processing in pro- instruction processing is aborted. In another example, if an gress at the time of the reset is aborted and cannot be recovered. interrupt request occurs during the execution of an instruction The processor is forced into the supervisor state, and the trace while the T-bit is asserted, the trace exception has priority, state is forced off. The processor interrupt priority mask is set and is processed fust. Before instruction processing resumes, at level seven. The vector number is intema11y generated to however, the interrupt exception is also processed, and instruc- reference the reset exception vector at location 0 in the super- tion processing commences fmally in the interrupt handler visor program space. Because no assumptions can be made about routine. A summary of exception grouping and priority is given the validity of register contents, in particular the supervisor in Table 8. stack pointer, neither the program counter nor the status register is saved. The address contained in the rust two words of the reset exception vector is fetched as the initial supervisor Table 8 Exception Grouping and Priority stack pointer, and the address in the last two words of the reset exception vector is fetched as the initial program counter. Group Exception Processing Finally, instruction execution is started at the address in the Reset program counter. The power-up/restart code should be pointed Exception processing begins 0 Address Error within two clock cycles. to by the initial program counter. Bus Error The RESET instruction does not cause loading of the reset Trace vector, but does assert the reset line to reset external devices. Interrupt Exception processing begins This allows the software to reset the system to a known state 1 Illegal before the next instruction and then continue processing with the next instruction. Privilege TRAP. TRAPV Exception processing is started by 2 CHK. normal instruction execution Zero Divide 129 ---- HD68000.HD68000Y------------------------------------~--------------------------- Yes >------- to Address Error or Bus Error Exception Processing Figure 36 Reset Exception Processing INTERRUPTS but are made pending. Pending interrupts are detected between Seven levels of interrupt priorities are provided. Devices instruction executions. If the priority of the pending interrupt may be chained externally within interrupt priority levels, is lower than or equal to the current processor priority, exe- allowing an unlimited number of peripheral devices to inter- cution continues with the next instruction and the interrupt rupt the processor. Interrupt priority levels are numbered exception processing is postponed. (The recognition of level from one to seven, level seven being the highest priority. The seven is slightly different, as explained in a following paragraph.) status register contains a three-bit mask: which indicates the If the priority of the pending interrupt is greater than the current processor priority, and interrupts are inhibited for current processor priority, the exception processing sequence all priority levels less than or equal to the current processor is started. First a copy of the status register is saved, and the priority. privilege state is set to supervisor, tracing is suppressed, and An interrupt request is made to the processor by encoding the processor priority level is set to the level of the interrupt the interrupt request level on the interrupt request lines; a being acknowledged. The processor fetches the vector number zero indicates no interrupt request. Interrupt requests arriving from the interrupting device, classifying the reference as an at the processor do not force immediate exception processing, interrupt acknowledge and displaying the level number of 130 -----------------------------------------------------------------HD68000,HD68000Y the interrupt being'acknowledged on the address bus. If external PROCESSOR INTERRUPTING DEVICE logic requests an automatic vectoring, the processor internally Request Interrupt generates a vector number which is determined by the interrupt level number. If external logic indicates a bus error, the inter- rupt is taken to be spurious, and the generated vector number references the spurious interrupt vector. The processor then Grant Interrupt proceeds with the usual exception processing, saving the pro- 1) Compare interrupt level in status register gram counter and status register on the supervisor stack. The and wait for current instruction to complete saved value of the program counter is the address of the instruc- 2) Place interrupt level on A, , A" A. tion which would have been executed had the interrupt not 3) Set R/W to read 4) Set function code to interrupt acknowledge been present. The content of the interrupt vector whose vector 5) Assert address strobe (AS) number was previously obtained is fetched and loaded into the 6) Assert lower data strobe (LOS) program counter, and normal instruction execution commences I in the interrupt handling routine. A flow chart for the interrupt acknowledge sequence is given in Figure 37, a timing diagram is given in Figure 38, and the interrupt exception timing se· 1 Provide Vector Number quence is shown in Figure 39. 1) Place vector number of Do - 0, 2) Assert data transfer acknowledge (OTACK) I Table 9 Internal Interrupt Level Level 12 11 10 Interrupt Acquire Vector Number 7 1 1 1) latch vector number 1 Non·Maskable Interrupt 2) Negate lOS 6 1 1 0 3) Negate AS' 5 1 0 1 4 1 0 0 Maskable Interrupt 3 0 1 1 !!!!!!!! 2 0 1 0 1) Negat.~ 1 0 0 1 0 0 0 0 No I nterru pt r Start Interrupt ProceSSing (NOTE) The internal interrupt mask level U2,.!,1.IO) are inverted to the logic level applied to the pins (TPL., II'L, , J15'(0). Figure 37 Interrupt Acknowledge Sequence FlowChart ClK ~ I '\j \ ~ \ r \ I \ ~ '---.r \ ~,..,. \ ~ ~ '---.r 'I / \ ~ \ ~ \ }----/\ < ~ "" ~§ < ~ \ < 7 last Bus Cycle of Instruction lACK Cycle Stack and, (Read or Write) (Vector Number Acquisition Vector Fetch Figure 38 Interrupt Acknowledge Sequence Timing Diagram 131 HD68000,HD68000Y----------------------------------------------------------------- last Bus Cycle of Instruction (During Which I nterrupt Was Recognized) f--- Stack PCl (SSPI - lACK Cycle (Vector Number Acquisition) f--- Stack Status (SSP) f--- Stack PCH (SSP) -+ ~ Read Vector High (A .. -A.. I - Read Vector low (A. - AI5I - Fetch First Word of Instruction of Interrupt Routine Figure 39 Interrupt Exception Timing Sequence Priority level seven is a special case. Level seven interrupts Word patterns with bits 15 through 12 equaling 1010 or cannot be inhibited by the interrupt priority mask, thus pro- 1111 are distinguished as unimplemented instructions and viding a "non-maskable interrupt" capability. An interrupt is separate exception vectors are given to these patterns to per- generated each time the interrupt request level changes from mit efficient emulation. This facility allows the operating some lower level to level seven. Note that a level seven interrupt system to detect program errors, or to emlllate unimplemented may still be caused by the level comparison if the request level instructions in software. is a seven and the processor priority is set to a lower level by an instruction. ILLEGAL INSTRUCTION EXAMPLE UNINITIALIZED INTERRUPT MOVE DO, #$1000 An interrupting device asserts VPA or provides an interrupt vector during an interrupt acknowledge cycle to the HD68000. + MOVE OPWORD If the vector register has not been initialized, the responding HMCS68000 Family peripheral will provide vector IS, the 0011 100111 + 000 000 unitialized interrupt vector. This provides a uniform way to recover from a programming error. tMOVE t IMMEDIATE t DATA t REGISTER WORD REGISTER NUMBER SPURIOUS INTERRUPT DIRECT "0" If during the interrupt acknowledge cycle no device responds by asserting DTACK or VPA, the bus error line should be assert- ed to terminate the vector acquisition. The processor separates PRIVILEGE VIOLATIONS ,the processing of this error from bus error by fetching the In' order to provide system security, various instructions spurious interrupt vector instead of the bus error vector. The are privileged. An attempt to execute one of the privileged processor then proceeds with the usual exception processing. instructions while in the user state will cause an exception. The privileged instruction are: INSTRUCTION TRAPS STOP AND (word) Immediate to SR Traps are exceptions caused by instructions. They arise RESET EOR (word) Immediate to SR either from processor recognition of abnormal conditions RTE OR (word) Immediate to SR during instruction execution, or from use of instructions whose MOVE to SR MOVE USP normal behavior is trapping. Some instructions are used specifically to generate traps. TRACING The TRAP instruction always forces an exception, and is useful To aid in program development,. the HD68000 includes for implementing system calls for user programs. The TRAPV a facility to allow instruction by instruction tracing. In the and CHK instructions force an exception if the user program trace state, after each instruction is executed an exceptions detects a runtime error, which may be an arithmetic overflow is forced, allowing a debugging program to monitor the exe- or a subscript out of bounds. cution of the program under test. The signed divide (DIVS) and unsigned divide (DNU) in- The trace facility uses the T-bit in the supervisor portion structions will force an exception if a division operation is of the status register. If the T-bit is negated (off), tracing is attempted with a divisor of zero. disabled, and instruction execution proceeds from instruction to instruction as normal. If the T-bit is asserted (on) at the ILLEGAL AND UNIMPLEMENTED INSTRUCTIONS beginning of the execution of an instruction, a trace exception Illegal instruction is the term used to refer to any of the will be generated after the execution of that instruction is word bit patterns which are not the bit pattern of the first completed. If the instruction is not executed. either because word of a legal instruction. During instruction execution, if an interrupt is taken, or the instruction is illegal or privileged, such an instruction is fetched, an illegal instruction exception the trace exception does not occur. The trace exception also occurs. does not occur if the instruction is aborted by a reset, bus 132 -----------------------------------------------------------------HD68000,HD68000Y error, or address error exception. If the instruction is·indeed ex- the bus error occurred. The processor is processing an instruc- ecuted and an interrupt is pending on completion, the trace tion if it is in the normal state or processing a Group 2 excep- exception is processed before the interrupt exception. If, during tion; the processor is not processing an instruction if it is pro- the execution of the instruction, an exception is forced by that cessing a Group 0 or a Group.l exception. Figure 40 illustrates instruction, the forced exception is processed before the trace how this information is organized on the supervisor stack. exception. Although this information is not sufficient in general to effect As an extreme illustration of the above rules, consider the full recovery from the bus error, it does allow software diag- arrival of an interrupt during the execution of a TRAP instruc- nosis. Finally, the processor commences instruction processing tion while tracing is enabled. First the trap exception is pro- at the address contained in the vector. It is the responsibility cessed, then the trace exception, and fInally the interrupt ex· of the error handler routine to clean up the stack and determine ception. Instruction execution resumes in the interrupt handler where to continue execution. routine. If a bus error occurs during the exception processing for a bus error, address error, or reset, the processor is halted, and TRACE MODE all processing cases. This simplifIes the detection of catastrophic IFT= 1 system failure, since the processor removes itself from the STATUS REGISTER system rather than destroy all memory contents. Only the RESET pin can restart a halted processor. ADDRESS ERROR AFTER EACH MAIN Address error exceptions occur when the processor attempts INSTRUCTION PROGRAM to access a word or a long word operand or an instruction at RETURN TO an odd address. The effect is much like an internally generated EXECUTE bus error, so that the bus cycle is aborted, and the processor NEXT INSTRUCTION ceases whatever processing it is currently doing and begins exception processing. After exception processing commences, ADDRESS OBTAINED the sequence is the same as that for bus error including the FROM VECTOR TABLE information that is stacked, except that the vector number refers to the address error vector instead. Likewise, if an address 1. If, upon completion of an instruction, T = 1, error occurs during the exception processing for a bus error, go to trace exception processing. address error, or reset, the processor is halted. As shown in 2. Execute trace exception sequence. Figure 42, an address error will execute a short bus cycle follow· 3. Execute trace service routine. 4. At the end of the service routine, execute ed by exception processing. return from exception (RTE). • INTERFACE WITH HMCS6800 PERIPHERALS Hitachi's extensive line of HMCS6800 peripherals are di- BUS ERROR rectly compatible with the HD68000. Some of these devices Bus error exceptions occur when the external logic requests that are particularly useful are: that a bus error be processed by an exception. The current bus HD6821 Peripheral Interface Adapter cycle which the processor is making is then aborted. Whether HD6843 Floppy Disk Controller the processor was doing instruction or exception processing, HD684SS CRT Controller that processing is terminated, and the processor immediately HD46508 Data Acquisition Unit begins exception processing. HD6850 Asynchronous Communication Interface Exception processing for bus error follows the usual se- Adapter quence of steps. The status register is copied, the supervisor HD6852 Synchronous Serial Data Adapter state is entered, and the trace state is turned off. The vector To interface the synchronous HMCS6800 peripherals with number is generated to refer to the bus error vector. Since the the asynchronous HD68000, the processor modifieS its bus processor was not between instructions when the bus error cycle to meet the HMCS6800 cycle requirements whenever an exception request was made, the context of the processor is HMCS6800 device address is detected. This is possible since more detailed. To save more of this context, additional infor- both processors use memory mapped JjO. Figure 44 is a flow mation is saved on the supervisor stack. The program counter chart of the interface operation between the processor and and the copy of the status register are of course saved. The value HMCS6800 devices. saved for the program counter is advanced by some amount, two to ten bytes beyond the address of the f11"St word of the • DATA TRANSFER OPERATION instruction which made the reference causing the bus error. If Three signal on the processor provide the HMCS6800 inter- the bus error occurred during the fetch of the next instruction, face. They are: enable (E), valid memory address (VMA), and the saved program counter has a value in the vicinity of the valid peripheral address (vpA). Enable corresponds to the current instruction, even if the current instruction is a branch, E or tP2 signal in existing HMCS6800 systems. The bus fre- a jump, or a return instruction. Besides the usual information, quency is one tenth of the incoming HD68000 clock frequency. the processor saves its internal copy of the fust word of the The timing of E allows 1 MHz peripherals to be used with instruction being processed, and the address which was being an 8 MHz HD68000. Enable has a 60/40 duty cycle; that accessed by the aborted bus, cycle. Specific information about is, it is low for six input clocks and high for four input clocks. the access is also saved: whether it was a read or a write, wheth- This duty cycle allows the processor to do successive VPA ac- er the processor was processing an instruction or not, and the cesses on successive E pulses. classification displayed on the function code outputs when HMCS6800 cycle timing is given in Figure 45 and 46. At 133 HD68000,HD68000Y-------------------------------------------------------------- 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Lower Address IRtWl I/N I Function Code High ~-·AccessAddre.. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \- - - - · low Instruction Register Status Register High - - -Program Counter----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - low R/W (reed/write): write ~ 0, read = 1. I/N (Instruction/not!: instruction = 0, not a 1 Figure 40 Supervisor Stack Order (Group 0) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o lower AddreSS Status Register r---- High Higher Address Program Counter ---- ------------------------------ ::v: ------- Figure 41 Supervisor Stack Order (Group 1, 2) ClK A,-A u AS \ / \ I \ UDS iJ5! " \ \ / I , \ \ / I , '\4 , \ \ RtW ~ DTACK \ I " '--- D. - 0 .. < ) ( }----I\ ( I I- Read -I- Aerr Write Figure 42 Address Error Timing II .. Approx. 8 Clocks Idle + Write Stack .. state zero (SO) in the cycle, the address bus is in the high- During state 2, the address strobe (AS) is asserted to in- impedance state. A function code is asserted on the function dicate that there is a valid address on the address bus. If the code output lines. One-half clock later, in state 1 the address bus cycle is a read cycle, the upper and/or lower data strobes bus is released from the high-impedance state. are also asserted in state 2. If the bus cycle is a write cycle, 134 -----------------------------------------------------------------HD68000,HD68000Y D. - 0, (or 0, - DIS) ~=============~D. -0, Address Address & Bus CS's AS CS HD68000 Block of VPA HMCS6800 Devices VMA CS E E Figure 43 Connection of HMCS6800 Peripherals the read/write (R/W) signal is switched to low (write) during PROCESSOR SLAVE state 2. One half clock later, in state 3, the write data is placed Initiate Cycle on the data bus, and in state 4 the data strobes are issued to 1) The processor starts a normal Read or indicate valid data on the data bus. The processor now inserts Write cycle wait states until it recognizes the assertion of VPA. The VPA input signals the processor that the address on the bus is the address of an HMCS6800 device (or an area reserved Define HMCS6800 Cycle for HMCS6800 devices) and that the bus should conform to 1) External hardware asserts Valid Peripheral the tP2 transfer characteristics of the HMCS6800 bus. -Valid Address (i7PA) peripheral address is derived by decoding the address bus, conditioned by address strobe. After the recognition of VPA, the processor assures that the Enable (E) is low, by waiting if necessary, and subsequently asserts VMA. Valid memory address is then used as part of the ! Synchronize With Enable chip select equation of the peripheral. This ensures that the 1) The processor monitors Enable (E) until it is low (Phase 1) HMCS6800 peripherals are selected and deselected at the 2l The processor asserts Valid Memory Address correct time. The peripheral now runs its cycle during the (VMA) high portion of the E signal. Figures 4S and 46 depict the best and worst case HMCS6800 cycle timing. This cycle length is dependent strictly upon when VPA is asserted in relationship to the E clock. During a read cycle, the processor latches the peripheral Transfer Data data in state 6. For all cycles, the processor negates the address 1) The peripheral waits until E is active and then transfers the data and data strobes one half clock cycle later in state 7, and the Enable signal goes low at this time. Another half clock later, the address bus is put in the high-impedance state. During a write cycle, the data bus is put in the high-impedance state and the read/write signal is switched high. The peripheral logic Terminate Cycle must remove VPA within one clock after address strobe is 1) The processor waits until E goes low. (On a negated. Read cycle the data is latchad as E goes Figure 47 shows the timing required by HMCS6800 pe- low internally) ripherals, the timing specified for HDCS6800, and the corre- 2l The processor negates VMA sponding timing for the HD68000. Two example systems with 3) The processor negates AS, UDS, and LOS HMCS6800 peripherals are showin in Figures 48 and 49. The system in Figure 48 reserves the upper eight megabytes of memory for HMCS6800 peripherals. The system in Figure 49 is more efficient with memory and easily expandable, but more 1 Start Next Cycle complex. DTACK should not be asserted while VPA is asserted. Notice that the HD68000 VMA is active low, contrasted with Figure 44 HMCS6800 Interface Flow Chart the active high HMCS6800 VMA. This allows the processor to put its buses in the high-impedance state on DMA requests without inadvertently selecting peripherals. 135 HD68000,HD68000Y----------------------------------------------------------------- 50 51 52 53 S4 w w w w w w w w w w w w 55 56 57 50 ClK AI - An A5 51 E VPA VMA Data Out Data In - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FC.-F~ ____ _J~ __________________________________________________________________ _Jr_----- (NOTE) This figure represents the best case HMC56800 timing where VPA falls before the third system clock cycle after the falling edge of E. Figure 45 HMCS6800 Timing - Best Case W~~~S4wwwwwwwwwwwwwwwwwwwwwwwwwwww~~~W ClK .rv-: ~JL.Cf~~FIJ'LJ A.-An J-{ ~ \ @ "1' ---< r-® J - ~ E ® -@ ~ ~ VPA \ -@--- VMA -- -@J - - ~@ :I-® RtW (Read) ® Data In UDS/lDS Read \ --- f-@ @- R/WWrite Data Out ~/~ @.... \ - --< r--@ Write \ FC. - FC. K Figure 46 HMCS6800 Timing - Worst Case 136 -----------------------------------------------------------------HD68000,HD68000Y HMCS6800· ~ 270n. 150 n.~ Type ns 180 B Type A ~S.;;'d;-.___ t= Peripheral'"" 70 n.~ Type B 140 ns 140n. Tvpe A S.d HMCS6800 E Clock Freq. 2.0 MHz Type B 1.5MHz A HMCS6800 VMA, RIW I 1.0 MHz S.d HMCS6BOOAddress ~ ==~~~----~==~------ --l 1--1~0~n..s":H':':M~C~S::68=OO:::'·:---------------- Peripheral il ~ 10 ns Peripheral· Type B ~ 180 n s = = = s ~ ~ ......j Type A 220 ns ~ r-- 10 ns HMCS6800· 10 ns Peripheral HMCS6800 Read 00'0 =m ----------------'W&#dIff/l#$ ~ I ))------ Type B ~pe,,~e~:3" I Type A 80 ns Std 195 ns HMCS6800WriteData _ _ _ _ _ _ _ _ _ _ _ _ _ _--<~ )~----- HD68000 Address ~'"""fj'"'_________________________.J) HD68000 (8 MHz! l--200n.~ VMA----------------------~~~~ Write Data ~---~~=====-------------~ HD68000CLK .. Times are expressed for different device clock frequencies. Figure 47 HD6BOOO to HMCS6BOO Peripheral Timing Diagram 33k +5V AS I ~I VMA I I Do -ou AI-Au ~ J ?> C C I I I::i .; ~ I'; .. .. .. ,. CS; eS I es o RS. AS o 0 ~ .i ci Ii CS1 CS 1 AS eso 0 HD6BOOO HD6821 PIA H06850 ACtA ~a: li'l I'~" E RIW VPA Fe, L.- tiV 3.3k It iR1l E AtW Fe, Fe, IPL IJiL, }e IT J 11't", RES E RIW Figure 48 HMCS6800 Interface - Example 1 137 ::t C 0) +5 3.3k § % ~~ J 6800 Addr_ c0) (XI ~ Al VQA Do-DIS AI-An 2 . .c ~ .c y• L .c L .c 74LS y. A 138 ~' ~ I~ .-.& ~ 8 y. ---- ~ ~ " VPA cf )' 1>- 133 ~ C y, y, y, ~ ! « ~ ~ c .c -.l'" 0 J ... 7' ~ 8CD :I'" '" > ~ 0 J l 33~f ~ cs. CS. CSo RS. RSo cs. CS•. CSO RS ~ HD68000 +5 HD6821 PIA HD6850ACIA ~ A 74LS y, - ..... I~ I~ ~ w I~ I~ 138 Co> (XI ~B A, y. y, ~ w ~C y, G1Gu. Fe. ~ G,. +s FC. 3.3k ~,/.. -rlr:. ,,~ l :. 74LS "I, 348 r4LS h I. r-- IPL. I AoI48 IPL IPL A. 1.1""--- I NMI A, RES 1: RIW___ --- --_._- - Figure 49 HMCS6800 Interface - Example 2 --------------------------------------------------------------HD68000,HD68000Y • INTERRUPT OPERATION there are six normal interrupt vectors and one NMI type vector. During an interrupt acknowledge cycle while the processor As with both the HMCS6800 and the HD68000's normal is fetching the vector, if VPA is asserted, the HD68000 wi1l vectored interrupt, the interrupt service routine can be located assert VMA and complete a normal HMCS6800 read cycle as anywhere in the address space. This is due to the fact that shown in Figure 50. The processor wi1l then use an internally while the vector numbers are fixed, the contents of the vector generated vector that is a function of the interrupt being serv- table entries are assigned by the user. iced. This process is known as autovectoring. The seven auto- Since VMA is asserted during autovectoring, the HMCS6800 vectors are vector numbers 25 through 31 (decimal). peripheral address decoding should prevent unintended ac- This operates in the same fashion (but is not restricted to) cesses. the HMCS6800 interrupt sequence. The basic difference is that ClK A, -A. A. - Au )-J \..- AS \ r--\ ,- UOS \ r--\ ,- lOS \ r--\ ,- R/W \ I DTACK '---1 o. -0" c::::::J D. - 0, ( ) FC. -FC, X y e, Jlf[. - l"P"L; \~ L- ___________________________J,___ VPA VMA ----------------------------------------~\ ,-- Interna! ~PC low Stacking--oI-l••------Autovector Operation _ _ _ _ _ _ _ _ _ Process,ng--r- ~I lnternal Processing •• Figure 50 Autovector Operation Timing Diagram • DATA TYPES AND ADDRESSING MODES basic types: Five basic data types are supported. These data types are: • Register Direct • Bits • Register Indirect • BCD Digits (4-bits) • Absolute • Bytes (8-bits) • Immediate • Word (16-bits) • Program Counter Relative • long Words (32-bits) • Implied In addition, operations on other data types such as memory Included in the register indirect addressing modes is the capa- addresses, status word data, etc., are provided for in the instruc- bility to do postincrementing, pred.,crementing, offsetting and tion set. indexing. Program counter relative mode can also be modified The 14 addressing modes, shown in Table 10, includs six via indexing and offsetting. 139 HD68000,HD68000Y----------------------------------------------------------------- Table 10 Addressing Modes • INSTRUCTION SET OVERVIEW The HD68000 instruction set is shown in Table 11. Some Mode Generation additional instructions are variations, or subsets, of these and Register Direct Addressing they appear in Table 12. Special emphasis has been given to Data Register Diredt EA=Dn the instruction set's support of structured high-level languages Address Register Direct EA=An to facilitate ease of programming. Each instruction, with few Absolute Data Addressing exceptions, operates on bytes, words, and long words and most Absolute Short EA = (Next Word) instructions can use any of the 14 addressing modes. Combining Absolute Long EA = (Next Two Words) instruction types, data types, and addressing modes, over 1000 Program Counter Relative Addressing useful instructions are provided. These instructions include Relative with Offset EA = (PC) + d .. signed and unsigned multiply and divide, "quick" arithmetic Relative with Index and Offset EA = PC) + (Xn) + d. operations, BCD arithmetic and expanded operations (through Register Indirect Addressing traps). Register Indirect EA= (An) The following paragraphs contain an overview of the form Postincrement Register Indirect EA = (AN), An <-An + N and structure of the HD68000 instruction set. The instruc- Predecrement Register Indirect An <-An - N, EA = (An) tions form a set of tools that include all the machine functions Register Indirect with Offset EA = (An) + d,. Indexed Register Indirect with Offset EA = (An) + (Xn) + d. to perform the following operations: Data Movement I mmediata Data Addressing Immediate DATA = Next Word(.) Integer Arithmetic Quick Immediate Inherent Data Logical Implied Addressing Shift and Rotate Implied Register EA = SR, USP, SP, PC Bit Manipulation Binary Coded Decimal (NOTES) Program Control EA = Effective Address d. = Eight-bit Offset An = Address Register (displacement! System Control Dn = Data Register d ,. = Sixteen-bit Offset The complete range of instruction capabilities combined Xn = Address or Data Register used (displacement) with the flexible addressing modes described previously pro- as Index Regi.ter N = 1 for Byte, 2 for vide a very flexible base for program development. SR = Status Register Words and 4 for Long PC = Program Counter Words ( ) = Contents of ..... = Replaces Table 11 Instruction Set Mnemonic Description Mnemonic Description Mnemonic Description ABCD Add Decimal with Extend EOR Exclusive Or PEA Push Effective Address ADD Add EXG Exchange Registers RESET Reset External Devices AND Logical And EXT Sign Extend ROL Rotate Left without Extend ASL Arithmetic Shift Left JMP Jump ROR Rotate Right without Extend ASR Arithmetic Shift Right JSP Jump to Subroutine ROXL Rotate Left with Extend Bee Branch Conditionally LEA Load Effective Address ROXR Rotate Right with Extend BCHG Bit Test and Change LINK Link Stack RTE Return from Exception BCLR Bit Test and Clear LSL Logical Shift Left RTR Return and Restore BRA Branch Always LSR Logical Shift Right RTS Return from Subroutine BSET Bit Test and Set Move SBCD Subtract Decimal with Extend MOVE BSR Branch to Subroutine Move Multiple Registers Set Conditional MOVEM Sec BTST Bit Test Move Peripheral Data STOP Stop MOVEP CHK Check Register Against Bounds MULS Signed Multiply SUB Subtract CLR Clear Operand MULU Unsigned Multiply SWAP Swap Data Register Halves CMP Compare NBCD Negate Decimal with Extend TAS Test and Set Operand DBee Test Condition, Decrement and NEG Negate TRAP Trap Branch NOP No Operation TRAPV Trap on Overflow DIVS Signed Divide NOT One's Complement TST Test DIVU UnSigned Divide Logical Or UNLK Unlink OR 140 --------------------------------------------------------------HD68000.HD68000Y Table 12 Variations of Instruction Types Instruction Instruction Variation Description Variation Description Type Type ADD ADD Add MOVE MOVE Move ADDA Add Address MOVEA Move Address ADOQ Add Quick MOVEQ Move Quick ADDI Add Immediate MOVE fromSR Move from Status Register ADDX Add with Extend MOVE to.5R Move to Status Register AND AND Logical And MOVE to CCR Move to Condition Codes ANDI And Immediate MOVE USP Move User Stack Pointer CMP CMP Compare NEG NEG Negate CMPA Compare Address NEGX Negate with Extend CMPM Compare Memory OR OR Logical Or CMPI Compare Immediate ORI Or Immediate EOR EOR Exclusive Or SUB SUB Subtract EORI Exclusive Or Immediate SUBA Subtract Address SUBI Subtract Immediate SUBQ Subtract Quick SUBX Subtract with Extend • ADDRESSING and negate instructions may be used on all sizes of data oper- Instructions for the HD68000 contain two kinds of infor- ands. mation: the type of function to be performed. and the location The multiply and divide operations are available for signed of the operand(s) on which to perform that function. The and unsigned operands using word multiply to produce a long methods used to locate (address) the operand(s) are explained word product. and a long word dividend with word divisor to in the following paragraphs. produce a word quotien with a word remainder. Instructions specify an operand location in one of three Multiprecision and mixed size arithmetic can be accomplish- ways: ed using a set of extended instructions. These instructions are: Register Specification - the number of the register is given add extended (ADDX). subtract extended (SUBX). sign extend in the register field of the instruction. (EXT). and negate binary with extend (NEGX). Effective Address - use of the different effective address A test operand (TST) instruction that will set the condition modes. codes as a result of a compare of the operand with zero is also Implicit Reference - the defmition of certain instructions available. Test and set (TAS) is a synchronization instruction implies the use of specific registers. useful in multiprocessor systems. Table 14 is a summary of the integer arithmetic operations. • DATA MOVEMENT OPERATIONS The basic method of data acquisition (transfer and storage) is provided by the move (MOVE) instruction. The move instruc- Table 13 Data Movement Operations tion and the effective addressing modes allow both address and data manipulation. Data move instructions allow byte. Instruction Operand Size Operation word. and long word operands to be transferred from memory EXG 32 Rx <+ Ry to memory. memory to register. register to memory. and regis- LEA 32 EA .... An ter to memory. and register to register. Address move instruc· tions allow word and long word operand transfers and ensure (An .... SP@-; that only legal address manipulations are executed. In addition LINK - SP .... An; SP+d .... SP to the general move instruction there are several special data MOVE 8.16.32 (EA)s .... EAd movement instructions: move multiple registers (MOVEM). move peripheral data (MOVEP). exchange registers (EXG). (EA) .... An. On MOVEM 16.32 load effective address (LEA). push effective address (PEA). An. On .... EA link stack (LINK). unlink stack (UNLK). and move quick MOVEP 16.32 (EA) .... on (MOVEQ). Table 13 is a summary of the data movement Dn .... EA operations. MOVEa 8 #Xxx .... On PEA 32 EA .... SP@- • INTEGER ARITHMETIC OPERATIONS The arithmetic operations include the four basic operations SWAP 32 on[31:16) ... on[15:0) of add (ADD). subtract (SUB). multiply (MUL). and divide (DIY) as well as arithmetic compare (CMP). clear (CLR). and UNLK - (An .... SP; SP@+ .... An negate (NEG). The add and subtract instructions are available (NOTES) for both address and data operations. with data operations s = source @ - = indirect with predecren'lent accepting all operand sizes. Address operations are limited d =: destination @+ = indirect with postdecrement to legal address size operands (16 or 32 bits). Data. address. [ I = bit numbers and memory compare operations are also available. The clear 141 H068000,H068000Y------------------------------------------------------------------- Table 14 Integer Arithmetic Operations • INSTRUCTION FORMAT Instructions are from one to five words in length, as shown Instruction Operand Size Operation in Figure 51. The length of the instruction and the operation 8,16,32 On + (EA) ..... On to be performed is specified by the first word of the instruction (EA+ On ..... EA which is called the operation word. The remaining words AOD further specify the operands. These words are either immediate (EA) + #Xxx ..... EA 16,32 AN + (EA) ..... An operands or extensions to the effective address mode specified 8,16,32 Dx+ Dy+ x ..... Ox in the operation word. ADDX 16,32 Ax@-+Ay@-+X ..... Ax@ 8,16,32 0 ..... EA • PROGRAM/DATA REFERENCES CLR The HD68000 separates memory references into two class- 8,16,32 On - (EA) es: program references, and data references. Program refer- (EA) - #Xxx ences, as the name implies, are references to that section of CMP Ax@+-Ay@+ 16,32 An - (EA) memory that contains the program being executed. Data refer- ences refer to that section of memory that contains data. DIVS 32+ 16 Dn/(EA) ..... On Generally, operand reads are froin the data space. All operand OIVU 32+ 16 Dn/(EA) ..... On writes are to the data space. 8 ..... 16 (On)s ..... Onl6 EXT 16 ..... 32 (On) 16 ..... On32 • REGISTER SPECIFICATION MULS 16·16 ..... 32 Dn.(EA)"'" On The register field within an instruction specifies the register to be used. Other fields within the instruction specify whether MULU 16·16 ..... 32 On*(EA) ..... On the register selected is an address or data register and how the NEG 8,16,32 0- (EA) ..... EA register is to be used. NEGX 8,16,32 0- (EA) - X - EA 8,16,32 On - (EA) ..... On • EFFECTIVE ADDRESS (EA) - On ..... EA Most instructions specify the location of an operand by using SUB the effective address field in the operation word. For example, (EA) - #Xxx ..... EA 16,32 An - (EA) ..... An Figure 52 shows the general format of the single effective ad- dress is composed of two 3-bit fields: the mode field, and the Ox - Oy - X ..... Ox SUBX 8,16,32 Ax@--Ay@--X4Ax@ register field. The value in the mode field selects the different address modes. The register field contains the number of a TAS 8 (EA) - 0,1 ..... EA[7] register. TST 8,16,32 (EA) -0 The effective address field may require additional informa- tion to fully specify the operand. This additional information, (NOTE) [ I = bit number called the effective address extension, is contained in the following word or words and is considered part of the instruc- tion, as shown in Figure 51. The effective address modes are grouped into three categories: register direct, memory address- ing, and special. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Operation Word (F irst Word Specifies Operation and Modes) Immediate Operand (If Any, One or Two Words) Source Effective Address Extension (If Any, One or Two Words) Destination Effective Address Extension (If Any, One or Two Words) Figure 51 Instruction Format 5 4 3 2 o Effective Address Mode Register Figure 52 Single-Effective-Address Instruction Operation Word General Format 142 -----------------------------------------------------------------HD68000,HD68000Y REGISTER DIRECT MODES Data Register Direct These effective addressing modes specify that the operand The operand is in the data register specified by the effective is in one of the 16 multifunction registers. address register field. EXAMPLE COMMENTS MPU • EA = On MEMORY $OOlFOO • Machine Level Coding MOVE DO, $1 FOO iOOOOASCDi DO 0011 0001 1100 0000 .I" Move Word IIJ.;-., Absolute Short Data Register OWL 31CO Direct MOVE DO, $1 FOO OWL+2 lFOO Address Register Direct The operand is in the address register specified by the effec- tive address register field. EXAMPLE COMMENTS • EA = An MPU MEMORY 1000012341 A4 • Machine Level Coding MOVE A4, $201000 ITIl00~ Word Absol ute Long Address OWL 33CC Register I---------~ Direct OWL + 2 ~_....;00:..:..::2.:.0_ ___1 MOVE A4,$201000 OWL+4 1000 1------1 143 HD68000,HD68000Y EXAMPLE COMMENTS .EA =An MPU MEMORY • Address Register Sign Extended • Machine Level Coding MOVE $201000,A4 1000012341 A4 0011 IWord Move 1[- 1000 Reg#4 0111 ~ 1001 Absolute Long Address Register Direct OWL 3879 OWL+2 0020 MOVE $201000, A4 OWL+4 1000 MEMORY ADDRESS MODES Address Register Indirect These effective addressing modes specify that the operand The address of the operand is in the address register specified is in memory and provide the specific address of the operand. by the register field. The reference is classified as a data refer- ence with the exception of the jump and jump to subroutine instructions. EXAMPLE COMMENTS .EA~ (An) MPU MEMORY • Machine Level Coding MOVE (AO), DO ~ jiOOO¥OQ.1:' ~ 1000010001 AO Word ~ Register Direct Reg #0 ARI OWL 1-_..;;.30,;;.1;.,;0_--1 (Address Register MOVE (AO), DO Indirect) 144 -------------------------------HD68000,HD68000Y Address Register Indirect With Postinerement address register is the stack pointer and the operand size is The address of the operand is in the address register specified byte, the address is incremented by two rather than one to by the register field. After the operand address is used, it is keep the stack pointer on a word boundary. The reference is incremented by one, two, or four depending upon whether classified as a data reference. the size of the operand is byte, word, or long word. If the COMMENTS • EA = (An); An + M-An MPU MEMORY Where An-.Address Register M -1,2,or4 (Depending Whether Byte, Word, or Long Word) 00000100 A4 • Machine Level Coding 00000102 MOVE (A4) +, $2000 I r Move 0001 Word Absolute 101 1r: ~ Short ARI with OWL 31DC Increment I-----~ OWL + 2 1-_...;;2;.;00.;;..;.0_-1 MOVE (A4) +,$2000 Address Register Indirect With Predecrement register is the stack pointer and the operand size· is byte, the The address of the operand is in the address register specified address is decremented by two rather than one to keep the by the register field. Before the operand address is used, it is stack pointer on a word boundary. The reference is classified decremented by one, two, or four depending upon whether as a data reference. the operand size is byte, word, or long word. If the address EXAMPLE COMMENTS • An - M_An; EA = (An) MPU MEMORY Where An_Address Register M -1,2,or4 (Depending Whether Byte, Word, or Long Word) 00000100 A3 • Machine Level Coding OOOOOOFE MOVE - (A3), $4000 :tI11~10011 Move Word 0001 with Pred ie· Absolute rament Short OWL 31E3 Reg #3 OWL + 2 ~--4-000----i MOVE - (A3),$4000 145 HD68000,HD68000Y------------------------------·----------------------------------- Address Register Indirect With Displacement register and the sign-extended 16-bit displacement integer in This address mode requires one word of extension. The ad- the extension word. The reference is classified as a data refer- dress of the operand is the sum of the address in the address ence wlth the exception of the jump to subroutine instructions. COMMENTS • EA = An +d,. MPU MEMORY Where An -Pointer Register d,. -16·Bit Displacement • d,. Displacement is Sign Extended • Machine Level Coding $1100 I--";~=-__~ MOVE $100(AOI,$3000 1000010001 AD $3000 I-__~=-__-I :r Move Word 0001 1110 .::::c- t I Absolute Short Reg- #0 ARI with 1000 Displacement MOVE $100(AOI,$30oo OWL 1-_.::3~1E:::8::"""_-I AQDRESS CALCULATION: OWL+21-_~0~lOO~_--I AO - 00001000 OWL+41-_~3~000~_--1 d,. - 00000100 00001100· Address Register Indirect With Index eight bits of the extension word, and the contents of the index This address mode requires one word .of extension. The register. The reference is classified as a data reference with the address of the operand is the sum of the address in the address exception of the jump and jump to subroutine instructions. register, the sign-extended displacement integer in the low order EXAMPLE COMMENTS • EA - An + Rx + d. MPU MEMORY Where An _ Pointer Register Rx - Designated Index Regilter, (Either Address Register or Data Registed d. _ 8·Bit Displacement 100002BDCI DO • Rx & d. are Sign Extended • Rx mey be Word or Long Word 1000020001 AO Long Word may be Designated with Rx.L • Machine Level Coding MOVE $04(AO, 001, $1000 0011 0001 1111 0000 ---=r Move ~I:.::r::.- Absolute Reg #0 Word Short ARI with OWL .31FO Index MOVE $04(AO, 001, OWL+2r--~0~004~--~ $1000 0000 0000 0000 0100 ADDRESS CALCULATION: AO - 00002000 OWL+41-__1~00~0::"""__-I olIwfra1 Reg #0 Jr.ii onstant Zeros DO • 00002BDC d -00000004 ooo04BEO 146 -----------------------------------------------------------------HD68000,HD68000Y SPECIAL ADDRESS MODE Absolute Short Address The special address modes use the effective address register This address mode requires one word of extension. The ad· field to specify the special addressing mode instead of a register dress of the operand is the extension word. The 16-bit address number. is sign extended before it is used. The reference is classified as a data reference with the exception of the jump and jump to subroutine instructions. EXAMPLE COMMENTS • EA = (Next Word) MPU MEMORY • 16-Bit Word is Sign Extended $2000 ~FFFF .... 0000 • Machine Level Coding NOT.L$2000 0100 0110 1011 1000 $2002 OOOO .... FFFF t t.w~ Absolute Not Instruction Short OWL 46B8 NOT.L$2000 OWL+2 2000 EXAMPLE COMMENTS • EA = (Next Word) MPU MEMORY • 16-Bit Word is Sign Extended $1000 • Machine Level Coing MOVE $1000, $2000 0011 0001 1111 1000 $2000 -.r- Move Word I~ Short Absolute Short OWL 31F8 MOVE $1000, $2000 OWL+2 1000 OWL+4 2000 147 HD68000.HD68000Y-------------------------------------------------------------- Absolute Long Addnss fust extension word; the low-order part of the address is the This address mode requires two words of extension. The second extension word. The reference is classified as a data address of the operand is developed by the concatenation of reference with the exception of the jump and jump to sub- the extension words. The high-<>rder part of the address is the routine instructions. EXAMPLE COMMENTS • EA - (Next Two Words) MPU MEMORY • Machine Lavel Coding NEG $014000 0100 0100 01~ =roo:.. k. ---.L.. NEG Absolute Instruction Long OWL 4479 OWL + 2 1-__..:.°00;;.;;.,;1__-1 NEG $014000 OWL + 4 1-__...;.400;;.;;.,;0__-1 Program Counter With Displacemant the extension word. The value in the program counter is the ad- This address mode requires one word of extension. The dress of the extension word. The reference is classified as a pro- address of the operand is the sum of the address in the program gram reference. counter and the sign-extended 16-bit displacement integer in EXAMPLE COMMENTS MPU MEMORY = • EA (PC) + dl6 • d .. is Sign Extended • Machine Laval Coding MOVE (LABEL). 00 IMove Word MOVE (LABEL), 00 ADDRESS CALCULATION: PC = 0000B002 d = 00001000 < LABEL> $9002 00009002 1----------1 148 -----------------------------------------------------------------HD68000,HD68000Y Program Counter With Index This address mode requires one word of extension. This address is the sum of the address in the program counter, the sign-extended displacement integer in the lower eight bits of the extension word, and the contents of the index register. The value in the program counter is the address of the extension word. This reference is classified as a program reference. EA = (PC) + (Rx) + d •. (NOTE) Extension Word 7654320 Displacement Integer Beginning } Addr... of PC + d. D/A : Data Register = 0, Address Register = 1 Data Table Register: Index Register Number W/L : Sign-extented, low order Word integer Desir<:d D!,ta LocatIon In Table I PC + d• + Rx in Index Register = 0 Long Word in I ndex Register = 1 EXAMPLE COMMENTS • EA = (PC) + (Rx) + d. MPU MEMORY Where PC-Current Program Counter Rx_Designated Index Register ~ (Either Data or Address Register) d. _8·Bit Displacement IXXXX3456IDO $8000 • Rx and d. are Sign Extended $8002~ • Rx may be Word or Long Word Long Word is Designated with Rx.L • Machine Level Coding ;;;:;) + Om • (Om_' + ... + Om_,) C = Dm~r+1 ASL (, = 0) - · · 0 0 LSL, ROXL LSR (, = 0) · ·· ·· - 0 0 ? 0 C = Dm _r+1 ROXL (,=0) ROL - - · · ·· 0 0 ? ? C=X C = Dm _r+1 · ··· ··· ROL (, =0) - 0 0 ASR, LSR, ROXR 0 ? C =0,_1 ASR, LSR (, = 0) - 0 0 ROXR (,=0) - · · 0 ? C=X ROR ROR (,=0) - - ·· ·· 0 0 ? 0 C -0,_1 - Not affected • General Case: Sm - Source operand molt lignificant bit U Undefined X=C Om - DeBtinatlon operand most significant bit ? Other- see Special Definition N = Rm Rm - Result bit mOlt lignificant bit Z = Riii· ... • i'Ili n - bit number r - shift amount 156 -----------------------------------------------------------------HD68000,HD68000Y • CONDITIONAL TESTS 1, the condition succeeds, or is true. If the formula evaluates to Table 23 lists the condition names, encodings, and tests 0, the condition is unsuccessful, or false. For example, the T for the conditional branch and set instructions. The test associ- condition always succeeds, while the EQ condition succeeds ated with each condition is a logical formula based on the only if the Z bit is currently set in the condition codes. current state of the condition codes. If this formula evaluates to Table 23 Conditional Tests Mnemonic Condition Encoding Test T true 0000 1 F false 0001 0 HI high 0010 C·Z LS low or same 0011 C+Z CC carry clear 0100 C CS carry set 0101 C NE not equal 0110 'Z EQ equal 0111 Z VC overflow clear 1000 V VS overflow set 1001 V PL plus 1010 N MI minus 1011 N GE greater or equal 1100 N·V+N·V LT less than 1101 N·V+N·v GT greater than 1110 N·V·Z+N·V·Z LE less or equal 1111 Z+N·V+N·V • INSTRUCTION SET memory or data alterable. The former refers to those address- The following paragraphs provide information about the ing modes which are both alterable and memory addresses, and addressing categories and instruction set of the HD68000. the latter refers to addressing modes which are both data and alterable. • ADDRESSING CATEGORIES Effective address modes may be categorized by the ways • INSTRUCTION PRE-FETCH in which they may used. The following classifications will The HD68000 uses a 2-word tightly-coupled instruction be used in the instruction definitions. prefetch mechanism to enhance performance. This mechanism Data If an effective address mode may be used to refer is described in terms of the microcode operations involved. to data operands, it is considered a data address- If the execution of an instruction is dermed to begin when the ing effective address mode. microroutine for that instruction is entered, some features of Memory If an effective address mode may be used to refer the prefetch mechanism can be descnbed. to memory operands, it is considered a memory 1) When execution of an instruction begins, the operation addressing effective address mode. word and the word following have already been fetched. Alterable If an effective address mode may be used to refer The operation word is in the instruction decoder. to alterable (writeable) operands, it is considered 2) In the case of multi-word instructions, as each addi- an alterable addressing effective address mode. tional word of the instruction is used internally, a fetch Control If an effective address mode may be used to refer is made to the instruction stream to replace it. to memory operands without an associated size, it 3) The last fetch from the instruction stream is made when is considered a control addressing effective address the operation word is discarded and decoding is started mode. on the next instruction. Table 24 shows the various categories to which each of the 4) If the instruction is a single-word instruction causing a effective address modes belong. Table 25 is the instruction set branch, the second word is not used. But because this summary. word is fetched by the preceding instruction, it is im- The status register addressing mode is not permitted unless possible to avoid this superfluous fetch. In the case of it is explicitly mentioned as a legal addressing mode. an interrupt or trace exception, both words are not used. These categories may be combined so that additional, more 5) The program counter usually points to the last word restrictive, classifications may be dermed. For example, the fetched from the instruction stream. instruction descriptions use such classifications as alterable 157 HD68000,HD68000Y----------------------------------------------------------------- Table 24 Effective Addressing Mode Categories Effective Addressing Categories Address Mode Register Data Modes Memory Control Alterable On 000 register number X - - X An An@ 001 010 register number register number - X - X -X X X An@+ 011 register number X X - X An@- 100 register number X X - X An@(d) 101 register number X X X X An@(d,ix) 110 register number X X X X xxx.W 111 000 X X X X xxx.L 111 001 X X X X PC@(d) PC@(d,ix) 111 111 010 011 X X X X X X -- #xxx 111 100 X X - - The following example illustrates many of the features of ,instruction prefetch. The contents of memory are assumed to be as illustrated in Figure 53. ORG o DEFINE RESTART VECTOR DC.L INiSSP INITIAL SYSTEM STACK POINTER DC.L RESTART RESTART SYSTEM ENTRY POINT ORG INTVECTOR DEFINE AN INTERRUPT VECTOR DC.L INTHANDLER HANDLER ADDRESS FOR THIS VECTOR ORG SYSTEM RESTART CODE RESTART: NOP NO OPERATION EXAMPLE BRA.S LABEL SHORT BRANCH ADD.W 00,01 ADD REGISTER TO REGISTER LABEL: SUB.W DISP(AO), A1 SUBTRACT REGISTER INDIRECT WITH OFFSET CMP.W 02,03 COMPARE REGISTER TO REGISTER SGE.B 07 See TO REGISTER INTHANDLER: MOVE.W LONGADR1, LONGADR2 MOVE WORD FROM AND TO LONG ADDRESS NOP NO OPERATION SWAP.W REGISTER SWAP Figure 53 Instruction Prefetch Example, Memory Contents The sequence we shall illustrate consists of the power-up The order of operations described within each microroutine is reset, the execution of NOP, BRA, SUB, the taking of an not exact, but is intended for illustrative purpose only. interrupt, and the execution of the MOVE.W xxx. L to yyy.L. 158 HD68000,HD68000Y Microroutine Operation Location Operand Reset Read 0 SSP High Read 2 SSP Low Read 4 PC High Read 6 PC Low Read (PC) NOP Read +(PC) BRA NOP Read +(PC) ADD BRA PC=PC+d Read (PC) SUB Read +(PC) DISP SUB Read +(PC) CMP Read DISP(AO) Read +(PC) SGE INTERRUPT Write -(SSP) PC Low Read Vector # Write -(SSP) SR Write -(SSP) PC High Read (VR) PC High Read +(VR) PC Low Read (PC) MOVE Read +(PC) xxx High MOVE Read +(PC) xxx Low Read +(PC) yyy High Read xxx Read +(PC) yyy Low Write yyy Read +(PC) NOP Read +(PC) SWAP Figure 54 Instruction Prefetch Example • DATA PREFETCH order to optimize performance. As a result, the processor reads Normally the HD68000 prefetches only instructions and not one extra word beyond the higher end of the source area. For data. However, when the MOVEM instruction is used to move example, the instruction sequence in Figure S5 will operate as data from memory to registers, the data stream is prefetched in shown in Figure 56. MOVE TWO Assume Effective Address Evaluation is Already Done LONGWORDS MOVEM.L A, DO/D1 INTO REGISTERS Microroutine Operation Location Other Operations A DC.W 1 WORD 1 MOVEM Read A B DC.W 2 WORD 2 Prepare to Fill DO C DC.W 3 WORD3 Read B A-+DOH D DC.W 4 WORD4 Read C B -+DOL E DC.W 5 WORD 5 Prepare to Fill D1 F DC.W 6 WORD6 Read D C-+D1H Read E D -+D1L Detect Register List Complete Figure 55 MOVEM Example, Memory Contents Figure 56 MOVEM Example, Operation Sequence 159 HD68000,HD68000Y----------------------------------------------------------------- Table 25 Instruction Set -. Operation Sl.. Add •• M.... # On An (An) (An) + -(An) - # 1- # - # - # - # - # - # - # - # - # - # - diAn) d(An.X;) Abs.W Abs.L d(PC) d(PC.Xn 5-lmmed =SR/CC Opoodo lit Pattorn 1111 11 1432 1111 1114 3211 ....... a_tl .. C.... XNZVC Mea Idd()glls AIID Add B s:D'l "~ I M1 B'. s:(}1 d:{Jl d~ 2 d, d~ 2 6 , 2'1 , 2 8 2 8 L,2 lB 1 11 1 11 2 14 2 10 16 12 lB 16 6 20 14 4 12 6 16 ,, ,, ,, , , ,, 4 12 , 14 4 8 1100 RRRI 1100 RRRI 110 I 0001 110 I DODO OOOOOrrr 0000 t r r r SSEE EEEE SSee He! dlO+slO+K'''d d+{)l'~d liIt-s-Dl *u*u* ••••• BInary 1 5"Dl d~ S 1 8 IOOA 2 20 2 20 2 22 24 26 18 4 20 14 6 28 , , 110 I DODO 10EE EEEE d...-[)J ..... d ~I d'Dl 8 2 14 2 14 2 16 18 6 22 • , ~ 4 18 20 6 110 I 0001 IOee eeee liIt"s-i>l AlIDA 2 8 8 2 12 2 12 2 14 4 16 18 4 16 6 20 , 16 4 • "12 110 I MAO o'\1...-s .... /Ji! .. _6. - H41 4 18 111'1' ttee Add Address AIIDI 1 d'M B'W s'lmm S 2 8 d 4 8 IOOA 8 1 14 2 14 2 16 18 10 4 18 6 22 4 16 4 16 4 18 6 20 6 22 6 20 8 14 • 4 18 4 10 6 I. 110 I MAl 0000 0110 llee teet SSEE EEEE d -t- :If.--d ** ••• Add Immed 1 s'lmm d ~ 6 16 IOOA 6 28 6 18 6 30 8 32 8 3' 8 32 10 36 Add QUick B'W s:lmm3 1 s"lmm3 d 2 d 2 4 2' 8 2 8 • 2 12 2 12 2 14 4 16 4 18 4 16 6 20 2 20 2 20 2 22 4 2. 4 26 4 14 6 28 0101 QQQO SSEE EEEE d .... 'tl:--d "''''''''''II' AIIDX Md Multi BfW s'll1 " IMI d 2 d, 4 2 18 101 RRRI 10 I RRRI 55000rrr S500lrff d-l-s+X ·d .* ••• preClston 1 s=[)1 d, 2 8 101 RRRI 1000 Urn AIID s'IMI B!W s=D1 d d 2 30 2 12 2 11 2 I' 4 16 18 4 16 6 20 , 101 RRRI 100 0001 1000 I r r f SSEE EEEE dD1 ........d -**00 Loglcal.o'lld d,il'1 1 s'01 s' 2 d, • 2 8 2 8 2 10 2 10 2 20 2 12 12 4 14 4 12 6 16 4 14 4 26 14 6 28 ,• ,• • 12 4 , 14 4 8 100 DODO 1000001 55ee eeee 1OEE EEEE D'ls....... [)] dliI........ d NIDI d,1» B" s"lmm s' 2 8 d, 8 • 2 14 2 14 2 16 16 4 16 , 18 10 18 6 22 18 6 20 6 22 6 20 8 24 , • 4 18 10 ,6 14 20 100 DODO 00000010 IDee uee SSEE EEEE Dls ....... 1)) d1t:--od -**00 .\ld Immed 1 s,imm d, 6 16 6 2B 6 28 6 30 8 32 8 24 8 32 10 36 ASL, ASR B'. count=!)) d, 1 6+", IIIO'rrrf SSIOODDD Arithmetic 911ft cQunt=#1-8d= 1 6+'" l CGlIflloi)! d, 2 8+'" 1110 QQQf SSOO 0000 ~~o ***** !! J 0 rrrf 1010 0000 cQunt=#1-8d, 2 8+'" , 1110 QQQf 1000 0000 ~i ", Memory W count=l d, 2' 12 2' 12 2' 14 4' 16 18 4' 16 6' 20 1110 OOOf IIEE EEEE 10K Test and B blt#=il1 bltit=lmrn d, d~ 2 12 2 12 2 14 4 16 16 16 , , 18 4 16 6 20 18 6 2il 6 22 6 20 8 24 0000 r f f 1 alEE EEEE 0000 1000 OIEE EEEE -(MI# of d-l. -(b"I# 01 d- - - *-- Cllange 1 bIt:li=tl1 bIt#=Jmm d ~ d, 2 <8 <12 , 0000 rrr J OIEE EEEE 0000 1000 OIEE EEEE (bit):!:*: of d 10111 B bltil:~[)j bitll:~lmm d, d, , 2 12 2 12 2 14 4 16 4 18 4 17 6 20 , 0000 rr r I 10EE EEEE * - .. Test and 16 4 16 18 6 20 6 22 6 20 8 2' 00001000 10EE EEEE -(bit)#: of d--Z, ~ ~ ~ Oear 1 bit:lt=1l1 bilit=lmm d~ d, 2 <10 <14 , 0000rr11 10EE EEEE 0000 1000 f OEE EEEE O-(b;t)# of d ISET Test and B b/t.t"=[h blt1t:=lmm d ~ do d, 2 <8 2 12 2 12 16 4 16 , 2 I. 4 16 4 18 4 16 6 20 18 6 20 6 22 6 20 8 2' , 0000 rr rI IIEE EEEE 00001000 IIEE EEEE -(bit)#ofd-Z, l-(btl)# old -- - Set 1 brt#=Dn 0000 r r r I 11EE EEEE ITST blt#~lmm B bII:1i=1l1 d, 4 <12 d, 2 8 2 8 2 10 , 4 12 4 14 4 f2 6 16 4 12 , 14 0000 1000 IIEE EEEE 0000 r r rI OOEE EEEE -(blt)# ofd-Z - ~ * -- &1 Test bIt:li~lmm 1 bit it~Dn d, d, 2 6 , 12 12 • I' 6 t6 6 t8 6 16 8 2il• 6 16 6 f8 00001000 OOEE EEEE 0000 r rr 1 OOEE EEEE brt#=lmm d, fO 00001000 OOEE EEEE CH. • <40 +--tra~ <44 <44 <46 <48 <50 <48 <52 , <48 , <50 <44 0100 0001 IDee eeee If [))(bound), then trap &unds trap , , •, , CIII B'. do 2 4 2 12 2 12 2 4 16 18 16 6 20 01000010 SSEE EEEE d--+MPU I' - 0100 aear {\Ierand a... l 8/W dclll do 2 s= 2 6 4 2' 4 2 2 20 8 2 2 20 8 2 2 22 10 4 24 12 4 26 I' ,,• 24 12 6 6 28 f6 • 12 • 14 , 8 1011 DODO 55ee eeee ()-od I»-s -**** Compare l Hh s= 2 6 2 6 2 14 2 I. 2 16 18 4 2il 18 6 21 4 18 4 20 6 14 Binary a... A • d~hl So 2 6 2 6 2 10 2 10 2 12 • ,• 1. 16 4 , 12 6 18 ,, 14 , • 10 -••• * .... 16 1011 AAAO II ee e e e~ M-S Compare 1 doM So 2 6 2 6 2 14 2 14 2 f6 4 18 2il 18 6 22 18 4 20 6 14 1011 MAl II ~ e e ~ ee Address CMI'f B'W s,/mm d, d, 6 , 8 CM" , 12 , 12 , 14 6 16 6 18 6 16 8 20 00001100 SSEE EEEE d-# - Compare /mm 1 s=lmm 14 CM" 6 20 6 20 6 22 8 24 8 26 8 24 10 28 a_ B!W S-(M)" d 2 11 1011RRRI 5500 I rrr d-s - ••• * Compare l s,(.AIl) + d' 2 20 Memory DIWS DIvide Signed • d=1ll s ~ 2 <158 2 <162 2 <162 2 <164 4 <166 4 <168 4 <166 6 <170 4 <166 4 <168 4 <162 1000 0001 11ee eeee 1l132fsl6-" 1»(",1 -*** a DIVU DIVide • d:1Jn s, 2 < 140 2 <144 2 <144 2 <146 4 <148 4 <150 , <148 6 <1524 <148 4 1 - •• 00 Movt Ollck IIUIS • d,D! , 2 <70 2 <74 2 <74 1 <76 • <78 • <8Il • <78 6 <82 • <78 • <8Il 4 <74 1100 0001 Ilee eeee !lOP1 " 2 <70 2 <74 2 <74 1 <76 • <78 • <8Il • <78 6 <82 • <78 4 <8Il 4 <74 1100 DODO II ee eeee B-I"'s ·m - •• 00 titSlgned IICO B d, 2 6 2 12 2 12 2 14 • 16 4 18 • 16 6 20 0100 1000 OOEE EEEE O~dlO-X ·d .u.u. Nelale 011111 IIC B'. M!rate.lJinary l d, d, 2 2 • 6 2 2 12 20 2 2 12 20 2 1 14 22 4 4 16 24 •• 18 26 4 4 16 24 6 6 20 28 0100 0100 S5EE EEEE O-d ·d ••••• 1111 M!rale Multi· L B'W d, d, 2 2 4 6 2 2 12 20 2 2 11 20 1 2 14 12 4 • 16 24 4 • 18 26 • 4 16 24 6 6 20 28 0100 0000 5SEE EEEE O-d- X "d ••••• pretlSlon 10' lolltal B/. l d- 2 d, 2 •6 2 2 12 20 2 2 12 20 2 2 14 22 4 4 16 14 4 4 18 26 4 4 16 24 6 6 20 28 01000110 S5EE EEEE -d ·d - •• 00 Qlmplement II B/. s;!)! d, ,- 2 2 12 2 12 2 14 • 16 4 18 4 16 6 20 10000001 55EE EEEE d{)I---d - •• 00 • •• • • • Inclusive(JI ~1>1 2 8 2 8 2 10 4 12 I' 4 12 6 16 12 14 8 1000 DODO SSu !tee i}\s--Bl lolleal l .1>1 ~1>1 d, " 2 8 1 1 20 1\ 2 2 20 I' 2 2 22 16 • 4 24 18 4 26 10 4 • 24 18 6 6 28 22 • 18 4 10 6 14 10000001 1000 DODO IDEE EEEE IDee eeee dD'l ......d OI1s-"'Q, Olt 8" (l'lmmediate l Solmm s:lmm d' 4 d, 6 8 16 4 6 16 JO • 6 16 JO 4 6 18 32 6 8 20 34 6 8 22 36 6 8 20 34 8 10 24 38 4 20 0000 0000 S5EE EEEE d:Ii ......d - •• 00 PIA PIlshEffect· l " 2 14 4 18 4 22 4 18 6 22 • 18 4 22 0100 1000 01 ee eeee ,'·-(SP) ----- IveAddreSS ~c "I, III B/. eOllllt,DI d, 2 6+10 1110 rrrf 5511 1000 - •• 00 ItIllle cOllllt::li1-8d: 2 6+10 without X lcount:DI d' 2 8+10 1110 QQQf SSOI IDDD M...." ooool::li1-8 dO' W counl:l d' 2 8+10 2' 12 2' 12 2' 14 4' 16 4' 18 4' 16 6' 20 1I10ud 1110 QQQf lOll I DOD 1001 IDDD c'19i:;J 1110 011 f II EE EEEE Nat.: Ref., to"Condition Code Computilloos" Opcode Bit PaHem Key as for condition Code. A:AOdress Relister # f: Direction: O-Rithl. I-Left R: Destination Rells.ter *;WonI onI~ C;Test Condition M: Destination fA Mode 5: Size: OO-Byle <;Mu+mum v_ I" tile MOVE ln5tRlcllOn) 0; Dati Rqister I' P: Displacement OI-Word ( 01-Byte I'; Number of PI'OII'- Bytl$ e;Soun:e £ffactive Address Q: QUICk Immediate Data IO-LolII" WlII"d IO-Lone Ward -; Numbir of Clock Periods £;Destination Effeeliv. Address r:Source Rellstet" ll-AlIOther OperatIon ll-Word V: Vector # •• ;TIII MPU goea through.,. extra nul ..... cycte after a m~tiple reed is done (Tile 1.1 EA+2~. (to be continued) 161 HD68000,HD68000Y----------------------------------------------------------------- IIn_Dnic Add•• On An (An) (An)+ -(An) d(An) d(An,Xi) Abs.W Abs.L d(PC) d(PC.Xi) s Immed Opoodo 1ft ' ..tern ....... C...,,,.. II.. d=SRfC 111111 e.... QJ)eration I..... # - # - # - # - # - # - # - # - # # - # - # 54321098 ~654 3210 XNZVC RDXR.RDn 8. count,[)l ~tale '0 1 6+1n counl,#\-8(1o 1 6+1n 1110 rr rf SSII DODD 1110 QQQI SSO I DODD r~,; ***0. IhrnughX L counl~D'I '0 11 8+2n tllO rn f 1011 DODD 1110 0101 I lEE EEEE ~x"J9n1 CQulll'#1-8d= 8+1n 1110 QQQI 1001 DODD Memory SICD •8 count'! S"()) ''00 1 6 l' 12 l' 11 l' 14 4' 16 4' 18 4' 16 6' 20 1000 RRRI 0000 Orr r Subtract digits S' (In) '0 1 18 1000 RRRI 0000 Irrr dlOslOX ·d *U*U* Scc Sol 8 cc '0 1 64 1 11 1 12 1 I' • 16 4 18 • 16 6 20 010 I eeee 1 lEE EEEE d-MPU Ilcctrue,l's ·d - -- ~ ~ Conditionally Else,Q's ·d 11 • I. SUI B'W s=[), '0 1 1'1 1 8 1 8 1 10 SlJlA 1 11 1 11 1 14 4 16 18 4 16 6 10 100 I 0001 SSEE EEEE d·r:n ·d •• *** '0 1 •8 SJiA•8 11 20I. 11 10I. 11 1116 •44 1418 •44 1610 •44 1418 66 1118 • 14 4 8 100 Subtract do!l1 So 11 6 16 4 11 I DODO SSee uee iii s-+1l1 Binary L .!l1 100 I 0001 I DEE EEEE d!l1·d • II "'!l1 So 18 4 10 6 14 1001 DODO IOee uee s"{), Il1 SUIA Subtract •L "'In ~,., So So 1 1 8 8 8 8 1 1 11 14 1 1 11 14 1 1 14 16 4 4 16 18 4 4 18 10 4 • 18 6 16 6 10 12 4 4 16 18 4 • 18 10 4 6 11 14 100 I AAAO 1001 AAA! llee eeee Ilee teet '" s ~kl ..... Mdress SUll 8. s~lmm 4 8 SUiA 4 16 4 16 4 18 6 10 6 11 6 10 8 14 0000 0[00 SSEE EEEE d:::r: ·d Subtract L s,lmm '"0 6 16 SUiA 6 28 6 18 6 30 8 31 8 34 8 31 10 36 ***** 4 18 , 16 Immediate SUI' B W s,lmmJ 1 4 l' 4 1 11 1 11 1 14 4 16 6 10 0101 QQQI SSEE EEEE d:t 'd Subtract L s"lmm3 '"0 1 8 1 8 1 16 1 16 1 11 • 2' 4 16 • 24 6 18 ***** ~Ick SUIl Subtract 8. $=01 S' (In) ,," 1 4 1 18 100 I RRRI 100! RRRI 5500 Orrr d s X ~d 5500 1r rr ***** Multiprecisiotl l So!)) s: (hi) , 1 8 1 30 1001 RRRI 100 I RRRI 1000 Orrr 1000lrrr SWAP W 1 4 0100 1000 0100 0000 !l1(3116)-~ Swap Regis· " !l1(150) -**00 terHalves TlS 8 , 1 4 1 14 1 14 1 16 4 18 4 20 4 18 6 11 01001010 II EE EEEE testd ·cc - •• 00 Test and Set l ... blt7ofd Qlerand TST 8W , 1 4 1 8 1 8 2 10 4 11 14 , • 18 4 1216 66 16 0100 1010 SSEE EEEE lestd· ... cc - .*0 0 Test U... l '0 1 4 1 11 1 11 1 14 4 16 4 10 Lklhnk 1 12 0100 1110 0101 IAAA "'-'SP. (SP) + ~An ----- I •• 8 dISP' bra taken 1 10 0110 ecee pppp pppp I!cctrue -- - • ~ ~ Branch Conditionally dlsp bra not taken bra taken , 1 8 10 PC+dlsP ... pc bra not taken 4 14 III B dlsp 1 10 0110 0000 pppp pppp PC+dlsP .. pc - -- - • ~ Branch dlsp, 4 10 Always ISR B ~ISpo 1 10 0110 0001 pppp pppp pc, (SP) - -- - ~ Bran ell PC.J-dlsP"'PC to Subroutine alcc •• dlspclmm dlsp cc Clunt.r Branch 4 10 010 I ecce ----- Decrement 10 false , 1 ,es 1100 1000 II cc false /)! 1-+1)) & If Counter. & Branchlkltll counter, • I1 i~ true false , 1 expired no no [)P< 1.PC+d!sp---PC Else.r«P Condition True or Count= 1 '0 , IIEE EEEE ,-pc - -- '"' Jump to 1 8 4 10 4 14 10 6 12 4 10 4 14 0100 1110 ~ ~ ,SR Jump to '0 1 16 • 18 • 21 • 18 6 ·'0 4 18 4 22 0100 1110 10EE EEEE pc, (SP) , .pc ----- Subroutme .OP 1 4 0100 1110 01110001 none ~-- . ~ rt~eratlon RIIIT Reset Exter· 1 131 01001110 01110000 assert RESET pm - --- ~ nalDevlces IITI Return from 1 10 0100 1110 01110011 (SP) + '50 (SP) + ,pc *.**. ucephon In 1 10 0100 1110 0111 0111 (51') + 'IX:. .**** Return from (SP) + ,pc SIIbroutme l Restore OC RTt 1 16 01001110 0111 0101 (SP) + ,pc ~ .. - ~ Return from Subroutine ITO' LoadSRlStop • 4 0100 1110 0111 0010 #: "'SR.Walt for Interrupt *.*** TRAP Trap 1 34 01001110 0100 VVVV PC-(SSP). - --- ~ SIH (SSP) (Vector) ~PC nary 1 34 Trap taken 0100 1110 0111 0110 IfHIIIeIIPC" ----- Trap If 4 Trap not ,(SSP) SR - iSSpl OmfiowSet I.kj (TIlAPVYftIor}'PC ehe.NOP Noh: Refer to-CoMitlon Code Computations' Opcode Bit Pattern Key as lor conCitlon Code A: Address Register # f,Dlrectlon.O-Rlght.l-left R. Destination Register * Word only C:TestCondltlon M:Oestlllatlon EA Mode S. Slze.OO-Byte III the MOVE IlistructlOIl] <: Ma~imum value 0: Data Register # P:Dlsplacement D)-Word ( Ol-Byte #;Number of Program Bytes e;SourceEllectlveAddtess Q. QUICk Immediate Data IO-Long Word lO-lonS Word -:Numbef of Clock Penod$ E:DestlnatlonEffe<:tlveAddress r.Source RegIster ll-Another OPt'ratlon ll-Word V.Vectorlt 162 ----------------------------------------------------------------HD68000,HD68000Y • INSTRUCTION FORMAT SUMMARY instructions according to the op-code map. This provides a summary of the first word in each instruction where, Size; Byte = 00 Sz; Word = 0 of the instruction set. Table 26 is an operation code (op-code) Word = 01 Long Word = 1 map which illustrates how bits 15 through 12 are used to Long Word =10 specify the operations. The remaining paragraph groups the Table 26 Operation Code Map Bits 15 thru 12 Operation 0000 Bit Manipulation/MOVEP/lmmediate 0001 Move Byte 0010 Move Long 0011 Move Word 0100 Miscellaneous 0101 ADDOISUBOISee/DB ee 0110 Bee 0111 MOVEa 1000 OR/DIV/SBCD 1001 SUB/SUBX 1010 (Unassigned) 1011 CMP/EOR 1100 AND/MULIABCD/EXG 1101 ADD/ADDX 1110 Sh itt/Rotate 1111 (Unassigned) (1) BIT MANIPULATION, MOVE PERIPHERAL, IMMEDIATE INSTRUCTIONS Dynamic Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 0 Register I 1 Type Effective Address Static Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 0 0 I 0 0 I I 1 0 0 I 0 Type Effective Address Bit Type Codes: TST = 00, CHG = 01, CLR = 10, SET = 11 MOVEP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 I 0 0 0 Register Op-Mode Op-Mode; Word to Reg = 100, Long to Reg = 101, Word to Mem = 110, Long to Mem = 111 0 I I 0 1 Register OR Immediate 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I I I 0 0 0 0 I 0 0 I 0 0 Size Effective Address AND Immediate 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 0 0 0 I I I I 0 0 0 1 0 '"I Size Effective Address 163 HD68000,HD68000Y SUB Immediate 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I I 0 0 0 0 0 0 0 Size Effective Address ADD Immediate 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I I 0 0 0 0 0 0 Size Effective Address EOR Immediate 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I I0 0 0 0 0 0 Size Effective Address CMP Immediate 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I0 I0 0 0 0 0 Size Effective Address (2) MOVE BYTE INSTRUCTION MOVE Bvte 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Destination Source Register Mode Mode Register (3) MOVE LONG INSTRUCTION MOVE Long 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Destination Source Register Mode Mode Register (4) MOVE WORD INSTRUCTION MOVE Word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Destination 'Source Register Mode Mode Register (5) MISCELLANEOUS INSTRUCTIONS NEGX 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 I 0 0 0 0 0 0 Size Effective Address MOVE fromSR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 0 0 0 0 Effective Address CLR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 0 0 0 Size Effective Address 164 ~------------------------------------------------------------H068000.H068000Y NEG 15 14 13 12 11 10 9 8 7 6 5 432 o o I1 o I0 o I1 I0 I0 Size Effective Address MOVE loCCR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 o I1 I0 I0 I0 I1 I0 I0 I1 I1 Effective Address NOT 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Size Effective Address MOVE toSR 15 14 13 12 11 10 9 8 7 6 5 432 o o I1 I0 Effective Address NBCO 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I0 I1 I0 I0 I1 I0 I0 I0 I0 I0 Effective Address PEA 15 14 13 12 11 10 9 8 7 6 5 432 o o I1 I0 Effective Address SWAP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 10111010111010101011101010 Register MOVEM Registers to EA 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 0 I 1 I 0 I 0 I 1 I 0 I 0 I 0 I 1 I Sz Effective Address EXTW 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 o 11 10 10 11 10 10 10 11 10 10 10 10 Register EXTL 15 14 13 12 11. 10 9 8 7 6 543 2 o Register TST 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 o I1 I0 I0 I1 I0 I1 I0 Size Effective Address TAS 15 14 13 12 11 10 9 8 7 6 543 2 o Effective Address 165 HD68000,HD68000Y-------------------------------------------------------------- MOVEM EA to Registers 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 0 I 1 I 0 I 0 I 1 I 1 I 0 I 0 I 1 I Sz Effective Address TRAP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I0 I1 I0 I0 I1 I1 I1 I0 I0 I1 I0 I0 Vector LINK 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 0 I 1 I 0 I0 I 1 I 1 I 1 I 0 I 0 I 1 I 0 I 1 I 0 Register UNLK 15 14 13 12 11 10 9 8 7 6 543 2 0 Register MOVE to USP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 0 I 1 I 0 I 0 I 1 I 1 I 1 I O· I 0 I 1 I 1 I 0 I 0 Register MOVE from USP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 10111010111111101011111011 Register RESET 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 10111010111111101011111110101010 NOP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 10111010111111101011111110101011 STOP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 10111010111111101011111110101110 RTE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 1011101011111110011111110101111 RTS 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 10111010111111101011111110111011 TRAPV 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 10111010111111010111 1 1110111 1 10 166 -----------------------------------------------------------------HD68000,HD68000Y RTR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o JSR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Effective Address JMP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Effective Address CHK 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Register Effective Address LEA 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Register Effective Address (6) ADD QUICK, SUBTRACT QUICK, SET CONDITIONALLY, DECREMENT INSTRUCTIONS ADDQ 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Data I0 Size Effective Address SUBQ 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Data I1 Size Effective Address Sec 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Condition I1 I1 Effective Address DBee 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Condition Register (7) BRANCH CONDITIONALLY, BRANCH TO SUBROUTINE INSTRUCTION Bee 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Condition 8 bit Displacement BSR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o I0 I1 I1 I0 o I0 o I1 8 bit Displacement (8) MOVE QUICK INSTRUCTION MOVEQ 15 14 13 12 11 10 9 8 7 6 5 4 3 2 o Register I0 Data 167 HD68000,HD68000Y (9) OR, DIVIDE, SUBTRACT DECIMAL INSTRUCTIONS OR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 Register Op-Mode Effective Address Op-Mode B 'w L 000 001 010 On V EA-+Dn 100 101 110 EA V On -+EA DIVU 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 Register 0 I I 1 1 Effective Address DIVS 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 Register I1 I1 Effective Address SBCD 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Destination Source Register Register RIM (register/memory): register - register = 0, memory - memory = 1 (10) SUBTRACT, SUBTRACT EXTENDED INSTRUCTIONS SUB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 1 0 Op-Mode I I 0 1 Register Op-Mode Effective Address B W L 000 001 010 Dn-EA-+Dn 100 101 110 EA-Dn-+EA - 011 111 An-EA-+An SUBX 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Destination Source Register Register (11) COMPARE, EXCLUSIVE OR INSTRUCTIONS CMP 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 1 0 I I 1 Op-Mode 1 Register Op-Mode Effective Address B W L 000 001 010 Dn-EA - 011 111 An-EA CMPM 15 14 13 12 11 10 9 B 7 6 5 4 3 2 0 I 1 0 I 1 Register I 1 Size 0 0 I 1 Register EOR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 I I 1 1 Register Size Effective Address (12) AND, MULTIPLY, ADD DECIMAL, EXCHANGE INSTRUCTIONS AND 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 1 Op-Mode 0 0 Register Op-Mode Effective Address B L W 000 001 010 On A EA-+Dn 100 101 110 EA A On -+EA 168 HD68000,HD68000Y MULU 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 Register 0 Effective Address MULS 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 Register Effective Address ABCD 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Source Register EXGD 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Data Register Data Register EXGA 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Address Register Address Register EXGM 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Data Register Address Register (13) ADD, ADD EXTENDED INSTRUCTIONS ADD 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 Register Op-Mode Effective Address Op-Mode B W L 000 001 010 On + EA~Dn 100 101 110 EA+ On ~EA 011 111 An + EA~An ADDX 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Destination Source Register (14) SHIFT/ROTATE INSTRUCTIONS Data Register Shifts 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 Count/Register Register Memory Shifts 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 I 1 0 0 Tvpe d Effective Address Shift Type Codes: AS =00, LS = 01, ROX = 10, RO = 11 d (direction): Right =0, Left = 1 i/r (count source): Immediate Count = 0, Register Count = 1 169 HD68000,HD68000Y---------------------------------------------------------------- .' INSTRUCTION EXECUTION TIMES the time required to perform the operations, store the results, The following paragraphs contain listings of the instruction and read the next instruction. The number of bus read and execution times in terms of external clock (CLK) periods. write cycles is shown in parenthesis as: (r/w). The number In this timing data, it is assumed that both me~ory read and of clock periods and the number of read and write cycles must write cycle times are four clock periods. Any wait states caused be added respectively to those of the effective address calcula- by a longer memory cycle must be added to the total fustruc- tion where indicated. tion time. The number of bus read and write cycles for each In Table 30 the headings have the following meanings: An = instruction is also included with the timing data. This data is address register operand, Dn = data register operand, ea = an enclosed in parenthesis following the execution periods and operand specified by an effective address, and M = memory is shown as: (r/w) where r is the number of read cycles and effective address oper~d. w is the number of write cycles. • IMMEDIATE INSTRUCTION CLOCK PERIODS (NOTE) The number of periods includes instruction fetch and all ap- The number of clock periods shown in Table 31 includes plicable operand fetches and stores. the time to fetch immediate operands, perform the operations, store the results, and read the next operation. The number of • EFFECTIVE ADDRESS OPERAND CALCULATION bus read and write cycles is shown in parenthesis as: (r/w). TIMING The number of clock periods and the number of read and write Table 27 lists the number of clock periods required to com- cycles must be added respectively to those of the effective pute an instruction's effective address. It includes fetching address calculation where indicated. of any extension words, the address computation, and fetch- In Table 31, the headings have the following meanings: ing of the memory operand. The number of bus read and # = immediate operand, Dn = data register operand, An = ad- write cycles is shown in parenthesis as (r/w). Note there are dress register operand, M =memory operand, CCR =condition no write cycles involved in processing the effective address. code register, and SR =status register. • MOVE INSTRUCTION CLOCK PERIODS • SINGLE OPERAND INSTRUCTION CLOCK PERIODS Table 28 and 29 indicate the number of clock periods for Table 32 indicates the number of clock periods fOi the the move instruction. This data includes instruction fetch, single operand instructions. The number of bus read and write operand reads, and operand writes. The number of bus read cycles is shown in parenthesis as: (r/w). The number of clock and write cycles is shown in parenthesis as: (r/w). periods and the number of read and write cycles must be added respectively to those of the effective address calculation where • STANDARD INSTRUCTION CLOCK PERIODS indicated. The number of clock periods shown in Table 30 indicates Table 27 Effective Address Calculation Timing Addressing Mode Byte, Word Long Register On Data Register Direct 0(0/0) 0(0/0) An Address Register 0 irect 0(0/0) 0(0/0) Memory An@ Address Register Indirect 4(1/0) 8(2/0) An@+ Address Register Indirect with Postincrement 4(1/0) 8(2/0) An@- Address Register Indirect with Predecrement 6(1/0) 10(2/0) An@(d) Address Register Indirect with Displacement 8(2/0) 12(3/0) An@(d,ix)* Address Register Indirect with Index 10(2/0) 14(3/0) xxx.W Absolute Short 8(2/0) 12(3/0) xxx.L Absolute Long 12(3/0) 16(4/0) . PC@(d) Program Counter with Displacement 8{2/0) 12(3/0) PC@(d, ix)* Program Counter with Index 10(2/0) 14(3/0) #xxx Immediate 4(1/0) 8(2/0) • The size of the index register Ox) does not affect execution time. 170 -------------------------------------------------------------------HD68000.HD68000Y Table 28 Move Byte and Word Instruction Clock Periods Destination Source Dn An An@ An@+ An@- An@(d) An@(d.ix)* xxx.W xxx.L Dn 4(1/0) 4(1/0) 8(1/1) 8(1/1 ) 8(1/1) 12(2/1 ) 14(2/1) 12(2/1) 16(3/1 ) An 4(1/0) 4(1/0) 8(1/1) 8(1/1) 8(1/1) 12(2/1 ) 14(2/1) 12(2/1) 16(3/1 ) An@ 8(2/0) 8(2/0) 12(211 ) 12(2/1) 12(2/1) 16(3/1) 18(3/1) 16(3/1) 20(4/1) An@+ 8(2/0) 8(2/0) 12(2/1) 12(2/1 ) 12(2/1) 16(3/1 ) 18(3/1) 16(3/1) 20(4/1) An@- 10(2/0) 10(2/0) 14(2/1) 14(2/1) 14(2/1) 18(3/1) 20(3/1) 18(3/1) 22(4/1 ) An@(d) 12(3/0) 12(3/0) 16(3/1) 16(3/1) 16(311) 20(4/1) 22(4/1) 20(4/1) 24(5/1) An@(d, ix)* 14(3/0) 14(3/0) 18(3/1) 18(3/1) 18(3/1) 22(4/1) 24(4/1) 22(4/1 ) 26(5/1) xxx.W 12(3/0) 12(3/0) 16(3/1) 16(3/1) 16(3/1 ) 20(4/1) 22(4/1) 20(4/1) 24(5/1) xxx.L 16(4/0) 16(4/0) 20(4/1) 20(4/1) 20(4/1) 24(5/1 ) 26(5/1) 24(5/1 ) 28(6/1) PC@(d) 12(3/0) 12(3/0) 16(3/1) 16(3/1) 16(3/1 ) 20(4/1) 22(4/1) 20(4/1) 24(5/1 ) PC@(d,ix)* 14(3/0) 14(3/0) 18(3/1) 18(3/1 ) 18(3/1) 22(411 ) 24(4/1) 22(4/1 ) 26(5/1) #xxx 8(2/0) 8(2/0) 12(2/1) 12(2/1) 12(2/1) 16(3/1) 18(3/1) 16(3/1) 20(4/1) * The size of the index register Ox) does not affect execution time. Table 29 Move Long Instruction Clock Periods Destination Source Dn An An@ An@+ An@- An@(d) An@(d,ix)* xxx.W xxx.L Dn 4(1/0) 4(1/0) 12(1/2) 12(1/2) 12(1/2) 16(2/2) 18(2/2) 16(2/2) 20(3/2) An 4(1/0) 4(1/0) 12(1/2) 12(1/2) 12(1/2) 16(2/2) 18(2/2) 16(2/2) 20(3/2) An@ 12(3/0) 12(3/0) 20(3/2) 20(3/2) 20(3/2) 24(4/2) 26(4/2) 24(4/2) 28(5/2) An@+ 12(3/0) 12(3/0) 20(3/2) 20(3/2) 20(3/2) 24(4/2) 26(412) 24(4/2) 28(5/2) An@- 14(3/0) 14(3/0) 22(3/2) 22(3/2) 22(312) 26(4/2) 28(4/2) 26(4/2) 30(5/2) An@(d) 16(4/0) 16(4/0) 24(4/2) 24(4/2) 24(4/2) 28(5/2) 30(5/2) 28(5/2) 32(6/2) An@(d, ix)* 18(4/0) 18(4/0) 26(4/2) 26(4/2) 26(4/2) 30(5/2) 32(5/2) 30(5/2) 34(6/2) xxx.W 16(4/0) 16(4/0) 24(4/2) 24(4/2) 24(4/2) 28(5/2) 30(5/2) 28(5/2) 32(6/2) xxx.L 20(5/0) 20(5/0) 28(512) 28(5/2) 28(5/2) 32(6/2) 34(6/2) 32(6/2) 36(7/2) PC@(d) 16(4/0) 16(4/0) 24(4/2) 24(4/2) 24(4/2) 28(5/2) 30(5/2) 28(5/2) 32(6/2) PC@(d,ix)* 18(4/0) 18(4/0) 26(4/2) 26(4/2) 26(4/2) 30(5/2) 32(5/2) 30(5/2) 34(6/2) #xxx 12(3/0) 12(3/0) 20(3/2) 20(3/2) 20(3/2) 24(4/2) 26(4/2) 24(4/2) 28(5/2) * The size of the index register Ox) does not affect execution time. Table 30 Standard I nstruction Clock Periods Instruction Size op,An op.Dn opDn, Byte, Word 8(1/0) + 4(1/0)+ 8(1/1) + ADD Long 6(1/0)+** 6(1/0) + ** 12(1/2) + Byte, Word - 4(1/0) + 8(1/1) + AND Long - 6(1/0) + *' 12(1/2) + Byte, Word 6(1/0) + 4(1/0) + - CMP Long 6(1/0) + 6(1/0)+ - DIVS - - 158(1/0) + * - DIVU - - 140(1/0) + * - Byte, Word - 4(1/0) ,,* 8(1/1) + EOR Long - 8(1/0) '** 12(1/2) + MULS - - 70(1/0) + • - MULU - - 70(1/0)+* - Byte, Word - 4(1/0) + 8(1/1) + OR Long - 6(1/0) + ** 12(1/2) + Byte, Word 8(1/0) + 4(1/0) + 8(1/1) + SUB Long 6(1/0) + ** 6(1/0)+'* 12(1/2) + + add effective address calculation time * * total of 8 clock periods for instruction if the effective address is register direct * indicates maximum value *** only available effective address mode is data register direct 171 HD68000,HD68000Y---------------------------------------------------------------- Table 31 Immediation Instruction Clock Periods Instruction Size op#, Dn op #, An op#,M op #, CCR/SR Byte, Word 8(2/0) - 12(2/1) + - ADDI Long 16(3/0) - 20(3/2) + - Byte, Word 4(1/0) 8(1/0)* 8(1/1) + - ADDO Long 8(1/0) 8(1/0) 12(1/2) + - ANDI Byte, Word 8(2/0) - 12(2/1) + 20(3/0) Long 16(3/0) - 20(3/1) + - CMPI Byte, Word 8(2/0) 8(2/0) 8(2/0) + - Long 14(3/0) 14(3/0) 12(3/0) + - EORI Byte, Word 8(2/0) - 12(2/1) + 20(3/0) Long 16(3/0) - 20(3/2) + - MOVEO Long 4(1/0) - - - ORI Byte, Word 8(2/0) - 12(2/1) + 20(3/0) Long 16(3/0) - 20(3/2) + - Byte, Word 8(2/0) - 12(2/1) + - SUB I Long 16(3/0) - 20(312) + - Byte, Word 4(1/0) 8(1/0)* 8(111) + - SUBO Long 8(1/0) 8(1/0) 12(112) + - + add effective address calculation time * word only Table 32 Single Operand Instruction Clock Periods Instruction Size Register Memory Byte, Word 4(1/0) 8(1/1) + CLR Long 6(1/0) 12(1/2) + NBCD Byte 6(1/0) 8(1/1) + Byte, Word 4(1/0) 8(1/1) + NEG Long 6(1/0) 12(1/2) + Byte, Word 4(1/0) 8(1/1) + NEGX Long 6(1/0) 12(1/2) + Byte, Word 4(1/0) 8(1/1) + NOT Long 6(1/0) 12(1/2) + Byte, False 4(1/0) 8(1/1) + See Byte, True 6(1/0) 8(1/1) + TAS Byte 4(1/0) 10(1/1) + Byte, Word 4(1/0) 4(1/0) + TST Long 4(1/0) 4(1/0) + + add effective address calculation time • SHIFT/ROTATE INSTRUCTION CLOCK PERIODS • BIT MANIPULATION INSTRUCTION CLOCK PERIODS Table 33 indicates the number of clock periods for the shift Table 34 indicates the number of clock periods required for and rotate instructions. The number of bus read and write the bit manipulation instructions. The number of bus read and cycles is shown in parenthesis as: (r/w). The number of clock write cycles is shown in parenthesis as: (r/w). The number of periods and the number of read and write cycles must be added clock periods and the number of read and write cycles must be respectively to those of the effective address calculation where added respectively to those of the effective address calculation indicated. where indicated. 172 -------------------------------------------------------------------HD68000,HD68000Y • CONDITIONAL INSTRUCTION CLOCK PERIODS • JMP, JSR, LEA, PEA, MOVEM INSTRUCTION CLOCK Table 35 indicates the number of clock periods required for PERIODS the conditional instructions. The number of bus read and write Table 36 indicates the number of clock periods required for cycles is indicated in parenthesis as: (r/w). The number of clock the jump, jump to subroutine, load effective address, push effec- periods and the number of read and write cycles must be added tive address, and move multiple registers instructions. The num- respectively to those of the effective address calculation where ber of bus read and ~rite cycles is shown in parenthesis as: (r/w). indicated. Table 33 Shift/Rotate Instruction Clock Periods Instruction Size Register Memory Byte, Word 6 + 2n(1/0) 8(1/1) + ASR,ASL Long 8 + 2n(1/0) - Byte, Word 6 + 2n(1/0) 8(1/1) + LSR, LSL Long 8 + 2n(1/0) - Byte,Word 6+2n(1/0) 8(1/1) + ROR, ROL Long 8 + 2n(1/0) - Byte, Word 6 + 2n(1/0) 8(1/1) + ROXR,ROXL Long 8 + 2n(1/0) - Table 34 Bit Manipulation Instruction Clock Periods Dynamic Static Instruction Size Register Memory Register Memory Byte - 8(1/1) + - 12(2/1) + BCHG Long 8(1/0)* - 12(2/0)* - BCLR Byte - 8(1/1) + - 12(2/1) + Long 10(1/0)* - 14(2/0)* - Byte - 8(1/1) + - 12(211) + BSET Long 8(1/0)* - 12(2/0)* - Byte - 4(1/0) + - 8(2/0) + BTST Long 6(1/0) - 10(2/0) - + add effective address calculation time * indicates maximum value Table 35 Conditional Instruction Clock Periods Trap or Branch Trap of Branch Instruction Displacement Taken Not Taken Byte 10(2/0) 8(1/0) Bee Word 10(2/0) 12(2/0) Byte 10(2/0) - BRA Word 10(2/0) - Byte 18(2/2) - BSR Word 18(2/2) - CClru. - 12(2/0) DBee CCtalo. 10(2/0) 14(3/0) CHK - 40(5/3) + * 10(1/0) + TRAP - 34(4/3) - TRAPV - 34(5/3) 4(1/0) + add effective address calculation time * indicates maximum value 173 HD68000,HD68000Y----------------------------------------------------------------- Table 36 JMP, JSR, LEA, PEA, MOMEM Instruction Clock Periods Instr Size An@ An@+ An@- An@(d) An@(d,ix)* xxx.W xxx.L PC@(d) PC@(d,ix)* JMP - 8(2/0) - - 10(2/0) 14(3/0) 10(2/0) 12(3/0) 10(2/0) 14(3/0) JSR - 16(2/2) - - 18(2/2) 22(2/2) 18(2/2) 20(3/2) 18(2/2) 22(2/2) LEA - 4(1/0) - - 8(2/0) 12(2/0) 8(2/0) 12(3/0) 8(2/0) 12(2/0) PEA - 12(1/2) - - 16(2/2) 20(2/2) 16(2/2) 20(3/2) 16(2/2) 20(2/2) MOVEM Word 12+4n 12+4n - 16+4n 18+4n 16+4n 20+4n 16+4n 18+4n (3+n/0) (3+n/0) - (4+n/0) (4+n/0) (4+n/0) (5+n/0) (4+n/0) (4+n/0) M-+R Long 12+8n 12+8n - 16+8n 18+8n 16+8n 20+8n 16+8n 18+8n (3+2n/0) (3+2n/0) - (4+2n/0) (4+2n/0) (4+2n/0) (5+2n/0) (4+2n/0) (4+2n/0) MOVEM Word 8+4n - 8+4n 12+4n 14+4n 12+4n 16+4n - - (2/n) - (2/n) (3/n) (3/n) (3/n) (4/n) - - R-+M Long 8+8n - 8+8n 12+8n 14+8n 12+8n 16+8n - - (2/2n) - (2/2n) (3/2n) (3/2n) (3/2n) (4/2n) - - n is the number of registers to move * is the size of the index register (ix) does not affect the instruction's execution time • MULTI-PRECISION INSTRUCTION CLOCK PERIODS the results, and read the next instructions. The number of read Table 37 indicates the number of clock periods for the multi- and write cycles is shown in parenthesis as: (r/w). precision instructions. The number of clock periods includes In Table 37, the headings have the following meanings: Dn = the time to fetch both operands, perform the operations, store data register operand and M = memory operand. Table 37 Multi-Precision Instruction Clock Periods Instruction Size op On, On opM,M Byte, Word 4(1/0) 18(3/1) ADDX Long 8(1/0) 30(5/2) Byte, Word - 12(3/0) CMPM Long - 20(5/0) Byte, Word 4(1/0) 18(3/1) SUBX Long 8(1/0) 30(5/2) ABCD Byte 6(1/0) 18(3/1) SBCD Byte 6(1/0) 18(3/1) • MISCELLANEOUS INSTRUCTION CLOCK PERIODS • EXCEPTION PROCESSING CLOCK PERIODS Table 38 indicates the number of clock periods for the fol- Table 39 indicates the number of clock periods for exception lowing miscellaneous instructions. The number of bus read and processing. The number of clock periods includes the time for write cycles is shown in parenthesis as: (r/w). The number of all stacking, the vector fetch, and the fetch of the first instruc- clock periods plus the number of read and write cycles must be tion of the handler routine. The number of bus read and write added to those of the effective address calculation where indi- cycles is shown in parenthesis as: (r/w). cated. 174 -------------------------------------------------------------------HD68000,HD68000Y Table 38 Miscellaneous Instruction Clock Periods Instruction Size Register Memory Register -+ Memory Memory -+ Register MOVE from SR - 6(1/0) 8(1/1) + - - MOVE toCCR - 12(2/0) 12(2/0) + - - MOVE to SR - 12(2/0) 12(2/0) + - - Word - - 16(2/2) 16(4/0) MOVEP Long - - 24(2/4) 24(6/0) EXG - 6(1/0) - - - Word 4(1/0) - - - EXT Long 4(1/0) - - - LINK - 16(2/2) - - - MOVE from USP - 4(1/0) - - - MOVE to USP - 4(1/0) - - - NOP - 4(1/0) - - - RESET - 132(1/0) - - - RTE - 20(5/0) - - - RTR - 20(5/0 - - - RTS - 16(4/0) - - - STOP - 4(0/0) - - - SWAP - 4(1/0) - - - UNLK - 12(3/0) - - - + add effective address calculation time Table 39 Exception Processing Clock Periods Exception Periods Reset 34(6/0) Address Error 50(417) Bus Error 50(417) Interrupt 44(5/3)* Illegal Instruction 34(4/3) Privileged Instruction 34(4/3) Trace 34(4/3) * The interrupt acknowledge bus cycle is assumed to take four external clock periods. 175 HD68000,HD68000Y------------------------------------------------------------------ • APPENDIX turn, may cause external DMA logic to run a bus cycle at the • THE 680008 MASK SET same time as the processor cycle, only when those paticuiar We implement the specification for HD68000·1O/·12 and timings are all satisfied. If the DMAC HD68450 is used, this two corrections on the 68000S mask: set. One of these correc· problem can be avoided. Because the HD68450 negates BR tions is the bus arbitration logic, and the other is a change to by one clock after the assertion of BGACK. correct a RTE/RTR microcode problem. For the 68000S mask: set, an internal hardware change is (1) Bus Arbitration Logic _ __ implemented and a timing specification (tBGKBR) is added. The problem occurs when bus grant acknowledge (BGACK) If BR and BGACK meet the asynchronous set·up time is asserted for only one clock cycle while bus request (BR) is tASI #47, then tBGKBR can be ignored. If BR and BGACK negated. IF BR is asserted one clock cycle....!!fter BGACK is are asserted asynchronously with respect to the clock, then negated, the processor asserts bus grant (BG) and address BGACK has to be asserted before BR is negated. strobe (AS) at the same time (Refer to Figure 58). This, in Table 40 tBGKBR Specification 4MHz 6MHz 8MHz 10MHz 12.5MHz Version Version Version Version Version Test Unit Number Item Symbol HD68000-4 HD68000-6 HD68000-8 HD68000·10 HD68000·12 Condition HD68000Y4 HD68000Y6 HD68000Y8 HD68000Yl0 HD68000Y12 min I max min 1 max min I max min I max min I max C@ BGACK "Low" to BR "High" tBGKBR Fig. 57 30 I - 25 I - 20 I - 20 1 - 20 1 - ns Strobes and RtW--------.J BGACK--+----------~~~----+_ BG-----------------1 CLK Figure 57 AC Electrical Waveforms - 8us Arbitration CLK I I 8R - - -...... / \~--------________~i________~-------­ I BG / ~--------,.\ --------------------~ :\ :I :!\ I BGACK I AS------------------------------------J/~-----,~L------T_------- - I Bus Grant Error --.t i t Fix moves Bus Grant to here - - - -...... Figure 58 8us Arbitration Timing Diagram Error Sequence 176 ----------------------------HD68000,HD68000Y 68000S Mask Set 68000R and 68000 Mask Set Ri>.: RA R = Bus Request Internal R == Bus Request Internal A = Bus Grant Acknowledge Internal A = Bus Grant Acknowledge Internal G = Bus Grant G = Bus Grant T = Three State Control to Bus Control Logic T :::: Three State Control to Bus Control Logic X = Don't Care X = Don't Care * State machine will not change state if bus is in SO. Refer to * State machine will not change state if bus is in SO. Refer to BUS ARBITRATION CONTROL for additional information. BUS ARBITRATION CONTROL for additional information. Figure 59 State Diagram of HD68000 Bus Arbitration Unit To Avoid this problem on 68000R mask set, users are rec· RTE instructions. These two instructions execute correctly ommended to choose one of the followings. provided there is no bus error. 1) Negate BR more than one clock after the assertion of If there is a bus error on the 2nd, 3rd, or 4th bus cycle of BGACK. RTR or RTE, the program counter is lost. The program counter 2) Avoid the assertion of BGACK for one clock cycle. loads the stack pointer +2 which is the same address as the 3) Reassert BR more than two clocks later than the nega· access. The results is the program counter containing the stack tion of BGACK. pointer. This problem can occur on all HD68000 mask sets 4) Use HD684S0 as DMA controllers. previous to 68000S. The fix inhibits the loading of the program counter during (2) RTE/RTR Microcode Problem this instruction until the 4th bus cycle. The error in the microcode only affects the RTR and the Memory ~R I.~ SP+2 SP PCH SPt4 pel Bus Cycle ~ I \ I I , i M~ i Access Address Contento! SP : SP+2 I , : SP+2 ! SP+4 SP+2 I PCH'PCL : PCH'PCL+2 ' S P t 2 : PCH'PCL+2 Mt28 Progrilm Counter (M+2)- (M+2)- (Mt2)" , 680005 milsk set Figure 60 RTE Instruction Bus Cycle 177 ... • ••