From ad646fb038a6a6286dffdd8d4706860807f7a358 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Thu, 9 Nov 2023 23:07:36 +0800 Subject: [PATCH] epin_cmp_npn_c() --- ses_layout.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ses_layout.c b/ses_layout.c index 23bca96..41a30bf 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -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; -- 2.25.1