Question: Assume the following C code: for ( i = 0 ; i < = 2 0 0 0 ; i + + ) { int

Assume the following C code:
for(i=0; i<=2000; i++){
int temp;
temp = X[i];
X[i]= Y[i];
Y[i]= temp;
}
Assume that $s0 has the address of X[0] and $s1 has the address of Y[0] and i is in $s2.
a) Write the above code using MIPS instructions.
b) How many instructions are executed during running this code.
c) Find the performance (duration of total execution) of above coode in MIPS 2GHz processor, assuming that arithmetic instruction takes 1 cycle, data transfer instruction takes 4 cycles, conditional branch takes 2 cycles and jump takes 1 cycle.
d) Find average CPI for the above code.
e) Find performance speed up for above code if data transfer instruction takes 1 cycle using cache.
Solve and explain all soluitons.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!