From 54c21f628252b8f894cc17f902c7bcef2c9978b3 Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Wed, 7 Feb 2018 21:07:11 -0800 Subject: [PATCH] Added method=gear back to ngspice simulation to fix convergence bug. --- compiler/characterizer/stimuli.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/characterizer/stimuli.py b/compiler/characterizer/stimuli.py index e8b78e48..b82d6aa7 100644 --- a/compiler/characterizer/stimuli.py +++ b/compiler/characterizer/stimuli.py @@ -209,12 +209,14 @@ def write_control(stim_file, end_time): """ Write the control cards to run and end the simulation """ # UIC is needed for ngspice to converge stim_file.write(".TRAN 5p {0}n UIC\n".format(end_time)) - # if OPTS.spice_name == "ngspice": - # # ngspice sometimes has convergence problems if not using gear method - # # which is more accurate, but slower than the default trapezoid method - # stim_file.write(".OPTIONS POST=1 RUNLVL=4 PROBE method=gear\n") - # else: - stim_file.write(".OPTIONS POST=1 RUNLVL=4 PROBE\n") + if OPTS.spice_name == "ngspice": + # ngspice sometimes has convergence problems if not using gear method + # which is more accurate, but slower than the default trapezoid method + # Do not remove this or it may not converge due to some "pa_00" nodes + # unless you figure out what these are. + stim_file.write(".OPTIONS POST=1 RUNLVL=4 PROBE method=gear\n") + else: + stim_file.write(".OPTIONS POST=1 RUNLVL=4 PROBE\n") # create plots for all signals stim_file.write("* probe is used for hspice/xa, while plot is used in ngspice\n")