From: yu.dongliang <18588496441@163.com> Date: Tue, 31 Oct 2023 07:14:46 +0000 (+0800) Subject: ses_layout_function() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=841740d37516761c086bc41a3b6a3517379acc1e;p=ses.git ses_layout_function() --- diff --git a/ses_layout.c b/ses_layout.c index af6da6d..c724502 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -716,7 +716,6 @@ static inline void __ses_flip_pos(ScfEcomponent* c) } } - static void __ses_de_cross(ScfEfunction* f, int d) { ScfEcomponent* c0; @@ -836,13 +835,14 @@ next: } } -static void __ses_set_cx(ScfEfunction* f, int d) +static void __ses_setc_xy(ScfEfunction* f, int d) { ScfEcomponent* c; ScfEpin* p0; ScfEpin* p1; size_t i; + size_t j; for (i = 0; i < f->n_components; i++) { c = f->components[i]; @@ -852,6 +852,15 @@ static void __ses_set_cx(ScfEfunction* f, int d) c->x = (p0->x + p1->x) / 2; c->y = (p0->y + p1->y) / 2; + + p0->x = c->x; + p1->x = c->x; + + for (j = 2; j < c->n_pins; j++) { + p0 = c->pins[j]; + + p0->x = (p0->x + 3 * c->x) / 4; + } } } @@ -1013,7 +1022,7 @@ 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) +static void __ses_xchg_ce(ScfEfunction* f, int d) { ScfEcomponent* c; ScfEpin* pb; @@ -1032,7 +1041,7 @@ static void __ses_xchg_npn_ce(ScfEfunction* f, int d) pc = c->pins[SCF_EDA_NPN_C]; pe = c->pins[SCF_EDA_NPN_E]; - pc->x = (pc->x + c->x * 3) / 4; +// pc->x = (pc->x + c->x * 3) / 4; if (pc->y > pe->y) SCF_XCHG(pc, pe); @@ -1056,41 +1065,13 @@ static void __ses_xchg_npn_ce(ScfEfunction* f, int d) } } -int ses_layout_function(ScfEfunction* f, int d) +static void __ses_mov_pos(ScfEfunction* f, int d) { ScfEcomponent* c; - ScfEcomponent* c2; - ScfEline* el; - ScfEline* el2; - ScfEpin* p0; - ScfEpin* p1; + ScfEpin* p; size_t i; size_t j; - size_t k; - - f->x = 0; - f->y = 0; - f->w = 0; - f->h = 0; - - int ret = __ses_layout_lines(f, d); - if (ret < 0) - return ret; - - __ses_layout_components(f, d); - __ses_xchg_components(f, d); - - qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); - - __ses_de_cross(f, d); - - __ses_set_cx (f, d); - __ses_xchg_cx(f, d); - - __ses_xchg_npn_ce(f, d); - - __ses_layout_cx(f, d); int mx = 0; int nx = INT_MIN; @@ -1100,18 +1081,18 @@ int ses_layout_function(ScfEfunction* f, int d) c = f->components[i]; for (j = 0; j < c->n_pins; j++) { - p0 = c->pins[j]; + p = c->pins[j]; - if (p0->x < 0) { - if (mx > p0->x) - mx = p0->x; + if (p->x < 0) { + if (mx > p->x) + mx = p->x; - if (nx < p0->x) - nx = p0->x; + if (nx < p->x) + nx = p->x; } else { - if (px > p0->x) - px = p0->x; + if (px > p->x) + px = p->x; } } } @@ -1128,12 +1109,12 @@ int ses_layout_function(ScfEfunction* f, int d) c = f->components[i]; for (j = 0; j < c->n_pins; j++) { - p0 = c->pins[j]; + p = c->pins[j]; - if (p0->x > 0) - p0->x -= px - nx - d; + if (p->x > 0) + p->x -= px - nx - d; - p0->x -= mx - d; + p->x -= mx - d; } if (c->x > 0) @@ -1141,6 +1122,42 @@ int ses_layout_function(ScfEfunction* f, int d) c->x -= mx - d; } +} + +int ses_layout_function(ScfEfunction* f, int d) +{ + ScfEcomponent* c; + ScfEcomponent* c2; + ScfEline* el; + ScfEline* el2; + ScfEpin* p0; + ScfEpin* p1; + + size_t i; + size_t j; + size_t k; + + f->x = 0; + f->y = 0; + f->w = 0; + f->h = 0; + + int ret = __ses_layout_lines(f, d); + if (ret < 0) + return ret; + + __ses_layout_components(f, d); + __ses_xchg_components(f, d); + + qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); + + __ses_de_cross(f, d); + + __ses_setc_xy(f, d); + __ses_xchg_cx(f, d); + __ses_xchg_ce(f, d); + __ses_mov_pos(f, d); +// __ses_layout_cx(f, d); int tx0 = INT_MAX; int tx1 = 0;