Question:
A 4-way set-associative cache memory has a total size of 64 KB with a cache block size of 64 bytes. If the physical address is 32 bits, how many bits are used for Tag, Set Index, and Block Offset respectively?
एक 4-वे सेट-एसोसिएटिव कैश मेमोरी का कुल आकार 64 KB है और ब्लॉक आकार 64 बाइट्स है। यदि भौतिक पता 32 बिट्स का है, तो क्रमशः टैग, सेट इंडेक्स और ब्लॉक ऑफसेट के लिए कितने बिट्स का उपयोग किया जाएगा?
Options:
- 18 bits, 8 bits, 6 bits
- 16 bits, 10 bits, 6 bits
- 20 bits, 6 bits, 6 bits
- 17 bits, 9 bits, 6 bits
- 18 बिट्स, 8 बिट्स, 6 बिट्स
- 16 बिट्स, 10 बिट्स, 6 बिट्स
- 20 बिट्स, 6 बिट्स, 6 बिट्स
- 17 बिट्स, 9 बिट्स, 6 बिट्स
Correct Answer: a)
Explanation:
Step-by-step derivation:
1. Block size = 64 bytes = \(2^6\) bytes \(\implies\) Block Offset = 6 bits.
2. Total number of blocks in cache = \(\frac{\text{Cache size}}{\text{Block size}} = \frac{64\text{ KB}}{64\text{ B}} = \frac{2^{16}}{2^6} = 2^{10} = 1024\) blocks.
3. Since it is 4-way set associative, each set contains 4 blocks.
Number of sets = \(\frac{1024}{4} = 256 = 2^8\) sets \(\implies\) Set Index = 8 bits.
4. Tag bits = \(\text{Physical Address bits} – \text{Set Index} – \text{Offset} = 32 – 8 – 6 = 18\) bits.
Therefore: Tag = 18 bits, Set Index = 8 bits, Offset = 6 bits.
1. Block size = 64 bytes = \(2^6\) bytes \(\implies\) Block Offset = 6 bits.
2. Total number of blocks in cache = \(\frac{\text{Cache size}}{\text{Block size}} = \frac{64\text{ KB}}{64\text{ B}} = \frac{2^{16}}{2^6} = 2^{10} = 1024\) blocks.
3. Since it is 4-way set associative, each set contains 4 blocks.
Number of sets = \(\frac{1024}{4} = 256 = 2^8\) sets \(\implies\) Set Index = 8 bits.
4. Tag bits = \(\text{Physical Address bits} – \text{Set Index} – \text{Offset} = 32 – 8 – 6 = 18\) bits.
Therefore: Tag = 18 bits, Set Index = 8 bits, Offset = 6 bits.
गणना:
ब्लॉक आकार = 64 बाइट्स = \(2^6\) \(\implies\) ऑफसेट = 6 बिट्स
कुल ब्लॉक = \(64\text{ KB} / 64\text{ B} = 1024\)
सेटों की संख्या (4-वे) = \(1024 / 4 = 256 = 2^8\) \(\implies\) सेट इंडेक्स = 8 बिट्स
टैग बिट्स = \(32 – (8 + 6) = 18\) बिट्स।
अतः: 18 बिट्स, 8 बिट्स, 6 बिट्स।
ब्लॉक आकार = 64 बाइट्स = \(2^6\) \(\implies\) ऑफसेट = 6 बिट्स
कुल ब्लॉक = \(64\text{ KB} / 64\text{ B} = 1024\)
सेटों की संख्या (4-वे) = \(1024 / 4 = 256 = 2^8\) \(\implies\) सेट इंडेक्स = 8 बिट्स
टैग बिट्स = \(32 – (8 + 6) = 18\) बिट्स।
अतः: 18 बिट्स, 8 बिट्स, 6 बिट्स।