Half Subtractor, Full Subtractor, and 4-Bit Borrow Subtractor in Logisim-evolution
Direct Answer: Designing Binary Subtractors in Logisim-evolution
A Half Subtractor computes $A – B$ for two 1-bit inputs, producing Diff = A ⊕ B and Borrow = ~A · B. A Full Subtractor incorporates an incoming borrow (Bin) from lower stages, evaluating Diff = A ⊕ B ⊕ Bin and Bout = (~A · B) + (~(A ⊕ B) · Bin). While cascading four Full Subtractors forms a 4-bit ripple-borrow subtractor, real CPUs and ALUs instead reuse a 4-bit Binary Adder with XOR-inverted $B$ and $C_{in} = 1$ ($A + \sim B + 1$) to handle both addition and subtraction in shared hardware.
Recommended Hardware Starter Kits for Arithmetic Labs
Elegoo Electronics Component Starter Kit
Prototype discrete Half/Full Subtractors with 74LS86 XOR, 74LS04 NOT, and 74LS08 AND gates on breadboards.
Digital Design & Computer Architecture
Explains two’s complement subtraction, signed overflow detection, and unified ALU adder-subtractor hardware.
Full Subtractor Truth Table and Boolean Equations
| A | B | Bin | Diff (D) | Borrow Out (Bout) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
Step by Step Ripple-Borrow Subtractor vs Two’s Complement Adder
Method A: Chaining Two Half Subtractors into a Full Subtractor
Place two HalfSubtractor subcircuits. Feed A, B into Half Subtractor 1 producing D1, B1. Feed D1, Bin into Half Subtractor 2 producing final Diff and B2. OR B1 and B2 together to produce Bout, then cascade four stages for 4-bit subtraction.
Method B: Unified Two’s Complement Adder-Subtractor
Pass input bus B[3:0] through four XOR gates controlled by mode bit Sub, and wire Sub to Cin of a 4-bit Adder. When Sub = 1, the circuit computes A + (~B) + 1 = A - B cleanly in one shared block.
Frequent Traps in Subtractor Circuits
Trap 1: Putting the NOT Gate on B Instead of A
Fix: In A - B, Borrow occurs when A = 0 and B = 1, so Borrow = ~A & B (invert A, not B).
Trap 2: Confusing Borrow Out with Carry Out
Fix: In a ripple-borrow subtractor, Bout = 1 means A < B (borrow needed); in a two’s complement adder-subtractor, Cout = 0 means borrow needed.
Trap 3: Floating Initial Borrow-In (Bin)
Fix: Always ground Bit 0’s Bin to constant 0.
Trap 4: Interpreting Unsigned Underflow as Overflow
Fix: For signed subtraction, check V = C3 ⊕ C4 rather than relying on Bout.
Curriculum Progression from Subtractors to ALUs
Frequently Asked Questions About Binary Subtractors
Why don’t real CPUs build separate Subtractor circuits alongside Adders?
Because two’s complement subtraction ($A – B = A + \sim B + 1$) reuses the exact same Adder hardware by simply adding XOR inverters on $B$ and setting $C_{in} = 1$, cutting silicon area in half.
What is the only difference between a Half Adder and a Half Subtractor?
Both use an identical XOR gate for Sum/Diff; the Half Subtractor simply inserts one NOT gate on input A before the AND gate (Borrow = ~A & B).
Does Logisim-evolution have a built-in Subtractor component?
Yes, under Arithmetic → Subtractor (configurable from 1 to 32 bits, with b in and b out ports).
How do I convert a negative two’s complement result back to positive magnitude?
Use Logisim’s Arithmetic → Negator component (or invert all bits and add 1) whenever the MSB sign bit equals 1.
