3.3.4 · D1Combinational Circuits

Foundations — Subtractors

2,820 words13 min readBack to topic

Throughout this page, two abbreviations appear:


Symbol 0 — a bit (the atom of everything)

Picture it as a single lamp on the board. Every letter you will meet (, , …) is one of these lamps — either dark or glowing.

Figure — Subtractors
Figure s01 — A bit as a lamp. Left: dark lamp = value . Right: glowing lamp = value . There is no in-between state; this "strictly on-or-off" fact is what makes truth tables finite and buildable.

Why the topic needs it: subtraction of "binary numbers" means subtraction of columns of bits. If you don't picture each letter as a lamp that is strictly on-or-off, the truth tables below look like magic. They are not — they are just "try every possible pattern of lamps."


Symbols and — the two inputs of one column

Picture two lamps stacked vertically, exactly like the two digits you line up on paper when you do subtraction by hand.


The borrow idea (before any symbol for it)

Do in your head. You can't — is smaller. On paper you'd "borrow from the next column." The same thing happens with single bits: can't stay , so we grab value from the column above.

Figure — Subtractors
Figure s02 — Borrowing in one column. The top bit is , the bottom is , so is impossible. We pull a bundle worth (yellow arrow) from the higher column, compute giving the difference , and send a "you owe 1" flag upward (pink arrow): that flag is .

Why the topic needs it: the entire difference between a subtractor and an adder is this one signal. An adder pushes a carry up; a subtractor pulls a borrow down. Same picture, opposite direction.


Symbol and — the borrow signals

Why the topic needs it: the HS ignores incoming borrow (no ). The FS accepts so it can be chained. That single extra input is the only structural difference between the two circuits.


Symbol — the difference output

Picture: after you took (and any borrow) away from , whatever glows in the current column is .


The bar: means NOT

The bar can also sit over a whole expression, not just one letter. For example means "first compute , then flip the result." So exactly when and are the same (because is when they differ, and the bar flips that).

Why the topic needs it: the borrow only happens when the top bit is . But formulas multiply things that are true (). So to say "top bit is 0" as a -signal, we write — it equals exactly when . That is why the borrow is and not .


The dot and plus: AND () and OR ()

Operator precedence — read a formula without guessing

So is read as — the bar hits only , each AND-group forms first, then OR joins them. A bar over a group, like , always needs the whole expression evaluated first because the bar sits over all of it.

Why the topic needs it: literally reads "borrow if (top is 0 AND bottom is 1) OR (top is 0 AND borrow-in) OR (bottom is 1 AND borrow-in)." AND builds each condition; OR collects them.


The XOR sign:

0 0 0
0 1 1
1 0 1
1 1 0

Figure — Subtractors
Figure s03 — XOR reads "1 when they differ." The four columns show every pair as two lamps; the output is (pink) only in the two middle cases where one lamp is on and the other off. This "1 when different" rule is exactly the difference bit .

Extending to three: is when an odd number of the three are . That is why the full-subtractor difference is a three-way XOR — it counts parity, and an odd count means one leftover candy.


Putting it together — the full truth tables and formulas

Now that every symbol is defined, here are the complete tables (no case left to the reader) and the boxed formulas they produce.

Half Subtractor (HS) — all 4 cases of

0 0 0 0
0 1 borrow, leftover 1 1
1 0 1 0
1 1 0 0

Reading the columns: when the bits differ (that's XOR); only in the row (that's ).

Full Subtractor (FS) — all 8 cases of

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

is in every row where an odd number of inputs are — that is three-input XOR. is in every row where a borrow is needed. Grouping those five borrow-rows gives the standard sum-of-products form.


The shortcut — derived here, step by step

Real hardware doesn't build a separate subtractor; it reuses an adder. The claim is:

Let us derive it rather than quote it. Every step is a WHAT / WHY.

Step 1 — What is as a number? For an -bit value, flipping every bit turns into . Why: the all-ones -bit number equals , and flipping is the same as computing all-ones minus bit by bit (no borrow ever, since each column is ). So:

Step 2 — Add the . Why: we want a clean (the "two's complement" of ), and Step 1 gave us one short of that.

Step 3 — Add . Why: our goal is , so start from and add the quantity from Step 2.

Step 4 — Drop the . Why: is one bit wider than our -bit result; it lands in bit position , which our -bit output cannot hold, so it falls off. Discarding it is precisely what "" means (keep only the low bits).


The and notation, precisely


How the pieces feed the topic

Bit 0 or 1

Inputs A and B

Borrow idea top too small

Overbar NOT

AND dot and OR plus

XOR differ = 1

Borrow signals Bout and Bin

Borrow formula bar A times B

Difference D

Half Subtractor and Full Subtractor

Two power n and mod

Shortcut A plus not B plus 1


Equipment checklist

Recall Self-test: can you answer each before moving on?

A bit can take which values? ::: Only or . What do HS and FS stand for? ::: Half Subtractor (no borrow-in) and Full Subtractor (with borrow-in ). In , which letter is the top (subtracted-from) bit? ::: . What does equal when ? ::: (NOT flips it). What does the overbar physically signal in a borrow formula? ::: "The top bit is " expressed as a -signal — the boss is broke. vs vs — which one is the bottom input operand? ::: Plain ; the others are borrow flags going up () and coming in (). In boolean algebra, what does mean and what is ? ::: OR; . What does (or ) mean? ::: AND — true only when both are . Which binds tightest: NOT, AND, or OR? ::: NOT (the bar) binds tightest, then AND, then OR. Does mean or ? ::: — the bar covers only what it sits on. equals in which case? ::: When and differ. Half-subtractor formulas? ::: and . Full-subtractor formulas? ::: and . Why is the difference bit ? ::: Leftover is exactly when the two bits differ — the definition of XOR. What does "" throw away? ::: Any value at or above — the bit in position (a carry, not a borrow) — keeping only the low bits. Derive : what is as a number? ::: , so , and ; drop the .