From abe3e30306058f12a5d06940510765780440ae97 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Tue, 11 Jul 2023 16:28:13 +0800 Subject: [PATCH] tmp --- ses_layout.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index b79ba46..d1c7655 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -39,14 +39,14 @@ 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) + if (SCF_EDA_PIN_POS & el0->flags) return -1; - if (SCF_EDA_PIN_NEG == el0->flags) + if (SCF_EDA_PIN_NEG & el0->flags) return 1; - if (SCF_EDA_PIN_POS == el1->flags) + if (SCF_EDA_PIN_POS & el1->flags) return 1; - if (SCF_EDA_PIN_NEG == el1->flags) + if (SCF_EDA_PIN_NEG & el1->flags) return -1; if (el0->n_conns < el1->n_conns) @@ -111,14 +111,9 @@ 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; - - 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; - } + + p ->lid = el->id; + el->flags |= p->flags; goto next; } } @@ -136,14 +131,9 @@ int ses_pins_same_line(ScfEfunction* f) if (scf_eline__add_pin(el, p->cid, p->id) < 0) return -ENOMEM; - 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; - } + p ->lid = el->id; + el->flags |= p->flags; next: p = NULL; } @@ -282,10 +272,13 @@ int __ses_layout_function2(ScfEfunction* f, ScfEline* el, size_t* pn, uint32_t d if (!l) return -ENOMEM; - if (SCF_EDA_PIN_NEG == el->flags || SCF_EDA_PIN_POS == el->flags) + if ((SCF_EDA_PIN_NEG | SCF_EDA_PIN_POS) & el->flags) l->x0 = bx; - else + + else if ((SCF_EDA_PIN_IN | SCF_EDA_PIN_OUT) & el->flags) l->x0 = bx + d; + else + l->x0 = bx + 2 * d + rand() % d; l->y0 = by + (n + j) * d; l->y1 = l->y0; -- 2.25.1