22. Subtractors and Adder/Subtractor Circuits
In digital systems, subtraction ($A - B$) is usually performed using the 2's complement representation, converting the problem into addition ($A + (-B)$).
Half Subtractor and Full Subtractor
If implemented directly, subtractors use the concept of Borrow instead of Carry.
- Half Subtractor: Calculates $A - B$, yielding a Difference (D) and a Borrow Out ($B_{out}$). $D = A \oplus B$. $B_{out} = \overline{A} B$.
- Full Subtractor: Calculates $A - B - B_{in}$ (Borrow In).
The Universal Adder/Subtractor Circuit
Modern systems use the 2's complement approach, avoiding separate hardware for subtraction. A single N-bit parallel adder can perform both addition and subtraction.
Mechanism:
- Use a Control Signal (M), where M=0 for Addition and M=1 for Subtraction.
- When $M=1$ (Subtraction $A-B$):
- The input B bits are inverted (1's complement) using XOR gates (since $B \oplus 1 = \overline{B}$).
- The initial $C_{in}$ of the adder is set to 1 (to perform the +1 step required for 2's complement).
This single, efficient circuit handles both primary arithmetic operations.