113k views
0 votes
Assume that the following code segment C is executed on a pipelined architecture that will cause data hazard(s): Code segment C: add $s2, $t2, $t3 sub $t4, $s2, $t5 add $t5, $s2, $t6 and $t5, $t4, $t6 2 2.A.) (10 POINTS) First describe schematically, what will be the first data hazard that will occur in this code segment. Then, schematically provide a solution for the first data hazard that will occur in this code segment by using each of the following data hazard remedies. Please note that for each item below you apply the solution independently, i.e. each solution should be isolated from other solutions. Ignore any further data hazard your proposed solution may cause. So, only try to solve the first data hazard that will occur in the code segment C. 2.B.) (10 POINTS) rearranging the code statements, i.e. reorganizing the order of instructions in the original code segment C. 2.C.) (10 POINTS) nop, i.e. inserting nop operation(s) into the original code segment C. 2.D.) (10 POINTS) stalling, applying stalling operations(s) into the original code segment C. 2.E.) (10 POINTS) data forwarding, i.e. applying data forwarding towards instruction(s) in the original code segment C.

User Shlag Stag
by
3.5k points

1 Answer

4 votes

Answer:

See explaination

Step-by-step explanation:

a) Reorganizing the code

ADD $s2 , $t2, $t3

ADD $t5, $s2, $t6

SUB $t4, $s2, $t5

AND $t5,$t4,$t6

The reordering of the instruction leads to less hazards as compared to before.

b) with NOP

ADD $s2 , $t2, $t3

NOP

NOP

SUB $t4, $s2, $t5

NOP

ADD $t5, $s2, $t6

NOP

NOP

AND $t5,$t4,$t6

c. Pipeline with stalls

see attachment please

d. pipeline with forwarding

see attachment

Assume that the following code segment C is executed on a pipelined architecture that-example-1
Assume that the following code segment C is executed on a pipelined architecture that-example-2
User James Holland
by
4.0k points