Presentation - ARM Processors
Presentation - ARM Processors
• Features
High performance, low power, small in size (ideal for embedded sys)
Large Register File, Small instruction set, Load-Store instructions,
Fixed length instructions, Conditional execution of instructions,
High code density, most instructions executable in single cycle,
32-bit in-line barrel shifter, built-in circuit for hardware debugging,
DSP enhanced instructions, Jazelle (Java byte code extn. 3rd state),
TrustZone (SoC approach to security)
N. Mathivanan
ARM Architecture Variants (core), Processor Families
• Each family has its own instruction set, mem management, etc.
Architectur Processor
Processor Features Microcontroller
e version Families
ARM7TDMI ARM720T Von Neumann,
LPC2100 series
(1995) ARM740T 3-stage pipeline
ARM v4T ARM920T
MMU, Harvard, SAM9G, LPC29xx,
ARM9TDMI ARM922T
5-stage pipeline LPC3xxx, STR9
ARM942T
ST32F512-M, LPC1300,
ARM v7-M Cortex Cortex-M3 MPU (optional), NVIC
1700, 1800
STA1095, SAM4L,
Cortex-R4 MPU, DSP
SAM4N, SAM4S
Incrementer Bus
• Data bus – 32-bit
PC Bus
Address
• Address bus – 32-bit Incrementer
Logic Control
• Register bank – (31+6) 32-bit regs. 32 x 8
multiplier
ALU Bus
• In-line barrel shifter
A Bus
B Bus
Barrel Shifter
• Multiplier
• ALU ALU
• Incrementer
• Address register Data Out Register Data In Register
Named as r0 – r15 r3
r4
r13,r14, r15 are SP, LR, PC
r5
8-bit/16-bit/32-bit data can r6
Banked Registers
FIQ
r7
be read/write
r8 r8_fiq
r10 r10_fiq
Only 1 is accessible
r11 r11_fiq
IRQ Undef Abort SVC
Named as CPSR, SPSR r12 r12_fiq
r13_sp r13_svc
Contains flags, control bits r13_fiq r13_irq r13_und r13_abt
r15_pc
Register bank has
CPSR
2 read and 1 write port and
SPSR_fiq SPSR_irq SPSR_und SPSR_abt SPSR_svc
N. Mathivanan
1 read and 1 write port for PC
• Bit definitions of Program Status registers
B31 B24 B23 B16 B15 B8 B7 B0
N Z C V I F T M4 M3 M2 M1 M0
Mode
Overflow
Carry Thumb State Flag
Zero FIQ Interrupt Mask
Negative IRQ Interrupt Mask
• Barrel shifter
Combinational logic circuit
Shifts left/right any no. of bits position in one cycle
Preprocess one of data from source reg. before passed to ALU
• Multiplier
• Address register
Holds the address of next instruction to be fetched
N. Mathivanan
• Data Types
o Word – 32-bit, Halfword – 16-bit, Byte – 8-bit
o Memory is byte addressable, can hold 2 32 bytes (= 4 GB)
o Word/ halfword /byte size data are placed at word/ halfword/
byte aligned addresses.
o 32-bit ARM instructions are placed at word aligned addresses
SUB F D E
• In T2, fetch 2nd, decode 1st instructions
CMP F D
• In T3, fetch 3rd, decode 2nd, execute 1st AND F
F - Fetch, D - Decode, E - Execute
instructions. -----
Time
• In each cycle one instruction is executed
N. Mathivanan
Pipelining Continued……
• PC points to memory address of instruction currently fetched
• Address of instruction currently decoded is PC-4
• Address of instruction currently executed is PC-8
• Branch instruction break pipeline, LDR/STR instruction stall
Memory
pipeline
T1
----- T2 T3 T4 T5 T6 T7 T8 Memory T1 T2 T3 T4 T5 T6 T7 T8
0x8000 BL 0x8020 F D E
ORR F D E
0x8004 SUB F D
F D Calc. Addr Data
0x8008 CMP F STR Transfer
----- SUB F D E
-----
CMP F D E
0x8020 AND F D E
AND F D E
0x8024 ADD F D E
F - Fetch, D - Decode, E - Execute
0x8028 MOV F D E
Time
F - Fetch, D - Decode, E - Execute
• ARM9F E–T 5
C Hstage, ARM10
DEC–
OD WR I T E
6EN.stage,
MathivananE X E C U T E
ARM11 – 8Mstage
E MOR Y
Operating Modes
• ARM7 has 7 modes, classified into privileged and non-privileged
o In non-privileged mode processor can’t change control bits of CPSR
N. Mathivanan
Operating Modes Continued….
User Mode
r0
r1
Mode Function r2
SPSR_irq
N. Mathivanan
Exceptions
• Generated by external events or internal sources
• Seven types of exceptions
o Reset: Occurs when ‘Reset’ pin is asserted – power-up/reset
o Undefined: Occurs when currently executing instruction could
not be recognized
o SWI: Occurs if program in user mode executes SWI instruction
to request OS services that are available in supervisor mode.
o Prefetch Abort: Occurs if instruction fetched from invalid
address. Exception is generated at execution stage.
o Data Abort: Occurs if data load/store attempt at illegal address
o IRQ: Occurs if IRQ pin goes low (only if CPSR IRQ mask bit is 0)
o FIQ: Occurs if FIQ pin goes low (only if CPSR FIQ mask bit is 0)
N. Mathivanan
Exception Handling
• Exception causes diversion of execution to a particular mem location
o Changes CPSR bits (enable ARM state, change mode bits, disable
interrupts)
o Saves return address i.e. (current PC–4) in LRexception
o Places vector address of exception mode in PC.
N. Mathivanan
• Execution branches to exception handler routine and executes
Exception handler has codes to return back to previous mode at
correct loc
Restores CPSR from SPSRexception
N. Mathivanan
Response of Processor to Exceptions
SPSR_svc = unexpected
CPSR[4:0]= 10011B (SVC mode)
CPSR[5] = 0 (ARM state), CPSR[6] = 1 (Disable FIQ)
Reset 0x00000000 No return 1
CPSR[7] = 1 (Disable IRQ)
r14_svc = unexpected
PC = 0x00000000 (Exception vector)
SPSR_und = CPSR
CPSR[4:0]= 11011B (undefined mode) If registers are
not saved in
CPSR[5] = 0 (ARM state), CPSR[6] unchanged
stack
CPSR[7] = 1 (Disable IRQ)
Un r14_und = addr of next to undefined instruction MOVS pc,lr
0x00000004 6
defined PC = 0x00000004 (Exception vector)
If saved:
Registers are saved in stack at entry using:
LDMFD sp!,
STMFD sp!,{<reglist>,lr}
{<reglist>,pc}^
N. Mathivanan
Exception
Except Processor Response to Enter Exception Handler Return Instruction Pri
Vector
SPSR_svc = CPSR
CPSR[4:0]= 10011B (SVC mode), If registers are not
CPSR[5] = 0 (ARM state) saved in stack
CPSR[6] unchanged, CPSR[7] = 1 (Disable IRQ)
r14_swi = addr of next instruction to SWI MOVS pc,lr
SWI 0x00000008 PC = 0x00000008 ;Exception vector 6
If saved:
Registers are saved in stack at entry using:
LDMFD sp!,
STMFD sp!,{<reglist>,lr}
{<reglist>,pc}^
SPSR_abt = CPSR
CPSR[4:0]= 10111B (Abort mode), If registers are not
CPSR[5] = 0 (ARM state) saved in stack
CPSR[6] unchanged, CPSR[7] = 1 (Disable IRQ)
Prefetch r14_abt = aborted instruction addr.+4 SUBS pc,lr,#4
0x0000000C PC = 0x0000000C ;Exception vector 5
Abort
SPSR_abt = CPSR
CPSR[4:0]= 10111B (Abort mode), If registers are
not saved in
CPSR[5] = 0 (ARM state) , CPSR[6] unchanged
stack
CPSR[7] = 1 (Disable IRQ)
r14_abt = aborted instruction addr.+8 SUBS pc,lr,#8
Data Abort 0x00000010 2
PC = 0x00000010 (Exception vector)
N. Mathivanan
Except Exception Return
Processor Response to Enter Exception Handler Pri
ion Vector Instruction
SPSR_irq = CPSR
If registers are
CPSR[4:0]= 10010B (IRQ mode), CPSR[5] = 0 (ARM state)
not saved in stack
CPSR[6] = unchanged, CPSR[7] = 1 (Disable IRQ)
r14_irq = last executed instruction addr.+8 SUBS pc,lr,#4
IRQ 0x00000018 PC = 0x00000018 ;Exception vector 4
SPSR_fiq = CPSR
If registers are
CPSR[4:0]= 10001B (FIQ mode), CPSR[5] = 0 (ARM state)
not saved in stack
CPSR[6] = 1 (Disable FIQ), CPSR[7] = 1 (Disable IRQ)
r14_fiq=last executed instruction addr.+8 SUBS pc,lr,#4
FIQ 0x0000001C PC = 0x0000001C ;Exception vector 3
N. Mathivanan
Debug Architecture
• Uses boundary scan technology and JTAG to access core
• JTAG can be used in programming, debugging, testing
• ARM7-TDMI is JTAG enabled
(to next cell)
Boundary Serial-out
Scan Cells Mode
• Scan chains - Scan cells linked to form chain around ARM macrocells
TAP provides JTAG signals to control boundary scan operation
Data can be shifted around from TDI to TDO, collected and probed
N. Mathivanan
• Host: PC running ARM debugger, allows setting break points/watch
point, examining contents of registers from host.
• EmbeddedICE forces ARM processor to debug state in which
processor is isolated from rest of the system
N. Mathivanan
Interface Signals
• Clocks & Timing signals Clocks and
timing
MCLK
nWAIT
TCK
TMS
ECLK TDI
nIRQ
• Processor mode signals Interrupts nFIQ
nTRUST
N. Mathivanan