Rb = V / Ib;
}
#endif
- if (dI < -1e-10
- && -1e8 < Rb && Rb < 1e8) {
+ if (Ib > 0 && dI < -1e-10 && -1e8 < Rb && Rb < 1e8) {
if (!edge->amplify_flag) {
edge->amplify_flag = 1;
-#if 0
+#if 1
scf_logi("edge: [%d], ", edge->index);
ses_pin_print(p0);
ses_pin_print(p1);
- printf("[b%d], Ic: %lg, Ib: %lg, dI: %lg, Vbe: %lg, Rb: %lg\n", edge->edge_b->index, Ic, Ib, dI, Vb - Ve, Rb);
+ printf("[b%d], Ic: %lg, Ib: %lg, dI: %lg, Vbe: %lg, Vce: %lg, Vc: %lg, Ve: %lg, Rb: %lg\n", edge->edge_b->index, Ic, Ib, dI, Vb - Ve, Vc - Ve, Vc, Ve, Rb);
#endif
for (i = 0; i < N; i++)
A[(n + edge->index) * N + i] = 0;
#include"ses_core.h"
-static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ctx)
+static int _dc_input_handler(ScfEfunction* f, int64_t ps, int64_t count, ses_ctx_t* ctx)
{
ScfEcomponent* B;
ScfEcomponent* c;
ScfEline* el2;
ScfEpin* p;
- size_t i;
- size_t j;
- int k;
+ long i;
+ long j;
+ int k;
+
+ int x[] = {0, 0, 1, 0, 1};
+ int y[] = {1, 1, 0, 1, 0};
B = f->components[0];
if (!(SCF_EDA_PIN_IN & el->flags))
continue;
- k = 1 % 2;
+ if (SCF_EDA_PIN_IN0 & el->flags)
+ k = x[(count / 100) & 0x1];
+ else
+ k = y[(count / 100) & 0x1];
+ scf_logi("el->io_lid: %ld, k: %d\n", el->io_lid, k);
+
el2 = f->elines[B->pins[k]->lid];
- el->v = k * B->v;
+ el->v = el2->v;
el->vconst = 1;
for (j = 0; j + 1 < el->n_pins; j += 2) {
c = f->components[el->pins[j]];
p = c->pins [el->pins[j + 1]];
+ if (p->lid != p->c_lid)
+ assert(0 == scf_eline__del_pin(f->elines[p->lid], c->id, p->id));
+
int ret = scf_eline__add_pin(el2, c->id, p->id);
if (ret < 0)
return ret;
+ scf_logw("c%ld, p%ld, l%ld --> l%ld\n", c->id, p->id, p->lid, el2->id);
p->lid = el2->id;
- scf_logw("c%ld, p%ld, l%ld --> l%ld\n", c->id, p->id, p->c_lid, p->lid);
}
scf_logw("IN el: %ld, V: %lg\n", el->id, el->v);