tmp
authoryu.dongliang <18588496441@163.com>
Wed, 6 Sep 2023 11:39:55 +0000 (19:39 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 6 Sep 2023 11:39:55 +0000 (19:39 +0800)
ses_step_dc_input.c
ses_step_jr.c
ses_step_va_diode.c

index 2a280439f9a7a384e31ac8734e98537317b574ce..bef68ea1af13a7018721de7fcd8d978290fb0dd2 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 = (i & 0x1) * B->v;
                        el->vconst = 1;
 
                        scf_logw("IN el: %ld, V: %lg\n", el->id, el->v);
index 80c7b643e91b7a5059cb165c612006740508a044..934317885fad7ee5e8bd1a0df8649fd67b9d2330 100644 (file)
@@ -114,13 +114,21 @@ static int __ses_path_jr(ScfEfunction* f, ses_path_t* path)
                        double dr  = p1->pr  - (p0->pr  + r);
                        double jdr = p1->jpr - (p0->jpr + jr);
 
-                       for ( ; j < path->pins->size; j++) {
+                       p1->pr  -= dr;
+                       p1->jpr -= jdr;
+
+                       scf_logw("j: %d, c%ldp%ld, p->pr: %lg + j%lg, p->sr: %lg + j%lg\n", j, p1->cid, p1->id, p1->pr, p1->jpr, p1->sr, p1->jsr);
+
+                       for (++j; j < path->pins->size; j++) {
                                p     = path->pins->data[j];
 
                                p->pr  -= dr;
                                p->jpr -= jdr;
 
-                               scf_logw("j: %d, c%ldp%ld, p->pr: %lg + j%lg\n", j, p->cid, p->id, p->pr, p->jpr);
+                               p->sr  -= dr;
+                               p->jsr -= jdr;
+
+                               scf_logw("j: %d, c%ldp%ld, p->pr: %lg + j%lg, p->sr: %lg + j%lg\n", j, p->cid, p->id, p->pr, p->jpr, p->sr, p->jsr);
                        }
 
                        scf_loge("child: %d, r: %lg, jr: %lg, r0: %lg, jr0: %lg, _r: %lg, _jr: %lg, dr: %lg, jdr: %lg\n\n",
index 727f9ffd3ef21584bb2d44c532e1e26728dd76a0..1a4a8b3a3361f46b986f2ecd708afe2a08c3edd4 100644 (file)
@@ -77,7 +77,7 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
        double r;
        double jr;
 
-       for (i = 0; i < path->pins->size; i++) {
+       for (i = 1; i < path->pins->size - 1; i++) {
                p  =        path->pins->data[i];
 
                el = f->elines    [p->lid];
@@ -97,10 +97,10 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                        v  = p0->v  - p->v;
                        jv = p0->jv - p->jv;
 
-                       r  = p1->pr  - p->pr;
-                       jr = p1->jpr - p->jpr;
+                       r  = p->pr  - p0->pr;
+                       jr = p->jpr - p0->jpr;
 
-                       ses_ur_i(&a, &ja, v, jv, p->pr, p->jpr);
+                       ses_ur_i(&a, &ja, v, jv, r, jr);
 
                        el->a      = a;
                        el->ja     = ja;
@@ -116,6 +116,29 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                                        v, jv, p->v, p->jv, r, jr, p->a, p->ja);
 
                } else {
+                       v  = p->v    - p1->v;
+                       jv = p->jv   - p1->jv;
+
+                       r  = p1->pr  - p->pr;
+                       jr = p1->jpr - p->jpr;
+
+                       double sr  = p1->sr  - p->sr;
+                       double jsr = p1->jsr - p->jsr;
+
+                       ses_ur_i(&a, &ja, v, jv, r, jr);
+
+                       el->a      = a;
+                       el->ja     = ja;
+                       el->aconst = 1;
+
+                       if (path->childs)
+                               __ses_path_split_i(f, path, p0, p, &a, &ja);
+
+                       p->a  = a;
+                       p->ja = ja;
+
+                       scf_loge("i: %d, c%ldp%ld, v: %lg + j%lg, p->v: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, sr: %lg + j%lg\n", i, p->cid, p->id,
+                                       v, jv, p->v, p->jv, r, jr, p->a, p->ja, sr, jsr);
                }
        }
        printf("\n");