Question: Q 1 6 . Pipelining [ 1 3 marks ] Refer to the following MIPS code which is the same as the one in question
Q Pipelining marks
Refer to the following MIPS code which is the same as the one in question Here, we look only at instructions I to I Pay attention to the assumptions underlined given below.
add $t $ $ # I; i
addi $t $a # I; $t &A
addi $t $a # I; $t &B
sll $t $a # I
loop: slt $t $t $t # I
beq $t $ end # I
lw $s$t # I
lw $s$t # I
slt $t $s $s # I
beq $t $ skip # I
add $t $s $ # I
add $s $s $ # I
add $s $t $ # I
skip: sw $s$t # I
sw $s$t # I
addi $t $t # I
addi $t $t # I
addi $t $t # I
j loop # I
end:
Assuming a stage MIPS pipeline, and all elements in array A are smaller than all elements in array B answer the parts below. You need to count until the last stage of instruction I
a How many cycles does this code segment take to complete its execution in the first iteration I to I in an ideal pipeline, that is one with no delays?
For parts b to d below, given the assumption for each part, how many additional cycles does this code segment I to I take to complete its execution in the first iteration as compared to an ideal pipeline computed in a Note that the jump instruction j computes the target address to jump to in its ID stage stage No delayed branching is used.
Write the total number of additional delay cycles for each of the parts b to d For example, if part a takes cycles and part b takes cycles, then you should write for part b
b Assuming without forwarding and branch decision is made at MEM stage stage No branch prediction is made.
c Assuming with forwarding and branch decision is made at MEM stage stage No branch prediction is made.
d Assuming with forwarding and branch decision is made at ID stage stage
Branch is predicted not taken.
e Assuming the setting in part b above without forwarding and branch decision at MEM stage without affecting the correctness of the code, is it possible to move one instruction to somewhere else to reduce the number of delay cycles? If so indicate which instruction to move, where to move it to and how many delay cycles are reduced by moving it If it is not possible, explain.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
