From 27c9e5d02bb00685dcb3939162b4ef08ddfc1f23 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Tue, 3 Oct 2023 21:14:36 +0800 Subject: [PATCH] tmp --- ses_core.h | 2 +- ses_step_jr.c | 7 +++++++ ses_step_va_diode.c | 30 +++++++++++++++++++----------- ses_step_va_transistor.c | 2 +- ses_steps.c | 3 ++- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/ses_core.h b/ses_core.h index 16d873e..b82b976 100644 --- a/ses_core.h +++ b/ses_core.h @@ -106,7 +106,7 @@ int ses_layout_board (ScfEboard* b); int ses_loop_function(ScfEfunction* f, scf_vector_t* loops); int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count); -void __ses_path_split_i(ses_path_t* path, ScfEpin* p0, ScfEpin* p1, double la, double jla, double* a, double* ja); +void __ses_path_split_i(ses_path_t* path, int i, int j, double la, double jla, double* a, double* ja); void __ses_path_dr (ScfEpin* p0, ScfEpin* p1, ScfEpin* p); static inline void vertical(int* px, int* py, int dx, int dy, int d) diff --git a/ses_step_jr.c b/ses_step_jr.c index e1b52a3..14006f7 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -124,6 +124,13 @@ static int __ses_path_jr(ScfEfunction* f, ses_path_t* path) p1->pr -= dr; p1->jpr -= jdr; + if (SCF_EDA_Transistor == c->type && SCF_EDA_Transistor_E == p1->id) { + + p = path->pins->data[j - 1]; + p->pr -= dr; + p->jpr -= jdr; + } + scf_logw("j: %d, c%ldp%ld, p->pr: %lg + j%lg, p->sr: %lg + j%lg, dr: %lg + j%lg\n", j, p1->cid, p1->id, p1->pr, p1->jpr, p1->sr, p1->jsr, dr, jdr); for (++j; j < path->pins->size; j++) { diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index ca3ef00..86ef0fe 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -1,10 +1,12 @@ #include"ses_core.h" -void __ses_path_split_i(ses_path_t* path, ScfEpin* p0, ScfEpin* p1, double la, double jla, double* a, double* ja) +void __ses_path_split_i(ses_path_t* path, int i, int j, double la, double jla, double* a, double* ja) { ses_path_t* child; ScfEpin* cp0; ScfEpin* cp1; + ScfEpin* p0 = path->pins->data[i]; + ScfEpin* p1 = path->pins->data[j]; double v = p0->v - p1->v; double jv = p0->jv - p1->jv; @@ -12,9 +14,12 @@ void __ses_path_split_i(ses_path_t* path, ScfEpin* p0, ScfEpin* p1, double la, d double r = p1->pr - p0->pr; double jr = p1->jpr - p0->jpr; - int j; - for (j = 0; j < path->childs->size; j++) { - child = path->childs->data[j]; + scf_loge("c%ldp%ld--c%ldp%ld, r: %lg, p1->pr: %lg, p0->pr: %lg, p1->sr: %lg, p0->sr: %lg\n", + p0->cid, p0->id, p1->cid, p1->id, r, p1->pr, p0->pr, p1->sr, p0->sr); + + int k; + for (k = 0; k < path->childs->size; k++) { + child = path->childs->data[k]; cp0 = child->pins->data[0]; cp1 = child->pins->data[child->pins->size - 1]; @@ -37,7 +42,7 @@ void __ses_path_split_i(ses_path_t* path, ScfEpin* p0, ScfEpin* p1, double la, d cp0->jv = p0->jv; if (child->childs) - __ses_path_split_i(child, cp0, cp1, child->a, child->ja, &cp1->a, &cp1->ja); + __ses_path_split_i(child, 0, child->pins->size - 1, child->a, child->ja, &cp1->a, &cp1->ja); cp0->a = cp1->a; cp0->ja = cp1->ja; @@ -50,8 +55,8 @@ void __ses_path_split_i(ses_path_t* path, ScfEpin* p0, ScfEpin* p1, double la, d cp1->dr -= cp1->sr; cp1->jdr -= cp1->jsr; - scf_loge("j: %d, c%ldp%ld--c%ldp%ld, v: %lg + j%lg, child->r: %lg + j%lg, cp1->a: %lg + j%lg, el->a: %lg + j%lg, cp1->dr: %lg + j%lg\n", - j, cp0->cid, cp0->id, cp1->cid, cp1->id, v, jv, child->r, child->jr, cp1->a, cp1->ja, la, jla, cp1->dr, cp1->jdr); + scf_loge("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, child->r: %lg, r: %lg, cp1->a: %lg, el->a: %lg, cp1->dr: %lg\n", + j, cp0->cid, cp0->id, cp1->cid, cp1->id, v, child->r, r, cp1->a, la, cp1->dr); } } @@ -307,7 +312,7 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) pj->ja = ja; if (path->childs) - __ses_path_split_i(path, pj, p1, a, ja, &pj->a, &pj->ja); + __ses_path_split_i(path, j, path->pins->size - 1, a, ja, &pj->a, &pj->ja); scf_loge("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, pj->v: %lg, pj->a: %lg, pr: %lg, sr: %lg\n\n", j, pj->cid, pj->id, p1->cid, p1->id, v, pj->v, pj->a, pr, sr); @@ -324,8 +329,11 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) pj->a = a; pj->ja = ja; + scf_logw("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, pj->v: %lg, pj->a: %lg, pr: %lg, sr: %lg\n\n", + j, pj->cid, pj->id, p1->cid, p1->id, v, pj->v, pj->a, pr, sr); + if (path->childs) - __ses_path_split_i(path, pj, p1, a, ja, &pj->a, &pj->ja); + __ses_path_split_i(path, j, path->pins->size - 1, a, ja, &pj->a, &pj->ja); scf_loge("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, pj->v: %lg, pj->a: %lg, pr: %lg, sr: %lg\n\n", j, pj->cid, pj->id, p1->cid, p1->id, v, pj->v, pj->a, pr, sr); @@ -349,7 +357,7 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) pi->ja = ja; if (path->childs) - __ses_path_split_i(path, p0, pi, a, ja, &pi->a, &pi->ja); + __ses_path_split_i(path, 0, i, a, ja, &pi->a, &pi->ja); __ses_path_dr_reverse(f, path, 0, i, pi->n_diodes, pi->a, pi->ja); @@ -367,7 +375,7 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) pi->ja = ja; if (path->childs) - __ses_path_split_i(path, p0, pi, a, ja, &pi->a, &pi->ja); + __ses_path_split_i(path, 0, i, a, ja, &pi->a, &pi->ja); p = c->pins[SCF_EDA_Transistor_B]; diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index a13ecf4..738c5f2 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -93,7 +93,7 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path) p->ja = el->ja; if (path->childs) - __ses_path_split_i(path, p0, pc, el->a, el->ja, &p->a, &p->ja); + __ses_path_split_i(path, 0, i, el->a, el->ja, &p->a, &p->ja); else { p0->a = el->a; p0->ja = el->ja; diff --git a/ses_steps.c b/ses_steps.c index 1afadcb..ca14cfc 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -37,12 +37,13 @@ static ses_step_t* ses_steps[] = &ses_step_jr, &ses_step_va_diode, &ses_step_va_transistor, - +#if 0 &ses_step_jr, &ses_step_va, &ses_step_va_balance, &ses_step_output, +#endif }; ses_flow_t* ses_flow_alloc() -- 2.25.1