ses_layout_function()
authoryu.dongliang <18588496441@163.com>
Mon, 16 Oct 2023 17:10:17 +0000 (01:10 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 16 Oct 2023 17:10:17 +0000 (01:10 +0800)
ses_layout.c

index d9ecdb2ad822127c93ec82d9320f73d214080b88..548723e3cb5333c00e0bece6b4702f6f6b4f52b0 100644 (file)
@@ -483,8 +483,8 @@ static void __ses_layout_components(ScfEfunction* f, int d)
                                p0 = c->pins[el0->pins[m + 1]];
                                p1 = c->pins[el1->pins[n + 1]];
 
-                               p0->x = el0->lines[0]->x1 + j * d + 10 + rand() % d;
-                               p1->x = el1->lines[0]->x1 + j * d + 10 + rand() % d;
+                               p0->x = el0->lines[0]->x1 + j * d + 10 + rand() % 20;
+                               p1->x = el1->lines[0]->x1 + j * d + 10 + rand() % 20;
                                p0->y = el0->lines[0]->y0;
                                p1->y = el1->lines[0]->y0;
 
@@ -514,7 +514,7 @@ static void __ses_layout_components(ScfEfunction* f, int d)
 
                        if (0 == p0->x) {
 
-                               p0->x = el0->lines[0]->x1 + d + 10 + rand() % d;
+                               p0->x = el0->lines[0]->x1 + d + 10 + rand() % 20;
                                p0->y = el0->lines[0]->y1;
 
                                el0->lines[0]->x1 = p0->x;
@@ -738,6 +738,7 @@ int ses_layout_function(ScfEfunction* f, int d)
 {
        ScfEcomponent* c;
        ScfEline*      el;
+       ScfEline*      el2;
        ScfEpin*       p0;
        ScfEpin*       p1;
 
@@ -838,10 +839,21 @@ int ses_layout_function(ScfEfunction* f, int d)
                        cx = c->x;
 
                        for (k = 0; k < c->n_pins; k++) {
+                               p1 =        c->pins[k];
+
                                if (k < 2)
-                                       c->pins[k]->x  = c->x;
+                                       p1->x  = c->x;
                                else
-                                       c->pins[k]->x += c->x - tmp;
+                                       p1->x += c->x - tmp;
+
+                               el2 = f->elines[p1->lid];
+
+                               if (el2->lines[0]->x1 < p1->x) {
+                                       el2->lines[0]->x1 = p1->x;
+
+                                       if (f->w < p1->x)
+                                               f->w = p1->x;
+                               }
                        }
 
                        if (x0 > p0->x)
@@ -853,9 +865,12 @@ int ses_layout_function(ScfEfunction* f, int d)
 
                el->lines[0]->x0 = x0;
                el->lines[0]->x1 = x1;
+
+               if (f->w < x1)
+                       f->w = x1;
        }
 
-       f->w -= mx - 3 * d + px - nx;
+       f->w += d;
        f->h += d;
 
        scf_loge("f->x: %d, y: %d, w: %d, h: %d\n", f->x, f->y, f->w, f->h);