From: yu.dongliang <18588496441@163.com> Date: Wed, 25 Oct 2023 07:00:41 +0000 (+0800) Subject: update 'ScfEpin' of native EDA module X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=805912ebeb80997f49a9c6d89f67f40fde38138f;p=scf.git update 'ScfEpin' of native EDA module --- diff --git a/native/eda/scf_eda.pb-c.c b/native/eda/scf_eda.pb-c.c index 8689756..84e07a4 100644 --- a/native/eda/scf_eda.pb-c.c +++ b/native/eda/scf_eda.pb-c.c @@ -385,7 +385,7 @@ const ProtobufCMessageDescriptor scf_line__descriptor = (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", @@ -640,9 +640,21 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = 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), @@ -653,7 +665,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }, { "y", - 23, + 24, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -665,7 +677,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }, { "n_diodes", - 24, + 25, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -677,7 +689,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }, { "l_pos", - 25, + 26, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -689,7 +701,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }, { "vflag", - 26, + 27, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_BOOL, 0, /* quantifier_offset */ @@ -701,7 +713,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }, { "pflag", - 27, + 28, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_BOOL, 0, /* quantifier_offset */ @@ -713,7 +725,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }, { "vconst", - 28, + 29, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_BOOL, 0, /* quantifier_offset */ @@ -725,7 +737,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }, { "aconst", - 29, + 30, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_BOOL, 0, /* quantifier_offset */ @@ -738,7 +750,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[29] = }; 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 */ @@ -751,10 +763,11 @@ static const unsigned scf_epin__field_indices_by_name[] = { 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 */ @@ -762,15 +775,15 @@ static const unsigned scf_epin__field_indices_by_name[] = { 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 = { @@ -780,7 +793,7 @@ 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, diff --git a/native/eda/scf_eda.pb-c.h b/native/eda/scf_eda.pb-c.h index c8234f3..4243879 100644 --- a/native/eda/scf_eda.pb-c.h +++ b/native/eda/scf_eda.pb-c.h @@ -67,6 +67,7 @@ struct _ScfEpin double jsr; double pr; double jpr; + uint64_t path; int32_t x; int32_t y; int32_t n_diodes; @@ -78,7 +79,7 @@ struct _ScfEpin }; #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 diff --git a/native/eda/scf_eda.proto b/native/eda/scf_eda.proto index f793189..b0820f1 100644 --- a/native/eda/scf_eda.proto +++ b/native/eda/scf_eda.proto @@ -37,17 +37,19 @@ message scf_epin required double pr = 20; required double jpr = 21; - required int32 x = 22; - required int32 y = 23; + required uint64 path = 22; - required int32 n_diodes = 24; - required int32 l_pos = 25; + required int32 x = 23; + required int32 y = 24; - required bool vflag = 26; - required bool pflag = 27; + required int32 n_diodes = 25; + required int32 l_pos = 26; - required bool vconst = 28; - required bool aconst = 29; + required bool vflag = 27; + required bool pflag = 28; + + required bool vconst = 29; + required bool aconst = 30; } message scf_econn diff --git a/native/eda/scf_eda_inst.c b/native/eda/scf_eda_inst.c index 10dc574..b930e6f 100644 --- a/native/eda/scf_eda_inst.c +++ b/native/eda/scf_eda_inst.c @@ -66,33 +66,33 @@ } \ } 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); @@ -100,11 +100,8 @@ static int __eda_bit_nand(scf_function_t* f, ScfEpin** in0, ScfEpin** in1, ScfEp 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; } @@ -114,28 +111,20 @@ static int __eda_bit_nor(scf_function_t* f, ScfEpin** in0, ScfEpin** in1, ScfEpi 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; } @@ -284,7 +273,7 @@ static int _eda_inst_bit_not_handler(scf_native_t* ctx, scf_3ac_code_t* c) 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; } @@ -320,8 +309,8 @@ static int _eda_inst_bit_and_handler(scf_native_t* ctx, scf_3ac_code_t* c) 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; } @@ -357,8 +346,8 @@ static int _eda_inst_bit_or_handler(scf_native_t* ctx, scf_3ac_code_t* c) 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; } @@ -398,8 +387,8 @@ static int _eda_inst_add_handler(scf_native_t* ctx, scf_3ac_code_t* c) 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