edited by
9,408 views
30 votes
30 votes

For a pipelined CPU with a single ALU, consider the following situations

  1. The ${j+1}^{st}$ instruction uses the result of the $j^{th}$ instruction as an operand

  2. The execution of a conditional jump instruction

  3. The $j^{th}$ and ${j+1}^{st}$ instructions require the ALU at the same time.

Which of the above can cause a hazard

  1. I and II only
  2. II and III only
  3. III only
  4. All the three
edited by

5 Answers

Best answer
58 votes
58 votes

1. Data hazard
2. Control hazard
3. Structural hazard as only one ALU is there

So, $(D)$. 

https://web.archive.org/web/20120106063906/http://www.cs.iastate.edu/~prabhu/Tutorial/PIPELINE/hazards.html

edited by
0 votes
0 votes
Answer is D

I . Read before write (data hazard)

II. control hazard

III. Structural hazard.
0 votes
0 votes

 

  1. Data Hazard (Read After Write - RAW):

    • Situation: The j + 1-st instruction uses the result of the j-th instruction as an operand.
    • Hazard: If the result of the j-th instruction is not yet available in the pipeline when the j + 1-st instruction needs it, a data hazard occurs. This is also known as a read-after-write hazard.
  2. Control Hazard (Conditional Jump):

    • Situation: The execution of a conditional jump instruction.
    • Hazard: When a conditional jump instruction is encountered, the pipeline may have to stall until the condition is evaluated and the target address is determined. This is a control hazard, as the flow of instructions is altered based on a condition.
  3. Structural Hazard (ALU Usage Conflict):

    • Situation: The j-th and j + 1-st instructions require the ALU at the same time.
    • Hazard: If the pipeline does not have the capability to handle multiple instructions requiring the ALU simultaneously, a structural hazard occurs. This situation is also known as a resource conflict.

therefore the correct answer is D, all can cause hazards

Answer:

Related questions

33 votes
33 votes
4 answers
1
Kathleen asked Sep 17, 2014
12,023 views
Consider the following system of linear equations $$\left( \begin{array}{ccc} 2 & 1 & -4 \\ 4 & 3 & -12 \\ 1 & 2 & -8 \end{array} \right) \left( \begin{array}{ccc} x \\ y...
35 votes
35 votes
3 answers
3
Kathleen asked Sep 17, 2014
14,990 views
Consider the following assembly language program for a hypothetical processor $A, B,$ and $C$ are $8-$bit registers. The meanings of various instructions are shown as com...