SCF_XCHG(c0->x, c1->x);
+ scf_logw("c%ld <--> c%ld\n", c0->id, c1->id);
+
for (i = 0; i < c0->n_pins; i++) {
p = c0->pins[i];
}
}
-static inline void __ses_xchg_cx(ScfEfunction* f, int d)
+static void __ses_xchg_cx(ScfEfunction* f, int d)
{
ScfEcomponent* c0;
ScfEcomponent* c1;
}
}
+static void __ses_layout_cx(ScfEfunction* f, int d)
+{
+ ScfEcomponent* c;
+ ScfEcomponent* c2;
+ ScfEline* el;
+ ScfEline* el2;
+ ScfEpin* p0;
+ ScfEpin* p1;
+
+ size_t i;
+ size_t j;
+ size_t k;
+
+ for (i = 0; i < f->n_components; i++) {
+ c = f->components[i];
+
+ p0 = c->pins[0];
+ p1 = c->pins[1];
+
+ c->x = (p0->x + p1->x) / 2;
+ c->y = (p0->y + p1->y) / 2;
+ }
+
+ for (i = 0; i < f->n_elines; i++) {
+ el = f->elines[i];
+
+ int cx = 0;
+
+ qsort_r(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp_cx, f);
+
+ for (j = 0; j < el->n_pins; j += 2) {
+
+ c = f->components[el->pins[j]];
+ p0 = c->pins [el->pins[j + 1]];
+
+ int tmp = c->x;
+
+ if (j > 0) {
+ if (c->x < cx + d)
+ c->x = cx + d;
+ }
+ cx = c->x;
+
+ 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_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;
+
+ if (c->x < c2->x + d / 2)
+ c->x = c2->x + d / 2;
+
+ 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;
+// p1->x = (c->x * 3 + p1->x) / 4;
+ }
+ }
+ }
+ qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
+}
+
int ses_layout_function(ScfEfunction* f, int d)
{
ScfEcomponent* c;
qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
- __ses_de_cross(f, d);
+ __ses_de_cross (f, d);
+
+ __ses_layout_cx(f, d);
+
+ __ses_xchg_cx (f, d);
int mx = 0;
int nx = INT_MIN;
c->y = cy / 2;
}
- for (i = 0; i < f->n_elines; i++) {
- el = f->elines[i];
-
- int cx = 0;
-
- qsort_r(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp_cx, f);
-
- for (j = 0; j < el->n_pins; j += 2) {
-
- c = f->components[el->pins[j]];
- p0 = c->pins [el->pins[j + 1]];
-
- int tmp = c->x;
-
- if (j > 0 && c->x < cx + d)
- c->x = cx + d;
- cx = c->x;
-
- 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;
- }
- }
- }
-
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;
-
- if (c->x < c2->x + d / 2)
- c->x = c2->x + d / 2;
-
- 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;
-// p1->x = (c->x * 3 + p1->x) / 4;
- }
-
- if (tx0 > p1->x)
- tx0 = p1->x;
-
- if (tx1 < p1->x)
- tx1 = p1->x;
- }
- }
- qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
-
for (i = 0; i < f->n_elines; i++) {
el = f->elines[i];
el->lines[0]->x0 = x0;
el->lines[0]->x1 = x1;
+
+ if (tx0 > x0)
+ tx0 = x0;
+
+ if (tx1 < x1)
+ tx1 = x1;
}
f->w = tx1 + d;