_va_transistor_handler()
authoryu.dongliang <18588496441@163.com>
Thu, 19 Oct 2023 13:36:42 +0000 (21:36 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 19 Oct 2023 13:36:42 +0000 (21:36 +0800)
ses_step_va_transistor.c

index 2c4ec9976acb668cb07817cd54e95ab11fd7124f..26cde5b71ac2c883821ab18f1821e8937b54bf90 100644 (file)
@@ -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_path_va_transistor(ScfEfunction* f, ses_path_t* path)
+static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path, int* changed)
 {
        ses_path_t*    parent = path->parent;
        ses_path_t*    child;
@@ -140,8 +140,9 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
        return 0;
 }
 
-static int ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
+static int ses_path_va_transistor(ScfEfunction* f, ses_path_t* path, int* changed)
 {
+       ses_path_t*    child;
        ScfEcomponent* B;
        ScfEpin*       p0;
        ScfEpin*       p1;
@@ -167,14 +168,15 @@ static int ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
        p0 = path->pins->data[0];
        p1 = path->pins->data[path->pins->size - 1];
 
-       int ret = __ses_path_va_transistor(f, path);
+       int ret = __ses_path_va_transistor(f, path, changed);
        if (ret < 0)
                return ret;
 
        if (path->childs) {
                for (j = 0; j < path->childs->size; j++) {
+                       child     = path->childs->data[j];
 
-                       ret = ses_path_va_transistor(f, path->childs->data[j]);
+                       ret = ses_path_va_transistor(f, child, changed);
                        if (ret < 0)
                                return ret;
                }
@@ -187,21 +189,22 @@ static int _va_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
 {
        ses_path_t* path;
 
-       size_t i;
+       int changed = 0;
+       int i;
 
        for (i = 0; i < ctx->paths->size; i++) {
                path      = ctx->paths->data[i];
 
-               scf_logi("i: %ld, path->type: %d\n", i, path->type);
+               scf_logi("i: %d, path->index: %d\n", i, path->index);
 
-               int ret = ses_path_va_transistor(f, path);
+               int ret = ses_path_va_transistor(f, path, &changed);
                if (ret < 0)
                        return ret;
 
                printf("\n");
        }
 
-       return 0;
+       return changed > 0 ? -EAGAIN : 0;
 }
 
 ses_step_t  ses_step_va_transistor =