layout
authoryu.dongliang <18588496441@163.com>
Mon, 16 Oct 2023 12:57:26 +0000 (20:57 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 16 Oct 2023 12:57:26 +0000 (20:57 +0800)
ses_layout.c

index 8a9080ee9a79070a30cf82221bb2e77e8c2e2e2b..a66fec122d7ddb7065960e83d75895d5e36ac1ac 100644 (file)
@@ -474,8 +474,8 @@ int ses_layout_function(ScfEfunction* f, int d)
                                p0 = c0->pins[el0->pins[m + 1]];
                                p1 = c0->pins[el1->pins[n + 1]];
 
-                               p0->x = el0->lines[0]->x1 + j * d + rand() % d;
-                               p1->x = el1->lines[0]->x1 + j * d + rand() % d;
+                               p0->x = el0->lines[0]->x1 + j * d + 10 + rand() % d;
+                               p1->x = el1->lines[0]->x1 + j * d + 10 + rand() % d;
                                p0->y = el0->lines[0]->y0;
                                p1->y = el1->lines[0]->y0;
 
@@ -505,7 +505,7 @@ int ses_layout_function(ScfEfunction* f, int d)
 
                        if (0 == p0->x) {
 
-                               p0->x = el0->lines[0]->x1 + d + rand() % d;
+                               p0->x = el0->lines[0]->x1 + d + 10 + rand() % d;
                                p0->y = el0->lines[0]->y1;
 
                                el0->lines[0]->x1 = p0->x;
@@ -541,26 +541,42 @@ int ses_layout_function(ScfEfunction* f, int d)
                                                if (p3 == p2)
                                                        continue;
 
-                                               if (p1->y < p0->y && p3->y < p0->y) {
+                                               if (p1->y < p0->y && p3->y > p0->y)
+                                                       continue;
+                                               if (p1->y > p0->y && p3->y < p0->y)
+                                                       continue;
 
-                                                       if (p0->x > p2->x) {
+                                               if (p1->y == p3->y) {
 
-                                                               if (p1->x < p3->x || p1->y > p3->y)
+                                                       if (p1->x < p3->x) {
+                                                               if (p0->x > p2->x)
                                                                        SCF_XCHG(p0->x, p2->x);
 
-                                                       } else {
-                                                               if (p1->x > p3->x || p1->y < p3->y)
-                                                                       SCF_XCHG(p0->x, p2->x);
-                                                       }
+                                                       } else if (p0->x < p2->x)
+                                                               SCF_XCHG(p0->x, p2->x);
+                                                       continue;
+                                               }
 
-                                               } else if (p1->y > p0->y && p3->y > p0->y) {
+                                               if (p1->y < p0->y) {
 
-                                                       if (p0->x > p2->x) {
-                                                               if (p1->x < p3->x || p1->y < p3->y)
+                                                       if (p1->y < p3->y) {
+                                                               if (p0->x < p2->x)
                                                                        SCF_XCHG(p0->x, p2->x);
-                                                       } else {
-                                                               if (p1->x > p3->x || p1->y > p3->y)
+
+                                                       } else if (p0->x > p2->x)
+                                                               SCF_XCHG(p0->x, p2->x);
+
+                                               } else if (p1->y > p0->y) {
+
+                                                       if (p1->y > p3->y) {
+                                                               if (p0->x < p2->x)
                                                                        SCF_XCHG(p0->x, p2->x);
+
+                                                       } else if (p0->x > p2->x) {
+                                                               SCF_XCHG(p0->x, p2->x);
+                                                               scf_logd("c%ldp%ld-c%ldp%ld->x: %d, c%ldp%ld-c%ldp%ld->x: %d\n\n",
+                                                                               p0->cid, p0->id, p1->cid, p1->id, p0->x,
+                                                                               p2->cid, p2->id, p3->cid, p3->id, p2->x);
                                                        }
                                                }
                                        }
@@ -570,7 +586,7 @@ int ses_layout_function(ScfEfunction* f, int d)
        }
 
        qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
-
+#if 1
        for (i = 0; i < f->n_components - 1; i++) {
                c0 =        f->components[i];
                p0 =        c0->pins[0];
@@ -674,7 +690,7 @@ int ses_layout_function(ScfEfunction* f, int d)
 next:
                c0 = NULL;
        }
-
+#endif
        int mx = 0;
        int nx = INT_MIN;
        int px = INT_MAX;
@@ -735,8 +751,8 @@ next:
 
                        if (j < 2)
                                p0->x = c0->x;
-                       else
-                               p0->x = (c0->x * 3 + p0->x) / 4;
+               //      else
+               //              p0->x = (c0->x * 3 + p0->x) / 4;
                }
        }
 
@@ -1029,7 +1045,7 @@ int ses_layout_board(ScfEboard* b)
                        return ret;
                }
 
-               ses_steps_analyse(f, 5, 1);
+//             ses_steps_analyse(f, 5, 1);
 
                x = f->x;
                y = f->y;