Question: Ex 3 : Consider the following loop, where x , y , z , w , and output are vectors of equal length: for (

Ex3: Consider the following loop, where x, y, z, w, and output are vectors of equal length:
for (i =0; i <500; ++i)
{
output[i]=(x[i]+3*y[i])*(z[i]-2*w[i]);
}
a) Convert the loop into Vector MIPS code with appropriate comments explaining each step.
b) Estimate the number of scalar MIPS instructions needed to execute the loop without vectorization.
c) Explain the advantages of vectorizing this code and how it improves performance over the scalar version
Ex4: Instruction Sequence:
1. Addi $t0, $t0,10 ; $t0= $t0+10
2. Lw $t1,0($t0) ; $t1= Mem[$t0]
3. Sub $t2, $t0, $t1 ; $t2= $t0- $t1
4. Mul $t3, $t1, $t2 ; $t3= $t1* $t2
5. Add $t4, $t2, $t3 ; $t4= $t2+ $t3
a. List all the data dependencies and their types (RAW, WAR, WAW).
b. Assuming the sequence is executed correctly and that the initial values of $t0, $t1, $t2, $t3, and $t4 are 100,200,50,30, and 0 respectively, what will be the final values of $t0, $t1, $t2, $t3, and $t4? Assume memory location 110 contains the value 300.
c. Assuming there are neither forwarding nor hazard detection units, what will be the final values of $t0, $t1, $t2, $t3, and $t4 in this case?
d. Explain how branch prediction works in MIPS architecture and what role it plays in pipelining.

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 Programming Questions!