__ses_layout_lines3()
authoryu.dongliang <18588496441@163.com>
Sat, 4 Nov 2023 09:48:10 +0000 (17:48 +0800)
committeryu.dongliang <18588496441@163.com>
Sat, 4 Nov 2023 09:48:10 +0000 (17:48 +0800)
ses_layout.c

index d8fd65fe2ce269708f8ffbc287ec2fb068e6d700..f42d81c21f7c8b956bce3126b88afae0b6ca5633 100644 (file)
@@ -1,8 +1,6 @@
 #include<cairo/cairo.h>
 #include"ses_core.h"
 
-#define N_PINS 4
-
 int epin_cmp(const void* v0, const void* v1)
 {
        const uint64_t* t0 = v0;
@@ -364,7 +362,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 <= N_PINS)
+               if (el0->n_conns <= 1)
                        continue;
 
                v0 = ses_vertex_add(graph, el0);
@@ -374,7 +372,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 <= N_PINS)
+                       if (el1->n_conns <= 1)
                                continue;
 
                        for (k = 0; k < el0->n_conns; k++) {
@@ -440,7 +438,7 @@ static int __ses_layout_lines3(ScfEfunction* f)
        }
 
 
-       for (j = N; j >= 0; j--) {
+       for (j = N; j >= 1; j--) {
 
                for (i = 1; i <= j; i++)
                        scf_vector_add(colors, (void*)i);
@@ -476,7 +474,7 @@ static int __ses_layout_lines3(ScfEfunction* f)
        }
 
        k = 0;
-       for (j = 0; j < colors->size; j++) {
+       for (++j; j >= 1; j--) {
 
                for (i = 0; i < graph->size; i++) {
                        v         = graph->data[i];
@@ -531,27 +529,16 @@ static int __ses_layout_lines2(ScfEfunction* f)
        for (i = 0; i < f->n_elines; i++) {
                el0       = f->elines[i];
 
-               if (el0->n_pins > N_PINS)
+               if (el0->n_conns > 1)
                        continue;
+               assert(1 == el0->n_conns);
 
                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);
 
-               if (el0->n_conns > 1) {
-                       m = __ses_find_eline_index(f, el0->conns[1]->lid);
-
-                       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];
 
                for (m = f->n_elines - 1; m > j; m--)
                        f->elines[m] = f->elines[m - 1];
@@ -1397,8 +1384,9 @@ 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);