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

Create successful ePaper yourself

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

The Instruction Sets<br />

A4.1 About the instruction sets<br />

<strong>ARM</strong>v7 contains two main instruction sets, the <strong>ARM</strong> <strong>and</strong> Thumb instruction sets. Much of the functionality<br />

available is identical in the two instruction sets. This chapter describes the functionality available in the<br />

instruction sets, <strong>and</strong> the Unified Assembler Language (UAL) that can be assembled to either instruction set.<br />

The two instruction sets differ in how instructions are encoded:<br />

Thumb instructions are either 16-bit or 32-bit, <strong>and</strong> are aligned on a two-byte boundary. 16-bit <strong>and</strong><br />

32-bit instructions can be intermixed freely. Many common operations are most efficiently executed<br />

using 16-bit instructions. However:<br />

— Most 16-bit instructions can only access eight of the general-purpose registers, R0-R7. These<br />

are known as the low registers. A small number of 16-bit instructions can access the high<br />

registers, R8-R15.<br />

— Many operations that would require two or more 16-bit instructions can be more efficiently<br />

executed with a single 32-bit instruction.<br />

<strong>ARM</strong> instructions are always 32-bit, <strong>and</strong> are aligned on a four-byte boundary.<br />

The <strong>ARM</strong> <strong>and</strong> Thumb instruction sets can interwork freely, that is, different procedures can be compiled or<br />

assembled to different instruction sets, <strong>and</strong> still be able to call each other efficiently.<br />

ThumbEE is a variant of the Thumb instruction set that is designed as a target for dynamically generated<br />

code. However, it cannot interwork freely with the <strong>ARM</strong> <strong>and</strong> Thumb instruction sets.<br />

See:<br />

Chapter A5 <strong>ARM</strong> Instruction Set Encoding for encoding details of the <strong>ARM</strong> instruction set<br />

Chapter A6 Thumb Instruction Set Encoding for encoding details of the Thumb instruction set<br />

Chapter A8 Instruction Details for detailed descriptions of the instructions<br />

Chapter A9 ThumbEE for encoding details of the ThumbEE instruction set.<br />

A4.1.1 Changing between Thumb state <strong>and</strong> <strong>ARM</strong> state<br />

A processor in Thumb state (that is, executing Thumb instructions) can enter <strong>ARM</strong> state (<strong>and</strong> change to<br />

executing <strong>ARM</strong> instructions) by executing any of the following instructions: BX, BLX, or an LDR or LDM that<br />

loads the PC.<br />

A processor in <strong>ARM</strong> state (that is, executing <strong>ARM</strong> instructions) can enter Thumb state (<strong>and</strong> change to<br />

executing Thumb instructions) by executing any of the same instructions.<br />

In <strong>ARM</strong>v7, a processor in <strong>ARM</strong> state can also enter Thumb state (<strong>and</strong> change to executing Thumb<br />

instructions) by executing an ADC, ADD, AND, ASR, BIC, EOR, LSL, LSR, MOV, MVN, ORR, ROR, RRX, RSB, RSC, SBC, or SUB<br />

instruction that has the PC as destination register <strong>and</strong> does not set the condition flags.<br />

A4-2 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!