in CO and Architecture retagged by
312 views
1 vote
1 vote
What does tag number signifies in line in cache?
in CO and Architecture retagged by
312 views

1 Answer

1 vote
1 vote

Let's assume we have a main memory of 16 bytes($2^{4},m=4$)(16 memory locations each of 1 byte)  and a cache of 4(or $2^{k}$,k=2 )bytes(4 locations each 1 byte).Also,assume that block size is 1 byte for the sake of simplicity.

Now, we know lower k bits of the main memory is used to index the block in which the cache should be placed(k=2).Following example will illustrate how it works out:-

Main Memory to Cache mapping

Suppose,contents of Main Memory address(1110) is to be mapped to location "10",as it's lower k(2) bits are "10".Also, contents of Main Memory address(0010,0110,1010,1110) all will be mapped to the same location.Or, in general anything with lower order k bits as "10 in this case" will be mapped to the same cache block.Now,the only way to identify which memory address has been mapped is to know the higher (m-k or 4-2=2 bits of the address of MM).Tag bits store upper (m-k) bits of the main memory address and when it's concatenated with the lower "k" bits we get the actual address which has been mapped.In the above example, "11 is the upper m-k(2) bits"or tag bits and when it is concatenated with lower "10" bits or index bits we get the address.

 

edited by

Related questions