tmp
authoryu.dongliang <18588496441@163.com>
Mon, 30 Oct 2023 08:31:33 +0000 (16:31 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 30 Oct 2023 08:31:33 +0000 (16:31 +0800)
ses_layout.c

index c2e79ab0b945b27a6180eef23d1984162422c0f1..32d7939c81ac6035d6853dab1870cd178a2afb9a 100644 (file)
@@ -230,7 +230,7 @@ next:
                el->c_pins = el->n_pins;
                el->id     = i;
 
-               scf_loge("line i: %ld, %p, el->flags: %#lx\n", i, el, el->flags);
+               scf_logd("line i: %ld, %p, el->flags: %#lx\n", i, el, el->flags);
 
                for (j = 0; j + 1 < el->n_pins; j += 2) {
 
@@ -240,9 +240,8 @@ next:
                        p->lid   = i;
                        p->c_lid = i;
 
-                       scf_logi("pin j: %ld, c%ldp%ld\n", j, el->pins[j], el->pins[j + 1]);
+                       scf_logd("pin j: %ld, c%ldp%ld\n", j, el->pins[j], el->pins[j + 1]);
                }
-               printf("\n");
 
                i++;
        }
@@ -422,41 +421,55 @@ int ses_lines_same_components(ScfEfunction* f)
        }
 
 #if 1
-       for (i = 0; i < f->n_elines; i++) {
-               el0       = f->elines[i];
+       k0 = INT_MAX;
 
-               if (el0->n_pins > 4)
-                       continue;
+       while (1) {
+               k1 = 0;
 
-               for (j = i + 1; j < f->n_elines; j++)
-                       f->elines[j - 1] = f->elines[j];
+               for (i = 0; i < f->n_elines; i++) {
+                       el0       = f->elines[i];
 
-               j = __ses_find_eline_index(f, el0->conns[0]->lid);
+                       if (el0->n_pins > 4)
+                               continue;
 
-               if (el0->n_conns > 1) {
-                       m = __ses_find_eline_index(f, el0->conns[1]->lid);
+                       for (j = i + 1; j < f->n_elines; j++)
+                               f->elines[j - 1] = f->elines[j];
 
-                       if (j > m)
-                               SCF_XCHG(j, m);
+                       j = __ses_find_eline_index(f, el0->conns[0]->lid);
 
-                       el1 = f->elines[j];
-                       ++j;
-               } else if (j > f->n_elines / 2) {
-                       el1 = f->elines[j];
-                       ++j;
-               } else {
-                       el1 = f->elines[j];
-               }
+                       if (el0->n_conns > 1) {
+                               m = __ses_find_eline_index(f, el0->conns[1]->lid);
+
+                               if (j > m)
+                                       SCF_XCHG(j, m);
+
+                               el1 = f->elines[j];
+                               ++j;
+                       } else if (j > f->n_elines / 2) {
+                               el1 = f->elines[j];
+                               ++j;
+                       } else {
+                               el1 = f->elines[j];
+                       }
 
-               for (n = f->n_elines - 1; n > j; n--)
-                       f->elines[n] = f->elines[n - 1];
+                       for (n = f->n_elines - 1; n > j; n--)
+                               f->elines[n] = f->elines[n - 1];
 
-               f->elines[j] = el0;
+                       f->elines[j] = el0;
 
-               if (j == i)
-                       continue;
+                       if (j == i)
+                               continue;
+
+                       k1++;
 
-               scf_loge("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, j, el1->id);
+                       scf_loge("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, j, el1->id);
+               }
+               printf("\n");
+
+               if (k0 <= k1)
+                       break;
+
+               k0 = k1;
        }
 #endif
 
@@ -466,14 +479,13 @@ int ses_lines_same_components(ScfEfunction* f)
 
                el0->n_lines = 0;
 
-               scf_logw("el0: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", el0->id, el0->n_conns, el0->n_pins, el0->flags);
+               scf_logd("el0: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", el0->id, el0->n_conns, el0->n_pins, el0->flags);
 
                for (j = 0; j < el0->n_conns; j++) {
                        ec        = el0->conns[j];
 
-                       scf_logi("j: %ld, lid: %ld, n_cids: %ld, cid[0]: %ld\n", j, ec->lid, ec->n_cids, ec->cids[0]);
+                       scf_logd("j: %ld, lid: %ld, n_cids: %ld, cid[0]: %ld\n", j, ec->lid, ec->n_cids, ec->cids[0]);
                }
-               printf("\n");
        }
 #endif
 
@@ -945,7 +957,7 @@ int ses_layout_function(ScfEfunction* f, int d)
                                p1->x  = c->x;
                        else {
                                p1->x +=  c->x - tmp;
-                               p1->x  = (c->x * 3 + p1->x) / 4;
+//                             p1->x  = (c->x * 3 + p1->x) / 4;
                        }
 
                        if (tx0 > p1->x)