Full Subtractor
Two XOR gates compute Difference for A, B, and Borrow-in, while a three-product network computes Borrow-out. Cascading Borrow-out into the next stage forms a multi-bit ripple-borrow subtractor.
A full subtractor computes A − B − B_in for one binary position. Its Borrow-out output connects to the Borrow-in input of the next more-significant stage.
What You'll Learn
- Compute Difference and Borrow-out for A − B − B_in.
- Derive the XOR Difference equation and the three-term Borrow-out equation.
- Interpret every row of the full subtractor's eight-row truth table.
- Cascade Borrow-out into the next stage to construct a multi-bit subtractor.
- Compare ripple-borrow subtraction with adder-based two's-complement subtraction.
How It Works
Two cascaded XOR gates compute Difference = A ⊕ B ⊕ B_in. Difference is therefore HIGH when an odd number of the three input bits are HIGH.
Borrow-out records whether the local minuend is insufficient after both B and B_in are considered. The implemented sum-of-products network is B_out = A̅B + A̅B_in + BB_in. Three AND terms recognize the borrow-producing cases, and two OR gates combine them. The expression is equivalent to A̅B + B_in·¬(A ⊕ B), but the circuit's three-product form exposes the contributing conditions directly.
For a multi-bit subtraction, bit 0 may use a half subtractor because it has no incoming borrow. Each higher bit uses a full subtractor. B_out from position i feeds B_in at position i + 1, allowing the borrow to propagate toward the most-significant bit. As with a ripple-carry adder, the chain's worst-case delay grows with word width.
Truth Table
Difference is the local result bit; Borrow out is the borrow passed to the next more-significant position.
| Inputs | Output | ||||
|---|---|---|---|---|---|
| A | B | Bin | Difference | Borrow out | |
| 0 | 0 | 0 | 0 | 0 | 0 − 0 − 0 = 0. |
| 0 | 0 | 1 | 1 | 1 | An incoming borrow makes the local result 1 and propagates a borrow. |
| 0 | 1 | 0 | 1 | 1 | Subtracting B = 1 from A = 0 produces Difference 1 with a borrow. |
| 0 | 1 | 1 | 0 | 1 | Both B and B_in are subtracted from 0; the local result is 0 and a borrow propagates. |
| 1 | 0 | 0 | 1 | 0 | 1 − 0 − 0 = 1. |
| 1 | 0 | 1 | 0 | 0 | 1 − 0 − 1 = 0 with no outgoing borrow. |
| 1 | 1 | 0 | 0 | 0 | 1 − 1 − 0 = 0 with no outgoing borrow. |
| 1 | 1 | 1 | 1 | 1 | 1 − 1 − 1 requires a borrow and leaves local Difference 1. |
Boolean Expression
Difference is the parity of A, B, and B_in.
Borrow-out is asserted by any of the three product terms implemented by the circuit's AND–OR network.
Try It Step-by-Step
Set the listed controls in the embedded circuit, then compare the observed modeled state with the expected result.
- 1A=0B=1Bin=0Expected:
Difference = 1, Borrow out = 1What you'll see:With A = 0 and B = 1, subtraction needs a borrow and leaves a local Difference of 1. - 2A=0B=1Bin=1Expected:
Difference = 0, Borrow out = 1What you'll see:The additional incoming borrow changes the Difference to 0, while Borrow out remains asserted. - 3A=1B=0Bin=1Expected:
Difference = 0, Borrow out = 0What you'll see:A supplies exactly the one unit consumed by B_in, so neither Difference nor Borrow out is asserted. - 4A=1B=1Bin=1Expected:
Difference = 1, Borrow out = 1What you'll see:After subtracting B and B_in from A, the local bit is 1 and the next stage receives a borrow.
Components Used
Applications and Design Context
Ripple-borrow subtractors. Cascaded cells subtract fixed-width unsigned values and expose a final borrow condition.
Arithmetic logic units. The same Difference and borrow semantics underpin ALU subtraction, even when hardware reuses an adder through two's-complement transformation.
Digital comparison. Unsigned A < B can be determined from the final borrow of A − B when the implementation's carry/borrow convention is handled correctly.
Counters and address arithmetic. Decrementers and address-offset units rely on the same per-bit subtraction relationships.
Arithmetic education and verification. The full truth table provides a compact reference for checking gate-level subtractor designs.
Frequently Asked Questions
What is the difference between Borrow-in and Borrow-out?
Borrow-in is the debt arriving from the preceding, less-significant bit. Borrow-out is the debt this stage passes to the next, more-significant bit.
Why are two XOR gates used?
The first forms A ⊕ B; the second XORs that result with B_in. XOR is associative, so the pair implements the three-input parity function for Difference.
How do I build a 4-bit subtractor?
Connect four subtraction stages from least to most significant. Feed each stage's Borrow out to the next stage's Borrow in. Bit 0 may be a half subtractor; bits 1–3 are full subtractors.
Why do many ALUs use an adder for subtraction?
Two's-complement arithmetic rewrites A − B as A + not(B) + 1. Reusing the adder reduces duplicated hardware, while status logic converts the resulting carry convention into the architecture's borrow or no-borrow flag semantics.
Is the final Borrow-out a signed overflow flag?
No. Borrow relates to unsigned subtraction. Signed two's-complement overflow is determined from sign-bit relationships or carries around the sign position and must be evaluated separately.