__ses_layout_cx()
authoryu.dongliang <18588496441@163.com>
Tue, 31 Oct 2023 07:33:24 +0000 (15:33 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 31 Oct 2023 07:33:24 +0000 (15:33 +0800)
ses_layout.c

index c724502844ad8c701fdd96d4789a6e4fe94569e9..680354f5c807f82d8e9a742b44e7db4bf27108d6 100644 (file)
@@ -956,45 +956,13 @@ static void __ses_layout_cx(ScfEfunction* f, int d)
 {
        ScfEcomponent* c;
        ScfEcomponent* c2;
-       ScfEline*      el;
-       ScfEpin*       p0;
-       ScfEpin*       p1;
+       ScfEpin*       p;
+       ScfEpin*       p2;
 
        size_t i;
        size_t j;
        size_t k;
 
-       for (i = 0; i < f->n_elines; i++) {
-               el        = f->elines[i];
-
-               int cx = 0;
-
-               qsort_r(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp_cx, f);
-
-               for (j = 0; j < el->n_pins; j += 2) {
-
-                       c  = f->components[el->pins[j]];
-                       p0 = c->pins      [el->pins[j + 1]];
-
-                       int tmp = c->x;
-
-                       if (j > 0) {
-                               if (c->x < cx + d)
-                                       c->x = cx + d;
-                       }
-                       cx = c->x;
-
-                       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_cx);
        for (i = 1; i < f->n_components; i++) {
                c  =        f->components[i];
@@ -1002,22 +970,32 @@ static void __ses_layout_cx(ScfEfunction* f, int d)
 
                int tmp = c->x;
 
-               if (c->x > c2->x + d)
-                       c->x = c2->x + d;
+               for (j = 0; j < c->n_pins; j++) {
+                       p  =        c->pins[j];
+
+                       for (k = 0; k < c2->n_pins; k++) {
+                               p2 =        c2->pins[k];
+
+                               if (p->lid == p2->lid) {
+                                       c->x = c2->x + d;
+                                       goto _set_px;
+                               }
+                       }
+               }
 
-               if (c->x < c2->x + d / 2)
-                       c->x = c2->x + d / 2;
+               c->x = c2->x + d / 2;
 
+_set_px:
                for (k = 0; k < c->n_pins; k++) {
-                       p1 =        c->pins[k];
+                       p  =        c->pins[k];
 
                        if (k < 2)
-                               p1->x  = c->x;
+                               p->x  = c->x;
                        else
-                               p1->x += c->x - tmp;
+                               p->x += c->x - tmp;
                }
 
-               scf_logi("c%ld->x: %d\n", c->id, c->x);
+               scf_logd("c%ld->x: %d\n", c->id, c->x);
        }
        qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
 }
@@ -1157,7 +1135,7 @@ int ses_layout_function(ScfEfunction* f, int d)
        __ses_xchg_cx(f, d);
        __ses_xchg_ce(f, d);
        __ses_mov_pos(f, d);
-//     __ses_layout_cx(f, d);
+       __ses_layout_cx(f, d);
 
        int tx0 = INT_MAX;
        int tx1 = 0;