Motorola MC68340 Operation & User’s Manual

Specifications

Brand: Motorola
Category: Processor
Model: MC68340 (Operation & User’s Manual)
File Type: PDF
File Size: —
Pages: 472

Read Online

Read the Motorola MC68340 Operation & User’s Manual online using the built-in PDF viewer.

Text of the manual

Integrated Processor with DMA

User's Manual MolOroIa reserves the right to make changes without further nolk:e to any products herein to Imprcw reliability, function or deslgh. MolDrola does not assume any liability arising out 01 the application or use 01 any product or circuit desaibed herein; neither does it convey any license under its patent rights nor the righta 01 others. Motorola produc18 are not designed, intended, or authorized lor use as components in systems intended lor surgical implant into the body, or other applications Intended to support or sustain IHe, or lor any other application in which the fajlure 01 the MolDrola produd could create a situation where peraonal Injury or death may occur. Should Buyer purchase or use MolDrola products lor any sudl unintended or unauthorized application, Buyer ahaJIindemnify and hold MolOroIa and ita ollicars, employees, subsidiaries, affiliates, and distributors harmless against ali dalms, costa, damages, and expenses, and reuonabIe attorney fees arising out 01, directly or indiredly, any claim 01 personal injury or death associated with such unintended or unauthorized use, even if sudl claim alleges thai MolOroIa was negligent regarding the design or manuladure 01 the part. Motorola and the 8 are registered lrademar1

The complete documentation package for the MC68340 consists of the MC68340UM/AD,

MC68340 Integrated Processor with DMA User's Manual, M68000PM/AD, MC68000 Family Programmer's Reference Manual, and the MC68340P/D, MC68340 Integrated Processor with DMA Product Brief. The MC68340 Integrated with DMA Processor User's Manual describes the programming, capabilities, registers, and operation of the MC68340; the MC68000 Family Programmer's Reference Manual provides instruction details for the MC68340; and the MC68340 Integrated Processor with DMA Product Brief provides a brief description of the MC68340 capabilities. This user's manual is organized as follows: Section 1 Section 2 Section 3 Section 4 Section 5 Section 6 Section 7 Device Overview Section 8 Signal Descriptions Section 9 Bus Operation System Integration Module Section 10 CPU32 Section 11 DMA Controller Module Section 12 Serial Module 6SK FAX-IT FAX 512-891-8593 Timer Modules IEEE 1149.1 Test Access Port Applications Electrical Characteristics Ordering Information and Mechanical Data The Motorola High-End Technical Publication Department provides a FAX number for you to submit any questions and comments about this document. We welcome your suggestions for improving our documentation or any questions concerning our products. Please provide the part number and revision number (located in upper right-hand corner on the cover), and the title of the document when submitting. When referring to items in the manual please reference by the page number, paragraph number~ figure number, table number, and line number if needed. Reference the line number from the top of the page. When we receive a FAX between the hours of 7:30 AM and 5:00 PM EST, Monday through Friday, we will respond within two hours. If the FAX is received after 5:00 PM or on the weekend, we will respond within two hours on the first working day following receipt of the FAX. When sending a FAX, please provide your name, company, FAX number, and voice number including area code (so we can talk to a real person if needed).

TABLE OF CONTENTS

Paragraph Number Title Page Number 1.1 1.1.1 1.1.2 1.2 1.2.1 1.2.2 1.3 1.3.1 1.3.1.1 1.3.1.2 1.3.1.3 1.3.1.4 1.3.1.5 1.3.1.6 1.3.1.7 1.3.2 1.3.3 1.3.4 1.4 1.5 1.6 1.7 Section 1 Device Overview M68300 Family .................................................................................................. 1-2 Organization .................................................................................................. 1-3 Advantages .................................................................................................... 1-3 Central Processor Unit ..................................................................................... 1 -3 CPU32 ............................................................................................................ 1-4 Background Debug Mode ........................................................................... 1-4 On-Chip Peripherals ........................................................................................ 1-5 System Integration Module ......................................................................... 1-5 External Bus Interface .............................................................................. 1-5 System Configuration and Protection ................................................... 1 -6 Clock Synthesizer ..................................................................................... 1-6 Chip Select and Wait State Generation ............................................... 1-6 Interrupt Handling ..................................................................................... 1-6 Discrete 1/0 Pins ........................................................................................ 1-6 IEEE 1149.1 Test Access Port ................................................................ 1-7 Direct Memory Access Module ................................................................... 1-7 Serial Module ................................................................................................ 1-7 Timer Modules ............................................................................................... 1-8 Power Consumption Management... ............................................................. 1-8 Physical .............................................................................................................. 1-9 Compact Disc-Interactive ................................................................................ 1 -9 More Information ............................................................................................... 1-1 0 Section 2 Signal Descriptions 2.1 Signal Index ....................................................................................................... 2-2 2.2 Address Bus ....................................................................................................... 2-4 2.2.1 Address Bus (A23-AO) ................................................................................ 2-4 2.2.2 Address Bus (A31-A24) .............................................................................. 2-4 2.3 Data Bus (015-00) .......................................................................................... 2-4 2.4 Function Codes (FC3-FCO) ............................................................................ 2-5 2.5 Chip Selects (CS3-CSO) ................................................................................. 2-5 2.6 Interrupt Request Level (IRQ7, IRQ6, IRQ5, IRQ3) ...................................... 2-6 MOTOROLA MC68340 USER'S MANUAL iii

TABLE OF CONTENTS (Continued)

Title Page Number 2.7 Bus Control Signals ......................................................................................... 2-6 2.7.1 Data and Size Acknowledge (DSACK1, DSACKO) ................................. 2-6 2.7.2 Address Strobe (AS) .................................................................................... 2-6 2.7.3 Data Strobe (OS) ........................................................................................... 2-7 2.7.4 Transfer Size (SIZ1, SIZO) .......................................................................... 2-7 2.7.5 ReadWrite (RIW) ........................................................................................... 2-7 2.8 Bus Arbitration Signals .................................................................................... 2-7 2.8.1 Bus Request (BR) .......................................................................................... 2-7 2.8.2 Bus Grant (BG) .............................................................................................. 2-7 2.8.3 Bus Grant Acknowledge (BGACK) ............................................................. 2-7 2.8.4 Read-Modify-Write Cycle (RMC) ................................................................ 2-8 2.9 Exception Control Signals .............................................................................. 2-8 2.9.1 Reset (RESET) ............................................................................................... 2-8 2.9.2 Halt (HAL T) ..................................................................................................... 2-8 2.9.3 Bus Error (BERR) .......................................................................................... 2-8 2.10 Clock Signals .................................................................................................... 2-8 2.10.1 System Clock (CLKOUT) ............................................................................ 2-8 2.10.2 Crystal Oscillator (EXTAL, XTAL) ............................................................... 2-9 2.10.3 External Filter Capacitor (XFC) .................................................................. 2-9 2.10.4 Clock Mode Select (MODCK) ..................................................................... 2-9 2.11 Instrumentation and Emulation Signals ................................ , ...................... 2-9 2.11.1 Instruction Fetch (IFETCH) ........................................................................... 2-9 2.11.2 Instruction Pipe (I PIPE) ................................................................................ 2-9 2.11.3 Breakpoint (BKPT) ........................................................................................ 2-10 2.11.4 Freeze (FREEZE) .......................................................................................... 2-1 0 2.12 DMA Module Signals ....................................................................................... 2-10 2.12.1 DMA Request (DREQ2, DREQ1) ................................................................ 2-10 2.12.2 DMA Acknowledge (DACK2, DACK1) ....................................................... 2-1 0 2.12.3 DMA Done (DONE2, DONE1) ..................................................................... 2-10 2.13 Serial Module Signals ..................................................................................... 2-11 2.13.1 Serial Crystal Oscillator (X2, X1) ............................................................... 2-11 2.13.2 Serial External Clock Input (SCLK) ........................................................... 2-11 2.13.3 Receive Data (RxDA, RxDB) ....................................................................... 2-11 2.13.4 Transmit Data (TxDA, TxDB) ....................................................................... 2-11 2.13.5 Clear to Send (CTSA, CTSB) ...................................................................... 2-11 2.13.6 Request to Send (R'fSA, R'f'SB) ................................................................. 2-11 2.13.7 Transmitter Ready (TxRDYA) ...................................................................... 2-11 2.13.8 Receiver Ready (RxRDYA) .......................................................................... 2-12 2.14 Timer Signals .................................................................................................... 2-12 2.14.1 Timer Gate (TGATE2, TGATE1) ................................................................. 2-12 2.14.2 Timer Input (TIN2, TIN 1) .............................................................................. 2-12 2.14.3 Timer Output (TOUT2, TOUT1 ) ................................................................... 2-12 iv MC68340 USER'S MANUAL MOTOROLA

TABLE OF CONTENTS (Continued)

Title Page Number 2.15 Test Signals ....................................................................................................... 2-13 2.15.1 Test Clock (TCK) ........................................................................................... 2-13 2.15.2 Test Mode Select (TMS) .............................................................................. 2-13 2.15.3 Test Data In (TO I) .......................................................................................... 2-13 2.15.4 Test Data Out (TOO) ..................................................................................... 2-13 2.16 Synthesizer Power (VCCSYN) .......................................................................... 2-13 2.17 System Power and Ground (Vee and GNO) ................................................ 2-13 2.18 Signal Summary ............................................................................................... 2-13 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.7.1 3.1.7.2 3.1.7.3 3.2 3.2.1 3.2.2 3.2.3 3.2.3.1 3.2.3.2 3.2.3.3 3.2.3.4 3.2.3.5 3.2.3.6 3.2.3.7 3.2.4 3.2.5 3.2.6 3.3 3.3.1 3.3.2 3.3.3 MOTOROLA Section 3 Bus Operation Bus Transfer Signals ........................................................................................ 3-1 Bus Control Signals ..................................................................................... 3-2 Function Code Signals ................................................................................ 3-3 Address Bus (A31-AO) ................................................................................ 3-4 Address Strobe (AS) .................................................................................... 3-4 Data Bus (015-00) ...................................................................................... 3-4 Data Strobe (OS) ........................................................................................... 3-4 Bus Cycle Termination Signals .................................................................. 3-4 Data Transfer and Size Acknowledge Signals (OSACK1 and OSACKO) ...................................................................... 3-4 Bus Error (BERR) ...................................................................................... 3-5 Autovector (AVEC) .................................................................................... 3-5 Data Transfer Mechanism ............................................................................... 3-5 Dynamic Bus Sizing ..................................................................................... 3-5 Misaligned Operands ................................................................................... 3-7 Operand Transfer Cases ............................................................................. 3-7 Byte Operand to 8-Bit Port, Odd or Even (AO = X) .............................. 3-7 Byte Operand to 16-Bit Port, Even (AO = 0) .......................................... 3-8 Byte Operand to 16-Bit Port, Odd (AO = 1) ........................................... 3-9 Word Operand to 8-Bit Port, Aligned ..................................................... 3-9 Word Operand to 16-Bit Port, Aligned ................................................... 3-10 Long-word Operand to 8-Bit Port, Aligned ........................................... 3-10 Long-Word Operand to 16-Bit Port, Aligned ........................................ 3-12 Bus Operation ................................................................................................ 3-14 Synchronous Operation with OSACKx ...................................................... 3-14 Fast Termination Cycles ............................................................................... 3-15 Data Transfer Cycles ........................................................................................ 3-16 Read Cycle ..................................................................................................... 3-16 Write Cycle ..................................................................................................... 3-18 Read-Modify-Write Cycle ............................................................................. 3-19 MC68340 USER'S MANUAL v all-guides.c om

TABLE OF CONTENTS (Continued)

Title Page Number CPU Space Cycles ........................................................................................... 3-21 Breakpoint Acknowledge Cycle ................................................................. 3-22 LPSTOP Broadcast Cycle ........................................................................... 3-23 Module Base Address Register Access .................................................... 3-27 Interrupt Acknowledge Bus Cycles ............................................................ 3-27 Interrupt Acknowledge Cycle-Terminated Normally ........................ 3-27 Autovector Interrupt Acknowledge Cycle ............................................. 3-29 Spurious Interrupt Cycle .......................................................................... 3-30 Bus Exception Control Cycles ........................................................................ 3-32 Bus Errors ....................................................................................................... 3-34 Retry Operation ............................................................................................. 3-36 Halt Operation ............................................................................................... 3-38 Double Bus Fault .......................................................................................... 3-39 Bus Arbitration ................................................................................................... 3-40 Bus Request. .................................................................................................. 3-43 Bus Grant. ....................................................................................................... 3-43 Bus Grant Acknowledge .............................................................................. 3-43 Bus Arbitration Control ................................................................................. 3-44 Show Cycles .................................................................................................. 3-44 Reset Operation ................................................................................................ 3-46 Section 4 System Integration Module Module Overview .............................................................................................. 4-1 Module Operation ............................................................................................. 4-2 Module Base Address Register Operation .............................................. .4-2 System Configuration and Protection Operation ................................... .4-3 System Configuration .............................................................................. 4-5 Internal Bus Monitor ................................................................................. 4-6 Double Bus Fault Monitor ....................................................................... .4-6 Spurious Interrupt Monitor ...................................................................... 4-6 Software Watchdog .................................................................................. 4-6 Periodic Interrupt Timer .......................................................................... .4-7 Periodic Timer Period Calculation .................................................... .4-8 Using the Periodic Timer as a Real-Time Clock ............................ .4-9 Simultaneous Interrupts by Sources in the SIM40 ............................. 4-9 Clock Synthesizer Operation ..................................................................... .4-9 Phase Comparator and Filter ................................................................ .4-11 Frequency Divider .................................................................................... 4-12 Clock Control ............................................................................................. 4-13 Chip Select Operation ................................................................................. 4-13 Programmable Features ......................................................................... .4-14 MC68340 USER'S MANUAL MOTOROLA

4.3 .. 4.3

4.3.5 4.3.5.1 4.3.5.2 4.3.5.3 4.3.5.4 4.3.5.5 4.3.5.6 4.3.5.7 4.4 4.4.1 4.4.2 4.4.3 TABLE OF CONTENTS (Continued) Title Page Number Global Chip Select Operation ............................................................... .4-14 External Bus Interface Operation .............................................................. .4-15 PortA ........................................................................................................... 4-15 Port B ........................................................................................................... 4-16 Low-Power Stop ........................................................................................... 4-17 Freeze ............................................................................................................. 4-17 Programming ModeL ....................................................................................... 4-18 Module Base Address Register (MBAR) .................................................. .4-20 System Configuration and Protection Registers .................................... .4-21 Module Configuration Register (MCR) .................................................. 4-21 Autovector Register (AVR) ....................................................................... 4-23 Reset Status Register (RSR) ................................................................... 4-23 Software Interrupt Vector Register (SWIV) .......................................... .4-24 System Protection Control Register (SYPCR) ..................................... 4-24 Periodic Interrupt Control Register (PICR) .......................................... .4-26 Periodic Interrupt Timer Register (PITR) ............................................... 4-27 Software Service Register (SWSR) ...................................................... 4-28 Clock Synthesizer Control Register (SYNCR) ....................................... .4-28 Chip Select Registers ...................................................................•.............. 4-29 Base Address Registers .......................................................................... 4-30 Address Mask Registers .......................................................................... 4-31 Chip Select Registers Programming Example ................................... .4-33 External Bus Interface ControL ................................................................... 4-33 Port A Pin Assignment Register 1 (PPARA1) ....................................... 4-33 Port A Pin Assignment Register 2 (PPARA2) ....................................... 4-34 Port A Data Direction Register (DORA) ................................................. 4-34 Port A Data Register (PORTA) ................................................................ 4-34 Port B Pin Assignment Register (PPARB) .......................................... ..4-35 Port B Data Direction Register (DDRB) ................................................. 4-35 Port B Data Register (pORTB, PORTB1) .............................................. 4-35 MC68340 Initialization Sequence ................................................................. 4-36 Startup ............................................................................................................ 4-36 SIM40 Module Configuration ..................................................................... 4-36 SIM40 Example Configuration Code ....................................................... .4-38 Section 5 CPU32 5.1 Overview ............................................................................................................. 5-1 5.1.1 Features ....................................................................................................... ;;.5-2 5.1.2 Virtual Memory .............................................................................................. 5-2 5.1.3 Loop Mode Instruction Execution ..................................... : ........................ 5-3 MOTOROLA MC68340 USER'S MANUAL vii

TABLE OF CONTENTS (Continued)

Title Page Number Vector Base Register .................................................................................... 5-4 Exception Handling ...................................................................................... 5-4 Addressing Modes ........................................................................................ 5-5 Instruction Set. ............................................................................................... 5-5 Table lookup and Interpolate Instructions ........................................... 5-7 low-Power STOP Instruction ................................................................. 5-7 Processing States ......................................................................................... 5-7 Privilege States ............................................................................................. 5-7 Architecture Summary ..................................................................................... 5-8 Programming Model ..................................................................................... 5-8 Registers ......................................................................................................... 5-1 0 Instruction Set. ................................................................................................... 5-11 M68000 Family Compatibility ..................................................................... 5-11 New Instructions ........................................................................................ 5-11 Low-Power Stop (lPSTOP) ................................................................ 5-11 Table lookup and Interpolation (TBl) .............................................. 5-12 Unimplemented Instructions ................................................................... 5-12 Instruction Format and Notation ................................................................. 5-12 Instruction Summary .................................................................................... 5-15 Condition Code Register ......................................................................... 5-20 Data Movement Instructions ................................................................... 5-21 Integer Arithmetic Operations ................................................................. 5-22 logic Instructions ...................................................................................... 5-24 Shift and Rotate Instructions ................................................................... 5-24 Bit Manipulation Instructions ................................................................... 5-25 Binary-Coded Decimal (BCD) Instructions .......................................... 5-26 Program Control Instructions .................................................................. 5-26 System Controllnstructions .................................................................... 5-27 Condition Tests ......................................................................................... 5-29 Using the TBl Instructions .......................................................................... 5-29 Table Example 1: Standard Usage ....................................................... 5-30 Table Example 2: Compressed Table .................................................. 5-31 Table Example 3: 8-Bit Independent Variable .................................... 5-32 Table Example 4: Maintaining Precision .............................................. 5-34 Table Example 5: Surface Interpolations ............................................. 5-36 Nested Subroutine Calls ............................................................................. 5-36 Pipeline Synchronization with the NOP Instruction ................................ 5-36 Processing States ............................................................................................. 5-36 State Transitions ........................................................................................... 5-37 Privilege levels ............................................................................................. 5-37 Supervisor Privilege leveL ..................................................................... 5-37 User Privilege level ................................................................................. 5-39 MC68340 USER'S MANUAL MOTOROLA

TABLE OF CONTENTS (Continued)

Title Page Number Changing Privilege Level ........................................................................ 5-39 Exception Processing ...................................................................................... 5-39 Exception Vectors ......................................................................................... 5-40 Types of Exceptions ................................................................................. 5-41 Exception Processing Sequence .......................................................... 5-41 Exception Stack Frame ............................................................................ 5-42 Multiple Exceptions .................................................................................. 5-42 Processing of Specific Exceptions ............................................................ 5-44 Reset ........................................................................................................... 5-44 Bus Error ..................................................................................................... 5-46 Address Error ............................................................................................. 5-46 Instruction Traps ........................................ ~ ............................................... 5-47 Software BreakpOints ............................................................................... 5-47 Hardware Breakpoints ............................................................................. 5-48 Format Error ............................................................................................... 5-48 Illegal or Unimplemented Instructions .................................................. 5-48 Privilege Violations ................................................................................... 5-49 Tracing ........................................................................................................ 5-50 Interrupts ..................................................................................................... 5-51 Retum from Exception .............................................................................. 5-52 Fault Recovery ............................................................................................... 5-53 Types of Faults .......................................................................................... 5-55 Type I-Released Write Faults ........................................................... 5-55 Type II-Prefetch, Operand, RMW, and MOVEP Faults ................. 5-56 Type III-Faults During MOVEM Operand Transfer ....................... 5-57 Type IV-Faults During Exception Processing ............................... 5-57 Correcting a Fault .................................................. , .................................. 5-57 Type !-Completing Released Writes via Software ....................... 5-57 Type I-Completing Released Writes via RTE ................................ 5-57 Type II-Correcting Faults via RTE .................................................... 5-58 Type III-Correcting Faults via Software .......................................... 5-58 Type III-Correcting Faults by Conversion and Restart ................. 5-58 Type III-Correcting Faults via RTE ................................................... 5-59 Type IV-Correcting Faults via Software ......................................... 5-59 CPU32 Stack Frames .................................................................................. 5-60 Four-Word Stack Frame .......................................................................... 5-60 Six-Word Stack Frame ............................................................................. 5-60· Bus Error Stack Frame ............................................................................. 5-60 Development Support ...................................................................................... 5-63 CPU32 Integrated Development Support ................................................ 5-63 Background Debug Mode (BDM) Overview ........................................ 5-64 Deterministic Opcode Tracking Overview ............................................ 5-64 MC68340 USER'S MANUAL Ix

TABLE OF CONTENTS (Continued)

Title Page Number On-Chip Hardware Breakpoint Overview ............................................. 5-64 Background Debug Mode ........................................................................... 5-65 Enabling BDM ........................................................................................... 5-65 BDM Sources ............................................................................................ 5-66 External BKPT Signal .......................................................................... 5-66 BGND Instruction .................................................................................. 5-66 Double Bus Fault. ................................................................................. 5-66 Entering BDM ............................................................................................ 5-66 Command Execution ................................................................................ 5-67 BDM Registers ........................................................................................... 5-67 Fault Address Register (FAR) ............................................................. 5-67 Return Program Counter (RPC) ......................................................... 5-67 Current Instruction Program Counter (PCC) .................................... 5-67 Returning from BDM ................................................................................. 5-68 Serial Interlace .......................................................................................... 5-68 CPU Serial Logic .................................................................................. 5-69 Development System Serial Logic .................................................... 5-71 Command Set ........................................................................................... 5-73 Command Format ................................................................................. 5-73 Command Sequence Diagram .......................................................... 5-74 Command Set Summary ..................................................................... 5-75 Read AID Register (RAREG/RDREG) ................................................ 5-76 Write AID Register (WAREGIWDREG) .............................................. 5-77 Read System Register (RSREG) ........................................................ 5-77 Write System Register (WSREG) ....................................................... 5-78 Read Memory Location (READ) ......................................................... 5-79 Write Memory Location (WRITE) ........................................................ 5-79 Dump Memory Block (DUMP) ............................................................ 5-80 Fill Memory Block (FILL) ...................................................................... 5-82 Resume Execution (GO) ...................................................................... 5-83 Call User Code (CALL) ........................................................................ 5-83 Reset Peripherals (RST) ...................................................................... 5-85 No Operation (NOP) ............................................................................. 5-85 Future Commands ................................................................................ 5-86 Deterministic Opcode Tracking .................................................................. 5-86 Instruction Fetch (IFETCH) .................................. , .................................... 5-86 Instruction Pipe (IPIPE) ............................................................................ 5-87 Opcode Tracking during Loop Mode .................................................... 5-88 Instruction Execution Timing ........................................................................... 5-88 Resource Scheduling .............................................................................. , ... 5-88 Microsequencer ........................................................................................ 5-89 Instruction Pipeline ................................................................................... 5-89 MC68340 USER'S MANUAL MOTOROLA all-guides.c om

TABLE OF CONTENTS (Continued)

Title Page Number Bus Controller Resources ....................................................................... 5-89 Prefetch Controller ................................................................................ 5-90 Write Pending Buffer ............................................................................ 5-90 Microbus Controller .............................................................................. 5-91 Instruction Execution Overlap ................................................................. 5-91 Effects of Wait States ................................................................................ 5-92 Instruction Execution Time Calculation ................................................ 5-92 Effects of Negative Tails .......................................................................... 5-93 Instruction Stream Timing Examples ........................................................ 5-94 Timing Example i-Execution Overlap ................................................ 5-94 Timing Example 2-Branch Instructions .............................................. 5-95 Timing Example 3-Negative Tails ....................................................... 5-96 Instruction Timing Tables ............................................................................ 5-97 Fetch Effective Address ........................................................................... 5-99 Calculate Effective Address .................................................................... 5-1 00 MOVE Instruction ...................................................................................... 5-1 01 Special-Purpose MOVE Instruction ....................................................... 5-1 01 Arithmetic/Logic Instructions ................................................................... 5-102 Immediate Arithmetic/Logic Instructions ............................................... 5-1 05 Binary-Coded Decimal and Extended Instructions ............................ 5-1 06 Single Operand Instructions ................................................................... 5-107 Shift/Rotate Instructions ........................................................................... 5-108 Bit Manipulation Instructions ................................................................... 5-1 09 Conditional Branch Instructions ............................................................. 5-11 0 Control Instructions ................................................................................... 5-111 Exception-Related Instructions and Operations .................................. 5-111 Save and Restore Operations ................................................................ 5-111 Section 6 DMA Controller Module DMA Module Overview .................................................................................... 6-2 DMA Module Signal Definitions ..................................................................... 6-4 DMA Request (DREQx) ................................................................................ 6-4 DMA Acknowledge (DACKx) ....................................................................... 6-4 DMA Done (DONEx) ..................................................................................... 6-4 Transfer Request Generation ......................................................................... 6-4 Internal Request Generation ....................................................................... 6-4 Internal Request. Maximum Rate ........................................................... 6-5 Internal Request, Limited Rate ............................................................... 6-5 External Request Generation ..................................................................... 6-5 External Burst Mode ................................................................................. 6-5 MC68340 USER'S MANUAL xi

TABLE OF CONTENTS (Continued)

Title Page Number External Cycle Steal Mode ..................................................................... 6-5 Data Transfer Modes ........................................................................................ 6-6 Single-Address Mode .................................................................................. 6-6 Single-Address Read ............................................................................... 6-7 Single-Address Write ............................................................................... 6-9 Dual-Address Mode ..................................................................................... 6-12 Dual-Address Read .................................................................................. 6-12 Dual-Address Write .................................................................................. 6-14 Bus Arbitration ................................................................................................... 6-18 DMA Channel Operation ................................................................................. 6-18 Channel Initialization and Startup ............................................................. 6-18 Data Transfers ............................................................................................... 6-19 Internal Request Transfers ...................................................................... 6-19 External Request Transfers ..................................................................... 6-19 Channel Termination ................................................................................... 6-20 Channel Termination ............................................................................... 6-20 Interrupt Operation .................................................................................... 6-20 Fast Termination Option .......................................................................... 6-20 Register Description ......................................................................................... 6-22 Module Configuration Register (MCR) ...................................................... 6-23 Interrupt Register (INTR) .............................................................................. 6-26 Channel Control Register (CCR) ............................................................... 6-26 Channel Status Register (CSR) ................................................................. 6-30 Function Code Register (FCR) ................................................................... 6-32 Source Address Register (SAR) ................................................................ 6-33 Destination Address Register (DAR) ......................................................... 6-33 Byte Transfer Counter Register (BTC) ...................................................... 6-34 Data Packing ..................................................................................................... 6-35 DMA Channel Initialization Sequence ......................................................... 6-36 DMA Channel Configuration ...................................................................... 6-36 DMA Channel Operation in Single-Address Mode ............................ 6-37 DMA Channel Operation in Dual-Address Mode ............................... 6-37 DMA Channel Example Configuration Code .......................................... 6-38 Section 7 Serial Module 7.1 Module Overview .............................................................................................. 7-2 7.1.1 Serial Communication Channels A and B ............................................... 7-3 7.1.2 Baud Rate Generator Logic ........................................................................ 7-3 7.1.3 Internal Channel Control Logic .................................................................. 7-3 7.1.4 Interrupt Control Logic ................................................................................. 7-3 xii MC68340 USER'S MANUAL MOTOROLA

TABLE OF CONTENTS (Continued)

Title "' _____ : ____ ,c ~ __ :_I "._-.1 .. '_ .1._ •• ""'~n,..n~ Page Number ""'V. I ItJQ, 1..,;;)"'1. "I ....,lII0I1111;&1 IVIUUU'Q LV IVIVUVVU 1 ••••••••••••••••••••••••••••••••••••••••••••• ,-.,.. Serial Module Signal Definitions ................................................................... 7-4 Crystal Input or External Clock (X1) .......................................................... 7-5 Crystal Output (X2) ....................................................................................... 7-5 External Input (SCLK) .................................................................................. 7-6 Channel A Transmitter Serial Data Output (TxDA) ................................. 7-6 Channel A Receiver Serial Data Input (RxDA) ........................................ 7-6 Channel B Transmitter Serial Data Output (TxDB) ................................. 7-6 Channel B Receiver Serial Data Input (RxDB) ........................................ 7-6 Channel A Request-To-Send (RTSA) ....................................................... 7-6 RTSA ........................................................................................................... 7-6 OPO .............................................................................................................. 7-6 Channel B Request-To-Send (RTSB) ....................................................... 7-6 RTSB ........................................................................................................... 7-7 OP1 .............................................................................................................. 7-7 Channel A Clear-To-Send (CTSA) ............................. ; .............................. 7-7 Channel B Clear-To-Send (CTSB) ............................................................ 7-7 Channel A Transmitter Ready (TxRDYA) .................................................. 7-7 TxRDYA ...................................................................................................... 7-7 OP6 .............................................................................................................. 7-7 Channel A Receiver Ready (RxRDYA) ...................................................... 7-7 RxRDYA ...................................................................................................... 7-7 FFULLA ....................................................................................................... 7-7 OP4 .............................................................................................................. 7-7 Operation ............................................................................................................ 7-8 Baud Rate Generator ................................................................................... 7-8 Transmitter and Receiver Operating Modes ............................................ 7-8 Transmitter ................................................................................................. 7-1 0 Receiver ...................................................................................................... 7-11 FIFO Stack .................................................................................................. 7-12 Looping Modes ............................................................................................. 7-14 Automatic Echo Mode .............................................................................. 7-14 Local Loopback Mode ............................................................................. 7 -14 Remote Loopback Mode ......................................................................... 7-14 Multidrop Mode ............................................................................................. 7-15 Bus Operation ................................................................................................ 7-17 Read Cycles ............................................................................................... 7 -17 Write Cycles ............................................................................................... 7 -17 Interrupt Acknowledge Cycles ................................................................ 7-17 Register Description and Programming ....................................................... 7-17 Register Description ..................................................................................... 7-17 Module Configuration Register (MCR) .................................................. 7-19 MC68340 USER'S MANUAL xiii

TABLE OF CONTENTS (Continued)

Title Page Number Interrupt Level Register (ILR) .................................................................. 7-21 Interrupt Vector Register (IVR) ................................................................ 7-21 Mode Register 1 (MR1) ............................................................................ 7-22 Status Register (SR) ................................................................................. 7-24 Clock-Select Register (CSR) .................................................................. 7 -26 Command Register (CR) ......................................................................... 7-27 Receiver Buffer (RB) ................................................................................. 7-30 Transmitter Buffer (TB) ............................................................................. 7-30 Input Port Change Register (IPCR) ........................................................ 7-31 Auxiliary Control Register (ACR) ............................................................ 7 -32 Interrupt Status Register (ISR) ................................................................ 7-32 Interrupt Enable Register (IER) ............................................................... 7-34 Input Port (IP) ............................................................................................. 7-35 Output Port Control Register (OPCR) .................................................... 7-35 Output Port Data Register (OP) .............................................................. 7-37 Mode Register 2 (MR2) ............................................................................ 7-37 Programming ................................................................................................. 7-40 Serial Module Initialization ..................................................................... 7-40 VO Driver Example .................................................................................... 7-40 Interrupt Handling ..................................................................................... 7-40 Serial Module Initialization Sequence ......................................................... 7-46 Serial Module Configuration ...................................................................... 7-46 Serial Module Example Configuration Code .......................................... 7-47 Section 8 Timer Modules Module Overview .............................................................................................. 8-1 Timer and Counter Functions ..................................................................... 8-2 Prescaler and Counter ............................................................................. 8-2 limeout Detection ..................................................................................... 8-2 Comparator ................................................................................................ 8-2 Clock Selection Logic .............................................................................. 8-3 Internal Control Logic ................................................................................... 8-3 Interrupt Control Logic ................................................................................. 8-4 Timer Modules Signal Definitions ................................................................. 8-4 limer Input (TIN1, TIN2) ........................................... ; .................................. 8-5 Timer Gate (TGATE1, TGATE2) ................................................................. 8-6 limer Output (TOUT1, TOUT2) ................................................................... 8-6 Operating Modes .............................................................................................. 8-6 Input Capture/Output Compare .................................................................. 8-6 Square-Wave Generator ............................................................................. 8-8 MC68340 USER'S MANUAL MOTOROLA

TABLE OF CONTENTS (Continued)

Title Page Number \I<)ri<) .... lo n"h,_r."I'lo ~n"<)ro_W<)"o ~onorl:ltnr R-Q - ------"- - --, -" --- - -.----- Variable-Width Single-Shot Pulse Generator ......................................... 8-1 0 Pulse-Width Measurement. ......................................................................... 8-12 Period Measurement. ................................................................................... 8-13 Event Count ................................................................................................... 8-14 Timer Bypass ................................................................................................. 8-16 Bus Operation ................................................................................................ 8-17 Read Cycles ............................................................................................... 8-17 Write Cycles ............................................................................................... 8-17 Interrupt Acknowledge Cycles ................................................................ 8-17 Register Description ......................................................................................... 8-17 Module Configuration Register (MCR) ...................................................... 8-18 Interrupt Register (IR) ................................................................................... 8-20 Control Register (CR) ................................................................................... 8-20 Status Register (SR) ..................................................................................... 8-23 Counter Register (CNTR) ............................................................................ 8-25 Preload 1 Register (PREL 1 ) ........................................................................ 8-25 Preload 2 Register (PREL2) ........................................................................ 8-26 Compare Register (COM) ............................................................................ 8-26 Timer Module Initialization Sequence .......................................................... 8-27 Timer Module Configuration ....................................................................... 8-27 Timer Module Example Configuration Code ........................................... 8-28 Section 9 IEEE 1149.1 Test Access Port 9.1 Overview ............................................................................................................. 9-1 9.2 TAP Controller ................................................................................................... 9-2 9.3 Boundary Scan Register ................................................................................. 9-3 9.4 Instruction Register ........................................................................................... 9-9 9.4.1 EXTEST (000) ............................................................................................... 9-10 9.4.2 SAMPLE/PRELOAD (001) .......................................................................... 9-1 0 9.4.3 BYPASS (X1X, 101) ..................................................................................... 9-11 9.4.4 HI-Z (1 00) ....................................................................................................... 9-11 9.5 MC68340 Restrictions ...................................................................................... 9-11 9.6 Non-IEEE 1149.1 Operation ........................................................................... 9-12 Section 10 Applications 10.1 Minimum System Configuration ................................................................... 1 0-1 10.1.1 Processor Clock Circuitry .......................................................................... 10-1 MOTOROLA MC68340 USER'S MANUAL xv all-guides.c om

TABLE OF CONTENTS (Concluded)

Title Page Number Reset Circuitry ............................................................................................. 10-3 SRAM Interface ........................................................................................... 10-3 ROM Interface .............................................................................................. 10-4 Serial Interface ............................................................................................ 10-4 Memory Interface Information ....................................................................... 10-5 Using an 8-Bit Boot ROM ........................................................................... 10-5 Access Time Calculations ......................................................................... 10-6 Calculating Frequency-Adjusted Output ................................................ 1 0-7 Interfacing an 8-Bit Device to 16-Bit Memory Using Single-Address DMA Mode .................................................................. 10-10 Power Consumption Considerations .......................................................... 10-10 MC68340 Power Reduction at 5V .......................................................... 10-11 MC68340V (3.3 V) ..................................................................................... 1 0-13 Section 11 Electrical Characteristics Maximum Rating ............................................................................................. 11-1 Thermal Characteristics ................................................................................. 11-1 Power Considerations ................................................................................... 11-2 AC Electrical Specification Definitions ....................................................... 11-2 DC Electrical Specifications ......................................................................... 11-5 AC Electrical Specifications Control Timing .............................................. 11-6 AC Timing Specifications .............................................................................. 11-8 DMA Module AC Electrical Specifications ................................................. 11-19 Timer Module Electrical Specifications ...................................................... 11-20 Serial Module Electrical Specifications ...................................................... 11-22 IEEE 1149.1 Electrical Specifications ......................................................... 11-25 Section 12 Ordering Information and Mechanical Data Standard MC68340 Ordering Information ................................................. 12-1 Pin Assignment ............................................................................................... 12-2 144-Lead Ceramic Quad Flat Pack (FE Suffix) ..................................... 12-2 145-Lead Plastic Pin Grid Array (RP Suffix) .......................................... 1 2-4 Package Dimensions ..................................................................................... 12-6 FE Suffix ....................................................................................................... 12-6 RP Suffix ....................................................................................................... 12-7 Index MC68340 USER'S MANUAL MOTOROLA

- -- - - --

LIST OF ILLU:S I HA IIUN::S Figure Number Title Page Number 1-1 Block Diagram ......................................................................................................... 1-1 2-1 Functional Signal Groups ..................................................................................... 2-1 3-1 Inpu1 Sample Window ............................................................................................ 3-2 3-2 MC68340 Interface to Various Port Sizes .......................................................... 3-7 3-3 Long-Word Operand Read Timing from 8-Bit Port ............................................ 3-11 3-4 Long-Word Operand Write Timing to 8-Bit Port ................................................. 3-12 3-5 Long-Word and Word Read and Write Timing-16-Bit Port ........................... 3-13 3-6 Fast Termination Timing ........................................................................................ 3-15 3-7 Word Read Cycle Flowchart ................................................................................. 3-16 3-8 Word Write Cycle Flowchart .................................................................................. 3-18 3-9 Read-Modify-Write Cycle Timing ......................................................................... 3-19 3-10 CPU Space Address Encoding ............................................................................ 3-21 3-11 Breakpoint Operation Flowchart .......................................................................... 3-24 3-12 Breakpoint Acknowledge Cycle Timing (Opcode Returned) .......................... 3-25 3-13 Breakpoint Acknowledge Cycle Timing (Exception Signaled) ...................... 3-26 3-14 Interrupt Acknowledge Cycle Flowchart ............................................................. 3-28 3-15 Interrupt Acknowledge Cycle Timing .................................................................. 3-29 3-16 Autovector Operation Timing ................................................................................ 3-31 3-17 Bus Error without DSACKx .................................................................................... 3-35 3-18 Late Bus Error with DSACKx ................................................................................. 3-36 3-19 Retry Sequence ...................................................................................................... 3-37 3-20 Late Retry Sequence ............................................................................................. 3-38 3-21 HALT Timing ............................................................................................................ 3-39 3-22 Bus Arbitration Flowchart for Single Request .................................................... 3-41 3-23 Bus Arbitration Timing Diagram-Idle Bus Case .............................................. 3-42 3-24 Bus Arbitration Timing Diagram-Active Bus Ca.se ......................................... 3-42 3-25 Bus Arbitration State Diagram .............................................................................. 3-45 3-26 Show Cycle Timing Diagram ................................................................................ 3-46 3-27 Timing for External Devices Driving RESET ...................................................... 3-47 3-28 Power-Up Reset Timing Diagram ........................................................................ 3-48 4-1 SIM40 Module Register Block .............................................................................. 4-3 4-2 System Configuration and Protection Function ............................................... .4-5 4-3 Software Watchdog Block Diagram .................................................................... 4-7 4-4 Clock Block Diagram for Crystal Operation ...................................................... .4-10 MOTOROLA MC68340 USER'S MANUAL xvii

LIST OF ILLUSTRATIONS (Continued)

Title Page Number 4-5 MC68340 Crystal Oscillator ....................... , .......................................................... 4-10 4-6 Clock Block Diagram for External Oscillator Operation .................................. .4-11 4-7 Full Interrupt Request Multiplexer ........................................................................ 4-16 4-8 SIM40 Programming Model. ................................................................................. 4-19 5-1 CPU32 Block Diagram ........................................................................................... 5-3 5-2 Loop Mode Instruction Sequence ....................................................................... 5-3 5-3 User Programming Model ..................................................................................... 5-9 5-4 Supervisor Programming Model Supplement .................................................. 5-9 5-5 Status Register ........................................................................................................ 5-10 5-6 Instruction Word General Format ......................................................................... 5-12 5-7 Table Example 1 ..................................................................................................... 5-30 5-8 Table Example 2 ..................................................................................................... 5-31 5-9 Table Example 3 ..................................................................................................... 5-33 5-1 0 Exception Stack Frame .......................................................................................... 5-42 5-11 Reset Operation Flowchart ..... , .............................................................................. 5-45 5-12 Format $O-Four-Word Stack Frame .................................................................. 5-60 5-13 Format $2-Six-Word Stack Frame .................................................................... 5-60 5-14 Internal Transfer Count Register .......................................................................... 5-61 5-15 Format $C-BERR Stack for Prefetches and Operands .................................. 5-62 5-16 Format $C-BERR Stack on MOVEM Operand ................................................ 5-62 5-17 Format $C-Four- and Six-Word BERRStack .................................................. 5-63 5-18 In-Circuit Emulator Configuration ........................................................................ 5-64 5-19 Bus State Analyzer Configuration ....................................................................... 5-64 5-20 BDM Block Diagram ............................................................................................... 5-65 5-21 BDM Command Execution Flowchart ................................................................. 5-68 5-22 Debug Serial 1/0 Block Diagram ................................... ~ ...................................... 5-70 5-23 Serial Interface Timing Diagram .......................................................................... 5-71 5-24 BKPT.Timing for Single Bus Cycle ...................................................................... 5-72 5-25 BKPT Timing for Forcing BDM .............................................................................. 5-72 5-26 BKPT/DSCLK Logic Diagram ............................................................................... 5-72 5-27 Command-Sequence Diagram ............... : ............................................................ 5-75 5-28 Functional Model of Instruction Pipeline ............................................................ 5-87 5-29 Instruction Pipeline Timing Diagram ................................................................... 5-88 5-30 Block Diagram of Independent Resources ........................................................ 5-90 5-31 Simultaneous Instruction Execution .................................................................... 5-91 5-32 Attributed Instruction Times ................................................................................... 5-92 5-33 Example 1-lnstruction Stream ........................................................................... 5-95 5-34 Example 2-Branch Taken ................................................................................... 5-95 5-35 Example 2-Branch Not Taken ............................................................................ 5-96 5-36 Example 3-Branch Negative Tail ...................................................................... 5-96 xviii MC68340 USER'S MANUAL MOTOROLA

LIST OF ILLUSTRATIONS (Continued)

Figure Number Title Page Number ". .. ..... .... "' __ I~ n= __ ... __ e:: .. U- I ...,.v.,", ...,.""""" ..,'Ql:I'Q ••••••••••••••••••••••••.••••••••••••••••••••••••••••••••••••••••••••••••••••••..•••.•.•••••••••.• _~. 6-2 Single-Address Transfers ..................................................................................... 6-3 6-3 Dual-Address Transfer ........................................................................................... 6-3 6-4 DMA External Connections to Serial Module .................................................... 6-6 6-5 Single-Address Read Timing (External Burst) .................................................. 6-8 6-6 Single-Address Read Timing (Cycle Steal) ....................................................... 6-9 6-7 Single-Address Write Timing (External Burst) ................................................... 6-1 0 6-8 Single-Address Write Timing (Cycle Steal) ....................................................... 6-11 6-9 Dual-Address Read Timing (External Burst-Source Requesting) ............... 6-13 6-10 Dual-Address Read Timing (Cycle Steal-Source Requesting) ................... 6-14 6-11 Dual-Address Write Timing (External Burst-Destination Requesting) ........ 6-16 6-12 Dual-Address Write Timing (Cycle Steal-Destination Requesting) ............ 6-17 6-13 Fast Termination Option (Cycle Steal) ................................................................ 6-21 6-14 Fast Termination Option (External Burst-Source Requesting) .................... 6-22 6-15 DMA Module Programming Model ...................................................................... 6-23 6-16 Packing and Unpacking of Operands ................................................................. 6-35 7-1 Simplified Block Diagram ...................................................................................... 7-1 7-2 External and Internal Interface Signals .............................................................. 7-5 7-3 Baud Rate Generator Block Diagram .................................................................. 7-8 7-4 Transmitter and Receiver Functional Diagram .................................................. 7-9 7-5 Transmitter Timing Diagram ................................................................................. 7-10 7-6 Receiver Timing Diagram ...................................................................................... 7 -12 7 -7 Looping Modes Functional Diagram ................................................................... 7 -15 7-8 Multidrop Mode Timing Diagram ......................................................................... 7-16 7-9 Serial Module Programming Model .................................................................... 7-19 7-10 Serial Module Programming Flowchart .............................................................. 7-41 8-1 Simplified Block Diagram ...................................................................................... 8-1 8-2 Timer Functional Diagram ..................................................................................... 8-3 8-3 External and Internal Interface Signals .............................................................. 8-5 8-4 Input Capture/Output Compare Mode ................................................................. 8-7 8-5 Square-Wave Generator Mode ............................................................................ 8-8 8-6 Variable Duty-Cycle Square-Wave Generator Mode ...................................... 8-1 0 8-7 Variable-Width Single-Shot Pulse Generator Mode ........................................ 8-11 8-8 Pulse-Width Measurement Mode ........................................................................ 8-12 8-9 Period Measurement Mode .................................................................................. 8-14 8-10 Event Count Mode .................................................................................................. 8-15 8-11 Timer Module Programming ModeL ................................................................... 8-18 9-1 Test Access Port Block Diagram .......................................................................... 9-2 9-2 TAP Controller State Machine .............................................................................. 9-3 MOTOROLA MC68340 USER'S MANUAL xix

LIST OF ILLUSTRATIONS (Continued)

Title Page Number 9-3 Output Latch Cell (O.Latch) ................................................................................... 9-7 9-4 Input Pin Cell (I.Pin) ................................................................................................ 9-7 9-5 Active-High Output Control Cell (IO.Ctll ) ........................................................... 9-8 9-6 Active-Low Output Control Cell (IO.CtIO) ............................................................ 9-8 9-7 Bidirectional Data Cell (IO.Cell) ........................................................................... 9-9 9-8 General Arrangement for Bidirectional Pins ...................................................... 9-9 9-9 Bypass Register ...................................................................................................... 9-11 10-1 Minimum System Configuration Block Diagram ............................................. 10-1 10-2 Sample Crystal Circuit ......................................................................................... 1 0-2 10-3 Statek Corporation Crystal Circuit ..................................................................... 10-2 10-4 XFC and VCCSYN Capacitor Connections ........................................................ l 0-3 10-5 SRAM Interface ..................................................................................................... 1 0-3 10-6 ROM Interface ........................................................................................................ 1 0-4 10-7 Serial Interface ...................................................................................................... 10-5 10-8 External Circuitry for 8-Bit Boot ROM ................................................................ 1 0-5 1 0-9 8-Bit Boot ROM Timing ......................................................................................... 1 0-6 10-10 Access Time Computation Diagram .................................................................. 1 0-6 10-11 Signal Relationships to CLKOUT ...................................................................... 10-7 1 0-12 Signal Width Specifications ................................................................................ 1 0-8 1 0-13 Skew between Two Outputs ............................................................................... 1 0-9 10-14 Circuitry for Interfacing 8-Bit Device to 16-Bit Memory in Single-Address DMA Mode .............................................................................. 1 0-10 10-15 MC68340 Current vs. Activity at 5 V .................................................................. 10-11 10-16 MC68340 Current vs. Voltageffemperature .................................................... 1 0-12 10-17 MC68340 Current vs. Clock Frequency at 5 V ................................................ 10-12 11-1 Drive Levels and Test Points for AC Specifications ....................................... 11-4 11-2 Read Cycle Timing Diagram ............................................................................... 11-11 11-3 Write Cycle Timing Diagram ............................................................................... l1-12 11-4 Fast Termination Read Cycle Timing Diagram ............................................... 11-13 11-5 Fast Termination Write Cycle Timing Diagram ................................................ 11-14 11-6 Bus Arbitation Timing-Active Bus Case ......................................................... 11-15 11-7 Bus Arbitration Timing-Idle Bus Case ............................................................ 11-16 11-8 Show Cycle Timing Diagram .............................................................................. 11-16 11-9 lACK Cycle Timing Diagram ............................................................................... 11-17 11-10 Background Debug Mode Serial Port Timing ................................................. 11-18 11-11 Background Debug Mode FREEZE Timing ..................................................... 11-18 11-12 DMA Signal Timing Diagram .............................................................................. 11-19 11-13 Timer Module Clock Signal Timing Diagram .................................................. 11-20 11-14 Timer Module Signal Timing Diagram .............................................................. 11-21 11-15 Serial Module General Timing Diagram .......................................................... 11-22 xx MC68340 USER'S MANUAL MOTOROLA all-guides.c om

LIST OF ILLUSTRATIONS (Concluded)

Figure Number Title Page Number 11-16 Serial Module Asynchronous MOCle Timing (Xl ) ............................................ 1 l-~" 11-17 Serial Module Asynchronous Mode Timing (SCLK-16X) ............................ 11-23 11-18 Serial Module Synchronous Mode Timing Diagram ..................................... 11-23 11-19 Test Clock Input Timing Diagram ....................................................................... 11-25 11-20 Boundary Scan Timing Diagram ....................................................................... 11-26 11-21 Test Access Port Timing Diagram ...................................................................... 11-26 MOTOROLA MC68340 USER'S MANUAL xxi

LIST OF TABLES

Title Page Number 2-1 Signal Index ............................................................................................................. 2-2 2-2 Address Space Encoding ..................................................................................... 2-5 2-3 DSACKx Encoding .................................................................................................. 2-6 2-4 SIZx Signal Encoding ............................................................................................ 2-7 2-5 Signal Summary ..................................................................................................... 2-14 3-1 SIZx Signal Encoding ............................................................................................ 3-3 3-2 Address Space Encoding ..................................................................................... 3-3 3-3 DSACKx Encoding .................................................................................................. 3-5 3-4 DSACKx, BERR, and HALT Assertion Results ................................................... 3-33 4-1 Clock Operating Modes ......................................................................................... 4-9 4-2 System Frequencies from 32.768-kHz Reference ............................................ 4-13 4-3 Clock Control Signals ............................................................................................ 4-13 4-4 Port A Pin Assignment Register ........................................................................... 4-15 4-5 Port B Pin Assignment Register .......................................................................... .4-16 4-6 SHENx Control Bits ................................................................................................ 4-22 4-7 Deriving Software Watchdog Timeout ................................................................ 4-25 4-8 BMTx Encoding ....................................................................................................... 4-26 4-9 PIRQL Encoding ...................................................................................................... 4-26 4-10 DDx Encoding ......................................................................................................... 4-32 4-11 PSx Encoding .......................................................................................................... 4-32 5-1 Instruction Set. ......................................................................................................... 5-6 5-2 Instruction Set Summary .... , .................................................................................. 5-16 5-3 Condition Code Computations ............................................................................. 5-20 5-4 Data Movement Operations .................................................................................. 5-21 5-5 Integer Arithmetic Operations ............................................................................... 5-23 5-6 Logic Operations ..................................................................................................... 5-24 5-7 Shift and Rotate Operations .................................................................................. 5-25 5-8 Bit Manipulation Operations ......................................................... : ....................... 5-25 5-9 Binary-Coded Decimal Operations ..................................................................... 5-26 5-10 Program Control Operations ................................................................................. 5-26 5-11 System Control Operations ................................................................................... 5-28 5-12 Condition Tests ....................................................................................................... 5-29 5-13 Standard Usage Entries ........................................................................................ 5-30 5-14 Compressed Table Entries ................................................................................... 5-32 xxii MC68340 USER'S MANUAL MOTOROLA

LIST OF TABLES (Continued)

Table Number Title Page Number . . ...... -.. - ..... - 0- I 0 0-011 IIIU~jJ~IIU~11L V i::lIli::lUI~ l::111I1~::> .........................................................••••••••••••• .r.;>.;> 5-16 Exception Vector Assignments ............................................................................. 5-40 5-17 Exception Priority Groups ...................................................................................... 5-43 5-18 Tracing ControL ....................................................................................................... 5-50 5-19 BDM Source Summary .......................................................................................... 5-67 5-20 Polling the BDM Entry Source ..................................................................... _ ........ 5-68 5-21 CPU Generated Message Encoding ................................................................... 5-70 5-22 Size Field Encoding ............................................................................................... 5-74 5-23 BDM Command Summary .................................................................................... 5-77 5-24 Register Field for RSREG and WSREG ....... , ...................................................... 5-79 6-1 FRZx Control Bits .................................................................................................... 6-24 6-2 SSIZEx Encoding ................................................................................................... 6-28 6-3 DSIZEx Encoding ................................................................................................... 6-29 6-4 REQx Encoding ....................................................................................................... 6-29 6-5 BBx Encoding and Bus Bandwidth ...................................................................... 6-29 6-6 Address Space Encoding ..................................................................................... 6-32 7-1 FRZx Control Bits .................................................................................................... 7-20 7-2 PMx and PT Control Bits ............................................................................... ; ........ 7-23 7-3 B/Cx Control Bits ..................................................................................................... 7-24 7-4 RCSx Control Bits ................................................................................................... 7-26 7-5 TCSx Control Bits ................................................................................................... 7-27 7 -6 MISCx Control Bits ................................................................................................. 7-28 7 -7 TCx Control Bits ...................................................................................................... 7 -29 7 -8 RCx Control Bits ...................................................................................................... 7 -30 7-9 CMx Control Bits ..................................................................................................... 7-38 7-10 SBx Control Bits ...................................................................................................... 7-39 8-1 OCx E ncodi ng ......................................................................................................... 8-17 8-2 FRZx Control Bits .................................................................................................... 8-19 8-3 lEx Encoding ............................................................................................................ 8-21 8-4 POTx Encoding ....................................................................................................... 8-22 8-5 MODEx Encoding ................................................................................................... 8-22 8-6 OCx Encoding ......................................................................................................... 8-22 9-1 Boundary Scan Control Bits ................................................................................. 9-4 9-2 Boundary Scan Bit Definitions ............................................................................. 9-5 9-3 Instructions ............................................................................................................... 9-10 10-1 Memory Access Times at 16.78 MHz ................................................................ 10-7 10-2 Typical Electrical Characteristics ....................................................................... 10-13 MOTOROLA MC68340 USER'S MANUAL xxiii

~I:\'; IIUN 1

DEVICE OVERVIEW The MC68340 is a high-performance 32-bit integrated processor with direct memory access (DMA), combining an enhanced M68000-compatible processor, 32-bit DMA, and other peripheral subsystems on a single integrated circuit. The MC68340 CPU32 delivers 32-bit CISC processor performance from a lower cost 16-bit memory system. The combination of peripherals offered in the MC68340 can be found in a diverse range of microprocessor-based systems, including embedded control and general computing. Systems requiring very high-speed block transfers of data can especially benefit from the MC68340. The MC68340's high level of functional integration results in significant reductions in component count, power consumption, board space, and cost while yielding much higher system reliability and shorter design time. The 3.3-V MC68340V is particularly attractive to applications requiring a very tight power budget. Complete code compatibility with the MC68000 and MC68010 affords the designer access to a broad base of established real- time kernels, operating systems, languages, applications, and development tools-many oriented towards embedded control. SYSTEM NTEGRATION MODU.E (SIM4O) CP\J32 TWO- I ~~TION I 68Ol!O- BASED CHANNa PROCESSOR SERIAL 00 CHIPSaECTS AN) WAIT STATES If i~ I~~I v" INTERMOOULE BUS ~ V ~ I OO::AL I 7 M'ERFACE I A~TION I TWo-CHANNa DMA TIMER TIMER I I CONTROUER IEEE TEST - Figure 1-1. Block Diagram MOTOROlA MC68340 USER'S MANUAL 1-1 all-guides.c om

The primary features of the MC68340, illustrated in Figure 1-1, are as follows:

• High Functional Integration on a Single Piece of Silicon • CPU32-MC68020-Derived 32-Bit Central Processor Unit - Upward Object-Code Compatible with MC68000 and MC68010 - Additional MC68020 Instructions and Addressing Modes - Unique Embedded Control Instructions - Fast Two-Clock Register Instructions-10,045 Dhrystones • Two-Channel Low-Latency DMA Controller for High-Speed Memory Transfers - Single- or Dual-Address Transfers - 32-Bit Addresses and Counters - 8-, 16-, and 32-Bit Data Transfers - 50 Mbyte/Sec Sustained Transfers (12.5 Mbyte/Sec Memory-to-Memory) • Two-Channel Universal Synchronous/Asynchronous ReceiverlTransmitter (USART) - Baud Rate Generators - Modem Control - MC68681/MC2681 Compatible - 9.8 MbitS/Sec Maximum Transfer Rate • Two Independent CounterlTimers - 16-Bit Counter - Up to 8-Bit Prescaler - Multimode Operation - 80-ns Resolution • System Integration Module Incorporates Many Functions Typically Relegated to External PAls, TTL, and ASIC, such as: - System Configuration - System Protection - Chip Select and Wait State Generation - Clock Generation - External Bus Interface - Periodic Interrupt Timer - Interrupt Response - Bus Arbitration - Dynamic Bus Sizing - IEEE 1149.1 Boundary Scan (JTAG) - Up to 16 Discrete 1/0 Lines - Power-On Reset • 32 Address Lines, 16 Data Lines • Power Consumption Control - Static HCMOS Technology Reduces Power in Normal Operation - Low Voltage Operation at 3.3 V ±0.3 V (MC68340V only) - Programmable Clock Generator Throttles Frequency - Unused Peripherals Can Be Turned Off - LPSTOP Provides an Idle State for Lowest Standby Current • 0-16.78 MHz or 0-25.16 MHz Operation • 144-Pin Ceramic Quad Flat Pack (CQFP) or 145-Pin Plastic Pin Grid Array (PGA) As a low voltage part, the MC68340V can operate with a 3.3-V power supply. MC68340 is used throughout this manual to refer to both the low voltage and standard 5-V parts since both are functionally equivalent. 1.1 M68300 FAMILY The MC68340 is one of a series of components in the M68300 family. Other members of the family include the MC68302, MC68330, MC68331, MC68332, and MC68333. 1-2 MC68340 USER'S MANUAL MOTOROLA

The M68300 family of integrated processors and controllers is built on an M68000 core

processor, an on-chip bus, and a selection of intelligent peripherals appropriate for a set of applications. The CPU32 is a powerful central processor with nearly the performance of the MC68020. A system inteoration module incoroorates the external bus interface and . - . many of the smaller circuits that typically surround a microprocessor for address decoding, wait-state insertion, interrupt prioritization, clock generation, arbitration, watchdog timing, and power-on reset timing. Each member of the M68300 family is distinguished by its selection of peripherals. Peripherals are chosen to address specific applications but are often useful in a wide variety of applications. The peripherals may be highly sophisticated timing or protocol engines that have their own processors, or they may be more traditional peripheral functions, such as UARTs and timers. Since each major function is designed in a standalone module, each module might be found in many different M68300 family parts. Driver software written for a module on one M68300 part can be used to run the same module that appears on another part. 1.1.2 Advantages By incorporating so many major features into a single M68300 family chip, a system designer can realize significant savings in design time, power consumption, cost, board space, pin count, and programming. The equivalent functionality can easily require 20 separate components. Each component might have 16-64 pins, totaling over 350 connections. Most of these connections require interconnects or are duplications. Each connection is a candidate for a bad solder jOint or misrouted trace; Each component is another part to qualify, purchase, inventory, and maintain. Each component requires a share of the printed circuit board. Each component draws power-often to drive large buffers to get the signal to another Chip. The cumulative power consumption of all the components must be available from the power supply. The signals between the CPU and a peripheral might not be compatible nor run from the same clock, requiring time delays or other special design considerations. In a M68300 family component, the major functions and glue logic are all properly connected internally, timed with the same clock, fully tested, and uniformly documented. Power consumption stays well under a watt, and a special standby mode drops current well under a milliamp during idle per~9c1s._0nly essential signals are brought out to pins. The primary package is the surface-mount quad flat pack for the smallest possible footprint; pin grid arrays are also available. 1.2 CENTRAL PROCESSOR UNIT The CPU32 is a powerful central processor that supervises system functions, makes decisions, manipulates data, and directs 1/0. A special debugging mode simplifies processor emulation during system debug. MOTOROLA MC68340 USER'S MANUAL 1·3

The CPU32 is an M68000 family processor specially designed for use as a 32-bit core

processor and for operation over the intermodule bus (1MB). Designers used the MC68020 as a model and included advances of the later M68000 family processors, resulting in an instruction execution performance of 4 MIPS (VAX-equivalent) at 25.16 MHz. The powerful and flexible M68000 architecture is the basis of the CPU32. MC68000 (including the MC68HCOOO and the MC68ECOOO) and MC68010 user programs will run unmodified on the CPU32. The programmer can use any of the eight 32-bit data registers for fast manipulation of data and any of the eight 32-bit address registers for indexing data in memory. The CPU32 can operate on data types of single bits, binary-coded decimal (BCD) digits, and 8, 16, and 32 bits. Peripherals and data in memory can reside anywhere in the 4-Gbyte linear address space. A supervisor operating mode protects system-level resources from the more restricted user mode, allowing a true virtual environment to be developed. Flexible instructions for data movement, arithmetic functions, logical operations, shifts and rotates, bit set and clear, conditional and unconditional program branches, and overall system control are supported, including a fast 32 x 32 multiply and 32-bit conditional branches. New instructions, such as table lookup and interpolate and low power stop, support the specific requirements of embedded control applications. Many addressing modes complement these instructions, including predecrement and postincrement, which allow simple stack and queue maintenance and scaled indexed for efficient table accesses. Data types and addreSSing modes are supported orthogonally by all data operations and with all appropriate addressing modes. Position-independent code is easily written. The CPU32 is specially optimized to run with the MC68340's 16-bit data bus. Most instructions execute in one-half the number of clocks compared to the original MC68000, yielding an overall 1.6 times the performance of the same-speed MC68000 and measuring 10,045 Dhrystoneslsec @ 25.16 MHz (6,742 Dhrystoneslsec @ 16.78 MHz). Like all M68000 family processors, the CPU32 recognizes interrupts of seven different priority levels and allows the peripheral to vector the processor to the desired service routine. Internal trap exceptions ensure proper instruction execution with good addresses and data, allow operating system intervention in special situations, and permit instruction tracing. Hardware signals can either terminate or rerun bad memory accesses before instructions process data incorrectly. The CPU32 offers the programmer full 32-bit data processing performance with complete M68000 compatibility, yet with more compact code than is available with RISC processors. The CPU32 is identical in all CPU32-based M68300 family products. 1.2.2 Background Debug Mode A special operating mode is available in the CPU32 in which normal instruction execution is suspended while special on-chip microcode performs the functions of a debugger. 1-4 MC68340 USER'S MANUAL MOTOROLA

Commands are received over a dedicated, high-speed, full-duplex serial interface.

Commands allow the manual reading or writing of CPU32 registers, reading or writing of external memory locations, and diversion to user-specified patch code. This background debug mode permits a much simpler emulation environment while leaving the processor chip in the target system, running its own debugging operations. 1.3 ON-CHIP PERIPHERALS To improve total system throughput and reduce part count, board size, and cost of system implementation, the M68300 family integrates on-chip, intelligent peripheral modules and typical glue logic. These functions on the MC68340 include the SIM40, a DMA controller, a serial module, and two timers. The processor communicates with these modules over the on-chip intermodule bus (1MB). This backbone of the chip is similar to traditional external buses with address, data, clock, interrupt, arbitration, and handshake signals. Because bus masters (like the CPU32 and DMA), peripherals, and the SIM40 are all on the chip, the 1MB ensures that communication between these modules is fully synchronized and that arbitration and interrupts can be handled in parallel with data transfers, greatly improving system performance. Internal accesses across the 1MB may be monitored from outside of the chip, if desired. Each module operates independently. No direct connections between peripheral modules are made inside the chip; however, external connections could, for instance, link a serial output to a DMA control line. Modules and their registers are accessed in the memory map of the CPU32 (and DMA) for easy access by general M68000 instructions and are relocatable. Each module may be assigned its own interrupt level, response vector, and arbitration priority. Since each module is a self-contained design and adheres to the 1MB interface speCifications, the modules may appear on other M68300 family products, retaining the investment in the software drivers for the module. 1.3.1 System Integration Module The MC68340 SIM40 provides the external bus interface for both the CPU32 and the DMA. It also eliminates much of the glue logic that typically supports the microprocessor and its interface with the peripheral and memory system. The SIM40 provides programmable circuits to perform address decoding and chip selects, wait-state insertion, interrupt handling, clock generation, bus arbitration, watchdog timing, discrete 110, and power-on reset timing. A boundary scan test capability is also provided. 1.3.1.1 EXTERNAL BUS INTERFACE. The external bus interface (EBI) handles the transfer of information between the internal CPU32 or DMA controller and memory, peripherals, or other processing elements in the external address space. Based on the MC68030 bus, the external bus provides up to 32 address lines and 16 data lines. Address extensions identify each bus cycle as CPU32 or DMA initiated, supervisor or user privilege level, and instruction or data access. The data bus allows dynamic sizing for 8- or 16-bit bus accesses (plus 32 bits for DMA). Synchronous transfers from the CPU32 or the DMA can be made in as little as two clock cycles. Asynchronous transfers allow the MOTOROLA MC68340 USER'S MANUAL 1-5

memory system to signal the CPU32 or DMA when the transfer is complete and to note

the number of bits in the transfer. An external master can arbitrate for the bus using a three-line handshaking interface. 1.3.1.2 SYSTEM CONFIGURATION AND PROTECTION. The M68000 family of processors is designed with the concept of providing maximum system safeguards. System configuration and various monitors and timers are provided in the MC68340. Power-on reset circuitry is a part of the SIM40. A bus monitor ensures that the system does not lock up when there is no response to a memory access. The bus fault monitor can reset the processor when a catastrophic bus failure occurs. Spurious interrupts are detected and handled appropriately. A software watchdog can pull the processor out of an infinite loop. An interrupt can be sent to the CPU32 with programmable regularity for DRAM refresh, time-of-day clock, task switching, etc. 1.3.1.3 CLOCK SYNTHESIZER. The clock synthesizer generates the clock signals used by all internal operations as well as a clock output used by external devices. The clock synthesizer can operate with an inexpensive 32768-Hz watch crystal or an external oscillator for reference, using an internal phase-locked loop and voltage-controlled oscillator. At any time, software can select clock frequencies from 131 kHz to 16.78 MHz or 25.16 MHz, favoring either low power consumption or high performance. Alternately, an external clock can drive the clock signal directly at the operating frequency. With its fully static HCMOS design, it is possible to completely stop the system clock without losing the contents of the internal registers. 1.3.1.4 CHIP SELECT AND WAIT STATE GENERATION. Four programmable chip selects provide signals to enable external memory and peripheral circuits, providing all handshaking and timing signals with up to 175-ns access times with a 25-MHz system clock (265 ns @ 16.78 MHz). Each chip select signal has an associated base address and an address mask that determine the addressing characteristics of that chip select. Address space and write protection can be selected for each. The block size can be selected from 256 bytes up to 4 Gbytes in increments of 2n. Accesses can be preselected for either 8- or 16-bit transfers. Fast synchronous termination or up to three wait states can be programmed, whether or not the chip select signals are used. External handshakes can also signal the end of a bus transfer. A system can boot from reset out of 8-bit-wide memory, if desired. 1.3.1.5 INTERRUPT HANDLING. Seven input signals are provided to trigger an external interrupt, one for each of the seven priority levels supported. Seven separate outputs can indicate the priority level of the interrupt being serviced. An input can direct the processor to a default service routine, if desired. Interrupts at each priority level can be preprogrammedto go to the default service routine. For maximum flexibility, interrupts can be vectored to the correct service routine by the interrupting device. 1.3.1.6 DISCRETE 1/0 PINS. When not used for other functions, 16 pins can be programmed as discrete input or output lines. Additionally, in other peripheral modules, pins for otherwise unused functions can often be used for general inpuVoutput. 1-6 MC68340 USER'S MANUAL MOTOROLA all-guides.c om

1.3.1.7 IEEE 1149.1 TEST ACCESS PORT. To aid in system diagnostics, the MC68340

includes dedicated user-accessible test logic that is fully compliant with the IEEE 1149.1 standard for boundary scan testability, often referred to as JTAG (Joint Test Action Group). 1.3.2 Direct Memory Access Module The most distinguishing MC68340 characteristic is the high-speed 32-bit DMA controller, used to quickly move large blocks of data between internal peripherals, external peripherals, or memory without processor intervention. The DMA module consists of two, independent, programmable channels. Each channel has separate request, acknowledge, and done signals. Each channel can operate in a single-address or a dual-address (flyby) mode. In single-address mode, only one (the source or the destination) address is provided, and a peripheral device such as a serial communications controller receives or supplies the data. An external request must start a single-address transfer. In this mode, each channel supports 32 bits of address and 8, 16, or 32 bits of data. In dual-address mode, two bus transfers occur, one from a source device and the other to a destination device. Dual-address transfers can be started by either an internal or external request. In this mode, each channel supports 32 bits of address and 8 or 16 bits of data (32 bits require external logic). The source and destination port size can be selected independently; when they are different, the data will be packed or unpacked. An 8-bit disk interface can be read twice before the concatenated 16-bit result is passed into memory. Byte, word, and long-word counts up to 32 bits can be transferred. All addresses and transfer counters are 32 bits. Addresses increment or remain constant, as programmed. The DMA channels support two external request modes, burst transfer and cycle steal. Internal requests can be programmed to occupy 2S, SO, 7S, or 100 percent of the data bus bandwidth. Interrupts can be programmed to postpone DMA completion. The DMA module can sustain a transfer rate of 12.S Mbytes/sec in dual-address mode and nearly SO Mbytes/sec in single-address mode @ 2S.16 MHz (8.4 and 33.3 Mbytes/sec @ 16.78 MHz, respectively). The DMA controller arbitrates with the CPU32 for the bus in parallel with existing bus cycles and is fully synchronized with the CPU32, eliminating all delays normally associated with bus arbitration by allowing DMA bus cycles to butt seamlessly with CPU bus cycles. 1.3.3 Serial Module Most digital systems use serial 1/0 to communicate with host computers, operator terminals, or remote devices. The MC68340 contains a two-channel, full-duplex USART. An on-chip baud rate generator provides standard baud rates up to 76.8k baud independently to each channel's receiver and transmitter. The module is functionally equivalent to the MC68681/MC2681 DUART. MOTOROLA MC68340 USER'S MANUAL 1-7

Each communication channel is completely independent. Data formats can be 5, 6, 7, or 8

bits with even, odd, or no parity and stop bits up to 2 in 1/16 increments. Four-byte receive buffers and two-byte transmit buffers minimize CPU service calls. A wide variety of error detection and maskable interrupt capability is provided on each channel. Full-duplex, autoecho loopback, local loopback, and remote loopback modes can be selected. Multidrop applications are supported. A 3.6864-MHz crystal drives the baud rate generators. Each transmit and receive channel can be programmed for a different baud rate, or an external 1 x and 16x clock input can be selected. Full modem suppvrt is provided with separate request-to-send (RTS) and clear- to-send (CTS) signals for each channel. One channel also provides service request signals. The two serial ports can sustain rates of 9.8 Mbps with a 25-MHz system clock in 1x mode, 612 kbps in 16x mode (6.5 Mbps and 410 kbps@ 16.78 MHz). 1.3.4 Timer Modules Timers and counters are used in a system to monitor elapsed time, generate waveforms, measure signals, keep time-of-day clocks, initiate DRAM refresh cycles, count events, and provide "time slices" to ensure that no task dominates the activity of the processor. A counter that counts clock pulses makes a timer, which is most useful when it causes certain actions to occur in response to reaching desired counts. The MC68340 has two, identical, versatile, on-chip counter/timers as well as a simple timer in the SIM40. These general-purpose counterltimers can be used for preCisely timed events without the errors to which software-based counters and timers are susceptible- e.g., errors caused by dynamic memory refreshing, DMA cycle steals, and interrupt servicing. The programmable timer operating modes are input capture, output compare, square-wave generation, variable duty-cycle square-wave generation, variable-width single-shot pulse generation, event counting, period measurement, and pulse-width measurement. Each timer consists of a 16-bit countdown counter with an 8-bit countdown prescaler for a composite 24-bit resolution. The two timers can be externally cascaded for a maximum count width of 48 bits. The counterltimer can be clocked by the internal system clock generated by the SIM40 (+2) or by an external clock input. Either the processor or external stimuli can trigger the starting and stopping of the counter. When a counter reaches a predetermined value, either an external output signal can be driven, or an interrupt can be made to the CPU32. The finest resolution of the timer is 80 ns with a 25-MHz system clock (125 ns@ 16.78 MHz). 1.4 POWER CONSUMPTION MANAGEMENT The MC68340 is very power efficient due to its advanced 0.8-1l HCMOS process technology and its static logic design. The resulting power consumption is typically 900 mW in full operation @ 25 MHz (650 mW @ 16.78 MHz)-far less than the comparable discrete component implementation the MC68340 can replace. For applications employing reduced voltage operation, selection of the MC68340V, which 1-8 MC68340 USER'S MANUAL MOTOROLA

requires only a 3.3-V power supply, reduces current consumption by 40-60% in all modes

of operation (as well as reducing noise emissions). The MC68340 has many additional methods of dynamically controlling power consumption during operation. The frequency of operation can be lowered under software ~nntrnl tn r.ol"h 11".0 I"llrr.on+ I"'l'\n~I.""n+jn" , . ...,hn .... _,..,"_ ... ~,.., .... ,.., ..... : .... I,.. ........ _~: ... :_ .... I I..JI_ :_4 ____ ' _~ ______ - _______ .. _ .... __ '. __ "'1"".'_" ........... ,..._ •• _ •• ,._ •• _- ,- IV_,"" _II"'V""I. IUIV "'"VIII",-1 peripheral modules can be turned off to save power (5-10% each). Running a special low power stop (LPSTOP) instruction shuts down the active circuits in the CPU and peripheral modules, halting instruction execution. Power consumption in this standby mode is reduced to about 350 ~W. Processing and power consumption can be resumed by resetting the part or by generating an interrupt with the SIM40's periodic interrupt timer. 1.5 PHYSICAL The MC68340 is available as 0-16.78 MHz and 0-25.16 MHz, O°C to +70°C and -40°C to +85°C, and 5.0 V ±5% and 3.3 V ±0.3 supply voltages (reduced frequencies at 3.3 V). Thirty-two power and ground leads minimize ground bounce and ensure proper isolation of different sections of the chip, including the clock oscillator. A 144 pins are used for signals and power. The MC68340 is available in a gull-wing ceramic quad flat pack (CQFP) with 25.6-mil (0.001-in) lead spacing or a 15 x 15 plastic pin grid array (PPGA) with 0.1-in pin spacing. 1.6 COMPACT DISC-INTERACTIVE The MC68340 was designed to meet the needs of many markets, including compact disc- interactive (CD-I). CD-I is an emerging standard for a publishing medium that will bring multimedia to a broad general audience-the consumer. CD-I players combine television and stereo systems as output devices, with interactive control using a TV remote-control- like device to provide a multimedia experience selected from software ''titles'' contained in compressed form on standard compact discs. The highly integrated MC68340 is ideal as the central processor for CD-I players. It provides the M68000 microprocessor code compatibility and OMA functions required by the CD-J Green Book specification as well as many other useful on-Chip functions for a very cost-effective solution. The extra demands of full-motion video CD-I systems make the best use of the MC68340 high performance. The MC68340 is CD-I compliant and has been CD-I qualified. With its low voltage operation, the MC68340V is the only practical choice for portable CD-I. MOTOROLA MC68340 USER'S MANUAL 1·9

1.7 MORE INFORMATION

The following table lists available documentation related to the MC68340: Document Number Document Name BR1114/D M68300 Integrated Processor Family MC68340P/D MC68340 Product Brief MC68340UM/AD MC68340 User's Manual M68000PM/AD M68000 Family Programmer's Reference Manual AN1063/D DRAM Controller for the MC68340 AN453 Software Implementation of SPI on the MC68340 BR5731D M68340 Evaluation System Product Brief BR7291D The 68K Source BR1407/D 3.3 Volt Logic and Interface Circuits 1-10 MC68340 USER'S MANUAL MOTOROLA

;:)I:.v I IVN ~

SIGNAL DESCRIPTIONS This section contains brief descriptions of the MC68340 input and output signals in their functional groups as shown in Figure 2-1. A23-AO 015-00 FC3-FCO RESET BERR HAlT AS os ANi SIZ1 SIZO DSACK1 DSACKO BR BG BGACK RMC IR06IPORT B6 IR05lPORT B5 IR03lPORT B3 CS3IIR04,pORT B4 CS2llR02JPORT B2 CS1/IR01,pORT B1 CSO/AVEC MODCK,f>ORT so MOTOROLA SYSTEM INTEGRATION MODULE CPU32 CORE TWO-CHANNEL DMA CONTROLLER 1MB @gzo@uz I~ l""IUi I'" I~ I~ 0:_ 0:<0 C.G:IOCOo TWO-CHANNEL SERiAl I/O OUTPUT PORT TIMER TIMER MODULE MODULE Figure 2-1. Functional Signal Groups MC68340 USER'S MANUAL RxDA TxDA CTSA RxDB TxDB CTSB TxRDYNOP6 RxRDYAIFFULLNOP4 RTSBtOP1 RTSNOPO 2-1 .. all-guides.c om

2.1 SIGNAL INDEX

The input and output signals for the MC68340 are listed in Table 2-1. The name, mnemonic, and brief functional description are presented. For more detail on each signal, refer to the signal paragraph. Guaranteed timing specifications for the signals listed in Table 2-1 can be found in Section 11 Electrical Characteristics. Table 2-1. Signal Index Input! Signal Name Mnemonic Function Output Address Bus A23-AO Lower 24 bits of the address bus Out Address Bus/Port A7-AO/ A31-A24 Upper eight bits of the address bus, parallel I/O port, or Out/I/O/Out Interrupt Acknowledge interrupt acknowledge lines ,Data Bus 015-00 The IS-bit data bus used to transfer byte or word data I/O Function Codes FC3-FCO Identify the processor stale and the address space of the Out cu rrent bus cycle Chip Select 3-1/ CS3-CST Enables peripherals at programmed addresses, interrupt Out/In/ Interrupt Request Level! priority level to the CPU32, or parallel I/O port I/O Port B4, B2, Bl Chip Select O/Autovector CSO Enables peripherals at programmed addresses or Out/In requests an automatic vector Bus Request BR Indicates that an external device requires bus mastership In Bus Grant BG Indicates that current bus cycle is complete and the Out MCS8340 has relinquished the bus Bus Grant Acknowledge BGACK Indicates that an external device has assumed bus In mastership Data and Size DSACK1, Provides asynchronous data transfers and dynamic bus In Acknowledge DSACKO sizing Read-Modify-Write Cycle RMC Identifies the bus cycle as part of an indivisible read- Out modify-write operation Address Strobe AS Indicates that a valid address is on the address bus Out Data Strobe OS During a read cycle, OS indicates that an external device Out should place valid data on the data bus, During a write cycle, OS indicates that valid data is on the data bus. Size SIZ1, SIZO Indicates the number of bytes remaining to be transferred Out for this cycle Read/Write R/W Indicates the direction of data transfer on the bus Out Interrupt Request Level/ IR07,IROS, Provides an interrupt priority level to the CPU32 or In/I/O Port B7, BS, B5, B3 IR05, IR03 becomes a parallel I/O port Reset RESET System reset I/O Halt HALT Suspends external bus activity I/O Bus Error BERR Indicates an invalid bus operation is being attempted In System Clock CLKOUT System clock out Out Crystal Oscillator EXTAL, XTAL Connections for an external crystal or oscillator to the In, Out internal oscillator circuit External Filter Capacitor XFC Connection pin for an external capacitor to filter the circuit In of the phase-locked loop 2-2 MC68340 USER'S MANUAL MOTOROLA

Table 2-1. Signal Index (Continued)

Inpull Signal Name Mnemonic Function Output Clock Mode Select! MODCK Selects the source of the internal system clock upon reset InlllO Port BO or becomes a parallel 110 port Instruction Fetchl iFETCH/DSI Indicates when the CPU32 is performing an instruction Outlln Development Serial In word prefetch and when the instruction pipeline has been flushed or provides background debug mode serial in • Instruction Pipel IPIPEIDSO Used to track movement of words through the instruction OutlOut Development Serial Out pipeline or provides background debug mode serial out BreakpointlDevelopment BKPT/DSCLK Signals a hardware breakpoint to the CPU32 or provides In/- Serial Clock background debug mode serial clock Freeze FREEZE Indicates that the CPU32 has entered background debug Out mode Transmit Data TxDA, TxDB Transmitter serial data output from the serial module Out Clear-to-Send CTSA,CTSB Serial module clear-to-send inputs In Request-to-Sendl RTSB,RTSA Channel request-to-send outputs or discrete outputs OullOut OP1,OPO Serial Crystal Oscillator X1,X2 Connections for an external crystal to the serial module internal oscillator circuit Serial Clock SCLK External serial module clock input In Transmitter ReadylOP6 TxRDYA Indicates transmit buffer has a character or becomes a OutlOut parallel output Receiver Readyl RxRDYA Indicates receive buffer has a character, the receiver OuVOutlOut FIFO FulVOP4 FIFO buffer is full or becomes a parallel output DMARequesl DRE02, Input that starts a DMA process In DRE01 DMA Acknowledge DACK2, Output that signals an access during DMA Out OACK1 DMA Done OONE2, Bi-directional signal that indicates the last transfer VO OONE1 Timer Gate TGATE2, Counter enable input to timer In TGATE1 Timer Input TIN2, TIN1 Time reference input to timer In Timer Output TOUT2, Output waveform from timer Out TOUT1 Test Clock TCK Provides a clock for IEEE 1149.1 test logic In Test Mode Select TMS Controls test mode operations In Test Data In TOI Shifts in instructions and test data In Test Data Out TOO Shifts out instructions and test data Out Synchronizer Power VCCSYN Quiet power supply to VCO; also used to control - synthesizer mode after reset. System Power Supply VCC,GND Power supply and ground to the MC68340 - and Ground MOTOROLA MC68340 USER'S MANUAL 2-3

The terms assert and negate are used throughout this section

to avoid confusion when dealing with a mixture of active-low and active-high signals. The term assert or assertion indicates that a signal is active or true, independent of the level represented by a high or low voltage. The term negate or negation indicates that a signal is inactive or false. 2.2 ADDRESS BUS The address bus signals are outputs that define the address of the byte (or the most significant byte) to be transferred during a bus cycle. The MC68340 places the address on the bus at the beginning of a bus cycle. The address is valid while AS is asserted. The address bus consists of the following two groups. Refer to Section 3 Bus Operation for information on the address bus and its relationship to bus operation. 2.2.1 Address Bus (A23-AO) These three-state outputs (along with A31-A24) provide the address for the current bus cycle, except in the CPU address space. 2.2.2 Address Bus (A31-A24) These pins can be programmed as the most significant eight address bits, pqrt A parallel I/O, or interrupt acknowledge signals. These pins can be used for more than one of their multiplexed functions as long as the external demultiplexing circuit properly resolves interaction between the different functions. A31-A24 These pins can function as the most significant eight address bits. Port A7-AO These eight pins can serve as a dedicated parallel I/O port. See Section 4 System Integration Module for more information on programming these pins. IACK7-IACK1 The MC68340 asserts one of these pins to indicate the level of an external interrupt during an interrupt acknowledge cycle. Peripherals can use the IACKx signals instead of monitoring the address bus and function codes to determine that an interrupt acknowledge cycle is in progress and to obtain the current interrupt level. 2.3 DATA BUS (015-00) This bidirectional, nonmultiplexed, parallel bus contains the data being transferred to or from the MC68340. A read or write operation may transfer 8 or 16 bits of data (one or two bytes) in one bus cycle. During a read cycle, the data is latched by the MC68340 on the 2-4 MC68340 USER'S MANUAL MOTOROLA

last falling edge of the clock for that bus cycle. For a write cycle, all 16 bits of the data bus

are driven, regardless of the port width or operand size. The MC68340 places the data on the data bus approximately one-half clock cycle after AS is asserted in a write cycle. 2.4 FUNCTION CODES (FC3-FCO) These signals are outputs that indicate one of 16 address spaces to which the address applies. Fifteen of these spaces are designated as either user or supervisor, program or data, and normal or direct memory access (OMA) spaces. One other address space is designated as CPU space to allow the CPU32 to acquire specific control information not normally associated with read or write bus cycles. The function code signals are valid while AS is asserted. See Table 2-2 for more information. Table 2-2. Address Space Encoding Function Code Bits 3 2 1 0 Address Spaces 0 0 0 0 Reserved (Motorola) 0 0 0 1 User Data Space 0 0 1 0 User Program Space 0 0 1 1 Reserved (User) 0 1 0 0 Reserved (Motorola) 0 1 0 1 Supervisor Data Space 0 1 1 0 Supervisor Program Space 0 1 1 1 CPU Space 1 x x x DMA Space 2.5 CHIP SELECTS (CS3-CSO) These pins can be programmed to be chip select output signals, port 8 parallel I/O and autovector input, or additional interrupt request lines. Refer to Section 4 System Integration Module for more information on these signals. CS3-CSO The chip select output signals enabl,e peripherals at programmed addresses. These signals are inactive high (not high impedance) after reset. CSO is the chip select for a boot ROM containing the reset vector and initialization program. It functions as the boot chip select immediately after reset. IRQ4, IRQ2, IRQ1 Interrupt request lines are external interrupt lines to the CPU32. These additional interrupt request lines are selected by the FIRQ bit in the module configuration register. MOTOROLA MC68340 USER'S MANUAL 2-5

Port B4, B2, B1, A\i'EC'

This signal group functions as three bits of parallel I/O and the autovector input. AVEC requests an automatic vector during an interrupt acknowledge cycle. 2.6 INTERRUPT REQUEST LEVEL (IRQ7, IRQ6. IRQ5. IRQ3) These pins can be programmed to be either prioritized interrupt request lines or port B parallel VO. ilm7.1RQ6, IRQ5. IRQ3 IRW, the highest priority, is nonmaskable. IRQ6-IRQ1 are internally maskable interrupts. Refer to Section 5 CPU32 for more information on interrupt request lines. Port B7, B6, B5, B3 These pins can be used as port B parallel I/O. Refer to Section 4 System Integration Module for more information on parallel I/O signals. 2.7 BUS CONTROL SIGNALS These signals control the bus transfer operations of the MC68340. Refer to Section 3 Bus Operation for more information on these signals. 2.7.1 Data and Size Acknowledge (DSACK1. DSACKO) These two active-low input signals allow asynchronous data transfers and dynamic data bus sizing between the MC68340 and external devices as listed in Table 2-3. During bus cycles. external devices assert DSACK1 and/or DSACKO as part of the bus protocol. During a read cycle, this signals the MC68340 to terminate the bus cycle and to latch the data. During a write cycle, this indicates that the external device has successfully stored the data and that the cycle may terminate. Table 2·3. DSACKx Encoding ~ DSACKI) Result 1 1 Insert Wait States in Current Bus Cycle 1 0 Complete Cycle-Data Bus Port Size Is 8 Bits 0 1 Complete Cycle-Data Bus Port Size Is 16 Bits 0 0 Reserved-Defaults to 16·Bit Port Size Can Be Used for 32·Bit DMA Cycles 2.7.2 Address Strobe (AS) AS is an outp.ut timing signal that indicates the validity of both an address on the address bus and many. contr,ol signals. AS is asserted approximately one-half clock cycle after the beginning of a bus cycle. MC68340 USER'S MANUAL MOTOROLA all-guides.c om

2.7.3 Data Strobe (oS)

OS is an output timing signal that applies to the data bus. For a read cycle, the MC68340 asserts OS and AS simultaneously to signal the external device to place data on the bus. For a write cycle, OS signals to the external device that the data to be written is valid. The MC68340 asserts OS approximately one clock cycle after the assertion of AS during a write cycle. 2.7.4 Transfer Size (SIZ1, SIZO) These output signals are driven by the bus master to indicate the number of operand bytes remaining to be transferred in the current bus cycle as noted in Table 2-4. Table 2-4. SIZx Signal Encoding SlZ1 SIZO Transfer Size 0 1 Byte 1 0 Word 1 1 Three Byte 0 0 Long Word 2.7.5 ReadlWrite (RIW) This active-high output signal is driven by the bus master to indicate the direction of a data transfer on the bus. A logic one indicates a read from a slave device; a logic zero indicates a write to a slave device. 2.8 BUS ARBITRATION SIGNALS The following signals are the bus arbitration control signals used to determine the bus master. Refer to Section 3 Bus Operation for more information on these signals. 2.8.1 Bus Request (BR) This active-low input signal indicates that an external device needs to become the bus master. 2.8.2 Bus Grant (BG) Assertion of this active-low output signal indicates that the MC68340 has relinquished the bus. 2.8.3 Bus Grant Acknowledge (BGACK) Assertion of this active-low input indicates that an external device has become the bus master. MOTOROLA MC68340 USER'S MANUAL 2-7 III

2.8.4 Read-Modify-Write Cycle (RMC)

This output signal identifies the bus cycle as part of an indivisible read-modify-write operation. It remains asserted during all bus cycles of the read-modify-write operation to indicate that bus ownership cannot be transferred. 2.9 EXCEPTION CONTROL SIGNALS These signals are used by the MC68340 to recover from an exception. 2.9.1 Reset (RESET) This active-low, open-drain, bidirectional Signal is used to initiate a system reset. An external reset signal (as well as a reset from the SIM40) resets the MC68340 and all external devices. A reset signal from the CPU32 (asserted as part of the RESET instruction) resets external devices; the internal state of the CPU32 is not affected. The on-chip modules are reset, except for the SIM40. However, the module configuration register for each on-chip module is not altered. When asserted by the MC68340, this signal is guaranteed to be asserted for a minimum of 512 clock cycles. Refer to Section 3 Bus Operation for a description of bus reset operation and Section 5 CPU32 for information about the reset exception. 2.9.2 Halt (HAL 1) This active-low, open-drain, bidirectional signal is asserted to suspend external bus activity, to request a retry when used with BERR, or to perform a single-step operation. As an output, HALT indicates a double bus fault by the CPU32. Refer to Section 3 Bus Operation for a description of the effects of HALT on bus operation. 2.9.3 Bus Error (BEAR) This active-low input signal indicates that an invalid bus operation is being attempted or, when used with HALT, that the processor should retry the current cycle. Refer to Section 3 Bus Operation for a description of the effects of BERR on bus operation. 2.10 CLOCK SIGNALS These signals are used by the MC68340 for controlling or generating the system clocks. See Section 4 System Integration Module for more information on the various clocking methods and frequencies. 2.10.1 System Clock (CLKOUT) This output signal is the system clock output and is used as the bus timing reference by external devices. CLKOUT can be varied in frequency or slowed in low power stop mode to conserve power. 2-8 MC68340 USER'S MANUAL MOTOROLA

2.10.2 Crystal Oscillator (EXT AL, XTAL)

These two pins are the connections for an external crystal to the internal oscillator circuit. If an external oscillator is used, it should be connected to EXTAL, with XTAL left open. 2.10.3 External Filter Capacitor (XFC) This pin is used to add an external capacitor to the filter circuit of the phase-locked loop. ~ The capaCitor should be connected between XFC and VCCSYN. .. 2.10.4 Clock Mode Select (MODCK) This pin selects the source of the internal system clock during reset. After reset, it can be programmed to be port B parallel I/O. MOOCK The state of this active-high input signal during reset selects the source of the internal system clock. If MOOCK is high during reset, the internal VOltage-controlled oscillator (VCO) furnishes the system clock in crystal mode. If MOOCK is low during reset, an external clock source at the EXTAL pin furnishes the system clock output in external clock mode. Port 80 This pin can be used as a port B parallel I/O. 2.11 INSTRUMENTATION AND EMULATION SIGNALS These signals are used for test or software debugging. See Section 5 CPU32 for more information on these signals and background debug mode. 2.11.1 Instruction Fetch (I FETCH) This pin functions as IFETCH in normal operation and as OSI in background debug mode. IFETCH This active-low output signal indicates when the CPU32 is performing an instruction word prefetch and when the instruction pipeline has been flushed. OSI This development serial input Signal helps to provide serial communications for background debug mode. 2.11.2 Instruction Pipe (IPIPE) This pin functions as IPIPE in normal operation and as OSO in background debug mode. MOTOROLA MC68340 USER'S MANUAL 2-9

This active-low output signal is used to track movement of words through the instruction

pipeline. DSO This development serial output signal helps to provide serial communications for background debug mode. 2.11.3 Breakpoint (BKPT) This pin functions as BKPT in normal operation and as DSCLK in background debug mode. BKPT This active-low input signal is used to signal a hardware breakpoint to the CPU32. DSCLK This development serial clock input helps to provide serial communications for background debug mode. 2.11.4 Freeze (FREEZE) Assertion of this active-high output signal indicates that the CPU32 has acknowledged a breakpoint and has initiated background mode operation. 2.12 DMA MODULE SIGNALS The following signals are used by the direct memory access (DMA) controller module to provide external handshake for either a source or destination. See Section 6 DMA Module for additional information on these signals. 2.12.1 DMA Request (DREQ2, DREQ1) This active-low input is asserted by a peripheral device to request an operand transfer between that peripheral and memory. The assertion of DREQx starts the DMA process. The assertion level in external burst mode is level sensitive; in external cycle steal mode, it is falling-edge sensitive. 2.12.2 DMA Acknowledge (DACK2, DACK1) This active-low output is asserted by the DMA to signal to a peripheral that an operand is being transferred in response to a previous transfer request. 2.12.3 DMA Done (DONE2, DONE1) This active-low bidirectional signal is asserted by the DMA or a peripheral device during any DMA bus cycle to indicate that the last data transfer is being performed. DONEx is an active input in any mode. As an output, it .is only active in external request mode. An external pullup resistor is required even during operation in the internal request mode. 2-10 MC68340 USER'S MANUAL MOTOROLA

2.13 SERIAL MODULE SIGNALS

The following signals are used by the serial module for data and clock signals. See Section 7 Serial Module for more information on these signals. 2.13.1 Serial Crystal Oscillator (X2, X1) ~ These pins furnish the connection to a crystal or external clock, which must be supplied .. when using the baud rate generator. An external clock is connected to the X1 pin; X2 is left floating. 2.13.2 Serial External Clock Input (SCLK) This input can be used as the external clock input for channel A or channel B, bypassing the baud rate generator. 2.13.3 Receive Data (RxDA, RxDB) These Signals are the receiver serial data input for each channel. Data received on this signal is sampled on the rising edge of the clock source, with the least significant bit received first. 2.13.4 Transmit Data (TxDA, TxDB) These Signals are the transmitter serial data output for each channel. The output is held high (,mark' condition) when the transmitter is disabled, idle, or operating in the local loopback mode. Data is shifted out on this signal at the falling edge of the clock source, with the least Significant bit transmitted first. 2.13.5 Clear to Send (CTSA, CTSB) These active-low signals can be programmed as the clear-to-send inputs for each channel. 2.13.6 Request to Send (RTSA, RTSB) These active-low Signals can be programmed as request-to-send outputs or used as discrete outputs. RTSB, R'fSA When used for this function, these signals function as the request-to-send outputs. OP1,OPO When useti for this function, these outputs are controlled by the value of bit 1 and bit 0, respectively, in the output port data registers. 2.13.7 Transmitter Ready (TxRDYA) This active-low output can be programmed as the channel A transmitter ready status indicator or used as a discrete output. MOTOROLA MC68340 USER'S MANUAL 2-11 all-guides.c om

When used for this function, this signal reflects the complement of the status of bit 2 of

the channel A status register. This signal can be used to control parallel data flow by acting as an interrupt to indicate when the transmitter contains a character. OPS When used for this function, this output is controlled by bit 6 in the output port data registers. 2.13.S Receiver Ready (RxRDYA) This active-low output signal can be programmed as the channel A receiver ready, channel A FIFO full indicator, or a dedicated parallel output. RxRDYA When used for this function, this signal reflects the complement of the status of bit 1 of the interrupt status register. This signal can be used to control parallel data flow by acting as an interrupt to indicate when the receiver contains a character. FFULLA When used for this function, this signal reflects the complement of the status of bit 1 of the interrupt status register. This signal can be used to control parallel data flow by acting as an interrupt to indicate when the receiver FIFO is full. OP4 When used for this function, this output is controlled by bit 4 in the output port data registers. 2.14 TIMER SIGNALS The following external signals are used by the timer modules. See Section 8 Timer Modules for additional information on these signals. 2.14.1 Timer Gate (TGATE2, TGATE1) These active-low inputs can be programmed to enable and disable the counters and prescalers. TGATEx can also be programmed as a simple input. 2.14.2 Timer Input (TIN2, TIN1) These inputs can be programmed as clocks that cause events to occur in the counters and prescalers. 2.14.3 Timer Output (TOUT2, TOUT1) These outputs drive the various output waveforms generated by the timers. 2-12 MC68340 USER'S MANUAL MOTOROLA

2.15 TEST SIGNALS

The following signals are used with the on-board test logic defined by the IEEE 1149.1 standard. See Section 9 IEEE 1149.1 Test Access Port for more information on the use of these signals. 2.15.1 Test Clock (TCK) This input provides a clock for on-board test logic defined by the IEEE 1149.1 standard. 2.15.2 Test Mode Select (TMS) This input controls test mode operations for on-board test logic defined by the IEEE 1149.1 standard. 2.15.3 Test Data In (TOI) This input is used for serial test instructions and test data for on-board test logic defined by the IEEE 1149.1 standard. 2.15.4 Test Data Out (TOO) This output is used for serial test instructions and test data for on-board test logic defined by the IEEE 1149.1 standard. 2.16 SYNTHESIZER POWER (VCCSYN) This pin supplies a quiet power source to the VCO to provide greater frequency stability. It is also used to control the synthesizer mode after reset. See Section 4 System Integration Module for more information. 2.17 SYSTEM POWER AND GROUND (VCC AND GNO) These pins provide system power and ground to the MC68340. Multiple pins are provided for adequate current capability. All power supply pins must have adequate bypass capacitance for high-frequency noise suppression. 2.18 SIGNAL SUMMARY Table 2-5 presents a summary of all the signals discussed in the preceding paragraphs. MOTOROLA MC68340 USER'S MANUAL 2-13 ..

Table 2-5. Signal Summary

Signal Name Mnemonic Input/Output Active State Three·State Address Bus A23-AO Out - Yes Address Bus Port A7-AO/ A31-A24 Out/l!O/Out -/-/Low Yes Interrupt Acknowledge Data Bus 015-00 I/O - Yes Function Codes FC3-FCO Out - Yes Chip Select 3/lnterrupt Request CS~ Out/In/I/O Low/Low/- No Level/Port B4, B2, B1 Chip Select O/Autovector eso Out/In Low/Low No Bus Request BR In Low - Bus Grant BC3 Out Low No Bus Grant Acknowledge l3GACR In Low - Data and Size Acknowledge DSACJ<1, DSACKO In Low - Read-Modify-Write Cycle l'lMC Out Low Yes Address Strobe AS Out Low Yes Data Strobe OS Out Low Yes Size SIZ1, SIZO Out - Yes Read/Write R/W Out High/Low Yes Interrupt Request Level/ IR07, IROS, TA05, In/I/O Low/- - Port B7, B6, B5, B3 IR03 Reset RESET I/O Low No Halt HALT I/O Low No Bus Error BERR In Low - System Clock CLKOUT Out - No Crystal Oscillator EXTAL, XTAL In, Out - - External Filter Capacitor XFC In - - Clock Mode Select/Port BO MODCK In/I/O -/- - Instruction Fetch/ WE'fCH/DSI Out/In Low/- No/- Development Serial In I nstruction Pipe/ \PIPE/DSO Out/Out Low/- No/- Development Serial Out Breakpoint! aKPf/DSCLK In/In Low/- -/- Development Serial Clock Freeze FREEZE Out High No Receive Data RxDA,RxDB In - - 2-14 MC68340 USER'S MANUAL MOTOROLA

Table 2-5. Signal Summary (Continued)

Signal Name Mnemonic Input/Output Active State Three·State Transmit Data TxDA,TxDB Out - No Clear-to-Send CTSA, c;rss In Low - Request-to-Send/ RTSB,RTSA Out/Out Low/- No OP1,OPO Serial Clock SCLK In - - .. Transmitter Ready/OP6 TxRDYA Out/Out Low/- No Receiver Ready/ RxRDYA Out/Out/Out Low/Low/- No FIFO Full/OP4 DMA Request DRrn2,15REQf In Low - DMA Acknowledge DACK2, DACK1 Out Low No DMADone OONE2, OONE1 I/O Low No Timer Gate TGATE2, TGATE1 In Low - Timer Input TIN2, TIN1 In - - Timer Output TOUT2, TOUT1 Out - Yes Test Clock TCK In - - Test Mode Select TMS In High - Test Data In TOI In High - Test Data Out TOO Out High - Synchronizer Power VCCSYN - - - System Power Supply and VCC,GNO - - - Return MOTOROLA MC68340 USER'S MANUAL 2-15

This section provides a functional description of the bus, the signals that control it. and the.

bus cycles provided for data transfer operations. It also describes the error and halt conditions, bus arbitration, and reset operation. Operation of the external bus is the same whether the MC68340 or an external device is the bus master; the names and descriptions of bus cycles are from the viewpoint of the bus master. For exact timing specifications, refer to Section 11 Electrical Characteristics. The MC68340 architecture supports byte, word, and long-word operands allowing access to 8- and 16-bit data ports through the use of asynchronous cycles controlled by the SIZ1/SIZO outputs and DSACK1/DSACKO inputs. The MC68340 requires word and long- word operands to be located in memory on word boundaries. The only type of transfer that can be performed to an odd address is a single-byte transfer, referred to as an odd-byte transfer. For an 8-bit port, multiple bus cycles may be required for an operand transfer due to either misalignment or a word or long-word operand. 3.1 BUS TRANSFER SIGNALS The bus transfers information between the MC68340 and external memory or a peripheral device. External devices can accept or provide 8 bits or 16 bits in parallel and must follow the handshake orotocol described in this section. The maximum number of bit!': ::lccenterl or provided during a bus transfer is defined as the port width. The MC68340 contains an address bus that specifies the address for the transfer and a data bus that transfers the data. Control signals indicate the beginning and type of the cycle as well as the address space and size of the transfer. The selected device then controls the length of the cycle with the signal(s) used to terminate the cycle. Strobe signals, one for the address bus and another for the data bus, indicate the validity of the address and provide timing information for the data. Both asynchronous and synchronous operation is possible for any port width. In asynchronous operation, the bus and control input Signals are internally synchronized to the MC68340 clock, introducing a delay. This delay is the time required for the MC68340 to sample an input signal, synchronize the input to the internal clocks, and determine whether it is high or low. In synchronous mode, the bus and control input signals must be timed to setup and hold times. Since no synchronization is needed, bus cycles can be completed in three clock cycles in this mode. Additionally, using the fast-termination option of the Chip select sigl".als, two-clock operation is possible. Furthermore, for all inputs, the MC68340 latches the level of the input during a sample window around the falling edge of the clock signal. This window is illustrated in Figure 3-1, where tsu and th are the input setup and hold times, respectively. To ensure that an input signal is recognized on a specificjalling edge of the clock, that input must be stable during MOTOROLA MC68340 USER'S MANUAL 3-1

the sample window. If an input makes a transition during the window time period, the level

recognized by the MC68340 is not predictable; however, the MC68340 always resolves the latched level to either a logic high or low before using it. In addition to meeting input setup and hold times for deterministic operation, all input signals must obey the protocols described in this section. ClKOUT EXT L-,-l SAMPLE WINDOW Figure 3-1. Input Sample Window NOTE The terms assert and negate are used throughout this section to avoid confusion when dealing with a mixture of active-low and active-high signals. The term assert or assertion indicates that a signal is active or true independent of the level represented by a high or low voltage. The term negate or negation indicates that a signal is inactive or false. 3.1.1 Bus Control Signals The MC68340 initiates a bus cycle by driving the A31-AO, SIZx, FCx, and RIW outputs. At the beginning of a bus cycle, SIZ1 and SIZO are driven with FC3-FCO. SIZ1 and SIZO indicate the number of bytes remaining to be transferred during an operand cycle (consisting of one or more bus cycles). Table 3-1 lists the encoding of the SIZx signal. These signals are valid while AS is asserted. The RIW signal determines the direction of the transfer during a bus cycle. Driven at the beginning of a bus cycle, RIW is valid while AS is asserted. RIW only transitions when a write cycle is preceded by a read cycle or vice versa. The signal may remain low for consecutive write cycles. The RMC signal is asserted at the beginning of the first bus cycle of a read-modify-write operation and remains asserted until completion of the final bus cycle of the operation. 3-2 MC68340 USER'S MANUAL MOTOROLA

Table 3-1. SIZx Signal Encoding

SlZ1 SlZO Transfer Size 0 1 Byte 1 0 Word 1 1 Three Bytes 0 0 Long Word 3.1.2 Function Code Signals • FC3-FCO are outputs that indicate one of 16 address spaces to which the address applies. Fifteen of these spaces are designated as either user or supervisor, program or data, and normal or direct memory access (DMA) spaces. One other address space is designated as CPU space to allow the CPU32 to acquire specific control information not normally associated with read or write bus cycles. FC3-FCO are valid while AS is asserted. Function codes (see Table 3-2) can be considered as extensions of the 32-bit address that can provide up to 16 different 4-Gbyte address spaces. Function codes are automatically generated by the CPU32 to select address spaces for data and program at both user and supervisor privilege levels, a CPU address space for processor functions, and an alternate master address space. User programs access only their own program and data areas to increase protection of system integrity and can be restricted from accessing other information. The S-bit in the CPU32 status register is set for supervisor accesses and cleared for user accesses to provide differentiation. Refer to 3.4 CPU Space Cycles for more information. TSlIhlA ~_? AttttrA~~ ~nal'A J:nl'nttinn . - Function Code BHs 3 2 1 0 Address Spaces 0 0 0 0 Reserved (Motorola) 0 0 0 1 User Data Space 0 0 1 0 User Program Space 0 0 1 1 Reserved (User) 0 1 0 0 Reserved (Motorola) 0 1 0 1 Supervisor Data Space 0 1 1 0 Supervisor Program Space 0 1 1 1 CPU Space 1 x x x DMASpace MOTOROLA MC68340 USER'S MANUAL 3-3

3.1.3 Address Bus (A31-AO)

These signals are outputs that define the address of the byte (or the most significant byte) to be transferred during a bus cycle. The MC68340 places the address on the bus at the beginning of a bus cycle. The address is valid while AS is asserted. 3.1.4 Address Strobe (AS) This output timing signal indicates the validity of many control signals and the address on the address bus. AS is asserted approximately one-half clock cycle after the beginning of a bus cycle. 3.1.5 Data Bus (015-00) This bidirectional, nonmultiplexed, parallel bus contains the data being transferred to or from the MC68340. A read or write operation may transfer 8 or 16 bits of data (one or two bytes) in one bus cycle. During a read cycle, the data is latched by the MC68340 on the last falling edge of the clock for that bus cycle. For a write cycle, all 16 bits of the data bus are driven, regardless of the port width or operand size. The MC68340 places the data on the data bus approximately one-half clock cycle after AS is asserted in a write cycle. 3.1.6 Data Strobe (OS) DS is an output timing signal that applies to the data bus. For a read cycle, the MC68340 asserts DS and AS simultaneously to signal the external device to place data on the bus. For a write cycle, DS signals to the external device that the data to be written is valid. The MC68340 asserts DS approximately one clock cycle after the assertion of AS during a write cycle. 3.1.7 Bus Cycle Termination Signals The following signals can terminate a bus cycle. 3.1.7.1 DATA TRANSFER AND SIZE ACKNOWLEDGE SIGNALS (DSACK1 AND DSACKO). During bus cycles, external devices assert DSACK1 and/or DSACKO as part of the bus protocol. During a read cycle, this signals the MC68340 to terminate the bus cycle and to latch the data. During a write cycle, this indicates that the external device has successfully stored the data and that the cycle may terminate. These signals also indicate to the MC68340 the size of the port for the bus cycle just completed (see Table 3-3). Refer to 3.3.1 Read Cycle for timing relationships of DSACK1 and DSACKO. Additionally, the system integration module (SIM40) chip select address mask register can be programmed to internally generate DSACK1 and DSACKO for external accesses, eliminating logic required to generate these signals. However, if external DSACKx signals are returned earlier than indicated by the DO bits in the chip select address mask register, the cycle will terminate sooner than programmed. Refer to Section 4 System Integration Module for additional information. The SIM40 can alternatively be programmed to generate a fast termination cycle, providing a two-cycle external access. Refer to 3.2.6 Fast Termination Cycles for additional information on these cycles. 3-4 MC68340 USER'S MANUAL MOTOROLA

3.1.7.2 BUS ERROR (BERR). This signal is also a bus cycle termination indicator and can

be used in the absence of DSACKx to indicate a bus error condition. BERR can also be asserted in conjunction with DSACKx to indicate a bus error condition, provided it meets the appropriate timing described in this section and in Section 11 Electrical Characteristics. Additionally. BERR and HALT can be asserted together to indicate a retry termination. Refer to 3.5 Bus Exception Control Cycles for additional information on the use of these signals. The internal bus monitor can be used to generate an internal bus error signal for internal and internal-to-external transfers. If the bus cycles of an external bus master are to be .. monitored. external BERR generation must be provided since the internal bus error monitor has no information about transfers initiated by an external bus master. 3.1.7.3 AUrOVECTOR <'AV'E~).This signal can be used to terminate interrupt acknowledge cycles. indicating that the MC68340 should internally generate a vector (autovector) number to locate an interrupt handler routine. AVEC can be generated either externally or internally by the SIM40 (see Section 4 System Integration Module for additional information). AVEC is ignored during all other bus cycles. 3.2 DATA TRANSFER MECHANISM The MC68340 supports byte, word. and long-word operands. allowing access to 8- and 16-bit data ports through the use of asynchronous cycles controlled by DSACK1 and DSACKO. The MC68340 also supports byte. word. and long-word operands, allowing access to 8- and 16-bit data ports through the use of synchronous cycles controlled by the fast termination capability of the SIM40. 3.2.1 Dynamic Bus Sizing The MC68340 dynamically interprets the port size of the addressed device during each bus cycle, allowing operand transfers to or from 8- and 16-bit ports. During an operand transfer cycle, the slave device signals its port size (byte or word) and indicates completion of the.bus cycle to the MC68340 through the use of the DSACKx inputs. Refer to Table 3-3 for DSACKx encoding. Table 3-3. DSACKX Encoding DSACKi IlSACKo Result 1 1 (Negated) (Negated) Insert Wait States in Current Bus Cycle 1 0 (Negated) (Asserted) Complete Cycle--Data Bus Port Size Is 8 Bits 0 1 (Asserted) (Negated) Complete Cycle--Data Bus Port Size Is 16 Bits 0 0 Reserved-Defaults to 16-Bit Port Size Can Be (Asserted) (Asserted) Used for 32-Bit DMA cycles MOTOROLA MC68340 USER'S MANUAL 3-5 all-guides.c om

For example, if the MC68340 is executing an instruction that reads a long-word operand

from a 16-bit port, the MC68340 latches the 16 bits of valid data and runs another bus cycle to obtain the other 16 bits. The operation from an 8-bit port is similar, but requires four read cycles. The addressed device uses DSACKx to indicate the port width. For instance, a 16-bit device always returns DSACKx for a 16-bit port (regardless of whether the bus cycle is a byte or word operation). Dynamic bus sizing requires that the portion of the data bus used for a transfer to or from a particular port size be fixed. A 16-bit port must reside on data bus bits 15-0, and an 8-bit port must reside on data bus bits 15-8. This requirement minimizes the number of bus cycles needed to transfer data to 8- and 16-bit ports and ensures that the MC68340 correctly transfers valid data. The MC68340 always attempts to transfer the maximum amount of data on all bus cycles; for a word operation, it always assumes that the port is 16 bits wide when beginning the bus cycle. The bytes of operands are designated as shown in Figure 3-2. The most significant byte of a long-word operand is OP~, and OP3 is the least significant byte. The two bytes of a word-length operand are OP~ (most significant) and OP1. The single byte of a byte-length operand is OP~. These designations are used in the figures and descriptions that follow. Figure 3-2 shows the required organization of data ports on the MC68340 bus for both 8- and 16-bit devices. The four bytes shown in Figure 3-2 are connected through the internal data bus and data multiplexer to the external data bus. The data multiplexer establishes the necessary connections for different combinations of address and data sizes. The multiplexer takes the two bytes of the 16-bit bus and routes them to their required positions. The positioning of bytes is determined by the SIZ1/SIZO and AO outputs. The SIZ1/SIZO outputs indicate the number of bytes to be transferred during the current bus cycle (see Table 3-1). The number of bytes transferred during a read or write bus cycle is equal to or less than the size indicated by the SIZ1/SIZO outputs, depending on port width. For example, during the first bus cycle of a long-word transfer to a word port, the size outputs indicate that four bytes are to be transferred although only two bytes are moved on that bus cycle. The address line AO also affects the operation of the data multiplexer. During an operand transfer, A31-A1 indicate the word base address of that portion of the operand to be accessed, and AO indicates the byte offset from the base (Le., either odd or even byte). Figure 3-2 lists the bytes required on the data bus for read cycles. The entries shown as OPn are portions of the requested operand that are read or written during that bus cycle and are defined by SIZ1/SIZO and AO for the bus cycle. 3-6 MC68340 USER'S MANUAL MOTOROLA

Byle to Byte

0 1 X 0 OPO (OPO) (b) Byte to Word (Even) 0 1 0 0 X OPO (OPOI (e) Byte to Word (Odd) 0 1 1 0 X (OPO) OPO (eI) Word to Byte (Aligned) 1 0 0 1 0 OPO (OP11 (e) Word to Word (Aligned) 1 0 0 0 X OPO OPl (I) Long Word to Byte (Aligned) 0 0 0 1 0 OPO (OP1) (g) Long Word to Word (Aligned) 0 0 0 0 X OPO OPl NOTES: 1. Operands in parentheses are ignored by the MC68340 cluing read cycles. 2. A 3-byte to by1a transfer does occur as the second byte transfar of a long-word \0 byte port transfer. Figure 3-2. MC6834D Interface to Various Port Sizes 3.2.2 Misaligned Operands ~ , , , In this architecture, the basic operand size is 16 bits. Operand misalignment refers to whether an operand is aligned on a word boundary or overlaps the word boundary, determined by address line AD. When AO is low, the address is even and is a word and byte boundary. When AO is high, the address is odd and is a byte boundary only. A byte operand is properly aligned at any address; a word or long-word operand is misaligned at an odd address. At most, each bus cycle can transfer a word of data aligned on a word boundary. If the MC68340 transfers a long-WOrd operand over a 16-bit port, the most significant operand word is transferred on the first bus cycle, and the least significant operand word is transferred on a following bus cycle. The CPU32 restricts all operands (both data and instructions) to be aligned. That is, word and long-WOrd operands must be located on a word or long-word boundary, respectively. The only type of transfer that can be performed to an odd address is a single-byte transfer, referred to as an odd-byte transfer. If a misaligned access is attempted, the CPU32 generates an address error exception, and enters exception processing. Refer to Section 5 CPU32 for more information on exception processing. 3.2.3 Operand Transfer Cases The following cases are examples of the allowable alignments of operands to ports. 3.2.3.1 BYTE OPERAND TO 8-BIT PORT, ODD OR EVEN (AD = X). The MC68340 drives the address bus with the desired address and the SIZx pins to indicate a single- byte operand. MOTOROLA MC68340 USER'S MANUAL 3-7 ..

BYTE OPERAND ~

7 • 0 DATA BUS 015 OS 07 DO Sill SilO AD iiSAcK1 DSACKO CYCLE 1 I OPO I (OPO} I o 1 X 0 For a read operation, the slave responds by placing data on bits 15-8 of the data bus, asserting DSACKO and negating DSACK1 to indicate an 8-bit port. The MC68340 then reads the operand byte from bits 15-8 and ignores bits 7-0. For a write operation, the MC68340 drives the single-byte operand on both bytes of the data bus because it does not know the port size until the DSACKx signals are read. The slave device reads the byte operand from bits 15-8 and places the operand in the specified location. The slave then asserts DSACKO to terminate the bus cycle. 3.2.3.2 BYTE OPERAND TO 16-BIT PORT, EVEN (AO = 0). The MC68340 drives the address bus with the desired address and the SIZx pins to indicate a single-byte operand. BYTE OPERAND Pp, 7 0 DATA BUS 015 OS 07 DO Sill SilO AD DSACK1 DSACKO CYCLE 1 I oPO I !OPO! I 0 0 0 X For a read operation, the slave responds by placing data on bits 15-8 of the data bus and asserting DSACK1 to indicate a i6-bit port. The MC68340 then reads the operand byte from bits 15-8 and ignores bits 7-0. For a write operation, the MC68340 drives the single-byte operand on both bytes of the data bus because it does not know the port size until the DSACKx signals are read. The slave device reads the operand from bits 15-8 of the data bus and uses the address to place the operand in the specified location. The slave then asserts DSACK1 to terminate the bus cycle. 3-8 MC68340 USER'S MANUAL MOTOROLA

3.2.3.3 BYTE OPERAND TO 16-BIT PORT, ODD (AD = 1). The MC68340 drives the

address bus with the desired address and the SIZx pins to indicate a single-byte operand. BYTE OPERAND DATA BUS CYCLE 1 ~ 7 • 0 015 os 07 DO I (OPO) I oPO I SlZl a SIZO AO DSACK1 DSACKO o X For a read operation, the slave responds by placing data on bits 7-0 of the data bus and I. asserting DSACK1 to indicate a 16-bit port. The MC68340 then reads the operand byte from bits 7-0 and ignores bits 15-8. For a write operation, the MC68340 drives the single-byte operand on both bytes of the data bus because it does not know the port size until the DSACKx signals are read. The slave device reads the operand from bits 7-0 of the data bus and uses the address to place the operand in the specified location. The slave then asserts DSACK1 to terminate the bus cycle. 3.2.3.4 WORD OPERAND TO a-BIT PORT, ALIGNED. The MC68340 drives the address bus with the desired address and the SIZx pins to indicate a word operand. WORD OPERAND I OPO I OPl 15 t 87 0 DATA BUS 015 08 07 00 SlZl SIZO AD DSACKl DSACKO CYCLE 1 I oPO I IOP1! I CYCLE2 _ OPl _ .OP1. _ o o 1 o 0 1 0 For a read operation, the slave responds by placing the most significant byte of the operand on bits 15-8 of the data bus and asserting DSACKO to indicate an 8-bit port. The MC68340 reads the most significant byte of the operand from bits 15-8 and ignores bits 7-0. The MC68340 then decrements the transfer size counter, increments the address, and reads the least significant byte of the operand from bits 15-8 of the data bus. For a write operation, the MC68340 drives the word operand on bits 15-0 of the data bus. The slave device then reads the most Significant byte of the operand from bits 15-8 of the data bus and asserts DSACKO to indicate that it received the data but is an 8-bit port. The MC68340 then decrements the transfer size counter, increments the address, and writes the least significant byte of the operand to bits 15-8 of the data bus. MOTOROLA MC68340 USER'S MANUAL 3-9

3.2.3.5 WORD OPERAND TO 16-BIT PORT, ALIGNED. The MC68340 drives the

address bus with the desired address and the size pins to indicate a word operand. WORD OPERAND I OPO I OPl I 15 + + 0 DATA BUS 015 08 07 00 Sill SilO AD DSACKl DSACKO CYCLE 1 I OPO I OPl 1 0 o 0 x For a read operation, the slave responds by placing the data on bits 15-0 of the data bus and asserting DSACK1 to indicate a 16-bit port. When DSACK1 is asserted, the MC68340 reads the data on the data bus and terminates the cycle. For a write operation, the MC68340 drives the word operand on bits 15--0 of the data bus. The slave device then reads the entire operand from bits 15--0 of the data bus and asserts DSACK1 to terminate the bus cycle. 3.2.3.6 LONG-WORD OPERAND TO 8-BIT PORT, ALIGNED. The MC68340 drives the address bus with the desired address and the SIZx pins to indicate a long-word operand. LONG-WORD OPERAND I OPO I OP1 I OP2 I OP3 I DATA BUS CYCLE 1 CYCLE 2 CYCLE 3 CYCLE 4 31 t 23 15 7 0 015 08 07 00 OPO (OP1) OPl (OP1) OP2 (OP3) OP3 (OP3) Sill SilO o o o 1 o o o o o o o For a read operation, shown in Figure 3-3, the slave responds by placing the most Significant byte of the operand on bits 15-8 of the data bus and asserting DSACKO to indicate an 8-bit port. The MC68340 reads the most significant byte of the operand (byte 0) from bits 15-8 and ignores bits 7-0. The MC68340 then decrements the transfer size counter, increments the address, initiates a new cycle, and reads byte 1 of the operand from bits 15-8 of the data bus. The MC68340 repeats the process of decrementing the transfer size counter, incrementing the address, initiating a new cycle, and reading a byte to transfer the remaining two bytes. For a write operation, shown in Figure 3-4, the MC68340 drives the two most significant bytes of the operand on bits 15--0 of the data bus. The. slave device then reads only the most significant byte of the operand (byte 0) from bits 15-8 of the data bus and asserts DSACKO to indicate reception and an 8-bit port. The MC68340 then decrements the transfer size counter, increments the address, and writes byte 1 of the operand to bits 15-8 of the data bus. The MC68340 continues to decrement the transfer size counter, increment the address, and write a byte to transfer the remaining two bytes to the slave device. 3-10 MC68340 USER'S MANUAL MOTOROLA all-guides.c om

JL rL rL rL rL n-rL rL rL rL rL rL rL--

·x X DC DC K=~ . .. FC3-FCO ·X X OC OC K:-- . . '/ .~ / ~ / 1\ / 1\ / I\~ ~ / ~ / 1"\ / 1"\ / 1\ .. 81ZO -\ I 1\ V f\-+ 4 BYTES 3BVTES 2 BYTES 1 BYTE V-~ \ I 1\ 8111 r 1\ / 1\ r \ Ir \. r" .1 015-08 'OPO' \..,;;.;.J 'OP1' \.::::.:..I ~ ~ 'OP3' \::.::J 07-00 +--BYTE BYTE BYTE BYTE READ READ READ READ LONG-WORD OPERANO READ FROM 8-B1T BUS Figure 3-3. Long-Word Operand Read Timing from 8-81t Port MOTOROLA MC68340 USER'S MANUAL 3-11

CLKOUT .rL rL rL rL rL rL rL rL rL rL rL n-

rL~ -~ x x x c: - A31-AO -~ x x x C_ - FC3-FCO -" 1\ / """""\. / \. / """""\. / \~ \ J ~\ J \ J \ J SIZO .!\ V 1\ V ~r- SlZl 4 BYTES 3 BYTES 2 BYTES 1 BYTE -, V 1\ V-r .r \ 1/ \ 1/ \ 1/ \ I/r ./ 015-08 OPO I)-K OPl I}-{ OP2 l}-{ 0P3 I}--r D7-DO II (OP1) }-K (OP1) }-K (0P3) I}-{ (0P3) }- I I I WRITE WRITE WRITE WRITE- LONG·WORD OPERAND WRITE TO 8-BIT BUS Figure 3-4. Long-Word Operand Write Timing to 8-Bit Port 3.2.3.7 LONG-WORD OPERAND TO 16-BIT PORT, ALIGNED. Figure 3-5 shows both long-word and word read and write timing to a 1S-bit port. LONG-WORD OPERAND I OPO I OPI I OP2 I OP3 I I 31 + 23 + 15 7 0 DATA BUS D15 os D7 DO Sill SIZO AD DsAcK1 DSACKO CYCLE 1 I OPO OPI I 0 0 0 0 X CYCLE 2 OP2 OP3 0 0 0 x 3-12 MC68340 USER'S MANUAL MOTOROLA

ClKOUT (L tL tL tL h-tL tL tL h-tL tL r-L tL h-h-tL h-h-

I- A31-A0 I)( I)( I)( ~ I)( I)( 0( '" FC3-FCO IX I)( I)( ~ IX I)( K v \ II 1\ /1\ Jh / \. j 1\ / ~ J~ 1\ I 1\ I 1\ / \ J \ W \ J - SIZO ~ / 4 BYTES 2 BYTES 2 BYTES 4 BYTES 2 BYTES 2 BYTES SlZl 1\ V 1\ V \. V 1--1\ lr h 1I ~ V-f\ V-I\ 1/1\ Ir --- I-- 015-08 VoPo' Ir---1 ~ ~K I}-K I}-f{ ~ ~ OPO OP2 OPO j\::.:J ~ ~ ~ I~ ~K I}-K I}-K I}- ~ ~ OPl OP3 OP1 ~ I I I D7-DO WORD ~ LONG WORD READ WORD READ LONG WORD WRITE TO WRITE TO ...... FROM 16-BIT BUS 16-BITBUS 16 BIT BUS FROM 16·BIT BUS Figure 3-5. Long-Word and Word Read and Write Timing-16-Bit Port The MC68340 drives the address bus with the desired address and drives the SIZx pins to indicate a long-word operand. For a read operation, the slave responds by placing the two most significant bytes of the operand on bits 15-0 of the data bus and asserting DSACK1 to indicate a 16-bit port. The MC68340 reads the two most significant bytes of the operand (bytes 0 and 1) from bits 15-0. The MC68340 then decrements the transfer size counter by 2, increments the address by 2, initiates a new cycle, and reads bytes 2 and 3 of the operand from bits 15-0 of the data bus. For a write operation, the MC68340 drives the two most significant bytes of the operand on bits 15-0 of the data bus. The slave device then reads the two most significant bytes of the operand (bytes 0 and 1) from bits 15-0 of the data bus and asserts DSACK1 to indicate reception and a 16-bit port. The MC68340 then decrements the transfer size counter by 2, increments the address by 2, and writes bytes 2 and 3 of the operand to bits 15--0 of the data bus. MOTOROLA MC68340 USER'S MANUAL 3-13 •

3.2.4 Bus Operation

The MC68340 bus is asynchronous, allowing external devices connected to the bus to operate at clock frequencies different from the clock for the MC68340. Bus operation uses the handshake lines (AS, OS, DSACK1/DSACKO, BERR, and HALT) to control data transfers. AS signals a valid address on the address bus, and OS is used as a condition for valid data ona writeJ::ycle. Decoding the SIZx outputs and lower address line AO provides strobei that select the active portion of the data bus. The slave device (memory or peripheral) responds by placing the requested data on the correct portion of the data bus for a read cycle or by latching the data on a write cycle; the slave asserts the DSACK1/DSACKO combination that corresponds to the port size to terminate the cycle. Alternatively, the SIM40 can be programmed to assert the DSACK1/DSACKO combination internally and respond for the slave. If no slave responds or the access is invalid, external control logic may assert BERR to abort the bus cycle or BERR with HALT to retry the bus cycle. DSACKX can 1)8 assertedbefore the data from a slave device is valid on a read cycle. The length of time that DSACKx may precede data must not exceed a specified value in any asynchronous system to ensure that valid data is latched into the MC68340. (See Section 11 Electrical Characteristics for timing parameters.) Note that no maximum time is specified from the assertion of AS to the assertion of DSACKx. Although the MC68340 can transfer data in a minimum of three clock cycles when the cycle is terminated with DSACKx, the MC68340 inserts wait cycles in clock-period increments until DSACKx is recognized. BERR and/or HALT can be asserted after DSACKx is asserted. BERR and or HALT must be asserted within the time specified after DSACKx is asserted in any asynchronous system. If this maximum delay time is violated, the MC68340 may exhibit erratic behavior. 3.2.5 Synchronous Operation with DSACKx Although cycles terminated with OSACKx are classified as asynchronous, cycles terminated with DSACKx can also operate synchronously in that signals are interpreted relative to clock edges. The devices that use these cycles must synchronize the response to the MC68340 clock (CLKOUT) to be synchronous. Since the devices terminate bus cycles with DSACKx, the dynamic bus sizing capabilities of the MC68340 are available. The minimum cycle time for these cycles is also three clocks. To support systems that use the system clock to generate DSACKx and other asynchronous inputs, the asynchronous input setup time and the asynchronous input hold time are given. If the setup and hold times are met for the assertion or negation of a signal such as DSACKx, the MC68340 is guaranteed to recognize that signal level on that specific falling edge of the system clock. If the assertion of DSACKx is recognized on a particular falling edge of the clock, valid data is latched into the MC68340 (for a read cycle) on the next falling clock edge if the data meets the data setup time. In this case, the parameter for asynchronous operation can be ignored. The timing parameters are described in Section 11 Electrical Characteristics. 3-14 MC68340 USER'S MANUAL MOTOROLA

If a system asserts DSACKx for the required window around the falling edge of S2 and

obeys the proper bus protocol by maintaining DSACKx (and/or BERR/HALT) until and throughout the clock edge that negates AS (with the appropriate asynchronous input hold time), no wait states are inserted. The bus cycle runs at its maximum speed for bus cycles terminated with DSACKx (three clocks per cycle). When BERR (or BERR and HALT) is asserted after DSACKx, BERR (and HALT) must meet the appropriate setup time prior to the falling clock edge one clock cycle after DSACKx is recognized. This setup time is critical, and the MC68340 may exhibit erratic behavior if it is violated. When operating synchronously, the data-in setup and hold times for synchronous cycles may be used instead of the timing requirements for data relative to DS. 3.2.6 Fast Termination Cycles With an external device that has a fast access time, the chip select circuit fast termination enable (FTE) can provide a two-clock external bus transfer. Since the chip select circuits are driven from the system clock, the bus cycle termination is inherently synchronized with the system clock. Refer to Section 4 System Integration Module for more information on chip selects.When fast termination is selected, the DD bits of the corresponding address mask register are overridden. Fast termination can only be used with zero wait states. To use the fast termination option, an external device should be fast enough to have data ready, within the specified setup time, by the falling edge of S4. Figure 3-6 shows the DSACKx timing for a read with two wait states, followed by a fast termination read and write. When using the fast termination option, DS is asserted only in a read cycle, not in a write cycle. MOTOROLA CLKOUT 015-00 so 51 S2 53 SW SW' SW SW' 54 S5 so Sl 54 S5 so SI 54 S5 so '\ ..... ------~ TWO WAIT STATES IN READ --+Oil-- FAST _-1*-- TERMINATION READ • DSACKx only internally asserted for fast termination cycles. Figure 3-6. Fast Termination Timing MC68340 USER'S MANUAL 3-15 .. all-guides.c om

3.3 DATA TRANSFER CYCLES

The transfer of data between the MC68340 and other devices involves the following signals: • Address Bus A31-AO • Data Bus 015-00 • Control Signals The address bus and data bus are parallel, nonmultiplexed buses. The bus master moves data on the bus by issuing control signals, and the bus uses a handshake protocol to ensure correct movement of the data. In all bus cycles, the bus master is responsible for de-skewing all signals it issues at both the start and end of the cycle. In addition, the bus master is responsible for de-skewing the acknowledge and data signals from the slave devices. The following paragraphs define read, write, and read-modify-write cycle operations. Each bus cycle is defined as a succession of states that apply to the bus operation. These states are different from the MC68340 states described for the CPU32. The clock cycles used in the descriptions and timing diagrams of data transfer cycles are independent of the clock frequency. Bus operations are described in terms of external bus states. 3.3.1 Read Cycle During a read cycle, the MC68340 receives data from a memory or peripheral device. If the instruction specifies a long-word or word operation, the MC68340 attempts to read two bytes at once. For a byte operation, the MC68340 reads one byte. The section of the data bus from which each byte is read depends on the operand size, address signal AO, and the port size. Refer to 3.2.1 Dynamic Bus Sizing and 3.2.2 Misaligned Operands for more information. Figure 3-7 is a flowchart of a word read cycle. BUS MASTER SLAVE ADDRESS DEVICE 1. SET RiWTO READ 2. DRIVE ADDRESS ON A31-A1l 3. DRIVE FUNCTION CODE ON FC3-FCO 4. DRIVE SIZE PHI FOR OPERAND SIZE 5. ASSERT AS AND os PRESENT DATA 1. DECODE ADDRESS 2. PLACEDATAOND15-DO ACQUIRE DATA 3. DRIVE DSACKx SIGNALS 1. LATCH DATA 2. NEGATE AS AND os TERMINATE CYCLE ~ 1. REMOVE DATA FROM D15-DO 2. NEGATE DSACKx START NEXT CYCLE Figure 3-7. Word Read Cycle Flowchart 3-16 MC68340 USER'S MANUAL MOTOROLA

State 0-The read cycle starts in state 0 (SO). During SO, the MC68340 places a valid

address on A31-AO and valid function codes on FC3-FCO. The function codes select the address space for the cycle. The MC68340 drives R/W high for a read cycle. SIZ1/SIZO become valid, indicating the number of bytes requested for transfer. State 1-Qne-half clock later, in state 1 (S1), the MC68340 asserts AS indicating a valid address on the address bus. The MC68340 also asserts DS during S1. The selected device uses RlW, SIZ1 or SIZO, AO, and DS to place its information on the data bus. One or both of the bytes (D15-D8 and D7-DO) are selected by SIZ1/SIZO and AO. State 2-As long as at least one of the DSACKx signals is recognized on the falling edge .. of S2 (meeting the asynchronous input setup time requirement), data is latched on the falling edge of S4, and the cycle terminates. State 3-lf DSACKx is not recognized by the start of state 3 (S3), the MC68340 inserts wait states instead of proceeding to states 4 and 5. To ensure that wait states are inserted, both DSACK1 and DSACKO must remain negated throughout the asynchronous input setup and hold times around the end of S2. If wait states are added, the MC68340 continues to sample DSACKx on the falling edges of the clock until one is recognized. State 4-At the falling edge of state 4 (S4), the MC68340 latches the incoming data and samples DSACKx to get the port size. State 5-The MC68340 negates AS and DS during state 5 (S5). It holds the address valid during S5 to provide address hold time for memory systems. R/W, SIZ1 and SIZO, and FC3-FCO also remain valid throughout S5. The external device keeps its data and DSACKx signals asserted until it detects the negation of AS or DS (whichever it detects first). The device must remove its data and negate DSACKx within approximately one clock period after sensing the negation of AS or DS. DSACKx signals that remain asserted ..... _ .... __ ........... :- 1:_: ... _.-....... __ .. __ ,.. .... , ........ 1. ..... "" ... n_+_ .... -1_ .. ....... ,.. """v+ hi I"",, "",,,In --,-"- .... - ...••.• "'-1 -- .... ·_···_ .. -·_·1 -_ .. __ .. _- '-' " .. - .. -.~. --- -1-"-- MOTOROLA MC68340 USER'S MANUAL 3-17

3.3.2 Write Cycle

During a write cycle, the MC68340 transfers data to memory or a peripheral device. Figure 3-8 is a flowchart of a word write cycle. BUS MASTER SLAVE ADDRESS DEVICE 1. SETRiWTOWRITE 2. DRIVE ADDRESS ON A31-M 3. DRIVE FLtlCTION CODE ON FC3-FCO 4. DRIVE SIZE PINS FOR OPERAND SIZE 5. ASSERT AS ACCEPT DATA 6. PlACEDATAONDl5-00 7. ASSERT os 1. DECODE ADDRESS 2. LATCH DATA FROM Dl5-00 TERMINATE OUTPUT TRANSFER 3. ASSERT DSACKx SIGNALS 1. NEGATE os AND AS 2. REMOVE DATA FROM Dl5-00 TERMINATE CYCLE ~ 1. NEGATE DSACKx START NEXT CYCLE Figure 3-8. Word Write Cycle Flowchart State 0-The write cycle starts in SO. During SO, the MC68340 places a valid address on A31-AO and valid function codes on FC3-FCO. The function codes select the address space for the cycle. The MC68340 drives RIW low for a write cycle. SIZ1/SIZO become valid, indicating the number of bytes to be transferred. State 1-Qne-half clock later during S1, the MC68340 asserts AS, indicating a valid address on the address bus. State 2-0uring S2, the MC68340 places the data to be written onto 015-00, and samples OSACKx at the end of S2. State 3-The MC68340 asserts OS during S3, indicating that data is stable on the data bus. As long as at least one of the OSACKx signals is recognized by the end of S2 (meeting the asynchronous input setup time requirement). the cycle terminates one clock later. If OSACKx is not recognized by the start of S3, the MC68340 inserts wait states instead of proceeding to S4 and S5. To ensure that wait states are inserted. both OSACK1 and DSACKO must remain negated throughout the asynchronous input setup and hold times around the end of S2. If wait states are added, the MC68340 continues to sample OSACKx on the falling edges of the clock until one is recognized. The selected device uses RIW, SIZ1/SIZO, and AO to latch data from the appropriate byte(s) of 015-08 and 07-00. SIZ1/SIZO and AO select the bytes of the data bus. If it has not already done so, the device asserts OSACKx to signal that it has successfully stored the data. 3-18 MC68340 USER'S MANUAL MOTOROLA

State 4-The MC68340 issues no new control signals during S4.

State 5-The MC68340 negates AS and DS during S5. It holds the address and data valid during S5 to provide address hold time for memory systems. RIW, SIZ1/SIZO, and FC3- FCO also remain valid throughout S5. The external device must keep DSACKx asserted until it detects the negation of AS or OS (whichever it detects first). The device must negate DSACKx within approximately one clock period after sensing the negation of AS or DS. DSACKx signals that remain asserted beyond this limit may be prematurely detected for the next bus cycle. 3.3.3 Read-Modify-Write Cycle The read-modify-write cycle performs a read, conditionally modifies the data in the arithmetic logic unit, and may write the data out to memory. In the MC68340, this operation is indivisible, providing semaphore capabilities for multiprocessor systems. During the entire read-modify-write sequence, the MC68340 asserts RMC to indicate that an indivisible operation is occurring. The MC68340 does not issue a BG signal in response to a BR signal during this operation. Figure 3-9 is an example of a functional timing diagram of a read-modify-write instruction specified in terms of clock periods. ClKOUT A31-A30 FC3-FCO t.'1704 COI'7n Riii RMC AS Os OSACKx 015-00 MOTOROLA so S2 S4 so S2 S4 so \4------INOIVISIBLE --------+1 CYCLE Figure 3-9. Read-Modify-Write Cycle Timing MC68340 USER'S MANUAL 3-19 ..

State 0-The MC68340 asserts RMC in SO to identify a read-modify-write cycle. The

MC68340 places a valid address on A31-AO and valid function codes on FC3-FCO. The function codes select the address space for the operation. SIZ1/SIZO become valid in SO to indicate the operand size. The MC68340 drives RIW high for the read cycle. State 1-0ne-half clock later during 51, the MC68340 asserts AS indicating a valid address on the address bus. The MC68340 also asserts OS during 51. State 2-The selected device uses RIW, SIZ1/SIZO, AO, and OS to place information on the data bus. Either or both of the bytes (015-08 and 07-00) are selected by SIZ1/SIZO and AO. Concurrently, the selected device may assert OSACKx. State 3-As long as at least one of the OSACKx signals is recognized by the end of 52 (meeting-the asynchronous input setup time requirement), data is latched on the next falling edge of the clock, and the cycle terminates. If OSACKx is not recognized by the start of 53, the MC68340 inserts wait states instead of proceeding to 54 and 55. To ensure that wait states are inserted, both OSACKl and OSACKO must remain negated throughout the asynchronous input setup and hold times around the end of 52. If wait states are added, the MC68340 continues to sample the OSACKx Signals on the falling edges of the clock until one is recognized. State 4-At the end of 54, the MC68340 latches the incoming data. State 5-The MC68340 negates AS and OS during 55. If more than one read cycle is required to read in the operand(s), SO-55 are repeated for each read cycle. When finished reading, the MC68340 holds the address, RIW, and FC3-FCO valid in preparation for the write portion of the cycle. The external device keeps its data and OSACKx signals asserted until it detects the negation of AS or OS (whichever it detects first). The device must remove the data and negate OSACKx within approximately one clock period after sensing the negation of AS or OS. OSACKx signals that remain asserted beyond this limit may be prematurely detected for the next portion of the operation. Idle States-The MC68340 does not assert any new control signals during the idle states, but it may internally begin the modify portion of the cycle at this time. SO-55 are omitted if no write cycle is required. If awrite cycle is required, R/W remains in the read mode until SO to prevent bus conflicts with the preceding read portion of the cycle; the data bus is not driven until 52. State 0-The MC68340 drives RIW low for a write cycle. Depending on the write operation to be performed, the address lines may change during SO. State 1-ln 51, the MC68340 asserts AS, indicating a valid address on the address bus. State 2-0uring 52, the MC68340 places the data to be written onto 015-00. State 3-The MC68340 asserts OS during 53, indicating stable data on the data bus. As long as at least one of the OSACKx signals is recognized by the end of 52 (meeting the asynchronous input setup time requirement), the cycle terminates one clock later. If OSACKx is not recognized by the start of 53, the MC68340 inserts wait states instead of 3-20 MC68340 USER'S MANUAL MOTOROLA all-guides.c om

proceeding to S4 and S5. To ensure that wait states are inserted, both OSACK1 and

OSACKO must remain negated throughout the asynchronous input setup and hold times around the end of S2. If wait states are added, the MC68340 continues to sample OSACKx on the falling edges of the clock until one is recognized. The selected device uses RIW, OS, SIZ1/SIZO, and AO to latch data from the appropriate section(s) of 015-08 and 07-00. SIZ1/SIZO and AO select the data bus sections. If it has not already done so, the device asserts OSACKX when it has successfully stored the data. State 4-The MC68340 issues no new control signals during S4. State 5-The MC68340 negates AS and OS during S5. It holds the address and data valid .. during S5 to provide address hold time for memory systems. RIW and FC3-FCO also remain valid throughout S5. If more than one write cycle is required, states SO-S5 are repeated for each write cycle. The external device keeps OSACKx asserted until it detects the negation of AS or OS (whichever it detects first). The device must remove its data and negate OSACKx within approximately one clock period after sensing the negation of AS or OS. 3.4 CPU SPACE CYCLES FC3-FCO select user and supervisor program and data areas. The area selected by FC3- FCO = $7 is classified as the CPU space. The breakpoint acknowledge, LPSTOP broadcast, module base address register access, and interrupt acknowledge cycles described in the following paragraphs use CPU space. The CPU space type, which is encoded on A19-A16 during a CPU space operation, indicates the function that the MC68340 is performing. On the MC68340, four of the encodings are implemented as . shown in Figure 3-10. All unused values are reserved by Motorola for additional CPU space types. BREAKPOINT ACKNOWlEDGE LOW-POWER STOP BROADCAST MOOULEBASE ADDRESS REGISTER ACCESS INTERRUPT . ACKNOWLEDGE MOTOROLA ~TION CODE 3 0 [ill]] 3 0 [ill]] 3 0 IIll::1] 3 0 [WJJ CPU SPACE CYCLES ADDRESS BUS 31 119 161 0 10 0 0 0 0 0 0 0 0 0 0 010 0 0 010 0 0 0 0 0 0 0 0 0 oIBKPT.IT 01 31 119 161 0 10 0 000 00 00000100 1 111 1 1 1 1 1 1 1 1 1 1 1 1 1 101 31 119 161, 0 100000000000010011111111111000000001 31 119 161 0 h 111 1111 111 111111111111111111 llLEVEqll ~ CPU SPACE TYPEAELD Figure 3-10. CPU Space Address Encoding MC68340 USER'S MANUAL 3-21

3.4.1 Breakpoint Acknowledge Cycle

The breakpoint acknowledge cycle allows external hardware to insert an instruction directly into the instruction pipeline as the program executes. The breakpoint acknowledge cycle is generated by the execution of a breakpoint instruction (BKPT) or the assertion of the BKPT pin. The T-bit state (shown in Figure 3-10) differentiates a software breakpoint cycle (T = O) from a hardware breakpoint cycle (T = 1). When a BKPT instruction is executed (software breakpoint). the MC68340 performs a word read from CPU space. type O. at an address corresponding to the breakpoint number (bits [2-0] of the BKPT opcode) on A4-A2. and the T -bit (A 1) is cleared. If this bus cycle is terminated with BERR (i.e .• no instruction word is available). the MC68340 then performs illegal instruction exception processing. If the bus cycle is terminated by OSACKx. the MC68340 uses the data on 015-00 (for 16-bit ports) or two reads from 015-08 (for 8-bit ports) to replace the BKPT instruction in the internal instruction pipeline and then begins execution of that instruction. When the CPU32 acknowledges a BKPT pin assertion (hardware breakpoint) with background mode disabled. the CPU32 performs a word read from CPU space. type O. at an address corresponding to all ones on A4-A2 (BKPT#7). and the T-bit (A 1) is set. If this bus cycle is terminated by BERR. the MC68340 performs hardware breakpoint exception processing. If this bus cycle is terminated by OSACKX. the MC68340 ignores data on the data bus and continues execution of the next instruction. NOTE The BKPT pin. is sampled on the same clock phase as data and is latched with data as it enters the CPU32 pipeline. If BKPT is asserted for only one bus cycle and a pipeline flush occurs before BKPT is detected by the CPU32. BKPT is ignored. To ensure detection of BKPT by the CPU32. BKPT can be asserted until a breakpoint acknowledge cycle is recognized. The breakpoint operation flowchart is shown in Figure 3-11. Figures 3-12 and 3-13 show the timing diagrams for the breakpoint acknowledge cycle with instruction opcodes supplied on the cycle and with an exception signaled. respectively. 3-22 MC68340 USER~S MANUAL MOTOROLA

3.4.2 LPSTOP Broadcast Cycle

The low power stop (LPSTOP) broadcast cycle is generated by the CPU32 executing the LPSTOP instruction. Since the external bus interface must get a copy of the interrupt mask level from the CPU32, the CPU32 performs a CPU space type 3 write with the mask level encoded on the data bus, as shown in the following figure. The CPU space type 3 cycle waits for the bus to be available, and is shown externally to indicate to external devices that the MC68340 is going into LPSTOP mode. If an external device requires additional time to prepare for entry into LPSTOP mode, entry can be delayed by asserting HALT. The SIM40 provides internal DSACKx response to this cycle. For more information ~ on how the SIM40 responds to LPSTOP mode, see Section 4 System Integration ~ Module. 15 14 13 12 11 10 9 8 7 6 5 4 2 1 o I - I - I - I - I - I - I - I - I - I - I - I - I - kl I 12-1Q-lnterrupt Mask Level The interrupt mask level is encoded on bits 2-0 of the data bus during an LPSTOP broadcast. MOTOROLA MC68340 USER'S MANUAL 3-23

BREAKPOINT OPERATION FLOW

PROCESSOR ACKNOWLEDGE BREAKPOINT IF BREAKPOINT INSTRUCTION EXECUTED: 1. SET RlWTO READ 2. SET FUNCTION CODE TO CPU SPACE 3. PLACE CPU SPACE TYPE 0 ON AI9-A16 4. PLACE BREAKPOINT NUMBER ON A2-A4 5. CLEART·BIT(Al) 6. SET SIZE TO WORD 7. ASSERT AS AND OS IF BKPT PIN ASSERlED: 1. SET RIW TO READ 2. SET FUNCTION CODE TO CPU SPACE 3. PLACE CPU SPACE TYPE 0 ON A 19-A16 4. PLACE ALL ONE'S ON A4-A2 5. SETT·BIT (A· 1 ) TO ONE 6. SET SIZE TO WORD 7. ASSERT AS AND OS IF BREAKPOINT INSTRUCTION EXECUTED AND DSACKx IS ASSERTED: 1. LATCH DATA 2. NEGATEASANDDS 3. GO TO (A) IF BKPT PIN ASSERlED AND DSACKx IS ASSERlED: 1. NEGATEASANDDS 2. GO TO (A) IF BERR ASSERTED: 1. NEGATEASANDDS 2. GO TO (B) (A) (B) I IF BREAKPOINT INSTRUCTION EXECUTED: 1. PLACE LATCHED DATA IN INSTRUCTION PIPELINE 2. CONTINUE PROCESSING IF BKPT PIN ASSERlED: 1. CONTINUE PROCESSING IF BREAKPOINT INSTRUCTION EXECUTED: 1. INITIATE UEGAL INSTRUCTION PROCESSING IF BKPT PIN ASSERlED: 1. INITIATE HARDWARE BREAKPOINT PROCESSING EXTERNAL DEVICE IF BREAKPOINT INSTRUCTION EXECUTED: 1--+1 1. PLACE REPLACEMENT OPCODE ON DATA BUS 2. ASSERT DSACKx -OR. 1. ASSERT BERR TO INITIATE EXCEPTION PROCESSING IF BKPT PIN ASSERTED: 1. ASSERT DSACKx -OR· 1. ASSERT BERRTO INITIATE EXCEPTION PROCESSING 1. NEGATE DSACKx or BERR Figure 3-11. Breakpoint Operation Flowchart MC68340 USER'S MANUAL MOTOROLA

BREAKPOINT ENCODING (~

~ "'4 c= ~ ~A1 ==x __________ ~ BREAKPOINT NUMBERIT-P ~ • • ~ .. "I A15-AS.AO ,I....-----.....Jo",,----------'lr------- FC3-fCO ~ ______ ---' ~ 0 CPU SPACE ~ ~ ~ ~ C .. SIZO =:x'--____ --' ~ tl SIZ1 ~'--____ ---J ~ .. L .. \~_-----,':j \'--_~t , ........ __ ......J/, 07-00 -----~q)-----c:::r ...... , ----C]--\..--- 015-08 ----~q ~ CY~, - BERR j .. , .. H~T J~------.....Jo",~--------~~~------~~~-- ~ .. .. ,'-__ '1--_..1.4 ......... : _____ .....J! " "'4 FETCHED I INSTRUCTION I ~ BREAKPOINT-~.t.If---- READ ---:.~"'E--- A~~~~~E .1.iXECUTIO~ I~ OCCURS INSTRUCTION WORD FETCH Figure 3-12. Breakpoint Acknowledge Cycle Timing (Opcode Returned) MOTOROLA MC68340 USER'S MANUAL 3-25 .. all-guides.c om

A31-A20 ~--------"~-------"Ir~.....l-. __

~, -'--C_ Al9-A16 J--------J.::=x BREAKPOINT ENCODING (*' " C A4-A1 ~'--____ ~~ BREAKPOINTNUMBERfT-BO _____ ---I\~ Al5-A5.AO \'------~"r-----------',Ir .. --------~ 3-26 FCHCO J'---_---I\~~---~ CPU SPACE ~ SilO J ::=x--------'lr~...l..-..---Ar"" J..-r=_ SIZl -::J.. ____ ---"~ ':;J .. .. \'--____ :) \L-_~r \'--_____ 7 ' 07-00 ------

3.4.3 Module Base Address Register Access

All internal module registers, including the SIM40, occupy a single 4-Kbyte block that is relocatable along 4-Kbyte boundaries. The location is fixed by writing the desired base address of the SIM40 block to the module base address register using the MOVES instruction. The module base address register is only accessible in CPU space at address $0003FFOO. The SFC or OFC register must indicate CPU space (FC3-FCO = $7), using the MOVEC instruction, before accessing the module base address register. Refer to Section 4 System Integration Module for additional information on the module base address register. 3.4.4 Interrupt Acknowledge Bus Cycles The CPU32 makes an interrupt pending in three cases. The first case occurs when a peripheral device signals the CPU32 (with IRQ7-IRQ1) that the device requires service and the internally synchronized value on these Signals indicates a higher priority than the interrupt mask in the status register. The second case occurs when a transition has occurred in the case of a level 7 interrupt. A recognized level 7 interrupt must be removed for one clock cycle before a second level 7 can be recognized. The third case occurs if, upon returning from servicing a level 7 interrupt, the request level stays at 7 and the processor mask level changes from 7 to a lower level, a second level 7 is recognized. The CPU32 takes an interrupt exception for a pending interrupt within one instruction boundary (after processing any other pending exception with a higher priority). The following paragraphs describe the types of interrupt acknowledge bus cycles that can be executed as part of interrupt exception processing. 3.4.4.1 INTERRUPT ACKNOWLEDGE CYCLE-TERMINATED NORMALLY. When the CPU32 processes an interrupt exception, it performs an interrupt acknowledge cycle to obtain the number of the vector that contains the starting location of the interrupt service ... _ ...... : __ t:!' ___ :_"' ___ •• _4: __ .... _~.~ ___ L_ •• __________ .... 1_ •• __ .1._ ..... __ :_01._ ...... A-L..._A ___ .a._:_ ... &..._ . __ .... _. --"'- ····_··_,....···tr -..., .. ,--- ,._,,- t'._l:f'_IIIII. __ ' ...... __ ._ •• _tf.-._ . .., ... _. -_"._,0, ... .... interrupt vectors for the routines they use. The following paragraphs describe the interrupt acknowledge cycle for these devices. Other interrupting conditions or devices that cannot supply a vector number will use the autovector cycle described in 3.4.4.2 Autovector Interrupt Acknowledge Cycle. MOTOROLA MC68340 USER'S MANUAL 3-27 ..

The interrupt acknowledge cycle is a read cycle. It differs from the read cycle described in

3.3.1 Read Cycle in that it accesses the CPU address space. Specifically, the differences are as follows: 1. FC3-FCO are set to $7 (FC3/FC2IFC1/FCO = 0111) for CPU address space. 2. A3, A2, and A1 are set to the interrupt request level, and the IACKx strobe corresponding to the current interrupt level is asserted. (Either the function codes and address Signals or the IACKx strobes can be monitored to determine that an interrupt acknowledge cycle is in progress and the current interrupt level.) 3. The CPU32 space type field (A19-A16) is set to $F (interrupt acknowledge). 4. Other address signals (A31-A20, A15-A4, and AO) are set to one. 5. The SIZO/SIZ1 and R/W signals are driven to indicate a single-byte read cycle. The responding device places the vector number on the least significant byte of its data port (for an 8-bit port, the vector number must be on 015-08; for a 16-bit port, the vector must be on 07-00) during the interrupt acknowledge cycle. The cycle is then terminated normally with OSACKX. Figure 3-14 is a flowchart of the interrupt acknowledge cycle; Figure 3-15 shows the timing for an interrupt acknowledge cycle terminated with OSACKX. INTERRUPTING DEVICE REQUEST NTERRUPT GRANT INTERRUPT 1. SYNCHRONIZE 1RQ7~Ql 2. COMPARE IROl-1RQ7 TO MASK LEVEL AND WAIT FOR NSTRUCTION TO COMPLETE 3. PLACE NTERRUPT LEVEL ON A3-Al: TYPE ~IELD (Al9-Al6) = SF 4. SET RNI TO READ 5. SETFC3-FCOT00111 6. DRIVE SIZE PINS TO INDICATE A ONE·BYTE TRANSFER PROVIDE VECTOR NUMBER 7. ASSERT AS AND os 8. ASSERT THE CORRESPONDING iACKX STROBE. 1. PLACE VECTOR NUMBER ON LEAST SIGNFICANT BYTE OF DATA BUS 2. ASSERT OSACKx (OR AVEC f NO VECTOR NUMBER) ACQUIRE VECTOR NUMBER 1. LATCH VECTOR NUMBER RELEASE 2. NEGATE OS AND AS 1. NEGATE DSACKx _I START NEXT CYCLE 1 Figure 3-14. Interrupt Acknowledge Cycle Flowchart 3-28 MC68340 USER'S MANUAL MOTOROLA

ClKOUT .rL rl-fL

A3l-A4 -x - -x - AIJ ·x - FC3-fCO ·x - SIZO ]( .~ . Sill -V -r\ / -r\ / .V \ ~ ~ D7-1lO Dls-D8 ~ / X 'I X 'I \ / LJlj-ltLfi INTERRUPT LEVEL CPU SPACE 1 BYTE \ \ VECTOR FROMl6-B1T PORT VECTOR~~"_ .-INTERNAL ARBITRATION I ~ , , .. .. ' , , , Ito. Ito. Ito. , II. Ito. /' Ito. r\-rl- r\ D< r\ OC I\. ~ \ "- I~ WRITE STACK ~---- lACK CYCLE ---~ *ln1Bmal Arbitration may take between 0-2 clock cycles. Figure 3-15. Interrupt Acknowledge Cycle Timing 3.4.4.2 AUTOVECTOR INTERRUPT ACKNOWLEDGE CYCLE. When the interrupting device cannot supply a vector number, it requests an automatically generated vector (autovector). Instead of placing a vector number on the data bus and asserting DSACKx, the device asserts AVEC to terminate the cycle. If the DSACKx signals are asserted during an interrupt acknowledge cycle terminated by AVEC, the DSACKx signals and data MOTOROLA MC68340 USER'S MANUAL 3-29 •

will be ignored if AVEC is asserted before or at the same time as the DSACKX signals.

The vector number supplied in an autovector operation is derived from the interrupt level of the current interrupt. When AVEC' is asserted instead of DSACKX during an interrupt acknowledge cycle, the MC68340 ignores the state of the data bus and internally generates the vector number (the sum of the interrupt level plus 24 ($18». AVEC is multiplexed with CSO. The FIRQ bit in the SIM40 module configuration register controls whether the AVEC/CSO pin is used as an autovector input or as CSO (refer to Section 4 System Integration Module for additional information). AVEC is only sampled during an interrupt acknowledge cycle. During all other cycles, AVEC is ignored. Additionally, AVEC can be internally generated for external devices by programming the autovector register. Seven distinct autovectors can be used, corresponding to- the seven levels of interrupt available with signals IRQ7-'iR01. Figure 3-16 shows the timing for an autovector operation. 3.4.4.3 SPURIOUS INTERRUPT CYCLE. Requested interrupts, whether internal or external, are arbitrated internally. When no internal module (including the SIM40, which responds for external requests) responds during an interrupt acknowledge cycle by arbitrating for the interrupt acknowledge cycle internally, the spurious interrupt monitor generates an internal bus error Signal to terminate the vector acquisition. The MC68340 automatically generates the spurious interrupt vector number (24) insteadof the interrupt vector number in this case. When an external device does not respond to an interrupt acknowledge cycle with AVEC or DSACKx, a bus monitor must assert BERR, which results in the CPU32 taking the spurious interrupt vector. If HALT is also asserted, the MC68340 retries the interrupt acknowledge cycle instead of using the spurious interrupt vector. 3-30 MC68340 USER'S MANUAL MOTOROLA all-guides.c om

ClJ(OUT _IL rL IL

r--Lr1-J W1JL. rL n- , A31-A4 -X V . \ - -D( ~ D< INTERRUPT LEVEL ~ lX. - A3-Al -D( ~ V \ - NJ FC3-fCO -D( - D< ~PUSPACE X ~ -D( V ., ~ - 1 BYTE SIZO -D( - Sill 1\ ~ V ... ' -V , -r--\ ..A / ... \ -r--\ ..,). / " II. J/ \ II ... \- D1s-DO -+-----+-----1 AVEC ~---~---~---~~---------+----~---~~---~---~-- ~7~~1 ~---~---~---~~---___ ---~---------~~---+----+--- CYCLE INTERNAL READ ARBITRATION ~------------~K------------~ CYCLE • Internal Arbitration may take between 0-2 clocks. Figure 3-16. Autovector Operation Timing MOTOROLA UC68340 USER'S MANUAL .. 3-31

3.5 BUS EXCEPTION CONTROL CYCLES

The bus architecture requires assertion of DSACKx from an external device to signal that a bus cycle is complete. Neither DSACKX nor AVEC is asserted in the following cases: • DSACKXlAVEC is programmed to respond internally. • The external device does not respond. • Various other application-dependent errors occur. The MC68340 provides BERR when no device responds by asserting DSACKx/AVEC within an appropriate period of time after the MC68340 asserts AS. This mechanism allows the cycle to terminate and the MC68340 to enter exception processing for the error condition. HALT is also used for bus exception control. This signal can be asserted by an external device for debugging purposes to cause single bus cycle operation, or, in combination with BERR, a retry of a bus cycle in error. To properly control termination of a bus cycle for a retry or a bus error condition, DSACKX, BERR, and HALT can be asserted and negated with the rising edge of the MC68340 clock. This assures that when two signals are asserted simultaneously, the required setup and hold time for both is met for the same falling edge of the MC68340 clock. This or an equivalent precaution should be designed into the external circuitry to provide these signals. Alternatively, the internal bus monitor could be used. The acceptable bus cycle terminations for asynchronous cycles are summarized in relation to DSACKx assertion as follows (case numbers refer to Table 3-4): • Normal Termination: DSACKx is asserted; BERR and HALT remain negated (case 1). • Halt Termination: HALT is asserted at the same time as or before DSACKx, and BERR remains negated (case 2). • Bus Error Termination: BEAR is asserted in lieu of, at the same time as, or before DSACKX (case 3) or after DSACKx (case 4), and HALT remains negated; BERR is negated at the same time as or after DSACKX. • Retry Termination: HALT and BER"R are asserted in lieu of, at the same time as, or before DSACKx (case 5) or after DSACKx (case 6); BERR is negated at the same time as or after DSACKX, and HALT may be negated at the same time as or after BERR. Table 3-4 lists various combinations of control signal sequences and the resulting bus cycle terminations. To ensure predictable operation, 'BERR and HALT should be negated according to the specifications given in Section 11 Electrical Characteristics. DSACKx BERR, and HALT may be negated after AS. If DSACKx or BERR remain asserted into S2 of the next bus cycle, that cycle may be terminated prematurely. EXAMPLE A: A system uses a bus monitor timer to terminate accesses to an unpopulated address space. The timer asserts BERR after timeout (case 3). ' 3-32 MC68340 USER'S MANUAL MOTOROLA

EXAMPLE B: A system uses error detection and correction on RAM contents. The

designer may: 1. Delay ""D""S"AAC""Kx'- until data is verified and assert BERR and HALT simultaneously to indicate to the MC68340 to automatically retry the error cycle (case 5), or if data is valid, assert DSACKx (case 1). 2. Delay DSACKx until data is verified and assert BERR with or without DSACKx if data is in error (case 3). This initiates exception processing for software handling of the condition. 3. Return DSACKx prior to data verification; if data is invalid, BERR is asserted on the .. next clock cycle (case 4). This initiates exception processing for software handling of the condition. 4. Return DSACKx prior to data verification; if data is invalid, assert BERR and HALT on the next clock cycle (case 6). The memory controller can then correct the RAM prior to or during the automatic retry. Table 3-4. DSACKi, BERR, and HALT Assertion Results Asserted on Rising Edge of State case Control Num Signal N N+2 Result 1 ~ A S Normal cycle terminate and continue. BERR NA NA HAC!' NA X 2 ~ A S Normal cycle terminate and halt; continue BERR NA NA when HAC!' negated. HAC!' AIS S 3 ~ NAJA X Terminate and take bus error exception, BERR A 5 possibly deferred. HAC!' NA X 4 ~ A X Terminate and take bus error exception, BERR NA A possibly deferred. HAC!' NA NA 5 ~ NAJA X Terminate and retry when HACf negated. BERR A 5 HAC!' AJ5 5 6 ~ A X Terminate and retry when HACf negated. BERR NA A HAC!' NA A NOTE5: N - Number of the current even bus state (e.g., 52, 54, etc.) A - Signal is asserted in this bus state NA - 5ignal is not asserted in this state X - Don'tcare 5 - 5ignal was asserted in previous state and remains asserted in this state MOTOROLA MC68340 USER'S MANUAL 3-33

3.5.1 Bus Errors

BERR can be used to abort the bus cycle and the instruction being executed. BERR takes precedence over DSACKx provided it meets the timing constraints described in Section 11 Electrical Characteristics. If BERR does not meet these constraints, it may cause unpredictable operation of the MC68340. If BERR remains asserted into the next bus cycle, it may cause incorrect operation of that cycle. When BERR is issued to terminate a bus cycle, the MC68340 can enter exception processing immediately following the bus cycle, or it can defer processing the exception. The instruction prefetch mechanism requests instruction words from the bus controller before it is ready to execute them. If a bus error occurs on an instruction fetch, the MC68340 does not take the exception until it attempts to use that instruction word. Should an intervening instruction cause a branch or should a task switch occur, the bus error exception does not occur. The bus error condition is recognized during a bus cycle in any of the following cases: • DSACKx and HALT are negated, and BEAR is asserted. • HALT and BERR are negated, and DSACKx is asserted. BERR is then.asserted within one clock cycle (HALT remains negated) . • BERR and HALT are asserted simultaneously, indicating a retry. When the MC68340 recognizes a bus error condition, it terminates the current bus cycle in the normal way. Figure 3-17 shows the timing of a bus error for the case in which DSACKx is not asserted. Figure 3-18 shows the timing for a bus error that is asserted after DSACKx. Exceptions are taken in both cases. Refer to Section 5 CPU32 for details of bus error exception processing. In the second case, in which BERR is asserted ~fter DSACKx is asserted, BERR must be asserted within the time specified for purely asynchronous operation, or it must be asserted and remain stable during the sample window around the next falling edge of the clock after DSACKx is recognized. If BERR is not stable at this time, the MC68340 may exhibit erratic behavior. BERR has priority over DSACKx. In this case, data may be present on the bus, butit may not be. valid. This sequence can be used by systems that have memory error detection and correction logic and by external cache memories. 3-34 MC68340 USER'S MANUAL MOTOROLA

Figure 3-17. Bus Error without DSACKX

MOTOROLA MC68340 USER'S MANUAL 3-35 all-guides.c om

;;+t ___ STACK_

WRITE Figure 3·18. late Bus Error with DSACKx 3.5.2 Retry Operation When both BERR and HALT are asserted by an external device during a bus cycle, the MC68340 enters the retry sequence shown in Figure 3-19. A delayed retry, which is similar to the delayed BERR signal described previously, can also occur (see Figure 3-20). The MC68340 terminates the bus cycle, places the control signals in their inactive state, and does not begin another bus cycle until the BERR and HALT signals are negated by external logic. After a synchronization delay, the MC68340 retries the previous cycle using the same access information (address, function code, size, etc.). BERR should be negated before S2 of the retried cycle to ensure correct operation of the retried cycle. 3-36 MC68340 USER'S MANUAL MOTOROLA

CLKOUT -rl-It-fL fL fi-~

rl-rl-fi- fo-- A31-AO -~ - ~ ~ Dc -D( ~ Dc D<~ D< - ~. FC3-fCO V -1\ • "-- / \ I 1\ / \ / _v I I I DATA \\\ • I \ \\ IGNORED III '\ D1~ T 7 I • / , READ CYCLE WITH HALT __ _ READ RERUN_ RETRY e:_ .. __ ~ .. " rtI_ ....... ~ __ •• ___ _ .... ~- .. - - -_. ·--"·1 --,-_ .. _- The MC68340 retries any read or write cycle of a read-modify-write operation separately; RMC remains asserted during the entire retry sequence. Asserting BR along with BERR and HALT provides a relinquish and retry operation. The MC68340 does not relinquish the bus during a read-modify-write operation. Any device that requires the MC68340 to give up the bus and retry a bus cycle during a read-modify-write cycle must assert only BERR and BR (HALT must not be included). The bus error handler software should examine the read-modify-write bit in the special status word (see Section 5 CPU32) and take the appropriate action to resolve this type of fault when it occurs. MOTOROLA MC68340 USER'S MANUAL 3-37 •

A31-AO -n-IL IL ~

n-IL IL r-- -~ ~ ~ K - ClKOUT FC3-FCO -~ DC. X K 1\ _10. V V \ 1\ / \. f r- \ ~ \ U r- \ '/ \ V- 015-010 I)- 10. I I, / / WRITE HALT WRlTE,_ RERUN CYCLE Figure 3-20. late Retry Sequence 3.5.3 Halt Operation When HALT is asserted and BERR is not asserted, the MC68340 halts external bus activity at the next bus cycle boundary (see Figure 3-21 ). HALT by itself does not terminate a bus cycle. Negating and reasserting HALT in accordance with the correct timing requirements provides a single-step (bus cycle to bus cycle) operation. Since HALT affects external bus cycles only, a program that does not require use of the external bus may continue executing. The single-cycle mode allows the user to proceed through (and debug) external MC68340 operations, one bus cycle at a time. Since the occurrence of a bus error while HALT is asserted causes a retry operation, the user must anticipate retry cycles while debugging in the single-cycle mode. The single-step operation and the software trace capability allow the system debugger to trace single bus cycles, single instructions, or changes in program flow. When the MC68340 completes a bus cycle with HALT asserted, D15-DO is placed in the high-impedance state, and bus control signals are negated (not high-impedance state); the A31-AO, FCx, SIZx, and R!W signals remain in the same state. The halt operation has no effect on bus arbitration (see 3.6 Bus Arbitration). When bus arbitration occurs while the MC68340 is halted, the address and control signals are also placed in the high- impedance state. Once bus mastership is returned to the MC68340, if HALT is still 3-38 MC68340 USER'S MANUAL MOTOROLA

asserted, the A31-AO, FCx, SIZx, and RIW signals are again driven to their previous

states. The MC68340 does not service interrupt requests while it is halted. SO S2 S4 n.J1.sL so S2 S4 JL IL n- IL n-IL CLKOUT A31-AO -K '\ I> - FC3-f"CO -~ ~ - _/ Llo. ~ \ / '\ ~ \ / , -\ r---\ / / ~ ~ _I 1\ j. V ~ \ - I> - 1,\ 01&-010 \ \ I> , BG ~READ I .10( HA'Y .10( I READ~ (ARBITRATION PERMITTED WHILE THE PROCESSOR IS HALTED) Figure 3-21. HALT Timing 3.5.4 Double Bus Fault so r-- K K - - r >- A double bus fault results when a bus error or an address error occurs during the exception processing sequence for any of the following: • A previous bus error • A previous address error • A reset For example, the MC68340 attempts to stack several words containing information about the state of the machine while processing a bus error exception. If a bus error exception MOTOROLA MC68340 USER'S MANUAL 3-39 ..

occurs during the stacking operation, the second error is considered a double bus fault.

When a double bus fault occurs, the MC68340 halts and asserts HALT. Only a reset operation can restart a halted MC68340. However, bus arbitration can still occur (see 3.6 Bus Arbitration). A second bus error or address error that occurs after exception processing has completed (during the execution of the exception handler routine or later) does not cause a double bus fault. A bus cycle that is retried does not constitute a bus error or contribute to a double bus fault. The MC68340 continues to retry the same bus cycle as long as the external hardware requests it. Reset can also be generated internally by the halt monitor (see Section 5 CPU32). 3.6 BUS ARBITRATION The bus design of the MC68340 provides for a single bus master at anyone time, either the MC68340 or an external device. One or more of the external devices on the bus can have the capability of becoming bus master for the external bus, but not the MC68340 internal bus. Bus arbitration is the protocol by which an external device becomes bus master; the bus controller in the MC68340 manages the bus arbitration signals so that the MC68340 has the lowest priority. External devices that need to obtain the bus must assert the bus arbitration signals in the sequences described in the following paragraphs. Systems having several devices that can become bus master require external circuitry to assign priorities to the devices so that, when two or more external devices attempt to become bus master at the same time, the one having the highest priority becomes bus master first. The sequence of the protocol is as follows: 1. An external device asserts BA. 2. The MC68340 asserts BG to indicate that the bus is available. 3. The external device asserts BGACK to indicate that it has assumed bus mastership. NOTE The MC68340 does not place CS3-CSO in a high-impedance state after reset or when the bus is granted to an external master. BR may be issued any time during a bus cycle or between cycles. BG is asserted in response to BA. To guarantee operand coherency, BG is only asserted at the end of an operand transfer. Additionally, BG is not asserted until the end of a read-modify-write operation (when RMC is negated) in response to a BR signal. When the requesting device receives BG and more than one external device can be bus master, the requesting device should begin whatever arbitration is required. When the external device assumes bus mastership, it asserts BGACK and maintains BGACK during the entire bus cycle (or cycles) for which it is bus master, The following conditions must be met for an external device to assume mastership of the bus through the normal bus arbitration procedure: 1) it must have received BG through the arbitration process, and 2) BGACK must be inactive, indicating that no other bus master has claimed ownership of the bus. 3-40 MC68340 USER'S MANUAL MOTOROlA all-guides.c om

Figure 3-22 is a flowchart showing bus arbitration for a single device. This technique

allows processing of bus requests during data transfer cycles. Refer to Figures 3-23 and 3-24 for bus arbitration timing diagrams. BR is negated at the time that BGACK is asserted. This type of operation applies to a system consisting of the MC68340 and one device capable of bus mastership. In a system having a number of devices capable of bus mastership, BR from each device can be wire- ORed to the MC68340. In such a system, more than one bus request could be asserted simultaneously. BG is negated a few clock cycles after the transition of BGACK. However, if bus requests are still pending after the negation of BG, the MC68340 asserts another ~ BG within a few clock cycles after it was negated. This additional assertion of BG allows ~ external arbitration circuitry to select the next bus master before the current bus master has finished using the bus. The following paragraphs provide additional information about the three steps in the arbitration process. Bus arbitration requests are recognized during normal processing, HALT assertion, and a CPU32 halt caused by a double bus fault. PROCESSOR REQUESTING DEVICE REQUEST THE BUS GRANT BUS ARBITRATION 1. ASSERT BR - 1. ASSERTBG ACKNOWLEDGE BUS MASTERSHIP 1. EXTERNAL ARBITRATION DETERMINES NEXT BUS MASTER 2. NEXT BUS MASTER WAITS FOR BGACK TO BE NEGATED I 3. NEXT BUS MASTER ASSERTS BGACK TERMINATE ARBITRATION TO BECOME NEW MASTER I I 4. BUS MASTER NEGATES SA 11. NEGATE BG (AND WAITFOR I BGACK TO BE NEGATED) OPERATE AS BUS MASTER I 1. PERFORM DATA TRANSFERS (READ AND WRITE CYCLES) ACCORDING TO THE SAME RULES THE PROCESSOR USES • RELEASE BUS MASTERSHIP I RE-ARBITRATE OR RESUME L 1. NEGATE BGACK PROCESSOR OPERATION I Figure 3-22. Bus Arbitration Flowchart for Single Request MOTOROLA MC68340 USER'S MANUAL 3-41

Figure 3-23. Bus Arbitration Timing Diagram-Idle Bus Case

so Sl S2 S3 S4 S5 CLKOUT A31-MJ J ) 015-00 .=J ( ) AS \ r-' os \ I' FWi\ /' OSACKO. \ / OSACKI iiR \ ~ / BG \ I BGACK \ Figure 3-24. Bus Arbitration Timing Diagram-Active Bus Case 3-42 MC68340 USER'S MANUAL MOTOROLA

3.6.1 Bus Request

External devices capable of becoming bus masters request the bus by asserting BA. This signal can be wire-ORed to indicate to the MC68340 that some external device requires control of the bus. The MC68340 is effectively at a lower bus priority level than the external device and relinquishes the bus after it has completed the current bus cycle (if one has started). If no BGACK is received while the BA is active, the MC68340 remains bus master once BA is negated. This prevents unnecessary interference with ordinary processing if the arbitration circuitry inadvertently responds to noise or if an external device determines that it no longer requires use of the bus before it has been granted • mastership. 3.6.2 Bus Grant The MC68340 supports operand coherency; thus, if an operand transfer requires multiple bus cycles, the MC68340 does not release the bus until the entire transfer is complete. Therefore, assertion of BG is subject to the following constraints: • The minimum time for BG assertion after BA is asserted depends on internal synchronization (see Section 11 Electrical Characteristics). • During an external operand transfer, the MC68340 does not assert BG until after the last cycle of the transfer (determined by SIZx and DSACKx). • During an external operand transfer, the MC68340 does not assert BG as long as RMC is asserted. • If the show cycle bits SHEN1-5HENO = 01, the MC68340 does not assert BG to an external master. Externally, the 00 signal can be routed through a daisy-chained network or a priority- encoded network. The MC68340 is not affected by the method of arbitration as long as the protocol is obeyed. 3.6.3 Bus Grant Acknowledge An external device cannot request and be granted the external bus while another device is the active bus master. A device that asserts BGACK remains the bus master until it negates BGACK. BGACK should not be negated until all required bus cycles are completed. Bus mastership is terminated at the negation of BGACK. Once an external device receives the bus and asserts BGACK, it should negate BA. If BA remains asserted after BGACK is asserted, the MC68340 assumes that another device is requesting the bus and prepares to issue another BG. MOTOROLA MC68340 USER'S MANUAL 3-43

3.6.4 Bus Arbitration Control

The bus arbitration control unit in the MC68340 is implemented with a finite state machine. As discussed previously, all asynchronous inputs to the MC68340 are internally synchronized in a maximum of two cycles of the clock. As shown in Figure 3-25 input signals labeled R and A are internally synchronized versions of BR and BGACK respectively. The BG output is labeled G, and the internal high-impedance control signal is labeled T. If T is true, the address, data, and control buses are placed in the high- impedance state after the next rising edge following the negation of AS and RMC. All signals are shown in positive logic (active high) regardless of their true active voltage level. The state machine shown in Figure 3-25 does not have a state 1 or state 4. State changes occur on the next rising edge of the clock after the internal signal is valid. The BG signal transitions on the falling edge of the clock after a state is reached during which G changes: The bus control signals (controlled by T) are driven by the MC68340 immediately following a state change, when bus mastership is returned to the MC68340. State 0, in which G and T are both negated, is the state of the bus arbiter while the MC68340 is bus master. R and A keep the arbiter in state 0 as long as they are both negated. The MC68340 does not allow arbitration of the external bus during the RMC sequence. For the duration of this sequence, the MC68340 ignores the BR input. If mastership of the bus is required during an RMC operation, BERR must be used to abort the RMC sequence. I 3.6.5 Show Cycles The MC68340 can perform data transfers with its internal modules without using the external bus, but, when debugging, it is desirable to have address and data information appear on the external bus. These external bus cycles, called show cycles, are distinguished by the fact that AS is not asserted externally. OS is used to signal address strobe timing in show cycles. After reset, show cycles are disabled and must be enabled by writing to the SHEN bits in the module configuration register (see 4.3.2.1 Module Configuration Register (MCR». When show cycles are disabled, the A31-AO, FCx, SIZx, and RIW signals continue to reflect internal bus activity. However, AS 'and OS are not asserted externally, and the external data bus remains in a high-impedance state. When show cycles are enabled, OS indicates address strobe timing and the external data bus contains data. The following paragraphs are a state-by-state description of show cycles, and Figure 3-26 illustrates a show cycle timing diagram. Refer to Section 11 Electrical Characteristics for specific timing information. 3-44 MC68340 USER'S MANUAL MOTOROLA

R -BUS REQUEST

A -BUS GRANT ACKNOWLEDGE B -BUS CVa.E IN PROGRESS G-BUSGRANT T -THREE-STATE SIGNAL TO BUS CONTROL V -BUS AVAlABLE TO BUS CONTROL Figure 3·25. Bus Arbitration State Diagram MC68340 USER'S MANUAL • 3-45 all-guides.c om

State ~During state 0, the A31-AO and FCx become valid, RIW is driven to indicate a

show read or write cycle, and the SIZx pins indicate the number of bytes to transfer. During a read, the addressed peripheral is driving the data bus, and the user must take care to avoid bus conflicts. State 41-Qne-half clock cycle later, DS (rather than AS) is asserted to indicate that address information is valid. State 42-No action occurs in state 42. The bus controller remains in state 42 (wait states will be inserted) until the internal read cycle is complete. State 43-When DS is negated, show data is valid on the next falling edge of the system clock. The external data bus drivers are enabled so that data becomes valid on the external bus as soon as it is available on the internal bus. State o-The A31-AO, FCx, RIW, and SIZx pins change to begin the next cycle. Data from the preceding cycle is valid through state O. so 841 842 S43 so Sl S2 CLKOUT A31-AO, X X FC2-fCO, S1Z1~1ZO Alii ===x X AS,CS \ os \ I \ D15-DO ==> < ~ ) BKPT \ L I .. SHOW CYClE 10 1 .. START OF EXTERNAL CYCLE-.j Figure 3-26. Show Cycle Timing Diagram 3.7 RESET OPERATION The MC68340 has reset control logic to determine the cause of reset, synchronize it if necessary, and assert the appropriate reset lines. The reset control logic can independentl}, drive three different lines: 1. EXTRST (external reset) drives the external RESET pin. 2. CLKRST (clock reset) resets the clock module. 3. INTRST (internal reset) goes to all other internal circuits. 3-46 MC68340 USER'S MANUAL MOTOROLA

Synchronous reset sources are not asserted until the end of the current bus cycle,

whether or not RMC is asserted. The internal bus monitor is automatically enabled for synchronous resets; therefore, if the current bus cycle does not terminate normally, the bus monitor terminates it. Only singfe-byte or word transfers are guaranteed valid for synchronous resets. An external or clock reset is a synchronous reset source. Asynchronous reset sources indicate a catastrophic failure, and the reset controller logic immediately resets the system. Resetting the MC68340 causes any bus cycle in progress to terminate as if DSACKx or BERR had been asserted. In addition, the MC68340 appropriately initializes registers for a reset exception. Asynchronous reset sources 3 include power-up, software watchdog, double bus fault resets, and execution of the RESET instruction. If an external device drives RESET low, RESET should be asserted for at least 590 clock periods to ensure that the MC68340 resets. The reset control logic holds reset asserted internally until the external RESET is released. When the reset control logic detects that external RESET is no longer being driven, it drives both internal and external reset low for an additional 512 cycles to guarantee this length of reset to the entire system. Figure 3-27 shows the RESET timing. ra= RESET II I"" 590 CLOCK ~n4 512 CLOCK "" !.--PUUED ~RNAL---+lI.-DRIVEN BY MC6834O-..J t'lgure 3-27. Timing for External Devices Driving RESET If reset is asserted from any other source, the reset control logic asserts RESET for 328 input clock periods plus 512 output clock periods, and until the source of reset is negated. After any internal reset occurs, a 14-cycle rise time is allowed before testing for the presence of an external reset. If no external reset is detected, the CPU32 begins its vector fetch. Figure 3-28 is a timing diagram of the power-up reset operation, showing the relationships between RESET, Vce, and bus signals. During the reset period, the entire bus three- states except for non-three-statable signals, which are driven to their inactive state. Once RESET negates, all control signals are driven to their inactive state, the data bus is in read mode, and the address bus is driven. After this, the first bus cycle for RESET exception processing begins. MOTOROLA MC68340 USER'S MANUAL 3-47

.---1~---=-51~=-~i=~~~~~ _______________ __

TCLKOUT RESH ______________________________ ~~~~~ BUS ~----..L~------------------------I-"i CYCLES ADDRESS AND 1-·~.~~:::..:::.';_o.;..-----eoNTROL SIGNALS ----~f4f­ THREE-STATED NOTES: 1. Internal start-up time. 2. SSP read here. 3. PC read here. 4. First instruction fetched here. Figure 3-28. Power-Up Reset Timing Diagram When a RESET instruction is executed, the MC68340 drives the RESET signal for 512 clock cycles. The SIM40 registers and the module control registers in each internal peripheral module (DMA, timers, and serial modules) are not affected. All other peripheral module registers are reset the same as for a hardware reset. The external devices connected to the RESET signal are reset at the completion of the RESET instruction. 3-48 MC68340 USER'S MANUAL MOTOROLA

SYSTEM INTEGRATION MODULE

The MC68340 system integration module (SIM40) consists of several functions that control the system start-up, initialization, configuration, and the external bus with a minimum of external devices. It also provides the IEEE 1149.1 boundary scan capabilities. The SIM40 includes the following functions: • System Configuration and Protection • Clock Synthesizer • Chip Selects and Wait States • External Bus Interface • Bus Arbitration • Dynamic Bus Sizing • IEEE 1149.1 Test Access Port 4.1 MODULE OVERVIEW The SIM40 is essentially identical to the SIM implemented in the MC68330. The SIM40 has similar features to the SIM in the MC68331, MC68332, and MC68333. The periodic interrupt timer, double bus fault monitor, software watchdog, internal bus monitor, and ;:;~;.;~:~;.;.; :i-,~",ii-u':'~ ",u"iiu, all:! iUI:!IIiil;C1i. j--juw~v~r, rllCUlY oj me omer Tealures In me ~IM'S differ in their use and details. The system configuration and protection function controls system configuration and provides various monitors and timers, including the internal bus monitor, double bus fault monitor, spurious interrupt monitor, software watchdog timer, and the periodic interrupt timer. The clock synthesizer generates the clock signals used by the SIM40 and the other on- chip modules, as well as CLKOUT used by external devices. The programmable chip select function provides four chip select signals that can enable external memory and peripheral circuits, providing all handshaking and timing signals. Each chip select signal has an associated base address register and an address mask register that contain the programmable characteristics of that chip select. Up to three wait states can be programmed by setting bits in the address mask register. MOTOROLA MC68340 USER'S MANUAL 4-1 ..

Other Processor Manuals