School/□ Systems Engineer/Week 23
Building gates from switches
A modern chip has billions of transistors and almost all are wired as just three or four patterns. What are they?
About 35 min · 3 goals · Checked by automated tests
1.Why should I care?
CMOS is the reason your phone lasts a day instead of an hour. By pairing two kinds of switch so one network always blocks, it draws power only when it switches. Learning the pattern lets you read a transistor schematic as logic.
- ◇ Model nMOS and pMOS transistors as voltage-controlled switches.
- ◇ Build a CMOS inverter, NAND and NOR from pull-up and pull-down networks.
- ◇ Explain why CMOS draws almost no static current.
2.Predict
In a CMOS NAND gate, how are the two nMOS transistors in the pull-down network connected?
Guess first. Being wrong here is how the surprise works.
3.Discover
Start with the inverter and toggle A. Then switch to NAND and NOR and try all four input combinations. For each, say which network conducts and confirm there is never a path from VDD to ground.
Loading the interactive…
Can't use the interactive? Read a description instead
In the gate builder, the inverter's output is 1 when A = 0 (pMOS on) and 0 when A = 1 (nMOS on). The NAND output is 0 only for A = B = 1, when both series nMOS conduct; the NOR output is 1 only for A = B = 0, when both series pMOS conduct. In every case exactly one network conducts.
4.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1
A pMOS transistor conducts when its gate is…
Practice 3
How many transistors are in a static CMOS 3-input NAND gate?
5.Watch
→ Ben Eater uses bipolar transistors, not MOSFETs, but watch for the same idea: switches in series make AND-like behaviour, in parallel OR-like.
Builds real logic gates from transistors on a breadboard, linking abstract logic to actual electronics.
13 min 1 s · captions on YouTube · source
Nothing loads from YouTube until you press play.
The video is optional: everything you need is also in the lesson text and the interactive.
6.Understand
Two kinds of switch
An nMOS conducts when its gate is high (1) and is good at pulling a node down to ground. A pMOS conducts when its gate is low (0) and is good at pulling up to VDD. In the switch-level model each is simply on or off; in reality each has some resistance and capacitance.
Pull-up and pull-down networks
A static CMOS gate has a pull-down network of nMOS between the output and ground and a pull-up network of pMOS between VDD and the output. Series nMOS = AND condition for pulling down; parallel nMOS = OR. The pull-up is the dual: series becomes parallel and vice versa. So NAND = series nMOS + parallel pMOS; NOR = parallel nMOS + series pMOS. Each input drives one of each: a 2-input gate has 4 transistors.
Why it costs so little to sit still
For every input combination exactly one network conducts. So in steady state there is no path from VDD to ground and only tiny leakage flows. Power is spent mainly when the output switches and its load capacitance charges or discharges, which is next lesson's topic.
Explain it another way
Two teams of doors: one between the output and the high rail, one between the output and the low rail. The teams are wired so that when one opens, the other is shut.
Natural CMOS gates are inverting (NAND, NOR, NOT, AOI). AND and OR need an extra inverter stage: 6 transistors for a 2-input AND. NAND is often preferred over NOR because series nMOS are faster than series pMOS.
Y = 0 exactly when the pull-down Boolean function is true; the pull-up implements its complement by De Morgan duality. For NAND: pull-down = A·B, pull-up = ¬A + ¬B = ¬(A·B).
Standard-cell libraries used by chip designers contain hundreds of variants of these patterns at different sizes and drive strengths; synthesis tools turn RTL code into networks of them.
Worked example 1
Design the transistor networks for a 3-input NOR.
Pull-down: three nMOS in parallel (any input 1 pulls Y low). Pull-up: three pMOS in series (all inputs 0 to connect Y to VDD). 6 transistors.
Common mix-ups
- CMOS gates draw current all the time, like a resistor.
✓ In steady state one network is always off, so only tiny leakage flows. - An AND gate is the simplest CMOS gate.
✓ NAND is simpler: AND is NAND plus an inverter (6 transistors).
7.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2 · a fresh version every time
A static CMOS gate with inputs A and B is built from two nMOS in series in the pull-down network and two pMOS in parallel in the pull-up network. Write its output Y for AB = 00, 01, 10, 11 as a 4-bit binary number (Y for 00 is the leftmost bit) and give that number in decimal.
Practice 4
A student wires both networks of a gate so that, for input 11, both conduct. What happens?
Practice 5 · a fresh version every time
A static CMOS gate with inputs A and B is built from a NOR stage (parallel nMOS, series pMOS) followed by a CMOS inverter. Write its output Y for AB = 00, 01, 10, 11 as a 4-bit binary number (Y for 00 is the leftmost bit) and give that number in decimal.
8.Apply it
Sketch a CMOS gate for Y = NOT(A·B + C) using one pull-down network (A and B in series, that pair in parallel with C) and its dual pull-up. Check all 8 rows of the truth table.
9.Reflect
Concepts: Transistors and CMOS logic · Logic gates and Boolean algebra