* SPICE netlist
Q1 CA INA N011 0 2N3904
R1 N011 N014 {Rfb}
R2 N012 N014 {Rfb}
Q2 CB INB N012 0 2N3904
R13 v+ CB {Rt}
R14 v+ CA {Rt}
VP V+ 0 {Va}
VN 0 V- {Va}
VINA INA 0 PWL file=ampl_train.pwl AC 0.5
VINB INB 0 0 AC -0.5
VP1 VCC 0 3.3
R3 N006 N005 {Rfb2}
R4 N007 N005 {Rfb2}
R5 0 OA {Rt2}
R6 0 OB {Rt2}
Q3 OB N010 N006 0 2N3906
Q4 OA N004 N007 0 2N3906
Q5 v+ CA N004 0 2N3904
Q6 v+ CB N010 0 2N3904
R7 N004 0 4.7k
R8 N010 0 4.7k
R9 v+ sense_out {4.7k*2}
Q9 N015 OA sense_out 0 2N3906
Q8 N015 OB sense_out 0 2N3906
Q10 N008 sense_out 0 0 2N3904
R11 VCC N008 100
R12 V+ v+ 1m
R15 N015 V- 1m
R16 N014 N015 {12/Iset}
Q12 N005 N003 N002 0 2N3906
Q13 N001 N001 v+ 0 2N3906
D2 N003 N001 1N750
R18 N003 0 500
R19 v+ N002 {R_th}
D1 sense_out N008 BAT54
Q7 VCC N008 N013 0 2N3904
R10 N013 N009 220
R17 N009 0 220
Q11 output N009 0 0 2N3904
R20 VCC output 100
D3 N009 output BAT54
R21 v+ sense_out {4.7k*2}
;.dc VINA -100m 100m 0.1m
.step temp -25 100 25
;.step param Rfb 0.01m 100 10
.param Rfb=Rt/sqrt(sqrt(2)*gain)
.param Rt=Va/Iset
.param Iset = 7m
.param Va = 15
.param Rt2=cm_out*2/Iset2
;.step param Va 8 22 1
.param gain=40
.param Rfb2=Rt2/sqrt(sqrt(2)*gain)
.param cm_out=0.6
.param Iset2 = Iset
;.step param iset 5m 20m 1m
;.step param R_th 100 2000 100
.tran 40u
.param R_th=800

* LTspice schematic (.asc)
Version 4.1
SHEET 1 3248 2064
WIRE -1576 -1032 -1624 -1032
WIRE -1528 -1032 -1576 -1032
WIRE -1416 -1032 -1464 -1032
WIRE -1384 -1032 -1416 -1032
WIRE -1208 -1032 -1288 -1032
WIRE -984 -1032 -1208 -1032
WIRE -744 -1032 -792 -1032
WIRE -696 -1032 -744 -1032
WIRE -1048 -968 -1112 -968
WIRE -984 -968 -1048 -968
WIRE -1624 -904 -1624 -1032
WIRE -1464 -904 -1464 -1032
WIRE -1288 -904 -1288 -1032
WIRE -1112 -904 -1112 -968
WIRE -792 -904 -792 -1032
WIRE -1416 -504 -1464 -504
WIRE -1352 -504 -1416 -504
WIRE -1112 -504 -1272 -504
WIRE -920 -504 -1112 -504
WIRE -600 -504 -920 -504
WIRE -456 -504 -600 -504
WIRE -440 -504 -456 -504
WIRE -264 -504 -440 -504
WIRE -40 -504 -264 -504
WIRE 456 -504 -40 -504
WIRE 616 -504 456 -504
WIRE 824 -504 616 -504
WIRE -40 -440 -40 -504
WIRE -264 -408 -264 -504
WIRE -136 -360 -200 -360
WIRE -264 -280 -264 -312
WIRE -136 -280 -136 -360
WIRE -136 -280 -264 -280
WIRE -264 -248 -264 -280
WIRE -40 -184 -40 -360
WIRE -264 -136 -264 -184
WIRE -104 -136 -264 -136
WIRE -264 -72 -264 -136
WIRE -264 56 -264 8
WIRE -1112 104 -1112 -504
WIRE -920 104 -920 -504
WIRE 456 152 456 -504
WIRE 616 152 616 -504
WIRE -600 184 -600 -504
WIRE -1112 232 -1112 184
WIRE -840 232 -1112 232
WIRE -664 232 -840 232
WIRE 216 232 -232 232
WIRE 840 264 808 264
WIRE 936 264 840 264
WIRE 1240 264 936 264
WIRE 1480 264 1240 264
WIRE -40 296 -40 -88
WIRE -40 296 -136 296
WIRE 56 296 -40 296
WIRE -440 312 -440 -504
WIRE -920 360 -920 184
WIRE -840 360 -920 360
WIRE -504 360 -840 360
WIRE -136 360 -136 296
WIRE 56 360 56 296
WIRE 936 392 936 264
WIRE 1480 392 1480 264
WIRE -1112 408 -1112 232
WIRE -920 408 -920 360
WIRE 456 408 456 232
WIRE 616 408 616 232
WIRE 616 408 456 408
WIRE -1496 456 -1544 456
WIRE -1176 456 -1496 456
WIRE -760 456 -856 456
WIRE -136 488 -136 440
WIRE 56 488 56 440
WIRE 1240 488 1240 264
WIRE -600 504 -600 280
WIRE -232 504 -232 232
WIRE -232 504 -600 504
WIRE 840 520 824 520
WIRE 936 520 936 472
WIRE 936 520 904 520
WIRE 1384 520 1368 520
WIRE 1480 520 1480 472
WIRE 1480 520 1448 520
WIRE -440 536 -440 408
WIRE -200 536 -440 536
WIRE 216 536 216 232
WIRE 216 536 120 536
WIRE 936 536 936 520
WIRE 1176 536 936 536
WIRE -1112 552 -1112 504
WIRE -920 552 -920 504
WIRE 936 584 936 536
WIRE 1480 584 1480 520
WIRE 1560 584 1480 584
WIRE 1624 584 1560 584
WIRE 456 632 456 408
WIRE 616 632 616 408
WIRE 744 632 616 632
WIRE 824 632 824 520
WIRE 824 632 744 632
WIRE 872 632 824 632
WIRE 1240 632 1240 584
WIRE 56 680 56 584
WIRE 136 680 56 680
WIRE 392 680 136 680
WIRE -1112 696 -1112 632
WIRE -1000 696 -1112 696
WIRE -920 696 -920 632
WIRE -920 696 -1000 696
WIRE 1480 696 1480 584
WIRE 616 712 616 632
WIRE -1496 728 -1544 728
WIRE -760 728 -760 456
WIRE -760 728 -1496 728
WIRE -600 728 -600 504
WIRE -440 728 -440 536
WIRE 1240 744 1240 712
WIRE 1368 744 1368 520
WIRE 1368 744 1240 744
WIRE 1416 744 1368 744
WIRE -136 760 -136 584
WIRE 136 760 -136 760
WIRE 552 760 136 760
WIRE -1000 792 -1000 696
WIRE 1240 792 1240 744
WIRE -136 808 -136 760
WIRE 56 808 56 680
WIRE -136 920 -136 888
WIRE -40 920 -136 920
WIRE 56 920 56 888
WIRE 56 920 -40 920
WIRE 936 952 936 680
WIRE 1240 952 1240 872
WIRE 1480 952 1480 792
WIRE -600 968 -600 808
WIRE -440 968 -440 808
WIRE -40 968 -40 920
WIRE -1416 1032 -1448 1032
WIRE -1384 1032 -1416 1032
WIRE -1000 1032 -1000 872
WIRE -1000 1032 -1304 1032
WIRE 456 1032 456 728
WIRE 456 1032 -1000 1032
WIRE 616 1032 616 808
WIRE 616 1032 456 1032
WIRE 824 1032 616 1032
FLAG -1496 456 INA
FLAG -1496 728 INB
FLAG -1416 -504 V+
FLAG -1416 1032 V-
FLAG -1624 -824 0
FLAG -1288 -824 0
FLAG -1464 -824 0
FLAG -1112 -824 0
FLAG -1576 -1032 V+
FLAG -1416 -1032 V-
FLAG -1208 -1032 INA
FLAG -1048 -968 INB
FLAG -792 -824 0
FLAG -744 -1032 VCC
FLAG -840 232 CA
FLAG -840 360 CB
FLAG 136 760 OB
FLAG 136 680 OA
FLAG -40 968 0
FLAG -600 968 0
FLAG -440 968 0
FLAG 744 632 sense_out
FLAG 936 952 0
FLAG 840 264 VCC
FLAG 1560 584 output
FLAG -264 56 0
FLAG -456 -504 v+
FLAG 1480 952 0
FLAG 1240 952 0
SYMBOL npn -1176 408 R0
SYMATTR InstName Q1
SYMATTR Value 2N3904
SYMBOL res -1128 536 R0
SYMATTR InstName R1
SYMATTR Value {Rfb}
SYMBOL res -936 536 R0
SYMATTR InstName R2
SYMATTR Value {Rfb}
SYMBOL npn -856 408 M0
SYMATTR InstName Q2
SYMATTR Value 2N3904
SYMBOL res -936 88 R0
SYMATTR InstName R13
SYMATTR Value {Rt}
SYMBOL res -1128 88 R0
SYMATTR InstName R14
SYMATTR Value {Rt}
SYMBOL voltage -1624 -920 R0
SYMATTR InstName VP
SYMATTR Value {Va}
SYMBOL voltage -1464 -808 R180
SYMATTR InstName VN
SYMATTR Value {Va}
SYMBOL voltage -1288 -920 R0
SYMATTR Value2 AC 0.5
SYMATTR InstName VINA
SYMATTR Value PWL file=ampl_train.pwl
SYMBOL voltage -1112 -920 R0
SYMATTR Value2 AC -0.5
SYMATTR InstName VINB
SYMATTR Value 0
SYMBOL voltage -792 -920 R0
SYMATTR InstName VP1
SYMATTR Value 3.3
SYMBOL res -152 456 M180
SYMATTR InstName R3
SYMATTR Value {Rfb2}
SYMBOL res 40 456 M180
SYMATTR InstName R4
SYMATTR Value {Rfb2}
SYMBOL res 40 904 M180
SYMATTR InstName R5
SYMATTR Value {Rt2}
SYMBOL res -152 904 M180
SYMATTR InstName R6
SYMATTR Value {Rt2}
SYMBOL pnp -200 584 M180
SYMATTR InstName Q3
SYMATTR Value 2N3906
SYMBOL pnp 120 584 R180
SYMATTR InstName Q4
SYMATTR Value 2N3906
SYMBOL npn -664 184 R0
SYMATTR InstName Q5
SYMATTR Value 2N3904
SYMBOL npn -504 312 R0
SYMATTR InstName Q6
SYMATTR Value 2N3904
SYMBOL res -616 712 R0
SYMATTR InstName R7
SYMATTR Value 4.7k
SYMBOL res -456 712 R0
SYMATTR InstName R8
SYMATTR Value 4.7k
SYMBOL res 440 136 R0
SYMATTR InstName R9
SYMATTR Value {4.7k*2}
SYMBOL pnp 392 728 M180
SYMATTR InstName Q9
SYMATTR Value 2N3906
SYMBOL pnp 552 808 M180
SYMATTR InstName Q8
SYMATTR Value 2N3906
SYMBOL npn 872 584 R0
SYMATTR InstName Q10
SYMATTR Value 2N3904
SYMBOL res 920 376 R0
SYMATTR InstName R11
SYMATTR Value 100
SYMBOL res -1368 -488 R270
SYMATTR InstName R12
SYMATTR Value 1m
SYMBOL res -1288 1016 R90
SYMATTR InstName R15
SYMATTR Value 1m
SYMBOL res -1016 776 R0
SYMATTR InstName R16
SYMATTR Value {12/Iset}
SYMBOL pnp -104 -88 M180
SYMATTR InstName Q12
SYMATTR Value 2N3906
SYMBOL pnp -200 -312 R180
SYMATTR InstName Q13
SYMATTR Value 2N3906
SYMBOL diode -248 -184 R180
SYMATTR InstName D2
SYMATTR Value 1N750
SYMBOL res -280 -88 R0
SYMATTR InstName R18
SYMATTR Value 500
SYMBOL res -56 -456 R0
SYMATTR InstName R19
SYMATTR Value {R_th}
SYMBOL diode 840 536 R270
SYMATTR InstName D1
SYMATTR Value BAT54
SYMBOL npn 1176 488 R0
SYMATTR InstName Q7
SYMATTR Value 2N3904
SYMBOL res 1224 616 R0
SYMATTR InstName R10
SYMATTR Value 220
SYMBOL res 1224 776 R0
SYMATTR InstName R17
SYMATTR Value 220
SYMBOL npn 1416 696 R0
SYMATTR InstName Q11
SYMATTR Value 2N3904
SYMBOL res 1464 376 R0
SYMATTR InstName R20
SYMATTR Value 100
SYMBOL diode 1384 536 R270
SYMATTR InstName D3
SYMATTR Value BAT54
SYMBOL res 600 136 R0
SYMATTR InstName R21
SYMATTR Value {4.7k*2}