Instruction Exceptions; Types Of Instruction Exceptions; Trap Instruction - Hitachi SH7032 Hardware Manual

Superh risc engine
Table of Contents

Advertisement

4.5

Instruction Exceptions

4.5.1

Types of Instruction Exceptions

Table 4.8 shows the three types of instruction that start exception handling (trap instructions,
illegal slot instructions, and general illegal instructions).
Table 4.8
Types of Instruction Exceptions
Type
Source Instruction

Trap instruction

TRAPA
Illegal slot
Undefined code or instruction
instruction
that rewrites the PC located
immediately after a delayed
branch instruction (delay slot)
General illegal
Undefined code in other than
instructions
delay slot
4.5.2
Trap Instruction
Trap instruction exception handling is carried out when a trap instruction (TRAPA) is executed.
The CPU then:
1. Saves the status register by pushing register contents onto the stack.
2. Pushes the program counter value onto the stack. The PC value saved is the start address of the
next instruction after the TRAPA instruction.
3. Reads the exception handling routine start address from the vector table corresponding to the
vector number specified in the TRAPA instruction, branches to that address, and starts
program execution. The branch is not a delayed branch.
Comments
Delayed branch instructions are: JMP, JSR,
BRA, BSR, RTS, RTE. Instructions that
rewrite the PC are: JMP, JSR, BRA, BSR,
RTS, RTE, BT, BF, and TRAPA
61

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents