c = f->components[el->pins[j]];
p = c->pins [el->pins[j + 1]];
- if (p->pflag && p != np) {
+ if (p->pflag && p != np && *ppath) {
scf_loge("branch: c%ld_p%ld, l%ld\n", c->id, p->id, el->id);
if (scf_vector_add(__paths, *ppath) < 0)
p->pflag = 1;
}
- ret = SCF_EDA_Path_TO;
*ppath = NULL;
- break;
+ continue;
}
if (p->vflag)
if (SCF_EDA_Path_OFF == ret)
p->vflag = 0;
- else if (SCF_EDA_Path_TO == ret)
- break;
}
if (SCF_EDA_Status_OFF == ret || SCF_EDA_Path_OFF == ret) {
scf_loge("off: c%ld_p%ld, l%ld\n", rp->cid, rp->id, rp->lid);
}
-end:
return ret;
}
return 0;
}
+static int topo_epin_cmp(const void* v0, const void* v1, void* arg)
+{
+ ScfEfunction* f = arg;
+ const uint64_t* p0 = v0;
+ const uint64_t* p1 = v1;
+
+ ScfEcomponent* c0 = f->components[p0[0]];
+ ScfEcomponent* c1 = f->components[p1[0]];
+
+ if (SCF_EDA_Diode == c0->type || (SCF_EDA_Transistor == c0->type && SCF_EDA_Transistor_B == p0[1]))
+ return -1;
+
+ if (SCF_EDA_Diode == c1->type || (SCF_EDA_Transistor == c1->type && SCF_EDA_Transistor_B == p1[1]))
+ return 1;
+
+ return 0;
+}
+
static int _topo_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ctx)
{
ses_path_t* path;
for (i = 0; i < f->n_elines; i++) {
el = f->elines[i];
el->vflag = 0;
+
+ qsort_r(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, topo_epin_cmp, f);
}
for (i = 0; i < f->n_components; i++) {