From eda8a09c9e0b8919f61cad0dc9fc77f437179daf Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Thu, 20 Jul 2023 11:07:12 +0800 Subject: [PATCH] dc input --- Makefile | 1 + ses_layout.c | 2 ++ ses_step_battery.c | 7 +++---- ses_step_dc_input.c | 13 ++++++++++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 466ee4a..cbd3363 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ CFILES += ses_layout.c CFILES += ses_loop.c CFILES += ses_steps.c +CFILES += ses_step_battery.c CFILES += ses_step_dc_input.c CFILES += ses_step_dc_diode.c CFILES += ses_step_dc_transistor.c diff --git a/ses_layout.c b/ses_layout.c index 509d49e..eeebc8c 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -980,6 +980,8 @@ int ses_layout_board(ScfEboard* b) return ret; } + ses_steps_analyse(f, 5, 5); + x = f->x; y = f->y; w = f->w; diff --git a/ses_step_battery.c b/ses_step_battery.c index b8256b6..8bdf125 100644 --- a/ses_step_battery.c +++ b/ses_step_battery.c @@ -3,7 +3,6 @@ static int _battery_handler(ScfEfunction* f, int64_t ns, int64_t count) { ScfEcomponent* c; - ScfEfunction* f; ScfEline* el; ScfEpin* p; @@ -12,15 +11,15 @@ static int _battery_handler(ScfEfunction* f, int64_t ns, int64_t count) size_t k; c = f->components[0]; - c->V = 5; + c->v = 5; p = c->pins[SCF_EDA_Battery_POS]; el = f->elines[p->lid]; - el->V = 5; + el->v = 5; p = c->pins[SCF_EDA_Battery_NEG]; el = f->elines[p->lid]; - el->V = 0; + el->v = 0; return 0; } diff --git a/ses_step_dc_input.c b/ses_step_dc_input.c index f27e1f3..6aaf1e0 100644 --- a/ses_step_dc_input.c +++ b/ses_step_dc_input.c @@ -3,7 +3,7 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count) { ScfEcomponent* c; - ScfEfunction* f; + ScfEcomponent* B; ScfEline* el; ScfEpin* p; @@ -11,6 +11,9 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count) size_t j; size_t k; + B = f->components[0]; + k = 0; + for (i = 0; i < f->n_elines; i++) { el = f->elines[i]; @@ -20,10 +23,18 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count) p = c->pins [el->pins[j + 1]]; 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; } } } + return 0; } ses_step_t ses_step_dc_input = -- 2.25.1