How do we calculate tag bit, no of set, index bit and address bit in set associative array map in cache?

Companies Related Questions, Computer Archtecture 0 Comments

First One need to calculate no of block in cache, by dividing the total cache size by each cache line size

and then no of sets is evaluated by dividing no of block by x (x is way set associative )

 index bit : no of bit used to represent each cache line size

remaining address bits  are used as tag bits

for example

Example :  A 4-way set associative cache has a total size of 256KB. If each cache line
is of size 64 bytes, how many sets will be present in the cache? How
many address bits are needed as tag bits? Assume address size as 32
bits.
Total number of blocks in cache = 256K/64 = 4096.

Since the cache is 4 way set
associative, number of sets = 4096/4 = 1024 sets.
Given a 32 bit address and 64 byte cache line, address [5:0] is used to index into cache
line, address [15:6] is used to find out which set the address maps to (10 bits) and
remaining address bits [31:16] are used as tag bits.

Leave a Reply