__ses_path_parent_jr()
authoryu.dongliang <18588496441@163.com>
Thu, 19 Oct 2023 07:32:31 +0000 (15:32 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 19 Oct 2023 07:32:31 +0000 (15:32 +0800)
ses_core.h
ses_step_jr.c

index 89a54def3b82aff0377dffb6f5ab45aaddacefc0..e19d6d9c00a04cad0599cb125d5b4b4086356fe6 100644 (file)
@@ -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;
 
index ae9f6517808c13940f67a673ae98aa257176acf8..2b617bfe5665af064a8ba135dbeb685f3a9a6a18 100644 (file)
@@ -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");
        }