2.1 CPU
37
Figure 2.1.22 shows the flow of interrupt processing from the generation of the hardware interrupt, until
no more interrupt requests remain in the interrupt request program. Figure 2.1.23 shows the flow of
hardware interrupt operations.
Fig. 2.1.22 A Hardware Interrupt from Generation to Removal
(1)
Interrupt source occurs in internal resource.
(2)
If the interrupt enable bit in that internal resource is set to ‘enable,’ an interrupt is request is
generated from the internal resource to the interrupt controller.
(3)
The interrupt controller receives the interrupt request, simultaneously determines its priority, and
transfers it to the CPU at the corresponding interrupt level.
(4)
The CPU receives the interrupt from the interrupt controller, and compares its interrupt level
with the value of the IL bit in the processor status (PS) register.
(5)
Only if the comparison shows a higher priority level than the interrupt level currently being
processed, the CPU then checks the value of the I flag in the processor status (PS) register.
(6)
If the check in step (5) shows that the I flag is set to ‘interrupt enabled’ status, the Processor
waits for the end of execution of the instruction that is currently executing, and then sets the ILM
register to the requested level.
(7)
The indicated register settings are saved, the processor branches and transfers control to the
interrupt processing routine.
(8)
Software in the user-defined interrupt processing routine clears the interrupt source that occurred
in step (1), and interrupt processing ends.
F
2 M
C
-1
6
b
u
s
Microcoding
Internal resource
Internal
In
te
rr
u
p
t
le
v
e
l
IL
L
e
v
e
l
c
o
m
p
a
ra
to
r
Interrupt
PS:
I:
ILM: Interrupt level mask register
IR:
PS,PC…
PS
I
ILM
F2MC-16L
CPU
peripheral
circuit
block
controller
…
RAM
IR
Comparator
Check
AND
Enable FF
Source FF
(8)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
Instruction register
Interrupt enable flag
Processor status register