(ProtobufCMessageInit) scf_econn__init,
NULL,NULL,NULL /* reserved[123] */
};
-static const ProtobufCFieldDescriptor scf_eline__field_descriptors[6] =
+static const ProtobufCFieldDescriptor scf_eline__field_descriptors[7] =
{
{
"id",
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
- "conns",
+ "dfo",
4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEline, dfo),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "conns",
+ 5,
PROTOBUF_C_LABEL_REPEATED,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(ScfEline, n_conns),
},
{
"lines",
- 5,
+ 6,
PROTOBUF_C_LABEL_REPEATED,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(ScfEline, n_lines),
},
{
"vflag",
- 6,
+ 7,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_BOOL,
0, /* quantifier_offset */
},
};
static const unsigned scf_eline__field_indices_by_name[] = {
- 3, /* field[3] = conns */
+ 4, /* field[4] = conns */
+ 3, /* field[3] = dfo */
2, /* field[2] = flags */
0, /* field[0] = id */
- 4, /* field[4] = lines */
+ 5, /* field[5] = lines */
1, /* field[1] = pins */
- 5, /* field[5] = vflag */
+ 6, /* field[6] = vflag */
};
static const ProtobufCIntRange scf_eline__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 6 }
+ { 0, 7 }
};
const ProtobufCMessageDescriptor scf_eline__descriptor =
{
"ScfEline",
"",
sizeof(ScfEline),
- 6,
+ 7,
scf_eline__field_descriptors,
scf_eline__field_indices_by_name,
1, scf_eline__number_ranges,
size_t n_pins;
uint64_t *pins;
uint64_t flags;
+ int64_t dfo;
size_t n_conns;
ScfEconn **conns;
size_t n_lines;
};
#define SCF_ELINE__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&scf_eline__descriptor) \
- , 0, 0,NULL, 0, 0,NULL, 0,NULL, 0 }
+ , 0, 0,NULL, 0, 0, 0,NULL, 0,NULL, 0 }
struct _ScfEcomponent
required uint64 id = 1;
repeated uint64 pins = 2;
required uint64 flags = 3;
- repeated scf_econn conns = 4;
- repeated scf_line lines = 5;
- required bool vflag = 6;
+ required int64 dfo = 4;
+ repeated scf_econn conns = 5;
+ repeated scf_line lines = 6;
+ required bool vflag = 7;
}
message scf_ecomponent
struct ses_edge_s
{
- ScfEcomponent* c0;
- ScfEpin* p0;
+ ScfEline* el0;
+ ScfEline* el1;
- ScfEcomponent* c1;
+ ScfEcomponent* c;
+ ScfEpin* p0;
ScfEpin* p1;
};
}
uint8_t text[64];
- snprintf(text, sizeof(text) - 1, "%ld", el->id);
+ snprintf(text, sizeof(text) - 1, "%ld_%ld", el->id, el->dfo);
cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 24);
- cairo_move_to (cr, l->x0 - 20, l->y0 + 5);
+ cairo_move_to (cr, l->x0 - 40, l->y0 + 5);
cairo_show_text (cr, text);
cairo_stroke(cr);
#include"ses_core.h"
-static int __ses_dfs_tree(ScfEfunction* f, ScfEcomponent* root, scf_vector_t* edges, int64_t* total)
+static int __ses_dfs_tree(ScfEfunction* f, ScfEline* root, scf_vector_t* edges, int64_t* total)
{
ScfEcomponent* c;
- ScfEpin* p;
- ScfEpin* rp;
+ ScfEline* el;
+ ScfEpin* p0;
+ ScfEpin* p1;
ses_edge_t* e;
root->vflag = 1;
- for (i = 0; i < root->n_pins; i++) {
- rp = root->pins[i];
+ for (i = 0; i + 1 < root->n_pins; i += 2) {
- if (rp->vflag)
+ c = f->components[root->pins[i]];
+ p0 = c->pins [root->pins[i + 1]];
+
+ if (p0->vflag)
continue;
- rp->vflag = 1;
+ p0->vflag = 1;
+
+ for (j = 0; j < c->n_pins; j++) {
+ p1 = c->pins[j];
- for (j = 0; j + 1 < rp->n_tos; j += 2) {
+ if (p1->vflag)
+ continue;
+ p1->vflag = 1;
- c = f->components[rp->tos[j]];
- p = c->pins [rp->tos[j + 1]];
+ el = f->elines[p1->lid];
- if (c->vflag || p->vflag)
+ if (el->vflag)
continue;
+ el->vflag = 1;
e = malloc(sizeof(ses_edge_t));
if (!e)
return -ENOMEM;
- e->c0 = root;
- e->p0 = rp;
+ e->c = c;
+ e->p0 = p0;
+ e->p1 = p1;
- e->c1 = c;
- e->p1 = p;
+ e->el0 = root;
+ e->el1 = el;
- c->vflag = 1;
- p->vflag = 1;
-
- scf_loge("c%ld_p%ld -- l%ld --> c%ld_p%ld\n", root->id, rp->id, rp->lid, c->id, p->id);
+ scf_loge("l%ld --- c%ld_p%ld_p%ld --> l%ld\n", root->id, c->id, p0->id, p1->id, el->id);
int ret = scf_vector_add(edges, e);
if ( ret < 0)
return ret;
- ret = __ses_dfs_tree(f, c, edges, total);
+ ret = __ses_dfs_tree(f, el, edges, total);
if ( ret < 0)
return ret;
}
int ses_loop_function(ScfEfunction* f, scf_vector_t* loops)
{
- if (!f || !loops || f->n_components < 2)
+ if (!f || !loops || f->n_elines < 2)
return -EINVAL;
ScfEcomponent* c;
+ ScfEline* el;
ScfEpin* p;
scf_vector_t* edges = scf_vector_alloc();
size_t j;
size_t k;
- int64_t total = f->n_components;
+ int64_t total = f->n_elines;
for (i = 0; i < f->n_components; i++) {
c = f->components[i];
}
}
- c = f->components[0];
-
- c->pins[SCF_EDA_Battery_NEG]->vflag = 1;
+ for (i = 0; i < f->n_elines; i++) {
+ el = f->elines[i];
+ el->vflag = 0;
+ }
- __ses_dfs_tree(f, c, edges, &total);
+ __ses_dfs_tree(f, f->elines[0], edges, &total);
return 0;
}