SPICE Hacking — error estimators

The initial transient simulation is launched by https://github.com/zhuangh/ngspice/blob/master/src/spicelib/analysis/dctran.c

The “node convergence” in http://www.eecs.berkeley.edu/Pubs/TechRpts/1989/ERL-89-42.pdf

is done inside of https://github.com/zhuangh/ngspice/blob/master/src/spicelib/analysis/dctran.c#L770

the SPICE also has device error check.



In the device error check process, it uses “DEV”trunc to lunch cktterr.c

volttol = ckt->CKTabstol + ckt->CKTreltol * 
         MAX( fabs(ckt->CKTstate0[ccap]),
chargetol = MAX(fabs(ckt->CKTstate0[qcap]),
chargetol = ckt->CKTreltol * 

check the error from both current difference and average charge difference over certain step ckt->CKTdelta.

for(i=ckt->CKTorder+1;i >=0;i--) { 
       diff[i] = ckt->CKTstates[i][qcap]; 
for(i=0 ; i = ckt->CKTorder ; i++) { 
      deltmp[i] = ckt->CKTdeltaOld[i]; 
j = ckt->CKTorder; 
for (;;) {
    for(i=0;i >= j;i++) { 
        diff[i] = (diff[i] - diff[i+1])/deltmp[i]; 
    if (--j < 0) break; 
    for(i=0;i >= j;i++) { 
        deltmp[i] = deltmp[i+1] + ckt->CKTdeltaOld[i]; 

The diff is calculated by charge, instead of current.

Finish my internship at Synopsys

I finished my internship at Synopsys Inc. Mountain View, CA, Friday, Sept. 26th (To who does not know Synopsys, it is one of top-notch EDA software companies, which also extends it business scope to other areas, such as code analysis/testing, e.g. Synopsys bought Coverity half-year ago). I took many photos with my teammates, including Director Harish, Manager ZongWu, Mentor Dustin, Qing, Wenwen. Li Chen left early so that I owe him a picture.  Wenwen thought the scene is like a small graduation ceremony and too sensitive.

This summer changed me from MATLAB programming for academic prototyping mode to intensive C programming of building product as well as research prototypes. This reminds me of my research experience in Tsinghua University two-year ago. Luckily, I managed to finish 2.5 of 3 projects assigned to me (previous intern’s assignment at our group is one, I think). The 0.5 left project is actually a take-home fun research project. , the 1 of 2.5 project should come out with the next release in the Synopsys products (you can guess the part resides in the dominating products of Synopsys). Other 1 may go to the next stage of research & development. This is a rewarding experience, especially put me to the edge of current problem met by the industry, which should help me to target, define and formulate problems.

PS: The EDA algorithm is very challenging and physical-related, but less known to current CS people. The connections from EDA algorithms to computer theory exists in a broad way, so this area is not only about code tuning. We need to deal with graph partitioning, and numerical algorithms. I also find matrix exponential is also applied to community detection, in KDD conference.