Q1.
a. A block-set-associative cache consists of a total 64 blocks divided into 4 - block sets. The main memory contains 4096 blocks, each consisting of 128 words. Find: i. How many bits are there in the main memory address? Ii. How many bits are there in tag ,set and word field
Answers
i)The main memory size = 4096 blocks
= 2¹²
Each block consist of 128 words = 2⁷ words
Hence total size of main memory in word lengths
= 2¹² x 2⁷
= 2¹⁹
Hence there will be 19 bits in the main memory
ii)The main memory size = 4096 blocks
= 2¹²
Hence the tag and set field combine will have 12 bits.i.e.
TAG + SET = 12
Number of sets = 64/4 = 16
=> The cache is divided into 16( = 2⁴) sets
SET = 4
=> TAG = 12-4 = 8
Each block consist of 128 words = 2⁷ words
Hence the word field length will be 7 bits
Hence there are 8,4,7 bits in tag set and word field respectively.
Ans. main memory size is = 4096 blocks = 2¹²
Every block consist of 128 words = 2⁷ words
Therefore the total size of main memory in length of words = 2¹² x 2⁷
= 2¹⁹
So, there is at least 19 bits in the main memory.
ii) Size of the main memory = 4096 blocks = 2¹²
Therefore, the tag and set the field in a combined manner will consist of 12 bits.i.e. TAG + SET = 12
So, the Number of sets is = 64/4 = 16
=> The cache is then divided into 16(= 2⁴) sets
SET = 4
=> TAG = 12-4 = 8
Every block contains of 128 words = 2⁷ words
Hence the word field length will be 7 bits. 8, 4, 7 bits respectively are in the tag set and word field.