<@U016EM8L91B> <@U017FMP2MJN> i have found a probl...
# analog-design
s
@User @User i have found a problem in the mosfet models. If we want to use the number of fingers (nf) in addition to geometrical dimensions W and L to calculate the area and perimeter of source/drain diffusions the definition of the .spice files for the mosfets must be changed such that 'nf' comes before the ad,as,pd, ps parameters that depend on nf. 'nf' must be placed before 'ad' in the .param declaration and in the mos instantiation. I have been trying everything, like modifying the pdk, testing different design kits, different versions of ngspice until i dound that the order of parameters matters if there is a dependency of some parameters w.r.t. others.
Copy code
.subckt  sky130_fd_pr__nfet_01v8_lvt d g s b
+
.param  l = 1 w = 1 nf = 1.0 ad = 0 as = 0 pd = 0 ps = 0 nrd = 0 nrs = 0 sa = 0 sb = 0 sd = 0 mult = 1
msky130_fd_pr__nfet_01v8_lvt d g s b sky130_fd_pr__nfet_01v8_lvt__model l = {l} w = {w} nf = {nf} ad = {ad} as = {as} pd = {pd} ps = {ps} nrd = {nrd} nrs = {nrs} sa = {sa} sb = {sb} sd = {sd}
.model sky130_fd_pr__nfet_01v8_lvt__model.0 nmos
...
...
After doing this change in the pdk i was able to simulate a mos transistor defined as follows:
Copy code
XM8 net1 G1v8 S B sky130_fd_pr__nfet_01v8_lvt W=2 L=0.15 nf=2 
+ ad='int((nf+1)/2) * W/nf * 0.29' 
+ pd='2*int((nf+1)/2) * (W/nf + 0.29)'
+ as='int((nf+2)/2) * W/nf * 0.29' 
+ ps='2*int((nf+2)/2) * (W/nf + 0.29)' 
+ nrd='0.29 / W' 
+ nrs='0.29 / W' sa=0
+ sb=0 sd=0 mult=1 m=1
the equations are reduced to numbers at netlist parsing time (no runtime penalties) and results in a correct evaluation of source / drain diffusion capacitances even for multi-fingered devices. It was really tough to figure this out.... :-)
👍 5