Coa Memory Hierarchy Notes
Coa Memory Hierarchy Notes
• Memory Hierarchy
• Hit/Miss, IPC
• Cache: Set, Line size, Associativity
A Sahu 1 A Sahu 2
BANK HDD
Register Instruction Register
Home Locker DDR RAM PC
FILE Memory FILE
PC
CPU Unified Mem
Purse Cache CPU
L2 ory
Data
ALU IL1 DL1 ALU
Pocket Regs Memory
Speed Storage
A Sahu 5 A Sahu 6
A Sahu 1
CS521 CSE IITG 11/23/2012
Hierarchical structure
• Programmers want unlimited amounts of memory with low
latency
Speed CPU Size Cost/Bit
• Fast memory technology is more expensive per bit than
slower memory
• Solution: organize memory system into a hierarchy Fastest Memory
Smallest Highest
– Entire addressable memoryy spacep g
available in largest,
slowest memory
Memory
– Incrementally smaller and faster memories, each
containing a subset of the memory below it, proceed in
steps up toward the processor
• Temporal and spatial locality insures that nearly all references Memory
Memory
can be found in smaller memories
Slowest Biggest Lowest
– Gives the allusion of a large, fast memory being presented
to the processor
A Sahu 7 A Sahu 8
Processor‐Memory
100
Performance e Gap
10
Memory
1
1980 1985 1990 1995 2000 2005 2010
Year
A Sahu 11 A Sahu 12
A Sahu 2
CS521 CSE IITG 11/23/2012
0 0 0 0
2120 1 2120 1
2 2 2 2
2123 3 2123 3
4 4 4 4
5 5 5 5
6 6 4143 6
7 7 7 7
8 8 8 8
9 9 9 9
Tag index Line Tag index Line
Decimal Example, Direct mapped, Line size 10 Decimal Example, Direct mapped, Line size 10
A Sahu 17 A Sahu 18
A Sahu 3
CS521 CSE IITG 11/23/2012
0 0 0 0
2120 4143 1
2 2 2 2
2123 3 2123 3
4 4 4 4
5 5 5 5
4143 6 4143 6
7 7 7 7
8 8 8 8
9 9 9 9
Tag index Line Tag index Line
Decimal Example, Direct mapped, Line size 10 Decimal Example, Direct mapped, Line size 10
A Sahu 19 A Sahu 20
0 0 0 0 0 0 0 0
2120 1 1 1 2120 1 1 1
2 2 2 2 2 2 2 2
3 3 3 3 2123 3 3 3
4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5
6 6 6 6 6 6 6 6
7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9
Tag index Line Tag index Line Tag index Line Tag index Line
0 0 0 0 0 0 0 0
2120 1 1 1 2120 1 4143 1
2 2 2 2 2 2 2 2
2123 3 3 3 2123 3 3 3
4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5
4143 6 6 6 4143 6 6 6
7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9
Tag index Line Tag index Line Tag index Line Tag index Line
A Sahu 4
CS521 CSE IITG 11/23/2012
Cache Size
• No of Set (Depend on index field) • Simple Hashing: Direct Map Cache
• Associatively (How many Tag) – Example: Array Direct/Random
• Line size (No of Addressable units/byte in a U – int A[10], each can store one element Access to
S – Data stored in Address%10 location Element
line) A
0 0 0 0 0 0 0 0 B • Array of List T
2120 1 4143 1 2120 1 4143 1 I I
2 2 2 2 2 2 2 2
L
– Int LA[10], each can store a list of element M
2123 3 3 3 2123 3 3 3 MIXED
4 4 4 4 4 4 4 4 I – Data stored in List of (Address%10)th location E
5 5 5 5 5 5 5 5
4143 6 6 6 4143 6 6 6 T – List size is limited in Set Associative Cache
7 7 7 7 7 7 7 7 Y
8
9
8
9
8
9
8
9
8
9
8
9
8
9
8
9
• List of Element
Tag index Line Tag index Line Tag index Line Tag index Line – Full Associative Cache Serial/Associative Access
• Cache Size = Nset X Associativity X LineSize – All data stored in one list to Element
= 10 x 4 x 10 = 400 Byte
A Sahu 25 A Sahu 26
A Sahu 27 A Sahu 28
... ...
... ...
1023 20 32 1023 16 32 32 32 32
= =
Mux
A Sahu 29 A Sahu 30
A Sahu 5
CS521 CSE IITG 11/23/2012
A Sahu 6