Consider a pipelined processor with the following four stages:
IF: Instruction Fetch
ID: Instruction Decode and Operand Fetch
EX: Execute
WB: Write Back
The IF, ID and WB stages take one clock cycle each to complete the operation. The number of clock cycles for the EX stage dependson the instruction. The ADD and SUB instructions need 1 clock cycle and the MUL instruction needs 3 clock cycles in the EX stage. Operand forwarding is used in the pipelined processor. What is the number of clock cycles taken to complete the following sequence of instructions?
ADD R2, R1, R0 R2 <- R0 + R1
MUL R4, R3, R2 R4 <- R3 * R2
SUB R6, R5, R4 R6 <- R5 - R4
(A) 7
(B) 8
(C) 10
(D) 14
Answer: (B)
Explanation: Explanation:
Order of instruction cycle phases
IF” ID” EX” WB”
We have 3 instructions. which represents wait in pipeline due to result dependently.
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
R2!R1!R0 |
IF |
ID |
EX |
WB |
|
|
|
|
R4!R3!R2 |
|
IF |
ID |
EX |
EX |
EX |
WB |
|
R6!R5!R4 |
|
|
IF |
ID |
- |
- |
EX |
WB |
This is the table shows the cycle phases and number of cycles require for given instruction.
No. of cycles required=8
So (B) is correct option.
Quiz of this Question
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing
Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.
Last Updated :
19 Nov, 2018
Like Article
Save Article