#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,
};
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);
}
}