__ses_de_cross()
authoryu.dongliang <18588496441@163.com>
Mon, 6 Nov 2023 05:56:04 +0000 (13:56 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 6 Nov 2023 05:56:04 +0000 (13:56 +0800)
ses_layout.c

index 82393580aaf37fb579268afed4f28cc4f3a879e1..bf2ddf5c722cd0b25e70131a78cf569a4fb3548d 100644 (file)
@@ -610,7 +610,7 @@ static int __ses_layout_lines(ScfEfunction* f, int d)
                if (!l)
                        return -ENOMEM;
 
-               l->x0 = d * abs(i - f->n_elines / 2);
+               l->x0 = d;
                l->x1 = d + l->x0;
                l->y0 = d + i * d;
                l->y1 = l->y0;
@@ -943,6 +943,7 @@ static int __ses_de_cross(ScfEfunction* f, int d)
        intptr_t N = 2;
        intptr_t i;
        intptr_t j;
+       intptr_t k;
 
        int ret = __ses_get_crosses(f, d, graph);
        if (ret < 0)
@@ -994,32 +995,30 @@ static int __ses_de_cross(ScfEfunction* f, int d)
        colors = NULL;
        graph  = NULL;
 
-       for (i = 0; i < f->n_elines; i++) {
-               el =        f->elines[i];
+       int x1 = 0;
 
-               qsort_r(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp_color, f);
+       N = j + 1;
 
-               el->lines[0]->x1 = el->lines[0]->x0 + d;
+       for (j = 1; j <= N; j++) {
 
-               for (j = 0; j + 1 < el->n_pins; j += 2) {
+               intptr_t j0 = (j - 1) / 2;
+               intptr_t j1 = (j - 1) % 2;
 
-                       c  = f->components[el->pins[j]];
-                       p  = c->pins      [el->pins[j + 1]];
-
-                       intptr_t k = (c->color - 1) / 2;
-                       intptr_t m = (c->color - 1) % 2;
+               for (i = 0; i < f->n_elines; i++) {
+                       el =        f->elines[i];
 
-                       while (el->n_lines <= k) {
+                       if (0 == j0)
+                               el->lines[0]->x1 = el->lines[0]->x0;
 
-                               scf_logw("el->n_lines: %ld, k: %ld\n", el->n_lines, k);
+                       else if (el->n_lines <= j0) {
 
-                               l0 = el->lines[el->n_lines - 1];
+                               l0 = el->lines[0];
 
                                l = malloc(sizeof(ScfLine));
                                if (!l)
                                        return -ENOMEM;
 
-                               l->x0 = l0->x1 + d;
+                               l->x0 = x1 + d;
                                l->x1 = l->x0;
                                l->y0 = l0->y0;
                                l->y1 = l0->y1;
@@ -1030,9 +1029,21 @@ static int __ses_de_cross(ScfEfunction* f, int d)
                                }
                        }
 
-                       l     = el->lines[k];
-                       p->x  = l->x1 + d;
-                       l->x1 = p->x;
+                       for (k = 0; k + 1 < el->n_pins; k += 2) {
+
+                               c  = f->components[el->pins[k]];
+                               p  = c->pins      [el->pins[k + 1]];
+
+                               if ((c->color - 1) / 2 != j0)
+                                       continue;
+
+                               l     = el->lines[j0];
+                               p->x  = l->x1 + d;
+                               l->x1 = p->x;
+
+                               if (x1 < l->x1)
+                                       x1 = l->x1;
+                       }
                }
        }