From 9ba15b22978e355d9ff10453c3a27189c31098ac Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Tue, 17 Oct 2023 20:21:17 +0800 Subject: [PATCH] __ses_layout_components() --- ses_layout.c | 80 +++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index c09d7f0..35f0c33 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -840,32 +840,6 @@ int ses_layout_function(ScfEfunction* f, int d) c->y = cy / 2; } - int tx0 = INT_MAX; - int tx1 = 0; - - qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_cx); - - for (i = 1; i < f->n_components; i++) { - c = f->components[i]; - c2 = f->components[i - 1]; - - int tmp = c->x; - - if (c->x > c2->x + d) - c->x = c2->x + d; - - for (k = 0; k < c->n_pins; k++) { - p1 = c->pins[k]; - - if (k < 2) - p1->x = c->x; - else - p1->x += c->x - tmp; - } - } - - qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id); - for (i = 0; i < f->n_elines; i++) { el = f->elines[i]; @@ -891,15 +865,42 @@ int ses_layout_function(ScfEfunction* f, int d) p1->x = c->x; else p1->x += c->x - tmp; + } + } + } - if (tx0 > p1->x) - tx0 = p1->x; + int tx0 = INT_MAX; + int tx1 = 0; - if (tx1 < p1->x) - tx1 = p1->x; - } + qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_cx); + for (i = 1; i < f->n_components; i++) { + c = f->components[i]; + c2 = f->components[i - 1]; + + int tmp = c->x; + + if (c->x > c2->x + d) + c->x = c2->x + d; + + if (c->x < c2->x + d / 2) + c->x = c2->x + d / 2; + + for (k = 0; k < c->n_pins; k++) { + p1 = c->pins[k]; + + if (k < 2) + p1->x = c->x; + else + p1->x += c->x - tmp; + + if (tx0 > p1->x) + tx0 = p1->x; + + if (tx1 < p1->x) + tx1 = p1->x; } } + qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id); for (i = 0; i < f->n_elines; i++) { el = f->elines[i]; @@ -919,22 +920,11 @@ int ses_layout_function(ScfEfunction* f, int d) x1 = p0->x; } - el->lines[0]->x0 = x0 - tx0 + d; - el->lines[0]->x1 = x1 - tx0 + d; - } - - for (i = 0; i < f->n_components; i++) { - c = f->components[i]; - - c->x -= tx0 - d; - - for (j = 0; j < c->n_pins; j++) { - p0 = c->pins[j]; - p0->x -= tx0 - d; - } + el->lines[0]->x0 = x0; + el->lines[0]->x1 = x1; } - f->w = tx1 - tx0 + 2 * d; + f->w = tx1 + d; f->h += d; scf_loge("f->x: %d, y: %d, w: %d, h: %d, tx0: %d, tx1: %d\n", f->x, f->y, f->w, f->h, tx0, tx1); -- 2.25.1