In: Computer Science
Discuss the cache mapping techniques as applied in embedded systems [10]
Embedded Systems
Cache Memory Mapping:
Cache memory mapping means how the main memory data will get mapped onto the cache memory. And it is not moved it is copied that means the data will remain in the main memory but and also it's replica will get dumped onto the cache memory. So, Cache mapping can be three types:
1. Direct Mapping
2. Associative Mapping
3. Set-associative Mapping
Direct Mapping:
The main memory has 4096 pages. pages are the main memory will be divided into equal sized fragment. Each and every page has a certain number of locations. suppose we consider it has 16 location.
If 4096 pages and 16 locations then 4096*16
=2^2*2^10*2^4
= 2^16
so, 16 bits addresses are there. From the 16 bit address out of 12 bits denoting the page number. And 4 bit offset are there from the 16 bit address. Each and every program has got locality of reference. And lso it has 128 frames.This locality of reference is the instruction which is executing now and the next instruction which is going to execute probability is highest that it will be in the visility of the previous program which is in executing right now. That means the next instruction which is supposed to be executed will be near by to the current instruction which is getting executed right now. Each block of main memory maps to only one cache line.
Associative Mapping:
CAM content addressable memory is playing a very vital role in associative mapping. Unlike direct mapping here main memory any page can be loaded onto the cache memory any frame. Suppose we are having 12 bit memory page number and we are having 4 bits main memory page offset. In CAM this 12 bits is searched. In CAM there are many locations page number respective the frame number. CAM will allow parallel searching. CAM word needs 19 bits per CAM word which is a very big disadvantage.
Set-associative Mapping:
Here cache memory is divided into number of sets. Each sets contains a number of lines. If there is 2 lines per set then 2 way set associative mapping 2 given block can be in one of 2 lines.