From: yu.dongliang <18588496441@163.com> Date: Thu, 20 Jul 2023 03:20:22 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=b268934c8d07c2d52c406cbd206ac69efc1a87c6;p=ses.git tmp --- diff --git a/ses_step_dc_diode.c b/ses_step_dc_diode.c index a73d5c6..78506b5 100644 --- a/ses_step_dc_diode.c +++ b/ses_step_dc_diode.c @@ -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, }; diff --git a/ses_step_dc_input.c b/ses_step_dc_input.c index 6aaf1e0..4e59bd1 100644 --- a/ses_step_dc_input.c +++ b/ses_step_dc_input.c @@ -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); } }