8
The Lord of the Cache Project 3

The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

Embed Size (px)

Citation preview

Page 1: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

The Lord of the CacheProject 3

Page 2: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

Caches

•Three common cache designs:•Direct-Mapped• store in exactly one cache line•Fully Associative•store in any cache line•Set Associative•store in a small set of cache lines

Page 3: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

V Tag Block

Tag Index Offset

=

hit? dataword select

32bits

Byte offset

Direct-mapped Cache

Page 4: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

V Tag Block

word select

hit? data

line select

= = = =

32bits

64bytes

Tag Offset

Fully Associative Cache

Page 5: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

word select

hit? data

line select

= =

32bits

64bytes

Tag Index Offset

2-way Set Associative Cache

Page 6: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

word selecthit? data

line select

= = =

32bits

64bytes

Tag Index Offset

3-way Set Associative Cache

Page 7: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

Cache Misses• Cold (aka Compulsory) Miss• Line is being referenced for the first time • Avoid by prefetching

• Conflict Miss• Line was in the cache, but has been evicted because

of another access with the same index• Avoid by increasing cache associativity

• Capacity Miss• line was in the cache, but has been evicted because

the cache is too small • Avoid by increasing cache size

Page 8: The Lord of the Cache Project 3. Caches Three common cache designs: Direct-Mapped store in exactly one cache line Fully Associative store in any cache

Cache Write Policies •Write-Through • Updates to a block in cache are immediately

written through to memory

•Write-Back• Updates to a block in cache are only written

back to memory when that block is evicted