pm0264 stm32 Cortexm33 Mcus Programming Manual Stmicroelectronics
pm0264 stm32 Cortexm33 Mcus Programming Manual Stmicroelectronics
Programming manual
Introduction
This programming manual provides information for application and system-level software developers. It gives a full description
of the STM32 Cortex®-M33 processor programming model, instruction set and core peripherals. The applicable products are
listed in the table below. The Cortex®-M33 processor is a high performance 32-bit processor designed for the microcontroller
and microprocessor market. It offers significant benefits to developers, including:
• Outstanding processing performance combined with fast interrupt handling.
• Enhanced system debug with extensive breakpoint and trace capabilities.
• Efficient processor core, system and memories.
• Instruction set extension for signal processing applications.
• Ultra-low power consumption with integrated sleep modes.
• Platform robustness with integrated memory protection unit.
• Extended security features with Security Extension for Armv8-M.
This document provides information required for application and system-level software development. It does not
provide information on debug components, features, or operation.
This document applies to the STM32 MCUs that embed an Arm® Cortex®-M33 processor.
Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
This material is for microcontroller software and hardware engineers, including those who have no experience
with Arm cores.
Interrupts
Processor
Nested Vector
Interrupt Controller
(NVIC)
Breakpoint Unit
Memory Protection Unit (MPU)
ROM tables
Cross Trigger
Interface (CTI)
Bus matrix
AMBA5 AHB 5
Memory system
Interrupts
Processor
Nested Vector
Interrupt Controller
(NVIC)
Security
Attribution Unit Breakpoint Unit
Implementation
Defined (SAU)
Attribution Unit ROM tables
(IDAU) Non-secure
Secure Memory Cross Trigger
Memory
Protection Unit Interface (CTI)
Protection Unit
(MPU_S)
(MPU_NS)
Bus matrix
AMBA5 AHB 5
Memory system
To facilitate the design of cost-sensitive devices, the STM32 Cortex®-M33 processor implements tightly-coupled
system components that reduce processor area while significantly improving interrupt handling and system
debug capabilities. The STM32 Cortex®-M33 processor implements the T32 instruction set based on STM32
Cortex®-M33-2 technology, ensuring high code density and reduced program memory requirements. The STM32
Cortex®-M33 processor instruction set provides the exceptional performance that is expected of a modern 32-bit
architecture, with better code density than most other architectures.
The STM32 Cortex®-M33 processor closely integrates a configurable Nested Vectored Interrupt Controller (NVIC)
to deliver industry-leading interrupt performance. The NVIC includes a non-maskable interrupt, and provides up to
256 interrupt priority levels for other interrupts. The tight integration of the processor core and NVIC provides fast
execution of Interrupt Service Routines (ISRs), which dramatically reduces interrupt latency. This reduced latency
is achieved through:
• The hardware stacking of registers.
• The ability to suspend load multiple and store multiple operations.
• Parallel instruction-side and data-side paths.
• Tail-chaining.
• Late-arriving interrupts.
Interrupt handlers do not require wrapping in assembler code, removing any code overhead from the ISRs. The
tail-chain optimization also significantly reduces the overhead when switching from one ISR to another.
To optimize low-power designs, the NVIC supports different sleep modes, including a deep sleep function that
enables the entire device to be rapidly powered down while still retaining program state.
To increase instruction throughput, the STM32 Cortex®-M33 processor can execute certain pairs of 16-bit
instructions simultaneously. This is called dual issue.
This chapter provides the reference material for the Cortex®-M33 processor description in a User Guide.
It contains the following sections:
Privilege levels
There are two levels of privilege:
Unprivileged Software has limited access to system resources.
Privileged Software has full access to system resources, subject to security restrictions.
In Thread mode, the CONTROL register controls whether software execution is privileged or unprivileged. In
Handler mode, software execution is always privileged.
Only privileged software can write to the CONTROL register to change the privilege level for software execution in
Thread mode. Unprivileged software can use the SVC instruction to make a Supervisor Call to transfer control to
privileged software.
R0
R1
R2
R3
Low registers
R4
R5
R6 General purpose registers
R7
R8
R9
High registers R10 Banked stack pointers
R11
R12
Active Stack Pointer SP (R13) PSP MSP
Link Register LR (R14)
Program Counter PC (R15)
Combined Program Status Registers xPSR
PRIMASK
Exception mask registers FAULTMASK
Special registers BASIPRI
Control Register CONTROL
PSPLIM
Stack Pointer Limit registers
MSPLIM
Required
Name Type(1) Reset value Description
privilege(2)
xPSR (includes
Section 2.1.3.6 Combined Program Status
APSR, IPSR, and RW Either -fn(4)
Register
EPSR)
Section 2.1.3.6.1 Application Program Status
APSR RW Either UNKNOWN
Register
Section 2.1.3.6.2 Interrupt Program Status
IPSR RO Privileged 00000000
Register
Section 2.1.3.6.3 Execution Program Status
EPSR RO Privileged -(4)
Register.
PRIMASK RW Privileged 00000000 Section 2.1.3.7.1 Priority Mask Register
FAULTMASK RW Privileged 00000000 Section 2.1.3.7.2 Fault Mask Register
BASEPRI RW Privileged 00000000 Section 2.1.3.7.3 Base Priority Mask Register
CONTROL RW Privileged 00000000 Section 2.1.3.8 CONTROL register
PSPLIM RW Privileged
00000000 Section 2.1.3.3 Stack limit registers
MSPLIM RW Privileged
1. Describes access type during program execution in Thread mode and Handler mode. Debug access can differ.
2. An entry of Either means privileged and unprivileged software can access the register.
3. Soft reset to the value retrieved by the reset handler
4. Bit[24] is the T-bit and is loaded from bit[0] of the reset vector. All other bits are reset to 0.
R0
R1
R2
R3
Low registers
R4
R5
R6 General purpose registers
R7
R8
R9 Banked stack pointers
High registers R10
R11
R12 PSP_S PSP_NS
Active Stack Pointer SP (R13) MSP_S MSP_NS
Link Register LR (R14)
Program Counter PC (R15)
Combined Program Status Registers xPSR
PRIMASK PRIMASK_S PRIMASK_NS
Exception mask registers FAULTMASK FAULTMASK_S FAULTMASK_NS
Special registers BASIPRI BASIPRI_S BASIPRI_NS
Control Register CONTROL CONTROL_S CONTROL_NS
Required
Name Type(1) Reset value Description
privilege(2)
Required
Name Type(1) Reset value Description
privilege(2)
1. Describes access type during program execution in Thread mode and Handler mode. Debug access can differ.
2. An entry of Either means privileged and unprivileged software can access the register.
3. Soft reset to the value retrieved by the reset handler.
4. Bit[24] is the T-bit and is loaded from bit[0] of the reset vector. All other bits are reset to 0.
Main MSP
Process PSP
In Thread mode, the CONTROL.SPSEL bit indicates the stack pointer to use.
0 Main stack pointer (MSP). This is the reset value.
1 Process stack pointer (PSP)
Main MSP_S
Secure
Process PSP_S
Main MSP_NS
Non-secure
Process PSP_NS
In Non-secure Thread mode, the CONTROL_NS.SPSEL bit indicates the stack pointer to use:
0 Main stack pointer (MSP_NS). This is the reset value.
1 Process stack pointer (PSP_NS).
Main MSPLIM
Process PSPLIM
The Cortex®‑M33 processor has four stack limit registers, as the following table shows.
Main MSPLIM_S
Secure
Process PSPLIM_S
Main MSPLIM_NS
Non-secure
Process PSPLIM_NS
Note: The four stack limit registers are banked between Security states.
See Table 2. Core register set summary without the Security Extension table for the stack limit registers attributes.
The bit assignments for the MSPLIM and PSPLIM registers are as follows:
31 3 2 0
LIMIT RES0
Main stack limit or process stack limit address for the selected Security state. Limit address for the selected
[31:3] LIMIT
stack pointer.
Access these registers individually or as a combination of any two or all three registers, using the register name
as an argument to the MSR or MRS instructions. For example:
• Read all the registers using PSR with the MRS instruction.
• Write to the APSR N, Z, C, V, and Q bits using APSR_nzcvq with the MSR instruction.
The PSR combinations and attributes are:
See the MRS and MSR instruction descriptions for more information about how to access the Program Status
Registers.
[31:9] - Reserved.
This is the number of the current exception:
0 = Thread mode.
1 = Reset.
2 = NMI.
3 = HardFault.
4 = MemManage.
5 = BusFault.
6 = UsageFault
7 = SecureFault
8-10 = Reserved.
[8:0] Exception number 7-10 = Reserved.
11 = SVCall.
12 = DebugMonitor.
13 = Reserved.
14 = PendSV.
15 =SysTick
16 = IRQ0.
.
.
.
495 = IRQ479.
The active bits in the Exception number field depend on the number of interrupts implemented.
0-47 interrupts = [5:0].
48-111 interrupts = [6:0].
112-239 interrupts = [7:0].
240-479 interrupts = [8:0].
[31:27] - Reserved
[26:25], [15:10] ICI Interruptible-continuable instruction bits, see Section 2.1.3.6.4 Interruptible-continuable instructions
[26:25], [15:10] IT Indicates the execution state bits of the IT instruction, see Section 3.9.5 IT
Attempts to read the EPSR directly through application software using the MSR instruction always return zero.
Attempts to write the EPSR using the MSR instruction in application software are ignored.
To access the exception mask registers use the MSR and MRS instructions, or the CPS instruction to change the
value of PRIMASK.PM or FAULTMASK.FM.
31 1 0
RES0
PM
When the current execution priority is boosted to a particular value, all exceptions with a lower or equal priority
are masked.
31 1 0
RES0
FM
When the current execution priority is boosted to a particular value, all exceptions with a lower or equal
priority are masked.
31 8 7 0
RES0 BASEPRI
[7:0] BASEPRI (1) Software can set BASEPRI_NS to a priority number between 1 and the
maximum supported priority number. The value in BASEPRI_NS is then
1 mapped to the bottom half of the priority range, so that the current execution
priority is boosted to the mapped-to value in the bottom half of the priority
range.
When the current execution priority is boosted to a particular value, all exceptions with a lower priority
are masked. Writing 0 to BASEPRI disables base priority boosting.
1. This field is similar to the priority fields in the interrupt priority registers. If the device implements only bits[7:M] of this field,
bits[M-1:0] read as zero and ignore writes. See Section 4.2.7 Interrupt Priority Registers for more information. Remember
that higher priority field values correspond to lower exception priorities.
See Table 2. Core register set summary without the Security Extension table for the CONTROL register attributes.
This register is banked between Security states on a bit by bit basis.
The bit assignments for the CONTROL register are as follows:
31 4 3 2 1 0
RES0
SFPA nPRIV
FPCA SPSEL
This bit is not banked between Security states and RAZ/WI from Non-secure state.
Indicates whether floating-point context is active:
0 No floating-point context active.
This bit is used to determine whether to preserve floating-point state when processing an exception.
This bit is not banked between Security states.
Defines the currently active stack pointer:
0 MSP is the current stack pointer.
1 PSP is the current stack pointer.
[1] SPSEL
In Handler mode, this bit reads as zero and ignores writes. The Cortex®‑M33 core updates this bit
automatically on exception return.
This bit is banked between Security states.
Defines the Thread mode privilege level:
0 Privileged.
[0] nPRIV
1 Unprivileged.
Handler mode always uses the MSP, so the processor ignores explicit writes to the active stack pointer bit of the
CONTROL register when in Handler mode. The exception entry and return mechanisms automatically update the
CONTROL register based on the EXC_RETURN value.
In an OS environment, Arm® recommends that threads running in Thread mode use the process stack and the
kernel and exception handlers use the main stack.
By default, Thread mode uses the MSP. To switch the stack pointer that is used in Thread mode to the PSP,
either:
• Use the MSR instruction to set the CONTROL.SPSEL bit, the current active stack pointer bit, to 1.
• Perform an exception return to Thread mode with the appropriate EXC_RETURN value.
Note: When changing the stack pointer, software must use an ISB instruction immediately after the MSR instruction.
This ensures that instructions after the ISB instruction execute using the new stack pointer.
0xFFFFFFFF
Vendor-specific
511MB
memory
0xE0100000
Private peripheralbus 0xE00FFFFF
1MB
0xE0000000
0xDFFFFFFF
0xA0000000
0x9FFFFFFF
0x60000000
0x5FFFFFFF
Peripheral 0.5GB
0x40000000
0x3FFFFFFF
SRAM 0.5GB
0x20000000
0x1FFFFFFF
Code 0.5GB
0x00000000
The processor reserves regions of the Private peripheral bus (PPB) address range for core peripheral registers.
For the Cortex‑M33 processor, only two combinations of these attributes are valid:
• Device-nGnRnE.
• Device-nGnRE.
Note: • Device-nGnRnE is equivalent to Armv7‑M Strongly Ordered memory type
• Device-nGnRE is equivalent to Armv7‑M Device memory.
• Device-nGRE and Device-GRE are new to the Armv8‑M architecture.
Typically, peripheral control registers must be either Device-nGnRE or Device-nGnRnE to prevent reordering of
the transactions in the programming sequences.
Note: Device memory is shareable, and must not be cached.
Non-secure Callable (NSC) NSC is a special type of Secure location that is permitted to hold an SG instruction to enable
software to transition from Non-secure to Secure state. The inclusion of NSC memory locations
removes the need for Secure software creators to allow for the accidental inclusion of SG
instructions, or data sharing encoding values, in normal Secure memory by restricting the
functionality of the SG instruction to NSC memory only.
Non-secure (NS) Non-secure addresses are used for memory and peripherals accessible by all software running
on the device.
Transactions are deemed to be Non-secure if they are to an address that is defined as Non-
Secure.
Note: Transactions are deemed to be Non-secure even if secure software performs the access.
Memory accesses initiated by Secure software to regions marked as Non-secure in the SAU
IDAU are marked as Non-secure on the AHB bus.
The MPU is banked between Secure and Non-secure memory. For instructions fetches, addresses that are
Secure are subject to the Secure MPU settings. Addresses that are Non-secure are subject to the Non-secure
MPU settings. For data loads and data stores, accesses depend on the Security state of the processor. For
example, if the processor is in Secure state the access is subject to the Secure MPU settings. If the processor is
in Non-secure state the access is subject to the Non-secure MPU settings.
Note: For more information on memory types, see Section 2.3.2 Memory regions, types, and attributes.
The Code, SRAM, and RAM regions can hold programs.
The MPU can override the default memory access behavior described in this section.
2.3.5.1 Additional memory access constraints for caches and shared memory
When a system includes caches or shared memory, some memory regions have additional access constraints,
and some regions are subdivided.
This behavior is shown by the following table:
0x60000000-0x7FFFFFFF WBWA
RAM Normal -
0x80000000-0x9FFFFFFF WT
0xA0000000-0xDFFFFFFF External device Device Shareable -
0xE0000000-0xE003FFFF Private Peripheral Bus Device Shareable -
0xE0040000-0xE0043FFF Device Device Shareable -
0xE0044000-0xE00EFFFF Private Peripheral Bus - Shareable Device
0xF0000000-0xFFFFFFFF Vendor_SYS Device Shareable Device
Note: For more information on memory types and shareability, see Section 2.3.2 Memory regions, types, and
attributes.
31 24 23 16 15 8 7 0
Address A B0 lsbyte B3 B2 B1 B0
A+1 B1
A+2 B2
A+3 B3 msbyte
0 It indicates that the thread or process gained exclusive access to the memory, and the
write succeeded.
1 It indicates that the thread or process did not gain exclusive access to the memory, and no
write was performed.
Implementing a semaphore
The software can use the synchronization primitives to implement a semaphore as follows:
1. Use a Load-Exclusive instruction to read from the semaphore address to check whether the semaphore is
free.
2. If the semaphore is free, use a Store-Exclusive to write the claim value to the semaphore address.
3. If the returned status bit from step 2 indicates that the Store-Exclusive succeeded, then the software has
claimed the semaphore. However, if the Store-Exclusive failed, another process might have claimed the
semaphore after the software performed step 1.
Exclusive tags
The processor includes an exclusive access monitor, that tags the fact that the processor has executed a
Load-Exclusive instruction. If the processor is part of a multiprocessor system with a global monitor, and the
address is in a shared region of memory, then the system also globally tags the memory locations that are
addressed by exclusive accesses by each processor.
The processor clears its exclusive access tag if:
• It executes a CLREX instruction.
• It executes a STREX or STLEX instruction, regardless of whether the write succeeds.
• An exception occurs. This means that the processor can resolve semaphore conflicts between different
threads.
In a multiprocessor implementation:
• Executing a CLREX instruction clears only the local exclusive access tag for the processor.
• Executing a STREX or STLEX instruction, or an exception, clears the local exclusive access tags for the
processor.
• Executing a STREX or STLEX instruction to a Shareable memory region can also clear the global exclusive
access tags for the processor in the system.
For more information about the synchronization primitive instructions, see Section 3.12.10 LDREX and STREX
and Section 3.12.12 CLREX.
A global exclusive access can be performed:
• In a Shared region if the MPU is implemented.
• By setting ACTLR.EXTEXCLALL. In this case, exclusive information is always sent externally.
In any other case, exclusive information is not sent on the AHB bus, HEXCL is 0, and only the local monitor is
used.
If HEXCL is sent externally and there is no exclusive monitor for the corresponding memory region, then STREX
and STLEX fails.
For example:
uint16_t value;
uint16_t *address = 0x20001002;
value = __LDREXH (address); // load 16-bit value from memory address 0x20001002
Table 21. Properties of the different exception types with the Security Extension
Exception
IRQ number
number (see Exception type Priority Vector address Activation
(see notes)
notes)
Note: • To simplify the software layer, the CMSIS only uses IRQ numbers. It uses negative values for exceptions
other than interrupts. The IPSR returns the Exception number, see Section 2.1.3.6.2 Interrupt Program
Status Register.
• For configurable priority values, see Section 4.2.7 Interrupt Priority Registers.
For an asynchronous exception, other than reset, the processor can execute extra instructions between the
moment the exception is triggered and the moment the processor enters the exception handler.
Privileged software can disable the exceptions that have configurable priority, as shown in the table above.
An exception that targets Secure state cannot be disabled by Non-secure code.
Reset The exception model treats reset as a special form of exception. When either power-on or
warm reset is asserted, the operation of the processor stops, potentially at any point in an
instruction. When reset is deasserted, execution restarts from the address provided by the
reset entry in the vector table. Execution restarts as privileged execution in Thread mode.
NMI A Non-Maskable Interrupt (NMI) can be signaled by a peripheral or triggered by software. This
is the highest priority exception other than reset. It is permanently enabled and has a fixed
priority of -2. NMIs cannot be masked or preempted by any exception other than Reset.
HardFault A HardFault is an exception that occurs because of an error during exception processing, or
because an exception cannot be managed by any other exception mechanism. HardFaults
have a fixed priority of -1, meaning they have higher priority than any exception with
configurable priority.
MemManage A MemManage fault is an exception that occurs because of a memory protection violation,
compared to the MPU or the fixed memory protection constraints, for both instruction and data
memory transactions. This fault is always used to abort instruction accesses to Execute Never
(XN) memory regions.
BusFault A BusFault is an exception that occurs because of a memory-related fault for an instruction or
data memory transaction. This might be from an error that is detected on a bus in the memory
system.
UsageFault A UsageFault is an exception that occurs because of a fault related to instruction execution.
This includes:
• An undefined instruction.
• An illegal unaligned access.
• Invalid state on instruction execution.
• An error on exception return.
The following can cause a UsageFault when the core is configured by software to report them:
• An unaligned address on word and halfword memory access.
• Division by zero.
SVCall A Supervisor Call (SVC) is an exception that is triggered by the SVC instruction. In an OS
environment, applications can use SVC instructions to access OS kernel functions and device
drivers.
DebugMonitor A DebugMonitor exception. If Halting debug is disabled and the debug monitor is enabled, a
debug event causes a DebugMonitor exception when the group priority of the DebugMonitor
exception is greater than the current execution priority.
PendSV PendSV is an asynchronous request for system-level service. In an OS environment, use
PendSV for context switching when no other exception is active.
SysTick A SysTick exception is an exception the system timer generates when it reaches zero. Software
can also generate a SysTick exception. In an OS environment, the processor can use this
exception as a system tick.
Interrupt (IRQ) An interrupt, or IRQ, is an exception signaled by a peripheral, or generated by a software
request. All interrupts are asynchronous to instruction execution. In the system, peripherals use
interrupts to communicate with the processor.
Table 22. Properties of the different exception type without the Security Extensions
Synchronous when
5 -11 BusFault Configurable 0x00000014 precise, asynchronous
when imprecise
6 -10 UsageFault Configurable 0x00000018 Synchronous
7-10 - Reserved - - -
11 -5 SVCall Configurable 0x0000002C Synchronous
12 -4 DebugMonitor Configurable 0x00000030 Synchronous
13 - Reserved - - -
14 -2 PendSV Configurable 0x00000038 Asynchronous
15 -1 SysTick Configurable 0x0000003C Asynchronous
0x00000040 and above.
16 and above 0 and above Interrupt (IRQ) Configurable Asynchronous
Increasing in steps of 4
Note: • To simplify the software layer, the CMSIS only uses IRQ numbers. It uses negative values for exceptions
other than interrupts. The IPSR returns the Exception number, see Section 2.1.3.6.2 Interrupt Program
Status Register.
• For configurable priority values, see Section 4.2.7 Interrupt Priority Registers.
For an asynchronous exception, other than reset, the processor can execute extra instructions between the
moment the exception is triggered and the moment the processor enters the exception handler.
Privileged software can disable the exceptions that have configurable priority, as shown in the table above.
18 2 IRQ2 0x48
17 1 IRQ1 0x44
16 0 IRQ0 0x40
15 -1 SysTick 0x3C
14 -2 PendSV 0x38
13 Reserved 0x30
12 -4 DebugMonitor
11 -5 SVCall 0x2C
10
9
Reserved
8
7
6 -11 UsageFault 0x18
5 -12 BusFaults 0x14
4 -13 MemManage 0x10
3 -13 HardFault 0x0C
2 -14 NMI 0x08
1 Reset 0x04
Initial SP value 0x00
On system reset the vector table is set to the value of the external INITNSVTOR bus. Privileged software can
write to VTOR to relocate the vector table start address to a different memory location, in the range 0x00000000
to 0xFFFFFF80, assuming access is allowed by the external LOCKNSVTOR pin.
The silicon vendor must configure the required alignment, which depends on the number of interrupts
implemented. The minimum alignment is 32 words, enough for up to 16 interrupts. For more interrupts, adjust
the alignment by rounding up to the next power of two. For example, if you require 21 interrupts, the alignment
must be on a 64-word boundary because the required table size is 37 words, and the next power of two is 64.
The following figure shows the order of the exception vectors in the Secure and Non-secure vector tables. The
least-significant bit of each vector is 1, indicating that the exception handler is written in Thumb code.
Because reset always targets Secure state, the Non-secure Reset and Non-secure Initial SP value are ignored by
the hardware.
On system reset, the Non-secure vector table is set to the value of the external INITNSVTOR bus, and
the Secure vector table is set to the value of the external INITSVTOR bus. Privileged software can write to
VTOR_S and VTOR_NS to relocate the vector table start address to a different memory location, in the range
0x00000000 to 0xFFFFFF80, assuming access is allowed by the external LOCKNSVTOR and LOCKSVTAIRCR
pins respectively.
The silicon vendor must configure the required alignment of the vector tables, which depends on the number of
interrupts implemented. The minimum alignment is 32 words, enough for up to 16 interrupts. For more interrupts,
adjust the alignment by rounding up to the next power of two. For example, if you require 21 interrupts, the
alignment must be on a 64-word boundary because the required table size is 37 words, and the next power of two
is 64.
In Table 23, the values in columns 2 and 3 must match, and increase from zero in increments of 32. The values in
column 4 start from 128 and increase in increments of 16.
Table 23. Extended priority when the number of interrupt priority levels is 8
0 0 0 128
1 32 32 144
2 64 64 160
3 96 96 176
4 128 128 192
5 160 160 208
6 192 192 224
7 224 224 240
In Table 24, the values in columns 2 and 3 must match, and increase from zero in increments of 16. The values in
column 4 start from 128 and increase in increments of 8.
Table 24. Extended priority when the number of interrupt priority levels is 16
0 0 0 128
1 16 16 136
2 32 32 144
3 48 48 152
4 64 64 160
5 80 80 168
6 96 96 176
7 112 112 184
8 128 128 192
9 144 144 200
10 160 160 208
11 176 176 216
12 192 192 224
13 208 208 232
14 224 224 240
15 240 240 248
Assigning a higher priority value to IRQ[0] and a lower priority value to IRQ[1] means that IRQ[1] has higher
priority than IRQ[0]. If both IRQ[1] and IRQ[0] are asserted, IRQ[1] is processed before IRQ[0].
If multiple pending exceptions have the same priority, the pending exception with the lowest exception number
takes precedence. For example, if both IRQ[0] and IRQ[1] are pending and have the same priority, then IRQ[0] is
processed before IRQ[1].
When the processor is executing an exception handler, the exception handler is preempted if a higher priority
exception occurs. If an exception occurs with the same priority as the exception being handled, the handler is not
preempted, irrespective of the exception number. However, the status of the new interrupt changes to pending.
Figure 9. Stack frame when an interrupt or an exception is preserved on the stack with or without
floating-point state
When a Non-secure exception preempts a Secure context, additional context is saved onto the stack and the
stacked registers are cleared to ensure no Secure data is available to Non-secure software.
If the Security Extension is implemented, when a Non-secure exception preempts software running in a Secure
state, additional context is saved onto the stack and the stacked registers are cleared to ensure no Secure data is
available to Non-secure software, as the following figure shows.
Figure 10. Stack frame extended to save additional context when the Security Extension is implemented
†
Or at offset 0x4C if at a word-aligned but not
doubleword-aligned address.
If the floating-point context is active, the Cortex‑M33 processor automatically stacks floating-point state in the
stack frame. There are two frame formats that contain floating-point context. If an exception is taken from Secure
state and FPCCR.TS is set, the additional floating-point context is stacked. In all other cases, only the standard
floating-point context is stacked, as the following figure shows.
Note: The conditions that trigger saving additional FP context are different from those that trigger additional integer
context.
Stack frame for Secure floating-point state when FPCCR.TS = 1 Stack frame for Secure floating-point state when FPCCR.TS = 0
The Stack pointer of the interrupted thread or handler is always used for stacking the state before the exception is
taken. For example if an exception is taken from Secure state to a Non-secure handler the Secure stack pointer is
used to save the state.
Immediately after stacking, the stack pointer indicates the lowest address in the stack frame.
The stack frame includes the return address. This is the address of the next instruction in the interrupted program.
This value is restored to the PC at exception return so that the interrupted program resumes.
In parallel to the stacking operation, the processor performs a vector fetch that reads the exception handler start
address from the vector table. When stacking is complete, the processor starts executing the exception handler.
At the same time, the processor writes an EXC_RETURN value to the LR. This value is used to trigger exception
return when the exception handler is complete.
If no higher priority exception occurs during exception entry, the processor starts executing the exception handler
and automatically changes the status of the corresponding pending interrupt to active.
If another higher priority exception occurs during exception entry, the processor starts executing the exception
handler for this exception and does not change the pending status of the earlier exception. This is the late arrival
case.
The processor saves an EXC_RETURN value to the LR on exception entry. The exception mechanism relies on
this value to detect when the processor has completed an exception handler. When the processor loads a value
matching this pattern to the PC it detects that the operation is not a normal branch operation and, instead, that the
exception is complete. As a result, it starts the exception return sequence. Bits[6:0] of the EXC_RETURN value
indicate the required return stack, processor mode, Security state, and stack frame as the following table shows.
The processor saves an EXC_RETURN value to the LR on exception entry. The exception mechanism relies on
this value to detect when the processor has completed an exception handler. When the processor loads a value
matching this pattern to the PC it detects that the operation is not a normal branch operation and, instead, that the
exception is complete. As a result, it starts the exception return sequence. Bits[6:0] of the EXC_RETURN value
indicate the required return stack, processor mode, and stack frame as the following table shows.
Secure and Non-secure Change to Secure state if the branch target address contains an SG
Non-secure
callable instruction.
Secure software can call a Non-secure function using the BLXNS instruction. When this happens, the LR is set to
a special value called FNC_RETURN, and the return address and XPSR is saved onto the Secure stack. Return
from Non-secure state to Secure state is triggered when one of the following instructions attempts to set the PC to
an FNC_RETURN value:
• A POP or LDM instruction that loads the PC.
• An LDR instruction that loads the PC.
• A BX instruction using any register.
When a return from Non-secure state to Secure state occurs the processor restores the program counter and
XPSR from the Secure stack.
Any scenario not listed in the table triggers a SecureFault. For example:
• Sequential instructions that cross security attributes from Secure to Non-secure.
• A 32-bit instruction fetch that crosses regions with different security attributes.
1. Occurs on an access to an XN region even if the processor does not include an MPU or the MPU is disabled.
2. Attempting to use an instruction set other than the T32 instruction set or returns to a non load/store-multiple instruction with
ICI continuation.
• A fault handler causes a fault with the same or lower priority as the fault it is servicing. This is because the
handler for the new fault cannot preempt the currently executing fault handler.
• An exception handler causes a fault for which the priority is the same as or lower than the currently
executing exception.
• A fault occurs and the handler for that fault is not enabled.
If a BusFault occurs during a stack push when entering a BusFault handler, the BusFault does not escalate to a
HardFault. This means that if a corrupted stack causes a fault, the fault handler executes even though the stack
push for the handler failed. The fault handler operates but the stack contents are corrupted.
The faults and fixed priority exceptions are also designated as Secure or Non-secure under the control of
AIRCR.BFHFMNINS. When AIRCR.BFHFMNINS is set to:
0 BusFaults and fixed priority exceptions are designated as Secure. The exceptions retain the
prioritization of HardFault at -1 and NMI at -2.
1 BusFaults and fixed priority exceptions are designated as Non-secure. In this case, Secure
HardFault is introduced at priority -3 to ensure that faults that target Secure state are
recognized.
The Non-secure state cannot inhibit BusFaults and fixed priority exceptions which target Secure state. Therefore
when faults and fixed priority exceptions are Secure, Non-secure FAULTMASK (FAULTMASK_NS) only inhibits
programmable priority exceptions, making it equivalent to Non-secure PRIMASK (PRIMASK_NS).
Non-secure programmable priority exceptions are mapped to the regular priority range 0-255, if AIRCR.PRIS is
clear. Non-secure programmable priority exceptions are mapped to the bottom half the regular priority range,
128-255, if AIRCR.PRIS is set to 1. Therefore the FAULTMASK_NS sets the execution priority to 0 or 80,
according to AIRCR.PRIS, to mask the Non-secure programmable priority exception only.
When BusFaults and fixed priority exceptions are Secure, FAULTMASK_S sets execution priority to -1 to inhibit
everything up to and including HardFault.
When BusFaults and fixed priority exceptions are designated as Non-secure, FAULTMASK_NS boosts priority to
-1 to inhibit everything up to Non-secure HardFault at priority -1, while FAULTMASK_S boosts priority to -3 to
inhibit all faults and fixed priority exceptions including the Secure HardFault at priority -3.
Note: Only Reset can preempt the fixed priority Secure HardFault when AIRCR.BFHFNMINS is set to 1. A Secure
HardFault when AIRCR.BFHFNMINS is set to 1 can preempt any exception other than Reset. A Secure
HardFault when AIRCR.BFHFNMINS is set to 0 can preempt any exception other than Reset, NMI, or another
HardFault.
2.6.4 Lockup
The processor enters a lockup state if a fault occurs when it cannot be serviced or escalated. When the processor
is in lockup state, it does not execute any instructions.
The processor remains in lockup state until either:
• It is reset.
• Preemption by a higher priority exception occurs.
• It is halted by a debugger.
Note: If lockup state occurs from a Secure HardFault when AIRCR.BFHFNMINS is set to 1 or the NMI handler, a
subsequent NMI does not cause the processor to leave lockup state.
If the event register is 1, it indicates that the processor must not enter sleep mode on execution of a WFE
instruction. Typically, this is because an external event signal is asserted, or a processor in the system has
executed an SEV instruction.
2.7.1.3 Sleep-on-exit
If the SLEEPONEXIT bit of the SCR is set to 1, when the processor completes the execution of all exception
handlers, it immediately enters sleep mode without restoring the Thread context from the stack. Use this
mechanism in applications that only require the processor to run when an exception occurs.
BFC Rd, #lsb, #width Bit Field Clear - Section 3.8.1 BFC and BFI
BL label Branch with Link - Section 3.9.2 B, BL, BX, and BLX
CMN Rn, Op2 Compare Negative N,Z,C,V Section 3.4.5 CMP and CMN
CMP Rn, Op2 Compare N,Z,C,V Section 3.4.5 CMP and CMN
Data Synchronization
DSB {opt} - Section 3.11.5 DSB
Barrier
Section 3.4.2 AND, ORR, EOR, BIC,
EOR, EORS {Rd,} Rn, Op2 Exclusive OR N,Z,C
and ORN
FLDMX (Decrement
Section 3.10.1 FLDMDBX,
FLDMDBX ,FLDMIAX Rn Before, Increment After) -
FLDMIAX
loads
FSTMX (Decrement
Section 3.10.2 FSTMDBX,
FSTMDBX,FSTMIAX Rn Before, Increment After) -
FSTMIAX
stores
Instruction
ISB {opt} - Section 3.11.6 ISB
Synchronization Barrier
IT - If Then condition block - Section 3.9.5 IT
LDA Rd, [Rn] Load-Acquire Word Section 3.12.9 LDA and STL
LDAB Rd, [Rn] Load-Acquire Byte Section 3.12.9 LDA and STL
Load-Acquire Exclusive
LDAEX Rd, [Rn] - Section 3.12.11 LDAEX and STLEX
Word
Load-Acquire Exclusive
LDAEXB Rd, [Rn] - Section 3.12.11 LDAEX and STLEX
Byte
Load-Acquire Exclusive
LDAEXH Rd, [Rn] - Section 3.12.11 LDAEX and STLEX
Halfword
LDAH Rd, [Rn] Load-Acquire Halfword - Section 3.12.9 LDA and STL
LDM Rn{!}, reglist Load Multiple - Section 3.12.6 LDM and STM
LDRB Rt, label Load Register Byte (literal) - Section 3.12.5 LDR, PC‑relative
Rt, Rt2, [Rn, Load Register Dual Section 3.12.2 LDR and STR,
LDRD -
#offset] (immediate offset) immediate offset
MLS Rd, Rn, Rm, Ra Multiply and Subtract - Section 3.5.1 MUL, MLA, and MLS
MOV, MOVS Rd, Op2 Move N,Z,C Section 3.4.6 MOV and MVN
MOV, MOVS Rd, Rm Move (register) N,Z Section 3.4.6 MOV and MVN
MOVW Rd, #imm16 Move 16-bit constant N,Z,C Section 3.4.6 MOV and MVN
MUL, MULS {Rd,} Rn, Rm Multiply N,Z Section 3.5.1 MUL, MLA, and MLS
MVN, MVNS Rd, Op2 Bitwise NOT N,Z,C Section 3.4.6 MOV and MVN
POP reglist Pop registers from stack - Section 3.12.8 PUSH and POP
PUSH reglist Push registers onto stack - Section 3.12.8 PUSH and POP
QADD {Rd,} Rn, Rm Saturating Add Q Section 3.6.3 QADD and QSUB
QADD16 {Rd,} Rn, Rm Saturating Add 16 - Section 3.6.3 QADD and QSUB
QADD8 {Rd,} Rn, Rm Saturating Add 8 - Section 3.6.3 QADD and QSUB
QSUB16 {Rd,} Rn, Rm Saturating Subtract 16 - Section 3.6.3 QADD and QSUB
QSUB8 {Rd,} Rn, Rm Saturating Subtract 8 - Section 3.6.3 QADD and QSUB
SADD8 {Rd,} Rn, Rm Signed Add 8 GE Section 3.4.9 SADD16 and SADD8
Signed Multiply
SMLAD, SMLADX Rd, Rn, Rm, Ra Q Section 3.5.4 SMLAD and SMLADX
Accumulate Dual
SMULBB,
Signed Multiply
SMULBT, {Rd,} Rn, Rm - Section 3.5.10 SMUL and SMULW
(halfwords)
SMULTB, SMULTT
RdLo, RdHi, Rn, Signed Multiply Long (32 Section 3.5.11 UMULL, UMAAL,
SMULL -
Rm × 32), 64-bit result UMLAL, SMULL, and SMLAL
SSUB8 {Rd,} Rn, Rm Signed Subtract 8 GE Section 3.4.15 SSUB16 and SSUB8
STL Rt, [Rn] Store-Release Word - Section 3.12.9 LDA and STL
STLB Rt, [Rn] Store-Release Byte - Section 3.12.9 LDA and STL
Store-Release Exclusive
STLEX Rt, Rt [Rn] - Section 3.12.11 LDAEX and STLEX
Word
Store-Release Exclusive
STLEXB Rt, Rt [Rn] - Section 3.12.11 LDAEX and STLEX
Byte
Store-Release Exclusive
STLEXH Rt, Rt [Rn] - Section 3.12.11 LDAEX and STLEX
Halfword
STLH Rt, [Rn] Store-Release Halfword - Section 3.12.9 LDA and STL
STM Rn{!}, reglist Store Multiple - Section 3.12.6 LDM and STM
Rd, Rm {,ROR
SXTB Sign extend 8 bits to 32 - Section 3.7.3 SXT and UXT
#n}
{Rd,} Rm {,ROR
SXTB16 Sign extend 8 bits to 16 - Section 3.7.3 SXT and UXT
#n}
{Rd,} Rm {,ROR Sign extend a Halfword to
SXTH - Section 3.7.3 SXT and UXT
#n} 32
TBB [Rn, Rm] Table Branch Byte - Section 3.9.6 TBB and TBH
TST Rn, Op2 Test N,Z,C Section 3.4.16 TST and TEQ
UADD8 {Rd,} Rn, Rm Unsigned Add 8 GE Section 3.4.17 UADD16 and UADD8
UDIV {Rd,} Rn, Rm Unsigned Divide - Section 3.5.2 SDIV and UDIV
USUB8 {Rd,} Rn, Rm Unsigned Subtract 8 GE Section 3.4.24 USUB16 and USUB8
.Td.F32 Sd, Sd, Convert from floating-point Section 3.10.7 VCVT between
VCVT -
#fbits to fixed point floating-point and fixed-point
{.size} Dd[x], Copy core register to Section 3.10.22 VMOV core register
VMOV -
Rt scalar to scalar
Floating-point Store
.F32 Sd, [Rn{, Register stores an
VSTR - Section 3.10.32 VSTR
#offset}] extension register to
memory
3.2.2 CMSE
CMSE is the compiler support for the Security Extension (architecture intrinsics and options) and is part of the
Arm C Language (ACLE) specification.
CMSE features are required when developing software running in Secure state. This provides mechanisms to
define Secure entry points and enable the tool chain to generate correct instructions or support functions in the
program image.
The CMSE features are accessed using various attributes and intrinsics. Additional macros are also defined as
part of the CMSE.
Table 33. CMSIS intrinsic functions to access the Non-secure special registers
3.3.1 Operands
An instruction operand can be an Arm register, a constant, or another instruction-specific parameter. Instructions
act on the operands and often store the result in a destination register. When there is a destination register in the
instruction, it is usually specified before the operands.
Operands in some instructions are flexible in that they can either be a register or a constant.
3.3.3.1 Constant
Instruction form when specifying an Operand2 constant.
#constant
where constant can be:
• Any constant that can be produced by shifting an 8‑bit value left by any number of bits within a 32‑bit word.
• Any constant of the form 0x00XY00XY.
• Any constant of the form 0xXY00XY00.
• Any constant of the form 0xXYXYXYXY.
Note: In these constants, X and Y are hexadecimal digits.
In addition, in a small number of instructions, constant can take a wider range of values. These are described in
the individual instruction descriptions.
When an Operand2 constant is used with the instructions MOVS, MVNS, ANDS, ORRS, ORNS, EORS, BICS, TEQ or
TST, the carry flag is updated to bit[31] of the constant, if the constant is greater than 255 and can be produced by
shifting an 8-bit value. These instructions do not affect the carry flag if Operand2 is any other constant.
ASR #n
Arithmetic shift right n bits, 1 ≤ n ≤ 32.
LSL #n
Logical shift left n bits, 1 ≤ n ≤ 31.
LSR #n
Logical shift right n bits, 1 ≤ n ≤ 32.
ROR #n
Rotate right n bits, 1 ≤ n ≤ 31.
RRX
Shift right one bit and insert the carry flag into the most significant bit of the result.
-
If omitted, no shift occurs, equivalent to LSL #0.
If you omit the shift, or specify LSL #0, the instruction uses the value in Rm.
If you specify a shift, the shift is applied to the value in Rm, and the resulting 32-bit value is used by the
instruction. However, the contents in the register Rm remain unchanged. Specifying a register with shift also
updates the carry flag when used with certain instructions.
The permitted shift lengths depend on the shift type and the instruction, see the individual instruction description
or the Flexible second operand. If the shift length is 0, no shift occurs. Register shift operations update the carry
flag except when the specified shift length is 0. The following sub-sections describe the various shift operations
and how they affect the carry flag. In these descriptions, Rm is the register containing the value to be shifted, and
n is the shift length.
3.3.4.1 ASR
Arithmetic shift right by n bits moves the left-hand 32-n bits of the register Rm, to the right by n places, into the
right-hand 32-n bits of the result. And it copies the original bit[31] of the register into the left‑hand n bits of the
result.
You can use the ASR #n operation to divide the value in the register Rm by 2n, with the result being rounded
towards negative-infinity.
When the instruction is ASRS or when ASR #n is used in Operand2 with the instructions MOVS, MVNS, ANDS,
ORRS, ORNS, EORS, BICS, TEQ or TST, the carry flag is updated to the last bit shifted out, bit[n-1], of the register
Rm.
Note: • If n is 32 or more, then all the bits in the result are set to the value of bit[31] of Rm.
• If n is 32 or more and the carry flag is updated, it is updated to the value of bit[31] of Rm.
31 5 4 3 2 1 0
3.3.4.2 LSR
Logical shift right by n bits moves the left-hand 32-n bits of the register Rm, to the right by n places, into the
right-hand 32-n bits of the result. And it sets the left‑hand n bits of the result to 0.
You can use the LSR #n operation to divide the value in the register Rm by 2n, if the value is regarded as an
unsigned integer.
When the instruction is LSRS or when LSR #n is used in Operand2 with the instructions MOVS, MVNS, ANDS, ORRS,
ORNS, EORS, BICS, TEQ or TST, the carry flag is updated to the last bit shifted out, bit[n-1], of the register Rm.
Note: • If n is 32 or more, then all the bits in the result are cleared to 0.
• If n is 33 or more and the carry flag is updated, it is updated to 0.
Carry
0 0 0 Flag
31 5 4 3 2 1 0
3.3.4.3 LSL
Logical shift left by n bits moves the right-hand 32-n bits of the register Rm, to the left by n places, into the
left-hand 32-n bits of the result. And it sets the right‑hand n bits of the result to 0.
You can use the LSL #n operation to multiply the value in the register Rm by 2n, if the value is regarded as an
unsigned integer or a two’s complement signed integer. Overflow can occur without warning.
When the instruction is LSLS or when LSL #n, with non-zero n, is used in Operand2 with the instructions MOVS,
MVNS, ANDS, ORRS, ORNS, EORS, BICS, TEQ or TST, the carry flag is updated to the last bit shifted out, bit[32-n],
of the register Rm. These instructions do not affect the carry flag when used with LSL #0.
Note: • If n is 32 or more, then all the bits in the result are cleared to 0.
• If n is 33 or more and the carry flag is updated, it is updated to 0.
0 0 0
31 5 4 3 2 1 0
Carry
Flag
3.3.4.4 ROR
Rotate right by n bits moves the left-hand 32-n bits of the register Rm, to the right by n places, into the right-hand
32-n bits of the result. And it moves the right‑hand n bits of the register into the left‑hand n bits of the result.
When the instruction is RORS or when ROR #n is used in Operand2 with the instructions MOVS, MVNS, ANDS,
ORRS, ORNS, EORS, BICS, TEQ or TST, the carry flag is updated to the last bit rotation, bit[n-1], of the register Rm.
Note: • If n is 32, then the value of the result is same as the value in Rm, and if the carry flag is updated, it is
updated to bit[31] of Rm.
• ROR with shift length, n, more than 32 is the same as ROR with shift length n-32.
31 5 4 3 2 1 0
3.3.4.5 RRX
Rotate right with extend moves the bits of the register Rm to the right by one bit. And it copies the carry flag into
bit[31] of the result.
When the instruction is RRXS or when RRX is used in Operand2 with the instructions MOVS, MVNS, ANDS, ORRS,
ORNS, EORS, BICS, TEQ or TST, the carry flag is updated to bit[0] of the register Rm.
31 30 1 0
All other load and store instructions generate a UsageFault exception if they perform an unaligned access, and
therefore their accesses must be address aligned.
Unaligned accesses are usually slower than aligned accesses. In addition, some memory regions might not
support unaligned accesses. Therefore, Arm recommends that programmers ensure that accesses are aligned.
To trap accidental generation of unaligned accesses, use the UNALIGN_TRP bit in the Configuration and Control
Register.
For more information about APSR, see Section 2.1.3.6.1 Application Program Status Register
The C condition flag is set in one of four ways:
• For an addition, including the comparison instruction CMN, C is set to 1 if the addition produced a carry (that
is, an unsigned overflow), and to 0 otherwise.
• For a subtraction, including the comparison instruction CMP, C is set to 0 if the subtraction produced a
borrow (that is, an unsigned underflow), and to 1 otherwise.
• For non-addition or subtractions that incorporate a shift operation, C is set to the last bit shifted out of the
value by the shifter.
• For other non-addition or subtractions, C is normally left unchanged. See the individual instruction
descriptions for any special cases.
Overflow occurs when the sign of the result, in bit[31], does not match the sign of the result had the operation
been performed at infinite precision. For example, the V condition flag can be set in one of four ways:
• If adding two negative values results in a positive value.
• If adding two positive values results in a negative value.
• If subtracting a positive value from a negative value generates a positive value.
• If subtracting a negative value from a positive value generates a negative value.
The Compare operations are identical to subtracting, for CMP, or adding, for CMN, except that the result is
discarded. See the instruction descriptions for more information.
Note: Most instructions update the status flags only if the S suffix is specified. See the instruction descriptions for more
information.
EQ Z=1 Equal.
MI N=1 Negative.
VS V=1 Overflow.
VC V=0 No overflow.
AL Can have any value Always. This is the default when no suffix is specified.
The following example shows the use of a conditional instruction to find the absolute value of a number. R0 =
abs(R1).
Absolute value MOVS R0, R1 ; R0 = R1, setting flags.
IT MI ; Skipping next instruction if value 0 or positive.
RSBMI R0, R0, #0 ; If negative, R0 = -R0.
The following example shows the use of conditional instructions to update the value of R4 if the signed values R0
is greater than R1 and R2 is greater than R3.
Compare and update value CMP R0, R1 ; Compare R0 and R1, setting flags.
ITT GT ; Skip next two instructions unless GT condition holds.
CMPGT R2, R3 ; If 'greater than', compare R2 and R3, setting flags.
MOVGT R4, R5 ; If still 'greater than', do R4 = R5.
ADC Add with Carry Section 3.4.1 ADD, ADC, SUB, SBC, and RSB
ADD Add Section 3.4.1 ADD, ADC, SUB, SBC, and RSB
ADDW Add Section 3.4.1 ADD, ADC, SUB, SBC, and RSB
AND Logical AND Section 3.4.2 AND, ORR, EOR, BIC, and ORN
ASR Arithmetic Shift Right Section 3.4.3 ASR, LSL, LSR, ROR, and RRX
BIC Bit Clear Section 3.4.2 AND, ORR, EOR, BIC, and ORN
EOR Exclusive OR Section 3.4.2 AND, ORR, EOR, BIC, and ORN
LSL Logical Shift Left Section 3.4.3 ASR, LSL, LSR, ROR, and RRX
LSR Logical Shift Right Section 3.4.3 ASR, LSL, LSR, ROR, and RRX
ORN Logical OR NOT Section 3.4.2 AND, ORR, EOR, BIC, and ORN
ORR Logical OR Section 3.4.2 AND, ORR, EOR, BIC, and ORN
RBIT Reverse Bits Section 3.4.8 REV, REV16, REVSH, and RBIT
REV Reverse byte order in a word Section 3.4.8 REV, REV16, REVSH, and RBIT
REV16 Reverse byte order in each halfword Section 3.4.8 REV, REV16, REVSH, and RBIT
REVSH Reverse byte order in bottom halfword and sign extend Section 3.4.8 REV, REV16, REVSH, and RBIT
ROR Rotate Right Section 3.4.3 ASR, LSL, LSR, ROR, and RRX
RRX Rotate Right with Extend Section 3.4.3 ASR, LSL, LSR, ROR, and RRX
RSB Reverse Subtract Section 3.4.1 ADD, ADC, SUB, SBC, and RSB
SASX Signed Add and Subtract with Exchange Section 3.4.10 SASX and SSAX
SSAX Signed Subtract and Add with Exchange Section 3.4.10 SASX and SSAX
SBC Subtract with Carry Section 3.4.1 ADD, ADC, SUB, SBC, and RSB
SHASX Signed Halving Add and Subtract with Exchange Section 3.4.13 SHASX and SHSAX
SHSAX Signed Halving Subtract and Add with Exchange Section 3.4.13 SHASX and SHSAX
SUB Subtract Section 3.4.1 ADD, ADC, SUB, SBC, and RSB
SUBW Subtract Section 3.4.1 ADD, ADC, SUB, SBC, and RSB
UASX Unsigned Add and Subtract with Exchange Section 3.4.18 UASX and USAX
USAX Unsigned Subtract and Add with Exchange Section 3.4.18 UASX and USAX
UHASX Unsigned Halving Add and Subtract with Exchange Section 3.4.20 UHASX and UHSAX
UHSAX Unsigned Halving Subtract and Add with Exchange Section 3.4.20 UHASX and UHSAX
USADA8 Unsigned Sum of Absolute Differences and Accumulate Section 3.4.23 USADA8
S
Is an optional suffix. If S is specified, the condition code flags are updated on the result of the operation.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the register holding the first operand.
Operand2
Is a flexible second operand.
imm12
Is any value in the range 0-4095.
Operation
The ADD instruction adds the value of Operand2 or imm12 to the value in Rn.
The ADC instruction adds the values in Rn and Operand2, together with the carry flag.
The SUB instruction subtracts the value of Operand2 or imm12 from the value in Rn.
The SBC instruction subtracts the value of Operand2 from the value in Rn. If the carry flag is clear, the result is
reduced by one.
The RSB instruction subtracts the value in Rn from the value of Operand2. This is useful because of the wide
range of options for Operand2.
Use ADC and SBC to synthesize multiword arithmetic.
Note: ADDW is equivalent to the ADD syntax that uses the imm12 operand. SUBW is equivalent to the SUB syntax that
uses the imm12 operand.
Restrictions
In these instructions:
• Operand2 must not be SP and must not be PC.
• Rd can be SP only in ADD and SUB, and only with the additional restrictions:
– Rn must also be SP.
– Any shift in Operand2 must be limited to a maximum of 3 bits using LSL.
• Rn can be SP only in ADD and SUB.
• Rd can be PC only in the ADD{cond} PC, PC, Rm instruction where:
– You must not specify the S suffix.
– Rm must not be PC and must not be SP.
– If the instruction is conditional, it must be the last instruction in the IT block.
• with the exception of the ADD{cond} PC, PC, Rm instruction, Rn can be PC only in ADD and SUB, and
only with the additional restrictions:
– You must not specify the S suffix.
– The second operand must be a constant in the range 0-4095.
Note: – When using the PC for an addition or a subtraction, bits[1:0] of the PC are rounded to 00 before
performing the calculation, making the base address for the calculation word-aligned.
– If you want to generate the address of an instruction, you have to adjust the constant based on the
value of the PC. Arm recommends that you use the ADR instruction instead of ADD or SUB with Rn
equal to the PC, because your assembler automatically calculates the correct constant for the ADR
instruction.
When Rd is PC in the ADD{cond} PC, PC, Rm instruction:
• Bit[0] of the value written to the PC is ignored.
• A branch occurs to the address created by forcing bit[0] of that value to 0.
Condition flags
If S is specified, these instructions update the N, Z, C and V flags according to the result.
Multiword values do not have to use consecutive registers. The following example shows instructions that subtract
a 96‑bit integer contained in R9, R1, and R11 from another contained in R6, R2, and R8. The example stores the
result in R6, R9, and R2.
96-bit subtraction SUBS R6, R6, R9 ; Subtract the least significant words.
SBCS R9, R2, R1 ; Subtract the middle words with carry.
SBC R2, R8, R11 ; Subtract the most significant words with carry.
S
Is an optional suffix. If S is specified, the condition code flags are updated on the result of the operation.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the register holding the first operand.
Operand2
Is a flexible second operand.
Operation
The AND, EOR, and ORR instructions perform bitwise AND, Exclusive OR, and OR operations on the values in Rn
and Operand2.
The BIC instruction performs an AND operation on the bits in Rn with the complements of the corresponding bits
in the value of Operand2.
The ORN instruction performs an OR operation on the bits in Rn with the complements of the corresponding bits in
the value of Operand2.
Restrictions
Do not use SP and do not use PC.
Condition flags
If S is specified, these instructions:
• Update the N and Z flags according to the result.
• Can update the C flag during the calculation of Operand2.
• Do not affect the V flag.
AND R9, R2, #0xFF00
ORREQ R2, R0, R5
ANDS R9, R8, #0x19
EORS R7, R11, #0x18181818
BIC R0, R1, #0xab
ORN R7, R11, R14, ROR #4
ORNS R7, R11, R14, ASR #32
S
Is an optional suffix. If S is specified, the condition code flags are updated on the result of the operation.
Rd
Is the destination register.
Rm
Is the register holding the value to be shifted.
Rs
Is the register holding the shift length to apply to the value in Rm. Only the least significant byte is used and can
be in the range 0-255.
n
Is the shift length. The range of shift length depends on the instruction:
ASR
Shift length from 1 to 32
LSL
Shift length from 0 to 31
LSR
Shift length from 1 to 32
ROR
Shift length from 1 to 31.
Note: MOVS Rd, Rm is the preferred syntax for LSLS Rd, Rm, #0.
Operation
ASR, LSL, LSR, and ROR move the bits in the register Rm to the left or right by the number of places specified by
constant n or register Rs.
RRX moves the bits in register Rm to the right by 1.
In all these instructions, the result is written to Rd, but the value in register Rm remains unchanged. For details on
what result is generated by the different instructions.
Restrictions
Do not use SP and do not use PC.
Condition flags
If S is specified:
• These instructions update the N, Z and C flags according to the result.
• The C flag is updated to the last bit shifted out, except when the shift length is 0.
ASR R7, R8, #9 ; Arithmetic shift right by 9 bits.
LSLS R1, R2, #3 ; Logical shift left by 3 bits with flag update.
LSR R4, R5, #6 ; Logical shift right by 6 bits.
ROR R4, R5, R6 ; Rotate right by the value in the bottom byte of R6.
RRX R4, R5 ; Rotate right with extend.
3.4.4 CLZ
Count Leading Zeros.
CLZ{cond} Rd, Rm
Where:
cond
Is an optional condition code.
Rd
Is the destination register.
Rm
Is the operand register.
Operation
The CLZ instruction counts the number of leading zeros in the value in Rm and returns the result in Rd. The result
value is 32 if no bits are set and zero if bit[31] is set.
Restrictions
Do not use SP and do not use PC.
Condition flags
This instruction does not change the flags.
CLZ R4,R9
CLZNE R2,R3
Operation
These instructions compare the value in a register with Operand2. They update the condition flags on the result,
but do not write the result to a register.
The CMP instruction subtracts the value of Operand2 from the value in Rn. This is the same as a SUBS
instruction, except that the result is discarded.
The CMN instruction adds the value of Operand2 to the value in Rn. This is the same as an ADDS instruction,
except that the result is discarded.
Restrictions
In these instructions:
• Do not use PC.
• Operand2 must not be SP.
Condition flags
These instructions update the N, Z, C and V flags according to the result.
CMP R2, R9
CMN R0, #6400
CMPGT SP, R7, LSL #2
S
Is an optional suffix. If S is specified, the condition code flags are updated on the result of the operation.
cond
Is an optional condition code.
Rd
Is the destination register.
Operand2
Is a flexible second operand.
Rm
The source register.
imm16
Is any value in the range 0-65535.
Operation
The MOV instruction copies the value of Operand2 into Rd.
When Operand2 in a MOV instruction is a register with a shift other than LSL #0, the preferred syntax is the
corresponding shift instruction:Also, the MOV instruction permits additional forms of Operand2 as synonyms for
shift instructions:
• ASR{S}{cond} Rd, Rm, #n is the preferred syntax for MOV{S}{cond} Rd, Rm, ASR #n.
• LSL{S}{cond} Rd, Rm, #n is the preferred syntax for MOV{S}{cond} Rd, Rm, LSL #n if n != 0.
• LSR{S}{cond} Rd, Rm, #n is the preferred syntax for MOV{S}{cond} Rd, Rm, LSR #n.
• ROR{S}{cond} Rd, Rm, #n is the preferred syntax for MOV{S}{cond} Rd, Rm, ROR #n.
• RRX{S}{cond} Rd, Rm is the preferred syntax for MOV{S}{cond} Rd, Rm, RRX.
• MOV{S}{cond} Rd, Rm, ASR Rs is a synonym for ASR{S}{cond} Rd, Rm, Rs.
• MOV{S}{cond} Rd, Rm, LSL Rs is a synonym for LSL{S}{cond} Rd, Rm, Rs.
• MOV{S}{cond} Rd, Rm, LSR Rs is a synonym for LSR{S}{cond} Rd, Rm, Rs.
• MOV{S}{cond} Rd, Rm, ROR Rs is a synonym for ROR{S}{cond} Rd, Rm, Rs.
The MVN instruction takes the value of Operand2, performs a bitwise logical NOT operation on the value, and
places the result into Rd.
Note: The MOVW instruction provides the same function as MOV, but is restricted to using the imm16 operand.
Restrictions
You can use SP and PC only in the MOV instruction, with the following restrictions:
• The second operand must be a register without shift.
• You must not specify the S suffix.
When Rd is PC in a MOV instruction:
• Bit[0] of the value written to the PC is ignored.
• A branch occurs to the address created by forcing bit[0] of that value to 0.
Note: Though it is possible to use MOV as a branch instruction, Arm strongly recommends the use of a BX or BLX
instruction to branch for software portability to the Arm instruction set.
Condition flags
If S is specified, these instructions:
• Update the N and Z flags according to the result.
• Can update the C flag during the calculation of Operand2.
• Do not affect the V flag.
MOVS R11, #0x000B ; Write value of 0x000B to R11, flags get updated.
MOV R1, #0xFA05 ; Write value of 0xFA05 to R1, flags are not updated.
MOVS R10, R12 ; Write value in R12 to R10, flags get updated.
MOV R3, #23 ; Write value of 23 to R3.
MOV R8, SP ; Write value of stack pointer to R8.
MVNS R2, #0xF ; Write value of 0xFFFFFFF0 (bitwise inverse of 0xF).
; to the R2 and update flags.
3.4.7 MOVT
Move Top.
Operation
MOVT writes a 16‑bit immediate value, imm16, to the top halfword, Rd[31:16], of its destination register. The write
does not affect Rd[15:0].
The MOV, MOVT instruction pair enables you to generate any 32‑bit constant.
Restrictions
Rd must not be SP and must not be PC.
Condition flags
This instruction does not change the flags.
MOVT R3, #0xF123 ; Write 0xF123 to upper halfword of R3, lower halfword
; and APSR are unchanged.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn
Is the register holding the operand.
Operation
Use these instructions to change endianness of data:
REV converts either:
• 32‑bit big‑endian data into little‑endian data.
• 32‑bit little‑endian data into big‑endian data.
REV16 converts either:
• 16‑bit big‑endian data into little‑endian data.
• 16‑bit little‑endian data into big‑endian data.
REVSH converts either:
• 16‑bit signed big‑endian data into 32‑bit signed little‑endian data.
• 16‑bit signed little‑endian data into 32‑bit signed big‑endian data.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
REV R3, R7 ; Reverse byte order of value in R7 and write it to R3.
REV16 R0, R0 ; Reverse byte order of each 16-bit halfword in R0.
REVSH R0, R5 ; Reverse Signed Halfword.
REVHS R3, R7 ; Reverse with Higher or Same condition.
RBIT R7, R8 ; Reverse bit order of value in R8 and write the result to R7.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
Use these instructions to perform a halfword or byte add in parallel.
The SADD16 instruction:The SADD8 instruction:
1. Adds each halfword from the first operand to the corresponding halfword of the second operand.
2. Writes the result in the corresponding halfwords of the destination register.
1. Adds each byte of the first operand to the corresponding byte of the second operand.
2. Writes the result in the corresponding bytes of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions set the APSR.GE bits according to the results of the additions.
For SADD16:
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<15:0>) + SInt(R[m]<15:0>);
sum2 = SInt(R[n]<31:16>) + SInt(R[m]<31:16>);
R[d]<15:0> = sum1<15:0>;
R[d]<31:16> = sum2<15:0>;
APSR.GE<1:0> = if sum1 >= 0 then '11' else '00';
APSR.GE<3:2> = if sum2 >= 0 then '11' else '00';
For SADD8:
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<7:0>) + SInt(R[m]<7:0>);
sum2 = SInt(R[n]<15:8>) + SInt(R[m]<15:8>);
sum3 = SInt(R[n]<23:16>) + SInt(R[m]<23:16>);
sum4 = SInt(R[n]<31:24>) + SInt(R[m]<31:24>);
R[d]<7:0> = sum1<7:0>;
R[d]<15:8> = sum2<7:0>;
R[d]<23:16> = sum3<7:0>;
R[d]<31:24> = sum4<7:0>;
APSR.GE<0> = if sum1 >= 0 then '1' else '0';
APSR.GE<1> = if sum2 >= 0 then '1' else '0';
APSR.GE<2> = if sum3 >= 0 then '1' else '0';
APSR.GE<3> = if sum4 >= 0 then '1' else '0';
op
Is one of:
SASX
Signed Add and Subtract with Exchange.
SSAX
Signed Subtract and Add with Exchange.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
The SASX instruction:
1. Adds the signed top halfword of the first operand with the signed bottom halfword of the second operand.
2. Writes the signed result of the addition to the top halfword of the destination register.
3. Subtracts the signed bottom halfword of the second operand from the top signed halfword of the first
operand.
4. Writes the signed result of the subtraction to the bottom halfword of the destination register.
The SSAX instruction:
1. Subtracts the signed bottom halfword of the second operand from the top signed halfword of the first
operand.
2. Writes the signed result of the addition to the bottom halfword of the destination register.
3. Adds the signed top halfword of the first operand with the signed bottom halfword of the second operand.
4. Writes the signed result of the subtraction to the top halfword of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions set the APSR.GE bits according to the results.
For SASX:
if ConditionPassed() then
EncodingSpecificOperations();
diff = SInt(R[n]<15:0>) - SInt(R[m]<31:16>);
sum = SInt(R[n]<31:16>) + SInt(R[m]<15:0>);
R[d]<15:0> = diff<15:0>;
R[d]<31:16> = sum<15:0>;
APSR.GE<1:0> = if diff >= 0 then '11' else '00';
APSR.GE<3:2> = if sum >= 0 then '11' else '00';
For SSAX:
if ConditionPassed() then
EncodingSpecificOperations();
sum = SInt(R[n]<15:0>) + SInt(R[m]<31:16>);
diff = SInt(R[n]<31:16>) - SInt(R[m]<15:0>);
R[d]<15:0> = sum<15:0>;
R[d]<31:16> = diff<15:0>;
APSR.GE<1:0> = if sum >= 0 then '11' else '00';
APSR.GE<3:2> = if diff >= 0 then '11' else '00';
3.4.11 SEL
Select bytes. Selects each byte of its result from either its first operand or its second operand, according to the
values of the GE flags.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
The SEL instruction:
1. Reads the value of each bit of APSR.GE.
2. Depending on the value of APSR.GE, assigns the destination register the value of either the first or second
operand register.
The behavior is:
if ConditionPassed() then
EncodingSpecificOperations();
R[d]<7:0> = if APSR.GE<0> == '1' then R[n]<7:0> else R[m]<7:0>;
R[d]<15:8> = if APSR.GE<1> == '1' then R[n]<15:8> else R[m]<15:8>;
R[d]<23:16> = if APSR.GE<2> == '1' then R[n]<23:16> else R[m]<23:16>;
R[d]<31:24> = if APSR.GE<3> == '1' then R[n]<31:24> else R[m]<31:24>;
Restrictions
None.
Condition flags
These instructions do not change the flags.
SADD16 R0, R1, R2 ; Set GE bits based on result.
SEL R0, R0, R3 ; Select bytes from R0 or R3, based on GE.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
Use these instructions to add 16-bit and 8-bit data and then to halve the result before writing the result to the
destination register.
The SHADD16 instruction:The SHADD8 instruction:
1. Adds each halfword from the first operand to the corresponding halfword of the second operand.
2. Shuffles the result by one bit to the right, halving the data.
3. Writes the halfword results in the destination register.
1. Adds each byte of the first operand to the corresponding byte of the second operand.
2. Shuffles the result by one bit to the right, halving the data.
3. Writes the byte results in the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
SHADD16 R1, R0 ; Adds halfwords in R0 to corresponding halfword of R1 and
; writes halved result to corresponding halfword in R1.
SHADD8 R4, R0, R5 ; Adds bytes of R0 to corresponding byte in R5 and
; writes halved result to corresponding byte in R4.
op
Is one of:
SHASX
Add and Subtract with Exchange and Halving.
SHSAX
Subtract and Add with Exchange and Halving.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
The SHASX instruction:
1. Adds the top halfword of the first operand with the bottom halfword of the second operand.
2. Writes the halfword result of the addition to the top halfword of the destination register, shifted by one bit to
the right causing a divide by two, or halving.
3. Subtracts the top halfword of the second operand from the bottom highword of the first operand.
4. Writes the halfword result of the division in the bottom halfword of the destination register, shifted by one bit
to the right causing a divide by two, or halving.
The SHSAX instruction:
1. Subtracts the bottom halfword of the second operand from the top highword of the first operand.
2. Writes the halfword result of the addition to the bottom halfword of the destination register, shifted by one bit
to the right causing a divide by two, or halving.
3. Adds the bottom halfword of the first operand with the top halfword of the second operand.
4. Writes the halfword result of the division in the top halfword of the destination register, shifted by one bit to
the right causing a divide by two, or halving.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
SHASX R7, R4, R2 ; Adds top halfword of R4 to bottom halfword of R2
; and writes halved result to top halfword of R7.
; Subtracts top halfword of R2 from bottom halfword of
; R4 and writes halved result to bottom halfword of R7.
SHSAX R0, R3, R5 ; Subtracts bottom halfword of R5 from top halfword
; of R3 and writes halved result to top halfword of R0.
; Adds top halfword of R5 to bottom halfword of R3 and
; writes halved result to bottom halfword of R0.
op
Is one of:
SHSUB16
Signed Halving Subtract 16.
SHSUB8
Signed Halving Subtract 8.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
Use these instructions to add 16-bit and 8-bit data and then to halve the result before writing the result to the
destination register.
The SHSUB16 instruction: The SHSUBB8 instruction:
1. Subtracts each halfword of the second operand from the corresponding halfwords of the first operand.
2. Shuffles the result by one bit to the right, halving the data.
3. Writes the halved halfword results in the destination register.
1. Subtracts each byte of the second operand from the corresponding byte of the first operand.
2. Shuffles the result by one bit to the right, halving the data.
3. Writes the corresponding signed byte results in the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
SHSUB16 R1, R0 ; Subtracts halfwords in R0 from corresponding halfword
; of R1 and writes to corresponding halfword of R1.
SHSUB8 R4, R0, R5 ; Subtracts bytes of R0 from corresponding byte in R5,
; and writes to corresponding byte in R4.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
Use these instructions to change endianness of data.
The SSUB16 instruction:The SSUB8 instruction:
1. Subtracts each halfword from the second operand from the corresponding halfword of the first operand.
2. Writes the difference result of two signed halfwords in the corresponding halfword of the destination register.
1. Subtracts each byte of the second operand from the corresponding byte of the first operand.
2. Writes the difference result of four signed bytes in the corresponding byte of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions set the APSR.GE bits according to the results of the subtractions.
For SSUB16:
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<15:0>) - SInt(R[m]<15:0>);
diff2 = SInt(R[n]<31:16>) - SInt(R[m]<31:16>);
R[d]<15:0> = diff1<15:0>;
R[d]<31:16> = diff2<15:0>;
For SSUB8:
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<7:0>) - SInt(R[m]<7:0>);
diff2 = SInt(R[n]<15:8>) - SInt(R[m]<15:8>);
diff3 = SInt(R[n]<23:16>) - SInt(R[m]<23:16>);
diff4 = SInt(R[n]<31:24>) - SInt(R[m]<31:24>);
R[d]<7:0> = diff1<7:0>;
R[d]<15:8> = diff2<7:0>;
R[d]<23:16> = diff3<7:0>;
R[d]<31:24> = diff4<7:0>;
APSR.GE<0> = if diff1 >= 0 then '1' else '0';
APSR.GE<1> = if diff2 >= 0 then '1' else '0';
APSR.GE<2> = if diff3 >= 0 then '1' else '0';
Operation
These instructions test the value in a register against Operand2. They update the condition flags based on the
result, but do not write the result to a register.
The TST instruction performs a bitwise AND operation on the value in Rn and the value of Operand2. This is the
same as the ANDS instruction, except that it discards the result.
To test whether a bit of Rn is 0 or 1, use the TST instruction with an Operand2 constant that has that bit set to 1
and all other bits cleared to 0.
The TEQ instruction performs a bitwise Exclusive OR operation on the value in Rn and the value of Operand2.
This is the same as the EORS instruction, except that it discards the result.
Use the TEQ instruction to test if two values are equal without affecting the V or C flags.
TEQ is also useful for testing the sign of a value. After the comparison, the N flag is the logical Exclusive OR of the
sign bits of the two operands.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions:
• Update the N and Z flags according to the result.
• Can update the C flag during the calculation of Operand2,
• Do not affect the V flag.
TST R0, #0x3F8 ; Perform bitwise AND of R0 value to 0x3F8,
; APSR is updated but result is discarded
TEQEQ R10, R9 ; Conditionally test if value in R10 is equal to
; value in R9, APSR is updated but result is discarded.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
Use these instructions to add 16- and 8-bit unsigned data.
The UADD16 instruction:
1. Adds each halfword from the first operand to the corresponding halfword of the second operand.
2. Writes the unsigned result in the corresponding halfwords of the destination register.
The UADD8 instruction:
1. Adds each byte of the first operand to the corresponding byte of the second operand.
2. Writes the unsigned result in the corresponding byte of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions set the APSR.GE bits according to the results of the additions.
For UADD16:
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<15:0>) + UInt(R[m]<15:0>);
sum2 = UInt(R[n]<31:16>) + UInt(R[m]<31:16>);
R[d]<15:0> = sum1<15:0>;
R[d]<31:16> = sum2<15:0>;
APSR.GE<1:0> = if sum1 >= 0x10000 then '11' else '00';
APSR.GE<3:2> = if sum2 >= 0x10000 then '11' else '00';
For UADD8:
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<7:0>) + UInt(R[m]<7:0>);
sum2 = UInt(R[n]<15:8>) + UInt(R[m]<15:8>);
sum3 = UInt(R[n]<23:16>) + UInt(R[m]<23:16>);
sum4 = UInt(R[n]<31:24>) + UInt(R[m]<31:24>);
R[d]<7:0> = sum1<7:0>;
R[d]<15:8> = sum2<7:0>;
R[d]<23:16> = sum3<7:0>;
R[d]<31:24> = sum4<7:0>;
APSR.GE<0> = if sum1 >= 0x100 then '1' else '0';
APSR.GE<1> = if sum2 >= 0x100 then '1' else '0';
APSR.GE<2> = if sum3 >= 0x100 then '1' else '0';
APSR.GE<3> = if sum4 >= 0x100 then '1' else '0';
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
The UASX instruction:
1. Subtracts the top halfword of the second operand from the bottom halfword of the first operand.
2. Writes the unsigned result from the subtraction to the bottom halfword of the destination register.
3. Adds the top halfword of the first operand with the bottom halfword of the second operand.
4. Writes the unsigned result of the addition to the top halfword of the destination register.
The USAX instruction:
1. Adds the bottom halfword of the first operand with the top halfword of the second operand.
2. Writes the unsigned result of the addition to the bottom halfword of the destination register.
3. Subtracts the bottom halfword of the second operand from the top halfword of the first operand.
4. Writes the unsigned result from the subtraction to the top halfword of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions set the APSR.GE bits according to the results.
For UASX:
if ConditionPassed() then
EncodingSpecificOperations();
diff = UInt(R[n]<15:0>) - UInt(R[m]<31:16>);
sum = UInt(R[n]<31:16>) + UInt(R[m]<15:0>);
R[d]<15:0> = diff<15:0>;
R[d]<31:16> = sum<15:0>;
APSR.GE<1:0> = if diff >= 0 then '11' else '00';
APSR.GE<3:2> = if sum >= 0x10000 then '11' else '00';
For USAX:
if ConditionPassed() then
EncodingSpecificOperations();
sum = UInt(R[n]<15:0>) + UInt(R[m]<31:16>);
diff = UInt(R[n]<31:16>) - UInt(R[m]<15:0>);
R[d]<15:0> = sum<15:0>;
R[d]<31:16> = diff<15:0>;
APSR.GE<1:0> = if sum >= 0x10000 then '11' else '00';
APSR.GE<3:2> = if diff >= 0 then '11' else '00';
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the register holding the first operand.
Rm
Is the register holding the second operand.
Operation
Use these instructions to add 16- and 8-bit data and then to halve the result before writing the result to the
destination register.
The UHADD16 instruction:
1. Adds each halfword from the first operand to the corresponding halfword of the second operand.
2. Shuffles the halfword result by one bit to the right, halving the data.
3. Writes the unsigned results to the corresponding halfword in the destination register.
The UHADD8 instruction:
1. Adds each byte of the first operand to the corresponding byte of the second operand.
2. Shuffles the byte result by one bit to the right, halving the data.
3. Writes the unsigned results in the corresponding byte in the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
UHADD16 R7, R3 ; Adds halfwords in R7 to corresponding halfword of R3
; and writes halved result to corresponding halfword in R7.
UHADD8 R4, R0, R5 ; Adds bytes of R0 to corresponding byte in R5 and writes
; halved result to corresponding byte in R4.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
The UHASX instruction:
1. Adds the top halfword of the first operand with the bottom halfword of the second operand.
2. Shifts the result by one bit to the right causing a divide by two, or halving.
3. Writes the halfword result of the addition to the top halfword of the destination register.
4. Subtracts the top halfword of the second operand from the bottom halfword of the first operand.
5. Shifts the result by one bit to the right causing a divide by two, or halving.
6. Writes the halfword result of the subtraction in the bottom halfword of the destination register.
The UHSAX instruction:
1. Subtracts the bottom halfword of the second operand from the top halfword of the first operand.
2. Shifts the result by one bit to the right causing a divide by two, or halving.
3. Writes the halfword result of the subtraction in the top halfword of the destination register.
4. Adds the bottom halfword of the first operand with the top halfword of the second operand.
5. Shifts the result by one bit to the right causing a divide by two, or halving.
6. Writes the halfword result of the addition to the bottom halfword of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
UHASX R7, R4, R2 ; Adds top halfword of R4 with bottom halfword of R2
; and writes halved result to top halfword of R7.
; Subtracts top halfword of R2 from bottom halfword of
; R7 and writes halved result to bottom halfword of R7.
UHSAX R0, R3, R5 ; Subtracts bottom halfword of R5 from top halfword of
; R3 and writes halved result to top halfword of R0.
; Adds top halfword of R5 to bottom halfword of R3 and
; writes halved result to bottom halfword of R0.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
Use these instructions to add 16-bit and 8-bit data and then to halve the result before writing the result to the
destination register.
The UHSUB16 instruction:
1. Subtracts each halfword of the second operand from the corresponding halfword of the first operand.
2. Shuffles each halfword result to the right by one bit, halving the data.
3. Writes each unsigned halfword result to the corresponding halfwords in the destination register.
The UHSUB8 instruction:
1. Subtracts each byte of second operand from the corresponding byte of the first operand.
2. Shuffles each byte result by one bit to the right, halving the data.
3. Writes the unsigned byte results to the corresponding byte of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
3.4.22 USAD8
Unsigned Sum of Absolute Differences.
Operation
The USAD8 instruction:
1. Subtracts each byte of the second operand register from the corresponding byte of the first operand register.
2. Adds the absolute values of the differences together.
3. Writes the result to the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
USAD8 R1, R4, R0 ; Subtracts each byte in R0 from corresponding byte of R4
; adds the differences and writes to R1.
USAD8 R0, R5 ; Subtracts bytes of R5 from corresponding byte in R0,
; adds the differences and writes to R0.
3.4.23 USADA8
Unsigned Sum of Absolute Differences and Accumulate.
Ra
Is the register that contains the accumulation value.
Operation
The USADA8 instruction:
1. Subtracts each byte of the second operand register from the corresponding byte of the first operand register.
2. Adds the unsigned absolute differences together.
3. Adds the accumulation value to the sum of the absolute differences.
4. Writes the result to the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
USADA8 R1, R0, R6 ; Subtracts bytes in R0 from corresponding halfword of R1
; adds differences, adds value of R6, writes to R1.
USADA8 R4, R0, R5, R2 ; Subtracts bytes of R5 from corresponding byte in R0
; adds differences, adds value of R2 writes to R4.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register.
Operation
Use these instructions to subtract 16-bit and 8-bit data before writing the result to the destination register.
The USUB16 instruction:
1. Subtracts each halfword from the second operand register from the corresponding halfword of the first
operand register.
2. Writes the unsigned result in the corresponding halfwords of the destination register.
The USUB8 instruction:
1. Subtracts each byte of the second operand register from the corresponding byte of the first operand register.
2. Writes the unsigned byte result in the corresponding byte of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions set the APSR.GE bits according to the results of the subtractions.
For USUB16:
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<15:0>) - UInt(R[m]<15:0>);
diff2 = UInt(R[n]<31:16>) - UInt(R[m]<31:16>);
R[d]<15:0> = diff1<15:0>;
R[d]<31:16> = diff2<15:0>;
APSR.GE<1:0> = if diff1 >= 0 then '11' else '00';
APSR.GE<3:2> = if diff2 >= 0 then '11' else '00';
For USUB8:
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<7:0>) - UInt(R[m]<7:0>);
diff2 = UInt(R[n]<15:8>) - UInt(R[m]<15:8>);
diff3 = UInt(R[n]<23:16>) - UInt(R[m]<23:16>);
diff4 = UInt(R[n]<31:24>) - UInt(R[m]<31:24>);
R[d]<7:0> = diff1<7:0>;
R[d]<15:8> = diff2<7:0>;
R[d]<23:16> = diff3<7:0>;
R[d]<31:24> = diff4<7:0>;
APSR.GE<0> = if diff1 >= 0 then '1' else '0';
APSR.GE<1> = if diff2 >= 0 then '1' else '0';
APSR.GE<2> = if diff3 >= 0 then '1' else '0';
APSR.GE<3> = if diff4 >= 0 then '1' else '0';
MLA Multiply with Accumulate, 32-bit result Section 3.5.1 MUL, MLA, and MLS
MLS Multiply and Subtract, 32-bit result Section 3.5.1 MUL, MLA, and MLS
MUL Multiply, 32-bit result Section 3.5.1 MUL, MLA, and MLS
Signed Multiply with Accumulate (32 × 32 + 64), Section 3.5.11 UMULL, UMAAL, UMLAL, SMULL,
SMLAL
64-bit result and SMLAL
Section 3.5.5 SMLALD, SMLALDX, SMLALBB,
SMLAL[B,T] Signed Multiply Accumulate Long (halfwords)
SMLALBT, SMLALTB, and SMLALTT
SMLSLD Signed Multiply Subtract Long Dual Section 3.5.6 SMLSD and SMLSLD
SMMUL, SMMULR Signed Most Significant Word Multiply Section 3.5.8 SMMUL
SMUAD, SMUADX Signed Dual Multiply Add Section 3.5.9 SMUAD and SMUSD
SMUL[B,T] Signed Multiply (word by halfword) Section 3.5.10 SMUL and SMULW
SMUSDX ,SMUSD Signed Dual Multiply Subtract Section 3.5.9 SMUAD and SMUSD
Unsigned Multiply Accumulate Accumulate Long Section 3.5.11 UMULL, UMAAL, UMLAL, SMULL,
UMAAL
(32 × 32 + 32 + 32), 64-bit result and SMLAL
Unsigned Multiply with Accumulate (32 × 32 + Section 3.5.11 UMULL, UMAAL, UMLAL, SMULL,
UMLAL
64), 64-bit result and SMLAL
Section 3.5.11 UMULL, UMAAL, UMLAL, SMULL,
UMULL Unsigned Multiply (32 × 32), 64-bit result
and SMLAL
Operation
The MUL instruction multiplies the values from Rn and Rm, and places the least significant 32 bits of the result in
Rd.
The MLA instruction multiplies the values from Rn and Rm, adds the value from Ra, and places the least
significant 32 bits of the result in Rd.
The MLS instruction multiplies the values from Rn and Rm, subtracts the product from the value from Ra, and
places the least significant 32 bits of the result in Rd.
The results of these instructions do not depend on whether the operands are signed or unsigned.
Restrictions
In these instructions, do not use SP and do not use PC.
If you use the S suffix with the MUL instruction:
• Rd, Rn, and Rm must all be in the range R0-R7.
• Rd must be the same as Rm.
• You must not use the cond suffix.
Condition flags
The MLA instruction and MULS instructions:
• Only MULS instruction updates the N and Z flags according to the result.
• No other MUL, MLA, or MLS instruction affects the condition flags.
MUL R10, R2, R5 ; Multiply, R10 = R2 × R5
MLA R10, R2, R1, R5 ; Multiply with accumulate, R10 = (R2 × R1) + R5
MULS R0, R2, R2 ; Multiply with flag update, R0 = R2 × R2
MULLT R2, R3, R2 ; Conditionally multiply, R2 = R3 × R2
MLS R4, R5, R6, R7 ; Multiply with subtract, R4 = R7 - (R5 × R6)
Operation
The SDIV instruction performs a signed integer division of the value in Rn by the value in Rm.
The UDIV instruction performs an unsigned integer division of the value in Rn by the value in Rm.
For both instructions, if the value in Rn is not divisible by the value in Rm, the result is rounded towards zero.
For the Cortex‑M33 processor, the integer divide operation latency is in the range of 2-11 cycles.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not change the flags.
SMLAWT
Signed Multiply Accumulate (word by halfword)
The top halfword, bits [31:16] of Rm is used.
SMLABB, SMLABT
Signed Multiply Accumulate Long (halfwords)
The bottom halfword, bits [15:0], of Rm is used.
SMLATB, SMLATT
Signed Multiply Accumulate Long (halfwords)
The top halfword, bits [31:16] of Rm is used.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn, Rm
Are registers holding the values to be multiplied.
Ra
Is a register holding the value to be added or subtracted from.
Operation
The SMLABB, SMLABT, SMLATB, SMLATT instructions:
• Multiply the specified signed halfword, top or bottom, values from Rn and Rm.
• Add the value in Ra to the resulting 32-bit product.
• Write the result of the multiplication and addition in Rd.
The non-specified halfwords of the source registers are ignored.
The SMLAWB and SMLAWT instructions:
• Multiply the 32-bit signed values in Rn with:
– The top signed halfword of Rm, T instruction suffix.
– The bottom signed halfword of Rm, B instruction suffix.
• Add the 32-bit signed value in Ra to the top 32 bits of the 48-bit product
• Write the result of the multiplication and addition in Rd.
The bottom 16 bits of the 48-bit product are ignored.
If overflow occurs during the addition of the accumulate value, the SMLAWB, SMLAWT, instruction sets the Q flag in
the APSR. No overflow can occur during the multiplication.
Restrictions
In these instructions, do not use SP and do not use PC.
Condition flags
If an overflow is detected, the Q flag is set.
SMLABB R5, R6, R4, R1 ; Multiplies bottom halfwords of R6 and R4, adds
; R1 and writes to R5.
SMLATB R5, R6, R4, R1 ; Multiplies top halfword of R6 with bottom halfword
; of R4, adds R1 and writes to R5.
SMLATT R5, R6, R4, R1 ; Multiplies top halfwords of R6 and R4, adds
; R1 and writes the sum to R5.
SMLABT R5, R6, R4, R1 ; Multiplies bottom halfword of R6 with top halfword
; of R4, adds R1 and writes to R5.
SMLABT R4, R3, R2 ; Multiplies bottom halfword of R4 with top halfword of
; R3, adds R2 and writes to R4.
SMLAWB R10, R2, R5, R3 ; Multiplies R2 with bottom halfword of R5, adds
; R3 to the result and writes top 32-bits to R10.
SMLAWT R10, R2, R1, R5 ; Multiplies R2 with top halfword of R1, adds R5
; and writes top 32-bits to R10.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn
Is the first operand register holding the values to be multiplied.
Rm
Is the second operand register.
Ra
Is the accumulate value.
Operation
The SMLAD and SMLADX instructions regard the two operands as four halfword 16-bit values.
The SMLAD instruction:
1. Multiplies the top signed halfword value in Rn with the top signed halfword of Rm and the bottom signed
halfword value in Rn with the bottom signed halfword of Rm.
2. Adds both multiplication results to the signed 32-bit value in Ra.
3. Writes the 32-bit signed result of the multiplication and addition to Rd.
The SMLADX instruction:
1. Multiplies the top signed halfword value in Rn with the bottom signed halfword of Rm and the bottom signed
halfword value in Rn with the top signed halfword of Rm.
2. Adds both multiplication results to the signed 32-bit value in Ra.
3. Writes the 32-bit signed result of the multiplication and addition to Rd.
Restrictions
Do not use SP and do not use PC.
Condition flags
Sets the Q flag if the accumulate operation overflows.
SMLAD R10, R2, R1, R5 ; Multiplies two halfword values in R2 with
; corresponding halfwords in R1, adds R5 and writes to
; R10.
SMLALDX R0, R2, R4, R6 ; Multiplies top halfword of R2 with bottom halfword
; of R4, multiplies bottom halfword of R2 with top
; halfword of R4, adds R6 and writes to R0.
cond
Is an optional condition code.
RdHi, RdLo
Are the destination registers. RdLo is the lower 32 bits and RdHi is the upper 32 bits of the 64-bit integer. The
accumulating value for the lower and upper 32 bits are held in the RdLo and RdHi registers respectively.
Rn, Rm
Are registers holding the first and second operands.
Operation
• Multiplies the two’s complement signed word values from Rn and Rm.
• Adds the 64-bit value in RdLo and RdHi to the resulting 64-bit product.
• Writes the 64-bit result of the multiplication and addition in RdLo and RdHi.
The SMLALBB, SMLALBT, SMLALTB and SMLALTT instructions:
• Multiplies the specified signed halfword, Top or Bottom, values from Rn and Rm.
• Adds the resulting sign-extended 32-bit product to the 64-bit value in RdLo and RdHi.
• Writes the 64-bit result of the multiplication and addition in RdLo and RdHi.
The non-specified halfwords of the source registers are ignored.
The SMLALD and SMLALDX instructions interpret the values from Rn and Rm as four halfword two’s complement
signed 16-bit integers. These instructions:
• SMLALD multiplies the top signed halfword value of Rn with the top signed halfword of Rm and the bottom
signed halfword values of Rn with the bottom signed halfword of Rm.
• SMLALDX multiplies the top signed halfword value of Rn with the bottom signed halfword of Rm and the
bottom signed halfword values of Rn with the top signed halfword of Rm.
• Add the two multiplication results to the signed 64-bit value in RdLo and RdHi to create the resulting 64-bit
product.
• Write the 64-bit product in RdLo and RdHi.
Restrictions
In these instructions:
• Do not use SP and do not use PC.
• RdHi and RdLo must be different registers.
Condition flags
These instructions do not affect the condition code flags.
SMLALBT R2, R1, R6, R7 ; Multiplies bottom halfword of R6 with top
; halfword of R7, sign extends to 32-bit, adds
; R1:R2 and writes to R1:R2.
SMLALTB R2, R1, R6, R7 ; Multiplies top halfword of R6 with bottom
; halfword of R7,sign extends to 32-bit, adds R1:R2
; and writes to R1:R2.
SMLALD R6, R8, R5, R1 ; Multiplies top halfwords in R5 and R1 and bottom
; halfwords of R5 and R1, adds R8:R6 and writes to
; R8:R6.
SMLALDX R6, R8, R5, R1 ; Multiplies top halfword in R5 with bottom
; halfword of R1, and bottom halfword of R5 with
; top halfword of R1, adds R8:R6 and writes to
; R8:R6.
op
Is one of:
SMLSD
Signed Multiply Subtract Dual.
SMLSDX
Signed Multiply Subtract Dual reversed.
SMLSLD
Signed Multiply Subtract Long Dual.
SMLSLDX
Signed Multiply Subtract Long Dual reversed.
If X is present, the multiplications are bottom × top and top × bottom. If the X is omitted, the multiplications are
bottom × bottom and top × top.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn, Rm
Are registers holding the first and second operands.
Ra
Is the register holding the accumulate value.
RdLo
Supplies the lower 32 bits of the accumulate value, and is the destination register for the lower 32 bits of the
result.
RdHi
Supplies the upper 32 bits of the accumulate value, and is the destination register for the upper 32 bits of the
result.
Operation
The SMLSD instruction interprets the values from the first and second operands as four signed halfwords. This
instruction:
• Optionally rotates the halfwords of the second operand.
• Performs two signed 16 × 16-bit halfword multiplications.
• Subtracts the result of the upper halfword multiplication from the result of the lower halfword multiplication.
• Adds the signed accumulate value to the result of the subtraction.
• Writes the result of the addition to the destination register.
The SMLSLD instruction interprets the values from Rn and Rm as four signed halfwords. This instruction:
• Optionally rotates the halfwords of the second operand.
• Performs two signed 16 × 16-bit halfword multiplications.
• Subtracts the result of the upper halfword multiplication from the result of the lower halfword multiplication.
• Adds the 64-bit value in RdHi and RdLo to the result of the subtraction.
• Writes the 64-bit result of the addition to the RdHi and RdLo.
Restrictions
In these instructions:
• Do not use SP and do not use PC.
Condition flags
The SMLSD{X} instruction sets the Q flag if the accumulate operation overflows. Overflow cannot occur during the
multiplications or subtraction.
For the T32 instruction set, these instructions do not affect the condition code flags.
SMLSD R0, R4, R5, R6 ; Multiplies bottom halfword of R4 with bottom
; halfword of R5, multiplies top halfword of R4
; with top halfword of R5, subtracts second from
; first, adds R6, writes to R0.
SMLSDX R1, R3, R2, R0 ; Multiplies bottom halfword of R3 with top
; halfword of R2, multiplies top halfword of R3
; with bottom halfword of R2, subtracts second from
; first, adds R0, writes to R1.
SMLSLD R3, R6, R2, R7 ; Multiplies bottom halfword of R6 with bottom
; halfword of R2, multiplies top halfword of R6
; with top halfword of R2, subtracts second from
; first, adds R6:R3, writes to R6:R3.
SMLSLDX R3, R6, R2, R7 ; Multiplies bottom halfword of R6 with top
; halfword of R2, multiplies top halfword of R6
; with bottom halfword of R2, subtracts second from
; first, adds R6:R3, writes to R6:R3.
R
If R is present, the result is rounded instead of being truncated. In this case the constant 0x80000000 is added to
the product before the top halfword is extracted.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn, Rm
Are registers holding the first and second multiply operands.
Ra
Is the register holding the accumulate value.
Operation
The SMMLA instruction interprets the values from Rn and Rm as signed 32-bit words.
The SMMLA instruction:
• Multiplies the values in Rn and Rm.
• Optionally rounds the result by adding 0x80000000.
• Extracts the most significant 32 bits of the result.
Restrictions
In these instructions:
• Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
SMMLA R0, R4, R5, R6 ; Multiplies R4 and R5, extracts top 32 bits, adds
; R6, truncates and writes to R0.
SMMLAR R6, R2, R1, R4 ; Multiplies R2 and R1, extracts top 32 bits, adds
; R4, rounds and writes to R6.
SMMLSR R3, R6, R2, R7 ; Multiplies R6 and R2, extracts top 32 bits,
; subtracts R7, rounds and writes to R3.
SMMLS R4, R5, R3, R8 ; Multiplies R5 and R3, extracts top 32 bits,
; subtracts R8, truncates and writes to R4.
3.5.8 SMMUL
Signed Most Significant Word Multiply.
op{R}{cond} Rd, Rn, Rm
Where:
op
Is one of:
SMMUL
Signed Most Significant Word Multiply.
R
If R is present, the result is rounded instead of being truncated. In this case the constant 0x80000000 is added to
the product before the top halfword is extracted.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn, Rm
Are registers holding the first and second operands.
Operation
The SMMUL instruction interprets the values from Rn and Rm as two’s complement 32-bit signed integers. The
SMMUL instruction:
• Multiplies the values from Rn and Rm.
• Optionally rounds the result, otherwise truncates the result.
• Writes the most significant signed 32 bits of the result in Rd.
Restrictions
In this instruction:
• Do not use SP and do not use PC.
Condition flags
This instruction does not affect the condition code flags.
SMMUL R0, R4, R5 ; Multiplies R4 and R5, truncates top 32 bits
; and writes to R0.
SMMULR R6, R2 ; Multiplies R6 and R2, rounds the top 32 bits
; and writes to R6.
If X is present, the multiplications are bottom × top and top × bottom. If the X is omitted, the multiplications are
bottom × bottom and top × top.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn, Rm
Are registers holding the first and the second operands.
Operation
The SMUAD instruction interprets the values from the first and second operands as two signed halfwords in each
operand. This instruction:
• Optionally rotates the halfwords of the second operand.
• Performs two signed 16 × 16-bit multiplications.
• Adds the two multiplication results together.
• Writes the result of the addition to the destination register.
The SMUSD instruction interprets the values from the first and second operands as two’s complement signed
integers. This instruction:
• Optionally rotates the halfwords of the second operand.
• Performs two signed 16 × 16-bit multiplications.
• Subtracts the result of the top halfword multiplication from the result of the bottom halfword multiplication.
• Writes the result of the subtraction to the destination register.
Restrictions
In these instructions:
• Do not use SP and do not use PC.
Condition flags
SMUAD, SMUADX set the Q flag if the addition overflows. The multiplications cannot overflow.
X and Y specify which halfword of the source registers Rn and Rm is used as the first and second multiply
operand. If X is B, then the bottom halfword, bits [15:0] of Rn is used. If X is T, then the top halfword, bits [31:16]
of Rn is used. If Y is B, then the bottom halfword, bits [15:0], of Rm is used. If Y is T, then the top halfword, bits
[31:16], of Rm is used.
Y specifies which halfword of the source register Rm is used as the second multiply operand. If Y is B, then the
bottom halfword (bits [15:0]) of Rm is used. If Y is T, then the top halfword (bits [31:16]) of Rm is used.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn, Rm
Are registers holding the first and second operands.
Operation
The SMULBB, SMULTB, SMULBT and SMULTT instructions interprets the values from Rn and Rm as four signed
16-bit integers.
These instructions:
• Multiply the specified signed halfword, Top or Bottom, values from Rn and Rm.
• Write the 32-bit result of the multiplication in Rd.
The SMULWT and SMULWB instructions interprets the values from Rn as a 32-bit signed integer and Rm as two
halfword 16-bit signed integers. These instructions:
• Multiply the first operand and the top, T suffix, or the bottom, B suffix, halfword of the second operand.
• Write the signed most significant 32 bits of the 48-bit result in the destination register.
Restrictions
In these instructions:
• Do not use SP and do not use PC.
• RdHi and RdLo must be different registers.
SMULBT R0, R4, R5 ; Multiplies the bottom halfword of R4 with the
; top halfword of R5, multiplies results and
; writes to R0.
SMULBB R0, R4, R5 ; Multiplies the bottom halfword of R4 with the
; bottom halfword of R5, multiplies results and
; writes to R0.
SMULTT R0, R4, R5 ; Multiplies the top halfword of R4 with the top
; halfword of R5, multiplies results and writes
; to R0.
SMULTB R0, R4, R5 ; Multiplies the top halfword of R4 with the
; bottom halfword of R5, multiplies results and
; and writes to R0.
SMULWT R4, R5, R3 ; Multiplies R5 with the top halfword of R3,
; extracts top 32 bits and writes to R4.
SMULWB R4, R5, R3 ; Multiplies R5 with the bottom halfword of R3,
; extracts top 32 bits and writes to R4.
cond
Is an optional condition code.
RdHi, RdLo
Are the destination registers. For UMLAL and SMLAL they also hold the accumulating value of the lower and
upper words respectively.
Rn, Rm
Are registers holding the operands.
Operation
The UMULL instruction interprets the values from Rn and Rm as unsigned integers. It multiplies these integers and
places the least significant 32 bits of the result in RdLo, and the most significant 32 bits of the result in RdHi.
The UMLAL instruction interprets the values from Rn and Rm as unsigned integers. It multiplies these integers,
adds the 64‑bit result to the 64‑bit unsigned integer contained in RdHi and RdLo, and writes the result back to
RdHi and RdLo.
The UMAAL instruction interprets the values from Rn and Rm as unsigned integers. It multiplies these integers,
adds the unsigned 32-bit integer in RdHi to the 64-bit result of the multiplication, adds the unsigned 32-bit integer
in RdLo to the 64-bit result of the addition, writes the top 32-bits of the result to RdHi and writes the lower 32-bits
of the result to RdLo.
The SMULL instruction interprets the values from Rn and Rm as two’s complement signed integers. It multiplies
these integers and places the least significant 32 bits of the result in RdLo, and the most significant 32 bits of the
result in RdHi.
The SMLAL instruction interprets the values from Rn and Rm as two’s complement signed integers. It multiplies
these integers, adds the 64‑bit result to the 64‑bit signed integer contained in RdHi and RdLo, and writes the
result back to RdHi and RdLo.
Restrictions
In these instructions:
• Do not use SP and do not use PC.
• RdHi and RdLo must be different registers.
Condition flags
These instructions do not affect the condition code flags.
UMULL R0, R4, R5, R6 ; Unsigned (R4,R0) = R5 × R6
SMLAL R4, R5, R3, R8 ; Signed (R5,R4) = (R5,R4) + R3 × R8
QASX Saturating Add and Subtract with Exchange Section 3.6.4 QASX and QSAX
QDADD Saturating Double and Add Section 3.6.5 QDADD and QDSUB
QDSUB Saturating Double and Subtract Section 3.6.5 QDADD and QDSUB
QSAX Saturating Subtract and Add with Exchange Section 3.6.4 QASX and QSAX
UQASX Unsigned Saturating Add and Subtract with Exchange Section 3.6.6 UQASX and UQSAX
UQSAX Unsigned Saturating Subtract and Add with Exchange Section 3.6.6 UQASX and UQSAX
cond
Is an optional condition code.
Rd
Is the destination register.
n
Specifies the bit position to saturate to:
• n ranges from 1 to 32 for SSAT.
• n ranges from 0 to 31 for USAT.
Rm
Is the register containing the value to saturate.
shift #s
Is an optional shift applied to Rm before saturating. It must be one of the following:
ASR #s
where s is in the range 1-31.
LSL #s
where s is in the range 0-31.
Operation
These instructions saturate to a signed or unsigned n-bit value.
The SSAT instruction applies the specified shift, then saturates to the signed range −2n–1 ≤ x ≤ 2n–1−1.
The USAT instruction applies the specified shift, then saturates to the unsigned range 0 ≤ x ≤ 2n−1.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
If saturation occurs, these instructions set the Q flag to 1.
SSAT R7, #16, R7, LSL #4 ; Logical shift left value in R7 by 4, then
; saturate it as a signed 16-bit value and
; write it back to R7.
USATNE R0, #7, R5 ; Conditionally saturate value in R5 as an
; unsigned 7 bit value and write it to R0.
cond
Is an optional condition code.
Rd
Is the destination register.
n
Specifies the bit position to saturate to:
• n ranges from 1 to 16 for SSAT.
• n ranges from 0 to 15 for USAT.
Rm
Is the register containing the values to saturate.
Operation
The SSAT16 instruction:
1. Saturates two signed 16-bit halfword values of the register with the value to saturate from selected by the bit
position in n.
2. Writes the results as two signed 16-bit halfwords to the destination register.
The USAT16 instruction:
1. Saturates two unsigned 16-bit halfword values of the register with the value to saturate from selected by the
bit position in n.
2. Writes the results as two unsigned halfwords in the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
If saturation occurs, these instructions set the Q flag to 1.
SSAT16 R7, #9, R2 ; Saturates the top and bottom highwords of R2
; as 9-bit values, writes to corresponding halfword
; of R7.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn, Rm
Are registers holding the first and second operands.
Operation
These instructions add or subtract two, four or eight values from the first and second operands and then writes a
signed saturated value in the destination register.
The QADD and QSUB instructions apply the specified add or subtract, and then saturate the result to the signed
range −2n–1 ≤ x ≤ 2n–1−1, where x is given by the number of bits applied in the instruction, 32, 16 or 8.
If the returned result is different from the value to be saturated, it is called saturation. If saturation occurs, the
QADD and QSUB instructions set the Q flag to 1 in the APSR. Otherwise, it leaves the Q flag unchanged. The 8-bit
and 16-bit QADD and QSUB instructions always leave the Q flag unchanged.
To clear the Q flag to 0, you must use the MSR instruction.
To read the state of the Q flag, use the MRS instruction.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
If saturation occurs, the QADD and QSUB instructions set the Q flag to 1.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn, Rm
Are registers holding the first and second operands.
Operation
The QASX instruction:
1. Adds the top halfword of the source operand with the bottom halfword of the second operand.
2. Subtracts the top halfword of the second operand from the bottom highword of the first operand.
3. Saturates the result of the subtraction and writes a 16-bit signed integer in the range –215 ≤ x ≤ 215 – 1,
where x equals 16, to the bottom halfword of the destination register.
4. Saturates the results of the sum and writes a 16-bit signed integer in the range –215 ≤ x ≤ 215 – 1, where x
equals 16, to the top halfword of the destination register.
The QSAX instruction:
1. Subtracts the bottom halfword of the second operand from the top highword of the first operand.
2. Adds the bottom halfword of the source operand with the top halfword of the second operand.
3. Saturates the results of the sum and writes a 16-bit signed integer in the range –215 ≤ x ≤ 215 – 1, where x
equals 16, to the bottom halfword of the destination register.
4. Saturates the result of the subtraction and writes a 16-bit signed integer in the range –215 ≤ x ≤ 215 – 1,
where x equals 16, to the top halfword of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
QASX R7, R4, R2 ; Adds top halfword of R4 to bottom halfword of R2,
; saturates to 16 bits, writes to top halfword of R7
; Subtracts top highword of R2 from bottom halfword of
; R4, saturates to 16 bits and writes to bottom halfword
; of R7
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rm, Rn
Are registers holding the first and second operands.
Operation
The QDADD instruction:
• Doubles the second operand value.
• Adds the result of the doubling to the signed saturated value in the first operand.
• Writes the result to the destination register.
The QDSUB instruction:
• Doubles the second operand value.
• Subtracts the doubled value from the signed saturated value in the first operand.
• Writes the result to the destination register.
Both the doubling and the addition or subtraction have their results saturated to the 32-bit signed integer range
–231 ≤ x ≤ 231– 1. If saturation occurs in either operation, it sets the Q flag in the APSR.
Restrictions
Do not use SP and do not use PC.
Condition flags
If saturation occurs, these instructions set the Q flag to 1.
QDADD R7, R4, R2 ; Doubles and saturates R4 to 32 bits, adds R2,
; saturates to 32 bits, writes to R7
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn, Rm
Are registers holding the first and second operands.
Operation
The UQASX instruction:
1. Adds the bottom halfword of the source operand with the top halfword of the second operand.
2. Subtracts the bottom halfword of the second operand from the top highword of the first operand.
3. Saturates the results of the sum and writes a 16-bit unsigned integer in the range 0 ≤ x ≤ 216 – 1, where x
equals 16, to the top halfword of the destination register.
4. Saturates the result of the subtraction and writes a 16-bit unsigned integer in the range 0 ≤ x ≤ 216 – 1,
where x equals 16, to the bottom halfword of the destination register.
The UQSAX instruction:
1. Subtracts the bottom halfword of the second operand from the top highword of the first operand.
2. Adds the bottom halfword of the first operand with the top halfword of the second operand.
3. Saturates the result of the subtraction and writes a 16-bit unsigned integer in the range 0 ≤ x ≤ 216 – 1,
where x equals 16, to the top halfword of the destination register.
4. Saturates the results of the addition and writes a 16-bit unsigned integer in the range 0 ≤ x ≤ 216 – 1, where
x equals 16, to the bottom halfword of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
UQASX R7, R4, R2 ; Adds top halfword of R4 with bottom halfword of R2,
; saturates to 16 bits, writes to top halfword of R7
; Subtracts top halfword of R2 from bottom halfword of
; R4, saturates to 16 bits, writes to bottom halfword of R7
UQSAX R0, R3, R5 ; Subtracts bottom halfword of R5 from top halfword of R3,
; saturates to 16 bits, writes to top halfword of R0
; Adds bottom halfword of R4 to top halfword of R5
; saturates to 16 bits, writes to bottom halfword of R0.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn, Rm
Are registers holding the first and second operands.
Operation
These instructions add or subtract two or four values and then writes an unsigned saturated value in the
destination register.
The UQADD16 instruction:
• Adds the respective top and bottom halfwords of the first and second operands.
• Saturates the result of the additions for each halfword in the destination register to the unsigned range 0 ≤ x
≤ 216−1, where x is 16.
The UQADD8 instruction:
• Adds each respective byte of the first and second operands.
• Saturates the result of the addition for each byte in the destination register to the unsigned range 0 ≤ x ≤
28−1, where x is 8.
The UQSUB16 instruction:
• Subtracts both halfwords of the second operand from the respective halfwords of the first operand.
• Saturates the result of the differences in the destination register to the unsigned range 0 ≤ x ≤ 216−1, where
x is 16.
The UQSUB8 instructions:
• Subtracts the respective bytes of the second operand from the respective bytes of the first operand.
• Saturates the results of the differences for each byte in the destination register to the unsigned range 0 ≤ x ≤
28−1, where x is 8.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
UQADD16 R7, R4, R2 ; Adds halfwords in R4 to corresponding halfword in R2,
; saturates to 16 bits, writes to corresponding halfword
; of R7
UQADD8 R4, R2, R5 ; Adds bytes of R2 to corresponding byte of R5, saturates
; to 8 bits, writes to corresponding bytes of R4
UQSUB16 R6, R3, R0 ; Subtracts halfwords in R0 from corresponding halfword
; in R3, saturates to 16 bits, writes to corresponding
; halfword in R6
UQSUB8 R1, R5, R6 ; Subtracts bytes in R6 from corresponding byte of R5,
; saturates to 8 bits, writes to corresponding byte of R1.
SXTAB Extend 8 bits to 32 and add Section 3.7.2 SXTA and UXTA
SXTAB16 Dual extend 8 bits to 16 and add Section 3.7.2 SXTA and UXTA
SXTAH Extend 16 bits to 32 and add Section 3.7.2 SXTA and UXTA
SXTB16 Dual extend 8 bits to 16 and add Section 3.7.3 SXT and UXT
UXTAB Extend 8 bits to 32 and add Section 3.7.2 SXTA and UXTA
UXTAB16 Dual extend 8 bits to 16 and add Section 3.7.2 SXTA and UXTA
UXTAH Extend 16 bits to 32 and add Section 3.7.2 SXTA and UXTA
UXTB16 Dual zero extend 8 bits to 16 and add Section 3.7.3 SXT and UXT
PKHTB
Pack Halfword, top and bottom with shift.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the second operand register holding the value to be optionally shifted.
imm
Is the shift length. The type of shift length depends on the instruction:For PKHBT:
For PKHTB:
LSL
A left shift with a shift length from 1 to 31, 0 means no shift.
ASR
An arithmetic shift right with a shift length from 1 to 32, a shift of 32-bits is encoded as 0b00000.
Operation
The PKHBT instruction:
1. Writes the value of the bottom halfword of the first operand to the bottom halfword of the destination register.
2. If shifted, the shifted value of the second operand is written to the top halfword of the destination register.
The PKHTB instruction:
1. Writes the value of the top halfword of the first operand to the top halfword of the destination register.
2. If shifted, the shifted value of the second operand is written to the bottom halfword of the destination register.
Restrictions
Rd must not be SP and must not be PC.
Condition flags
This instruction does not change the flags.
PKHBT R3, R4, R5 LSL #0 ; Writes bottom halfword of R4 to bottom halfword of
; R3, writes top halfword of R5, unshifted, to top
; halfword of R3
PKHTB R4, R0, R2 ASR #1 ; Writes R2 shifted right by 1 bit to bottom halfword
; of R4, and writes top halfword of R0 to top
; halfword of R4.
cond
Is an optional condition code.
Rd
Is the destination register. If Rd is omitted, the destination register is Rn.
Rn
Is the first operand register.
Rm
Is the register holding the value to rotate and extend.
ROR #n
Is one of:
ROR #8
Value from Rm is rotated right 8 bits.
ROR #16
Value from Rm is rotated right 16 bits.
ROR #24
Value from Rm is rotated right 24 bits.
Operation
These instructions do the following:
1. Rotate the value from Rm right by 0, 8, 16 or 24 bits.
2. Extract bits from the resulting value:
– SXTAB extracts bits[7:0] from Rm and sign extends to 32 bits.
– UXTAB extracts bits[7:0] from Rm and zero extends to 32 bits.
– SXTAH extracts bits[15:0] from Rm and sign extends to 32 bits.
– UXTAH extracts bits[15:0] from Rm and zero extends to 32 bits.
– SXTAB16 extracts bits[7:0] from Rm and sign extends to 16 bits, and extracts bits [23:16] from Rm and
sign extends to 16 bits.
– UXTAB16 extracts bits[7:0] from Rm and zero extends to 16 bits, and extracts bits [23:16] from Rm and
zero extends to 16 bits.
3. Adds the signed or zero extended value to the word or corresponding halfword of Rn and writes the result in
Rd.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the flags.
SXTAH R4, R8, R6, ROR #16 ; Rotates R6 right by 16 bits, obtains bottom
; halfword, sign extends to 32 bits, adds R8,and
; writes to R4
UXTAB R3, R4, R10 ; Extracts bottom byte of R10 and zero extends to 32
; bits, adds R4, and writes to R3.
op
Is one of:
SXTB
Sign extends an 8‑bit value to a 32‑bit value.
SXTH
Sign extends a 16‑bit value to a 32‑bit value.
SXTB16
Sign extends two 8-bit values to two 16-bit values.
UXTB
Zero extends an 8‑bit value to a 32‑bit value.
UXTH
Zero extends a 16‑bit value to a 32‑bit value.
UXTB16
Zero extends two 8-bit values to two 16-bit values.
cond
Is an optional condition code.
Rd
Is the destination register.
Rn
Is the register holding the value to extend.
ROR #n
Is one of:
ROR #8
Value from Rn is rotated right 8 bits.
ROR #16
Value from Rn is rotated right 16 bits.
ROR #24
Value from Rn is rotated right 24 bits.
Operation
These instructions do the following:
1. Rotate the value from Rn right by 0, 8, 16 or 24 bits.
2. Extract bits from the resulting value:
– SXTB extracts bits[7:0] and sign extends to 32 bits.
– UXTB extracts bits[7:0] and zero extends to 32 bits.
– SXTH extracts bits[15:0] and sign extends to 32 bits.
– UXTH extracts bits[15:0] and zero extends to 32 bits.
– SXTB16 extracts bits[7:0] and sign extends to 16 bits, and extracts bits [23:16] and sign extends to 16
bits.
– UXTB16 extracts bits[7:0] and zero extends to 16 bits, and extracts bits [23:16] and zero extends to 16
bits.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the flags.
SXTH R4, R6, ROR #16 ; Rotate R6 right by 16 bits, then obtain the lower
; halfword of the result and then sign extend to
; 32 bits and write the result to R4.
UXTB R3, R10 ; Extract lowest byte of the value in R10 and zero
; extend it, and write the result to R3.
SBFX Signed Bit Field Extract Section 3.8.2 SBFX and UBFX
UBFX Unsigned Bit Field Extract Section 3.8.2 SBFX and UBFX
Operation
BFC clears a bit field in a register. It clears width bits in Rd, starting at the low bit position lsb. Other bits in Rd
are unchanged.
BFI copies a bit field into one register from another register. It replaces width bits in Rd starting at the low bit
position lsb, with width bits from Rn starting at bit[0]. Other bits in Rd are unchanged.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the flags.
Operation
SBFX extracts a bit field from one register, sign extends it to 32 bits, and writes the result to the destination
register.
UBFX extracts a bit field from one register, zero extends it to 32 bits, and writes the result to the destination
register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the flags.
SBFX R0, R1, #20, #4 ; Extract bit 20 to bit 23 (4 bits) from R1 and sign
; extend to 32 bits and then write the result to R0.
UBFX R8, R11, #9, #10 ; Extract bit 9 to bit 18 (10 bits) from R11 and zero
; extend to 32 bits and then write the result to R8.
BLX Branch indirect with Link Section 3.9.2 B, BL, BX, and BLX
BLXNS Branch indirect with Link, Non-secure Section 3.9.3 BXNS and BLXNS
CBNZ Compare and Branch if Non Zero Section 3.9.4 CBZ and CBNZ
CBZ Compare and Branch if Zero Section 3.9.4 CBZ and CBNZ
Operation
All these instructions cause a branch to the address indicated by label or contained in the register specified by Rm.
In addition:
• The BL and BLX instructions write the address of the next instruction to LR, the link register R14.
• The BX and BLX instructions result in a UsageFault exception if bit[0] of Rm is 0.
BL and BLX instructions also set bit[0] of the LR to 1. This ensures that the value is suitable for use by a
subsequent POP {PC} or BX instruction to perform a successful return branch.
The following table shows the ranges for the various branch instructions.
Restrictions
In these instructions:
• Do not use SP or PC in the BX or BLX instruction.
• For BX and BLX, bit[0] of Rm must be 1 for correct execution. Bit[0] is used to update the EPSR T-bit and is
discarded from the target address.
Note: Bcond is the only conditional instruction on the processor.
BX can be used an Exception or Function return.
Condition flags
These instructions do not change the flags.
Examples
Operation
The BLXNS instruction calls a subroutine at an address contained in Rm and conditionally causes a transition from
the Secure to the Non-secure state.
For both BXNS and BLXNS, Rm[0] indicates a transition to Non-secure state if value is 0, otherwise the target state
remains Secure. If transitioning to Non-secure, BLXNS pushes the return address and partial PSR to the Secure
stack and assigns R14 to a FNC_RETURN value.
These instructions are available for Secure state only. When the processor is in Non-secure state, these
instructions are UNDEFINED and triggers a UsageFault if executed.
Restrictions
PC and SP cannot be used for Rm.
Condition flags
These instructions do not change the flags.
Examples
Note: For information about how to build a Secure image that uses a previously generated import library, see the Arm®
Compiler Software Development Guide.
Operation
Use the CBZ or CBNZ instructions to avoid changing the condition code flags and to reduce the number of
instructions.
CBZ Rn, label does not change condition flags but is otherwise equivalent to:
CMP Rn, #0
BEQ label
CBNZ Rn, label does not change condition flags but is otherwise equivalent to:
CMP Rn, #0
BNE label
Restrictions
The restrictions are:
• Rn must be in the range of R0-R7.
• The branch destination must be within 4 to 130 bytes after the instruction.
• These instructions must not be used inside an IT block.
Condition flags
These instructions do not change the flags.
CBZ R5, target ; Forward branch if R5 is zero
CBNZ R0, target ; Forward branch if R0 is not zero
3.9.5 IT
If-Then condition instruction.
IT{x{y{z}}} cond
Where:
x
specifies the condition switch for the second instruction in the IT block.
y
Specifies the condition switch for the third instruction in the IT block.
z
Specifies the condition switch for the fourth instruction in the IT block.
cond
Specifies the condition for the first instruction in the IT block.
The condition switch for the second, third and fourth instruction in the IT block can be either:
T Then. Applies the condition cond to the instruction.
E Else. Applies the inverse condition of cond to the instruction.
Note: It is possible to use AL (the always condition) for cond in an IT instruction. If this is done, all of the instructions
in the IT block must be unconditional, and each of x, y, and z must be T or omitted but not E.
Operation
The IT instruction makes up to four following instructions conditional. The conditions can be all the same, or
some of them can be the logical inverse of the others. The conditional instructions following the IT instruction
form the IT block.
The instructions in the IT block, including any branches, must specify the condition in the {cond} part of their
syntax.
Note: Your assembler might be able to generate the required IT instructions for conditional instructions automatically,
so that you do not have to write them yourself. See your assembler documentation for details.
A BKPT instruction in an IT block is always executed, even if its condition fails.
Exceptions can be taken between an IT instruction and the corresponding IT block, or within an IT block. Such an
exception results in entry to the appropriate exception handler, with suitable return information in LR and stacked
PSR.
Instructions designed for use for exception returns can be used as normal to return from the exception, and
execution of the IT block resumes correctly. This is the only way that a PC‑modifying instruction is permitted to
branch to an instruction in an IT block.
Restrictions
The following instructions are not permitted in an IT block:
• IT.
• CBZ and CBNZ.
• CPSID and CPSIE.
Other restrictions when using an IT block are:
• A branch or any instruction that modifies the PC must either be outside an IT block or must be the last
instruction inside the IT block. These are:
– ADD PC, PC, Rm.
– MOV PC, Rm.
– B, BL, BX, BLX.
– Any LDM, LDR, or POP instruction that writes to the PC.
– TBB and TBH.
• Do not branch to any instruction inside an IT block, except when returning from an exception handler.
• All conditional instructions except Bcond must be inside an IT block. Bcond can be either outside or inside
an IT block but has a larger branch range if it is inside one.
• Each instruction inside the IT block must specify a condition code suffix that is either the same or logical
inverse as for the other instructions in the block.
Note: Your assembler might place extra restrictions on the use of IT blocks, such as prohibiting the use of assembler
directives within them.
Condition flags
This instruction does not change the flags.
Operation
These instructions cause a PC‑relative forward branch using a table of single byte offsets for TBB, or halfword
offsets for TBH. Rn provides a pointer to the table, and Rm supplies an index into the table. For TBB the branch
offset is the unsigned value of the byte returned from the table, and for TBH the branch offset is twice the
unsigned value of the halfword returned from the table. The branch occurs to the address at that offset from the
address of the byte immediately after the TBB or TBH instruction.
Restrictions
The restrictions are:
• Rn must not be SP.
• Rm must not be SP and must not be PC.
• When any of these instructions is used inside an IT block, it must be the last instruction of the IT block.
Condition flags
These instructions do not change the flags.
VCVTB Converts half-precision value to single-precision Section 3.10.36 VCVTB and VCVTT
VFMA Floating-point Fused Multiply Accumulate Section 3.10.9 VFMA and VFMS
VFMS Floating-point Fused Multiply Subtract Section 3.10.9 VFMA and VFMS
VFNMA Floating-point Fused Negate Multiply Accumulate Section 3.10.10 VFNMA and VFNMS
VFNMS Floating-point Fused Negate Multiply Subtract Section 3.10.10 VFNMA and VFNMS
VMAXNM, VMINNM Maximum, Minimum with IEEE754-2008 NaN handling Section 3.10.37 VMAXNM and VMINNM
VMOV Copies between Scalar to Arm core register Section 3.10.18 VMOV scalar to core register
VRINTA,
Float to integer (in floating-point format) conversion with Section 3.10.39 VRINTA, VRINTN, VRINTP,
VRINTN,
directed rounding VRINTM, and VRINTZ
VRINTP, VRINTM
VRINTR, VRINTX Float to integer (in floating-point format) conversion Section 3.10.38 VRINTR and VRINTX
VSEL Select register, alternative to a pair of conditional VMOV Section 3.10.34 VSEL
Operation
FLDMX loads multiple SIMD and FP registers from consecutive locations in the Advanced SIMD and floating-point
register file using an address from a general-purpose register.
Arm deprecates use of FLDMDBX and FLDMIAX, except for disassembly purposes, and reassembly of
disassembled code.
Depending on settings in the CPACR and NSACR and the Security state and mode in which the instruction is
executed, an attempt to execute the instruction might be undefined.
Operation
FSTMX stores multiple SIMD and FP registers from the Advanced SIMD and floating-point register file to
consecutive locations using an address from a general-purpose register.
Arm deprecates use of FLDMDBX and FLDMIAX, except for disassembly purposes, and reassembly of
disassembled code.
Depending on settings in the CPACR, NSACR, and FPEXC Registers, and the security state and mode in which
the instruction is executed, an attempt to execute the instruction might be undefined.
3.10.3 VABS
Floating-point Absolute.
VABS{cond}.F32 Sd, Sm
Where:
cond
Is an optional condition code.
Sd, Sm
Are the destination floating-point value and the operand floating-point value.
Operation
This instruction:
1. Takes the absolute value of the operand floating-point register.
2. Places the results in the destination floating-point register.
Restrictions
There are no restrictions.
Condition flags
This instruction does not change the flags.
VABS.F32 S4, S6
3.10.4 VADD
Floating-point Add.
VADD{cond}.F32 {Sd,} Sn, Sm
Where:
cond
Is an optional condition code.
Sd
Is the destination floating-point value.
Sn, Sm
Are the operand floating-point values.
Operation
This instruction:
1. Adds the values in the two floating-point operand registers.
2. Places the results in the destination floating-point register.
3. the results in the destination floating-point register.
Restrictions
There are no restrictions.
Condition flags
This instruction does not change the flags.
VADD.F32 S4, S6, S7
Operation
This instruction:
1. Compares either:
– Two floating-point registers.
– Or one floating-point register and zero.
2. Writes the result to the FPSCR flags.
Restrictions
This instruction can optionally raise an Invalid Operation exception if either operand is any type of NaN. It
always raises an Invalid Operation exception if either operand is a signaling NaN.
Condition flags
When this instruction writes the result to the FPSCR flags, the values are normally transferred to the Arm flags by
a subsequent VMRS instruction.
VCVT{R}{cond}.Tm.F32 Sd, Sm
VCVT{cond}.F32.Tm Sd, Sm
Where:
R
If R is specified, the operation uses the rounding mode specified by the FPSCR. If R is omitted. the operation
uses the Round towards Zero rounding mode.
cond
Is an optional condition code.
Tm
Is the data type for the operand. It must be one of:
• S32 signed 32-bit value.
• U32 unsigned 32-bit value.
Sd, Sm
Are the destination register and the operand register.
Operation
These instructions:
1. Either:
– Convert a value in a register from floating-point value to a 32-bit integer.
– Convert from a 32-bit integer to floating-point value.
2. Place the result in a second register.
The floating-point to integer operation normally uses the Round towards Zero rounding mode, but can
optionally use the rounding mode specified by the FPSCR.
The integer to floating-point operation uses the rounding mode specified by the FPSCR.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
This instruction:
1. Either
– Converts a value in a register from floating-point to fixed-point.
– Converts a value in a register from fixed-point to floating-point.
2. Places the result in a second register.
The floating-point values are single-precision or double-precision.
The fixed-point value can be 16-bit or 32-bit. Conversions from fixed-point values take their operand from the
low-order bits of the source register and ignore any remaining bits.
Signed conversions to fixed-point values sign-extend the result value to the destination register width.
Unsigned conversions to fixed-point values zero-extend the result value to the destination register width.
The floating-point to fixed-point operation uses the Round towards Zero rounding mode. The fixed-point to
floating-point operation uses the Round to Nearest rounding mode.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.8 VDIV
Divides floating-point values.
VDIV{cond}.F32 {Sd,} Sn, Sm
Where:
cond
Is an optional condition code.
Sd
Is the destination register.
Sn, Sm
Are the operand registers.
Operation
This instruction:
1. Divides one floating-point value by another floating-point value.
2. Writes the result to the floating-point destination register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
The VFMA instruction:
1. Multiplies the floating-point values in the operand registers.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
The VFNMA instruction:
1. Negates the first floating-point operand register.
2. Multiplies the first floating-point operand with second floating-point operand.
3. Adds the negation of the floating -point destination register to the product
4. Places the result into the destination register.
The result of the multiply is not rounded before the addition.
The VFNMS instruction:
1. Multiplies the first floating-point operand with second floating-point operand.
2. Adds the negation of the floating-point value in the destination register to the product.
3. Places the result in the destination register.
The result of the multiply is not rounded before the addition.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.11 VLDM
Floating-point Load Multiple.
cond
Is an optional condition code.
size
Is an optional data size specifier.
Rn
Is the base register. The SP can be used.
!
Is the command to the instruction to write a modified value back to Rn. This is required if mode == DB, and is
optional if mode == IA.
list
Is the list of extension registers to be loaded, as a list of consecutively numbered doubleword or singleword
registers, separated by commas and surrounded by brackets.
Operation
This instruction loads multiple extension registers from consecutive memory locations using an address from an
Arm core register as the base address.
Restrictions
The restrictions are:
• If size is present, it must be equal to the size in bits, 32 or 64, of the registers in list.
• For the base address, the SP can be used. In the Arm instruction set, if ! is not specified the PC can be
used.
• list must contain at least one register. If it contains doubleword registers, it must not contain more than 16
registers.
• If using the Decrement before addressing mode, the write back flag, !, must be appended to the base
register specification.
Condition flags
These instructions do not change the flags.
VLDMIA.F64 r1, {d3,d4,d5}
3.10.12 VLDR
Loads a single extension register from memory.
VLDR{cond}{.F<32|64>} <Sd|Dd>, [Rn {, #imm}]
VLDR{cond}{.F<32|64>} <Sd|Dd>, label
VLDR{cond}{.F<32|64>} <Sd|Dd>, [PC, #imm]
Where:
cond
Is an optional condition code.
32, 64
Are the optional data size specifiers.
Dd
Is the destination register for a doubleword load.
Sd
Is the destination register for a singleword load.
Rn
Is the base register. The SP can be used.
imm
Is the + or - immediate offset used to form the address. Permitted address values are multiples of 4 in the range
0-1020.
label
Is the label of the literal data item to be loaded.
Operation
This instruction loads a single extension register from memory, using a base address from an Arm core register,
with an optional offset.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.13 VLLDM
Floating-point Lazy Load Multiple restores the contents of the Secure floating-point registers that were protected
by a VLSTM instruction, and marks the floating-point context as active.
VLLDM {cond}<Rn>
Where:
cond
Is an optional condition code.
Rn
Is the base register.
Operation
If the lazy state preservation set up by a previous VLSTM instruction is active (FPCCR.LSPACT == 1), this
instruction deactivates lazy state preservation and enables access to the Secure floating-point registers. If lazy
state preservation is inactive (FPCCR.LSPACT == 0), either because lazy state preservation was not enabled
(FPCCR.LSPEN == 0) or because a floating-point instruction caused the Secure floating-point register contents
to be stored to memory, this instruction loads the stored Secure floating-point register contents back into the
floating-point registers. If Secure floating-point is not in use (CONTROL_S.SFPA == 0), this instruction behaves
as a NOP. This instruction is only available in Secure state, and is UNDEFINED in Non-secure state. If the
Floating-point Extension is not implemented, this instruction is available in Secure state, but behaves as a NOP.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.14 VLSTM
Floating-point Lazy Store Multiple stores the contents of Secure floating-point registers to a prepared stack frame,
and clears the Secure floating-point registers.
VLSTM {cond}<Rn>
Where:
cond
Is an optional condition code.
Rn
Is the base register.
Operation
If floating-point lazy preservation is enabled (FPCCR.LSPEN == 1), then the next time a floating-point instruction
other than VLSTM or VLLDM is executed:
• The contents of Secure floating-point registers are stored to memory.
• The Secure floating-point registers are cleared.
If Secure floating-point is not in use (CONTROL_S.SFPA == 0), this instruction behaves as a NOP.
This instruction is only available in Secure state, and is UNDEFINED in Non-secure state.
If the Floating-point Extension is not implemented, this instruction is available in Secure state, but behaves as a
NOP.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
The floating-point Multiply Accumulate instruction:
1. Multiplies two floating-point values.
2. Adds the results to the destination floating-point value.
The floating-point Multiply Subtract instruction:
1. Multiplies two floating-point values.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
This instruction copies a constant value to a floating-point register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
This instruction copies the contents of one floating-point register to another.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
This instruction transfers one word from the upper or lower half of a doubleword floating-point register to an Arm
core register.
Restrictions
Rt cannot be PC or SP.
Condition flags
These instructions do not change the flags.
Operation
This instruction transfers:
• The contents of a single-precision register to an Arm core register.
• The contents of an Arm core register to a single-precision register.
Restrictions
Rt cannot be PC or SP.
Condition flags
These instructions do not change the flags.
Operation
This instruction transfers:
• The contents of two consecutively numbered single-precision registers to two Arm core registers.
• The contents of two Arm core registers to a pair of single-precision registers.
Restrictions
The restrictions are:
• The floating-point registers must be contiguous, one after the other.
• The Arm core registers do not have to be contiguous.
• Rt cannot be PC or SP.
Condition flags
These instructions do not change the flags.
Rt, Rt2
Are the two Arm core registers.
Operation
This instruction:
• Transfers two words from two Arm core registers to a doubleword register.
• Transfers a doubleword register to two Arm core registers.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
This instruction transfers one word to the upper or lower half of a doubleword floating-point register from an Arm
core register.
Restrictions
Rt cannot be PC or SP.
Condition flags
These instructions do not change the flags.
3.10.23 VMRS
Move to Arm Core register from floating-point System Register.
VMRS{cond} Rt, FPSCR
VMRS{cond} APSR_nzcv, FPSCR
Where:
cond
Is an optional condition code.
Rt
Is the destination Arm core register. This register can be R0-R14.
APSR_nzcv
Transfer floating-point flags to the APSR flags.
Operation
This instruction performs one of the following actions:
• Copies the value of the FPSCR to a general-purpose register.
• Copies the value of the FPSCR flag bits to the APSR N, Z, C, and V flags.
Restrictions
Rt cannot be PC or SP.
Condition flags
These instructions optionally change the N, Z, C, and V flags.
3.10.24 VMSR
Move to floating-point System Register from Arm Core register.
VMSR{cond} FPSCR, Rt
Where:
cond
Is an optional condition code.
Rt
Is the general-purpose register to be transferred to the FPSCR.
Operation
This instruction moves the value of a general-purpose register to the FPSCR.
Restrictions
Rt cannot be PC or SP.
Condition flags
This instruction updates the FPSCR.
3.10.25 VMUL
Floating-point Multiply.
VMUL{cond}.F32 {Sd,} Sn, Sm
Where:
cond
Is an optional condition code.
Sd
Is the destination floating-point value.
Sn, Sm
Are the operand floating-point values.
Operation
This instruction:
1. Multiplies two floating-point values.
2. Places the results in the destination register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.26 VNEG
Floating-point Negate.
VNEG{cond}.F32 Sd, Sm
Where:
cond
Is an optional condition code.
Sd
Is the destination floating-point value.
Sm
Is the operand floating-point value.
Operation
This instruction:
1. Negates a floating-point value.
2. Places the results in a second floating-point register.
The floating-point instruction inverts the sign bit.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
The VNMLA instruction:
1. Multiplies two floating-point register values.
2. Adds the negation of the floating-point value in the destination register to the negation of the product.
3. Writes the result back to the destination register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.28 VPOP
Floating-point extension register Pop.
VPOP{cond}{.size} list
Where:
cond
Is an optional condition code.
size
Is an optional data size specifier. If present, it must be equal to the size in bits, 32 or 64, of the registers in list.
list
Is a list of extension registers to be loaded, as a list of consecutively numbered doubleword or singleword
registers, separated by commas and surrounded by brackets.
Operation
This instruction loads multiple consecutive extension registers from the stack.
Restrictions
list must contain at least one register, and not more than sixteen registers.
Condition flags
These instructions do not change the flags.
3.10.29 VPUSH
Floating-point extension register Push.
VPUSH{cond}{.size} list
Where:
cond
Is an optional condition code.
size
Is an optional data size specifier. If present, it must be equal to the size in bits, 32 or 64, of the registers in list.
list
Is a list of the extension registers to be stored, as a list of consecutively numbered doubleword or singleword
registers, separated by commas and surrounded by brackets.
Operation
This instruction stores multiple consecutive extension registers to the stack.
Restrictions
list must contain at least one register, and not more than sixteen.
Condition flags
These instructions do not change the flags.
3.10.30 VSQRT
Floating-point Square Root.
VSQRT{cond}.F32 Sd, Sm
Where:
cond
Is an optional condition code.
Sd
Is the destination floating-point value.
Sm
Is the operand floating-point value.
Operation
This instruction:
• Calculates the square root of the value in a floating-point register.
• Writes the result to another floating-point register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.31 VSTM
Floating-point Store Multiple.
VSTM{mode}{cond}{.size} Rn{!}, list
Where:
mode
Is the addressing mode:
• IA Increment After. The consecutive addresses start at the address specified in Rn. This is the default and
can be omitted.
• DB Decrement Before. The consecutive addresses end just before the address specified in Rn.
cond
Is an optional condition code.
size
Is an optional data size specifier. If present, it must be equal to the size in bits, 32 or 64, of the registers in list.
Rn
Is the base register. The SP can be used.
!
Is the function that causes the instruction to write a modified value back to Rn. Required if mode == DB.
list
Is a list of the extension registers to be stored, as a list of consecutively numbered doubleword or singleword
registers, separated by commas and surrounded by brackets.
Operation
This instruction stores multiple extension registers to consecutive memory locations using a base address from an
Arm core register.
Restrictions
The restrictions are:
• list must contain at least one register. If it contains doubleword registers it must not contain more than 16
registers.
• Use of the PC as Rn is deprecated.
Condition flags
These instructions do not change the flags.
3.10.32 VSTR
Floating-point Store.
VSTR{cond}{.32} Sd, [Rn{, #imm}]
VSTR{cond}{.64} Dd, [Rn{, #imm}]
Where:
cond
Is an optional condition code.
32, 64
Are the optional data size specifiers.
Sd
Is the source register for a singleword store.
Dd
Is the source register for a doubleword store.
Rn
Is the base register. The SP can be used.
imm
Is the + or - immediate offset used to form the address. Values are multiples of 4 in the range 0-1020. imm can
be omitted, meaning an offset of +0.
Operation
This instruction stores a single extension register to memory, using an address from an Arm core register, with an
optional offset, defined in imm:
Restrictions
The use of PC for Rn is deprecated.
Condition flags
These instructions do not change the flags.
3.10.33 VSUB
Floating-point Subtract.
VSUB{cond}.F32 {Sd,} Sn, Sm
Where:
cond
Is an optional condition code.
Sd
Is the destination floating-point value.
Sn, Sm
Are the operand floating-point values.
Operation
This instruction:
1. Subtracts one floating-point value from another floating-point value.
2. Places the results in the destination floating-point register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
3.10.34 VSEL
Floating-point Conditional Select allows the destination register to take the value from either one or the other of
two source registers according to the condition codes in the APSR.
VSEL{cond}.F32 Sd, Sn, Sm
Where:
cond
Is an optional condition code. VSEL has a subset of the condition codes. The condition codes for VSEL are
limited to GE, GT, EQ and VS, with the effect that LT, LE, NE and VC is achievable by exchanging the source
operands.
Sd
Is the destination single-precision floating-point value.
Sn, Sm
Are the operand single-precision floating-point values.
Operation
Depending on the result of the condition code, this instruction moves either:
• Sn source register to the destination register.
• Sm source register to the destination register.
The behavior is:
EncodingSpecificOperations();
ExecuteFPCheck();
if dp_operation then
S[d] = if ConditionHolds(cond) then S[n] else S[m];
Restrictions
The VSEL instruction must not occur inside an IT block.
Condition flags
This instruction does not change the flags.
<rmode>
Is one of:
A
Round to nearest ties away.
M
Round to nearest even.
N
Round towards plus infinity.
P
Round towards minus infinity.
Operation
These instructions:
1. Read the source register.
2. Convert to integer with directed rounding.
3. Write to the destination register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
cond
Is an optional condition code.
Sd
Is the destination register.
Sm
Is the operand register.
Operation
This instruction with the .F16.F32 suffix:
1. Converts the half-precision value in the top or bottom half of a single-precision register to single-precision
value.
2. Writes the result to a single-precision register.
This instruction with the .F32.F16 suffix:
1. Converts the value in a single-precision register to half-precision value.
2. Writes the result into the top or bottom half of a single-precision register, preserving the other half of the
target register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
Operation
The VMAXNM instruction compares two source registers, and moves the largest to the destination register.
The VMINNM instruction compares two source registers, and moves the smallest to the destination register.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
cond
Is an optional condition code.
Sd
Is the destination floating-point value.
Sm
Are the operand floating-point values.
Operation
These instructions:
1. Read the source register.
2. Round to the nearest integer value in floating-point format using the rounding mode specified by the FPSCR.
A zero input gives a zero result with the same sign, an infinite input gives an infinite result with the same
sign, and a NaN is propagated as for normal arithmetic.
3. Write the result to the destination register.
4. For the VRINTX instruction only. Generate a floating-point exception if the result is not numerically equal to
the input value.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
<rmode>
Is one of:
A
Round to nearest ties away.
N
Round to Nearest Even.
P
Round towards Plus Infinity.
M
Round towards Minus Infinity.
Z
Round towards Zero.
Operation
These instructions:
1. Read the source register.
2. Round to the nearest integer value with a directed rounding mode specified by the instruction.
3. A zero input gives a zero result with the same sign, an infinite input gives an infinite result with the same
sign, and a NaN is propagated as for normal arithmetic.
4. Write the result to the destination register.
Restrictions
VRINTA, VRINTN, VRINTP and VRINTM cannot be conditional. VRINTZ can be conditional.
Condition flags
These instructions do not change the flags.
TTT Test Target Unprivileged Section 3.11.13 TT, TTT, TTA, and TTAT
TTA Test Target Alternate Domain Section 3.11.13 TT, TTT, TTA, and TTAT
TTAT Test Target Alternate Domain Unprivileged Section 3.11.13 TT, TTT, TTA, and TTAT
3.11.1 BKPT
Breakpoint.
BKPT #imm
Where:
imm
Is an expression evaluating to an integer in the range 0-255 (8-bit value).
Operation
The BKPT instruction causes the processor to enter Debug state if invasive debug is enabled. Debug tools can
use this to investigate system state when the instruction at a particular address is reached.
imm is ignored by the processor. If required, a debugger can use it to store additional information about the
breakpoint.
The BKPT instruction can be placed inside an IT block, but it executes unconditionally, unaffected by the condition
specified by the IT instruction.
Condition flags
This instruction does not change the flags.
BKPT #0x3 ; Breakpoint with immediate value set to 0x3 (debugger can
; extract the immediate value by locating it using the PC)
Note: Arm does not recommend the use of the BKPT instruction with an immediate value set to 0xAB for any purpose
other than Semi-hosting.
3.11.2 CPS
Change Processor State.
CPSeffect iflags
Where:
effect
Is one of:
IE
Clears the special purpose register.
ID
Sets the special purpose register.
iflags
Is a sequence of one or more flags:
i
Set or clear PRIMASK.
f
Set or clear FAULTMASK.
Operation
CPS changes the PRIMASK and FAULTMASK special register values.
Restrictions
The restrictions are:
• Use CPS only from privileged software. It has no effect if used in unprivileged software.
• CPS cannot be conditional and so must not be used inside an IT block.
Condition flags
This instruction does not change the condition flags.
CPSID i ; Disable interrupts and configurable fault handlers (set PRIMASK)
CPSID f ; Disable interrupts and all fault handlers (set FAULTMASK)
CPSIE i ; Enable interrupts and configurable fault handlers (clear PRIMASK)
CPSIE f ; Enable interrupts and fault handlers (clear FAULTMASK)
3.11.3 CPY
Copy is a pre-Unified Assembler Language (UAL) synonym for MOV (register).
CPY Rd, Rn
This is equivalent to:
MOV Rd, Rn
3.11.4 DMB
Data Memory Barrier.
DMB{cond} {opt}
Where:
cond
Is an optional condition code.
opt
Specifies an optional limitation on the DMB operation. Values are:
SY
DMB operation ensures ordering of all accesses, encoded as opt == '1111'. Can be omitted.
All other encodings of opt are reserved. The corresponding instructions execute as system (SY) DMB operations,
but software must not rely on this behavior.
Operation
DMB acts as a data memory barrier. It ensures that all explicit memory accesses that appear, in program order,
before the DMB instruction are completed before any explicit memory accesses that appear, in program order,
after the DMB instruction. DMB does not affect the ordering or execution of instructions that do not access memory.
Condition flags
This instruction does not change the flags.
DMB ; Data Memory Barrier
3.11.5 DSB
Data Synchronization Barrier.
DSB{cond} {opt}
Where:
cond
Is an optional condition code.
opt
Specifies an optional limitation on the DSB operation. Values are:
SY
DSB operation ensures completion of all accesses, encoded as opt == '1111'. Can be omitted.
All other encodings of opt are reserved. The corresponding instructions execute as system (SY) DSB operations,
but software must not rely on this behavior.
Operation
DSB acts as a special data synchronization memory barrier. Instructions that come after the DSB, in program
order, do not execute until the DSB instruction completes. The DSB instruction completes when all explicit memory
accesses before it complete.
Condition flags
This instruction does not change the flags.
DSB ; Data Synchronisation Barrier
3.11.6 ISB
Instruction Synchronization Barrier.
ISB{cond} {opt}
Where:
cond
Is an optional condition code.
opt
Specifies an optional limitation on the ISB operation. Values are:
SY
Fully system ISB operation, encoded as opt == '1111'. Can be omitted.
All other encodings of opt are reserved. The corresponding instructions execute as full system ISB operations,
but software must not rely on this behavior.
Operation
ISB acts as an instruction synchronization barrier. It flushes the pipeline of the processor, so that all instructions
following the ISB are fetched from cache or memory again, after the ISB instruction has been completed.
Condition flags
This instruction does not change the flags.
ISB ; Instruction Synchronisation Barrier
3.11.7 MRS
Move the contents of a special register to a general-purpose register.
MRS{cond} Rd, spec_reg
Where:
cond
Is an optional condition code.
Rd
Is the destination register.
spec_reg
Can be any of: APSR, IPSR, EPSR, IEPSR, IAPSR, EAPSR, PSR, MSP, PSP, PRIMASK, BASEPRI,
BASEPRI_MAX, FAULTMASK, CONTROL,MSP_NS, PSP_NS, MSPLIM, PSPLIM, MSPLIM_NS, PSPLIM_NS,
PRIMASK_NS, FAULTMASK_NS, and CONTROL_NS.
Note: All the EPSR and IPSR fields are zero when read by the MRS instruction.
An access to a register not ending in _NS returns the register associated with the current Security state.
Access to a register ending in _NS in Secure state returns the Non-secure register. Access to a register ending
in _NS in Non-secure state is RAZ/WI.
Operation
Use MRS in combination with MSR as part of a read‑modify‑write sequence for updating a PSR, for example to
clear the Q flag.
In process swap code, the programmers model state of the process being swapped out must be saved, including
relevant PSR contents. Similarly, the state of the process being swapped in must also be restored. These
operations use MRS in the state-saving instruction sequence and MSR in the state-restoring instruction sequence.
Note: BASEPRI_MAX is an alias of BASEPRI when used with the MRS instruction.
Restrictions
Rd must not be SP and must not be PC.
Condition flags
This instruction does not change the flags.
MRS R0, PRIMASK ; Read PRIMASK value and write it to R0
3.11.8 MSR
Move the contents of a general‑purpose register into the specified special register.
MSR{cond} spec_reg, Rn
Where:
cond
Is an optional condition code.
Rn
Is the source register.
spec_reg
Can be any of: APSR_nzcvq, APSR_g, APSR_nzcvqg, MSP, PSP, PRIMASK, BASEPRI, BASEPRI_MAX,
FAULTMASK, CONTROL, MSP_NS, PSP_NS -MSPLIM, PSPLIM, MSPLIM_NS, PSPLIM_NS, PRIMASK_NS,
FAULTMASK_NS, and CONTROL_NS.
Note: You can use APSR to refer to APSR_nzcvq.
Operation
The register access operation in MSR depends on the privilege level. Unprivileged software can only access the
APSR, see the APSR bit assignments. Privileged software can access all special registers.
In unprivileged software writes to unallocated or execution state bits in the PSR are ignored.
Note: When you write to BASEPRI_MAX, the instruction writes to BASEPRI only if either:
• Rn is non-zero and the current BASEPRI value is 0.
• Rn is non-zero and less than the current BASEPRI value.
Note: An access to a register not ending in _NS writes the register associated with the current Security state. Access
to a register ending in _NS in Secure state writes the Non-secure register. Access to a register ending in _NS in
Non-secure state is RAZ/WI.
Restrictions
Rn must not be SP and must not be PC.
Condition flags
This instruction updates the flags explicitly based on the value in Rn.
MSR CONTROL, R1 ; Read R1 value and write it to the CONTROL register.
3.11.9 NOP
No Operation.
NOP{cond}
Where:
cond
Is an optional condition code.
Operation
NOP does nothing. NOP is not necessarily a time‑consuming NOP. The processor might remove it from the pipeline
before it reaches the execution stage.
Use NOP for padding, for example to place the following instruction on a 64‑bit boundary.
Condition flags
This instruction does not change the flags.
NOP ; No operation
3.11.10 SEV
Send Event.
SEV{cond}
Where:
cond
Is an optional condition code.
Operation
SEV is a hint instruction that causes an event to be signaled to all processors within a multiprocessor system. It
also sets the local event register to 1.
Condition flags
This instruction does not change the flags.
SEV ; Send Event
3.11.11 SG
Secure Gateway.
SG
Operation
Secure Gateway marks a valid branch target for branches from Non-secure code that wants to call Secure code.
A linker is expected to generate a Secure Gateway operation as a part of the branch table for the Non-secure
Callable (NSC) region.
There is no C intrinsic function for SG. Secure Gateways are expected to be generated by linker or by assembly
programming. Arm does not expect software developers to insert a Secure Gateway instruction inside C or C++
program code.
Note: For information about how to build a Secure image that uses a previously generated import library, see the Arm®
Compiler Software Development Guide.
3.11.12 SVC
Supervisor Call.
SVC{cond} #imm
Where:
cond
Is an optional condition code.
imm
Is an expression evaluating to an integer in the range 0‑255 (8‑bit value).
Operation
The SVC instruction causes the SVC exception.
imm is ignored by the processor. If required, it can be retrieved by the exception handler to determine what
service is being requested.
Condition flags
This instruction does not change the flags.
SVC #0x32 ; Supervisor Call (SVCall handler can extract the immediate value
; by locating it through the stacked PC)
cond
Is an optional condition code.
Rd
Is the destination general-purpose register into which the status result of the target test is written.
Rn
Is the base register.
Operation
The instruction returns the Security state and access permissions in the destination register, the contents of which
are as follows:
Table 44. Security state and access permissions in the destination register
[7:0] MREGION The MPU region that the address maps to. This field is 0 if MRVALID is 0.
. RAZ/WI The SAU region that the address maps to. This field is only valid if the instruction is executed
[15:8] -SREGION
from Secure state. This field is 0 if SRVALID is 0.
[16] MRVALID Set to 1 if the MREGION content is valid. Set to 0 if the MREGION content is invalid.
[17] -SRVALID . RAZ/WI Set to 1 if the SREGION content is valid. Set to 0 if the SREGION content is invalid.
Read accessibility. Set to 1 if the memory location can be read according to the permissions of the
[18] R selected MPU when operating in the current mode. For TTT and TTAT, this bit returns the permissions
for unprivileged access, regardless of whether the current mode is privileged or unprivileged.
Read/write accessibility. Set to 1 if the memory location can be read and written according to the
[19] RW
permissions of the selected MPU when operating in the current mode.
[31:20] - RAZ/WI
Equal to R AND NOT S. Can be used with the LSLS (immediate) instruction to check both the MPU and
[20] NSR SAU or IDAU permissions. This bit is only valid if the instruction is executed from Secure state and the R
field is valid.
Equal to RW AND NOT S. Can be used with the LSLS (immediate) instruction to check both the MPU
[21] NSRW and SAU or IDAU permissions. This bit is only valid if the instruction is executed from Secure state and
the RW field is valid.
Security. A value of 1 indicates that the memory location is Secure, and a value of 0 indicates that the
[22] S
memory location is Non-secure. This bit is only valid if the instruction is executed from Secure state.
IREGION valid flag. For a Secure request, indicates the validity of the IREGION field. Set to 1 if the
IREGION content is valid. Set to 0 if the IREGION content is invalid.
[23] IRVALID
This bit is always 0 if the IDAU cannot provide a region number, the address is exempt from security
attribution, or if the requesting TT instruction is executed from the Non-secure state.
IDAU region number. Indicates the IDAU region number containing the target address. This field is 0 if
[31:24] IREGION
IRVALID is 0.
3.11.14 UDF
Permanently Undefined.
UDF{cond}.W {#}imm
Where:
imm
Is a:
• 8-bit unsigned immediate, in the range 0 to 255. The PE ignores the value of this constant.
• 16-bit unsigned immediate, in the range 0 to 65535. The PE ignores the value of this constant.
cond
Arm deprecates using any c value other than AL.
Operation
Permanently Undefined generates an Undefined Instruction UsageFault exception.
3.11.15 WFE
Wait For Event.
WFE{cond}
Where:
cond
Is an optional condition code.
Operation
WFE is a hint instruction.
If the event register is 0, WFE suspends execution until one of the following events occurs:
• An exception, unless masked by the exception mask registers or the current priority level.
• An exception enters the Pending state, if SEVONPEND in the System Control Register is set.
• A Debug Entry request, if Debug is enabled.
• An event signaled by a peripheral or another processor in a multiprocessor system using the SEV instruction.
If the event register is 1, WFE clears it to 0 and returns immediately.
Condition flags
This instruction does not change the flags.
WFE ; Wait for event
3.11.16 WFI
Wait for Interrupt.
WFI{cond}
Where:
cond
Is an optional condition code.
Operation
WFI is a hint instruction that suspends execution until one of the following events occurs:
• A non-masked interrupt occurs and is taken.
• An interrupt masked by PRIMASK becomes pending.
• A Debug Entry request, if Debug is enabled.
Condition flags
This instruction does not change the flags.
WFI ; Wait for interrupt
3.11.17 YIELD
Yield
YIELD{cond}
Where:
cond
Is an optional condition code.
Operation
YIELD is a hint instruction that enables software with a multithreading capability to indicate to the hardware that a
task is being performed, which could be swapped out to improve overall system performance. Hardware can use
this hint to suspend and resume multiple code threads if it supports the capability.
Condition flags
This instruction does not change the flags.
YIELD; Suspend task
LDR{type} Load Register using immediate offset Section 3.12.2 LDR and STR, immediate offset
LDR{type} Load Register using register offset Section 3.12.3 LDR and STR, register offset
LDR{type}T Load Register with unprivileged access Section 3.12.4 LDR and STR, unprivileged
LDR Load Register using PC-relative address Section 3.12.5 LDR, PC‑relative
LDRD Load Register Dual Section 3.12.2 LDR and STR, immediate offset
POP Pop registers from stack Section 3.12.8 PUSH and POP
PUSH Push registers onto stack Section 3.12.8 PUSH and POP
STR{type} Store Register using immediate offset Section 3.12.2 LDR and STR, immediate offset
STR{type} Store Register using register offset Section 3.12.3 LDR and STR, register offset
STR{type}T Store Register with unprivileged access Section 3.12.4 LDR and STR, unprivileged
3.12.1 ADR
Generate PC-relative address.
ADR{cond} Rd, label
Where:
cond
Is an optional condition code.
Rd
Is the destination register.
label
Is a PC‑relative expression.
Operation
ADR generates an address by adding an immediate value to the PC, and writes the result to the destination
register.
ADR provides the means by which position‑independent code can be generated, because the address is
PC‑relative.
If you use ADR to generate a target address for a BX or BLX instruction, you must ensure that bit[0] of the address
you generate is set to1 for correct execution.
Values of label must be within the range of −4095 to +4095 from the address in the PC.
Note: You might have to use the .W suffix to get the maximum offset range or to generate addresses that are not
word-aligned.
Restrictions
Rd must not be SP and must not be PC.
Condition flags
This instruction does not change the flags.
ADR R1, TextMessage ; Write address value of a location labelled as
; TextMessage to R1.
LDR
Load Register.
STR
Store Register.
type
Is one of:
B
Unsigned byte, zero extend to 32 bits on loads.
SB
Signed byte, sign extend to 32 bits (LDR only).
H
Unsigned halfword, zero extend to 32 bits on loads.
SH
Signed halfword, sign extend to 32 bits (LDR only).
‑
Omit, for word.
cond
Is an optional condition code.
Rt
Is the register to load or store.
Rn
Is the register on which the memory address is based.
offset
Is an offset from Rn. If offset is omitted, the address is the contents of Rn.
Rt2
Is the additional register to load or store for two-word operations.
Operation
LDR instructions load one or two registers with a value from memory.
STR instructions store one or two register values to memory.
Load and store instructions with immediate offset can use the following addressing modes:
Offset addressing The offset value is added to or subtracted from the address obtained from the register Rn.
The result is used as the address for the memory access. The register Rn is unaltered. The
assembly language syntax for this mode is:
[Rn, #offset]
Pre-indexed addressing The offset value is added to or subtracted from the address obtained from the register Rn. The
result is used as the address for the memory access and written back into the register Rn. The
assembly language syntax for this mode is:
[Rn, #offset]!
Post-indexed addressing The address obtained from the register Rn is used as the address for the memory access. The
offset value is added to or subtracted from the address, and written back into the register Rn.
The assembly language syntax for this mode is:
[Rn], #offset
The value to load or store can be a byte, halfword, word, or two words. Bytes and halfwords can either be signed
or unsigned.
The following table shows the ranges of offset for immediate, pre-indexed and post-indexed forms.
Restrictions
For load instructions:
• Rt can be SP or PC for word loads only.
• Rt must be different from Rt2 for two-word loads.
• Rn must be different from Rt and Rt2 in the pre-indexed or post-indexed forms.
When Rt is PC in a word load instruction:
• Bit[0] of the loaded value must be 1 for correct execution.
• A branch occurs to the address created by changing bit[0] of the loaded value to 0.
• If the instruction is conditional, it must be the last instruction in the IT block.
For store instructions:
• Rt can be SP for word stores only.
• Rt must not be PC.
• Rn must not be PC.
• Rn must be different from Rt and Rt2 in the pre-indexed or post-indexed forms.
Condition flags
These instructions do not change the flags.
LDR R8, [R10] ; Loads R8 from the address in R10.
LDRNE R2, [R5, #960]! ; Loads (conditionally) R2 from a word
; 960 bytes above the address in R5, and
; increments R5 by 960.
STR R2, [R9,#const‑struc] ; const‑struc is an expression evaluating
; to a constant in the range 0‑4095.
STRH R3, [R4], #4 ; Store R3 as halfword data into address in
; R4, then increment R4 by 4.
LDRD R8, R9, [R3, #0x20] ; Load R8 from a word 32 bytes above the
; address in R3, and load R9 from a word 36
; bytes above the address in R3.
STRD R0, R1, [R8], #-16 ; Store R0 to address in R8, and store R1 to
; a word 4 bytes above the address in R8,
; and then decrement R8 by 16.
LDR
Load Register.
STR
Store Register.
type
Is one of:
B
Unsigned byte, zero extend to 32 bits on loads.
SB
Signed byte, sign extend to 32 bits (LDR only).
H
Unsigned halfword, zero extend to 32 bits on loads.
SH
Signed halfword, sign extend to 32 bits (LDR only).
‑
omit, for word.
cond
Is an optional condition code.
Rt
Is the register to load or store.
Rn
Is the register on which the memory address is based.
Rm
Is a register containing a value to be used as the offset.
LSL #n
Is an optional shift, with n in the range 0-3.
Operation
LDR instructions load a register with a value from memory.
STR instructions store a register value into memory.
The memory address to load from or store to is at an offset from the register Rn. The offset is specified by the
register Rm and can be shifted left by up to 3 bits using LSL.
The value to load or store can be a byte, halfword, or word. For load instructions, bytes and halfwords can either
be signed or unsigned.
Restrictions
In these instructions:
• Rn must not be PC.
• Rm must not be SP and must not be PC.
• Rt can be SP only for word loads and word stores.
• Rt can be PC only for word loads.
When Rt is PC in a word load instruction:
• Bit[0] of the loaded value must be 1 for correct execution, and a branch occurs to this halfword-aligned
address.
• If the instruction is conditional, it must be the last instruction in the IT block.
Condition flags
These instructions do not change the flags.
LDR
Load Register.
STR
Store Register.
type
Is one of:
B
Unsigned byte, zero extend to 32 bits on loads.
SB
Signed byte, sign extend to 32 bits (LDR only).
H
Unsigned halfword, zero extend to 32 bits on loads.
SH
Signed halfword, sign extend to 32 bits (LDR only).
‑
Omit, for word.
cond
Is an optional condition code.
Rt
Is the register to load or store.
Rn
Is the register on which the memory address is based.
offset
Is an immediate offset from Rn and can be 0 to 255. If offset is omitted, the address is the value in Rn.
Operation
These load and store instructions perform the same function as the memory access instructions with immediate
offset. The difference is that these instructions have only unprivileged access even when used in privileged
software.
When used in unprivileged software, these instructions behave in exactly the same way as normal memory
access instructions with immediate offset.
Restrictions
In these instructions:
• Rn must not be PC.
• Rt must not be SP and must not be PC.
Condition flags
These instructions do not change the flags.
STRBTEQ R4, [R7] ; Conditionally store least significant byte in
; R4 to an address in R7, with unprivileged access.
LDRHT R2, [R2, #8] ; Load halfword value from an address equal to
; sum of R2 and 8 into R2, with unprivileged access.
B
Unsigned byte, zero extend to 32 bits.
SB
Signed byte, sign extend to 32 bits.
H
Unsigned halfword, zero extend to 32 bits.
SH
Signed halfword, sign extend to 32 bits.
‑
Omit, for word.
cond
Is an optional condition code.
Rt
Is the register to load or store.
Rt2
Is the second register to load or store.
label
Is a PC‑relative expression.
Operation
LDR loads a register with a value from a PC-relative memory address. The memory address is specified by a label
or by an offset from the PC.
The value to load or store can be a byte, halfword, or word. For load instructions, bytes and halfwords can either
be signed or unsigned.
label must be within a limited range of the current instruction. The following table shows the possible offsets
between label and the PC.
Note: You might have to use the .W suffix to get the maximum offset range.
Restrictions
In these instructions:
• Rt can be SP or PC only for word loads.
• Rt2 must not be SP and must not be PC.
• Rt must be different from Rt2.
When Rt is PC in a word load instruction:
• Bit[0] of the loaded value must be 1 for correct execution, and a branch occurs to this halfword-aligned
address.
• If the instruction is conditional, it must be the last instruction in the IT block.
Condition flags
These instructions do not change the flags.
LDR R0, LookUpTable ; Load R0 with a word of data from an address
; labelled as LookUpTable.
LDRSB R7, localdata ; Load a byte value from an address labelled
; as localdata, sign extend it to a word
; value, and put it in R7.
LDM
Load Multiple registers.
STM
Store Multiple registers.
addr_mode
Is any one of the following:
IA
Increment address After each access. This is the default.
DB
Decrement address Before each access.
cond
Is an optional condition code.
Rn
Is the register on which the memory addresses are based.
!
Is an optional write-back suffix. If ! is present the final address, that is loaded from or stored to, is written back
into Rn.
reglist
Is a list of one or more registers to be loaded or stored, enclosed in braces. It can contain register ranges. It
must be comma separated if it contains more than one register or register range.
LDMIA and LDMFD are synonyms for LDM. LDMFD refers to its use for popping data from Full Descending stacks.
LDMEA is a synonym for LDMDB, and refers to its use for popping data from Empty Ascending stacks.
STMIA and STMEA are synonyms for STM. STMEA refers to its use for pushing data onto Empty Ascending stacks.
STMFD is a synonym for STMDB, and refers to its use for pushing data onto Full Descending stacks.
Operation
LDM instructions load the registers in reglist with word values from memory addresses based on Rn.
STM instructions store the word values in the registers in reglist to memory addresses based on Rn.
For LDM, LDMIA, LDMFD, STM, STMIA, and STMEA the memory addresses used for the accesses are at 4-byte
intervals ranging from Rn to Rn + 4 * (n-1), where n is the number of registers in reglist. The accesses happens in
order of increasing register numbers, with the lowest numbered register using the lowest memory address and the
highest number register using the highest memory address. If the write-back suffix is specified, the value of Rn +
4 * (n-1) is written back to Rn.
For LDMDB, LDMEA, STMDB, and STMFD the memory addresses used for the accesses are at 4-byte intervals
ranging from Rn to Rn - 4 * (n-1), where n is the number of registers in reglist. The accesses happen in order
of decreasing register numbers, with the highest numbered register using the highest memory address and the
lowest number register using the lowest memory address. If the write-back suffix is specified, the value of Rn - 4 *
(n-1) is written back to Rn.
The PUSH and POP instructions can be expressed in this form.
Restrictions
In these instructions:
• Rn must not be PC.
• reglist must not contain SP.
• In any STM instruction, reglist must not contain PC.
• In any LDM instruction, reglist must not contain PC if it contains LR.
• reglist must not contain Rn if you specify the write-back suffix.
When PC is in reglist in an LDM instruction:
• Bit[0] of the value loaded to the PC must be 1 for correct execution, and a branch occurs to this halfword-
aligned address
• If the instruction is conditional, it must be the last instruction in the IT block.
Condition flags
These instructions do not change the flags.
LDM R8,{R0,R2,R9} ; LDMIA is a synonym for LDM.
STMDB R1!,{R3‑R6,R11,R12}
Incorrect examples
3.12.7 PLD
Preload Data.
PLD{cond} [Rn {, #imm}] ; Immediate
PLD{cond} [Rn, Rm {, LSL #shift}] ; Register
PLD{cond} label ; Literal
Where:
cond
Is an optional condition code.
Rn
Is the base register.
imm
Is the + or - immediate offset used to form the address. This offset can be omitted, meaning an offset of 0.
Rm
Is the optionally shifted offset register.
shift
Specifies the shift to apply to the value read from <Rm>, in the range 0-3. If this option is omitted, a shift by 0 is
assumed.
label
The label of the literal item that is likely to be accessed in the near future.
Operation
PLD signals the memory system that data memory accesses from a specified address are likely in the near
future. If the address is cacheable then the memory system responds by pre-loading the cache line containing
the specified address into the data cache. If the address is not cacheable, or the data cache is disabled, this
instruction behaves as no operation.
Restrictions
There are no restrictions.
Condition flags
These instructions do not change the flags.
PUSH and POP are synonyms for STMDB and LDM (or LDMIA) with the memory addresses for the access based on
SP, and with the final address for the access written back to the SP. PUSH and POP are the preferred mnemonics
in these cases.
Operation
PUSH stores registers on the stack, with the lowest numbered register using the lowest memory address and the
highest numbered register using the highest memory address.
POP loads registers from the stack, with the lowest numbered register using the lowest memory address and the
highest numbered register using the highest memory address.
PUSH uses the value in the SP register minus four as the highest memory address, POP uses the value in the SP
register as the lowest memory address, implementing a full-descending stack. On completion, PUSH updates the
SP register to point to the location of the lowest store value, POP updates the SP register to point to the location
above the highest location loaded.
If a POP instruction includes PC in its reglist, a branch to this location is performed when the POP instruction has
completed. Bit[0] of the value read for the PC is used to update the APSR T-bit. This bit must be 1 to ensure
correct operation.
Restrictions
In these instructions:
• reglist must not contain SP.
• For the PUSH instruction, reglist must not contain PC.
• For the POP instruction, reglist must not contain PC if it contains LR.
When PC is in reglist in a POP instruction:
• Bit[0] of the value loaded to the PC must be 1 for correct execution, and a branch occurs to this halfword-
aligned address.
• If the instruction is conditional, it must be the last instruction in the IT block.
Condition flags
These instructions do not change the flags.
PUSH {R0,R4-R7} ; Push R0,R4,R5,R6,R7 onto the stack
POP {R0,R6,PC} ; Pop r0,r6 and PC from the stack, then branch to the new PC.
LDA
Load-Acquire Register.
STL
Store-Release Register.
type
Is one of:
B
Unsigned byte, zero extend to 32 bits on loads.
H
Unsigned halfword, zero extend to 32 bits on loads..
cond
Is an optional condition code.
Rt
Is the register to load or store.
Rn
Is the register on which the memory address is based.
Operation
LDA, LDAB, and LDAH loads word, byte, and halfword data respectively from a memory address. If any loads
or stores appear after a load-acquire in program order, then all observers are guaranteed to observe the load-
acquire before observing the loads and stores. Loads and stores appearing before a load-acquire are unaffected.
STL, STLB, and STLH stores word, byte, and halfword data respectively to a memory address. If any loads or
stores appear before a store-release in program order, then all observers are guaranteed to observe the loads
and stores before observing the store-release. Loads and stores appearing after a store-release are unaffected.
In addition, if a store-release is followed by a load-acquire, each observer is guaranteed to observe them in
program order.
There is no requirement that a load-acquire and store-release be paired.
All store-release operations are multi-copy atomic, meaning that in a multiprocessing system, if one observer
observes a write to memory because of a store-release operation, then all observers observe it. Also, all
observers observe all such writes to the same location in the same order.
Restrictions
The address specified must be naturally aligned, or an alignment fault is generated.
The PC must not use SP for Rt.
Condition flags
These instructions do not change the flags.
Operation
LDREX, LDREXB, and LDREXH load a word, byte, and halfword respectively from a memory address.
STREX, STREXB, and STREXH attempt to store a word, byte, and halfword respectively to a memory address. The
address used in any Store-Exclusive instruction must be the same as the address in the most recently executed
Load-exclusive instruction. The value stored by the Store-Exclusive instruction must also have the same data
size as the value loaded by the preceding Load-exclusive instruction. This means software must always use a
Load-exclusive instruction and a matching Store-Exclusive instruction to perform a synchronization operation.
If a Store-Exclusive instruction performs the store, it writes 0 to its destination register. If it does not perform the
store, it writes 1 to its destination register. If the Store-Exclusive instruction writes 0 to the destination register, it
is guaranteed that no other process in the system has accessed the memory location between the Load-exclusive
and Store-Exclusive instructions.
For reasons of performance, keep the number of instructions between corresponding Load-Exclusive and Store-
Exclusive instruction to a minimum.
Note: The result of executing a Store-Exclusive instruction to an address that is different from that used in the
preceding Load-Exclusive instruction is unpredictable.
Restrictions
In these instructions:
• Do not use PC.
• Do not use SP for Rd and Rt.
• For STREX, Rd must be different from both Rt and Rn.
• The value of offset must be a multiple of four in the range 0-1020.
Condition flags
These instructions do not change the flags.
MOV R1, #0x1 ; Initialize the ‘lock taken’ value
try
LDREX R0, [LockAddr] ; Load the lock value
CMP R0, #0 ; Is the lock free?
ITT EQ ; IT instruction for STREXEQ and CMPEQ
STREXEQ R0, R1, [LockAddr] ; Try and claim the lock
CMPEQ R0, #0 ; Did this succeed?
BNE try ; No – try again
.... ; Yes – we have the lock.
LDAEX
Load Register.
STLEX
Store Register.
type
Is one of:
B
Unsigned byte, zero extend to 32 bits on loads.
H
Unsigned halfword, zero extend to 32 bits on loads..
cond
is an optional condition code.
Rd
is the destination register for the returned status.
Rt
is the register to load or store.
Rn
is the register on which the memory address is based.
Operation
Load Register Exclusive calculates an address from a base register value and an immediate offset, loads a word
from memory, writes it to a register and:
• If the address has the Shared Memory attribute, marks the physical address as exclusive access for the
executing core in a global monitor.
• Causes the core that executes to indicate an active exclusive access in the local monitor.
• If any loads or stores appear after LDAEX in program order, then all observers are guaranteed to observe the
LDAEX before observing the loads and stores. Loads and stores appearing before LDAEX are unaffected.
Store Register Exclusive calculates an address from a base register value and an immediate offset, and stores a
word from a register to memory If the executing core has exclusive access to the memory addressed:
• Rd is the destination general-purpose register into which the status result of the store exclusive is written,
encoded in the Rd field. The value returned is:
0 If the operation updates memory.
1 If the operation fails to update memory.
• If any loads or stores appear before STLEX in program order, then all observers are guaranteed to observe
the loads and stores before observing the store-release. Loads and stores appearing after STLEX are
unaffected.
Note: All store-release operations are multi-copy atomic.
Restrictions
In these instructions:
• Do not use PC.
• Do not use SP for Rd and Rt.
• For STLEX, Rd must be different from both Rt and Rn.
Condition flags
These instructions do not change the flags.
lock
MOV R1, #0x1 ; Initialize the ‘lock taken’ value try
LDAEX R0, [LockAddr] ; Load the lock value
CMP R0, #0 ; Is the lock free?
BNE try ; No – try again
STREX R0, R1, [LockAddr] ; Try and claim the lock
CMP R0, #0 ; Did this succeed?
BNE try ; No – try again
; Yes – we have the lock.
unlock
MOV r1, #0
STL r1, [r0]
3.12.12 CLREX
Clear Exclusive.
CLREX{cond}
Where:
cond
Is an optional condition code.
Operation
Use CLREX to make the next STREX, STREXB, or STREXH instruction write 1 to its destination register and fail to
perform the store. CLREX enables compatibility with other Arm Cortex processors that have to force the failure of
the store exclusive if the exception occurs between a load-exclusive instruction and the matching store-exclusive
instruction in a synchronization operation. In Cortex-M processors, the local exclusive access monitor clears
automatically on an exception boundary, so exception handlers using CLREX are optional.
Condition flags
This instruction does not change the flags.
CLREX
4 Cortex®-M33 peripherals
1. Software can read the MPU Type Register at 0xE000ED90 to test for the presence of a Memory Protection Unit (MPU).
Required
Address Name Type Reset value Description
privilege
Note: The input parameter IRQn is the IRQ number. For more information on CMSIS NVIC functions, see http://
arm-software.github.io/CMSIS_5/Core/html/group__NVIC__gr.html
31 0
SETENA
Interrupt set-enable bits. For SETENA[m] in NVIC_ISERn, allows interrupt 32n + m to be accessed.
Write:
0 No effect.
Read:
0 Interrupt 32n+m disabled.
1 Interrupt 32n+m enabled.
If a pending interrupt is enabled, the NVIC activates the interrupt based on its priority. If an interrupt is not
enabled, asserting its interrupt signal changes the interrupt state to pending, but the NVIC never activates the
interrupt, regardless of its priority.
The register bits can be RAZ/WI depending on the value of NVIC_ITNS
31 0
CLRENA
Interrupt clear-enable bits. For SETENA[m] in NVIC_ICERn, allows interrupt 32n + m to be accessed.
Write:
0 No effect.
Read:
0 Interrupt 32n+m disabled.
1 Interrupt 32n+m enabled.
31 0
SETPEND
Interrupt set-pending bits. For SETPEND[m] in NVIC_ISPRn, allows interrupt 32n + m to be accessed.
Write:
0 No effect.
Read:
0 Interrupt 32n + m is not pending.
1 Interrupt 32n + m pending.
31 0
ACTIVE
Active state bits. For ACTIVE[m] in NVIC_IABRn, indicates the active state for interrupt 32n+m.
[31:0] ACTIVE 0 The interrupt is not active.
1 The interrupt is active.
31 0
ITNS
Interrupt Targets Non-secure bits. For ITNS[m] in NVIC_ITNSn, this field indicates and allows modification of
the target Security state for interrupt 32n+m.
[31:0] ITNS
0 The interrupt targets Secure state.
1 The interrupt targets Non-secure state.
31 24 23 16 15 8 7 0
. . .
...
. . .
...
Priority,
[31:24] byte offset
3
Priority,
[23:16] byte offset Each priority field holds a priority value. The priority depends on the value of PRIS for exceptions
2 targeting the Non-secure state. If the processor implements fewer than 8 bits of priority, then the least
significant bits of this field are res0. Each priority field holds a priority value. The lower the value, the
Priority, greater the priority of the corresponding interrupt. If the processor implements fewer than 8 bits of
[15:8] byte offset priority, then the least significant bits of this field are res0.
1
Priority,
[7:0] byte offset
0
See Section 4.2.1 Accessing the NVIC registers using CMSIS for more information about the access to the
interrupt priority array, which provides the software view of the interrupt priorities.
Find the NVIC_IPR number and byte offset for interrupt M as follows:
• The corresponding NVIC_IPR number, N, is given by N = M DIV 4.
• The byte offset of the required Priority field in this register is M MOD 4, where:
– Byte offset 0 refers to register bits[7:0].
– Byte offset 1 refers to register bits[15:8].
– Byte offset 2 refers to register bits[23:16].
– Byte offset 3 refers to register bits[31:24].
Priority values depend on the value of PRIS.
The register bits can be RAZ/WI depending on the value of NVIC_ITNS.
These registers are not banked between Security states.
31 0
CLRPEND
Read:
0 Interrupt 32n + m is not pending.
1 Interrupt 32n + m is pending.
Note: Writing 1 to an NVIC_ICPR bit does not affect the active state of the corresponding interrupt.
31 9 8 0
RES0 INTID
In addition, the CMSIS provides functions for NVIC control, listed in Section 4.2.1 Accessing the NVIC registers
using CMSIS.
The input parameter IRQn is the IRQ number, see Section 2.4.2 Exception types for more information. For more
information about these functions, see the CMSIS documentation.
Required Reset
Address Name Type Description
privilege value
E000ED04 ICSR RW(1) Privileged 00000000 Section 4.3.5 Interrupt Control and State Register
Required Reset
Address Name Type Description
privilege value
E000ED08 VTOR RW Privileged UNKNOWN Section 4.3.6 Vector Table Offset Register
E000ED0C AIRCR RW(1) Privileged FA050000 Section 4.3.7 Application Interrupt and Reset Control Register
E000ED1C SHPR2 RW Privileged 00000000 Section 4.3.10.2 System Handler Priority Register 2
E000ED20 SHPR3 RW Privileged 00000000 Section 4.3.10.3 System Handler Priority Register 3
E000ED24 SHCSR RW Privileged 00000000 Section 4.3.11 System Handler Control and State Register
E000ED28 CFSR RW Privileged 00000000 Section 4.3.12 Configurable Fault Status Register
31 24 23 22 21 20 19 0
RES0 RES0
CP10
CP11
31 30 29 28 13 12 11 10 9 8 3 2 1 0
UNK/SBZP UNK/SBZP
EXTEXCLALL
UNK/SBZP
DISITMATBFLUSH
UNK/SBZP
FPEXCODIS
DISOOFP
DISFOLD
UNK/SBZP
DISMCYCINT
Implementer code:
[31:24] Implementer
0x41 Arm
Variant number, the n value in the rnpm product revision identifier:
[23:20] Variant
0 Revision 0
[19:16] Constant Reads as 0xF
Part number of the processor:
[15:4] PartNo
D21 Cortex‑M33
Revision number, the m value in the rnpm product revision identifier:
[3:0] Revision
2 Patch 2.
31 30 29 28 27 26 25 24 23 22 21 20 12 11 10 9 8 0
VECTPENDING VECTACTIVE
Read:
0 NMI exception is not pending.
Read:
0 SysTick exception is not pending.
Note:
Subtract 16 from this value to obtain the CMSIS
IRQ number required to index into the Interrupt Clear-
Enable, Set-Enable, Clear-Pending, Set-Pending, or
Priority Registers, see Section 2.1.3.6.2 Interrupt
Program Status Register.
This field is not banked between Security states.
1. This is the same value as IPSR bits[8:0], see Section 2.1.3.6.2 Interrupt Program Status Register
TBLOFF RES0
<See the configurable information after the register description table for information about the
configuration of the boundary between TBLOFF field and the [6:0] field that follows.>
Vector table base offset field. It contains bits[29:7] of the offset of the table base from the bottom of the
[31:7] TBLOFF memory map.<See the configurable information after this table for information about the configuration of this
field and the [6:0] field that follows.>.
[6:0] - Reserved, res0.
When setting TBLOFF, you must align the offset to the number of exception entries in the vector table. <Configure
the next statement to give the information required for your implementation, the statement reminds you of how
to determine the alignment requirement.> The minimum alignment is 32 words, enough for up to 16 interrupts.
For more interrupts, adjust the alignment by rounding up to the next power of two. For example, if you require 21
interrupts, the alignment must be on a 64-word boundary because the required table size is 37 words, and the
next power of two is 64.
Note: Table alignment requirements mean that bits[6:0] of the table offset are always zero.
31 16 15 14 13 12 11 10 8 7 4 3 2 1 0
Read: VECTKEYSTAT
RES0 RES0
Write: VECTKEY
ENDIANNESS
PRIS
BFHFNMINS
PRIGROUP
SYSRESETREQS
SYSRESETREQ
VECTCLRACTIVE
RES0
Register key:
Read: VECTKEYSTAT Reads as 0xFA05.
[31:16] RW
Write: VECTKEY On writes, write 0x5FA to VECTKEY,
otherwise the write is ignored.
Data endianness bit:
[15] ENDIANNESS RO
0 Little-endian.
[14] PRIS RAZ/WI -
[13] BFHFNMINS RAO/WI -
[12:11] - - Reserved, RES0
Interrupt priority grouping field. This field
determines the split of group priority from
[10:8] PRIGROUP RW
subpriority, see Section 4.3.7.1 Binary
point.
[7:4] - - Reserved, RES0
[3] SYSRESETREQS RAZ/WI -
[2] SYSRESETREQ RAZ/WI -
Reserved for Debug use. This bit reads
as 0. When writing to the register you
[1] VECTCLRACTIVE WO
must write 0 to this bit, otherwise behavior
is UNPREDICTABLE.
[0] - - Reserved, RES0
Register key:
Reads as 0xFA05.
Read: VECTKEYSTAT
[31:16] RW On writes, write 0x5FA to VECTKEY,
Write: VECTKEY otherwise the write is ignored.
This Field is not banked between Security
states.
Data endianness bit:
0 Little-endian.
[15] ENDIANNESS RO
This bit is not banked between Security
states.
RAO/WI
BusFault and NMI are Non-
1 secure and exceptions can
target Non-secure HardFault.
PRIGROUP Binary point(1) Group priority bits Subpriority bits Group priorities Subpriorities
1. PRI_n[7:0] field showing the binary point. x denotes a group priority field bit, and y denotes a subpriority field bit.
Note: Determining pre-emption of an exception uses only the group priority field.
RES0
SEVONPEND
SLEEPDEEPS
SLEEPDEEP
SLEEPONEXIT
RES0
31 19 18 17 16 15 11 10 9 8 7 5 4 3 2 1 0
BP
IC
DC
STKOFHFNMIGN
RES1
BFHFNMIGN
DIV_0_TRP
UNALIGN_TRP
RES0
USERSETMPEND
RES1
MemManage PRI_4
BusFault PRI_5
Section 4.3.10.1 System Handler Priority Register 1
UsageFault PRI_6
SecureFault PRI_7
SVCall PRI_11 Section 4.3.10.2 System Handler Priority Register 2
PendSV PRI_14
Section 4.3.10.3 System Handler Priority Register 3
SysTick PRI_15
Each PRI_n field is 8 bits wide, but the processor implements only bits[7:M] of each field, and bits[M-1:0] read as
zero and ignore writes.
PRI_11 Reserved
HARDFAULTPENDED MEMFAULTACT
SECUREFAULTPENDED BUSFAULTACT
SECUREFAULTENA HARDFAULTACT
USGFAULTENA USGFAULTACT
BUSFAULTENA SECUREFAULTACT
MEMFAULTENA NMIACT
SVCALLPENDED SVCALLACT
BUSFAULTPENDED MONITORACT
MEMFAULTPENDED PENDSVACT
USGFAULTPENDED SYSTICKACT
If you disable a system handler and the corresponding fault occurs, the processor treats the fault as a hard fault.
You can write to this register to change the pending or active status of system exceptions. An OS kernel can write
to the active bits to perform a context switch that changes the current exception type.
Caution: • Software that changes the value of an active bit in this register without correct adjustment to the stacked
content can cause the processor to generate a fault exception. Ensure software that writes to this register
retains and t restores the current active status.
• After you have enabled the system handlers, if you have to change the value of a bit in this register you
must use a read-modify-write procedure. Using a read-modify-write procedure ensures that you change
only the required bit.
The CFSR is byte accessible. You can access the CFSR or its subregisters as follows:
• Access the complete CFSR with a word access to 0xE000ED28.
• Access the MMFSR with a byte access to 0xE000ED28.
• Access the MMFSR and BFSR with a halfword access to 0xE000ED28.
• Access the BFSR with a byte access to 0xE000ED29.
• Access the UFSR with a halfword access to 0xE000ED2A.
MMARVALID IACCVIOL
RES0 DACCVIOL
MLSPERR RES0
MSTKERR MUNSTKERR
If a MemManage fault occurs and is escalated to a HardFault because of priority, the HardFault handler
must set this bit to 0. This prevents problems on return to a stacked active MemManage fault handler
whose MMFAR value has been overwritten.
When this bit is 1, the SP is still adjusted but the values in the context area on the stack might be
incorrect. The processor has not written a fault address to the MMFAR.
MemManage fault on unstacking for a return from exception:
0 No unstacking fault.
1 Unstack for an exception return has caused one or more access violations.
[3] MUNSTKERR
This fault is chained to the handler. This means that when this bit is 1, the original return stack is still
present. The processor has not adjusted the SP from the failing return, and has not performed a new
save. The processor has not written a fault address to the MMFAR.
[2] - Reserved, res0.
Data access violation flag:
0 No data access violation fault.
The processor attempted a load or store at a location that does not permit
[1] DACCVIOL 1
the operation.
When this bit is 1, the PC value stacked for the exception return points to the faulting instruction. The
processor has loaded the MMFAR with the address of the attempted access.
Instruction access violation flag:
0 No instruction access violation fault.
The processor attempted an instruction fetch from a location that does not
1
[0] IACCVIOL permit execution.
This fault occurs on any access to an XN region, even when the MPU is disabled.
When this bit is 1, the PC value stacked for the exception return points to the faulting instruction. The
processor has not written a fault address to the MMFAR.
Note: The MMFSR bits are sticky. This means as one or more fault occurs, the associated bits are set to 1. A bit that is
set to 1 is cleared to 0 only by writing 1 to that bit, or by a reset.
BFARVALID IBUSERR
RES0 PRECISERR
LSPERR RES0
STKERR UNSTKERR
[7] BFARVALID
The processor sets this bit to 1 after a BusFault where the address is known. Other faults can set this bit
to 0, such as a MemManage fault occurring later.
If a BusFault occurs and is escalated to a hard fault because of priority, the hard fault handler must set
this bit to 0. This prevents problems if returning to a stacked active BusFault handler whose BFAR value
has been overwritten.
[6] - Reserved, res0.
0 No bus fault occurred during floating-point lazy state preservation.
[5] LSPERR
1 A bus fault occurred during floating-point lazy state preservation.
BusFault on stacking for exception entry:
0 No stacking fault.
[4] STKERR 1 Stacking for an exception entry has caused one or more BusFaults.
When the processor sets this bit to 1, the SP is still adjusted but the values in the context area on the
stack might be incorrect. The processor does not write a fault address to the BFAR.
BusFault on unstacking for a return from exception:
0 No unstacking fault.
1 Unstack for an exception return has caused one or more BusFaults.
[3] UNSTKERR
This fault is chained to the handler. This means that when the processor sets this bit to 1, the original
return stack is still present. The processor does not adjust the SP from the failing return, does not
performed a new save, and does not write a fault address to the BFAR.
[2] - Reserved, res0.
Precise data bus error:
0 No precise data bus error.
[1] PRECISERR A data bus error has occurred, and the PC value stacked for the exception
1
return points to the instruction that caused the fault.
When the processor sets this bit to 1, it writes the faulting address to the BFAR.
Instruction bus error:
0 No instruction bus error.
1 Instruction bus error.
[0] IBUSERR
The processor detects the instruction bus error on prefetching an instruction, but it sets the IBUSERR
flag to 1 only if it attempts to issue the faulting instruction.
When the processor sets this bit to 1, it does not write a fault address to the BFAR.
Note: The BFSR bits are sticky. This means as one or more fault occurs, the associated bits are set to 1. A bit that is
set to 1 is cleared to 0 only by writing 1 to that bit, or by a reset.
15 10 9 8 7 5 4 3 2 1 0
RES0 RES0
DIVBYZERO
UNALIGNED
STKOF
NOCP
INVPC
INVSTATE
UNDEFINSTR
Note: All the bits are sticky. This means as one or more fault occurs, the associated bits are set to 1. A bit that is set to
1 is cleared to 0 only by writing 1 to that bit, or by a reset.
31 30 29 2 1 0
RES0
FORCED VECTTBL
DEBUGEVT RES0
Reserved for Debug use. When writing to the register you must write 1 to this bit, otherwise behavior is
[31] DEBUGEVT
unpredictable. If AIRCR.BFHFNMINS is zero this field is RAZ/WI from Non-secure state.
Indicates a forced HardFault, generated by escalation of a fault with configurable priority that cannot be
handled, either because of priority or because it is disabled:
0 No forced HardFault.
[30] FORCED
1 Forced HardFault.
When this bit is set to 1, the HardFault handler must read the other fault status registers to find the
cause of the fault. If AIRCR.BFHFNMINS is zero this field is RAZ/WI from Non-secure state.
[29:2] - Reserved, res0.
Indicates a HardFault on a vector table read during exception processing:
0 No HardFault on vector table read.
1 HardFault on vector table read.
[1] VECTTBL
This error is always handled by the HardFault handler.
When this bit is set to 1, the PC value stacked for the exception return points to the instruction that was
pre-empted by the exception. If AIRCR.BFHFNMINS is zero this field is RAZ/WI from Non-secure state.
[0] - Reserved, res0.
Note: The HFSR bits are sticky. This means as one or more fault occurs, the associated bits are set to 1. A bit that is
set to 1 is cleared to 0 only by writing 1 to that bit, or by a reset.
When the MMARVALID bit of the MMFSR is set to 1, this field holds the address of the location that
[31:0] ADDRESS
generated the MemManage fault
When an unaligned access faults, the address is the actual address that faulted. Because a single read or write
instruction can be split into multiple aligned accesses, the fault address can be any address in the range of the
requested access size.
Flags in the MMFSR indicate the cause of the fault, and whether the value in the MMFAR is valid.
When the BFARVALID bit of the BFSR is set to 1, this field holds the address of the location that
[31:0] ADDRESS
generated the BusFault
When an unaligned access faults the address in the BFAR is the one requested by the instruction, even if it is not
the address of the fault.
Flags in the BFSR indicate the cause of the fault, and whether the value in the BFAR is valid.
When enabled, each timer counts down from the reload value to zero, reloads (wraps to) the value in the
SYST_RVR on the next clock cycle, then decrements on subsequent clock cycles. Writing a value of zero to the
SYST_RVR disables the counter on the next wrap. When the counter transitions to zero, the COUNTFLAG status
bit is set to 1. Reading SYST_CSR clears the COUNTFLAG bit to 0. Writing to the SYST_CVR clears the register
and the COUNTFLAG status bit to 0. The write does not trigger the SysTick exception logic. Reading the register
returns its value at the time it is accessed.
Note: When the processor is halted for debugging, the counter does not decrement.
The system timer registers are:
E000E010 SYST_CSR RW 00000000 Section 4.4.1 SysTick Control and Status Register.
E000E014 SYST_RVR RW UNKNOWN Section 4.4.2 SysTick Reload Value Register.
E000E018 SYST_CVR RW UNKNOWN Section 4.4.3 SysTick Current Value Register.
C0000000
E000E01C SYST_CALIB RO Section 4.4.4 SysTick Calibration Value Register.
(SysTick calibration value)
RES0 RES0
COUNTFLAG CLKSOURCE
TICKINT
ENABLE
RES0 RELOAD
RES0 CURRENT
31 30 29 24 23 0
RES0 TENMS
SKEW
NOREF
[31] NOREF Reads as one. Indicates that no separate reference clock is provided.
Reads as one. Calibration value for the 10ms inexact timing is not known because TENMS is not known.
[30] SKEW
This can affect the suitability of SysTick as a software real-time clock.
[29:24] - Reserved, res0.
[23:0] TENMS Reads as zero. Indicates that calibration value is not known.
If calibration information is not known, calculate the calibration value required from the frequency of the core clock
or external clock.
Note: • Only Privileged accesses to the SAU registers are permitted. Unprivileged accesses generate a fault.
• The SAU registers are word accessible only. Halfword and byte accesses are UNPREDICTABLE.
• The SAU registers are RAZ/WI when accessed from Non-secure state.
• The SAU registers are not banked between Security states.
31 2 1 0
RES0
ALLNS
ENABLE
This bit is RAZ/WI when the Security Extension is implemented without an SAU region.
31 87 0
RES0 SREGION
31 87 0
RES0 REGION
31 5 4 0
BADDR Reserved
Base address. Holds bits[31:5] of the base address for the selected SAU region.
[31:5] BADDR
Bits[4:0] of the base address are defined as 0x00.
[4:0] - Reserved, res0.
31 5 4 2 1 0
LADDR
RES0
NSC
ENABLE
Limit address. Holds bits[31:5] of the limit address for the selected SAU region.
[31:5] LADDR
Bits[4:0] of the limit address are defined as 0x1F.
[4:2] - Reserved, res0.
Non-secure callable. Controls whether Non-secure state is permitted to execute an SG instruction from this
region.
31 8 7 6 5 4 3 2 1 0
RES0
LSERR
SFARVALID
LSPERR
INVTRAN
AUVIOL
INVER
INVIS
INVEP
Secure fault address valid. This bit is set when the SFAR register contains a valid value. As with
similar fields, such as BFSR.BFARVALID and MMFSR.MMARVALID, this bit can be cleared by other
exceptions, such as BusFault. The possible values of this bit are:
[6] SFARVALID
0 SFAR content not valid.
1 SFAR content valid.
Lazy state preservation error flag. Stick flag indicating that an SAU or IDAU violation occurred during the
lazy preservation of floating-point state. The possible values of this bit are:
[5] LSPERR
0 Error has not occurred.
1 Error has occurred.
Invalid transition flag. Sticky flag indicating that an exception was raised due to a branch that was not
flagged as being domain crossing causing a transition from Secure to Non-secure memory. The possible
values of this bit are:
[4] INVTRAN
0 Error has not occurred.
1 Error has occurred.
Attribution unit violation flag. Sticky flag indicating that an attempt was made to access parts of the
address space that are marked as Secure with NS-Req for the transaction set to Non-secure. This bit is
not set if the violation occurred during:
• Lazy state preservation, see LSPERR.
[3] AUVIOL • Vector fetches.
The possible values of this bit are:
0 Error has not occurred.
1 Error has occurred.
Invalid exception return flag. This can be caused by EXC_RETURN.DCRS being set to 0 when returning
from an exception in the Non-secure state, or by EXC_RETURN.ES being set to 1 when returning from
an exception in the Non-secure state. The possible values of this bit are:
[2] INVER
0 Error has not occurred.
1 Error has occurred.
Invalid integrity signature flag. This bit is set if the integrity signature in an exception stack frame is found
to be invalid during the unstacking operation. The possible values of this bit are:
[1] INVIS
0 Error has not occurred.
1 Error has occurred.
Invalid entry point. This bit is set if a function call from the Non-secure state or exception targets a
non-SG instruction in the Secure state. This bit is also set if the target address is an SG instruction, but
there is no matching SAU/IDAU region with the NSC flag set. The possible values of this bit are:
[0] INVEP
0 Error has not occurred.
1 Error has occurred.
ADDRESS
When the SFARVALID bit of the SFSR is set to 1, this field holds the address of an access that caused an
[31:0] ADDRESS
SAU violation.
Use the MPU registers to define the MPU regions and their attributes.
The following table shows a summary of the MPU registers.
SEPARATE
31 3 2 1 0
RES0
PRIVDEFENA
HFNMIENA
ENABLE
When enabled, the background region acts as if it has the lowest priority. Any region that is defined
and enabled has priority over this default map. If the MPU is disabled, the processor ignores this bit.
Enables the operation of MPU during HardFault and NMI handlers.
When the MPU is enabled:
MPU is disabled during HardFault and NMI handlers, regardless of the
[1] HFNMIENA 0
value of the ENABLE bit.
1 The MPU is enabled during HardFault and NMI handlers.
When the MPU is disabled, if this bit is set to 1 the behavior is UNPREDICTABLE.
Enables the MPU:
[0] ENABLE 0 MPU is disabled.
1 MPU is enabled.
XN and Device-nGnRnE rules always apply to the System Control Space regardless of the value of the ENABLE
bit.
When the ENABLE bit is set to 1, at least one region of the memory map must be enabled for the system to
function unless the PRIVDEFENA bit is set to 1. If the PRIVDEFENA bit is set to 1 and no regions are enabled,
then only privileged software can operate.
When the ENABLE bit is set to 0, the system uses the default memory map. This has the same behavior as if the
MPU is not implemented.
The default memory map applies to accesses from both privileged and unprivileged software.
When the MPU is enabled, accesses to the System Control Space and vector table are always permitted. Other
areas are accessible based on regions and whether PRIVDEFENA is set to 1.
Unless HFNMIENA is set to 1, the MPU is not enabled when the processor is executing the handler for an
exception with priority –1, –2, or –3. These priorities are only possible when handling a HardFault or NMI
exception. Setting the HFNMIENA bit to 1 enables the MPU when operating with these priorities.
31 8 7 0
RES0 REGION
You must write the required region number to this register before accessing the MPU_RBAR or MPU_RLAR.
BASE
SH
AP[2:1]
XN
Contains bits[31:5] of the lower inclusive limit of the selected MPU memory region. This value is zero
[31:5] BASE
extended to provide the base address to be checked against.
Shareability. Defines the shareability domain of this region for Normal memory.
00 Non-shareable.
01 UNPREDICTABLE.
LIMIT AttrIndx EN
RES0
Limit address. Contains bits[31:5] of the upper inclusive limit of the selected MPU memory region.
[31:5] LIMIT
This value is postfixed with 1F to provide the limit address to be checked against.
[4] - Reserved, res0.
[3:1] AttrIndx Attribute index. Associates a set of attributes in the MPU_MAIR0 and MPU_MAIR1 fields.
Enable. Region enable.
The possible values of this bit are:
[0] EN
0 Region disabled.
1 Region enabled.
31 24 23 16 15 8 7 0
Attr<n>, bits [8n+7:8n], for Memory attribute encoding for MPU regions with an AttrIndex of n.
n= 0 to 3.
31 24 23 16 15 8 7 0
Attr<n>, bits Memory attribute encoding for MPU regions with an AttrIndex of n.
[8(n-4)+7:8(n-4)], for n = 4
to 7
MAIR_ATTR defines the memory attribute encoding used in MPU_MAIR0 and MPU_MAIR1, and the bit
assignments are:
When MAIR_ATTR[7:4] is 0000:
7 4 3 2 1 0
0000 00
Device
Device attributes. Specifies the memory attributes for Device.The possible values of this field are:
00 Device-nGnRnE.
[3:2] Device 01 Device-nGnRE.
10 Device-nGRE.
11 Device-GRE.
7 4 3 0
Outer Inner
Outer attributes. Specifies the Outer memory attributes. The possible values of this field are:
Device memory. In this case, refer to Section 4.5.17 MPU Memory Attribute
0000
Indirection Registers 0 and 1.
R and W specify the outer read and write allocation policy: 0 = do not allocate, 1 = allocate.
[3:0] Inner Inner attributes. Specifies the Inner memory attributes. The possible values of this field are:
R and W specify the outer read and write allocation policy: 0 = do not allocate, 1 = allocate.
To avoid unexpected behavior, disable the interrupts before updating the attributes of a region that the interrupt
handlers might access. When setting up the MPU, and if the MPU has previously been programmed, disable
unused regions to prevent any previous region settings from affecting the new MPU setup.
MAIR_ATTR.Outer
Memory region Shareability Memory type and attributes
MAIR_ATTRInner
In most microcontroller implementations, the cache policy attributes do not affect the system behavior. However,
using these settings for the MPU regions makes the application code more portable. The values given are for
typical situations. In special systems, such as multiprocessor designs or designs with a separate DMA engine,
the shareability attribute might be important. In these cases, refer to the recommendations of the memory device
manufacturer.
Shareability attributes define whether the global monitor is used, or only the local monitor is used.
Required
Address Name Type Reset Description
privilege
0xE000EF34 FPCCR RW Privileged 0xC0000000 Section 4.6.1 Floating-point Context Control Register
0xE000EF38 FPCAR RW Privileged - Section 4.6.2 Floating-point Context Address Register
- FPSCRy RW Unprivileged - Section 4.6.3 Floating-point Status Control Register
Section 4.6.4 Floating-point Default Status Control
0xE000EF3C FPDSCR RW Privileged 0x00000000
Register
31 30 29 28 27 26 25 11 10 9 8 7 6 5 4 3 2 1 0
RES0 S
TS
CLRONRETS
CLRONRET
LSPENS
LSPEN
ASPEN
UFRDY
SPLIMVIOL
MONRDY
SFRDY
BFRDY
MMRDY
HFRDY
THREAD
USER
LSPACT
Writes to this bit from Non-secure state are ignored if LSPENS is set to one.
This bit is not banked between Security states.
Lazy state preservation enable Secure only. This bit controls whether the LSPEN bit is writeable from
the Non-secure state.
The possible values of this bit are:
[29] LSPENS 0 LSPEN is readable and writeable from both Security states.
LSPEN is readable from both Security states. Writes to LSPEN are ignored
1 from the Nonsecure
state.
Clear on return. Clear floating-point caller saved registers on exception return.
The possible values of this bit are:
0 Disabled.
1 Enabled.
[28] CLRONRET
When set to 1 the caller saved floating-point registers S0 to S15, and FPSCR are cleared on
exception return (including tail chaining) if CONTROL.FPCA is set to 1 and FPCCR_S.LSPACT is
set to 0.
This bit is not banked between Security states.
Clear on return Secure only. This bit controls whether the CLRONRET bit is writeable from the
[27] CLRONRETS
Non-secure state.
[26] TS When set to 0 the floating-point registers are treated as Non-secure even when the core is in the
Secure state
and, therefore, the callee saved registers are never pushed to the stack. If the floating-point registers
never
contain data that needs to be protected, clearing this flag can reduce interrupt latency.
This bit is not banked between Security states.
[25-11] - Reserved, res0.
UsageFault ready. Indicates whether the software executing when the processor allocated the
floating-point stack frame was able to set the UsageFault exception to pending.
The possible values of this bit are:
[10] UFRDY 0 Not able to set the UsageFault exception to pending.
1 Able to set the UsageFault exception to pending.
[7] SFRDY If accessed from the Secure state, this bit indicates whether the software executing (when the
processor allocated the floating-point stack frame) was able to set the SecureFault exception to
pending.
This bit is not banked between Security states.
BusFault ready. Indicates whether the software executing when the processor allocated the floating-
point stack frame was able to set the BusFault exception to pending.
The possible values of this bit are:
0 Not able to set the BusFault exception to pending.
[6] BFRDY
1 Able to set the BusFault exception to pending.
This bit is for fault handler information only and does not interact with the exception model.
This bit is banked between Security states.
Security status of the floating point context.
If accessed from the Non-secure state, this bit behaves as RAZ/WI.
This bit is updated whenever lazy state preservation is activated, or when a floating-point instruction is
[2] S executed.
The possible values of this bit are:
0 Indicates that the floating-point context belongs to the Non-secure state.
1 Indicates that the floating-point context belongs to the Secure state.
Indicates the privilege level of the software executing, when the processor allocated the floating point
stack.
The possible values of this bit are:
[1] USER 0 Privileged level.
1 Unprivileged level.
31 3 2 0
ADDRESS
RES0
[31:3] ADDRESS The location of the unpopulated floating-point register space that is allocated on an exception stack frame.
[2:0] - Reserved, res0
N Z C V RES0
[31] N Condition code flags. Floating-point comparison operations update these flags:
[30] Z N Negative condition code flag.
31 27 26 25 24 23 22 21 0
RES0 0 0 0 0 0 RES0
AHP RMode
DN FZ
Revision history
Table 111. Document revision history
Contents
1 About this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1 Typographic conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 List of abbreviations for registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 About the Cortex®-M33 processor and core peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3.1 System-level interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.2 Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.3 Integrated configurable debug. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.4 Cortex®-M33 processor features and benefits summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.5 Cortex®-M33 processor core peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
List of tables
Table 1. Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Table 2. Core register set summary without the Security Extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 3. Core register set summary with the Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 4. Stack pointer register without the Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 5. Stack pointer register with the Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 6. Stack limit registers without the Security Extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Table 7. Stack limit registers with the Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Table 8. MSPLIM and PSPLIM register bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Table 9. xPSR register combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Table 10. APSR bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Table 11. IPSR bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Table 12. EPSR bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Table 13. PRIMASK register bit assignments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 14. FAULTMASK register bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 15. BASEPRI register bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 16. CONTROL register bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Table 17. STM32L5xx and STM32U5xx Cortex® M33 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 18. Memory access behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 19. Memory region shareability and cache policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Table 20. CMSIS functions for exclusive access instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Table 21. Properties of the different exception types with the Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Table 22. Properties of the different exception type without the Security Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 23. Extended priority when the number of interrupt priority levels is 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Table 24. Extended priority when the number of interrupt priority levels is 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Table 25. Exception return behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Table 26. Exception return behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Table 27. Security state transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Table 28. Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Table 29. Fault status and fault address registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Table 30. Cortex‑M33 instruction set summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Table 31. CMSIS functions to generate some Cortex-M33 processor instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Table 32. CMSIS functions to access the special registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Table 33. CMSIS intrinsic functions to access the Non-secure special registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Table 34. Condition code suffixes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Table 35. Data processing instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Table 36. Multiply and divide instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Table 37. Saturating instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Table 38. Packing and unpacking instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
Table 39. Bit field instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115
Table 40. Branch and control instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116
Table 41. Branch ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
Table 42. Floating-point instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Table 43. Miscellaneous instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Table 44. Security state and access permissions in the destination register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Table 45. Memory access instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Table 46. Offset ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Table 47. Offset ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Table 48. Core peripheral register regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Table 49. NVIC registers summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Table 50. CMSIS access NVIC functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Table 51. NVIC_ISERn bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Table 52. NVIC_ICERn bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Table 53. NVIC_ISPRn bit assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
List of figures
Figure 1. STM32 Cortex®-M33 processor implementation without the security extension . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 2. STM32 Cortex®-M33 processor implementation with the security extension . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 3. Core registers without the Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 4. Core registers with the Security Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 5. Cortex‑M33 processor memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 6. Little-endian example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 7. Vector table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Figure 8. Vector table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 9. Stack frame when an interrupt or an exception is preserved on the stack with or without floating-point state . . 34
Figure 10. Stack frame extended to save additional context when the Security Extension is implemented . . . . . . . . . . . . 34
Figure 11. Extended exception stack frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Figure 12. Security state transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Figure 13. ASR #3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Figure 14. LSR #3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Figure 15. LSL #3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Figure 16. ROR #3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Figure 17. RRX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60