Useful Blocks
Rather than design every circuit from raw gates, engineers assemble standard building blocks — combinational modules so common they are used like Lego pieces.
The adder does binary addition. A half adder adds two bits, producing a sum (, the XOR) and a carry (, the AND). A full adder adds three bits — two operands plus a carry-in — producing a sum and a carry-out, so full adders can be chained: the carry-out of one feeds the carry-in of the next. Chaining full adders makes a ripple-carry adder that adds two -bit numbers (with the carry rippling along, which also explains why addition takes longer for wider numbers).
A multiplexer (MUX) is a data selector: it has several data inputs, some select lines, and one output, and it routes the chosen input to the output. A MUX with data inputs needs select lines. MUXes are how a circuit chooses between sources — the hardware equivalent of an if/else.
A decoder does the opposite: it takes a -bit input and activates exactly one of output lines — the one whose number matches the input. Decoders select a specific memory row or device from an address. Its inverse, an encoder, turns a one-active-line input back into a binary number.
| Block | Function |
|---|---|
| Half / full adder | Add bits, producing sum and carry |
| Multiplexer (MUX) | Route one of several inputs to the output |
| Decoder | Activate one of outputs from a -bit input |
Common pitfall: mixing up a multiplexer and a decoder. A MUX has many inputs and one output (it selects one input to pass through); a decoder has one small input and many outputs (it activates exactly one output line). They are near-opposites — one narrows, the other fans out.
A 4-to-1 multiplexer with four data lines converging; the two select bits choose one path that lights in accent through to the single output — beside a decoder fanning one 2-bit input out to activate one of four out.