* SPICE netlist
V1 S 0 12
BV2 PSU_en 0 V={if(V(S)>7,5.5,0)}
R3 PSU_en B {WC1(22k,0.01,1)}
R4 B 0 {WC1(10k,0.05,2)}
M2 D G S S BSS84
XQ1 G B E BC847B ;pnba C)B)E
C1 Vin_mon 0 10n
R2 D Vin_mon {WC1(22k,0.01,5)}
R6 Vin_mon 0 {WC1(470R,0.05,6)}
R5 S G {WC1(10k,0.05,3)}
R1 E 0 {WC1(1k,0.05,4)}
V3 STEPPING 0 {STEPPING}
.dc V1 0 40 0.1
+ IS = 7.035E-16
+ N = 0.9809
+ BV = 3.3
+ IBV = 0.005
+ RS = 0.3487
+ CJO = 3.162E-10
+ VJ = 0.6687
+ M = 0.3164
+ FC = 0.5
.FUNC MOD(a,b) {a-FLOOR(a/b)*b}
.FUNC BIT(x) {if(MOD(STEPPING,2**(X+1))>=2**x,1,0)}
.FUNC EVA1 (nom, tol, param_num) {if(STEPPING == -1, nom, nom*(1-tol)+2*nom*tol*BIT(param_num))}
.FUNC EVA2 (nom, min, max, param_num) {if(STEPPING == -1, nom, IF(BIT(param_num),max,min))}
.FUNC WC1 (nom, tol, param_num) EVA1(nom, tol, param_num)
.FUNC WC2 (nom, min, max, param_num) EVA2(nom, min, max, param_num)
.step param STEPPING -1 63 1
.SUBCKT BC847A 1 2 3
Q1 1 2 3 MAIN 0.8636
Q2 11 2 33 MAIN 0.1364
RQ 11 1 324.8
D1 2 1 DIODE
+ IS = 1.124E-14
+ NF = 0.9872
+ ISE = 2.566E-15
+ NE = 1.661
+ BF = {WC2(110,180,220,0)}
+ IKF = 0.09455
+ VAF = 36.27
+ NR = 0.9859
+ ISC = 7.015E-18
+ NC = 0.9228
+ BR = 7.047
+ IKR = 0.8167
+ VAR = 16.61
+ RB = 150
+ IRB = 0.0008356
+ RBM = 0.8289
+ RE = 0.804
+ RC = 0.2454
+ XTB = 1.382
+ EG = 1.11
+ XTI = 7.452
+ CJE = 1.264E-11
+ VJE = 0.7056
+ MJE = 0.3401
+ TF = 6.258E-10
+ XTF = 25
+ VTF = 2
+ ITF = 0.277
+ PTF = 0
+ CJC = 3.624E-12
+ VJC = 0.5036
+ MJC = 0.365
+ XCJC = 1
+ TR = 1.55E-07
+ CJS = 0
+ VJS = 0.75
+ MJS = 0.333
+ FC = 0.78
+ IS = 1.365E-15
+ N = 0.988
+ BV = 1000
+ IBV = 0.001
+ RS = 2163
+ CJO = 0
+ VJ = 1
+ M = 0.5
+ FC = 0
+ TT = 0
+ EG = 1.11
+ XTI = 3
.SUBCKT BC847B 1 2 3
Q1 1 2 3 MAIN 0.8636
Q2 11 2 33 MAIN 0.1364
RQ 11 1 324.8
D1 2 1 DIODE
+ IS = 1.124E-14
+ NF = 0.9872
+ ISE = 2.566E-15
+ NE = 1.661
+ BF = {WC2(290,200,450,0)}
+ IKF = 0.09455
+ VAF = 36.27
+ NR = 0.9859
+ ISC = 7.015E-18
+ NC = 0.9228
+ BR = 7.047
+ IKR = 0.8167
+ VAR = 16.61
+ RB = 150
+ IRB = 0.0008356
+ RBM = 0.8289
+ RE = 0.804
+ RC = 0.2454
+ XTB = 1.382
+ EG = 1.11
+ XTI = 7.452
+ CJE = 1.264E-11
+ VJE = 0.7056
+ MJE = 0.3401
+ TF = 6.258E-10
+ XTF = 25
+ VTF = 2
+ ITF = 0.277
+ PTF = 0
+ CJC = 3.624E-12
+ VJC = 0.5036
+ MJC = 0.365
+ XCJC = 1
+ TR = 1.55E-07
+ CJS = 0
+ VJS = 0.75
+ MJS = 0.333
+ FC = 0.78
+ IS = 1.365E-15
+ N = 0.988
+ BV = 1000
+ IBV = 0.001
+ RS = 2163
+ CJO = 0
+ VJ = 1
+ M = 0.5
+ FC = 0
+ TT = 0
+ EG = 1.11
+ XTI = 3
.SUBCKT BC847C 1 2 3
Q1 1 2 3 MAIN 0.8636
Q2 11 2 33 MAIN 0.1364
RQ 11 1 324.8
D1 2 1 DIODE
+ IS = 1.124E-14
+ NF = 0.9872
+ ISE = 2.566E-15
+ NE = 1.661
+ BF = {WC2(420,520,800,0)}
+ IKF = 0.09455
+ VAF = 36.27
+ NR = 0.9859
+ ISC = 7.015E-18
+ NC = 0.9228
+ BR = 7.047
+ IKR = 0.8167
+ VAR = 16.61
+ RB = 150
+ IRB = 0.0008356
+ RBM = 0.8289
+ RE = 0.804
+ RC = 0.2454
+ XTB = 1.382
+ EG = 1.11
+ XTI = 7.452
+ CJE = 1.264E-11
+ VJE = 0.7056
+ MJE = 0.3401
+ TF = 6.258E-10
+ XTF = 25
+ VTF = 2
+ ITF = 0.277
+ PTF = 0
+ CJC = 3.624E-12
+ VJC = 0.5036
+ MJC = 0.365
+ XCJC = 1
+ TR = 1.55E-07
+ CJS = 0
+ VJS = 0.75
+ MJS = 0.333
+ FC = 0.78
+ IS = 1.365E-15
+ N = 0.988
+ BV = 1000
+ IBV = 0.001
+ RS = 2163
+ CJO = 0
+ VJ = 1
+ M = 0.5
+ FC = 0
+ TT = 0
+ EG = 1.11
+ XTI = 3

* LTspice schematic (.asc)
Version 4
SHEET 1 1360 864
WIRE 376 -432 312 -432
WIRE 312 -400 312 -432
WIRE 312 -304 312 -320
WIRE -56 -64 -168 -64
WIRE 216 -64 -56 -64
WIRE -168 -48 -168 -64
WIRE -56 -32 -56 -64
WIRE -168 48 -168 32
WIRE 216 64 216 -64
WIRE -56 80 -56 48
WIRE 136 80 -56 80
WIRE 168 80 136 80
WIRE 216 176 216 160
WIRE 216 176 136 176
WIRE 216 192 216 176
WIRE -56 208 -56 80
WIRE -568 256 -680 256
WIRE -360 256 -488 256
WIRE -136 256 -360 256
WIRE -120 256 -136 256
WIRE -680 288 -680 256
WIRE -360 288 -360 256
WIRE 216 304 216 272
WIRE 344 304 216 304
WIRE 680 304 344 304
WIRE -56 320 -56 304
WIRE 344 320 344 304
WIRE -56 336 -56 320
WIRE 216 336 216 304
WIRE -680 384 -680 368
WIRE -360 384 -360 368
WIRE 216 416 216 400
WIRE 344 416 344 400
WIRE -56 432 -56 416
FLAG -360 384 0
FLAG -56 432 0
FLAG -680 384 0
FLAG -168 48 0
FLAG 680 304 Vin_mon
FLAG 344 416 0
FLAG 216 416 0
FLAG -680 256 PSU_en
FLAG -168 -64 Vin
FLAG -136 256 B
FLAG 136 80 G
FLAG -56 320 E
FLAG 136 176 D
FLAG 216 -64 S
FLAG 312 -304 0
FLAG 376 -432 STEPPING
IOPIN 752 -272 Out
SYMBOL voltage -168 -64 R0
SYMATTR InstName V1
SYMATTR Value 12
SYMBOL voltage -680 272 R0
SYMATTR Value V={if(V(Vin)>7,5.5,0)}
SYMATTR InstName V2
SYMATTR Prefix B
SYMBOL res -584 272 R270
SYMATTR InstName R3
SYMATTR Value {WC1(22k,0.01,1)}
SYMBOL res -376 272 R0
SYMATTR Value {WC1(10k,0.05,2)}
SYMATTR InstName R4
SYMBOL pmos 168 160 M180
SYMATTR InstName M2
SYMATTR Value BSS84
SYMBOL npn -120 208 R0
SYMATTR InstName Q1
SYMATTR Value BC847B
SYMATTR Prefix X
SYMBOL cap 200 336 R0
SYMATTR InstName C1
SYMATTR Value 10n
SYMBOL res 200 176 R0
SYMATTR InstName R2
SYMATTR Value {WC1(22k,0.01,5)}
SYMBOL res 328 304 R0
SYMATTR InstName R6
SYMATTR Value {WC1(470R,0.05,6)}
SYMBOL res -72 -48 R0
SYMATTR InstName R5
SYMATTR Value {WC1(10k,0.05,3)}
SYMBOL res -72 320 R0
SYMATTR InstName R1
SYMATTR Value {WC1(1k,0.05,4)}
SYMBOL voltage 312 -416 R0
SYMATTR InstName V3
SYMATTR Value {STEPPING}