ses_analysis.c
authoryu.dongliang <18588496441@163.com>
Wed, 19 Jul 2023 16:26:59 +0000 (00:26 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 19 Jul 2023 16:26:59 +0000 (00:26 +0800)
ses_analysis.c [new file with mode: 0644]
ses_core.h

diff --git a/ses_analysis.c b/ses_analysis.c
new file mode 100644 (file)
index 0000000..4e1b1f9
--- /dev/null
@@ -0,0 +1,61 @@
+#include"ses_core.h"
+
+extern ses_step_t   ses_step_dc_input;
+//extern ses_step_t   ses_step_ac_start;
+
+extern ses_step_t   ses_step_dc_diode;
+extern ses_step_t   ses_step_dc_transistor;
+
+//extern ses_step_t   ses_step_ac_transistor;
+//extern ses_step_t   ses_step_ac_diode;
+
+extern ses_step_t   ses_step_simplify;
+extern ses_step_t   ses_step_va;
+extern ses_step_t   ses_step_va_balance;
+
+extern ses_step_t   ses_step_output;
+
+
+static ses_step_t*  ses_steps[] =
+{
+       &ses_step_dc_input,
+
+       &ses_step_dc_diode,
+       &ses_step_dc_transistor,
+
+       &ses_step_simplify,
+       &ses_step_va,
+       &ses_step_va_balance,
+
+       &ses_step_output,
+};
+
+
+int ses_analyse_function(ScfEfunction* f, int64_t ns, int64_t count)
+{
+       if (!f || ns <= 0 || count < 0)
+               return -EINVAL;
+
+       ses_step_t* s;
+
+       int64_t i;
+       int64_t j;
+
+       for (i = 0; i < count; i++) {
+
+               for (j = 0; j < sizeof(ses_steps) / sizeof(ses_steps[0]); j++) {
+                       s  = ses_steps[j];
+
+                       if (!s || !s->handler)
+                               continue;
+
+                       int ret = s->handler(f, ns, i);
+                       if (ret < 0) {
+                               scf_loge("analysis step '%s' ret: %d\n", s->name, ret);
+                               return ret;
+                       }
+               }
+       }
+
+       return 0;
+}
index cecc74b50d99af88d74f4e7291dac61245aaa094..ca83fd2aa06762372c99250d25ee558faf536230 100644 (file)
@@ -4,6 +4,7 @@
 #include"scf_eda_pb.h"
 #include"scf_vector.h"
 
+typedef struct ses_step_s    ses_step_t;
 typedef struct ses_loop_s    ses_loop_t;
 typedef struct ses_edge_s    ses_edge_t;
 typedef struct ses_pin_s     ses_pin_t;
@@ -29,8 +30,20 @@ struct ses_loop_s
        scf_vector_t*  pins;
 };
 
+struct ses_step_s
+{
+       const char*    name;
+
+       int          (*handler)(ScfEfunction* f, int64_t ns, int64_t count);
+
+       void*          priv;
+};
+
+
 int ses_layout_board (ScfEboard*    b);
 
 int ses_loop_function(ScfEfunction* f, scf_vector_t* loops);
 
+int ses_analyse_function(ScfEfunction* f, int64_t ns, int64_t count);
+
 #endif