Skip to content
Official PYQ · 2003

GATE CS 2003 Q46 — Computer Arithmetic

Explain with AI

Consider the ALU shown below.

 

If the operands are in 2’s2’s complement representation, which of the following operations can be performed by suitably setting the control lines KK and C0C_0 only (+ and – denote addition and subtraction respectively)?

Choose one option
View worked solution

Answer: A

In the given ALU circuit, the inputs to the nn-bit adder are:

  • First input: AA
  • Second input: B⊕KB \oplus K (since BB is XORed with the control line KK)
  • Carry-in: C0C_0

The output of the adder is given by the expression:

S=A+(B⊕K)+C0S = A + (B \oplus K) + C_0

Let us analyze the possible operations by setting the control lines KK and C0C_0:

  1. Addition (A+BA + B): By setting K=0K = 0 and C0=0C_0 = 0, we get:
    S=A+(B⊕0)+0=A+BS = A + (B \oplus 0) + 0 = A + B This operation is possible.
  2. Subtraction (A−BA - B): In 22’s complement representation, A−B=A+Bˉ+1A - B = A + \bar{B} + 1. By setting K=1K = 1 and C0=1C_0 = 1, we get:
    S=A+(B⊕1)+1=A+Bˉ+1=A−BS = A + (B \oplus 1) + 1 = A + \bar{B} + 1 = A - B This operation is possible.
  3. Increment (A+1A + 1): To perform A+1A + 1, the second operand of the adder must be 00 with C0=1C_0 = 1. Since the second operand is B⊕KB \oplus K, its value depends on the external input BB. We cannot force B⊕K=0B \oplus K = 0 for all values of BB using only the control lines KK and C0C_0. Thus, A+1A + 1 is not possible.

Therefore, we can perform A+BA + B and A−BA - B, but not A+1A + 1.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Computer Arithmetic questions