Associative memory and set associative memory mapping
The document discusses cache memory mapping techniques, specifically fully-associative and set-associative mappings, highlighting their advantages and drawbacks, such as conflict and capacity misses. It outlines the calculations necessary for determining tag, set-offset, and word-offset, using a specific cache size example with various associations. The document also includes details on tag-directory size computation based on given parameters.
Fully-Associative Mapping
Indirect mapping, though cache memory block is vacant still conflict misses
occurs.
To overcome this problem Tag bit and cache-offset field is combined.
So main memory block can be stored anywhere.
Physical address is divided into two parts.
Word-offset
Tag
Tag Word-offset
3.
Problem using filly-associativemapping
Cache memory size= 64KB
Block size= 32B
Number of bits given for main memory addressing= 32
Find number of bits required for tag and word-offset?
Solution: -
Block size=32B
Block offset= log225=5
Tag= 32-5=27
Tag = 27 Word-offset = 5
32
4.
Set-associative Mapping
Draw backin direct mapping:-
Compulsory miss occurs.
conflict miss occurs.
Cache memory could not be used effectively.
Draw back in fully-associative mapping:-
Compulsory miss occurs.
Capacity miss occurs.
To over come the loopholes present in both mapping Set-associative mapping
technique is used.
5.
Contd…
Cache linesare grouped into sets.
Particular block of main memory is mapped to particular set of cache lines.
Within the set, block can be mapped to the free cache lines.
To find the set number :-
set number= main memory block number % Number of sets in cache.
Physical address is divided into three parts.
Block-offset
Set-offset
Tag
Tag Set-offset Block-offset
6.
Problem using set-associativemapping
Cache memory size=64KB
Main memory size=4GB
Block size=32B , 4-way associative
Find tag, set-offset and word-offset?
Solution:- Number of blocks in cache = size of cache memory / Block size
=64KB / 32B = 2KB =21 x 210 =211
Number of sets in cache = no of blocks in cache / associativity
= 2KB/4 = 211 / 24 = 29
Set offset = log229 =9
7.
Contd…
Block size =32B
Numberof bits required for word offset= log225=5
Size of main memory =4GB= 22 x 230 = 232
Number of bits required for memory addressing
= log2232 =32
Tag = 32-(set-offset + word-offset)
= 32 – (9+5) =18
Tag=18 Set-offset=9 Block-offset=5
8.
Tag-directory size computation
Tag-directory size = Tag x number of blocks
=18 x 211
= 36 x 210
= 36B
Tag-directory size= (tag + number of extra bits given) x (number of blocks)
[if in question it is given that number of dirty_bits=1 and number of modified
bit =2]
Tag-directory size = (18 + 1+ 2) x 211
= 21 x211
= 42 x 2 10
= 42KB