C6 · Lesson 52 · Op-amp design lab
From specifications to currents and a capacitor, and back again
Lesson 41's design procedure is a chain of small formulas, and chains of formulas belong in code: once they're functions, you can try a dozen designs in a second and see what each specification costs. In this lab you'll write a function that predicts a two-stage op amp's gain, bandwidth, phase margin and slew rate from its currents and capacitors, a function that runs the design procedure from a specification, and a search that finds the smallest compensation capacitor giving a required phase margin.
- The two-stage op amp's phase margin and gain-bandwidth against its compensation capacitor, for the design of lesson 41 (20 µA tail, 100 µA output stage, 0.2 V overdrives, 10 pF load).
- More means more margin but less bandwidth. The readouts give both at the slider's value.
- Find the smallest that still gives 60°: that's the fastest stable design.
Predict
For that op amp, what is the smallest that gives 60° of phase margin?
About 1.5 pF. The rule of thumb's 2.2 pF gives 67°, a little more than needed; 1.5 pF reaches exactly 60° and raises the GBW from 7.2 MHz to 10.6 MHz. A search like this, run on the full equations, is how design rules of thumb get refined.
Name it
Performance from the design
For tail current , second-stage current , overdrives (input pair) and (output device), equal λ, compensation and load :
and the phase margin from the two-pole crossover of lesson 39, , PM = .
Design from the specification
Given GBW, SR and , with (k ≈ 10) and chosen:
- ;
- ;
- , so ;
- , so .
Searching
Phase margin rises steadily with , so bisection on (in log space, between 1 fF and 1 nF) finds the smallest value that meets a margin.
Worked example
Predict the performance of lesson 41's design: 20 µA, 100 µA, 0.2 V overdrives, λ = 0.05 V⁻¹, = 2.2 pF, = 10 pF.
Show the solution
- DC gain. = 80 dB.
- Gain-bandwidth and second pole. GBW = 7.23 MHz and = 15.9 MHz.
- Phase margin. The exact crossover is 6.7 MHz, so PM = 67.3°. The quick estimate with crossover at GBW gave 66°.
- Slew rate.
Answer 80 dB of gain, GBW = 7.23 MHz, a phase margin of 67.3° and a slew rate of 8.2 V/µs.
Worked example
Design for GBW = 10 MHz and SR = 10 V/µs into 5 pF, with k = 10 and = 0.2 V.
Show the solution
- Compensation capacitor. = 1.1 pF.
- Tail current. = 11 µA.
- Input stage. = 69.1 µS, so = 0.16 V.
- Output stage. = 0.691 mS, so = 69 µA.
- Total current. 11 + 69 = 80 µA.
Answer = 1.1 pF, = 11 µA, = 0.16 V and = 69 µA, 80 µA in total.
Check
A two-stage op amp has a 10 µA tail, input overdrive 0.1 V and = 5 pF. What is its GBW?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
Its output device carries 50 µA at 0.15 V of overdrive, into 20 pF. Where is the second pole?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
Write performance(I5, I7, vov1, vov6, lam, Cc, CL) returning a dict with A0_db, GBW (Hz), f2 (Hz), pm (degrees, from the exact two-pole crossover) and sr (V/s).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write design(GBW, SR, CL, k=10, vov6=0.2) returning a dict with Cc, I5, gm1, vov1, gm6 and I7, following the four steps.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write min_cc(I5, I7, vov1, vov6, lam, CL, pm=60): the smallest giving at least pm degrees, by bisection on between 1 fF and 1 nF (200 steps), using your performance.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why does a design procedure fix first, before any currents?
Every important speed specification runs through the compensation capacitor. The phase margin depends on the ratio of the second pole to the gain-bandwidth, which for a given load is set by and the ratio of the two stages' transconductances; once that ratio is chosen, follows from the load alone. Then the slew rate fixes the tail current, since the tail charges , and the gain-bandwidth fixes the input transconductance, since sets it. Choosing first turns each remaining specification into one equation for one unknown.
Practice
Keep practicing
5 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.