Data Processing Instructions (1)
Data Processing Instructions (1)
Instruction Set
Data processing
instructions
Data transfer
instructions
Block transfer
instructions
Branching instructions
Multiply instructions
Data processing instruction:
• These instruction manipulate data within the registers.
• The instructions are-move instruction, logical instructions,
comparison instruction and multiply instruction.
• Move and logical instruction update carry flag C, negative flag and
zero flag.
Move instruction:
• It copies N or immediate value to the destination register Rd.
• The instruction is used for setting initial values and transferring data between the registers.
• Syntax:<instruction>{<cond>}{s} Rd, N
• Example:
PRE r5=5
r7=8
MOV r7,r5 ; let r7 = r5
POST r5=5
r7=5
Barrel shifter:
• A unique and powerful feature of the ARM processor is the ability to shift the 32-bit binary
pattern in one of the source registers left or right by a specific number of positions before
it enters the ALU.
• Pre-processing or shift occurs within the cycle time of the instruction. This is particularly useful
for loading constants into a register and achieving fast multiplier or division by a power of 2.
Barrel shifter operation:
• The logical shift(LSL) to register Rm before moving it to the destination register. The MOV
instruction copies the shift operator result into register Rd. N represents the result of the LSL
operation.
PRE r5=5
r7=8
MOV r7,r5,LSL #2 ; let r7=r5*4=(r5<<2)
POST r5=5
r7=20
Logical shift by 1:
Barrel shifter operation:
x represents the register being shifted and y represents the shift amount.
Barrel shifter example:
PRE cpsr=nzcvqiFt_USER
r0=0x00000000
r1=0x80000004
MOVS r0, r1, LSL #1
POST cpsr=nzCvqiFt_USER
r0=0x00000008
r1=0x80000004
Arithmetic instruction:
• The arithmetic instruction implement addition and subtraction of 32 bit signed and
unsigned values.
• Syntax: <instruction>{<contd>}{S} Rd, Rn, N
ADC Add two 32-bit values and carry Rd=Rn+ N+ carry
ADD Add two 32-bit values Rd=Rn+ N
RSB Reserve subtract of two 32-bit values Rd=N-Rn
RSC Reserve subtract with carry of two 32-bit value Rd=N-Rn-!(carry flag)
PRE cpsr=nzcvqiFt_USER
R1=0x00000001
POST nZCvqiFt_USER
r1=0x00000000
Logical instructions:
• Performs bitwise logical operations on the two source registers
• Syntax: <instruction>{<cond>}{S} Rd, Rn,N