From c3d47529d771b7e8f20a6a81fbc2ced3b3ec1e41 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 11 Sep 2023 11:47:24 +0800 Subject: [PATCH] ses_step_va_diode.c --- ses_step_dc_input.c | 2 +- ses_step_va.c | 18 +++++++++++++----- ses_step_va_diode.c | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ses_step_dc_input.c b/ses_step_dc_input.c index 2a28043..2daed43 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 = (0x0) * B->v; el->vconst = 1; scf_logw("IN el: %ld, V: %lg\n", el->id, el->v); diff --git a/ses_step_va.c b/ses_step_va.c index 9062ef1..5fe2362 100644 --- a/ses_step_va.c +++ b/ses_step_va.c @@ -42,7 +42,7 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) ses_ur_i(&path->a, &path->ja, v, jv, path->r, path->jr); - scf_loge("path: %d, v: %lg + j%lg, r: %lg + j%lg, a: %lg + j%lg\n", path->index, v, jv, path->r, path->jr, path->a, path->ja); + scf_loge("path: %d, v: %lg + j%lg, r: %lg + j%lg, a: %lg + j%lg\n\n", path->index, v, jv, path->r, path->jr, path->a, path->ja); double a = path->a; double ja = path->ja; @@ -55,7 +55,7 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) for (i = 0; i < path->pins->size; i++) { p = path->pins->data[i]; - if (path->childs) { + if (!(i & 0x1) && path->childs) { for (j = 0; j < path->childs->size; j++) { child = path->childs->data[j]; @@ -84,6 +84,10 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) double _ja = 0; ses_ir_u(&_v, &_jv, a, ja, _r, _jr); + + scf_logw("child: %d, c%ldp%ld, c%ldp%ld, _v: %lg + j%lg, a: %lg + j%lg, _r: %lg + j%lg, p->pr: %lg + j%lg, p->dr: %lg + j%lg, p2->pr: %lg + j%lg\n", + child->index, p->cid, p->id, p2->cid, p2->id, _v, _jv, a, ja, _r, _jr, p->pr, p->jpr, p->dr, p->jdr, p2->pr, p2->jpr); + ses_ur_i(&_a, &_ja, _v, _jv, child->r, child->jr); a -= _a; @@ -93,6 +97,9 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) el->v = p->v - _v; el->jv = p->jv - _jv; + scf_loge("child: %d, c%ldp%ld, c%ldp%ld, p->v: %lg + j%lg, el->v: %lg + j%lg, _v: %lg + j%lg\n", + child->index, p->cid, p->id, p2->cid, p2->id, p->v, p->jv, el->v, el->jv, _v, _jv); + int ret = __ses_path_va(f, child); if (ret < 0) return ret; @@ -153,8 +160,8 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) } } - scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, a: %lg + j%lg\n\n", path->index, i, p->cid, p->id, - p->v, p->jv, dv, jdv, r, jr, p->a, p->ja, a, ja); + scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, a: %lg + j%lg, p->pr: %lg + j%lg\n\n", path->index, i, p->cid, p->id, + p->v, p->jv, dv, jdv, r, jr, p->a, p->ja, a, ja, p->pr, p->jpr); r = 0; jr = 0; @@ -163,7 +170,8 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) dv = p->v; jdv = p->jv; - scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, a: %lg + j%lg\n", path->index, i, p->cid, p->id, p->v, p->jv, dv, jdv, a, ja); + scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, a: %lg + j%lg, p->pr: %lg + %lg\n", + path->index, i, p->cid, p->id, p->v, p->jv, dv, jdv, a, ja, p->pr, p->jpr); } } printf("\n"); diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index cdd57be..c922366 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -134,10 +134,14 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) if (path->childs) __ses_path_split_i(path, p, p1, el->a, el->ja, &p->a, &p->ja); - __ses_path_dr(p, p1, p); + p2 = c->pins[SCF_EDA_Diode_NEG]; + p2->a = p->a; + p2->ja = p->ja; - scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg + j%lg, p->v: %lg + j%lg, p->a: %lg + j%lg, pr: %lg + j%lg, sr: %lg + j%lg, p->dr: %lg + j%lg\n", - i, p->cid, p->id, p1->cid, p1->id, v, jv, p->v, p->jv, p->a, p->ja, pr, jpr, sr, jsr, p->dr, p->jdr); + __ses_path_dr(p, p1, p2); + + scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg + j%lg, p->v: %lg + j%lg, p->a: %lg + j%lg, pr: %lg + j%lg, sr: %lg + j%lg, p2->dr: %lg + j%lg\n", + i, p->cid, p->id, p1->cid, p1->id, v, jv, p->v, p->jv, p->a, p->ja, pr, jpr, sr, jsr, p2->dr, p2->jdr); } else { p = path->pins->data[i + 1]; -- 2.25.1