__ses_path_va_bridge()
authoryu.dongliang <18588496441@163.com>
Thu, 16 Nov 2023 07:03:55 +0000 (15:03 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 16 Nov 2023 07:03:55 +0000 (15:03 +0800)
ses_step_va_bridge.c

index c34cb26b9db0519aae445e8bd575751ff5a77a77..b40f6d69ae04e3f06f6200cbfc50d23c0c95348e 100644 (file)
@@ -1,6 +1,6 @@
 #include"ses_core.h"
 
-int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double ja_bridge)
+int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double da_vip, double dja_vip)
 {
        if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
                return -EINVAL;
@@ -46,7 +46,7 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double
                        r  = tr  - r;
                        jr = jtr - jr;
 
-                       ses_ir_u(&v, &jv, a_bridge, ja_bridge, r, jr);
+                       ses_ir_u(&v, &jv, da_vip, dja_vip, r, jr);
 
                        if (p->lid != Bp->lid) {
                                p->v   -= v;
@@ -69,7 +69,7 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double
                tr  -= r;
                jtr -= jr;
 
-               ses_ir_u(&v, &jv, a_bridge, ja_bridge, tr, jtr);
+               ses_ir_u(&v, &jv, da_vip, dja_vip, tr, jtr);
 
                vip = path->pins->data[0];
 
@@ -185,81 +185,6 @@ int __ses_flow_v_neg(ScfEfunction* f, ses_flow_t* flow, double dv_vip, double dj
        return 0;
 }
 
-int __ses_flow_a_neg(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double ja_bridge)
-{
-       if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
-               return -EINVAL;
-
-       ses_path_t* path = flow->paths->data[flow->paths->size - 1];
-       ScfEpin*    vip  = flow->vip;
-       ScfEpin*    p0;
-       ScfEpin*    p;
-
-       double tr  = flow->neg_r;
-       double jtr = flow->neg_jr;
-
-       int i;
-       int j;
-
-       for (i   = 0; i < flow->paths->size; i++) {
-               path =        flow->paths->data[i];
-
-               double v;
-               double jv;
-
-               double r;
-               double jr;
-
-               int j0 = -1;
-               for (j = 0; j < path->pins->size; j++) {
-                       p  =        path->pins->data[j];
-
-                       if (j0 < 0) {
-                               if (p->lid == vip->lid)
-                                       j0 = j;
-                               else
-                                       continue;
-                       }
-
-                       __ses_path_pr(f, path, j0, j, NULL, &r, &jr);
-
-                       r  = tr  - r;
-                       jr = jtr - jr;
-
-                       if (p->sr != p->pr)
-                               j0 = j;
-
-                       ses_ir_u(&v, &jv, a_bridge, ja_bridge, r, jr);
-
-                       p->v  += v;
-                       p->jv += jv;
-
-                       scf_loge("c%ldp%ld->v: %lg, r: %lg, %lg\n", p->cid, p->id, p->v, r, p->sr);
-               }
-
-               assert(p0);
-
-               vip = path->pins->data[j - 1];
-
-               if (j - 1 != j0) {
-
-                       __ses_path_sr(f, path, j0, j, NULL, &r, &jr);
-
-                       tr  -= r;
-                       jtr -= jr;
-
-                       ses_ir_u(&v, &jv, a_bridge, ja_bridge, tr, jtr);
-
-                       vip->v  += v;
-                       vip->jv += jv;
-
-                       scf_logw("c%ldp%ld->v: %lg + j%lg, r: %lg + j%lg\n", vip->cid, vip->id, vip->v, vip->jv, tr, jtr);
-               }
-       }
-
-       return 0;
-}
-
 static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* changed, scf_vector_t* paths)
 {
        if (!bridge)
@@ -328,7 +253,7 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change
 
        double a   = 0;
        double ja  = 0;
-       double Eta = 0.001;
+       double Eta = 0.01;
 
        int k = 0;
        do {
@@ -349,7 +274,7 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change
                v  = flow->vip->v;
                jv = flow->vip->jv;
 
-               ret = __ses_flow_a_pos(f, flow, a, ja);
+               ret = __ses_flow_a_pos(f, flow, Eta * da, Eta * dja);
                if (ret < 0)
                        return ret;
 
@@ -364,7 +289,7 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change
                printf("\n");
 
                k++;
-       } while (k < 46);
+       } while (da > 1e-5);
 
        v  = p0->v  - p1->v;
        jv = p0->jv - p1->jv;