Overview
Readings Brown & Vranesic §3.1–3.3, 3.5–3.6, 3.8.8, 3.9 · week 5
This chapter is about how logic gates are actually built. Transistors work as voltage-controlled switches, where NMOS pulls an output down to ground and PMOS pulls it up to . Wiring them in series and parallel gives you NAND, NOR and more complex gates, and CMOS uses both types together so no current flows when the gate is idle. The second half is about how gates get packaged and sold: 7400-series chips, then programmable devices (PLAs, CPLDs, FPGAs), along with fan-out and transmission gates.
Notes
Logic values as voltages
Logic 0 and 1 are voltage ranges, and there’s an undefined region in between that signals only pass through while switching.
| Range () | Meaning (positive logic) |
|---|---|
| to | Logic 1 (HIGH) |
| to | Undefined |
| to | Logic 0 (LOW) |
- is ground (0 V). is the positive supply.
- The exact thresholds depend on the technology.
Transistors as switches
What a gate has to do. The output of a gate is just a wire, and a wire only has a voltage if something connects it to a power source. We only care about two voltages:
- : the high supply (say 5 V). Connect the output here and it reads 1.
- GND: ground (0 V). Connect the output here and it reads 0.
So the whole job of a gate is to connect the output to or to GND, depending on the inputs. Transistors are the switches that make those connections.
For logic analysis, a MOSFET is treated as an ideal switch that’s flipped by voltage (on its gate) instead of a finger. There are two types, and they’re opposites:
| Transistor | Gate HIGH (1) | Gate LOW (0) | Placed between… | Job |
|---|---|---|---|---|
| NMOS | ON (closed) | OFF (open) | the output and GND | pull down: make the output 0 |
| PMOS (bubble on its gate) | OFF (open) | ON (closed) | and the output | pull up: make the output 1 |
- Pull down = “when I’m ON, I connect the output to ground, so it becomes 0.”
- Pull up = “when I’m ON, I connect the output to , so it becomes 1.”
"Pull down" doesn't mean the NMOS makes 0 V. It means that when it's ON, it gives the output a low-resistance path to ground. PMOS does the same thing with .
Picture the output as a bucket of water, with the water level as the output voltage. A pipe from a high tank () runs to the bucket with a valve: that's the PMOS, and opening it fills the bucket (output 1). A pipe from the bucket to a drain (GND) has a valve too: that's the NMOS, and opening it empties the bucket (output 0).
Why each type goes where it does. Each type is only good at passing one value. An NMOS connected to ground can pull the output all the way down to a clean 0 V, but it would only give a weak 1 if you used it to reach . A PMOS is the mirror image, with clean 1s and weak 0s. That’s why NMOS goes to ground and PMOS goes to .
For how a single transistor works (gate, source, drain, and how the gate voltage forms the channel), with an interactive NMOS/PMOS cross-section, see MOSFET.
NMOS, PMOS and CMOS: what is each one built from?
The three names are three logic families, and what separates them is which networks the gate contains. Everything is built from the two networks above, so keep these three lines in mind:
| Family | What’s inside the gate | How the output gets a 1 | How the output gets a 0 |
|---|---|---|---|
| NMOS logic | a PDN (NMOS) + a pull-up resistor | the resistor weakly pulls it up (when the PDN is OFF) | the PDN conducts and wins over the resistor |
| PMOS logic | a PUN (PMOS) + a pull-down resistor | the PUN conducts and wins over the resistor | the resistor weakly pulls it down (when the PUN is OFF) |
| CMOS | a PUN (PMOS) and a PDN (NMOS) | the PUN conducts (PDN is OFF) | the PDN conducts (PUN is OFF) |
So NMOS logic is “a PDN with a resistor on top”, PMOS logic is “a PUN with a resistor underneath”, and CMOS is a PUN and a PDN with no resistor at all. The resistor in the first two is only there so the output is never left floating. In CMOS the other network does that job properly.
Wording. A transistor is NMOS or PMOS. A network (PDN or PUN) is a group of the same kind of transistor wired in series/parallel. A logic family (NMOS logic, PMOS logic, CMOS) is how those networks are combined into a gate. So "an NMOS gate is made of a PDN" means "a gate whose only transistors are NMOS, all of them in the pull-down network".
Try it: switch between the three families, pick a gate, and flip the inputs. Watch the orange wires. Whenever one lights up, current is flowing from to GND the whole time, which is the static current that CMOS gets rid of.
Networks: series and parallel
One transistor is only enough for a NOT gate. For anything else, the output should only connect to a supply for certain input combinations, so we wire several transistors together. Two rules decide how:
- Series (end to end, like a chain): current only gets through if every switch is ON → behaves like AND.
- Parallel (side by side, like separate lanes): current gets through if any switch is ON → behaves like OR.
A group of transistors wired this way is a network. Every gate uses one or both of these:
| Name | Made of | Connects the output to… | Makes the output… |
|---|---|---|---|
| PDN (pull-down network) | NMOS transistors | GND | 0 |
| PUN (pull-up network) | PMOS transistors | 1 |
NMOS logic gates
The older style uses only a PDN. A PDN can pull the output to 0, but when it’s OFF the output isn’t connected to anything, and a floating wire isn’t a reliable 1. The fix is a pull-up resistor (or pull-up device) from to the output that weakly holds it high:
- PDN OFF → the resistor wins → output HIGH.
- PDN ON → it beats the resistor → output LOW.
| Gate | NMOS arrangement | Output 0 when… | Result |
|---|---|---|---|
| NOT | One NMOS | ||
| NAND | Two NMOS in series | and | |
| NOR | Two NMOS in parallel | or | |
| AND | NAND followed by NOT | — | |
| OR | NOR followed by NOT | — |
- Series = AND, parallel = OR, exactly as above.
- The output is always the complement of the pull-down condition, which is why NAND and NOR come naturally and AND/OR need an extra inverter.
Example 3.1: Reading an NMOS circuit
An NMOS gate has a pull-up resistor to . Its pull-down network is NMOS in series with NMOS , and that pair is in parallel with NMOS . Find .
Show answerHide answer
- When does the PDN conduct? Series = AND, parallel = OR, so it conducts when .
- The output is LOW whenever the PDN conducts, so it’s the complement:
The drawback: whenever the output is LOW, current flows from through the resistor and the NMOS network to ground the whole time. That wastes power and makes heat, and CMOS fixes it.
Example 3.2: The cost of static current
An NMOS-logic gate has a pull-up resistor and a V supply. When its output is LOW, the NMOS network’s resistance is small compared with . Find the power the gate draws while LOW, and the total for a chip with such gates of which half are LOW.
Show answerHide answer
That heat is released even when nothing is switching, which is why this style cannot scale to millions of gates. A CMOS gate has no such path in a steady state.
PMOS logic gates
The mirror image of NMOS logic uses only a PUN of PMOS transistors, with a pull-down resistor from the output to GND:
- PUN ON → it beats the resistor → output HIGH.
- PUN OFF → the resistor pulls the output to GND → output LOW.
Because a PMOS turns on with a 0, the PUN conducts when its inputs are 0, and the gate computes a function of the complemented inputs:
| Gate | PMOS arrangement | Output 1 when… | Result |
|---|---|---|---|
| NOT | One PMOS | ||
| NAND | Two PMOS in parallel | or | |
| NOR | Two PMOS in series | and |
- Same series = AND, parallel = OR rule, but applied to the 0 inputs since that’s what turns a PMOS on.
- It has the same drawback as NMOS logic, flipped. When the output is HIGH, current flows from through the PUN and the resistor to GND the whole time.
- It was used in very early chips, but NMOS is faster (electrons move more easily than holes), so NMOS logic took over, and then CMOS replaced both.
The PUN you just drew is exactly the top half of a CMOS gate. And the PDN from the NMOS section is exactly the bottom half. CMOS is just those two halves on one output, with the resistor removed.
CMOS logic gates
CMOS stands for complementary MOS. It replaces the resistor of NMOS logic with a pull-up network (PUN) of PMOS transistors (or, equivalently, replaces the resistor of PMOS logic with a PDN), so it uses both kinds of transistor as a matched pair of networks. The PUN sits between and the output, the PDN sits between the output and GND, and they’re built so that for every input combination exactly one of them conducts:
| Situation | PUN | PDN | Output |
|---|---|---|---|
| Output should be 1 | ON | OFF | Connected to → |
| Output should be 0 | OFF | ON | Connected to GND → |
The big advantage: in any steady state one network is OFF, so there’s no direct path from to GND and basically no static current. That’s the main reason CMOS ended up as the dominant logic technology.
The duality rule: the PUN and PDN are duals of each other. Wherever the PDN has NMOS in series, the PUN has PMOS in parallel, and the other way around.
| Gate | PUN (PMOS) | PDN (NMOS) | Transistors |
|---|---|---|---|
| NOT | 1 PMOS | 1 NMOS | 2 |
| NAND | parallel | series | 4 |
| NOR | series | parallel | 4 |
| AND | NAND + NOT | NAND + NOT | 6 |
| OR | NOR + NOT | NOR + NOT | 6 |
Walk-through: the NOT gate. One PMOS on top, one NMOS below, both controlled by the same input , with the output between them.
| PMOS (top) | NMOS (bottom) | Output connected to | ||
|---|---|---|---|---|
| 0 | ON (gate is 0) | OFF | 1 | |
| 1 | OFF | ON (gate is 1) | GND | 0 |
Input 0 turns on the top valve and fills the bucket → output 1. Input 1 turns on the bottom valve and drains it → output 0.
Walk-through: the NAND, . Work out each network from the function:
- PUN: is 1 when or . PMOS turns on with a 0 and “or” means parallel, so the PUN is two PMOS in parallel.
- PDN: is 0 when and . NMOS turns on with a 1 and “and” means series, so the PDN is two NMOS in series.
| PMOS A | PMOS B | NMOS A | NMOS B | |||
|---|---|---|---|---|---|---|
| 0 | 0 | ON | ON | OFF | OFF | 1 |
| 0 | 1 | ON | OFF | OFF | ON | 1 |
| 1 | 0 | OFF | ON | ON | OFF | 1 |
| 1 | 1 | OFF | OFF | ON | ON | 0 |
If either input is 0, at least one PMOS is ON and fills the output to 1. Only when both are 1 do both NMOS turn on and drain it to 0.
Example 3.3: Transistor states in a CMOS NOR
For a 2-input CMOS NOR with , : which transistors are ON, and what is ?
Show answerHide answer
- PUN (two PMOS in series): PMOS is ON (gate 0), PMOS is OFF (gate 1). Series needs both, so the PUN is off.
- PDN (two NMOS in parallel): NMOS is OFF, NMOS is ON. Parallel needs one, so the PDN conducts.
- The output is connected to GND, so . Check: ✓
To remember: NMOS = ON with a 1, on the bottom, pulls down. PMOS = ON with a 0, on top, pulls up. PDN = the NMOS network, PUN = the PMOS network. CMOS = both together, always exactly one ON.
Try it: pick a gate and flip the inputs. ON transistors are drawn solid, OFF ones faded, and the network that’s connected to the output is highlighted.
Designing complex CMOS gates
You don’t have to build everything out of NAND/NOR/NOT. Any function that’s a single inverting expression, , can be built directly as one PUN + PDN. This works because a CMOS gate is naturally inverting. A 1 on the inputs turns NMOS on and pulls the output down, so more 1s tend to give a 0. That’s why NAND and NOR are easy, while AND and OR (which aren’t inverting) cost an extra inverter.
The recipe is to describe when the output is 1 for the PUN and when it’s 0 for the PDN, remembering that PMOS turns on with a 0 and NMOS turns on with a 1:
- PUN: write the condition for in terms of complemented inputs (""). AND → series, OR → parallel.
- PDN: write the condition for , i.e. , in terms of uncomplemented inputs (""). AND → series, OR → parallel. Use DeMorgan’s theorems to get into that form.
- Check duality: every series in the PUN should be a parallel in the PDN and vice versa. If it isn’t, something’s wrong.
- Connect the PUN to , the PDN to GND, and join them at the output.
Worked through: Textbook Example 3.1,
- PUN, reading directly. is already written with complemented inputs. A product () means ” and ”, so those two PMOS go in series. The means ” or that”, so ‘s PMOS goes in parallel with the series pair.
- PDN, from . Apply DeMorgan: . Now every input is uncomplemented. The product means NMOS in series with the sum, and the sum is a parallel pair.
- Duality check: the PUN is ” ∥ ( series )”, the PDN is ” series ( ∥ )“. Series and parallel swapped ✓. That’s 6 transistors.
Textbook Example 3.2:
- PUN: in parallel with [( ∥ ) in series with ].
- PDN: → in series with [( series ) ∥ ].
That uses fewer transistors than building each AND and OR as its own gate.
Example 3.4: Designing a complex CMOS gate
Design a CMOS circuit for and count its transistors.
Show answerHide answer
- PDN realizes : NMOS and in series, that pair in parallel with NMOS .
- PUN is the dual: PMOS and in parallel, that pair in series with PMOS .
- Check the PUN directly: by DeMorgan, . That’s ( or ) and : PMOS ∥ , in series with ✓
Figure 3.1: CMOS circuit for .
6 transistors. Building it from an AND gate (6) and a NOR gate (4) would take 10.
Example 3.5: CMOS gate from an expression with complemented inputs
Design the CMOS networks for .
Show answerHide answer
- PUN from : ( AND ) OR → PMOS series , that pair parallel with PMOS .
- PDN from : by DeMorgan, → NMOS parallel , that pair in series with NMOS .
- Duality check: the PUN’s series pair (, ) is a parallel pair in the PDN, and swaps from parallel to series ✓
To sanity check a design, I pick one input combination and trace it. Does exactly one network conduct? If both do, you've made a short from to GND, and if neither does, the output floats.
Speed of logic gates
The ideal-switch model tells you what a gate does, but not how fast. In a real circuit:
- An ON transistor has some resistance.
- The wires and the transistors themselves have capacitance. Each gate input is like a tiny bucket that has to be filled or emptied before its voltage changes.
- Changing the output means charging or discharging that capacitance through that resistance, and that takes time. This is the propagation delay.
Back to the bucket picture. Opening the fill valve doesn’t make the level jump to the top, because the water has to flow in through a narrow pipe (the resistance), and a bigger bucket (more capacitance) takes longer to fill. It’s also why a gate output is never a perfect square edge. See Propagation Delay for the picture and how it limits clock speed.
We don’t do detailed timing analysis in this course, but remember the idea: more load (more capacitance) means a slower gate.
Fan-in and fan-out (§3.8.8)
- Fan-in: the number of inputs a gate has.
- Fan-out: the number of other gate inputs that one gate output drives. Each one adds capacitance , so driving gates is like driving . The propagation delay goes up in direct proportion to .
Fan-in matters too. A 4-input NAND has four NMOS in series in its PDN, so the path to ground adds up four resistances and is slower than a 2-input NAND. That’s why big gates often get split into smaller ones.
Example 3.6: Fan-out and load capacitance
Each gate input presents fF. A NAND gate drives other gates. What load does it see, and how does its delay compare with driving just one?
Show answerHide answer
The charging time is proportional to the load, so the delay is about the one-gate case (ignoring the gate’s own internal delay). If one load takes ns, four take roughly ns. This is why a signal that must reach many inputs is often driven through a buffer.
Transmission gates (§3.9)
Everything so far connected the output to a supply ( or GND). A transmission gate connects one signal to another instead, like a door that either lets a signal through or blocks it.
Why not just use a single transistor? One transistor only passes one value well. An NMOS passes clean 0s but a weak 1, and a PMOS is the opposite. So a transmission gate puts an NMOS and a PMOS in parallel, driven by complementary control signals and . Whatever the signal is, one of the two transistors passes it cleanly:
- (): both transistors ON, so .
- : both OFF, so the output is disconnected (it just floats, it isn’t 0).
See Transmission Gate for a step-by-step look at how a 0 and a 1 each pass through.
Uses:
- XOR gate: built from gates, takes 22 transistors in CMOS (two ANDs and an OR at 6 each, two NOTs at 2 each). With two transmission gates and two inverters it only takes 8. When one transmission gate passes , and when the other passes .
- 2-to-1 multiplexer: two transmission gates controlled by and . passes and passes . It’s the same function as the multiplexers in Ch 6, just built at the transistor level.
Example 3.7: XOR transistor count
How many transistors does a CMOS XOR take when built from AND, OR, and NOT gates, versus with transmission gates?
Show answerHide answer
- Gates: needs 2 NOTs (2 transistors each), 2 ANDs (6 each), and 1 OR (6):
- Transmission gates: 2 inverters (2 each) + 2 transmission gates (2 each) = 8.
Standard chips: the 7400 series (§3.5)
Before programmable logic, circuits were built by wiring together standard chips, each with a few fixed gates.
- They come in a dual-inline package (DIP), with two rows of pins (leads). One pin is for , one is for GND, and the rest are wired to the gates inside.
- The part number tells you what’s inside:
| Chip | Contents |
|---|---|
| 7404 | Six NOT gates |
| 7408 | Four 2-input AND gates |
| 7432 | Four 2-input OR gates |
| 74244 | Eight tri-state buffers (20-pin package) |
- The suffix letters tell you the technology, not the function. 74LS00 is TTL (transistor-transistor logic) and 74HC00 is CMOS, but both are quad 2-input NANDs.
- Lots of manufacturers make the same parts, which keeps them cheap and easy to get.
- Packages got smaller over time. The SOIC (small-outline IC) is the same idea as a DIP but much smaller.
Example 3.8: Implementing a function with 7400-series chips
Implement with 7400-series chips. Which chips are needed, and how many gates are left over?
Show answerHide answer
- Operations needed: one NOT (), two 2-input ANDs ( and ), one 2-input OR.
- Chips: a 7404 for the NOT, a 7408 for the ANDs, a 7432 for the OR, each with power and ground connected.
- Spare gates: 5 NOTs, 2 ANDs, and 3 ORs are unused and available for other logic.
Simplify first. only needs one NOT, one OR and one AND. That's still three chips, but fewer wires.
Buffers. A buffer outputs the same logic value it’s given (). It doesn’t change the logic, it just drives the signal harder (more current), which helps with speed when there’s a big load. A tri-state buffer adds an enable input. When enabled, , and when disabled the output is disconnected (high impedance, written Z).
| Enable | ||
|---|---|---|
| 0 | 0 | Z |
| 0 | 1 | Z |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
“Tri-state” means the output has three states: 0, 1, and not driving anything. Z isn’t a third voltage. It means the output is unplugged, like a transmission gate that’s OFF. This lets many devices share one wire (a bus), since only one buffer is enabled at a time and they never fight over the wire’s value. Buffers are one of the main things standard chips are still used for today.
Example 3.9: Sharing a bus with tri-state buffers
Three tri-state buffers drive one wire. Their data inputs are . What is on the wire if only buffer 2 is enabled? What goes wrong if buffers 1 and 2 are both enabled?
Show answerHide answer
- Only buffer 2 enabled: its output is and the other two are Z (disconnected), so the wire is 0.
- Buffers 1 and 2 enabled: one tries to drive the wire to 1 and the other to 0. That is a bus conflict, because it shorts to GND through the two output stages. The wire’s voltage is undefined and the chips may overheat.
A bus design must guarantee that at most one enable is active at a time.
Integration scale
| Scale | Size | Notes |
|---|---|---|
| SSI (small) | A few gates | Early chips, e.g. 7400 series |
| MSI (medium) | About 10–100 gates | More circuitry per chip |
| LSI (large) | Beyond MSI | |
| VLSI (very large) | Thousands to billions of transistors | Modern chips |
These labels don’t mean much anymore now that chips are so big.
Programmable logic devices (§3.6)
Standard chips have fixed functions and only a few gates each, so a big circuit needs lots of chips, lots of wires, and a lot of board space. A programmable logic device (PLD) is one general-purpose chip where the designer sets up the internal connections:
PLA (programmable logic array): implements functions in SOP form.
- Input buffers provide every input in true and complemented form ( and ).
- A programmable AND plane forms product terms from any of those literals.
- A programmable OR plane sums any of the product terms to make each output
A product term can be shared by several outputs, which saves AND gates.
Why SOP? Any function can be written as a sum of products (see Ch 2), so a PLA that can make any product and sum any products can implement any function that fits in its size. Simplifying with K-maps (Ch 4) gives fewer product terms and a smaller PLA.
Example 3.10: PLA product terms
A PLA must implement and . How many product terms does the AND plane need?
Show answerHide answer
- List the distinct products: , , .
- OR plane: , .
3 product terms, since is shared by both outputs.
CPLD (complex PLD): several PAL/PLA-like blocks on one chip, with a programmable interconnect between them.
- It’s programmed in-system (ISP) through a JTAG port (an IEEE standard that uses 4 wires), because big chips are too fragile for programming sockets.
- Nonvolatile: it keeps its configuration with the power off.
FPGA (field-programmable gate array): much bigger, up to millions of equivalent gates.
- It’s made of logic blocks, I/O blocks, and routing channels with programmable switches.
- There are no AND/OR planes. Each logic block uses a lookup table (LUT) instead, usually with 4 or 5 inputs, and often a flip-flop for sequential logic.
- Volatile: the configuration is lost when the power goes off and has to be reloaded every power-up, usually from a PROM on the board.
- The labs in this course use an FPGA board.
How a LUT works: a LUT is a tiny memory that stores a truth table. A 2-input LUT has storage cells, one per row. The inputs , drive the select lines of a tree of multiplexers that pick the cell for the current row. So any function of 2 variables fits in a 2-input LUT, and you only change the stored bits.
Think of it as a cheat sheet instead of a circuit. Rather than building gates that compute the answer, the LUT just looks up the answer for the current inputs. The multiplexers in it are the ones from Ch 6. See Lookup Tables for a worked example and how bigger functions are built from lots of LUTs.
Example 3.11: Programming a LUT
What bits are stored in a 2-input LUT to make it an XNOR gate? What would change to make it a NAND?
Show answerHide answer
- One cell per truth-table row (). XNOR is 1 when the inputs match: 1, 0, 0, 1.
- NAND is 0 only for : 1, 1, 1, 0. Only the stored bits change, and the multiplexer tree stays the same.
Example 3.12: Sizing a LUT
(a) How many storage cells does a 4-input LUT have? (b) What bits make a 3-input LUT compute ?
Show answerHide answer
(a) cells.
(b) A 3-input LUT has cells, one per row . A 3-way XOR is 1 when an odd number of inputs are 1:
| 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 | |
|---|---|---|---|---|---|---|---|---|
| stored bit | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
The function is just the stored bits. This is the same truth table as the three-way light control in Ch 2.
Key formulas
CMOS duality
PDN condition
- The PDN realizes with uncomplemented inputs (NMOS on for 1).
- The PUN realizes with complemented inputs (PMOS on for 0).
Fan-out load
- : total load capacitance on the driving gate’s output
- : fan-out, the number of gate inputs being driven
- : input capacitance of one driven gate
LUT size
- : number of LUT inputs
Common mistakes
- Swapping NMOS and PMOS behavior. NMOS is ON with a 1 and PMOS is ON with a 0 (the bubble).
- Putting PMOS in the pull-down network or NMOS in the pull-up network.
- Building the PDN for instead of . The PDN conducts when the output should be 0.
- Forgetting duality. If the PDN is series, the PUN has to be parallel (and the other way around).
- Thinking a CMOS AND is “simpler” than a NAND. It’s a NAND plus an inverter (6 transistors vs 4).
- Mixing up which PLDs are volatile. CPLDs keep their configuration without power and FPGAs lose it.