fix: and.pack error
authoryu.dongliang <18588496441@163.com>
Sun, 10 Mar 2024 14:16:52 +0000 (22:16 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 10 Mar 2024 14:16:52 +0000 (22:16 +0800)
ses_step_jr.c
ses_step_va_transistor.c

index 9dc1e9868d28bc1ed0208cc4c76ddc1e0e38412c..0290e7a1f8c4f0c57958be553cdc4b9c2b424b5c 100644 (file)
@@ -1,5 +1,14 @@
 #include"ses_core.h"
 
+void __ses_npn_epr(ScfEfunction* f, ScfEpin* pe, double* r, double* jr)
+{
+       ScfEcomponent* c  = f->components[pe->cid];
+       ScfEpin*       pb = c->pins[SCF_EDA_NPN_B];
+       ScfEpin*       pc = c->pins[SCF_EDA_NPN_C];
+
+       ses_merge_r(r, jr, pb->pr, pb->jpr, pc->pr, pc->jpr);
+}
+
 void __ses_path_sr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1, double* r, double* jr)
 {
        ScfEpin*       p0 = path->pins->data[i];
@@ -11,6 +20,9 @@ void __ses_path_sr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1
        double r1  = 0;
        double jr1 = 0;
 
+       scf_logd("c%ldp%ld-c%ldp%ld, p0->sr: %lg, p0->pr: %lg, p1->sr: %lg, p1->pr: %lg\n",
+                       p0->cid, p0->id, p1->cid, p1->id, p0->sr, p0->pr, p1->sr, p1->pr);
+
        if (SCF_EDA_NPN == c1->type) {
 
                if (SCF_EDA_NPN_E == p1->id) {
@@ -32,11 +44,14 @@ void __ses_path_sr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1
                        p0 = path->pins->data[i - 1];
                        c0 = f->components[p0->cid];
 
+                       double pr0  = p0->pr;
+                       double jpr0 = p0->jpr;
+
                        if (SCF_EDA_NPN == c0->type && SCF_EDA_NPN_E == p0->id)
-                               p0 = path->pins->data[i - 2];
+                               __ses_npn_epr(f, p0, &pr0, &jpr0);
 
-                       *r  = p1->sr  - r1  - p0->pr;
-                       *jr = p1->jsr - jr1 - p0->jpr;
+                       *r  = p1->sr  - r1  - pr0;
+                       *jr = p1->jsr - jr1 - jpr0;
                } else {
                        *r  = p1->sr;
                        *jr = p1->jsr;
@@ -58,18 +73,29 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1
        ScfEcomponent* c0 = f->components[p0->cid];
        ScfEcomponent* c1 = f->components[p1->cid];
 
+       scf_logd("c%ldp%ld-c%ldp%ld, p0->pr: %lg, p1->pr: %lg\n", p0->cid, p0->id, p1->cid, p1->id, p0->pr, p1->pr);
+
+       double pr1  = p1->pr;
+       double jpr1 = p1->jpr;
+
        if (SCF_EDA_NPN == c1->type) {
 
                if (SCF_EDA_NPN_E == p1->id) {
                        if (cp1 != p1)
                                p1 = path->pins->data[j - 1];
 
+                       pr1  = p1->pr;
+                       jpr1 = p1->jpr;
+
                } else if (j > 0) {
                        p1 = path->pins->data[j - 1];
                        c1 = f->components[p1->cid];
 
+                       pr1  = p1->pr;
+                       jpr1 = p1->jpr;
+
                        if (SCF_EDA_NPN == c1->type && SCF_EDA_NPN_E == p1->id)
-                               p1 = path->pins->data[j - 2];
+                               __ses_npn_epr(f, p1, &pr1, &jpr1);
                } else {
                        *r  = 0;
                        *jr = 0;
@@ -80,25 +106,28 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1
        if (SCF_EDA_NPN == c0->type) {
 
                if (SCF_EDA_NPN_E == p0->id) {
-                       *r  = p1->pr  - p0->pr;
-                       *jr = p1->jpr - p0->jpr;
+                       *r  = pr1  - p0->pr;
+                       *jr = jpr1 - p0->jpr;
 
                } else if (i > 0) {
                        p0 = path->pins->data[i - 1];
                        c0 = f->components[p0->cid];
 
+                       double pr0  = p0->pr;
+                       double jpr0 = p0->jpr;
+
                        if (SCF_EDA_NPN == c0->type && SCF_EDA_NPN_E == p0->id)
-                               p0 = path->pins->data[i - 2];
+                               __ses_npn_epr(f, p0, &pr0, &jpr0);
 
-                       *r  = p1->pr  - p0->pr;
-                       *jr = p1->jpr - p0->jpr;
+                       *r  = pr1  - pr0;
+                       *jr = jpr1 - jpr0;
                } else {
-                       *r  = p1->pr;
-                       *jr = p1->jpr;
+                       *r  = pr1;
+                       *jr = jpr1;
                }
        } else {
-               *r  = p1->pr  - p0->pr;
-               *jr = p1->jpr - p0->jpr;
+               *r  = pr1  - p0->pr;
+               *jr = jpr1 - p0->jpr;
        }
        scf_logd("c%ldp%ld-c%ldp%ld, r: %lg, p0->pr: %lg, p1->pr: %lg\n", p0->cid, p0->id, p1->cid, p1->id, *r, p0->pr, p1->pr);
 }
index 0e36938ee09cd031a3682722c9e185e7e3d3a02e..df8a81064fa651be67aef449c79ceb6518fafb83 100644 (file)
@@ -18,7 +18,7 @@ void __ses_path_dr_transistor(ScfEfunction* f, ses_path_t* path, int i, int j)
        p->dr  -= r;
        p->jdr -= jr;
 
-       scf_logd("c%ldp%ld--c%ldp%ld, v: %lg, r: %lg, p->sr: %lg, p->a: %lg, p->dr: %lg\n",
+       scf_logi("c%ldp%ld--c%ldp%ld, v: %lg, r: %lg, p->sr: %lg, p->a: %lg, p->dr: %lg\n",
                        p->cid, p->id, p1->cid, p1->id, v, r, p->sr, p->a, p->dr);
 }
 
@@ -258,7 +258,7 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
                        pc->v  = Bp->v  - v;
                        pc->jv = Bp->jv - jv;
 
-                       scf_logd("i: %d, c%ldp%ld--c%ldp%ld, v: %lg, pc->v: %lg, pc->a: %lg, pr: %lg, _pr: %lg pc->pr: %lg\n",
+                       scf_logi("i: %d, c%ldp%ld--c%ldp%ld, v: %lg, pc->v: %lg, pc->a: %lg, pr: %lg, _pr: %lg pc->pr: %lg\n",
                                        i, p0->cid, p0->id, pc->cid, pc->id, v, pc->v, pc->a, pr, _pr, pc->pr);
                }