From 6d8841c2bf76b1eb197830c30324162004c3ad6d Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 23 Oct 2023 14:11:53 +0800 Subject: [PATCH] __ses_path_va_bridge() --- ses_core.h | 2 ++ ses_step_va_bridge.c | 29 +++++++++++++++++++++++++++++ ses_step_va_transistor.c | 2 +- ses_utils.c | 2 ++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ses_core.h b/ses_core.h index e482331..89ae3c5 100644 --- a/ses_core.h +++ b/ses_core.h @@ -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) { /* diff --git a/ses_step_va_bridge.c b/ses_step_va_bridge.c index ab89ae3..00254cc 100644 --- a/ses_step_va_bridge.c +++ b/ses_step_va_bridge.c @@ -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; } diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index 564ba8f..26d4503 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -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; diff --git a/ses_utils.c b/ses_utils.c index d65442f..f4b0a45 100644 --- a/ses_utils.c +++ b/ses_utils.c @@ -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); } } -- 2.25.1