ARM7TDMI-S Modes of Operation
454
SNIU028A – February 2016 – Revised April 2016
Copyright © 2016, Texas Instruments Incorporated
ARM7TDMI-S MPUSS
As shown in
, each processor mode has its own R13 and R14 registers. This allows each mode
to maintain its own stack pointer and return address. In addition, the Fast Interrupt (FIQ) mode has
additional registers: R8–R12. This means that when the ARM processor switches into FIQ mode, the
software does not need to save the normal R8–R12 registers, as FIQ mode has its own set that can be
modified.
The Current Program Status Register (CPSR) is used to store condition code flags, interrupt disable bits,
the current processor mode and other status and control information. This register is depicted in
:
Table 14-3. Current Program Status Register
31
30
29
28
27
24
23
16
N
Z
C
V
Undefined
Undefined
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Undefined
I
F
T
Mode
The Current Program Status Register is defined in the following way:
•
Bits 24–31 can be modified in any mode, and are used to store the condition code flags. Only four
condition code flags
are available: N for Negative, Z for Zero, C for Carry and V for Overflow; the other
bits are undefined. The condition code flags are set or cleared as a by-product of certain arithmetic
instructions. For example, “cmp r0,r1” sets the Z (Zero) flag if R0 and R1 are equal.
•
Bits 6 and 7 (F and I respectively) are the
interrupt disable
bits: setting one of these bits to 1 disables
that interrupt; bit 6 disables the Fast Interrupt (FIQ), bit 7 disables the normal Interrupt (IRQ). These
bits can only be modified in a privileged mode.
•
Bit 5 (the T bit) determines whether the processor runs in ARM state or in Thumb state. Thumb state
uses a different, more compact, instruction set when compared to ARM. Never set this bit; Doing so
will make the processor enter an unpredictable state. This bit can only be modified in a privileged
mode.
•
Bits 0–4 set the processor mode;
shows the individual bit patterns needed to use a
particular mode. These bits can only be modified in a privileged mode.
•
Bits 8–27 are undefined and reserved for future or more advanced ARM processors. Never alter the
contents of these bits; instead, use a read-modify-write cycle to preserve them. These bits can only be
modified in a privileged mode.
As mentioned above, bits 24–31, the condition code flags, can be modified in any mode. Bits 0–23 can
only be modified in a
privileged
mode (i.e., any mode other than User mode).
shows the
individual bit patterns needed in bits 0–4 to use a particular mode:
Table 14-4. Bit Patterns in Different ARM Processor Operating Modes
Mode Bit
Processor Mode (Abbreviation)
Accesible Registers
Bin
Hex
10000
10
User (usr)
PC, R14-R0, CPSR
10001
11
Fast Interrupt (fiq)
PC, R14_fiq-R8_fiq, R7-R0, CPSR,
SPSR_fiq
10010
12
Interrupt (irc)
PC, R14_irq, R13_irq, R12-R0, CPSR,
SPSR_irq
10011
13
Supervison (svc)
PC, R14_svc, R13_svc, R12-R0, CPSR,
SPSR_svc
10111
17
Abort (abt)
PC, R14_abt, R13_abt, R12-R0, CPSR,
SPSR_abt
11011
1B
Undefined (und)
PC, R14_und, R13_und, R12-R0, CPSR,
SPSR_und
11111
1F
System (sys)
PC, R14-R0, CPSR
It is worth noting that the five Saved Program Status Registers (SPSRs) have the same format as the
Current Program Status Register. These registers save the contents of CPSR when an exception occurs.