Skip to content

Instantly share code, notes, and snippets.

@snmishra
Last active January 13, 2021 07:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snmishra/4e6fa23affd66585920ee538fcc6ed89 to your computer and use it in GitHub Desktop.
Save snmishra/4e6fa23affd66585920ee538fcc6ed89 to your computer and use it in GitHub Desktop.
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 http://ptm.asu.edu/modelcard/LP/45nm_LP.pm
.inc "../PTM-MG/45nm_LP.pm"
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(*)
.control
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
end
.endc
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment