#include<cairo/cairo.h>
#include"ses_core.h"
+#define N_PINS 4
+
int epin_cmp(const void* v0, const void* v1)
{
const uint64_t* t0 = v0;
for (i = 0; i + 1 < f->n_elines; i++) {
el0 = f->elines[i];
- if (el0->n_pins <= 4)
+ if (el0->n_pins <= N_PINS)
continue;
v0 = ses_vertex_add(graph, el0);
for (j = i + 1; j < f->n_elines; j++) {
el1 = f->elines[j];
- if (el1->n_pins <= 4)
+ if (el1->n_pins <= N_PINS)
continue;
for (k = 0; k < el0->n_conns; k++) {
intptr_t N = 2;
intptr_t i;
intptr_t j;
+ intptr_t k;
scf_loge("\n");
ses_lines_diff_components(f, graph);
N = v->edges->size;
}
+
for (j = N; j >= 0; j--) {
for (i = 1; i <= j; i++)
printf("\n");
}
+ k = 0;
for (j = 0; j < colors->size; j++) {
for (i = 0; i < graph->size; i++) {
el = v->data;
- if (j == el->color)
+ if (j == el->color) {
scf_logi("j: %ld, l%ld->color: %ld\n", j, el->id, el->color);
+
+ if (el == f->elines[k]) {
+ k++;
+ continue;
+ }
+
+ N = __ses_find_eline_index(f, el->id);
+
+ SCF_XCHG(f->elines[k], f->elines[N]);
+ k++;
+ }
}
printf("\n");
}
+ for (i = 0; i < f->n_elines; i++) {
+ el = f->elines[i];
+
+ scf_logw("el: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", el->id, el->n_conns, el->n_pins, el->flags);
+ }
+
scf_vector_clear(graph, ( void (*)(void*) )ses_vertex_free);
scf_vector_free(graph);
scf_vector_free(colors);
size_t i;
size_t j;
- size_t k0;
- size_t k1;
+ size_t m;
if (f->n_elines <= 2)
return 0;
__ses_layout_lines3(f);
- size_t m;
- size_t n;
-
- el0 = f->elines[0];
- m = f->n_elines >> 1;
-
- f->elines[0] = f->elines[m];
- f->elines[m] = el0;
- el0->n_lines = 1;
-
- for (i = 0; i < el0->n_conns && i < 2; i++) {
- ec = el0->conns[i];
-
- j = __ses_find_eline_index(f, ec->lid);
- el1 = f->elines[j];
-
- n = m + (i << 1) - 1;
-
- f->elines[j] = f->elines[n];
- f->elines[n] = el1;
- el1->n_lines = 1;
- }
-
- for (n = m - 1; n > 0; n--) {
- el0 = f->elines[n];
-
- el0->n_lines = 1;
-
- if (0 == el0->n_conns)
- continue;
-
- for (i = 0; i < el0->n_conns; i++) {
- ec = el0->conns[i];
-
- j = __ses_find_eline_index(f, ec->lid);
- el1 = f->elines[j];
-
- if (0 == el1->n_lines)
- break;
- }
-
- if (i == el0->n_conns)
- continue;
-
- f->elines[j ] = f->elines[n - 1];
- f->elines[n - 1] = el1;
- el1->n_lines = 1;
- }
-
- for (n = m + 1; n < f->n_elines - 1; n++) {
- el0 = f->elines[n];
-
- el0->n_lines = 1;
-
- if (0 == el0->n_conns)
- continue;
-
- for (i = 0; i < el0->n_conns; i++) {
- ec = el0->conns[i];
-
- j = __ses_find_eline_index(f, ec->lid);
- el1 = f->elines[j];
-
- if (0 == el1->n_lines)
- break;
- }
-
- if (i == el0->n_conns)
- continue;
-
- f->elines[j ] = f->elines[n + 1];
- f->elines[n + 1] = el1;
- el1->n_lines = 1;
- }
-
#if 1
- size_t N_PINS = 0;
-
for (i = 0; i < f->n_elines; i++) {
el0 = f->elines[i];
- if (N_PINS < el0->n_pins)
- N_PINS = el0->n_pins;
- }
-
- scf_loge("N_PINS: %ld\n", N_PINS);
-
- N_PINS = N_PINS < 8 ? 8 : N_PINS;
-
- for (n = 0; n < N_PINS / 2 - 2; n++) {
-
- for (i = 0; i < f->n_elines; i++) {
- el0 = f->elines[i];
-
- if (el0->n_pins > N_PINS / 2 - n)
- continue;
+ if (el0->n_pins > N_PINS)
+ continue;
- for (j = i + 1; j < f->n_elines; j++)
- f->elines[j - 1] = f->elines[j];
+ for (j = i + 1; j < f->n_elines; j++)
+ f->elines[j - 1] = f->elines[j];
- j = __ses_find_eline_index(f, el0->conns[0]->lid);
+ j = __ses_find_eline_index(f, el0->conns[0]->lid);
- if (el0->n_conns > 1) {
- m = __ses_find_eline_index(f, el0->conns[1]->lid);
+ if (el0->n_conns > 1) {
+ m = __ses_find_eline_index(f, el0->conns[1]->lid);
- if (j > m)
- SCF_XCHG(j, m);
+ if (j > m)
+ SCF_XCHG(j, m);
- el1 = f->elines[j];
- ++j;
- } else if (j > f->n_elines / 2) {
- el1 = f->elines[j];
- ++j;
- } else
- el1 = f->elines[j];
+ el1 = f->elines[j];
+ ++j;
+ } else if (j > f->n_elines / 2) {
+ el1 = f->elines[j];
+ ++j;
+ } else
+ el1 = f->elines[j];
- for (m = f->n_elines - 1; m > j; m--)
- f->elines[m] = f->elines[m - 1];
+ for (m = f->n_elines - 1; m > j; m--)
+ f->elines[m] = f->elines[m - 1];
- f->elines[j] = el0;
+ f->elines[j] = el0;
- if (j == i)
- continue;
+ if (j == i)
+ continue;
- scf_loge("n: %ld, mov el%ld [%ld] --> [%ld] el%ld\n", N_PINS / 2 - n, el0->id, i, j, el1->id);
- }
- printf("\n");
+ scf_loge("mov el%ld [%ld] --> [%ld] el%ld\n", el0->id, i, j, el1->id);
}
#endif
qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id);
-// ses_cross(f, d);
-
__ses_de_cross(f, d);
+ ses_cross(f, d);
__ses_setc_xy(f, d);
__ses_xchg_cx(f, d);