Figure 2:
E31 Core Complex Interrupt Architecture Block Diagram.
When a RISC‑V hart takes an interrupt, the following occurs:
• The value of
mstatus.MIE
is copied into
mstatus.MPIE
, and then
mstatus.MIE
is cleared,
effectively disabling interrupts.
• The current
pc
is copied into the
mepc
register, and then
pc
is set to the value of
mtvec
. In
the case where vectored interrupts are enabled,
pc
is set to
mtvec.BASE
+ 4 × exception
code.
• The privilege mode prior to the interrupt is encoded in
mstatus.MPP
.
At this point, control is handed over to software in the interrupt handler with interrupts disabled.
Interrupts can be re-enabled by explicitly setting
mstatus.MIE
or by executing an
MRET
instruc-
tion to exit the handler. When an MRET instruction is executed, the following occurs:
• The privilege mode is set to the value encoded in
mstatus.MPP
.
• The value of
mstatus.MPIE
is copied into
mstatus.MIE
.
• The
pc
is set to the value of
mepc
.
At this point control is handed over to software.
The Control and Status Registers involved in handling RISC‑V interrupts are described in Sec-
tion 5.3
Copyright © 2017–2018, SiFive Inc. All rights reserved.
16