From 38af169d9e0521805534da14bdcadd1b0ef5d18f Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Thu, 13 Jul 2023 21:30:11 +0800 Subject: [PATCH] tmp --- ses_layout.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index def801d..14ae464 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -348,7 +348,8 @@ int ses_lines_same_components(ScfEfunction* f) int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, uint32_t bw, uint32_t bh) { - ScfEcomponent* c; + ScfEcomponent* c0; + ScfEcomponent* c1; ScfEline* el0; ScfEline* el1; ScfEline* el2; @@ -381,7 +382,7 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u return -ENOMEM; l0->x0 = bx; - l0->x1 = bx + d; + l0->x1 = bx; l0->y0 = by + i * d; l0->y1 = l0->y0; @@ -403,21 +404,21 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u j = 0; while (m + 1 < el0->n_pins && n + 1 < el1->n_pins) { - uint64_t c0 = el0->pins[m]; - uint64_t c1 = el1->pins[n]; + uint64_t cid0 = el0->pins[m]; + uint64_t cid1 = el1->pins[n]; - if (c0 < c1) + if (el0->pins[m] < el1->pins[n]) m += 2; - else if (c0 > c1) + else if (el0->pins[m] > el1->pins[n]) n += 2; else { - c = f->components[c0]; + c0 = f->components[el0->pins[m]]; - p0 = c->pins[el0->pins[m + 1]]; - p1 = c->pins[el1->pins[n + 1]]; + p0 = c0->pins[el0->pins[m + 1]]; + p1 = c0->pins[el1->pins[n + 1]]; - if (SCF_EDA_Battery == c->type) { + if (SCF_EDA_Battery == c0->type) { p0->x = el0->lines[0]->x0; p1->x = el1->lines[0]->x0; @@ -450,12 +451,12 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u for (m = 0; m + 1 < el0->n_pins; m += 2) { - c = f->components[el0->pins[m]]; - p0 = c->pins[el0->pins[m + 1]]; + c0 = f->components[el0->pins[m]]; + p0 = c0->pins[el0->pins[m + 1]]; if (0 == p0->x) { - if (SCF_EDA_Battery == c->type) + if (SCF_EDA_Battery == c0->type) p0->x = el0->lines[0]->x0; else { p0->x = el0->lines[0]->x1 + d + rand() % 10; @@ -472,20 +473,20 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u scf_loge("f->x: %d, y: %d, w: %d, h: %d\n", f->x, f->y, f->w, f->h); for (i = 0; i < f->n_components; i++) { - c = f->components[i]; + c0 = f->components[i]; uint32_t cx = 0; uint32_t cy = 0; - for (j = 0; j < c->n_pins; j++) { - p0 = c->pins[j]; + for (j = 0; j < c0->n_pins; j++) { + p0 = c0->pins[j]; cx += p0->x; cy += p0->y; } - c->x = cx / c->n_pins; - c->y = cy / c->n_pins; + c0->x = cx / c0->n_pins; + c0->y = cy / c0->n_pins; } return 0; -- 2.25.1