S2 · Lesson 51 · Analog design lab
From specifications to transconductances, currents, gain and a verified phase margin
Lesson 20 gave the two-stage op amp's design equations. In practice designers script them: a short program turns specifications (gain-bandwidth, load, phase margin, gm/ID choices) into transconductances, currents, gain and slew rate, then checks the result's stability numerically instead of trusting the quick estimate. In this lab you'll write that script: the sizing, an exact phase-margin calculation from the poles and zero, and a search for the nulling resistor that meets a phase-margin target.
Predict
A two-stage op amp's quick estimate gives 60° of phase margin with the right-half-plane zero ignored. Where does the exact margin, with the zero included, land?
Lower. A right-half-plane zero raises the gain like an ordinary zero but rotates the phase the wrong way, like a pole, so the true crossover phase is worse than the pole-only estimate. In the design worked in this lab, the zero at costs about 10°: 67° without it, 57° with it. That's what the nulling resistor buys back.
Name it
The sizing equations
From lesson 20, with and :
- ,
- per input transistor,
- ,
The open-loop gain
With , , and the zero at (positive: right half plane):
A negative z (left half plane) gives phase lead automatically through the sign of the arctangent. With no zero, use z = ∞.
Phase margin
Find the crossover by bisection on between and , then .
What you'll write
size_two_stage(GBW, CL, k=2.2, cc_ratio=0.4, gmid1=15, gmid6=10, lam=0.1): return a dict with keysCc,gm1,gm6,I1,I6,A0,SR(SI units).phase_margin(A0, wu, p2, z=math.inf): the exact phase margin in degrees.rz_for_pm(target, A0, wu, p2, gm6, Cc): the smallest (Ω, between 0 and 1 MΩ) whose phase margin reaches the target, by bisection.
Worked example
Size an op amp for 30 MHz into 5 pF with the defaults, and find its phase margin with and without the zero.
Show the solution
- Compensation and transconductances. With the defaults, = 2 pF, = 0.377 mS and = 2.07 mS.
- Currents, gain and slew rate. = 25.1 µA, = 207 µA, = 3750 and SR = 25.1 V/µs.
- Poles. = 30 MHz and = 66 MHz.
- With = 0. The zero sits at (165 MHz), and the exact margin is 57.4°.
- With . That's 482 Ω, and the margin is 67.3°.
- Reaching 70°. It takes = 620 Ω, which moves the zero into the left half plane.
Answer the phase margin is 57.4° with the zero ( = 0) and 67.3° without it ( = 482 Ω).
Worked example
Why check the phase margin numerically instead of using 90° − arctan()?
Show the solution
- What the estimate assumes. The quick estimate assumes the crossover is at and ignores the zero.
- The estimate. With it gives
- Exact, without the zero. The exact crossover, a little below , gives 67.3°.
- Exact, with the zero. With the right-half-plane zero the exact answer is 57.4°: the estimate would have been 8° optimistic.
- The cost of checking. The numerical check costs a few lines and removes the guesswork.
Answer the quick estimate gives 65.6°, but the exact margin is 67.3° without the zero and 57.4° with it, so with the zero the estimate would have been 8° optimistic.
Check
Step 1. Write size_two_stage(...) returning the dict of design values.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write phase_margin(A0, wu, p2, z=math.inf).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write rz_for_pm(target, A0, wu, p2, gm6, Cc).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
For GBW = 50 MHz into 1 pF with = 0.5·, what does the input pair need?
Write units the way you normally would: 1.5 mS, 1500 µS and 0.0015 S are the same answer.
Check
With = 1 mS, = 1 pF and = 0.2 kΩ, where's the zero (positive means right half plane)?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
What's the quick-estimate phase margin for = 2.2 (no zero)?
Explain why
Why is a numerical phase-margin check worth writing, when the design equations already target a margin?
The design equations use approximations: they place the crossover exactly at the unity-gain frequency, treat the second pole as , and often leave out the right-half-plane zero and any higher poles. Each approximation shifts the margin a few degrees, and they don't all point the same way. The zero alone can cost ten degrees. A numerical check evaluates the actual gain and phase of the modeled transfer function at its true crossover, so it catches those errors before a simulation or a test chip does, and it turns choices like the nulling resistor into a quick search instead of a guess.
Practice
Keep practicing
6 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.