SlideShare a Scribd company logo
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM instruction set
ARM versions.
ARM assembly language.
ARM programming model.
ARM memory organization.
ARM data operations.
ARM flow of control.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM versions
ARM architecture has been extended over
several versions.
We will concentrate on ARM7.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM assembly language
Fairly standard assembly language:
LDR r0,[r8] ; a comment
label ADD r4,r0,r1
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM programming model
r0
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15 (PC)
CPSR
31 0
N Z C V
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Endianness
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
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM data types
Word is 32 bits long.
Word can be divided into four 8-bit bytes.
ARM addresses cam be 32 bits long.
Address refers to byte.
Address 4 starts at byte 4.
Can be configured at power-up as either
little- or bit-endian mode.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM status bits
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 = -231
: NZCV = 0101.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM data instructions
Basic format:
ADD r0,r1,r2
Computes r1+r2, stores in r0.
Immediate operand:
ADD r0,r1,#2
Computes r1+2, stores in r0.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM data instructions
ADD, ADC : add (w.
carry)
SUB, SBC : subtract
(w. carry)
RSB, RSC : reverse
subtract (w. carry)
MUL, MLA : multiply
(and accumulate)
AND, ORR, EOR
BIC : bit clear
LSL, LSR : logical
shift left/right
ASL, ASR : arithmetic
shift left/right
ROR : rotate right
RRX : rotate right
extended with C
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Data operation varieties
Logical shift:
fills with zeroes.
Arithmetic shift:
fills with ones.
RRX performs 33-bit rotate, including C bit
from CPSR above sign bit.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM comparison
instructions
CMP : compare
CMN : negated compare
TST : bit-wise test
TEQ : bit-wise negated test
These instructions set only the NZCV bits
of CPSR.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM move instructions
MOV, MVN : move (negated)
MOV r0, r1 ; sets r0 to r1
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM load/store
instructions
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]
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM ADR pseudo-op
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
v
Overheads for Computers as
Components 2nd
ed.
Example: C assignments
C:
x = (a + b) - c;
Assembler:
ADR r4,a ; get address for a
LDR r0,[r4] ; get value of a
ADR r4,b ; get address for b, reusing r4
LDR r1,[r4] ; get value of b
ADD r3,r0,r1 ; compute a+b
ADR r4,c ; get address for c
LDR r2[r4] ; get value of c
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
C assignment, cont’d.
SUB r3,r3,r2 ; complete computation of x
ADR r4,x ; get address for x
STR r3[r4] ; store value of x
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Example: C assignment
C:
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
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
C assignment, cont’d.
MUL r2,r2,r0 ; compute final value for y
ADR r4,y ; get address for y
STR r2,[r4] ; store y
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Example: C assignment
C:
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
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
C assignment, cont’d.
ADR r4,z ; get address for z
STR r1,[r4] ; store value for z
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Additional addressing
modes
Base-plus-offset addressing:
LDR r0,[r1,#16]
Loads from location r1+16
Auto-indexing increments base register:
LDR r0,[r1,#16]!
Post-indexing fetches, then does offset:
LDR r0,[r1],#16
Loads r0 from r1, then adds 16 to r1.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM flow of control
All operations can be performed
conditionally, testing CPSR:
EQ, NE, CS, CC, MI, PL, VS, VC, HI, LS, GE,
LT, GT, LE
Branch operation:
B #100
Can be performed conditionally.
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Example: if statement
C:
if (a > b) { x = 5; y = c + d; } else x = c - d;
Assembler:
; compute and test condition
ADR r4,a ; get address for a
LDR r0,[r4] ; get value of a
ADR r4,b ; get address for b
LDR r1,[r4] ; get value for b
CMP r0,r1 ; compare a < b
BGE fblock ; if a >= b, branch to false block
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
If statement, cont’d.
; true block
MOV r0,#5 ; generate value for x
ADR r4,x ; get address for x
STR r0,[r4] ; store x
ADR r4,c ; get address for c
LDR r0,[r4] ; get value of c
ADR r4,d ; get address for d
LDR r1,[r4] ; get value of d
ADD r0,r0,r1 ; compute y
ADR r4,y ; get address for y
STR r0,[r4] ; store y
B after ; branch around false block
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
If statement, cont’d.
; false block
fblock ADR r4,c ; get address for c
LDR r0,[r4] ; get value of c
ADR r4,d ; get address for d
LDR r1,[r4] ; get value for d
SUB r0,r0,r1 ; compute a-b
ADR r4,x ; get address for x
STR r0,[r4] ; store value of x
after ...
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Example: Conditional
instruction implementation
; true block
MOVLT r0,#5 ; generate value for x
ADRLT r4,x ; get address for x
STRLT r0,[r4] ; store x
ADRLT r4,c ; get address for c
LDRLT r0,[r4] ; get value of c
ADRLT r4,d ; get address for d
LDRLT r1,[r4] ; get value of d
ADDLT r0,r0,r1 ; compute y
ADRLT r4,y ; get address for y
STRLT r0,[r4] ; store y
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Example: switch
statement
C:
switch (test) { case 0: … break; case 1: … }
Assembler:
ADR r2,test ; get address for test
LDR r0,[r2] ; load value for test
ADR r1,switchtab ; load address for switch table
LDR r1,[r1,r0,LSL #2] ; index switch table
switchtab DCD case0
DCD case1
...
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Example: FIR filter
C:
for (i=0, f=0; i<N; i++)
f = f + c[i]*x[i];
Assembler
; loop initiation code
MOV r0,#0 ; use r0 for I
MOV r8,#0 ; use separate index for arrays
ADR r2,N ; get address for N
LDR r1,[r2] ; get value of N
MOV r2,#0 ; use r2 for f
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
FIR filter, cont’.d
ADR r3,c ; load r3 with base of c
ADR r5,x ; load r5 with base of x
; loop body
loop LDR r4,[r3,r8] ; get c[i]
LDR r6,[r5,r8] ; get x[i]
MUL r4,r4,r6 ; compute c[i]*x[i]
ADD r2,r2,r4 ; add into running sum
ADD r8,r8,#4 ; add one word offset to array index
ADD r0,r0,#1 ; add 1 to i
CMP r0,r1 ; exit?
BLT loop ; if i < N, continue
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
ARM subroutine linkage
Branch and link instruction:
BL foo
Copies current PC to r14.
To return from subroutine:
MOV r15,r14
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Nested subroutine calls
Nesting/recursion requires coding
convention:
f1 LDR r0,[r13] ; load arg into r0 from stack
; call f2()
STR r13!,[r14] ; store f1’s return adrs
STR r13!,[r0] ; store arg to f2 on stack
BL f2 ; branch and link to f2
; return from f1()
SUB r13,#4 ; pop f2’s arg off stack
LDR r13!,r15 ; restore register and return
© 2008 Wayne Wolf
Overheads for Computers as
Components 2nd
ed.
Summary
Load/store architecture
Most instructions are RISCy, operate in
single cycle.
Some multi-register operations take longer.
All instructions can be executed
conditionally.

More Related Content

What's hot

Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructions
Ravi Anand
 
Efficient JIT to 32-bit Arches
Efficient JIT to 32-bit ArchesEfficient JIT to 32-bit Arches
Efficient JIT to 32-bit Arches
Netronome
 
ARM instruction set
ARM instruction  setARM instruction  set
ARM instruction set
Karthik Vivek
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
techbed
 
8086 instruction set
8086  instruction set8086  instruction set
8086 instruction set
mengistu ketema
 
Unit vi
Unit viUnit vi
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction set
Shail Modi
 
ARM inst set part 2
ARM inst set part 2ARM inst set part 2
ARM inst set part 2
Karthik Vivek
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly languagehemant meena
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
karthiga selvaraju
 
8086 arch instns
8086 arch instns8086 arch instns
8086 arch instnsRam Babu
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
Alamin Hossain Miraje
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Vijay Kumar
 
Instruction Set 8085
Instruction Set 8085Instruction Set 8085
Instruction Set 8085
Stupidsid.com
 
8051 experiments1
8051 experiments18051 experiments1
8051 experiments1
tt_aljobory
 
Chp2 introduction to the 68000 microprocessor copy
Chp2 introduction to the 68000 microprocessor   copyChp2 introduction to the 68000 microprocessor   copy
Chp2 introduction to the 68000 microprocessor copymkazree
 
Winter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate TrainingWinter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate Training
Technogroovy
 
B instruction set
B instruction setB instruction set
B instruction set
AKINYEMI AWOYELE
 

What's hot (20)

Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructions
 
Efficient JIT to 32-bit Arches
Efficient JIT to 32-bit ArchesEfficient JIT to 32-bit Arches
Efficient JIT to 32-bit Arches
 
ARM instruction set
ARM instruction  setARM instruction  set
ARM instruction set
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
 
8086 instruction set
8086  instruction set8086  instruction set
8086 instruction set
 
Unit vi
Unit viUnit vi
Unit vi
 
mup
mupmup
mup
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction set
 
ARM inst set part 2
ARM inst set part 2ARM inst set part 2
ARM inst set part 2
 
Avr instruction set
Avr instruction setAvr instruction set
Avr instruction set
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly language
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
8086 arch instns
8086 arch instns8086 arch instns
8086 arch instns
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Instruction Set 8085
Instruction Set 8085Instruction Set 8085
Instruction Set 8085
 
8051 experiments1
8051 experiments18051 experiments1
8051 experiments1
 
Chp2 introduction to the 68000 microprocessor copy
Chp2 introduction to the 68000 microprocessor   copyChp2 introduction to the 68000 microprocessor   copy
Chp2 introduction to the 68000 microprocessor copy
 
Winter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate TrainingWinter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate Training
 
B instruction set
B instruction setB instruction set
B instruction set
 

Viewers also liked

분당건마 선릉건마 《안산오피》 부천건마
분당건마 선릉건마 《안산오피》 부천건마분당건마 선릉건마 《안산오피》 부천건마
분당건마 선릉건마 《안산오피》 부천건마
sfalzgyc5
 
Visualizing Search Analysis By Ryan Jones
Visualizing Search Analysis By Ryan JonesVisualizing Search Analysis By Ryan Jones
Visualizing Search Analysis By Ryan Jones
Search Marketing Expo - SMX
 
"Arquitectura la-informática"
"Arquitectura la-informática""Arquitectura la-informática"
"Arquitectura la-informática"
erika_rapunzel
 
Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...
Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...
Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...
Search Marketing Expo - SMX
 
분당건마 안양건마 《논현오피》 부평건마
분당건마 안양건마 《논현오피》 부평건마분당건마 안양건마 《논현오피》 부평건마
분당건마 안양건마 《논현오피》 부평건마
sfalzgyc5
 
, تجویز منطقی دارواصول نسخه نویسی ppt
  ,  تجویز منطقی دارواصول نسخه نویسی  ppt  ,  تجویز منطقی دارواصول نسخه نویسی  ppt
, تجویز منطقی دارواصول نسخه نویسی ppt
darmatop
 
Technical Development Portfolio
Technical Development PortfolioTechnical Development Portfolio
Technical Development PortfolioNahdin Sabla
 
Miniferia científica
Miniferia científicaMiniferia científica
Miniferia científica
CEOPUERTO
 
Primary Science Teaching Awards
Primary Science Teaching AwardsPrimary Science Teaching Awards
Primary Science Teaching Awards
azstt
 
Logistics management
Logistics managementLogistics management
Logistics management
Navin Raj Saroj
 

Viewers also liked (10)

분당건마 선릉건마 《안산오피》 부천건마
분당건마 선릉건마 《안산오피》 부천건마분당건마 선릉건마 《안산오피》 부천건마
분당건마 선릉건마 《안산오피》 부천건마
 
Visualizing Search Analysis By Ryan Jones
Visualizing Search Analysis By Ryan JonesVisualizing Search Analysis By Ryan Jones
Visualizing Search Analysis By Ryan Jones
 
"Arquitectura la-informática"
"Arquitectura la-informática""Arquitectura la-informática"
"Arquitectura la-informática"
 
Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...
Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...
Step Away From The Tools: How to Get a Picture View of Your Competition By Pu...
 
분당건마 안양건마 《논현오피》 부평건마
분당건마 안양건마 《논현오피》 부평건마분당건마 안양건마 《논현오피》 부평건마
분당건마 안양건마 《논현오피》 부평건마
 
, تجویز منطقی دارواصول نسخه نویسی ppt
  ,  تجویز منطقی دارواصول نسخه نویسی  ppt  ,  تجویز منطقی دارواصول نسخه نویسی  ppt
, تجویز منطقی دارواصول نسخه نویسی ppt
 
Technical Development Portfolio
Technical Development PortfolioTechnical Development Portfolio
Technical Development Portfolio
 
Miniferia científica
Miniferia científicaMiniferia científica
Miniferia científica
 
Primary Science Teaching Awards
Primary Science Teaching AwardsPrimary Science Teaching Awards
Primary Science Teaching Awards
 
Logistics management
Logistics managementLogistics management
Logistics management
 

Similar to Ch2 arm-1

ch2-arm-1.ppt
ch2-arm-1.pptch2-arm-1.ppt
ch2-arm-1.ppt
jerart julus
 
Arm instruction set
Arm instruction setArm instruction set
Arm instruction set
Ravi Babu
 
swrp141.pdf
swrp141.pdfswrp141.pdf
swrp141.pdf
Watchsoft
 
Controlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault InjectionControlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault Injection
Riscure
 
Module 2 PPT of ES.pptx
Module 2 PPT of ES.pptxModule 2 PPT of ES.pptx
Module 2 PPT of ES.pptx
shruthi810379
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching materialJohn Williams
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
Manju Badiger
 
ARM AAE - Intrustion Sets
ARM AAE - Intrustion SetsARM AAE - Intrustion Sets
ARM AAE - Intrustion Sets
Anh Dung NGUYEN
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
Fatma Sayed Ibrahim
 
ARM Architecture Instruction Set
ARM Architecture Instruction SetARM Architecture Instruction Set
ARM Architecture Instruction Set
Dwight Sabio
 
ARM Introduction
ARM IntroductionARM Introduction
ARM Introduction
Ramasubbu .P
 
The ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM ArchitectureThe ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM Architecture
sreea4
 
arm-intro.ppt
arm-intro.pptarm-intro.ppt
arm-intro.ppt
MostafaParvin1
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
SaravananVijayakumar4
 

Similar to Ch2 arm-1 (20)

ch2-arm-1.ppt
ch2-arm-1.pptch2-arm-1.ppt
ch2-arm-1.ppt
 
Arm instruction set
Arm instruction setArm instruction set
Arm instruction set
 
S emb t4-arch_cpu
S emb t4-arch_cpuS emb t4-arch_cpu
S emb t4-arch_cpu
 
swrp141.pdf
swrp141.pdfswrp141.pdf
swrp141.pdf
 
Controlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault InjectionControlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault Injection
 
Module 2 PPT of ES.pptx
Module 2 PPT of ES.pptxModule 2 PPT of ES.pptx
Module 2 PPT of ES.pptx
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
 
ARM AAE - Intrustion Sets
ARM AAE - Intrustion SetsARM AAE - Intrustion Sets
ARM AAE - Intrustion Sets
 
ARM.ppt
ARM.pptARM.ppt
ARM.ppt
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
 
OptimizingARM
OptimizingARMOptimizingARM
OptimizingARM
 
ARM Architecture Instruction Set
ARM Architecture Instruction SetARM Architecture Instruction Set
ARM Architecture Instruction Set
 
ARM Introduction
ARM IntroductionARM Introduction
ARM Introduction
 
The ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM ArchitectureThe ARM Architecture: ARM : ARM Architecture
The ARM Architecture: ARM : ARM Architecture
 
Arm
ArmArm
Arm
 
arm-intro.ppt
arm-intro.pptarm-intro.ppt
arm-intro.ppt
 
Ch9a
Ch9aCh9a
Ch9a
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 

More from rubini Rubini

adhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdfadhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdf
rubini Rubini
 
unit_5 ppt DIRECT BROADCAST SATELLITE.pptx
unit_5 ppt DIRECT BROADCAST SATELLITE.pptxunit_5 ppt DIRECT BROADCAST SATELLITE.pptx
unit_5 ppt DIRECT BROADCAST SATELLITE.pptx
rubini Rubini
 
Delta Modulation & Adaptive Delta M.pptx
Delta Modulation & Adaptive Delta M.pptxDelta Modulation & Adaptive Delta M.pptx
Delta Modulation & Adaptive Delta M.pptx
rubini Rubini
 
Unit I.pptx INTRODUCTION TO DIGITAL COMMUNICATION
Unit I.pptx INTRODUCTION TO DIGITAL COMMUNICATIONUnit I.pptx INTRODUCTION TO DIGITAL COMMUNICATION
Unit I.pptx INTRODUCTION TO DIGITAL COMMUNICATION
rubini Rubini
 
adhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdfadhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdf
rubini Rubini
 
Dept Vision & Mission Final copy 13.12.2016.docx
Dept Vision & Mission Final copy 13.12.2016.docxDept Vision & Mission Final copy 13.12.2016.docx
Dept Vision & Mission Final copy 13.12.2016.docx
rubini Rubini
 
PROGRAM OUTCOMES FINAL COPY as on 13.12.16.docx
PROGRAM OUTCOMES FINAL COPY as on 13.12.16.docxPROGRAM OUTCOMES FINAL COPY as on 13.12.16.docx
PROGRAM OUTCOMES FINAL COPY as on 13.12.16.docx
rubini Rubini
 
Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...
Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...
Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...
rubini Rubini
 
ppt
pptppt
Ch1
Ch1Ch1
7 227 2005
7 227 20057 227 2005
7 227 2005
rubini Rubini
 

More from rubini Rubini (12)

adhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdfadhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdf
 
unit_5 ppt DIRECT BROADCAST SATELLITE.pptx
unit_5 ppt DIRECT BROADCAST SATELLITE.pptxunit_5 ppt DIRECT BROADCAST SATELLITE.pptx
unit_5 ppt DIRECT BROADCAST SATELLITE.pptx
 
Delta Modulation & Adaptive Delta M.pptx
Delta Modulation & Adaptive Delta M.pptxDelta Modulation & Adaptive Delta M.pptx
Delta Modulation & Adaptive Delta M.pptx
 
Unit I.pptx INTRODUCTION TO DIGITAL COMMUNICATION
Unit I.pptx INTRODUCTION TO DIGITAL COMMUNICATIONUnit I.pptx INTRODUCTION TO DIGITAL COMMUNICATION
Unit I.pptx INTRODUCTION TO DIGITAL COMMUNICATION
 
adhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdfadhoc and wireless sensor network nptel assignment answers (1).pdf
adhoc and wireless sensor network nptel assignment answers (1).pdf
 
Dept Vision & Mission Final copy 13.12.2016.docx
Dept Vision & Mission Final copy 13.12.2016.docxDept Vision & Mission Final copy 13.12.2016.docx
Dept Vision & Mission Final copy 13.12.2016.docx
 
PROGRAM OUTCOMES FINAL COPY as on 13.12.16.docx
PROGRAM OUTCOMES FINAL COPY as on 13.12.16.docxPROGRAM OUTCOMES FINAL COPY as on 13.12.16.docx
PROGRAM OUTCOMES FINAL COPY as on 13.12.16.docx
 
Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...
Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...
Mehmet Yuce_ Jamil Y Khan - Wireless body area networks _ technology, impleme...
 
ppt
pptppt
ppt
 
Ch1
Ch1Ch1
Ch1
 
7 227 2005
7 227 20057 227 2005
7 227 2005
 
Cs lab viva
Cs lab vivaCs lab viva
Cs lab viva
 

Recently uploaded

Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
azkamurat
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 

Recently uploaded (20)

Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 

Ch2 arm-1

  • 1. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM instruction set ARM versions. ARM assembly language. ARM programming model. ARM memory organization. ARM data operations. ARM flow of control.
  • 2. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM versions ARM architecture has been extended over several versions. We will concentrate on ARM7.
  • 3. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM assembly language Fairly standard assembly language: LDR r0,[r8] ; a comment label ADD r4,r0,r1
  • 4. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM programming model r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 (PC) CPSR 31 0 N Z C V
  • 5. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Endianness 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
  • 6. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM data types Word is 32 bits long. Word can be divided into four 8-bit bytes. ARM addresses cam be 32 bits long. Address refers to byte. Address 4 starts at byte 4. Can be configured at power-up as either little- or bit-endian mode.
  • 7. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM status bits 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 = -231 : NZCV = 0101.
  • 8. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM data instructions Basic format: ADD r0,r1,r2 Computes r1+r2, stores in r0. Immediate operand: ADD r0,r1,#2 Computes r1+2, stores in r0.
  • 9. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM data instructions ADD, ADC : add (w. carry) SUB, SBC : subtract (w. carry) RSB, RSC : reverse subtract (w. carry) MUL, MLA : multiply (and accumulate) AND, ORR, EOR BIC : bit clear LSL, LSR : logical shift left/right ASL, ASR : arithmetic shift left/right ROR : rotate right RRX : rotate right extended with C
  • 10. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Data operation varieties Logical shift: fills with zeroes. Arithmetic shift: fills with ones. RRX performs 33-bit rotate, including C bit from CPSR above sign bit.
  • 11. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM comparison instructions CMP : compare CMN : negated compare TST : bit-wise test TEQ : bit-wise negated test These instructions set only the NZCV bits of CPSR.
  • 12. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM move instructions MOV, MVN : move (negated) MOV r0, r1 ; sets r0 to r1
  • 13. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM load/store instructions 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]
  • 14. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM ADR pseudo-op 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
  • 15. v Overheads for Computers as Components 2nd ed. Example: C assignments C: x = (a + b) - c; Assembler: ADR r4,a ; get address for a LDR r0,[r4] ; get value of a ADR r4,b ; get address for b, reusing r4 LDR r1,[r4] ; get value of b ADD r3,r0,r1 ; compute a+b ADR r4,c ; get address for c LDR r2[r4] ; get value of c
  • 16. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. C assignment, cont’d. SUB r3,r3,r2 ; complete computation of x ADR r4,x ; get address for x STR r3[r4] ; store value of x
  • 17. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Example: C assignment C: 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
  • 18. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. C assignment, cont’d. MUL r2,r2,r0 ; compute final value for y ADR r4,y ; get address for y STR r2,[r4] ; store y
  • 19. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Example: C assignment C: 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
  • 20. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. C assignment, cont’d. ADR r4,z ; get address for z STR r1,[r4] ; store value for z
  • 21. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Additional addressing modes Base-plus-offset addressing: LDR r0,[r1,#16] Loads from location r1+16 Auto-indexing increments base register: LDR r0,[r1,#16]! Post-indexing fetches, then does offset: LDR r0,[r1],#16 Loads r0 from r1, then adds 16 to r1.
  • 22. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM flow of control All operations can be performed conditionally, testing CPSR: EQ, NE, CS, CC, MI, PL, VS, VC, HI, LS, GE, LT, GT, LE Branch operation: B #100 Can be performed conditionally.
  • 23. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Example: if statement C: if (a > b) { x = 5; y = c + d; } else x = c - d; Assembler: ; compute and test condition ADR r4,a ; get address for a LDR r0,[r4] ; get value of a ADR r4,b ; get address for b LDR r1,[r4] ; get value for b CMP r0,r1 ; compare a < b BGE fblock ; if a >= b, branch to false block
  • 24. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. If statement, cont’d. ; true block MOV r0,#5 ; generate value for x ADR r4,x ; get address for x STR r0,[r4] ; store x ADR r4,c ; get address for c LDR r0,[r4] ; get value of c ADR r4,d ; get address for d LDR r1,[r4] ; get value of d ADD r0,r0,r1 ; compute y ADR r4,y ; get address for y STR r0,[r4] ; store y B after ; branch around false block
  • 25. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. If statement, cont’d. ; false block fblock ADR r4,c ; get address for c LDR r0,[r4] ; get value of c ADR r4,d ; get address for d LDR r1,[r4] ; get value for d SUB r0,r0,r1 ; compute a-b ADR r4,x ; get address for x STR r0,[r4] ; store value of x after ...
  • 26. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Example: Conditional instruction implementation ; true block MOVLT r0,#5 ; generate value for x ADRLT r4,x ; get address for x STRLT r0,[r4] ; store x ADRLT r4,c ; get address for c LDRLT r0,[r4] ; get value of c ADRLT r4,d ; get address for d LDRLT r1,[r4] ; get value of d ADDLT r0,r0,r1 ; compute y ADRLT r4,y ; get address for y STRLT r0,[r4] ; store y
  • 27. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Example: switch statement C: switch (test) { case 0: … break; case 1: … } Assembler: ADR r2,test ; get address for test LDR r0,[r2] ; load value for test ADR r1,switchtab ; load address for switch table LDR r1,[r1,r0,LSL #2] ; index switch table switchtab DCD case0 DCD case1 ...
  • 28. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Example: FIR filter C: for (i=0, f=0; i<N; i++) f = f + c[i]*x[i]; Assembler ; loop initiation code MOV r0,#0 ; use r0 for I MOV r8,#0 ; use separate index for arrays ADR r2,N ; get address for N LDR r1,[r2] ; get value of N MOV r2,#0 ; use r2 for f
  • 29. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. FIR filter, cont’.d ADR r3,c ; load r3 with base of c ADR r5,x ; load r5 with base of x ; loop body loop LDR r4,[r3,r8] ; get c[i] LDR r6,[r5,r8] ; get x[i] MUL r4,r4,r6 ; compute c[i]*x[i] ADD r2,r2,r4 ; add into running sum ADD r8,r8,#4 ; add one word offset to array index ADD r0,r0,#1 ; add 1 to i CMP r0,r1 ; exit? BLT loop ; if i < N, continue
  • 30. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. ARM subroutine linkage Branch and link instruction: BL foo Copies current PC to r14. To return from subroutine: MOV r15,r14
  • 31. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Nested subroutine calls Nesting/recursion requires coding convention: f1 LDR r0,[r13] ; load arg into r0 from stack ; call f2() STR r13!,[r14] ; store f1’s return adrs STR r13!,[r0] ; store arg to f2 on stack BL f2 ; branch and link to f2 ; return from f1() SUB r13,#4 ; pop f2’s arg off stack LDR r13!,r15 ; restore register and return
  • 32. © 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Summary Load/store architecture Most instructions are RISCy, operate in single cycle. Some multi-register operations take longer. All instructions can be executed conditionally.