From 80aade813553e84ac3f607c5e6aea9bb5426c879 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sat, 30 Sep 2023 22:10:14 +0800 Subject: [PATCH] ses_layout_function() --- ses_layout.c | 59 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index d73bf24..92b578b 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -572,8 +572,6 @@ int ses_layout_function(ScfEfunction* f, int d) qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); - int mx = 0; - for (i = 0; i < f->n_components - 1; i++) { c0 = f->components[i]; @@ -606,31 +604,19 @@ int ses_layout_function(ScfEfunction* f, int d) if (y0 < y2 && y2 < y1 && y1 < y3) { - if (p0->x > 0) { + if (p0->x > 0) p0->x = -p0->x; - if (mx > p0->x) - mx = p0->x; - } - if (p1->x > 0) { + if (p1->x > 0) p1->x = -p1->x; - if (mx > p1->x) - mx = p1->x; - } } else if (y2 < y0 && y0 < y3 && y3 < y1) { - if (p2->x > 0) { + if (p2->x > 0) p2->x = -p2->x; - if (mx > p2->x) - mx = p2->x; - } - if (p3->x > 0) { + if (p3->x > 0) p3->x = -p3->x; - if (mx > p3->x) - mx = p3->x; - } } } } @@ -698,6 +684,38 @@ next: c0 = NULL; } + int mx = 0; + int nx = INT_MIN; + int px = INT_MAX; + + for (i = 0; i < f->n_components; i++) { + c0 = f->components[i]; + + for (j = 0; j < c0->n_pins; j++) { + p0 = c0->pins[j]; + + if (p0->x < 0) { + if (mx > p0->x) + mx = p0->x; + + if (nx < p0->x) + nx = p0->x; + + } else { + if (px > p0->x) + px = p0->x; + } + } + } + + if (INT_MIN == nx) + nx = 0; + + if (INT_MAX == px) + px = 0; + + scf_loge("mx: %d, nx: %d, px: %d\n", mx, nx, px); + for (i = 0; i < f->n_components; i++) { c0 = f->components[i]; @@ -707,6 +725,9 @@ next: for (j = 0; j < c0->n_pins; j++) { p0 = c0->pins[j]; + if (p0->x > 0) + p0->x -= px - nx - d; + p0->x -= mx - d; if (j < 2) { @@ -744,7 +765,7 @@ next: el0->lines[0]->x1 = x1; } - f->w -= mx - d * 2; + f->w -= mx - 3 * d + px - nx; f->h += d; scf_loge("f->x: %d, y: %d, w: %d, h: %d\n", f->x, f->y, f->w, f->h); -- 2.25.1