From: yu.dongliang <18588496441@163.com> Date: Mon, 11 Sep 2023 05:32:32 +0000 (+0800) Subject: __ses_path_va() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=eb24a0866818395735aea76e3adb248edca473bb;p=ses.git __ses_path_va() --- diff --git a/ses_step_va.c b/ses_step_va.c index ff53e9e..77be931 100644 --- a/ses_step_va.c +++ b/ses_step_va.c @@ -72,30 +72,44 @@ static int __ses_path_split_a(ScfEfunction* f, ses_path_t* path, int i, double* return 0; } -static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, int i, double a, double ja) +static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, int i, double a, double ja) { ScfEpin* p2; - ScfEpin* p0 = path->pins->data[0]; ScfEpin* p = path->pins->data[i]; ScfEcomponent* c = f->components[p->cid]; double v = 0; double jv = 0; + double r = 0; + double jr = 0; if (SCF_EDA_Transistor == c->type) { - if (SCF_EDA_Transistor_B == p->id || SCF_EDA_Transistor_C == p->id) - ses_ir_u(&v, &jv, a, ja, p->sr - (p->r + p->dr), p->jsr - (p->jr + p->jdr)); + if (SCF_EDA_Transistor_B == p->id || SCF_EDA_Transistor_C == p->id) { - else if (i >= 1) { + r = p->sr - (p->r + p->dr ) - p0->sr; + jr = p->jsr - (p->jr + p->jdr) - p0->jsr; + + ses_ir_u(&v, &jv, a, ja, r, jr); + + } else if (i >= 1) { p2 = path->pins->data[i - 1]; - ses_ir_u(&v, &jv, a, ja, p2->sr, p2->jsr); + r = p2->sr - p0->sr; + jr = p2->jsr - p0->jsr; + + ses_ir_u(&v, &jv, a, ja, r, jr); } else return -EINVAL; - } else - ses_ir_u(&v, &jv, a, ja, p->sr, p->jsr); + } else { + r = p->sr - p0->sr; + jr = p->jsr - p0->jsr; + + ses_ir_u(&v, &jv, a, ja, r, jr); + + scf_logd("c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p->cid, p->id, a, ja, r, jr, v, jv); + } p->v = p0->v - v; p->jv = p0->jv - jv; @@ -158,14 +172,21 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) if (!(i & 0x1) && path->childs) { - int ret = __ses_path_split_a(f, path, i, &a, &ja); + int ret = __ses_path_split_v(f, path, p0, i, a, ja); if (ret < 0) return ret; - } - int ret = __ses_path_split_v(f, path, i, a, ja); - if (ret < 0) - return ret; + ret = __ses_path_split_a(f, path, i, &a, &ja); + if (ret < 0) + return ret; + + p0 = p; + + } else { + int ret = __ses_path_split_v(f, path, p0, i, a, ja); + if (ret < 0) + return ret; + } el = f->elines[p->lid]; el->v = p->v;