tmp
authoryu.dongliang <18588496441@163.com>
Tue, 31 Oct 2023 06:46:32 +0000 (14:46 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 31 Oct 2023 06:46:32 +0000 (14:46 +0800)
ses_layout.c

index f6059857c23cace2b2cd141f6d26313eba31e85d..af6da6dbde7999ed6f7e8df8b80ed0ee974ddba2 100644 (file)
@@ -828,14 +828,33 @@ static void __ses_de_cross(ScfEfunction* f, int d)
                                        }
                                }
                        }
-
-                       __ses_flip_pos(c0);
                }
+
+               __ses_flip_pos(c0);
 next:
                c0 = NULL;
        }
 }
 
+static void __ses_set_cx(ScfEfunction* f, int d)
+{
+       ScfEcomponent* c;
+       ScfEpin*       p0;
+       ScfEpin*       p1;
+
+       size_t i;
+
+       for (i = 0; i < f->n_components; i++) {
+               c  =        f->components[i];
+
+               p0 = c->pins[0];
+               p1 = c->pins[1];
+
+               c->x = (p0->x + p1->x) / 2;
+               c->y = (p0->y + p1->y) / 2;
+       }
+}
+
 static inline void __ses_xchg_cx2(ScfEcomponent* c0, ScfEcomponent* c1)
 {
        ScfEpin* p;
@@ -929,7 +948,6 @@ static void __ses_layout_cx(ScfEfunction* f, int d)
        ScfEcomponent* c;
        ScfEcomponent* c2;
        ScfEline*      el;
-       ScfEline*      el2;
        ScfEpin*       p0;
        ScfEpin*       p1;
 
@@ -937,16 +955,6 @@ static void __ses_layout_cx(ScfEfunction* f, int d)
        size_t j;
        size_t k;
 
-       for (i = 0; i < f->n_components; i++) {
-               c  =        f->components[i];
-
-               p0 = c->pins[0];
-               p1 = c->pins[1];
-
-               c->x = (p0->x + p1->x) / 2;
-               c->y = (p0->y + p1->y) / 2;
-       }
-
        for (i = 0; i < f->n_elines; i++) {
                el        = f->elines[i];
 
@@ -997,8 +1005,10 @@ static void __ses_layout_cx(ScfEfunction* f, int d)
                        if (k < 2)
                                p1->x  = c->x;
                        else
-                               p1->x +=  c->x - tmp;
+                               p1->x += c->x - tmp;
                }
+
+               scf_logi("c%ld->x: %d\n", c->id, c->x);
        }
        qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
 }
@@ -1073,13 +1083,15 @@ int ses_layout_function(ScfEfunction* f, int d)
 
        qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
 
-       __ses_de_cross (f, d);
+       __ses_de_cross(f, d);
 
-       __ses_layout_cx(f, d);
-       __ses_xchg_cx  (f, d);
+       __ses_set_cx (f, d);
+       __ses_xchg_cx(f, d);
 
        __ses_xchg_npn_ce(f, d);
 
+       __ses_layout_cx(f, d);
+
        int mx = 0;
        int nx = INT_MIN;
        int px = INT_MAX;