solution to midterm question 3 3) pipeline For each code sequence below, state whether it must stall, can avoid stalls using only forwarding, or can execute without stalling or forwarding. 3.1) sequence 1 lw x10, 0(x10) add x11, x10, x10 answer stall (after lw) because data dependency on x10, lw will get data at stage 4 (mem) but add needs this data at stage 3, forwarding will not help because forwarding can deliver data at stage 3 (alu) which (mem) did not yet get the data. timeline in the pipeline: lw x10 fet dec alu mem wb add x11 fet dec alu mem wb 3.2) sequence 2 add x11, x10, x10 addi x12, x10, 5 addi x14, x11, 5 answer between add x11 and addi x12 there is no data dependency. between addi x12 and addi x14 there is no data dependency. between add x11 and addi x14 there is data dependency on x11 but these instructions are already two clocks apart. conclusion: there is no stall in case of add x11 and addi x14, forwarding will not help because it can only forward to the next instruction (not two instructions) timeline in the pipeline: add x11 fet dec alu mem wb addi x12 fet dec alu mem wb addi x14 fet dec alu mem wb 3.3) sequence 3 addi x11, x10, 1 addi x12, x10, 2 addi x13, x10, 3 addi x14, x10, 4 addi x15, x10, 5 answer all five instructions have no data dependency to each other. conclusion: no stall