Learn · Change an input · Check the result

Make the logic click.

Explore gates, follow a carry through two half adders and learn how a K-map gets its shape.

Free browser exercise · Binary functional model · Reviewed 12 November 2026

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.

Open the complete two-input truth table
All four binary inputs for six two-input gates
ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

Read the truth-table guide →

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.

Full-adder derivation · K-map fundamentals

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.