From: yu.dongliang <18588496441@163.com> Date: Sat, 4 Nov 2023 08:10:47 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=96319700ac4551c0bbc059531acba01eed4b981f;p=ses.git tmp --- diff --git a/ses_layout.c b/ses_layout.c index 7891926..d8fd65f 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1,6 +1,8 @@ #include #include"ses_core.h" +#define N_PINS 4 + int epin_cmp(const void* v0, const void* v1) { const uint64_t* t0 = v0; @@ -362,7 +364,7 @@ int ses_lines_diff_components(ScfEfunction* f, ses_graph_t* graph) for (i = 0; i + 1 < f->n_elines; i++) { el0 = f->elines[i]; - if (el0->n_pins <= 4) + if (el0->n_pins <= N_PINS) continue; v0 = ses_vertex_add(graph, el0); @@ -372,7 +374,7 @@ int ses_lines_diff_components(ScfEfunction* f, ses_graph_t* graph) for (j = i + 1; j < f->n_elines; j++) { el1 = f->elines[j]; - if (el1->n_pins <= 4) + if (el1->n_pins <= N_PINS) continue; for (k = 0; k < el0->n_conns; k++) { @@ -426,6 +428,7 @@ static int __ses_layout_lines3(ScfEfunction* f) intptr_t N = 2; intptr_t i; intptr_t j; + intptr_t k; scf_loge("\n"); ses_lines_diff_components(f, graph); @@ -436,6 +439,7 @@ static int __ses_layout_lines3(ScfEfunction* f) N = v->edges->size; } + for (j = N; j >= 0; j--) { for (i = 1; i <= j; i++) @@ -471,6 +475,7 @@ static int __ses_layout_lines3(ScfEfunction* f) printf("\n"); } + k = 0; for (j = 0; j < colors->size; j++) { for (i = 0; i < graph->size; i++) { @@ -478,12 +483,29 @@ static int __ses_layout_lines3(ScfEfunction* f) el = v->data; - if (j == el->color) + if (j == el->color) { scf_logi("j: %ld, l%ld->color: %ld\n", j, el->id, el->color); + + if (el == f->elines[k]) { + k++; + continue; + } + + N = __ses_find_eline_index(f, el->id); + + SCF_XCHG(f->elines[k], f->elines[N]); + k++; + } } printf("\n"); } + for (i = 0; i < f->n_elines; i++) { + el = f->elines[i]; + + scf_logw("el: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", el->id, el->n_conns, el->n_pins, el->flags); + } + scf_vector_clear(graph, ( void (*)(void*) )ses_vertex_free); scf_vector_free(graph); scf_vector_free(colors); @@ -498,141 +520,48 @@ static int __ses_layout_lines2(ScfEfunction* f) size_t i; size_t j; - size_t k0; - size_t k1; + size_t m; if (f->n_elines <= 2) return 0; __ses_layout_lines3(f); - size_t m; - size_t n; - - el0 = f->elines[0]; - m = f->n_elines >> 1; - - f->elines[0] = f->elines[m]; - f->elines[m] = el0; - el0->n_lines = 1; - - for (i = 0; i < el0->n_conns && i < 2; i++) { - ec = el0->conns[i]; - - j = __ses_find_eline_index(f, ec->lid); - el1 = f->elines[j]; - - n = m + (i << 1) - 1; - - f->elines[j] = f->elines[n]; - f->elines[n] = el1; - el1->n_lines = 1; - } - - for (n = m - 1; n > 0; n--) { - el0 = f->elines[n]; - - el0->n_lines = 1; - - if (0 == el0->n_conns) - continue; - - for (i = 0; i < el0->n_conns; i++) { - ec = el0->conns[i]; - - j = __ses_find_eline_index(f, ec->lid); - el1 = f->elines[j]; - - if (0 == el1->n_lines) - break; - } - - if (i == el0->n_conns) - continue; - - f->elines[j ] = f->elines[n - 1]; - f->elines[n - 1] = el1; - el1->n_lines = 1; - } - - for (n = m + 1; n < f->n_elines - 1; n++) { - el0 = f->elines[n]; - - el0->n_lines = 1; - - if (0 == el0->n_conns) - continue; - - for (i = 0; i < el0->n_conns; i++) { - ec = el0->conns[i]; - - j = __ses_find_eline_index(f, ec->lid); - el1 = f->elines[j]; - - if (0 == el1->n_lines) - break; - } - - if (i == el0->n_conns) - continue; - - f->elines[j ] = f->elines[n + 1]; - f->elines[n + 1] = el1; - el1->n_lines = 1; - } - #if 1 - size_t N_PINS = 0; - for (i = 0; i < f->n_elines; i++) { el0 = f->elines[i]; - if (N_PINS < el0->n_pins) - N_PINS = el0->n_pins; - } - - scf_loge("N_PINS: %ld\n", N_PINS); - - N_PINS = N_PINS < 8 ? 8 : N_PINS; - - for (n = 0; n < N_PINS / 2 - 2; n++) { - - for (i = 0; i < f->n_elines; i++) { - el0 = f->elines[i]; - - if (el0->n_pins > N_PINS / 2 - n) - continue; + if (el0->n_pins > N_PINS) + continue; - for (j = i + 1; j < f->n_elines; j++) - f->elines[j - 1] = f->elines[j]; + for (j = i + 1; j < f->n_elines; j++) + f->elines[j - 1] = f->elines[j]; - j = __ses_find_eline_index(f, el0->conns[0]->lid); + j = __ses_find_eline_index(f, el0->conns[0]->lid); - if (el0->n_conns > 1) { - m = __ses_find_eline_index(f, el0->conns[1]->lid); + if (el0->n_conns > 1) { + m = __ses_find_eline_index(f, el0->conns[1]->lid); - if (j > m) - SCF_XCHG(j, m); + if (j > m) + SCF_XCHG(j, m); - el1 = f->elines[j]; - ++j; - } else if (j > f->n_elines / 2) { - el1 = f->elines[j]; - ++j; - } else - el1 = f->elines[j]; + el1 = f->elines[j]; + ++j; + } else if (j > f->n_elines / 2) { + el1 = f->elines[j]; + ++j; + } else + el1 = f->elines[j]; - for (m = f->n_elines - 1; m > j; m--) - f->elines[m] = f->elines[m - 1]; + for (m = f->n_elines - 1; m > j; m--) + f->elines[m] = f->elines[m - 1]; - f->elines[j] = el0; + f->elines[j] = el0; - if (j == i) - continue; + if (j == i) + continue; - scf_loge("n: %ld, mov el%ld [%ld] --> [%ld] el%ld\n", N_PINS / 2 - n, el0->id, i, j, el1->id); - } - printf("\n"); + scf_loge("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, j, el1->id); } #endif @@ -1468,9 +1397,8 @@ int ses_layout_function(ScfEfunction* f, int d) qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); -// ses_cross(f, d); - __ses_de_cross(f, d); + ses_cross(f, d); __ses_setc_xy(f, d); __ses_xchg_cx(f, d);