ses_step_va_diode.c
authoryu.dongliang <18588496441@163.com>
Mon, 11 Sep 2023 03:47:24 +0000 (11:47 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 11 Sep 2023 03:47:24 +0000 (11:47 +0800)
ses_step_dc_input.c
ses_step_va.c
ses_step_va_diode.c

index 2a280439f9a7a384e31ac8734e98537317b574ce..2daed43d333c38e1b594e722cfb0cd0411eae975 100644 (file)
@@ -17,7 +17,7 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx
 
                if (SCF_EDA_PIN_IN & el->flags) {
 
-                       el->v = (rand() & 0x1) * B->v;
+                       el->v = (0x0) * B->v;
                        el->vconst = 1;
 
                        scf_logw("IN el: %ld, V: %lg\n", el->id, el->v);
index 9062ef1edd09966b6a8dbe018efcd4376031f805..5fe23626ec9102d631ee651cbe4bce3e07ca4f13 100644 (file)
@@ -42,7 +42,7 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path)
 
        ses_ur_i(&path->a, &path->ja, v, jv, path->r, path->jr);
 
-       scf_loge("path: %d, v: %lg + j%lg, r: %lg + j%lg, a: %lg + j%lg\n", path->index, v, jv, path->r, path->jr, path->a, path->ja);
+       scf_loge("path: %d, v: %lg + j%lg, r: %lg + j%lg, a: %lg + j%lg\n\n", path->index, v, jv, path->r, path->jr, path->a, path->ja);
 
        double a   = path->a;
        double ja  = path->ja;
@@ -55,7 +55,7 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path)
        for (i = 0; i < path->pins->size; i++) {
                p  =        path->pins->data[i];
 
-               if (path->childs) {
+               if (!(i & 0x1) && path->childs) {
                        for (j    = 0; j < path->childs->size; j++) {
                                child =        path->childs->data[j];
 
@@ -84,6 +84,10 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path)
                                double _ja = 0;
 
                                ses_ir_u(&_v, &_jv,  a,  ja,       _r,       _jr);
+
+                               scf_logw("child: %d, c%ldp%ld, c%ldp%ld, _v: %lg + j%lg, a: %lg + j%lg, _r: %lg + j%lg, p->pr: %lg + j%lg, p->dr: %lg + j%lg, p2->pr: %lg + j%lg\n",
+                                               child->index, p->cid, p->id, p2->cid, p2->id, _v, _jv, a, ja, _r, _jr, p->pr, p->jpr, p->dr, p->jdr, p2->pr, p2->jpr);
+
                                ses_ur_i(&_a, &_ja, _v, _jv, child->r, child->jr);
 
                                a     -= _a;
@@ -93,6 +97,9 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path)
                                el->v  = p->v  - _v;
                                el->jv = p->jv - _jv;
 
+                               scf_loge("child: %d, c%ldp%ld, c%ldp%ld, p->v: %lg + j%lg, el->v: %lg + j%lg, _v: %lg + j%lg\n",
+                                               child->index, p->cid, p->id, p2->cid, p2->id, p->v, p->jv, el->v, el->jv, _v, _jv);
+
                                int ret = __ses_path_va(f, child);
                                if (ret < 0)
                                        return ret;
@@ -153,8 +160,8 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path)
                                }
                        }
 
-                       scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, a: %lg + j%lg\n\n", path->index, i, p->cid, p->id,
-                                       p->v, p->jv, dv, jdv, r, jr, p->a, p->ja, a, ja);
+                       scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, a: %lg + j%lg, p->pr: %lg + j%lg\n\n", path->index, i, p->cid, p->id,
+                                       p->v, p->jv, dv, jdv, r, jr, p->a, p->ja, a, ja, p->pr, p->jpr);
 
                        r   = 0;
                        jr  = 0;
@@ -163,7 +170,8 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path)
                        dv  = p->v;
                        jdv = p->jv;
 
-                       scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, a: %lg + j%lg\n", path->index, i, p->cid, p->id, p->v, p->jv, dv, jdv, a, ja);
+                       scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, a: %lg + j%lg, p->pr: %lg + %lg\n",
+                                       path->index, i, p->cid, p->id, p->v, p->jv, dv, jdv, a, ja, p->pr, p->jpr);
                }
        }
        printf("\n");
index cdd57be012981b53b2f77706178154ef53ca61ad..c922366119fa431f5d1df34a34c8236e0e1d841e 100644 (file)
@@ -134,10 +134,14 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                        if (path->childs)
                                __ses_path_split_i(path, p, p1, el->a, el->ja, &p->a, &p->ja);
 
-                       __ses_path_dr(p, p1, p);
+                       p2     = c->pins[SCF_EDA_Diode_NEG];
+                       p2->a  = p->a;
+                       p2->ja = p->ja;
 
-                       scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg + j%lg, p->v: %lg + j%lg, p->a: %lg + j%lg, pr: %lg + j%lg, sr: %lg + j%lg, p->dr: %lg + j%lg\n",
-                                       i, p->cid, p->id, p1->cid, p1->id, v, jv, p->v, p->jv, p->a, p->ja, pr, jpr, sr, jsr, p->dr, p->jdr);
+                       __ses_path_dr(p, p1, p2);
+
+                       scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg + j%lg, p->v: %lg + j%lg, p->a: %lg + j%lg, pr: %lg + j%lg, sr: %lg + j%lg, p2->dr: %lg + j%lg\n",
+                                       i, p->cid, p->id, p1->cid, p1->id, v, jv, p->v, p->jv, p->a, p->ja, pr, jpr, sr, jsr, p2->dr, p2->jdr);
 
                } else {
                        p     = path->pins->data[i + 1];