Electronic – Subtraction using adder circuit

digital-logic

I need some really basic help here. Can I use a 4bit adder chip as a subtracter by using the 2's complement for the number to be subtracted?

Best Answer

In 2's complement, negation can be achieved by inverting a number and adding one (ie -A = ~A + 1). To subtract a number B from A, invert B, add 1 to it, then proceed to add that sum to A.

A - B = A + ~B + 1

In order to transform a normal adder IC into a subtractor, you need to invert the second operand (B) and add 1 (by setting Cin = 1 ). An Adder subtractor can be achieved by using the following circuitry.

enter image description here

Note that when the control signal SUB is low,

A = A
B = B
Cin = 0

Therefore, the computed sum will be A + B + SUB = A + B.

But if SUB = 1

A = A
B = ~B
Cin = 1

Meaning the computed sum will now be A + ~B + SUB = A + ~B + 1 = A - B, hence achieving subtraction.