Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this assignment, find out all hazards that exist in three separate code segme

ID: 3815119 • Letter: I

Question

In this assignment, find out all hazards that exist in three separate code segments A, B and C. Note that the code segments are independent of each other, and the lines are numbered so that they can be used in the answers. The answer format must be strictly followed: the answers template file Assignment4Answers.txt has a separate section for each code segment. Under each segment’s answer write the hazards you have detected for that segment by replacing the X and Y with line numbers from the code segment, and T with the type of solution to the hazard. T can be M, W or S, where M = forward from Memory stage, W = forward from Writeback stage, and S = stall. For example, if you think there is a hazard between lines 1 and 4 of code segment B, which can be solved by stalling the pipeline, you would write the following in the answers file:

B.

1 ,4, S

For more hazards detected for that segment, simply create more lines under that segment in the answers file and follow this format.

A.

1. addi   $s1, $s2, 5

2. sub $t0, $t1, $t2

3. lw $t3, 15($s1)

4. sw $t5, 72($t0)

5. or   $t2, $s4, $s5

B.

1. add   $s0, $t0, $t1

2. sub   $s1, $t2, $t3

3. and   $s2, $s0, $s1

4. or   $s3, $t4, $t5

5. slt $s4, $s2, $s3

C.

1. add   $t0, $s0, $s1

2. sub   $t0, $t0, $s2

3. lw   $t1, 60($t0)

4. and $t2, $t1, $t0

Assignment4Answers.txt

A.
X,Y,T

B.
X,Y,T

C.
X,Y,T

Explanation / Answer

A.

1,4,M

Explanation :-

In 3rd and 4th line , $s1 and $t0 are accessed at same time

B.

1,5,S

In 3rd line,$s0 and $s1 are not updated.

in 5th line,$s3,$s2 are not updated

C.

1,3,M

In 1st and 3rd line, $t0 is accessed for writing and reading at the same time