scf_logd("f->elines[%ld]->id: %ld, f->elines[%ld]->id: %ld\n", src, f->elines[src]->id, dst, f->elines[dst]->id);
}
+static inline void eline_mov_after(ScfEfunction* f, intptr_t dst, intptr_t src)
+{
+ if (dst == src)
+ return;
+
+ ScfEline* el = f->elines[src];
+ intptr_t i;
+
+ for (i = src + 1; i < f->n_elines; i++)
+ f->elines[i - 1] = f->elines[i];
+
+ for (i = f->n_elines - 1; i > dst + 1; i--)
+ f->elines[i] = f->elines[i - 1];
+
+ f->elines[dst + 1] = el;
+
+ scf_logd("f->elines[%ld]->id: %ld, f->elines[%ld]->id: %ld\n", src, f->elines[src]->id, dst, f->elines[dst]->id);
+}
+
int _topo_print(scf_vector_t* paths);
static void __ses_layout_path2(ScfEfunction* f, ses_path_t* path, ses_path_t* base)
ScfEpin* bp;
ScfEpin* p;
ScfEpin* pb;
- ScfEpin* pc;
+ ScfEpin* pe;
intptr_t j;
intptr_t 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);
+ scf_logw("__n: %ld, l%ld\n\n", __n, f->elines[__n]->id);
break;
}
}
eline_mov_before(f, __n, n);
- if (SCF_EDA_NPN == p->cid && SCF_EDA_NPN_E == p->id) {
- c = f->components[p->cid];
- pc = c->pins[SCF_EDA_NPN_C];
+ c = f->components[p->cid];
+
+ if (SCF_EDA_NPN == c->type && SCF_EDA_NPN_C == p->id) {
+ pe = c->pins[SCF_EDA_NPN_E];
pb = c->pins[SCF_EDA_NPN_B];
- intptr_t ic = __ses_find_eline_index(f, pc->lid);
+ intptr_t ie = __ses_find_eline_index(f, pe->lid);
intptr_t ib = __ses_find_eline_index(f, pb->lid);
- eline_mov_before(f, __n, ib);
+ eline_mov_after(f, __n, ib);
- scf_loge("**************** c%ldp%ld, ic: %ld, ib: %ld, ie: %ld\n", p->cid, p->id, ic, ib, n);
+ ie = __ses_find_eline_index(f, pe->lid);
+ ib = __ses_find_eline_index(f, pb->lid);
+ n = __ses_find_eline_index(f, p->lid);
+
+ scf_loge("**************** c%ldp%ld, ic: %ld, ib: %ld, ie: %ld\n", p->cid, p->id, n, ib, ie);
}
}
printf("\n");
{
intptr_t i;
- if (path != base) {
- __ses_layout_path2(f, path, base);
+ __ses_layout_path2(f, path, base);
- base = path;
- }
+ base = path;
if (base->childs) {
for (i = 0; i < base->childs->size; i++) {