From: yu.dongliang <18588496441@163.com> Date: Sun, 16 Jul 2023 06:42:21 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=2968d0d61491048430c5c71fc40341ecf4fe5c8f;p=ses.git tmp --- diff --git a/ses_layout.c b/ses_layout.c index edb1427..4c1beb5 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -369,6 +369,7 @@ int ses_layout_function(ScfEfunction* f, int d) size_t k; size_t m; size_t n; + size_t q; f->x = 0; f->y = 0; @@ -471,6 +472,73 @@ int ses_layout_function(ScfEfunction* f, int d) } } + int mx = 0; + + for (i = 0; i < f->n_components - 1; i++) { + c0 = f->components[i]; + + 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; + + int y0 = p0->y < p1->y ? p0->y : p1->y; + int y1 = p0->y < p1->y ? p1->y : p0->y; + + for (m = i + 1; m < f->n_components; m++) { + c1 = f->components[m]; + + for (n = 0; n < c1->n_pins - 1; n++) { + p2 = c1->pins[n]; + + for (q = n + 1; q < c1->n_pins; q++) { + p3 = c1->pins[q]; + + 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) { + + if (p0->x > 0) { + p0->x = -p0->x; + if (mx > p0->x) + mx = p0->x; + } + + if (p1->x > 0) { + p1->x = -p1->x; + if (mx > p1->x) + mx = p1->x; + } + + } else if (y2 < y0 && y0 < y3 && y3 < y1) { + + if (p2->x > 0) { + p2->x = -p2->x; + if (mx > p2->x) + mx = p2->x; + } + + if (p3->x > 0) { + p3->x = -p3->x; + if (mx > p3->x) + mx = p3->x; + } + } + } + } + } + } + } + } + for (i = 0; i < f->n_elines; i++) { el0 = f->elines[i]; @@ -496,9 +564,14 @@ int ses_layout_function(ScfEfunction* f, int d) if ((p1->y < p0->y && p3->y < p0->y) || (p1->y > p0->y && p3->y > p0->y)) { - if ((p0->x > p2->x && p1->x < p3->x) - || (p0->x < p2->x && p1->x > p3->x)) - SCF_XCHG(p0->x, p2->x); + if (p0->x > 0 && p1->x > 0 && p2->x > 0 && p3->x > 0) { + + if ((p0->x > p2->x && p1->x < p3->x) + || (p0->x < p2->x && p1->x > p3->x)) + SCF_XCHG(p0->x, p2->x); + + } else if (p0->x < 0 && p1->x < 0 && p2->x < 0 && p3->x < 0) { + } } } }