The ARM Architecture
Agenda
Introduction to ARM Ltd
ARM Architecture/Programmers Model
Data Path and Pipelines
AMBA
Development Tools
Confidential
1
ARM Ltd
Founded in November 1990
Spun out of Acorn Computers
Designs the ARM range of RISC processor cores
Licenses ARM core designs to semiconductor
partners who fabricate and sell to their customers.
ARM does not fabricate silicon itself
Also develop technologies to assist with the design-
in of the ARM architecture
Software tools, boards, debug hardware,
application software, bus architectures,
peripherals etc
ARM Partnership Model
Confidential
2
ARM Powered Products
Agenda
Introduction to ARM Ltd
ARM Architecture/Programmers Model
Data Path and Pipelines
AMBA
Development Tools
Confidential
3
Architecture Revisions
ARMv7 (Future)
version
ARM1156T2F-S™
ARM1136JF-S™
ARMv6
ARM1176JZF-S™
ARM102xE XScaleTM ARM1026EJ-S™
ARMv5
ARM9x6E ARM926EJ-S™
® SC200™
ARM7TDMI-S™ StrongARM ARM92xT
V4
SC100™ ARM720T™
1994 1996 1998 2000 2002 2004 2006
time
XScale is a trademark of Intel Corporation
Data Sizes and Instruction Sets
The ARM is a 32-bit architecture.
When used in relation to the ARM:
Byte means 8 bits
Halfword means 16 bits (two bytes)
Word means 32 bits (four bytes)
Most ARM’s implement two instruction sets
32-bit ARM Instruction Set
16-bit Thumb Instruction Set
Jazelle cores can also execute Java bytecode
Confidential
4
Processor Modes
The ARM has seven basic operating modes:
User : unprivileged mode under which most tasks run
FIQ : entered when a high priority (fast) interrupt is raised
IRQ : entered when a low priority (normal) interrupt is raised
Supervisor : entered on reset and when a Software Interrupt
instruction is executed
Abort : used to handle memory access violations
Undef : used to handle undefined instructions
System : privileged mode using the same registers as user mode
The ARM Register Set
Current Visible Registers
r0
Abort
Undef
SVC
IRQ
FIQ
User Mode
Mode
Mode
Mode
Mode r1
r2
r3 Banked out Registers
r4
r5
r6 User FIQ IRQ SVC Undef Abort
r7
r8 r8 r8
r9 r9 r9
r10 r10 r10
r11 r11 r11
r12 r12 r12
r13 (sp) r13 (sp) r13 (sp) r13 (sp) r13 (sp) r13 (sp) r13 (sp)
r14 (lr) r14 (lr) r14 (lr) r14 (lr) r14 (lr) r14 (lr) r14 (lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr spsr
10
Confidential
5
Exception Handling
When an exception occurs, the ARM:
Copies CPSR into SPSR_<mode>
Sets appropriate CPSR bits
Change to ARM state 0x1C FIQ
0x18 IRQ
Change to exception mode 0x14 (Reserved)
Disable interrupts (if appropriate) 0x10 Data Abort
Stores the return address in LR_<mode> 0x0C Prefetch Abort
Sets PC to vector address 0x08 Software Interrupt
0x04 Undefined Instruction
To return, exception handler needs to:0x00 Reset
Restore CPSR from SPSR_<mode> Vector Table
Restore PC from LR_<mode> Vector table can be at
0xFFFF0000 on ARM720T
This can only be done in ARM state. and on ARM9/10 family devices
11
Conditional Execution and Flags
ARM instructions can be made to execute conditionally by postfixing them with the
appropriate condition code field.
This improves code density and performance by reducing the number of
forward branch instructions.
CMP r3,#0 CMP r3,#0
BEQ skip ADDNE r0,r1,r2
ADD r0,r1,r2
skip
By default, data processing instructions do not affect the condition code flags but
the flags can be optionally set by using “S”. CMP does not need “S”.
loop
…
SUBS r1,r1,#1 decrement r1 and set flags
BNE loop if Z flag clear then branch
12
Confidential
6
Branch instructions
Branch : B{<cond>} label
Branch with Link : BL{<cond>} subroutine_label
31 28 27 25 24 23 0
Cond 1 0 1 L Offset
Link bit 0 = Branch
1 = Branch with link
Condition field
The processor core shifts the offset field left by 2 positions, sign-extends it
and adds it to the PC
± 32 Mbyte range
How to perform longer branches?
13
Data processing Instructions
Consist of :
Arithmetic: ADD ADC SUB SBC RSB RSC
Logical: AND ORR EOR BIC
Comparisons: CMP CMN TST TEQ
Data movement: MOV MVN
These instructions only work on registers, NOT memory.
Syntax:
<Operation>{<cond>}{S} Rd, Rn, Operand2
Comparisons set flags only - they do not specify Rd
Data movement does not specify Rn
Second operand is sent to the ALU via barrel shifter.
14
Confidential
7
Using a Barrel Shifter:The 2nd Operand
Register, optionally with shift operation
Operand Operand Shift value can be either be:
1 2 5 bit unsigned integer
Specified in bottom byte of
another register.
Barrel
Shifter
Used for multiplication by constant
Immediate value
8 bit number, with a range of 0-
255.
ALU
Rotated right through even
number of positions
Allows increased range of 32-bit
Result constants to be loaded directly into
registers
15
Loading 32 bit constants
To allow larger constants to be loaded, the assembler offers a pseudo-
instruction:
LDR rd, =const
This will either:
Produce a MOV or MVN instruction to generate the value (if possible).
or
Generate a LDR instruction with a PC-relative address to read the
constant from a literal pool (Constant data area embedded in the
code).
For example
LDR r0,=0xFF => MOV r0,#0xFF
LDR r0,=0x55555555 => LDR r0,[PC,#Imm12]
…
…
DCD 0x55555555
This is the recommended way of loading constants into a register
16
Confidential
8
Single register data transfer
LDR STR Word
LDRB STRB Byte
LDRH STRH Halfword
LDRSB Signed byte load
LDRSH Signed halfword load
Memory system must support all access sizes
Syntax:
LDR{<cond>}{<size>} Rd, <address>
STR{<cond>}{<size>} Rd, <address>
e.g. LDREQB
17
Agenda
Introduction to ARM Ltd
ARM Architecture/Programmers Model
Data Path and Pipelines
AMBA
Development Tools
18
Confidential
9
The ARM7TDM Core
ABE A[31:0] Address
Incrementer
Address Register Incrementer
P
C BIGEND
MCLK
nWAIT
Register Bank PC Update
nRW
Instruction MAS[1:0]
A
Decode Stage Decoder
L A B ISYNC
Instruction nIRQ
U Decompression nFIQ
Multiplier nRESET
B B and ABORT
B nTRANS
u u Read Data
nMREQ
u s Barrel s Register SEQ
Shifter Control LOCK
s nM[4:0]
Logic
Write Data nOPC
Register nCPI
32 Bit ALU CPA
CPB
DBE D[31:0]
19
Pipeline changes for ARM9TDMI
ARM7TDMI
ARM decode
Instruction Thumb→ARM Reg Reg
Shift ALU
Fetch decompress Read Write
Reg Select
FETCH DECODE EXECUTE
ARM9TDMI
ARM or Thumb
Instruction Inst Decode Memory Reg
Shift + ALU Write
Fetch Reg Reg Access
Decode Read
FETCH DECODE EXECUTE MEMORY WRITE
20
Confidential
10
ARM10 vs. ARM11 Pipelines
ARM10
Branch ARM or Memory
Prediction Shift + ALU
Thumb Reg Read Access Reg
Instruction Instruction Write
Decode Multiply
Fetch Multiply
Add
FETCH ISSUE DECODE EXECUTE MEMORY WRITE
ARM11
Shift ALU Saturate
Fetch Fetch MAC MAC MAC Write
Decode Issue
1 2 1 2 3 back
Data Data
Address Cache Cache
1 2
21
Agenda
Introduction to ARM Ltd
ARM Architecture/Programmers Model
Data Path and Pipelines
AMBA
Development Tools
22
Confidential
11
AMBA
Arbiter Reset
ARM
TIC
Remap/
External Bus Interface Timer
Pause
ROM External
Bridge
Bus
Interface
External
RAM On-chip Interrupt
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
23
AHB basic signal timing
Address Phase Data Phase A Data Phase B
A Address Phase B
HCLK
HADDR A B C
HWRITE A B C
HWDATA A B
HRDATA A B
HRESP OKAY A OKAY B
HREADY
24
Confidential
12
Agenda
Introduction to ARM Ltd
ARM Architecture/Programmers Model
Data Path and Pipelines
AMBA
Development Tools
25
ARM Debug Architecture
Ethernet
Debugger (+ optional
trace tools)
JTAG port Trace Port
EmbeddedICE Logic
Provides breakpoints and processor/system
access
TAP
JTAG interface (ICE) controller
Converts debugger commands to JTAG ETM
signals
Embedded trace Macrocell (ETM) EmbeddedICE
Logic
Compresses real-time instruction and data
access trace
Contains ICE features (trigger & filter logic)
Trace port analyzer (TPA) ARM
core
Captures trace in a deep buffer
26
Confidential
13
27
Confidential
14