bridge
authoryu.dongliang <18588496441@163.com>
Fri, 22 Sep 2023 06:39:47 +0000 (14:39 +0800)
committeryu.dongliang <18588496441@163.com>
Fri, 22 Sep 2023 06:39:47 +0000 (14:39 +0800)
ses_core.h
ses_step_topo.c
ses_step_va_balance.c
ses_steps.c

index 03311275359e56b42496b0f25e92d5531894a0c2..d8fe0205cccdcb0e48cad55d797c39ff2da805a2 100644 (file)
@@ -64,6 +64,8 @@ struct ses_path_s
 
        int            type;
        int            index;
+
+       int            n_diodes;
 };
 
 struct ses_ctx_s
index 508bb1b60d7e2176563910a03d48f560415cdfd1..2e3919b777e6580a1b647532ca71d3291192b4e3 100644 (file)
@@ -315,6 +315,22 @@ static int _topo_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t*
                path = NULL;
        }
 
+       for (i = 0; i < ctx->paths->size; i++) {
+               path      = ctx->paths->data[i];
+
+               path->n_diodes = 0;
+
+               for (j = 0; j < path->pins->size; j++) {
+                       p  =        path->pins->data[j];
+
+                       c  = f->components[p->cid];
+
+                       if ((SCF_EDA_Diode      == c->type && SCF_EDA_Diode_NEG    == p->id)
+                        || (SCF_EDA_Transistor == c->type && SCF_EDA_Transistor_B == p->id))
+                               path->n_diodes++;
+               }
+       }
+
        scf_vector_qsort(ctx->paths, _ses_path_cmp);
 
        int ret = _topo_layers(ctx->paths);
index fe04f783084a3893d6945e5c2813be300dced21f..259cbd5c96f55abb026df2510d654cd8ab1b6ea4 100644 (file)
@@ -63,10 +63,10 @@ static int __ses_path_va_balance(ScfEfunction* f, ses_path_t* bridge, ses_flow_t
        ses_path_t*    path1 = flow1->paths->data[flow1->paths->size - 1];
 
        ScfEpin*       r0p0  = path0->pins->data[0];
-       ScfEpin*       r0p1  = flow0->vip;
+       ScfEpin*       r0p1  = path0->pins->data[path0->pins->size - 1];
 
        ScfEpin*       r1p0  = path1->pins->data[0];
-       ScfEpin*       r1p1  = flow1->vip;
+       ScfEpin*       r1p1  = path1->pins->data[path1->pins->size - 1];
 
        int i;
        int j;
@@ -84,21 +84,23 @@ static int __ses_path_va_balance(ScfEfunction* f, ses_path_t* bridge, ses_flow_t
 
        if (p0->v > p1->v) {
 
-               double v   = r0p0->v   p1->v;
-               double jv  = r0p0->jv  p1->jv;
+               double v   = r0p0->v    - r1p1->v;
+               double jv  = r0p0->jv   - r1p1->jv;
 
-               double r0  = r0p1->pr  - r0p0->pr;
-               double jr0 = r0p1->jpr - r0p0->jpr;
-
-               double r   = r0  + bridge->r;
-               double jr  = jr0 + bridge->jr;
+               double r   = flow0->pr  + bridge->r  + flow1->nr;
+               double jr  = flow0->jpr + bridge->jr + flow1->jnr;
 
                double a;
                double ja;
 
+               double dv;
+               double jdv;
+
                ses_ur_i(&a, &ja, v, jv, r, jr);
 
-               scf_loge("r->pr: %lg + j%lg, v: %lg + j%lg, a: %lg + j%lg\n", r, jr, v, jv, a, ja);
+               ses_ir_u(&dv, &jdv, a, ja, flow0->pr, flow0->jpr);
+
+               scf_loge("r->pr: %lg + j%lg, v: %lg + j%lg, a: %lg + j%lg, dv: %lg + j%lg\n", r, jr, v, jv, a, ja, dv, jdv);
 
        } else {
 
index 6c2d001b57846033d7a95acb3b17731298e69f8f..6895bf1338d8047f48e4ca8d6197ba2fd1969d5d 100644 (file)
@@ -251,7 +251,7 @@ void ses_path_print(ses_path_t* path)
        int i;
 
        if (!path->parent)
-               printf("\033[31mpath: %d, \033[0m", path->index);
+               printf("\033[31mpath: %d, n_diodes: %d, \033[0m", path->index, path->n_diodes);
 
        for (i = 0; i < path->pins->size; i++) {
                p  =        path->pins->data[i];
@@ -266,7 +266,7 @@ void ses_path_print(ses_path_t* path)
        for (i = 0; i < path->childs->size; i++) {
                path2     = path->childs->data[i];
 
-               printf("\033[32mchild: %d, parent: %d, \033[0m", path2->index, path->index);
+               printf("\033[32mchild: %d, n_diodes: %d, parent: %d, \033[0m", path2->index, path2->n_diodes, path->index);
 
                ses_path_print(path2);
        }