From a419f01f716d1a257cc913ff23fe4afaeb300399 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sat, 11 Nov 2023 19:54:21 +0800 Subject: [PATCH] Revert "__ses_de_cross()" This reverts commit 1fc3497fad908b35f1a2653a83424086e0ce5b99. --- ses_layout.c | 85 ++++------------------------------------------------ 1 file changed, 5 insertions(+), 80 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index c279985..4c17f1f 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1133,46 +1133,6 @@ next: return 0; } -static void decross_mov_before(ScfEfunction* f, int d, intptr_t dst, intptr_t src) -{ - ScfEcomponent* c; - ScfEline* el; - ScfEpin* p; - ScfLine* l; - - intptr_t i; - intptr_t j; - intptr_t k; - - intptr_t min = dst < src ? dst : src; - intptr_t max = dst > src ? dst : src; - - int y0 = f->elines[min]->lines[0]->y0; - - eline_mov_before(f, dst, src); - - for (i = min; i <= max; i++) { - el = f->elines[i]; - - int y = y0 + (i - min) * d; - - for (j = 0; j < el->n_lines; j++) { - l = el->lines[j]; - - l->y0 = y; - l->y1 = y; - } - - for (j = 0; j + 1 < el->n_pins; j += 2) { - - c = f->components[el->pins[j]]; - p = c->pins [el->pins[j + 1]]; - - p->y = y; - } - } -} - static int __ses_de_cross(ScfEfunction* f, int d) { ScfEcomponent* c; @@ -1213,8 +1173,7 @@ static int __ses_de_cross(ScfEfunction* f, int d) for (j = 1; j <= N; j++) scf_vector_add(colors, (void*)j); - int try = 0; - for (j = N; j >= 2; ) { + for (j = N; j >= 2; j--) { int ret = ses_graph_kcolor(graph, j, colors); if (ret < 0) { @@ -1232,41 +1191,8 @@ static int __ses_de_cross(ScfEfunction* f, int d) } } - if (n > 0) { - if (try > 0) - break; - - ScfEcomponent* max = NULL; - - for (i = 0; i < graph->size; i++) { - v = graph->data[i]; - - c = v->data; - if (v->color < 0 && SCF_EDA_NPN == c->type) { - - if (!max || max->color < c->color) - max = c; - } - - v->color = 0; - } - - i = __ses_find_eline_index(f, max->pins[SCF_EDA_NPN_B]->lid); - k = __ses_find_eline_index(f, max->pins[SCF_EDA_NPN_C]->lid); - - scf_logw("mov c%ld: el%ld [%ld] --> [%ld] el%ld\n\n", max->id, f->elines[k]->id, k, i, f->elines[i]->id); - - decross_mov_before(f, d, i, k); - - scf_vector_clear(graph, ( void (*)(void*) )ses_vertex_free); - - ret = __ses_get_crosses(f, d, graph); - if (ret < 0) - return ret; - - try++; - continue; - } + if (n > 0) + break; for (i = 0; i < graph->size; i++) { v = graph->data[i]; @@ -1277,7 +1203,6 @@ static int __ses_de_cross(ScfEfunction* f, int d) } scf_vector_del(colors, (void*)j); - j--; } scf_vector_clear(graph, ( void (*)(void*) )ses_vertex_free); @@ -1681,12 +1606,12 @@ int ses_layout_function(ScfEfunction* f, int d) __ses_layout_components(f, d); __ses_xchg_components(f, d); + qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); + ret = __ses_de_cross(f, d); if (ret < 0) return ret; - qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); - __ses_setc_xy(f, d); __ses_layout_cx(f, d); -- 2.25.1