GATE / CS ARCHIVE

GATE CSE 2008 / QUESTION 77

Safe instruction for a branch delay slot

Computer Organization & Architecture · Pipelining & Hazards · Full GATE CSE 2008 paper

GATE 2008, Q77 2 marks · MCQ
Report issue

Pipelining & Hazards

Question 77, GATE 2008: A processor has one branch delay slot. Which instruction can be moved into it without other program changes?
I1: ADD R2←R7+R8
I2: SUB R4←R5−R6
I3: ADD R1←R2+R3
I4: STORE Memory[R4]←R1
BRANCH to Label if R1==0

(A) I1
(B) I2
(C) I3
(D) I4
Question 77, GATE 2008: A processor has one branch delay slot. Which instruction can be moved into it without other program changes?
I1: ADD R2←R7+R8
I2: SUB R4←R5−R6
I3: ADD R1←R2+R3
I4: STORE Memory[R4]←R1
BRANCH to Label if R1==0

(A) I1
(B) I2
(C) I3
(D) I4
Question 77, GATE 2008: A processor has one branch delay slot. Which instruction can be moved into it without other program changes?
I1: ADD R2←R7+R8
I2: SUB R4←R5−R6
I3: ADD R1←R2+R3
I4: STORE Memory[R4]←R1
BRANCH to Label if R1==0

(A) I1
(B) I2
(C) I3
(D) I4
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. I4 stores R1 through address R4 but changes neither register used by the branch condition. Moving it from immediately before the branch to the single delay slot preserves its unconditional execution and lets the branch still test the R1 computed by I3.
2. I1 cannot move because I3 needs R2; I2 cannot move because I4 needs R4; I3 cannot move because I4 and the branch need R1. Thus I4, option D, is the legal choice in the stated dependency model.

Original paper, page 17