HOW TO FIND TAG FIELD , CACHE SIZE , BLOCK SIZE AND NUMBER OF SET IN COMPUTER ORGANISATION?


QUESTION:   A CPU generates 32-bit addresses. The block size is 4 K Bytes. The processor has a Cache which can hold a total of 128 blocks and is 4-way set associative. The minimum size of the cache tag is:

ANSWER:

Firstly, write given information in the question.

CPU generates 32-bit addresses

block size is 4 K means 4 × 2^10 = 2^12.

Cache size = 128 blocks means 2^7

4-way set associative means, each set has 4 elements and the block corresponding to that block can fit any where in those. so number of set is ( cache size/ 4 )= 128/4 = 32 = 2^5.

total size of main memory in blocks = 2^(32−12)=2^20.

TAG = 20 – 5 = 15 bits.

In end,

Tag is 15 bits

Number of set is 5 bits.

Block size is 12 bits.

Total 32 bits which is generated by CPU

Leave a comment