Consider a computer with a 4-ways set-associative mapped cache of the…
2008
Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB. The number of bits in the TAG, SET and WORD fields, respectively are:
- A.
7, 6, 7
- B.
8, 5, 7
- C.
8, 6, 6
- D.
9, 4, 7
Attempted by 323 students.
Show answer & explanation
Correct answer: D
Final answer: 9, 4, 7
Step-by-step calculation:
Total address bits: main memory = 1 MB = 2^20 bytes, so address width = 20 bits.
WORD (block offset) bits: block size = 128 words = 128 bytes, so WORD = log2(128) = 7 bits.
SET bits: cache size = 8 KB = 8192 bytes; number of cache lines = 8192 / 128 = 64 lines. With 4-way set associativity, number of sets = 64 / 4 = 16, so SET = log2(16) = 4 bits.
TAG bits: TAG = address bits - SET bits - WORD bits = 20 - 4 - 7 = 9 bits.
Therefore the number of bits in the TAG, SET and WORD fields are 9, 4 and 7 respectively. The option listing "9, 4, 7" is correct.
A video solution is available for this question — log in and enroll to watch it.