From: yu.dongliang <18588496441@163.com> Date: Thu, 19 Oct 2023 07:32:31 +0000 (+0800) Subject: __ses_path_parent_jr() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=d0d060637b2cad9a90077ed4401e6ccb78080608;p=ses.git __ses_path_parent_jr() --- diff --git a/ses_core.h b/ses_core.h index 89a54de..e19d6d9 100644 --- a/ses_core.h +++ b/ses_core.h @@ -53,6 +53,12 @@ struct ses_path_s int parent_p0; int parent_p1; + double parent_r0; + double parent_jr0; + + double parent_r1; + double parent_jr1; + double r0; double jr0; diff --git a/ses_step_jr.c b/ses_step_jr.c index ae9f651..2b617bf 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -13,8 +13,13 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1 if (SCF_EDA_NPN_E == p1->id) { if (cp1 != p1) p1 = path->pins->data[j - 1]; - } else + + } else if (j > 0) p1 = path->pins->data[j - 1]; + else { + *r = 0; + *jr = 0; + } } if (SCF_EDA_NPN == c0->type) { @@ -177,6 +182,43 @@ static int __ses_path_jr(ScfEfunction* f, ses_path_t* path) return 0; } +static void __ses_path_parent_jr(ScfEfunction* f, ses_path_t* path) +{ + if (!path->childs) + return; + + ses_path_t* child; + + int i; + + for (i = 0; i < path->childs->size; i++) { + child = path->childs->data[i]; + + child->parent_r0 = 0; + child->parent_jr0 = 0; + + child->parent_r1 = 0; + child->parent_jr1 = 0; + + if (child->parent_p0 > 0) + __ses_path_pr(f, path, 0, child->parent_p0, NULL, &child->parent_r0, &child->parent_jr0); + + if (child->parent_p1 < path->pins->size - 1) + __ses_path_pr(f, path, child->parent_p1, path->pins->size - 1, NULL, &child->parent_r1, &child->parent_jr1); + + child->parent_r0 += path->parent_r0; + child->parent_jr0 += path->parent_jr0; + + child->parent_r1 += path->parent_r1; + child->parent_jr1 += path->parent_jr1; + + scf_logw("child: %d, parent_p0: %d, parent_p1: %d, r0: %lg, r1: %lg\n", + child->index, child->parent_p0, child->parent_p1, child->parent_r0, child->parent_r1); + + __ses_path_parent_jr(f, child); + } +} + static int _jr_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ctx) { ses_path_t* path; @@ -199,6 +241,13 @@ static int _jr_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ct if (ret < 0) return ret; + path->parent_r0 = 0; + path->parent_jr0 = 0; + + path->parent_r1 = 0; + path->parent_jr1 = 0; + + __ses_path_parent_jr(f, path); printf("\n"); }