Foundations — Comparators
Before you can read a single line of Comparators, you need to be fluent in the tiny language it is written in. Below is every symbol and idea the parent note uses, each built from nothing, ordered so each one leans on the one before it.
1. A "bit" — the atom of everything
WHAT it looks like: a lamp. Look at the first figure — a bulb that is dark (0) or glowing (1). That is the entire universe of a single bit.
WHY the topic needs it: comparators compare binary numbers, and a binary number is just a row of bits. If you don't know what one bit is, a row of them is meaningless. Everything below is built out of these two symbols, 0 and 1.
2. A binary number and "place value"
The rightmost bit is worth , the next , then , then , and so on.
WHAT it looks like: the second figure lays on a shelf of weights . See how the left bit sits on the tallest pillar (weight 8) and the right bit on the shortest (weight 1).
WHY the topic needs it: the parent note's central trick — "compare from the MSB down" — only makes sense once you feel that the leftmost bit dominates the value. A single high MSB () outweighs every lower bit put together (). That is the whole reason comparators scan left-first.
3. The naming: , , and subscripts
Plain words: means "bit number 1 of the number " — position 1, counting from the right starting at 0. The letter is just "how many bits we have".
WHY the topic needs it: without indices we could not write general formulas like . The subscript is how we talk about "the bit at each position" without drawing a specific number.
4. The overbar — NOT
WHAT it looks like: an inverter — feed a light in, the opposite light comes out.
WHY the topic needs it: the 1-bit result literally reads " is 1 and is not 1", i.e. — the only way can be greater. You cannot read that equation without knowing the bar.
| 0 | 1 |
| 1 | 0 |
5. Truth tables — the honest full listing
WHAT it looks like: a complete menu. Nothing is left out — that is its power. See Truth Tables and Minterms for how each output "1" turns into an equation.
WHY the topic needs it: the parent note derives the 1-bit comparator by reading its 4-row truth table column by column. Each 1 in a column becomes one product term. If you don't know a truth table is exhaustive, you won't trust the derivation covers all cases — and covering all cases is the whole point.
6. The three logic gates: AND, OR, NOT
WHAT it looks like: the third figure shows the three gate shapes with a tiny truth strip under each. Notice the AND gate's flat back and round nose; the OR gate's curved back; the NOT gate's triangle with a bubble.
WHY the topic needs it: every comparator equation is built from just these three operations. is one NOT and one AND. The multi-bit is a big OR of guarded AND terms. Master these three and the whole design is just spelling.
7. XOR and XNOR — the "difference" and "same" detectors
| (differ) | (same) | ||
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
WHY the topic needs it: the per-bit match signal is an XNOR. Equality of the whole number is an AND of all these XNORs. If you confuse XOR with XNOR you build a machine that reports "not equal" when it should report "equal" — the single most common bug in the parent's mistakes list.
8. Combinational circuit — no memory, no clock
Contrast: a circuit with memory (a "sequential" circuit) would remember old values. A comparator does not — the same always give the same .
WHY the topic needs it: the parent's opening line calls a comparator "a combinational circuit… no clock, no memory". This is the promise that lets us describe it fully with a truth table: the output is a pure function of the inputs, nothing hidden.
9. Putting the symbols together (a reading test)
Now read this parent equation out loud in plain words:
- — "MSB of is 1 AND MSB of is 0" (so wins on the top bit),
- — "OR",
- — "the MSBs were equal" (XNOR of the top bits),
- — "AND the LSB of is 1 while LSB of is 0".
Whole sentence: " is greater if its top bit already wins, OR the top bits tie and its bottom bit wins." If you can say that, you are ready for the parent note.
Prerequisite map
Equipment checklist
Self-test: cover the right side and answer each before revealing.