DevTools Logo

Digital Logic Gate & Circuit Simulator

About this tool

The Logic Gate & Circuit Simulator runs a real discrete-event simulation, not a static truth-table evaluator. Every gate, latch and flip-flop has a propagation delay; changes ripple through the netlist as timed events on a priority queue, so you can watch a signal actually take several ticks to cross a chain of gates the way it would on real silicon.

Signals carry four values — 0, 1, Z (high-impedance) and X (unknown/conflict) — so tri-state buffers and driver conflicts behave correctly: two outputs fighting over the same net are detected and flagged rather than silently resolved to whichever wire was drawn last.

Beyond gates (AND/OR/NAND/NOR/XOR/XNOR/NOT/BUFFER/TRISTATE), the palette includes SR and D latches, D flip-flops with configurable clock edge, 2:1 and 4:1 multiplexers, switches and clocks as sources, and OUTPUT/seven-segment sinks — enough to wire adders, counters and small state machines from scratch.

For purely combinational circuits, the tool derives a full truth table and a Karnaugh map with Quine-McCluskey minimization, giving you both the brute-force behavior and the simplified Boolean expression side by side.

When you're ready to leave the browser, export the circuit as Verilog, VHDL, an annotated JSON netlist (with a documented schema for round-tripping), or an SVG schematic reflecting live signal colors.

How to use this tool

  1. Place components

    Click a palette entry, then click the canvas to drop it; click again to cancel placement.

  2. Wire pins

    Click an output pin, then an input pin, to connect them; clicking the same pin twice cancels the pending wire.

  3. Toggle inputs

    Click an INPUT switch to flip it between 0 and 1 while the simulation runs.

  4. Run or step

    Run advances the simulator continuously; Step advances exactly one event tick for precise timing inspection.

  5. Edit properties

    Select a component to adjust its propagation delay, input count, clock period or flip-flop edge in the side panel.

  6. Read the outputs

    Switch to the Truth Table or K-Map tab for combinational circuits, or Export for Verilog/VHDL/SVG/JSON.

Use cases

Digital logic coursework

Build the exact circuit from a homework problem and read off its truth table or minimized K-Map instead of hand-deriving both.

Interview prep

Prototype adders, muxes and small state machines live, then verify propagation and driver conflicts before whiteboarding them.

HDL bootstrapping

Sketch a small module visually, export Verilog or VHDL as a starting point, then continue in your normal toolchain.

Teaching tri-state buses

Deliberately create a driver conflict to show students what bus contention looks like and why enable lines matter.

Common mistakes

Mistake:Expecting a static truth table for clocked circuits

Fix:Circuits with CLOCK, DFF or latch elements depend on prior state and timing — the Truth Table tab warns and still shows a snapshot, but Step through the simulation instead to see real behavior.

Mistake:Wiring two outputs to the same input pin

Fix:Each input pin accepts one wire; to combine signals, use a gate (OR, MUX) or a tri-state bus with enable lines, not two direct wires.

Mistake:Ignoring propagation delay when reading the canvas

Fix:A newly wired gate doesn't show its output instantly — Step or Run to let the event queue settle before judging the result.

Mistake:Building more than 10 input variables

Fix:Truth tables and K-Maps cap at 10 and 6 input variables respectively (2^10 rows, readable K-Map grid) — beyond that, verify behavior by stepping the simulation instead.

Frequently asked questions

Is this a truth-table evaluator or a real simulator?

A real discrete-event simulator. Every component has a propagation delay (editable per-instance), and signal changes are scheduled as timed events on a priority queue rather than resolved instantly. Step through a circuit one event at a time to see exactly when each gate's output changes.

What do the four signal colors mean?

Signals are 4-valued: 0 (low), 1 (high), Z (high-impedance — a tri-state output that isn't driving), and X (unknown, including driver conflicts). A wire showing X usually means two outputs are fighting over the same net, or an input hasn't been driven yet.

Why does the Truth Table tab warn about my circuit?

If your circuit contains a CLOCK, DFF, or latch, its outputs depend on prior state and timing, not just the current input combination — a static truth table can't capture that fully. The tab still renders a best-effort snapshot, but Step or Run the simulation to see real sequential behavior.

How is the K-Map expression minimized?

With the Quine–McCluskey algorithm: prime implicants are generated from the on-set (and don't-cares, where the circuit's output is undefined for that input combination), then a minimal cover is selected. The result is shown as a sum-of-products expression alongside the grid.

Can I package a sub-circuit into a reusable IC?

The simulation engine supports IC flattening and JSON export/import with IC references, but the canvas editor doesn't yet have a 'package as IC' button or an IC palette entry — placing an IC instance requires hand-editing the exported JSON. This is a deliberate scope decision rather than an oversight.

What can I export, and is the code actually usable?

Verilog and VHDL (both throw a clear error instead of silently mis-compiling if the circuit references an unflattened IC), a documented JSON netlist you can re-import, and an SVG schematic that reflects live signal colors at export time.

How large a circuit can I build?

There's no hard component cap, but truth tables are capped at 10 input variables (2^10 rows) and the K-Map display at 6, since both are meant for compact combinational logic — larger designs are better verified by stepping the simulation than by exhaustive truth tables.

Does anything leave my browser?

No. The simulator, truth-table/K-Map derivation, and all code generation run entirely client-side; nothing about your circuit is sent anywhere.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML