Binary Number Analyzer
Multi-gate circuit analyzing 3-bit binary numbers. Uses NOT, AND, OR, and XOR gates to detect patterns and properties in binary data.
Ce que tu apprendras
- Compute the zero-detect signal as inverted OR-reduce of all input bits.
- Compute parity using XOR-reduce of all input bits.
- Display the binary value's decimal equivalent on a digit display.
- Run multiple bitwise reductions in parallel on the same input bus.
- Connect these reductions to CPU status flags (Z, P, S).
Comment ça fonctionne
A binary number analyzer combines several common combinational circuits into one demo: detection of zero, even/odd parity, and value comparison. Each is built from primitive gates and runs in parallel on the same input bus.
- Zero detection: OR-reduce all input bits, then invert. Output high only when every input bit is 0. - Parity (even): XOR-reduce all input bits. Output high when there's an even number of 1s. (XOR-reduce + invert gives even parity; raw XOR-reduce gives odd parity.) - Magnitude indicator: Display the binary value on a digit display, often with a comparator against a threshold.
These three are the fundamental "properties" of a binary number you read directly from its bits without converting to decimal: is it zero? is it odd? how big is it? Real CPUs maintain status flags for exactly these properties (Z, P, S, N) updated every arithmetic operation.
Combining them into one demo highlights how multiple bitwise reductions on the same bus run independently and in parallel — they don't share intermediate signals, just the input bits.
Table de vérité
Selected 4-bit input rows showing zero detection and parity.
| Entrées | Sortie | ||||||
|---|---|---|---|---|---|---|---|
| B3 | B2 | B1 | B0 | Zero | EvenParity | Decimal | |
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 — Zero=1, even parity (0 ones) |
| 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 — odd parity (1 one) |
| 0 | 1 | 0 | 1 | 0 | 1 | 5 | 5 — even parity (2 ones) |
| 1 | 1 | 1 | 1 | 0 | 1 | 15 | 15 — even parity (4 ones) |
Expression booléenne
Inverted OR-reduce: high only when every bit is 0.
Inverted XOR-reduce: high when there's an even number of 1s.
Essaie étape par étape
Règle les entrées dans la simulation ci-dessus, lis ce qui devrait se produire et vérifie-le.
- 1B = 0000Attendu:
Zero=1, Parity=1, Decimal=0Ce que tu verras: All zeros: Zero detect fires; even parity (0 is even). - 2B = 0011Attendu:
Zero=0, Parity=1, Decimal=3Ce que tu verras: Two 1s — even parity. Decimal display reads 3. - 3B = 0001Attendu:
Zero=0, Parity=0, Decimal=1Ce que tu verras: One 1 — odd parity (so even-parity light is off). Decimal reads 1. - 4B = 1111Attendu:
Zero=0, Parity=1, Decimal=15Ce que tu verras: Four 1s — even parity. Maximum 4-bit value (15) on the display.
Composants utilisés
Applications concrètes
CPU status flags. Every ALU operation updates Zero, Parity, Sign, and other flags. These are wired to the same parallel reductions this circuit demonstrates.
Conditional branch instructions. "Jump if zero" reads the Zero flag — set by the Zero-detect logic on the last ALU result.
Network checksums. Parity bits and CRCs use XOR reductions over packet bytes for error detection.
Interrupt-state polling. A polling controller checks several status registers' parity or zero state to determine if any interrupt is pending.
Memory comparators. Equality compare against a fixed value uses XOR-reduction patterns similar to parity but per-bit XOR with the constant.