Examples
Interactive circuit examples from half adder to Fibonacci generator
Half Adder
Two bits → sum + carry. The simplest arithmetic circuit. Toggle the switches to see how AND computes carry and XOR computes sum.
Full Adder
Three bits (a + b + carry in) → sum + carry out. Reuses HalfAdder as a composite — the simulator expands it to primitives automatically.
Counter
Increments on each clock cycle. A register feeds its output through an adder that adds 1, and the result loops back. Step the clock to watch it count.
Fibonacci Generator
Two registers and one adder produce the Fibonacci sequence every clock tick. A DFlipFlop seed trick injects +1 on the first tick only.
Design Patterns
Combinational — no state, no clock. Outputs computed directly from inputs. Examples: gates, adders, muxes, ALUs.
Sequential — has state and clock. State updates on rising clock edge, outputs reflect current state. Examples: counters, registers, shift registers.
Hierarchical composition — build complex circuits from simpler ones. FullAdder from HalfAdder, ALU from Adder+Mux, CPU from ALU+RegisterFile+Memory.
Feedback loops — connect a node's output back to its input through a register. The register breaks the combinational loop by introducing a one-cycle delay. This is how counters, state machines, and CPUs work.