How to use it
The page opens with a half adder already wired up. Flip the two switches on the left and watch the wires, the lamps and the marked row of the truth table change together. To build your own circuit, add switches (inputs), gates and lamps (outputs) from the palette, then join an output pin on the right of one part to an input pin on the left of another. An input pin takes one wire; an output pin can feed any number of inputs. The Examples list loads six ready circuits, and “Build from expression” turns a formula such as (A & B) | !C into gates. The circuit is saved in this browser; “Share link” puts it into a web address.
Controls
- Mouse: drag a part from the palette onto the workspace, or click it to drop it at the next free spot. Drag a part to move it, drag from pin to pin to wire, click a switch to flip it. Click a part or a wire and press Delete to remove it. Drag the background to pan.
- Touch: tap a palette item, then tap the workspace. Tap a pin, then a second pin to connect them. Tap a switch to flip it; drag parts or the background with one finger.
- Keyboard: the palette buttons add parts. In the workspace, Tab and Shift+Tab step through parts and pins. On a part, the arrow keys move it, Space flips a switch and Delete removes it. On a pin, Enter starts a wire and Enter on a second pin ends it; Esc cancels. Ctrl+Z undoes, Ctrl+Y redoes, and + − 0 zoom.
How it works
A logic gate takes signals that are either 0 or 1 and produces one output. AND gives 1 only when both inputs are 1. OR gives 1 when at least one input is 1. NOT flips its input. XOR gives 1 when the two inputs differ. NAND, NOR and XNOR are AND, OR and XOR followed by NOT; the small circle on the output means “inverted”.
A truth table lists every combination of inputs, one per row, with the outputs the circuit gives. With n inputs there are 2n rows: 4 for two switches and 64 for six, the largest table this page prints. The panel also shows a Boolean expression for each lamp, read from the wiring. To work on formulas alone, use the truth table generator, the Boolean algebra simplifier or the Karnaugh map solver.
Full adder: S = A ⊕ B ⊕ Cin, Cout = (A ∧ B) ∨ (Cin ∧ (A ⊕ B))
The sum bit is 1 when exactly one input is 1 (XOR); the carry is 1 when both are (AND). A full adder also accepts the carry from the column to its right, so a chain of full adders adds binary numbers of any length.
NAND is called universal because every other gate can be made from it. Join both inputs of a NAND and you get NOT. A NOT after a NAND is AND. By De Morgan’s law, ¬(A ∧ B) = ¬A ∨ ¬B, so a NAND fed with inverted inputs is OR. NOR is universal in the same way.
All of this is combinational logic: the outputs depend only on the present inputs. Feed an output back to an earlier input and the circuit becomes sequential. In the SR latch, two NOR gates feed each other. A brief 1 on S sets Q to 1, and the loop keeps it there after S returns to 0; a 1 on R resets it. That is one bit of memory. If the signals do not settle within 200 evaluation passes, as with a NOT gate wired to itself, the circuit is reported as oscillating.
Things to try
- Load “XOR from four NAND gates” and check that its table matches a single XOR gate.
- Load the De Morgan example: lamps X and Y agree in every row.
- In the SR latch, switch S on and off, then R on and off: Q holds its value while both are 0. With both at 1, both lamps go dark.
- Wire a NOT gate’s output to its own input and read the status line.
- Build
A xor B xor Cfrom the expression box and compare it with the S column of the full adder.
Frequently asked questions
Why do some pins say “n/c”?
It means “not connected”. An input without a wire reads as 0, so the gate still gives an output, but probably not the one you wanted.
Why is there no truth table for my circuit?
Either it has more than six inputs, which would need more than 64 rows, or a feedback loop reaches a lamp. With feedback the outputs depend on history, so the page shows a log of recent states instead.
What does “oscillating” mean?
The circuit has no stable state: every pass changes at least one signal. A real circuit of this kind keeps flipping as fast as its gates allow.
Does the simulator model gate delays?
No. The gates here are ideal. Real gates need a short time to switch, which causes brief glitches that are not shown. In a real SR latch, releasing S and R at the same moment gives an unpredictable result; here the outcome is always the same.