Professional Documents
Culture Documents
Architecture, Programming and Development Tools
Architecture, Programming and Development Tools
Architecture, Programming
and
Development Tools
Lesson 3
ARM CPU32 bit ARM and
16-bit Thumb Instruction Sets
Outline
Basic Features
32-bit
Instruction Set
Thumb 16-bit Instruction Set
Inter-working with ARM/Thumb sets
ARM
byte,
16-bit half-word data types
half-words are aligned on 2byte boundaries
32-bit data types- words are
aligned on 4-byte boundaries
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
Address
Half word
Word
Byte3 (MSB)
byte2
byte1
Byte0 (LSB)
Byte
Address0
Address1
Address2
Address3
Address
Half word
Word
Byte3 (MSB)
byte2
byte1
byte0 (LSB)
Byte
Address0
Address1
Address2
Address3
Programming Model
16
general-purpose registers
with program counter as one of
the register (R15).
- Registers
R0 R1 R2 R3 R4 R5 R6 R7 Lo
R8registers
R9 R10 R11 R12 Hi registers
10
11
Outline
Basic
Features
32-bit Instruction Set
Thumb 16-bit Instruction Set
Inter-working with ARM/Thumb sets
12
Load Instructions
LDM:
13
14
Store Instructions
STM:
15
16
Load-store architecture
Features
LDM/STM with multiple options
of addressing modes (like
immediate)
LDM/STM loads into a subset of
registers in a list or save from the
list to the memory addresses
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
17
18
ARM Arithmetic
Instructions
ADD
ADC
BIC
A select
Add with Carry bit
clear
Subtract with carry
SUB: Subtract
MAC unit
Support
SBC
and
SUB
MUL
32x32
and
MULL
MLA
and
MLAL
multiply
(32 x 32 32)
with add
instruction
multiply long
(32 x 32 64)
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
long
19
and add instruction.
Arithmetic Instructions
ADC:
20
DVF:
ARM7500
21
22
ARM Logic
Instructions
AND
ORR
Hypothetical
AND
TST
Test
bits
CMN
TEQ
CMP
Compare negated
values
EOR
Exclusive
OR
Test Equivalence
(Hypothetical EOR)
(Hypothetical
SUB)
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
23
Logical Instructions..
Logical
24
Branch
BL: Branch with Link
25
<number>
SWI: cond SWI (8 msbs) remaining 24
bit lsbs are irrelevant as far as
execution of the instruction is
concerned.
Interrupt handler can use the 24-bits
for the suffix parameter (s) and
number to reflect the interrupting
foreground program (source of SWI).
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
26
SWI
<suffix>
<number>
27
28
29
Source
operand 2
8-bits
Destination
Option Field
Refer Next
Slide
Bits 31-0
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
30
Instruction Format
cond
00 X opcode S Rn Rd
operand 2
31
If
32
Second
33
Outline
Basic
Features
32-bit Instruction Set
Thumb 16-bit Instruction Set
Inter-working with ARM/Thumb sets
34
35
Programming Model
8
36
37
Store multiple
registers
LDR: Load register (32 bits?)
LDRB:Load byte (8 bit) into
register
LDRH: Load half-word (!)into
register
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
38
Contd
LDRSB:
39
Contd
STMIA:Thumb:
Store multiple
registers
STR: Store register (32 bit?)
STRB:Store byte (8 bit)
STRH: Store half-word (16 bit)
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
40
41
Thumb Arithmetic
Instructions
ADD
ADC
BIC
A select
Add with Carry bit
clear
SBC
and
SUB
MUL
NEG
multiply
By -1
multiply long
(32 x 32 64)
42
Thumb Logic
Instructions
AND
OR
TST
Test
bits
CMN
Hypothetical
AND
CMP
EOR
Exclusive
OR
(Hypothetical
SUB)
Compare negated
values
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
43
No operation,
B: Branch, BX: Branch and
Exchange
BL: Long Branch with Link (LR
and PC exchange), BLX:Branch
with Link and Exchange
BKPT: Breakpoint
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
44
45
Destination
cum Source
Register
or Rm
Rn Rd or other options
For Index
Bits 15-0
"Microcontrollers....", Raj Kamal,
from Pearson Education, 2005
46
Instruction Example
ADD
47
Outline
Basic
Features
32-bit Instruction Set
Thumb 16-bit Instruction Set
Inter-working with ARM/Thumb sets
48
ARM/THUMB Inter-working
T-bit
49
When
50
51
52
http://www.cs.umd.edu/class/fall2001/
cmsc411/proj01/arm/thumb.html
http://www.cs.man.ac.uk/Study_subwe
b/Ugrad/coursenotes/cs1031/Lec20Thumb.pdf.
53
Summary
54
We learnt
Programmability
as little
endian and big endian
ARM 7 - Princeton
architecture, ARM 9 Harvard architecture
8-bit
55
We learnt
Conditional data processing, data
transfer and control flow Execution
and addressing modes facilitate by
the few instructions only
56
We learnt
LDM/STM
57
subset
Better code density than 32-bit
architecture instruction set and
switching in-between ARM 32-bit
set and Thumb 16-bit set supported
58
59
THANK YOU
60