GATE CS 2015 Set 2 — Question 53
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0MediumData ForwardingInstruction PipeliningComputer Organization & ArchitecturePipeline StallsPipeline Stages & Throughput
Computer Organization & Architecture → Instruction Pipelining → Data Forwarding
Last updated
Question
Consider the sequence of machine instructions given below:
In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register stores the result of the operation performed on the second and the third registers. This sequence of instructions is to be executed in a pipelined instruction processor with the following 4 stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO) and (4) Write back the result (WB). The IF, OF and WB stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution of the above sequence of instructions is ___________.
MUL R5, R0, R1
DIV R6, R2, R3
ADD R7, R5, R6
SUB R8, R7, R4
In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register stores the result of the operation performed on the second and the third registers. This sequence of instructions is to be executed in a pipelined instruction processor with the following 4 stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO) and (4) Write back the result (WB). The IF, OF and WB stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution of the above sequence of instructions is ___________.
Correct answer
13 to 13
Solution
Stages: IF, OF, WB take 1 cycle each; PO takes 3 cycles for MUL, 5 for DIV and 1 for ADD/SUB. There is a single PO unit, and results are forwarded from the end of PO directly to the next instruction that needs them.Dependencies: ADD needs R5 (from MUL) and R6 (from DIV); SUB needs R7 (from ADD).
| Instruction | IF | OF | PO | WB |
|---|---|---|---|---|
| MUL R5, R0, R1 | 1 | 2 | 3-5 | 6 |
| DIV R6, R2, R3 | 2 | 3 | 6-10 | 11 |
| ADD R7, R5, R6 | 3 | 4 (stalls) | 11 | 12 |
| SUB R8, R7, R4 | 4 | 5 (stalls) | 12 | 13 |
- DIV cannot start PO until MUL leaves the PO stage, so its PO occupies cycles 6-10.
- ADD needs R6, which is forwarded at the end of cycle 10, so ADD's PO is in cycle 11 and WB in 12.
- SUB needs R7, forwarded at the end of cycle 11, so SUB's PO is in cycle 12 and WB in 13.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Instruction Pipelining
2026 Set 1 Q14Match each addressing mode in List I with a data element or an element of a data structure (in…2026 Set 1 Q15Consider a processor P whose instruction set architecture is the load-store architecture. The…2026 Set 1 Q16Which one of the following dependencies among the register operands of different instructions can…2026 Set 2 Q18Consider the following two statements about interrupt handling mechanisms in a CPU. S1: In…2026 Set 1 Q38The size of the physical address space of a processor is bytes. The capacity of a cache…