Home / Expert Answers / Computer Science / assume-the-following-program-is-running-on-the-5-stage-in-order-pipeline-processor-shown-in-class-pa410

(Solved): Assume the following program is running on the 5-stage in-order pipeline processor shown in class. ...



Assume the following program is running on the 5-stage in-order pipeline processor shown in class. All registers are initiali
Assume the following program is running on the 5-stage in-order pipeline processor shown in class. All registers are initialized to 0. Assuming only WX and WD (register file internal forwarding) forwarding, branches are resolved in Decode stage, and branches are always predicted not-taken. How many cycles will it take to execute the program, if the branch outcome is actually taken? Draw a pipeline diagram (table) to show the details of your work. Use arrows to indicate forwarding.


We have an Answer from Expert

View Expert Answer

Expert Answer



To determine the number of cycles required to execute the program, we need to analyze the pipeline diagram for each instruction and identify any data dependencies, hazards, and forwarding opportunities.
Assuming the branch outcome is taken, the program will execute as follows:
Cycle 1:
lw $r6 0($r10) (IF)
nop (ID)
nop (EX)
nop (MEM)
nop (WB)
Cycle 2:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
nop (EX)
nop (MEM)
nop (WB)
Cycle 3:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
add $r2 $r6 $r7 (EX)
nop (MEM)
nop (WB)
Cycle 4:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
add $r2 $r6 $r7 (EX)
beq $r2 $r3 label (MEM)
nop (WB)
Cycle 5:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
add $r2 $r6 $r7 (EX)
nop (MEM)
nop (WB)
Cycle 6:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
sub $r6 $r8 $r4 (EX)
nop (MEM)
nop (WB)
Cycle 7:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
sub $r6 $r8 $r4 (EX)
nop (MEM)
sw $r6 0($r10) (WB)
Cycle 8:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
lw $r1 0($r2) (EX)
nop (MEM)
sw $r6 0($r10) (WB)
Cycle 9:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
lw $r1 0($r2) (EX)
or $r4 $r2 $r1 (MEM)
sw $r6 0($r10) (WB)
Cycle 10:
lw $r6 0($r10) (IF)
lw $r7 0($r11) (ID)
lw $r1 0($r2) (EX)
nop (MEM)
sw $r6 0($r10) (WB)
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe