Skip to content

Instantly share code, notes, and snippets.

Last active Jan 13, 2021
What would you like to do?
Example testbench for generating gm/ID curves using ngspice
* gm/Id simulation
* public domain
.param ll=250n vg=1 vd=0.7 vdd=1.1
* Download models from
.inc "../PTM-MG/"
vg vg 0 vg
vdn dn 0 'vd'
vdp dp 0 '-vd'
egn gn 0 vg 0 1
egp gp 0 vg 0 -1
mn dn gn 0 0 nmos w=10u l=ll
mp dp gp 0 0 pmos w=10u l=ll
.probe dc v(*) i(*)
set filetype binary
set appendwrite
save all @mn[gm] @mn[id] @mn[cgs] @mn[cgg] @mn[cgd] @mn[gds] @mn[w] @mn[l]
+ @mp[gm] @mp[id] @mp[cgs] @mp[cgg] @mp[cgd] @mp[gds] @mp[w] @mp[l]
foreach tx_len 250n 500n 750n 1u 1.5u 2u 3u 5u 10u
alter @mn[l] = $tx_len
alter @mp[l] = $tx_len
* Vgs sweep
dc vg 0 1.1 0.01
write gmid.raw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment