---
title: A two-stage CMOS op amp
heading: Seven transistors and a capacitor, designed from the specifications
eyebrow: C6 · Lesson 41 · A two-stage CMOS op amp
xp: 50
---

::: hook
Put together the pieces of this course and you have an op amp. A five-transistor OTA (lesson 7) gives gain and a differential input; a common-source stage with a current-source load (lesson 4) gives more gain and a low-impedance output; a Miller capacitor across the second stage (lesson 39) makes the whole thing stable in feedback. This **two-stage CMOS op amp** is the most common amplifier in integrated circuits. This lesson analyzes it and shows how its specifications (gain, bandwidth, slew rate, phase margin, power) map onto currents, overdrives and one capacitor.
:::

::: play
- A two-stage op amp at transistor level, connected as a follower with a 10 pF load, stepping between 1.5 V and 1.8 V. Its compensation capacitor $C_c$ is 2.2 pF.
- The output settles cleanly, with slight overshoot: about 65° of phase margin.
- Shrink $C_c$ toward 0.3 pF: the response gets faster but rings longer and longer, as the second pole approaches the crossover. Raise it to 10 pF: very stable but slow, limited by slew rate.
:::
:::

```sim circuit
VDD vdd 0 3.3                                   @ 12,-3 down 9
M3 x x vdd pmos VTO=-0.5 KP=0.5m LAMBDA=0.05    @ 3,-1 left flip
M4 o1 x vdd pmos VTO=-0.5 KP=0.5m LAMBDA=0.05   @ 4,-1 flip
M1 x out tail nmos VTO=0.5 KP=0.5m LAMBDA=0.05  @ 1,2
M2 o1 inp tail nmos VTO=0.5 KP=0.5m LAMBDA=0.05 @ 6,2 left
I1 tail 0 20u                                   @ 3,3 down 3
M6 out o1 vdd pmos VTO=-0.5 KP=5m LAMBDA=0.05   @ 8,-1 flip
I2 out 0 100u                                   @ 9,2 down 4
CC o1 out 2.2p                                  @ 6,0 right 3
CL out 0 10p                                    @ 11,0 down 6
VIN inp 0 square 1.5 1.8 200k Hz                @ 7,4 down 2
slider: CC 0.2p..10p log
scope: v(inp), v(out)
time: 0..10u s
```

::: predict
## A two-stage op amp has $g_{m1}$ = 0.1 mS, $g_{m6}$ = 1 mS and a 10 pF load. What compensation capacitor puts its second pole at 2.2 times its gain-bandwidth (about 65° of margin)?

- [ ] 0.22 pF
- [x] 2.2 pF
- [ ] 22 pF
- [ ] 10 pF, equal to the load

::: reveal
2.2 pF. GBW is $g_{m1}/2\pi C_c$ and the second pole $g_{m6}/2\pi C_L$, so their ratio is $\frac{g_{m6}C_c}{g_{m1}C_L}$; setting it to 2.2 gives $C_c = 2.2\frac{g_{m1}}{g_{m6}}C_L$. With the second stage's $g_m$ ten times the first's, that's the designer's rule of thumb $C_c \approx 0.22C_L$.
:::
:::

::: nameit
## The circuit

- **First stage:** NMOS pair $M_1$, $M_2$ with tail current $I_5$, PMOS mirror load $M_3$, $M_4$. Gain $A_1 = g_{m1}(r_{o2} \parallel r_{o4})$.
- **Second stage:** PMOS common source $M_6$ with an NMOS current source $M_7$ (here an ideal current source) carrying $I_7$. Gain $A_2 = g_{m6}(r_{o6} \parallel r_{o7})$.
- **Compensation:** $C_c$ from the first stage's output to the op amp's output, with an optional nulling resistor.

The input that drives the mirror's diode side ($M_1$) is the inverting input, because the second stage inverts.

## Performance

$$A_0 = A_1A_2 \qquad \text{GBW} = \frac{g_{m1}}{2\pi C_c} \qquad f_2 \approx \frac{g_{m6}}{2\pi C_L}$$

**Slew rate:** the smaller of $I_5/C_c$ (the first stage charging $C_c$) and $I_7/(C_L + C_c)$ (the second stage charging the load).

**Systematic offset:** for the first stage's output to sit exactly at the voltage that makes $M_6$ carry $I_7$, the current densities must match: $\frac{(W/L)_6}{(W/L)_4} = 2\frac{(W/L)_7}{(W/L)_5}$.

**Output swing:** from about $v_{OV7}$ to $V_{DD} - v_{OV6}$, nearly rail to rail.

**Power:** $V_{DD}(I_5 + I_7)$, plus the bias circuit.

## A design procedure

1. Choose $C_c$ from the load for the phase margin: $C_c \approx 2.2\frac{g_{m1}}{g_{m6}}C_L$ for about 65°.
2. Set $I_5$ from the slew rate: $I_5 = \text{SR} \cdot C_c$.
3. Set $g_{m1}$ from the GBW: $g_{m1} = 2\pi\text{GBW} \cdot C_c$, which fixes the input pair's overdrive, $v_{OV} = I_5/g_{m1}$.
4. Set $g_{m6}$ (and $I_7$) to put $f_2$ where step 1 assumed.
5. Check the gain, swing, common-mode range and power.
:::

::: example
## Analyze a design with a 20 µA tail, $I_7$ = 100 µA, all overdrives 0.2 V, λ = 0.05 V⁻¹, $C_L$ = 10 pF and a 3.3 V supply.

::: solution
1. **First stage.**
   $$\begin{aligned} g_{m1} &= \frac{2 \times 10\ \mu\text{A}}{0.2\ \text{V}} \\ &= 0.1\ \text{mS} \end{aligned}$$
   and $r_{o2} \parallel r_{o4}$ = 1 MΩ, so $A_1$ = 100.
2. **Second stage.** $g_{m6}$ = 1 mS and $r_{o6} \parallel r_{o7}$ = 100 kΩ, so $A_2$ = 100.
3. **DC gain.** $A_0 = 10^4$, 80 dB.
4. **Compensation.**
   $$\begin{aligned} C_c &= 2.2 \times 0.1 \times 10\ \text{pF} \\ &= 2.2\ \text{pF} \end{aligned}$$
   gives GBW = 7.2 MHz and $f_2$ = 15.9 MHz: 66° of margin.
5. **Slew rate.** Internally $\frac{20\ \mu\text{A}}{2.2\ \text{pF}}$ = 9.1 V/µs, and at the output $\frac{100\ \mu\text{A}}{12.2\ \text{pF}}$ = 8.2 V/µs, so 8.2 V/µs.
6. **Power.** 0.40 mW.

**Answer:** a gain of $10^4$ (80 dB), GBW = 7.2 MHz with 66° of margin, a slew rate of 8.2 V/µs and 0.40 mW of power.
:::
:::

::: example
## A spec asks for GBW = 10 MHz and SR = 10 V/µs into 5 pF. Find $C_c$, the tail current and the first stage's overdrive, assuming $g_{m6} = 10g_{m1}$.

::: solution
1. **Compensation capacitor.**
   $$\begin{aligned} C_c &= 0.22 \times 5\ \text{pF} \\ &= 1.1\ \text{pF} \end{aligned}$$
2. **Tail current.** The slew rate sets it:
   $$10\ \text{V}/\mu\text{s} \times 1.1\ \text{pF} = 11\ \mu\text{A}$$
3. **Input transconductance.** The GBW sets it:
   $$\begin{aligned} g_{m1} &= 2\pi \times 10\ \text{MHz} \times 1.1\ \text{pF} \\ &= 69\ \mu\text{S} \end{aligned}$$
4. **Overdrive.**
   $$\begin{aligned} v_{OV} &= \frac{11\ \mu\text{A}}{69\ \mu\text{S}} \\ &= 0.16\ \text{V} \end{aligned}$$

**Answer:** $C_c$ = 1.1 pF, an 11 µA tail and a first-stage overdrive of 0.16 V.
:::
:::

::: example
## The first example's op amp (20 µA tail, $I_7$ = 100 µA, 0.2 V overdrives, 3.3 V supply) has its output stage between M6 and M7. What range can its output cover, and what power does it draw?

::: solution
1. **Lowest output.** It can fall until M7, the current sink, runs out of overdrive at 0.2 V.
2. **Highest output.** It can rise until M6 does, at 3.3 − 0.2 = 3.1 V: nearly rail to rail, because only one device sits on each side of the output.
3. **Power.** The supply carries 20 + 100 = 120 µA (plus the bias reference), so
   $$3.3\ \text{V} \times 120\ \mu\text{A} = 0.40\ \text{mW}$$
4. **Why two stages.** A two-stage design is chosen over a single cascoded stage for exactly that swing; the cascode's stack would have lost several overdrives.

**Answer:** the output covers 0.2 V to 3.1 V, and the amplifier draws 0.40 mW.
:::
:::

::: check
given: gm1 = 0.05 | 0.5; r1 = 0.5 | 2; gm6 = 0.5 | 5; r2 = 0.05 | 0.5
answer: 20*log(gm1*1e-3*r1*1e6*gm6*1e-3*r2*1e6)
unit: dB
tolerance: 0.5%

## A two-stage op amp has $g_{m1}$ = {gm1} mS with {r1} MΩ at the first stage's output, and $g_{m6}$ = {gm6} mS with {r2} MΩ at the second's. What is its DC gain in dB?

::: right
Right. $20\log_{10}(g_{m1}R_1g_{m6}R_2)$ = {answer}.
:::

::: misses
- [any] Not yet. Multiply the two stage gains.
:::
:::

::: check
given: gm1 = 0.05 | 0.5; gm6 = 0.75 | 4; CL = 2 | 20
answer: 2.2*gm1/gm6*CL
unit: pF
tolerance: 0.5%

## What $C_c$ puts the second pole at 2.2 × GBW for $g_{m1}$ = {gm1} mS, $g_{m6}$ = {gm6} mS and $C_L$ = {CL} pF?

::: right
Right. $2.2\frac{g_{m1}}{g_{m6}}C_L$ = {answer}.
:::

::: misses
- [0.22*CL] That rule assumes $g_{m6} = 10g_{m1}$; use the actual ratio.
- [any] Not yet. Set $f_2/\text{GBW} = 2.2$.
:::
:::

::: check
given: I5 = 10 | 100; Cc = 0.5 | 5; I7 = 50 | 500; CL = 5 | 50
answer: I7/(CL + Cc)
unit: V/µs
tolerance: 0.5%

## A two-stage op amp has a {I5} µA tail, $C_c$ = {Cc} pF, $I_7$ = {I7} µA and $C_L$ = {CL} pF. How fast can its output stage slew the load?

::: right
Right. $I_7/(C_L + C_c)$ = {answer}.
:::

::: misses
- [I7/CL] The output also has to charge $C_c$.
- [I5/Cc] That's the internal limit from the first stage.
- [any] Not yet. The second stage's current charges $C_L + C_c$.
:::
:::

::: check
given: GBW = 1 | 50; Cc = 0.5 | 5
answer: 2*pi*GBW*1e6*Cc*1e-12*1e6
unit: µS
tolerance: 0.5%

## A two-stage op amp with $C_c$ = {Cc} pF must have GBW = {GBW} MHz. What $g_{m1}$ does it need?

::: right
Right. $2\pi\,\text{GBW}\,C_c$ = {answer}.
:::

::: misses
- [any] Not yet. GBW = $g_{m1}/(2\pi C_c)$.
:::
:::

::: check
given: SR = 1 | 20; Cc = 0.5 | 5
answer: SR*Cc
unit: µA
tolerance: 0.5%

## What tail current gives an internal slew rate of {SR} V/µs with $C_c$ = {Cc} pF?

::: right
Right. $\text{SR} \cdot C_c$ = {answer}.
:::

::: misses
- [any] Not yet. $I_5 = \text{SR} \cdot C_c$.
:::
:::

::: check
given: W4 = 2 | 5; W5 = 4 | 10; W7 = 10 | 40
answer: 2*W7/W5*W4
unit: µm
tolerance: 0.5%

## For zero systematic offset, with $(W/L)_4$ = {W4}, $(W/L)_5$ = {W5} and $(W/L)_7$ = {W7} (same lengths, in µm of width), how wide must $M_6$ be?

::: right
Right. $W_6 = 2\frac{W_7}{W_5}W_4$ = {answer}.
:::

::: misses
- [W7/W5*W4] The tail splits in two, so $M_4$ carries only half of $I_5$: a factor of 2.
- [any] Not yet. $(W/L)_6/(W/L)_4 = 2(W/L)_7/(W/L)_5$.
:::
:::

::: check
given: VDD = 1.8 | 3.3 | 5; I5 = 10 | 100; I7 = 50 | 500
answer: VDD*(I5 + I7)/1000
unit: mW
tolerance: 0.5%

## What power does a two-stage op amp on {VDD} V with a {I5} µA tail and {I7} µA in its second stage draw (ignoring bias)?

::: right
Right. $V_{DD}(I_5 + I_7)$ = {answer}.
:::

::: misses
- [any] Not yet. Supply times total current.
:::
:::

::: check
kind: parts
given: VDD = 1.8 | 3.3 | 5; It = 10 | 50; I7 = 50 | 200; ov = 0.15 | 0.25

## A two-stage CMOS op amp on {VDD} V has a {It} µA tail and {I7} µA in its output stage, all overdrives {ov} V.

::: part
answer: VDD - 2*ov
unit: V
tolerance: 0.5%

### What peak-to-peak output range does it have?

::: misses
- [VDD] Each output device needs its overdrive.
- [any] $V_{DD} - v_{OV6} - v_{OV7}$.
:::
:::

::: part
answer: VDD*(It + I7)/1000
unit: mW
tolerance: 0.5%

### What power does it draw, ignoring the bias reference?

::: misses
- [any] $V_{DD}(I_\text{tail} + I_7)$.
:::
:::
:::

::: check
kind: derivation
vars: G = 1000000..1000000000, S = 1000000..1000000000, L = 0.000000000001..0.0000000001, k = 2..20

## A two-stage op amp must reach gain-bandwidth G and slew rate S into $C_L$ = L, with $C_c$ = 0.22L and $g_{m6} = k\,g_{m1}$.

::: step
answer: 0.22*L

### What's $C_c$?
:::

::: step
answer: S*0.22*L

### What tail current does the slew rate need?
:::

::: step
answer: 2*pi*G*0.22*L

### What $g_{m1}$ does the GBW need?
:::

::: step
answer: S*0.22*L/(2*pi*G*0.22*L)

### What first-stage overdrive results, $\frac{2(I/2)}{g_{m1}}$?
:::

::: right
Right. Slew rate over GBW sets the input pair's overdrive: $v_{OV} = \frac{\text{SR}}{2\pi\,\text{GBW}}$.
:::
:::

::: explain
## Why does a two-stage op amp need a compensation capacitor when a single-stage OTA driving a capacitor doesn't?

::: model
A single-stage OTA has only one high-impedance node, its output, so with a capacitive load it has one dominant pole and its phase lag never goes much past 90°: it's stable in any feedback connection. A two-stage op amp has two high-impedance nodes, the first stage's output and the final output, each giving a pole at a fairly low frequency. Together they can add 180° of lag while the loop gain is still large, so it would oscillate in a follower. The Miller capacitor across the second stage splits those poles apart, making one very low and pushing the other above the crossover frequency, so the phase lag at crossover stays well short of 180°.
:::
:::

::: practice

::: check
given: A1 = 30 | 200; A2 = 20 | 100
answer: A1*A2
tolerance: 0.5%

## A two-stage op amp's stages have gains of {A1} and {A2}. What is its total gain?

::: misses
- [any] Multiply.
:::
:::

::: check
given: CL = 1 | 2 | 5 | 10 | 20 | 30 | 50
answer: 0.22*CL
unit: pF
tolerance: 0.5%

## By the rule of thumb ($g_{m6} = 10g_{m1}$), what $C_c$ suits a {CL} pF load?

::: misses
- [any] $0.22C_L$.
:::
:::

::: check
given: I = 10 | 200; gm = 0.05 | 1
answer: I/gm/1000
unit: V
tolerance: 0.5%

## An input pair with a {I} µA tail has $g_{m1}$ = {gm} mS per side. What is its overdrive?

::: misses
- [any] $v_{OV} = I_5/g_{m1}$, since $g_{m1} = 2(I_5/2)/v_{OV}$.
:::
:::
:::
