GATE / CS ARCHIVE

GATE CSE 2003 / QUESTION 46

Controlled XOR inputs of an adder-subtractor

Computer Organization & Architecture · Data Representation & Arithmetic · Full GATE CSE 2003 paper

GATE 2003, Q46 2 marks · MCQ
Report issue

Data Representation & Arithmetic

Question 46, GATE 2003: An n-bit ripple-carry ALU has a full adder at each bit. At bit i its inputs are Ai, Bi XOR K, and carry Ci; the output is Si and the next carry. K is shared by all XOR gates and C0 is the least-significant carry input. For two's-complement operands, which operations can be performed by choosing only K and C0?
A. A+B and A−B, but not A+1
B. A+B and A+1, but not A−B
C. A+B, but neither A−B nor A+1
D. A+B, A−B and A+1
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. A full-adder chain adds its two input words and the initial carry, so S=A+(B XOR K...K)+C0 modulo 2n.
2. Enumerate the controls: (0,0) produces A+B; (0,1) produces A+B+1; (1,0) produces A+complement(B)=A−B−1; (1,1) produces A−B.
3. For arbitrary B none of these cancels B entirely. In particular the extra carry in (0,1) gives A+B+1, not A+1. Thus only addition and subtraction are generally available: A.

Solution: The gates feeding the B inputs are XOR gates. For an n-bit word the circuit computes A+(B XOR K…K)+C₀ modulo 2ⁿ. Setting (K,C₀)=(0,0) gives A+B; setting (1,1) gives A+¬B+1=A−B. Neither setting can remove arbitrary B to give A+1 solely by changing those two control lines. Therefore A+B and A−B, but not general A+1, is option A.

Original paper, page 6