05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Application Level Programmers’ Model<br />

A2.4 The Application Program Status Register (APSR)<br />

Program status is reported in the 32-bit Application Program Status Register (APSR). The format of the<br />

APSR is:<br />

31 30 29 28 27 26 24 23 20 19 16 15 0<br />

N Z C V Q RAZ/<br />

SBZP<br />

Reserved GE[3:0] Reserved<br />

In the APSR, the bits are in the following categories:<br />

Reserved bits are allocated to system features, or are available for future expansion. Unprivileged<br />

execution ignores writes to privileged fields. However, application level software that writes to the<br />

APSR must treat reserved bits as Do-Not-Modify (DNM) bits. For more information about the<br />

reserved bits, see Format of the CPSR <strong>and</strong> SPSRs on page B1-16.<br />

Flags that can be set by many instructions:<br />

N, bit [31] Negative condition code flag. Set to bit [31] of the result of the instruction. If the result<br />

is regarded as a two's complement signed integer, then N == 1 if the result is negative <strong>and</strong><br />

N == 0 if it is positive or zero.<br />

Z, bit [30] Zero condition code flag. Set to 1 if the result of the instruction is zero, <strong>and</strong> to 0 otherwise.<br />

A result of zero often indicates an equal result from a comparison.<br />

C, bit [29] Carry condition code flag. Set to 1 if the instruction results in a carry condition, for<br />

example an unsigned overflow on an addition.<br />

V, bit [28] Overflow condition code flag. Set to 1 if the instruction results in an overflow condition,<br />

for example a signed overflow on an addition.<br />

Q, bit [27] Set to 1 to indicate overflow or saturation occurred in some instructions, normally related<br />

to Digital Signal Processing (DSP). For more information, see Pseudocode details of<br />

saturation on page A2-9.<br />

GE[3:0], bits [19:16]<br />

Greater than or Equal flags. SIMD instructions update these flags to indicate the results<br />

from individual bytes or halfwords of the operation. These flags can control a later SEL<br />

instruction. For more information, see SEL on page A8-312.<br />

Bits [26:24] are RAZ/SBZP. Therefore, software can use MSR instructions that write the top byte of<br />

the APSR without using a read, modify, write sequence. If it does this, it must write zeros to<br />

bits [26:24].<br />

Instructions can test the N, Z, C, <strong>and</strong> V condition code flags to determine whether the instruction is to be<br />

executed. In this way, execution of the instruction can be made conditional on the result of a previous<br />

operation. For more information about conditional execution see Conditional execution on page A4-3 <strong>and</strong><br />

Conditional execution on page A8-8.<br />

In <strong>ARM</strong>v7-A <strong>and</strong> <strong>ARM</strong>v7-R, the APSR is the same register as the CPSR, but the APSR must be used only<br />

to access the N, Z, C, V, Q, <strong>and</strong> GE[3:0] bits. For more information, see Program Status Registers (PSRs)<br />

on page B1-14.<br />

A2-14 Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DDI 0406B

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!