__ses_status_check()
authoryu.dongliang <18588496441@163.com>
Sun, 12 Nov 2023 14:10:21 +0000 (22:10 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 12 Nov 2023 14:10:21 +0000 (22:10 +0800)
ses_step_dc_transistor.c
ses_step_topo.c
ses_step_va_transistor.c

index 3b3ccd031f9ed7652731570656722394b1ec7b2b..031382e94aa21b02026ab056d8e3dfdd3af213dc 100644 (file)
@@ -52,9 +52,10 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
                        if (le->v == Bn->v)
                                lb->vconst = 1;
 
-                       if (pb->v > Bp->v)
-                               c->status = SCF_EDA_Status_OFF;
-                       else
+                       if (pb->v > Bp->v) {
+                               if (!c->lock)
+                                       c->status = SCF_EDA_Status_OFF;
+                       } else
                                c->status = SCF_EDA_Status_ON;
 
                } else if (le->v < SCF_EDA_V_MIN) {
@@ -66,9 +67,10 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
                        if (lb->v == Bp->v)
                                le->vconst = 1;
 
-                       if (pe->v < Bn->v)
-                               c->status = SCF_EDA_Status_OFF;
-                       else
+                       if (pe->v < Bn->v) {
+                               if (!c->lock)
+                                       c->status = SCF_EDA_Status_OFF;
+                       } else
                                c->status = SCF_EDA_Status_ON;
 
                } else if (lb->v >= le->v + SCF_EDA_V_NPN_OFF) {
@@ -88,14 +90,16 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
                        pb->v = lb->v;
                        pe->v = le->v;
 
-                       if (pb->v > Bp->v)
-                               c->status = SCF_EDA_Status_OFF;
-                       else
+                       if (pb->v > Bp->v) {
+                               if (!c->lock)
+                                       c->status = SCF_EDA_Status_OFF;
+                       } else
                                c->status = SCF_EDA_Status_ON;
                } else {
                        pb->v = lb->v;
                        pe->v = le->v;
-                       c->status = SCF_EDA_Status_OFF;
+                       if (!c->lock)
+                               c->status = SCF_EDA_Status_OFF;
                }
 
                scf_loge("\033[34mc%ld, status: %d, pb->v: %lg, pe->v: %lg, diff: %lg, off: %lg\033[0m\n",
index f1fdfb0f55c906d0581ba7be6303e93064becb5f..cc91f4321e5621e4fc8723e3c71c5b96c6d907f0 100644 (file)
@@ -651,6 +651,7 @@ static void _topo_clear(ScfEfunction* f)
        for (i = 0; i < f->n_components; i++) {
                c         = f->components[i];
                c->vflag  = 0;
+               c->lock   = 0;
 
                for (j = 0; j < c->n_pins; j++) {
                        p         = c->pins[j];
index a562111a5eb7ef4f6622d721c808588a5d0bb9be..fc54c2a4cf2ac1396fa0c27d92f316ecd031becd 100644 (file)
@@ -48,7 +48,8 @@ int __ses_status_check(ScfEfunction* f, ScfEcomponent* c, ScfEpin* pb, ScfEpin*
 
                if (pb->v > Bp->v) {
                        pb->v = Bp->v;
-                       c->status = SCF_EDA_Status_OFF;
+                       if (!c->lock)
+                               c->status = SCF_EDA_Status_OFF;
                } else
                        c->status = SCF_EDA_Status_ON;
                goto _changed;
@@ -58,7 +59,8 @@ int __ses_status_check(ScfEfunction* f, ScfEcomponent* c, ScfEpin* pb, ScfEpin*
 
                if (pe->v < Bn->v) {
                        pe->v = Bn->v;
-                       c->status = SCF_EDA_Status_OFF;
+                       if (!c->lock)
+                               c->status = SCF_EDA_Status_OFF;
                } else
                        c->status = SCF_EDA_Status_ON;
                goto _changed;
@@ -66,7 +68,8 @@ int __ses_status_check(ScfEfunction* f, ScfEcomponent* c, ScfEpin* pb, ScfEpin*
        } else if (pb->v - pe->v < Voff) {
 
                if (c->status != SCF_EDA_Status_OFF) {
-                       c->status  = SCF_EDA_Status_OFF;
+                       if (!c->lock)
+                               c->status  = SCF_EDA_Status_OFF;
                        goto _changed;
                }
        } else if (SCF_EDA_Status_ON != c->status) {
@@ -90,6 +93,7 @@ _changed:
 
                        if (SCF_EDA_NPN == c2->type && SCF_EDA_NPN_B == p2->id) {
                                c2->status  = SCF_EDA_Status_ON;
+                               c2->lock    = 1;
 
                                scf_loge("\033[35mc%ld, status: %d\033[0m\n", c2->id, c2->status);
                        }