From ed3d6126c970c93f6336264a994c7a38e8a4a1a9 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 30 Oct 2023 16:00:39 +0800 Subject: [PATCH] ses_lines_same_components() --- ses_layout.c | 68 +++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index 70417be..c2e79ab 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -271,7 +271,6 @@ int ses_lines_same_components(ScfEfunction* f) ScfEline* tmp; ScfEline* el0; ScfEline* el1; - ScfEline* el2; ScfEconn* ec; size_t i; @@ -423,51 +422,42 @@ int ses_lines_same_components(ScfEfunction* f) } #if 1 - k0 = 0; - do { - k1 = k0; - k0 = 0; - - for (i = 0; i < f->n_elines; i++) { - el0 = f->elines[i]; - - if (el0->n_pins > 4) - 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); + if (el0->n_conns > 1) { + m = __ses_find_eline_index(f, el0->conns[1]->lid); - el1 = f->elines[j]; - ++j; - } else if (j > f->n_elines / 2) { - el1 = f->elines[j]; - ++j; - } else { - el1 = f->elines[j]; - } + if (j > m) + SCF_XCHG(j, m); - for (n = f->n_elines - 1; n > j; n--) - f->elines[n] = f->elines[n - 1]; + el1 = f->elines[j]; + ++j; + } else if (j > f->n_elines / 2) { + el1 = f->elines[j]; + ++j; + } else { + el1 = f->elines[j]; + } - f->elines[j] = el0; + for (n = f->n_elines - 1; n > j; n--) + f->elines[n] = f->elines[n - 1]; - if (j != i) { - k0++; - scf_loge("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, j, el1->id); - } - } + f->elines[j] = el0; - printf("k0: %ld, k1: %ld\n", k0, k1); + if (j == i) + continue; - } while (k0 != k1); + scf_loge("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, j, el1->id); + } #endif #if 1 @@ -955,7 +945,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) @@ -1215,7 +1205,6 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ || (c->x + dx3 + dx0 < c->x + dx3 - dx0 && pe->x < pc->x)) { cairo_set_source_rgb(cr, 0.6, 0.6, 0.0); - cairo_set_line_width(cr, 2); cairo_move_to(cr, c->x - dx3, c->y - dy3); cairo_line_to(cr, c->x + dx3 + dx0, c->y + dy3 + dy0); @@ -1230,7 +1219,6 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ cairo_stroke(cr); cairo_set_source_rgb(cr, 0.0, 0.6, 0.0); - cairo_set_line_width(cr, 2.5); cairo_move_to(cr, c->x - dx3, c->y - dy3); cairo_line_to(cr, c->x + dx3 - dx0, c->y + dy3 - dy0); cairo_line_to(cr, pc->x, pc->y); @@ -1238,14 +1226,12 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ } else { cairo_set_source_rgb(cr, 0.0, 0.6, 0.0); - cairo_set_line_width(cr, 2.5); cairo_move_to(cr, c->x - dx3, c->y - dy3); cairo_line_to(cr, c->x + dx3 + dx0, c->y + dy3 + dy0); cairo_line_to(cr, pc->x, pc->y); cairo_stroke(cr); cairo_set_source_rgb(cr, 0.6, 0.6, 0.0); - cairo_set_line_width(cr, 2); cairo_move_to(cr, c->x - dx3, c->y - dy3); cairo_line_to(cr, c->x + dx3 - dx0, c->y + dy3 - dy0); -- 2.25.1