MOTOROLA
9-14
EXCEPTION PROCESSING
CPU16
REFERENCE MANUAL
The IP field is automatically set to the priority of the pending interrupt as a part of in-
terrupt exception processing. The TDP, ANDP, and ORP instructions can be used to
change the IP mask value. IP can also be changed by pushing a modified CCR onto
the stack, then using the PULM instruction. IP is also modified by the action of the re-
turn from interrupt (RTI) instruction.
Interrupt exception processing sequence is as follows:
A. Priority of all pending exceptions is evaluated, and the highest priority exception
is processed first.
B. Processor state is stacked, then the CCR PK extension field is cleared.
C. Mask value of the pending interrupt is written to the IP field.
D. An interrupt acknowledge cycle (IACK) is run.
1. If the interrupting device supplies a vector number, the CPU16 acquires it.
2. If the interrupting device asserts the autovector (AVEC) signal in response
to IACK, the CPU16 generates an autovector number corresponding to the
interrupt priority.
3. If a BERR signal occurs during IACK, the CPU16 generates the spurious in-
terrupt vector number.
E. The vector number is converted to a vector address.
F. The content of the vector address is loaded into the PC, and the processor
jumps to the exception handler routine.
SECTION 3 SYSTEM RESOURCES
contains more information about bus control sig-
nals and interfacing.
9.7.2 Synchronous Exceptions
Synchronous exception processing is part of an instruction definition. Exception pro-
cessing for synchronous exceptions will always be completed, and the first instruction
of the handler routine will always be executed, before interrupts are detected.
Because of pipelining, the value of PK : PC at the time a synchronous exception exe-
cutes is equal to the address of the instruction that causes the exception plus $0006.
Since RTI always subtracts $0006 upon return, the stacked PK : PC must be adjusted
by the instruction that caused the exception so that execution will resume with the fol-
lowing instruction —$0002 is added to the PK : PC value before it is stacked.
9.7.2.1 Illegal Instructions
An illegal instruction exception can occur at two times:
1. When the execution unit identifies an opcode for which there is no instruction
definition.
2. When an attempt is made to execute the BGND instruction with background de-
bugging mode disabled.
In both cases, exception processing follows the normal sequence, except that the PK
: PC value is adjusted before it is stacked.
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.