The previous ans given by me is wrong.
$\textbf{Multiplexer}$ is used in the Direct mapped cache.
The format of Direct mapped cache is
Tag |
Line Offset |
Word Offset |
Each main memory block gets mapped to a $\textbf{fixed block}$ in the cache memory and this is decided by formula
$\textbf{cache line( or block) = k % S}$ where
k is a block of main memory
S is the number of blocks of cache memory
CPU generated address is searched in the directed mapped cache format.
When CPU is looking for data then it is first searched in the cache memory by using $\text{Line Offset}$.
$\text{Why Line Offset is used first?}$ This is because each main memory block has contention to get mapped to same cache block. Once a block is selected then its tag is compared with CPU generated tag, if tag is matched then then one of the word from the selected block is sent to the CPU.
$\text{How a word is fetched from the selected cache block? }$ All the words in a block becomes input to the multiplexer and the $\text{CPU generated Word Offset}$ becomes the select line of the multiplexer which enables the particular input line and the desired word appears at the output from the set of words in a block.