The First Encounter: Authors: Nemanja Perovic, Prof. Dr. Veljko Milutinovic
The First Encounter: Authors: Nemanja Perovic, Prof. Dr. Veljko Milutinovic
What Is ARM?
Advanced RISC Machine
Features
Architectural simplicity
which allows
Very small implementations which result in Very low power consumption
ARM Architecture
Typical RISC architecture:
Large uniform register file
Load/store architecture Simple addressing modes Uniform and fixed-length instruction fields
Pipeline Organization
Increases speed most instructions executed in single cycle Versions:
10
Fetch
i+1
Decode Fetch
i+2
t+1
t+2
t+3
t+4
11
Stages:
Fetch Decode Execute Buffer/data
Separates data and instruction memory => reduction of CPI (average number of clock Cycles Per Instruction)
Write-back
12
13
Operating Modes
Seven operating modes:
User
Privileged:
System (version 4 and above) FIQ IRQ Abort
exception modes
Undefined
Supervisor
14
Exception modes:
15
Exceptions
Exception Reset Undefined instruction Software interrupt Mode Supervisor Undefined Supervisor Priority 1 6 6 IV Address 0x00000000 0x00000004 0x00000008
Prefetch Abort
Data Abort Interrupt Fast interrupt
Abort
Abort IRQ FIQ
5
2 4 3
0x0000000C
0x00000010 0x00000018 0x0000001C
ARM Registers
31 general-purpose 32-bit registers
16 visible, R0 R15
17
Hardware
R14 Link Register (LR): optionally holds return address for branch instructions R15 Program Counter (PC)
Software
R13 - Stack Pointer (SP)
18
(PC + 4) LR
CPSR SPSR_mod PC IV address
FIQ
R0 R1 R2 R3 R4 R5 R6 R7_fiq R8_fiq R9_fiq R10_fiq R11_fiq R12_fiq R13_fiq R14_fiq R15 (PC) CPSR SPSR_fiq
Supervisor
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13_svc R14_svc R15 (PC) CPSR SPSR_svc
Abort
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13_abt R14_abt R15 (PC) CPSR SPSR_abt
IRQ
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13_irq R14_irq R15 (PC) CPSR SPSR_irq
Undefined
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13_und R14_und R15 (PC) CPSR SPSR_und
20
Instruction Set
Two instruction sets:
ARM
Standard 32-bit instruction set
THUMB
16-bit compressed form Code density better than most CISC
21
Load/Store architecture
3-address data processing instructions
Conditional execution
Load/Store multiple registers Shift & ALU operation in single clock cycle
22
16 condition codes:
MI PL negative positive or zero
overflow
EQ NE
HI LS
unsigned higher
GT LE
CS
VS
GE
AL
CC
VC
no overflow
LT
NV
23
24
3-address format:
Two 32-bit operands (op1 is register, op2 is register or immediate) 32-bit result placed in a register
Barrel shifter for op2 allows full 32-bit shift within instruction cycle
25
MOV, MVN
Comparison operations:
+
Data processing instructions
+
Barrel shifter
=
Powerful tools for efficient coded programs
27
if (z==1) R1=R2+(R3*4)
compiles to
EQADDS R1,R2,R3, LSL #2
( SINGLE INSTRUCTION ! )
28
Used to move signed and unsigned Word, Half Word and Byte to and from registers
Can be used to load PC (if target address is beyond branch instruction range)
LDR
LDRH LDRSH LDRB LDRSB
Load Word
Load Half Word Load Signed Half Word Load Byte Load Signed Byte
STR
STRH
Store Word
Store Half Word
STRSH Store Signed Half Word STRB STRSB Store Byte Store Signed Byte
29
Mi+1 Mi+2
STM
Swap Instruction
Exchanges a word between registers Two cycles but single atomic action Support for RT semaphores
R0
R1 R2
R7 R8
R15
31
R14 R15
32
Multiply Instructions
Integer multiplication (32-bit result)
33
Multiply Instructions
Instructions:
MUL MULA
UMULL UMLAL SMULL SMLAL
34
Software Interrupt
SWI instruction
Cond
Opcode
Ordinal
Maximum 224 calls Suitable for running privileged code and making OS calls
35
Branching Instructions
Branch (B): jumps forwards/backwards up to 32 MB Branch link (BL): same + saves (PC+4) in LR Suitable for function call/return Condition codes for conditional branches
36
37
No condition codes
Two-address data processing instructions
Access to R0 R8 restricted to
40
New NEON media and signal processing extensions Thumb-2 blended 16/32-bit instruction set for performance and low power Improved Interrupt handling
41
Summary
Adoption of ARM technology has increased efficiency and lowered costs ARM is the worlds leading architecture today
42
References
www.arm.com
ARM Limited ARM Architecture Reference Manual, Addison Wesley, June 2000
Trevor Martin The Insiders Guide To The Philips ARM7Based Microcontrollers, Hitex (UK) Ltd., February 2005 Steve Furber ARM System-On-Chip Architecture (2nd edition), Addison Wesley, March 2000
43
The End