size_t k;
size_t n;
- k = 0;
-
for (i = 0; i < f->n_components - 1; i++) {
c0 = f->components[i];
}
}
- for (i = 0; i < f->n_components - 1; i++) {
- c0 = f->components[i];
+ do {
+ n = 0;
- int y0 = INT_MAX;
- int y1 = INT_MIN;
- int m0 = 0;
- int n0 = 0;
+ for (i = 0; i < f->n_components - 1; i++) {
+ c0 = f->components[i];
- if (c0->color > 0) {
- m0 = (c0->color - 1) / 2;
- n0 = (c0->color - 1) % 2;
- }
+ int y0 = INT_MAX;
+ int y1 = INT_MIN;
+ int m0 = 0;
+ int n0 = 0;
- for (k = 0; k < c0->n_pins; k++) {
- p = c0->pins[k];
+ if (c0->color > 0) {
+ m0 = (c0->color - 1) / 2;
+ n0 = (c0->color - 1) % 2;
+ }
- if (y0 > p->y)
- y0 = p->y;
+ for (k = 0; k < c0->n_pins; k++) {
+ p = c0->pins[k];
- if (y1 < p->y)
- y1 = p->y;
- }
+ if (y0 > p->y)
+ y0 = p->y;
- if (y1 - y0 <= d)
- continue;
+ if (y1 < p->y)
+ y1 = p->y;
+ }
- for (j = i + 1; j < f->n_components; j++) {
- c1 = f->components[j];
+ for (j = i + 1; j < f->n_components; j++) {
+ c1 = f->components[j];
- int y2 = INT_MAX;
- int y3 = INT_MIN;
- int m1 = 0;
- int n1 = 0;
+ int y2 = INT_MAX;
+ int y3 = INT_MIN;
+ int m1 = 0;
+ int n1 = 0;
- if (c1->color > 0) {
- m1 = (c1->color - 1) / 2;
- n1 = (c1->color - 1) % 2;
- }
-
- if (m0 != m1 || n0 != n1)
- continue;
+ if (c1->color > 0) {
+ m1 = (c1->color - 1) / 2;
+ n1 = (c1->color - 1) % 2;
+ }
- scf_logi("c%ld <--> c%ld, color: %ld, %ld, cx: %d, %d\n", c0->id, c1->id, c0->color, c1->color, c0->x, c1->x);
+ if (m0 != m1 || n0 != n1)
+ continue;
- for (k = 0; k < c1->n_pins; k++) {
- p = c1->pins[k];
+ for (k = 0; k < c1->n_pins; k++) {
+ p = c1->pins[k];
- if (y2 > p->y)
- y2 = p->y;
+ if (y2 > p->y)
+ y2 = p->y;
- if (y3 < p->y)
- y3 = p->y;
- }
+ if (y3 < p->y)
+ y3 = p->y;
+ }
- if ((y0 <= y2 && y3 < y1) || (y0 < y2 && y3 <= y1)) {
+ if ((y0 <= y2 && y3 < y1) || (y0 < y2 && y3 <= y1)) {
- if ((0 == n0 && c0->x > c1->x) || (1 == n0 && c0->x < c1->x))
- __ses_xchg_cx2(c0, c1);
+ if ((0 == n0 && c0->x > c1->x) || (1 == n0 && c0->x < c1->x)) {
+ __ses_xchg_cx2(c0, c1);
+ n++;
+ }
- } else if ((y2 <= y0 && y1 < y3) || (y2 < y0 && y1 <= y3)) {
+ } else if ((y2 <= y0 && y1 < y3) || (y2 < y0 && y1 <= y3)) {
- if ((0 == n0 && c0->x < c1->x) || (1 == n0 && c0->x > c1->x))
- __ses_xchg_cx2(c0, c1);
+ if ((0 == n0 && c0->x < c1->x) || (1 == n0 && c0->x > c1->x)) {
+ __ses_xchg_cx2(c0, c1);
+ n++;
+ }
+ }
}
}
- }
+ } while (n > 0);
}
static void __ses_layout_cx(ScfEfunction* f, int d)