0
20kviews
Explain set associative and associative cache mapping techniques.
1 Answer
0
299views

Set-Associative Mapping

  1. The direct mapped cache can hold maximum 256 words.

  2. The set-associative cache is an imported version of direct mapped cache organization, where multiple of 256 words can be stored, but with increased cost.

  3. In set-associative cache memory two or more words can be stored under the same index address. Each data word is stored together with its tag.

  4. The number of tag-data words under an index is said to form a set. If k number of words with their associated tags (i.e. set site = k) are stored under an index of cache,. Then the cache memory is called k-way set-associative.

  5. A 2-way set-associative memory is shown in figure, where two data words together with two tag values are stored in a single index address.

  6. For 2-way set-associative cache, the word length is 2(8 + 8) = 32 bits, since each tag requires 8 bits and each data word requires 8 bits. So, the cache memory size is now converted to 256 x 32. This means that the cache memory can hold 512 words of the main memory.

  7. When the CPU generates a memory address of 16.bit, the index value of 8-bits is used to access the cache. Then the tag field of CPU address is compared with both tags under the selected index of the 2-way set associative cache memory for bits. The comparison of tags in the set of cache memory is done using the associative search technique, which is why the mapping technique is called set-associative mapping.

  8. In this case, since multiple number of words is stored under a common index value the hit ratio improves compared to previous two techniques.

  9. If the set is full and a miss occurs in a set-associative cache, then one of the stored tag-data pairs must he replaced with a new pair value from the main memory.

enter image description here

Merits of set-associative cache:

The cache memory has highest hit ratio compared to other two cache memories.

Demerits of set-associative cache:

This is the most expensive memory. The cost increases as set size increases.

Please log in to add an answer.