Hi, my ngspice simulation results are highly depen...
# sky130
a
Hi, my ngspice simulation results are highly dependent on the existence of this two configuration variables
Copy code
set ng_nomodcheck    ; Suppresses any model parameter check, if set.   
set ngbehavior=hsa   ; Sets compatibility mode for ngspice
• If both are declared, gives the expected plot. • If none is declared, results are wrong. • If only ng_nomodcheck is set, simulation crashes with "Transient solution failed" • If only ngbehavior=hsa is set, gives expected plot When none is declared (wrong result case) it gives the following warnings. (r_sens is a lab_pin):
Copy code
Error: no such device or model name r_sens

Checking parameters for BSIM 4.5 model x1.xosc_ref.xst3.xinv_osc.xm2:sky130_fd_pr__pfet_01v8__model.17
Warning: Eta0 = -0.306053 is negative.
Warning: A2 = -1.55637 is too small. Set to 0.01.

Checking parameters for BSIM 4.5 model x1.xosc_ref.xst2.xinv_osc.xm2:sky130_fd_pr__pfet_01v8__model.17
Warning: Eta0 = -0.306053 is negative.
Warning: A2 = -1.55637 is too small. Set to 0.01.

Checking parameters for BSIM 4.5 model x1.xosc_ref.xst1.xinv_osc.xm2:sky130_fd_pr__pfet_01v8__model.17
Warning: Eta0 = -0.306053 is negative.
Warning: A2 = -1.55637 is too small. Set to 0.01.

Checking parameters for BSIM 4.5 model x1.xosc_sens.xst3.xinv_osc.xm2:sky130_fd_pr__pfet_01v8__model.17
Warning: Eta0 = -0.306053 is negative.
Warning: A2 = -1.55637 is too small. Set to 0.01.

Checking parameters for BSIM 4.5 model x1.xosc_sens.xst2.xinv_osc.xm2:sky130_fd_pr__pfet_01v8__model.17
Warning: Eta0 = -0.306053 is negative.
Warning: A2 = -1.55637 is too small. Set to 0.01.

Checking parameters for BSIM 4.5 model x1.xosc_sens.xst1.xinv_osc.xm2:sky130_fd_pr__pfet_01v8__model.17
Warning: Eta0 = -0.306053 is negative.
Warning: A2 = -1.55637 is too small. Set to 0.01.
Note: Starting dynamic gmin stepping
Warning: Dynamic gmin stepping failed
Note: Starting true gmin stepping
Note: True gmin stepping completed
And finally, the sky130 devices used have the following parameters:
Copy code
sky130_fd_pr__cap_mim_m3_1      W=10 L=10 MF=1 m=1

sky130_fd_pr__res_high_po_5p73  L=8 mult=1 m=1
sky130_fd_pr__res_iso_pw        W=180 L=30.5 m=1

sky130_fd_pr__nfet_01v8         L=0.15  W=2 nf=1
sky130_fd_pr__nfet_01v8         L=0.15  W=1 nf=1
sky130_fd_pr__nfet_01v8         L=0.15  W=2 nf=2
sky130_fd_pr__pfet_01v8         L=0.15  W=1 nf=1
sky130_fd_pr__pfet_01v8         L=0.15  W=6 nf=6
I'm not sure why this happens, but it could be that the pfets are too small and the good results are not valid
👀 1
t
@aquiles viza: I always keep a
.spiceinit
file in my working directory when doing simulations with sky130, with the contents from the PDK (copied from
libs.tech/ngspice/spinit
):
Copy code
* ngspice initialization for sky130
* assert BSIM compatibility mode with "nf" vs. "W"
set ngbehavior=hsa
* "nomodcheck" speeds up loading time
set ng_nomodcheck
I have not checked for any change in behavior with ngspice version 42. However, in earlier versions, if
nomodcheck
was not set then reading in the
sky130.lib.spice
file could take several minutes. The
hsa
mode, in spite of being some sort of "hspice compatibility" flag, affects whether W is "interpreted" as total width or width per finger. The BSIM model definition clearly states that W is the total width, so I have never understood what this has to do with hspice (other than that hspice correctly implements the BSIM model definition). Your pFET device with W=6 nf=6 will change size by a factor of 6 depending on the setting of the flag.
The upshot is that you should always use
ngbehavior=hsa
because not using it is simply wrong; and you should use
nomodcheck
if you don't want to wait all day for the simulation. (But I would not expect different behavior based on `nomodcheck`; "results are wrong" is consistent with the changed definition of W; it seems like "transient solution failed" should not have happened, though. . . )
a
I have a .spiceinit on the working directory, but it seems that xschem is not reading it. Maybe it could be useful to set those lines on the MODELS code symbol, but I'm not sure how to put the "set" commands outside the .spiceinit
t
xschem does not read the file, ngspice does. And be aware that xschem's default place to run simulations is in ~/.xschem/simulations/, so if you are using the default location, then the .spiceinit file needs to be there, not in the schematic directory.
a
Yep, ngspice reads the file but through xschem is unable to find it, surely because the .spiceinit wasn't on that directory. When running ngspice alone it reads the .spiceinit and the simulations runs as expected. I just try defining the env variable SPICE_USERINIT_DIR on the work dir before running xschem and it is read, so the simulation errors are fixed. Thanks Tim for your help. Do you know what
set skywaterpdk
does?
t
No, I don't, sorry.
a
Don't worry, thanks tim 🙂