Question

In: Computer Science

Consider a 4-way set-associative cache, 4 rows, a line size of 128 bytes and a write-back...

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).

Solutions

Expert Solution

Block Size = 128 Bytes

  • 0th Block => 0 to 127
  • 1st Block => 128 to 255
  • 2nd Block => 256 to 383
  • 3rd Block => 384 to 511

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

Related Solutions

Computer archieture 1. Assume that the cache size is 512kB, and each cache line is 128...
Computer archieture 1. Assume that the cache size is 512kB, and each cache line is 128 Bytes. If it’s a 4-way associative cache, how many sets are there? If it’s a 2-way associative cache, how many sets are there? Let’s assume the cache is initially empty, and LRU policy is used for cache line replacement. If the following memory blocks are accessed: Mem-block # 7, 1031, 2055, 4103, 1031, 7, 2055, 3079, 1031, 3079 What is the cache hit/miss rate...
11. (12 pts) Consider a system with 32-bit addresses and a 16KB 8-way set-associative cache. Each...
11. (12 pts) Consider a system with 32-bit addresses and a 16KB 8-way set-associative cache. Each cache line contains 64 bytes. (a) How many bits of an address are used for the offset in this cache? (b) How many bits of an address are used for the index in this cache? (c) How many bits of an address are used in the tag for this cache? (d) What is the value of the tag for 0x000d6ae2? (e) What is the...
In set-associative mapping, why when having the choice to replace of which cache line to replace...
In set-associative mapping, why when having the choice to replace of which cache line to replace do we choose the ones with D=0?
Assume a computer with a cache that holds 64 bytes and has a block size of...
Assume a computer with a cache that holds 64 bytes and has a block size of 32 bytes. Direct address mapping is used and from the beginning the cache is empty. The following program sequence is executed: for (col = 0; col < 2; col++) { for (row = 0; row < 4; row++) A[row][col] = B[row] * C[col]; } Assume that for the variables row and col registers are used. The matrix A consists of 4 rows and 4...
A direct mapped cache has 16 blocks and block size is 64-bits (8 bytes). a. Where...
A direct mapped cache has 16 blocks and block size is 64-bits (8 bytes). a. Where will the memory block 45 reside in cache? (5 b. Where will be the memory address 1667 mapped in cache
A direct mapped cache has 32 cache lines.Each cache line consists of 4 words, and each...
A direct mapped cache has 32 cache lines.Each cache line consists of 4 words, and each word is four bytes.The address bus consists of 16 bits. How many bits are required for the tag in this direct-mapped cache?
6 C++ Questions: 19. Assuming an int is size 4 bytes, what is the size in...
6 C++ Questions: 19. Assuming an int is size 4 bytes, what is the size in memory of the below array: int cards[10] = {7, 4, 7, 5, 7}; 20. In the array from question 19, what is the value of the below elements: cards[1]; cards[8]; Assume you have an array with 128 integers which is sorted from lowest to highest. 21a. You are searching for a value which is contained in the array using the binary search algorithm. What...
Python: How would I write a function that takes a directory and a size in bytes,...
Python: How would I write a function that takes a directory and a size in bytes, and returns a list of files in the directory or below that are larger than the size. For example, I can use this function to look for files larger than 1 Meg below my Home directory.
Consider a disk with block size B = 512 bytes. A block pointer is P =...
Consider a disk with block size B = 512 bytes. A block pointer is P = 6 bytes long, and a record pointer is PR = 7 bytes long. A file has r = 30,000 EMPLOYEE records of fixed length. Each record has the following fields: Name (30 bytes),Ssn (9 bytes), Department_code (9 bytes), Address (40 bytes), Phone (10 bytes), Birth_date (8 bytes), Sex (1 byte), Job_code (4 bytes), and Salary (4 bytes, real number). An additional byte is used...
6. Each Isocost line demonstrates ______. Write the general equation of an Isocost line. the set...
6. Each Isocost line demonstrates ______. Write the general equation of an Isocost line. the set of combinations of goods and services i.e., outputs that yield different total costs labor costs in the short run the set of combinations of labor and capital that yield the same total costs combination of L and K that yield multiple total costs 7. If the quantity demanded of capital does not change by a large amount when the price of capital increases by...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT