GATE / CS ARCHIVE

GATE CSE 1993 / QUESTION 10(b)

PC after operand fetch

Computer Organization & Architecture · Instructions & Addressing Modes · Full GATE CSE 1993 paper

GATE 1993, Q10(b) Descriptive
Report issue

Instructions & Addressing Modes

Question 10(b), GATE 1993: The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. For a non-jump instruction, find PC after execution.
Question 10(b), GATE 1993: The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. For a non-jump instruction, find PC after execution.
Tap to enlarge
Answer & solution

Answer: 2002. (no official key was published)

There are two distinct increments. First the instruction fetch consumes the memory word at 2000 and advances PC to 2001. Next mode 2 uses the current PC as the address of the operand, reads M[2001], and increments that selected register by one. Because the selected register is PC, it becomes 2002.

The instruction is specified to be non-jumping, so no later branch-target assignment replaces this sequential address. PC=2002 therefore identifies the next instruction, after both the instruction word and its inline operand word. Do not increment a third time for execution: the next fetch has not yet happened. Conversely 2001 accounts only for instruction fetch and overlooks the addressing mode's explicit post-increment. This result uses the conventional word-addressed fetch semantics implicit in part (a).

Original paper, page 10