From: yu.dongliang <18588496441@163.com> Date: Mon, 30 Oct 2023 10:42:01 +0000 (+0800) Subject: __ses_xchg_npn_ce() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=37968af876c0d424cf3f35b9ed022e746a11524f;p=ses.git __ses_xchg_npn_ce() --- diff --git a/ses_layout.c b/ses_layout.c index 3e98f34..291f019 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -988,6 +988,38 @@ static void __ses_layout_cx(ScfEfunction* f, int d) qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id); } +static void __ses_xchg_npn_ce(ScfEfunction* f, int d) +{ + ScfEcomponent* c; + ScfEpin* pb; + ScfEpin* pe; + ScfEpin* pc; + + size_t i; + + for (i = 0; i < f->n_components; i++) { + c = f->components[i]; + + if (SCF_EDA_NPN != c->type) + continue; + + pb = c->pins[SCF_EDA_NPN_B]; + pc = c->pins[SCF_EDA_NPN_C]; + pe = c->pins[SCF_EDA_NPN_E]; + + if (pc->y > pe->y && pe->y > pb->y) { + + if ((c->x < 0 && pc->x > pe->x) || (c->x > 0 && pc->x < pe->x)) + SCF_XCHG(pc->x, pe->x); + + } else if (pc->y < pe->y && pe->y < pb->y) { + + if ((c->x < 0 && pc->x > pe->x) || (c->x > 0 && pc->x < pe->x)) + SCF_XCHG(pc->x, pe->x); + } + } +} + int ses_layout_function(ScfEfunction* f, int d) { ScfEcomponent* c; @@ -1018,9 +1050,10 @@ int ses_layout_function(ScfEfunction* f, int d) __ses_de_cross (f, d); __ses_layout_cx(f, d); - __ses_xchg_cx (f, d); + __ses_xchg_npn_ce(f, d); + int mx = 0; int nx = INT_MIN; int px = INT_MAX; @@ -1056,9 +1089,6 @@ int ses_layout_function(ScfEfunction* f, int d) for (i = 0; i < f->n_components; i++) { c = f->components[i]; - int cx = 0; - int cy = 0; - for (j = 0; j < c->n_pins; j++) { p0 = c->pins[j]; @@ -1066,15 +1096,12 @@ int ses_layout_function(ScfEfunction* f, int d) p0->x -= px - nx - d; p0->x -= mx - d; - - if (j < 2) { - cx += p0->x; - cy += p0->y; - } } - c->x = cx / 2; - c->y = cy / 2; + if (c->x > 0) + c->x -= px - nx - d; + + c->x -= mx - d; } int tx0 = INT_MAX;