Part Number Hot Search : 
R0J47 AD62551A PPR100 ULBM15 FIN1025 KDV350E S1YB20 ACHIP
Product Description
Full Text Search
 

To Download CPU32RM Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. "typical" parameters can and do vary in different applications. all operating parameters, including "typicals" must be validated for each customer application by customer's technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and ! are registered trademarks of motorola, inc. motorola, inc. is an equal opportunity/affirmative action employer. ?motorola, inc., 1990, 1996 cpu32 reference manual f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 reference manual motorola iii preface this reference manual describes programming and operation of the cpu32 in- struction processing module, found in the m68300 family of embedded controllers. it is part of a multivolume set of manuals ?each volume corresponds to a major module in the m68300 family. a user's manual for each device incorporating the cpu32 describes processor function and operation with reference to other modules within the device. this manual consists of the following sections and appendix: section 1 overview section 2 architecture summary section 3 data organization and addressing capabilities section 4 instruction set section 5 processing states section 6 exception processing section 7 development support section 8 instruction execution timing appendix a m68000 family summary index note in this manual, the terms assertion and negation specifya particular logic state. assert and assertion refer to an active or true signal. negate and negation refer to an inactive or false signal. these terms are used independently of the voltage level that they represent. this manual is written for systems designers, systems programmers, and applica- tions programmers. systems designers need general knowledge of the entire vol- ume, with particular emphasis on section 1, section 7, and appendix a ?they will also need to be familiar with electrical specifications and mechanical data con- tained in the user? manual. systems programmers should become familiar with sections 1 through 6, section 8, and appendix a. applications programmers can find most of the information they need in sections 1 through 5, section 8, and ap- pendix a. this manual is also written for users of the m68000 family that are not familiar with the cpu32. although there are comparative references to other motorola micro- processors throughout the manual, section 1, section 2, and appendix a specifi- cally identify the cpu32 within the m68000 family, and discuss the differences betweeen it and related devices. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola cpu32 reference manual iv f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 motorola reference manual v paragraph title page section 1 overview 1.1 features .................................................................................................... 1-1 1.1.1 virtual memory .................................................................................. 1-2 1.1.2 loop mode instruction execution ...................................................... 1-2 1.1.3 vector base register ........................................................................ 1-3 1.1.4 exception handling ........................................................................... 1-3 1.1.5 enhanced addressing modes ........................................................... 1-4 1.1.6 instruction set ................................................................................... 1-4 1.1.6.1 table lookup and interpolation instructions ............................. 1-4 1.1.6.2 low-power stop instruction ...................................................... 1-6 1.1.7 processing states ............................................................................. 1-6 1.1.8 privilege states ................................................................................. 1-6 1.2 block diagram ........................................................................................... 1-6 section 2architecture summary 2.1 programming model .................................................................................. 2-1 2.2 registers ................................................................................................... 2-2 2.3 data types ................................................................................................ 2-3 2.3.1 organization in registers .................................................................. 2-4 2.3.1.1 data registers .......................................................................... 2-4 2.3.1.2 address registers ..................................................................... 2-5 2.3.1.3 control registers ...................................................................... 2-5 2.3.2 organization in memory .................................................................... 2-6 section 3 data organization and addressing capabilities 3.1 program and data references .................................................................. 3-1 3.2 notation conventions ................................................................................ 3-2 3.3 implicit reference ...................................................................................... 3-2 3.4 effective address ...................................................................................... 3-3 3.4.1 register direct mode ......................................................................... 3-3 3.4.1.1 data register direct .................................................................. 3-3 3.4.1.2 address register direct ............................................................ 3-3 3.4.2 memory addressing modes ............................................................... 3-4 3.4.2.1 address register indirect .......................................................... 3-4 3.4.2.2 address register indirect with postincrement .......................... 3-4 3.4.2.3 address register indirect with predecrement .......................... 3-4 3.4.2.4 address register indirect with displacement ........................... 3-5 3.4.2.5 address register indirect with index (8-bit displacement) ...... 3-5 3.4.2.6 address register indirect with index (base displacement) ..... 3-6 table of contents f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola cpu32 vi reference manual (continued) paragraph title page table of contents 3.4.3 special addressing modes ................................................................ 3-7 3.4.3.1 program counter indirect with displacement ........................... 3-7 3.4.3.2 program counter indirect with index (8-bit displacement) ....... 3-7 3.4.3.3 program counter indirect with index (base displacement) ...... 3-8 3.4.3.4 absolute short address ............................................................ 3-8 3.4.3.5 absolute long address ............................................................. 3-9 3.4.3.6 immediate data ......................................................................... 3-9 3.4.4 effective address encoding summary .............................................. 3-9 3.5 programming view of addressing modes ............................................... 3-11 3.5.1 addressing capabilities ................................................................... 3-11 3.5.2 general addressing mode summary .............................................. 3-14 3.6 m68000 family addressing capability .................................................... 3-14 3.7 other data structures ............................................................................. 3-15 3.7.1 system stack .................................................................................. 3-15 3.7.2 user stacks ..................................................................................... 3-16 3.7.3 queues ............................................................................................ 3-17 section 4 instruction set 4.1 m68000 family compatibility .................................................................... 4-1 4.1.1 new instructions ................................................................................ 4-1 4.1.1.1 low-power stop (lpstop) ...................................................... 4-1 4.1.1.2 table lookup and interpolation (tbl) ....................................... 4-2 4.1.2 unimplemented instructions .............................................................. 4-2 4.2 instruction format ..................................................................................... 4-2 4.2.1 notation ............................................................................................. 4-3 4.3 instruction summary ................................................................................. 4-5 4.3.1 condition code register ................................................................... 4-5 4.3.2 data movement instructions .............................................................. 4-6 4.3.3 integer arithmetic operations ............................................................ 4-7 4.3.4 logic instructions .............................................................................. 4-8 4.3.5 shift and rotate instructions ............................................................. 4-9 4.3.6 bit manipulation instructions ............................................................. 4-9 4.3.7 binary-coded decimal (bcd) instructions ...................................... 4-10 4.3.8 program control instructions ........................................................... 4-10 4.3.9 system control instructions ............................................................ 4-11 4.3.10 condition tests ............................................................................... 4-12 4.4 instruction details .................................................................................... 4-13 4.5 instruction format summary ................................................................. 4-170 4.6 table lookup and interpolation instructions ......................................... 4-188 4.6.1 table example 1: standard usage ............................................... 4-188 4.6.2 table example 2: compressed table ........................................... 4-189 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 motorola reference manual vii (continued) paragraph title page table of contents 4.6.3 table example 3: 8-bit independent variable ............................... 4-191 4.6.4 table example 4: maintaining precision ....................................... 4-192 4.6.5 table example 5: surface interpolations ...................................... 4-194 4.7 nested subroutine calls ........................................................................ 4-194 4.8 pipeline synchronization with the nop instruction ............................... 4-194 section 5processing states 5.1 state transitions ....................................................................................... 5-1 5.2 privilege levels ......................................................................................... 5-1 5.2.1 supervisor privilege level ................................................................. 5-2 5.2.2 user privilege level .......................................................................... 5-2 5.2.3 changing privilege level ................................................................... 5-2 5.3 types of address space ........................................................................... 5-3 5.3.1 cpu space access .......................................................................... 5-3 5.3.1.1 type 0000 ?breakpoint .......................................................... 5-4 5.3.1.2 type 0001 ?mmu access ...................................................... 5-4 5.3.1.3 type 0010 ?coprocessor access ........................................... 5-4 5.3.1.4 type 0011 ?internal register access ..................................... 5-4 5.3.1.5 type 1111 ?interrupt acknowledge ........................................ 5-5 section 6 exception processing 6.1 definition of exception processing ............................................................ 6-1 6.1.1 exception vectors ............................................................................. 6-1 6.1.2 types of exceptions .......................................................................... 6-2 6.1.3 exception processing sequence ....................................................... 6-3 6.1.4 exception stack frame ..................................................................... 6-3 6.1.5 multiple exceptions ........................................................................... 6-4 6.2 processing of specific exceptions ............................................................ 6-5 6.2.1 reset ................................................................................................. 6-5 6.2.2 bus error ........................................................................................... 6-6 6.2.3 address error .................................................................................... 6-7 6.2.4 instruction traps ................................................................................ 6-8 6.2.5 software breakpoints ........................................................................ 6-8 6.2.6 hardware breakpoints ....................................................................... 6-8 6.2.7 format error ...................................................................................... 6-9 6.2.8 illegal or unimplemented instructions ............................................... 6-9 6.2.9 privilege violations .......................................................................... 6-10 6.2.10 tracing ............................................................................................ 6-11 6.2.11 interrupts ......................................................................................... 6-12 6.2.12 return from exception ..................................................................... 6-13 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola cpu32 viii reference manual (continued) paragraph title page table of contents 6.3 fault recovery ........................................................................................ 6-14 6.3.1 types of faults ................................................................................ 6-16 6.3.1.1 type i: released write faults ................................................. 6-16 6.3.1.2 type ii: prefetch, operand, rmw, and movep faults .......... 6-17 6.3.1.3 type iii: faults during movem operand transfer ................. 6-17 6.3.1.4 type iv: faults during exception processing ......................... 6-18 6.3.2 correcting a fault ............................................................................ 6-18 6.3.2.1 (type i) completing released writes via software ................ 6-19 6.3.2.2 (type i) completing released writes via rte ....................... 6-19 6.3.2.3 (type ii) correcting faults via rte ......................................... 6-19 6.3.2.4 (type iii) correcting faults via software ................................. 6-20 6.3.2.5 (type iii) correcting faults by conversion and restart ......... 6-20 6.3.2.6 (type iii) correcting faults via rte ........................................ 6-21 6.3.2.7 (type iv) correcting faults via software ................................ 6-21 6.4 cpu32 stack frames .............................................................................. 6-21 6.4.1 normal four-word stack frame ..................................................... 6-22 6.4.2 normal six-word stack frame ........................................................ 6-22 6.4.3 berr stack frame ......................................................................... 6-22 section 7 development support 7.1 cpu32 integrated development support .................................................. 7-1 7.1.1 background debug mode (bdm) overview ...................................... 7-1 7.1.2 deterministic opcode tracking overview ......................................... 7-2 7.1.3 on-chip hardware breakpoint overview .......................................... 7-3 7.2 background debug mode (bdm) .............................................................. 7-3 7.2.1 enabling bdm ................................................................................... 7-4 7.2.2 bdm sources .................................................................................... 7-4 7.2.2.1 external bkpt signal ................................................................ 7-4 7.2.2.2 bgnd instruction ...................................................................... 7-4 7.2.2.3 double bus fault ....................................................................... 7-5 7.2.2.4 peripheral breakpoints .............................................................. 7-5 7.2.3 entering bdm .................................................................................... 7-5 7.2.4 command execution ......................................................................... 7-5 7.2.5 background mode registers ............................................................. 7-6 7.2.5.1 fault address register (far) ................................................... 7-6 7.2.5.2 return program counter (rpc) ................................................ 7-6 7.2.5.3 current instruction program counter (pcc) ............................. 7-7 7.2.6 returning from bdm .......................................................................... 7-7 7.2.7 serial interface .................................................................................. 7-7 7.2.7.1 cpu serial logic ....................................................................... 7-8 7.2.7.2 development system serial logic .......................................... 7-10 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 motorola reference manual ix (continued) paragraph title page table of contents 7.2.8 command set ................................................................................. 7-11 7.2.8.1 command format ................................................................... 7-11 7.2.8.2 command sequence diagram ................................................ 7-12 7.2.8.3 command set summary ......................................................... 7-14 7.2.8.4 read a/d register (rareg/rdreg) .................................... 7-15 7.2.8.5 write a/d register (wareg/wdreg) ................................... 7-15 7.2.8.6 read system register (rsreg) ............................................ 7-16 7.2.8.7 write system register (wsreg) ........................................... 7-16 7.2.8.8 read memory location (read) .............................................. 7-17 7.2.8.9 write memory location (write) ............................................ 7-18 7.2.8.10 dump memory block (dump) ................................................. 7-19 7.2.8.11 fill memory block (fill) ......................................................... 7-21 7.2.8.12 resume execution (go) ......................................................... 7-22 7.2.8.13 call user code (call) ........................................................... 7-22 7.2.8.14 reset peripherals (rst) ......................................................... 7-24 7.2.8.15 no operation (nop) ................................................................ 7-24 7.2.8.16 future commands .................................................................. 7-25 7.3 deterministic opcode tracking ............................................................... 7-25 7.3.1 instruction fetch (ifetch) ............................................................. 7-25 7.3.2 instruction pipe (ipipe) ................................................................... 7-25 7.3.3 opcode tracking during loop mode ............................................... 7-27 section 8 instruction execution timing 8.1 resource scheduling ................................................................................ 8-1 8.1.1 microsequencer ................................................................................. 8-1 8.1.2 instruction pipeline ............................................................................ 8-2 8.1.3 bus controller resources ................................................................. 8-2 8.1.3.1 prefetch controller .................................................................... 8-3 8.1.3.2 write-pending buffer ................................................................. 8-3 8.1.3.3 microbus controller ................................................................... 8-3 8.1.4 instruction execution overlap ........................................................... 8-4 8.1.5 effects of wait states ........................................................................ 8-5 8.1.6 instruction execution time calculation ............................................. 8-5 8.1.7 effects of negative tails .................................................................... 8-6 8.2 instruction stream timing examples ......................................................... 8-7 8.2.1 timing example 1: execution overlap .............................................. 8-7 8.2.2 timing example 2: branch instructions ............................................. 8-8 8.2.3 timing example 3: negative tails ..................................................... 8-9 8.3 instruction timing tables ........................................................................ 8-10 8.3.1 fetch effective address .................................................................. 8-12 8.3.2 calculate effective address ............................................................ 8-13 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola cpu32 x reference manual (continued) paragraph title page table of contents 8.3.3 move instruction ............................................................................ 8-14 8.3.4 special-purpose move instruction ................................................. 8-14 8.3.5 arithmetic/logic instructions ........................................................... 8-15 8.3.6 immediate arithmetic/logic instructions .......................................... 8-17 8.3.7 binary-coded decimal and extended instructions .......................... 8-18 8.3.8 single operand instructions ............................................................ 8-18 8.3.9 shift/rotate instructions .................................................................. 8-19 8.3.10 bit manipulation instructions ........................................................... 8-20 8.3.11 conditional branch instructions ....................................................... 8-20 8.3.12 control instructions ......................................................................... 8-21 8.3.13 exception-related instructions and operations .............................. 8-21 8.3.14 save and restore operations ......................................................... 8-22 appendix am68000 family summary index f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 motorola reference manual xi figure title page 1-1 loop mode instruction sequence ................................................................... 1-3 1-2 cpu32 block diagram ................................................................................... 1-7 2-1 user programming model .............................................................................. 2-2 2-2 supervisor programming model supplement ................................................. 2-2 2-3 status register ............................................................................................... 2-3 2-4 data organization in data registers .............................................................. 2-4 2-5 address organization in address registers ................................................... 2-5 2-6 memory operand addressing ........................................................................ 2-7 3-1 single-effective-address instruction operation word .................................... 3-1 3-2 effective address specification formats ...................................................... 3-10 3-3 using size in the index selection ................................................................ 3-12 3-4 using absolute address with indexes .......................................................... 3-12 3-5 addressing array items ................................................................................ 3-13 3-6 m68000 family address extension words .................................................. 3-15 4-1 instruction word general format ................................................................... 4-2 4-2 instruction description format ..................................................................... 4-14 4-3 table example 1 ........................................................................................ 4-188 4-4 table example 2 ........................................................................................ 4-189 4-5 table example 3 ........................................................................................ 4-191 6-1 exception stack frame .................................................................................. 6-4 6-2 reset operation flowchart ............................................................................. 6-6 6-3 format $0 ?four-word stack frame ......................................................... 6-22 6-4 format $2 ?six-word stack frame ........................................................... 6-22 6-5 internal transfer count register .................................................................. 6-23 6-6 format $c ?berr stack for prefetches and operands ............................ 6-24 6-7 format $c ?berr stack on movem operand ........................................ 6-24 6-8 format $c ?four- and six-word berr stack .......................................... 6-24 7-1 in-circuit emulator configuration ................................................................... 7-2 7-2 bus state analyzer configuration .................................................................. 7-2 7-3 bdm block diagram ....................................................................................... 7-3 7-4 bdm command execution flowchart ............................................................ 7-6 7-5 debug serial i/o block diagram .................................................................... 7-8 7-6 serial interface timing diagram ..................................................................... 7-9 7-7 bkpt timing for single bus cycle ............................................................... 7-10 7-8 bkpt timing for forcing bdm ..................................................................... 7-10 7-9 bkpt/dsclk logic diagram ....................................................................... 7-11 7-10 command-sequence-diagram example ...................................................... 7-13 7-11 functional model of instruction pipeline ....................................................... 7-26 7-12 instruction pipeline timing diagram ............................................................. 7-26 8? block diagram of independent resources ..................................................... 8-2 8-2 simultaneous instruction execution ............................................................... 8-4 list of illustrations f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola cpu32 xii reference manual (continued) figure title page list of illustrations 8? attributed instruction times ............................................................................ 8-4 8-4 example 1 ?instruction stream .................................................................... 8-7 8-5 example 2 ?branch taken .......................................................................... 8-8 8-6 example 2 ?branch not taken .................................................................... 8-8 8-7 example 3 ?branch negative tail ............................................................... 8-9 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 motorola reference manual xiii table title page 1-1 instruction set summary ....................................................................................... 1-5 3-1 effective addressing mode categories................................................................ 3-11 4-1 condition code computations............................................................................... 4-5 4-2 data movement operations................................................................................... 4-6 4-3 integer arithmetic operations ................................................................................ 4-7 4-4 logic operations.................................................................................................... 4-8 4-5 shift and rotate operations .................................................................................. 4-9 4-6 bit manipulation operations................................................................................ 4-10 4-7 binary-coded decimal operations ...................................................................... 4-10 4-8 program control operations................................................................................ 4-10 4-9 system control operations.................................................................................. 4-11 4-10 condition tests.................................................................................................. 4-12 4-11 operation code map ....................................................................................... 4-170 5-1 address spaces..................................................................................................... 5-3 6-1 exception vector assignments .............................................................................. 6-2 6-2 exception priority groups ...................................................................................... 6-4 6-3 tracing control .................................................................................................... 6-11 7-1 bdm source summary .......................................................................................... 7-4 7-2 polling the bdm entry source ............................................................................... 7-5 7-3 cpu generated message encoding...................................................................... 7-8 7-4 bdm command summary................................................................................... 7-14 a-1 m68000 instruction set extensions ....................................................................... a-3 a-2 m68000 addressing modes................................................................................... a-4 list of tables f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola cpu32 xiv reference manual (continued) table title page list of tables f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 overview motorola reference manual 1-1 section 1 overview the cpu32, the first-generation instruction processing module of the m68300 family, is based on the industry-standard mc68000 processor. it has many features of the mc68010 and mc68020, as well as unique features suited for high-performance con- troller applications. the cpu32 is source code and binary code compatible with the m68000 family. cpu32 power consumption during normal operation is low because it is a high-speed complementary metal-oxide semiconductor (hcmos) device. power consumption can be reduced to a minimum during periods of inactivity by executing the low-power stop (lpstop) instruction, which shuts down the cpu32 and other intermodule bus (imb) submodules. ease of programming is an important consideration in using a microcontroller. the cpu32 instruction format reflects a predominately register-memory interaction philos- ophy. all data resources are available to all operations requiring those resources. there are eight multifunction data registers and seven general-purpose addressing registers. the data registers readily support 8-bit (byte), 16-bit (word), and 32-bit (long word) operand lengths for all operations. address manipulation is supported by word and long-word operations. although the program counter (pc) and stack pointers (sp) are special purpose registers, they are also available for most data addressing activi- ties. ease of program checking and diagnosis is enhanced by trace and trap capabil- ities at the instruction level. as controller applications become more complex and control programs become larger, high-level language (hll) will become the system designer's choice in programming languages. hll aids rapid development of complex algorithms, with less error, and is readily portable. the cpu32 instruction set will efficiently support hll. 1.1 features features of the cpu32 are as follows: ?fully upward object code compatible with m68000 family ?virtual memory implementation ?loop mode of instruction execution ?fast multiply, divide, and shift instructions ?fast bus interface with dynamic bus port sizing ?improved exception handling for controller applications ?enhanced addressing modes ?scaled index ?address register indirect with base displacement and ?expanded pc relative modes ?32-bit branch displacements ?instruction set enhancements f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola overview cpu32 1-2 reference manual ?high-precision multiply and divide ?trap on condition codes ?upper and lower bounds checking ? enhanced breakpoint instruction ? trace on change of flow ? table lookup and interpolate instruction ? low-power stop instruction ? hardware breakpoint signal, background mode ? 16.77-mhz operating frequency (?0 to 125 c) ? fully static implementation 1.1.1 virtual memory a system that supports virtual memory has a limited amount of high-speed physical memory that can be accessed directly by the processor and maintains an image of a much larger ?irtual?memory on a secondary storage device. when the processor at- tempts to access a location in the virtual memory map that is not resident in physical memory, a page fault occurs. the access to that location is temporarily suspended while the necessary data is fetched from secondary storage and placed in physical memory. the suspended access is then restarted or continued. the cpu32 uses in- struction restart, which requires that only a small portion of the internal machine state be saved. after correcting the fault, the machine state is restored, and the instruction is refetched and restarted. this process is completely transparent to the application program. 1.1.2 loop mode instruction execution the cpu32 has several features that provide efficient execution of program loops. one of these features is the dbcc looping primitive. to increase the performance of the cpu32, a loop mode has been added to the processor. the loop mode is used by any single-word instruction that does not change the program flow. loop mode is im- plemented in conjunction with the dbcc instruction. figure 1-1 shows the required form of an instruction loop for the processor to enter loop mode. loop mode is entered when dbcc is executed and loop displacement is ?. once in loop mode, the processor performs only data cycles associated with the instruction and suppresses instruction fetches. termination condition and count are checked after each execution of looped instruction data operations. the cpu automatically exits loop mode for interrupts or other exceptions. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 overview motorola reference manual 1-3 figure 1-1 loop mode instruction sequence 1.1.3 vector base register the vector base register (vbr) contains the base address of the 1024-byte exception vector table. the table contains 256 exception vectors. exception vectors are the memory addresses of routines that begin execution at the completion of exception pro- cessing. each routine performs operations appropriate to the corresponding excep- tion. because exception vectors are memory addresses, each table entry is a single long word. each vector is assigned an 8-bit number. vector numbers for some exceptions are ob- tained from an external device; others are supplied automatically by the processor. the processor multiplies the vector number by four to calculate vector offset, then adds the offset to the vbr base address. the sum is the memory address of the vec- tor. because the vbr stores the vector table base address, the table can be located any- where in memory. it can also be dynamically relocated for each task executed by an operating system. details of exception processing are provided in section 6 ex- ception processing . 1.1.4 exception handling the processing of an exception occurs in four steps, with variations for different ex- ception causes. during the first step, a temporary internal copy of the status register is made, and the status register is set for exception processing. during the second step, the exception vector is determined. during the third step, the current processor context is saved. during the fourth step, a new context is obtained, and the processor then proceeds with normal instruction execution. exception processing saves the most volatile portion of the current context by pushing it on the supervisor stack. this context is organized in a format called an exception stack frame. the stack frame always includes the status register and program counter at the time an exception occurs. to support generic handlers, the processor also plac- es the vector offset in the exception stack frame and marks the frame with a format code. the return-from-exception (rte) instruction uses the format code to determine what information is on the stack, so that context can be properly restored. one-word instruction dbcc dbcc displacement $fffc = ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola overview cpu32 1-4 reference manual 1.1.5 enhanced addressing modes addressing in the cpu32 is register oriented. most instructions allow the results of the specified operation to be placed either in a register or in memory. there is no need for extra instructions to store register contents in memory. there are seven basic addressing modes: 1. register direct 2. register indirect 3. register indirect with index 4. program counter indirect with displacement 5. program counter indirect with index 6. absolute 7. immediate the register indirect addressing modes include postincrement, predecrement, and off- set capability. the pc relative mode also has index and offset capabilities. in addition to the addressing modes, many instructions implicitly specify the use of a status reg- ister, sp, and/or pc. addressing is explained fully in section 3 data organiza- tion and addressing capabilities . a summary of m68000 family addressing modes is found in appendix a m68000 family summary . 1.1.6 instruction set the instruction set of the cpu32 is very similar to that of the mc68020 (see table 1- 1). two new instructions have been added to facilitate controller applications ?low- power stop (lpstop) and table lookup and interpolate (tbl). the following m68020 instructions are not implemented on the cpu32: bfxxx ?bit field instructions (bfchg, bfclr, bfexts, bfextu, bfffo bfins, bfset, bftst) callm, rtm ?call module, return module cas, cas2 ?compare and set (read-modify-write instructions) cpxxx coprocessor instructions (cpbcc, cpdbcc, cpgen, cp restore, cpsave, cpscc, cptrapcc) pack, unpk pack, unpack bcd instructions the cpu32 traps on unimplemented instructions and illegal effective addressing modes, allowing the user to emulate instructions or to define special-purpose func- tions. however, motorola reserves the right to use all currently uniplemented instruc- tions operation codes for future m68000 core enhancements. see section 4 instruction set for comprehensive information. 1.1.6.1 table lookup and interpolation instructions to speed up real-time applications, a range of discrete data points is often precalcu- lated from a continuous control function, then stored in memory. a full range of data can require an inordinate amount of memory. the table instructions make it possible f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 overview motorola reference manual 1-5 to store a sample of the full range and recover intermediate values quickly via linear interpolation. a round-to-nearest algorithm can be applied to the results. table 1-1 instruction set summary mnemonic description mnemonic description abcd add adda addi addq addx and andi asl, asr add decimal with extend add add address add immediate add quick add with extend logical and logical and immediate arithmetic shift left and right move move ccr move sr move usp movea movec movem movep moveq moves move move condition code register move status register move user stack pointer move address move control register move multiple registers move peripheral move quick move alternate address space bcc bchg bclr bgnd bkpt bra bset bsr btst branch conditionally test bit and change test bit and clear background breakpoint branch test bit and set branch to subroutine test bit muls, muls.l mulu, mulu.l signed multiply unsigned multiply nbcd neg negx nop negate decimal with extend negate negate with extend no operation or ori logical inclusive or logical inclusive or immediate chk, chk2 clr cmp cmpa cmpi cmpm cmp2 check register against upper and lower bounds clear compare compare address compare immediate compare memory to memory compare register against upper and lower bounds pea push effective address reset rol, ror roxl, roxr rtd rte rtr rts reset external devices rotate left and right rotate with extend left and right return and deallocate return from exception return and restore codes return from subroutine dbcc divs, divsl divu, divul test condition, decrement and branch signed divide unsigned divide sbcd scc stop sub suba subi subq subx swap subtract decimal with extend set conditionally stop subtract subtract address subtract immediate subtract quick subtract with extend swap register words eor eori exg ext, extb logical exclusive or logical exclusive or immediate exchange registers sign extend lea link lpstop lsl, lsr load effective address link and allocate low power stop logical shift left and right tbls, tblsn tblu, tblun table lookup and interpolate (signed) table lookup and interpolate (unsigned) illegal take illegal instruction trap jmp jsr jump jump to subroutine tas trap trapcc trapv tst test operand and set trap trap conditionally trap on overflow test operand unlk unlink f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola overview cpu32 1-6 reference manual 1.1.6.2 low-power stop instruction the cpu32 is a fully static design. power consumption can be reduced to a minimum during periods of inactivity by stopping the system clock. the cpu32 instruction set includes a low-power stop command (lpstop) that efficiently implements this capa- bility. the processor will remain in stop mode until a user-specified interrupt, or reset, occurs. 1.1.7 processing states there are four processing states ?normal, exception, background and halted. normal processing is associated with instruction execution. the bus is used to fetch instructions and operands, and to store results. exception processing is associated with interrupts, trap instructions, tracing, and other exception conditions. background processing allows interactive debugging of the system. halted processing is an indication of catastrophic hardware failure. see section 5 processing states for complete information. 1.1.8 privilege states the processor can operate at either of two privilege levels. supervisor level is more privileged than user level ?all instructions are available at supervisor level, but ac- cess is restricted at user level. effective use of privilege level can protect system resources from uncontrolled access. the state of the s bit in the status register determines access level and whether the stack pointer (usp) or the supervisor stack pointer (ssp) is used for stack operations. see section 5 processing states for a complete explanation of privilege lev- els. 1.2 block diagram a block diagram of the cpu32 is shown in figure 1-2 . the functional elements oper- ate concurrently. essential synchronization of instruction execution and buss opera- tion is maintained by the sequencer/control unit. the bus controller prefetches instructions and operands. a three-stage pipeline is used to hold and decode instruc- tions prior to execution. the execution unit maintains the program counter under se- quencer control. the bus control contains a write-pending buffer that allows the sequencer to continue execution of instructions after a request for a write cycle is queued. see section 8 instruction execution timing for a detailed expla- nation of instruction execution. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 overview motorola reference manual 1-7 figure 1-2 cpu32 block diagram bus control instruction pipeline and decode execution unit sequencer control unit bus control address bus data bus 16 32 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola overview cpu32 1-8 reference manual f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 architecture summary motorola reference manual 2-1 section 2architecture summary the cpu32 is upward source and object code compatible with the mc68000 and mc68010. it is downward source and object code compatible with the mc68020. with- in the m68000 family, architectural differences are limited to the supervisory operating state. user state programs can be executed unchanged on upward compatible devic- es. the major cpu32 features are as follows: ? 32-bit internal data path and arithmetic hardware ?32-bit address bus supported by 32-bit calculations ?rich instruction set ?eight 32-bit general-purpose data registers ?seven 32-bit general-purpose address registers ?separate user and supervisor stack pointers ?separate user and supervisor state address spaces ?separate program and data address spaces ?many data types ?flexible addressing modes ?full interrupt processing ?expansion capability 2.1 programming model the cpu32 programming model consists of two groups of registers that correspond to the user and supervisor privilege levels. user programs can only use the registers of the user model. the supervisor programming model, which supplements the user programming model, is used by cpu32 system programmers who wish to protect sen- sitive operating system functions. the supervisor model is identical to that of mc68010 and later processors. the cpu32 has eight 32-bit data registers, seven 32-bit address registers, a 32-bit program counter, separate 32-bit supervisor and user stack pointers, a 16-bit status register, two alternate function code registers, and a 32-bit vector base register (see figure 2-1 and figure 2-2 ). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola architecture summary cpu32 2-2 reference manual figure 2-1 user programming model figure 2-2 supervisor programming model supplement 2.2 registers registers d7 to d0 are used as data registers for bit, byte (8-bit), word (16-bit), long- word (32-bit), and quad-word (64-bit) operations. registers a6 to a0 and the user and supervisor stack pointers are address registers that may be used as software stack pointers or base address registers. register a7 (shown as a7 and a7' in figure 2-1 ) is a register designation that applies to the user stack pointer in the user privilege level and to the supervisor stack pointer in the supervisor privilege level. in addition, ad- dress registers may be used for word and long-word operations. all of the 16 general- purpose registers (d7 to d0, a7 to a0) may be used as index registers. 31 16 15 8 7 0 d0 d1 d2 d3 data registers d4 d5 d6 d7 31 16 15 0 a0 a1 a2 a3 address registers a4 a5 a6 31 16 15 0 a7 (usp) user stack pointer 31 0 pc program counter 15 8 7 0 0 ccr condition code register 31 16 15 0 a7' (ssp) supervisor stack pointer 15 8 7 0 (ccr) sr status register 31 0 pc vector base register 31 3 2 0 sfc alternate function dfc code registers f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 architecture summary motorola reference manual 2-3 the program counter (pc) contains the address of the next instruction to be executed by the cpu32. during instruction execution and exception processing, the processor automatically increments the contents of the pc or places a new value in the pc, as appropriate. the status register (sr) (see figure 2-3 ) contains condition codes, an interrupt prior- ity mask (three bits), and three control bits. condition codes reflect the results of a pre- vious operation. the codes are contained in the low byte, or condition code register of the sr. the interrupt priority mask determines the level of priority an interrupt must have in order to be acknowledged. the control bits determine trace mode and privilege level. at user privilege level, only the condition code register is available. at supervisor privilege level, software can access the full status register. figure 2-3 status register the vector base register (vbr) contains the base address of the exception vector ta- ble in memory. the displacement of an exception vector is added to the value in this register to access the vector table. alternate function code registers sfc and dfc contain 3-bit function codes. the cpu32 generates a function code each time it accesses an address. specific codes are assigned to each type of access. the codes can be used to select eight dedicated 4g-byte address spaces. the move instructions can use registers sfc and dfc to specify the function code of a memory address. 2.3 data types six basic data types are supported: 1. bits 2. binary-coded decimal (bcd) digits 3. byte integers (8 bits) 4. word integers (16 bits) 5. long-word integers (32 bits) 6. quad-word integers (64 bits) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 t1 t0 s 0 0 i2 i1 i0 0 0 0 x n z v c extend negative zero overflow carry interrupt priority mask supervisor/user state trace enable system byte user byte (condition code register) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola architecture summary cpu32 2-4 reference manual 2.3.1 organization in registers the eight data registers can store data operands of 1, 8, 16, 32, and 64 bits and ad- dresses of 16 or 32 bits. the seven address registers and the two stack pointers are used for address operands of 16 or 32 bits. the pc is 32 bits wide. 2.3.1.1 data registers each data register is 32 bits wide. byte operands occupy the low-order 8 bits, word operands, the low-order 16 bits, and long-word operands, the entire 32 bits. when a data register is used as either a source or destination operand, only the appropriate low-order byte or word (in byte or word operations, respectively) is used or changed ?the remaining high-order portion is neither used nor changed. the least significant bit (lsb) of a long-word integer is addressed as bit zero, and the most significant bit (msb) is addressed as bit 31. figure 2-4 shows the organization of various types of data in the data registers. figure 2-4 data organization in data registers quad-word data consists of two long words: for example, the product of 32-bit multiply or the quotient of 32-bit divide operations (signed and unsigned). quad words may be organized in any two data registers without restrictions on order or pairing. there are no explicit instructions for the management of this data type; however, the movem instruction can be used to move a quad word into or out of the registers. 31 30 10 msb lsb byte 31 24 23 16 15 8 7 0 high-order byte middle high byte middle low byte low-order byte word 31 16 15 0 high-order word low-order word long word 31 0 long word quad word 63 62 32 msb high-order long word 31 10 low-order long word lsb f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 architecture summary motorola reference manual 2-5 bcd data represents decimal numbers in binary form. cpu32 bcd instructions use a format in which a byte contains two digits ?the four lsb contain the low digit, and the four msb contain the high digit. the abcd, sbcd, and nbcd instructions operate on two bcd digits packed into a single byte. 2.3.1.2 address registers each address register and stack pointer holds a 32-bit address. address registers can- not be used for byte-sized operands. when an address register is used as a source operand, either the low-order word or the entire long-word operand is used, depending upon the operation size. when an address register is used as a destination operand, the entire register is affected, regardless of operation size. if the source operand is a word, it is first sign extended to 32 bits, and then used in the operation. address reg- isters can be used to support address computation. the instruction set includes in- structions that add to, subtract from, compare, and move the contents of address registers. figure 2-5 shows the organization of addresses in address registers. figure 2-5 address organization in address registers 2.3.1.3 control registers the control registers contain control information for supervisor functions. the registers vary in size. with the exception of the user portion of the sr (ccr), they are accessed only by instructions at the supervisor privilege level. the sr shown in figure 2-3 is 16 bits wide. only 11 bits of the sr are defined, and all undefined values are reserved by motorola for future definition. the undefined bits are read as zeros and should be written as zeros for future compatibility. the lower byte of the sr is the ccr. operations to the ccr can be performed at the supervisor or user privilege level. all operations to the sr and ccr are word-size operations. for all ccr operations, the upper byte is read as all zeros and is ignored when written, regardless of privilege level. the alternate function code registers (sfc and dfc) are 32-bit registers with only bits [2:0] implemented. these bits contain address space values (fc2 to fc0) for the read or write operand of the moves instruction. the movec instruction is used to transfer values to and from the alternate function code registers. these are long-word transfers ?the upper 29 bits are read as zeros and are ignored when written. 31 16 15 0 sign extended 16-bit address operand 31 0 full 32-bit address operand f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola architecture summary cpu32 2-6 reference manual 2.3.2 organization in memory memory is organized on a byte-addressable basis. an address corresponds to a high- order byte. for example, the address (n) of a long-word data item is the address of the most significant byte of the high-order word. the address of the most significant byte of the low-order word is (n + 2), and the address of the least significant byte of the long word is (n + 3). the cpu32 requires data words and long words, as well as instruction words to be aligned on word boundaries. data misalignment is not support- ed. figure 2-6 shows how operands and instructions are organized in memory. note that (n + x) is below (n) ?that is, address value increases as one moves down the page. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 architecture summary motorola reference manual 2-7 figure 2-6 memory operand addressing bit data 1 byte = 8 bits byte data (8 bits) 76543210 msb = most significant bit lsb = least significant bit address (32 bits) (32 bits) (16 bits) 15 0 word 1 word 2 high order low order msb lsb 0 lsb msb 15 msd = most significant digit lsd = least significant digit decimal data 2 bcd digits = 1 byte 15 12 11 8 7 4 3 0 msd bcd 0 bcd 4 bcd 1 bcd 5 bcd 2 bcd 6 bcd 3 bcd 7 high order low order msb byte 0 lsb byte 1 byte 2 byte 3 15 8 7 0 15 0 msb word 0 lsb lsd address 1 address 2 address 0 long word 0 long word 1 long word 2 word data / instruction long word data / instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola architecture summary cpu32 2-8 reference manual f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-1 section 3 data organization and addressing capabilities the addressing mode of an instruction can specify the value of an operand (an imme- diate operand), a register that contains the operand (register direct addressing mode), or how the effective address of an operand in memory is derived. an assembler syntax has been defined for each addressing mode. figure 3-1 shows the general format of the single-effective-address instruction oper- ation word. the effective address field specifies the addressing mode for an operand that can use one of the numerous defined modes. the designation is composed of two 3-bit fields, the mode field and the register field. the value in the mode field selects a mode or a set of modes. the register field specifies a register for the mode or a sub- mode for modes that do not use registers. figure 3-1 single-effective-address instruction operation word many instructions imply the addressing mode for only one of the operands. the for- mats of these instructions include appropriate fields for operands that use only a single addressing mode. additional information may be needed to specify an operand address. this information is contained in an additional word or words called the effective address extension, and is considered part of an instruction. address extension formats are discussed in 3.4.4 effective address encoding summary . when an addressing mode uses a register, the register is specified by the register field of the operation word. other fields within the instruction specify whether the selected register is an address or data register and how the register is to be used. 3.1 program and data references an m68000 family processor makes two classes of memory references, each of which has a complete, separate logical address space. references to opcodes and extension words are program space references. operand reads and writes are primarily data space references. operand reads are from data space in all but two cases ?immediate operands embedded in the instruc- tion stream and operands addressed relative to the current program counter are pro- gram space references. all operand writes are to data space. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 x x x x x x x x x x effective address mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-2 reference manual 3.2 notation conventions ea ?effective address an ?address register n example: a3 is address register 3 dn ?data register n example: d5 is data register 5 rn ?any register, data or address xn.size*scale ? index register n (data or address), index size (w for word, l for long word), scale factor (1, 2, 4, or 8 for byte, word, long-word or quad-word scaling) pc ?program counter sr ?status register sp ?stack pointer ccr ?condition code register usp ?user stack pointer ssp ?supervisor stack pointer dn ?displacement value, n bits wide bd ?base displacement l ?long-word size w ?word size b ?byte size (an) ?identifies an indirect address in a register 3.3 implicit reference some instructions make implicit reference to the program counter, the system stack pointer, the user stack pointer, the supervisor stack pointer, or the status register. the following table shows the instructions and the registers involved: instruction implicit registers andi to ccr sr andi to sr sr bra pc bsr pc, sp chk (exception) pc, sp chk2 (exception) ssp, sr dbcc pc divs (exception) ssp, sr divu (exception) ssp, sr eori to ccr sr eori to sr sr jmp pc jsr pc, sp link sp lpstop sr move ccr sr move sr sr move usp usp f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-3 3.4 effective address most instructions specify the location of an operand by a field in the operation word called an effective address field or an effective address ( ea ? ). an ea is composed of two 3-bit subfields: mode specification field and register specification field. each of the address modes is selected by a particular value in the mode specification subfield of the ea. the ea field may require further information to fully specify the operand. this information, called the ea extension, is in a following word or words and is considered part of the instruction (see 3.1 program and data references ). 3.4.1 register direct mode these ea modes specify that the operand is in one of the 16 multifunction registers. 3.4.1.1 data register direct in the data register direct mode, the operand is in the data register specified by the ea register field. 3.4.1.2 address register direct in the address register direct mode, the operand is in the address register specified by the ea register field. ori to ccr sr ori to sr sr pea sp rtd pc, sp rte ps, sp, sr rtr pc, sp, sr rts pc, sp stop sr trap (exception) ssp, sr trapv (exception) ssp, sr unlk sp instruction implicit registers 0 31 generation: assembler syntax: mode: register: data register: number of extension words: ea = dn dn 000 n dn 0 operand 0 31 operand ea = an an 001 n an 0 generation: assembler syntax: mode: register: data register: number of extension words: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-4 reference manual 3.4.2 memory addressing modes these ea modes specify the address of the memory operand. 3.4.2.1 address register indirect in the address register indirect mode, the operand is in memory, and the address of the operand is in the address register specified by the register field. 3.4.2.2 address register indirect with postincrement in the address register indirect with postincrement mode, the operand is in memory, and the address of the operand is in the address register specified by the register field. after the operand address is used, it is incremented by one, two, or four, depending on the size of the operand: byte, word, or long word. if the address register is the stack pointer and the operand size is byte, the address is incremented by two rather than one to keep the stack pointer aligned to a word boundary. 3.4.2.3 address register indirect with predecrement in the address register indirect with predecrement mode, the operand is in memory, and the address of the operand is in the address register specified by the register field. before the operand address is used, it is decremented by one, two, or four, depending on the operand size: byte, word, or long word. if the address register is the stack point- er and the operand size is byte, the address is decremented by two rather than one to keep the stack pointer aligned to a word boundary. 0 31 operand 0 31 generation: assembler syntax: mode: register: address register: memory address: number of extension words: 0 ea = (an) (an) 010 n an memory address 0 31 operand 0 31 + memory address memory address: number of extension words: 0 operand length ( 1, 2, or 4): ea = (an) an = an + size (an) + 011 n an generation: assembler syntax: mode: register: address register: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-5 3.4.2.4 address register indirect with displacement in the address register indirect with displacement mode, the operand is in memory. the address of the operand is the sum of the address in the address register plus the sign-extended 16-bit displacement integer in the extension word. displacements are always sign extended to 32 bits before being used in ea calculations. 3.4.2.5 address register indirect with index (8-bit displacement) this mode requires one extension word that contains the index register indicator and an 8-bit displacement. the index register indicator includes size and scale information. in this mode, the operand is in memory. the address of the operand is the sum of the contents of the address register, the sign-extended displacement value in the low-or- der eight bits of the extension word, and the sign-extended contents of the index reg- ister (possibly scaled). the user must specify displacement, address register, and index register. this address mode can have either of two different formats of extension. the brief for- mat (8-bit displacement) requires one word of extension and provides fast indexed ad- dressing. the full format (16 and 32-bit displacement) provides optional displacement size. both forms use an index operand. for brief format addressing, the address of the operand is the sum of the address in the address register, the sign-extended displacement integer in the low-order eight bits of the extension word, and the index operand. the reference is classed as a data reference, except for the jmp and jsr instructions. the index operand is specified ?i.sz*scl? operand memory address 0 31 0 31 memory address: number of extension words: 0 operand length (1, 2, or 4): an = an size ea = (an) (an) 100 n an generation: assembler syntax: mode: register: address register: + generation: assembler syntax: mode: register: address register: displacement: memory address: number of extension words: 1 ea = (an) + d (d an) n an memory address operand 0 0 31 31 15 0 31 sign extended integer 16 16, 101 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-6 reference manual ?i?specifies a general data or address register used as an index register. the index operand is derived from the index register. the index register is a data register if bit [15] = 0 in the first extension word and an address register if bit [15] = 1. the index register number is given by extension word bits [14:12]. index size is referred to as ?z? it may be either ??or ?? index size is given by bit [11] of the extension word. if bit [11] = 0, the index value is the sign-extended low-order word integer of the index register (w). if bit [11] = 1, the index value is the long integer in the index register (l). the term ?cl?refers to index scale selection and may be 1, 2, 4, or 8. the index value is scaled according to bits [10:9]. codes 00, 01, 10, or 11 select index scaling of 1, 2, 4, or 8, respectively. 3.4.2.6 address register indirect with index (base displacement) the full format indexed addressing mode requires an index register indicator and an optional 16- or 32-bit sign-extended base displacement. the index register indicator includes size and scale information. in this mode, the operand is in memory. the ad- dress of the operand is the sum of the contents of the address register, the scaled con- tents of the sign-extended index register, and the base displacement. + + operand 0 31 0 31 0 31 x memory address integer sign extended sign-extended value scale value 0 7 generation: assembler syntax: mode: register: address register: displacement: index register: scale: memory address: number of extension words: 1 31 ea = (an) + (xn*scale) + d (d an. size*scale) n an 8 8 , 110 sign-extended value + + operand 0 31 0 31 0 31 x memory address sign-extended value scale value 0 generation: assembler syntax: mode: register: address register: index register: scale: memory address: number of extension words: 1, 2, or 3 31 n an 110 ea = (an) + (xn*scale) + bd (bd, an, xn. size*scale) base displacement: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-7 3.4.3 special addressing modes these special addressing modes do not use the register field to specify a register num- ber but rather to specify a submode. 3.4.3.1 program counter indirect with displacement in this mode, the operand is in memory. the address of the operand is the sum of the address in the program counter and the sign-extended 16-bit displacement integer in the extension word. the value in the program counter is the address of the extension word. the reference is a program space reference and is only allowed for read access- es. 3.4.3.2 program counter indirect with index (8-bit displacement) this mode is similar to the address register indirect with index (8-bit displacement) mode described in 3.4.2.5 address register indirect with index (8-bit displace- ment) , but the program counter is used as the base register. the operand is in memory. the address of the operand is the sum of the address in the program counter, the sign-extended displacement integer in the lower eight bits of the extension word, and the sized, scaled, and sign-extended index operand. the val- ue in the program counter is the address of the extension word. this reference is a program space reference and is only allowed for reads. the user must include the dis- placement, the program counter, and the index register when specifying this address- ing mode. + generation: assembler syntax: mode: register: displacement: memory address: number of extension words: 1 operand 0 0 31 31 15 0 31 sign extended integer 16 ea = (pc) + d (d , pc) 111 010 address of extension word program counter: 16 + + operand 0 31 0 31 0 31 x integer sign extended sign-extended value scale value 0 7 generation: assembler syntax: mode: register: displacement: index register: scale: memory address: number of extension words: 1 31 ea = (pc) + (xn) + d (d , pc, xn. size*scale) 111 011 program counter: 8 8 address of extension word f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-8 reference manual 3.4.3.3 program counter indirect with index (base displacement) this mode is similar to the address register indirect with index (base displacement) mode described in 3.4.2.6 address register indirect with index (base displace- ment) , but the program counter is used as the base register. it requires an index reg- ister indicator and an optional 16- or 32-bit sign-extended base displacement. the operand is in memory. the address of the operand is the sum of the contents of the program counter, the scaled contents of the sign-extended index register, and the base displacement. the value of the program counter is the address of the first exten- sion word. the reference is a program space reference and is only allowed for read accesses. in this mode, the program counter, the index register, and the displacement are all op- tional. however, the user must supply the assembler notation ?pc?(zero value is tak- en for the program counter) to indicate that the program counter is not used. this scheme allows the user to access the program space without using the program counter in calculating the ea. the user can access the program space with a data reg- ister indirect access by placing zpc in the instruction and specifying a data register (dn) as the index register. 3.4.3.4 absolute short address in this addressing mode, the operand is in memory, and the address of the operand is in the extension word. the 16-bit address is sign extended to 32 bits before it is used. sign-extended value + + operand 0 31 0 31 0 31 x sign-extended value scale value 0 generation: assembler syntax: mode: register: index register: scale: memory address: number of extension words: 1, 2, or 3 31 base displacement: address of extension word ea = (pc) + (xn) + bd (bd, pc, xn. size*scale) 111 011 program counter: 0 31 operand 0 31 generation: assembler syntax: mode: register: memory address: number of extension words: 1 extension word: memory address sign extended 15 ea given (xxx).w 111 000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-9 3.4.3.5 absolute long address in this mode, the operand is in memory, and the address of the operand occupies the two extension words following the instruction word in memory. the first extension word contains the high-order part of the address; the low-order part of the address is the second extension word. 3.4.3.6 immediate data in this addressing mode, the operand is in one or two extension words: byte operation the operand is in the low-order byte of the extension word. word operation the operand is in the extension word. long-word operation the high-order 16 bits of the operand are in the first extension word; the low-order 16 bits are in the second extension word. 3.4.4 effective address encoding summary most addressing modes use one of the three formats shown in figure 3-2 . the single ea instruction is in the format of the instruction word. the mode field of this word se- lects the addressing mode. the register field contains the general register number or a value that selects the addressing mode when the mode field contains ?11? some indexed or indirect modes use the instruction word followed by the brief format extension word. other indexed or indirect modes consist of the instruction word and the full format of extension words. the longest instruction for the cpu32 contains six extension words. it is a move instruction with full format extension words for both source and destination ea and a 32-bit base displacement for both addresses. 0 generation: assembler syntax: mode: register: memory address: number of extension words: 2 15 0 15 0 ea given (xxx).l 111 001 first extension word: second extension word: address high address low concatenation operand 0 31 0 31 generation: assembler syntax: mode: register: number of extension words: operand given #xxx 111 100 1 or 2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-10 reference manual field definition field definition instruction bs base register suppress register general register number 0 = base register added extension 1 = base register suppressed register index register number is index suppress d/a index register type 0 = evaluate and add index operand 0 = dn 1 = suppress index operand 1 = an bd size base displacement size w/l word/long word index size 00 = reserved 0 = sign-extended word 01 = null displacement 1 = long word 10 = word displacement scale scale factor 11 = long-word displacement 00 = 1 i/is * index/indirect selection 01 = 2 indirect and indexing operand 10 = 4 determined in conjunction with bit 6, 11 = 8 index suppress *memory indirect addressing will cause illegal instruction trap; must be = 000 if is = 1 figure 3-2 effective address specification formats ea modes can be classified as follows: data a data addressing ea mode refers to data operands. memory a memory addressing ea mode refers to memory operands. alterable an alterable addressing ea mode refers to writable operands. control a control addressing ea mode refers to unsized memory operands. categories are sometimes combined, forming new, more restrictive, categories. two examples are alterable memory or alterable data. the former refers to addressing modes that are both alterable and memory addresses; the latter refers to addressing modes that are both alterable and data addresses. table 3-1 shows categories to which each of the ea modes belong. single ea instruction format 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address x x x x x x x x x x mode register brief format extension word 15 14 12 11 10 9 8 7 0 d/a register w/ l scale 0 displacement full format extension word(s) 15 14 12 11 10 9 8 7 6 5 4 3 2 0 d/a register w/ l scale 1 bs is bd size 0 i/is base displacement (0, 1, or 2 words) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-11 3.5 programming view of addressing modes extensions to indexed addressing modes, indirection, and full 32-bit displacements provide additional programming capabilities for the cpu32. the following paragraphs describe addressing techniques and summarize addressing modes from a program- ming point of view. 3.5.1 addressing capabilities in the cpu32, setting the base register suppress (bs) bit in the full format extension word (see figure 3-2 ) suppresses use of the base address register in calculating the ea, allowing any index register to be used in place of the base register. because any data register can be an index register, this provides a data register indirect form (dn). this mode could also be called register indirect (rn) because either a data register or an address register can be used to address memory ?an extension of m68000 fam- ily addressing capability. the ability to specify the size and scale of an index register (xn.size * scale) in these modes provides additional addressing flexibility. when using the size parame- ter, either the entire contents of the index register can be used, or the least significant word can be sign extended to provide a 32-bit index value (refer to figure 3-3 ). table 3-1 effective addressing mode categories addressing mode code register data memory control alterable syntax data register direct 000 reg. no. x x dn address register direct 001 reg. no. x an address register indirect 010 reg.no. x x x x (an) address register indirect with postincrement 011 reg. no. x x x (an) + address register indirect with predecrement 100 reg. no. x x x ?(an) address register indirect with displacement 101 reg.no. x x x x (d 16, an) address register indirect with index (8-bit displacement) 110 reg. no. x x x x (d 8 , an, xn) address register indirect with index (base displacement) 110 reg. no. x x x x (bd, an, xn) absolute short 111 000 x x x x (xxx).w absolute long 111 001 x x x x (xxx).l program counter indirect with displacement 111 010 x x x (d 16 , pc) program counter indirect with index (8-bit displacement) 111 011 x x x (d 8 , pc, xn) program counter indirect with index (base displacement) immediate 111 100 x x #(data) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-12 reference manual figure 3-3 using size in the index selection for the cpu32, the register indirect modes can be extended further. because dis- placements can be 32 bits wide, they can represent absolute addresses or the results of expressions that contain absolute addresses. this scheme allows the general reg- ister indirect form to be (bd, rn) or (bd, an, rn) when the base register is not sup- pressed. thus, an absolute address can be directly indexed by one or two registers (refer to figure 3-4 ). setting the index register suppress bit (is) in the full format extension word suppresses the index operand. the indirect suppressed index register mode uses the contents of register an as an index to the pointer located at the address specified by the displace- ment. the actual data item is at the address in the selected pointer. an optional scaling function supports direct array subscripting. an index register can be left shifted by zero, one, two, or three bits before use in an ea calculation, to scale for an array of elements of corresponding size. this is much more efficient than using an arithmetic value in one of the general-purpose registers to multiply the index regis- ter by one, two, four, or eight. figure 3-4 using absolute address with indexes scaling does not add to the ea calculation time. however, when combined with the appropriate derived modes, scaling produces additional capabilities. arrayed struc- tures can be addressed absolutely and then subscripted; for example, (bd, rn * scale). optionally, an address register that contains a dynamic displacement can be 31 16 15 0 used in address calculation dlw d1 an rn bd syntax: (bd,an,rn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-13 included in the address calculation (bd, an, rn * scale). another variation that can be derived is (an, rn * scale). in the first case, the array address is the sum of the contents of a register and a displacement (see figure 3-5 ). in the second example, an contains the address of an array and rn contains a subscript. figure 3-5 addressing array items note: regardless of array structure, software increments index to point to next record. syntax: move.w (a5,a6.l*scale),(a7) where: a5 = address of array structure a6 = index number of array item a7 = stack pointer a6 = 1 a6 = 1 0 simple array (scale = 1) record of 1 word (scale = 2) 15 0 record of 2 words (scale = 4) record of 4 words (scale = 8) 15 7 3 4 2 2 a6 = 1 0 2 15 a6 = 1 0 2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-14 reference manual 3.5.2 general addressing mode summary the addressing modes described in the previous paragraphs are derived from specific combinations of options in the indexing mode or a selection of two alternate address- ing modes. for example, the addressing mode called register indirect (rn) assembles as address register indirect if the register is an address register. if rn is a data register, the assembler uses address register indirect with index mode, with a data register as the indirect register, and suppresses the address register by setting the base suppress bit in the ea specification. assigning an address register as rn provides higher performance than using a data register as rn. another case is (bd, an), which selects an addressing mode based on the size of the displacement. if the displacement is 16 bits or less, the address register indirect with displacement mode (d 16 , an) is used. when a 32-bit displacement is re- quired, the address register indirect with index (bd, an, xn) is used with the index reg- ister suppressed. it is useful to examine the derived addressing modes available to a programmer (with- out regard to the cpu32 ea mode actually encoded) because the programmer need not be concerned about these decisions. the assembler can choose the more efficient addressing mode to encode. 3.6 m68000 family addressing capability programs can be easily transported from one member of the m68000 family to anoth- er. the user object code of earlier members of the family is upwardly compatible with later members and can be executed without change. the address extension word(s) are encoded with information that allows the cpu32 to distinguish new additions to the basic m68000 family architecture. earlier microprocessors have no knowledge of extension word formats implemented in later processors, and, while they do detect illegal instructions, they do not decode invalid encodings of the extension words as exceptions. address extension words for the early mc68000, mc68008, mc68010, and mc68020 microprocessors are shown in figure 3-6 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-15 d/a: 0 = data register select 1 = address register select w/l 0 = word-sized operation 1 = long-word-sized operation d/a: 0 = data register select 1 = address register select w/l 0 = word-sized operation 1 = long-word-sized operation scale: 00 = scale factor 1 (compatible with mc68000) 01 = scale factor 2 (extension to mc68000) 10 = scale factor 4 (extension to mc68000) 11 = scale factor 8 (extension to mc68000) figure 3-6 m68000 family address extension words the encoding for scale used by the cpu32 and the mc68020 is a compatible ex- tension of the m68000 architecture. a value of zero for scale is the same encoding for both extension words; thus, software that uses this encoding is both upward and downward compatible across all processors in the product line. however, the other values of scale are not found in both extension formats; therefore, while software can be easily migrated in an upward compatible direction, only nonscaled addressing is supported in a downward fashion. if the mc68000 were to execute an instruction that encoded a scaling factor, the scaling factor would be ignored and would not ac- cess the desired memory address. 3.7 other data structures in addition to supporting the array data structure with the index addressing mode, m68000 processors also support stack and queue data structures with the address register indirect postincrement and predecrement addressing modes. a stack is a last- in-first-out (lifo) list; a queue is a first-in-first-out (fifo) list. when data is added to a stack or queue, it is pushed onto the structure; when it is removed, it is ?opped? or pulled, from the structure. the system stack is used implicitly by many instructions; user stacks and queues may be created and maintained through use of addressing modes. 3.7.1 system stack address register 7 (a7) is the system stack pointer (sp). the sp is either the supervi- sor stack pointer (ssp) or the user stack pointer (usp), depending on the state of the s bit in the status register. if the s bit indicates the supervisor state, the ssp is the sp, and the usp cannot be referenced as an address register. if the s bit indicates the user state, the usp is the active sp, and the ssp cannot be referenced. each system mc6800/mc68008/mc68010 address extension word 15 14 12 11 10 9 8 7 0 d/a register w/ l 0 0 0 displacement integer cpu32/mc68020 extension word 15 14 12 11 10 9 8 7 0 d/a register w/ l scale 0 displacement integer f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-16 reference manual stack fills from high memory to low memory. the address mode ?sp) creates a new item on the active system stack, and the address mode (sp) + deletes an item from the active system stack. the program counter is saved on the active system stack on subroutine calls and is restored from the active system stack on returns. on the other hand, both the program counter and the status register are saved on the supervisor stack during the process- ing of traps and interrupts. thus, the correct execution of the supervisor state code is not dependent on the behavior of user code, and user programs may use the usp ar- bitrarily. to keep data on the system stack aligned properly, data entry on the stack is restricted so that data is always put in the stack on a word boundary. thus, byte data is pushed on or pulled from the system stack in the high-order half of the word; the low-order half is unchanged. 3.7.2 user stacks the user can implement stacks with the address register indirect with postincrement and predecrement addressing modes. with address register an (n = 0 to 6), the user can implement a stack that is filled either from high to low memory or from low to high memory. important considerations are as follows: ?use the predecrement mode to decrement the register before its contents are used as the pointer to the stack. ?use the postincrement mode to increment the register after its contents are used as the pointer to the stack. ?maintain the sp correctly when byte, word, and long-word items are mixed in these stacks. to implement stack growth from high to low memory, use ?an) to push data on the stack, (an) + to pull data from the stack. for this type of stack, after either a push or a pull operation, register an points to the top item on the stack. this scheme is illustrated as follows: to implement stack growth from low to high memory, use (an) + to push data on the stack, ?an) to pull data from the stack. in this case, after either a push or pull operation, register an points to the next avail- able space on the stack. this scheme is illustrated as follows: an low memory (free) top of stack bottom of stack high memory f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 data organization and addressing capabilities motorola reference manual 3-17 3.7.3 queues queues can be implemented using the address register indirect with postincrement or predecrement addressing modes. queues are pushed from one end and pulled from the other, and use two registers. a queue filled either from high to low memory or from low to high memory can be implemented with a pair (two of a0 to a6) of address reg- isters. (an) is the ?ut?pointer and (am) is the ?et?pointer. to implement growth of the queue from low to high memory, use (an) + to put data into the queue, (am) + to get data from the queue. after a ?ut?operation, the ?ut?register points to the next available queue space, and the unchanged ?et?register points to the next item to be removed from the queue. after a ?et?operation, the ?et?register points to the next item to be removed from the queue, and the unchanged ?ut?register points to the next available queue space, which is illustrated as follows: to implement a queue as a circular buffer, the relevant address register should be checked and (if necessary) adjusted before performing a ?ut?or ?et?operation. the address register is adjusted by subtracting the buffer length (in bytes) from the register contents. to implement growth of the queue from high to low memory, use ?an) to put data into the queue, ?am) to get data from the queue. after a ?ut?operation, the ?ut?register points to the last item placed in the queue, and the unchanged ?et?address register points to the last item removed from the queue. after a ?et?operation, the ?et?register points to the last item removed from the queue, and the unchanged ?ut?register points to the last item placed in the queue, which is illustrated as follows: bottom of stack low memory top of stack (free) high memory an get (am) + put (an) + high memory low memory (free) last get (free) next get last put f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola data organization and addressing capabilities cpu32 3-18 reference manual to implement the queue as a circular buffer, the ?et?or ?ut?operation should be per- formed first, and then the relevant address register should be checked and (if neces- sary) adjusted. the address register is adjusted by adding the buffer length (in bytes) to the register contents. get ?(am) put ?(an) high memory low memory last put (free) next get last get (free) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-1 section 4 instruction set this section describes the set of instructions provided in the cpu32 and demonstrates their use. descriptions of the instruction format and the operands used by instructions are included. after a summary of the instructions by category, a detailed description of each instruction is listed in alphabetical order. complete programming information is provided, as well as a description of condition code computation and an instruction for- mat summary. the cpu32 instructions include machine functions for all the following operations: ?data movement ?arithmetic operations ?logical operations ?shifts and rotates ?bit manipulation ?conditionals and branches ?system control the large instruction set encompasses a complete range of capabilities and, com- bined with the enhanced addressing modes, provides a flexible base for program de- velopment. 4.1 m68000 family compatibility it is the philosophy of the m68000 family that all user-mode programs can execute unchanged on a more advanced processor and that supervisor-mode programs and exception handlers should require only minimal alteration. the cpu32 can be thought of as an intermediate member of the m68000 family. ob- ject code from an mc68000 or mc68010 may be executed on the cpu32, and many of the instruction and addressing mode extensions of the mc68020 are also support- ed. 4.1.1 new instructions two instructions have been added to the m68000 instruction set for use in controller applications. these are the low-power stop (lpstop) and the table lookup and inter- polation (tbl) commands. 4.1.1.1 low-power stop (lpstop) in applications where power consumption is a consideration, the cpu32 can force the device into a low-power standby mode when immediate processing is not required. the low-power mode is entered by executing the lpstop instruction. the processor remains in this mode until a user-specified or higher level interrupt, or a reset, occurs. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-2 reference manual 4.1.1.2 table lookup and interpolation (tbl) to maximize throughput for real-time applications, reference data is often precalculat- ed and stored in memory for quick access. the storage of sufficient data points can require an inordinate amount of memory. the tbl instruction uses linear interpolation to recover intermediate values from a sample of data points, and thus conserves mem- ory. when the tbl instruction is executed, the cpu32 looks up two table entries bounding the desired result and performs a linear interpolation between them. byte, word, and long-word operand sizes are supported. the result can be rounded according to a round-to-nearest algorithm, or returned unrounded along with the fractional portion of the calculated result (byte and word results only). this extra ?recision?can be used to reduce cumulative error in complex calculations. see 4.6 table lookup and inter- polation instructions for examples. 4.1.2 unimplemented instructions the ability to trap on unimplemented instructions allows user-supplied code to emulate unimplemented capabilities or to define special-purpose functions. however, motorola reserves the right to use all currently unimplemented instruction operation codes for future m68000 enhancements. see 6.2.8 illegal or unimplemented instructions for more details. 4.2 instruction format all instructions consist of at least one word. some instructions can have as many as seven words, as shown in figure 4-1 . the first word of the instruction, called the op- eration word, specifies instruction length and the operation to be performed. the re- maining words, called extension words, further specify the instruction and operands. these words may be immediate operands, extensions to the effective address mode specified in the operation word, branch displacements, bit number, special register specifications, trap operands, or argument counts. figure 4-1 instruction word general format 15 0 operation word (one word, specifies operation and modes) special operand specifiers (if any, one or two words) immediate operand or source address extension (if any, one to three words) destination effective address extension (if any, one to three words) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-3 besides the operation code, which specifies the function to be performed, an instruc- tion defines the location of every operand for the function. instructions specify an op- erand location in one of three ways: ?register specification a register field of the instruction contains the number of the register. ?effective address an effective address field of the instruction con- tains address mode information. ?implicit reference the definition of an instruction implies the use of specific registers. the register field within an instruction specifies the register to be used. other fields within the instruction specify whether the register is an address or data register and how it is to be used. section 3 data organization and addressing ca- pabilities contains detailed register information. 4.2.1 notation except where noted, the following notation is used in this section: data immediate data from an instruction destination destination contents source source contents vector location of exception vector an any address register (a7 to a0) ax, ay address registers used in computation dn any data register (d7 to d0) rc control register (vbr, sfc, dfc) rn any address or data register dh, dl data registers, high and low order 32 bits of product dr, dq data registers, division remainder, division quotient dx, dy data registers, used in computation dym, dyn data registers, table interpolation values xn index register [an] address extension cc condition code d # displacement example: d 16 is a 16-bit displacement ea ? effective address # data ? immediate data; a literal integer label assembly program label list list of registers example: d3?0 [...] bits of an operand examples: [7] is bit 7; [31:24] are bits 31 to 24 (...) contents of a referenced location example: (rn) refers to the contents of rn f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-4 reference manual ccr condition code register (lower byte of status register) x ?extend bit n ?negative bit z ?zero bit v ?overflow bit c ?carry bit pc program counter sp active stack pointer sr status register ssp supervisor stack pointer usp user stack pointer fc function code dfc destination function code register sfc source function code register + addition or post increment subtraction or predecrement / division or conjunction * multiplication = equal to 1 not equal to > greater than 3 greater than or equal to < less than less than or equal to boolean and + boolean or ? boolean xor (exclusive or) not boolean complement (operand is inverted) bcd binary coded decimal, indicated by subscript example: source 10 is a bcd source operand. lsw least significant word msw most significant word {r/w} read/write indicator in description of an operation, a destination operand is placed to the right of source operands, and is indicated by an arrow ( ?). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-5 4.3 instruction summary the instructions form a set of tools to perform the following operations: data movement bit manipulation integer arithmetic binary-coded decimal arithmetic logic program control shift and rotate system control the complete range of instruction capabilities combined with the addressing modes described previously provide flexibility for program development. 4.3.1 condition code register the condition code register portion of the status register contains five bits that indicate the result of a processor operation. table 4-1 lists the effect of each instruction on these bits. the carry bit and the multiprecision extend bit are separate in the m68000 family to simplify programming techniques that use them. refer to table 4-5 as an example. table 4-1 condition code computations operations x n z v c special definition abcd *u?u? c = decimal carry z = z rm ... r0 add, addi, addq ***?? v = sm dm rm + sm dm rm c = sm dm; rm dm + sm rm addx * *??? v = sm dm rm + sm dm rm c = sm dm + rm dm + sm rm z = z rm ... r0 and, andi, eor, eori, moveq, move, or, ori, clr, ext, not, tas, tst ? * 0 0 chk * u u u chk2, cmp2 u?u? z = (r = lb) + ( r = ub ) c = (lb ub) (ir < lb) + ( r > ub) + ( ub < lb) (r > ub) (r < lb) sub, subi, subq ***?? v = sm dm rm + sm dm rm c = sm dm + rm dm + sm rm subx * *??? v = sm dm rm + sm dm rm c = sm dm + rm dm + sm rm z = z rm ... r0 cmp, cmpi, cmpm ? * ? ? v = sm dm rm + sm dm rm c = sm dm + rm dm + sm rm divs, divu * * ? 0 v = division overflow muls, mulu * * ? 0 v = multiplication overflow sbcd, nbcd *u?u? c = decimal borrow z = z rm ... r0 neg ***?? v = dm rm c = dm + rm negx * *??? v = dm rm c = dm + rm z = z rm ... r0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-6 reference manual note: the following notation applies to this table only. not affected sm source operand msb u undefined dm destination operand msb ? see special definition rm result operand msb * general case r register tested x = c r shift count n = rm lb lower bound z = rm ... r0 ub upper bound 4.3.2 data movement instructions the move instruction is the basic means of transferring and storing address and data. move instructions transfer byte, word, and long-word operands from memory to memory, memory to register, register to memory, and register to register. address movement instructions (move or movea) transfer word and long-word operands and ensure that only valid address manipulations are executed. in addition to the general move instructions, there are several special data movement instructions ?move multiple registers (movem), move peripheral data (movep), move quick (moveq), exchange registers (exg), load effective address (lea), push effective address (pea), link stack (link), and unlink stack (unlk). table 4-2 is a summary of the data movement operations. asl ***?? v = dm (dm ?1 + ... + dm ?r) + dm (dm-1 + ... + dm ?r) c = dm ?r + 1 asl (r = 0) * * 0 0 lsl, roxl * * * 0 ? c = dm ?r + 1 lsr (r = 0) * * 0 0 roxl (r = 0) * * 0 ? c = x rol * * 0 ? c = dm ?r + 1 rol (r = 0) * * 0 0 asr, lsr, roxr * * * 0 ? c = dr ?1 asr, lsr (r = 0) * * 0 0 roxr (r = 0) * * 0 ? c = x ror * * 0 ? c = dr ?1 ror (r = 0) * * 0 0 table 4-2 data movement operations instruction syntax operand size operation exg rn, rn 32 rn ? rn lea ea ? , an 32 ea ? ? an link an, # d ? 16, 32 sp ?4 ? sp, an ? (sp); sp ? an, sp + d ? sp move ea ? , ea ? 8, 16, 32 source ? destination movea ea ? , an 16, 32 ? 32 source ? destination table 4-1 condition code computations (continued) operations x n z v c special definition f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-7 4.3.3 integer arithmetic operations the arithmetic operations include the four basic operations of add (add), subtract (sub), multiply (mul), and divide (div) as well as arithmetic compare (cmp, cmpm, cmp2), clear (clr), and negate (neg). the instruction set includes add, cmp, and sub instructions for both address and data operations with all operand sizes valid for data operations. address operands consist of 16 or 32 bits. the clear and negate in- structions apply to all sizes of data operands. signed and unsigned mul and div instructions include: ?word multiply to produce a long-word product ?long-word multiply to produce a long-word or quad-word product ?division of a long-word dividend by a word divisor (word quotient and word re- mainder) ?division of a long-word or quad-word dividend by a long-word divisor (long-word quotient and long-word remainder) a set of extended instructions provides multiprecision and mixed-size arithmetic. these instructions are add extended (addx), subtract extended (subx), sign extend (ext), and negate binary with extend (negx). refer to table 4-3 for a summary of the integer arithmetic operations. movem list, ea ? ea ? , list 16, 32 16, 32 ? 32 listed registers ? destination source ? listed registers movep dn, (d 16 , an) (d 16 , an), dn 16, 32 dn [31: 24] ? (an + d); dn [23 : 16] ? (an + d + 2); dn [15 : 8] ? (an + d + 4) + dn [7 : 0] ? (an + d + 6) (an + d) ? dn [31 : 24] : (an + d + 2) ? dn [23 : 16]; (an + d + 4) ? dn [15 : 8] : (an + d + 6) ? dn [7 : 0] moveq # data ?, dn 8 ? 32 immediate data ? destination pea ea ? 32 sp ?4 ? sp + ea ? ? sp unlk an 32 an ? sp + (sp) ? an, sp + 4 ? sp table 4-3 integer arithmetic operations instruction syntax operand size operation add dn, ea ? ea ? , dn 8, 16, 32 8, 16, 32 source + destination ? destination adda ea ? , an 16, 32 source + destination ? destination addi # data ?, ea ? 8, 16, 32 immediate data + destination ? destination addq # data ?, ea ? 8, 16, 32 immediate data + destination ? destination addx dn, dn ?(an), ?(an) 8, 16, 32 8, 16, 32 source + destination + x ? destination clr ea ? 8, 16, 32 0 ? destination cmp ea ? , dn 8, 16, 32 (destination ?source), ccr shows results cmpa ea ? , an 16, 32 (destination ?source), ccr shows results cmpi # data ?, ea ? 8, 16, 32 (destination ?data), ccr shows results cmpm (an) +, (an) + 8, 16, 32 (destination ?source), ccr shows results table 4-2 data movement operations instruction syntax operand size operation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-8 reference manual 4.3.4 logic instructions the logical operation instructions (and, or, eor, and not) perform logical opera- tions with all sizes of integer data operands. a similar set of immediate instructions (andi, ori, and eori) provide these logical operations with all sizes of immediate da- ta. the tst instruction arithmetically compares the operand with zero, placing the re- sult in the condition code register. table 4-4 summarizes the logical operations. cmp2 ea ? , rn 8, 16, 32 lower bound rn upper bound, ccr shows result divs/divu ea ? , dn 32/16 ? 16 : 16 destination / source ? destination (signed or unsigned) divsl/divul ea ? , dr : dq ea ? , dq ea ? , dr : dq 64/32 ? 32 : 32 32/32 ? 32 32/32 ? 32 : 32 destination / source ? destination (signed or unsigned) ext dn dn 8 ? 16 16 ? 32 sign extended destination ? destination extb dn 8 ? 32 sign extended destination ? destination muls/mulu ea ? , dn ea ? , dl ea ? , dh : dl 16 * 16 ? 32 32 * 32 ? 32 32 * 32 ? 64 source * destination ? destination (signed or unsigned) neg ea ? 8, 16, 32 0 ?destination ? destination negx ea ? 8, 16, 32 0 ?destination ?x ? destination sub ea ? , dn dn, ea ? 8, 16, 32 destination ?source ? destination suba ea ? , an 16, 32 destination ?source ? destination subi # data ?, ea ? 8, 16, 32 destination ?data ? destination subq # data ?, ea ? 8, 16, 32 destination ?data ? destination subx dn, dn ?(an), ?(an) 8, 16, 32 8, 16, 32 destination ?source ?x ? destination tbls/tblu ea ? , dn dym : dyn, dn 8, 16, 32 dyn ?dym ? temp (temp * dn [7 : 0]) ? temp (dym * 256) + temp ? dn tblsn/tblun ea ? , dn dym : dyn, dn 8, 16, 32 dyn ?dym ? temp (temp * dn [7 : 0]) / 256 ? temp dym + temp ? dn table 4-4 logic operations instruction syntax operand size operation and ea ? , dn dn, ea ? 8, 16, 32 8, 16, 32 source destination ? destination andi # data ?, ea ? 8, 16, 32 data destination ? destination eor dn, ea ? 8, 16, 32 source ? destination ? destination eori # data ?, ea ? 8, 16, 32 data ? destination ? destination not ea ? 8, 16, 32 destination ? destination or ea ? , dn dn, ea ? 8, 16, 32 8, 16, 32 source + destination ? destination ori # data ?, ea ? 8, 16, 32 data + destination ? destination tst ea ? 8, 16, 32 source ?0, to set condition codes table 4-3 integer arithmetic operations instruction syntax operand size operation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-9 4.3.5 shift and rotate instructions the arithmetic shift instructions, asr and asl, and logical shift instructions, lsr and lsl, provide shift operations in both directions. the ror, rol, roxr, and roxl in- structions perform rotate (circular shift) operations, with and without the extend bit. all shift and rotate operations can be performed on either registers or memory. register shift and rotate operations shift all operand sizes. the shift count may be specified in the instruction operation word (to shift from 1 to 8 places) or in a register (modulo 64 shift count). memory shift and rotate operations shift word-length operands one bit position only. the swap instruction exchanges the 16-bit halves of a register. performance of shift/ rotate instructions is enhanced so that use of the ror and rol instructions with a shift count of eight allows fast byte swapping. table 4-5 is a summary of the shift and rotate operations. 4.3.6 bit manipulation instructions bit manipulation operations are accomplished using the following instructions: bit test (btst), bit test and set (bset), bit test and clear (bclr), and bit test and change (bchg). all bit manipulation operations can be performed on either registers or mem- table 4-5 shift and rotate operations instruction syntax operand size operation asl dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 asr dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 lsl dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 lsr dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 rol dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 ror dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 roxl dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 roxr dn, dn # data ?, dn ea ? 8, 16, 32 8, 16, 32 16 swap dn 16 x/c 0 x/c x/c 0 x/c 0 c c c x c x msw lsw f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-10 reference manual ory. the bit number is specified as immediate data or in a data register. register op- erands are 32 bits long, and memory operands are 8 bits long. table 4-6 is a summary of bit manipulation instructions. 4.3.7 binary-coded decimal (bcd) instructions five instructions support operations on bcd numbers. the arithmetic operations on packed bcd numbers are add decimal with extend (abcd), subtract decimal with ex- tend (sbcd), and negate decimal with extend (nbcd). table 4-7 is a summary of the bcd operations. 4.3.8 program control instructions a set of subroutine call and return instructions and conditional and unconditional branch instructions perform program control operations. table 4-8 summarizes these instructions. table 4-6 bit manipulation operations instruction syntax operand size operation bchg dn, ea ? # data ?, ea ? 8, 32 8, 32 ( bit number ? of destination) ? z ? bit of destination bclr dn, ea ? # data ?, ea ? 8, 32 8, 32 ( bit number ? of destination) ? z; 0 ? bit of destination bset dn, ea ? # data ?, ea ? 8, 32 8, 32 ( bit number ? of destination) ? z; 1 ? bit of destination btst dn, ea ? # data ?, ea ? 8, 32 8, 32 ( bit number ? of destination) ? z table 4-7 binary-coded decimal operations instruction syntax operand size operation abcd dn, dn ?(an), ?(an) 8 8 source 10 + destination 10 + x ? destination nbcd ea ? 8 8 0 ?destination 10 ?x ? destination sbcd dn, dn ?(an), ?(an) 8 8 destination 10 ?source 10 ?x ? destination table 4-8 program control operations instruction syntax operand size operation conditional bcc label ? 8, 16, 32 if condition true, then pc + d ? pc dbcc dn , label ? 16 if condition false, then dn ?1 ? pc; if dn 1 ( 1), then pc + d ? pc scc ea ? 8 if condition true, then destination bits are set to one; else, destination bits are cleared to zero unconditional bra label ? 8, 16, 32 pc + d ? pc bsr label ? 8, 16, 32 sp ?4 ? sp; pc ? (sp); pc + d ? pc f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-11 to specify conditions for change in program control, condition codes must be substi- tuted for the letters ?c?in conditional program control opcodes. condition test mne- monics are given below. refer to 4.3.10 condition tests for detailed information on condition codes. cc?arry clear ls?ow or same cs?arry set lt?ess than eq?qual mi?inus f?alse* ne?ot equal ge?reater or equal pl?lus gt?reater than t?rue hi?igh vc?verflow clear le?ess or equal vs?verflow set *not applicable to the bcc instruction 4.3.9 system control instructions privileged instructions, trapping instructions, and instructions that use or modify the condition code register provide system control operations. all of these instructions cause the processor to flush the instruction pipeline. table 4-9 summarizes the in- structions. the preceding list of condition tests also applies to the trapcc instruction. refer to 4.3.10 condition tests for detailed information on condition codes. jmp ea ? none destination ? pc jsr ea ? none sp ?4 ? sp; pc ? (sp); destination ? pc nop none none pc + 2 ? pc returns rtd # d ? 16 (sp) ? pc; sp + 4 + d ? sp rtr none none (sp) ? ccr; sp + 2 ? sp; (sp) ? pc; sp + 4 ? sp rts none none (sp) ? pc; sp + 4 ? sp table 4-9 system control operations instruction syntax size operation privileged andi # data ? , sr 16 data sr ? sr eori # data ? , sr 16 data ? sr ? sr move ea ? , sr sr, ea ? 16 16 source ? sr sr ? destination movea usp, an an, usp 32 32 usp ? an an ? usp movec rc, rn rn, rc 32 32 rc ? rn rn ? rc moves rn, ea ? ea ? , rn 8, 16, 32 rn ? destination using dfc source using sfc ? rn ori # data ? , sr 16 data + sr ? sr table 4-8 program control operations instruction syntax operand size operation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-12 reference manual 4.3.10 condition tests conditional program control instructions and the trapcc instruction execute on the basis of condition tests. a condition test is the evaluation of a logical expression relat- ed to the state of the ccr bits. if the result is one, the condition is true. if the result is zero, the condition is false. for example, the t condition is always true, and the eq condition is true only if the z bit condition code is true. table 4-10 lists each condition test. reset none none assert reset line rte none none (sp) ? sr; sp + 2 ? sp; (sp) ? pc; sp + 4 ? sp; restore stack according to format stop # data ? 16 data ? sr; stop lpstop # data ? none data ? sr; interrupt mask ? ebi; stop trap generating bkpt # data ? none if breakpoint cycle acknowledged, then execute returned operation word, else trap as illegal instruction. bgnd none none if background mode enabled, then enter background mode, else format/vector offset ? ?(ssp); pc ? ? (ssp); sr ? ? (ssp); (vector) ? pc chk ea ? , dn 16, 32 if dn < 0 or dn < (ea), then chk exception chk2 ea ? , rn 8, 16, 32 if rn < lower bound or rn > upper bound, then chk exception illegal none none ssp ?2 ? ssp; vector offset ? (ssp); ssp ?4 ? ssp; pc ? (ssp); ssp ?2 ? ssp; sr ? (ssp); illegal instruction vector address ? pc trap # data ? none ssp ?2 ? ssp; format/vector offset ? (ssp); ssp ?4 ? ssp; pc ? (ssp); sr ? (ssp); vector address ? pc trapcc none # data ? none 16, 32 if cc true, then trap exception trapv none none if v set, then overflow trap exception condition code register andi # data ?, ccr 8 data ccr ? ccr eori # data ?, ccr 8 data ? ccr ? ccr move ea ? , ccr ccr, ea ? 16 16 source ? ccr ccr ? destination ori # data ?, ccr 8 data + ccr ? ccr table 4-10 condition tests mnemonic condition encoding test t true 0000 1 f* false 0001 0 hi high 0010 c z ls low or same 0011 c + z cc carry clear 0100 c cs carry set 0101 c table 4-9 system control operations (continued) instruction syntax size operation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-13 * not available for the bcc instruction. 4.4 instruction details the following paragraphs contain detailed information about each instruction in the cpu32 instruction set. the instruction descriptions are arranged alphabetically by in- struction mnemonic. figure 4-2 shows the format of the instruction descriptions. 4.2.1 notation applies, with the following additions. a. the attributes line specifies the size of the operands of an instruction. when an instruction can use operands of more than one size, a suffix is used with the mnemonic of the instruction: .b byte .w word .l long word b. in instruction set descriptions, changes in ccr bits are shown as follows: * set according to result of operation not affected by operation 0 cleared 1 set u undefined after operation ne not equal 0110 z eq equal 0111 z vc overflow clear 1000 v vs overflow set 1001 v pl plus 1010 n mi minus 1011 n ge greater or equal 1100 n v + n v lt less than 1101 n v + n v gt greater than 1110 n v z + n v z le less or equal 1111 z; n v ; n v table 4-10 condition tests (continued) mnemonic condition encoding test f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-14 reference manual figure 4-2 instruction description format x set the same as the carry bit. n undefined. z cleared if the result is nonzero. unc v undefined. c set if a decimal carry was generate register rx field - specifies the destin if r/m = 0, specifies a data register if r/m = 1, specifies an address regi r/m field: 0 = data register to data register if r/m = 0, rx and ry are data registers if r/m = 1, rx and ry are address registers for th instruction name operation description assembler syntax for this instruction size attribute text description of instruction operation condition code effects abcd operation: assembler syntax: meanings and allowed values (for the various fields required by the instruction format) add decim source + destination + x 10 abcd dy,dx abcd - (ay), - (ax) attributes: size = (byte) condition codes: instruction format (this specifies the bit pattern and fields of the operation and command words, and any other words that are always part of the instruction.) the effective address extensions are not explicitly illustrated. the extension words (if any) follow immediately after the illustrated portions of the instructions. r/m field - specifies the operand addr 0 - the operation is data register to 1 - the operation is memory to mem normally the z condition code bit is an operation. this allows successf of multiple-precision operations. description: adds the source operation and stores the result in the destinatio decimal arithmetic. the operands, w different ways: 1. data register to data register: specified in the instruction. 2. memory to memory: the opera addressing mode using the add instruction format: instruction fields: note register ry field - specifies the sourc if r/m = 0, specifies a data regist if r/m = 1, specifies an address xnzvc uu 15 14 13 12 11 10 1 1 0 0 register rx 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-15 abcd add decimal with extend abcd operation: source 10 + destination 10 + x ? destination assembler abcd dy, dx syntax: abcd ?(ay), ?(ax) attributes: size = (byte) description: adds the source operand to the destination operand along with the extend bit, and stores the result in the destination location. the addition is performed using binary coded decimal arithmetic. the operands, which are packed bcd num- bers, can be addressed in two different ways: 1. data register to data register ?operands are contained in data registers spec- ified by the instruction. 2. memory to memory ?operands are addressed with the predecrement ad- dressing mode using address registers specified by the instruction. condition codes: x set the same as the carry bit. n unde?ed. z cleared if the result is nonzero. unchanged otherwise. v unde?ed. c set if a decimal carry was generated. cleared otherwise. note normally the z condition code bit is set via programming before the start of an operation. this allows successful tests for zero results upon completion of multiple-precision operations. instruction format: xnzvc * u* u* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 0 register rx 1 0 0 0 0 r/m register ry f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-16 reference manual abcd add decimal with extend abcd instruction fields: register rx ?ld ?speci?s the destination register: if r/m = 0, speci?s a data register if r/m = 1, speci?s an address register for predecrement addressing mode r/m ?ld ?speci?s the operand addressing mode: 0 ?the operation is data register to data register 1 ?the operation is memory to memory register ry ?ld ?speci?s the source register: if r/m = 0, speci?s a data register if r/m = 1, speci?s an address register for predecrement addressing mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-17 add add add operation: source + destination ? destination assembler: add ea ? , dn syntax: add dn, ea ? attributes: size = (byte, word, long) description: adds the source operand to the destination operand using binary addition, and stores the result in the destination location. the mode of the instruction indicates which operand is the source and which is the destination as well as the operand size. condition codes: x set the same as the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w is generated. cleared otherwise. c set if a carry is generated. cleared otherwise. instruction format: instruction fields: . register ?ld ?speci?s any of the eight data registers. opmode ?ld: xnzvc * * * * * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 1 register opmode mode register byte word long operation 000 001 010 ea ? + dn ? ? dn ? 100 101 110 dn ? + ea ? ? ea ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-18 reference manual add add add effective address field ?determines addressing mode: if the location specified is a source operand, all addressing modes are allowed as shown: *word and long word only if the location specified is a destination operand, only memory alterable addressing modes are allowed as shown: notes: 1. dn mode is used when destination is a data register. destination ea ? mode is invalid for a data register. 2. adda is used when the destination is an address register. addi and addq are used when the source is immediate data. most assemblers automatically make this distinction. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an* 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-19 adda add address adda operation: source + destination ? destination assembler syntax: adda ea ? an attributes: size = (word, long) description: adds the source operand to the destination address register and stores the result in the address register. the entire destination address register is used regardless of the operation size. condition codes: not affected instruction format: instruction fields: register ?ld ?speci?s any of the eight address registers. this is always the desti- nation. opmode ?ld ?speci?s the size of the operation: 011 ?word operation. the source operand is sign-extended to a long oper- and and the operation is performed on the address register using all 32 bits. 111 ?long operation. effective address ?ld ?speci?s source operand. all addressing modes are al- lowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 1 register opmode mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-20 reference manual addi add immediate addi operation: immediate data + destination ? destination assembler syntax: addi # data ?, ea ? attributes: size = (byte, word, long) description: adds the immediate data to the destination operand, and stores the result in the destination location. the size of the immediate data must match the oper- ation size. condition codes: x set the same as the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w is generated. cleared otherwise. c set if a carry is generated. cleared otherwise. instruction format: instruction fields: size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 1 1 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-21 addi add immediate addi effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: immediate ?ld ?(data immediately following the instruction): if size = 00, the data is the low-order byte of the immediate word. if size = 01, the data is the entire immediate word. if size = 10, the data is the next two immediate words. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an - (an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-22 reference manual addq add quick addq operation: immediate data + destination ? destination assembler syntax: addq # data ?, ea ? attributes: size = (byte, word, long) description: adds an immediate value in the range (1?) to the operand at the destination location. word and long operations are allowed on the address registers. when adding to address registers, the condition codes are not altered, and the entire destination address register is used, regardless of the operation size. condition codes: x set the same as the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w occurs. cleared otherwise. c set if a carry occurs. cleared otherwise. the condition codes are not affected when the destination is an address register. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 1 data 0 size mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-23 addq add quick addq instruction fields: . data ?ld ?three bits of immediate data, (9?1), with 0 representing a value of 8). size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation effective address ?ld ?speci?s the destination location. only alterable addressing modes are allowed as shown: *word and long only addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an* 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-24 reference manual addx add extended addx operation: source + destination + x ? destination assembler addx dy, dx syntax: addx ?(ay), ?(ax) attributes: size = (byte, word, long) description: adds the source operand to the destination operand along with the extend bit and stores the result in the destination location. the operands can be addressed in two ways: 1. data register to data register: data registers specified by the instruction contain the operands. 2. memory to memory: address registers specified by the instruction address the operands using the predecrement addressing mode. condition codes: x set the same as the carry bit. n set if the result is negative. cleared otherwise. z cleared if the result is nonzero. unchanged otherwise. v set if an over?w occurs. cleared otherwise. c set if a carry is generated. cleared otherwise. note normally the z condition code bit is set via programming before the start of an operation. this allows successful tests for zero results upon completion of multiple-precision operations. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 1 register rx 1 size 0 0 r/m register ry f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-25 addx add extended addx instruction fields: register rx ?ld ?speci?s the destination register: if r/m = 0, speci?s a data register. if r/m = 1, speci?s an address register for predecrement addressing mode. size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation r/m ?ld ?speci?s the operand address mode: 0 ?the operation is data register to data register. 1 ?the operation is memory to memory. register ry ?ld ?speci?s the source register: if r/m = 0, speci?s a data register. if r/m = 1, speci?s an address register for predecrement addressing mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-26 reference manual and logical and and operation: source destination ? destination assembler and ea ? ,dn syntax: and dn, ea ? attributes: size = (byte, word, long) description: performs an and operation of the source operand with the destina- tion operand and stores the result in the destination location. the contents of an address register may not be used as an operand. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: register ?ld ?speci?s any of the eight data registers. opmode ?ld: xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register opmode mode register byte word long operation 000 001 010 ( ea ?) ( dn ?) ? dn 100 101 110 ( dn ?) ( ea ?) ? ea f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-27 and logical and and effective address ?ld ?determines addressing mode: if the location speci?d is a source operand, only data addressing modes are allowed as shown: if the location speci?d is a destination operand, only memory alterable addressing modes are allowed as shown: notes: 1. the dn mode is used when the destination is a data register; the destination ea ? mode is invalid for a data register. 2. most assemblers use andi when the source is immediate data. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-28 reference manual andi and immediate andi operation: immediate data destination ? destination assembler syntax: andi # data ?, ea ? attributes: size = (byte, word, long) description: performs an and operation of the immediate data with the destina- tion operand and stores the result in the destination location. the size of the immedi- ate data must match the operation size. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 0 1 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-29 andi and immediate andi effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: immediate ?ld ?(data immediately following the instruction): if size = 00, the data is the low-order byte of the immediate word. if size = 01, the data is the entire immediate word. if size = 10, the data is the next two immediate words. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-30 reference manual andi and immediate to condition code register andi to ccr to ccr operation: source ccr ? ccr assembler syntax: andi # data ? , ccr attributes: size = (byte) description: performs an and operation of the immediate operand with the con- dition codes and stores the result in the low-order byte of the status register. condition codes: x cleared if bit 4 of immediate operand is zero. unchanged otherwise. n cleared if bit 3 of immediate operand is zero. unchanged otherwise. z cleared if bit 2 of immediate operand is zero. unchanged otherwise. v cleared if bit 1 of immediate operand is zero. unchanged otherwise. c cleared if bit 0 of immediate operand is zero. unchanged otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 byte data (8 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-31 andi and immediate to the status register andi to sr (privileged instruction) to sr operation: if supervisor state then source sr ? sr else trap assembler syntax: andi # data ? , sr attributes: size = (word) description: performs an and operation of the immediate operand with the con- tents of the status register and stores the result in the status register. all implemented bits of the status register are affected. condition codes: x cleared if bit 4 of immediate operand is zero. unchanged otherwise. n cleared if bit 3 of immediate operand is zero. unchanged otherwise. z cleared if bit 2 of immediate operand is zero. unchanged otherwise. v cleared if bit 1 of immediate operand is zero. unchanged otherwise. c cleared if bit 0 of immediate operand is zero. unchanged otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 0 0 word data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-32 reference manual asl, asr arithmetic shift asl, asr operation: destination shifted by count ? ? destination assembler asd dx,dy syntax: asd # data ? , dy asd ea ? where d is direction, l or r attributes: size = (byte, word, long) description: arithmetically shifts the bits of the operand in the direction (l or r) speci?d. the carry bit receives the last bit shifted out of the operand. the shift count for shifting a register may be speci?d in two ways: 1. immediate ?shift count is specified by the instruction (shift range, 8?). 2. register ?the shift count is the value in the data register specified by the in- struction, modulo 64. an operand in memory can be shifted one bit only, and the operand size is restricted to a word. for asl, the operand is shifted left; the number of positions shifted is the shift count. bits shifted out of the high-order bit go to both the carry and the extend bits; zeros are shifted into the low-order bit. the overflow bit indicates if any sign changes occur dur- ing the shift. for asr, the operand is shifted right; the number of positions shifted is the shift count. bits shifted out of the low-order bit go to both the carry and the extend bits; the sign- bit (msb) is shifted into the high-order bit. x/c 0 asl x/c asr f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-33 asl, asr arithmetic shift asl, asr condition codes: x set according to the last bit shifted out of the operand. unaffected for a shift count of zero. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v set if the most signi?ant bit is changed during the shift operation. cleared otherwise. c set according to the last bit shifted out of the operand. cleared for a shift count of zero. instruction format (register shifts): instruction fields (register shifts): count/register ?ld ?speci?s shift count or register that contains shift count: if i/r = 0, this ?ld contains the shift count. the values one to seven represent counts of one to seven; value of zero represents a count of eight. if i/r = 1, this ?ld speci?s the data register that contains the shift count (mod- ulo 64). dr ?ld ?speci?s the direction of the shift: 0 ?shift right 1 ?shift left size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation i/r ?ld: if i/r = 0, speci?s immediate shift count. if i/r = 1, speci?s register shift count. register ?ld ?speci?s a data register to be shifted. xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 0 0 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-34 reference manual asl, asr arithmetic shift asl, asr instruction format (memory shifts): instruction fields (memory shifts): dr ?ld ?speci?s the direction of the shift: 0 ?shift right 1 ?shift left effective address ?ld ?speci?s the operand to be shifted. only memory alterable addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 0 0 dr 1 1 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-35 bcc branch conditionally bcc operation: if (condition true) then pc+ d ? pc assembler syntax: bcc label ? attributes: size = (byte, word, long) description: if the speci?d condition is true, program execution continues at location (pc) + displacement. the pc contains the address of the instruction word of the bcc instruction plus two. the displacement is a twos complement integer that rep- resents the relative distance in bytes from the current pc to the destination pc. if the 8-bit displacement ?ld in the instruction word is zero, a 16-bit displacement (the word immediately following the instruction) is used. if the 8-bit displacement ?ld in the instruction word is all ones ($ff), the 32-bit displacement (long word immediately following the instruction) is used. condition codes are speci?d as follows: condition codes: not affected. instruction format: cc name code description cc name code description cc carry clear 0100 c ls low or same 0011 c ; z cs carry set 0101 c lt less than 1101 n v ; n v eq equal 0111 z mi minus 1011 n ge greater or equal 1100 n v; n v n e not equal 0110 z gt greater than 1110 n v z ; n v z pl plus 1010 n hi high 0010 c z v c overflow clear 1000 v le less or equal 1111 z; n v ; n v v s overflow set 1001 v 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 0 condition 8-bit displacement 16-bit displacement if 8-bit displacement = $00 32-bit displacement if 8-bit displacement = $ff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-36 reference manual bcc branch conditionally bcc instruction fields: condition ?ld ?the binary code for one of the conditions listed in the table. 8-bit displacement ?ld ?twos complement integer specifying the number of bytes between the branch instruction and the next instruction to be executed if the condition is met. 16-bit displacement ?ld ?used for displacement when 8-bit displacement ?ld contains$00. 32-bit displacement ?ld ?used for displacement when 8-bit displacement ?ld contains $ff. note a branch to the instruction immediately following automatically uses 16-bit displacement because the 8-bit displacement field contains $00 (zero offset). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-37 bchg test a bit and change bchg operation: ( n umber ? of destination) ? z; ( n umber ? of destination) ? bit number ? of destination assembler: bchg dn, ea ? syntax: bchg # data ? , ea ? attributes: size = (byte, long) description: tests a speci?d bit in the destination operand, sets the z condition code appropriately, then inverts the speci?d bit. when the destination is a data regis- ter, any of the 32 bits can be speci?d by the modulo 32 bit number. when the desti- nation is a memory location, the operation is a byte operation, and the bit number is modulo 8. in all cases, bit zero refers to the least signi?ant bit. the bit number for this operation may be speci?d in either of two ways: 1. immediate ?the bit number is speci?d by a second instruction word 2. register ?the speci?d data register contains the bit number. condition codes: x not affected n not affected z set if the bit tested is zero. cleared otherwise v not affected c not affected instruction format (bit number static, specified as immediate data): xnzvc ? 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 0 1 mode register 0 0 0 0 0 0 0 0 bit number f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-38 reference manual bchg test a bit and change bchg instruction fields (bit number static): bit number ?ld ?speci?s the bit number. effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: *long only; all others are byte only instruction format (bit number dynamic, specified in a register): instruction fields (bit number dynamic): register ?ld ?speci?s the data register that contains the bit number. effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: *long only; all others are byte only addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 0 1 mode register addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-39 bclr test a bit and clear bclr operation: ( bit n umber ? of destination) ? z; 0 ? bit number ? of destination assembler bclr dn, ea ? syntax: bclr # data ?, ea ? attributes: size = (byte, long) description: tests a speci?d bit in the destination operand, sets the z condition code appropriately, then clears the bit. when a data register is the destination, any of the 32 bits can be speci?d by a modulo 32 bit number. when a memory location is the destination, the operation is a byte operation, and the bit number is modulo 8. in all cases, bit zero refers to the least signi?ant bit. the bit number for this operation can be speci?d in either of two ways: 1. immediate ?the bit number is speci?d by a second instruction word. 2. register ?the speci?d data register contains the bit number. condition codes: x not affected n not affected z set if the bit tested is zero. cleared otherwise v not affected c not affected instruction format (bit number static, specified as immediate data): xnzvc ? 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 1 0 mode register 0 0 0 0 0 0 0 0 bit number f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-40 reference manual bclr test a bit and clear bclr instruction fields (bit number static): bit number ?ld ?speci?s the bit number. effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: *long only; all others are byte only instruction format (bit number dynamic, specified in a register): instruction fields (bit number dynamic): . register ?ld ?speci?s the data register that contains the bit number. effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: *long only; all others are byte only addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 1 0 mode register addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-41 bgnd enter background mode bgnd operation: if (background mode enabled) then enter background mode else format/vector offset ? ?(ssp) pc ? ?(ssp) sr ? ?(ssp) (vector) ? pc assembler syntax: bgnd attributes: size = (unsized) description: the processor suspends instruction execution and enters back- ground mode (if enabled). the freeze output is asserted to acknowledge entrance into background mode. upon exiting background mode, instruction execution contin- ues with the instruction pointed to by the program counter. if background mode is not enabled, the processor initiates illegal instruction exception processing. the vector number is generated to reference the illegal instruction exception vector. background mode is covered in section 7 devel- opment support . condition codes: x not affected n not affected z not affected v not affected c not affected instruction format: xnzvc 1514131211109876543210 0100101011111010 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-42 reference manual bkpt breakpoint bkpt operation: run breakpoint acknowledge cycle; if acknowledged then execute returned operation word else trap as illegal instruction assembler syntax: bkpt # data ? attributes: unsized description: executes a breakpoint acknowledge bus cycle. bits [2:4] of the address bus are set to the value of the immediate data (0 to 7) and bits 0 and 1 of the address bus are set to 0. the breakpoint acknowledge cycle accesses the cpu space, addressing type 0, and provides the breakpoint number specified by the instruction on address lines a4 to a2. if external hardware terminates the cycle with dsackx , the data on the bus (an in- struction word) is inserted into the instruction pipe and is executed after the breakpoint instruction. the breakpoint instruction requires a word transfer ?if the first bus cycle accesses an 8-bit port, a second cycle is required. if external logic terminates the breakpoint acknowledge cycle with berr (i.e., no instruction word available) the pro- cessor takes an illegal instruction exception. refer to 6.2.5 software breakpoints for details of breakpoint operation. this instruction supports breakpoints for debug monitors and real-time hardware em- ulators. the exact operation performed by the instruction is implementation-depen- dent. typically, this instruction replaces an instruction in a program and the replaced instruction is returned by the breakpoint acknowledge cycle. condition codes: not affected. instruction format: instruction fields: vector ?ld ?contains immediate data in the range (0?). this is the breakpoint number. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 vector f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-43 bra branch always bra operation: pc + d ? pc assembler syntax: bra label ? attributes: size = (byte, word, long) description: program execution continues at location (pc) + displacement. the pc contains the address of the instruction word of the bra instruction plus two. the displacement is a twos complement integer that represents the relative distance in bytes from the current pc to the destination pc. if the 8-bit displacement ?ld in the instruction word is zero, a 16-bit displacement (the word immediately following the instruction) is used. if the 8-bit displacement ?ld in the instruction word is all ones ($ff), the 32-bit displacement (long word immediately following the instruction) is used. condition codes: not affected. instruction format: instruction fields: 8-bit displacement ?ld ?twos complement integer specifying the number of bytes between the branch instruction and the next instruction to be executed. 16-bit displacement ?ld ?used for a larger displacement when 8-bit displacement is $00. 32-bit displacement ?ld ?used for a larger displacement when 8-bit displacement is $ff. note a branch to the instruction immediately following automatically uses 16-bit displacement because the 8-bit displacement field contains $00 (zero offset). 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 0 0 0 0 0 8-bit displacement 16-bit displacement if 8-bit displacement = $00 32-bit displacement if 8-bit displacement = $ff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-44 reference manual bset test a bit and set bset operation: ( bit n umber ? of destination ) ? z; 1 ? bit number ? of destination assembler: bset dn, ea ? syntax: bset # data ? , ea ? attributes: size = (byte, long) description: tests a bit in the destination operand, sets the z condition code appropriately, then sets the speci?d bit in the destination operand. when a data reg- ister is the destination, any of the 32 bits can be speci?d by a modulo 32 bit number. when a memory location is the destination, the operation is a byte operation, and the bit number is modulo 8. in all cases, bit zero refers to the least signi?ant bit. the bit number for this operation can be speci?d in two ways: 1. immediate ?the bit number is speci?d by the second word of the instruc- tion. 2. register ?the speci?d data register contains the bit number. condition codes: x not affected. n not affected z set if the bit tested is zero. cleared otherwise v not affected c not affected. instruction format (bit number static, specified as immediate data): xnzvc ? 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 1 1 mode register 0 0 0 0 0 0 0 0 bit number f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-45 bset test a bit and set bset instruction fields (bit number static): bit number ?ld ?speci?s the bit number. effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: *long only; all others are byte only instruction format (bit number dynamic, specified in a register): instruction fields (bit number dynamic): register ?ld ?speci?s the data register that contains the bit number. effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: *long only; all others are byte only addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 1 1 mode register addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-46 reference manual bsr branch to subroutine bsr operation: sp ?4 ? sp; pc ? (sp); pc + d ? pc assembler syntax: bsr label ? attributes: size = (byte, word, long) description: pushes the long word address of the instruction immediately follow- ing the bsr instruction onto the system stack. the pc contains the address of the instruction word plus two. program execution then continues at location (pc) + dis- placement. the displacement is a twos complement integer that represents the rela- tive distance in bytes from the current pc to the destination pc. if the 8-bit displacement ?ld in the instruction word is zero, a 16-bit displacement (the word immediately following the instruction) is used. if the 8-bit displacement ?ld in the instruction word is all ones ($ff), the 32-bit displacement (long word immediately fol- lowing the instruction) is used. condition codes: not affected. instruction format: instruction fields: 8-bit displacement ?ld ?twos complement integer specifying the number of bytes between the branch instruction and the next instruction to be executed. 16-bit displacement ?ld ?used for larger displacement when 8-bit displacement is $00. 32-bit displacement ?ld ?used for larger displacement when 8-bit displacement is $ff. note a branch to the instruction immediately following automatically uses 16-bit displacement because the 8-bit displacement field contains $00 (zero offset). 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 0 0 0 0 1 8-bit displacement 16-bit displacement if 8-bit displacement = $00 32-bit displacement if 8-bit displacement = $ff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-47 btst test a bit btst operation: ?( bit number ? of destination) ? z assembler btst dn, ea ? syntax: btst # data ? , ea ? attributes: size = (byte, long) description: tests a bit in the destination operand and sets the z condition code appropriately. when a data register is the destination, any of the 32 bits can be spec- i?d by a modulo 32 bit number. when a memory location is the destination, the oper- ation is a byte operation, and the bit number is modulo 8. in all cases, bit zero refers to the least signi?ant bit. the bit number for this operation can be speci?d in either of two ways: 1. immediate ?the bit number is speci?d by a second word of the instruction. 2. register ?the speci?d data register contains the bit number. condition codes: x not affected. n not affected. z set if the bit tested is zero. cleared otherwise. v not affected. c not affected. instruction format (bit number static, specified as immediate data): xnzvc ? 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 0 0 mode register 0 0 0 0 0 0 0 0 bit number f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-48 reference manual btst test a bit btst instruction fields (bit number static): bit number ?ld ?speci?s the bit number. effective address ?ld ?speci?s the destination location. only data addressing modes areallowed as shown: *long only; all others are byte only instruction format (bit number dynamic, specified in a register): instruction fields (bit number dynamic): register ?ld ?speci?s the data register that contains the bit number. effective address ?ld ?speci?s the destination location. only data addressing modes are allowed as shown: *long only; all others are byte only addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 0 0 mode register addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-49 chk check register against bounds chk operation: if dn < 0 or dn > source then trap assembler syntax: chk ea ? , dn attributes: size = (word, long) description: compares the value in the data register speci?d by the instruction to zero and to the upper bound (effective address operand). the upper bound is a twos complement integer. if the register value is less than zero or greater than the upper bound, a chk instruction exception, vector number 6, occurs. condition codes: x not affected. n set if dn < 0; cleared if dn > effective address operand. unde?ed otherwise. z unde?ed. v unde?ed. c unde?ed. instruction format: instruction fields: register ?ld ?speci?s the data register that contains the value to be checked. size ?ld ?speci?s the size of the operation. 11 ?word operation. 10 ?long operation. effective address ?ld ?speci?s the upper bound operand. only data addressing modes areallowed as shown: xnzvc * uuu 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 register size 0 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-50 reference manual chk check register against bounds chk effective address ?ld ?speci?s the destination location. only data addressing modes are allowed as shown: *long only; all others are byte only addressing mode mode register addressing mode mode register dn* 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-51 chk2 check register against bounds chk2 operation: if rn < lower bound or rn > upper bound then trap assembler syntax: chk2 ea ? , rn attributes: size = (byte, word, long) description: compares the value in rn to each bound. the effective address contains the bounds pair: the lower bound followed by the upper bound. for signed comparisons, the arithmetically smaller value should be used as the lower bound. for unsigned comparisons, the logically smaller value should be the lower bound. the size of both data and the bounds can be speci?d as byte, word, or long. if rn is a data register and the operation size is byte or word, only the appropriate low- order part of rn is checked. if rn is an address register and the operation size is byte or word, the bounds operands are sign-extended to 32 bits and the resultant operands are compared to the full 32 bits of an. if the upper bound equals the lower bound, the valid range is a single value. if the register value is less than the lower bound or greater than the upper bound, a chk instruction exception, vector number 6, occurs. condition codes: x not affected. n unde?ed. z set if rn is equal to either bound. cleared otherwise. v unde?ed. c set if rn is out of bounds. cleared otherwise. xnzvc u*u* f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-52 reference manual chk2 check register against bounds chk2 instruction format: instruction fields: size ?ld ?speci?s the size of the operation. 00 ?byte operation 01 ?word operation 10 ?long operation effective address ?ld ?speci?s the location of the bounds operands. only control addressing modes are allowed as shown: d/a ?ld ?speci?s whether an address register or data register is to be checked. 0 ?data register. 1 ?address register. register ?ld ?speci?s the address or data register that contains the value to be checked. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 size 0 0 0 mode register d/a register 1 0 0 0 0 0 0 0 0 0 0 0 addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-53 clr clear an operand clr operation: 0 ? destination assembler syntax: clr ea ? attributes: size = (byte, word, long) description: clears the destination operand to zero. condition codes: x not affected. n always cleared. z always set. v always cleared. c always cleared. instruction format: instruction fields: size ?ld ?speci?s the size of the operation. 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc 0100 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 1 0 size mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-54 reference manual clr clear an operand clr effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-55 cmp compare cmp operation: destination ?source ? cc assembler syntax: cmp ea ?, dn attributes: size = (byte, word, long) description: subtracts the source operand from the destination data register and sets condition codes according to the result. the data register is not changed. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w occurs. cleared otherwise. c set if a borrow occurs. cleared otherwise. instruction format: instruction fields: register ?ld ?speci?s the destination data register. opmode ?ld: xnzvc **** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 1 1 register opmode mode register byte word long operation 000 001 010 ( dn ?) - ( ea ?) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-56 reference manual cmp compare cmp effective address ?ld ?speci?s the source operand. all addressing modes are allowed as shown: *word and long only note cmpa is used when the destination is an address register. cmpi is used when the source is immediate data. cmpm is used for memory- to-memory compares. most assemblers automatically make the dis- tinction. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an* 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-57 cmpa compare address cmpa operation: destination ?source ? cc assembler syntax: cmpa ea ? , an attributes: size = (word, long) description: subtracts the source operand from the destination address register and sets the condition codes according to the result. the address register is not changed. the size of the operation can be speci?d as word or long. word length source operands are sign extended to 32-bits for comparison. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w is generated. cleared otherwise. c set if a borrow is generated. cleared otherwise. instruction format: instruction fields: register ?ld ?speci?s the destination address register. opmode ?ld ?speci?s the size of the operation: 011 ?word operation. the source operand is sign-extended to a long oper- and and the operation is performed on the address register using all 32 bits. 111 ?long operation. xnzvc **** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 1 1 register opmode mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-58 reference manual cmpa compare address cmpa effective address ?ld ?speci?s source operand. all addressing modes are allowed as shown: addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-59 cmpi compare immediate cmpi operation: destination ?immediate data ? cc assembler syntax: cmpi # data ? , ea ? attributes: size = (byte, word, long) description: subtracts the immediate data from the destination operand and sets condition codes according to the result. the destination location is not changed. the size of the immediate data must match the operation size. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w occurs. cleared otherwise. c set if a borrow occurs. cleared otherwise. instruction format: instruction fields: size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc **** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 1 0 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-60 reference manual cmpi compare immediate cmpi effective address ?ld ?speci?s the destination operand. only data addressing modes, except immediate, are allowed as shown: immediate ?ld ?(data immediately following the instruction): if size = 00, the data is the low-order byte of the immediate word. if size = 01, the data is the entire immediate word. if size = 10, the data is the next two immediate words. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-61 cmpm compare memory cmpm operation: destination ?source ? cc assembler syntax: cmpm (ay)+, (ax)+ attributes: size = (byte, word, long) description: subtracts the source operand from the destination operand and sets the condition codes according to the results. the destination location is not changed. the operands are always addressed with the postincrement addressing mode, using the address registers speci?d by the instruction. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w is generated. cleared otherwise. c set if a borrow is generated. cleared otherwise. instruction format: instruction fields: register ax ?ld ?(always the destination). speci?s an address register in the postincrement addressing mode. size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation register ay ?ld ?(always the source). speci?s an address register in the postin- crement addressing mode. xnzvc **** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 0 1 1 register ax 1 size 0 0 1 register ay f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-62 reference manual cmp2 compare register against bounds cmp2 operation: compare rn < lower-bound or rn > upper-bound and set condition codes assembler syntax: cmp2 ea ? , rn attributes: size = (byte, word, long) description: compares the value in rn to each bound. the effective address contains the bounds pair: the lower bound followed by the upper bound. for signed comparisons, the arithmetically smaller value should be used as the lower bound. for unsigned comparisons, the logically smaller value should be the lower bound. the size of the data and the bounds can be speci?d as byte, word, or long. if rn is a data register and the operation size is byte or word, only the appropriate low- order part of rn is checked. if rn is an address register and the operation size is byte or word, the bounds operands are sign-extended to 32 bits and the resultant operands are compared to the full 32 bits of an. if the upper bound equals the lower bound, the valid range is a single value. note this instruction is identical to chk2, except that it sets condition codes rather than taking an exception when the value in rn is out of bounds. condition codes: x not affected. n unde?ed. z set if rn is equal to either bound. cleared otherwise. v unde?ed. c set if rn is out of bounds. cleared otherwise. instruction format: xnzvc u*u* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 size 0 1 1 mode register d/a register 0 0 0 0 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-63 cmp2 compare register against bounds cmp2 instruction fields: size ?ld ?speci?s the size of the operation. 00 ?byte operation 01 ?word operation 10 ?long operation effective address ?ld ?speci?s the location of the bounds pair. only control addressing modes are allowed as shown: d/a ?ld ?speci?s whether an address register or data register is compared. 0 ?data register. 1 ?address register. register ?ld ?speci?s the address or data register that contains the value to be checked. addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-64 reference manual dbcc test condition, decrement, and branch dbcc operation: if condition false then dn ?1 ? dn;if dn 1 ? then pc + d ? pc assembler syntax: dbcc dn, label ? attributes: size = (word) description: controls a loop of instructions. the parameters are a condition code, a data register (counter), and a displacement value. the instruction ?st tests the con- dition (for termination); if it is true, no operation is performed. if the termination condi- tion is not true, the low-order 16 bits of the counter data register are decremented by one. if the result is ?, execution continues with the next instruction. if the result is not equal to ?, execution continues at the location indicated by the current value of the pc, plus the sign-extended 16-bit displacement. the value in the pc is the address of the instruction word of the dbcc instruction plus two. the displacement is a twos complement integer that represents the relative distance in bytes from the current pc to the destination pc. condition code cc speci?s one of the following conditions: condition codes: not affected. cc name code description cc name code description cc carry clear 0100 c ls low or same 0011 c ; z cs carry set 0101 c lt less than 1101 n v ; n v eq equal 0111 z mi minus 1011 n f never equal 0001 0 n e not equal 0110 z ge greater or equal 1100 n v; n v pl plus 1010 n gt greater than 1110 n v z ; n v z t always true 0000 1 hi high 0010 c z v c overflow clear 1000 v le less or equal 1111 z; n v ; n v v s overflow set 1001 v f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-65 dbcc test condition, decrement, and branch dbcc instruction format: instruction fields: condition ?ld ?the binary code for one of the conditions listed in the table. register ?ld ?speci?s the data register used as the counter. displacement ?ld ?speci?s the number of bytes to branch. notes: 1. terminating condition is similar to until loop clauses of high-level languages. for example, dbmi can be stated decrement and branch until minus.'' 2. most assemblers accept dbra for dbf when a count terminates the loop (no condition is tested). 3. a program can enter a loop at the beginning, or by branching to the trailing dbcc instruction. entering the loop at the beginning is useful for indexed ad- dressing modes and dynamically specified bit operations. in this case, the con- trol index count must be one less than the desired number of loop executions. however, when entering a loop by branching to the trailing dbcc instruction, the control count should equal the loop execution count so that the dbcc instruction will not branch and the main loop will not execute if a zero count occurs. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 1 condition 1 1 0 0 1 register displacement f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-66 reference manual divs signed divide divs divsl divsl operation: destination / source ? destination assembler syntax: divs.w ea ? , dn32/16 ? 16r:16q divs.l ea ? , dq32/32 ? 32q divs.l ea ? , dr:dq64/32 ? 32r:32q divsl.l ea ? , dr:dq32/32 ? 32r:32q attributes: size = (word, long) description: divides the signed destination operand by the signed source oper- and and stores the signed result in the destination. the instruction uses one of four forms. the word form of the instruction divides a long word by a word. the result is a quotient in the lower word (least significant 16 bits) and a remainder in the upper word (most significant 16 bits) of the destination. the sign of the remainder is the same as the sign of the dividend. the first long form divides a long word by a long word. the result is a long quotient; the remainder is discarded. the second long form divides a quad word (in any two data registers) by a long word. the result is a long word quotient and a long word remainder. the third long form divides a long word by a long word. the result is a long word quo- tient and a long word remainder. two special conditions may arise during the operation: 1. division by zero causes a trap. 2. overflow may be detected before instruction completion. if an overflow is detected, the overflow condition code is set and the operands are unaffect- ed. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-67 divs signed divide divs divsl divsl condition codes: x not affected. n set if quotient is negative. cleared otherwise. unde?ed if over?w or divide by zero occurs. z set if quotient is zero. cleared otherwise. unde?ed if over?w or divide by zero occurs. v set if division over?w occurs; unde?ed if divide by zero occurs. cleared oth- erwise. c always cleared. instruction format (word form): instruction fields: register ?ld ?speci?s any of the eight data registers. this ?ld always speci?s the destination operand. effective address ?ld ?speci?s the source operand. only data addressing modes are allowed as shown: note overflow occurs if the quotient is larger than a 16-bit signed integer. xnzvc ***0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 0 0 register 1 1 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-68 reference manual divs signed divide divs divsl divsl instruction format (long form): instruction fields: effective address ?ld ?speci?s the source operand. only data addressing modes are allowed as shown: register dq ?ld ?speci?s a data register for the destination operand. the low- order 32 bits of the dividend come from this register, and the 32-bit quotient is loaded into this register. size ?ld ?selects a 32 or 64 bit division operation. 0 ?32-bit dividend is in register dq. 1 ?64-bit dividend is in dr:dq. register dr ?ld ?after the division, this register contains the 32-bit remainder. if dr and dq are the same register, only the quotient is returned. if size is 1, the dr ?ld also speci?s the data register that contains the high-order 32 bits of the dividend. note overflow occurs if the quotient is larger than a 32-bit signed integer. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 0 0 0 1 mode register 0 register dq 1 size 0 0 0 0 0 0 0 register dr addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-69 divu unsigned divide divu divul divul operation: destination/source ? destination assembler syntax: divs.w ea ? , dn32/16 ? 16r:16q divs.l ea ? , dq32/32 ? 32q divs.l ea ? , dr:dq64/32 ? 32r:32q divsl.l ea ? , dr:dq32/32 ? 32r:32q attributes: size = (word, long) description: divides the unsigned destination operand by the unsigned source operand and stores the unsigned result in the destination. the instruction uses one of four forms. the word form of the instruction divides a long word by a word. the result is a quotient in the lower word (least signi?ant 16 bits) and a remainder in the upper word (most signi?ant 16 bits) of the destination. the ?st long form divides a long word by a long word. the result is a long quo- tient; the remainder is discarded. the second long form divides a quad word (in any two data registers) by a long word. the result is a long word quotient and a long word remainder. the third long form divides a long word by a long word. the result is a long word quotient and a long word remainder. two special conditions may arise during the operation: 1. division by zero causes a trap. 2. over?w may be detected before instruction completion. if an over?w is detected, the over?w condition code is set and the operands are unaffected. condition codes: x not affected. n set if quotient is negative. cleared otherwise. unde?ed if over?w or divide by zero occurs. z set if quotient is zero. cleared otherwise. unde?ed if over?w or divide by zero occurs. v set if division over?w occurs; unde?ed if divide by zero occurs. cleared oth- erwise. c always cleared. xnzvc ***0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-70 reference manual divu unsigned divide divu divul divul instruction format (word form): instruction fields: register ?ld ?speci?s any of the eight data registers. this ?ld always speci?s the destination operand. effective address ?ld ?speci?s the source operand. only data addressing modes are allowed as shown: note overflow occurs if the quotient is larger than a 16-bit signed integer. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 0 0 register 0 1 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-71 divu unsigned divide divu divul divul instruction format (long form): instruction fields: effective address ?ld ?speci?s the source operand. only data addressing modes are allowed as shown: register dq ?ld ?speci?s a data register for the destination operand. the low- order 32 bits of the dividend come from this register, and the 32-bit quotient is loaded into this register. size ?ld ?selects a 32 or 64 bit division operation. 0 ?32-bit dividend is in register dq. 1 ?64-bit dividend is in dr:dq. register dr ?ld ?after the division, this register contains the 32-bit remainder. if dr and dq are the same register, only the quotient is returned. if size is 1, this ?ld also speci?s the data register that contains the high-order 32 bits of the dividend. note overflow occurs if the quotient is larger than a 32-bit signed integer. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 0 0 0 1 mode register 0 register dq 1 size 0 0 0 0 0 0 0 register dr addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-72 reference manual eor exclusive or eor operation: source ? destination ? destination assembler syntax: eor dn, ea ? attributes: size = (byte, word, long) description: performs an exclusive or operation on the destination operand using the source operand and stores the result in the destination location. the source operand must be a data register. the destination operand is speci?d in the effective address ?ld. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: register ?ld ?speci?s any of the eight data registers. opmode ?ld: xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 1 1 register opmode mode register byte word long operation 000 001 010 ( ea ?) ? ( dn ?) ? ea ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-73 eor exclusive or eor effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: note memory to data register operations are not allowed. most assem- blers use eori when the source is immediate data. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-74 reference manual eori exclusive or immediate eori operation: immediate data ? destination ? destination assembler syntax: eori # data ? , ea ? attributes: size = (byte, word, long) description: performs an exclusive or operation on the destination operand using the immediate data and the destination operand and stores the result in the destination location. the size of the immediate data must match the operation size. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 1 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-75 eori exclusive or immediate eori effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: immediate ?ld ?(data immediately following the instruction): if size = 00, the data is the low-order byte of the immediate word. if size = 01, the data is the entire immediate word. if size = 10, the data is next two immediate words. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-76 reference manual eori exclusive or immediate eori to ccr to condition code register to ccr operation: source ? ccr ? ccr assembler syntax: eori # data ? , ccr attributes: size = (byte) description: performs an exclusive or operation on the condition code register using the immediate operand, and stores the result in the condition code register (low-order byte of the status register). all implemented bits of the condition code reg- ister are affected. condition codes: x changed if bit 4 of immediate operand is one. unchanged otherwise. n changed if bit 3 of immediate operand is one. unchanged otherwise. z changed if bit 2 of immediate operand is one. unchanged otherwise. v changed if bit 1 of immediate operand is one. unchanged otherwise. c changed if bit 0 of immediate operand is one. unchanged otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 1 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 byte data (8 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-77 eori exclusive or immediate to status register eori to sr (privileged instruction) to sr operation: if supervisor state then source ? sr ? sr else trap assembler syntax: eori # data ? , sr attributes: size = (word) description: performs an exclusive or operation on the contents of the status register using the immediate operand, and stores the result in the status register. all implemented bits of the status register are affected. condition codes: x changed if bit 4 of immediate operand is one. unchanged otherwise. n changed if bit 3 of immediate operand is one. unchanged otherwise. z changed if bit 2 of immediate operand is one. unchanged otherwise. v changed if bit 1 of immediate operand is one. unchanged otherwise. c changed if bit 0 of immediate operand is one. unchanged otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 1 0 1 0 0 1 1 1 1 1 0 0 word data (16 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-78 reference manual exg exchange registers exg operation: rx ? ry assembler: exg dx, dy syntax: exg ax, ay exg dx, ay exg ay, dx attributes: size = (long) description: exchanges the contents of two 32-bit registers. the instruction per- forms three types of exchanges: 1. exchange data registers. 2. exchange address registers. 3. exchange a data register and an address register. condition codes: not affected. instruction format: instruction fields: register rx ?ld ?speci?s either a data register or an address register depending on the mode. if the exchange is between data and address registers, this ?ld always speci?s the data register. opmode ?ld ?speci?s the type of exchange: 01000 ?data registers. 01001 ?address registers. 10001 ?data register and address register. register ry ?ld ?speci?s either a data register or an address register depending on the mode. if the exchange is between data and address registers, this ?ld always speci?s the address register. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 0 register rx 1 opmode register ry f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-79 ext sign extend ext extb extb operation: destination sign-extended ? destination assembler syntax: ext.w dnextend byte to word ext.l dnextend word to long word extb.l dnextend byte to long word attributes: size = (word, long) description: extends a byte in a data register to a word or a long word, or a word in a data register to a long word, by replicating the sign bit to the left. if the operation extends a byte to a word, bit [7] of the designated data register is copied to bits [15:8] of that data register. if the operation extends a word to a long word, bit [15] of the des- ignated data register is copied to bits [31:16] of the data register. the extb form cop- ies bit [7] of the designated register to bits [31:8] of the data register. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: opmode ?ld ?speci?s the size of the sign-extension operation: 010 ?sign-extend low-order byte of data register to word. 011 ?sign-extend low-order word of data register to long. 111 ?sign-extend low-order byte of data register to long. register ?ld ?speci?s the data register is to be sign-extended. xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 opmode 0 0 0 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-80 reference manual illegal take illegal instruction trap illegal operation: ssp ?2 ? ssp; vector offset ? (ssp); ssp ?4 ? ssp; pc ? (ssp); ssp ?2 ? ssp; sr ? (ssp); illegal instruction vector address ? pc assembler syntax: illegal attributes: unsized description: forces an illegal instruction exception, vector number 4. all other illegal instruction bit patterns are reserved for future extension of the instruction set and should not be used to force an exception. condition codes: not affected instruction format: 1514131211109876543210 0100101011111100 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-81 jmp jump jmp operation: destination address ? pc assembler syntax: jmp ea ? attributes: unsized description: program execution continues at the effective address speci?d by the instruction. the addressing mode for the effective address must be a control addressing mode. condition codes: not affected. instruction format: instruction fields: effective address ?ld ?speci?s the address of the next instruction. only control addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 1 0 1 1 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-82 reference manual jsr jump to subroutine jsr operation: sp ?4 ? sp; pc ? (sp) destination address ? pc assembler syntax: jsr ea ? attributes: unsized description: pushes the long word address of the instruction immediately follow- ing the jsr instruction onto the system stack. program execution then continues at the address speci?d by the instruction. condition codes: not affected. instruction format: instruction fields: effective address ?ld ?speci?s the address of the next instruction. only control addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 1 0 1 0 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-83 lea load effective address lea operation: ea ? ? an assembler syntax: lea ea ? , an attributes: size = (long) description: loads the effective address into the speci?d address register. all 32 bits of the address register are affected by this instruction. condition codes: not affected. instruction format: instruction fields: register ?ld ?speci?s the address register to be updated with the effective address. effective address ?ld ?speci?s the address to be loaded into the address regis- ter. only control addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 register 1 1 1 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-84 reference manual link link and allocate link operation: sp ?4 ? sp; an ? (sp); sp ? an; sp + d ? sp assembler syntax: link an, # displacement ? attributes: size = (word, long) description: pushes the contents of the speci?d address register onto the stack, then loads the updated stack pointer into the address register. finally, adds the dis- placement value to the stack pointer. for word size operation, the displacement is the sign-extended word following the operation word. for long size operation, the dis- placement is the long word following the operation word. the address register occu- pies one long word on the stack. the user should specify a negative displacement to allocate stack area. condition codes: not affected. instruction format: instruction fields: register ?ld ?speci?s the address register for the link. displacement ?ld ?speci?s the twos complement integer to be added to the stack pointer. note link and unlk can be used to maintain a linked list of local data and parameter areas on the stack for nested subroutine calls. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 register word displacement 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 register high-order displacement low-order displacement f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-85 lpstop low power stop lpstop operation: if supervisor state then immediate data ? sr interrupt mask ? external bus interface (ebi) stop else trap assembler syntax: lpstop # data ? attributes: size = (word) privileged description: the immediate operand is moved into the entire status register, the program counter is advanced to point to the next instruction, and the processor stops fetching and executing instructions. a cpu lpstop broadcast cycle is executed to cpu space $3 to copy the updated interrupt mask to the external bus interface (ebi). the internal clocks are stopped. execution of instructions resumes when a trace, interrupt, or reset exception occurs. a trace exception occurs if the trace state is on when the lpstop instruc- tion is executed. if an interrupt request is asserted with a higher priority that the current priority level set by the new status register value, an interrupt exception occurs; otherwise the interrupt request is ignored. if the bit of the immediate data corresponding to the s bit is off, execution of the instruction causes a privilege vio- lation. an external reset always initiates reset exception processing. condition codes: set according to the immediate operand. instruction format: instruction fields: immediate ?ld ?speci?s the data to be loaded into the status register. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 immediate data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-86 reference manual lsl, lsr logical shift lsl, lsr operation: destination shifted by count ? ? destination assembler lsd dx, dy syntax: lsd # data ?, dy lsd ea ? where d is direction, l or r attributes: size = (byte, word, long) description: shifts the bits of the operand in the direction speci?d (l or r). the carry bit receives the last bit shifted out of the operand. shift count can be speci?d in one of two ways: 1. immediate ?the shift count (1?) is speci?d by the instruction. 2. register ?the shift count is the value in the data register speci?d by the instruction, modulo 64. the size of the operation for register destinations may be specified as byte, word, or long. the contents of memory, ea ? , can be shifted one bit only, and the operand size is restricted to a word. the lsl instruction shifts the operand to the left the number of positions specified as the shift count. bits shifted out of the high-order bit go to both the carry and the extend bits; zeros are shifted into the low-order bits. the lsr instruction shifts the operand to the right the number of positions specified as the shift count. bits shifted out of the low-order bit go to both the carry and the ex- tend bits; zeros are shifted into the high-order bits. x/c 0 lsl x/c 0 lsr f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-87 lsl, lsr logical shift lsl, lsr condition codes: x set according to the last bit shifted out of the operand. unaffected for a shift count of zero. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c set according to the last bit shifted out of the operand. cleared for a shift count of zero. instruction format (register shifts): instruction fields (register shifts): count/register ?ld ?speci?s shift count or register that contains shift count: if i/r = 0, this ?ld contains the shift count. the values one to seven represent counts of one to seven; value of zero represents a count of eight. if i/r = 1, this ?ld speci?s the data register that contains the shift count (mod- ulo 64). dr ?ld ?speci?s the direction of the shift: 0 ?shift right 1 ?shift left size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation i/r ?ld: if i/r = 0, speci?s immediate shift count. if i/r = 1, speci?s register shift count. register ?ld ?speci?s a data register to be shifted. xnzvc ***0* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 0 1 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-88 reference manual lsl, lsr logical shift lsl, lsr instruction format (memory shifts): instruction fields (memory shifts): dr ?ld ?speci?s the direction of the shift: 0 ?shift right 1 ?shift left effective address ?ld ?speci?s the operand to be shifted. only memory alterable addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 0 1 dr 1 1 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-89 move move data from source to destination move operation: source ? destination assembler syntax: move ea ? , ea ? attributes: size = (byte, word, long) description: moves the data at the source to the destination location, and sets the condition codes according to the data. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: size ?ld ?speci?s the size of the operand to be moved: 01 ?byte operation 11 ?word operation 10 ?long operation xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 destination effective address 0 0 size register mode mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-90 reference manual move move data from source to destination move destination effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: source effective address ?ld ?speci?s the source operand. all addressing modes are allowed as shown: *for byte size operation, address register direct is not allowed. notes: 1. most assemblers use movea when the destination is an address register. 2. moveq can be used to move an immediate 8-bit value to a data register. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an* 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-91 movea move address movea operation: source ? destination assembler syntax: movea ea ? , an attributes: size = (word, long) description: moves the contents of the source to the destination address register. the size of the operation is speci?d as word or long. word size source operands are sign-extended to 32-bit quantities. condition codes: not affected. instruction format: instruction fields: size ?ld ?speci?s the size of the operand to be moved: 11 ?word operation. the source operand is sign-extended to a long operand and all 32 bits are loaded into the address register. 10 ?long operation. destination register (dst-reg) ?ld ?speci?s the destination address register. effective address ?ld ?speci?s the location of the source operand. all addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 size dst?eg 0 0 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-92 reference manual move move from the move from ccr condition code register from ccr operation: ccr ? destination assembler syntax: move ccr, ea ? attributes: size = (word) description: moves the condition code bits (zero extended to word size) to the destination location. unimplemented bits are read as zeros. condition codes: not affected. instruction format: instruction fields: effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: note move from ccr is a word operation. andi, ori, and eori to ccr are byte operations. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 1 0 1 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-93 move move to condition code register move to ccr to ccr operation: source ? ccr assembler syntax: move ea ? , ccr attributes: size = (word) description: moves the low-order byte of the source operand to the condition code register. the upper byte of the source operand is ignored; the upper byte of the status register is not altered. condition codes: x set to the value of bit 4 of the source operand. n set to the value of bit 3 of the source operand. z set to the value of bit 2 of the source operand. v set to the value of bit 1 of the source operand. c set to the value of bit 0 of the source operand. instruction format: x n z v c * * * * * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 1 0 0 1 1 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-94 reference manual move move to condition code register move to ccr to ccr instruction fields: effective address ?ld ?speci?s the destination location. only data addressing modes are allowed as shown: note move to ccr is a word operation. andi, ori, and eori to ccr are byte operations. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-95 move move from the status register move from sr (privileged instruction) from sr operation: if supervisor state then sr ? destination else trap assembler syntax: move sr, ea ? attributes: size = (word) description: moves the data in the status register to the destination location. the destination must be of word length. unimplemented bits are read as zeros. condition codes: not affected. instruction format: instruction fields: effective address ?ld ?speci?s the destination location. only data alterable addressing modes are allowed as shown: note use the move from ccr instruction to access only the condition codes. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 0 0 1 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-96 reference manual move move to the status register move to sr (privileged instruction) to sr operation: if supervisor state then source ? sr else trap assembler syntax: move ea ? , sr attributes: size = (word) description: moves the data in the source operand to the status register. the source operand is a word and all implemented bits of the status register are affected. condition codes: set according to the source operand. instruction format: instruction fields: effective address ?ld ?speci?s the destination location. only data addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 1 1 0 1 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-97 move move user stack pointer move usp (privileged instruction) usp operation: if supervisor state then usp ? an or an ? usp else trap assembler move usp, an syntax: move an, usp attributes: size = (long) description: moves the contents of the user stack pointer to or from the speci?d address register. condition codes: not affected. instruction format: instruction fields: dr ?ld ?speci?s the direction of transfer: 0 ?transfer the address register to the usp. 1 ?transfer the usp to the address register. register ?ld ?speci?s the address register for the operation. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 0 dr register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-98 reference manual movec move control register movec (privileged instruction) operation: if supervisor state then rc ? rn or rn ? rc else trap assembler movec rc, rn syntax: movec rn, rc attributes: size = (long) description: moves the contents of the speci?d control register (rc) to the spec- i?d general register (rn), or copies the contents of the speci?d general register to the speci?d control register. movec is always a 32-bit transfer even though the con- trol register may be implemented with fewer bits. unimplemented bits are read as zeros. condition codes: not affected. instruction format: instruction fields: dr ?ld ?speci?s the direction of the transfer: 0 ?control register to general register. 1 ?general register to control register. a/d ?ld ?speci?s the type of general register: 0 ?data register. 1 ?address register. register ?ld ?speci?s the register number. control register ?ld ?speci?s the control register. hex control register 000 source function code (sfc) 001 destination function code (dfc) 800 user stack pointer (usp) 801 vector base register (vbr) any other code causes an illegal instruction exception. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 1 0 1 dr a/d register control register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-99 movem move multiple registers movem operation: registers ? destination source ? registers assembler movem register list, ea ? syntax: movem ea ? , register list attributes: size = (word, long) description: moves the contents of selected registers to or from consecutive memory locations starting at the location speci?d by the effective address. a register is selected if the bit in the mask ?ld corresponding to that register is set. the instruc- tion size determines whether 16 or 32 bits of each register are transferred. in the case of a word transfer to either address or data registers, each word is sign- extended to 32 bits, and the resulting long word is loaded into the associated register. selecting the addressing mode also selects the mode of operation of the movem instruction, and only the control modes, the predecrement mode, and the postin- crement mode are valid. if the effective address is speci?d by one of the control modes, the registers are transferred starting at the speci?d address, and the address is incremented by the operand length (2 or 4) following each transfer. the order of the registers is from data register 0 to data register 7, then from address register 0 to address register 7. if the effective address is speci?d by the predecrement mode, only a register-to- memory operation is allowed. the registers are stored starting at the speci?d address minus the operand length (2 or 4), and the address is decremented by the operand length following each transfer. the order of storing is from address register 7 to address register 0, then from data register 7 to data register 0. when the instruction has completed, the decremented address register contains the address of the last operand stored. in the cpu 32, if the addressing register is also moved to memory, the value written is the decremented value. if the effective address is speci?d by the postincrement mode, only a memory-to- register operation is allowed. the registers are loaded starting at the speci?d address; the address is incremented by the operand length (2 or 4) following each transfer. the order of loading is the same as that of control mode addressing. when the instruction has completed, the incremented address register contains the address of the last operand loaded plus the operand length. in the cpu32, if the addressing register is also loaded from memory, the value loaded is the value fetched plus the operand length. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-100 reference manual movem move multiple registers movem condition codes: not affected. instruction format: instruction field: dr ?ld ?speci?s the direction of the transfer: 0 ?register to memory 1 ?memory to register size ?ld ?speci?s the size of the registers being transferred: 0 ?word transfer 1 ?long transfer effective address ?ld ?speci?s the memory address for the operation. for regis- ter-to-memory transfers, only control alterable addressing modes, or the pre- decrement addressing mode are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 dr 0 0 1 size mode register register list mask addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-101 movem move multiple registers movem for memory-to-register transfers, only control addressing modes or the postincre- ment addressing mode are allowed as shown: register list mask ?ld ?speci?s the registers to be transferred. the low-order bit corresponds to the ?st register to be transferred; the high-order bit corre- sponds to the last register to be transferred. thus, both for control modes and for the postincrement mode addresses, the mask correspondence is: for predecrement mode addresses, the mask correspondence is reversed: note an extra read bus cycle occurs for memory operands. this accesses an operand at one address higher than the last register image re- quired. addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 d0 d1 d2 d3 d4 d5 d6 d7 a0 a1 a2 a3 a4 a5 a6 a7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-102 reference manual movep move peripheral data movep operation: source ? destination assembler movep dx, (d, ay) syntax: movep (d, ay), dx attributes: size = (word, long) description: moves data between a data register and alternate bytes within the address space (typically assigned to a peripheral), starting at the location speci?d and incrementing by two. this instruction is designed for 8-bit peripherals on a 16-bit data bus. the high-order byte of the data register is transferred ?st and the low-order byte is transferred last. the memory address is speci?d by the address register indi- rect plus 16-bit displacement addressing mode. if the address is even, all the trans- fers are to or from the high-order half of the data bus; if the address is odd, all the transfers are to or from the low-order half of the data bus. the instruction also accesses alternate bytes on an 8- or 32-bit bus. example: long transfer to/from an even address. byte organization in register byte organization in memory (low address at top) 31 24 23 16 15 8 7 0 high order mid-upper mid-lower low order 158 7 0 high order mid-upper mid-lower low order f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-103 movep move peripheral data movep example: word transfer to/from an odd address byte organization in register byte organization in memory (low address at top) condition codes: not affected. instruction format: instruction fields: data register ?ld ?speci?s the data register for the instruction. opmode ?ld ?speci?s the direction and size of the operation: 100 ?transfer word from memory to register. 101 ?transfer long from memory to register. 110 ?transfer word from register to memory. 111 ?transfer long from register to memory. address register ?ld ?speci?s the address register which is used in the address register indirect plus displacement addressing mode. displacement ?ld ?speci?s the displacement used in the operand address. 31 24 23 16 15 8 7 0 high order low order 158 7 0 high order low order 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 data register opmode 0 0 1 addr register displacement (16 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-104 reference manual moveq move quick moveq operation: immediate data ? destination assembler syntax: moveq # data ? , dn attributes: size = (long) description: moves a byte of immediate data to a 32-bit data register. the data in an 8-bit ?ld within the operation word is sign-extended to a long operand in the data register as it is transferred. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: register ?ld ?speci?s the data register to be loaded. data ?ld ?eight bits of data, which are sign-extended to a long operand. xnzvc **00 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 1 register 0 data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-105 moves move address space moves (privileged instruction) operation: if supervisor state then rn ? destination [dfc] or source [sfc] ? rn else trap assembler: moves rn, ea ? syntax: moves ea ? , rn attributes: size = (byte, word, long) description: moves the byte, word, or long operand from the speci?d general register to a location within the address space speci?d by the destination function code (dfc) register; or moves the byte, word, or long operand from a location within the address space speci?d by the source function code (sfc) register to the speci- ?d general register. if the destination is a data register, the source operand replaces the correspond- ing low-order bits of the data register, depending on the size of the operation. if the destination is an address register, the source operand is sign-extended to 32 bits and then loaded into the address register. condition codes: not affected. instruction format: instruction fields: size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 1 1 0 size mode register a/d register dr 0 0 0 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-106 reference manual moves move address space moves (privileged instruction) effective address ?ld ?speci?s the source or destination location within the alter- nate address space. only memory alterable addressing modes are allowed as shown: a/d ?ld ?speci?s the type of general register: 0 ?data register 1 ?address register register ?ld ?speci?s the register number. dr ?ld ?speci?s the direction of the transfer: 0 ?from ea ? to general register 1 ?from general register to ea ? note for either of the two following examples, which use the same ad- dress register as both source and destination, the value stored is un- defined. the current implementations of the mc68010, cpu32, and mc68020 store the incremented or decremented value of an. moves.x an, (an)+ moves.x an, ?an) addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-107 muls signed multiply muls operation: source * destination ? destination assembler syntax: muls.w ea ? , dn16x16 ? 32 muls.l ea ? , dl 32x32 ? 32 muls.l ea ? , dh:dl32 x 32 ? 64 attributes: size = (word, long) description:: multiplies two signed operands yielding a signed result. in the word form, the multiplier and multiplicand are both word operands, and the result is a long word operand. a register operand is the low-order word; the upper word of the register is ignored. all 32 bits of the product are saved in the destina- tion data register. in the long form, the multiplier and multiplicand are both long word operands, and the result is either a long word or a quad word. the long word result is the low- order 32 bits of the quad word result; the high-order 32 bits of the product are dis- carded. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if over?w. cleared otherwise. c always cleared. note overflow (v = 1) can occur only when multiplying 32-bit operands to yield a 32-bit result. overflow occurs if the high-order 32 bits of the quad word product are not the sign extension of the low-order 32 bits. xnzvc ***0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-108 reference manual muls signed multiply muls instruction format (word form): instruction fields: register ?ld ?speci?s a data register as the destination. effective address ?ld ?speci?s the source operand. only data addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register 1 1 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-109 muls signed multiply muls instruction format (long form): instruction fields: effective address ?ld ?speci?s the source operand. only data addressing modes are allowed as shown: register dl ?ld ?speci?s a data register for the destination operand. the 32-bit multiplicand comes from this register, and the low-order 32 bits of the product are loaded into this register. size ?ld ?selects a 32- or 64-bit product. 0 ?32-bit product to be returned to register dl. 1 ?64-bit product to be returned to dh:dl. register dh ?ld ?if size is 1, speci?s the data register into which the high-order 32 bits of the product are loaded. if dh = dl and size is 1, the results of the operation are unde?ed. this ?ld is unused, otherwise. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 0 0 0 0 mode register 0 register dl 1 size 0 0 0 0 0 0 0 register dh addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-110 reference manual mulu unsigned multiply mulu operation: source * destination ? destination assembler syntax: mulu.w ea ? , dn16x16 ? 32 mulu.l ea ? , dl32x32 ? 32 mulu.l ea ? , dh:dl32x32 ? 64 attributes: size = (word, long) description: multiplies two unsigned operands yielding an unsigned result. in the word form, the multiplier and multiplicand are both word operands, and the result is a long word operand. a register operand is the low-order word; the upper word of the register is ignored. all 32 bits of the product are saved in the destina- tion data register. in the long form, the multiplier and multiplicand are both long word operands, and the result is either a long word or a quad word. the long word result is the low- order 32 bits of the quad word result; the high-order 32 bits of the product are dis- carded. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if over?w. cleared otherwise. c always cleared. note overflow (v=1) can occur only when multiplying 32-bit operands to yield a 32-bit result. overflow occurs if any of the high-order 32 bits of the quad word product are not equal to zero. xnzvc ***0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-111 mulu unsigned multiply mulu instruction format (word form): instruction fields: register ?ld ?peci?s a data register as the destination. effective address ?ld ?peci?s the source operand. only data addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register 0 1 1 mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-112 reference manual mulu unsigned multiply mulu instruction format (long form): instruction fields: effective address ?ld ?speci?s the source operand. only data addressing modes are allowed as shown: register dl ?ld ?speci?s a data register for the destination operand. the 32-bit multiplicand comes from this register, and the low-order 32 bits of the product are loaded into this register. size ?ld ?selects a 32- or 64-bit product. 0 ?32-bit product to be returned to register dl. 1 ?64-bit product to be returned to dh:dl. register dh ?ld ?if size is 1, speci?s the data register into which the high-order 32 bits of the product are loaded. if dh = dl and size is 1, the results of the operation are unde?ed. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 0 0 0 0 mode register 0 register dl 0 size 0 0 0 0 0 0 0 register dh addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-113 nbcd negate decimal with extend nbcd operation: 0 ?(destination 10 ) ?x ? destination assembler syntax: nbcd ea ? attributes: size = (byte) description: subtracts the destination operand and the extend bit from zero. the operation is performed using binary coded decimal arithmetic. the packed bcd result is saved in the destination location. this instruction produces the tens comple- ment of the destination if the extend bit is zero, or the nines complement if the extend bit is one. condition codes: x set the same as the carry bit. n unde?ed. z cleared if the result is non-zero. unchanged otherwise. v unde?ed. c set if a decimal borrow occurs. cleared otherwise. note normally the z condition code bit is set via programming before the start of the operation. this allows successful tests for zero results upon completion of multiple precision operations. instruction format: xnzvc *u*u* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 0 0 0 0 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-114 reference manual nbcd negate decimal with extend nbcd instruction fields: effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-115 neg negate neg operation: 0 ?(destination) ? destination assembler syntax: neg ea ? attributes: size = (byte, word, long) description: subtracts the destination operand from zero and stores the result in the destination location. condition codes: x set the same as the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w occurs. cleared otherwise. c cleared if the result is zero. set otherwise. instruction format: instruction fields: size ?ld ?speci?s the size of the operation. 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 1 0 0 size mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-116 reference manual neg negate neg effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-117 negx negate with extend negx operation: 0 ?(destination) ?x ? destination assembler syntax: negx ea ? attributes: size = (byte, word, long) description: subtracts the destination operand and the extend bit from zero. stores the result in the destination location. condition codes: x set the same as the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w occurs. cleared otherwise. c cleared if the result is zero. set otherwise. note normally, the z condition bit is set via programming before the start of the operation. this allows successful tests for zero results upon completion of multiple precision operations. instruction format: instruction fields: size ?ld ?speci?s the size of the operation. 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 0 0 size mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-118 reference manual negx negate with extend negx effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-119 nop no operation nop operation: none assembler syntax: nop attributes: unsized description: performs no operation. the program counter is incremented, but processor state is otherwise unaffected. execution continues with the instruction fol- lowing the nop instruction. the nop instruction does not begin execution until all pending bus cycles are completed. this synchronizes the pipeline, and prevents instruction overlap. condition codes: not affected. instruction format: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-120 reference manual not logical complement not operation: destination ? destination assembler syntax: not ea ? attributes: size = (byte, word, long) description: calculates the ones complement of the destination operand and stores the result in the destination location. condition codes: x not affected. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: size ?ld ?speci?s the size of the operation. 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 1 1 0 size mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-121 not logical complement not effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-122 reference manual or inclusive logical or or operation: source + destination ? destination assembler or ea ? , dn syntax: or dn, ea ? attributes: size = (byte, word, long) description: performs an inclusive or operation on the source operand and the destination operand and stores the result in the destination location. the contents of an address register may not be used as an operand. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: register ?ld ?speci?s any of the eight data registers. opmode ?ld: xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register opmode mode register byte word long operation 000 001 010 ( ea ?) + ( dn ?) ? dn 100 101 110 ( dn ?) + ( ea ?) ? ea f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-123 or inclusive logical or or effective address ?ld ?if the location speci?d is a source operand, only data addressing modes are allowed as shown: if the location speci?d is a destination operand, only memory alterable addressing modes are allowed as shown: notes: 1. if the destination is a data register, it must be specified using the destination dn mode, not the destination ea ? mode. 2. most assemblers use ori when the source is immediate data. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-124 reference manual ori inclusive or immediate ori operation: immediate data; destination ? destination assembler syntax: ori ? # data ? , ea ? attributes: size = (byte, word, long) description: performs an inclusive or operation on the immediate data and the destination operand and stores the result in the destination location. the size of the immediate data must match the operation size. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c always cleared instruction format: instruction fields: size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 0 0 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-125 ori inclusive or immediate ori effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: immediate ?ld ?(data immediately following the instruction): if size = 00, the data is the low-order byte of the immediate word. if size = 01, the data is the entire immediate word. if size = 10, the data is the next two immediate words. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-126 reference manual ori inclusive or immediate ori to ccr to condition code register to ccr operation: source; ccr ? ccr assembler syntax: ori # data ? , ccr attributes: size = (byte) description: performs an inclusive or operation on the immediate operand and the condition codes and stores the result in the condition code register (low-order byte of the status register). all implemented bits of the condition code register are affected. condition codes: x set if bit 4 of immediate operand is zero. unchanged otherwise. n set if bit 3 of immediate operand is zero. unchanged otherwise. z set if bit 2 of immediate operand is zero. unchanged otherwise. v set if bit 1 of immediate operand is zero. unchanged otherwise. c set if bit 0 of immediate operand is zero. unchanged otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 byte data (8 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-127 ori inclusive or immediate to status register ori to sr (privileged instruction) to sr operation: if supervisor state then source; sr ? sr else trap assembler syntax: ori # data ? , sr attributes: size = (word) description: performs an inclusive or operation of the immediate operand and the contents of the status register and stores the result in the status register. all implemented bits of the status register are affected. condition codes: x set if bit 4 of immediate operand is zero. unchanged otherwise. n set if bit 3 of immediate operand is zero. unchanged otherwise. z set if bit 2 of immediate operand is zero. unchanged otherwise. v set if bit 1 of immediate operand is zero. unchanged otherwise. c set if bit 0 of immediate operand is zero. unchanged otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 word data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-128 reference manual pea push effective address pea operation: sp ?4 ? sp; ea ? ? (sp) assembler syntax: pea ea ? attributes: size = (long) description: computes the effective address and pushes it onto the stack. the effective address must be a long word address. condition codes: not affected. instruction format: instruction fields: effective address ?ld ?speci?s the address to be pushed onto the stack. only control addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 0 0 0 1 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-129 reset reset external devices reset (privileged instruction) operation: if supervisor state then assert reset line else trap assembler syntax: reset attributes: unsized description: asserts the reset signal for 512 clock periods, resetting all exter- nal devices. the processor state, other than the program counter, is unaffected and execution continues with the next instruction. condition codes: not affected. instruction format: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-130 reference manual rol, ror rotate (without extend) rol, ror operation: destination rotated by count ? ? destination assembler rod dx, dy syntax: rod # data ? , dy rod ea ? where d is direction, l or r attributes: size = (byte, word, long) description: rotates the bits of the operand in the direction speci?d (l or r). the extend bit is not included in the rotation. for register rotation, the rotation count can be speci?d in either of two ways: 1. immediate ?the count (1-8) is specified by the instruction. 2. register ?the count is the value in the data register specified by the instruc- tion, modulo 64. the size of the operation for register destinations is specified as byte, word, or long. the contents of memory, ea ? ; can be rotated one bit only, and operand size is restrict- ed to a word. the rol instruction rotates the bits of the operand to the left; the rotate count deter- mines the number of bit positions rotated. bits rotated out of the high-order bit go to the carry bit and also back into the low-order bit. the ror instruction rotates the bits of the operand to the right; the rotate count deter- mines the number of bit positions rotated. bits rotated out of the low-order bit go to the carry bit and also back into the high-order bit. c rol c ror f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-131 rol, ror rotate (without extend) rol, ror condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c set according to the last bit rotated out of the operand. cleared when the rotate count is zero. instruction format (register rotate): instruction fields (register rotate): count/register ?ld: if i/r = 0, this ?ld contains the rotate count. the values 1? represent counts of 1?, and 0 speci?s a count of 8. if i/r = 1, this ?ld speci?s a data register that contains the rotate count (mod- ulo 64). dr ?ld ?speci?s the direction of the rotate: 0 ?rotate right 1 ?rotate left size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation i/r ?ld ?speci?s the rotate count location: if i/r = 0, immediate rotate count if i/r = 1, register rotate count register ?ld ?speci?s a data register to be rotated note byte swapping in the low order word of a data register is best done with ror/ror, w # 8 ? , dn. a special hardware assist has been pro- vided to minimize operation execution. xnzvc **0* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 1 1 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-132 reference manual rol, ror rotate (without extend) rol, ror instruction format (memory rotate): instruction fields (memory rotate): dr ?ld ?speci?s the direction of the rotate: 0 ?rotate right 1 ?rotate left effective address ?ld ?speci?s the operand to be rotated. only memory alterable addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 1 1 dr 1 1 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-133 roxl, roxr rotate with extend roxl, roxr operation: destination rotated with x by count ? ? destination assembler roxd dx, dy syntax: roxd # data ? , dy roxd ea ? where d is direction, l or r attributes: size = (byte, word, long) description: rotates the bits of the operand in the direction specified (l or r). the ex- tend bit is included in the rotation. for register rotation, the rotation count can be spec- ified in either of two ways: 1. immediate ?the count (1?) is specified by the instruction. 2. register ?the count is the value in the data register specified by the instruc- tion, modulo 64. the size of the operation for register destinations is specified as byte, word, or long. the contents of memory, ea ? , can be rotated one bit only, and operand size is restrict- ed to a word. the roxl instruction rotates the bits of the operand to the left; the rotate count deter- mines the number of bit positions rotated. bits rotated out of the high-order bit go to the carry bit and the extend bit; the previous value of the extend bit rotates into the low- order bit. the roxr instruction rotates the bits of the operand to the right; the rotate count de- termines the number of bit positions rotated. bits rotated out of the low-order bit go to the carry bit and the extend bit; the previous value of the extend bit rotates into the high-order bit. c x roxl c x roxr f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-134 reference manual roxl, roxr rotate with extend roxl, roxr condition codes: x set to the value of the last bit rotated out of the operand. unaffected when count is zero. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v always cleared. c set according to the last bit rotated out of the operand. set to the value of the extend bit when count is zero. instruction format (register rotate): instruction fields (register rotate): count/register ?ld: if i/r = 0, this ?ld contains the rotate count. the values 1? represent counts of 1?, and 0 speci?s a count of 8. if i/r = 1, this ?ld speci?s a data register that contains the rotate count (mod- ulo 64). dr ?ld ?speci?s the direction of the rotate: 0 ?rotate right 1 ?rotate left size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation i/r ?ld ?speci?s the rotate count location: if i/r = 0, immediate rotate count if i/r = 1, register rotate count register ?ld ?speci?s a data register to be rotated xnzvc ***0* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 1 0 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-135 roxl, roxr rotate with extend roxl, roxr instruction format (memory rotate): instruction fields (memory rotate): dr ?ld ?speci?s the direction of the rotate: 0 ?rotate right 1 ?rotate left effective address ?ld ?speci?s the operand to be rotated. only memory alterable addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 1 0 dr 1 1 mode register addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-136 reference manual rtd return and deallocate rtd operation: (sp) ? pc; sp + 4 + d ? sp assembler syntax: rtd # displacement ? attributes: unsized description: pulls the program counter value from the stack and adds the sign- extended 16-bit displacement value to the stack pointer. the previous program counter value is lost. condition codes: not affected. instruction format: instruction field: displacement ?ld ?speci?s the twos complement integer to be sign extended and added to the stack pointer. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 displacement (16 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-137 rte return from exception rte (privileged instruction) operation: if supervisor state then (sp) ? sr; sp + 2 ? sp; (sp) ? pc; sp + 4 ? sp; restore state and de-allocate stack according to (sp) else trap assembler syntax: rte attributes: unsized description: loads the processor state information stored in the exception stack frame located at the top of the stack into the processor. the instruction examines the stack format ?ld in the format/offset word to determine how much information must be restored. condition codes: set according to the condition code bits in the status register value restored from the stack. instruction format: format/offset word (in stack frame): format field of format/offset word: contains the format code, which implies the stack frame size (including the format/off- set word). 0000 ?short format, removes four words. loads the status register and the program counter from the stack frame. 0001 ?throwaway format, removes four words. loads the status register from the stack frame and switches to the active system stack. continues the instruction using the active system stack. 0010 ?instruction error format, removes six words. loads the status register and the program counter from the stack frame and discards the other words. 1000 ?mc68010 long format. the mc68020 takes a format error exception. 1001 ?coprocessor mid-instruction format, removes 10 words. resumes execution of coprocessor instruction. 1010 ?mc68020 short format, removes 16 words and resumes instruction execution. 1011 ?mc68020 long format, removes 46 words and resumes instruction execution. any other value in this ?ld causes the processor to take a format error exception. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 format 0 0 vector offset f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-138 reference manual rtr return and restore condition codes rtr operation: (sp) ? ccr; sp + 2 ? sp; (sp) ? pc; sp + 4 ? sp assembler syntax: rtr attributes: unsized description: pulls the condition code and program counter values from the stack. the previous condition codes and program counter values are lost. the supervisor portion of the status register is unaffected. condition codes: set to the condition codes from the stack. instruction format: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 1 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-139 rts return from subroutine rts operation: (sp) ? pc; sp + 4 ? sp assembler syntax: rts attributes: unsized description: pulls the program counter value from the stack. the previous value is lost. condition codes: not affected. instruction format: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 0 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-140 reference manual sbcd subtract decimal with extend sbcd operation: destination 10 ?source 10 ?x ? destination assembler sbcd dx, dy syntax: sbcd ?ax), ?ay) attributes: size = (byte) description: subtracts the source operand and the extend bit from the destina- tion operand and stores the result in the destination location. the subtraction is per- formed using binary coded decimal arithmetic; the operands are packed bcd numbers. the instruction has two modes: 1. data register to data register: the data registers speci?d by the instruction contain the operands. 2. memory to memory: the address registers speci?d by the instruction access the operands from memory using the predecrement addressing mode. condition codes: x set the same as the carry bit. n unde?ed. z cleared if the result is nonzero. unchanged otherwise. v unde?ed. c set if a borrow (decimal) is generated. cleared otherwise. note normally the z condition code bit is set via programming before the start of an operation. this allows successful tests for zero results upon completion of multiple-precision operations. instruction format: instruction fields: register dy/ay ?ld ?speci?s the destination register. if r/m = 0, speci?s a data register. if r/m = 1, speci?s an address register for the predecrement addressing mode. r/m ?ld ?speci?s the operand addressing mode: 0 ?the operation is data register to data register. 1 ?the operation is memory to memory. register dx/ax ?ld ?speci?s the source register: if r/m = 0, speci?s a data register. if r/m = 1, speci?s an address register for the predecrement addressing mode. xnzvc *u*u* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 0 0 0 register ry 1 0 0 0 0 r/m register rx f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-141 scc set according to condition code scc operation: if condition true then set destination else clear destination assembler syntax: scc ea ? attributes: size = (byte) description: tests the speci?d condition code. if the condition is true, sets all bits in the byte speci?d to 1 (true). otherwise, clears all bits to 0 (false). condi- tion code cc speci?s one of the following conditions: condition codes: not affected. instruction format: cc name code description cc name code description cc carry clear 0100 c ls low or same 0011 c ; z cs carry set 0101 c lt less than 1101 n v ; n v eq equal 0111 z mi minus 1011 n f never equal 0001 0 n e not equal 0110 z ge greater or equal 1100 n v; n v pl plus 1010 n gt greater than 1110 n v z ; n v z t always true 0000 1 hi high 0010 c z v c overflow clear 1000 v le less or equal 1111 z; n v ; n v v s overflow set 1001 v 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 1 condition 1 1 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-142 reference manual scc set according to condition code scc instruction fields: condition ?ld ?the binary code for one of the conditions listed in the table. effective address ?ld ?speci?s the location in which the true/false byte is to be stored. only data alterable addressing modes are allowed as shown: note a subsequent neg.b instruction with the same effective address can be used to change the scc result from true or false to the equiv- alent arithmetic value (true = 1, false = 0). addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-143 stop load status register and stop stop (privileged instruction) operation: if supervisor state then immediate data ? sr; stop else trap assembler syntax: stop # data ? attributes: unsized description: moves the immediate operand into the status register (both user and supervisor portions), advances the program counter to point to the next instruction, and stops the fetching and executing of instructions. a trace, interrupt, or reset excep- tion causes the processor to resume instruction execution. a trace exception occurs if instruction tracing is enabled (t0 = 1, t1=0) when the stop instruction begins execu- tion. if an interrupt request is asserted with a priority higher than the priority level set by the new status register value, an interrupt exception occurs; otherwise, the inter- rupt request is ignored. external reset always initiates reset exception processing. condition codes: set according to the immediate operand. instruction format: instruction fields: immediate ?ld ?speci?s the data to be loaded into the status register. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 0 immediate data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-144 reference manual sub subtract sub operation: destination ?source ? destination assembler sub ea ? , dn syntax: sub dn, ea ? attributes: size = (byte, word, long) description: subtracts the source operand from the destination operand and stores the result in the destination. the mode of the instruction indicates which oper- and is the source, which is the destination, and which is the operand size. condition codes: x set to the value of the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w is generated. cleared otherwise. c set if a borrow is generated. cleared otherwise. instruction fields: register ?ld ?speci?s any of the eight data registers. opmode ?ld: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 1 register opmode mode register byte word long operation 000 001 010 ( ea ?) ( dn ?) ? dn ? 100 101 110 ( dn ?) ( ea ?) ? ea ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-145 sub subtract sub effective address ?ld ?determines the addressing mode. if the location speci?d is a source operand, all addressing modes are allowed as shown: *for byte size operation, address register direct is not allowed. if the location speci?d is a destination operand, only memory alterable addressing modes are allowed as shown: notes: 1. if the destination is a data register, it must be specified as a destination dn address, not as a destination ea ? address. 2. most assemblers use suba when the destination is an address register, and subi or subq when the source is immediate data. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an* 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-146 reference manual suba subtract address suba operation: destination ?source ? destination assembler syntax: suba ea ? , an attributes: size = (word, long) description: subtracts the source operand from the destination address register and stores the result in the address register. word size source operands are sign extended to 32-bit quantities prior to the subtraction. condition codes: not affected. instruction format: instruction fields: register ?ld ?speci?s the destination, any of the eight address registers. opmode ?ld ?speci?s the size of the operation: 011 ?word operation. the source operand is sign extended to a long oper- and and theoperation is performed on the address register using all 32 bits. 111 ?long operation. effective address ?ld ?speci?s the source operand. all addressing modes are allowed as shown: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 0 1 register opmode mode register addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-147 subi subtract immediate subi operation: destination ?immediate data ? destination assembler syntax: subi # data ? , ea ? attributes: size = (byte, word, long) description: subtracts the immediate data from the destination operand and stores the result in the destination location. the size of the immediate data must match the operation size. condition codes: x set to the value of the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w occurs. cleared otherwise. c set if a borrow occurs. cleared otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 1 0 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-148 reference manual subi subtract immediate subi instruction fields: size ?ld ?speci?s the size of the operation. 00 ?byte operation 01 ?word operation 10 ?long operation effective address ?ld ?speci?s the destination operand. only data alterable addressing modes are allowed as shown: immediate ?ld ?(data immediately following the instruction) if size = 00, the data is the low-order byte of the immediate word. if size = 01, the data is the entire immediate word. if size = 10, the data is the next two immediate words. addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-149 subq subtract quick subq operation: destination ?immediate data ? destination assembler syntax: subq # data ? , ea ? attributes: size = (byte, word, long) description: subtracts the immediate data (1?) from the destination operand. only word and long operations are allowed with address registers, and the condition codes are not affected. when subtracting from address registers, the entire destina- tion address register is used, regardless of the operation size. condition codes: x set to the value of the carry bit. n set if the result is negative. cleared otherwise. z set if the result is zero. cleared otherwise. v set if an over?w occurs. cleared otherwise. c set if a borrow occurs. cleared otherwise. instruction format: xnzvc ***** 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 1 data 1 size mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-150 reference manual subq subtract quick subq instruction fields: data ?ld ?three bits of immediate data; 1? represent immediate values of 1?, and 0 represents 8. size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation effective address ?ld ?speci?s the destination location. only alterable address- ing modes are allowed as shown: *word and long only addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an* (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-151 subx subtract with extend subx operation: destination ?source ?x ? destination assembler subx dx, dy syntax: subx ?ax), ?ay) attributes: size = (byte, word, long) description: subtracts the source operand and the extend bit from the destination operand and stores the result in the destination location. the instruction has two modes: 1. register to register: data registers specified by the instruction contain the op- erands. 2. memory to memory: address registers specified by the instruction access op- erands from memory using predecrement addressing mode. condition codes: x set to the value of the carry bit. n set if the result is negative. cleared otherwise. z cleared if the result is nonzero. unchanged otherwise. v set if an over?w occurs. cleared otherwise. c set if a carry occurs. cleared otherwise. note normally the z condition code bit is set via programming before the start of an operation. this allows successful tests for zero results upon completion of multiple-precision operations. xnzvc ***** f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-152 reference manual subx subtract with extend subx instruction format: instruction fields: register dy/ay ?ld ?speci?s the destination register: if r/m = 0, speci?s a data register. if r/m = 1, speci?s an address register for the predecrement addressing mode. size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation r/m ?ld ?speci?s the operand addressing mode: 0 ?the operation is data register to data register. 1 ?the operation is memory to memory. register dx/ax ?ld ?speci?s the source register: if r/m = 0, speci?s a data register. if r/m = 1, speci?s an address register for the predecrement addressing mode. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 0 0 1 register rx 1 size 0 0 r/m register ry f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-153 swap swap register halves swap operation: register [31:16] ? register [15:0] assembler syntax: swap dn attributes: size = (word) description: exchange the 16-bit words (halves) of a data register. condition codes: x not affected. n set if the most signi?ant bit of the 32-bit result is set. cleared otherwise. z set if the 32-bit result is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: register ?ld ?speci?s the data register to swap. xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-154 reference manual tbls table lookup and interpolate (signed) tbls tblsn tblsn operation: rounded: entry (n) + {(entry (n + 1) ?entry (n) ) * dx [7:0]} / 256 ? dx unrounded: entry (n) * 256 + {(entry (n + 1) ?entry (n) ) * dx [7:0]} ? dx where entry (n) and entry (n + 1) are either: 1. consecutive entries in the table pointed to by the ea ? and indexed by dx [15:8] * size or, 2. the registers dym, dyn, respectively assembler syntax: tbls. size ? ea ? ,dx(result rounded) tblsn. size ? ea ? ,dx(result not rounded) tbls. size ? dym:dyn,dx(result rounded) tblsn. size ? dym:dyn, dx(result not rounded) attributes: size = (byte, word, long) description: the signed table lookup and interpolate instruction, tbls, allows the ef?ient use of compressed linear data tables to model complex functions. the tbls instruction has two modes of operation: table lookup and interpolate mode, and data register interpolate mode. for table lookup and interpolate mode, data register dx [15:0] contains the indepen- dent variable x. the effective address points to the start of a signed byte, word, or long-word table containing a linear representation of the dependent variable, y, as a function of x. in general, the independent variable, located in the low-order word of dx, consists of an 8-bit integer part and an 8-bit fractional part. an assumed radix point is located between bits 7 and 8. the integer part, dx [15:8], is scaled by the operand size and is used as an offset into the table. the selected entry in the table is subtracted from the next consecutive entry. a fractional portion of this difference is taken by mul- tiplying by the interpolation fraction, dx [7:0]. the adjusted difference is then added to the selected table entry. the result is returned in the destination data register, dx. for register interpolate mode, the interpolation occurs using the dym and dyn regis- ters in place of the two table entries. for this mode, only the fractional portion, dx [7:0], is used in the interpolation, and the integer portion, dx [15:8], is ignored. the register interpolation mode may be used with several table lookup and interpolations to model multidimensional functions. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-155 tbls table lookup and interpolate (signed) tbls tblsn tblsn signed table entries range from ? n? to 2 n? ?1, where n is 8, 16, or 32 for byte, word, and long-word tables, respectively. rounding of the result is optionally selected via the ??instruction field. if r = 0 (tbls), the fractional portion is rounded according to the round-to-nearest algorithm. the rounding procedure can be summarized by the following table. the adjusted difference is then added to the selected table entry. the rounded result is returned in the destination data register, dx. only the portion of the register corre- sponding to the selected size is affected. if r =1 (tblsn), the result is returned in register dx without rounding. if the size is byte, the integer portion of the result is returned in dx [15:8]. the integer portion of a word result is stored in dx [23:8]. the least significant 24 bits of a long result are stored in dx [31:8]. byte and word results are sign extended to fill the entire 32-bit register. note a long-word result contains only the least significant 24 bits of integer precision. adjusted difference fraction rounding adjustment n ? ? < n < +0 n 3 +1 31 24 23 16 15 8 7 0 byte unaffected unaffected unaffected result word unaffected unaffected result result long result result result result 31 24 23 16 15 8 7 0 byte sign extended sign extended result fraction word sign extended result result fraction long result result result fraction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-156 reference manual tbls table lookup and interpolate (signed) tbls tblsn tblsn for all sizes, the 8-bit fractional portion of the result is returned in the low byte of the data register, dx [7:0]. user software can make use of the fractional data to reduce cumulative errors in lengthy calculations or implement rounding algorithms different from those provided by other forms of tbls. the assumed radix point described pre- viously places two restrictions on the programmer: 1. tables are limited to 257 entries in length. 2. interpolation resolution is limited to 1/256 the distance between consecutive table entries. the assumed radix point should not, however, be construed by the programmer as a requirement that the independent variable be calcu- lated as a fractional number in the range 0 x 255. on the contrary, x should be considered an integer in the range 0 x 65535, realizing that the table is actually a compressed linear representation of a function in which only every 256th value is actually stored in memory. see 4.6 table lookup and interpolation instructions for more information on the tbls/tblsn instruction. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v set if the integer portion of an unrounded long result is not in the range, ?(2 23 ) result (2 23 ) ?1. cleared otherwise. c always cleared. instruction format: table lookup and interpolate: xnzvc ***0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 1 1 0 0 0 0 0 mode register 0 register dx 1 r 0 1 size 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-157 tbls table lookup and interpolate (signed) tbls tblsn tblsn data register interpolate: instruction fields: effective address ?ld (table lookup and interpolate mode only: speci?s the source location. only control addressing modes are allowed as shown: size ?ld: speci?s the size of operation. 00 ?byte operation 01 ?word operation 10 ?long operation register ?ld: speci?s the destination data register, dx. on entry, the register contains the interpolation fraction and entry number. dym, dyn ?ld: if the effective address mode ?ld is nonzero, this operand register is unused and should be zero. if the effective address mode ?ld is zero, the surface interpolation variant of this instruction is implied, and dyn speci?s one of the two source operands. rounding mode ?ld: the ? bit controls rounding of the ?al result. when r = 0, the result is rounded according to the round-to-nearest algorithm. when r = 1, the result is returned unrounded. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 register dym 0 register dx 1 r 0 0 size 0 0 0 register dyn addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-158 reference manual tblu table lookup and interpolate (unsigned) tblu tblun tblun operation: rounded: entry (n) + {(entry (n + 1) ?entry (n) ) * dx [7:0]} / 256 ? dx unrounded: entry (n) * 256 + {(entry (n + 1) ?entry (n) ) * dx [7:0]} ? dx where entry (n) and entry (n + 1) are either: 1. consecutive entries in the table pointed to by the ea ? and indexed by dx [15:8] * size or, 2. the registers dym, dyn respectively assembler syntax: tblu. size ? ea ? ,dx(result rounded) tblun. size ? ea ? ,dx(result not rounded) tblu. size ? dym:dyn,dx(result rounded) tblun. size ? dym:dyn, dx(result not rounded) attributes: size = (byte, word, long) description: the signed table lookup and interpolate instruction, tblu, allows the ef?ient use of compressed linear data tables to model complex functions. the tblu instruction has two modes of operation: table lookup and interpolate mode, and data register interpolate mode. for table lookup and interpolate mode, data register dx [15:0] contains the indepen- dent variable x. the effective address points to the start of a signed byte, word, or long-word table containing a linear representation of the dependent variable, y, as a function of x. in general, the independent variable, located in the low-order word of dx, consists of an 8-bit integer part and an 8-bit fractional part. an assumed radix point is located between bits 7 and 8. the integer part, dx [15:8], is scaled by the operand size and is used as an offset into the table. the selected entry in the table is subtracted from the next consecutive entry. a fractional portion of this difference is taken by mul- tiplying by the interpolation fraction, dx [7:0]. the adjusted difference is then added to the selected table entry. the result is returned in the destination data register, dx. for register interpolate mode, the interpolation occurs using the dym and dyn regis- ters in place of the two table entries. for this mode, only the fractional portion, dx [7:0], is used in the interpolation, and the integer portion, dx [15:8], is ignored. the register interpolation mode may be used with several table lookup and interpolations to model multidimensional functions. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-159 tblu table lookup and interpolate (unsigned) tblu tblun tblun unsigned table entries range from 0 to 2 n? where n is 8, 16, or 32 for byte, word, and long-word tables, respectively. unsigned and unrounded table results are zero extend- ed. rounding of the result is optionally selected via the ??instruction field. if r = 0 (tblu), the fractional portion is rounded according to the round-to-nearest algorithm. the rounding procedure can be summarized by the following table. the adjusted difference is then added to the selected table entry. the rounded result is returned in the destination data register, dx. only the portion of the register corre- sponding to the selected size is affected. if r = 1 (tablun), the result is returned in register dx without rounding. if the size is byte, the integer portion of the result is returned in dx (15:8). the integer portion of a word result is stored in dx (23:8). the least significant 24 bits of a long result are stored in dx (31:8). byte and word results are zero extended to fill the entire 32-bit register. note a long-word result contains only the least significant 24 bits of integer precision. adjusted difference fraction rounding adjustment n < +0 n 3 +1 31 24 23 16 15 8 7 0 byte unaffected unaffected unaffected result word unaffected unaffected result result long result result result result 31 24 23 16 15 8 7 0 byte zero extended zero extended result fraction word zero extended result result fraction long result result result fraction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-160 reference manual tblu table lookup and interpolate (unsigned) tblu tblun tblun for all sizes, the 8-bit fractional portion of the result is returned in the low byte of the data register, dx (7:0). user software can make use of the fractional data to re- duce cumulative errors in lengthy calculations or implement rounding algorithms different from those provided by other forms of tblu. the assumed radix point de- scribed previously places two restrictions on the programmer: 1. tables are limited to 257 entries in length. 2. interpolation resolution is limited to 1/256 the distance between consecutive ta- ble entries.the assumed radix point should not, however, be construed by the programmer as a requirement that the independent variable be calculated as a fractional number in the range 0 x 255. on the contrary, x should be con- sidered to be an integer in the range 0 x 65535, realizing that the table is actually a compressed linear representation of a function in which only every 256th value is actually stored in memory. see 4.6 table lookup and interpolation instructions for more information on the tblu/tblun instruction. condition codes: x not affected. n set if the most signi?ant bit of the result is set. cleared otherwise. z set if the result is zero. cleared otherwise. v set if the integer portion of an unrounded long result is not in the range,0 result (2 24 ) ?1. cleared otherwise. c always cleared. instruction format: table lookup and interpolate: xnzvc ***0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 1 1 0 0 0 0 0 mode register 0 register dx 0 r 0 1 size 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-161 tblu table lookup and interpolate (unsigned) tblu tblun tblun data register interpolate: instruction fields: effective address ?ld (table lookup and interpolate mode only): speci?s the source location. only control addressing modes are allowed as shown: size ?ld: speci?s the size of operation. 00 ?byte operation 01 ?word operation 10 ?long operation register ?ld: speci?s the destination data register, dx. on entry, the register contains the interpolation fraction and entry number. dym, dyn ?ld: if the effective address mode ?ld is nonzero, this operand register is unused and should be zero. if the effective address mode ?ld is zero, the surface interpolation variant of this instruction is implied, and dyn speci?s one of the two source operands. rounding mode ?ld: the ? bit controls rounding of the ?al result. when r = 0, the result is rounded according to the round-to-nearest algorithm. when r = 1, the result is returned unrounded. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 register dym 0 register dx 0 r 0 0 size 0 0 0 register dyn addressing mode mode register addressing mode mode register dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + ?(an) (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-162 reference manual tas test and set an operand tas operation: destination tested ? condition codes; 1 ? bit 7 of destination assembler syntax: tas ea ? attributes: size = (byte) description: tests and sets the byte operand addressed by the effective address ?ld. the instruction tests the current value of the operand and sets the n and z con- dition bits appropriately. tas also sets the high-order bit of the operand. the opera- tion uses a read-modify-write memory cycle that completes the operation without interruption. this instruction supports use of a ?g to coordinate several processors. condition codes: x not affected. n set if the most signi?ant bit of the operand is currently set. cleared otherwise. z set if the operand was zero. cleared otherwise. v always cleared. c always cleared. instruction format: xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 1 0 1 1 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-163 tas test and set an operand tas instruction fields: effective address ?ld ?speci?s the location of the tested oper- and. only data alterable addressing modes are allowed as shown: addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an (xxx).l 111 001 (an) 010 reg. number: an # data ? (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) (bd, an, xn) 110 reg. number: an (bd, pc, xn) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-164 reference manual trap trap trap operation: ssp ?2 ? ssp; format/offset ? (ssp); ssp ?4 ? ssp; pc ? (ssp); ssp ?2 ? ssp; sr ? (ssp); vector address ? pc assembler syntax: trap # vector ? attributes: unsized description: causes a trap # vector ? exception. a vector number is generated by adding the immediate vector operand to 32. the range of vector operand values is 0?, thus there are 16 possible vector numbers. condition codes: not affected. instruction format: instruction fields: vector ?ld ?speci?s the trap vector to be taken. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 0 0 vector f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-165 trapcc trap on condition trapcc operation: if cc then trap assembler trapcc syntax: trapcc.w # data ? trapcc.l # data ? attributes: unsized or size = (word, long) description: if the speci?d condition is true, causes a trapcc exception (vector number 7). the address of the next instruction word (current pc) is pushed onto the stack. if the condition is not true, the processor performs no operation and execution continues with the next instruction. the immediate data operand must be placed in the word(s) immediately following the operation word. it is available to the trap han- dler. condition code cc speci?s one of the following conditions. condition codes: not affected. instruction format: instruction fields: condition ?ld ?the binary code for one of the conditions listed in the table. opmode ?ld ?selects the instruction form. 010 ?instruction is followed by word-size operand. 011 ?instruction is followed by long-word-size operand. 100 ?instruction has no operand. cc name code description cc name code description cc carry clear 0100 c ls low or same 0011 c ; z cs carry set 0101 c lt less than 1101 n v ; n v eq equal 0111 z mi minus 1011 n f never equal 0001 0 n e not equal 0110 z ge greater or equal 1100 n v; n v pl plus 1010 n gt greater than 1110 n v z ; n v z t always true 0000 1 hi high 0010 c z v c overflow clear 1000 v le less or equal 1111 z; n v ; n v v s overflow set 1001 v 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 1 condition 1 1 1 1 1 opmode optional word or long word f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-166 reference manual trapv trap on over?w trapv operation: if v then trap assembler syntax: trapv attributes: unsized description: if the ccr over?w bit is set, there is a trapv exception (vector number 7). if the bit is not set, the processor performs no operation and execution continues with the next instruction. condition codes: not affected. instruction format: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 1 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-167 tst test an operand tst operation: destination tested ? condition codes assembler syntax: tst ea ? attributes: size = (byte, word, long) description: compares the operand with zero and sets condition codes accord- ing to the results of the test. condition codes: x not affected. n set if the operand is negative. cleared otherwise. z set if the operand is zero. cleared otherwise. v always cleared. c always cleared. instruction format: instruction fields: size ?ld ?speci?s the size of the operation: 00 ?byte operation 01 ?word operation 10 ?long operation xnzvc ? * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 1 0 size mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-168 reference manual tst test an operand tst effective address ?ld ?speci?s the destination operand. all addressing modes are allowed as shown: *word or long word operation only addressing mode mode register addressing mode mode register dn 000 reg. number: dn (xxx).w 111 000 an* 001 reg. number: an (xxx).l 111 001 (an) 010 reg. number: an # data ? 111 100 (an) + 011 reg. number: an ?(an) 100 reg. number: an (d 16 , an) 101 reg. number: an (d 16 , pc) 111 010 (d 8 , an, xn) 110 reg. number: an (d 8 , pc, xn) 111 011 (bd, an, xn) 110 reg. number: an (bd, pc, xn) 111 011 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-169 unlk unlink unlk operation: an ? sp; (sp) ? an; sp + 4 ? sp assembler syntax: unlk an attributes: unsized description: loads the stack pointer from the speci?d address register then loads the address register with a long word pulled from the top of the stack. condition codes: not affected. instruction format: instruction fields: register ?ld ?speci?s the address register for the instruction. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 1 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-170 reference manual 4.5 instruction format summary a summary of the primary words in each instruction of the instruction set follows. the complete instruction definition consists of the primary words followed by the address- ing mode operands such as immediate data fields, displacements, and index oper- ands. the four most significant bits of the first (or only) primary word provide a means of categorizing the instructions. table 4-11 is an operation code (opcode) map that lists an instruction category for each combination of these bits. table 4-11 operation code map bits [15:12] operation 0000 bit manipulation/movep/immediate 0001 move byte 0010 move long 0011 move word 0100 miscellaneous 0101 addq/subq/scc/dbcc/trapcc 0110 bcc/bsr/bra 0111 moveq 1000 or/div/sbcd 1001 sub/subx 1010 (unassigned, reserved) 1011 cmp/ eor 1100 and/mul/abcd/exg 1101 add/addx 1110 shift/rotate/bit field 1111 table lookup and interpolation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-171 ori 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 0 0 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) size field: 00 = byte 01 = word 10 = long ori to ccr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 byte data (8 bits) ori to sr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 word data cmp2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 size 0 1 1 mode register d/a register 0 0 0 0 0 0 0 0 0 0 0 0 size field: 00 = byte 01 = word 10 = long chk2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 size 0 1 1 mode register d/a register 1 0 0 0 0 0 0 0 0 0 0 0 size field: 00 = byte 01 = word 10 = long btst (dynamic) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 0 0 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-172 reference manual bchg (dynamic) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 0 1 mode register bclr (dynamic) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 1 0 mode register bset (dynamic) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 register 1 1 1 mode register movep 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 data register opmode 0 0 1 addr register displacement (16 bits) opmode field: 100 = transfer word from memory to register 101 = transfer long from memory to register 110 = transfer word from register to memory 111 = transfer word from register to memory andi 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 0 1 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) size field: 00 = byte 01 = word 10 = long andi to ccr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 byte data (8 bits) andi to sr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 0 0 word data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-173 subi 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 1 0 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) size field: 00 = byte 01 = word 10 = long addi 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 0 1 1 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) size field: 00 = byte 01 = word 10 = long btst (static) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 0 0 mode register 0 0 0 0 0 0 0 0 bit number bit number field: modulo 32-bit selection bchg (static) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 0 1 mode register 0 0 0 0 0 0 0 0 bit number bit number field: modulo 32-bit selection bclr (static) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 1 0 mode register 0 0 0 0 0 0 0 0 bit number bit number field: modulo 32-bit selection f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-174 reference manual bset (static) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 0 0 1 1 mode register 0 0 0 0 0 0 0 0 bit number bit number field: modulo 32-bit selection eori 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 0 1 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) size field: 00 = byte 01 = word 10 = long eori to ccr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 1 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 byte data (8 bits) eori to sr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 1 0 1 0 0 1 1 1 1 1 0 0 word data (16 bits) cmpi 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 1 0 0 size mode register word data (16 bits) byte data (8 bits) long data (32 bits) size field: 00 = byte 01 = word 10 = long moves 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 0 0 0 1 1 1 0 size mode register a/d register dr 0 0 0 0 0 0 0 0 0 0 0 dr field: 0 = ea to register 1 = register to ea f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-175 move 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 destination effective address 0 0 size register mode mode register size field: 00 = byte 01 = word 10 = long note register and mode locations. movea 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 destination effective address 0 0 size 0 0 1 register mode register size field: 00 = byte 01 = word 10 = long negx 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 0 0 size mode register size field: 00 = byte 01 = word 10 = long move from sr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 0 0 1 1 mode register chk 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 register size 0 mode register size field: 00 = byte 01 = word 10 = long lea 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 register 1 1 1 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-176 reference manual clr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 1 0 size mode register size field: 00 = byte 01 = word 10 = long move from ccr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 0 1 0 1 1 mode register neg 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 0 0 size mode register size field: 00 = byte 01 = word 10 = long move to ccr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 1 0 0 1 1 mode register not 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 1 1 0 size mode register size field: 00 = byte 01 = word 10 = long move to sr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 0 1 1 0 1 1 mode register nbcd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 0 0 0 0 mode register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-177 link long 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 register high-order displacement low-order displacement swap 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 register bkpt 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 vector pea 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 0 0 0 1 mode register size field: 00 = byte 01 = word 10 = long ext, extb 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 0 opmode 0 0 0 register opmode field: 010 = extend word 011 = extend long 111 = extend byte long movem 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 dr 0 0 1 size mode register register list mask size field: 00 = byte 01 = word 10 = long register to ea mask 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 ea to register mask 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 d0 d1 d2 d3 d4 d5 d6 d7 a0 a1 a2 a3 a4 a5 a6 a7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-178 reference manual tst 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 1 0 size mode register size field: 00 = byte 01 = word 10 = long tas 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 0 1 0 1 1 mode register bgnd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 1 0 1 1 1 1 1 0 1 0 illegal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1 0 0 mulu (long) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 0 0 0 0 mode register 0 register dl 0 size 0 0 0 0 0 0 0 register dh size field: 0 = long word product 1 = quad word product muls (long) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 0 0 0 1 mode register 0 register dq 1 size 0 0 0 0 0 0 0 register dr size field: 0 = long word product 1 = quad word product trap 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 0 0 vector f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-179 link (word) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 register word displacement unlk 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 0 1 1 register move usp 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 0 dr register dr field: 0 = move an to usp 1 = move usp to an reset 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 nop 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 1 stop 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 0 immediate data rte 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 format/offset word (in stack frame) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 format 0 0 vector offset format field: four bits imply frame size; only values 000?010 and 1000?011 are used. rtd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 displacement (16 bits) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-180 reference manual rts 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 0 1 trapv 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 1 0 rtr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 1 1 movec 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 0 1 1 1 1 0 1 dr a/d register control register dr field: 0 = control register to general register 1 = general register to control register control register field: $000 = sfc$801 = vbr $001 = dfc$802 = caar $002 = cacr$803 = msp $800 = usp$804 = isp jsr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 1 0 1 0 mode register jmp 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 0 1 1 1 0 1 1 mode register addq 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 1 data 0 size mode register data field: three bits of immediate data; 000?11 represent values of 1?; 000 represents 8 size field: 00 = byte 01 = word 10 = long f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-181 scc 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 1 condition 1 1 mode register dbcc 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 1 condition 1 1 0 0 1 register displacement trapcc 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 0 1 condition 1 1 1 1 1 opmode optional word or long word opmode field: 010 = word operand 011 = long operand 100 = no operand subq 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 0 1 0 1 data 1 size mode register data field: three bits of immediate data; 000?11 represent values of 1?; 000 represents 8 size field: 00 = byte 01 = word 10 = long bcc 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 0 condition 8-bit displacement 16-bit displacement if 8-bit displacement = $00 32-bit displacement if 8-bit displacement = $ff bra 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 0 0 0 0 0 8-bit displacement 16-bit displacement if 8-bit displacement = $00 32-bit displacement if 8-bit displacement = $ff bsr 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 0 0 0 0 1 8-bit displacement 16-bit displacement if 8-bit displacement = $00 32-bit displacement if 8-bit displacement = $ff f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-182 reference manual moveq 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 1 register 0 data data field: data is sign extended to a long operand, and all 32 bits are transferred to the data register. or 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register opmode mode register opmode field: byte word long operation 000 001 010 ( ea ? ); ( dn ? ) ? dn 100 101 110 ( dn ? ); ( ea ? ) ? ea divu 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 0 0 register 0 1 1 mode register divs 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 0 0 register 1 1 1 mode register sbcd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 0 0 0 register ry 1 0 0 0 0 r/m register rx r/m field: 0 = data register to data register 1 = memory to memory if r/m = 0, both registers must be data registers if r/m = 1, both registers must be address registers for predecrement addressing mode sub 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 1 register opmode mode register opmode field: byte word long operation 000 001 010 ( ea ? ) ( dn ? ) ? dn ? 100 101 110 ( dn ? ) ( ea ? ) ? ea ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-183 suba 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 0 1 register opmode mode register opmode field: word long operation 011 111 ( an ? ) ( ea ? ) ? dn ? subx 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 1 register rx 1 size 0 0 r/m register ry size field: 00 = byte 01 = word 10 = long r/m field: 0 = data register to data register 1 = memory to memory if r/m = 0, both registers must be data registers if r/m = 1, both registers must be address registers for predecrement addressing mode cmp 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 1 1 register opmode mode register opmode field: byte word long operation 000 001 010 ( dn ? ) ( ea ? ) ? ccr cmpa 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 1 1 register opmode mode register opmode field: word long operation 011 111 ( an ? ) ( ea ? ) ? ccr eor 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 0 1 1 register opmode mode register opmode field: byte word long operation 100 101 110 ( ea ? ) ? ( dn ? ) ? ea ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-184 reference manual cmpm 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 0 1 1 register ax 1 size 0 0 1 register ay size field: 00 = byte 01 = word 10 = long and 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register opmode mode register opmode field: byte word long operation 000 001 010 ( ea ? ) ( dn ? ) ? dn ? 100 101 110 ( dn ? ) ( ea ? ) ? ea ? mulu (word) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register 0 1 1 mode register muls (word) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 0 register 1 1 1 mode register abcd 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 0 register rx 1 0 0 0 0 r/m register ry r/m field: 0 = data register to data register 1 = memory to memory if r/m = 0, both registers must be data registers if r/m = 1, both registers must be address registers for predecrement addressing mode exg 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 0 register rx 1 opmode register ry opmode field: specifies type of exchange 01000 ?data register exchange 01001 ?address register exchange 10001 ?data register / address register (rx specifies data register, ry specifies address register) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-185 add 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 1 register opmode mode register opmode field: byte word long operation 000 001 010 ( ea ? ) + ( dn ? ) ? dn ? 100 101 110 ( dn ? ) + ( ea ? ) ? ea ? adda 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 0 1 register opmode mode register opmode field: word long operation 011 111 ( ea ? ) + ( an ? ) ? an ? addx 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 1 register rx 1 size 0 0 r/m register ry size field: 00 = byte 01 = word 10 = long r/m field: 0 = data register to data register 1 = memory to memory if r/m = 0, both registers must be data registers if r/m = 1, both registers must be address registers for predecrement addressing mode asl, asr (register) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 0 0 register count/register field: if i/r field = 0, specifies shift count if i/r field = 1, specifies data register that contains shift count dr field: 0 = right 1 = left size field: 00 = byte 01 = word 10 = long i/r field: 0 = immediate shift count 1 = register shift count f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-186 reference manual lsl, lsr (register) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 0 1 register count/register field: if i/r field = 0, specifies shift count if i/r field = 1, specifies data register that contains shift count dr field: 0 = right 1 = left size field: 00 = byte 01 = word 10 = long i/r field: 0 = immediate shift count 1 = register shift count roxl, roxr (register) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 1 0 register count/register field: if i/r field = 0, specifies shift count if i/r field = 1, specifies data register that contains shift count dr field: 0 = right 1 = left size field: 00 = byte 01 = word 10 = long i/r field: 0 = immediate shift count 1 = register shift count rol, ror 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 0 count/register dr size i/r 1 1 register count/register field: if i/r field = 0, specifies shift count if i/r field = 1, specifies data register that contains shift count dr field: 0 = right 1 = left size field: 00 = byte 01 = word 10 = long i/r field: 0 = immediate shift count 1 = register shift count asl, asr (memory) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 0 0 dr 1 1 mode register dr field: 0 = right 1 = left lsl, lsr (memory) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 0 1 dr 1 1 mode register dr field: 0 = right 1 = left f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-187 roxl, roxr (memory) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 1 0 dr 1 1 mode register dr field: 0 = right 1 = left rol, ror (memory) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 0 0 1 1 dr 1 1 mode register dr field: 0 = right 1 = left lpstop 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 immediate data tblu, tblun (data register interpolate) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 register dym register dx 0 r 0 0 size 0 0 0 register dyn r field: 0 = unrounded 1 = rounded tblu, tblun (lookup and interpolate) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 1 1 0 0 0 0 0 mode register 0 register dx 0 r 0 1 size 0 0 0 0 0 0 r field: 0 = unrounded 1 = rounded tbls, tblsn (data register interpolate) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 register dym register dx 1 r 0 0 size 0 0 0 register dyn r field: 0 = unrounded 1 = rounded tbls, tblsn (lookup and interpolate) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 effective address 1 1 1 1 1 0 0 0 0 0 mode register 0 register dx 1 r 0 1 size 0 0 0 0 0 0 r field: 0 = unrounded 1 = rounded f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-188 reference manual 4.6 table lookup and interpolation instructions there are four table lookup and interpolate instructions. tbls returns a signed, round- ed byte, word, or long-word result. tblsn returns a signed, unrounded byte, word, or long-word result. tblu returns an unsigned, rounded byte, word, or long-word result. tblun returns an unsigned, unrounded byte, word, or long-word result. all four in- structions support two types of interpolation data: an n-element table stored in mem- ory, and a two-element range stored in a pair of data registers. the latter form provides a means of performing surface (3d) interpolation between two previously calculated linear interpolations. the following examples show how to compress tables and use fewer interpolation lev- els between table entries. example 1 (see figure 4-3 ) demonstrates table lookup and interpolation for a 257-entry table, allowing up to 256 interpolation levels between en- tries. example 2 (see figure 4-4 ) reduces table length for the same data to four en- tries. example 3 (see figure 4-5 ) demonstrates use of an 8-bit independent variable with an instruction. two additional examples show how tblsn can reduce cumulative error when multi- ple table lookup and interpolation operations are used in a calculation. example 4 demonstrates addition of the results of three table interpolations. example 5 illustrates use of tblsn in surface interpolation. 4.6.1 table example 1: standard usage figure 4-3 table example 1 the table consists of 257 word entries. as shown in figure 4-3 , the function is linear within the range 32768 x 49152. table entries within this range are as follows: x 16384 32768 49152 65536 independent variable dependent variable y f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-189 *these values are the end points of the range. all entries between these points fall on the line. the table instruction is executed with the following bit pattern in dx: table entry offset ? dx [8:15] = $a3 = 163 interpolation fraction ? dx [0:7] = $80 = 128 using this information, the table instruction calculates dependent variable y: y = 1669 + (128 (1679 ?1669)) / 256 = 1674 4.6.2 table example 2: compressed table figure 4-4 table example 2 entry number x value y value 128* 32768 1311 162 41472 1659 163 41728 1669 164 41984 1679 165 42240 1690 192* 49152 1966 31 16 15 0 not used 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 x 256 512 786 1024 independent variable dependent variable y f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-190 reference manual in example 2, the data from example 1 has been compressed by limiting the maximum value of the independent variable. instead of the range 0 x = 65535, x is limited to 0 x 1023. the table has been compressed to only 5 entries, but up to 256 levels of interpolation are allowed between entries. caution extreme table compression with many levels of interpolation is pos- sible only with highly linear functions. the table entries within the range of interest are as follows: since the table is reduced from 257 to 5 entries, independent variable x must be scaled appropriately. in this case the scaling factor is 64, and the scaling is done by a single instruction: lsr.w #6,dx thus, dx now contains the following bit pattern: table entry offset ? dx [8:15] = $02 = 2 interpolation fraction ? dx [0:7] = $8e = 142 using this information, the table instruction calculates dependent variable y: . y = 1331 + (142 (1966 ?1311)) / 256 = 1674 the function chosen for examples 1 and 2 is linear between data points. if another function had been used, interpolated values might not have been identical. entry number x value y value 2 512 1311 3 786 1966 31 16 15 0 not used 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-191 4.6.3 table example 3: 8-bit independent variable figure 4-5 table example 3 this example shows how to use a table instruction within an interpolation subroutine. independent variable x is calculated as an 8-bit value, allowing 16 levels of interpola- tion on a 17-entry table. x is passed to the subroutine, which returns an 8-bit result. the subroutine uses the following data, based on the function shown in figure 4-5 . x (subroutine) x (instruction) y 000 1 256 16 2 512 32 3 768 48 4 1024 64 5 1280 80 6 1536 96 7 1792 112 8 2048 128 9 2304 112 10 2560 96 11 2816 80 12 3072 64 13 3328 48 14 3584 32 15 3840 16 16 4096 0 y x 1024 2048 3072 4096 independent variable independent variable f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-192 reference manual the first column is the value passed to the subroutine, the second column is the value expected by the table instruction, and the third column is the result returned by the subroutine. the following value has been calculated for independent variable x: since x is an 8-bit value, the upper four bits are used as a table offset and the lower four bits are used as an interpolation fraction. the following results are obtained from the subroutine: table entry offset ? dx [4:7] = $b = 11 interpolation fraction ? dx [0:3] = $d = 13 thus, y is calculated as follows: y = 80 + (13 (64 ?80)) / 16 = 67 if the 8-bit value for x were used directly by the table instruction, interpolation would be incorrectly performed between entries 0 and 1. data must be shifted to the left four places before use: lsl.w #4, dx the new range for x is 0 x 4096; however, since a left shift fills the least significant digits of the word with zeroes, the interpolation fraction can only have one of 16 values. after the shift operation, dx contains the following value: execution of the table instruction using the new value in dx yields: table entry offset ? dx [8:15] = $0b = 11 interpolation fraction ? dx [0:7] = $d0 = 208 thus, y is calculated as follows: y = 80 + (208 (64 ?80)) / 256 = 67 4.6.4 table example 4: maintaining precision in this example, three table lookup and interpolation (tli) operations are performed and the results are summed. the calculation is done once with the result of each tli rounded before addition and once with only the final result rounded. assume that the result of the three interpolations are as follows (a ??indicates the binary radix point). 31 16 15 0 not used 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 1 31 16 15 0 not used 0 0 0 0 1 0 1 1 1 1 0 1 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction set motorola reference manual 4-193 first, the results of each tli are rounded with the tbls round-to-nearest-even algo- rithm. the following values would be returned by tbls: summing, the following result is obtained: now, using the same tli results, the sum is first calculated and then rounded accord- ing to the same algorithm: rounding yields: the second result is preferred. the following code sequence illustrates how addition of a series of table interpolations can be performed without loss of precision in the in- termediate results: l0: tblsn.b ea ?, dx tblsn.b ea ?, dx tblsn.b ea ?, dl add.l dx, dm long addition avoids problems with carry add.l dm, dl asr.l#8, dl move radix point bcc.b l1 fraction msb in carry addq.b #1, dl l1: . . . tli # 1 0010 0000 . 0111 0000 tli # 2 0011 1111 . 0111 0000 tli # 3 0000 0001 . 0111 0000 tli # 1 0010 0000 . tli # 2 0011 1111 . tli # 3 0000 0001 . 0010 0000 . 0011 1111 . 0000 0001 . 0110 0000 . 0010 0000 . 0111 0000 0011 1111 . 0111 0000 0000 0001 . 0111 0000 0110 0001 . 0101 0000 0110 0001 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction set cpu32 4-194 reference manual 4.6.5 table example 5: surface interpolations the various forms of table can be used to perform surface (3d) tlis. however, since the calculation must be split into a series of 2d tlis, the possibility of losing precision in the intermediate results is possible. the following code sequence, incorporating both tbls and tblsn, eliminates this possibility. l0: move.w dx, dl copy entry number and fraction number tblsn.b ea ? , dx tblsn.b ea ?, dl tbls.w dx:dl, dm surface interpolation, with round asr.l #8, dm read just the result bcc.b l1 no round necessary addq.b #1, dl half round up l1: . . . before execution of this code sequence, dx must contain fraction and entry numbers for the two tli, and dm must contain the fraction for surface interpolation. the ea ? fields in the tblsn instructions point to consecutive columns in a 3d table. the tbls size parameter must be word if the tblsn size parameter is byte, and must be long word if tblsn is word. increased size is necessary because a larger number of sig- nificant digits is needed to accommodate the scaled fractional results of the 2d tli. 4.7 nested subroutine calls the link instruction pushes an address onto the stack, saves the stack address at which the address is stored, and reserves an area of the stack for use. using this in- struction in a series of subroutine calls will generate a linked list of stack frames. the unlk instruction removes a stack frame from the end of the list by loading an ad- dress into the stack pointer and pulling the value at that address from the stack. when the instruction operand is the address of the link address at the bottom of a stack frame, the effect is to remove the stack frame from both the stack and the linked list. 4.8 pipeline synchronization with the nop instruction although the no operation (nop) instruction performs no visible operation, it does force synchronization of the instruction pipeline, since all previous instructions must complete execution before the nop begins. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 processing states motorola reference manual 5-1 section 5processing states this section describes the processing states of the cpu32. it includes a functional de- scription of the bits in the supervisor portion of the status register and an overview of actions taken by the processor in response to exception conditions. 5.1 state transitions the processor is in normal, background, or exception state unless halted. when the processor fetches instructions and operands or executes instructions, it is in the normal processing state. the stopped condition, which the processor enters when a stop or lpstop instruction is executed, is a variation of the normal state in which no further bus cycles are generated. background state is an alternate operational mode used for system debugging. refer to section 7 development support for more information. exception processing refers specifically to the transition from normal processing of a program to normal processing of system routines, interrupt routines, and other excep- tion handlers. exception processing includes the stack operations, the exception vec- tor fetch, and the filling of the instruction pipeline caused by an exception. exception processing ends when execution of an exception handler routine begins. refer to section 6 exception processing for comprehensive information. a catastrophic system failure occurs if the processor detects a bus error or generates an address error while in the exception processing state. this type of failure halts the processor. for example, if a bus error occurs during exception processing caused by a bus error, the cpu32 assumes that the system is not operational and halts. the halted condition should not be confused with the stopped condition. after the pro- cessor executes a stop or lpstop instruction, execution of instructions can resume when a trace, interrupt, or reset exception occurs. 5.2 privilege levels to protect system resources, the processor can operate with either of two levels of ac- cess ?user or supervisor. supervisor level is more privileged than user level. all in- structions are available at the supervisor level, but execution of some instructions is not permitted at the user level. there are separate stack pointers for each level. the s bit in the status register indicates privilege level, and determines which stack pointer is used for stack operations. the processor identifies each bus access (supervisor or user mode) via function codes to enforce supervisor and user access levels. in a typical system most programs execute at the user level. user programs can ac- cess only their own code and data areas, and are restricted from accessing other in- formation. the operating system executes at the supervisor privilege level, has access f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola processing states cpu32 5-2 reference manual to all resources, performs the overhead tasks for the user level programs, and coordi- nates their activities. 5.2.1 supervisor privilege level if the s bit in the status register is set, supervisor privilege level applies, and all instruc- tions are executable. the bus cycles generated for instructions executed in supervisor level are normally classified as supervisor references, and the values of the function codes on fc[2:0] refer to supervisor address spaces. all exception processing is performed at the supervisor level. all bus cycles generated during exception processing are supervisor references, and all stack accesses use the supervisor stack pointer. instructions that have important system effects can only be executed at supervisor lev- el. for instance, user programs are not permitted to execute stop, lpstop, or re- set instructions. to prevent a user program from gaining privileged access, except in a controlled manner, instructions that can alter the s bit in the status register are priv- ileged. the trap #n instruction provides controlled user access to operating system services. 5.2.2 user privilege level if the s bit in the status register is cleared, the processor executes instructions at the user privilege level. the bus cycles for an instruction executed at the user privilege lev- el are classified as user references, and the values of the function codes on fc[2:0] specify user address spaces. while the processor is at the user level, implicit referenc- es to the system stack pointer and explicit references to address register seven (a7) refer to the user stack pointer (usp). 5.2.3 changing privilege level to change from user privilege level to supervisor privilege level, a condition that caus- es exception processing must occur. when exception processing begins, the current values in the status register, including the s bit, are saved on the supervisor stack, and then the s bit is set, enabling supervisory access. execution continues at supervisor level until exception processing is complete. to return to user access level, a system routine must execute one of the following in- structions: move to sr, andi to sr, eori to sr, ori to sr, or rte. these instruc- tions execute only at supervisor privilege level, and can modify the s bit of the status register. after these instructions execute, the instruction pipeline is flushed, then re- filled from the appropriate address space. the rte instruction causes a return to a program that was executing when an excep- tion occurred. when rte is executed, the exception stack frame saved on the super- visor stack can be restored in either of two ways. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 processing states motorola reference manual 5-3 if the frame was generated by an interrupt, breakpoint, trap, or instruction exception, the status register and program counter are restored to the values saved on the su- pervisor stack, and execution resumes at the restored program counter address, with access level determined by the s bit of the restored status register. if the frame was generated by a bus error or an address error exception, the entire pro- cessor state is restored from the stack. 5.3 types of address space during each bus cycle, the processor generates function code signals that permit se- lection of eight distinct 4-gigabyte address spaces. not all devices that incorporate the cpu32 support a full complement of memory. (refer to the appropriate user's manual for details.) selection varies according to the access required. automatic selection of supervisor and user space, and of program and data space, is provided. in addition, certain special processor cycles, such as the interrupt acknowledge cycle or the lp- stop broadcast cycle are recognized, and appropriate codes are generated. table 5-1 shows function code values and the corresponding address space. *address space 3 is reserved for user definition; 0 and 4 are reserved for future use by motorola. although an appropriate address space is selected, memory locations of user program and data, and of supervisor data, within that address space are not predefined. dur- ing reset, two long words beginning at memory location zero in the supervisor program space are used for processor initialization. no other memory locations are explicitly defined by the cpu32. 5.3.1 cpu space access function code $7 ([fc2:fc0] = 111) selects cpu address space. the processor com- municates with external devices for special purposes by accessing this space. all m68000 processors use cpu space for interrupt acknowledge cycles. the cpu32 also uses cpu space for breakpoint acknowledge and the lpstop broadcast. supervisor programs can use the moves instruction to access all address spaces, including user spaces and cpu address space. although the moves instruction can be used to generate cpu space cycles, doing so may interfere with proper system op- eration. exercise caution when using moves to access cpu space. table 5-1 address spaces fc2 fc1 fc0 address space 0 0 0 undefined reserved* 0 0 1 user data space 0 1 0 user program space 0 1 1 undefined reserved* 1 0 0 undefined reserved* 1 0 1 supervisor data space 1 1 0 supervisor program space 1 1 1 cpu space f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola processing states cpu32 5-4 reference manual address bus encoding facilitates cpu space transactions. bits a[19:16], the cpu space type field, show which transaction is being performed. currently, only five of the 16 possible encodings are defined: 0000, 0001, 0010, 0011, and 1111. of these, only 0000, 0011, and 1111 are supported by the cpu32. address bits a[31:20] are not present on all m68000 processors, and thus cannot be essential to cpu space transaction decoding. the function of other address bus bit fields depends on the transaction being performed. a description of each defined cpu space types follows. 5.3.1.1 type 0000 ?breakpoint this cpu space type is used for breakpoint acknowledge. bkpt# field a[4:2] indicates the breakpoint number. software breakpoints set this val- ue to the number of the executing breakpoint instruction. hardware breakpoints al- ways set bkpt# to 7 (%111). t bit a1 designates the type of breakpoint. t = 0 indicates a software breakpoint; t = 1 indicates a hardware breakpoint. 5.3.1.2 type 0001 ?mmu access this type of access is not supported by the cpu32 processor. this space is reserved for future use. 5.3.1.3 type 0010 ?coprocessor access this type of access is not supported by the cpu32 processor. this space is reserved for future use. 5.3.1.4 type 0011 ?internal register access type 0011 space is used to access certain critical system configuration or control reg- isters. the cpu32 external bus interface interrupt mask register resides in cpu space. this register is written to when lpstop is executed, and masks off external interrupts while in stop mode. a[3:1] indicate the encoded interrupt mask level. 31 54 210 0 000000000000000000000 00000 bkpt # t 0 31 18 17 1 0 0 000000000000011111111 11111 bkpt # t 0 data 00000 0000000110 15 3210 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 processing states motorola reference manual 5-5 these control registers, reserved for future expansion, also reside in cpu space 3, and are only accessible through the moves command. the general format of this cpu space type is defined as follows: a[15:12] are used as 1 of 16 external chip selects. a[11: 8] are used as 1 of 16 internal module selects. a[7:0] are used as 1 of 256 module register addresses. 5.3.1.5 type 1111 ?interrupt acknowledge interrupt acknowledge is a cpu space type used for interrupt acknowledge. a[4:1] in- dicate the encoded interrupt level being acknowledged. 31 18 17 16 15 12 11 8 7 5 4 2 1 0 0 000000000000011 ccccmm m m aaaaaaaa 31 54 10 1 111111111111111111111 11111 level 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola processing states cpu32 5-6 reference manual f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-1 section 6 exception processing this section discusses system resources related to exception handling, exception pro- cessing sequence, and specific features of individual exception processing routines 6.1 definition of exception processing an exception is a special condition that preempts normal processing. exception pro- cessing is the transition from normal mode program execution to execution of a routine that deals with an exception. 6.1.1 exception vectors an exception vector is the address of a routine that handles an exception. the vector base register (vbr) contains the base address of a 1024-byte exception vector table, which consists of 256 exception vectors. sixty-four vectors are defined by the proces- sor, and 192 vectors are reserved for user definition as interrupt vectors. except for the reset vector, each vector in the table is one long word in length. the reset vector is two long words in length. refer to table 6-1 for information on vector assignment. caution because there is no protection on the 64 processor-defined vectors, external devices can access vectors reserved for internal purposes ?this practice is strongly discouraged. all exception vectors, except the reset vector, are located in supervisor data space. the reset vector is located in supervisor program space. only the initial reset vector is fixed in the processor memory map. when initialization is complete, there are no fixed assignments. since the vbr stores the vector table base address, the table can be located anywhere in memory. it can also be dynamically relocated for each task exe- cuted by an operating system. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-2 reference manual each vector is assigned an 8-bit number. vector numbers for some exceptions are ob- tained from an external device; others are supplied by the processor. the processor multiplies the vector number by four to calculate vector offset, then adds the offset to the contents of the vbr. the sum is the memory address of the vector. 6.1.2 types of exceptions an exception can be caused by internal or external events. an internal exception can be generated by an instruction or by an error. the trap, trapcc, trapv, bkpt, chk, chk2, rte, and div instructions can cause excep- tions during normal execution. illegal instructions, instruction fetches from odd ad- dresses, word or long-word operand accesses from odd addresses, and privilege violations also cause internal exceptions. table 6-1 exception vector assignments vector number vector offset assignment dec hex space 0 0 000 sp reset: initial stack pointer 1 4 004 sp reset: initial program counter 2 8 008 sd bus error 3 12 00c sd address error 4 16 010 sd illegal instruction 5 20 014 sd zero division 6 24 018 sd chk, chk2 instructions 7 28 01c sd trapcc, trapv instructions 8 32 020 sd privilege violation 9 36 024 sd trace 10 40 028 sd line 1010 emulator 11 44 02c sd line 1111 emulator 12 48 030 sd hardware breakpoint 13 52 034 sd (reserved, coprocessor protocol violation) 14 56 038 sd format error and uninitialized interrupt 15 60 03c sd format error and uninitialized interrupt 16?3 64 92 040 05c sd (unassigned, reserved) 24 96 060 sd spurious interrupt 25 100 064 sd level 1 interrupt autovector 26 104 068 sd level 2 interrupt autovector 27 108 06c sd level 3 interrupt autovector 28 112 070 sd level 4 interrupt autovector 29 116 074 sd level 5 interrupt autovector 30 120 078 sd level 6 interrupt autovector 31 124 07c sd level 7 interrupt autovector 32?7 128 188 080 0bc sd trap instruction vectors (0?5) 48?8 192 232 0c0 0e8 sd (reserved, coprocessor) 59?3 236 252 0ec 0fc sd (unassigned, reserved) 64?55 256 1020 100 3fc sd user defined vectors (192) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-3 sources of external exception include interrupts, breakpoints, bus errors, and reset re- quests. interrupts are peripheral device requests for processor action. breakpoints are used to support development equipment. bus error and reset are used for access con- trol and processor restart. 6.1.3 exception processing sequence for all exceptions other than a reset exception, exception processing occurs in the fol- lowing sequence. refer to 6.2.1 reset for details of reset processing. as exception processing begins, the processor makes an internal copy of the sta- tus register. after the copy is made, the processor state bits in the status register are changed ?the s bit is set, establishing supervisor access level, and bits t1 and t0 are cleared, disabling tracing. for reset and interrupt exceptions, the inter- rupt priority mask is also updated. next, the exception number is obtained. for interrupts, the number is fetched rom cpu space $f (the bus cycle is an interrupt acknowledge). for all other excep- tions, internal logic provides a vector number. next, current processor status is saved. an exception stack frame is created and placed on the supervisor stack. all stack frames contain copies of the status regis- ter and the program counter for use by rte. the type of exception and the context in which the exception occurs determine what other information is stored in the stack frame. finally, the processor prepares to resume normal execution of instructions. the ex- ception vector offset is determined by multiplying the vector number by four, and the offset is added to the contents of the vbr to determine displacement into the exception vector table. the exception vector is loaded into the program counter. if no other exception is pending, the processor will resume normal execution at the new address in the pc. 6.1.4 exception stack frame during exception processing, the most volatile portion of the current context is saved on the top of the supervisor stack. this context is organized in a format called the ex- ception stack frame. the exception stack frame always includes the contents of status register and pro- gram counter at the time the exception occurred. to support generic handlers, the pro- cessor also places the vector offset in the exception stack frame and marks the frame with a format code. the format field allows an rte instruction to identify stack infor- mation so that it can be properly restored. the general form of the exception stack frame is illustrated in figure 6-1. although some formats are peculiar to a particular m68000 family processor, format 0000 is al- ways legal and always indicates that only the first four words of a frame are present. see 6.4 cpu32 stack frames for a complete discussion of exception stack frames. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-4 reference manual figure 6-1 exception stack frame 6.1.5 multiple exceptions each exception has been assigned a priority based on its relative importance to sys- tem operation. priority assignments are shown in table 6-2 . group 0 exceptions have the highest priorities. group 4 exceptions have the lowest priorities. exception pro- cessing for exceptions that occur simultaneously is done by priority, from highest to lowest. it is important to be aware of the difference between exception processing mode and execution of an exception handler. each exception has an assigned vector that points to an associated handler routine. exception processing includes steps described in 6.1.3 exception processing sequence , but does not include execution of handler routines, which is done in normal mode. when the cpu32 completes exception processing, it is ready to begin either exception processing for a pending exception, or execution of a handler routine. priority assign- ment governs the order in which exception processing occurs, not the order in which exception handlers are executed. table 6-2 exception priority groups group/ priority exception and relative priority characteristics 0 reset aborts all processing (instruction or exception); does not save old context 1.1 1.2 address error bus error suspends processing (instruction or exception); saves internal context 2 bkpt#n, chk, chk2, division by zero, rte, trap#n, trapcc, trapv exception processing is a part of instruction execution 3 illegal instruction, line a, unimplemented line f, privilege violation exception processing begins before instruction execution 4.1 4.2 4.3 trace hardware breakpoint interrupt exception processing begins when current instruction or previous exception processing is complete status register program counter low format vector offset other processor state information, depending on exception (0, 2, or 8 words) program counter high higher addresses sp (after stacking) stacking order 0 15 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-5 as a general rule, when simultaneous exceptions occur, the handler routines for lower priority exceptions are executed before the handler routines for higher priority excep- tions. for example, consider the arrival of an interrupt during execution of a trap in- struction, while tracing is enabled. trap exception processing (2) is done first, followed immediately by exception processing for the trace (4.1), and then by exception pro- cessing for the interrupt (4.3). each exception places a new context on the stack. when the processor resumes normal instruction execution, it is vectored to the inter- rupt handler, which returns to the trace handler that returns to the trap handler. there are special cases to which the general rule does not apply. the reset exception will always be the first exception handled, since reset clears all other exceptions. it is also possible for high priority exception processing to begin before low priority excep- tion processing is complete. for example, if a bus error occurs during trace exception processing, the bus error will be processed and handled before trace exception pro- cessing is completed. 6.2 processing of specific exceptions the following paragraphs provide details concerning sources of specific exceptions, how each arises, and how each is processed. 6.2.1 reset assertion of reset by external hardware, or assertion of the internal reset signal by an internal module, causes a reset exception. the reset exception has the highest priority of any exception. reset is used for system initialization and for recovery from catastrophic failure. the reset exception aborts any processing in progress when it is recognized, and that processing cannot be recovered. reset performs the following operations: 1. clears t0 and t1 in the status register to disable tracing 2. sets the s bit in the status register to establish supervisor privilege 3. sets the interrupt priority mask to the highest priority level (%111) 4. initializes the vector base register to zero ($00000000) 5. generates a vector number to reference the reset exception vector 6. loads the first long word of the vector into the interrupt stack pointer 7. loads the second long word of the vector into the program counter 8. fetches and initiates decode of the first instruction to be executed figure 6-2 is a flowchart of the reset exception. after initial instruction prefetches, normal program execution begins at the address in the program counter. the reset exception does not save the value of either the pro- gram counter or the status register. if a bus error or address error occurs during reset exception processing sequence, a double bus fault occurs. the processor halts, and the halt signal is asserted to indi- cate the halted condition. execution of the reset instruction does not cause a reset exception nor does it affect any internal cpu register, but it does cause the cpu32 to assert the reset signal, resetting all internal and external peripherals. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-6 reference manual figure 6-2 reset operation flowchart 6.2.2 bus error a bus error exception occurs when an assertion of the berr signal is acknowledged. the berr signal can be asserted by one of three sources: 1. external logic by assertion of the berr input pin 2. direct assertion of the internal berr signal by an internal module 3. direct assertion of the internal berr signal by the on-chip hardware watchdog after detecting a no-response condition bus error exception processing begins when the processor attempts to use informa- tion from an aborted bus cycle. 1 s 0 t0,t1 $7 12:io $0 vbr entry fetch vector # 0 fetch vector # 1 otherwise sp (vector # 0) prefetch first word otherwise begin instruction execution exit (double bus fault) assert hal t exit otherwise pc (vector # 1) bus error bus error bus error/ address error f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-7 when the aborted bus cycle is an instruction prefetch, the processor will not initiate exception processing unless the prefetched information is used. for example, if a branch instruction flushes an aborted prefetch, that word is not accessed, and no ex- ception occurs. when the aborted bus cycle is a data access, the processor initiates exception pro- cessing immediately, except in the case of released operand writes. released write bus errors are delayed until the next instruction boundary or until another operand ac- cess is attempted. exception processing for bus error exceptions follows the regular sequence, but con- text preservation is more involved than for other exceptions because a bus exception can be initiated while an instruction is executing. several bus error stack format orga- nizations are utilized to provide additional information regarding the nature of the fault. first, any register altered by a faulted-instruction effective address calculation is re- stored to its initial value. then a special status word (ssw) is placed on the stack. the ssw contains specific information about the aborted access ?size, type of access (read or write), bus cycle type, and function code are saved. finally, fault address, bus error exception vector number, program counter value, and a copy of the status regis- ter are saved. if a bus error occurs during exception processing for a bus error, an address error, a reset, or while the processor is loading stack information during rte execution, the processor halts. this simplifies isolation of catastrophic system failure by preventing processor interaction with stacks and memory. only assertion of reset can restart a halted processor. 6.2.3 address error address error exceptions occur when the processor attempts to access an instruction, word operand, or long-word operand at an odd address. the effect is much the same as an internally generated bus error. the exception processing sequence is the same as that for bus error, except that the vector number refers to the address error excep- tion vector. address error exception processing begins when the processor attempts to use infor- mation from the aborted bus cycle. if the aborted cycle is a data space access, exception processing begins when the pro- cessor attempts to use the data, except in the case of a released operand write. re- leased write exceptions are delayed until the next instruction boundary or attempted operand access. an address exception on a branch to an odd address is delayed until the program counter is changed. no exception occurs if the branch is not taken. in this case, the fault address and return program counter value placed in the exception stack frame are the odd address, and the current instruction program counter points to the instruc- tion that caused the exception. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-8 reference manual if an address error occurs during exception processing for a bus error, another ad- dress error, or a reset, the processor halts. 6.2.4 instruction traps traps are exceptions caused by instructions. they arise from either processor recog- nition of abnormal conditions during instruction execution or from use of specific trap- ping instructions. traps are generally used to handle abnormal conditions that arise in control routines. the trap instruction, which always forces an exception, is useful for implementing system calls for user programs. the trapcc, trapv, chk, and chk2 instructions force exceptions when a program detects a run-time error. the divs and divu in- structions force an exception if a division operation is attempted with a divisor of zero. exception processing for traps follows the regular sequence. if tracing is enabled when an instruction that causes a trap begins execution, a trace exception will be gen- erated by the instruction, but the trap handler routine will not be traced (the trap excep- tion will be processed first, then the trace exception). the vector number for the trap instruction is internally generated ?part of the num- ber comes from the instruction itself. the trap vector number, program counter value, and a copy of the status register are saved on the supervisor stack. the saved pro- gram counter value is the address of the instruction that follows the instruction which generated the trap. for all instruction traps other than trap, a pointer to the instruc- tion causing the trap is also saved in the fifth and sixth words of the exception stack frame. 6.2.5 software breakpoints to support hardware emulation, the cpu32 must provide a means of inserting break- points into target code and of announcing when a breakpoint is reached. the mc68000 and mc68008 can detect an illegal instruction inserted at a breakpoint when the processor fetches from the illegal instruction exception vector location. since the vbr on the cpu32 allows relocation of exception vectors, the exception vector ad- dress is not a reliable indication of a breakpoint. cpu32 breakpoint support is provided by extending the function of a set of illegal instructions ($4848?484f). when a breakpoint instruction is executed, the cpu32 performs a read from cpu space $0, at a location corresponding to the breakpoint number (see 5.3 types of ad- dress space ). if this bus cycle is terminated by berr , the processor performs illegal instruction exception processing. if the bus cycle is terminated by dsack , the proces- sor uses the data returned to replace the breakpoint in the instruction pipeline and be- gins execution of that instruction. 6.2.6 hardware breakpoints the cpu32 recognizes hardware breakpoint requests. hardware breakpoint requests do not force immediate exception processing, but are left pending. an instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-9 breakpoint is not made pending until the instruction corresponding to the request is ex- ecuted. a pending breakpoint can be acknowledged between instructions or at the end of ex- ception processing. to acknowledge a breakpoint, the cpu performs a read from cpu space $0 at location $1e. see 5.3 types of address space for a detailed description of cpu space operations. if the bus cycle terminates normally, instruction execution continues with the next in- struction, as if no breakpoint request occurred. if the bus cycle is terminated by berr , the cpu begins exception processing. data returned during this bus cycle is ignored. exception processing follows the regular sequence. vector number 12 (offset $30) is internally generated. the program counter of the currently executing instruction, the program counter of the next instruction to execute, and a copy of the status register are saved on the supervisor stack. 6.2.7 format error the processor checks certain data values for control operations. the validity of the stack format code and, in the case of a bus cycle fault format, the version number of the processor that generated the frame are checked during execution of the rte in- struction. this check ensures that the program does not make erroneous assumptions about information in the stack frame. if the format of the control data is improper, the processor generates a format error ex- ception. this exception saves a four-word format exception frame and then vectors through vector table entry number 14. the stacked program counter is the address of the rte instruction that discovered the format error. 6.2.8 illegal or unimplemented instructions an instruction is illegal if it contains a word bit pattern that does not correspond to the bit pattern of the first word of a legal cpu32 instruction, if it is a movec instruction that contains an undefined register specification field in the first extension word, or if it contains an indexed addressing mode extension word with bits [5:4] = 00 or bits [3:0] 1 0000. if an illegal instruction is fetched during instruction execution, an illegal instruction ex- ception occurs. this facility allows the operating system to detect program errors or to emulate instructions in software. word patterns with bits [15:12] = 1010 (referred to as a-line opcodes) are unimple- mented instructions. a separate exception vector (vector 10, offset $28) is given to un- implemented instructions to permit efficient emulation. word patterns with bits [15:12] = 1111 (referred to as f-line opcodes) are used for m68000 family instruction set extensions. they can generate an unimplemented in- struction exception caused by the first extension word of the instruction or by the ad- dressing mode extension word. a separate f-line emulation vector (vector 11, offset $2c) is used for the exception vector. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-10 reference manual all unimplemented instructions are reserved for use by motorola for enhancements and extensions to the basic m68000 architecture. opcode pattern $4afc is defined to be illegal on all m68000 family members. those customers requiring the use of an unimplemented opcode for synthesis of ?ustom instructions,?operating system calls, etc., should use this opcode. exception processing for illegal and unimplemented instructions is similar to that for traps. the instruction is fetched and decoding is attempted. when the processor de- termines that execution of an illegal instruction is being attempted, exception process- ing begins. no registers are altered. exception processing follows the regular sequence. the vector number is generated to refer to the illegal instruction vector or, in the case of an unimplemented instruction, to the corresponding emulation vector. the illegal instruction vector number, current program counter, and a copy of the status register are saved on the supervisor stack, with the saved value of the program counter being the address of the illegal or unim- plemented instruction. 6.2.9 privilege violations to provide system security, certain instructions can be executed only at the supervisor access level an attempt to execute one of these instructions at the user level will cause an exception. the privileged exceptions are as follows: ?and immediate to sr ?eor immediate to sr ?lpstop ?move from sr ?move to sr ?move usp ?movec ?moves ?or immediate to sr ?reset ?rte ?stop exception processing for privilege violations is nearly identical to that for illegal instruc- tions. the instruction is fetched and decoded. if the processor determines that a priv- ilege violation has occurred, exception processing begins before instruction execution. exception processing follows the regular sequence. the vector number (8) is gener- ated to reference the privilege violation vector. privilege violation vector offset, current program counter, and status register are saved on the supervisor stack. the saved program counter value is the address of the first word of the instruction causing the privilege violation. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-11 6.2.10 tracing to aid in program development, m68000 processors include a facility to allow tracing of instruction execution. cpu32 tracing also has the ability to trap on changes in pro- gram flow. in trace mode, a trace exception is generated after each instruction exe- cutes, allowing a debugging program to monitor the execution of a program under test. the t1 and t0 bits in the supervisor portion of the status register are used to control tracing. when t[1:0] = 00, tracing is disabled, and instruction execution proceeds normally (see table 6-3 ). when t[1:0] = 01 at the beginning of instruction execution, a trace exception will be generated if the program counter changes sequence during execution. all branches, jumps, subroutine calls, returns, and status register manipulations can be traced in this way. no exception occurs if a branch is not taken. when t[1:0] = 10 at the beginning of instruction execution, a trace exception will be generated when execution is complete. if the instruction is not executed, either be- cause an interrupt is taken or because the instruction is illegal, unimplemented, or priv- ileged, an exception is not generated. at the present time, t[1:0] = 11 is an undefined condition. it is reserved by motorola for future use. exception processing for trace starts at the end of normal processing for the traced instruction and before the start of the next instruction. exception processing follows the regular sequence (tracing is disabled so that the trace exception itself is not traced). a vector number is generated to reference the trace exception vector. the ad- dress of the instruction that caused the trace exception, the trace exception vector off- set, the current program counter, and a copy of the status register are saved on the supervisor stack. the saved value of the program counter is the address of the next instruction to be executed. a trace exception can be viewed as an extension to the function of any instruction. if a trace exception is generated by an instruction, the execution of that instruction is not complete until the trace exception processing associated with it is also complete: if an instruction is aborted by a bus error or address error exception, trace exception processing is deferred until the suspended instruction is restarted and completed nor- mally. an rte from a bus error or address error will not be traced because of the pos- sibility of continuing the instruction from the fault. table 6-3 tracing control t1 t0 tracing function 00 no tracing 01 trace on change of flow 10 trace on instruction execution 11 (undefined; reserved) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-12 reference manual if an instruction is executed and an interrupt is pending on completion, the trace exception is processed before the interrupt exception. if an instruction forces an exception, the forced exception is processed before the trace exception. if an instruction is executed and a breakpoint is pending upon completion of the in- struction, the trace exception is processed before the breakpoint. if an attempt is made to execute an illegal, unimplemented, or privileged instruction while tracing is enabled, no trace exception will occur because the instruction is not executed. this is particularly important to an emulation routine that performs an in- struction function, adjusts the stacked program counter to beyond the unimple- mented instruction, and then returns. the status register on the stack must be checked to determine if tracing is on before the return is executed. if tracing is on, trace exception processing must be emulated so that the trace exception handler can account for the emulated instruction. tracing also affects normal operation of the stop and lpstop instructions. if either begins execution with t1 set, a trace exception will be taken after the instruction loads the status register. upon return from the trace handler routine, execution will continue with the instruction following stop (lpstop), and the processor will not enter the stopped condition. 6.2.11 interrupts there are seven levels of interrupt priority and 192 assignable interrupt vectors within each exception vector table. judicious use of multiple vector tables and hardware chaining will permit a virtually unlimited number of peripherals to interrupt the proces- sor. interrupt recognition and subsequent processing are based on internal interrupt re- quest signals (irq7 ?rq1 ) and the current priority set in status register priority mask i[2:0]. interrupt request level zero (irq7 ?rq1 negated) indicates that no service is re- quested. when an interrupt of level one through six is requested via irq6 ?rq1 , the processor compares the request level with the interrupt mask to determine whether the interrupt should be processed. interrupt requests are inhibited for all priority levels less than or equal to the current priority. level seven interrupts are nonmaskable. irq7 ?rq1 are synchronized and debounced by input circuitry on consecutive rising edges of the processor clock. to be valid, an interrupt request must be held constant for at least two consecutive clock periods. interrupt requests do not force immediate exception processing, but are left pending. a pending interrupt is detected between instructions or at the end of exception pro- cessing ?all interrupt requests must be held asserted until they are acknowledged by the cpu. if the priority of the interrupt is greater than the current priority level, excep- tion processing begins. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-13 exception processing occurs as follows. first, the processor makes an internal copy of the status register. after the copy is made, the processor state bits in the status reg- ister are changed ?the s bit is set, establishing supervisor access level, and bits t1 and t0 are cleared, disabling tracing. then, priority level is set to the level of the inter- rupt and the processor fetches a vector number from the interrupting device (cpu space $f). the fetch bus cycle is classified as an interrupt acknowledge and the en- coded level number of the interrupt is placed on the address bus. if an interrupting device requests automatic vectoring, the processor generates a vec- tor number (25 to 31) determined by the interrupt level number. if the response to the interrupt acknowledge bus cycle is a bus error, the interrupt is taken to be spurious, and the spurious interrupt vector number (24) is generated. the exception vector number, program counter, and status register are saved on the supervisor stack. the saved value of the program counter is the address of the instruc- tion that would have executed if the interrupt had not occurred. priority level seven interrupt is a special case. level seven interrupts are nonmaskable interrupts (nmi). level seven requests are transition sensitive to eliminate redundant servicing and concomitant stack overflow. transition sensitive means that the level seven input must change state before the cpu will detect an interrupt. an nmi is generated each time the interrupt request level changes to level seven (re- gardless of priority mask value), and each time the priority mask changes from seven to a lower number while request level remains at seven. many m68000 peripherals provide for programmable interrupt vector numbers to be used in the system interrupt request/acknowledge mechanism. if the vector number is not initialized after reset and if the peripheral must acknowledge an interrupt request, the peripheral should return the uninitialized interrupt vector number (15). see the system integration user's manual for detailed information on interrupt ac- knowledge cycles. 6.2.12 return from exception when exception stacking operations for all pending exceptions are complete, the pro- cessor begins execution of the handler for the last exception processed. after the ex- ception handler has executed, the processor must restore the system context in existence prior to the exception. the rte instruction is designed to accomplish this task. when rte is executed, the processor examines the stack frame on top of the super- visor stack to determine if it is valid and determines what type of context restoration must be performed. see 6.4 cpu32 stack frames for a description of stack frames. for a normal four-word frame, the processor updates the status register and program counter with data pulled from the stack, increments the supervisor stack pointer by eight, and resumes normal instruction execution. for a six-word frame, the status reg- f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-14 reference manual ister and program counter are updated from the stack, the active supervisor stack pointer is incremented by 12, and normal instruction execution resumes. for a bus fault frame, the format value on the stack is first checked for validity. in ad- dition, the version number on the stack must match the version number of the proces- sor that is attempting to read the stack frame. the version number is located in the most significant byte (bits [15:8]) of the internal register word at location sp + $14 in the stack frame. the validity check insures that stack frame data will be properly inter- preted in multiprocessor systems. if a frame is invalid, a format error exception is taken. if it is inaccessible, a bus error exception is taken. otherwise, the processor reads the entire frame into the proper in- ternal registers, de-allocates the stack (12 words), and resumes normal processing. bus error frames for faults during exception processing require the rte instruction to rewrite the faulted stack frame. if an error occurs during any of the bus cycles required by rewrite, the processor halts. if a format error occurs during rte execution, the processor creates a normal four- word fault stack frame below the frame that it was attempting to use. if a bus error oc- curs, a bus-error stack frame will be created. the faulty stack frame remains intact, so that it may be examined and repaired by an exception handler, or used by a different type of processor (e.g., an mc68010, mc68020, or a future m68000 processor) in a multiprocessor system. 6.3 fault recovery there are four phases of recovery from a fault: recognizing the fault, saving the pro- cessor state, repairing the fault (if possible), and restoring the processor state. saving and restoring the processor state are described in the following paragraphs. the stack contents are identified by the special status word (ssw). in addition to iden- tifying the fault type represented by the stack frame, the ssw contains the internal pro- cessor state corresponding to the fault. tp berr frame type mv movem in progress tr trace pending b1 breakpoint channel 1 pending b0 breakpoint channel 0 pending rr rerun write cycle after rte rm faulted cycle was read-modify-write in instruction/other rw read/write of faulted bus cycle lg original operand size was long word siz remaining size of faulted bus cycle func function code of faulted bus cycle 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 tp mv 0 tr b1 b0 rr rm in rw lg siz func f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-15 the tp field defines the class of the faulted bus operation. two berr exception frame types are defined. one is for faults on prefetch and operand accesses, and the other is for faults during exception frame stacking: 0 ?operand or prefetch bus fault 1 ?exception processing bus fault mv is set when the operand transfer portion of the movem instruction is in progress at the time of a bus fault. if a prefetch bus fault occurs while refetching the movem opcode and extension word, both the mv and in bits will be set. 0 ?movem was not in progress when fault occurred 1 ?movem in progress when fault occurred tr indicates that a trace exception was pending when a bus error exception was pro- cessed. the instruction that generated the trace will not be restarted upon return from the exception handler. this includes movem and released write bus errors indicated by the assertion of either mv or rr in the ssw. 0 ?trace not pending 1 ?trace pending b1 indicates that a breakpoint exception was pending on channel 1 (external break- point source) when a bus error exception was processed. pending breakpoint status is stacked, regardless of the type of bus error exception. 0 ?breakpoint not pending 1 ?breakpoint pending b0 indicates that a breakpoint exception was pending on channel 0 (internal break- point source) when the bus error exception was processed. pending breakpoint status is stacked, regardless of the type of bus error exception. 0 ?breakpoint not pending 1 ?breakpoint pending rr will be set if the faulted bus cycle was a released write. if the write is completed (rerun) in the exception handler, the rr bit should be cleared before executing rte. the bus cycle will be rerun if the rr bit is set upon return from the exception handler. 0 ?faulted cycle was read, rmw, or unreleased write 1 ?faulted cycle was a released write faulted rmw bus cycles set the rm bit. rm is ignored during unstacking. 0 ?faulted cycle was non-rmw cycle 1 ?faulted cycle was either the read or write of an rmw cycle instruction prefetch faults are distinguished from operand (both read and write) faults by the in bit. if in is cleared, the error was on an operand cycle; if in is set, the error was on an instruction prefetch. in is ignored during unstacking. 0 ?operand 1 ?prefetch read and write bus cycles are distinguished by the rw bit. read bus cycles will set the bit, and write bus cycles will clear it. the bit is reloaded into the bus controller if the rr bit is set during unstacking. 0 ?faulted cycle was an operand write 1 ?faulted cycle was a prefetch or operand read the lg bit indicates an original operand size of long word. lg is cleared if the original operand was a byte or word ?siz will indicate original (and remaining) size. lg is set if the original was a long word ?siz will indicate the remaining size at the time of fault. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-16 reference manual lg is ignored during unstacking. 0 ?original operand size was byte or word 1 ?original operand size was long word the ssw siz field shows operand size remaining when a fault was detected. this field does not indicate the initial size of the operand. it also does not necessarily indicate the proper status of a dynamically sized bus cycle. dynamic sizing occurs on the ex- ternal bus and is transparent to the cpu. byte size is shown only when the original operand was a byte. the field is reloaded into the bus controller if the rr bit is set dur- ing unstacking. the siz field is encoded as follows: 00 ?long word 01 ?byte 10 ?word 11 ?unused, reserved the function code for the faulted cycle is stacked in the func field of the ssw, which is a copy of [fc2:fc0] for the faulted bus cycle. this field is reloaded into the bus con- troller if the rr bit is set during unstacking. all unused bits are stacked as zeros and are ignored during unstacking. further discussion of the ssw is included in 6.3.1 types of faults . 6.3.1 types of faults an efficient implementation of instruction restart dictates that faults on some bus cy- cles be treated differently than faults on other bus cycles. the cpu32 defines four fault types: released write faults, faults during exception processing, faults during movem operand transfer, and faults on any other bus cycle. 6.3.1.1 type i: released write faults cpu32 instruction pipelining can cause a final instruction write to overlap the execu- tion of a following instruction. a write that is overlapped is called a released write. since the machine context for the instruction that queued the write is lost as soon as the following instruction starts, it is impossible to restart the faulted instruction. released write faults are taken at the next instruction boundary. the stacked program counter is that of the next unexecuted instruction. if a subsequent instruction attempts an operand access while a released write fault is pending, the instruction is aborted and the write fault is acknowledged. this action prevents stale data from being used by the instruction. the ssw for a released write fault contains the following bit pattern: tr, b1, and b0 are set if the corresponding exception is pending when the berr ex- ception is taken. status regarding the faulted bus cycle is reflected in the ssw lg, siz, and func fields. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 tr b1 b0 1 0 0 0 lg siz func f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-17 the remainder of the stack contains the program counter of the next unexecuted in- struction, the current status register, the address of the faulted memory location, and the contents of the data buffer which was to be written to memory. this data is written on the stack in the format depicted in figure 6-3 . 6.3.1.2 type ii: prefetch, operand, rmw, and movep faults the majority of berr exceptions are included in this category ?all instruction prefetches, all operand reads, all rmw cycles, and all operand accesses resulting from execution of movep (except the last write of a movep rn, ea ? or the last write of movem, which are type i faults). the tas, movep, and movem instructions ac- count for all operand writes not considered released. all type ii faults cause an immediate exception that aborts the current instruction any registers that were altered as the result of an effective address calculation (i.e., postin- crement or predecrement) are restored prior to processing the bus cycle fault. the ssw for faults in this category contains the following bit pattern: the trace pending bit is always cleared, since the instruction will be restarted upon re- turn from the handler. saving a pending exception on the stack would result in a trace exception being taken prior to restarting the instruction. if the exception handler does not alter the stacked sr trace bits, the trace is requeued when the instruction is start- ed. the breakpoint pending bits are stacked in the ssw, even though the instruction is restarted upon return from the handler. this avoids problems with bus state analyzer equipment that has been programmed to breakpoint only the first access to a specific location, or to count accesses to that location. if this response is not desired, the ex- ception handler can clear the bits before return. the rm, in, rw, lg, func, and siz fields all reflect the type of bus cycle that caused the fault. if the bus cycle was an rmw, the rm bit will be set and the rw bit will show whether the fault was on a read or write. 6.3.1.3 type iii: faults during movem operand transfer bus faults that occur as a result of movem operand transfer are classified as type iii faults. movem instruction prefetch faults are type ii faults. type iii faults cause an immediate exception that aborts the current instruction. none of the registers altered during execution of the faulted instruction are restored prior to execution of the fault handler. this includes any register predecremented as a result of the effective address calculation or any register overwritten during instruction exe- cution. since postincremented registers are not updated until the end of an instruction, the register retains its preinstruction value unless overwritten by operand movement. the ssw for faults in this category contains the following bit pattern: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 0 0 b1 b0 0 rm in rw lg siz func f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-18 reference manual mv is set, indicating that movem should be continued from the point where the fault occurred upon return from the exception handler. tr, b1, and b0 are set if a corre- sponding exception is pending when the berr exception is taken. in is set if a bus fault occurs while refetching an opcode or an extension word during instruction restart. rw, lg, siz, and func all reflect the type of bus cycle that caused the fault. all write faults have the rr bit set, to indicate that the write should be rerun upon return from the exception handler. the remainder of the stack frame contains sufficient information to continue movem with operand transfer following a faulted transfer. the address of the next operand to be transferred, incremented or decremented by operand size, is stored in the faulted address location ($08). the stacked transfer counter is set to 16 minus the number of transfers attempted (including the faulted cycle). refer to figure 6-3 for the stacking format. 6.3.1.4 type iv: faults during exception processing the fourth type of fault occurs during exception processing. if this exception is a sec- ond address or bus error, the machine halts in the ?ouble bus fault?condition. how- ever, if the exception is one that causes a four- or six-word stack frame to be written, a bus cycle fault frame is written below the faulted exception stack frame. the ssw for a fault within an exception contains the following bit pattern: tr, b1, and b0 are set if a corresponding exception is pending when the berr ex- ception is taken. the contents of the faulted exception stack frame are included in the bus fault stack frame. the pre-exception status register and the format/vector word of the faulted frame are stacked. the type of exception can be determined from the format/vector word. if the faulted exception stack frame contains six words, the program counter of the instruction that caused the initial exception is also stacked. this data is placed on the stack in the format shown in figure 6-4 . the return address from the initial excep- tion is stacked for rte. 6.3.2 correcting a fault fault correction methods are discussed in the following paragraphs. there are two ways to complete a faulted released write bus cycle. the first is to use a software handler. the second is to rerun the bus cycle via rte. type ii fault handlers must terminate with rte, but specific requirements must also be met before an instruction is restarted. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 1 0 tr b1 b0 rr 0 in rw lg siz func 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 1 0 0 tr b1 b0 0 0 0 1 lg siz func 15 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-19 there are three varieties of type iii operand fault recovery. the first is completion of an instruction in software. the second is conversion to type ii with restart via rte. the third is continuation from the fault via rte. 6.3.2.1 (type i) completing released writes via software to complete a bus cycle in software, a handler must first read the ssw function code field to determine the appropriate address space, then access the fault address point- er on the stack, and then transfer data from the stacked image of the output buffer to the fault address. because the cpu32 has a 16-bit internal data bus, long operands require two bus ac- cesses. a fault during the second access of a long operand causes the lg bit in the ssw to be set. the siz field indicates remaining operand size. if operand coherency is important, the complete operand must be rewritten. after a long operand is rewritten, the rr bit must be cleared. failure to clear the rr bit can cause rte to rerun the bus cycle. following rewrite, it is not necessary to adjust the program counter (or other stack contents) before executing rte. 6.3.2.2 (type i) completing released writes via rte an exception handler can use the rte instruction to complete a faulted bus cycle. when rte executes, the fault address, data output buffer, program counter, and sta- tus register are restored from the stack. any pending breakpoint or trace exceptions, as indicated by tr, b1, and b0 in the stacked ssw, are requeued during ssw resto- ration. the rr bit in the ssw is checked during the unstacking operation ?if it is set, the rw, func, and siz fields are restored and the released write cycle is rerun. to maintain long-word operand coherence, stack contents must be adjusted prior to rte execution. the fault address must be decremented by two if lg is set and siz indicates a remaining byte or word. siz must be set to long. all other fields should be left unchanged. the bus controller uses the modified fault address and siz field to re- run the complete released write cycle manipulating the stacked ssw can cause unpredictable results because rte checks only the rr bit to determine if a bus cycle must be rerun. inadvertent alteration of the control bits could cause the bus cycle to be a read instead of a write, or could cause access to a different address space than the original bus cycle. if the rerun bus cycle is a read, returned data will be ignored. 6.3.2.3 (type ii) correcting faults via rte instructions aborted because of a type ii fault are restarted upon return from the ex- ception handler. a fault handler must establish safe restart conditions. if a fault is caused by a nonresident page in a demand-paged virtual memory configuration, the fault address must be read from the stack, and the appropriate page retrieved. an rte instruction terminates the exception handler. after unstacking the machine state, the instruction is refetched and restarted. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-20 reference manual 6.3.2.4 (type iii) correcting faults via software sufficient information is contained in the stack frame to complete movem in software. after the cause of the fault is corrected, the faulted bus cycle must be rerun. do the following to complete an instruction through software: a. setup for rerun read the movem opcode and extension from locations pointed to by stack frame pc and pc + 2. the effective address need not be recalculated, since the next operand address is saved in the stack frame. however, the opcode ef- fective address field must be examined to determine how to update the address register and program counter when the instruction is complete. adjust the mask to account for operands already transferred. subtract the stacked operand transfer count from 16 to obtain the number of operands trans- ferred. scan the mask using this count value. each time a set bit is found, clear it and decrement the counter. when the count is zero, the mask is ready for use. adjust the operand address. if the predecrement addressing mode is in effect, subtract the operand size from the stacked value; otherwise, add the operand size to the stacked value. b. rerun instruction scan the mask for set bits. read/write the selected register from/to the operand address as each bit is found. as each operand is transferred, clear the mask bit and increment (decrement) the operand address. when all bits in the mask are cleared, all operands have been transferred. if the addressing mode is predecrement or postincrement, update the register to complete the execution of the instruction. if the tr bit is set in the stacked ssw, create a six-word stack frame and ex- ecute the trace handler. if either b1 or b0 in the ssw is set, create another six word stack frame and execute the hardware breakpoint handler. de-allocate the stack and return control to the faulted program. 6.3.2.5 (type iii) correcting faults by conversion and restart in some situations it may be necessary to rerun all the operand transfers for a faulted instruction rather than continue from a faulted operand. clearing the mv bit in the stacked ssw converts a type iii fault into a type ii fault. consequently, movem, like all other type ii exceptions, will be restarted upon return from the exception handler. when a fault occurs after an operand has transferred, that transfer is not ?ndone? however, these memory locations are accessed a second time when the instruction is restarted. if a register used in an effective address calculation is overwritten before a fault occurs, an incorrect effective address is calculated upon instruction restart. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-21 6.3.2.6 (type iii) correcting faults via rte the preferred method of movem bus fault recovery is to correct the cause of the fault and then execute an rte instruction without altering the stack contents. the rte recognizes that movem was in progress when a fault occurred, restores the appropriate machine state, refetches the instruction, repeats the faulted transfer, and continues the instruction. movem is the only instruction continued upon return from an exception handler. al- though the instruction is refetched, the effective address is not recalculated, and the mask is rescanned the same number of times as before the fault ?modifying the code prior to rte can cause unexpected results. 6.3.2.7 (type iv) correcting faults via software berr exceptions can occur during exception processing while the processor is fetch- ing an exception vector or while it is stacking. the same stack frame and ssw are used in both cases, but each has a distinct fault address. the stacked faulted excep- tion format/vector word identifies the type of faulted exception and the contents of the remainder of the frame. a fault address corresponding to the vector specified in the stacked format/vector word indicates that the processor could not obtain the address of the exception handler. a berr exception handler should execute rte after correcting a fault. rte restores the internal machine state, fetches the address of the original exception handler, rec- reates the original exception stack frame, and resumes execution at the exception handler address. if the fault is intractable, the exception handler should rewrite the faulted exception stack frame at sp + $14 + $06 and then jump directly to the original exception handler. the stack frame can be generated from the information in the berr frame: the pre- exception status register (sp + $0c), the format/vector word (sp + $0e), and, if the frame being written is a six-word frame, the program counter of the instruction causing the exception (sp + $10). the return program counter value is available at sp + $02. a stacked fault address equal to the current stack pointer may indicate that, although the first exception received a berr while stacking, the berr exception stacking was successfully completed. this is an extremely improbable occurrence, but the cpu32 supports recovery from it. once the exception handler determines that the fault has been corrected, recovery can proceed as described previously. if the fault cannot be corrected, move the supervisor stack to another area of memory, copy all valid stack frames to the new stack, create a faulted exception frame on top of the stack, and re- sume execution at the exception handler address. 6.4 cpu32 stack frames the cpu32 generates three different stack frames ?the normal four- and six-word frames, and the twelve-word berr stack frame. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-22 reference manual 6.4.1 normal four-word stack frame this stack frame is created by interrupt, format error, trap #n, illegal instruction, a- line and f-line emulator trap, and privilege violation exceptions. depending on the ex- ception type, the program counter value is either the address of the next instruction to be executed or the address of the instruction that caused the exception (see figure 6-3 ). figure 6-3 format $0 ?four-word stack frame 6.4.2 normal six-word stack frame this stack frame (see figure 6-4 ) is created by instruction-related traps, which include chk, chk2, trapcc, trapv, and divide-by-zero, and by trace exceptions. the fault- ed instruction program counter value is the address of the instruction that caused the exception. the next program counter value (the address to which rte returns) is the address of the next instruction to be executed. figure 6-4 format $2 ?six-word stack frame hardware breakpoints also utilize this format. the faulted instruction program counter value is the address of the instruction executing when the breakpoint was sensed. usually this is the address of the instruction that caused the breakpoint, but, because released writes can overlap following instructions, the faulted instruction program counter may point to an instruction following the instruction that caused the breakpoint. the address to which rte returns is the address of the next instruction to be executed 6.4.3 berr stack frame this stack frame is created when a bus cycle fault is detected. the cpu32 berr stack frame differs significantly from the equivalent stack frames of other m68000 family members. the only internal machine state required in the cpu32 stack frame is the bus controller state at the time of the error, and a single register. 15 0 sp ? status register +$02 program counter high program counter low +$06 0 0 0 0 vector offset 15 0 sp ? status register +$02 next instruction program counter high next instruction program counter low +$06 0 0 1 0 vector offset +$08 faulted instruction program counter high faulted instruction program counter low f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 exception processing motorola reference manual 6-23 bus operation in progress at the time of a fault is conveyed by the ssw. the berr stack frame is 12 words in length. there are three variations of the frame, each distinguished by different values in the ssw tp and mv fields. an internal transfer count register appears at location sp + 14 in all bus error stack frames. the register contains an 8-bit microcode revision number, and, for type iii faults, an 8-bit transfer count. register format is shown in figure 6-5 . figure 6-5 internal transfer count register the microcode revision number is checked before a berr stack frame is restored via rte. in a multiprocessor system, this check insures that a processor using stacked information is at the same revision level as the processor that created it. the transfer count is ignored unless the mv bit in the stacked ssw is set. if the mv bit is set, the least significant byte of the internal register is reloaded into the movem transfer counter during rte execution. for faults occurring during normal instruction execution (both prefetches and non- movem operand accesses) ssw [tp:mv] = 00. stack frame format is shown in fig- ure 6-6 . faults that occur during the operand portion of the movem instruction.are identified by ssw [tp:mv] = 01. stack frame format is shown in figure 6-7 . when a bus error occurs during exception processing, ssw [tp:mv] = 10. the frame shown in figure 6-8 is written below the faulting frame. stacking begins at the address pointed to by sp ?6 (sp value is the value before initial stacking on the faulted frame). the frame can have either four or six words, depending on the type of error. four word stack frames do not include the faulted instruction program counter (the internal trans- fer count register is located at sp + $10 and the ssw is located at sp + $12). the fault address of a dynamically sized bus cycle is the address of the upper byte, regardless of the byte that caused the error. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 tp mv 0 tr b1 b0 rr rm in rw lg siz func 15 8 7 0 microcode revision number transfer count f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola exception processing cpu32 6-24 reference manual figure 6-6 format $c ?berr stack for prefetches and operands figure 6-7 format $c ?berr stack on movem operand figure 6-8 format $c ?four- and six-word berr stack 15 0 sp ? status register +$02 return program counter high return program counter low +$06 1 1 0 0 vector offset +$08 faulted address high faulted address low +$0c dbuf high dbuf low +$10 current instruction program counter high current instruction program counter low +$14 internal transfer count register +$16 0 0 special status word 15 0 sp ? status register +$02 return program counter high return program counter low +$06 1 1 0 0 vector offset +$08 faulted address high faulted address low +$0c dbuf high dbuf low +$10 current instruction program counter high current instruction program counter low +$14 internal transfer count register +$16 0 1 special status word 15 0 sp ? status register +$02 next instruction program counter high next instruction program counter low +$06 1 1 0 0 vector offset +$08 faulted address high faulted address low +$0c pre-exception status register faulted exception format/vector word +$10 faulted instruction program counter high (six word frame only) faulted instruction program counter low (six word frame only) +$14 internal transfer count register +$16 0 1 special status word f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-1 section 7 development support all m68000 family members have the following special features that facilitate applica- tions development: trace on instruction execution ?all m68000 processors include an instruction-by- instruction tracing facility to aid in program development. the mc68020, mc68030, and cpu32 can also trace those instructions that change program flow. in trace mode, an exception is generated after each instruction is executed, allow- ing a debugger program to monitor execution of a program under test. see 6.2.10 tracing for more information. breakpoint instruction ?an emulator can insert software breakpoints into target code to indicate when a breakpoint occurs. on the mc68010, mc68020, mc68030, and cpu32, this function is provided via illegal instructions ($4848 $484f) that serve as breakpoint instructions. see 6.2.5 software breakpoints for more information. unimplemented instruction emulation ?when an attempt is made to execute an illegal instruction, an illegal instruction exception occurs. unimplemented instruc- tions (f-line, a-line) utilize separate exception vectors to permit efficient emulation of unimplemented instructions in software. see 6.2.8 illegal or unimplemented instructions for more information. 7.1 cpu32 integrated development support in addition to standard mc68000 family capabilities, the cpu32 has features to sup- port advanced integrated system development. these features include background debug mode, deterministic opcode tracking, hardware breakpoints, and internal visi- bility in a single-chip environment. 7.1.1 background debug mode (bdm) overview microprocessor systems generally provide a debugger, implemented in software, for system analysis at the lowest level. the bdm on the cpu32 is unique because the debugger is implemented in cpu microcode. bdm incorporates a full set of debug options ?registers can be viewed and/or altered, memory can be read or written, and test features can be invoked. a resident debugger simplifies implementation of an in-circuit emulator. in a common setup (see figure 7-1 ), emulator hardware replaces the target system processor. a complex, expensive pod-and-cable interface provides a communication path between target system and emulator. by contrast, an integrated debugger supports use of a bus state analyzer (bsa) for in- circuit emulation. the processor remains in the target system (see figure 7-2 ) and the f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-2 reference manual interface is simplified. the bsa monitors target processor operation and the on-chip debugger controls the operating environment. emulation is much ?loser?to target hardware, and many interfacing problems (i.e., limitations on high-frequency opera- tion, ac and dc parametric mismatches, and restrictions on cable length) are mini- mized. figure 7-1 in-circuit emulator configuration figure 7-2 bus state analyzer configuration 7.1.2 deterministic opcode tracking overview cpu32 function code outputs are augmented by two supplementary signals that mon- itor the instruction pipeline. the instruction fetch (ifetch) output identifies bus cycles in which data is loaded into the pipeline, and signals pipeline flushes. the instruction pipe (ipipe) output indicates when each mid-instruction pipeline advance occurs and when instruction execution begins. these signals allow a bsa to synchronize with in- struction stream activity. refer to 7.3 deterministic opcode tracking for complete information. target system in-circuit emulator target mcu target system bus state analyzer target mcu f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-3 7.1.3 on-chip hardware breakpoint overview an external breakpoint input and an on-chip hardware breakpoint capability permit breakpoint trap on any memory access. off-chip address comparators preclude break- points on internal accesses unless show cycles are enabled. breakpoints on prefetched instructions, which are flushed from the pipeline before execution, are not acknowledged, but operand breakpoints are always acknowledged. acknowledged breakpoints can initiate either exception processing or background debug mode (bdm). see 6.2.6 hardware breakpoints for more information. 7.2 background debug mode (bdm) bdm is an alternate cpu32 operating mode. during bdm, normal instruction execu- tion is suspended, and special microcode performs debugging functions under exter- nal control. figure 7-3 is a bdm block diagram. figure 7-3 bdm block diagram bdm can be initiated in several ways ?by externally generated breakpoints, by inter- nal peripheral breakpoints, by the background (bgnd) instruction, or by catastrophic exception conditions. while in bdm, the cpu32 ceases to fetch instructions via the parallel bus and communicates with the development system via a dedicated, high- speed, spi-type serial command interface. sequencer microcode serial interface bus control irc berr bkpt execution unit ipipe /dso ifetch /dsi data bus berr bkpt /dsclk address bus irb berr bkpt ira berr bkpt freeze f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-4 reference manual 7.2.1 enabling bdm accidentally entering bdm in a non-development environment could lock up the cpu32 since the serial command interface would probably not be available. for this reason, bdm is enabled during reset via the breakpoint (bkpt ) signal. bdm operation is enabled when bkpt is asserted (low), at the rising edge of reset . bdm remains enabled until the next system reset. a high bkpt signal on the trailing edge of reset disables bdm. bkpt is relatched on each rising transition of reset . bkpt is synchronized internally, and must be held low for at least two clock cycles pri- or to negation of reset . bdm enable logic must be designed with special care. if hold time on bkpt extends into the first bus cycle following reset, the bus cycle could inadvertently be tagged with a breakpoint. refer to the system integration module user's manual for timing informa- tion. 7.2.2 bdm sources when bdm is enabled, any of several sources can cause the transition from normal mode to bdm. these sources include external breakpoint hardware, the bgnd in- struction, a double bus fault, and internal peripheral breakpoints. if bdm is not enabled when an exception condition occurs, the exception is processed normally. table 7-1 summarizes the processing of each source for both enabled and disabled cases. as shown in table 7-1 , the bkpt instruction never causes a transition into bdm. 7.2.2.1 external bkpt signal once enabled, bdm is initiated whenever assertion of bkpt is acknowledged. if bdm is disabled, a breakpoint exception (vector $0c) is acknowledged. the bkpt input has the same timing relationship to the data strobe trailing edge as does read cycle data. there is no breakpoint acknowledge bus cycle when bdm is entered. 7.2.2.2 bgnd instruction an illegal instruction, $4afa, is reserved for use by development tools. the cpu32 defines $4afa (bgnd) to be a bdm entry point when bdm is enabled. if bdm is dis- abled, an illegal instruction trap is acknowledged. illegal instruction traps are dis- cussed in 6.2.8 illegal or unimplemented instructions . table 7-1 bdm source summary source bdm enabled bdm disabled bkpt background breakpoint exception double bus fault background halted bgnd instruction background illegal instruction bkpt instruction opcode substitution/ illegal instruction opcode substitution/ illegal instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-5 7.2.2.3 double bus fault the cpu32 normally treats a double bus fault, or two bus faults in succession, as a catastrophic system error, and halts. when this condition occurs during initial system debug (a fault in the reset logic), further debugging is impossible until the problem is corrected. in bdm, the fault can be temporarily bypassed, so that its origin can be iso- lated and eliminated. 7.2.2.4 peripheral breakpoints cpu32 peripheral breakpoints are implemented in the same way as external break- points ?peripherals request breakpoints by asserting the bkpt signal. consult the appropriate peripheral user's manual for additional details on the generation of periph- eral breakpoints. 7.2.3 entering bdm when the processor detects a breakpoint or a double bus fault, or decodes a bgnd instruction, it suspends instruction execution and asserts the freeze output. this is the first indication that the processor has entered bdm. once freeze has been as- serted, the cpu enables the serial communication hardware and awaits a command. the cpu writes a unique value indicating the source of bdm transition into temporary register a (atemp) as part of the process of entering bdm. a user can poll atemp and determine the source (see table 7-2 ) by issuing a read system register command (rsreg). atemp is used in most debugger commands for temporary storage ?it is imperative that the rsreg command be the first command issued after transition into bdm. *special status word (ssw) is described in detail in 6.3 fault recovery . a double bus fault during initial stack pointer/program counter (sp/pc) fetch sequence is distinguished by a value of $ffffffff in the current instruction pc. at no other time will the processor write an odd value into this register. 7.2.4 command execution figure 7-4 summarizes bdm command execution. commands consist of one 16-bit operation word and can include one or more 16-bit extension words. each incoming word is read as it is assembled by the serial interface. the microcode routine corre- sponding to a command is executed as soon as the command is complete. result op- erands are loaded into the output shift register to be shifted out as the next command is read. this process is repeated for each command until the cpu returns to normal operating mode. table 7-2 polling the bdm entry source source atemp [31:16] atemp [15:0] double bus fault ssw* $ffff bgnd instruction $0000 $0001 hardware breakpoint $0000 $0000 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-6 reference manual 7.2.5 background mode registers bdm processing uses three special purpose registers to keep track of program context during development. a description of each follows. 7.2.5.1 fault address register (far) the far contains the address of the faulting bus cycle immediately following a bus or address error. this address remains available until overwritten by a subsequent bus cycle. following a double bus fault, the far contains the address of the last bus cycle. the address of the first fault (if there was one) is not visible to the user. 7.2.5.2 return program counter (rpc) the rpc points to the location where fetching will commence after transition from background mode to normal mode. this register should be accessed to change the flow of a program under development. changing the rpc to an odd value will cause an address error when normal mode prefetching begins. figure 7-4 bdm command execution flowchart yes no continue enter bdm ?assert freeze signal ?wait for command send initial command ?load command register ?enable shift clock ?shift out 17 bits ?disable shift clock execute command ?load: not ready/ response ?perform command ?store results read results/new command ?load command register ?enable shift clock ?shift in/out 17 bits ?disable shift clock ?read result register if results = "not ready" cpu activity development system activity ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-7 7.2.5.3 current instruction program counter (pcc) the pcc holds a pointer to the first word of the last instruction executed prior to tran- sition into background mode. due to instruction pipelining, the instruction pointed to may not be the instruction which caused the transition. an example is a breakpoint on a released write. the bus cycle may overlap as many as two subsequent instructions before stalling the instruction sequencer. a breakpoint asserted during this cycle will not be acknowledged until the end of the instruction executing at completion of the bus cycle. pcc will contain $00000001 if bdm is entered via a double bus fault immedi- ately out of reset. 7.2.6 returning from bdm bdm is terminated when a resume execution (go) or call user code (call) command is received. both go and call flush the instruction pipeline and refetch instructions from the location pointed to by the rpc. the return pc and the memory space referred to by the status register supv bit reflect any changes made during bdm. freeze is negated prior to initiating the first prefetch. upon negation of freeze, the serial subsystem is disabled, and the signals revert to ipipe /ifetch functionality. 7.2.7 serial interface communication with the cpu32 during bdm occurs via a dedicated serial interface, which shares pins with other development features. the bkpt signal becomes the se- rial clock (dsclk); serial input data (dsi) is received on ifetch , and serial output data (dso) is transmitted on ipipe . the serial interface uses a full-duplex synchronous protocol similar to the serial pe- ripheral interface (spi) protocol. the development system serves as the master of the serial link since it is responsible for the generation of dsclk. if dsclk is derived from the cpu32 system clock, development system serial logic is unhindered by the oper- ating frequency of the target processor. operable frequency range of the serial clock is from dc to one-half the processor system clock frequency. the serial interface operates in full-duplex mode ?ata is transmitted and received simultaneously by both master and slave devices. in general, data transitions occur on the falling edge of dsclk and are stable by the following rising edge of dsclk. data is transmitted msb first, and is latched on the rising edge of dsclk. the serial data word is 17 bits wide ?16 data bits and a status/control bit. bit 16 indicates status of cpu-generated messages as shown in table 7-3 . 16 15 0 s/c data field - status control bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-8 reference manual command and data transfers initiated by the development system should clear bit 16. the current implementation ignores this bit; however, motorola reserves the right to use this bit for future enhancements. 7.2.7.1 cpu serial logic cpu serial logic, shown in the left-hand portion of figure 7-5 , consists of transmit and receive shift registers and of control logic that includes synchronization, serial clock generation circuitry, and a received bit counter. figure 7-5 debug serial i/o block diagram table 7-3 cpu generated message encoding bit 16 data message type 0 xxxx valid data transfer 0 ffff command complete; status ok 1 0000 not ready with response; come again 1 0001 berr terminated bus cycle; data invalid 1 ffff illegal command control logic serial in parallel out parallel in serial out execution unit status synchronize microsequencer parallel in serial out serial in parallel out result latch control logic status data dsi dso dsclk serial clock 16 rcv data latch cpu instruction register bus 16 16 command latch data 16 development system 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-9 both dsclk and dsi are synchronized to on-chip clocks, thereby minimizing the chance of propagating metastable states into the serial state machine. data is sam- pled during the high phase of clkout. at the falling edge of clkout, the sampled value is made available to internal logic. if there is no synchronization between cpu32 and development system hardware, the minimum hold time on dsi with respect to dsclk is one full period of clkout. figure 7-6 serial interface timing diagram the serial state machine begins a sequence of events based on the rising edge of the synchronized dsclk (see figure 7-6 ). synchronized serial data is transferred to the input shift register, and the received bit counter is decremented. one-half clock period later, the output shift register is updated, bringing the next output bit to the dso signal. dso changes relative to the rising edge of dsclk and does not necessarily remain stable until the falling edge of dsclk. one clock period after the synchronized dsclk has been seen internally, the updated counter value is checked. if the counter has reached zero, the receive data latch is up- dated from the input shift register. at this same time, the output shift register is reload- ed with the ?ot ready/come again?response. once the receive data latch has been loaded, the cpu is released to act on the new data. response data overwrites the ?ot ready?response when the cpu has completed the current operation. data written into the output shift register appears immediately on the dso signal. in general, this action changes the state of the signal from a high (?ot ready?response status bit) to a low (valid data status bit) logic level. however, this level change only occurs if the command completes successfully. error conditions overwrite the ?ot ready?response with the appropriate response that also has the status bit set. clkout freeze dsclk dsi sample window internal synchronized dsclk internal synchronized dsi dso f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-10 reference manual a user can use the state change on dso to signal hardware that the next serial trans- fer may begin. a time-out of sufficient length to trap error conditions that do not change the state of dso should also be incorporated into the design. hardware interlocks in the cpu prevent result data from corrupting serial transfers in progress. 7.2.7.2 development system serial logic the development system, as the master of the serial data link, must supply the serial clock. however, normal and bdm operations could interact if the clock generator is not properly designed. breakpoint requests are made by asserting bkpt to the low state in either of two ways. the primary method is to assert bkpt during a single bus cycle for which an exception is desired. another method is to assert bkpt , then continue to assert it until the cpu32 responds by asserting freeze. this method is useful for forcing a transi- tion into bdm when the bus is not being monitored. each of these methods requires a slightly different serial logic design to avoid spurious serial clocks. figure 7-7 represents the timing required for asserting bkpt during a single bus cy- cle. figure 7-7 bkpt timing for single bus cycle figure 7-8 depicts the timing of the bkpt /freeze method. in both cases, the serial clock is left high after the final shift of each transfer. this technique eliminates the pos- sibility of accidentally tagging the prefetch initiated at the conclusion of a bdm session. as mentioned previously, all timing within the cpu is derived from the rising edge of the clock; the falling edge is effectively ignored. figure 7-8 bkpt timing for forcing bdm shift_clk force_bgnd bkpt_tag freeze bkpt bkpt_tag freeze shift_clk force_bgnd bkpt f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-11 figure 7-9 represents a sample circuit providing for both bkpt assertion methods. as the name implies, force_bgnd is used to force a transition into bdm by the asser- tion of bkpt . force_bgnd can be a short pulse or can remain asserted until freeze is asserted. once asserted, the set-reset latch holds bkpt low until the first shift_clk is applied. figure 7-9 bkpt /dsclk logic diagram bkpt_tag should be timed to the bus cycles since it is not latched. if extended past the assertion of freeze, the negation of bkpt_tag appears to the cpu32 as the first dsclk. dsclk is the gated serial clock. normally high, it pulses low for each bit to be trans- ferred. at the end of the seventeenth clock period, it remains high until the start of the next transmission. clock frequency is implementation dependent and may range from dc to the maximum specified frequency. although performance considerations might dictate a hardware implementation, software solutions are not precluded, provided se- rial bus timing is maintained. 7.2.8 command set following is a description of the command set available in bdm. 7.2.8.1 command format the following standard bit format is utilized by all bdm commands. operation field: commands are distinguished by the operation field. this 6-bit field provides for a maximum of 64 unique commands. r/w field: direction of operand transfer is specified by this field. when the bit is set, the trans- fer is from cpu to development system. when the bit is clear, data is written to the cpu or to memory from the development system. 15 10 9 8 7 6 5 4 3 2 0 operation 0 r/w op size 0 0 a/d register extension word(s) bkpt /dsclk s1 s2 r q q reset force_bgnd bkpt_tag shift_clk f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-12 reference manual operand size: for sized operations, this field specifies the operand data size. all addresses are expressed as 32-bit absolute values. the size field is encoded as follows: address/data (a/d) field: the a/d field is used by commands that operate on address and data registers. it determines whether the register field specifies a data or address register. one in- dicates an address register; zero, a data register. for other commands, this field may be interpreted differently. register field: in most commands, this field specifies the register number when operating on an address or data register. extension words (as required): at this time, no command requires an extension word to specify fully the operation to be performed, but some commands require extension words for addresses or immediate data. addresses require two extension words because only absolute long addressing is permitted. immediate data can be either one or two words in length ?byte and word data each require a single extension word, long-word data requires two words. both operands and addresses are transferred most significant word first. 7.2.8.2 command sequence diagram a command sequence diagram illustrates the serial bus traffic for each command. each bubble in the diagram represents a single 17-bit transfer across the bus. the top half in each diagram corresponds to the data transmitted by the development system to the cpu; the bottom half corresponds to the data returned by the cpu in response to the development system commands. command and result transactions are over- lapped to minimize latency. figure 7-10 demonstrates the use of command sequence diagrams. the cycle in which the command is issued contains the development system com- mand mnemonic (in this example, read memory location). during the same cycle, the cpu responds with either the lowest order results of the previous command or with a command complete status (if no results were required). during the second cycle, the development system supplies the high-order 16 bits of the memory address. the cpu returns a ?ot ready?response unless the received command was decoded as unimplemented, in which case the response data is the il- legal command encoding. if an illegal command response occurs, the development system should retransmit the command. encoding operand size 00 byte 01 word 10 long 11 reserved f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-13 note the ?ot ready?response can be ignored unless a memory bus cycle is in progress. otherwise, the cpu can accept a new serial transfer with eight system clock periods. in the third cycle, the development system supplies the low-order 16 bits of a memory address. the cpu always returns the ?ot ready?response in this cycle. at the com- pletion of the third cycle, the cpu initiates a memory read operation. any serial trans- fers that begin while the memory access is in progress return the ?ot ready?response. results are returned in the two serial transfer cycles following the completion of mem- ory access. the data transmitted to the cpu during the final transfer is the opcode for the following command. should a memory access generate either a bus or address error, an error status is returned in place of the result data. figure 7-10 command-sequence-diagram example commands transmitted to the cpu command code transmitted during this cycle high-order 16 bits of memory address low-order 16 bits of memory address sequence taken if operation has not completed data unused from this transfer sequence taken if illegal command is received by cpu results from previous command responses from the cpu nonserial-related activity ms addr "not ready" xxx "illegal" ls addr "not ready" next cmd "not ready" read (long) ??? next cmd "not ready" xxx "not ready" xxx berr/aerr ms result next cmd ls result read memory location next command code sequence taken if bus error or address error occurs on memory access high- and low-order 16 bits of result xxx f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-14 reference manual 7.2.8.3 command set summary the bdm command set is summarized in table 7-4 . subsequent paragraphs contain detailed descriptions of each command. table 7-4 bdm command summary command mnemonic description read a/d register rareg/rdreg read the selected address or data register and return the results via the serial interface. write a/d register wareg/wdreg the data operand is written to the specified address or data register. read system register rsreg the specified system control register is read. all registers that can be read in supervisor mode can be read in bdm. write system register wsreg the operand data is written into the specified system control register. read memory location read read the sized data at the memory location specified by the long-word address. the source function code register (sfc) determines the address space accessed. write memory location write write the operand data to the memory location specified by the long-word address. the destination function code register (dfc) register determines the address space accessed. dump memory block dump used in conjunction with the read command to dump large blocks of memory. an initial read is executed to set up the starting address of the block and to retrieve the first result. subsequent operands are retrieved with the dump command. fill memory block fill used in conjunction with the write command to fill large blocks of memory. an initial write is executed to set up the starting address of the block and to supply the first operand. subsequent operands are written with the fill command. resume execution go the pipeline is flushed and refilled before resuming instruction execution at the return pc. call user code call current pc is stacked at the location of the current sp. instruction execution begins at user patch code. reset peripherals rst asserts reset for 512 clock cycles. the cpu is not reset by this command. synonymous with the cpu reset instruction. no operation nop nop performs no operation and may be used as a null command. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-15 7.2.8.4 read a/d register (rareg/rdreg) read the selected address or data register and return the results via the serial inter- face. command format: command sequence: operand data: none result data: the contents of the selected register are returned as a long-word value. the data is returned most significant word first. 7.2.8.5 write a/d register (wareg/wdreg) the operand (long-word) data is written to the specified address or data register. all 32 bits of the register are altered by the write. command format: command sequence: operand data: long-word data is written into the specified address or data register. the data is supplied most significant word first. result data: command complete status ($0ffff) is returned when register write is complete. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 1 0 0 0 0 1 1 0 0 0 a/d register 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 0 0 1 0 0 0 0 0 1 0 0 0 a/d register rdreg/rareg ??? xxx ms result xxx "illegal" next cmd ls result next cmd "not ready" wdreg/wareg ??? ms data xxx "illegal" ls data "not ready" next cmd "not ready" "cmd complete" next cmd "not ready" f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-16 reference manual 7.2.8.6 read system register (rsreg) the specified system control register is read. all registers that can be read in supervi- sor mode can be read in bdm. several internal temporary registers are also accessi- ble. command format: command sequence: operand data: none result data: always returns 32 bits of data, regardless of the size of the register being read. if the register is less than 32 bits, the result is returned zero extended. register field: the system control register is specified by the register field according to the follow- ing table: 7.2.8.7 write system register (wsreg) operand data is written into the specified system control register. all registers that can be written in supervisor mode can be written in bdm. several internal temporary reg- isters are also accessible. command format: 15 14 13 12 11 10 9 8 7 6 5 4 3 0 0 0 1 0 0 1 0 0 1 0 0 0 register system register select code return program counter (rpc) 0000 current instruction program counter (pcc) 0001 status register (sr) 1011 user stack pointer (usp) 1100 supervisor stack pointer (ssp) 1101 source function code register (sfc) 1110 destination function code register (dfc) 1111 temporary register a (atemp) 1000 fault address register (far) 1001 vector base register (vbr) 1010 rsreg ??? xxx ms result xxx "illegal" next cmd ls result next cmd "not ready" f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-17 command sequence: operand data: the data to be written into the register is always supplied as a 32-bit long word. if the register is less than 32 bits, the least significant word is used. result data: ?ommand complete?status is returned when register write is complete. register field: the system control register is specified by the register field according to the follow- ing table. the far is a read-only register ?any write to it is ignored. 7.2.8.8 read memory location (read) read the sized data at the memory location specified by the long-word address. only absolute addressing is supported. the sfc register determines the address space ac- cessed. valid data sizes include byte, word, or long word. command format: command sequence: 15 14 13 12 11 10 9 8 7 6 5 4 3 0 0 0 1 0 0 1 0 0 1 0 0 0 register system register select code return program counter (rpc) 0000 current instruction program counter (pcc) 0001 status register (sr) 1011 user stack pointer (usp) 1100 supervisor stack pointer (ssp) 1101 source function code register (sfc) 1110 destination function code register (dfc) 1111 temporary register a (atemp) 1000 fault address register (far) 1001 vector base register (vbr) 1010 15 14 13 12 11 10 9 8 7 6 5 4 3 0 0 0 0 1 1 0 0 1 op size 0 0 0 0 0 0 ms data xxx "illegal" ls data "not ready" next cmd "not ready" "cmd complete" next cmd wsreg ??? "not ready" f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-18 reference manual operand data: the single operand is the long-word address of the requested memory location. result data: the requested data is returned as either a word or long word. byte data is returned in the least significant byte of a word result, with the upper byte cleared. word re- sults return 16 bits of significant data; long-word results return 32 bits. a successful read operation returns data bit 16 cleared. if a bus or address error is encountered, the returned data is $10001. 7.2.8.9 write memory location (write) write the operand data to the memory location specified by the long-word address. the destination function code (dfc) register determines the address space accessed. only absolute addressing is supported. valid data sizes include byte, word, and long word. command format: command sequence: 15 14 13 12 11 10 9 8 7 6 5 4 3 0 0 0 0 1 1 0 0 0 op size 0 0 0 0 0 0 ms addr "not ready" xxx "illegal" ls addr "not ready" next cmd "not ready" read (b/w) ??? next cmd "not ready" xxx "not ready" next cmd result xxx berr/aerr read memory location ms addr "not ready" xxx "illegal" ls addr "not ready" next cmd "not ready" read (long) ??? next cmd xxx "not ready" ms result xxx berr/aerr read memory location xxx next cmd ls result "not ready" read memory location f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-19 operand data: two operands are required for this instruction. the first operand is a long-word ab- solute address that specifies a location to which the operand data is to be written. the second operand is the data. byte data is transmitted as a 16-bit word, justified in the least significant byte. 16- and 32-bit operands are transmitted as 16 and 32 bits, respectively. result data: successful write operations return a status of $0ffff. bus or address errors on the write cycle are indicated by the assertion of bit 16 in the status message and by a data pattern of $0001. 7.2.8.10 dump memory block (dump) dump is used in conjunction with the read command to dump large blocks of mem- ory. an initial read is executed to set up the starting address of the block and to re- trieve the first result. subsequent operands are retrieved with the dump command. the initial address is incremented by the operand size (1, 2, or 4) and saved in a tem- porary register. subsequent dump commands use this address, increment it by the current operand size, and store the updated address back in the temporary register. next cmd next cmd ms addr "not ready" xxx "illegal" ls addr "not ready" next cmd "not ready" write (b/w) ??? next cmd "not ready" xxx "not ready" xxx berr/aerr "cmd complete" data "not ready" write memory location ms addr "not ready" xxx "illegal" ls addr "not ready" next cmd write (long) ??? ms data "not ready" ls data "not ready" write memory location next cmd "not ready" xxx "not ready" xxx berr/aerr "cmd complete" "not ready" f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-20 reference manual note the dump command does not check for a valid address in the tem- porary register ?dump is a valid command only when preceded by another dump or by a read command. otherwise, the results are undefined. the nop command can be used for inter-command pad- ding without corrupting the address pointer. the size field is examined each time a dump command is given, allowing the operand size to be altered dynamically. command format: command sequence: operand data: none result data: requested data is returned as either a word or long word. byte data is returned in the least significant byte of a word result. word results return 16 bits of significant data; long-word results return 32 bits. status of the read operation is returned as in the read command: $0xxxx for success, $10001 for bus or address errors. 15 14 13 12 11 10 9 8 7 6 5 4 3 0 0 0 0 1 1 1 0 1 op size 0 0 0 0 0 0 dump (long) ??? xxx "not ready" next cmd result xxx berr/aerr xxx "illegal" next cmd "not ready" next cmd "not ready" read memory location dump (b/w) ??? xxx "not ready" ms result xxx berr/aerr xxx "illegal" next cmd "not ready" next cmd "not ready" read memory location next cmd ls result xxx f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-21 7.2.8.11 fill memory block (fill) fill is used in conjunction with the write command to fill large blocks of memory. an initial write is executed to set up the starting address of the block and to supply the first operand. subsequent operands are written with the fill command. the initial address is incremented by the operand size (1, 2, or 4) and is saved in a temporary register. subsequent fill commands use this address, increment it by the current op- erand size, and store the updated address back in the temporary register. note the fill command does not check for a valid address in the tempo- rary register ?fill is a valid command only when preceded by an- other fill or by a write command. otherwise, the results are undefined. the nop command can be used for inter-command pad- ding without corrupting the address pointer. the size field is examined each time a fill command is given, allowing the operand size to be altered dynamically. command format: command sequence: operand data: a single operand is data to be written to the memory location. byte data is trans- mitted as a 16-bit word, justified in the least significant byte; 16- and 32-bit oper- ands are transmitted as 16 and 32 bits, respectively. result data: status is returned as in the write command: $0ffff for a successful operation and $10001 for a bus or address error during write. 15 14 13 12 11 10 9 8 7 6 5 4 3 0 0 0 0 1 1 1 0 0 op size 0 0 0 0 0 0 next cmd "not ready" "not ready" xxx berr/aerr "cmd complete" ms data "not ready" xxx next cmd xxx "illegal" next cmd "not ready" fill (b/w) ??? write memory location next cmd "not ready" xxx "not ready" xxx berr/aerr "cmd complete" next cmd xxx "illegal" next cmd "not ready" fill (long) ??? data "not ready" write memory location ls data "not ready" f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-22 reference manual 7.2.8.12 resume execution (go) the pipeline is flushed and refilled before normal instruction execution is resumed. prefetching begins at the return pc and current privilege level. if either the pc or sr is altered during bdm, the updated value of these registers is used when prefetching commences. note the processor exits bdm when a bus error or address error occurs on the first instruction prefetch from the new pc ?the error is trapped as a normal mode exception. the stacked value of the cur- rent pc may not be valid in this case, depending on the state of the machine prior to entering bdm. for address error, the pc does not reflect the true return pc. instead, the stacked fault address is the (odd) return pc. command format: command sequence: operand data: none result data: none 7.2.8.13 call user code (call) this instruction provides a convenient way to patch user code. the return pc is stacked at the location pointed to by the current sp. the stacked pc serves as a return address to be restored by the rts command that terminates the patch routine. after stacking is complete, the 32-bit operand data is loaded into the pc. the pipeline is flushed and refilled from the location pointed to by the new pc. bdm is exited, and nor- mal mode instruction execution begins. note if a bus error or address error occurs during return address stacking, the cpu returns an error status via the serial interface and remains in bdm. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 go ??? normal mode xxx "illegal" next cmd "not ready" f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-23 if a bus error or address error occurs on the first instruction prefetch from the new pc, the processor exits bdm and the error is trapped as a normal mode exception. the stacked value of the current pc may not be valid in this case, depending on the state of the machine prior to entering bdm. for address error, the pc does not reflect the true return pc. instead, the stacked fault address is the (odd) return pc. command format: command sequence: operand data: the 32-bit operand data is the starting location of the patch routine, which is the initial pc upon exiting bdm. result data: none as an example, consider the following code segment. it is supposed to output a char- acter to an asynchronous communications interface adaptor ?note that the routine fails to check the transmit data register empty (tdre) flag. chkstat: move.b acias,d0 move acia status to d0 beq.b chkstat loop till condition true move.b data,aciad output data missing: andi.b #2,d0 check for tdre rts return to in-line code bdm and the call command can be used to patch the code as follows: 1. breakpoint user program at chkstat 2. enter bdm 3. execute call command to missing 4. exit bdm 5. execute missing code 6. return to user program. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 ls addr "not ready" stack return pc ms addr "not ready" xxx "illegal" next cmd "not ready" call ??? normal mode xxx berr/aerr next cmd "not ready" freeze negated prefetch started f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-24 reference manual 7.2.8.14 reset peripherals (rst) rst asserts reset for 512 clock cycles. the cpu is not reset by this command. this command is synonymous with the cpu reset instruction. command format: command sequence: operand data: none result data: the ?ommand complete?response ($0ffff) is loaded into the serial shifter after negation of reset. 7.2.8.15 no operation (nop) nop performs no operation and may be used as a null command where required. command format: command sequence: operand data: none result data: the ?ommand complete?response ($0ffff) is returned during the next shift op- eration. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 reset ??? assert reset xxx "not ready" xxx "illegal" next cmd "not ready" next cmd "cmd complete" xxx "illegal" "not ready" nop ??? next cmd "cmd complete" next cmd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-25 7.2.8.16 future commands unassigned command opcodes are reserved by motorola for future expansion. all un- used formats within any revision level will perform a nop and return the illegal command response. 7.3 deterministic opcode tracking the cpu32 utilizes deterministic opcode tracking to trace program execution. two signals, ipipe and ifetch, provide all the information required to analyze the opera- tion of the instruction pipeline. 7.3.1 instruction fetch (ifetch ) ifetch indicates which bus cycles are accessing data to fill the instruction pipeline. ifetch is pulse-width modulated to multiplex two indications on a single pin. asserted for a single clock cycle, ifetch indicates that the data from the current bus cycle is to be routed to the instruction pipeline. ifetch held low for two clock cycles indicates that the instruction pipeline has been flushed. the data from the bus cycle is used to begin filling the empty pipeline. both user and supervisor mode fetches are signaled by ifetch . proper tracking of bus cycles via the ifetch signal on a fast bus requires a simple state machine. on a two-clock bus, ifetch may signal a pipeline flush with associat- ed prefetch followed immediately by a second prefetch. that is, ifetch remains as- serted for three clocks, two clocks indicating the flush/fetch and a third clock signaling the second fetch. these two operations are easily discerned if the tracking logic sam- ples ifetch on the two rising edges of clkout, which follow the address strobe (da- ta strobe during show cycles) falling edge. three-clock and slower bus cycles allow time for negation of the signal between consecutive indications and do not experience this operation. 7.3.2 instruction pipe (ipipe ) the internal instruction pipeline can be modeled as a three-stage fifo (see figure 7- 11 ). stage a is an input buffer ?data can be used out of the stages b and c. ipipe signals advances of instructions in the pipeline. instruction register a (ira) holds incoming words as they are prefetched. no decoding takes place in the buffer. instruction register b (irb) provides initial decoding of the opcode and decoding of extension words ?t is a source of immediate data. instruc- tion register c (irc) supplies residual opcode decoding during instruction execution. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-26 reference manual figure 7-11 functional model of instruction pipeline assertion of ipipe for a single clock cycle indicates the use of data from irb. regard- less of the presence of valid data in ira, the contents of irb are invalidated when ipipe is asserted. if ira contains valid data, the data is copied into irb (ira ? irb), and the irb stage is revalidated. assertion of ipipe for two clock cycles indicates the start of a new instruction and sub- sequent replacement of data in irc. this action causes a full advance of the pipeline (irb ? irc and ira ? irb). ira is refilled during the next instruction fetch bus cycle. data loaded into ira propagates automatically through subsequent empty pipeline stages. signals that show the progress of instructions through irb and irc are nec- essary to accurately monitor pipeline operation. these signals are provided by ira and irb validity bits. when a pipeline advance occurs, the validity bit of the stage be- ing loaded is set and the validity bit of the stage supplying the data is negated. because instruction execution is not timed to bus activity, ipipe is synchronized with the system clock and not the bus. figure 7-12 illustrates the timing in relation to the system clock. figure 7-12 instruction pipeline timing diagram ipipe should be sampled on the falling edge of the clock. the assertion of ipipe for a single cycle after one or more cycles of negation indicates use of the data in irb (advance of ira into irb). assertion for two clock cycles indi- cates that a new instruction has started (both ira ? irb and irb ? irc transfers data bus extension words opcodes residual ira irb irc ira ira ipipe extension word used instruction start extension word used instruction start ira ira ira ira irb irc ira ira irb irc clkout f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 development support motorola reference manual 7-27 have occurred). loading irc always indicates that an instruction is beginning execu- tion ?the opcode is loaded into irc by the transfer. in some cases, instructions using immediate addressing begin executing and initiate a second pipeline advance at the same time. ipipe will not be negated between the two indications, which implies the need for a state machine to track the state of ipipe . the state machine can be resynchronized during periods of inactivity on the signal. 7.3.3 opcode tracking during loop mode ipipe and ifetch continue to work normally during loop mode. ifetch indicates all instruction fetches up through the point that data begins recirculating within the in- struction pipeline. ipipe continues to signal the start of instructions and the use of ex- tension words even though data is being recirculated internally. ifetch returns to normal operation with the first fetch after exiting loop mode. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola development support cpu32 7-28 reference manual f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-1 section 8 instruction execution timing this section describes the instruction execution timing of the cpu32. external clock cycles are used to provide accurate execution and operation timing guidelines, but not exact timing for every possible circumstance. this approach is used because exact execution time for an instruction or operation depends on concurrency of independent- ly scheduled resources, on memory speeds, and on other variables. an assembly language programmer or compiler writer can use the information in this section to predict the performance of the cpu32. additionally, timing for exception processing is included so that designers of multitasking or real-time systems can pre- dict task-switch overhead, maximum interrupt latency, and similar timing parameters. instruction timing is given in clock cycles to eliminate clock frequency dependency. 8.1 resource scheduling the cpu32 contains several independently scheduled resources. the organization of these resources within the cpu32 is shown in figure 8? . some variation in instruc- tion execution timing results from concurrent resource utilization. because resource scheduling is not directly related to instruction boundaries, it is impossible to make an accurate prediction of the time required to complete an instruction without knowing the entire context within which the instruction is executing. 8.1.1 microsequencer the microsequencer either executes microinstructions or awaits completion of ac- cesses necessary to continue microcode execution. the microsequencer supervises the bus controller, instruction execution, and internal processor operations such as calculation of effective address and setting of condition codes. it also initiates instruc- tion word prefetches after a change of flow and controls validation of instruction words in the instruction pipeline. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-2 reference manual figure 8? block diagram of independent resources 8.1.2 instruction pipeline the cpu32 contains a two-word instruction pipeline where instruction opcodes are decoded. each stage of the pipeline is initially filled under microsequencer control and subsequently refilled by the prefetch controller as it empties. stage a of the instruction pipeline is a buffer. prefetches completed on the bus before stage b empties are temporarily stored in this buffer. instruction words (instruction op- eration words and all extension words) are decoded at stage b. residual decoding and execution take place in stage c. each pipeline stage has an associated status bit that shows whether the word in that stage was loaded with data from a bus cycle that terminated abnormally. 8.1.3 bus controller resources the bus controller consists of the instruction prefetch controller, the write-pending buffer, and the microbus controller. these three resources transact all reads, writes, and instruction prefetches required for instruction execution. microsequencer and control control store control logic instruction pipeline stage stage c b execution unit program counter section data section write-pending buffer prefetch controller microbus controller address bus data bus bus control signals stage a f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-3 the bus controller and microsequencer operate concurrently. the bus controller can perform a read or write, or schedule a prefetch, while the microsequencer controls ef- fective address calculation or sets condition codes. the microsequencer can also request a bus cycle that the bus controller cannot per- form immediately. when this happens, the bus cycle is queued, and the bus controller runs the cycle when the current cycle is complete. 8.1.3.1 prefetch controller the instruction prefetch controller receives an initial request from the microsequencer to initiate prefetching at a given address. subsequent prefetches are initiated by the prefetch controller whenever a pipeline stage is invalidated, either through instruction completion or through use of extension words. prefetch occurs as soon as the bus is free of operand accesses previously requested by the microsequencer. additional state information permits the controller to inhibit prefetch requests when a change in instruction flow (e.g. a jump or branch instruction) is anticipated. in a typical program, 10 to 25 percent of the instructions causes a change of flow. each time a change occurs, the instruction pipeline must be flushed and refilled from the new instruction stream. if instruction prefetches, rather than operand accesses, were given priority, many instruction words would be flushed unused, and necessary oper- and cycles would be delayed. to maximize available bus bandwidth, the cpu32 will schedule a prefetch only when the next instruction is not a change-of-flow instruction, and when there is room in the pipeline for the prefetch. 8.1.3.2 write-pending buffer the cpu32 incorporates a single-operand write-pending buffer. the buffer permits the microsequencer to continue execution after a request for a write cycle is queued in the bus controller. the time needed for a write at the end of an instruction can overlap the head cycle time for the following instruction, and thus reduce overall execution time. interlocks prevent the microsequencer from overwriting the buffer. 8.1.3.3 microbus controller the microbus controller performs bus cycles issued by the microsequencer. operand accesses always have priority over instruction prefetches. word and byte operands are accessed in a single cpu-initiated bus cycle, although the external bus interface may be required to initiate a second cycle when a word operand is sent to a byte-sized external port. long operands are accessed in two bus cycles, most significant word first. the instruction pipeline is capable of recognizing instructions that cause a change of flow. it informs the bus controller when a change of flow is imminent, and the bus con- troller refrains from starting prefetches that would be discarded due to the change of flow. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-4 reference manual 8.1.4 instruction execution overlap overlap is the time, measured in clock cycles, that an instruction executes concurrent- ly with the previous instruction. as shown in figure 8-2, portions of instructions a and b execute simultaneously, so that total execution time is reduced. because portions of instructions b and c also overlap, overall execution time for all three instructions is also reduced. each instruction contributes to the total overlap time. the portion of execution time at the end of instruction a that can overlap the beginning of instruction b is called the tail of instruction a. the portion of execution time at the beginning of instruction b that can overlap the end of instruction a is called the head of instruction b. the total overlap time between instructions a and b is the smaller tail of a and the head of b. figure 8-2 simultaneous instruction execution the execution time attributed to instructions a, b, and c after considering the overlap is illustrated in figure 8-3. the overlap time is attributed to the execution time of the completing instruction. the following equation shows the method for calculating the overlap time: overlap = min (tail n , head n+1 ) figure 8? attributed instruction times overlap overlap instruction a instruction b instruction c overlap period (absorbed by instruction a) overlap period (absorbed by instruction b) instruction a instruction b instruction c f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-5 8.1.5 effects of wait states the cpu32 access time for on-chip memory and peripherals is two clocks. while two- clock external accesses are possible when the bus is operated in a synchronous mode, a typical external memory speed is three or more clocks. all instruction times listed in this section are for word access only (unless an explicit exception is given), and are based on the assumption that both instruction fetches and operand cycles are to a two-clock memory. any time a long access is made, time for the additional bus cycle(s) must be added to the overall execution time. wait states due to slow external memory must be added to the access time for each bus cycle. a typical application has a mixture of bus speeds ?rogram execution from an off-chip rom, accesses to on-chip peripherals, storage of variables in slow off-chip ram, and accesses to external peripherals with speeds ranging from moderate to very slow. to arrive at an accurate instruction time calculation, each bus access must be individually considered. many instructions have a head cycle count, which can overlap the cycles of an operand fetch to slower memory started by a previous instruction. in these cases, an increase in access time has no effect on the total execution time of the pair of in- structions. to trace instruction execution time by monitoring the external bus, note that the order of operand accesses for a particular instruction sequence is always the same ?pro- vided bus speed is unchanged, the interleaving of instruction prefetches with operands within each sequence is identical. 8.1.6 instruction execution time calculation the overall execution time for an instruction depends on the amount of overlap with previous and following instructions. in order to calculate an instruction time estimate, the entire code sequence must be analyzed. to derive the actual instruction execution times for an instruction sequence, the instruction times listed in the tables must be ad- justed to account for overlap. the formula for this calculation is: c 1 - min (t 1 , h 2 ) + c 2 - min (t 2 , h 3 ) + c 3 - min (t 3 , h 4 ) + .... where: c n is the number of cycles listed for instruction n h n is the head time for instruction n t n is the tail time for instruction n min (t n , h m ) is the minimum of parameters t n and h m f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-6 reference manual the number of cycles for the instruction (c n above), can include one or two effective address calculations in addition to the raw number in the cycles column. in these cas- es, calculate overall instruction time as if it were for multiple instructions, using the fol- lowing equation: cea ? - min (t ea , h op ) + c op where: cea ? is the instruction's effective address time c op is the instruction's operation time h op is the instruction operation's head time t ea is the effective address's tail time min (t n , h m ) is the minimum of parameters t n and h m the overall head for the instruction is the head for the effective address, and the over- all tail for the instruction is the tail for the operation. therefore, the actual equation for execution time becomes: c op1 - min (t op1 , h ea2 ) + cea ? 2 - min (t ea2 , h op2 ) + c op2 - min (t op2 , h ea3 ) + ... every instruction must prefetch to replace itself in the instruction pipe. usually, these prefetches occur during or after an instruction. a prefetch is permitted to begin in the first clock of any indexed effective addressing mode operation. additionally, a prefetch for an instruction is permitted to begin two clocks before the end of an instruction, provided the bus is not being used. if the bus is being used, then the prefetch occurs at the next available time, when the bus would otherwise be idle. 8.1.7 effects of negative tails when the cpu32 changes instruction flow, the instruction decode pipeline must begin refilling before instruction execution can resume. refilling forces a two-clock idle peri- od at the end of the change of flow instruction. this idle period can be used to prefetch an additional word on the new instruction path. because of the stipulation that each instruction must prefetch to replace itself, the con- cept of negative tails has been introduced to account for these free clocks on the bus. on a two-clock bus, it is not necessary to adjust instruction timing to account for the potential extra prefetch. the cycle times of the microsequencer and bus are matched and no additional benefit or penalty is obtained. in the instruction execution time equa- tions, a zero should be used instead of a negative number. negative tails are used to adjust for slower fetches on slower buses. normally, in- creasing the length of prefetch bus cycles directly affects the cycle count and tail val- ues found in the tables. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-7 in the following equations, negative tail values are used to negate the effects of a slow- er bus. the equations are generalized, however, so that they may be used on any speed bus with any tail value. new_tail = old_tail + (new_clock ?2) if ((new_clock ?4) >0) then new_cycle = old_cycle + (new_clock -2) + (new_clock ?4) else new_cycle = old_cycle + (new _clock ?2) where: new_tail/new_cycle is the adjusted tail/cycle at the slower speed old_tail/old_cycle is the value listed in the instruction timing tables new_clock is the number of clocks per cycle at the slower speed note that many instructions listed as having negative tails are change of flow instruc- tions, and that the bus speed used in the calculation is that of the new instruction stream. 8.2 instruction stream timing examples the following programming examples provide a detailed examination of timing effects. in all examples, memory access is either from internal two-clock memory or from ex- ternal synchronous memory, the bus is idle, and the instruction pipeline is full at start. 8.2.1 timing example 1: execution overlap figure 8-4 illustrates execution overlap caused by the bus controller's completion of bus cycles while the sequencer is calculating the next effective address. one clock is saved between instructions, as that is the minimum time of the individual head and tail numbers. instructions move.wa1, (a0) + addq.w#1, (a0) clr.w$30 (a1) figure 8-4 example 1 ?instruction stream write for 1 1 pre- fetch read for 2 write for 2 2 pre- fetch addq to addq.w #1,(ao) ea fetch addq move a1,(ao)+ move.w a1,(ao)+ ea calc clr clr 3 pre- fetch 3 pre- fetch write for 3 clr.w $30(a1) clock 123456789012345678 bus controller instruction controller execution time f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-8 reference manual 8.2.2 timing example 2: branch instructions example 2 shows what happens when a branch instruction is executed, in both the taken and not-taken cases. (refer to figures 8-5 and 8-6). the instruction stream is for a simple limit check with the variable already in a data register. instructions moveq#7, d1 cmp.ld1, d0 ble.bnext move.ld1, (a0) figure 8-5 example 2 ?branch taken figure 8-6 example 2 ?branch not taken 12345678901234 clock bus controller instruction controller execution time 1 pre- fetch cmp d1,d0 2 pre- fetch write for 3 cmp moveq moveq #7,d1 ble.b not taken offset calc next inst. pre- fetch pre- fetch pre- fetch taken taken taken 1 pre- fetch cmp d1,d0 moveq moveq #7,d1 ble.b not taken offset calc write for 4 3 pre- fetch 4 pre- fetch not taken write for 4 move to (a0) move.l d1,(ao) cmp 2 pre- fetch 12345678901234 clock bus controller instruction controller execution time f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-9 8.2.3 timing example 3: negative tails this example (figure 8-7) shows how to use negative tail figures for branches and oth- er change-of-flow instructions. in this example, bus speed is assumed to be four clocks per access. instruction three is at the branch destination. instructions moveq#7, d1 bra.wfaraway move.ld1, d0 although the cpu32 has a two-word instruction pipeline, internal delay causes mini- mum branch instruction time to be three bus cycles. the negative tail is a reminder that an extra two clocks are available for prefetching a third word on a fast bus ?on a slow- er bus, there is no extra time for the third word. figure 8-7 example 3 ?branch negative tail example 3 illustrates three different aspects of instruction time calculation: the branch instruction does not attempt to prefetch beyond the minimum number of words needed for itself. the negative tail allows execution to begin sooner than would a three-word pipeline. there is a one-clock delay due to late arrival of the displacement at the cpu. only changes of flow require negative tail calculation, but the concept can be gener- alized to any instruction ?only two words are required to be in the pipeline, but up to three words may be present. when there is an opportunity for an extra prefetch, it is made. a prefetch to replace an instruction can begin ahead of the instruction, resulting in a faster processor. instruction controller moveq offset calc 9 branch offset bra.w faraway taken taken fetch move.l fetch next instruction prefetch move to d0 move.l d1,d0 moveq #7,d1 clock 123456789012345678 bus controller execution time f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-10 reference manual 8.3 instruction timing tables the following assumptions apply to the times shown in the tables in this section: ? a 16-bit data bus is used for all memory accesses. ? memory access times are based on two clock bus cycles with no wait states. ? the instruction pipeline is full at the beginning of the instruction and is refilled by the end of the instruction. three values are listed for each instruction and addressing mode: head the number of cycles available at the beginning of an instruction to com- plete a previous instruction write or to perform a prefetch. tail the number of cycles an instruction uses to complete a write. cycles four numbers per entry, three contained in parentheses. the outer number is the minimum number of cycles required for the in- struction to complete. numbers within the parentheses represent the number of bus accesses performed by the instruction. the first number is the number of operand read accesses performed by the instruction. the second number is the number of instruction fetches performed by the instruction, including all prefetches that keep the instruction and the instruction pipeline filled. the third number is the number of write accesses performed by the in- struction. as an example, consider an add.l (12, a3, d7.w * 4), d2 instruction. section 8.3.5 arithmetic/logic instructions shows that the instruction has a head = 0, a tail = 0, and cycles = 2 (0/1/0). however, in indexed, address register indirect ad- dressing mode, additional time is required to fetch the effective address. section 8.3.1 fetch effective address gives addressing mode data. for (d 8 , an, xn.sz * scale), head = 4, tail = 2, cycles = 8 (2/1/0). because this example is for a long access and the fea table lists data for word accesses, add two clocks to the tail and to the number of cycles (??table notation), to obtain head = 4, tail = 4, cycles = 10 (2/ 1/0). assuming that no trailing write exists from the previous instruction, effective address calculation requires six clocks. replacement fetch for the effective address occurs during these six clocks, leaving a head of four. if there is no time in the head to perform a prefetch, due to a previous trailing write, then additional time to do the prefetches must be allotted in the middle of the instruction or after the tail. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-11 the total number of bus-activity clocks is: (2 reads 2 clocks/read) + (1 instruction access 2 clocks/access) + (0 writes 2 clocks/write) = 6 clocks of bus activity the number of internal clocks (not overlapped by bus activity) is: 10 clocks total - 6 clocks bus activity = 4 internal clocks memory read requires two bus cycles at two clocks each. this read time, implied in the tail figure for the effective address, cannot be overlapped with the instruction be- cause the instruction has a head of zero. an additional two clocks are required for the add instruction itself. the total is 6 + 4 + 2 = 12 clocks. if bus cycles take more time (i.e., the memory is off- chip), add an appropriate number of clocks to each memory access. the instruction sequence move.l d0, (a0) followed by lsl.l #7, d2 provides an ex- ample of overlapped execution. the move instruction has a head of zero and a tail of four, because it is a long write. the lsl instruction has a head of four. the trailing write from the move overlaps the lsl head completely. thus, the two-instruction se- quence has a head of zero and a tail of zero, and a total execution of eight rather than 12 clocks. general observations regarding calculation of execution time are as follows: any time the number of bus cycles is listed as ?? substitute a value of one for byte and word cycles and a value of two for long cycles. for long bus cycles, usually add a value of two to the tail. the time calculated for an instruction on a three-clock (or longer) bus is usually longer than the actual execution time. all times shown are for two-clock bus cycles. if the previous instruction has a negative tail, then a prefetch for the current instruc- tion can begin during the execution of that previous instruction. certain instructions requiring an immediate extension word (immediate word effec- tive address, absolute word effective address, address register indirect with dis- placement effective address, conditional branches with word offsets, bit operations, lpstop, tbl, movem, movec, moves, movep, mul.l, div.l, chk2, cmp2, and dbcc) are not permitted to begin until the extension word has been in the instruction pipeline for at least one cycle. this does not apply to long offsets or displacements. total number of clocks number of read cycles number of instruction access cycles number of write cycles 10 2 1 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-12 reference manual 8.3.1 fetch effective address the fetch effective address table indicates the number of clock periods needed for the processor to calculate and fetch the specified effective address. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. notes: 1. the read of the effective address and replacement fetches overlap the head of the operation by the amount specified in the tail. 2. size and scale of the index register do not affect execution time. 3. the program counter may be substituted for the base address register an. 4. when adjusting the prefetch time for slower buses, extra clocks may be subtracted from the head until the head reaches zero, at which time additional clocks must be added to both the tail and cycle counts. instruction head tail cycles notes dn 0(0/0/0) an 0(0/0/0) (an) 1 1 3(x/0/0) 1 (an) + 1 1 3(x/0/0) 1 - (an) 2 2 4(x/0/0) 1 (d 16 ,an) or (d 16 ,pc) 1 3 5(x/1/0) 1,3 (xxx).w 1 3 5(x/1/0) 1 (xxx).l 1 5 7(x/2/0) 1 # data ? .b 1 1 3(0/1/0) 1 # data ? .w 1 1 3(0/1/0) 1 # data ? .l 1 3 5(0/2/0) 1 (d 8 ,an,xn.sz * sc) or (d 8 ,pc,xn.sz * sc) 4 2 8(x/1/0) 1,2,3,4 (0) (all suppressed) 2 2 6(x/1/0) 1,4 (d 16 ) 1 3 7(x/2/0) 1,4 (d 32 ) 1 5 9(x/3/0) 1,4 (an) 1 1 5(x/1/0) 1,2,4 (xm.sz * sc) 4 2 8(x/1/0) 1,2,4 (an,xm.sz * sc) 4 2 8(x/1/0) 1,2,3,4 (d 16 ,an) or (d 16 ,pc) 1 3 7(x/2/0) 1,3,4 (d 32 ,an) or (d 32 ,pc) 1 5 9(x/3/0) 1,3,4 (d 16 ,an,xm) or (d 16 ,pc,xm) 2 2 8(x/2/0) 1,3,4 (d 32 ,an,xm) or (d 32 ,pc,xm) 1 3 9(x/3/0) 1,3,4 (d 16 ,an,xm.sz * sc) or (d 16 ,pc,xm.sz * sc) 2 2 8(x/2/0) 1,2,3,4 (d 32 ,an,xm.sz * sc) or (d 32 ,pc,xm.sz * sc) 1 3 9(x/3/0) 1,2,3,4 x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-13 8.3.2 calculate effective address the calculate effective address table indicates the number of clock periods needed for the processor to calculate a specified effective address. the timing is equivalent to fetch effective address except there is no read cycle. the tail and cycle time are re- duced by the amount of time the read would occupy. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. notes: 1. replacement fetches overlap the head of the operation by the amount specified in the tail. 2. size and scale of the index register do not affect execution time. 3. the program counter may be substituted for the base address register an. 4. when adjusting the prefetch time for slower buses, extra clocks may be subtracted from the head until the head reaches zero, at which time additional clocks must be added to both the tail and cycle counts. instruction head tail cycles notes dn 0(0/0/0) an 0(0/0/0) (an) 1 0 2(0/0/0) (an) + 1 0 2(0/0/0) - (an) 2 0 2(0/0/0) (d 16 ,an) or (d 16 ,pc) 1 1 3(0/1/0) 1,3 (xxx).w 1 1 3(0/1/0) 1 (xxx).l 1 3 5(0/2/0) 1 (d 8 ,an,xn.sz * sc) or (d 8 ,pc,xn.sz * sc) 4 0 6(0/1/0) 2,3,4 (0) (all suppressed) 2 0 4(0/1/0) 4 (d 16 ) 1 1 5(0/2/0) 1,4 (d 32 ) 1 3 7(0/3/0) 1,4 (an) 1 0 4(0/1/0) 4 (xm.sz * sc) 4 0 6(0/1/0) 2,4 (an,xm.sz * sc) 4 0 6(0/1/0) 2,4 (d 16 ,an) or (d 16 ,pc) 1 1 5(0/2/0) 1,3,4 (d 32 ,an) or (d 32 ,pc) 1 3 7(0/3/0) 1,3,4 (d 16 ,an,xm) or (d 16 ,pc,xm) 2 0 6(0/2/0) 3,4 (d 32 ,an,xm) or (d 32 ,pc,xm) 1 1 7(0/3/0) 1,3,4 (d 16 ,an,xm.sz * sc) or (d 16 ,pc,xm.sz * sc) 2 0 6(0/2/0) 2,3,4 (d 32 ,an,xm.sz * sc) or (d 32 ,pc,xm.sz * sc) 1 1 7(0/3/0) 1,2,3,4 x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-14 reference manual 8.3.3 move instruction the move instruction table indicates the number of clock periods needed for the pro- cessor to calculate the destination effective address and to perform a move or movea instruction. for entries with cea or fea, refer to the appropriate table to cal- culate that portion of the instruction time. destination effective addresses are divided by their formats (refer to 3.4.4 effective address encoding summary ). the total number of clock cycles is outside the paren- theses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. when using this table, begin at the top and move downward. use the first entry that matches both source and destination addressing modes. note: for instructions not explicitly listed, use the move cea ? , fea ? entry. the source effective address is calculated by the calculate effective address table, and the destination effective address is calculated by the fetch effective address table, even though the bus cycle is for the source effective address. 8.3.4 special-purpose move instruction the special-purpose move instruction table indicates the number of clock periods needed for the processor to fetch, calculate, and perform the special-purpose move operation on control registers or a specified effective address. footnotes indicate when to account for the appropriate effective address times. the total number of clock cycles is outside the parentheses. the numbers inside parenthe- ses (r/p/w) are included in the total clock cycle number. all timing data assumes two- clock reads and writes. instruction head tail cycles move rn, rn 0 0 2(0/1/0) move fea ? , rn 0 0 2(0/1/0) move rn, (am) 0 2 4(0/1/x) move rn, (am) + 1 1 5(0/1/x) move rn, - (am) 2 2 6(0/1/x) move rn, cea ? 1 3 5(0/1/x) move fea, (an) 2 2 6(0/1/x) move fea ? , (an) + 2 2 6(0/1/x) move fea ? , - (an) 2 2 6(0/1/x) move #, cea ? 2 2 6(0/1/x) * move cea ? , fea ? 2 2 6(0/1/x) x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. * an # fetch effective address time must be added for this instruction: fea ? + cea ? + oper ? f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-15 note: the moves instruction has an additional a save step which other instructions do not have. to calculate total the instruction time, calculate the save, the effective address, and the operation execution times, and combine in the order listed, using the equations given in 8.1.6 instruction execution time calculation . 8.3.5 arithmetic/logic instructions the arithmetic/logic instruction table indicates the number of clock periods needed to perform the specified arithmetic/logical instruction using the specified addressing mode. footnotes indicate when to account for the appropriate effective address times. the total number of clock cycles is outside the parentheses. the numbers inside pa- rentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. instruction head tail cycles exg rn, rm 2 0 4(0/1/0) movec cr, rn 10 0 14(0/2/0) movec rn, cr 12 0 14-16(0/1/0) move ccr, dn 2 0 4(0/1/0) move ccr, cea ? 0 2 4(0/1/1) move dn, ccr 2 0 4(0/1/0) move fea ? , ccr 0 0 4(0/1/0) move sr, dn 2 0 4(0/1/0) move sr, cea ? 0 2 4(0/1/1) move dn, sr 4 - 2 10(0/3/0) move fea ? , sr 0 - 2 10(0/3/0) movem.w cea ? , rl 1 0 8 + n * 4 (n + 1, 2, 0) 1 movem.w rl, cea ? 10 8 + n * 4 (0, 2, n) 1 movem.l cea ? , rl 1 0 12 + n * 4(2n + 2, 2, 0) movem.l rl, cea ? 1210 + n ?4 (0, 2, 2n) movep.w dn, (d 16 , an) 2 0 10(0/2/2) movep.w (d 16 , an), dn 1 2 11(2/2/0) movep.l dn, (d 16 , an) 2 0 14(0/2/4) movep.l (d 16 , an), dn 1 2 19(4/2/0) moves (save) cea ? , rn 1 1 3(0/1/0) moves (op) cea ? , rn 7 1 11(x/1/0) moves (save) rn, cea ? 1 1 3(0/1/0) moves (op) rn, cea ? 9 2 12(0/1/x) move usp, an 0 0 2(0/1/0) move an, usp 0 0 2(0/1/0) swap dn 4 0 6(0/1/0) x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. 1 each bus cycle may take up to four clocks without increasing total execution time. cr = control registers usp, vbr, sfc, and dfc n = number of registers to transfer rl = register list < = maximum time ?certain data or mode combinations may execute faster. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-16 reference manual * these instructions have an additional save operation that other instructions do not have. to calculate total instruction time, calculate save, ea ? , and operation execution times, then combine in the order shown, using equations in 8.1.6 instruction execution time calculation . a save operation is not run for long word divide and multiply instructions when fea ? = dn, instruction head tail cycles add(a) rn, rm 0 0 2(0/1/0) add(a) fea ? , rn 0 0 2(0/1/0) add dn, fea ? 0 3 5(0/1/x) and dn, dm 0 0 2(0/1/0) and fea ? , dn 0 0 2(0/1/0) and dn, fea ? 0 3 5(0/1/x) eor dn, dm 0 0 2(0/1/0) eor dn, fea ? 0 3 5(0/1/x) or dn, dm 0 0 2(0/1/0) or fea ? , dn 0 0 2(0/1/0) or dn, fea ? 0 3 5(0/1/x) sub(a) rn, rm 0 0 2(0/1/0) sub(a) fea ? , rn 0 0 2(0/1/0) sub dn, fea ? 0 3 5(0/1/x) cmp(a) rn, rm 0 0 2(0/1/0) cmp(a) fea ? , rn 0 0 2(0/1/0) cmp2 (save) * fea ? , rn 1 1 3(0/1/0) cmp2 (op) fea ? , rn 2 0 16 - 18(x/1/0) mul(s/u).w fea ? , dn 0 0 26(0/1/0) mul(s/u).l (save) * fea ? , dn 1 1 3(0/1/0) mul(s/u).l (op) fea ? , dl 2 0 46 - 52(0/1/0) mul(s/u).l (op) fea ? , dn:dl 2 0 46(0/1/0) divu.w fea ? , dn 0 0 32(0/1/0) divs.w fea ? , dn 0 0 42(0/1/0) divu.l (save) * fea ? , dn 1 1 3(0/1/0) divu.l (op) fea ? , dn 2 0 <46(0/1/0) divs.l (save) * fea ? , dn 1 1 3(0/1/0) divs.l (op) fea ? , dn 2 0 <62(0/1/0) tbl(s/u) dn:dm, dp 26 0 28-30(0/2/0) tbl(s/u) (save) * cea ? , dn 1 1 3(0/1/0) tbl(s/u) (op) cea ? , dn 6 0 33-35(2x/1/0) tblsn dn:dm, dp 30 0 30-34(0/2/0) tblsn (save) * cea ? , dn 1 1 3(0/1/0) tblsn (op) cea ? , dn 6 0 35-39(2x/1/0) tblun dn:dm, dp 30 0 34-40(0/2/0) tblun (save) * cea ? , dn 1 1 3(0/1/0) tblun (op) cea ? , dn 6 0 39-45(2x/1/0) x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. < = maximum time; certain data or mode combinations may execute faster. su = the execution time is identical for signed or unsigned operands. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-17 8.3.6 immediate arithmetic/logic instructions the immediate arithmetic/logic instruction table indicates the number of clock periods needed for the processor to fetch the source immediate data value and to perform the specified arithmetical/logical instruction using the specified addressing mode. foot- notes indicate when to account for the appropriate fetch effective or fetch immediate effective address times. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. instruction head tail cycles moveq #, dn 0 0 2(0/1/0) addq #, rn 0 0 2(0/1/0) addq #, fea ? 0 3 5(0/1/x) subq #, rn 0 0 2(0/1/0) subq #, fea ? 0 3 5(0/1/x) addi #, rn 0 0 2(0/1/0) * addi #, fea ? 0 3 5(0/1/x) * andi #, rn 0 0 2(0/1/0) * andi #, fea ? 0 3 5(0/1/x) * eori #, rn 0 0 2(0/1/0) * eori #, fea ? 0 3 5(0/1/x) * ori #, rn 0 0 2(0/1/0) * ori #, fea ? 0 3 5(0/1/x) * subi #, rn 0 0 2(0/1/0) * subi #, fea ? 0 3 5(0/1/x) * cmpi #, rn 0 0 2(0/1/0) * cmpi #, fea ? 0 3 5(0/1/x) * x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. * an # fetch effective address time must be added for this instruction: fea ? + fea ? + oper ?. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-18 reference manual 8.3.7 binary-coded decimal and extended instructions the binary-coded decimal and extended instruction table indicates the number of clock periods needed for the processor to perform the specified operation using the specified addressing mode. no additional tables are needed to calculate total effective execution time for these instructions. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. 8.3.8 single operand instructions the single operand instruction table indicates the number of clock periods needed for the processor to perform the specified operation using the specified addressing mode. the total number of clock cycles is outside the parentheses. the numbers inside pa- rentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. instruction head tail cycles abcd dn, dm 2 0 4(0/1/0) abcd - (an), - (am) 2 2 12(2/1/1) sbcd dn, dm 2 0 4(0/1/0) sbcd - (an), - (am) 2 2 12(2/1/1) addx dn, dm 0 0 2(0/1/0) addx - (an), - (am) 2 2 10(2/1/1) subx dn, dm 0 0 2(0/1/0) subx - (an), - (am) 2 2 10(2/1/1) cmpm (an)+, (am)+ 1 0 8(2/1/0) instruction head tail cycles clr dn 0 0 2(0/1/0) clr cea ? 0 2 4(0/1/x) neg dn 0 0 2(0/1/0) neg fea ? 0 3 5(0/1/x) negx dn 0 0 2(0/1/0) negx fea ? 0 3 5(0/1/x) not dn 0 0 2(0/1/0) not fea ? 0 3 5(0/1/x) ext dn 0 0 2(0/1/0) nbcd dn 2 0 4(0/1/0) nbcd fea ? 0 2 6(0/1/1) scc dn 2 0 4(0/1/0) scc cea ? 2 2 6(0/1/1) tas dn 4 0 6(0/1/0) tas cea ? 1 0 10(0/1/1) tst fea ? 0 0 2(0/1/0) x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-19 8.3.9 shift/rotate instructions the shift/rotate instruction table indicates the number of clock periods needed for the processor to perform the specified operation on the given addressing mode. footnotes indicate when to account for the appropriate effective address times. the number of bits shifted does not affect the execution time, unless noted. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are includ- ed in the total clock cycle number. all timing data assumes two-clock reads and writes. notes: 1. head and cycle times can be calculated as follows: max (3 + (n/4) + mod(n,4) + mod (((n/4) + mod (n,4) + 1,2), 6) or derived from the following table. 2. head and cycle times are calculated as follows: (count 63): max (3 + n + mod (n + 1,2), 6). 3. head and cycle times are calculated as follows: (count 8): max (2 + n + mod (n,2), 6). d = direction (left or right) instruction head tail cycles note lsd dn, dm - 2 0 (0/1/0) 1 lsd #, dm 4 0 6(0/1/0) lsd fea ? 0 2 6(0/1/1) asd dn, dm - 2 0 (0/1/0) 1 asd #, dm 4 0 6(0/1/0) asd fea ? 0 2 6(0/1/1) rod dn, dm - 2 0 (0/1/0) 1 rod #, dm 4 0 6(0/1/0) rod fea ? 0 2 6(0/1/1) roxd dn, dm - 2 0 (0/1/0) 2 roxd #, dm - 2 0 (0/1/0) 3 roxd fea ? 0 2 6(0/1/1) clocks shift counts 6 01234568912 8 7 10 11 13 14 16 17 20 10 15 18 19 21 22 24 25 28 12 23 26 27 29 30 32 33 36 14 31 34 35 37 38 40 41 44 16 39 42 43 45 46 48 49 52 18 47 50 51 53 54 56 57 60 20 55 58 59 61 62 22 63 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-20 reference manual 8.3.10 bit manipulation instructions the bit manipulation instruction table indicates the number of clock periods needed for the processor to perform the specified operation on the given addressing mode. the total number of clock cycles is outside the parentheses. the numbers inside parenthe- ses (r/p/w) are included in the total clock cycle number. all timing data assumes two- clock reads and writes. * an # fetch effective address time must be added for this instruction: fea ? + fea ? + oper ? 8.3.11 conditional branch instructions the conditional branch instruction table indicates the number of clock periods needed for the processor to perform the specified branch on the given branch size, with com- plete execution times given. no additional tables are needed to calculate total effective execution time for these instructions. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. *in loop mode instruction head tail cycles bchg #, dn 2 0 6(0/2/0) * bchg dn, dm 4 0 6(0/1/0) bchg #, fea ? 1 2 8(0/2/1) * bchg dn, fea ? 2 2 8(0/1/1) bclr #, dn 2 0 6(0/2/0) * bclr dn, dm 4 0 6(0/1/0) bclr #, fea ? 1 2 8(0/2/1) * bclr dn, fea ? 2 2 8(0/1/1) bset #, dn 2 0 6(0/2/0) * bset dn, dm 4 0 6(0/1/0) bset #, fea ? 1 2 8(0/2/1) * bset dn, fea ? 2 2 8(0/1/1) btst #, dn 2 0 4(0/2/0) * btst dn, dm 2 0 4(0/1/0) btst #, fea ? 1 0 4(0/2/0) * btst dn, fea ? 2 0 8(0/1/0) instruction head tail cycles bcc (taken) 2 - 2 8(0/2/0) bcc.b (not taken) 2 0 4(0/1/0) bcc.w (not taken) 0 0 4(0/2/0) bcc.l (not taken) 0 0 6(0/3/1) dbcc (t, not taken) 1 1 4(0/2/0) dbcc (f, - 1, not taken) 2 0 6(0/2/0) dbcc (f, not - 1, taken) 6 - 2 10(0/2/0) dbcc (t, not taken) 4 0 6(0/1/0) * dbcc (f, - 1, not taken) 6 0 8(0/1/0) * dbcc (f, not - 1, taken) 6 0 10(0/0/0) * f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 instruction execution timing motorola reference manual 8-21 8.3.12 control instructions the control instruction table indicates the number of clock periods needed for the pro- cessor to perform the specified operation on the given addressing mode. footnotes indicate when to account for the appropriate effective address times. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. note: the chk2 instruction involves a save step which other instructions do not have. to calculate total the instruction time, calculate the save, the effective address, and the operation execution times, and combine in the order listed, using the equations given in 8.1.6 instruction execution time calculation . 8.3.13 exception-related instructions and operations the exception-related instructions and operations table indicates the number of clock periods needed for the processor to perform the specified exception-related actions. no additional tables are needed to calculate total effective execution time for these in- structions. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are included in the total clock cycle number. all timing data assumes two-clock reads and writes. instruction head tail cycles andi #, sr 0 - 2 12(0/2/0) eori #, sr 0 - 2 12(0/2/0) ori #, sr 0 - 2 12(0/2/0) andi #, ccr 2 0 6(0/2/0) eori #, ccr 2 0 6(0/2/0) ori #, ccr 2 0 6(0/2/0) bsr.b 3 - 2 13(0/2/2) bsr.w 3 - 2 13(0/2/2) bsr.l 1 - 2 13(0/2/2) chk fea ? , dn (no ex) 2 0 8(0/1/0) chk fea ? , dn (ex) 2 - 2 42(2/2/6) chk2 (save) fea ? , dn (no ex) 1 1 3(0/1/0) chk2 (op) fea ? , dn (no ex) 2 0 18(x/0/0) chk2 (save) fea ? , dn (ex) 1 1 3(0/1/0) chk2 (op) fea ? , dn (ex) 2 - 2 52(x + 2/1/6) jmp cea ? 0 - 2 6(0/2/0) jsr cea ? 3 - 2 13(0/2/2) lea cea ? , an 0 0 2(0/1/0) link.w an, # 2 0 10(0/2/2) link.l an, # 0 0 10(0/3/2) nop 0 0 2(0/1/0) pea cea ? 0 0 8(0/1/2) rtd # 1 - 2 12(2/2/0) rtr 1 - 2 14(3/2/0) rts 1 - 2 12(2/2/0) unlk an 1 0 9(2/1/0) x = there is one bus cycle for byte and word operands and two bus cycles for long operands. for long bus cycles, add two clocks to the tail and to the number of cycles. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola instruction execution timing cpu32 8-22 reference manual * minimum interrupt acknowledge cycle time is assumed to be three clocks. note: the f-line (second word illegal) operation involves a save step which other operations do not have. to calculate, total the operation time, calculate the save, then calculate effective address and the operation execution times. combine in the order listed, using the equations given in 8.1.6 instruction execution time calculation . 8.3.14 save and restore operations the save and restore operations table indicates the number of clock periods needed for the processor to perform the specified state save or return from exception. com- plete execution times and stack length are given. no additional tables are needed to calculate total effective execution time for these instructions. the total number of clock cycles is outside the parentheses. the numbers inside parentheses (r/p/w) are includ- ed in the total clock cycle number. all timing data assumes two-clock reads and writes. instruction head tail cycles bkpt (acknowledged) 0 0 14(1/0/0) bkpt (bus error) 0 - 2 35(3/2/4) breakpoint (acknowledged) 0 0 10(1/0/0) breakpoint (bus error) 0 - 2 42(3/2/6) interrupt 0 - 2 30(3/2/4) * reset 0 0 518(0/1/0) stop 2 0 12(0/1/0) lpstop 3 - 2 25(0/3/1) divide-by-zero 0 - 2 36(2/2/6) trace 0 - 2 36(2/2/6) trap # 4 - 2 29(2/2/4) illegal 0 - 2 25(2/2/4) a-line 0 - 2 25(2/2/4) f-line (first word illegal) 0 - 2 25(2/2/4) f-line (second word illegal) ea = rn 1 - 2 31(2/3/4) f-line (second word illegal) ea 1 rn (save) 1 1 3(0/1/0) f-line (second word illegal) ea 1 rn (op) 4 -2 29(2/2/4) privileged 0 - 2 25(2/2/4) trapcc (trap) 2 - 2 38(2/2/6) trapcc (no trap) 2 0 4(0/1/0) trapcc.w (trap) 2 - 2 38(2/2/6) trapcc.w (no trap) 0 0 4(0/2/0) trapcc.l (trap) 0 - 2 38(2/2/6) trapcc.l (no trap) 0 0 6(0/3/0) trapv (trap) 2 - 2 38(2/2/6) trapv (no trap) 2 0 4(0/1/0) instruction head tail cycles berr on instruction 0 - 2 < 58(2/2/12) berr on exception 0 - 2 48(2/2/12) rte (four-word frame) 1 - 2 24(4/2/0) rte (six-word frame) 1 - 2 26(4/2/0) rte (berr on instruction) 1 - 2 50(12/12/y) rte (berr on four-word frame) 1 - 2 66(10/2/4) rte (berr on six-word frame) 1 - 2 70(12/2/6) < = maximum time is indicated ?certain data or mode combinations execute faster. y = if a bus error occurred during a write cycle, the cycle is rerun by the rte. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 m68000 family summary motorola reference manual a-1 appendix am68000 family summary appendix a summarizes the characteristics of the microprocessors in the m68000 family. the m68000 user? manual includes more detailed information about the mc68000 and mc68010 differences. *three-word cache for the loop mode virtual memory/machine mc68000 none mc68010 bus error detection, instruction continuation cpu32 bus error detection, instruction restart mc68020 bus error detection, instruction continuation coprocessor interface mc68000 emulated in software mc68010 emulated in software cpu32 emulated in software mc68020 in microcode word/long-word data alignment mc68000 word/long-word data, instructions, and stack must be word aligned mc68010 word/long-word data, instructions, and stack must be word aligned cpu32 word/long-word data, instructions, and stack must be word aligned mc68020 only instructions must be word aligned (data alignment im- proves performance) control registers mc68000 none mc68010 sfc, dfc, vbr cpu32 sfc, dfc, vbr mc68020 sfc, dfc, vbr, cacr, caar stack pointers mc68000 mc68010 cpu32 mc68020 data bus size (bits) 1 6 1 6 8, 16 8, 16, 32 address bus size (bits) 24 24 24 32 instruction cache (in words) 3* 3* 128 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola m68000 family summary cpu32 a-2 reference manual mc68000 usp, ssp mc68010 usp, ssp cpu32 usp, ssp mc68020 usp, ssp (msp, isp) status register bits mc68000 t, s, i0/i1/i2, x/n/z/v/c mc68010 t, s, i0/i1/i2, x/n/z/v/c cpu32 t1/t0, s, i0/i1/i2, x/n/z/v/c mc68020 t1/t0, s, m, i0/i1/i2, x/n/z/v/c function code/address space mc68000 fc0 ?fc2 = is interrupt acknowledge only mc68010 fc0 ?fc2 = 7 is cpu space cpu32 fc0 ?fc2 = 7 is cpu space mc68020 fc0 ?fc2 = 7 is cpu space indivisible bus cycles mc68000 use as signal mc68010 use as signal cpu32 use rmc signal mc68020 use rmc signal stack frames mc68000 supports original set mc68010 supports formats $0, $8 cpu32 supports formats $0, $2, $c mc68020 supports formats $0, $1, $2, $9, $a, $b f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 m68000 family summary motorola reference manual a-3 table a-1 m68000 instruction set extensions mnemonic description cpu32 m68020 bcc supports 32-bit displacement bfxxxx bit field instructions (bfchg, bfclr, bfexts, bfextu, bffo, bfins, bfset, bftst) bgnd background operation bkpt new instruction function bra supports 32-bit displacement bsr supports 32-bit displacement callm new instruction cas,cas2 new instruction chk supports 32-bit operands chk2 new instruction cmp1 supports program counter relative addressing cmp2 new instruction cp coprocessor instructions divs/divu supports 32-bit and 64-bit operations extb supports 8-bit extend to 32 bits link supports 32-bit displacement lpstop new instruction movec supports new control registers muls/mulu supports 32-bit operands and 64-bit results pack new instruction rtm new instruction tblsn,tblun tbls,tblu new instruction tst supports program counter relative, immediate, and an addressing trapcc new instruction unpk new instruction f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola m68000 family summary cpu32 a-4 reference manual table a-2 m68000 addressing modes mode mnemonic mc68010/ mc68000 cpu32 mc68020 register direct rn address register indirect (an) address register indirect with postincrement (an)+ address register indirect with-(an) predecrement 0 0 address register indirect with displacement (16, an) address register indirect with index (8-bit displacement) (d8, an, xn) address register indirect with index (base displacement) (bd, an, xn * scale) memory indirect with postincrement ([bd, an], xn, od) memory indirect with predecrement ([bd, an, xn], od) absolute short (xxx).w absolute long (xxx).l program counter indirect with displacement (d16, pc) program counter indirect with index (8-bit displacement) (d8, pc, xn) program counter indirect with index (base displacement) (bd, pc, xn * scale) immediate #(data) program counter memory indirect with postincrement ([bd, pc], xn, od) program counter memory indirect with predecrement ([bd, pc, xn], od) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 index motorola reference manual i-1 ? absolute long address mode 3-9 absolute short address mode 3-8 ac electrical specifications, see appropriate user? manual address bus, see appropriate user? manual address error exception 6-7 address register direct addressing mode 3-3 indirect addressing mode 3-4 indirect displacement mode 3-5 indirect index (8-bit displacement) mode 3-5 indirect index (base displacement) mode 3-6 indirect postincrement addressing mode 3-4 indirect predecrement addressing mode 3-4 address registers 2-5 address space types 5-3 addressing capabilities 3-11 compatibility, m68000 3-14, a-4 indexed 3-5, 3-6, 3-7 indirect 3-4 mode enhancements 1-4 mode summary 3-14 addressing modes memory 3-4 programming view 3-11 register direct 3-3 special 3-7 architectural comparisons (m68000) a-1 arithmetic/logic instructions 4-7 assignments, exception vector 6-2 asynchronous bus operation, see appropriate user? manual ? background debug mode 7-3 commands execution 7-5 format 7-11 sequence diagrams 7-12 sequence example 7-13 set 7-11 summary 7-14 enabling 7-4 entering 7-5 returning from 7-7 sources 7-4 registers 7-6 serial interface 7-7 bgnd instruction 7-4 binary-coded decimal operations 4-10 bit manipulation operations 4-10 block diagram 1-6 branch instructions 4-10 condition tests 4-12 breakpoint exception processing 6-8 breakpoint instruction 4-12, 7-4 breakpoint signal, external 7-4 breakpoints hardware 6-9, 7-4 on data accesses 7-4 on instructions 7-4 peripheral 7-5 software 6-8 bus controller resources 8-2 bus error 6-6, 6-22 bus error fault stack frame 6-22 bus faults, double 7-5 ? compatibility, m68000 addressing 3-14 condition code computations 4-5 register 2-3, 4-5 condition tests 4-12 control registers 2-5 conventions, notation 3-2 correcting faults 6-18 cpu serial logic 7-8 space 5-3 ? data bdm serial format 7-7 movement instructions 4-6 register direct addressing mode 3-3 registers 2-4 structures, other (stacks and queues) 3-15 types 2-3 deterministic opcode tracking 7-2, 7-25 development features, standard 7-1 development support 7-1 development system serial logic 7-10 index f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola index cpu32 i-2 reference manual double bus faults 6-5, 7-5 dynamic bus sizing 6-16, 6-23 ? effective address 3-3 calculation timing table (cea) 8-13 encoding summary 3-9 fetch timing table (fea) 8-12 enhanced addressing modes 1-4 enhanced instruction set 1-4 errors, bus 6-6 exception address error 6-7 breakpoint instruction (bkpt) 6-8 bus error 6-6 definition of exception processing 6-1 format error 6-9 illegal instruction 6-9 instruction traps 6-8 interrupts 6-12 multiple 6-4 priority 6-4 privilege violation 6-10 processing sequence 6-3 related instructions and operations 8-21 reset 6-5 return from 6-13 stack frame 6-3 trace 6-11 types 6-2 unimplemented instruction 6-9 vectors 6-1 execution overlap 8-7 execution time calculations 8-5 ? faults correcting 6-18 type i via rte 6-19 type i via software 6-19 type ii via rte 6-19 type iii via conversion and restart 6-20 type iii via rte 6-21 type iii via software 6-20 type iv via software 6-21 recovery 6-14 types of 6-16 type i, released write 6-16 type ii, prefetch, operand, rmw, movep 6-17 type iii, movem operand transfer 6-17 type iv, exception processing 6-18 fetch effective address, timing table 8-12 format error 6-9 four-word stack frame, normal 6-22 function code registers 2-3, 2-5 future bdm commands 7-25 ? general description 1-1 ? halt operation 5-1 ? illegal or unimplemented instruction 6-9 immediate arithmetic/logic instruction timing 8-17 data addressing 3-9 implicit reference 3-2 indexed addressing 3-5, 3-7 indirect addressing 3-4 instruction details 4-13 execution overlap 8-4 execution time calculation 8-5 fetch signal (ifetch) 7-25 format 4-2 format summary 4-170 m68000 family compatibility 4-1 new 4-1 pipe 7-25, 8-2 pipe signal (ipipe) 7-25 summary 4-5 timing tables 8-10 traps 6-8 instruction set extensions a-3 instruction stream timing examples 8-7 instructions binary-coded decimal (bcd) 4-10, 8-18 bit manipulation 4-10, 8-20 conditional branch 4-10, 8-20 data movement 4-6, 8-14 exception related 4-11, 8-21 integer arithmetic 4-7, 8-15 logic 4-8, 8-15 program control (branch) 4-10, 8-20 shift and rotate 4-9, 8-19 single operand 8-18 system control 4-11, 8-21 table lookup and interpolation 4-188 interrupts 6-12 ? logic instructions 4-8 low-power stop (lpstop) 4-1, 5-1 ? m68000 family addressing capability 3-14 m68000 family compatibility 4-1 memory f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
cpu32 index motorola reference manual i-3 addressing modes 3-4 indirect addressing 3-4 organization 2-6 virtual 1-2 microbus controller 8-3 microsequencer 8-1 model, programming 2-1 move instruction timing 8-14 move instruction, special purpose, timing 8-14 multiple exceptions 6-4 ? negative tails 8-6 organization in memory 2-6 normal processing state 5-1 notation conventions, addressing 3-2 notation, instruction set 4-3 ? opcode tracking during loop mode 7-27 opcode tracking in background mode 7-2, 7-25 organization memory 2-6 registers 2-4 overlap 8-4 ? pipeline sync with the nop instruction 4-194 prefetch controller 8-3 priority exception 6-4 interrupt 6-12 privilege levels 5-1 changing 5-2 supervisor 5-2 user 5-2 privilege violations 6-10 processing of specific exceptions 6-5 processing states 5-1 program and data references 3-1, 5-3 program control (branch) instructions 4-10 program counter indirect with displacement mode 3-7 index (8-bit displacement) 3-7, 3-8 index (base displacement) 3-8 programming model 2-1 programming view of addressing modes 3-11 ? queues 3-17 ? references data 3-1 implicit 3-2 program 3-1 register direct mode 3-3 registers address 2-5 condition code 2-3, 4-5 control 2-5 data 2-4 function code 2-3 organization 2-2 status 2-3 vector base 2-3, 6-1 released writes 6-16, 6-19 reset 6-5 resource scheduling 8-1 return from exception 6-13 rotate instructions 4-9 ? save and restore operation timing 8-22 serial interface (bdm) 7-7 shift and rotate instruction timing 8-19 shift and rotate instructions 4-9 single operand instruction timing 8-18 six-word stack frame, normal 6-22 sizing, dynamic bus 6-16, 6-23 software breakpoints 6-8 software fault recovery 6-19 space formats 5-4 type 0000 - breakpoint 5-4 type 0001 - mmu access 5-4 type 0010 - coprocessor access 5-4 type 0011 - internal register access 5-4 type 1111 - interrupt acknowledge 5-5 special addressing modes 3-7 special-purpose move instruction timing 8-14 stack frames 6-3, 6-21 supervisor 2-2, 3-15 system 3-16 user 2-2, 3-15 state transition 5-1 status register 2-3 subroutine calls, nested 4-194 supervisor privilege level 5-2 surface interpolation 4-188, 4-194 synchronization, pipeline with nop 4-194 system control instructions 4-11 stack 3-16 ? table lookup and interpolation 4-187 examples 8-bit independent variable 4-191 compressed table 4-190 maintaining precision 4-192 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola index cpu32 i-4 reference manual standard usage 4-188 surface interpolations 4-194 instruction, using the 4-188 tests, condition 4-12 timing examples branch instructions 8-8 execution overlap 8-7 negative tails 8-9 timing tables 8-10 arihmetic/logic instructions 8-15 binary-coded decimal/extended instructions 8-18 bit manipulation instructions 8-20 calculate effective address (cea) 8-13 conditional branch instructions 8-20 control instructions 8-21 exception-related instructions 8-21 fetch effective address (fea) 8-10 immediate arithmetic/logic instructions 8-17 move instruction 8-14 save and restore operations 8-22 shift/rotate instructions 8-19 single operand instructions 8-18 special-purpose move instruction 8-14 trace on instruction execution 6-11, 7-1 ? unimplemented instruction emulation 6-9, 7-1 unimplemented instructions 4-2, 6-9 user privilege level 5-2 user stacks 3-16 ? vector base register 1-3, 2-3, 6-1 vectors, exception 6-1 virtual memory 1-2 ? write pending buffer 8-3 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .


▲Up To Search▲   

 
Price & Availability of CPU32RM

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X