• retagged by
5,767 views
0 0 votes
Is there any multiplexer(s) present in the implementation of Direct Mapped Cache?

If yes, then the Hit latency would be Multiplexer latency + Comparator Latency?

3 Answers

2 2 votes

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.

• edited by
0 0 votes

There is no multiplexer present in the $\text{Direct mapped cache}$ but it is used in $\text{Set associative cache}$. The format of Direct mapped cache is

      Tag                         Line Offset             Word Offset

So only comparator is required to to match with tag bits, and once tags are matched that line is selected.

$\textbf{PS:- Edit}$

There are two scenarios:

$\underline{\textbf{1) When Cache is empty or some needed block is not present in the cache : -}}$

Each main memory block gets mapped to a fixed block in the cache memory. So when a block is not present in the cache then main memory block is added to particular fixed block in cache memory and this is decided by formula

$\textbf{cache line( or block) = k % S}$ where

$\text{k is block of main memory}$

$\text{S is number of blocks of cache memory}$

$\underline{\textbf{2) When desired cache block is present in the cache memory: - }}$

When CPU is looking for some data then it searches within the blocks present in the cache memory. In order to find the correct cache block(or line) it uses comparator to match with tag bits. If the one of the tag bits gets matched with the CPU generated tag bits then that block is send to the CPU otherwise(when desired block is not present in the cache memory) desired main memory block is brought to the cache memory using above formula $k \% S$.

For more reference: Refer slide number 14

https://web.stanford.edu/class/ee282h/handouts/Handout28.pdf

• reshown by
0 0 votes
bhai manlo
cpu ne address generate kiya h
apan ne ab use three parts me divide krdiya
tag me
index(line offset me)
block offset me
now apan
jab cpu address generate krega
to index bit dekhenge sabse phle un bits ko decoder se decode krke wo cache ki line activate krdenge
ab us line ke respect me tag bit and valid bit h unko comparator se check krke dekhlenge ki data h ya nhi
agar valid bit 1 and tag bit bhi same h mtlab cache line me jo data cpu mang rha h wahi h
now cache line me to pura block h or cpu mang rha h 1 byte
so block me jyda data h manlo 4 byte hoga
and apan ko chahiye 1byte
to us 4 (00,01,10,11) block offset me se ek chahiye
to ek mux lagega exact byte pata kne ke liye
Position:
Show:

Related questions

0 0 votes
2 2 answers
1.7k
1.7k views
Mojo-Jojo asked Jan 11, 2016
1,653 views
If we are given direct mapped cache, we have to add Multiplexer delay to the comparator delay ?
0 0 votes
1 1 answer
945
945 views
S Ram asked Jan 12, 2019
945 views
Can we apply LRU policy to direct mapped cache. according to me it doesn't make any sense as eventually it will be like FIFO only as unique memory addresses are assigned ...
0 0 votes
0 0 answers
1.3k
1.3k views
Na462 asked Aug 4, 2018
1,288 views
Ans. 1
1 1 vote
1 answers 1 answer
2.3k
2.3k views