App Unit 2 PKM
App Unit 2 PKM
1
Load-Store Architecture
2
3
4
5
6
7
8
9
10
11
ARM instruction set
• data processing instructions
• branch instructions
• load-store instructions
• software interrupt instruction
• program status register instructions.
12
Data Processing Instructions
• The data processing instructions manipulate
data within registers.
• Most data processing instructions can process
one of their operands using the barrel shifter.
• If you use the S suffix on a data processing
instruction, then it updates the flags in the
cpsr.
13
Data Processing Instructions
• move instructions
• arithmetic instructions
• logical instructions
• comparison instructions
• Multiply instructions.
14
Move Instructions
15
Barrel shifter with MOV
16
17
18
19
20
21
22
23
24
25
Arithmetic Instructions
• The arithmetic instructions implement
addition and subtraction of 32-bit signed and
unsigned values.
26
27
Using the Barrel Shifter with Arithmetic
Instructions
28
Logical Instructions
29
Logical Instructions
• BIC instruction is particularly useful when
clearing status bits and is frequently used to
change interrupt masks in the cpsr.
• The logical instructions update the cpsr flags
only if the S suffix is present.
• These instructions can use barrel-shifted
second operands in the same way as the
arithmetic instructions.
30
Comparison Instructions
32
Comparison Instructions
34
35
Multiply Instructions
• The long multiply instructions (SMLAL, SMULL,
UMLAL, and UMULL) produce a 64-bit result.
• The result is too large to fit a single 32-bit
register so the result is placed in two registers
labeled RdLo and RdHi.
• RdLo holds the lower 32 bits of the 64-bit
result, and RdHi holds the higher 32 bits of the
64-bit result
36
37
Branch Instructions
38
39
40
Branch Instructions
• Branches are used to change execution flow.
• Most assemblers hide the details of a branch
instruction encoding by using labels.
• In previous example, forward and backward are
the labels.
• The branch labels are placed at the beginning
of the line and are used to mark an address
that can be used later by the assembler to
calculate the branch offset.
41
42
Branch Instructions
44
Single-Register Transfer
45
46
Single-Register Load-Store Addressing Modes
47
48
• The preindex mode is useful for accessing an element in a
data structure.
• The postindex and preindex with writeback modes are useful
for traversing an array.
• A signed offset or register is denoted by “+/−”, identifying that
it is either a positive or negative offset from the base address
register Rn.
49
50
51
Multiple-Register Transfer
• Load-store multiple instructions can transfer
multiple registers between memory and the
processor in a single instruction.
• The transfer occurs from a base address
register Rn pointing into memory.
• Multiple-register transfer instructions are
more efficient from single-register transfers
for moving blocks of data around memory and
saving and restoring context and stacks.
52
Multiple-Register Transfer
53
54
55
56
57
58
Stack Operations
67
Software Interrupt Instruction
• A software interrupt instruction (SWI) causes a
software interrupt exception, which provides a
mechanism for applications to call operating
system routines.
68
Software Interrupt Instruction
• When the processor executes an SWI
instruction, it sets the program counter pc to
the offset 0x8 in the vector table.
• The instruction also forces the processor mode
to SVC, which allows an operating system
routine to be called in a privileged mode.
• Each SWI instruction has an associated SWI
number, which is used to represent a particular
function call or feature.
69
70
Program Status Register Instructions
72
73
Coprocessor Instructions
74
Loading Constants
• To aid programming there are two
pseudoinstructions to move a 32-bit value into
a register.
75
76
Arm thumb instruction
77
78
79
80
81
82
83
84
Assembler directives
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
ASEMBLY PROGRAMMING
• REFER LAB PROGRAMS
102