- •The ARM Architecture
- •Agenda
- •Founded in November 1990
- •ARM Partnership Model
- •ARM Powered Products
- •Intellectual Property
- •Agenda
- •Data Sizes and Instruction Sets
- •Processor Modes
- •The ARM Register Set
- •Register Organization Summary
- •The Registers
- •Program Status Registers
- •Program Counter (r15)
- •Exception Handling
- •Development of the
- •Agenda
- •Conditional Execution and Flags
- •Condition Codes
- •Examples of conditional execution
- •Branch instructions
- •Data processing Instructions
- •LSL : Logical Left Shift
- •Using the Barrel Shifter:
- •Immediate constants (1)
- •Immediate constants (2)
- •Loading 32 bit constants
- •Multiply
- •Single register data transfer
- •Address accessed
- •Pre or Post Indexed Addressing?
- •LDM / STM operation
- •PSR Transfer Instructions
- •ARM Branches and Subroutines
- •Thumb
- •Agenda
- •Example ARM-based System
- •AMBA
- •Agenda
- •The RealView Product Families
- •ARM Debug Architecture
Pre or Post Indexed Addressing?
Pre-indexed: STR r0,[r1,#12]
Offset
12
r1 Base 0x200
Register
|
|
|
|
|
r0 |
Source |
0x20c |
0x5 |
|
|
|
0x5 |
Register |
|
|
|
||||
|
|
|
|
|
|
for STR |
|
|
|
|
|
|
0x200
Auto-update form: STR r0,[r1,#12]!
Post-indexed: STR r0,[r1],#12
Updated |
r1 |
|
|
|
Offset |
|
Base |
0x20c |
|
|
|
12 |
|
|
|
|
||||
Register |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Original |
r1 |
|
|
|
|
|
|
|
|
|
|
||
Base |
|
|
|
|
|
|
0x200 |
|
|
|
|
|
|
|
|
|
|
|
||
Register |
|
|
|
|
|
|
|
|
|
|
|
|
0x20c |
|
|
r0 |
|
|
|
|
Source |
|
|
|
|
|
|
|
|
|
0x5 |
Register |
|
|
|
|
for STR |
0x200 |
0x5 |
|
|
39v10 The ARM Architecture |
31 |
LDM / STM operation
|
Syntax: |
|
|
|
|
|
|
|
|
|
|
|
|
|
<LDM|STM>{<cond>}<addressing_mode> Rb{!}, <register list> |
||||||||||||
|
4 addressing modes: |
|
|
|
|
|
|
|
|
|
|
|
|
|
LDMIA / STMIA |
increment after |
|
|
|
|
|
|
|
||||
|
LDMIB / STMIB |
increment before |
|
|
|
|
|
|
|
||||
|
LDMDA / STMDA |
decrement after |
|
|
|
|
|
|
|
||||
|
LDMDB / STMDB |
decrement before |
|
|
|
|
|
|
|
||||
|
|
|
|
|
IA |
IB |
|
DA |
|
DB |
|||
LDMxx r10, {r0,r1,r4} |
|
|
|
|
|
|
|
|
|
||||
|
|
r4 |
|
|
|
|
|
|
|||||
STMxx r10, {r0,r1,r4} |
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|||||
r4 |
|
r1 |
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
r1 |
|
r0 |
|
|
|
|
|
Increasing |
|
Base Register (Rb) |
r10 |
|
|
r0 |
|
|
|
r4 |
|
|
|
Address |
|
|
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r1 |
|
r4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r0 |
|
r1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39v10 The ARM Architecture |
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Software Interrupt (SWI) |
||||||||||||||||||
31 |
|
|
28 |
27 |
|
24 23 |
0 |
|
|||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cond |
|
1 1 1 |
1 |
|
|
|
|
|
SWI number (ignored by processor) |
|
||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Condition Field
Causes an exception trap to the SWI hardware vector
The SWI handler can examine the SWI number to decide what operation has been requested.
By using the SWI mechanism, an operating system can implement a set of privileged operations which applications running in user mode can request.
Syntax:
SWI{<cond>} <SWI number>
39v10 The ARM Architecture |
33 |
PSR Transfer Instructions
31 |
|
|
28 |
|
27 |
24 |
23 |
16 |
15 |
8 |
7 |
6 |
5 |
4 |
0 |
|
|
|||||||
|
N Z C V |
Q |
|
J |
|
U n d e f |
|
i n e d |
|
I F |
T |
|
|
mode |
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f |
|
|
|
|
s |
|
x |
|
|
|
|
|
c |
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MRS and MSR allow contents of CPSR / SPSR to be transferred to / from a general purpose register.
Syntax:
|
MRS{<cond>} |
Rd,<psr> |
; |
Rd = <psr> |
|
MSR{<cond>} |
<psr[_fields]>,Rm |
; |
<psr[_fields]> = Rm |
where
<psr> = CPSR or SPSR
[_fields] = any combination of ‘fsxc’
Also an immediate form
MSR{<cond>} <psr_fields>,#Immediate
In User Mode, all bits can be read but only the condition flags (_f) can be written.
39v10 The ARM Architecture |
34 |
ARM Branches and Subroutines
B <label>
PC relative. ±32 Mbyte range.
BL <subroutine>
Stores return address in LR
Returning implemented by restoring the PC from LR
For non-leaf functions, LR will have to be stacked
|
|
func1 |
|
func2 |
|
|
|
|
|
: |
|
STMFD sp!, |
|
: |
|
{regs,lr} |
|
|
|
|
|
|
: |
|
: |
|
: |
|
|
|
|
|
||
|
|
|
: |
|
BL func1 |
|
BL func2 |
|
|
|
|
|
||
|
|
|
: |
|
: |
|
: |
|
|
|
|
|
||
|
|
|
: |
|
: |
|
LDMFD sp!, |
|
|
|
|
|
||
|
|
|
MOV pc, lr |
|
|
|
{regs,pc} |
|
|
|
|
|
|
|
39v10 The ARM Architecture |
35 |
Thumb
Thumb is a 16-bit instruction set
Optimised for code density from C code (~65% of ARM code size)
Improved performance from narrow memory
Subset of the functionality of the ARM instruction set
Core has additional execution state - Thumb
Switch between ARM and Thumb using BX instruction
ADDS r2,r2,#1
32-bit ARM Instruction
ADD r2,#1
16-bit Thumb Instruction
For most instructions generated by compiler:
Conditional execution is not used
Source and destination registers identical
Only Low registers used
Constants are of limited size
Inline barrel shifter not used
39v10 The ARM Architecture |
36 |
Agenda
Introduction
Programmers Model
Instruction Sets
System Design
Development Tools
39v10 The ARM Architecture |
37 |
Example ARM-based System
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 bit RAM |
|
|
|
|
32 bit RAM |
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Interrupt |
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
Controller |
|
|
|
Peripherals |
|
|
|
|
I/O |
|||
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
nIRQ |
nFIQ |
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARM |
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
8 bit ROM |
|
|
|
|
Core |
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39v10 The ARM Architecture |
38 |
AMBA
|
|
|
|
Arbiter |
|
|
|
|
|
|
|
|
|
|
|
|
Reset |
|
|
|
|
|
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
ARM |
|
|
|
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||
|
|
|
TIC |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer |
|
|
Remap/ |
||||||||||
External |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
Bus |
Interface |
|
|
|
|
|
|
|
|
Pause |
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
ROM |
|
|
External |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bridge |
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
Bus |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
Interface |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
External |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Interrupt |
|
|
||||
RAM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Onchip |
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
Decoder |
|
|
|
|
RAM |
|
|
|
|
|
Controller |
|
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AHB or ASB |
APB |
System Bus |
Peripheral Bus |
|
AMBA |
|
ACT |
||
|
|
Advanced Microcontroller Bus |
|
|
AMBA Compliance Testbench |
|
|
Architecture |
|
|
|
|
ADK |
|
PrimeCell |
||
|
|
Complete AMBA Design Kit |
|
|
ARM’s AMBA compliant peripherals |
39v10 The ARM Architecture |
39 |
Agenda
Introduction
Programmers Model
Instruction Sets
System Design
Development Tools
39v10 The ARM Architecture |
40 |