Date post: | 15-Jul-2015 |
Category: |
Education |
Upload: | radhesham-khatri |
View: | 120 times |
Download: | 3 times |
What does Cache mean?The word CACHE means collections of items of same type stored in hidden place.
What does Memory mean?
The ability to remember information, experiences, and people
Cache brief:
Small amount of fast memory.
An auxiliary memory from which high speed retrieval is possible.
Sits between normal main memory and CPU May be located on CPU chip or module
Cache Importance :
If the ACTIVE portions of the program and data are place in a fast small memory,
the average memory access time can be REDUCED, thus reducing the total execution time of the program. Such a FAST SMALL MEMORY
is referred to as a CACHE MEMORY.
Cache
Main Memory
0123456789101112131415
0123
64 Words
Blocks(4 words)
Lines
16 Words
No of blocks in MAIN MEMORY =64/4 = 16
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
No of Lines in CACHE=16/4 = 4
0 0 0 1 0 1
Block No Block offset
5
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
24 25 26 27
28 29 30 31
32 33 34 35
36 37 38 39
40 41 42 43
44 45 46 47
48 49 50 51
52 53 54 55
56 57 58 59
60 61 62 63
Round Robin Order
0123456789101112131415
0123
Lines
Blocks
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
0123456789101112131415
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
24 25 26 27
28 29 30 31
32 33 34 35
36 37 38 39
40 41 42 43
44 45 46 47
48 49 50 51
52 53 54 55
56 57 58 59
60 61 62 63
Main Memory
0123456789101112131415
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
0123
Binary Representation
0 0 0 1 0 1
Block Number Block offset
LineTag
0
1
2
3
0 0
1 1
1 0
1 1
Tag LINE
0 0 0 0 0 0
0 0 0 0 0 1
0 0 0 0 1 0
0 0 0 0 1 1
Block NumberBlock offsetTag Line
0
1
Main Memory
0123456789101112131415
64 Words
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
24 25 26 27
28 29 30 31
32 33 34 35
36 37 38 39
40 41 42 43
44 45 46 47
48 49 50 51
52 53 54 55
56 57 58 59
60 61 62 63
5
0 ,1,2 ,3
1 1 0 1 0 0
1 1 0 1 0 1
1 1 0 1 1 0
1 1 0 1 1 1
Block NumberBlock offsetTag Line
52, 53, 54,55
1 : Direct Mapping
0 0 0 1 0 1
Block Number Block offset
LineTag
Main Memory
0123456789101112131415
64 Words
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
24 25 26 27
28 29 30 31
32 33 34 35
36 37 38 39
40 41 42 43
44 45 46 47
48 49 50 51
52 53 54 55
56 57 58 59
60 61 62 63
0
1
2
3
0 0
1 1
1 0
1 1
Tag LINE
Cache
1 : Direct Mapping
One- One
A main memory block can load into any line of cache
2 : Associative MappingMain Memory
0123456789101112131415
64 Words
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
24 25 26 27
28 29 30 31
32 33 34 35
36 37 38 39
40 41 42 43
44 45 46 47
48 49 50 51
52 53 54 55
56 57 58 59
60 61 62 63
Cache
0123
16 Words
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
0-15
Main Memory
0123456789101112131415
64 Words
Blocks(4 words)
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
24 25 26 27
28 29 30 31
32 33 34 35
36 37 38 39
40 41 42 43
44 45 46 47
48 49 50 51
52 53 54 55
56 57 58 59
60 61 62 63
Set
MAIN MEMORY size = 64
CACHE Size = 32Block size of Main Memory = 4
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
0123
2-way Set Associative
Sets = Lines/ Set SizeSets =8 / 2 = 4 Sets
Lines = Cache size / Block SizeLines = 32 / 4 = 8 Lines
Set Size = 2 Lines
0
1
2
3
4
5
6
7
Set 0
Set 1
Set 2
Set 3
0 0 0 1 0 1
Block Number Block offset
Set NoTag
0 1 1 0 1 1
cc
3 : Set Associative Mapping