ARM.SoC.Architecture

# The comparison operations only set the condition

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ension gives the programmer control over whether or not an instruction modifies the condition codes, the codes can be preserved over long instruction sequences when it is appropriate to do so. An arithmetic operation (which here includes CMP and CMN) sets all the flags according to the arithmetic result. A logical or move operation does not produce a meaningful value for C or V, so these operations set N and Z according to the result but preserve V, and either preserve C when there is no shift operation, or set C to the value of the last bit to fall off the end of the shift. This detail is not often significant. Data transfer instructions 55 Use Of the We have already seen the C flag used as an input to an arithmetic data processing Condition codes instruction. However we have not yet seen the most important use of the condition codes, which is to control the program flow through the conditional branch instructions. These will be described in Section 3.3 on page 63. Multiplies A special form of the data processing instruction supports multiplication: MUL r4, r3, r2 ; r4 := (r3 x r2)[31:0] There are some important differences from the other arithmetic instructions: Immediate second operands are not supported. The result register must not be the same as the first source register. If the ' s' bit is set the V flag is preserved (as for a logical instruction) and the C flag is rendered meaningless. Multiplying two 32-bit integers gives a 64-bit result, the least significant 32 bits of which are placed in the result register and the rest are ignored. This can be viewed as multiplication in modulo 232 arithmetic and gives the correct result whether the operands are viewed as signed or unsigned integers. (ARMs also support long multiply instructions which place the most significant 32 bits into a second result register; these are described in Section 5.8 on page 122.) An alternative form, subject to the same restrictions, adds the product to a running total. This is the multiply-accumulate instruction: MLA r4, r3, r2, r1 ; r4 := (r3 x r2 + r1)[31:0] Multiplication by a constant can be implemented by loadin...
View Full Document

Ask a homework question - tutors are online