From ae2fc4ab7557d1654a39dc3b69d2c40c850402e9 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 6 Sep 2023 19:39:55 +0800 Subject: [PATCH] tmp --- ses_step_dc_input.c | 2 +- ses_step_jr.c | 12 ++++++++++-- ses_step_va_diode.c | 31 +++++++++++++++++++++++++++---- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/ses_step_dc_input.c b/ses_step_dc_input.c index 2a28043..bef68ea 100644 --- a/ses_step_dc_input.c +++ b/ses_step_dc_input.c @@ -17,7 +17,7 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx if (SCF_EDA_PIN_IN & el->flags) { - el->v = (rand() & 0x1) * B->v; + el->v = (i & 0x1) * B->v; el->vconst = 1; scf_logw("IN el: %ld, V: %lg\n", el->id, el->v); diff --git a/ses_step_jr.c b/ses_step_jr.c index 80c7b64..9343178 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -114,13 +114,21 @@ static int __ses_path_jr(ScfEfunction* f, ses_path_t* path) double dr = p1->pr - (p0->pr + r); double jdr = p1->jpr - (p0->jpr + jr); - for ( ; j < path->pins->size; j++) { + p1->pr -= dr; + p1->jpr -= jdr; + + scf_logw("j: %d, c%ldp%ld, p->pr: %lg + j%lg, p->sr: %lg + j%lg\n", j, p1->cid, p1->id, p1->pr, p1->jpr, p1->sr, p1->jsr); + + for (++j; j < path->pins->size; j++) { p = path->pins->data[j]; p->pr -= dr; p->jpr -= jdr; - scf_logw("j: %d, c%ldp%ld, p->pr: %lg + j%lg\n", j, p->cid, p->id, p->pr, p->jpr); + p->sr -= dr; + p->jsr -= jdr; + + scf_logw("j: %d, c%ldp%ld, p->pr: %lg + j%lg, p->sr: %lg + j%lg\n", j, p->cid, p->id, p->pr, p->jpr, p->sr, p->jsr); } scf_loge("child: %d, r: %lg, jr: %lg, r0: %lg, jr0: %lg, _r: %lg, _jr: %lg, dr: %lg, jdr: %lg\n\n", diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index 727f9ff..1a4a8b3 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -77,7 +77,7 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) double r; double jr; - for (i = 0; i < path->pins->size; i++) { + for (i = 1; i < path->pins->size - 1; i++) { p = path->pins->data[i]; el = f->elines [p->lid]; @@ -97,10 +97,10 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) v = p0->v - p->v; jv = p0->jv - p->jv; - r = p1->pr - p->pr; - jr = p1->jpr - p->jpr; + r = p->pr - p0->pr; + jr = p->jpr - p0->jpr; - ses_ur_i(&a, &ja, v, jv, p->pr, p->jpr); + ses_ur_i(&a, &ja, v, jv, r, jr); el->a = a; el->ja = ja; @@ -116,6 +116,29 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) v, jv, p->v, p->jv, r, jr, p->a, p->ja); } else { + v = p->v - p1->v; + jv = p->jv - p1->jv; + + r = p1->pr - p->pr; + jr = p1->jpr - p->jpr; + + double sr = p1->sr - p->sr; + double jsr = p1->jsr - p->jsr; + + ses_ur_i(&a, &ja, v, jv, r, jr); + + el->a = a; + el->ja = ja; + el->aconst = 1; + + if (path->childs) + __ses_path_split_i(f, path, p0, p, &a, &ja); + + p->a = a; + p->ja = ja; + + scf_loge("i: %d, c%ldp%ld, v: %lg + j%lg, p->v: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, sr: %lg + j%lg\n", i, p->cid, p->id, + v, jv, p->v, p->jv, r, jr, p->a, p->ja, sr, jsr); } } printf("\n"); -- 2.25.1