v {xschem version=3.4.6 file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
* simulation.
* Copyright (C) 1998-2024 Stefan Frederik Schippers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
}
G {}
K {}
V {}
S {}
E {}
L 18 2175 -40 2210 -40 {}
L 18 2175 -40 2175 40 {}
L 18 2175 40 2210 40 {}
L 18 2210 40 2230 90 {}
L 18 2230 90 2240 90 {}
L 18 2240 -90 2240 90 {}
L 18 2230 -90 2240 -90 {}
L 18 2210 -40 2230 -90 {}
L 18 2210 -40 2210 40 {}
L 18 2230 -90 2230 90 {}
B 2 2520 -210 3200 -20 {flags=graph
y1 = -0.0035
y2 = 11
divy = 6
x1=0.0097330137
x2=0.010324865
divx=10
node="i(v.x1.vu)
i(v.x0.vu)
i(v.x1.vd)
i(v.x0.vd)"
color="11 13 12 7"
unitx=1
autoload=1
sim_type=tran}
B 2 2520 -540 3200 -230 {flags=graph
y1 = -49
y2 = 59
divy = 12
x1=0.0097330137
x2=0.010324865
divx=10
node="outp
outm
vpp
vnn
x1.vboost
x0.vboost"
color="4 15 6 12 7 4"
unitx=1
hilight_wave=-1
autoload=1
sim_type=tran}
B 2 2520 -730 3200 -540 {flags=graph
y1 = 0
y2 = 840
divy = 6
x1=0.0097330137
x2=0.010324865
divx=10


unitx=1
color="4 7"
node="\\"supply power;i(vcurrvnn) vnn * i(vcurrvpp) vpp * +\\"
\\"running average supply power;i(vcurrvnn) vnn * i(vcurrvpp) vpp * + 200u ravg()\\""
hilight_wave=1
autoload=1
sim_type=tran}
B 2 2520 -20 3200 170 {flags=graph
y1 = 0
y2 = 850
divy = 6
x1=0.0097330137
x2=0.010324865
divx=10


unitx=1
color="4 7"
node="\\"Load power;outm outp - i(v.x1.v8) *\\"
\\"Running Average Load power;outm outp - i(v.x1.v8) * 200u ravg()\\""
autoload=1
sim_type=tran}
B 2 1980 360 2117 420 {flags=image
alpha=0.6
[encoded data, 50943 characters]}
B 2 1810 362.5 1948 425 {flags=image
alpha=0.6
image=/home/schippes/x/xyce.png
[encoded data, 61011 characters]}
T {actual value
50u} 240 -470 0 1 0.4 0.4 {}
T {actual value
50u} 230 1120 0 1 0.4 0.4 {}
T {actual value
50u} 10 -930 0 0 0.4 0.4 {}
T {actual value
50u} 40 610 0 0 0.4 0.4 {}
T {actual value
200} 2190 -1180 0 0 0.4 0.4 {}
T {Select one or more graphs (and no other objects)
and use arrow keys to zoom / pan waveforms} 2430 -830 0 0 0.3 0.3 {}
N 1880 -1410 1880 -1390 {lab=#net1}
N 1880 -1270 1880 -1250 {lab=#net2}
N 1830 -1050 1900 -1050 {lab=VSS}
N 1900 -1050 1900 -1040 {lab=VSS}
N 1900 -1040 1940 -1040 {lab=VSS}
N 1870 -1090 1900 -1090 {lab=IN}
N 1940 -1100 2030 -1100 {lab=REFP}
N 2070 -1260 2070 -1250 {lab=VNN}
N 2070 -1330 2070 -1320 {lab=VSS}
N 1880 -1250 1910 -1250 {lab=#net2}
N 1880 -1410 1910 -1410 {lab=#net1}
N 2070 -1330 2080 -1330 {lab=VSS}
N 2050 -1410 2080 -1410 {lab=VPP}
N 2050 -1250 2070 -1250 {lab=VNN}
N 2050 -1330 2070 -1330 {lab=VSS}
N 90 -540 210 -540 {lab=FBN}
N 90 -420 90 -400 {lab=IN}
N 80 1050 210 1050 {lab=FB}
N 190 490 190 510 {lab=VPP}
N 210 670 210 700 {lab=INX}
N 210 760 210 780 {lab=VSS}
N 1830 -970 1900 -970 {lab=VSS}
N 1870 -1010 1900 -1010 {lab=IN}
N 1940 -1020 2030 -1020 {lab=REFM}
N 150 670 190 670 {lab=INX}
N 80 1170 80 1190 {lab=VSS}
N 190 670 210 670 {lab=INX}
N 210 -860 250 -860 {lab=VSSX}
N 190 -1040 190 -1020 {lab=VPP}
N 210 -860 210 -830 {lab=VSSX}
N 210 -770 210 -750 {lab=VSS}
N 190 -860 210 -860 {lab=VSSX}
N 140 -860 190 -860 {lab=VSSX}
N 2200 -1100 2220 -1100 {lab=IN_INT}
N 2200 -1100 2200 -1070 {lab=IN_INT}
N 210 -650 210 -630 {lab=VPP}
N 210 940 210 960 {lab=VPP}
N 2190 30 2190 250 {lab=OUTP}
N 210 -540 250 -540 {lab=FBN}
N 210 1050 270 1050 {lab=FB}
N 1900 -960 1940 -960 {lab=VSS}
N 1900 -970 1900 -960 {lab=VSS}
N 2080 -1410 2120 -1410 {lab=VPP}
N 2070 -1250 2120 -1250 {lab=VNN}
N 2080 -1330 2120 -1330 {lab=VSS}
N 2080 -1340 2080 -1330 { lab=VSS}
N 2080 -1410 2080 -1400 { lab=VPP}
N 210 -570 210 -540 { lab=FBN}
N 210 1020 210 1050 { lab=FB}
N 190 -960 190 -860 { lab=VSSX}
N 190 640 190 670 { lab=INX}
N 1970 -1410 1990 -1410 {lab=#net3}
N 1970 -1250 1990 -1250 {lab=#net4}
N 1880 -1330 1990 -1330 {lab=#net5}
N 270 870 310 870 {
lab=FB}
N 270 870 270 1050 {
lab=FB}
N 1700 -800 2190 -800 {
lab=OUTM}
N 2190 -800 2190 -30 {
lab=OUTM}
N 2190 260 2190 760 {
lab=OUTP}
N 1700 760 2190 760 {
lab=OUTP}
N 80 940 80 990 {
lab=OUTP}
N 90 -650 90 -600 {
lab=OUTM}
N 250 -690 310 -690 {
lab=FBN}
N 250 -690 250 -540 {
lab=FBN}
N 250 -860 250 -740 {
lab=VSSX}
N 250 -740 310 -740 {
lab=VSSX}
N 270 820 310 820 {
lab=INX}
N 270 640 270 820 {
lab=INX}
N 190 640 270 640 {
lab=INX}
N 190 570 190 640 { lab=INX}
N 230 1300 310 1300 {lab=VNN}
N 230 1260 310 1260 {lab=VSS}
N 230 -260 310 -260 {lab=VNN}
N 230 -300 310 -300 {lab=VSS}
N 230 170 310 170 {lab=VPP}
N 230 -1390 310 -1390 {lab=VPP}
C {vsource.sym} 1880 -1360 0 0 {name=V1 value="dc 50 pwl 0 0 1m 50"}
C {vsource.sym} 1880 -1300 0 0 {name=V0 value="dc 50 pwl 0 0 1m 50"}
C {lab_pin.sym} 2120 -1410 0 1 {name=p5 lab=VPP}
C {lab_pin.sym} 2120 -1250 0 1 {name=p6 lab=VNN}
C {lab_pin.sym} 2120 -1330 0 1 {name=p3 lab=VSS}
C {lab_pin.sym} 2190 250 0 1 {name=p14 lab=OUTP}
C {res.sym} 2190 0 0 1 {name=R1 m=1 value=8}
C {lab_pin.sym} 1830 -1050 0 0 {name=p26 lab=VSS}
C {lab_pin.sym} 1870 -1090 0 0 {name=p31 lab=IN}
C {vcvs.sym} 1940 -1070 0 0 {name=E3 value=\{gain*0.99\}}
C {lab_pin.sym} 2030 -1100 0 1 {name=p32 lab=REFP}
C {capa.sym} 2070 -1290 0 0 {name=C3 m=1 value="100u"}
C {res.sym} 1940 -1410 1 1 {name=R11 m=1 value=0.3}
C {res.sym} 1940 -1250 1 1 {name=R9 m=1 value=0.3}
C {res.sym} 90 -570 0 0 {name=R19 m=1 value='100k'
}
C {res.sym} 90 -510 0 0 {name=R0 m=1 value="'100k/gain'"}
C {lab_pin.sym} 90 -400 0 1 {name=p108 lab=IN}
C {lab_pin.sym} 2190 -210 0 1 {name=p9 lab=OUTM}
C {lab_pin.sym} 230 170 0 0 {name=p12 lab=VPP}
C {lab_pin.sym} 230 1300 0 0 {name=p13 lab=VNN}
C {res.sym} 190 540 0 1 {name=R6 m=1 value=100k}
C {lab_pin.sym} 190 490 0 0 {name=p7 lab=VPP}
C {res.sym} 210 730 0 1 {name=R7 m=1 value=100k}
C {lab_pin.sym} 210 780 0 0 {name=p15 lab=VSS}
C {lab_pin.sym} 1830 -970 0 0 {name=p20 lab=VSS}
C {lab_pin.sym} 1870 -1010 0 0 {name=p21 lab=IN}
C {vcvs.sym} 1940 -990 0 0 {name=E0 value=\{-gain*0.99\}}
C {lab_pin.sym} 2030 -1020 0 1 {name=p23 lab=REFM}
C {lab_pin.sym} 190 640 0 0 {name=p8 lab=INX}
C {lab_pin.sym} 2200 -950 0 0 {name=p126 lab=VSS}
C {lab_pin.sym} 2280 -1100 0 1 {name=p127 lab=IN}
C {capa.sym} 90 -450 0 1 {name=C5 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 80 1190 0 1 {name=p11 lab=VSS}
C {capa.sym} 80 1140 0 1 {name=C6 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 230 1260 0 0 {name=p28 lab=VSS}
C {res.sym} 80 1020 0 0 {name=R2 m=1 value='100k'}
C {res.sym} 80 1080 0 0 {name=R3 m=1 value="'100k/(gain-2)'"}
C {vsource.sym} 2200 -1040 0 0 {name=V3 
xvalue="dc 0 pulse -.1 .1 1m .1u .1u 10.1u 20u" 
value="dc 0 sin 0 1 \{frequ\} 1m"
}
C {res.sym} 190 -990 0 1 {name=R4 m=1 value=100k}
C {lab_pin.sym} 190 -1040 0 0 {name=p18 lab=VPP}
C {res.sym} 210 -800 0 1 {name=R5 m=1 value=100k}
C {lab_pin.sym} 210 -750 0 0 {name=p10 lab=VSS}
C {res.sym} 210 -600 0 0 {name=R8 m=1 value=100k}
C {capa.sym} 120 670 1 0 {name=C4 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 90 670 0 0 {name=p0 lab=IN}
C {capa.sym} 110 -860 1 0 {name=C1 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 80 -860 0 0 {name=p17 lab=VSS}
C {lab_pin.sym} 250 -860 0 1 {name=p22 lab=VSSX}
C {res.sym} 2250 -1100 1 1 {name=R10 m=1 value=2}
C {lab_pin.sym} 210 -650 0 1 {name=p24 lab=VPP}
C {res.sym} 210 990 0 0 {name=R13 m=1 value=100k}
C {lab_pin.sym} 210 940 0 1 {name=p16 lab=VPP}
C {vsource.sym} 2200 -980 0 0 {name=Vin value=0 xvalue="pwl 0 .1 1m .1 1.01m 0"
}
C {lab_pin.sym} 270 1050 0 1 {name=p19 lab=FB}
C {lab_pin.sym} 250 -540 0 1 {name=p25 lab=FBN}
C {title.sym} 180 1470 0 0 {name=l2 author="Stefan Schippers"}
C {lab_pin.sym} 2200 -1100 0 0 {name=p27 lab=IN_INT}
C {ammeter.sym} 2020 -1410 3 0 {name=vcurrvpp}
C {ammeter.sym} 2020 -1250 3 0 {name=vcurrvnn}
C {ammeter.sym} 2020 -1330 3 0 {name=vcurrvss}
C {launcher.sym} 60 -120 0 0 {name=h2
descr="Ctrl-Click
Clear all probes" 
tclcommand="
    xschem push_undo
    xschem set no_undo 1
    xschem set no_draw 1
 
    set lastinst [xschem get instances]
    for \{ set i 0 \} \{ $i < $lastinst \} \{incr i \} \{
      set type [xschem getprop instance $i cell::type]
      if \{ [regexp \{(^|/)probe$\} $type ] \} \{
        xschem setprop $i voltage fast
      \}
      if \{ [regexp \{current_probe$\} $type ] \} \{
        xschem setprop $i current fast
      \}
      if \{ [regexp \{differential_probe$\} $type ] \} \{
        xschem setprop $i voltage fast
      \}
    \}
    xschem set no_undo 0
    xschem set no_draw 0
    xschem redraw
"
}
C {capa.sym} 2080 -1370 0 0 {name=C2 m=1 value="100u"}
C {ngspice_get_expr.sym} 95 1005 0 0 {name=r18 
node="[ngspice::get_current \{r2[i]\}]"
descr = current
 }
C {ngspice_get_expr.sym} 2150 -10 2 0 {name=r29 
node="[format %.4g [expr \{([ngspice::get_voltage outm] - [ngspice::get_voltage outp]) * [ngspice::get_current \{r1[i]\}]\}]] "
descr = power
}
C {launcher.sym} 60 -190 0 0 {name=h3
descr="Load file into gaw" 
comment="
  This launcher gets raw filename from current schematic using 'xschem get schname'
  and stripping off path and suffix.  It then loads raw file into gaw.
  This allow to use it in any schematic without changes.
"
tclcommand="
set rawfile [file tail [file rootname [xschem get schname]]].raw
gaw_cmd \\"tabledel $rawfile
load $netlist_dir/$rawfile
table_set $rawfile\\"
unset rawfile"
}
C {spice_probe.sym} 1990 -1100 0 0 {name=p42 analysis=tran }
C {spice_probe.sym} 2000 -1020 0 0 {name=p43 analysis=tran }
C {spice_probe.sym} 2280 -1100 0 0 {name=p44 analysis=tran }
C {launcher.sym} 1880 170 0 0 {name=h1
descr="Backannotate"
tclcommand="xschem annotate_op"}
C {ngspice_get_expr.sym} 1940 -1200 0 0 {name=r19 
node="[ngspice::get_current \{r9[i]\}]"
descr = current
}
C {spice_probe.sym} 2110 -1410 0 0 {name=p45 analysis=tran }
C {spice_probe.sym} 2110 -1250 0 0 {name=p46 analysis=tran }
C {launcher.sym} 1880 310 0 0 {name=h5 
descr="load ngspice waves" 
tclcommand="
xschem raw_read $netlist_dir/poweramp_lcc.raw tran
"
}
C {launcher.sym} 1880 220 0 0 {name=h6
descr="Graph Manual page"
url="https://xschem.sourceforge.io/stefan/xschem_man/graphs.html"}
C {simulator_commands.sym} 1890 -420 0 0 {name=COMMANDS
simulator=ngspice
only_toplevel=false 
value="
.option ITL4=20000 ITL5=0
vvss vss 0 dc 0 
.temp 30

.param frequ=5k
.param gain=45
.option savecurrents

** models are generally not free: you must download
** SPICE models for active devices and put them  into the below 
** referenced file in simulation directory.
.include \\"models_poweramp.txt\\"
.control
save all
op
write poweramp_lcc.raw
set appendwrite
tran  8e-7 0.02 uic
* .FOUR 20k v(outm,outp)
* .probe i(*) 
plot outp outm
save p(r*) p(v*)
write poweramp_lcc.raw
.endc
"}
C {simulator_commands.sym} 1890 -620 0 0 {name=COMMANDS1
simulator=xyce
only_toplevel=false 
value="
vvss vss 0 dc 0 

.param frequ=5k
.param gain=45

** models are generally not free: you must download
** SPICE models for active devices and put them  into the below 
** referenced file in simulation directory.
.include \\"models_poweramp.txt\\"
.tran  8e-7 0.07 uic
* .op
.print tran format=raw file=poweramp_lcc_xyce.raw v(*) i(*) 
+ v(x1:*) v(x0:*) i(x1:*) i(x0:*)
+ id(x0:*) ig(x0:*) is(x0:*) ib(x0:*)
+ ib(x0:*) ic(x0:*) ie(x0:*)
+ id(x1:*) ig(x1:*) is(x0:*) ib(x1:*)
+ ib(x1:*) ic(x1:*) ie(x1:*)
* .print dc format=raw file=poweramp_op.raw v(*) i(*) v(x1:*) v(x0:*) i(x1:*) i(x0:*)

"}
C {launcher.sym} 1880 270 0 0 {name=h7 
descr="load Xyce waves" 
tclcommand="
xschem raw_read $netlist_dir/poweramp_lcc_xyce.raw tran
"
}
C {mos_power_ampli.sch} 310 1440 0 0 {name=x0}
C {mos_power_ampli.sch} 310 -120 0 0 {name=x1}
C {lab_wire.sym} 1760 760 0 1 {name=p29 lab=OUTP}
C {lab_wire.sym} 1760 -800 0 1 {name=p30 lab=OUTM}
C {lab_pin.sym} 80 940 0 0 {name=p33 lab=OUTP}
C {lab_pin.sym} 90 -650 0 1 {name=p34 lab=OUTM}
C {lab_pin.sym} 230 -1390 0 0 {name=p1 lab=VPP}
C {lab_pin.sym} 230 -260 0 0 {name=p2 lab=VNN}
C {lab_pin.sym} 230 -300 0 0 {name=p4 lab=VSS}
