From: yu.dongliang <18588496441@163.com> Date: Thu, 9 Nov 2023 12:40:14 +0000 (+0800) Subject: npn X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=d33ce08c1cab45aad9107b4e33808eacc0a945dd;p=ses.git npn --- diff --git a/ses_layout.c b/ses_layout.c index 890250e..23bca96 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -671,37 +671,42 @@ static int __ses_layout_lines2(ScfEfunction* f) return 0; __ses_layout_lines4(f); -#if 0 +#if 1 for (i = 0; i < f->n_elines; i++) { el0 = f->elines[i]; if (el0->n_pins != 4) continue; - ScfEcomponent* c0 = f->components[el0->pins[0]]; - ScfEcomponent* c1 = f->components[el0->pins[2]]; + intptr_t cflag = 0; + intptr_t ib = INT_MAX; + + for (j = 0; j + 1 < el0->n_pins; j += 2) { + + ScfEcomponent* c = f->components[el0->pins[j]]; + ScfEpin* p = c->pins [el0->pins[j + 1]]; - ScfEpin* p0 = c0->pins[el0->pins[1]]; - ScfEpin* p1 = c1->pins[el0->pins[3]]; + if (c->color > 2) + continue; - if (SCF_EDA_NPN == c0->type && SCF_EDA_NPN == c1->type) { + if (SCF_EDA_NPN != c->type) + continue; - ScfEpin* pb0 = c0->pins[SCF_EDA_NPN_B]; - ScfEpin* pb1 = c1->pins[SCF_EDA_NPN_B]; + if (SCF_EDA_NPN_C == p->id) + cflag = 1; - if (el0->id != pb0->lid && el0->id != pb1->lid) { - intptr_t i0 = __ses_find_eline_index(f, pb0->lid); - intptr_t i1 = __ses_find_eline_index(f, pb1->lid); + m = __ses_find_eline_index(f, c->pins[SCF_EDA_NPN_B]->lid); - if (i0 > i1) - i0 = i1; + if (ib > m) + ib = m; + } - el1 = f->elines[i0]; + if (cflag && ib < f->n_elines) { + el1 = f->elines[ib]; - eline_mov_after(f, i0, i); + eline_mov_before(f, ib, i); - scf_logi("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, i0, el1->id); - } + scf_logi("mov el%ld [%ld] <--> [%ld] el%ld\n", el0->id, i, ib, el1->id); } } #endif