From fe951a16374345c6740a60a0fd942c3910daaa5d Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sun, 10 Mar 2024 22:16:52 +0800 Subject: [PATCH] fix: and.pack error --- ses_step_jr.c | 55 ++++++++++++++++++++++++++++++---------- ses_step_va_transistor.c | 4 +-- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/ses_step_jr.c b/ses_step_jr.c index 9dc1e98..0290e7a 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -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); } diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index 0e36938..df8a810 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -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); } -- 2.25.1