Modeling Logic Gates in Simulation
How gate behavior, timing, and unknown states are represented in digital logic simulators used to verify designs before fabrication.
Why simulate gates
Before a design is committed to silicon, it is checked in a logic simulator. The simulator evaluates the gate network against test inputs and reports the outputs, catching functional and timing errors while they are still cheap to fix.
More than two values
Real simulation uses more than 0 and 1. A common four-value system adds X for unknown or uninitialized and Z for high impedance. X propagates through logic to flag places where behavior is undefined, and Z models the disconnected state of a tri-state output on a shared bus.
Event-driven evaluation
- The simulator processes signal changes as time-ordered events, not by re-evaluating everything each step.
- When an input changes, only the gates it feeds are scheduled for update.
- Each gate applies its delay, so its output change is queued for a later time.
- This event queue makes large designs simulate efficiently.
Delay models
Gates are annotated with propagation delays, often separate rise and fall values, so the simulator reproduces realistic timing and can expose glitches and race conditions. Zero-delay modes run faster for pure functional checks but hide timing hazards.
A simple functional model
def nand(a, b):
if a == 'X' or b == 'X':
return 'X' # unknown in, unknown out
return 0 if (a and b) else 1
From gates to Kronos models
The same event-driven principles scale from a handful of gates to the large numerical models Kronos runs for the Hyperion breeder and the burner. Those are physics simulations rather than logic circuits, but they share the discipline of verifying behavior in software before committing to hardware; the machines remain designs and simulations, not built.