path = NULL;
}
+ for (i = 0; i < ctx->paths->size; i++) {
+ path = ctx->paths->data[i];
+
+ path->n_diodes = 0;
+
+ for (j = 0; j < path->pins->size; j++) {
+ p = path->pins->data[j];
+
+ c = f->components[p->cid];
+
+ if ((SCF_EDA_Diode == c->type && SCF_EDA_Diode_NEG == p->id)
+ || (SCF_EDA_Transistor == c->type && SCF_EDA_Transistor_B == p->id))
+ path->n_diodes++;
+ }
+ }
+
scf_vector_qsort(ctx->paths, _ses_path_cmp);
int ret = _topo_layers(ctx->paths);
ses_path_t* path1 = flow1->paths->data[flow1->paths->size - 1];
ScfEpin* r0p0 = path0->pins->data[0];
- ScfEpin* r0p1 = flow0->vip;
+ ScfEpin* r0p1 = path0->pins->data[path0->pins->size - 1];
ScfEpin* r1p0 = path1->pins->data[0];
- ScfEpin* r1p1 = flow1->vip;
+ ScfEpin* r1p1 = path1->pins->data[path1->pins->size - 1];
int i;
int j;
if (p0->v > p1->v) {
- double v = r0p0->v - p1->v;
- double jv = r0p0->jv - p1->jv;
+ double v = r0p0->v - r1p1->v;
+ double jv = r0p0->jv - r1p1->jv;
- double r0 = r0p1->pr - r0p0->pr;
- double jr0 = r0p1->jpr - r0p0->jpr;
-
- double r = r0 + bridge->r;
- double jr = jr0 + bridge->jr;
+ double r = flow0->pr + bridge->r + flow1->nr;
+ double jr = flow0->jpr + bridge->jr + flow1->jnr;
double a;
double ja;
+ double dv;
+ double jdv;
+
ses_ur_i(&a, &ja, v, jv, r, jr);
- scf_loge("r->pr: %lg + j%lg, v: %lg + j%lg, a: %lg + j%lg\n", r, jr, v, jv, a, ja);
+ ses_ir_u(&dv, &jdv, a, ja, flow0->pr, flow0->jpr);
+
+ scf_loge("r->pr: %lg + j%lg, v: %lg + j%lg, a: %lg + j%lg, dv: %lg + j%lg\n", r, jr, v, jv, a, ja, dv, jdv);
} else {
int i;
if (!path->parent)
- printf("\033[31mpath: %d, \033[0m", path->index);
+ printf("\033[31mpath: %d, n_diodes: %d, \033[0m", path->index, path->n_diodes);
for (i = 0; i < path->pins->size; i++) {
p = path->pins->data[i];
for (i = 0; i < path->childs->size; i++) {
path2 = path->childs->data[i];
- printf("\033[32mchild: %d, parent: %d, \033[0m", path2->index, path->index);
+ printf("\033[32mchild: %d, n_diodes: %d, parent: %d, \033[0m", path2->index, path2->n_diodes, path->index);
ses_path_print(path2);
}