return 0;
}
-static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, int i, double a, double ja)
+static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, int i, double a, double ja)
{
ScfEpin* p2;
- ScfEpin* p0 = path->pins->data[0];
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_Transistor == c->type) {
- if (SCF_EDA_Transistor_B == p->id || SCF_EDA_Transistor_C == p->id)
- ses_ir_u(&v, &jv, a, ja, p->sr - (p->r + p->dr), p->jsr - (p->jr + p->jdr));
+ if (SCF_EDA_Transistor_B == p->id || SCF_EDA_Transistor_C == p->id) {
- else if (i >= 1) {
+ r = p->sr - (p->r + p->dr ) - p0->sr;
+ jr = p->jsr - (p->jr + p->jdr) - p0->jsr;
+
+ ses_ir_u(&v, &jv, a, ja, r, jr);
+
+ } else if (i >= 1) {
p2 = path->pins->data[i - 1];
- ses_ir_u(&v, &jv, a, ja, p2->sr, p2->jsr);
+ r = p2->sr - p0->sr;
+ jr = p2->jsr - p0->jsr;
+
+ ses_ir_u(&v, &jv, a, ja, r, jr);
} else
return -EINVAL;
- } else
- ses_ir_u(&v, &jv, a, ja, p->sr, p->jsr);
+ } else {
+ r = p->sr - p0->sr;
+ jr = p->jsr - p0->jsr;
+
+ ses_ir_u(&v, &jv, a, ja, r, jr);
+
+ scf_logd("c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p->cid, p->id, a, ja, r, jr, v, jv);
+ }
p->v = p0->v - v;
p->jv = p0->jv - jv;
if (!(i & 0x1) && path->childs) {
- int ret = __ses_path_split_a(f, path, i, &a, &ja);
+ int ret = __ses_path_split_v(f, path, p0, i, a, ja);
if (ret < 0)
return ret;
- }
- int ret = __ses_path_split_v(f, path, i, a, ja);
- if (ret < 0)
- return ret;
+ ret = __ses_path_split_a(f, path, i, &a, &ja);
+ if (ret < 0)
+ return ret;
+
+ p0 = p;
+
+ } else {
+ int ret = __ses_path_split_v(f, path, p0, i, a, ja);
+ if (ret < 0)
+ return ret;
+ }
el = f->elines[p->lid];
el->v = p->v;