
C165UTAH
Interrupt and Trap Functions
Data Sheet
130
2001-02-23
segment 0. No Interrupt Request flags are affected by the TRAP instruction. The
interrupt service routine called by a TRAP instruction must be terminated with a RETI
(return from interrupt) instruction to ensure correct operation.
Note:
The CPU level in register PSW is not modified by the TRAP instruction, so the
service routine is executed on the same priority level from which it was invoked.
Therefore, the service routine entered by the TRAP instruction can be interrupted
by other traps or higher priority interrupts, other than when triggered by a
hardware trap.
Hardware Traps
Hardware traps are issued by faults or specific system states that occur during runtime
of a program (not identified at assembly time). A hardware trap may also be triggered
intentionally, eg. to emulate additional instructions by generating an Illegal Opcode trap.
The C165UTAH distinguishes eight different hardware trap functions. When a hardware
trap condition has been detected, the CPU branches to the trap vector location for the
respective trap condition. Depending on the trap condition, the instruction which caused
the trap is either completed or cancelled (ie. it has no effect on the system state) before
the trap handling routine is entered.
Hardware traps are non-maskable and always have priority over every other CPU
activity. If several hardware trap conditions are detected within the same instruction
cycle, the highest priority trap is serviced (see table in section “Interrupt System
Structure”).
PSW, CSP (in segmentation mode), and IP are pushed on the internal system stack and
the CPU level in register PSW is set to the highest possible priority level (ie. level 15),
disabling all interrupts. The CSP is set to code segment zero, if segmentation is enabled.
A trap service routine must be terminated with the RETI instruction.
The eight hardware trap functions of the C165UTAH are divided into two classes:
Class A traps
are
external Non-Maskable Interrupt (NMI)
Stack Overflow
Stack Underflow trap
These traps share the same trap priority, but have an individual vector address.
Class B traps
are
Undefined Opcode
Protection Fault
Illegal Word Operand Access
Illegal Instruction Access
Illegal External Bus Access Trap
These traps share the same trap priority, and the same vector address.