_topo_path_completes()
authoryu.dongliang <18588496441@163.com>
Sun, 12 Nov 2023 14:47:04 +0000 (22:47 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 12 Nov 2023 14:47:04 +0000 (22:47 +0800)
ses_step_topo.c
ses_steps.c

index cc91f4321e5621e4fc8723e3c71c5b96c6d907f0..caaf14814b0c39c6d9b32db3d6f490ffa9355ac4 100644 (file)
@@ -340,6 +340,8 @@ static int _topo_path_completes(ScfEfunction* f, scf_vector_t* paths)
        ses_path_t*      path0;
        ses_path_t*      path1;
 
+       ScfEcomponent*   c0;
+       ScfEcomponent*   c1;
        ScfEcomponent*   B  = f->components[0];
        ScfEpin*         Bp = B->pins[SCF_EDA_Battery_POS];
        ScfEpin*         Bn = B->pins[SCF_EDA_Battery_NEG];
@@ -377,20 +379,30 @@ static int _topo_path_completes(ScfEfunction* f, scf_vector_t* paths)
                        if (p2->lid != Bp->lid)
                                continue;
 
-                       if (p3->lid == Bn->lid)
-                               continue;
+//                     if (p3->lid == Bn->lid)
+//                             continue;
 
                        for (k = path1->pins->size - 1; k >= 0; k -= 2) {
                                p  = path1->pins->data[k];
 
-                               if (p->lid == p0->lid)
-                                       break;
+                               if (p->lid == p0->lid) {
+                                       c0 = f->components[p0->cid];
+                                       c1 = f->components[p->cid];
+
+                                       if (SCF_EDA_NPN == c0->type) {
+                                               if (SCF_EDA_NPN_C == p0->id)
+                                                       break;
+                                               else if (SCF_EDA_NPN != c1->type || SCF_EDA_NPN_C != p->id)
+                                                       break;
+                                       } else if (SCF_EDA_NPN != c1->type)
+                                               break;
+                               }
                        }
 
                        if (k > 0) {
-                               scf_loge("merge path: c%ldp%ld-c%ldp%ld ... c%ldp%ld-c%ldp%ld\n",
-                                               p2->cid, p2->id, p->cid,  p->id,
-                                               p0->cid, p0->id, p1->cid, p1->id);
+                               scf_loge("merge path: c%ldp%ld-c%ldp%ld (%d)... c%ldp%ld-c%ldp%ld (%d)\n",
+                                               p2->cid, p2->id, p->cid,  p->id,  path1->pins->size,
+                                               p0->cid, p0->id, p1->cid, p1->id, path0->pins->size);
 
                                int ret = __topo_path_xchg(path0, 0, path1, k + 1);
                                if (ret < 0)
@@ -414,9 +426,9 @@ static int _topo_path_completes(ScfEfunction* f, scf_vector_t* paths)
                        }
 
                        if (k < path0->pins->size) {
-                               scf_loge("merge path: c%ldp%ld-c%ldp%ld ... c%ldp%ld-c%ldp%ld\n",
-                                               p2->cid, p2->id, p3->cid, p3->id,
-                                               p ->cid, p ->id, p1->cid, p1->id);
+                               scf_loge("merge path: c%ldp%ld-c%ldp%ld (%d) ... c%ldp%ld-c%ldp%ld (%d)\n",
+                                               p2->cid, p2->id, p3->cid, p3->id, path1->pins->size,
+                                               p ->cid, p ->id, p1->cid, p1->id, path0->pins->size);
 
                                int ret = __topo_path_xchg(path0, k, path1, path1->pins->size);
                                if (ret < 0)
index 044cbc92bcf8c946bf7e101167eb50e19858cc48..25503856b0677eebcde5ba0130be459d023274a4 100644 (file)
@@ -38,12 +38,12 @@ static ses_step_t*  ses_steps_1[] =
 
 //     &ses_step_simplify,
        &ses_step_topo,
-
+#if 0
        &ses_step_jr,
 
        &ses_step_va_diode,
        &ses_step_va_transistor,
-#if 1
+
        &ses_step_jr,
        &ses_step_va,
        &ses_step_va_bridge,
@@ -144,7 +144,7 @@ int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count)
                        return ret;
 
                int j;
-               for (j = 0; j < 3; j++) {
+               for (j = 0; j < 1; j++) {
                        printf("\n\033[33m%s(), %d(), j: %d\033[0m\n", __func__, __LINE__, j);
 
                        ret = __ses_steps_analyse(f, ns, i, ctx);