{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

W06_12a_ARM_Progr3 - 12a ARM Programming 3 CSC 230...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
12a ARM Programming 3 CSC 230 Department of Computer Science University of Victoria 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
SHIFT OPERATIONS (conceptually) Shift Left by n bits: logical or arithmetic shift - LSL C 0 Multiplication by 2 n A i h i Shif Ri h b bi ASR Arithmetic Shift Right by n bits - ASR C Signed division by 2 n Logical Shift Right by n bits - LSR Unsigned division by 2 n 2 C 0
Background image of page 2
ROTATE INSTRUCTIONS: (conceptually) Rotate Right by n bits - ROR 32 bit rotate C Rotate Right extended by one bit - RRX 33 bit rotate, 33 rd bit is carry C 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Shift and Rotate in ARM? No explicit instructions Shifts and rotate are incorporated into addressing modes Examples: @shift content of R2 left by 4 bits MOV R2 R2 LSL #4 @ that is, R2 = R2 * 16 R2,R2,LSL #4 ADD R2,R2,R1,LSL #4 @R2 = R2 + R1 * 16 @R2 = R1 / 4 MOV R2,R1,ASR #2 4 LDR R2,[ R1,R3,LSL #2] @load from address @calculated as R1 + R3 * 4
Background image of page 4
How are SHIFTS implemented in hardware for ARM? Rn Rm g g Barrel shifter ocessing ocessing o pre-pr Pre-pro esult N ARITHMETIC No Re LOGIC UNIT Rd
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Small Example: an ARM program for adding numbers HVZ p. 119, fig. 3.8 @ ========== Data ========== .data @ Begin the "data" segment, for variables .align @ Next item begins at a word (aligned) @ address sum: .word 0 1 word initialized to 0 1 d n: .word 5 1 word initialized to 5 5 words num1: .word 3,-17,27,-12,322 uninit: .skip 4 end initialized as shown (array) .end
Background image of page 6