From: yu.dongliang <18588496441@163.com> Date: Tue, 11 Jul 2023 08:04:08 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=fbe8eb5fa06a8cbc184cf1190b86ced67849ca29;p=ses.git tmp --- diff --git a/ses_layout.c b/ses_layout.c index 8282334..b79ba46 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -39,6 +39,16 @@ int eline_cmp(const void* v0, const void* v1) const ScfEline* el0 = *(const ScfEline**)v0; const ScfEline* el1 = *(const ScfEline**)v1; + if (SCF_EDA_PIN_POS == el0->flags) + return -1; + if (SCF_EDA_PIN_NEG == el0->flags) + return 1; + + if (SCF_EDA_PIN_POS == el1->flags) + return 1; + if (SCF_EDA_PIN_NEG == el1->flags) + return -1; + if (el0->n_conns < el1->n_conns) return 1; @@ -101,8 +111,14 @@ int ses_pins_same_line(ScfEfunction* f) else { if (scf_eline__add_pin(el, p->cid, p->id) < 0) return -ENOMEM; - p->lid = el->id; - + p ->lid = el->id; + + if (SCF_EDA_Battery == c->type) { + if (SCF_EDA_Battery_POS == p->id) + el->flags = SCF_EDA_PIN_POS; + else + el->flags = SCF_EDA_PIN_NEG; + } goto next; } } @@ -120,7 +136,14 @@ int ses_pins_same_line(ScfEfunction* f) if (scf_eline__add_pin(el, p->cid, p->id) < 0) return -ENOMEM; - p->lid = el->id; + p ->lid = el->id; + + if (SCF_EDA_Battery == c->type) { + if (SCF_EDA_Battery_POS == p->id) + el->flags = SCF_EDA_PIN_POS; + else + el->flags = SCF_EDA_PIN_NEG; + } next: p = NULL; } @@ -130,7 +153,7 @@ next: for (i = 0; i < f->n_elines; i++) { el = f->elines[i]; - scf_logw("line i: %ld, %p\n", i, el); + scf_logw("line i: %ld, %p, el->flags: %#lx\n", i, el, el->flags); for (j = 0; j + 1 < el->n_pins; j += 2) @@ -219,7 +242,7 @@ int ses_lines_same_components(ScfEfunction* f) for (i = 0; i < f->n_elines; i++) { el0 = f->elines[i]; - scf_loge("i: %ld, el0: %ld, n_conns: %ld, n_pins: %ld\n", i, el0->id, el0->n_conns, el0->n_pins); + 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++) { ec = el0->conns[j]; @@ -259,7 +282,11 @@ int __ses_layout_function2(ScfEfunction* f, ScfEline* el, size_t* pn, uint32_t d if (!l) return -ENOMEM; - l->x0 = bx; + if (SCF_EDA_PIN_NEG == el->flags || SCF_EDA_PIN_POS == el->flags) + l->x0 = bx; + else + l->x0 = bx + d; + l->y0 = by + (n + j) * d; l->y1 = l->y0; @@ -303,11 +330,6 @@ int __ses_layout_function(ScfEfunction* f, ScfEline* el, size_t* pn, uint32_t d, if (el2->id == ec->lid && 0 == el2->n_lines) { - int diff = 10 + rand() % 20; - - bx += diff; - bw -= diff; - ret = __ses_layout_function(f, el2, pn, d, bx, by, bw, bh); if (ret < 0) return ret; @@ -350,11 +372,6 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u int ret = __ses_layout_function(f, el, &n, d, bx, by, bw, bh); if (ret < 0) return ret; - - int diff = 10 + rand() % 20; - - bx += diff; - bw -= diff; } } scf_logi("f->x: %d, f->y: %d, f->w: %d, f->h: %d\n", f->x, f->y, f->w, f->h);