MOSFET CβV Extraction Tool (BSIM4, ngspice)
Links
| Language | GitHub Pages π | GitHub π» |
|---|---|---|
| πΊπΈ English |
This tool automatically extracts gate capacitance (CggβVg) characteristics
from BSIM4 NMOS/PMOS models using ngspice DC analysis.
Key features:
- Per-process-node analysis (e.g., 130nm)
- Independent extraction for NMOS and PMOS
- Temperature sweep (LT = β40Β°C, RT = 25Β°C, HT = 125Β°C)
- Model files separated under
models/ - Automatic netlist generation β ngspice batch execution β Cgg extraction β PNG output
π Directory Structure
BSIM4_ANALYZER_CV/
β
βββ models/
β βββ nmos130.sp
β βββ pmos130.sp
β
βββ template_cv.cir
βββ run_cv.py
βββ plot_cv.py
βββ README.md
β
βββ results/
βββ 130nm/
βββ nmos_130nm_RT.cir
βββ nmos_130nm_RT.log
βββ nmos_130nm_RT.png
βββ pmos_130nm_RT.cir
βββ pmos_130nm_RT.log
βββ pmos_130nm_RT.png
βββ β¦ (LT / HT also produced)
π§© 1. template_cv.cir (Analysis Template)
A voltage sweep template used by Python .format() to embed settings.
NMOS (standard)
- Connections: S = D = B = 0V, gate swept
- Sweep: 0V β VDD
PMOS (real device behavior)
- Connections: D = S = B = VDD, gate swept
- Sweep: VDD β 0V
β Matches physical ON/OFF behavior
(OFF at Vg = VDD β ON at Vg = 0)
Output: Cgg only
.print dc V(g) @m1[cgg]
β Why Only Cgg Is Extracted (Important)
BSIM4 internal capacitances behave as:
- Cgg = βQg / βVg, a physically meaningful total gate capacitance
- Cgs, Cgd, Cgb are partitioned charges (model-dependent), not physical CV values
Problems with partitioned capacitances:
- Cgs + Cgd + Cgb β Cgg
- Cgs/Cgd depend heavily on the charge-partition algorithm
- They may contain unstable values at low Vg
β Therefore, this tool extracts Cgg only, ensuring physical interpretability.
π 2. Netlist Auto-Generation & Batch Execution (run_cv.py)
Run:
python run_cv.py
This performs:
- Auto-generation of NMOS/PMOS Γ LT/RT/HT netlists
- Automatic batch execution of all 6 cases using ngspice
Update ngspice path if needed:
NGSPICE_CMD = r"C:\Program Files\Spice64\bin\ngspice.exe"
π 3. Plotting CggβVg (plot_cv.py)
Run:
python plot_cv.py
Processing steps:
- Read V(g) and Cgg from
.print dc - Remove index=0 (DC initial non-physical point)
- Remove Cgg β€ 0 (solver startup noise)
- Save PNG to:
results/<node>/<basename>.png
π§ͺ Example Output Behavior
- NMOS: accumulation β depletion β inversion (U-shaped curve)
- PMOS: reversed sweep (VDD β 0), following real device biasing
- Units: F (farads), matplotlib handles scientific notation automatically
π¦ Model Files (models/*.sp)
BSIM4 educational models:
nmos130.sppmos130.sp
(Not matched to any foundry process; intended for learning & analysis.)
π§ Adding a New Process Node
Add a node definition inside run_cv.py:
"90nm": {
"vdd": 1.0,
"nmos_model_file": "nmos90.sp",
"pmos_model_file": "pmos90.sp",
"nmos_model_name": "nmos90",
"pmos_model_name": "pmos90",
"lch": "0.09u",
"wch": "1u",
"toxe": "1.8e-9",
},
β Environment
- Windows 11
- ngspice 41 (64-bit)
- Python 3.9+
- matplotlib 3.x
π Summary
This tool provides:
- Correct terminal conditions for NMOS/PMOS and physically accurate sweep directions
- Physically meaningful extraction of Cgg only
- Fully automated batch processing for 6 conditions (NMOS/PMOS Γ 3 temperatures)
- Clean separation of models / template / results for easy scaling
- Complete automation from ngspice β log β PNG
Ideal for device physics education, compact modeling, and process comparison studies.
Possible extensions:
- dC/dV extraction
- Cox estimation
- CV-derived Vth
- Experimental-research mode for Cgs/Cgd/Cgb
- Multi-node comparison plots
β NMOS CβV Characteristics (130nm, RT)

- Device: NMOS (130nm)
- Temperature: RT (Room Temperature)
- Behavior: Accumulation β Depletion β Inversion
- Extracted Parameter: Cgg vs. Vg
β PMOS CβV Characteristics (130nm, RT)

- Device: PMOS (130nm)
- Temperature: RT (Room Temperature)
- Sweep Direction: VDD β 0 V (realistic PMOS biasing)
- Extracted Parameter: Cgg vs. Vg
π Hybrid License
This project uses a Hybrid License:
| Item | License | Description |
|---|---|---|
| Source Code | MIT License | Free to use, modify, redistribute |
| Documentation / Text Materials | CC BY 4.0 | Attribution required |
| Figures / Plots / Generated Images | CC BY-NC 4.0 | Non-commercial use only |
| External References | Original license applies | Cite appropriately |
π€ Author
| π Item | Details |
|---|---|
| Name | Shinichi Samizo |
| GitHub |