From 6e42d93b7e5dcf45cfcddc7a2955defc3c5d7ac3 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sat, 22 Jul 2023 15:08:43 +0800 Subject: [PATCH] _simplify_handler --- ses_step_simplify.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/ses_step_simplify.c b/ses_step_simplify.c index d9880a1..0bf922d 100644 --- a/ses_step_simplify.c +++ b/ses_step_simplify.c @@ -224,14 +224,51 @@ static int _simplify_handler(ScfEfunction* f, int64_t ns, int64_t count) ScfEcomponent* c; ScfEcomponent* B; ScfEline* el; - ScfEpin* pb; - ScfEpin* pc; - ScfEpin* pe; + ScfEline* el2; + ScfEline* elp; + ScfEline* eln; + ScfEpin* p; size_t i; size_t j; size_t k; + B = f->components[0]; + + elp = f->elines[B->pins[SCF_EDA_Battery_POS]->lid]; + eln = f->elines[B->pins[SCF_EDA_Battery_NEG]->lid]; + + for (i = 0; i < f->n_elines; i++) { + el = f->elines[i]; + + if (!(SCF_EDA_PIN_IN & el->flags)) + continue; + + if (el->v == elp->v) + el2 = elp; + else if (el->v == eln->v) + el2 = eln; + else + continue; + + for (j = 0; j + 1 < el->n_pins; j += 2) { + + c = f->components[el->pins[j]]; + p = c->pins [el->pins[j + 1]]; + + if (SCF_EDA_Status_OFF == c->status) + continue; + + int ret = scf_eline__add_pin(el2, c->id, p->id); + if (ret < 0) + return ret; + + p->lid = el2->id; + + scf_logw("c%ld, p%ld, l%ld --> l%ld\n", c->id, p->id, p->c_lid, p->lid); + } + } + _simplify_draw(f, f->x, f->y, f->w, f->h); return 0; -- 2.25.1