Docsity

ARM Architecture: Most Widely Used RISC Instruction Set Architecture, Exercises of Computer Architecture and Organization

Toggle sidebar
bg1
“The ARM architecture describes a family of RISC-based computer processors designed and licensed by British
company ARM Holdings. It was first developed in the 1980s and globally as of 2013 is the most widely used
32-bit instruction set architecture in terms of quantity produced. In 2011 alone, producers of chips based on
ARM architectures reported shipments of 7.9 billion ARM-based processors, representing 95% of smartphones,
90% of hard disk drives, 40% of digital televisions and set-top boxes, 15% of microcontrollers and 20% of
mobile computers.” -- (http://en.wikipedia.org/wiki/ARM_architecture)
E78
16
PC:
D74
16
C70
16
B6C
16
A68
16
14
16
R6:
964
16
10
16
R5:
860
16
C
16
R4:
75C
16
8
16
R3:
658
16
4
16
R2:
554
16
64
16
R1:
4(Label X:) 50
16
R0:
MemoryRegister File
1) For each of the AL statement listed below, always assume the above unmodified register and memory values.
Reg. indirect with scaled reg.
post-autoindexed
LDR R0, [R1], R2, LSL #2
Reg. indirect post-autoindexed
LDR
R0, [R1], #8
Reg. indirect with scaled reg.
pre-autoindexed
LDR
R
0
, [R1, R2,
LSL
#2]!
Pre-autoindexed immediate
offset
LDR
R0, [R1, #-8]!
LDR R0, [R1, -R3, ASR #1]
Reg. indirect with scaled reg.
indexed (pre-indexed)
LDR R0, [R1, R2, LSL #2]
LDR R0, [R1, R2]
Reg. indirect with reg. indexed
LDR
R0, [R1, -R2]
Register indirect
LDR
“global label”
LDR
R0, X
R1R0
Register Values After ExecutionAddressing ModeAssembly Language Statement
2) Consider the following insertion sort algorithm:
integer firstUnsortedIndex, testIndex, elementToInsert;
for firstUnsortedIndex = 1 to (length-1) do
testIndex = firstUnsortedIndex-1;
elementToInsert = numbers[firstUnsortedIndex];
while (testIndex >=0) AND (numbers[testIndex] > elementToInsert ) do
numbers[ testIndex + 1 ] = numbers[ testIndex ];
testIndex = testIndex - 1;
end while
numbers[ testIndex + 1 ] = elementToInsert;
end for
Computer Org. Lecture 13 Name:_______________
Lecture 13 Page 1
Docsity.com
pf2

Partial preview of the text

Download ARM Architecture: Most Widely Used RISC Instruction Set Architecture and more Exercises Computer Architecture and Organization in PDF only on Docsity!

“The ARM architecture describes a family of RISC-based computer processors designed and licensed by British company ARM Holdings. It was first developed in the 1980s and globally as of 2013 is the most widely used 32-bit instruction set architecture in terms of quantity produced. In 2011 alone, producers of chips based on ARM architectures reported shipments of 7.9 billion ARM-based processors, representing 95% of smartphones, 90% of hard disk drives, 40% of digital televisions and set-top boxes, 15% of microcontrollers and 20% of mobile computers.” -- (http://en.wikipedia.org/wiki/ARM_architecture)

PC: 7816 E

7416 D

7016 C

6C 16 B

R6: 14 16 6816 A

R5: 10 16 6416 9

R4: C 16 6016 8

R3: 8 16 5C 16 7

R2: 4 16 5816 6

R1: 64 16 5416 5

R0: (Label X:) 50 16 4

Register File Memory

  1. For each of the AL statement listed below, always assume the above unmodified register and memory values.

Reg. indirect with scaled reg. post-autoindexed

LDR R0, [R1], R2, LSL #

LDR R0, [R1], #8 Reg. indirect post-autoindexed

Reg. indirect with scaled reg. pre-autoindexed

LDR R 0 , [R1, R2, LSL #2]!

Pre-autoindexed immediate offset

LDR R0, [R1, #-8]!

LDR R0, [R1, -R3, ASR #1]

Reg. indirect with scaled reg. indexed (pre-indexed)

LDR R0, [R1, R2, LSL #2]

LDR R0, [R1, R2] Reg. indirect with reg. indexed

LDR R0, [R1, -R2]

LDR R0, [R1] Register indirect

LDR R0, X “global label”

R0 R

Assembly Language Statement Addressing Mode Register Values After Execution

  1. Consider the following insertion sort algorithm:

integer firstUnsortedIndex, testIndex, elementToInsert; for firstUnsortedIndex = 1 to (length-1) do testIndex = firstUnsortedIndex-1; elementToInsert = numbers[firstUnsortedIndex]; while (testIndex >=0) AND (numbers[testIndex] > elementToInsert ) do numbers[ testIndex + 1 ] = numbers[ testIndex ]; testIndex = testIndex - 1; end while numbers[ testIndex + 1 ] = elementToInsert; end for

Computer Org. Lecture 13 Name:_______________

Lecture 13 Page 1Docsity.com

  1. Write ARM Assembly Language code for the above insertion sort algorithm

AREA INSERTION_SORT, CODE, READONLY

ENTRY

STOP B STOP

AREA INSERTION_SORT, DATA, READWRITE

ALIGN

NUMBERS DCD 20, 30, 10, 40, 50, 60, 30, 25, 10, 5

LENGTH DCD 10

END

Computer Org. Lecture 13 Name:_______________

Lecture 13 Page 2Docsity.com