Boole and Shannon
George Boole, a schoolteacher in Lincoln and later professor at Cork, published The Laws of Thought in 1854, treating logical statements with algebra: true and false became 1 and 0, “and” became multiplication and “or” addition. For 83 years it was pure mathematics. Then Claude Shannon showed in his master’s thesis at MIT in 1937 that Boole’s algebra exactly describes circuits of relays and switches – and conversely, that any logical function can be built from switches. It has been called the most important master’s thesis of the 20th century. (On logic itself: see logic.)
Binary numbers
In the binary system each digit (bit) has the weight $2^n$: $1011_2 = 8 + 2 + 1 = 11$. Four bits can be written as one hexadecimal digit 0–F. Negative numbers are represented in two’s complement: with $n$ bits, $-x$ is the same as $2^n - x$; one inverts all the bits and adds 1. The advantage is that addition and subtraction become the same operation in hardware, and there is only one zero. With 4 bits the range is −8 (1000) to +7 (0111); adding 1 to 7 makes the number “roll over” to −8 – overflow, a classic source of program errors.
Logic gates
| A | B | AND $AB$ | OR $A+B$ | XOR $A\oplus B$ | NAND $\overline{AB}$ | NOR $\overline{A+B}$ |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
The NAND gate is universal: all other gates can be built from NAND alone – NOT is a NAND with its inputs joined, AND is NAND followed by NOT, and so on. The same holds for NOR. The Apollo guidance computer was built entirely from about 5600 NOR gates.
De Morgan and Karnaugh
Augustus De Morgan’s laws state that $\overline{A\cdot B} = \bar A + \bar B$ and $\overline{A+B} = \bar A\cdot\bar B$ – AND and OR can be swapped by inverting inputs and outputs. To simplify a logical expression with up to four or five variables one draws a Karnaugh map (Maurice Karnaugh, Bell Labs, 1953): the truth table arranged in Gray code so that neighbouring cells differ in only one variable. Groups of 1s in rectangles of 1, 2, 4 or 8 cells give the simplest terms directly. Larger problems use computer algorithms (Quine–McCluskey, Espresso).
The adder
A half adder adds two bits: the sum is $A\oplus B$, the carry $AB$. A full adder also adds a carry from the previous position: $S = A\oplus B\oplus C_\mathrm{in}$ and $C_\mathrm{out} = AB + C_\mathrm{in}(A\oplus B)$. Chaining four full adders, so that the carry “ripples” from position to position, gives a 4-bit adder – the heart of a microprocessor’s arithmetic unit (ALU). Ripple carry is slow because the last bit must wait for all the others; fast processors use carry-lookahead, which computes the carries in parallel.
Flip-flops and counters
Combinational circuits have no memory: the output depends only on the inputs right now. Cross-coupling two NAND gates gives a latch that remembers one bit. An edge-triggered D flip-flop copies the input D to the output Q exactly when the clock goes from 0 to 1, and holds it otherwise. With flip-flops one builds registers, shift registers, memory and counters. A simple binary counter is a chain of toggle flip-flops, each dividing the frequency by two – that is how a digital watch gets 1 Hz from a 32 768 Hz quartz crystal ($2^{15}$).
A synchronous system, in which all flip-flops are driven by the same clock, is a state machine: the next state is a combinational function of the present state and the inputs. Every processor is at bottom a large state machine.
TTL and CMOS
Texas Instruments’ 7400 series of TTL chips (transistor–transistor logic), from the mid-1960s, became the industry standard: the 7400 with four NAND gates, the 7474 with two D flip-flops, the 7490 decade counter. TTL works at 5 V; below 0.8 V counts as 0 and above 2.0 V as 1, and the margin to the guaranteed output levels is the noise margin. A TTL gate delays the signal by about 10 ns and uses a few milliwatts. CMOS logic (RCA’s 4000 series from 1968) uses almost no power when not switching, because one transistor is always off. That is why CMOS won completely: a modern processor with billions of transistors would melt in TTL.
From analogue to digital
A D/A converter turns a binary number into a voltage, for example with an R–2R resistor network in which each bit contributes half the current of the one before. An A/D converter goes the other way: the successive-approximation converter tries its way bit by bit with a D/A converter and a comparator, just as one guesses a number with “higher or lower”. With $n$ bits the quantisation error is at most half a step, and the ideal signal-to-noise ratio for a sine wave is $6.02n + 1.76$ dB – about 98 dB for the CD’s 16 bits (see sampling).
Since 1989
- Moore’s law held for decades: from about a million transistors in Intel’s 80486 (1989) to more than 100 billion in the largest chips today.
- Programmable logic: FPGAs (Xilinx, 1985) have replaced most discrete logic; a circuit is described in a language such as VHDL or Verilog and “synthesised” automatically.
- Microcontrollers costing pennies, such as Arduino and the Raspberry Pi Pico, have made it cheaper to write a program than to build a circuit of gates.
- The limits: Transistors are now so small that quantum effects such as tunnelling and leakage currents set the limit – and quantum computers use qubits that are not just 0 or 1 (see quantum mechanics).
Further reading
- M. Morris Mano and Michael D. Ciletti: Digital Design (6th ed., Pearson 2017)
- Charles Petzold: Code. The Hidden Language of Computer Hardware and Software (2nd ed., Microsoft Press 2022)
- Claude E. Shannon: “A symbolic analysis of relay and switching circuits”, Trans. AIEE 57 (1938) 713–723