ES Test Assignment Sol.
ES Test Assignment Sol.
i) Memory mapping
Offset- One line of cache word has 32 bit words- 4 bytes thus require 2 bits. Note that it is byte
addressable.
5 3 2
[5]
ii) Cache contents
Direct Mapping
Main memory:
Main memory
1
Address Parameters Block Number ACCESS
Hex Binary Tag Index Offset (Tag+index
(Decimal)
54 00 0101 0100 00010 101 00 21 M
LB 21
58 00 0101 1000 00010 110 00 22 M
LB22
104 01 0000 0100 01000 001 00 65 M
LB65
5C 00 0101 1100 00010 111 00 23 M
LB23
108 01 0000 1000 01000 010 00 66 M
LB 66
60 00 0110 0000 00011 000 00 24 M
LB 24
F0 00 1111 0000 00111 100 00 60 M
LB 60
64 00 0110 0100 00011 001 00 25 M
LB 25
R65
54 00 0101 0100 00010 101 00 21 H
58 00 0101 1000 00010 110 00 22 H
10C 01 0000 1100 01000 011 00 67 M
LB 67
5C 00 0101 1100 00010 111 00 23 H
110 01 0001 0000 01000 100 00 68 M
LB 68
R 60
60 00 0110 0000 00011 000 00 24 H
F0 00 1111 0000 00111 100 00 60 M
LB 60
R 68
64 00 0110 0100 00011 001 00 25 H
[10]
Cache contents
[3]
[2]
2
b) Consider a 2-way set associative cache.
One line of cache word has 32 bit words- 4 bytes thus require 2 bits. Note that it is byte
addressable.
Tag=10-4=6 bits
6 2 2
[5]
= 8/2 = 4
3
Address Parameters Block Set ACCESS
Hex Binary Tag Index Offset Number Number
(Tag+index
(Decimal)
54 00 0101 0100 000101 01 00 21 1 M
LB 21
58 00 0101 1000 000101 10 00 22 2 M
LB 22
104 01 0000 0100 010000 01 00 65 1 M
LB 65
[SET 1 FULL]
5C 00 0101 1100 000101 11 00 23 3 M
LB 23
108 01 0000 1000 010000 10 00 66 2 M
LB 62
[SET 2 FULL]
60 00 0110 0000 000110 00 00 24 0 M
LB 24
F0 00 1111 0000 001111 00 00 60 0 M
LB 60
[SET 0 FULL]
64 00 0110 0100 000110 01 00 25 1 M
LB 25
RB 21 (LRU)
54 00 0101 0100 000101 01 00 21 1 M
LB 21
RB 65 (LRU)
58 00 0101 1000 000101 10 00 22 2 H
10C 01 0000 1100 010000 11 00 67 3 M
LB 67
[SET 3 FULL]
5C 00 0101 1100 000101 11 00 23 3 H
110 01 0001 0000 010001 00 00 68 0 M
LB 68
RB 24 (LRU)
60 00 0110 0000 000110 00 00 24 0 M
LB 24
RB 60 (LRU)
F0 00 1111 0000 001111 00 00 60 0 M
LB 60
RB 68 (LRU)
64 00 0110 0100 000110 01 00 25 1 H
[10]
WAY 1 WAY 2
4
Cache Set Status Address Block/word
line Number Tag
number D V
0 0 ? ? 001111 Block 60
1 ? ? 000110 Block 24
2 1 ? ? 000110 Block 25
? ? 000101 Block 21
3 2 ? ? 000101 Block 22
? ? 010000 Block 66
4 3 ? ? 000101 Block 23
5 ? ? 010000 Block 67
[2]
Conclusion: Two way set associative has better performance than direct mapped
5
SOLUTION QUESTION 2 [10]
Number of caches 2
Delay =5.1ns