From 1160621f8953915f810cd271e9cceaa375136b00 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sun, 16 Jul 2023 16:13:31 +0800 Subject: [PATCH] ses line --- ses_layout.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index 7943aec..9281afe 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -387,7 +387,7 @@ int ses_layout_function(ScfEfunction* f, int d) if (!l0) return -ENOMEM; - l0->x0 = d; + l0->x0 = 0; l0->x1 = d; l0->y0 = d + i * d; l0->y1 = l0->y0; @@ -509,6 +509,8 @@ 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++) { @@ -557,6 +559,9 @@ int ses_layout_function(ScfEfunction* f, int d) } else if (y2 < y0 && y0 < y3 && y3 < y1) { + el0 = f->elines[p2->lid]; + el1 = f->elines[p3->lid]; + if (p2->x > 0) { p2->x = -p2->x; if (mx > p2->x) @@ -576,27 +581,17 @@ int ses_layout_function(ScfEfunction* f, int d) } } - qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); - for (i = 0; i < f->n_components; i++) { c0 = f->components[i]; - uint32_t cx = 0; - uint32_t cy = 0; + int cx = 0; + int cy = 0; for (j = 0; j < c0->n_pins; j++) { p0 = c0->pins[j]; p0->x -= mx - d; - el0 = f->elines[p0->lid]; - - if (el0->lines[0]->x1 < p0->x) - el0->lines[0]->x1 = p0->x; - - if (c0->id == 11) - scf_loge("p0->x: %d, p0->lid: %ld, el0->id: %ld, el0->x1: %d\n", p0->x, p0->lid, el0->id, el0->lines[0]->x1); - cx += p0->x; cy += p0->y; } @@ -605,6 +600,28 @@ int ses_layout_function(ScfEfunction* f, int d) c0->y = cy / c0->n_pins; } + for (i = 0; i < f->n_elines; i++) { + el0 = f->elines[i]; + + int x0 = INT_MAX; + int x1 = 0; + + for (j = 0; j < el0->n_pins; j += 2) { + + c0 = f ->components[el0->pins[j]]; + p0 = c0->pins [el0->pins[j + 1]]; + + if (x0 > p0->x) + x0 = p0->x; + + if (x1 < p0->x) + x1 = p0->x; + } + + el0->lines[0]->x0 = x0; + el0->lines[0]->x1 = x1; + } + f->w -= mx - d * 2; f->h += d; -- 2.25.1