#include"ses_core.h"
-static int __dfs_path(ScfEfunction* f, ScfEcomponent* rc, ScfEpin* rp, ses_ctx_t* ctx, scf_vector_t** ppath)
+static int __dfs_path(ScfEfunction* f, ScfEcomponent* rc, ScfEpin* rp, ses_ctx_t* ctx, ses_path_t** ppath)
{
- scf_vector_t* path = *ppath;
-
+ ses_path_t* path = *ppath;
ScfEcomponent* c;
ScfEline* el;
ScfEpin* np;
return SCF_EDA_Path_OFF;
if (!path) {
- path = scf_vector_alloc();
+ path = ses_path_alloc();
if (!path)
return -ENOMEM;
*ppath = path;
}
- if (scf_vector_add(path, rp) < 0)
+ if (scf_vector_add(path->pins, rp) < 0)
return -ENOMEM;
if (SCF_EDA_Transistor != rc->type || SCF_EDA_Transistor_E != rp->id)
continue;
}
- if (scf_vector_add(path, np) < 0)
+ if (scf_vector_add(path->pins, np) < 0)
return -ENOMEM;
if (SCF_EDA_Transistor != rc->type || SCF_EDA_Transistor_E != np->id)
if (scf_vector_add(ctx->paths, path) < 0)
return -ENOMEM;
- for (j = 0; j < path->size; j++) {
- p = path->data[j];
+ path->type = SES_PATH_MAIN;
+
+ for (j = 0; j < path->pins->size; j++) {
+ p = path->pins->data[j];
p->pflag = 1;
}
if (ret > 0) {
if (*ppath)
- scf_vector_del(*ppath, np);
+ scf_vector_del((*ppath)->pins, np);
if (SCF_EDA_Path_OFF == ret)
np->vflag = 0;
if (ret > 0) {
if (*ppath)
- scf_vector_del(*ppath, rp);
+ scf_vector_del((*ppath)->pins, rp);
if (SCF_EDA_Path_OFF == ret) {
rp->vflag = 0;
static int _topo_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ctx)
{
- scf_vector_t* path;
-
+ ses_path_t* path;
ScfEcomponent* c;
ScfEcomponent* B;
ScfEline* el;
- ScfEline* el2;
- ScfEline* elp;
- ScfEline* eln;
ScfEpin* p;
size_t i;
size_t j;
- size_t k;
-
- B = f->components[0];
-
- elp = f->elines[B->pins[SCF_EDA_Battery_POS]->lid];
- eln = f->elines[B->pins[SCF_EDA_Battery_NEG]->lid];
for (i = 0; i < f->n_elines; i++) {
el = f->elines[i];
for (j = 0; j < c->n_pins; j++) {
p = c->pins[j];
p->vflag = 0;
+ p->pflag = 0;
}
}
+ B = f->components[0];
+ el = f->elines[B->pins[SCF_EDA_Battery_POS]->lid];
path = NULL;
- for (i = 0; i + 1 < elp->n_pins; i += 2) {
+ for (i = 0; i + 1 < el->n_pins; i += 2) {
- c = f->components[elp->pins[i]];
- p = c->pins [elp->pins[i + 1]];
+ c = f->components[el->pins[i]];
+ p = c->pins [el->pins[i + 1]];
if (c == B)
continue;
continue;
if (SCF_EDA_Status_OFF == ret || SCF_EDA_Path_OFF == ret) {
- scf_vector_clear(path, NULL);
+ ses_path_free(path);
+ path = NULL;
continue;
}
if (scf_vector_add(ctx->paths, path) < 0) {
- scf_vector_free(path);
+ ses_path_free(path);
return -ENOMEM;
}
- path = NULL;
+ path->type = SES_PATH_BRANCH;
+ path = NULL;
}
if (path) {
- scf_vector_free(path);
+ ses_path_free(path);
path = NULL;
}
for (i = 0; i < ctx->paths->size; i++) {
path = ctx->paths->data[i];
- for (j = 0; j < path->size; j++) {
- p = path->data[j];
+ scf_logi("i: %ld, path->type: %d\n", i, path->type);
+
+ for (j = 0; j < path->pins->size; j++) {
+ p = path->pins->data[j];
scf_logi("i: %ld, j: %ld, c%ldp%ld\n", i, j, p->cid, p->id);
}