a) A data hazard is when the ALU requires a value that is not in the register file where it is supposed to be. The hardware techinique known as EX Forwarding can overcome this problem by moving the result from the first instruction to the second straight from the EX cycle, bypassing the need to wait for the MEM and WB stages. This eliminates the need for stalls in the pipeline. The sequence stalls the pipeline for a cycle because the ID stage of the add instruction cannot happen until the MEM stage of the lw instruction is completed. MEM forwarding (similar to EX forwarding) allows $t0 to be sent directly from the MEM stage of lw to the EX stage of add. b) A control hazard is when two different instructions could be executed after a conditional branch statement, but it is not known which one to start executing until the EX stage of the branch instruction is completed. This leads to a pipeline stall. There are three possible ways around this problem: static branch prediction, dynamic branch prediction, and delanyed branches. SBP predicts that the branch will be taken if the PC of the target is before the PC of the branch, and not taken otehrwise. DBP tracks which branches have been taken recently, and follows the pattern. Delayed branches executes the instruction at PC+4 anyway, but does so after an instruction called the "branch delay slot." c) lw $t0, ($sp) lw $t1, ($t0) # data hazard with $t0 addi $t1, $t1, 4# data hazard with $t1 lw $t2, ($t0) add $t3, $t2, $t1#data hazard with $t2 sw $t3, 4($sp) # data hazard with $t3 avoided with EX forwarding sw $zero, ($sp) #revised instruction order lw $t0, ($sp) sw $zero, ($sp) # removes data hazard with $t0 via bubble in MEM forwarding lw $t1, ($t0) lw $t2, ($t0) # removes data hazards with $t1 and $t2 via bubble in MEM forwarding and instruction movement, respectively addi $t1, $t1, 4 add $t3, $t2, $t1#data hazard now avoided with EX forwarding sw $t3, 4($sp) # data hazard still avoided with EX forwarding Alternatively, the instruction set can be rewritten as follows: lw $t1, ($sp) lw $t2, ($sp) addi $t1, $t1, 4 sw $zero, ($sp) add $t3, $t2, $t1 sw $t3, 4($sp) # data hazard avoided with EX forwarding