From: yu.dongliang <18588496441@163.com> Date: Fri, 22 Sep 2023 06:39:47 +0000 (+0800) Subject: bridge X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=c0241f72c0df9bab0a257ffea41025db8646a78f;p=ses.git bridge --- diff --git a/ses_core.h b/ses_core.h index 0331127..d8fe020 100644 --- a/ses_core.h +++ b/ses_core.h @@ -64,6 +64,8 @@ struct ses_path_s int type; int index; + + int n_diodes; }; struct ses_ctx_s diff --git a/ses_step_topo.c b/ses_step_topo.c index 508bb1b..2e3919b 100644 --- a/ses_step_topo.c +++ b/ses_step_topo.c @@ -315,6 +315,22 @@ static int _topo_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* path = NULL; } + for (i = 0; i < ctx->paths->size; i++) { + path = ctx->paths->data[i]; + + path->n_diodes = 0; + + for (j = 0; j < path->pins->size; j++) { + p = path->pins->data[j]; + + c = f->components[p->cid]; + + if ((SCF_EDA_Diode == c->type && SCF_EDA_Diode_NEG == p->id) + || (SCF_EDA_Transistor == c->type && SCF_EDA_Transistor_B == p->id)) + path->n_diodes++; + } + } + scf_vector_qsort(ctx->paths, _ses_path_cmp); int ret = _topo_layers(ctx->paths); diff --git a/ses_step_va_balance.c b/ses_step_va_balance.c index fe04f78..259cbd5 100644 --- a/ses_step_va_balance.c +++ b/ses_step_va_balance.c @@ -63,10 +63,10 @@ static int __ses_path_va_balance(ScfEfunction* f, ses_path_t* bridge, ses_flow_t ses_path_t* path1 = flow1->paths->data[flow1->paths->size - 1]; ScfEpin* r0p0 = path0->pins->data[0]; - ScfEpin* r0p1 = flow0->vip; + ScfEpin* r0p1 = path0->pins->data[path0->pins->size - 1]; ScfEpin* r1p0 = path1->pins->data[0]; - ScfEpin* r1p1 = flow1->vip; + ScfEpin* r1p1 = path1->pins->data[path1->pins->size - 1]; int i; int j; @@ -84,21 +84,23 @@ static int __ses_path_va_balance(ScfEfunction* f, ses_path_t* bridge, ses_flow_t if (p0->v > p1->v) { - double v = r0p0->v - p1->v; - double jv = r0p0->jv - p1->jv; + double v = r0p0->v - r1p1->v; + double jv = r0p0->jv - r1p1->jv; - double r0 = r0p1->pr - r0p0->pr; - double jr0 = r0p1->jpr - r0p0->jpr; - - double r = r0 + bridge->r; - double jr = jr0 + bridge->jr; + double r = flow0->pr + bridge->r + flow1->nr; + double jr = flow0->jpr + bridge->jr + flow1->jnr; double a; double ja; + double dv; + double jdv; + ses_ur_i(&a, &ja, v, jv, r, jr); - scf_loge("r->pr: %lg + j%lg, v: %lg + j%lg, a: %lg + j%lg\n", r, jr, v, jv, a, ja); + ses_ir_u(&dv, &jdv, a, ja, flow0->pr, flow0->jpr); + + scf_loge("r->pr: %lg + j%lg, v: %lg + j%lg, a: %lg + j%lg, dv: %lg + j%lg\n", r, jr, v, jv, a, ja, dv, jdv); } else { diff --git a/ses_steps.c b/ses_steps.c index 6c2d001..6895bf1 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -251,7 +251,7 @@ void ses_path_print(ses_path_t* path) int i; if (!path->parent) - printf("\033[31mpath: %d, \033[0m", path->index); + printf("\033[31mpath: %d, n_diodes: %d, \033[0m", path->index, path->n_diodes); for (i = 0; i < path->pins->size; i++) { p = path->pins->data[i]; @@ -266,7 +266,7 @@ void ses_path_print(ses_path_t* path) for (i = 0; i < path->childs->size; i++) { path2 = path->childs->data[i]; - printf("\033[32mchild: %d, parent: %d, \033[0m", path2->index, path->index); + printf("\033[32mchild: %d, n_diodes: %d, parent: %d, \033[0m", path2->index, path2->n_diodes, path->index); ses_path_print(path2); }