Skip to main content
@pbzona/wires/components is a collection of useful parts and a demonstration of the toolkit. NAND is its only primitive. Every other component is a NAND network built with the same public circuit() API you use, with no privileged access to the simulator.

Unknown values

Because these components are pure NAND networks, they inherit NAND’s handling of "X". That is sometimes more pessimistic than the ideal truth table. For example, Mux outputs "X" when select is "X", even if a and b are equal. This is deliberate. It’s what the gate-level circuit would actually compute.

Timing

Each NAND adds one tick, so a component’s settle time depends on the longest NAND path its signals take. AND settles in 3 ticks from an input change (2 NAND levels, plus the tick that applies the input). Use run() to wait for any component, or step() to watch it settle one tick at a time.

Building on the library

The standard components are ordinary definitions. Add them to your own circuits, inspect them with describe(), or read their source as worked examples.

Gates

NAND, NOT, AND, OR, NOR, XOR, XNOR

Arithmetic

Half and full adders

Routing

Multiplexer and demultiplexer

Memory

NAND SR latch