(ProtobufCMessageInit) scf_line__init,
NULL,NULL,NULL /* reserved[123] */
};
-static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] =
+static const ProtobufCFieldDescriptor scf_epin__field_descriptors[30] =
{
{
"id",
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
- "x",
+ "path",
22,
PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEpin, path),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "x",
+ 23,
+ PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
offsetof(ScfEpin, x),
},
{
"y",
- 23,
+ 24,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
},
{
"n_diodes",
- 24,
+ 25,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
},
{
"l_pos",
- 25,
+ 26,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
},
{
"vflag",
- 26,
+ 27,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_BOOL,
0, /* quantifier_offset */
},
{
"pflag",
- 27,
+ 28,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_BOOL,
0, /* quantifier_offset */
},
{
"vconst",
- 28,
+ 29,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_BOOL,
0, /* quantifier_offset */
},
{
"aconst",
- 29,
+ 30,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_BOOL,
0, /* quantifier_offset */
};
static const unsigned scf_epin__field_indices_by_name[] = {
8, /* field[8] = a */
- 28, /* field[28] = aconst */
+ 29, /* field[29] = aconst */
5, /* field[5] = c_lid */
1, /* field[1] = cid */
15, /* field[15] = dr */
11, /* field[11] = jr */
18, /* field[18] = jsr */
7, /* field[7] = jv */
- 24, /* field[24] = l_pos */
+ 25, /* field[25] = l_pos */
2, /* field[2] = lid */
- 23, /* field[23] = n_diodes */
- 26, /* field[26] = pflag */
+ 24, /* field[24] = n_diodes */
+ 21, /* field[21] = path */
+ 27, /* field[27] = pflag */
19, /* field[19] = pr */
10, /* field[10] = r */
17, /* field[17] = sr */
12, /* field[12] = uF */
13, /* field[13] = uH */
6, /* field[6] = v */
- 27, /* field[27] = vconst */
- 25, /* field[25] = vflag */
- 21, /* field[21] = x */
- 22, /* field[22] = y */
+ 28, /* field[28] = vconst */
+ 26, /* field[26] = vflag */
+ 22, /* field[22] = x */
+ 23, /* field[23] = y */
};
static const ProtobufCIntRange scf_epin__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 29 }
+ { 0, 30 }
};
const ProtobufCMessageDescriptor scf_epin__descriptor =
{
"ScfEpin",
"",
sizeof(ScfEpin),
- 29,
+ 30,
scf_epin__field_descriptors,
scf_epin__field_indices_by_name,
1, scf_epin__number_ranges,
double jsr;
double pr;
double jpr;
+ uint64_t path;
int32_t x;
int32_t y;
int32_t n_diodes;
};
#define SCF_EPIN__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&scf_epin__descriptor) \
- , 0, 0, 0, 0, 0,NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+ , 0, 0, 0, 0, 0,NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
struct _ScfEconn
} \
} while (0)
-#define EDA_PIN_ADD_INPUT(_in, _i, _c, _pid) \
+#define EDA_PIN_ADD_INPUT(_in, _i, _ef, _p) \
do { \
- if (!(_in)->pins[_i]) \
- (_in)->pins[_i] = (_c)->pins[_pid]; \
- else { \
- EDA_PIN_ADD_COMPONENT((_in)->pins[_i], (_c)->id, _pid); \
- EDA_PIN_ADD_COMPONENT((_c )->pins[_pid], (_in)->pins[_i]->cid, (_in)->pins[_i]->id); \
+ ScfEcomponent* c = (_ef)->components[(_p)->cid]; \
+ ScfEcomponent* R = NULL; \
+ \
+ if (!(_in)->pins[_i]) { \
+ EDA_INST_ADD_COMPONENT(_ef, R, SCF_EDA_Resistor); \
+ \
+ EDA_PIN_ADD_PIN(c, (_p)->id, R, 0); \
+ \
+ (_in)->pins[_i] = R->pins[1]; \
+ } else { \
+ EDA_PIN_ADD_COMPONENT((_in)->pins[_i], (c)->id, (_p)->id); \
+ EDA_PIN_ADD_COMPONENT((c )->pins[(_p)->id], (_in)->pins[_i]->cid, (_in)->pins[_i]->id); \
} \
} while (0)
-#define EDA_PIN_ADD_INPUT_EF(_in, _i, _ef, _p) \
- EDA_PIN_ADD_INPUT(_in, _i, (_ef)->components[(_p)->cid], (_p)->id)
-
static int __eda_bit_nand(scf_function_t* f, ScfEpin** in0, ScfEpin** in1, ScfEpin** out)
{
ScfEcomponent* B = f->ef->components[0];
ScfEcomponent* T0 = NULL;
ScfEcomponent* T1 = NULL;
- ScfEcomponent* R0 = NULL;
- ScfEcomponent* R1 = NULL;
ScfEcomponent* R = NULL;
EDA_INST_ADD_COMPONENT(f->ef, T0, SCF_EDA_NPN);
EDA_INST_ADD_COMPONENT(f->ef, T1, SCF_EDA_NPN);
- EDA_INST_ADD_COMPONENT(f->ef, R0, SCF_EDA_Resistor);
- EDA_INST_ADD_COMPONENT(f->ef, R1, SCF_EDA_Resistor);
EDA_INST_ADD_COMPONENT(f->ef, R, SCF_EDA_Resistor);
EDA_PIN_ADD_PIN(R, 1, B, SCF_EDA_Battery_POS);
EDA_PIN_ADD_PIN(T0, SCF_EDA_NPN_E, T1, SCF_EDA_NPN_C);
EDA_PIN_ADD_PIN(T1, SCF_EDA_NPN_E, B, SCF_EDA_Battery_NEG);
- EDA_PIN_ADD_PIN(T0, SCF_EDA_NPN_B, R0, 0);
- EDA_PIN_ADD_PIN(T1, SCF_EDA_NPN_B, R1, 0);
-
- *in0 = R0->pins[1];
- *in1 = R1->pins[1];
+ *in0 = T0->pins[SCF_EDA_NPN_B];
+ *in1 = T1->pins[SCF_EDA_NPN_B];
*out = R ->pins[0];
return 0;
}
ScfEcomponent* B = f->ef->components[0];
ScfEcomponent* T0 = NULL;
ScfEcomponent* T1 = NULL;
- ScfEcomponent* R0 = NULL;
- ScfEcomponent* R1 = NULL;
ScfEcomponent* R = NULL;
EDA_INST_ADD_COMPONENT(f->ef, T0, SCF_EDA_NPN);
EDA_INST_ADD_COMPONENT(f->ef, T1, SCF_EDA_NPN);
- EDA_INST_ADD_COMPONENT(f->ef, R0, SCF_EDA_Resistor);
- EDA_INST_ADD_COMPONENT(f->ef, R1, SCF_EDA_Resistor);
EDA_INST_ADD_COMPONENT(f->ef, R, SCF_EDA_Resistor);
EDA_PIN_ADD_PIN(R, 1, B, SCF_EDA_Battery_POS);
EDA_PIN_ADD_PIN(T0, SCF_EDA_NPN_C, R, 0);
EDA_PIN_ADD_PIN(T1, SCF_EDA_NPN_C, R, 0);
- EDA_PIN_ADD_PIN(T0, SCF_EDA_NPN_C, T1, SCF_EDA_NPN_C);
- EDA_PIN_ADD_PIN(T0, SCF_EDA_NPN_E, T1, SCF_EDA_NPN_E);
+ EDA_PIN_ADD_PIN(T0, SCF_EDA_NPN_E, B, SCF_EDA_Battery_NEG);
EDA_PIN_ADD_PIN(T1, SCF_EDA_NPN_E, B, SCF_EDA_Battery_NEG);
- EDA_PIN_ADD_PIN(T0, SCF_EDA_NPN_B, R0, 0);
- EDA_PIN_ADD_PIN(T1, SCF_EDA_NPN_B, R1, 0);
-
- *in0 = R0->pins[1];
- *in1 = R1->pins[1];
+ *in0 = T0->pins[SCF_EDA_NPN_B];
+ *in1 = T1->pins[SCF_EDA_NPN_B];
*out = R ->pins[0];
return 0;
}
if (ret < 0)
return ret;
- EDA_PIN_ADD_INPUT(in, i, f->ef->components[pi->cid], pi->id);
+ EDA_PIN_ADD_INPUT(in, i, f->ef, pi);
out->pins[i] = po;
}
if (ret < 0)
return ret;
- EDA_PIN_ADD_INPUT(in0, i, f->ef->components[p0->cid], p0->id);
- EDA_PIN_ADD_INPUT(in1, i, f->ef->components[p1->cid], p1->id);
+ EDA_PIN_ADD_INPUT(in0, i, f->ef, p0);
+ EDA_PIN_ADD_INPUT(in1, i, f->ef, p1);
out->pins[i] = po;
}
if (ret < 0)
return ret;
- EDA_PIN_ADD_INPUT(in0, i, f->ef->components[p0->cid], p0->id);
- EDA_PIN_ADD_INPUT(in1, i, f->ef->components[p1->cid], p1->id);
+ EDA_PIN_ADD_INPUT(in0, i, f->ef, p0);
+ EDA_PIN_ADD_INPUT(in1, i, f->ef, p1);
out->pins[i] = po;
}
if (ret < 0)
return ret;
- EDA_PIN_ADD_INPUT_EF(in0, i, f->ef, p0);
- EDA_PIN_ADD_INPUT_EF(in1, i, f->ef, p1);
+ EDA_PIN_ADD_INPUT(in0, i, f->ef, p0);
+ EDA_PIN_ADD_INPUT(in1, i, f->ef, p1);
Pc = cf; // carry flag
out->pins[i] = res; // result