Digital electronics takes a continuous voltage and forces it into two categories. In a 5 V system, anything above about 2.0 V is read as logic 1 and anything below about 0.8 V as logic 0. The band between is undefined and a well-designed circuit never lingers there. This deliberate throwing away of information is what makes digital circuits robust: a signal degraded by noise still lands in the right category, and gets cleanly regenerated by the next gate.
The gates
| Gate | Boolean | Plain English | Output is 1 when… |
|---|---|---|---|
| AND | Y = A · B | both | every input is 1 |
| OR | Y = A + B | either | at least one input is 1 |
| NOT | Y = A′ | opposite | the input is 0 |
| NAND | Y = (A·B)′ | not both | NOT every input is 1 |
| NOR | Y = (A+B)′ | neither | all inputs are 0 |
| XOR | Y = A ⊕ B | different | the inputs differ |
| XNOR | Y = (A⊕B)′ | same | the inputs match |
Building and reading a truth table
A truth table lists every possible combination of inputs and the output for each. With n inputs there are 2ⁿ rows — 4 rows for two inputs, 8 for three, 16 for four. Write the input columns in counting order (00, 01, 10, 11) so you cannot accidentally miss a combination, then add an intermediate column for each gate in the circuit and fill it before attempting the final output.
The half adder is worth understanding because it is where logic gates stop being abstract. Adding two bits gives 0+0=0, 0+1=1, 1+0=1, and 1+1=10 — a sum bit of 0 and a carry of 1. Look at the sum column: it is exactly XOR. Look at the carry column: it is exactly AND. Two gates perform binary addition, and chaining full adders (which also accept a carry in) builds the adder inside every CPU's ALU.
Combinational circuits
A combinational circuit's output depends only on its inputs right now, with no memory of what came before. Every circuit in this topic is combinational. Working out its behaviour is always the same procedure: label the output of every gate, build a truth table with one column per label, fill the columns left to right in the order the signals flow, and read off the final column.
Real chips
The classic 7400-series chips put several gates in one 14-pin package: a 7408 holds four AND gates, a 7432 four ORs, a 7404 six inverters, and the 7400 four NANDs. Pin 14 is supply and pin 7 is ground on almost all of them. Every unused input must be tied to a defined level, because a floating CMOS input drifts, oscillates and wastes power — it does not politely sit at zero.