return 0;
}
-int __ses_layout_lines(ScfEfunction* f, int d)
+static int __ses_layout_lines(ScfEfunction* f, int d)
{
ScfEline* el;
ScfLine* l;
}
}
-void __ses_layout_components(ScfEfunction* f, int d)
+static void __ses_layout_components(ScfEfunction* f, int d)
{
ScfEcomponent* c;
ScfEline* el0;
}
}
-int ses_layout_function(ScfEfunction* f, int d)
+static void __ses_xchg_components(ScfEfunction* f, int d)
{
ScfEcomponent* c0;
ScfEcomponent* c1;
- ScfEline* el0;
- ScfEline* el1;
- ScfEline* el2;
-
- ScfEconn* ec;
- ScfLine* l0;
- ScfLine* l1;
- ScfLine* l2;
-
+ ScfEline* el;
ScfEpin* p0;
ScfEpin* p1;
ScfEpin* p2;
size_t n;
size_t q;
- f->x = 0;
- f->y = 0;
- f->w = 0;
- f->h = 0;
-
- int ret = __ses_layout_lines(f, d);
- if (ret < 0)
- return ret;
-
- __ses_layout_components(f, d);
-
for (i = 0; i < f->n_elines; i++) {
- el0 = f->elines[i];
+ el = f->elines[i];
- for (m = 0; m + 3 < el0->n_pins; m += 2) {
+ for (m = 0; m + 3 < el->n_pins; m += 2) {
- c0 = f->components[el0->pins[m]];
- p0 = c0->pins [el0->pins[m + 1]];
+ c0 = f->components[el->pins[m]];
+ p0 = c0->pins [el->pins[m + 1]];
for (j = 0; j < c0->n_pins; j++) {
p1 = c0->pins[j];
if (p1 == p0)
continue;
- for (n = 2; n + 1 < el0->n_pins; n += 2) {
+ for (n = 2; n + 1 < el->n_pins; n += 2) {
- c1 = f->components[el0->pins[n]];
- p2 = c1->pins [el0->pins[n + 1]];
+ c1 = f->components[el->pins[n]];
+ p2 = c1->pins [el->pins[n + 1]];
for (k = 0; k < c1->n_pins; k++) {
p3 = c1->pins[k];
}
}
}
+}
- qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
+static void __ses_de_cross(ScfEfunction* f, int d)
+{
+ ScfEcomponent* c0;
+ ScfEcomponent* c1;
+ ScfEpin* p0;
+ ScfEpin* p1;
+ ScfEpin* p2;
+ ScfEpin* p3;
+
+ size_t i;
+ size_t j;
+ size_t k;
+ size_t m;
+ size_t n;
+ size_t q;
for (i = 0; i < f->n_components - 1; i++) {
c0 = f->components[i];
next:
c0 = NULL;
}
+}
+
+int ses_layout_function(ScfEfunction* f, int d)
+{
+ ScfEcomponent* c;
+ ScfEline* el;
+ ScfEpin* p0;
+ ScfEpin* p1;
+
+ size_t i;
+ size_t j;
+ size_t k;
+
+ f->x = 0;
+ f->y = 0;
+ f->w = 0;
+ f->h = 0;
+
+ int ret = __ses_layout_lines(f, d);
+ if (ret < 0)
+ return ret;
+
+ __ses_layout_components(f, d);
+ __ses_xchg_components(f, d);
+
+ qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
+
+ __ses_de_cross(f, d);
int mx = 0;
int nx = INT_MIN;
int px = INT_MAX;
for (i = 0; i < f->n_components; i++) {
- c0 = f->components[i];
+ c = f->components[i];
- for (j = 0; j < c0->n_pins; j++) {
- p0 = c0->pins[j];
+ for (j = 0; j < c->n_pins; j++) {
+ p0 = c->pins[j];
if (p0->x < 0) {
if (mx > p0->x)
scf_loge("mx: %d, nx: %d, px: %d\n", mx, nx, px);
for (i = 0; i < f->n_components; i++) {
- c0 = f->components[i];
+ c = f->components[i];
int cx = 0;
int cy = 0;
- for (j = 0; j < c0->n_pins; j++) {
- p0 = c0->pins[j];
+ for (j = 0; j < c->n_pins; j++) {
+ p0 = c->pins[j];
if (p0->x > 0)
p0->x -= px - nx - d;
}
}
- c0->x = cx / 2;
- c0->y = cy / 2;
+ c->x = cx / 2;
+ c->y = cy / 2;
}
for (i = 0; i < f->n_elines; i++) {
- el0 = f->elines[i];
+ el = f->elines[i];
int x0 = INT_MAX;
int x1 = 0;
int cx = 0;
- qsort_r(el0->pins, el0->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp_cx, f);
+ qsort_r(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp_cx, f);
- for (j = 0; j < el0->n_pins; j += 2) {
+ for (j = 0; j < el->n_pins; j += 2) {
- c0 = f ->components[el0->pins[j]];
- p0 = c0->pins [el0->pins[j + 1]];
+ c = f->components[el->pins[j]];
+ p0 = c->pins [el->pins[j + 1]];
- int tmp = c0->x;
+ int tmp = c->x;
- if (j > 0 && c0->x < cx + d)
- c0->x = cx + d;
- cx = c0->x;
+ if (j > 0 && c->x < cx + d)
+ c->x = cx + d;
+ cx = c->x;
- for (k = 0; k < c0->n_pins; k++) {
+ for (k = 0; k < c->n_pins; k++) {
if (k < 2)
- c0->pins[k]->x = c0->x;
+ c->pins[k]->x = c->x;
else
- c0->pins[k]->x += c0->x - tmp;
+ c->pins[k]->x += c->x - tmp;
}
if (x0 > p0->x)
x1 = p0->x;
}
- el0->lines[0]->x0 = x0;
- el0->lines[0]->x1 = x1;
+ el->lines[0]->x0 = x0;
+ el->lines[0]->x1 = x1;
}
f->w -= mx - 3 * d + px - nx;