In: Computer Science
Consider a 4-way set-associative cache, 4 rows, a line size of
128 bytes and a write-back policy. The following requests are made
to memory:
Load: 0b0011111001000101
Load: 0b1000111110110100
Load: 0b0110101111110100
Store: 0b0010110000000110
Store: 0b1111001001110101
Store: 0b1110000111000001
Load: 0b0000000010100110
Load: 0b0101001001001101
Assuming the machine is in cold-start, profile the contents to the
cache after all of the requests have been made. State any
assumption you make (if needed).
Block Size = 128 Bytes
Load: 0b0011111001000101 => 15,941/128 = 124th Block =>
124%4 = 0th set
Load: 0b1000111110110100 => 36,788/128 = 287th Block =>
287%4 = 3rd Set
Load: 0b0110101111110100 => 27,636/128 = 215th Block =>
215%4 = 3rd Set
Store: 0b0010110000000110 => 11,270/128 = 88th Block => 88%4
= 0th Set
Store: 0b1111001001110101 => 62,069/128 = 484th Block =>
484%4 = 0th Set
Store: 0b1110000111000001 => 57,793/128 = 451th Block =>
451%4 = 3rd Set
Load: 0b0000000010100110 => 166/128 = 1st Block => 1%4 = 1st
Set
Load: 0b0101001001001101 => 21,196/128 = 165th Block
=> 165%4 = 1st Set
Block 0 | Block 1 | Block 2 | Block 3 | |
Set# 0 |
0b0011111000000000 - 0b0011111001111111 |
0b0010110000000000 - 0b0010110001111111 | 0b1111001000000000 - 0b1111001001111111 | |
Set# 1 | 0b0000000010000000 - 0b0000000011111111 | 0b0101001010000000 - 0b0101001011111111 | ||
Set# 2 | ||||
Set# 3 | 0b1000111110000000 - 0b1000111111111111 | 0b0110101110000000 - 0b0110101111111111 | 0b1110000110000000 - 0b1110000111111111 |