From 35601bea710e3cfdce7bf04ec6eba184006d0aaa Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 8 Nov 2023 14:12:00 +0800 Subject: [PATCH] tmp --- ses_layout.c | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index 23083df..d0049a3 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -556,6 +556,25 @@ static inline void eline_mov_before(ScfEfunction* f, intptr_t dst, intptr_t src) 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) @@ -565,7 +584,7 @@ static void __ses_layout_path2(ScfEfunction* f, ses_path_t* path, ses_path_t* ba ScfEpin* bp; ScfEpin* p; ScfEpin* pb; - ScfEpin* pc; + ScfEpin* pe; intptr_t j; intptr_t k; @@ -588,7 +607,7 @@ static void __ses_layout_path2(ScfEfunction* f, ses_path_t* path, ses_path_t* ba 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; } } @@ -597,17 +616,22 @@ static void __ses_layout_path2(ScfEfunction* f, ses_path_t* path, ses_path_t* ba 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"); @@ -617,11 +641,9 @@ static void __ses_layout_path(ScfEfunction* f, ses_path_t* path, ses_path_t* bas { 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++) { -- 2.25.1