From: yu.dongliang <18588496441@163.com> Date: Wed, 19 Jul 2023 16:26:59 +0000 (+0800) Subject: ses_analysis.c X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=624a8d2b43c13470ac090e9eebf8dcc8be916d7e;p=ses.git ses_analysis.c --- diff --git a/ses_analysis.c b/ses_analysis.c new file mode 100644 index 0000000..4e1b1f9 --- /dev/null +++ b/ses_analysis.c @@ -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; +} diff --git a/ses_core.h b/ses_core.h index cecc74b..ca83fd2 100644 --- a/ses_core.h +++ b/ses_core.h @@ -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