__ses_layout_path()
authoryu.dongliang <18588496441@163.com>
Wed, 8 Nov 2023 04:08:01 +0000 (12:08 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 8 Nov 2023 04:08:01 +0000 (12:08 +0800)
ses_layout.c

index 1bdcfa7f812a601b18281cb6a8be064e04e074ba..ccfe5c13dc54fc6d19eac5d8f74a0307199c08f6 100644 (file)
@@ -558,7 +558,7 @@ static inline void eline_mov_before(ScfEfunction* f, intptr_t dst, intptr_t src)
 
 int _topo_print(scf_vector_t* paths);
 
-static int __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* base)
+static void __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* base)
 {
        ScfEcomponent* c;
        ScfEline*      el;
@@ -575,7 +575,7 @@ static int __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* base
        bp  = base->pins->data[base->pins->size - 1];
        __n = __ses_find_eline_index(f, bp->lid);
 
-       scf_logd("path: %d, __n: %ld, l%ld\n", path->index, __n, f->elines[__n]->id);
+       scf_logw("path: %d, __n: %ld, l%ld\n", path->index, __n, f->elines[__n]->id);
 
        for (j = path->pins->size - 1; j > 0; j -= 2) {
                p  = path->pins->data[j];
@@ -644,6 +644,27 @@ static int __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* base
 
                eline_mov_before(f, __n, n);
        }
+       printf("\n");
+
+       base = path;
+
+       if (base->childs) {
+               for (j = 0; j < base->childs->size; j++) {
+                       path      = base->childs->data[j];
+
+                       __ses_layout_path(f, path, base);
+               }
+       }
+
+       if (base->bridges) {
+               for (j = 0; j < base->bridges->size; j++) {
+                       path      = base->bridges->data[j];
+
+                       __ses_layout_path(f, path, base);
+               }
+       }
+
+       scf_loge("path: %d\n\n", path->index);
 }
 
 static int __ses_layout_lines4(ScfEfunction* f)
@@ -653,13 +674,9 @@ static int __ses_layout_lines4(ScfEfunction* f)
        ses_path_t*    path;
 
        ScfEcomponent* B;
-       ScfEcomponent* c;
        ScfEline*      el;
        ScfEpin*       Bp;
-       ScfEpin*       Bn;
        ScfEpin*       p;
-       ScfEpin*       pc;
-       ScfEpin*       pe;
 
        intptr_t i;
        intptr_t j;
@@ -681,7 +698,6 @@ static int __ses_layout_lines4(ScfEfunction* f)
 
        B  = f->components[0];
        Bp = B->pins[SCF_EDA_Battery_POS];
-       Bn = B->pins[SCF_EDA_Battery_NEG];
 
        for (i = 0; i < paths->size; i++) {
                base      = paths->data[i];
@@ -698,12 +714,15 @@ static int __ses_layout_lines4(ScfEfunction* f)
                p  =        base->pins->data[j];
 
                n  = __ses_find_eline_index(f, p->lid);
+
                SCF_XCHG(f->elines[n], f->elines[j / 2]);
        }
 
        p = base->pins->data[j - 1];
        n = __ses_find_eline_index(f, p->lid);
+
        SCF_XCHG(f->elines[n], f->elines[j / 2 + 1]);
+
        scf_logd("j: %ld, l%ld\n", j / 2 + 1, f->elines[j / 2 + 1]->id);
 
        for (i = 0; i < paths->size; i++) {