#include"ses_core.h"
-void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, double* r, double* jr)
+void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1, double* r, double* jr)
{
ScfEpin* p0 = path->pins->data[i];
ScfEpin* p1 = path->pins->data[j];
ScfEcomponent* c0 = f->components[p0->cid];
ScfEcomponent* c1 = f->components[p1->cid];
- if (SCF_EDA_Transistor == c1->type && SCF_EDA_Transistor_E == p1->id)
+ if (SCF_EDA_Transistor == c1->type && SCF_EDA_Transistor_E == p1->id && cp1 != p1)
p1 = path->pins->data[j - 1];
if (SCF_EDA_Transistor == c0->type) {
*r = p1->pr - p0->pr;
*jr = p1->jpr - p0->jpr;
}
+
+ scf_logd("c%ldp%ld-c%ldp%ld, r: %lg, p0->pr: %lg, p1->pr: %lg\n", p0->cid, p0->id, p1->cid, p1->id, *r, p0->pr, p1->pr);
}
static int __ses_path_jr(ScfEfunction* f, ses_path_t* path)
double _r = child->r / R;
double _jr = -child->jr / R;
- __ses_path_pr(f, path, k, j, &r, &jr);
+ __ses_path_pr(f, path, k, j, NULL, &r, &jr);
R = r * r + jr * jr;
r = r / R;
static int __ses_path_split_a(ScfEfunction* f, ses_path_t* path, int i, double* a, double *ja)
{
ses_path_t* child;
+
+ ScfEcomponent* c;
ScfEline* el;
ScfEpin* p;
ScfEpin* p2;
double _a = 0;
double _ja = 0;
- ses_ir_u(&_v, &_jv, *a, *ja, _r, _jr);
+ __ses_path_pr(f, path, i, k, cp1, &_r, &_jr);
+
+ 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);
+ scf_logw("child: %d, c%ldp%ld-c%ldp%ld (c%ldp%ld-c%ldp%ld), _v: %lg, a: %lg, _r: %lg, p->pr: %lg, p->dr: %lg, p2->pr: %lg\n",
+ child->index, p->cid, p->id, p2->cid, p2->id, cp0->cid, cp0->id, cp1->cid, cp1->id, _v, *a, _r, p->pr, p->dr, p2->pr);
ses_ur_i(&_a, &_ja, _v, _jv, child->r, child->jr);
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);
+ scf_loge("child: %d, c%ldp%ld, c%ldp%ld, p->v: %lg, el->v: %lg, _v: %lg\n",
+ child->index, p->cid, p->id, p2->cid, p2->id, p->v, el->v, _v);
int ret = __ses_path_va(f, child);
if (ret < 0)
ses_ir_u(&v, &jv, a, ja, r, jr);
+ scf_logd("c%ldp%ld, c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p0->cid, p0->id, p->cid, p->id, a, ja, r, jr, v, jv);
+
} else if (i >= 1) {
p2 = path->pins->data[i - 1];
jr = p2->jsr - p0->jsr;
ses_ir_u(&v, &jv, a, ja, r, jr);
+
+ scf_logd("c%ldp%ld, c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p0->cid, p0->id, p->cid, p->id, a, ja, r, jr, v, jv);
} else
return -EINVAL;
jr = p->jsr - p0->jsr;
ses_ir_u(&v, &jv, a, ja, r, jr);
-
- scf_logd("c%ldp%ld, c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p0->cid, p0->id, p->cid, p->id, a, ja, r, jr, v, jv);
}
p->v = p0->v - v;
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\n", path->index, v, jv, path->r, path->jr, path->a, path->ja);
+ scf_loge("path: %d, v: %lg, r: %lg, a: %lg\n\n", path->index, v, path->r, path->a);
double a = path->a;
double ja = path->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);
+ scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg, dv: %lg, r: %lg, p->a: %lg, a: %lg, p->pr: %lg\n\n", path->index, i, p->cid, p->id,
+ p->v, dv, r, p->a, a, p->pr);
r = 0;
jr = 0;
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, p->pr: %lg + %lg\n",
- path->index, i, p->cid, p->id, p->v, p->jv, dv, jdv, a, ja, p->pr, p->jpr);
+ scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg, dv: %lg, a: %lg, p->pr: %lg\n", path->index, i, p->cid, p->id, p->v, dv, a, p->pr);
}
}
printf("\n");