Indicate potential hazards in the following be specific Sub

Indicate potential hazards in the following, be specific: Sub $2, $1, $3 And $12, $2, $5 Or $12=3, $6, $2 Add $14, $2, $2 SW$15,100 ($2) B. FP following FP: 4 cycles [add, and, or are FP] ADD STALLS TO THE above code clip

Solution

I am assuming it is a pipelined CPU without any forwarding where each instruction takes 4 cycles ( IF-ID-EX-WB).

1. Read after Write Hazard (RAW)

$2 is still not available

sub $2,$1,$3

and $12,$2,$5

or $12,$6,$2

add $14,$2,$2 ( $2 is written to the register bank in this stage, hence availabe in the next cycle for instruction decoding).

sw $15,100($2) is allright, no hazard.

 Indicate potential hazards in the following, be specific: Sub $2, $1, $3 And $12, $2, $5 Or $12=3, $6, $2 Add $14, $2, $2 SW$15,100 ($2) B. FP following FP: 4

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site