__ses_layout_components()
authoryu.dongliang <18588496441@163.com>
Tue, 17 Oct 2023 12:21:17 +0000 (20:21 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 17 Oct 2023 12:21:17 +0000 (20:21 +0800)
ses_layout.c

index c09d7f007c5e32dd4a78f0d70c9a51df23df3d41..35f0c33c6ab8069216bdeeafd47daae664cf43ec 100644 (file)
@@ -840,32 +840,6 @@ int ses_layout_function(ScfEfunction* f, int d)
                c->y = cy / 2;
        }
 
-       int tx0 = INT_MAX;
-       int tx1 = 0;
-
-       qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_cx);
-
-       for (i = 1; i < f->n_components; i++) {
-               c  =        f->components[i];
-               c2 =        f->components[i - 1];
-
-               int tmp = c->x;
-
-               if (c->x > c2->x + d)
-                       c->x = c2->x + d;
-
-               for (k = 0; k < c->n_pins; k++) {
-                       p1 =        c->pins[k];
-
-                       if (k < 2)
-                               p1->x  = c->x;
-                       else
-                               p1->x += c->x - tmp;
-               }
-       }
-
-       qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
-
        for (i = 0; i < f->n_elines; i++) {
                el        = f->elines[i];
 
@@ -891,15 +865,42 @@ int ses_layout_function(ScfEfunction* f, int d)
                                        p1->x  = c->x;
                                else
                                        p1->x += c->x - tmp;
+                       }
+               }
+       }
 
-                               if (tx0 > p1->x)
-                                       tx0 = p1->x;
+       int tx0 = INT_MAX;
+       int tx1 = 0;
 
-                               if (tx1 < p1->x)
-                                       tx1 = p1->x;
-                       }
+       qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_cx);
+       for (i = 1; i < f->n_components; i++) {
+               c  =        f->components[i];
+               c2 =        f->components[i - 1];
+
+               int tmp = c->x;
+
+               if (c->x > c2->x + d)
+                       c->x = c2->x + d;
+
+               if (c->x < c2->x + d / 2)
+                       c->x = c2->x + d / 2;
+
+               for (k = 0; k < c->n_pins; k++) {
+                       p1 =        c->pins[k];
+
+                       if (k < 2)
+                               p1->x  = c->x;
+                       else
+                               p1->x += c->x - tmp;
+
+                       if (tx0 > p1->x)
+                               tx0 = p1->x;
+
+                       if (tx1 < p1->x)
+                               tx1 = p1->x;
                }
        }
+       qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
 
        for (i = 0; i < f->n_elines; i++) {
                el        = f->elines[i];
@@ -919,22 +920,11 @@ int ses_layout_function(ScfEfunction* f, int d)
                                x1 = p0->x;
                }
 
-               el->lines[0]->x0 = x0 - tx0 + d;
-               el->lines[0]->x1 = x1 - tx0 + d;
-       }
-
-       for (i = 0; i < f->n_components; i++) {
-               c  =        f->components[i];
-
-               c->x -= tx0 - d;
-
-               for (j = 0; j < c->n_pins; j++) {
-                       p0        = c->pins[j];
-                       p0->x    -= tx0 - d;
-               }
+               el->lines[0]->x0 = x0;
+               el->lines[0]->x1 = x1;
        }
 
-       f->w  = tx1 - tx0 + 2 * d;
+       f->w  = tx1 + d;
        f->h += d;
 
        scf_loge("f->x: %d, y: %d, w: %d, h: %d, tx0: %d, tx1: %d\n", f->x, f->y, f->w, f->h, tx0, tx1);