if (t0[1] > t1[1])
return 1;
-
return 0;
}
if (c0->x > c1->x)
return 1;
-
return 0;
}
if (ec0->n_cids > ec1->n_cids)
return -1;
-
return 0;
}
if (el0->n_pins > el1->n_pins)
return -1;
-
return 0;
}
if (el0->id > el1->id)
return 1;
+ return 0;
+}
+
+int ecomponent_cmp_id(const void* v0, const void* v1)
+{
+ const ScfEcomponent* c0 = *(const ScfEcomponent**)v0;
+ const ScfEcomponent* c1 = *(const ScfEcomponent**)v1;
+
+ if (c0->id < c1->id)
+ return -1;
+
+ if (c0->id > c1->id)
+ return 1;
+ return 0;
+}
+
+int ecomponent_cmp_cx(const void* v0, const void* v1)
+{
+ const ScfEcomponent* c0 = *(const ScfEcomponent**)v0;
+ const ScfEcomponent* c1 = *(const ScfEcomponent**)v1;
+ if (c0->x < c1->x)
+ return -1;
+
+ if (c0->x > c1->x)
+ return 1;
return 0;
}
p0 = c->pins[el0->pins[m + 1]];
p1 = c->pins[el1->pins[n + 1]];
- p0->x = el0->lines[0]->x1 + j * d + 10 + rand() % 20;
- p1->x = el1->lines[0]->x1 + j * d + 10 + rand() % 20;
+ p0->x = el0->lines[0]->x1 + j * d + rand() % 10;
+ p1->x = el1->lines[0]->x1 + j * d + rand() % 10;
p0->y = el0->lines[0]->y0;
p1->y = el1->lines[0]->y0;
if (0 == p0->x) {
- p0->x = el0->lines[0]->x1 + d + 10 + rand() % 20;
+ p0->x = el0->lines[0]->x1 + d + rand() % 10;
p0->y = el0->lines[0]->y1;
el0->lines[0]->x1 = p0->x;
int ses_layout_function(ScfEfunction* f, int d)
{
ScfEcomponent* c;
+ ScfEcomponent* c2;
ScfEline* el;
ScfEline* el2;
ScfEpin* p0;
int tx0 = INT_MAX;
int tx1 = 0;
+ qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_cx);
+
+ for (i = 1; i < f->n_components; i++) {
+ c = f->components[i];
+ c2 = f->components[i - 1];
+
+ int tmp = c->x;
+
+ if (c->x > c2->x + d)
+ c->x = c2->x + d;
+
+ for (k = 0; k < c->n_pins; k++) {
+ p1 = c->pins[k];
+
+ if (k < 2)
+ p1->x = c->x;
+ else
+ p1->x += c->x - tmp;
+ }
+ }
+
+ qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
+
for (i = 0; i < f->n_elines; i++) {
el = f->elines[i];