{
const ScfEline* el0 = *(const ScfEline**)v0;
const ScfEline* el1 = *(const ScfEline**)v1;
-
+#if 0
if (SCF_EDA_PIN_POS & el0->flags)
return -1;
if (SCF_EDA_PIN_NEG & el0->flags)
return 1;
if (SCF_EDA_PIN_NEG & el1->flags)
return -1;
-
+#endif
if (el0->n_conns < el1->n_conns)
return 1;
int ses_lines_same_components(ScfEfunction* f)
{
+ ScfEline* tmp;
ScfEline* el0;
ScfEline* el1;
ScfEconn* ec;
qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp);
+ for (i = 0; i < f->n_elines; i++) {
+ el0 = f->elines[i];
+
+ scf_loge("i: %ld, el0: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", i, el0->id, el0->n_conns, el0->n_pins, el0->flags);
+ }
+ printf("\n\n");
+
+ if (f->n_elines <= 2)
+ return 0;
+
+ size_t k;
+ 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];
+
+ for (j = 0; j < f->n_elines; j++) {
+ el1 = f->elines[j];
+
+ if (el1->id == ec->lid)
+ break;
+ }
+ assert(j < f->n_elines);
+
+ 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];
+
+ for (j = 0; j < f->n_elines; j++) {
+ el1 = f->elines[j];
+
+ if (el1->id == ec->lid)
+ break;
+ }
+ assert(j < f->n_elines);
+
+ 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];
+
+ for (j = 0; j < f->n_elines; j++) {
+ el1 = f->elines[j];
+
+ if (el1->id == ec->lid)
+ break;
+ }
+ assert(j < f->n_elines);
+
+ 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
for (i = 0; i < f->n_elines; i++) {
el0 = f->elines[i];
+ el0->n_lines = 0;
+
scf_loge("i: %ld, el0: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", i, el0->id, el0->n_conns, el0->n_pins, el0->flags);
for (j = 0; j < el0->n_conns; j++) {
scf_logi("j: %ld, lid: %ld, n_cids: %ld\n", j, ec->lid, ec->n_cids);
}
-
printf("\n");
}
#endif
if (0 == el->n_lines) {
- int ret = __ses_layout_function(f, el, &n, d, bx, by, bw, bh);
+ int ret = __ses_layout_function2(f, el, &n, d, bx, by, bw, bh);
if (ret < 0)
return ret;
}