* SPICE netlist
V1 Vin 0 5
V2 PSU_en 0 PULSE(0 5 1m 10u 10u 3m)
R3 PSU_en N002 {WC1(1k,0.05,0)}
R4 N002 0 {WC1(100k,0.05,1)}
D1 0 Vin_mon BZX84-C3V3
R2 Vin N001 {WC1(3k6,0.05,2)}
R6 Vin_mon 0 {WC1(6k8,0.01,3)}
V3 STEPPING 0 {STEPPING}
V4 THERSHOLD 0 2.475
M1 N001 N002 Vin_mon Vin_mon NMOS
.tran 5m startup
+ 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 15 1
.SUBCKT BSS169_L1 drain gate source PARAMS: dVth=0 dRdson=0 dgfs=0 dC=0
.PARAM Rs=0.074 Rg=10 Ls=3n Ld=1n Lg=3n
.PARAM Inn=0.05 Unn=0 Rmax=12
.PARAM act=0.25
X1 d1 g s Tj K_100_d_var PARAMS: a={act} dVth={dVth} dR={dRdson} Inn={Inn} Unn={Unn}
+Rmax={Rmax} dgfs={dgfs} Rs={Rs} dC={dC} heat=0
Rg g1 g {Rg}
Lg gate g1 {Lg*if(dgfs==99,0,1)}
Gs s1 s VALUE={V(s1,s)/(Rs*(1+(limit(V(Tj),-200,999)-25)*4m))}
Rsa s1 s 1Meg
Ls source s1 {Ls*if(dgfs==99,0,1)}
Ld drain d1 {Ld*if(dgfs==99,0,1)}
E1 Tj w VALUE={TEMP}
R1 w 0 1u
.SUBCKT K_100_d_var dd g s Tj PARAMS: a=1 dVth=0 dR=0 dgfs=0 Inn=1 Unn=1 Rmax=1
+gmin=1 Rs=1 Rp=1 dC=0 heat=1
.PARAM Vth0=-1.8 beta4c=0.303 ph0=20 ph1=0.026 Ubr=150
.PARAM Rd=0.6 nmu=2.6 Rf=0.2 rpa=0.02925 lnIsj=-24.6
.PARAM Rdi=0.073
.PARAM Tref=298 T0=273 auth=3m c=0.82 mu_bet=0.4
.PARAM f_bet=-2 ndi=1.2 UTnbr=207m lnBr=-23 kbq=85.8u
.PARAM Wcml={beta4c*4*c}
.PARAM aubr={0.93m*UBr}
.PARAM dvgs={0.1-0.06*Vth0}
.PARAM f1=118p f2=118p f3=207p f4=330p f5=217p
.PARAM U0=0.5 nd=0.42 nc=0.5 g1=4 bb=-10.8
.PARAM sl=30p remp=0p ta=60n td=20n
.PARAM Vmin=-2.9 Vmax=-1.8 dCmax=0.35
.PARAM Vth={Vth0+(Vmax-Vth0)*limit(dVth,0,1)-(Vmin-Vth0)*limit(dVth,-1,0)}
.PARAM p0={Wcml*a*((1-f_bet)*(T0/Tref)**mu_bet+f_bet) }
.PARAM Rlim={(Rmax-Rs-(Unn-Vth0-Inn*Rs-SQRT((Unn-Vth0-Inn*Rs)**2-4*c*Inn/p0))/(2*c*Inn))/(1+rpa*(Inn/a)**2)}
.PARAM dRd={Rd/a+if(dVth==0,limit(dR,0,1)*max(Rlim-Rd/a,0),0)}
.PARAM bet={Wcml}
.PARAM dC1={1+dCmax*limit(dC,0,1)}
.PARAM Cox={f1*a*dC1}
.PARAM Cds0={f2*a*dC1}
.PARAM Cgs0={f3*a*dC1}
.PARAM Cox1={f5*a*dC1}
.PARAM Crand={remp*SQRT(a)}
.PARAM dRdi={Rdi/a}
.FUNC U1(Uds,T) {(SQRT(1+4*(0.4+(T-T0-25)*2m)*abs(Uds))-1)/2/(0.4+(T-T0-25)*2m)}
.FUNC I2(p,Uee,z1,pp) {if(Uee>pp,(Uee-c*z1)*z1,p*(pp-p)/c*exp((Uee-pp-(min(0,Uee))**2)/p))}
.FUNC Ig(Uds,T,p,Uee) {bet*((1-f_bet)*(T0/T)**mu_bet+f_bet)*I2(p,Uee,min(Uds,Uee/(2*c)),min(2*p,p+c*Uds))}
.FUNC Iges(Uds,Ugs,T)
+{a*(sgn(Uds)*Ig(U1(Uds,T),T,1/(ph0-ph1*T),Ugs-Vth+auth*(T-Tref))+exp(min(lnBr+(abs(Uds)-UBr-aubr*(T-Tref))/UTnbr,25)))}
.FUNC Isjt(Tj) {exp(min(lnIsj+(Tj/Tref-1)*1.12/(ndi*kbq*Tj),9))*(Tj/Tref)**1.5}
.FUNC Idiode(Usd,Tj,Iss) {exp(min(log(Iss)+Usd/(ndi*kbq*Tj),9))-Iss}
.FUNC Idiod(Usd,Tj) {a*Idiode(Usd,Tj,Isjt(Tj))}
.FUNC QCdg(x,z) {if(f4>f5,(f5**2-(f4-z*sl)**2)/(2*sl)+f5*min(x,(f4-f5)/sl),f4*z-sl*z**2/2-f5*max((f4-f5)/sl-x,0))}
E_Edg d ox VALUE {V(d,g)-(min(V(d,g),-bb)+1/(g1*(1-nc))*((1/(1+g1*max(V(d,g)+bb,0)))**(nc-1)-1))}
C_Cdg ox g {Cox}
E_Edg1 d ox1 VALUE {V(d,g)-QCdg(V(d,g),limit(V(d,g),(f4-f5)/sl,f4/sl))/f5}
C_Cdg1 ox1 g {Cox1}
C_Cdg2 d g {Crand}
E_Eds d edep VALUE {(V(d2,s)-I(V_sense3)/Cds0)}
C_Cds edep s {Cds0}
C_Cds2 d2 s {Cds0/500}
C_Cgs g s {Cgs0}
G_chan d s VALUE={Iges(V(d,s),V(g,s),T0+limit(V(Tj),-200,350))}
E_RMos d1 d VALUE={I(V_sense)*(Rf*dRd+(1-Rf)*dRd*((limit(V(Tj),-200,999)+T0)/Tref)**nmu)*(1+rpa*(I(V_sense)/a)**2)}
V_sense dd d1 0
G_diode s d2 VALUE={Idiod(V(s,d2),T0+limit(V(Tj),-200,499))}
R_Rdio d2 d3 {dRdi}
V_sense2 d1 d3 0
L_L001 a c {td/(ta+td)}
R_R001 a b {1/ta}
V_sense3 c f 0
R_sense3 f 0 1
E_E001 b 0 VALUE {I(V_sense2)}
E_E002 e 0 VALUE {1Meg*Cds0*(1/(1-nd)*U0**nd*(limit(U0+V(d2,s),U0/2,2*UBr))**(1-nd)+2**nd*min(V(d2,s)+U0/2,0))}
R_R002 e c 1Meg
R1 g s 1G
Rd01 d s 500Meg
Rd02 d2 s 500Meg
Rd03 d1 d 10k
G_TH 0 Tj VALUE = {heat*LIMIT(I(V_sense)*V(dd,s),0,100k)}

* LTspice schematic (.asc)
Version 4
SHEET 1 1760 496
WIRE 480 -248 288 -248
WIRE 288 -232 288 -248
WIRE 480 -216 480 -248
WIRE -816 -168 -880 -168
WIRE -560 -168 -608 -168
WIRE -880 -136 -880 -168
WIRE -608 -136 -608 -168
WIRE 288 -136 288 -152
WIRE 480 -120 480 -136
WIRE -880 -40 -880 -56
WIRE -48 -40 -176 -40
WIRE 144 -40 32 -40
WIRE 432 -40 144 -40
WIRE -608 -24 -608 -56
WIRE -176 -8 -176 -40
WIRE 144 -8 144 -40
WIRE -176 104 -176 72
WIRE 144 104 144 72
WIRE 480 104 480 -24
WIRE 768 104 480 104
WIRE 880 104 768 104
WIRE 480 136 480 104
WIRE 768 152 768 104
WIRE 480 248 480 216
WIRE 768 248 768 216
FLAG 144 104 0
FLAG -176 104 0
FLAG 288 -136 0
FLAG 880 104 Vin_mon
FLAG 768 248 0
FLAG 480 248 0
FLAG -176 -40 PSU_en
FLAG 288 -248 Vin
FLAG -880 -40 0
FLAG -816 -168 STEPPING
IOPIN -672 48 Out
FLAG -560 -168 THERSHOLD
IOPIN -416 48 Out
FLAG -608 -24 0
SYMBOL voltage 288 -248 R0
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage -176 -24 R0
SYMATTR Value PULSE(0 5 1m 10u 10u 3m)
SYMATTR InstName V2
SYMBOL res -64 -24 R270
SYMATTR InstName R3
SYMATTR Value {WC1(1k,0.05,0)}
SYMBOL res 128 -24 R0
SYMATTR Value {WC1(100k,0.05,1)}
SYMATTR InstName R4
SYMBOL zener 784 216 R180
SYMATTR InstName D1
SYMATTR Value BZX84-C3V3
SYMBOL res 464 -232 R0
SYMATTR InstName R2
SYMATTR Value {WC1(3k6,0.05,2)}
SYMBOL res 464 120 R0
SYMATTR InstName R6
SYMATTR Value {WC1(6k8,0.01,3)}
SYMBOL voltage -880 -152 R0
SYMATTR InstName V3
SYMATTR Value {STEPPING}
SYMBOL voltage -608 -152 R0
SYMATTR InstName V4
SYMATTR Value 2.475
SYMBOL nmos 432 -120 R0
SYMATTR InstName M1