09.12.2012 Views

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.14 The program status registers<br />

2.14.1 The condition code flags<br />

2.14.2 The Q flag<br />

Programmers Model<br />

The processor contains one CPSR, and six SPSRs for exception handlers to use. The program<br />

status registers:<br />

• hold information about the most recently performed logical or arithmetic operation<br />

• control the enabling and disabling of interrupts<br />

• set the processor operating mode.<br />

Figure 2-12 shows the bit arrangements of the program status registers.<br />

31 30 29 28 27 26 25 24 23 20 19 16 15 10 9 8 7 6 5 4 0<br />

N Z C V Q J<br />

DNM<br />

GE[3:0]<br />

Figure 2-12 Program status register<br />

Note<br />

The bits identified in Figure 2-12 as Do Not Modify (DNM) must not be modified by software.<br />

These bits are:<br />

• Readable, to enable the processor state to be preserved, for example, during process<br />

context switches.<br />

• Writable, to enable the processor state to be restored. To maintain compatibility with<br />

future <strong>ARM</strong> processors, and as good practice, you are strongly advised to use a<br />

read-modify-write strategy when you change the CPSR.<br />

The N, Z, C, and V bits are the condition code flags. You can set them by arithmetic and logical<br />

operations, and also by MSR and LDM instructions. The processor tests these flags to determine<br />

whether to execute an instruction.<br />

In <strong>ARM</strong> state, you can execute most instructions conditionally on the state of the N, Z, C, and<br />

V bits. In Thumb state, you can execute fewer instructions conditionally. However, you can<br />

make most instructions conditional with the IT instruction.<br />

See the <strong>ARM</strong> Architecture <strong>Reference</strong> <strong>Manual</strong> for more information about conditional<br />

executions.<br />

You can set the Sticky Overflow, Q flag, to 1 by executing certain multiply and fractional<br />

arithmetic instructions:<br />

• QADD<br />

• QDADD<br />

<strong>ARM</strong> DDI 0344K Copyright © 2006-2010 <strong>ARM</strong> Limited. All rights reserved. 2-21<br />

ID060510 Non-Confidential<br />

IT[7:2]<br />

Greater than<br />

or equal to<br />

Java state bit<br />

IT[1:0]<br />

Sticky overflow<br />

Overflow<br />

Carry/Borrow/Extend<br />

Zero<br />

Negative/Less than<br />

E<br />

A<br />

I<br />

F<br />

T<br />

M[4:0]<br />

Mode bits<br />

Thumb state bit<br />

FIQ disable<br />

IRQ disable<br />

Imprecise abort<br />

disable bit<br />

Data endianness bit

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

Saved successfully!

Ooh no, something went wrong!