From 1487c326ff1bfeeae64ce8e8978b8cb641181761 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sun, 5 Nov 2023 17:23:44 +0800 Subject: [PATCH] tmp --- ses_layout.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index c19aafe..1b67e59 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1114,6 +1114,8 @@ static void __ses_xchg_cx(ScfEfunction* f, int d) int y0 = INT_MAX; int y1 = INT_MIN; + int m = (c0->color - 1) % 2; + for (k = 0; k < c0->n_pins; k++) { p = c0->pins[k]; @@ -1130,7 +1132,7 @@ static void __ses_xchg_cx(ScfEfunction* f, int d) for (j = i + 1; j < f->n_components; j++) { c1 = f->components[j]; - if ((c0->x < 0 && c1->x > 0) || (c0->x > 0 && c1->x < 0)) + if (c0->color != c1->color) continue; int y2 = INT_MAX; @@ -1148,12 +1150,12 @@ static void __ses_xchg_cx(ScfEfunction* f, int d) if ((y0 <= y2 && y3 < y1) || (y0 < y2 && y3 <= y1)) { - if ((c0->x < 0 && c0->x > c1->x) || (c0->x > 0 && c0->x < c1->x)) + if ((0 == m && c0->x > c1->x) || (1 == m && c0->x < c1->x)) __ses_xchg_cx2(c0, c1); } else if ((y2 <= y0 && y1 < y3) || (y2 < y0 && y1 <= y3)) { - if ((c0->x < 0 && c0->x < c1->x) || (c0->x > 0 && c0->x > c1->x)) + if ((0 == m && c0->x < c1->x) || (1 == m && c0->x > c1->x)) __ses_xchg_cx2(c0, c1); } } @@ -1212,6 +1214,7 @@ static void __ses_xchg_ce(ScfEfunction* f, int d) ScfEpin* pc; size_t i; + size_t j; for (i = 0; i < f->n_components; i++) { c = f->components[i]; @@ -1219,6 +1222,8 @@ static void __ses_xchg_ce(ScfEfunction* f, int d) if (SCF_EDA_NPN != c->type) continue; + j = (c->color - 1) % 2; + pb = c->pins[SCF_EDA_NPN_B]; pc = c->pins[SCF_EDA_NPN_C]; pe = c->pins[SCF_EDA_NPN_E]; @@ -1228,19 +1233,18 @@ static void __ses_xchg_ce(ScfEfunction* f, int d) if (pc->y > pb->y) { - if ((c->x < 0 && pc->x < pe->x) || (c->x > 0 && pc->x > pe->x)) + if ((0 == j && pc->x < pe->x) || (1 == j && pc->x > pe->x)) SCF_XCHG(pc->x, pe->x); } else if (pe->y < pb->y) { - if ((c->x < 0 && pc->x > pe->x) || (c->x > 0 && pc->x < pe->x)) + if ((0 == j && pc->x > pe->x) || (1 == j && pc->x < pe->x)) SCF_XCHG(pc->x, pe->x); } else if (pc->y < pb->y) { - if ((c->x > 0 && pc->x < pb->x) || (c->x < 0 && pc->x > pb->x)) { + if ((0 == j && pc->x > pb->x) || (1 == j && pc->x < pb->x)) SCF_XCHG(pc->x, pe->x); - } } } } @@ -1338,8 +1342,8 @@ int ses_layout_function(ScfEfunction* f, int d) return ret; __ses_setc_xy(f, d); -// __ses_xchg_cx(f, d); -// __ses_xchg_ce(f, d); + __ses_xchg_cx(f, d); + __ses_xchg_ce(f, d); // __ses_mov_pos(f, d); __ses_layout_cx(f, d); -- 2.25.1