Computer Science, asked by gauravgoel998, 1 year ago

a set-associative cache consists of 64 lines, or slots, divided into four-line sets. main memory contains 4k blocks of 128 words each. show the format of main memory addresses

Answers

Answered by shubhamjoshi033
70

Number of sets = 64/4 = 16

=> The cache is divided into 16( =  2⁴) sets

Therefore, 4 bits are needed to identify the set number.

Main memory consists of 4K = 2¹² blocks.

Therefore, the  set + tag lengths must be 12 bits  

tag length = 12 - 4 = 8

Each block contains 128 words = 2⁷ words

Therefore, 7 bits are needed to specify the word field

So the main memory can be represented as

TAG                 SET             WORD

 8                          4                  7

Answered by Sidyandex
17

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

Similar questions