ScfEcomponent* c0 = f->components[p0->cid];
ScfEcomponent* c1 = f->components[p1->cid];
+ double r1 = 0;
+ double jr1 = 0;
+
if (SCF_EDA_NPN == c1->type) {
if (SCF_EDA_NPN_E == p1->id) {
if (cp1 != p1)
p1 = path->pins->data[j - 1];
- } else if (j > 0)
+ } else if (j > 0) {
p1 = path->pins->data[j - 1];
- else {
+ c1 = f->components[p1->cid];
+
+ if (SCF_EDA_NPN == c1->type && SCF_EDA_NPN_E == p1->id) {
+ p1 = path->pins->data[j];
+ r1 = p1->r + p1->dr;
+ jr1 = p1->jr + p1->jdr;
+ }
+ } else {
*r = 0;
*jr = 0;
return;
if (i > 0) {
p0 = path->pins->data[i - 1];
- *r = p1->sr - p0->pr;
- *jr = p1->jsr - p0->jpr;
+ *r = p1->sr - r1 - p0->pr;
+ *jr = p1->jsr - jr1 - p0->jpr;
} else {
*r = p1->sr;
*jr = p1->jsr;
*jr = p1->jsr - p0->jsr;
}
- 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->sr, p1->sr);
+ scf_logd("c%ldp%ld-c%ldp%ld, r: %lg, p0->sr: %lg, p0->pr: %lg, p1->sr: %lg, p1->pr: %lg\n",
+ p0->cid, p0->id, p1->cid, p1->id, *r, p0->sr, p0->pr, p1->sr, p1->pr);
}
void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1, double* r, double* jr)
return n;
}
-static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, int i, double a, double ja)
+static void __ses_path_split_v(ScfEfunction* f, ses_path_t* path, int i0, int i, double a, double ja)
{
- ScfEpin* p2;
- ScfEpin* p = path->pins->data[i];
-
- ScfEcomponent* c = f->components[p->cid];
- double v = 0;
- double jv = 0;
- double r = 0;
- double jr = 0;
-
- if (SCF_EDA_NPN == c->type) {
-
- if (SCF_EDA_NPN_E != p->id) {
-
- if (p != p0) {
- r = p->sr - (p->r + p->dr ) - p0->sr;
- jr = p->jsr - (p->jr + p->jdr) - p0->jsr;
- } else {
- r = 0;
- jr = 0;
- }
+ ScfEpin* p2;
+ ScfEpin* p0 = path->pins->data[i0];
+ ScfEpin* p = path->pins->data[i];
- } else if (i >= 1) {
- p2 = path->pins->data[i - 1];
+ double v;
+ double jv;
+ double r;
+ double jr;
- if (p2 == p0) {
- r = p0->r + p0->dr;
- jr = p0->jr + p0->jdr;
- } else {
- r = p2->sr - p0->sr;
- jr = p2->jsr - p0->jsr;
- }
- } else
- return -EINVAL;
-
- } else {
- r = p->sr - p0->sr;
- jr = p->jsr - p0->jsr;
- }
+ __ses_path_sr(f, path, i0, i, NULL, &r, &jr);
ses_ir_u(&v, &jv, a, ja, r, jr);
p->jv = p0->jv - jv;
scf_logd("c%ldp%ld, c%ldp%ld, a: %lg, r: %lg, v: %lg\n", p0->cid, p0->id, p->cid, p->id, a, r, v);
- return 0;
}
int __ses_path_va(ScfEfunction* f, ses_path_t* path, int* changed)
int i;
int j;
- int k;
p0 = path->pins->data[0];
p1 = path->pins->data[path->pins->size - 1];
double dv = 0;
double jdv = 0;
+ int i0 = 0;
+
for (i = 0; i < path->pins->size; i++) {
p = path->pins->data[i];
if (!(i & 0x1) && path->childs) {
- int ret = __ses_path_split_v(f, path, p0, i, a, ja);
- if (ret < 0)
- return ret;
+ __ses_path_split_v(f, path, i0, i, a, ja);
- ret = __ses_path_split_a(f, path, i, &a, &ja, changed);
+ int ret = __ses_path_split_a(f, path, i, &a, &ja, changed);
if (ret < 0)
return ret;
if (ret > 0) {
p0 = p;
+ i0 = i;
scf_logd("i: %d, p0: c%ldp%ld\n", i, p0->cid, p0->id);
}
-
- } else {
- int ret = __ses_path_split_v(f, path, p0, i, a, ja);
- if (ret < 0)
- return ret;
- }
+ } else
+ __ses_path_split_v(f, path, i0, i, a, ja);
el = f->elines[p->lid];
el->v = p->v;