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.

Pseudocode Definition<br />

I.1 Instruction encoding diagrams <strong>and</strong> pseudocode<br />

Instruction descriptions in this manual contain:<br />

An Encoding section, containing one or more encoding diagrams, each followed by some<br />

encoding-specific pseudocode that translates the fields of the encoding into inputs for the common<br />

pseudocode of the instruction, <strong>and</strong> picks out any encoding-specific special cases.<br />

An Operation section, containing common pseudocode that applies to all of the encodings being<br />

described. The Operation section pseudocode contains a call to the EncodingSpecificOperations()<br />

function, either at its start or after only a condition check performed by if ConditionPassed() then.<br />

An encoding diagram specifies each bit of the instruction as one of the following:<br />

An obligatory 0 or 1, represented in the diagram as 0 or 1. If this bit does not have this value, the<br />

encoding corresponds to a different instruction.<br />

A should be 0 or 1, represented in the diagram as (0) or (1). If this bit does not have this value, the<br />

instruction is UNPREDICTABLE.<br />

A named single bit or a bit in a named multi-bit field. The cond field in bits [31:28] of many <strong>ARM</strong><br />

instructions has some special rules associated with it.<br />

An encoding diagram matches an instruction if all obligatory bits are identical in the encoding diagram <strong>and</strong><br />

the instruction, <strong>and</strong> one of the following is true:<br />

the encoding diagram is not for an <strong>ARM</strong> instruction<br />

the encoding diagram is for an <strong>ARM</strong> instruction that does not have a cond field in bits [31:28]<br />

the encoding diagram is for an <strong>ARM</strong> instruction that has a cond field in bits [31:28], <strong>and</strong> bits [31:28]<br />

of the instruction are not 0b1111.<br />

The execution model for an instruction is:<br />

1. Find all encoding diagrams that match the instruction. It is possible that no encoding diagrams match.<br />

In that case, ab<strong>and</strong>on this execution model <strong>and</strong> consult the relevant instruction set chapter instead to<br />

find out how the instruction is to be treated. The bit pattern of such an instruction is usually reserved<br />

<strong>and</strong> UNDEFINED, though there are some other possibilities. For example, unallocated hint instructions<br />

are documented as being reserved <strong>and</strong> to be executed as NOPs.<br />

2. If the operation pseudocode for the matching encoding diagrams starts with a condition check,<br />

perform that condition check. If the condition check fails, ab<strong>and</strong>on this execution model <strong>and</strong> treat the<br />

instruction as a NOP. If there are multiple matching encoding diagrams, either all or none of their<br />

corresponding pieces of common pseudocode start with a condition check.<br />

3. Perform the encoding-specific pseudocode for each of the matching encoding diagrams<br />

independently <strong>and</strong> in parallel. Each such piece of encoding-specific pseudocode starts with a bitstring<br />

variable for each named bit or multi-bit field in its corresponding encoding diagram, named the same<br />

as the bit or multi-bit field <strong>and</strong> initialized with the values of the corresponding bit(s) from the bit<br />

pattern of the instruction.<br />

AppxI-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!