From 9d36ded872776fa717b5cf36687fd939abb531f1 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 30 Oct 2023 10:34:39 +0800 Subject: [PATCH] __ses_find_eline_index() --- ses_layout.c | 58 +++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index 2dedeb1..4bf6b1d 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -230,7 +230,7 @@ next: el->c_pins = el->n_pins; el->id = i; - scf_logd("line i: %ld, %p, el->flags: %#lx\n", i, el, el->flags); + scf_loge("line i: %ld, %p, el->flags: %#lx\n", i, el, el->flags); for (j = 0; j + 1 < el->n_pins; j += 2) { @@ -240,9 +240,9 @@ next: p->lid = i; p->c_lid = i; - scf_logd("pin j: %ld, c%ldp%ld\n", j, el->pins[j], el->pins[j + 1]); + scf_logi("pin j: %ld, c%ldp%ld\n", j, el->pins[j], el->pins[j + 1]); } -// printf("\n"); + printf("\n"); i++; } @@ -250,11 +250,28 @@ next: return 0; } +static inline int __ses_find_eline_index(ScfEfunction* f, uint64_t lid) +{ + ScfEline* el; + size_t j; + + for (j = 0; j < f->n_elines; j++) { + el = f->elines[j]; + + if (el->id == lid) + break; + } + assert(j < f->n_elines); + + return j; +} + int ses_lines_same_components(ScfEfunction* f) { ScfEline* tmp; ScfEline* el0; ScfEline* el1; + ScfEline* el2; ScfEconn* ec; size_t i; @@ -330,7 +347,6 @@ int ses_lines_same_components(ScfEfunction* f) if (f->n_elines <= 2) return 0; - size_t k; size_t m; size_t n; @@ -344,13 +360,8 @@ int ses_lines_same_components(ScfEfunction* f) for (i = 0; i < el0->n_conns && i < 2; i++) { ec = el0->conns[i]; - for (j = 0; j < f->n_elines; j++) { - el1 = f->elines[j]; - - if (el1->id == ec->lid) - break; - } - assert(j < f->n_elines); + j = __ses_find_eline_index(f, ec->lid); + el1 = f->elines[j]; n = m + (i << 1) - 1; @@ -370,13 +381,8 @@ int ses_lines_same_components(ScfEfunction* f) for (i = 0; i < el0->n_conns; i++) { ec = el0->conns[i]; - for (j = 0; j < f->n_elines; j++) { - el1 = f->elines[j]; - - if (el1->id == ec->lid) - break; - } - assert(j < f->n_elines); + j = __ses_find_eline_index(f, ec->lid); + el1 = f->elines[j]; if (0 == el1->n_lines) break; @@ -401,13 +407,8 @@ int ses_lines_same_components(ScfEfunction* f) for (i = 0; i < el0->n_conns; i++) { ec = el0->conns[i]; - for (j = 0; j < f->n_elines; j++) { - el1 = f->elines[j]; - - if (el1->id == ec->lid) - break; - } - assert(j < f->n_elines); + j = __ses_find_eline_index(f, ec->lid); + el1 = f->elines[j]; if (0 == el1->n_lines) break; @@ -427,13 +428,14 @@ int ses_lines_same_components(ScfEfunction* f) el0->n_lines = 0; - scf_logd("el0: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", el0->id, el0->n_conns, el0->n_pins, el0->flags); + scf_logw("el0: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", el0->id, el0->n_conns, el0->n_pins, el0->flags); for (j = 0; j < el0->n_conns; j++) { ec = el0->conns[j]; - scf_logd("j: %ld, lid: %ld, n_cids: %ld, cid[0]: %ld\n", j, ec->lid, ec->n_cids, ec->cids[0]); + scf_logi("j: %ld, lid: %ld, n_cids: %ld, cid[0]: %ld\n", j, ec->lid, ec->n_cids, ec->cids[0]); } + printf("\n"); } #endif @@ -1213,7 +1215,7 @@ int ses_layout_board(ScfEboard* b) return ret; } - ses_steps_analyse(f, 5, 1); +// ses_steps_analyse(f, 5, 1); x = f->x; y = f->y; -- 2.25.1