int _topo_print(scf_vector_t* paths);
+static int __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* base)
+{
+ ScfEcomponent* c;
+ ScfEline* el;
+ ScfEpin* bp;
+ ScfEpin* p;
+ ScfEpin* pc;
+ ScfEpin* pe;
+
+ intptr_t j;
+ intptr_t k;
+ intptr_t n;
+ intptr_t __n;
+
+ bp = base->pins->data[base->pins->size - 1];
+ __n = __ses_find_eline_index(f, bp->lid);
+
+ scf_logd("path: %d, __n: %ld, l%ld\n", path->index, __n, f->elines[__n]->id);
+
+ for (j = path->pins->size - 1; j > 0; j -= 2) {
+ p = path->pins->data[j];
+
+ for (k = base->pins->size - 1; k >= 0; k--) {
+ bp = base->pins->data[k];
+
+ if (p->lid == bp->lid) {
+ __n = __ses_find_eline_index(f, bp->lid);
+
+ scf_logw("__n: %ld, l%ld\n", __n, f->elines[__n]->id);
+ break;
+ }
+ }
+
+ if (k < 0) {
+ n = __ses_find_eline_index(f, p->lid);
+
+ if (SCF_EDA_NPN == p->cid && SCF_EDA_NPN_B == p->id) {
+ c = f->components[p->cid];
+ pc = c->pins[SCF_EDA_NPN_C];
+ pe = c->pins[SCF_EDA_NPN_E];
+
+ intptr_t ic = __ses_find_eline_index(f, pc->lid);
+ intptr_t ie = __ses_find_eline_index(f, pe->lid);
+
+ if (ic > ie)
+ __n = ic;
+ else
+ __n = ie;
+
+ scf_loge("c%ldp%ld, ic: %ld, ie: %ld\n", p->cid, p->id, ic, ie);
+ }
+
+ eline_mov_before(f, __n, n);
+ }
+ }
+
+ p = path->pins->data[0];
+
+ for (k = base->pins->size - 1; k >= 0; k--) {
+ bp = base->pins->data[k];
+
+ if (p->lid == bp->lid) {
+ __n = __ses_find_eline_index(f, bp->lid);
+ break;
+ }
+ }
+
+ if (k < 0) {
+ n = __ses_find_eline_index(f, p->lid);
+
+ if (SCF_EDA_NPN == p->cid && SCF_EDA_NPN_B == p->id) {
+ c = f->components[p->cid];
+ pc = c->pins[SCF_EDA_NPN_C];
+ pe = c->pins[SCF_EDA_NPN_E];
+
+ intptr_t ic = __ses_find_eline_index(f, pc->lid);
+ intptr_t ie = __ses_find_eline_index(f, pe->lid);
+ if (ic > ie)
+ __n = ic;
+ else
+ __n = ie;
+ scf_loge("c%ldp%ld, ic: %ld, ie: %ld\n", p->cid, p->id, ic, ie);
+ }
+
+ eline_mov_before(f, __n, n);
+ }
+}
+
static int __ses_layout_lines4(ScfEfunction* f)
{
scf_vector_t* paths;
- ses_path_t* Bpath;
+ ses_path_t* base;
ses_path_t* path;
ScfEcomponent* B;
Bn = B->pins[SCF_EDA_Battery_NEG];
for (i = 0; i < paths->size; i++) {
- Bpath = paths->data[i];
+ base = paths->data[i];
- p = Bpath->pins->data[0];
+ p = base->pins->data[0];
if (p->lid == Bp->lid)
break;
}
if (i >= paths->size)
goto end;
- for (j = 0; j < Bpath->pins->size; j += 2) {
- p = Bpath->pins->data[j];
+ for (j = 0; j < base->pins->size; j += 2) {
+ p = base->pins->data[j];
n = __ses_find_eline_index(f, p->lid);
SCF_XCHG(f->elines[n], f->elines[j / 2]);
}
- p = Bpath->pins->data[j - 1];
+ p = base->pins->data[j - 1];
n = __ses_find_eline_index(f, p->lid);
SCF_XCHG(f->elines[n], f->elines[j / 2 + 1]);
scf_logd("j: %ld, l%ld\n", j / 2 + 1, f->elines[j / 2 + 1]->id);
for (i = 0; i < paths->size; i++) {
path = paths->data[i];
- if (path == Bpath)
+ if (path == base)
continue;
- __n = __ses_find_eline_index(f, Bn->lid);
- scf_logd("path: %d, __n: %ld, l%ld\n", path->index, __n, f->elines[__n]->id);
-
- for (j = path->pins->size - 1; j > 0; j -= 2) {
- p = path->pins->data[j];
-
- for (k = Bpath->pins->size - 1; k >= 0; k--) {
- Bp = Bpath->pins->data[k];
-
- if (p->lid == Bp->lid) {
- __n = __ses_find_eline_index(f, Bp->lid);
-
- scf_logw("__n: %ld, l%ld\n", __n, f->elines[__n]->id);
- break;
- }
- }
-
- if (k < 0) {
- n = __ses_find_eline_index(f, p->lid);
-
- if (SCF_EDA_NPN == p->cid && SCF_EDA_NPN_B == p->id) {
- c = f->components[p->cid];
- pc = c->pins[SCF_EDA_NPN_C];
- pe = c->pins[SCF_EDA_NPN_E];
-
- intptr_t ic = __ses_find_eline_index(f, pc->lid);
- intptr_t ie = __ses_find_eline_index(f, pe->lid);
-
- if (ic > ie)
- __n = ic;
- else
- __n = ie;
-
- scf_loge("c%ldp%ld, ic: %ld, ie: %ld\n", p->cid, p->id, ic, ie);
- }
-
- eline_mov_before(f, __n, n);
- }
- }
-
- p = path->pins->data[0];
-
- for (k = Bpath->pins->size - 1; k >= 0; k--) {
- Bp = Bpath->pins->data[k];
-
- if (p->lid == Bp->lid) {
- __n = __ses_find_eline_index(f, Bp->lid);
- break;
- }
- }
-
- if (k < 0) {
- n = __ses_find_eline_index(f, p->lid);
-
- if (SCF_EDA_NPN == p->cid && SCF_EDA_NPN_B == p->id) {
- c = f->components[p->cid];
- pc = c->pins[SCF_EDA_NPN_C];
- pe = c->pins[SCF_EDA_NPN_E];
-
- intptr_t ic = __ses_find_eline_index(f, pc->lid);
- intptr_t ie = __ses_find_eline_index(f, pe->lid);
- if (ic > ie)
- __n = ic;
- else
- __n = ie;
- scf_loge("c%ldp%ld, ic: %ld, ie: %ld\n", p->cid, p->id, ic, ie);
- }
-
- eline_mov_before(f, __n, n);
- }
- printf("\n");
+ __ses_layout_path(f, path, base);
}
ret = 0;