From: yu.dongliang <18588496441@163.com> Date: Sun, 12 Nov 2023 14:10:21 +0000 (+0800) Subject: __ses_status_check() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=58c400ab9c06c74c0aeeaa34037852745cd4705c;p=ses.git __ses_status_check() --- diff --git a/ses_step_dc_transistor.c b/ses_step_dc_transistor.c index 3b3ccd0..031382e 100644 --- a/ses_step_dc_transistor.c +++ b/ses_step_dc_transistor.c @@ -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", diff --git a/ses_step_topo.c b/ses_step_topo.c index f1fdfb0..cc91f43 100644 --- a/ses_step_topo.c +++ b/ses_step_topo.c @@ -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]; diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index a562111..fc54c2a 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -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); }