#include"ses_core.h"
-static int _ses_path_cmp(const void* v0, const void* v1)
-{
- const ses_path_t* p0 = *(const ses_path_t**)v0;
- const ses_path_t* p1 = *(const ses_path_t**)v1;
-
- if (p0->n_diodes > p1->n_diodes)
- return -1;
-
- if (p0->n_diodes < p1->n_diodes)
- return 1;
-
- if (p0->pins->size > p1->pins->size)
- return -1;
-
- if (p0->pins->size < p1->pins->size)
- return 1;
-
- return 0;
-}
-
int __dfs_path(ScfEfunction* f, ScfEcomponent* rc, ScfEpin* rp, scf_vector_t* __paths, ses_path_t** ppath)
{
ScfEcomponent* c;
p0 = child->pins->data[0];
p1 = child->pins->data[child->pins->size - 1];
- for (j = i - 1; j >= 0; j--) {
+ for (j = paths->size - 1; j >= 0; j--) {
parent = paths->data[j];
+ if (parent == child)
+ continue;
+
int n = 0;
for (k = 0; k < parent->pins->size; k++) {
}
}
- scf_vector_qsort(ctx->paths, _ses_path_cmp);
-
int ret = _topo_layers(ctx->paths);
if (ret < 0)
return ret;
p0 = path->pins->data[0];
p1 = path->pins->data[path->pins->size - 1];
- if (p0->lid == cp0->lid && p1->lid == cp1->lid)
- return ses_path_add(path, child);
+ if (p0->lid == cp0->lid && p1->lid == cp1->lid) {
+
+ if (child->pins->size == child->n_diodes * 2
+ && path->pins->size > path->n_diodes * 2) {
+
+ parent->childs->data[j] = child;
+ child->parent = parent;
+ child->parent_p0 = path->parent_p0;
+ child->parent_p1 = path->parent_p1;
+ child->type = SES_PATH_BRANCH;
+
+ return ses_path_add(child, path);
+ } else
+ return ses_path_add(path, child);
+ }
}
if (scf_vector_add(parent->childs, child) < 0)