epin_cmp_npn_c()
authoryu.dongliang <18588496441@163.com>
Thu, 9 Nov 2023 15:07:36 +0000 (23:07 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 9 Nov 2023 15:07:36 +0000 (23:07 +0800)
ses_layout.c

index 23bca9624e83f59b087d26b098be1d97fdfb81db..41a30bf1cbbd299e2005f882cea6b989d68fb655 100644 (file)
@@ -20,6 +20,38 @@ int epin_cmp(const void* v0, const void* v1)
        return 0;
 }
 
+int epin_cmp_npn_c(const void* v0, const void* v1, void* arg)
+{
+       const uint64_t* t0 = v0;
+       const uint64_t* t1 = v1;
+
+       ScfEfunction*   f  = arg;
+       ScfEcomponent*  c0 = f->components[t0[0]];
+       ScfEcomponent*  c1 = f->components[t1[0]];
+       ScfEpin*        p0 = c0->pins[t0[1]];
+       ScfEpin*        p1 = c1->pins[t1[1]];
+
+       if (SCF_EDA_NPN != c0->type)
+               return 1;
+       if (SCF_EDA_NPN != c1->type)
+               return -1;
+
+       if (SCF_EDA_NPN_E != p0->id)
+               return 1;
+       if (SCF_EDA_NPN_E != p1->id)
+               return -1;
+
+       ScfEpin* pb0 = c0->pins[SCF_EDA_NPN_B];
+       ScfEpin* pb1 = c1->pins[SCF_EDA_NPN_B];
+
+       if (pb0->y < pb1->y)
+               return -1;
+       if (pb0->y > pb1->y)
+               return 1;
+
+       return 0;
+}
+
 int epin_cmp_color(const void* v0, const void* v1, void* arg)
 {
        const uint64_t* t0 = v0;