Consider a system with a direct-mapped cache of size 64 (= 26) bytes, and a main
ID: 3546922 • Letter: C
Question
Consider a system with a direct-mapped cache of size 64 (= 26) bytes, and a main memory of size of 1 KB (i.e.1024 or 210 bytes).
Each cache line contains 8 bytes. A program running on the system accesses the following bytes in the first ten steps:
1: 10 1010 0100
2: 10 1010 1000
3: 10 1010 0100
4: 01 0000 0000
5: 00 1010 0000
6: 00 1010 1100
7: 00 1010 0100
8: 01 0000 0000
9: 10 1010 0000
10: 01 0000 0000
Assuming that the initial values of the cache tags and the cache lines are completely arbitrary,
show which accesses will lead to a hit, and which will cause to a miss. Also, show how the cache
tags will change after each of the above steps. You should justify your answer.
Explanation / Answer
cache arrangement contains 8 rows and 8 coloumns. 8 coloumns correspond to the offset, and 8 rows are represented by 3 bits just after offset by 3rd 4th and 5th bit. Rest 4 are the tag bits, stored in the 4 bit tag of the cache line..
Last 4 bits (leftmost) are the tag of the cache line, and next 3 digits(out of 6, 3 are for offset) are the location of the cache line (not used in the tag),
1: 10 10"10 0"100 : miss-> cache line 100 contained arbitary data, now it contains tag 1010
2: 10 10"10 1"000 : miss-> cache line 101 contained arbitary data, now it contains tag 1010
3: 10 10"10 0"100 : hit-> cache line 100 contains the tag 1010, the required tag
4: 01 00"00 0"000 : miss-> cache line 000 contained arbitary data, now it contains tag 0100
5: 00 10"10 0"000 : miss-> cache line 100 contained 1010, now it contains tag 0010
6: 00 10"10 1"100 : miss-> cache line 101 contained 1010, now it contains tag 0010
7: 00 10"10 0"100 : hit-> cache line 100 contains the tag 0010, the required tag
8: 01 00"00 0"000 : hit-> cache line 000 contains the tag 0100, the required tag
9: 10 10"10 0"000 : miss-> cache line 100 contained 0010, now it contains tag 1010
10: 01 00"00 0"000: hit-> cache line 000 contains the tag 0100, the required tag
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.