Documente Academic
Documente Profesional
Documente Cultură
Outline
ARM Processor Core
Memory Hierarchy
Software Development
Summary
Register Bank
control
address register
P
C
incrementer
PC
register
bank
Barrel Shifter
instruction
decode
A
L
U
b
u
s
multiply
register
&
b
u
s
b
u
s
barrel
shifter
control
ALU
ALU
Address register and
incrementer
Data Registers
Hold data passing to and from
memory
data in register
D[31:0]
Fetch
The instruction is fetched from memory and placed in the instruction pipeline
Decode
The instruction is decoded and the datapath control signals prepared for the
next cycle
Execute
The register bank is read, an operand shifted, the ALU result generated and
written back into destination register
SOC Consortium Course Material
Multi-Cycle Instruction
address register
increment
increment
Rd
Rd
PC
registers
registers
Rn
PC
Rn
Rm
mult
mult
as ins.
as ins.
as instruction
as instruction
[7:0]
data out
data in
i. pipe
data out
data in
i. pipe
address register
increment
increment
Rn
PC
PC
registers
registers
Rd
Rn
mult
mult
shifter
lsl #0
=A + B /A - B
=A / A+ B / A- B
[11:0]
data out
data in
i. pipe
byte?
data in
i. pipe
Branch Instructions
address register
address register
increment
increment
R14
registers
registers
PC
PC
mult
mult
lsl #2
shifter
=A+ B
=A
[23:0]
data out
data in
i. pipe
data out
data in
i. pipe
The third cycle, which is required to complete the pipeline refilling, is also
used to mark the small correction to the value stored in the link register
in order that is points directly at the instruction which follows the branch
SOC Consortium Course Material
10
11
12
Fetch
+4
I-cache
fetch
pc + 4
pc + 8
I decode
r15
instruction
decode
register read
immediate
fields
mul
LDM/
STM
+4
postindex
reg
shift
shift
pre-index
execute
ALU
forwarding
paths
mux
B, BL
MOV pc
SUBS pc
D-cache
buffer/
data
rot/sgn ex
LDR pc
register write
Decode
The instruction is decoded and
register operands read from the
register files. There are 3 operand
read ports in the register file so most
ARM instructions can source all their
operands in one cycle
Execute
byte repl.
load/store
address
write-back
13
Buffer/Data
+4
I-cache
fetch
pc + 4
pc + 8
I decode
r15
instruction
decode
register read
immediate
fields
mul
LDM/
STM
+4
postindex
reg
shift
shift
pre-index
execute
ALU
Write back
The result generated by the
instruction are written back to the
register file, including any data
loaded from memory
forwarding
paths
mux
B, BL
MOV pc
SUBS pc
byte repl.
load/store
address
D-cache
buffer/
data
rot/sgn ex
LDR pc
register write
write-back
14
Pipeline Hazards
There are situations, called hazards, that prevent the next
instruction in the instruction stream from being executing
during its designated clock cycle. Hazards reduce the
performance from the ideal speedup gained by pipelining.
There are three classes of hazards:
Structural Hazards
They arise from resource conflicts when the hardware cannot support all
possible combinations of instructions in simultaneous overlapped
execution.
Data Hazards
They arise when an instruction depends on the result of a previous
instruction in a way that is exposed by the overlapping of instructions in
the pipeline.
Control Hazards
They arise from the pipelining of branches and other instructions that
change the PC
SOC Consortium Course Material
15
Structural Hazards
When a machine is pipelined, the overlapped
execution of instructions requires pipelining of
functional units and duplication of resources to
allow all possible combinations of instructions in
the pipeline.
If some combination of instructions cannot be
accommodated because of a resource conflict, the
machine is said to have a structural hazard.
16
Example
A machine has shared a single-memory pipeline
for data and instructions. As a result, when an
instruction contains a data-memory reference
(load), it will conflict with the instruction reference
for a later instruction (instr 3):
Clock cycle number
instr
load
IF
ID
EX
MEM
WB
IF
ID
EX
MEM
WB
IF
ID
EX
MEM
WB
IF
ID
EX
MEM
Instr 1
Instr 2
Instr 3
WB
17
Solution (1/2)
To resolve this, we stall the pipeline for one clock
cycle when a data-memory access occurs. The
effect of the stall is actually to occupy the
resources for that instruction slot. The following
table shows how the stalls are actually
implemented.
Clock cycle number
instr
load
IF
ID
EX
MEM
WB
IF
ID
EX
MEM
WB
IF
ID
EX
MEM
WB
stall
IF
ID
EX
Instr 1
Instr 2
Instr 3
MEM
WB
18
Solution (2/2)
Another solution is to use separate instruction and
data memories.
ARM belongs to the Harvard architecture, so it does
not suffer from this hazard
19
Data Hazards
Data hazards occur when the pipeline changes the
order of read/write accesses to operands so that the
order differs from the order seen by sequentially
executing instructions on the unpipelined machine.
Clock cycle number
ADD
R1,R2,R3
SUB
R4,R5,R1
AND
R6,R1,R7
OR
R8,R1,R9
XOR
R10,R1,R11
IF
ID EX
MEM WB
IF
IDsub
EX
MEM WB
IF
IDand
EX
MEM WB
IF
IDor
EX
MEM WB
IF
IDxor
EX
MEM WB
20
Forwarding
The problem with data hazards, introduced by this
sequence of instructions can be solved with a
simple hardware technique called forwarding.
ADD
R1,R2,R3
SUB
R4,R5,R1
AND
R6,R1,R7
IF
ID
EX
MEM
WB
IF
IDsub
EX
MEM
WB
IF
IDand
EX
MEM
WB
21
Forwarding Architecture
next
pc
+4
I-cache
fetch
pc + 4
pc + 8
I decode
r15
instruction
decode
register read
immediate
fields
mul
LDM/
STM
+4
postindex
reg
shift
shift
pre-index
execute
ALU
forwarding
paths
mux
B, BL
MOV pc
SUBS pc
byte repl.
load/store
address
D-cache
buffer/
data
rot/sgn ex
LDR pc
register write
Forwarding works as
follows:
write-back
22
Forward Data
Clock cycle number
ADD
R1,R2,R3
SUB
R4,R5,R1
AND
R6,R1,R7
IF
ID
EXadd
MEMadd WB
IF
ID
EXsub
MEM
WB
IF
ID
EXand
MEM
WB
23
Without Forward
Clock cycle number
ADD
R1,R2,R3
SUB
R4,R5,R1
AND
R6,R1,R7
IF
ID
EX
MEM
WB
IF
stall stall
IDsub
EX
MEM WB
stall stall
IF
IDand
EX
MEM WB
24
Data Forwarding
Data dependency arises when an instruction needs to use
the result of one of its predecessors before the result has
returned to the register file => pipeline hazards
Forwarding paths allow results to be passed between stages
as soon as they are available
5-stage pipeline requires each of the three source operands
to be forwarded from any of the intermediate result registers
Still one load stall
LDR rN, []
ADD r2,r1,rN ;use rN immediately
One stall
Compiler rescheduling
25
LDR
R1,@(R2)
SUB
R4,R1,R5
AND
R6,R1,R7
OR
R8,R1,R9
IF
ID
EX MEM
WB
IF
ID
EXsub
MEM
WB
IF
ID
EXand
MEM
WB
IF
ID
EXE
MEM
WB
26
LDR
R1,@(R2)
SUB
R4,R1,R5
AND
R6,R1,R7
OR
R8,R1,R9
IF
ID
EX MEM WB
IF
ID
stall
EXsub
MEM
WB
IF
stall
ID
EX
MEM
WB
stall
IF
ID
EX
MEM
WB
27
LDR Interlock
28
Optimal Pipelining
29
30
31
32
scan chain 0
Embedded
ICE
opc, r/w,
mreq, trans,
mas[1:0]
A[31:0]
processor
core
D[31:0]
Din[31:0]
Dout[31:0]
other
signals
scan chain 1
bus
splitter
JTAG TAP
controller
33
34
mclk
wait
eclk
configuration
bigend
interrupts
irq
q
isync
initialization
reset
bus
control
enin
enout
enouti
abe
ale
ape
dbe
tbe
busen
highz
busdis
ecapclk
debug
coprocessor
interface
power
dbgrq
breakpt
dbgack
exec
extern1
extern0
dbgen
rangeout0
rangeout1
dbgrqi
commrx
commtx
opc
cpi
cpa
cpb
Vdd
Vss
A[31:0]
Din[31:0]
Dout[31:0]
D[31:0]
bl[3:0]
r/w
mas[1:0]
mreq
seq
lock
ARM7TDMI
core
memory
interface
trans
mode[4:0]
abort
MMU
interface
Tbit
state
tapsm[3:0]
ir[3:0]
tdoen
tck1
tck2
screg[3:0]
TAP
information
drivebs
ecapclkbs
icapclkbs
highz
pclkbs
rstclkbs
sdinbs
sdoutbs
shclkbs
shclk2bs
boundary
scan
extension
TRST
TCK
TMS
TDI
TDO
JTAG
controls
35
Memory interface
32-bit address A[31:0], bidirectional data bus D[31:0], separate data
out Dout[31:0], data in Din[31:0]
\mreq indicates that the memory address will be sequential to that
used in the previous cycle
mreq
0
0
1
1
s eq
0
1
0
1
Cy cl e
N
S
I
C
Us e
Non-sequential memory access
Sequential memory access
Internal cycle bus and memory inactive
Coprocessor register transfer memory inactive
SOC Consortium Course Material
36
MMU interface
\trans (translation control), 0: user mode, 1: privileged mode
\mode[4:0], bottom 5 bits of the CPSR (inverted)
Abort, disallow access
State
T bit, whether the processor is currently executing ARM or Thumb
instructions
Configuration
Bigend, big-endian or little-endian
SOC Consortium Course Material
37
Initialization
\reset, starts the processor from a known state, executing from
address 0000000016
ARM7TDMI characteristics
Process
Metal layers
Vdd
0.35 um
3
3.3 V
Transistors
Core area
Clock
74,209
2
2.1 mm
0 to 66 MHz
MIPS
Power
MIPS/W
60
87 mW
690
38
Memory Access
The ARM7 is a Von Neumann, load/store
architecture, i.e.,
Only 32 bit data bus for both instr. and data.
Only the load/store instr. (and SWP) access
memory.
39
Non-sequential (N cycle)
(nMREQ, SEQ) = (0, 0)
The ARM core requests a transfer to or from an address which is unrelated to
the address used in the preceding address.
Internal (I cycle)
(nMREQ, SEQ) = (1, 0)
The ARM core does not require a transfer, as it performing an internal
function, and no useful prefetching can be performed at the same time
40
ARM720T
ARM710T
8K unified write through cache
Full memory management unit
supporting virtual memory
Write buffer
ARM 740T
8K unified write through cache
Memory protection unit
Write buffer
41
ARM8
Higher performance than ARM7
By increasing the clock rate
By reducing the CPI
Higher memory bandwidth, 64-bit wide memory
Separate memories for instruction and data accesses
ARM
8
Core Organization
ARM9TDMI
ARM10TDMI
prefetch
unit
addresses
PC instructions
memory
(doublebandwidth)
read data
write data
integer
unit
CPinst. CPdata
coprocessor(s)
42
Pipeline Organization
5-stage, prefetch unit occupies the 1st stage,
integer unit occupies the remainder
(1) Instruction prefetch
Prefetch Unit
Integer Unit
43
PC+8
coprocessor
instructions
inst. decode
decode
register read
coproc
data
multiplier
execute
ALU/shifter
write
pipeline
+4
mux
write
data
address
memory
read
data
forwarding
paths
rot/sgn ex
write
register write
44
ARM8 Macrocell
ARM810
virtual address
8 Kbyte cache
(doublebandwidth)
prefetch
unit
PC instructions
read data
ARM8 integer
unit
write data
CPinst.
CPdata
copy-back tag
CP15
copy-back data
JTAG
write buffer
MMU
physical address
address buffer
data in
data out
address
45
ARM9TDMI
Harvard architecture
Increases available memory bandwidth
Instruction memory interface
Data memory interface
5-stage pipeline
Changes implemented to
Improve CPI to ~1.5
Improve maximum clock frequency
46
ARM9TDMI Organization
next
pc
+4
I-cache
fetch
pc + 4
pc + 8
I decode
r15
instruction
decode
register read
immediate
fields
mul
LDM/
STM
+4
post index
reg
shift
shift
pre-index
execute
ALU
forwarding
paths
mux
B, BL
MOV pc
SUBS pc
byte repl.
load/store
address
buffer/
data
D-cache
rot/sgn ex
LDR pc
register write
write-back
47
Fetch
instruction
fetch
Decode
Thumb
decompress
Execute
ARM
decode
reg
read
shift/ALU
reg
write
shift/ALU
data memory
access
reg
write
Execute
Memory
ARM9TDMI:
instruction
fetch
decode
Fetch
Decode
r. read
Write
Not sufficient slack time to translate Thumb instructions into ARM instructions and
then decode, instead the hardware decode both ARM and Thumb instructions
directly
SOC Consortium Course Material
48
On-chip debugger
Additional features compared to ARM7TDMI
Hardware single stepping
Breakpoint can be set on exceptions
ARM9TDMI characteristics
Process
Metal layers
Vdd
0.25 um
3
2.5 V
Transistors
Core area
Clock
110,000
2
2.1 mm
0 to 200 MHz
MIPS
Power
MIPS/W
220
150 mW
1500
49
virtual IA
instruction
cache
instruction
MMU
external
coprocessor
interface
data
data
cache
virtual DA
instructions
CP15
data
MMU
EmbeddedICE
& JTAG
AMBA interface
physical DA
ARM9TDMI
write
buffer
2 16K caches
Full memory
management unit
supporting virtual
addressing and
memory protection
Write buffer
physical
address tag
copy-back DA
physical IA
AMBA AMBA
address data
50
Protection Unit
instruction
cache
data
cache
2 4K caches
Memory protection
Unit
Write buffer
AMBA interface
write
buffer
data
EmbeddedICE
& JTAG
data address
I address
instructions
ARM9TDMI
AMBA AMBA
address data
51
Architecture v5TE
ARM946E-S
ARM9E-S core
Instruction and data caches, selectable sizes
Instruction and data RAMs, selectable sizes
Protection unit
AHB bus interface
SOC Consortium Course Material
52
ARM10TDMI (1/2)
Current high-end ARM processor core
Performance on the same IC process
ARM10TDMI
ARM9TDMI
ARM7TDMI
branch
prediction
instruction
fetch
Fetch
decode
Issue
data memory
access
r. read
decode
shift/ALU
multiply
multiplier
partials add
Decode
Execute
Memory
data
write
reg
write
Write
53
ARM10TDMI (2/2)
Reduce CPI
Branch prediction
Non-blocking load and store execution
64-bit data memory transfer 2 registers in each cycle
54
ARM1020T Overview
Architecture v5T
ARM1020E will be v5TE
CPI ~ 1.3
6-stage pipeline
Static branch prediction
32KB instruction and 32KB data caches
hit under miss support
ARM1020T
VFP10
SDRAM memory interface
PLL
SOC Consortium Course Material
55
Summary (1/2)
ARM7TDMI
Von Neumann architecture
3-stage pipeline
CPI ~ 1.9
ARM9TDMI, ARM9E-S
Harvard architecture
5-stage pipeline
CPI ~ 1.5
ARM10TDMI
Harvard architecture
6-stage pipeline
CPI ~ 1.3
SOC Consortium Course Material
56
Summary (2/2)
Cache
Direct-mapped cache
Set-associative cache
Fully associative cache
Software Development
CodeWarrior
AXD
57
References
[1] http://twins.ee.nctu.edu.tw/courses/ip_core_02/index.html
[2] ARM System-on-Chip Architecture by S.Furber, Addison
Wesley Longman: ISBN 0-201-67519-6.
[3] www.arm.com
58