Hello, I am doing RF simulations of a gilbert cell...
# analog-design
a
Hello, I am doing RF simulations of a gilbert cell mixer. The transistors widths were chosen based on gm/Id, I am using a python script that interfaces to the shared ngspice (v37) library and automates circuit alterations, performs analysis and extracts gain, power, noise and IIP3 measures. The problem is that I am not sure I can trust my simulations, since I am getting "negative capacitance" errors inside the nfet18 models. To make it more complicated, those errors only come up in the shared ngspice lib called from python (I am using 'ngspyce'), when I run the same simulations calling ngspice directly from the command line, they dont show up. Someone said these negative capacitances might be something missing inside the model parameters. But I may be messing up with the circuit parameters (although I checked this using ngspice 'show' command). I dont understand model binning very well, but I think this could be an issue too. Edit: Ah yes, I am using nf != 1 (fingers). I heard it had some problems too, is this still an issue today? Any thoughts on this? Help would be much appreciated =)
This is the output from my script, the ERROR lines come up with some W/L combinations:
Loading netlist...
Applying params...
M1 width: 10 x 3.00um
M2/M3 width: 1 x 1.95um
M4/M5/M6/M7 width: 2 x 4.20um
Resistor W=5.73um L=45.90um R=2403 Ohms
ngspice cmd> alterparam mixer_biasfactor=10
output: []
ngspice cmd> alterparam mixer_m23width=1.95
output: []
ngspice cmd> alterparam mixer_m23fingers=1
output: []
ngspice cmd> alterparam mixer_m4567width=8.4
output: []
ngspice cmd> alterparam mixer_m4567fingers=2
output: []
ngspice cmd> alterparam mixer_rl=45.9
output: []
output: ['Reset re-loads circuit ** sch_path: /foss/designs/opensubghz/xschem/mixer_transfer_tb.sch', 'Circuit: ** sch_path: /foss/designs/opensubghz/xschem/mixer_transfer_tb.sch']
Running operating point simulation...
ERROR:ngspyce.sharedspice:Checking parameters for BSIM 4.5 model x2.xm7:sky130_fd_pr__nfet_01v8__model.8
ERROR:ngspyce.sharedspice:Fatal: Pclm = -0.112651 is not positive.
ERROR:ngspyce.sharedspice:warning: Cdscd = -0.00390997 is negative.
ERROR:ngspyce.sharedspice:Fatal error: detected during BSIM4v5.5.0 parameter checking for
ERROR:ngspyce.sharedspice:model x2.xm7:sky130_fd_pr__nfet_01v8__model.8 of device instance m.x2.xm7.msky130_fd_pr__nfet_01v8
ERROR:ngspyce.sharedspice:doAnalyses: no such parameter on this device
ERROR:ngspyce.sharedspice:op simulation(s) aborted
In some less critical situations the simulation still runs, please take a look at this output:
Loading netlist...
Applying params...
M1 width: 10 x 3.00um
M2/M3 width: 17 x 5.88um
M4/M5/M6/M7 width: 1 x 3.15um
Resistor W=5.73um L=45.90um R=2403 Ohms
ngspice cmd> alterparam mixer_biasfactor=10
output: []
ngspice cmd> alterparam mixer_m23width=100.0
output: []
ngspice cmd> alterparam mixer_m23fingers=17
output: []
ngspice cmd> alterparam mixer_m4567width=3.15
output: []
ngspice cmd> alterparam mixer_m4567fingers=1
output: []
ngspice cmd> alterparam mixer_rl=45.9
output: []
output: ['Reset re-loads circuit ** sch_path: /foss/designs/opensubghz/xschem/mixer_transfer_tb.sch', 'Circuit: ** sch_path: /foss/designs/opensubghz/xschem/mixer_transfer_tb.sch']
Running operating point simulation...
ERROR:ngspyce.sharedspice:Checking parameters for BSIM 4.5 model x2.xm3:sky130_fd_pr__nfet_01v8__model.8
ERROR:ngspyce.sharedspice:warning: Cdscd = -0.001111 is negative.
ERROR:ngspyce.sharedspice:Checking parameters for BSIM 4.5 model x2.xm1:sky130_fd_pr__nfet_01v8__model.8
ERROR:ngspyce.sharedspice:warning: Cdscd = -0.000974418 is negative.
ERROR:ngspyce.sharedspice:Checking parameters for BSIM 4.5 model x2.xm2:sky130_fd_pr__nfet_01v8__model.8
ERROR:ngspyce.sharedspice:warning: Cdscd = -0.001111 is negative.
Just in case someone runs into this same problem, I found out that running ngspice from command line imported some options from ~/spice.rc:
set num_threads=16
set ngbehavior=hsa
set ng_nomodcheck
These options need to be set explicitly by the code if the ngspice shared lib is used, then the sims will run fine!