Consider a computer with a 256 byte address space and a two way 64 byte set associative cache. The computer word size is a byte and each cache line contains four bytes. If the cache is initially empty and the following sequence of hexadecimal addresses is read, show the cache contents and the the corresponding sequence of hits and misses. 48, 0C, 48, 4C, 5C, 3A, 20, 21, 22, 24, 81, 49, 30, 34, 27, 3E, 24, 28, 2C, 40
Memory Size = 256 Bytes => Address = 8 bits
Cache Size = 64 Bytes
Line/Block Size = 4 Bytes => Byte offset = 2 bits
Number of blocks in set = 2
Number of Sets in Cache = 64/(4*2) = 8 => set index = 3
Tag bits = 8-2-3 = 3 bits
Address | Hit/Miss | Set 0 | Set 1 | Set 2 | Set 3 | Set 4 | Set 5 | Set 6 | Set 7 | ||||||||
Block 0 | Block 1 | Block 0 | Block 1 | Block 0 | Block 1 | Block 0 | Block 1 | Block 0 | Block 1 | Block 0 | Block 1 | Block 0 | Block 1 | Block 0 | Block 1 | ||
48 = 010 010 00 | Miss | 48 - 51 | |||||||||||||||
0C = 000 011 00 | Miss | 48 - 51 | 0C - 0F | ||||||||||||||
48 = 010 010 00 | Hit | 48 - 51 | |||||||||||||||
4C = 010 011 00 | Miss | 48 - 51 | 0C - 0F | 4C - 4F | |||||||||||||
5C = 010 111 00 | Miss | 48 - 51 | 0C - 0F | 4C - 4F | 5C - 5F | ||||||||||||
3A = 001 110 10 | Miss | 48 - 51 | 0C - 0F | 4C - 4F | 38 - 3B | 5C - 5F | |||||||||||
20 = 001 000 00 | Miss | 20 - 23 | 48 - 51 | 0C - 0F | 4C - 4F | 38 - 3B | 5C - 5F | ||||||||||
21 = 001 000 01 | Hit | 20 - 23 | 48 - 51 | 0C - 0F | 4C - 4F | 38 - 3B | 5C - 5F | ||||||||||
22 = 001 000 10 | Hit | 20 - 23 | 48 - 51 | 0C - 0F | 4C - 4F | 38 - 3B | 5C - 5F | ||||||||||
24 = 001 001 00 | Miss | 20 - 23 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 38 - 3B | 5C - 5F | |||||||||
81 = 100 000 01 | Miss | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 38 - 3B | 5C - 5F | ||||||||
49 = 010 010 01 | Hit | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 38 - 3B | 5C - 5F | ||||||||
30 = 001 100 00 | Miss | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 30 -33 | 38 - 3B | 5C - 5F | |||||||
34 = 001 101 00 | Miss | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 30 -33 | 34 - 37 | 38 - 3B | 5C - 5F | ||||||
27 = 001 001 11 | Hit | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 30 -33 | 34 - 37 | 38 - 3B | 5C - 5F | ||||||
3E = 001 111 10 | Miss | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 30 - 33 | 34 - 37 | 38 - 3B | 5C - 5F | 3C - 3F | |||||
24 = 001 001 00 | Hit | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 0C - 0F | 4C - 4F | 30 - 33 | 34 - 37 | 38 - 3B | 5C - 5F | 3C - 3F | |||||
28 = 001 010 00 | Miss | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 28 - 31 | 0C - 0F | 4C - 4F | 30 - 33 | 34 - 37 | 38 - 3B | 5C - 5F | 3C - 3F | ||||
2C = 001 011 00 | Miss | 20 - 23 | 80 - 83 | 24 - 27 | 48 - 51 | 28 - 31 | 2C - 2F | 4C - 4F | 30 - 33 | 34 - 37 | 38 - 3B | 5C - 5F | 3C - 3F | ||||
40 = 010 000 00 | Miss | 40 - 43 | 80 - 83 | 24 - 27 | 48 - 51 | 28 - 31 | 2C - 2F | 4C - 4F | 30 - 33 | 34 - 37 | 38 - 3B | 5C - 5F | 3C - 3F |
Get Answers For Free
Most questions answered within 1 hours.