Logic as switches
The atom every gate is made of
Logic is built from switches: two switches in series conduct only when both are closed (an AND condition), two switches in parallel conduct when either is closed (an OR condition), and a transistor is simply a switch you close with a voltage instead of a finger.
Build it in the lab →This lesson opens a detailed build-along track: from logic to silicon. You already have the algebra of true and false from Boolean algebra and the specification tool from truth tables. Here we start turning those abstract
1s and 0s into physical switching networks, one transistor at a time, so that by the end you can look at any Boolean expression and read off the transistors that compute it.Strip digital logic down to its atom and you find a switch: a thing that is either closed (current flows) or open (current is blocked). Nothing else is needed. Long before transistors, working computers were built from mechanical relays and even from arrays of hand-thrown knife switches, because a switch already knows how to do the two operations all of logic rests on: AND and OR. The transistor did not invent logic. It just made the switch small, fast, and controllable by a voltage instead of a finger.
Represent a Boolean variable by a switch: the variable is
1 when the switch is closed and 0 when it is open. Wire a lamp to a battery through those switches and the lamp is the output: it lights (output 1) exactly when a complete path of closed switches carries current from the battery to the lamp. The question "does the lamp light?" becomes "is there a conducting path?", and the *shape* of the wiring decides which Boolean function you get.Series switches = AND
Put two switches in series, one after the other on the same wire. Current reaches the lamp only if it can pass through the first switch and the second. If either one is open, the path is broken and the lamp stays dark. So a series pair computes
A AND B: the output is 1 only when both switches are closed.| A | B | series |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Parallel switches = OR
Now put two switches in parallel, side by side so current has two possible routes to the lamp. Now the lamp lights if either route is open for business: closing the first switch or the second (or both) completes a path. A parallel pair computes
A OR B: the output is 1 whenever at least one switch is closed.| A | B | parallel |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Series = AND, parallel = OR. That single sentence is the bridge from Boolean algebra to physical circuits, and it is the rule this whole track is built on. A product term (an AND) becomes a series chain; a sum (an OR) becomes parallel branches. Nest them and you can wire up any expression you can write.
A concrete example you have used without thinking: a hallway light controlled from a single switch is a one-switch circuit. A door buzzer that sounds when the front door or the back door opens is two door sensors in parallel (OR). A microwave that will only run when the door is shut and you have pressed start is two switches in series (AND). Everyday wiring is already Boolean logic.
The transistor is a switch with a voltage handle
The only thing a hand-thrown switch cannot do is throw itself. A computer needs the *output* of one logic decision to *control* the next switch, automatically and billions of times a second. That is exactly what the transistor adds: it is a switch whose handle is a wire. Put a
1 on that control wire (the gate) and the switch closes; put a 0 and it opens. Wire the output of one transistor network to the gate of the next and logic drives logic, with no finger required.A through to F only while its gate EN is 1. A closed switch conducts, an open one blocks. Open it in the lab and toggle EN to open and close the switch yourself.The switch picture is exact for whether current *can* flow, but a real switch does not, by itself, decide the output's logic value when it is open. A lamp with its switch open is dark, but a bare wire with nothing driving it is not
0, it is floating (Z), as signals explains. Keeping that distinction straight is why the coming lessons are so careful about always connecting the output to a definite VCC or GND through a closed path, never leaving it dangling.Try it
You want a circuit that lights a lamp only when
A is closed AND (either B OR C is closed). Describe the switch arrangement.Answer
Put
B and C in parallel with each other (the OR), then put that parallel pair in series with A (the AND). Current reaches the lamp only if A is closed and at least one of B, C is closed, which is exactly A AND (B OR C). This is the same series-of-parallel nesting you will use to build real gates from transistors.Frequently asked
What is the atom of digital logic?
The switch. A switch is either closed (conducts) or open (blocks), and that binary behavior is all logic needs. Switches in series compute AND, switches in parallel compute OR, and a transistor is just a switch you close with a voltage instead of a finger.
Why do switches in series compute AND?
Because current must pass through the first switch and the second to reach the output. If either is open the path breaks, so the output is
1 only when both switches are closed, which is exactly the AND function.Why do switches in parallel compute OR?
Because parallel switches give current more than one route. Closing either switch (or both) completes a path, so the output is
1 whenever at least one switch is closed, which is exactly the OR function.Were computers built from switches before transistors?
Yes. Early machines used electromechanical relays (switches thrown by an electromagnet) and even hand-thrown knife switches. They computed the same AND and OR functions; transistors simply made the switch tiny, fast, and controllable by a voltage.
Next: the MOSFET, the specific voltage-controlled switch that every gate in this course is built from, and what its three terminals actually do.
You've got the theory. Now build it from scratch and watch it work.
Build it in the lab →Builds towardThe MOSFET switch