Related Articles
GATE | GATE-CS-2003 | Question 90
• Difficulty Level : Hard
• Last Updated : 19 Nov, 2018

Consider the ALU shown below.

If the operands are in 2’s complement representation, which of the following operations can be performed by suitably setting the control lines K and C0 only (+ and – denote addition and subtraction respectively) ?
(A) A + B, and A – B, but not A + 1
(B) A + B, and A + 1, but not A – B
(C) A + B, but not A – B, or A + 1
(D) A + B, and A – B, and A + 1

Explanation: We can set value of k and c as 0 or 1

Two things we need to know—

1. If we take xor of any number with 1 we get it in its complement form.
2. If we take xor of any number with 0 we get that number itself.

So on setting k=1 we can get –B and c will work like select signal

C=1 means subtract

Hence with k=1 c=1 we get A-B

With K=0 c=0 we get A+B

We need b=1,c=0 or b=0,c=1 to get A+1
since b isn’t predefined we can’t get A+1

So Ans is (A) part.

Quiz of this Question

Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up