JSON.stringify, and together they hold everything a frontend needs to draw a circuit and animate its signals.
Topology
describe() returns a ComponentDescription tree rooted at "root":
id (its hierarchical path), its name, the parent id, the definition name, its kind, its ports, child components and internal connections. Primitives have empty components and connections. See ComponentDescription.
Wires
A wire is one driver plus every port connected to it. The driver is either one of the circuit’s inputs or a gate’s output. Connections add no delay, so every port on a wire always has the same value. A wire is named after its driver. InAND, the wire leaving the inner NAND is called root.nand.outputs.out, and it also reaches root.not.inputs.a and both inputs of the NOT’s gate. That’s why the trace and the netlist talk about wires, while signals lists every port separately.
Netlist
elaborate() returns the flattened graph that the simulator actually runs:
State
inspect() turns a simulation state into plain data:
signalshas an entry for every port in the hierarchy, in hierarchical order, so any port in a diagram can be colored directly.wiresgroups those ports by wire, so you can see that a value really is the same wire.
Trace
Enable tracing withsimulate(definition, { trace: true }). It’s off by default to save memory.
- Entries are ordered by tick, and by wire id within a tick, so traces are deterministic.
trace()returns everything from tick 0 up to the state you call it on. Branches each have their own trace, and they share their common history.- Each state also has
changes: just the entries added by the step that produced it. That’s handy when stepping withstep().