tmp
authoryu.dongliang <18588496441@163.com>
Tue, 11 Jul 2023 08:28:13 +0000 (16:28 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 11 Jul 2023 08:28:13 +0000 (16:28 +0800)
ses_layout.c

index b79ba46fadc47dd7d9b8016dd025fdbee7f823a1..d1c76553e6d43151deb24e5f43d7f5dae09bff2e 100644 (file)
@@ -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;