ses line
authoryu.dongliang <18588496441@163.com>
Sun, 16 Jul 2023 08:13:31 +0000 (16:13 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 16 Jul 2023 08:13:31 +0000 (16:13 +0800)
ses_layout.c

index 7943aec4ad10463744f463e92c97b36243aff7db..9281afedd78badcb2524191080ad948d2bc50513 100644 (file)
@@ -387,7 +387,7 @@ int ses_layout_function(ScfEfunction* f, int d)
                if (!l0)
                        return -ENOMEM;
 
-               l0->x0 = d;
+               l0->x0 = 0;
                l0->x1 = d;
                l0->y0 = d + i * d;
                l0->y1 = l0->y0;
@@ -509,6 +509,8 @@ int ses_layout_function(ScfEfunction* f, int d)
                }
        }
 
+       qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
+
        int mx = 0;
 
        for (i = 0; i < f->n_components - 1; i++) {
@@ -557,6 +559,9 @@ int ses_layout_function(ScfEfunction* f, int d)
 
                                                        } else if (y2 < y0 && y0 < y3 && y3 < y1) {
 
+                                                               el0 = f->elines[p2->lid];
+                                                               el1 = f->elines[p3->lid];
+
                                                                if (p2->x > 0) {
                                                                        p2->x = -p2->x;
                                                                        if (mx > p2->x)
@@ -576,27 +581,17 @@ int ses_layout_function(ScfEfunction* f, int d)
                }
        }
 
-       qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
-
        for (i = 0; i < f->n_components; i++) {
                c0 =        f->components[i];
 
-               uint32_t cx = 0;
-               uint32_t cy = 0;
+               int cx = 0;
+               int cy = 0;
 
                for (j = 0; j < c0->n_pins; j++) {
                        p0 =        c0->pins[j];
 
                        p0->x -= mx - d;
 
-                       el0 = f->elines[p0->lid];
-
-                       if (el0->lines[0]->x1 < p0->x)
-                               el0->lines[0]->x1 = p0->x;
-
-                       if (c0->id == 11)
-                               scf_loge("p0->x: %d, p0->lid: %ld, el0->id: %ld, el0->x1: %d\n", p0->x, p0->lid, el0->id, el0->lines[0]->x1);
-
                        cx += p0->x;
                        cy += p0->y;
                }
@@ -605,6 +600,28 @@ int ses_layout_function(ScfEfunction* f, int d)
                c0->y = cy / c0->n_pins;
        }
 
+       for (i = 0; i < f->n_elines; i++) {
+               el0       = f->elines[i];
+
+               int x0 = INT_MAX;
+               int x1 = 0;
+
+               for (j = 0; j < el0->n_pins; j += 2) {
+
+                       c0 = f ->components[el0->pins[j]];
+                       p0 = c0->pins      [el0->pins[j + 1]];
+
+                       if (x0 > p0->x)
+                               x0 = p0->x;
+
+                       if (x1 < p0->x)
+                               x1 = p0->x;
+               }
+
+               el0->lines[0]->x0 = x0;
+               el0->lines[0]->x1 = x1;
+       }
+
        f->w -= mx - d * 2;
        f->h += d;