From 4d2a57db6723820363c273f18562d090691ff785 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 25 Oct 2023 22:36:24 +0800 Subject: [PATCH] __ses_path_split_v() --- ses_step_jr.c | 21 +++++++++++++---- ses_step_va.c | 65 +++++++++++++-------------------------------------- ses_steps.c | 2 +- 3 files changed, 33 insertions(+), 55 deletions(-) diff --git a/ses_step_jr.c b/ses_step_jr.c index 4d24f36..fa3d9c9 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -8,15 +8,25 @@ void __ses_path_sr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1 ScfEcomponent* c0 = f->components[p0->cid]; ScfEcomponent* c1 = f->components[p1->cid]; + double r1 = 0; + double jr1 = 0; + if (SCF_EDA_NPN == c1->type) { if (SCF_EDA_NPN_E == p1->id) { if (cp1 != p1) p1 = path->pins->data[j - 1]; - } else if (j > 0) + } else if (j > 0) { p1 = path->pins->data[j - 1]; - else { + c1 = f->components[p1->cid]; + + if (SCF_EDA_NPN == c1->type && SCF_EDA_NPN_E == p1->id) { + p1 = path->pins->data[j]; + r1 = p1->r + p1->dr; + jr1 = p1->jr + p1->jdr; + } + } else { *r = 0; *jr = 0; return; @@ -27,8 +37,8 @@ void __ses_path_sr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1 if (i > 0) { p0 = path->pins->data[i - 1]; - *r = p1->sr - p0->pr; - *jr = p1->jsr - p0->jpr; + *r = p1->sr - r1 - p0->pr; + *jr = p1->jsr - jr1 - p0->jpr; } else { *r = p1->sr; *jr = p1->jsr; @@ -38,7 +48,8 @@ void __ses_path_sr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1 *jr = p1->jsr - p0->jsr; } - 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->sr, p1->sr); + scf_logd("c%ldp%ld-c%ldp%ld, r: %lg, p0->sr: %lg, p0->pr: %lg, p1->sr: %lg, p1->pr: %lg\n", + p0->cid, p0->id, p1->cid, p1->id, *r, p0->sr, p0->pr, p1->sr, p1->pr); } void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1, double* r, double* jr) diff --git a/ses_step_va.c b/ses_step_va.c index 21bb464..a9d20bd 100644 --- a/ses_step_va.c +++ b/ses_step_va.c @@ -78,46 +78,18 @@ static int __ses_path_split_a(ScfEfunction* f, ses_path_t* path, int i, double* return n; } -static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, int i, double a, double ja) +static void __ses_path_split_v(ScfEfunction* f, ses_path_t* path, int i0, int i, double a, double ja) { - ScfEpin* p2; - 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_NPN == c->type) { - - if (SCF_EDA_NPN_E != p->id) { - - if (p != p0) { - r = p->sr - (p->r + p->dr ) - p0->sr; - jr = p->jsr - (p->jr + p->jdr) - p0->jsr; - } else { - r = 0; - jr = 0; - } + ScfEpin* p2; + ScfEpin* p0 = path->pins->data[i0]; + ScfEpin* p = path->pins->data[i]; - } else if (i >= 1) { - p2 = path->pins->data[i - 1]; + double v; + double jv; + double r; + double jr; - if (p2 == p0) { - r = p0->r + p0->dr; - jr = p0->jr + p0->jdr; - } else { - r = p2->sr - p0->sr; - jr = p2->jsr - p0->jsr; - } - } else - return -EINVAL; - - } else { - r = p->sr - p0->sr; - jr = p->jsr - p0->jsr; - } + __ses_path_sr(f, path, i0, i, NULL, &r, &jr); ses_ir_u(&v, &jv, a, ja, r, jr); @@ -125,7 +97,6 @@ static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, in p->jv = p0->jv - jv; scf_logd("c%ldp%ld, c%ldp%ld, a: %lg, r: %lg, v: %lg\n", p0->cid, p0->id, p->cid, p->id, a, r, v); - return 0; } int __ses_path_va(ScfEfunction* f, ses_path_t* path, int* changed) @@ -150,7 +121,6 @@ int __ses_path_va(ScfEfunction* f, ses_path_t* path, int* changed) int i; int j; - int k; p0 = path->pins->data[0]; p1 = path->pins->data[path->pins->size - 1]; @@ -178,29 +148,26 @@ int __ses_path_va(ScfEfunction* f, ses_path_t* path, int* changed) double dv = 0; double jdv = 0; + int i0 = 0; + for (i = 0; i < path->pins->size; i++) { p = path->pins->data[i]; if (!(i & 0x1) && path->childs) { - int ret = __ses_path_split_v(f, path, p0, i, a, ja); - if (ret < 0) - return ret; + __ses_path_split_v(f, path, i0, i, a, ja); - ret = __ses_path_split_a(f, path, i, &a, &ja, changed); + int ret = __ses_path_split_a(f, path, i, &a, &ja, changed); if (ret < 0) return ret; if (ret > 0) { p0 = p; + i0 = i; scf_logd("i: %d, p0: c%ldp%ld\n", i, p0->cid, p0->id); } - - } else { - int ret = __ses_path_split_v(f, path, p0, i, a, ja); - if (ret < 0) - return ret; - } + } else + __ses_path_split_v(f, path, i0, i, a, ja); el = f->elines[p->lid]; el->v = p->v; diff --git a/ses_steps.c b/ses_steps.c index 80d3cef..a1469ee 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -141,7 +141,7 @@ int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count) return ret; int j; - for (j = 0; j < 1; j++) { + for (j = 0; j < 2; j++) { ret = __ses_steps_analyse(f, ns, i, ctx); if (-EAGAIN == ret) -- 2.25.1