35-Cache Memory Block Identification in Direct Mapping, Associate Mapping and Set Associate-06-03-2
35-Cache Memory Block Identification in Direct Mapping, Associate Mapping and Set Associate-06-03-2
Organization
• Course Code: BCSE205L
• Course Type: Theory (ETH)
• Slot: A2+TA2
• Timings:
Monday 14:00-14:50
Wednesday 15:00-15:50
Friday 16:00-16:50
Fully Associative
Tag
Offset
FCFS
Random
Write Through
Write back
Update Policies
Write around
Write allocate
Cache Memory Management Techniques
Index
Offset
Tag Index Offset
Set Associative
Fully Associative
Consider a example, If the cache has 4 lines (line 0 to line 3). Then according to the direct mapping where
the following blocks are present. 4, 8, 16, 16, 20, 12, and 24.
Even if there are many lines in the cache, they will never be used due to the direct mapping restriction. This
is the conflict miss issue with direct mapping.
• Hit latency is the amount of time it takes to determine if the needed block is in the cache or not.
• Even if a miss occurs, time is still consumed.
• Miss-latency is the term used to describe the amount of time needed to address a miss.
Here Number of lines are 4 and the Tag bit is just one bit.
There is a multiplexer, since there are 4 cache lines and one-bit
tag, the multiplexer size is 4by1.
To select (check or choose) which one among the 4 lines depends
on the line number in the CPU address field
Two multiplexers are required if the tag bits are two, with the first one
being connected to the first tag bit and the second one to the second
tag bit of a cache line.
Both multipliers are connected to the address filed line bits.
As seen in the picture, there are just two bits of address filed tag lines
in comparison to both multiplexer outlines.
• Here one comparator is sufficient. The reason is, we have to search only for one tag field (i.e., only for one
cache line, because here if the required block is present in the cache, it will present only in one particular
cache-line.).
• The important note is, even though there are k multiplexers but just consider the latency of one multiplexer
because all of them work in parallel.
• Therefore consider the latency of one multiplexer and one required size bits comparator. Most of cases
multiplexer delays are negligible.
• If the comparator delay is 10*k ns, where k is the number of tag bits and there are 2 bits in the tag field.
• Then what is the delay? 10*2=20ns
Dr. Venkata Phanikrishna B, SCOPE, VIT-Vellore
Hit Latency calculating in Direct mapping
Problem: Main memory size is 1GB and cache size is 1MB, the propagation delay of comparator size is 10Kns
then what is hit latency.
Solution: Find out the tags.
MM/Cache ratio=1GB/1MB=1*230/1*220=210
• What it means, 210 main memory blocks are map to one cache line.
• There for from these, 10 bits are required in the tag.
• Then comparator delay required is 10Kns =10*10ns=100ns
Note: In direct mapping, the required number of comparators are always one. Because we exactly know where to
look for (i.e., which cache line). If it presents there it hit. If it is not present there then miss and it also means that it
is not present anywhere in the cache.
FIFO
RANDOM
Block Replacement