for (i = 0; i < f->n_elines; i++) {
el = f->elines[i];
- uint32_t sum = 0;
+ for (j = 0; j + 1 < el->n_pins; j += 2) {
- for (j = 0; j < el->n_conns; j++) {
- ec = el->conns[j];
+ uint64_t cid = el->pins[j];
+ uint64_t pid = el->pins[j + 1];
- el2 = NULL;
- for (k = 0; k < f->n_elines; k++) {
- el2 = f->elines[k];
-
- if (el2->id == ec->lid)
- break;
- }
+ scf_logi("j: %ld, cid: %ld, pid: %ld\n", j, cid, pid);
- assert(k < f->n_elines);
- uint32_t dis = UINT_MAX;
+ ScfEcomponent* c = f->components[cid];
+ ScfEpin* p = NULL;
- for (k = 0; k < el->n_lines; k++) {
- l = el->lines[k];
+ assert(c->id == cid);
- for (m = 0; m < el2->n_lines; m++) {
- l2 = el2->lines[m];
+ for (k = 0; k < c->n_pins; k++) {
+ p = c->pins[k];
- uint32_t dis2;
+ if (p->id == pid)
+ break;
+ p = NULL;
+ }
+ assert(p);
- if (l->y0 < l2->y0)
- dis2 = l2->y0 - l->y0;
- else
- dis2 = l->y0 - l2->y0;
+ m = j * d / f->w;
+ assert(m < el->n_lines);
- if (dis > dis2)
- dis = dis2;
- }
- }
+ l = el->lines[m];
+ m = j * d % f->w;
+ assert(m < l->x1);
- sum += dis;
+ p->x = l->x1 - m;
+ p->y = l->y0;
}
-
- scf_logi("el->id: %ld, sum: %d\n", el->id, sum);
}
return 0;
int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_t bh)
{
+ ScfEcomponent* c;
ScfEfunction* f;
ScfEline* el;
+ ScfEpin* p;
ScfLine* l;
cairo_surface_t* surface;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, bx + bw, by + bh);
cr = cairo_create (surface);
- cairo_set_line_width(cr, 1);
+ cairo_set_line_width(cr, 2);
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_rectangle (cr, 0, 0, bx + bw, by + bh);
cairo_fill(cr);
size_t j;
size_t k;
- double colors[5][3] =
+ double lcolors[3][3] =
{
- {0, 1, 0},
-
{1, 0, 1},
- {1, 1, 0},
+ {1, 0.5, 0},
{0, 1, 1},
-
- {1, 0.5, 0.5},
};
for (i = 0; i < b->n_functions; i++) {
for (j = 0; j < f->n_elines; j++) {
el = f->elines[j];
- double red = colors[j % 5][0];
- double green = colors[j % 5][1];
- double blue = colors[j % 5][2];
+ double red = lcolors[j % 3][0];
+ double green = lcolors[j % 3][1];
+ double blue = lcolors[j % 3][2];
cairo_set_source_rgb(cr, red, green, blue);
}
}
+ double ccolors[3][3] =
+ {
+ {1, 0, 0},
+ {0, 1, 0},
+ {0, 0, 1},
+ };
+
+ for (i = 0; i < b->n_functions; i++) {
+ f = b->functions[i];
+
+ for (j = 0; j < f->n_components; j++) {
+ c = f->components[j];
+
+ double red = ccolors[j % 3][0];
+ double green = ccolors[j % 3][1];
+ double blue = ccolors[j % 3][2];
+
+ cairo_set_source_rgb(cr, red, green, blue);
+
+ scf_logw("j: %ld, c->id: %ld, n_pins: %ld, ", j, c->id, c->n_pins);
+
+ for (k = 0; k < c->n_pins; k++) {
+ p = c->pins[k];
+
+ printf("p[%ld]: %d,%d, ", k, p->x, p->y);
+
+ if (0 == k)
+ cairo_move_to(cr, p->x, p->y);
+ else
+ cairo_line_to(cr, p->x, p->y);
+ }
+ printf("\n");
+ }
+ cairo_stroke(cr);
+ }
+
cairo_surface_write_to_png(surface, "./a.png");
cairo_destroy(cr);
ses_lines_same_components(f);
- ses_layout_function(f, 5, x + 20, y + 20, w - 20, h - 20);
+ int ret = ses_layout_function(f, 25, x + 30, y + 30, w - 40, h - 40);
+ if (ret < 0) {
+ scf_loge("\n");
+ return ret;
+ }
}
ses_layout_draw(b, x, y, w, h);