a block set associative cache consists of a total of 64 blocks divided into 4-blocks sets.the main memory contains 4096 blocks,each consisting of 128 words.a) how many bits are there in main memory address
Answers
There will be 19 bits in the main memory
EXPLANATION:
The main memory size = 4096 blocks
= 2¹²
Hence the tag and set field combine will have 12 bits.
Each block consist of 128 words = 2⁷ words
Hence the word field length will be 7 bits
Hence total size of main memory in word lengths
= 2¹² x 2⁷
= 2¹⁹
Hence there will be 19 bits in the main memory
I hope this helps.
The format comprises of Tag, Set and Word
We need to find out the number of bits that are required for SET field
There are 64 Cache lines that are distributed in a set of 4 lines
Therefore, number of lines= 64/4 = 16 lines
Hence Cache needs 4-bit SET field
Number of memory locations= 4 * 1024 = 4096
12 bits comprise of both SET field and TAG field
Therefore
SET + TAG = 12
That is , 4 + TAG = 12
Therefore TAG = 8
For WORD field
128 words are present in each block
Therefore number of bits required = 7 ( since 2 to the power 7 = 128)
Thus, the main memory address format is as follows:
TAG field SET field WORD field
8 bits 4 bits 7 bits