GATE / CS ARCHIVE

GATE CSE 1993 / QUESTION 10(a)

Operand address with PC autoincrement

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

GATE 1993, Q10(a) Descriptive
Report issue

Instructions & Addressing Modes

Question 10(a), 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. Find the operand address.
Question 10(a), 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. Find the operand address.
Tap to enlarge
Answer & solution

Answer: 2001, under conventional instruction-fetch PC advancement. (no official key was published)

Use the conventional fetch sequence for a word-addressed CPU. Before instruction fetch PC=2000. Fetching the one-word instruction into the instruction register advances PC to 2001. Decoding then selects PC as the mode-2 address register. The effective operand address is the value of PC at that point, namely 2001, so the operand is the contents of memory word M[2001]. The operand fetch subsequently increments PC again, but this later value is not the operand address.

In register-transfer notation: IR ← M[PC]; PC ← PC+1; EA ← PC; operand ← M[EA]; PC ← PC+1. The addresses 2000 and 2001 respectively hold the instruction and its following operand word. This is the usual immediate-operand idiom implemented by PC autoincrement. It assumes ordinary instruction-fetch advancement of the PC, implicit in the question's CPU convention; it does not treat PC as still 2000 during operand addressing.

Original paper, page 10