What is Direct Mapping Process in Computer Architecture?


Direct mapping is a procedure used to assign each memory block in the main memory to a particular line in the cache. If a line is already filled with a memory block and a new block needs to be loaded, then the old block is discarded from the cache.

The figure shows how multiple blocks from the example are mapped to each line in the cache.

Just like locating a word within a block, bits are taken from the main memory address to uniquely describe the line in the cache where a block can be stored.

Example − Consider a cache with = 512 lines, then a line would need 9 bits to be uniquely identified.

Direct mapping divides an address into three parts: t tag bits, l line bits, and w word bits. The word bits are the least significant bits that identify the specific word within a block of memory.

The line bits are the next least significant bits that identify the line of the cache in which the block is stored. The remaining bits are stored along with the block as the tag which locates the block’s position in the main memory.

Updated on: 03-Nov-2023

23K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements