Skip to content
Tutorials Center
My learning

Topics

Lesson 41 of 45 Β· Projects and Practice

Project: build and measure a MOSFET simulator

Build a compact MOSFET model in Python that works from subthreshold to strong inversion, plot its characteristics and extract V_T, slope, g_m and DIBL like an engineer.

Device engineers do not just read equations; they build compact models and then measure them, in simulation or in the lab, to extract parameters. In this project you will write a MOSFET model that behaves sensibly in every region, generate its I-V curves, and then pretend the output is "measured data" and extract threshold voltage, subthreshold slope, transconductance and DIBL from it. Everything runs in your browser.

What you will learn

  • How to write one smooth equation that covers subthreshold, triode and saturation.
  • How to generate output and transfer characteristics and plot them on linear and log axes.
  • Three standard ways to extract the threshold voltage.
  • How to measure subthreshold slope and DIBL.
  • How a model becomes the building block for a circuit (the CMOS inverter).

The pipeline

Four stages: parameters, equations, curves and extraction
Caption: A simulator is a pipeline: parameters go in, equations produce curves, and extraction turns curves back into numbers.

Step 1: a model that spans all regions

The textbook equations break at V_GS = V_T: the square law predicts zero current, while the real device shows an exponential subthreshold tail. A neat way out is an interpolation model in the style of the EKV compact model. Define the forward and reverse terms

F(x) = lnΒ²(1 + e^(x / (2 V_T)))

and write the drain current (source grounded) as

I_D = 2 nΒ² Ξ² V_TΒ² Β· [ F(V_P) βˆ’ F(V_P βˆ’ V_DS) ] Β· (1 + Ξ» V_DS), with V_P = (V_GS βˆ’ V_T) / n

where Ξ² = Β΅C_ox W/L, n β‰₯ 1 is the slope factor, and V_T here is the thermal voltage. For V_P ≫ V_T this reduces to the square law Β½Ξ²(V_GS βˆ’ V_T)Β² in saturation and to the triode equation for small V_DS; for V_P β‰ͺ 0 it reduces to I ∝ e^((V_GS βˆ’ V_T)/(n V_T)), an exponential with slope n V_T ln10 per decade. One formula, all regions, and it is smooth, which numerical circuit solvers like. We add DIBL by letting the threshold fall with the drain voltage: V_T = V_T0 βˆ’ Ξ· V_DS.

Python Step 1: model and characteristics

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 2: extract parameters from the curves

Now treat the simulated curves as measurements and recover the model's parameters, as a process engineer would.

Threshold voltage, three ways.

  1. Linear extrapolation at maximum g_m. At small V_DS (say 50 mV), find the gate voltage where g_m = dI_D/dV_GS is largest, draw the tangent line there and read where it crosses I_D = 0. The x-intercept corrects for the V_DS/2 offset to give V_T.
  2. Constant-current criterion. Define V_T as the V_GS at which I_D = 100 nA Γ— W/L (a common convention).
  3. Square-root method in saturation: fit a line to √I_D against V_GS.

Subthreshold slope. Find the steepest part of log I_D against V_GS below threshold: S = Ξ”V_GS/Ξ”log₁₀I_D.

DIBL. Compare the threshold voltage at low and high V_DS: DIBL = (V_T,lin βˆ’ V_T,sat)/(V_DS,sat βˆ’ V_DS,lin), in mV/V.

Python Step 2: parameter extraction

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 3: use the model in a circuit

A model earns its keep when you wire it into something. Combine an NMOS and a PMOS (the PMOS is the same equation with the voltages mirrored) and solve for the output where their currents balance, exactly as you did for the CMOS inverter, but now with subthreshold behavior and DIBL included.

Python Step 3: inverter with the compact model

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Challenges

  1. Change the slope factor n from 1.3 to 1.0 and 1.6. How do S and the off-current at V_GS = 0 change?
  2. Add velocity saturation by replacing V_P with a limited overdrive, or divide I_D by 1 + ΞΈΒ·(V_GS βˆ’ V_T), and see how the output curves lose their quadratic shape.
  3. Make the PMOS weaker (bp = 0.7e-3) and find the new V_M. Which way does it move and why?
  4. Add a series source resistance R_s: solve for the internal V_GS and V_DS at each point. What happens to g_m?
  5. Estimate the ring-oscillator frequency of three inverters from t_pd β‰ˆ C V_DD/(2 I_on).

Check your understanding

Quick check Β· 4 questions

of 4 answered You scored / 4 Β· perfect!

  1. 1. Why use an interpolation (EKV-style) model instead of the square law alone?

    The square law predicts zero current below V_T; the interpolation model reproduces the exponential subthreshold tail with one smooth formula.
  2. 2. The linear-extrapolation method for V_T uses

    The tangent at max g_m crosses the V_GS axis near V_T (after subtracting V_DS/2).
  3. 3. DIBL in this model means that the threshold voltage

    The drain lowers the source-channel barrier; the model uses V_T = V_T0 βˆ’ Ξ· V_DS.
  4. 4. If the slope factor n rises from 1.3 to 1.6, the subthreshold slope S

    S = n Γ— 59.5 mV/decade at 300 K.

Summary

  • One smooth equation can describe subthreshold, triode and saturation, which is how compact models work.
  • Extraction methods (max-g_m tangent, constant current, √I_D fit) give slightly different V_T; engineers state which one they use.
  • Subthreshold slope and DIBL are measured from log-scale and two-V_DS curves.
  • A good device model plugs straight into circuit solutions such as the CMOS inverter.

Next: Project: a solar cell model