Академический Документы
Профессиональный Документы
Культура Документы
Decana de America
Tecnologa de Memoria
Memoria
SRAM DRAM Magnetic disk
CPU
$ per GB
$400$1,000 $20$40 $0.08$0.1
Processor
Level 1
Level 2
Level n
Jerarquia de Memoria
Referencias
CPU L1 cache L2 cache 1 cycle ~1-5 cycles ~5-20 cycles ~40-80 cycles
Main memory
Clave de Estrategia de performance:
Memoria Cache
Son de tamao pequeo, Basadas en Fast SRAM, Buffer entre CPU y Memoria principal (Niveles) Utilizan los principios de Localidad Son administradas por controladores Basadas en accesos por bloques
CPU chip register file L1 cache cache bus ALU system bus memory bus I/O bridge main memory
L2 cache
bus interface
line 0 line 1
block 10
abcd
...
block 21
pqrs
...
block 30 wxyz
...
valid
Conj. 0: valid
tag
tag
0
0
1
1
B1
B1 B1 B1 E lineas por Conj.
tag tag
1 1
Conj. S-1:
Direccionando Cache
Address A: t bits
v Conj. 0: v v Conj. 1: v tag tag tag tag 0 0 0 0 v tag 0 0 1 B1 1 1 1 1 B1 B1 B1 B1
m-1
s bits
b bits
0
B1
El dato est en la cache si el tag de una lnea vlida en ese conjunto coincide con el tag de la direccin solicitada
Conj. 0: Conj. 1:
valid valid
tag tag
Conj. S-1:
valid
tag
cache block
tag tag
Conj. seleccionado
Conj. 1:
valid
tag
cache block
t bits
m-1
tag
s bits b bits 00 001 set index block offset0 Sistemas Digitales Mg. Juan Carlos Gonzales Surez
0110
(2)= ?
w0
w1 w2
w3
m-1
(3) If (1) y (2), Then cache hit, y extraigo datos s bits b bits desde block offset i 100 Else, set index block offset0 ir a buscar en memoria principal. Sistemas Digitales Mg. Juan Carlos Gonzales Surez
1 2
3 5 4 5
data
tag 2k lines
memoria
p-k-m
CPU
p-k-m
tag
Direccin de Memory
k
cache address
Mem.Principal
Tag.0
0 0 0 0 0 0
0 1 0 0 0 0 0 1 1
Tag.1
VD
Tag
Tag.2
Linea 0 1 2 . . 1021 1022 1023 0 1 2 . . 1021 1022 1023 0 1 2 . . 1021 1022 1023
Direccin 0 7 8 15 16 23 . . 8168 8176 8184 8192 8200 8208 . . 16360 16368 16376 16384 16392 16400 . . 24552 24560 24568
Direccin: 16360 Operacin: Read 003FE8h => 00000000001 1111111101 000 V D 1 0 Tag 1 Line Index 1021 Offset 0
0 1 2 4294959104 4294959112 4294959120
Tag.2047
1021 1022 1023 4294967272 4294967280 4294967288
Direccin: 16383 Operacin: Write 003FFFh => 00000000001 1111111111 111 V D 1 1 Tag 1 Line Index 1023 Offset 7
Direccin: 16382 Operacin: Read 003FFEh => 00000000001 1111111111 110 V D 1 1 Tag 1 Line Index 1023 Offset 6
V D 1 0
Tag 2
Offset 4
High-Order Bit Indexing 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Conj. 0:
valid valid
tag tag
valid
Conj. 1: valid
tag
tag
cache block
cache block
tag tag
Conj. Selecc.
valid
Conj. 1: valid
tag
tag
cache block
cache block
tag tag
cache block
cache block
tag
s bits b bits 00 001 set index block offset0 Sistemas Digitales Mg. Juan Carlos Gonzales Surez
1001 0110 w0 w1 w2 w3
=?
(2) t bits 0110 tag
m-1
(3) If (1) y (2), Then cache hit, y extraigo datos (block offset ) s bits b bits Else, i 100 ir a memoria principal. set index block offset0
Sistemas Digitales Mg. Juan Carlos Gonzales Surez
Mem.Principal
Tag.0
Tag.1
VD
Tag
Tag.2
Linea 0 1 2 . . 1021 1022 1023 0 1 2 . . 1021 1022 1023 0 1 2 . . 1021 1022 1023
Direccin 0 7 8 15 16 23 . . 8168 8176 8184 8192 8200 8208 . . 16360 16368 16376 16384 16392 16400 . . 24552 24560 24568
Direccin: 16360 Operacin: Read 003FE8h => 000000000011111111101 000 V D 1 0 Tag 2045 Offset 0
0 1 2 4294959104 4294959112 4294959120
Tag.2047
1021 1022 1023 4294967272 4294967280 4294967288
V D 1 1
Tag 2045
Offset 7
Direccin: 16382 Operacin: Read 003FFEh => 000000000011111111111 110 V D 1 1 Tag 2045 Offset 6
index
offset
address
Hit
Algoritmos de Reemplazo
Algoritmo implementado en Hardware (veloz)
Write Strategies
On a Hit Write Through. Escribe en cache y memoria. Write Back. Escribe cuando se reemplaza pgina de cache. On a miss:
Write Allocate. Asigna linea para escritura. Write NoAllocate. No asigna linea para escritura
Intel Caches
80386 no on chip cache 80486 8k using 16 byte lines and four way set associative organization Pentium (all versions) two on chip L1 caches Data & instructions Pentium 3 L3 cache added off chip Pentium 4 L1 caches 8k bytes 64 byte lines four way set associative L2 cache Feeding both L1 caches 256k 128 byte lines 8 way set associative L3 cache on chip
Multi-core Architecture
AMD ARCHITECTURE
L1
L2
L3
Gracias
Example
32-word memory 8-word cache (The addresses below are word addresses.)
Address Binary Cache block Hit or miss 22 10110 110 26 11010 010 22 10110 110 26 11010 010 16 10000 000 3 00011 011 16 10000 000 18 10010 010
Index Valid Tag Data 000 001 010 011 100 101 110 111