__ses_path_va_bridge()
authoryu.dongliang <18588496441@163.com>
Mon, 23 Oct 2023 06:11:53 +0000 (14:11 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 23 Oct 2023 06:11:53 +0000 (14:11 +0800)
ses_core.h
ses_step_va_bridge.c
ses_step_va_transistor.c
ses_utils.c

index e482331050c217d4eb242fa9f27cab105298585b..89ae3c5a5821af4ce98392c5a1dfb965f832231b 100644 (file)
@@ -121,6 +121,8 @@ int  __ses_path_pos    (ScfEfunction* f, ScfEline* el);
 int  __ses_path_neg    (ScfEfunction* f, ScfEline* el);
 int  __ses_path_va     (ScfEfunction* f, ses_path_t* path);
 
+int  __ses_status_check(ScfEcomponent* c, ScfEpin* pb, ScfEpin* pe, ScfEpin* Bn);
+
 static inline void vertical(int* px, int* py, int dx, int dy, int d)
 {
        /*
index ab89ae385db2b41c20e1e497a84b92ee78d6431f..00254ccbb26b7fbf30e00c92d7c533ce630b887f 100644 (file)
@@ -12,10 +12,14 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* path, int* changed)
 
        ses_path_t*    child;
        ScfEcomponent* c;
+       ScfEcomponent* B;
        ScfEline*      el;
+       ScfEpin*       Bn;
        ScfEpin*       p0;
        ScfEpin*       p1;
 
+       int i;
+
        p0 = path->pins->data[0];
        p1 = path->pins->data[path->pins->size - 1];
 
@@ -37,6 +41,31 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* path, int* changed)
        if (ret < 0)
                return ret;
 
+       B  = f->components[0];
+       Bn = B->pins[SCF_EDA_Battery_NEG];
+
+       for (i = 0; i < path->pins->size; i++) {
+               p0 =        path->pins->data[i];
+
+               c = f->components[p0->cid];
+
+               if (SCF_EDA_NPN == c->type) {
+                       if (SCF_EDA_NPN_B == p0->id) {
+
+                               p1        = c->pins[SCF_EDA_NPN_E];
+                               *changed += __ses_status_check(c, p0, p1, Bn);
+                       }
+
+               } else if (SCF_EDA_Diode  == c->type) {
+
+                       if (SCF_EDA_Diode_POS == p0->id) {
+
+                               p1        = c->pins[SCF_EDA_Diode_NEG];
+                               *changed += __ses_status_check(c, p0, p1, Bn);
+                       }
+               }
+       }
+
        return 0;
 }
 
index 564ba8fa62ff183c536794f81220e1f7b56d7821..26d45038a24a338598635a4d346e5a71f7cc4d6a 100644 (file)
@@ -22,7 +22,7 @@ void __ses_path_dr_transistor(ScfEfunction* f, ses_path_t* path, int i, int j)
                        p->cid, p->id, v, r, p->sr, p->a, p->dr);
 }
 
-static int __ses_status_check(ScfEcomponent* c, ScfEpin* pb, ScfEpin* pe, ScfEpin* Bn)
+int __ses_status_check(ScfEcomponent* c, ScfEpin* pb, ScfEpin* pe, ScfEpin* Bn)
 {
        if (pe->v < SCF_EDA_V_MIN) {
                pe->v = pb->v - SCF_EDA_V_Diode_ON;
index d65442fe60940b2fcd09c495ce2d73474e9c0dd1..f4b0a45729a9a85453521505aff3e8994fb422c1 100644 (file)
@@ -322,6 +322,8 @@ void ses_path_free(ses_path_t* path)
                        scf_vector_free (path->bridges);
                }
 
+               scf_logd("path: %d\n", path->index);
+
                free(path);
        }
 }