1 data processing instructions arm data processing

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: her to produce a single result which is the sum. Here are some rules which apply to ARM data processing instructions: All operands are 32 bits wide and come from registers or are specified as literals in the instruction itself. The result, if there is one, is 32 bits wide and is placed in a register. (There is an exception here: long multiply instructions produce a 64-bit result; they are discussed in Section 5.8 on page 122.) Each of the operand registers and the result register are independently specified in the instruction. That is, the ARM uses a '3-address' format for these instructions. Simple register operands A typical ARM data processing instruction is written in assembly language as shown below: r0, r1 + r2 r1, r2 ADD r2 r0, r1, ; r0 : = The semicolon in this line indicates that everything to the right of it is a comment and should be ignored by the assembler. Comments are put into the assembly source code to make reading and understanding it easier. This example simply takes the values in two registers (r1 and r2), adds them together, and places the result in a third register (r0). The values in the source registers are 32 bits wide and may be considered to be either unsigned integers or signed 2's-complement integers. The addition may produce a carry-out or, in the case of signed 2's-complement values, an internal overflow into the sign bit, but in either case this is ignored. Note that in writing the assembly language source code, care must be taken to write the operands in the correct order, which is result register first, then the first operand and lastly the second operand (though for commutative operations the order of the first and second operands is not significant when they are both registers). When this instruction is executed the only change to the system state is the value of the destination register r0 (and, optionally, the N, Z, C and V flags in the CPSR, as we shall see later). Data processing instructions 51 The different instructions available in this form are listed below in their classes: Arithmetic operations. These instructions perform binary arithmetic (addition, subtraction and reverse subtraction, which is subtraction with the operand order reversed) on two 32-bit operands. The operands may be unsign...
View Full Document

This document was uploaded on 10/30/2011 for the course CSE 378 380 at SUNY Buffalo.

Ask a homework question - tutors are online