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

Given the following code I1 lw $t1, 8($s0) I2 add $s0, $s0, $s1 I3 sub $s1, $t1,

ID: 645532 • Letter: G

Question

  Given the following code

                I1            lw           $t1,        8($s0)

                I2            add        $s0,        $s0,        $s1

                I3            sub         $s1,        $t1,        $t0

                Assume that forwarding is NOT implemented.

                2.1          Are there any data hazards in the pipeline? If yes, between which pairs of instructions                                  do they happen.

                2.2 Show the status of the instruction pipeline, by inserting instructions, stages, and bubbles into appropriate cycle slots.

Instruction

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Cycle 5

Cycle 5

Cycle 6

Cycle 7

Cycle 8

Instruction

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Cycle 5

Cycle 5

Cycle 6

Cycle 7

Cycle 8

Explanation / Answer

2A)

Here, there are no hazards are present in the given instruction.

Here in the line one it has to load the value of s0 into the t1.

In the line 2, the value of t1 is not been used. So, in this line, the value of s1 and s0 are retrieved and the values are added and stored into the s0.

In the line 3, the value of t0 and t1 are retrieved and subtracted and stored in the register s1. So, therefore in any of the lines, the previous line value is not dependent on other.

Hence, there are no hazards.

2B)

The pipe line execution:

Instruction

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Cycle 5

Cycle 5

Cycle 6

Cycle 7

Cycle 8

lw $t1, 8($s0)

IF

ID

EX

MEM

WB

add        $s0,        $s0,        $s1

IF

ID

EX

MEM

WB

sub         $s1,        $t1,        $t0

IF

ID

EX

MEM

WB

Instruction

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Cycle 5

Cycle 5

Cycle 6

Cycle 7

Cycle 8

lw $t1, 8($s0)

IF

ID

EX

MEM

WB

add        $s0,        $s0,        $s1

IF

ID

EX

MEM

WB

sub         $s1,        $t1,        $t0

IF

ID

EX

MEM

WB

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote