For a pipelined CPU with a single ALU, consider the following situations
-
The instruction uses the result of the instruction as an operand
-
The execution of a conditional jump instruction
-
The and instructions require the ALU at the same time.
Which of the above can cause a hazard
View worked solution
Answer: D
In a pipelined processor, hazards prevent the next instruction in the instruction stream from executing in its designated clock cycle. Let us analyze each of the given situations:
-
Situation I: The instruction uses the result of the instruction as an operand.
This introduces a dependency where a register is read before it is written by the preceding instruction. This causes a Data Hazard (specifically, a Read-After-Write or RAW hazard). -
Situation II: The execution of a conditional jump instruction.
Since the target address and the branch outcome are not known immediately, the pipeline cannot confidently fetch the next instruction. This causes a Control Hazard (or branch hazard). -
Situation III: The and instructions require the ALU at the same time.
Because the CPU has only a single ALU, both instructions cannot use this hardware resource simultaneously. This resource conflict causes a Structural Hazard.
Since all three situations can cause a hazard, the correct option is D.
Free practice · Your answers on this page are not saved.
