Information Technology Reference
In-Depth Information
Fetching the operand of the second instruction during time slot k þ
3 will lead to
incorrect results.
Example 3 Consider the execution of the following sequence of instructions on a
five-stage pipeline consisting of IF, ID, OF, IE, and IS. It is required to show the
succession of these instructions in the pipeline.
I 1 !
Load
1, R1;
R1
2
1;
2
I 2 !
Load
5, R2;
R2
5;
I 3 !
Sub
R2, 1, R2
R2
R2
1;
2
I 4 !
Add
R1, R2, R3;
R3
R1
þ R2;
I 5 !
Add
R4, R5, R6;
R6
R4
þ R5;
I 6 ! SL
R3
R3
SL (R3)
I 7 !
Add
R6, R4, R7;
R7
R4
þ R6;
In this example, the following data dependencies are observed:
Instructions
Type of data dependency
I 3 and I 2
Read-after-write and write-after-write (W-W)
I 4 and I 1
Read-after-write (R-W)
I 4 and I 3
Read-after-write (R-W)
I 6 and I 4
Read-after-write and write-after-write (W-W)
I 7 and I 5
Read-after-write (R-W)
Figure 9.7 illustrates the progression of these instructions in the pipeline taking
into consideration the data dependencies mentioned above. The assumption made
in constructing the Gantt's chart in Figure 9.7 is that fetching an operand by an
instruction that depends on the results of a previous instruction execution is delayed
until such operand is available, that is, the result is stored. A total of 16 time units are
required to execute the given seven instructions taking into consideration the data
dependencies among the different instructions.
I 1
I 2
I 3
I 4
I 5
I 6
I 7
IS
IE
OF
ID
IF
I 1
I 2
I 3
I 4
I 5
I 6
I 7
I 1
I 2
I 3
I 4
I 5
I 6
I 7
I 1
I 2
I 3
I 4
I 5
I 6
I 7
I 1
I 2
I 3
I 4
I 5
I 6
I 7
123456789 0 1 2
13
4
15
16
Figure 9.7 Gantt's chart for Example 3
Search WWH ::




Custom Search