Saturday 8 April 2017

Direct Mapping Cache

Cache is divided into lines and Main memory is divided into blocks.
In direct mapping cache,  all block numbers having same last bits will be mapped to one line in cache.
Hence the address generated by CPU is divided into 2 parts, block number and block offset.
by looking at the block number, you can identify to which line in cache we may find it.

As many block number will have same last bits, it is difficuilt to identify which block is mapped to this line in cache.

Hence the address generated by CPU is divided into 2 parts, block number and block offset.
Each block number is divided into 2 parts  : 1) tag and 2) cache line number

first bits in block number bits in logical address represent tag
and last bits represent cache line number. (number of bits used to represent cache line number depends on the number of lines present in cache. Remaining bits will be used to represent tag).

by seeing the cache line number bits , we can identify the cache line number and
by seeing the tag, we can identify which block is mapped in that cache.

No comments:

Post a Comment