v {xschem version=3.0.0 file_version=1.2 }
G {}
K {}
V {}
S {}
E {}
B 2 1060 -550 1690 -70 {flags=graph
y1=1.16665
y2=5.05705
divy=4
subdivy=1
x1=2.3
x2=2.7
divx=6
subdivx=1
node="v(diffout)
v(plus)
v(minus)"
color="7 8 10"

}
T {CMOS DIFFERENTIAL AMPLIFIER
EXAMPLE. DC simulation} 140 -730 0 0 0.4 0.4 {}
T {This is an example of a code block that will
be placed as a header in the netlist.
use 'place=header' attribute and set the
header text as a 'value' attribute} 720 -720 0 0 0.4 0.4 {}
N 30 -310 30 -280 {lab=VCC}
N 30 -310 60 -310 {lab=VCC}
N 260 -240 260 -190 {lab=GN}
N 260 -190 300 -190 {lab=GN}
N 300 -190 300 -160 {lab=GN}
N 300 -160 530 -160 {lab=GN}
N 500 -290 520 -290 {lab=0}
N 670 -290 690 -290 {lab=0}
N 500 -260 690 -260 {lab=#net1}
N 440 -290 460 -290 {lab=PLUS}
N 730 -290 750 -290 {lab=MINUS}
N 690 -490 740 -490 {lab=VCC}
N 450 -490 500 -490 {lab=VCC}
N 540 -490 650 -490 {lab=G}
N 540 -490 540 -460 {lab=G}
N 500 -460 540 -460 {lab=G}
N 690 -560 690 -520 {lab=VCC}
N 500 -560 690 -560 {lab=VCC}
N 500 -560 500 -520 {lab=VCC}
N 570 -580 570 -560 {lab=VCC}
N 690 -420 830 -420 {lab=DIFFOUT}
N 30 -440 30 -410 {lab=PLUS}
N 30 -440 60 -440 {lab=PLUS}
N 30 -590 30 -560 {lab=MINUS}
N 30 -590 60 -590 {lab=MINUS}
N 570 -130 570 -100 {lab=0}
N 570 -130 590 -130 {lab=0}
N 590 -160 590 -130 {lab=0}
N 570 -160 590 -160 {lab=0}
N 260 -130 260 -100 {lab=0}
N 240 -130 260 -130 {lab=0}
N 240 -160 240 -130 {lab=0}
N 240 -160 260 -160 {lab=0}
N 690 -460 690 -380 { lab=DIFFOUT}
N 500 -460 500 -380 { lab=G}
N 570 -260 570 -250 { lab=#net1}
N 690 -380 690 -320 { lab=DIFFOUT}
N 500 -380 500 -320 { lab=G}
N 570 -250 570 -190 { lab=#net1}
C {lab_pin.sym} 750 -360 0 0 {name=p20 lab=0  net_name=true}
C {lab_pin.sym} 30 -220 0 0 {name=p17 lab=0  net_name=true}
C {title.sym} 160 -30 0 0 {name=l1 author="Stefan Schippers"  net_name=true}
C {nmos4.sym} 550 -160 0 0 {name=m1 model=cmosn w=5u l=2u m=1  net_name=true}
C {pmos4.sym} 670 -490 0 0 {name=m2 model=cmosp w=5u l=2u m=1  net_name=true}
C {vsource.sym} 30 -250 0 0 {name=VVCC value=5  net_name=true}
C {lab_pin.sym} 570 -100 0 0 {name=p1 lab=0  net_name=true}
C {lab_pin.sym} 60 -310 0 1 {name=p2 lab=VCC  net_name=true}
C {nmos4.sym} 280 -160 0 1 {name=m3 model=cmosn w=5u l=2u m=1  net_name=true}
C {lab_pin.sym} 260 -100 0 0 {name=p3 lab=0  net_name=true}
C {isource.sym} 260 -270 0 0 {name=IBIAS value=100u  net_name=true}
C {lab_pin.sym} 260 -300 0 0 {name=p4 lab=0  net_name=true}
C {nmos4.sym} 480 -290 0 0 {name=m4 model=cmosn w=10u l=1u m=1  net_name=true}
C {lab_pin.sym} 520 -290 0 1 {name=p5 lab=0  net_name=true}
C {nmos4.sym} 710 -290 0 1 {name=m5 model=cmosn w=10u l=1u m=1  net_name=true}
C {lab_pin.sym} 670 -290 0 0 {name=p0 lab=0  net_name=true}
C {lab_pin.sym} 740 -490 0 1 {name=p6 lab=VCC  net_name=true}
C {pmos4.sym} 520 -490 0 1 {name=m6 model=cmosp w=5u l=2u m=1  net_name=true}
C {lab_pin.sym} 450 -490 0 0 {name=p7 lab=VCC  net_name=true}
C {lab_pin.sym} 570 -580 0 0 {name=p8 lab=VCC  net_name=true}
C {lab_pin.sym} 440 -290 0 0 {name=p9 lab=PLUS  net_name=true}
C {lab_pin.sym} 750 -290 0 1 {name=p10 lab=MINUS  net_name=true}
C {lab_pin.sym} 830 -420 0 1 {name=p11 lab=DIFFOUT  net_name=true}
C {lab_pin.sym} 260 -210 0 0 {name=p13 lab=GN  net_name=true}
C {lab_pin.sym} 30 -350 0 0 {name=p14 lab=0  net_name=true}
C {vsource.sym} 30 -380 0 0 {name=VPLUS value="2.5 pwl 0 2.4 10n 2.4 10.1n 2.6"  net_name=true}
C {lab_pin.sym} 60 -440 0 1 {name=p15 lab=PLUS  net_name=true}
C {lab_pin.sym} 30 -500 0 0 {name=p16 lab=0  net_name=true}
C {vsource.sym} 30 -530 0 0 {name=V1 value=2.5  net_name=true}
C {lab_pin.sym} 60 -590 0 1 {name=p18 lab=MINUS  net_name=true}
C {capa.sym} 750 -390 0 0 {name=CL
m=1
value=2p
footprint=1206
device="ceramic capacitor"  net_name=true}
C {code.sym} 900 -190 0 0 {name=STIMULI
only_toplevel=true
value=".temp 30
** models are generally not free: you must download
** SPICE models for active devices and put them into the below 
** referenced file in netlist/simulation directory.
** http://bwrcs.eecs.berkeley.edu/Classes/icdesign/ee241_s00/ASSIGNMENTS/TSMC035-n96g-params.txt
.include \\"models_cmos_example.txt\\"
.option savecurrents
.save all @m4[gm] @m5[gm] @m1[gm]
.control
save all
op
write cmos_example.raw
set appendwrite
* tran 1n 300n
dc vplus 2.3 2.7 0.001
write cmos_example.raw
.endc

"}
C {lab_pin.sym} 500 -430 0 0 {name=p12 lab=G  net_name=true}
C {launcher.sym} 700 -60 0 0 {name=h1
descr=Backannotate
tclcommand="ngspice::annotate"}
C {launcher.sym} 700 -110 0 0 {name=h2
descr="View raw file"
tclcommand="textwindow $netlist_dir/cmos_example.raw"}
C {ngspice_probe.sym} 500 -390 0 0 {name=r1}
C {ngspice_probe.sym} 420 -160 0 0 {name=r2}
C {ngspice_probe.sym} 600 -260 0 0 {name=r3}
C {ngspice_probe.sym} 770 -420 0 0 {name=r4}
C {ngspice_get_value.sym} 620 -160 0 0 {name=r5 node=i(@$\{path\}m1[id])
descr="I="}
C {code.sym} 890 -580 0 0 {name=HEADER
place=header
only_toplevel=true
value="** ======================== **
** This is a netlist header **
** ======================== **"}
C {launcher.sym} 1125 -585 0 0 {name=h3 
descr="Select arrow and 
Ctrl key + Left-button-Click to load/unload waveforms" 
tclcommand="
xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw
"
}
C {launcher.sym} 1300 -50 0 0 {name=h4
descr="Graph Manual page"
url="https://xschem.sourceforge.io/stefan/xschem_man/graphs.html"}
C {launcher.sym} 1260 -670 0 0 {name=h5 
descr=" Ctrl-Left-Click to load/unload
embedded waveforms" 
tclcommand="xschem raw_read_from_attr"
spice_data="
[encoded data, 174021 characters]
AAAAAAAEQK/MmE1vlvc/N5mZmZmZBUAAAAAAAAAAAAAAAAAAABRAAAAAAAAAAADsyD76tEgavw=="}
