One pair of inputs. Seven functions.
Choose A and B to compare the gate outputs. Cin adds a third bit for the full-adder example below.
Interactive controls require JavaScript. The worked tables and linked guides remain readable without it.
Follow the full-adder carry
Open the complete two-input truth table
| A | B | AND | OR | NAND | NOR | XOR | XNOR |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
Build a four-variable K-map
Rows are AB, columns are CD; A is the most significant bit. Select a cell to cycle 0 → 1 → X → 0. X marks a don't-care that your specification must justify.
| AB/CD | 00 | 01 | 11 | 10 |
|---|
This tool lists minterms and don't-cares. It does not automatically minimize expressions.
Follow the checked three-group solution →A worked example you can check
For A=B=Cin=1, the first half adder gives partial=0 and c1=1. The second adds partial=0 to Cin=1, giving Sum=1 and c2=0. Cout=c1 OR c2=1, so the two-bit result is 11: decimal 3.
For the map, F=Σm(0,1,2,5,8,9,10) is equivalent to B′D′+B′C′+A′C′D. The linked solution identifies each group and checks every input.
Source and verification
The executable checks cover all four binary gate input pairs, all 12 half/full-adder input cases, eight JK state/input rows, eight active-high SR state/input rows, 512 four-step JK sequences and all 16 cells of the worked K-map. They also check Gray-code wrap adjacency and reject invalid numeric inputs.
Download model source · Download tests
Save both files in one folder and run node test_logic.mjs. These tests validate binary function and arithmetic; they do not model voltage thresholds, gate delays, metastability or hardware fault coverage.