โ Full Subtractors
Full Subtractors are the simplest forms of general subtractor circuits that are able to subtract multi-bit numbers in chains
๐งฎ Difference Logic
Given place-values A, B, and the borrow-in B_in
Through knowledge of half subtractors
we would subtract B from A first, then subtract the borrow-in, B_in through XOR
Since XOR is associative, the sequence or grouping of subtraction doesn’t matter
General Formula for Difference
$$
\text{Diff} = A \oplus B \oplus B_{in}
$$
General Formula for Difference
$$ \text{Diff} = A \oplus B \oplus B_{in} $$๐๏ธ Borrow Logic
Borrow is a little harder to find a general form, so we start from an exhaustive form, where any pair of conditions triggers a borrow
$$ B_{out} = \overline{A} + B + B_{in} $$A is 0 and B is 1 โ need to borrow
OR
A is 0 and B_in is 1 โ still need to borrow
OR
B is 1 and B_in is 1 โ subtracting 2 from 1 or 0 โ need to borrow
Why we find pairs Pairs are the simplest constructs of condition, we can construct subtractions of more terms through subtractions of less, and 2 is the least amount
i.e. We don’t have to check if all 3 inputs cause a borrow, since any 2 already do
Exhaustive Form
$$ B_{out} = \overline{A} \cdot B + \overline{A} \cdot B_{in} + B \cdot B_{in} $$We can also factor the expression for the 2 terms that share $\overline{A}$ as a factor, but we prefer grouping terms sharing $B_{in}$ because we want the focus to be on the 2 main subtraction terms: A and B
Intermediate Simplified Form
$$ B_{out} = \overline{A} \cdot B + (\overline{A} + B) \cdot B_{in} $$True is already handled by $\overline{A} \cdot B$โโso we have to use exclusive OR for atomicityGeneral Formula for Borrow
$$ B_{out} = \overline{A} \cdot B + (\overline{A} \oplus B) \cdot B_{in} $$