XC2200 Derivatives
System Units (Vol. 1 of 2)
Interrupt and Trap Functions
User’s Manual
5-46
V2.1, 2008-08
ICU_X2K, V2.2
Class B Traps
Class B traps are generated by unrecoverable hardware failures. In the case of a
hardware failure, the CPU must immediately start a failure service routine. Class B traps
can interrupt an atomic/extend sequence and an I/O read access. After finishing the
Class B service routine, a restoration of the interrupted instruction flow is not possible.
All Class B traps have the same priority (trap priority I). When several Class B traps
become active at the same time, the corresponding flags in the TFR register are set and
the trap service routine is entered. Because all Class B traps have the same vector, the
priority of service of simultaneously occurring Class B traps is determined by software in
the trap service routine.
The access error (ACER) and system request 1 (SR1) are asynchronous external (to the
CPU) events, while all other Class B traps are generated in the pipeline during the
execution of instructions. Class B trap events can be generated only during the memory
stage of execution, so traps cannot be generated by two different instructions in the
pipeline in the same CPU cycle. Instructions which caused a Class B trap event are
always executed, then the pipeline is canceled and the IP of the instruction following the
one which caused the trap is pushed on the stack. Therefore, the stack always contains
the IP of the first following not-executed instruction in the instruction flow.
Note: The Branch Folding Unit allows the execution of a branch instruction in parallel
with the preceding instruction. The pre-processed branch instruction is combined
with the preceding instruction. The branch is executed together with the instruction
causing the Class B trap. The IP of the first following not-executed instruction in
the instruction flow is pushed on the stack.
A Class A trap occurring during the execution of a Class B trap service routine will be
serviced immediately. During the execution of a Class A trap service routine, however,
any Class B trap occurring will not be serviced until the Class A trap service routine is
exited with a RETI instruction. In this case, the occurrence of the Class B trap condition
is stored in the TFR register, but the IP value of the instruction which caused this trap is
lost.
Note: If a Class A trap occurs simultaneously with a Class B trap, both trap flags are set.
The IP of the instruction following the one which caused the trap is pushed into the
stack, and the Class A trap is executed. If this occurs during execution of an
atomic/extend sequence or I/O read access in progress, then the presence of the
Class B trap breaks the protection of atomic/extend operations and the Class A
trap will be executed immediately without waiting for the sequence completion.
After return from the service routine, the IP is popped from the system stack and
immediately pushed again because of the other pending Class B trap. In this
situation, the restoration of the interrupted instruction flow is not possible.