Fig. 1 — Full SubtractorInteractive simulation

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.

InputsOutput
ABBinDifferenceBorrow out
000000 − 0 − 0 = 0.
00111An incoming borrow makes the local result 1 and propagates a borrow.
01011Subtracting B = 1 from A = 0 produces Difference 1 with a borrow.
01101Both B and B_in are subtracted from 0; the local result is 0 and a borrow propagates.
100101 − 0 − 0 = 1.
101001 − 0 − 1 = 0 with no outgoing borrow.
110001 − 1 − 0 = 0 with no outgoing borrow.
111111 − 1 − 1 requires a borrow and leaves local Difference 1.

Boolean Expression

D=A⊕B⊕BinD = A \oplus B \oplus B_{in}

Difference is the parity of A, B, and B_in.

Bout=A‾B+A‾Bin+BBinB_{out} = \overline{A} B + \overline{A} B_{in} + B 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.

  1. 1
    A=0B=1Bin=0
    Expected:Difference = 1, Borrow out = 1
    What you'll see:With A = 0 and B = 1, subtraction needs a borrow and leaves a local Difference of 1.
  2. 2
    A=0B=1Bin=1
    Expected:Difference = 0, Borrow out = 1
    What you'll see:The additional incoming borrow changes the Difference to 0, while Borrow out remains asserted.
  3. 3
    A=1B=0Bin=1
    Expected:Difference = 0, Borrow out = 0
    What you'll see:A supplies exactly the one unit consumed by B_in, so neither Difference nor Borrow out is asserted.
  4. 4
    A=1B=1Bin=1
    Expected:Difference = 1, Borrow out = 1
    What 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.

Continue Learning