Question: for (i=0; i <100; i++) z[i] = a[i] - b[i] ; Assume that - a, b, and z are arrays of 32-bit words. The machine
for (i=0; i<100; i++)
z[i] = a[i] - b[i] ;
Assume that - a, b, and z are arrays of 32-bit words. The machine code for this fragment is stored in memory starting from location 00000000 Hex. Arrays a, b, and z are stored in memory beginning with memory locations 100hex, 200hex, and 300hex, respectively.
1.) Convert this code to MIPS. You must provide the numeric offset for each branch or jump instruction that you use.
Assume that the CPIs for MIPS instructions on a multi-cycle system M1 are as listed below:
lw : 5 cycles
R-type, addi, sw, and other immediate Arithmetic instruction : 4 Cycles
beq, bne, and j: 3 cycles
other instructions: 4 cycles
2.) How many clock cycles does it take to execute the C-code fragment on system M1? Justify your answer.
3.) Assume that the clock rate for M1 is 4.0 GHz. What is the CPU execution time for the code on M1?
4.) Compute CPU execution time of the code for a single-cycle system (CPI = 1 for all instructions) with clock rate 2.0 Ghz.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
