![](http://datasheet.mmic.net.cn/230000/79RC32438-200BB_datasheet_15568909/79RC32438-200BB_97.png)
IDT MIPS32 4Kc Processor Core
Exceptions
79RC32438 User Reference Manual
2 - 35
November 4, 2002
Notes
System Control Coprocessor
The System Control Coprocessor (CP0) is implemented as an integral part of the 4Kc processor core
and supports memory management, address translation, exception handling, and other privileged opera-
tions. Certain CP0 registers are used to support memory management. For additional information on the
CP0 register set, see the CP0 Registers section later in this chapter.
Exceptions
The 4Kc processor core receives exceptions from a number of sources, including translation lookaside
buffer (TLB) misses, arithmetic overflows, I/O interrupts, and system calls. When the CPU detects one of
these exceptions, the normal sequence of instruction execution is suspended and the processor enters
kernel mode.
In kernel mode, the core disables interrupts and forces execution of a software exception processor
(called a handler) located at a fixed address. The handler saves the context of the processor, including the
contents of the program counter, the current operating mode, and the status of the interrupts (enabled or
disabled). This context is saved so it can be restored when the exception has been serviced.
When an exception occurs, the core loads the Exception Program Counter (EPC) register with a location
where execution can restart after the exception has been serviced. The restart location in the EPC register
is the address of the instruction that caused the exception or, if the instruction was executing in a branch
delay slot, the address of the branch instruction immediately preceding the delay slot. To distinguish
between the two, software must read the BD bit in the CP0 Cause register.
Exception Conditions
When an exception condition occurs, the relevant instruction and all those that follow it in the pipeline
are cancelled. Accordingly, any stall conditions and any later exception conditions that may have refer-
enced this instruction are inhibited; there is no benefit in servicing stalls for a cancelled instruction.
When an exception condition is detected on an instruction fetch, the core aborts that instruction and all
instructions that follow. When this instruction reaches the W stage, the exception flag causes it to write
various CP0 registers with the exception state, change the current program counter (PC) to the appropriate
exception vector address, and clear the exception bits of earlier pipeline stages.
This implementation allows all preceding instructions to complete execution and prevents all subse-
quent instructions from completing. Thus, the value in the EPC (ErrorEPC for errors or DEPC for debug
exceptions) is sufficient to restart execution. It also ensures that exceptions are taken in the order of execu-
tion; an instruction taking an exception may itself be killed by an instruction further down the pipeline that
takes an exception in a later cycle.
Exception Priority
Table 2.14 lists all possible exceptions and the relative priority of each, highest to lowest. Several of
these exceptions can happen simultaneously. If that happens, the exception with the highest priority is the
one taken.
Op Code
Description of Instructions
TLBP
Translation Lookaside Buffer Probe
TLBR
Translation Lookaside Buffer Read
TLBWI
Translation Lookaside Buffer Write Index
TLBWR
Translation Lookaside Buffer Write Random
Table 2.13 TLB Instructions