+1 vote

Consider the code below:

1 ADDI R1, R1, -8
2 LOAD R2, 4(R1)
3 ADD R3, R2, R4
4 LOAD R4, 8(R1)
5 SUB R5, R3, R4

Following are the pipeline stages: IF, ID, EX, MEM, WB
Which of the following is a correct reordering of the above code which would avoid stalls?

(A) 1,2,4,3,5
(B) 1,2,3,4,5
(C) 1,2,4,5,3
(D) 2,3,1,4,5

asked Jun 12 in Computer Organization by gbmentor (7,990 points)
reshown Jun 13 by gbmentor

4 Answers

0 votes
I think a is better one not sure
answered Jun 13 by tsnikhilsharmagate2018 (7,480 points)
how It can be better than b since 3,4 if interchange can cause WAR hazard
I think all reordering wrong
0 votes
C and D is not possible now answer is a or b not sure which one.
answered 6 days ago by tsnikhilsharmagate2018 (7,480 points)
0 votes

No option seems correct bcz 4,3 load ,add and 4,5 load ,Sub 

answered 6 days ago by 23rishiyadavpro20 (4,120 points)
0 votes
There is a mistake in the question. Marks will be given to all.
answered 6 days ago by getgatebook (22,170 points)