From: yu.dongliang <18588496441@163.com> Date: Mon, 16 Oct 2023 10:48:07 +0000 (+0800) Subject: ses_layout_function() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=6dc80ed33f33eb3009a24adba5d7796a4191c870;p=ses.git ses_layout_function() --- diff --git a/ses_layout.c b/ses_layout.c index 1daf10a..b9842aa 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -573,50 +573,48 @@ int ses_layout_function(ScfEfunction* f, int d) for (i = 0; i < f->n_components - 1; i++) { c0 = f->components[i]; + p0 = c0->pins[0]; - for (j = 0; j < c0->n_pins - 1; j++) { - p0 = c0->pins[j]; - - for (k = j + 1; k < c0->n_pins; k++) { - p1 = c0->pins[k]; - - if (p0->y - p1->y <= d && p0->y - p1->y >= -d) - continue; + for (k = 1; k < c0->n_pins; k++) { + p1 = c0->pins[k]; - int y0 = p0->y < p1->y ? p0->y : p1->y; - int y1 = p0->y < p1->y ? p1->y : p0->y; + if (p0->y - p1->y <= d && p0->y - p1->y >= -d) + continue; - for (m = i + 1; m < f->n_components; m++) { - c1 = f->components[m]; + int y0 = p0->y < p1->y ? p0->y : p1->y; + int y1 = p0->y < p1->y ? p1->y : p0->y; - for (n = 0; n < c1->n_pins - 1; n++) { - p2 = c1->pins[n]; + for (m = i + 1; m < f->n_components; m++) { + c1 = f->components[m]; + p2 = c1->pins[0]; - for (q = n + 1; q < c1->n_pins; q++) { - p3 = c1->pins[q]; + for (q = 1; q < c1->n_pins; q++) { + p3 = c1->pins[q]; - if (p2->y - p3->y <= d && p2->y - p3->y >= -d) - continue; + if (p2->y - p3->y <= d && p2->y - p3->y >= -d) + continue; - int y2 = p2->y < p3->y ? p2->y : p3->y; - int y3 = p2->y < p3->y ? p3->y : p2->y; + int y2 = p2->y < p3->y ? p2->y : p3->y; + int y3 = p2->y < p3->y ? p3->y : p2->y; - if (y0 < y2 && y2 < y1 && y1 < y3) { + if (y0 < y2 && y2 < y1 && y1 < y3) { - if (p0->x > 0) - p0->x = -p0->x; + if (p2->x > 0) { + if (p0->x > 0) + p0->x = -p0->x; - if (p1->x > 0) - p1->x = -p1->x; + if (p1->x > 0) + p1->x = -p1->x; + } - } else if (y2 < y0 && y0 < y3 && y3 < y1) { + } else if (y2 < y0 && y0 < y3 && y3 < y1) { - if (p2->x > 0) - p2->x = -p2->x; + if (p0->x > 0) { + if (p2->x > 0) + p2->x = -p2->x; - if (p3->x > 0) - p3->x = -p3->x; - } + if (p3->x > 0) + p3->x = -p3->x; } } } @@ -626,58 +624,52 @@ int ses_layout_function(ScfEfunction* f, int d) for (i = 0; i < f->n_components; i++) { c0 = f->components[i]; + p0 = c0->pins[0]; - for (j = 0; j < c0->n_pins - 1; j++) { - p0 = c0->pins[j]; + if (p0->x > 0) + continue; - if (p0->x > 0) + for (k = 1; k < c0->n_pins; k++) { + p1 = c0->pins[k]; + + if (p1->x > 0) continue; - for (k = j + 1; k < c0->n_pins; k++) { - p1 = c0->pins[k]; + int y0 = p0->y < p1->y ? p0->y : p1->y; + int y1 = p0->y < p1->y ? p1->y : p0->y; + + for (m = 0; m < f->n_components; m++) { + c1 = f->components[m]; - if (p1->x > 0) + if (c0 == c1) continue; - int y0 = p0->y < p1->y ? p0->y : p1->y; - int y1 = p0->y < p1->y ? p1->y : p0->y; + p2 = c1->pins[0]; + if (p2->x < 0) + continue; - for (m = 0; m < f->n_components; m++) { - c1 = f->components[m]; + for (q = 1; q < c1->n_pins; q++) { + p3 = c1->pins[q]; - if (c0 == c1) + if (p3->x < 0) continue; - for (n = 0; n < c1->n_pins - 1; n++) { - p2 = c1->pins[n]; - - if (p2->x < 0) - continue; - - for (q = n + 1; q < c1->n_pins; q++) { - p3 = c1->pins[q]; - - if (p3->x < 0) - continue; - - if (p2->y - p3->y <= d && p2->y - p3->y >= -d) - continue; + if (p2->y - p3->y <= d && p2->y - p3->y >= -d) + continue; - int y2 = p2->y < p3->y ? p2->y : p3->y; - int y3 = p2->y < p3->y ? p3->y : p2->y; + int y2 = p2->y < p3->y ? p2->y : p3->y; + int y3 = p2->y < p3->y ? p3->y : p2->y; - if ((y0 < y2 && y2 < y1 && y1 < y3) || (y2 < y0 && y0 < y3 && y3 < y1)) - goto next; - } - } + if ((y0 < y2 && y2 < y1 && y1 < y3) || (y2 < y0 && y0 < y3 && y3 < y1)) + goto next; } + } - if (p0->x < 0) - p0->x = -p0->x; + if (p0->x < 0) + p0->x = -p0->x; - if (p1->x < 0) - p1->x = -p1->x; - } + if (p1->x < 0) + p1->x = -p1->x; } next: c0 = NULL; @@ -738,8 +730,10 @@ next: c0->x = cx / 2; c0->y = cy / 2; - c0->pins[0]->x = c0->x; - c0->pins[1]->x = c0->x; + for (j = 0; j < c0->n_pins; j++) { + p0 = c0->pins[j]; + p0->x = c0->x; + } } for (i = 0; i < f->n_elines; i++) {