}
}
-
static void __ses_de_cross(ScfEfunction* f, int d)
{
ScfEcomponent* c0;
}
}
-static void __ses_set_cx(ScfEfunction* f, int d)
+static void __ses_setc_xy(ScfEfunction* f, int d)
{
ScfEcomponent* c;
ScfEpin* p0;
ScfEpin* p1;
size_t i;
+ size_t j;
for (i = 0; i < f->n_components; i++) {
c = f->components[i];
c->x = (p0->x + p1->x) / 2;
c->y = (p0->y + p1->y) / 2;
+
+ p0->x = c->x;
+ p1->x = c->x;
+
+ for (j = 2; j < c->n_pins; j++) {
+ p0 = c->pins[j];
+
+ p0->x = (p0->x + 3 * c->x) / 4;
+ }
}
}
qsort(f->components, f->n_components, sizeof(ScfEcomponent*), ecomponent_cmp_id);
}
-static void __ses_xchg_npn_ce(ScfEfunction* f, int d)
+static void __ses_xchg_ce(ScfEfunction* f, int d)
{
ScfEcomponent* c;
ScfEpin* pb;
pc = c->pins[SCF_EDA_NPN_C];
pe = c->pins[SCF_EDA_NPN_E];
- pc->x = (pc->x + c->x * 3) / 4;
+// pc->x = (pc->x + c->x * 3) / 4;
if (pc->y > pe->y)
SCF_XCHG(pc, pe);
}
}
-int ses_layout_function(ScfEfunction* f, int d)
+static void __ses_mov_pos(ScfEfunction* f, int d)
{
ScfEcomponent* c;
- ScfEcomponent* c2;
- ScfEline* el;
- ScfEline* el2;
- ScfEpin* p0;
- ScfEpin* p1;
+ ScfEpin* p;
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);
-
- __ses_set_cx (f, d);
- __ses_xchg_cx(f, d);
-
- __ses_xchg_npn_ce(f, d);
-
- __ses_layout_cx(f, d);
int mx = 0;
int nx = INT_MIN;
c = f->components[i];
for (j = 0; j < c->n_pins; j++) {
- p0 = c->pins[j];
+ p = c->pins[j];
- if (p0->x < 0) {
- if (mx > p0->x)
- mx = p0->x;
+ if (p->x < 0) {
+ if (mx > p->x)
+ mx = p->x;
- if (nx < p0->x)
- nx = p0->x;
+ if (nx < p->x)
+ nx = p->x;
} else {
- if (px > p0->x)
- px = p0->x;
+ if (px > p->x)
+ px = p->x;
}
}
}
c = f->components[i];
for (j = 0; j < c->n_pins; j++) {
- p0 = c->pins[j];
+ p = c->pins[j];
- if (p0->x > 0)
- p0->x -= px - nx - d;
+ if (p->x > 0)
+ p->x -= px - nx - d;
- p0->x -= mx - d;
+ p->x -= mx - d;
}
if (c->x > 0)
c->x -= mx - d;
}
+}
+
+int ses_layout_function(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;
+
+ 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);
+
+ __ses_setc_xy(f, d);
+ __ses_xchg_cx(f, d);
+ __ses_xchg_ce(f, d);
+ __ses_mov_pos(f, d);
+// __ses_layout_cx(f, d);
int tx0 = INT_MAX;
int tx1 = 0;