diff options
| author | Warrick Lo <wlo@warricklo.net> | 2026-03-08 16:28:58 -0700 |
|---|---|---|
| committer | Warrick Lo <wlo@warricklo.net> | 2026-03-08 16:28:58 -0700 |
| commit | c73f0093e7a43403d63548b9484cff67204cad2c (patch) | |
| tree | 502ea563d0459e0631fdb758f90238c05f8c392f /schematic/mosfet-check.tcl | |
| parent | Add circuit schematic and symbol (diff) | |
| download | opamp-c73f0093e7a43403d63548b9484cff67204cad2c.tar.xz opamp-c73f0093e7a43403d63548b9484cff67204cad2c.zip | |
Add testbenches
Signed-off-by: Warrick Lo <wlo@warricklo.net>
Diffstat (limited to 'schematic/mosfet-check.tcl')
| -rw-r--r-- | schematic/mosfet-check.tcl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/schematic/mosfet-check.tcl b/schematic/mosfet-check.tcl new file mode 100644 index 0000000..3cdfc23 --- /dev/null +++ b/schematic/mosfet-check.tcl @@ -0,0 +1,27 @@ +xschem annotate_op +xschem unhilight_all + +foreach {i n t} [xschem instance_list] { + if {$t eq {nmos} || $t eq {pmos}} { + set inst x[string tolower $i] + lassign [array get ::ngspice::ngspice_data *$inst.*\\\[vth\\\]*] node_vth vth + lassign [array get ::ngspice::ngspice_data *$inst.*\\\[vgs\\\]*] node_vgs vgs + lassign [array get ::ngspice::ngspice_data *$inst.*\\\[vds\\\]*] node_vds vds + set vov [expr {$vgs - $vth}] + + if {$vov <= 0} { + # Off. + xschem set hilight_color 0 + } elseif {$vds < $vov} { + # Linear/triode. + xschem set hilight_color 1 + } else { + # Saturation. + xschem set hilight_color 2 + } + + xschem hilight_instname $i fast + } +} + +xschem redraw |