Consider the following C code: int A[16]; int B[16]; int m; ... //A large chunk of code that does NOT access //arrays A and B. .. for (int i=0; i


Consider the following C code:<br>int A[16];<br>int B[16];<br>int m;<br>...<br>//A large chunk of code that does NOT access<br>//arrays A and B.<br>..<br>for (int i=0; i<10; i++) {<br>for (int j=0; j<16; j++) {<br>B[j] = m * A[j] + B[j];<br>}<br>}<br>Assume this program runs on a 32-bit machine, i.e., the CPU loads/stores 4 bytes from memory<br>in one go. This machine has a 16-bit memory address, and each memory block stores 16 bytes.<br>This machine has a direct-mapped data cache with 16 cache lines.<br>Array A starts at address O, and B starts at address 256 - both arrays begin at a memory block<br>boundary. Each element of arrays A and B occupies 4 bytes. The values of i, j, and m are stored<br>in CPU registers.<br>Q5.1<br>A compulsory cache miss happens the first time the CPU reads any bytes in a memory block.<br>Such cache misses are inevitable, and the entire memory block must be brought into the cache.<br>How many compulsory misses in the data cache will occur when running the above code?<br>Give your answer in a base 10 number (and only write down the number).<br>

Extracted text: Consider the following C code: int A[16]; int B[16]; int m; ... //A large chunk of code that does NOT access //arrays A and B. .. for (int i=0; i<10; i++)="" {="" for="" (int="" j="0;"><16; j++)="" {="" b[j]="m" *="" a[j]="" +="" b[j];="" }="" }="" assume="" this="" program="" runs="" on="" a="" 32-bit="" machine,="" i.e.,="" the="" cpu="" loads/stores="" 4="" bytes="" from="" memory="" in="" one="" go.="" this="" machine="" has="" a="" 16-bit="" memory="" address,="" and="" each="" memory="" block="" stores="" 16="" bytes.="" this="" machine="" has="" a="" direct-mapped="" data="" cache="" with="" 16="" cache="" lines.="" array="" a="" starts="" at="" address="" o,="" and="" b="" starts="" at="" address="" 256="" -="" both="" arrays="" begin="" at="" a="" memory="" block="" boundary.="" each="" element="" of="" arrays="" a="" and="" b="" occupies="" 4="" bytes.="" the="" values="" of="" i,="" j,="" and="" m="" are="" stored="" in="" cpu="" registers.="" q5.1="" a="" compulsory="" cache="" miss="" happens="" the="" first="" time="" the="" cpu="" reads="" any="" bytes="" in="" a="" memory="" block.="" such="" cache="" misses="" are="" inevitable,="" and="" the="" entire="" memory="" block="" must="" be="" brought="" into="" the="" cache.="" how="" many="" compulsory="" misses="" in="" the="" data="" cache="" will="" occur="" when="" running="" the="" above="" code?="" give="" your="" answer="" in="" a="" base="" 10="" number="" (and="" only="" write="" down="" the="">

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here