In: Computer Science
1. Assume we have 8 registers, R0~R7, and we have a pipeline of 6 stages:
Instruction Fetch (IF), Instruction Issue (II), Operands Fetch (OF), Execution (EX), Write Back (WB), and Commitment (CO). Each stage needs exactly 1 cycle to finish its work.
Also assume that the pipeline supports forwarding, which means the result of WB can be forwarded to OF.
Given the following piece of instructions:
R1 = R0 + R2
R3 = R4 + R5
R6 = R1 + R3
R0 = R2 + R7
Multiple questions asked in a single post, Solution for the first problem is provided below, please comment if any doubts:
1.
i)
ii)
Instruction |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
R1 = R1 + R2 |
IF |
II |
OF |
EX |
WB |
CO |
|||
R3 = R4 + R5 |
IF |
II |
OF |
EX |
WB |
CO |
|||
R0 = R2 + R7 |
IF |
II |
OF |
EX |
WB |
CO |
|||
R6 = R1 + R3 |
IF |
II |
OF |
EX |
WB |
CO |
Number of cycles required in the pipelined execution is 9.