From: yu.dongliang <18588496441@163.com> Date: Mon, 30 Oct 2023 05:33:42 +0000 (+0800) Subject: ses_lines_same_components() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=1742a28b38d6238c4fa51462fc04209573f805e2;p=ses.git ses_lines_same_components() --- diff --git a/ses_layout.c b/ses_layout.c index c52b134..70417be 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -423,35 +423,51 @@ int ses_lines_same_components(ScfEfunction* f) } #if 1 - for (i = 0; i < f->n_elines; ) { - el0 = f->elines[i]; + k0 = 0; + do { + k1 = k0; + k0 = 0; - if (0 == el0->n_lines || el0->n_pins <= 4) { - i++; - continue; - } + for (i = 0; i < f->n_elines; i++) { + el0 = f->elines[i]; - for (j = i + 1; j < f->n_elines; j++) - f->elines[j - 1] = f->elines[j]; + if (el0->n_pins > 4) + continue; - j = __ses_find_eline_index(f, el0->conns[0]->lid); + for (j = i + 1; j < f->n_elines; j++) + f->elines[j - 1] = f->elines[j]; - if (el0->n_conns > 1) { - m = __ses_find_eline_index(f, el0->conns[1]->lid); + j = __ses_find_eline_index(f, el0->conns[0]->lid); - if (j > m) - SCF_XCHG(j, m); - } else - m = j + 2; + if (el0->n_conns > 1) { + m = __ses_find_eline_index(f, el0->conns[1]->lid); - for (n = f->n_elines - 1; n > j + 1; n--) - f->elines[n] = f->elines[n - 1]; + if (j > m) + SCF_XCHG(j, m); - f->elines[j + 1] = el0; - el0->n_lines = 0; + el1 = f->elines[j]; + ++j; + } else if (j > f->n_elines / 2) { + el1 = f->elines[j]; + ++j; + } else { + el1 = f->elines[j]; + } - scf_loge("mov el%ld: %ld --> (%ld) %ld (%ld)\n", el0->id, i, j, j + 1, m); - } + for (n = f->n_elines - 1; n > j; n--) + f->elines[n] = f->elines[n - 1]; + + f->elines[j] = el0; + + if (j != i) { + k0++; + scf_loge("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, j, el1->id); + } + } + + printf("k0: %ld, k1: %ld\n", k0, k1); + + } while (k0 != k1); #endif #if 1 @@ -939,7 +955,7 @@ int ses_layout_function(ScfEfunction* f, int d) p1->x = c->x; else { p1->x += c->x - tmp; - p1->x = (c->x * 3 + p1->x) / 4; +// p1->x = (c->x * 3 + p1->x) / 4; } if (tx0 > p1->x)