tmp
authoryu.dongliang <18588496441@163.com>
Thu, 20 Jul 2023 03:20:22 +0000 (11:20 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 20 Jul 2023 03:20:22 +0000 (11:20 +0800)
ses_step_dc_diode.c
ses_step_dc_input.c

index a73d5c685292e738bf3f2f8dd2348fca390c75b1..78506b5b2821335d5ffd712f71af2efea237c246 100644 (file)
@@ -1,8 +1,41 @@
 #include"ses_core.h"
 
+static int _dc_diode_handler(ScfEfunction* f, int64_t ns, int64_t count)
+{
+       ScfEcomponent*   c;
+       ScfEcomponent*   B;
+       ScfEline*        el;
+       ScfEpin*         p;
+
+       size_t i;
+       size_t j;
+       size_t k;
+
+       B = f->components[0];
+       k = 0;
+
+       for (i = 0; i < f->n_elines; i++) {
+               el =        f->elines[i];
+
+               if (!(SCF_EDA_PIN_IN & el->flags))
+                       continue;
+
+               for (j = 0; j + 1 < el->n_pins; j += 2) {
+
+                       c  = f->components[el->pins[j]];
+
+                       if (SCF_EDA_Diode != c->type)
+                               continue;
+
+               }
+       }
+
+       return 0;
+}
 
-ses_step_t  ses_step_dc_diode =
+ses_step_t   ses_step_dc_diode =
 {
-       .name = "dc_diode",
+       .name    = "dc_diode",
 
+       .handler = _dc_diode_handler,
 };
index 6aaf1e08c2cb23a7bd7005800c991e3ab0f70d7c..4e59bd1ac4dd9f3a4ccf480a9ed77cb0e36efc47 100644 (file)
@@ -2,35 +2,22 @@
 
 static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count)
 {
-       ScfEcomponent*   c;
        ScfEcomponent*   B;
        ScfEline*        el;
        ScfEpin*         p;
 
        size_t i;
-       size_t j;
-       size_t k;
 
        B = f->components[0];
-       k = 0;
 
        for (i = 0; i < f->n_elines; i++) {
                el =        f->elines[i];
 
-               for (j = 0; j + 1 < el->n_pins; j += 2) {
+               if (SCF_EDA_PIN_IN & el->flags) {
 
-                       c  = f->components[el->pins[j]];
-                       p  = c->pins      [el->pins[j + 1]];
+                       el->v = (rand() & 0x1) * B->v;
 
-                       if (SCF_EDA_PIN_IN & p->flags) {
-
-                               el->v = (rand() & 0x1) * B->v;
-
-                               scf_logw("IN el: %ld, V: %lg\n", el->id, el->v);
-
-                               k++;
-                               break;
-                       }
+                       scf_logw("IN el: %ld, V: %lg\n", el->id, el->v);
                }
        }