

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Slides on: ARM versions. ARM assembly language. ARM programming model. ARM memory organization. ARM data operations. ARM flow of control
Typology: Study notes
1 / 33
This page cannot be seen from the preview
Don't miss anything!


























(^) ARM versions. (^) ARM assembly language. (^) ARM programming model. (^) ARM memory organization. (^) ARM data operations. (^) ARM flow of control.
(^) ARM architecture has been extended over several versions. (^) We will concentrate on ARM7.
r r r r r r r r r r r r r r r r15 (PC) CPSR 31 0 N Z C V
(^) Relationship between bit and byte/word ordering defines endianness: byte 3 byte 2 byte 1 byte 0 byte 0 byte 1 byte 2 byte 3 bit 31 (^) bit 0 bit 0 bit 31 little-endian big-endian
(^) Every arithmetic, logical, or shifting operation sets CPSR bits: (^) N (negative), Z (zero), C (carry), V (overflow). (^) Examples: (^) -1 + 1 = 0: NZCV = 0110. (^231) -1+1 = -2^31 : NZCV = 1001.
(^) Basic format: ADD r0,r1,r (^) Computes r1+r2, stores in r0. (^) Immediate operand: ADD r0,r1,# (^) Computes r1+2, stores in r0.
(^) Logical shift: (^) fills with zeroes. (^) Arithmetic shift: (^) fills with ones. (^) RRX performs 33-bit rotate, including C bit from CPSR above sign bit.
(^) CMP : compare (^) CMN : negated compare (^) TST : bit-wise AND (^) TEQ : bit-wise XOR (^) These instructions set only the NZCV bits of CPSR.
(^) LDR, LDRH, LDRB : load (half-word, byte) (^) STR, STRH, STRB : store (half-word, byte) (^) Addressing modes: (^) register indirect : LDR r0,[r1] (^) with second register : LDR r0,[r1,-r2] (^) with constant : LDR r0,[r1,#4]
(^) Cannot refer to an address directly in an instruction. (^) Generate value by performing arithmetic on PC. (^) ADR pseudo-op generates instruction required to calculate address: ADR r1,FOO
SUB r3,r3,r2 ; complete computation of x ADR r4,x ; get address for x STR r3,[r4] ; store value of x
y = a*(b+c); (^) Assembler: ADR r4,b ; get address for b LDR r0,[r4] ; get value of b ADR r4,c ; get address for c LDR r1,[r4] ; get value of c ADD r2,r0,r1 ; compute partial result ADR r4,a ; get address for a LDR r0,[r4] ; get value of a
z = (a << 2) | (b & 15); (^) Assembler: ADR r4,a ; get address for a LDR r0,[r4] ; get value of a MOV r0,r0,LSL 2 ; perform shift ADR r4,b ; get address for b LDR r1,[r4] ; get value of b AND r1,r1,#15 ; perform AND ORR r1,r0,r1 ; perform OR
ADR r4,z ; get address for z STR r1,[r4] ; store value for z