From: yu.dongliang <18588496441@163.com> Date: Wed, 18 Oct 2023 10:55:51 +0000 (+0800) Subject: __ses_de_cross() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=ee7b0b9456af2c2d94f4a8ff8e00fdfbdffaefc0;p=ses.git __ses_de_cross() --- diff --git a/ses_layout.c b/ses_layout.c index d63e3a3..d97599a 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -653,48 +653,54 @@ static void __ses_de_cross(ScfEfunction* f, int d) for (i = 0; i < f->n_components - 1; i++) { c0 = f->components[i]; - p0 = c0->pins[0]; - for (k = 1; k < c0->n_pins; k++) { - p1 = c0->pins[k]; + for (j = 0; j < c0->n_pins - 1; j++) { + p0 = c0->pins[j]; - if (p0->y - p1->y <= d && p0->y - p1->y >= -d) - 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; + 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]; - p2 = c1->pins[0]; + int y0 = p0->y < p1->y ? p0->y : p1->y; + int y1 = p0->y < p1->y ? p1->y : p0->y; - for (q = 1; q < c1->n_pins; q++) { - p3 = c1->pins[q]; + for (m = i + 1; m < f->n_components; m++) { + c1 = f->components[m]; - if (p2->y - p3->y <= d && p2->y - p3->y >= -d) - continue; + for (n = 0; n < c1->n_pins - 1; n++) { + p2 = c1->pins[n]; - int y2 = p2->y < p3->y ? p2->y : p3->y; - int y3 = p2->y < p3->y ? p3->y : p2->y; + for (q = n + 1; q < c1->n_pins; q++) { + p3 = c1->pins[q]; - if (y0 < y2 && y2 < y1 && y1 < y3) { + if (p2->y - p3->y <= d && p2->y - p3->y >= -d) + continue; - if (p2->x > 0) { - if (p0->x > 0) - p0->x = -p0->x; + int y2 = p2->y < p3->y ? p2->y : p3->y; + int y3 = p2->y < p3->y ? p3->y : p2->y; - if (p1->x > 0) - p1->x = -p1->x; - } + if (y0 < y2 && y2 < y1 && y1 < y3) { + + if (p2->x > 0) { + if (p0->x > 0) + p0->x = -p0->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 (p0->x > 0) { - 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; + } + } } } } @@ -704,44 +710,50 @@ static void __ses_de_cross(ScfEfunction* f, int d) for (i = 0; i < f->n_components; i++) { c0 = f->components[i]; - p0 = c0->pins[0]; - - if (p0->x > 0) - continue; - for (k = 1; k < c0->n_pins; k++) { - p1 = c0->pins[k]; + for (j = 0; j < c0->n_pins - 1; j++) { + p0 = c0->pins[j]; - if (p1->x > 0) + if (p0->x > 0) continue; - 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]; + for (k = j + 1; k < c0->n_pins; k++) { + p1 = c0->pins[k]; - if (c0 == c1) + if (p1->x > 0) continue; - p2 = c1->pins[0]; - if (p2->x < 0) - continue; + int y0 = p0->y < p1->y ? p0->y : p1->y; + int y1 = p0->y < p1->y ? p1->y : p0->y; - for (q = 1; q < c1->n_pins; q++) { - p3 = c1->pins[q]; + for (m = 0; m < f->n_components; m++) { + c1 = f->components[m]; - if (p3->x < 0) + if (c0 == c1) continue; - if (p2->y - p3->y <= d && p2->y - p3->y >= -d) - continue; + for (n = 0; n < c1->n_pins - 1; n++) { + p2 = c1->pins[n]; - int y2 = p2->y < p3->y ? p2->y : p3->y; - int y3 = p2->y < p3->y ? p3->y : p2->y; + if (p2->x < 0) + continue; - if ((y0 < y2 && y2 < y1 && y1 < y3) || (y2 < y0 && y0 < y3 && y3 < y1)) - goto next; + 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; + + 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; + } + } } }