Set-associative cache

Set-associative cache

Set-associative cache combines ideas of direct-mapped and fully-associative cache. The cache is divided into contiguous equal-sized sets.

A -way set-associative cache has multiple sets of $n$ blocks.

In a set-associative cache, each address maps to only one set: $$MM \text{ block number } \% \text{ number of sets}$$

A set-associative address is composed of the following: ?

  • uniquely identifies which main memory block is in the cache (in combination with the set)
  • uniquely identifies which set in the cache
  • uniquely identifies which word in the block

Link to original

title: Example 1: 4-way set-associative cache
![](https://git.is.horse/insert/university/obsidian-notes/-/raw/9d95afcbbdb7a4c77ca9f62b32e35c6f31e269e7/University/Year%201/Semester%201/4CCS1CS1%20Computer%20Systems%201/Week%209.%20Memory%20hierarchy%20and%20cache%20systems/Diagrams/Pasted%20image%2020211206130008.png)
title: Example 2: 4-way set-associative cache
![](https://git.is.horse/insert/university/obsidian-notes/-/raw/9d95afcbbdb7a4c77ca9f62b32e35c6f31e269e7/University/Year%201/Semester%201/4CCS1CS1%20Computer%20Systems%201/Week%209.%20Memory%20hierarchy%20and%20cache%20systems/Diagrams/Pasted%20image%2020211206130024.png)