From 2e618a2cd4ff3bf76114051c031ef347e9c1754b Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Fri, 8 Sep 2023 20:16:33 +0800 Subject: [PATCH] ses_step_va_transistor.c --- ses_step_va_diode.c | 2 +- ses_step_va_transistor.c | 103 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 97 insertions(+), 8 deletions(-) diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index 1e98b5f..7a7ce24 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -55,7 +55,7 @@ void __ses_path_dr(ScfEpin* p0, ScfEpin* p1, ScfEpin* p) ses_ui_r(&p->dr, &p->jdr, v, jv, p->a, p->ja); - scf_logd("c%ldp%ld, v: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, p->dr: %lg + j%lg\n", p->cid, p->id, + scf_logw("c%ldp%ld, v: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, p->dr: %lg + j%lg\n", p->cid, p->id, v, jv, r, jr, p->a, p->ja, p->dr, p->jdr); p->dr -= r; diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index c2a6169..e253cbd 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -7,6 +7,8 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path) ScfEline* el; ScfEpin* p0; ScfEpin* p1; + + ScfEpin* p; ScfEpin* pb; ScfEpin* pc; ScfEpin* pe; @@ -52,6 +54,8 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path) if (SCF_EDA_Transistor_B != pb->id) continue; + p = path->pins->data[i - 1]; + v = p0->v - pb->v; jv = p0->jv - pb->jv; @@ -63,17 +67,30 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path) ses_ur_i(&el->a, &el->ja, v, jv, pr, jpr); - pb->a = el->a; - pb->ja = el->ja; + pb->a = el->a; + pb->ja = el->ja; + + p->v = el->v; + p->jv = el->jv; + p->a = el->a; + p->ja = el->ja; + el->aconst = 1; - if (path->childs) + if (path->childs) { + + __ses_path_split_i(path, p0, pb, el, &p->a, &p->ja); __ses_path_split_i(path, pb, p1, el, &pb->a, &pb->ja); - __ses_path_dr(pb, p1, pb); + } else { + p0->a = el->a; + p0->ja = el->ja; + } + + __ses_path_dr(p, p1, pb); - scf_loge("i: %d, c%ldp%ld, v: %lg + j%lg, pb->v: %lg + j%lg, pb->a: %lg + j%lg, pr: %lg + j%lg, sr: %lg + j%lg, pb->dr: %lg + j%lg\n", - i, pb->cid, pb->id, v, jv, pb->v, pb->jv, pb->a, pb->ja, pr, jpr, sr, jsr, pb->dr, pb->jdr); + scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg + j%lg, pb->v: %lg + j%lg, pb->a: %lg + j%lg, pr: %lg + j%lg, sr: %lg + j%lg, pb->dr: %lg + j%lg\n", + i, p0->cid, p0->id, pb->cid, pb->id, v, jv, pb->v, pb->jv, pb->a, pb->ja, pr, jpr, sr, jsr, pb->dr, pb->jdr); pc = c->pins[SCF_EDA_Transistor_C]; pe = c->pins[SCF_EDA_Transistor_E]; @@ -84,10 +101,82 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path) pe->a = pc->a + pb->a; pe->ja = pc->ja + pb->ja; + pb->aconst = 1; + pc->aconst = 1; + pe->aconst = 1; + scf_loge("i: %d, c%ldp%ld, pc->a: %lg + j%lg\n", i, pc->cid, pc->id, pc->a, pc->ja); scf_loge("i: %d, c%ldp%ld, pe->a: %lg + j%lg\n", i, pe->cid, pe->id, pe->a, pe->ja); } - printf("\n"); + + for (i = 1; i < path->pins->size - 1; i++) { + pc = path->pins->data[i]; + + el = f->elines [pc->lid]; + c = f->components[pc->cid]; + + if (SCF_EDA_Transistor != c->type) + continue; + + if (SCF_EDA_Transistor_C != pc->id) + continue; + + if (!pc->aconst) + continue; + + p = path->pins->data[i - 1]; + + pr = p->pr - p0->pr; + jpr = p->jpr - p0->jpr; + + sr = p->sr - p0->sr; + jsr = p->jsr - p0->jsr; + + ses_ir_u(&v, &jv, pc->a, pc->ja, pr, jpr); + + pc->v = p0->v - v; + pc->jv = p0->jv - jv; + + if (pc->v < p1->v) { + v = p0->v - p1->v; + jv = p0->jv - p1->jv; + + pr = p1->sr - p0->pr; + jpr = p1->jsr - p0->jpr; + + ses_ur_i(&pc->a, &pc->ja, v, jv, pr, jpr); + + pr = p->pr - p0->pr; + jpr = p->jpr - p0->jpr; + + ses_ir_u(&v, &jv, pc->a, pc->ja, pr, jpr); + + pc->v = p0->v - v; + pc->jv = p0->jv - jv; + } + + el->v = pc->v; + el->jv = pc->jv; + el->a = pc->a; + el->ja = pc->ja; + + p->v = el->v; + p->jv = el->jv; + p->a = el->a; + p->ja = el->ja; + + if (path->childs) + __ses_path_split_i(path, p0, pc, el, &p->a, &p->ja); + else { + p0->a = el->a; + p0->ja = el->ja; + } + + __ses_path_dr(p, p1, pc); + + scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg + j%lg, pc->v: %lg + j%lg, pc->a: %lg + j%lg, pr: %lg + j%lg, sr: %lg + j%lg, pc->dr: %lg + j%lg\n", + i, p0->cid, p0->id, pc->cid, pc->id, v, jv, pc->v, pc->jv, pc->a, pc->ja, pr, jpr, sr, jsr, pc->dr, pc->jdr); + } return 0; } -- 2.25.1