ses_layout_function()
authoryu.dongliang <18588496441@163.com>
Tue, 17 Oct 2023 07:56:20 +0000 (15:56 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 17 Oct 2023 07:56:20 +0000 (15:56 +0800)
ses_layout.c

index 548723e3cb5333c00e0bece6b4702f6f6b4f52b0..32224d56cbd1fdf2f7beddd665777fdcabddefda 100644 (file)
@@ -818,11 +818,12 @@ int ses_layout_function(ScfEfunction* f, int d)
                c->y = cy / 2;
        }
 
+       int tx0 = INT_MAX;
+       int tx1 = 0;
+
        for (i = 0; i < f->n_elines; i++) {
                el        = f->elines[i];
 
-               int x0 = INT_MAX;
-               int x1 = 0;
                int cx = 0;
 
                qsort_r(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp_cx, f);
@@ -846,15 +847,25 @@ int ses_layout_function(ScfEfunction* f, int d)
                                else
                                        p1->x += c->x - tmp;
 
-                               el2 = f->elines[p1->lid];
-
-                               if (el2->lines[0]->x1 < p1->x) {
-                                       el2->lines[0]->x1 = p1->x;
+                               if (tx0 > p1->x)
+                                       tx0 = p1->x;
 
-                                       if (f->w < p1->x)
-                                               f->w = p1->x;
-                               }
+                               if (tx1 < p1->x)
+                                       tx1 = p1->x;
                        }
+               }
+       }
+
+       for (i = 0; i < f->n_elines; i++) {
+               el        = f->elines[i];
+
+               int x0 = INT_MAX;
+               int x1 = 0;
+
+               for (j = 0; j < el->n_pins; j += 2) {
+
+                       c  = f->components[el->pins[j]];
+                       p0 = c->pins      [el->pins[j + 1]];
 
                        if (x0 > p0->x)
                                x0 = p0->x;
@@ -863,17 +874,25 @@ int ses_layout_function(ScfEfunction* f, int d)
                                x1 = p0->x;
                }
 
-               el->lines[0]->x0 = x0;
-               el->lines[0]->x1 = x1;
+               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;
 
-               if (f->w < x1)
-                       f->w = x1;
+               for (j = 0; j < c->n_pins; j++) {
+                       p0        = c->pins[j];
+                       p0->x    -= tx0 - d;
+               }
        }
 
-       f->w += d;
+       f->w  = tx1 - tx0 + 2 * d;
        f->h += d;
 
-       scf_loge("f->x: %d, y: %d, w: %d, h: %d\n", f->x, f->y, f->w, f->h);
+       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);
 
        return 0;
 }