From 9d335ab86e14a7b92b671b1f19712b7521969f98 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sat, 29 Jul 2023 21:39:46 +0800 Subject: [PATCH] change scf_eda.proto for native/eda --- native/eda/scf_eda.c | 1 - native/eda/scf_eda.h | 13 +- native/eda/scf_eda.pb-c.c | 404 +++++++++++++++++++++++++++++++++----- native/eda/scf_eda.pb-c.h | 34 +++- native/eda/scf_eda.proto | 73 +++++-- native/eda/scf_eda_inst.c | 31 ++- native/eda/scf_eda_pb.h | 2 +- 7 files changed, 462 insertions(+), 96 deletions(-) diff --git a/native/eda/scf_eda.c b/native/eda/scf_eda.c index 9d0ff4e..76dfe9e 100644 --- a/native/eda/scf_eda.c +++ b/native/eda/scf_eda.c @@ -171,7 +171,6 @@ int scf_eda_select_inst(scf_native_t* ctx, scf_function_t* f) printf("\n"); } #endif - return 0; } diff --git a/native/eda/scf_eda.h b/native/eda/scf_eda.h index 5dafe64..276b4a5 100644 --- a/native/eda/scf_eda.h +++ b/native/eda/scf_eda.h @@ -23,13 +23,22 @@ (_c)->pins[i]->cid = (_c)->id; \ } while (0) - #define EDA_PIN_ADD_COMPONENT(_pin, _cid, _pid) \ do { \ - int ret = scf_epin__add_component((_pin), (_cid), (_pid)); \ + int ret = scf_epin__add_component((_pin), _cid, _pid); \ + if (ret < 0) \ + return ret; \ + } while (0) + +#define EDA_PIN_ADD_PIN(_c0, _pid0, _c1, _pid1) \ + do { \ + int ret = scf_epin__add_component((_c0)->pins[_pid0], (_c1)->id, (_pid1)); \ if (ret < 0) \ return ret; \ \ + ret = scf_epin__add_component((_c1)->pins[_pid1], (_c0)->id, (_pid0)); \ + if (ret < 0) \ + return ret; \ } while (0) typedef struct { diff --git a/native/eda/scf_eda.pb-c.c b/native/eda/scf_eda.pb-c.c index 2b509dd..09a1cc3 100644 --- a/native/eda/scf_eda.pb-c.c +++ b/native/eda/scf_eda.pb-c.c @@ -385,63 +385,147 @@ const ProtobufCMessageDescriptor scf_line__descriptor = (ProtobufCMessageInit) scf_line__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor scf_epin__field_descriptors[7] = +static const ProtobufCFieldDescriptor scf_epin__field_descriptors[16] = { { - "tos", + "id", 1, - PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_UINT64, - offsetof(ScfEpin, n_tos), - offsetof(ScfEpin, tos), + 0, /* quantifier_offset */ + offsetof(ScfEpin, id), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "id", + "cid", 2, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_UINT64, 0, /* quantifier_offset */ - offsetof(ScfEpin, id), + offsetof(ScfEpin, cid), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "cid", + "lid", 3, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_UINT64, 0, /* quantifier_offset */ - offsetof(ScfEpin, cid), + offsetof(ScfEpin, lid), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "lid", + "flags", 4, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_UINT64, 0, /* quantifier_offset */ - offsetof(ScfEpin, lid), + offsetof(ScfEpin, flags), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "flags", + "tos", 5, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_UINT64, + offsetof(ScfEpin, n_tos), + offsetof(ScfEpin, tos), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "c_lid", + 6, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_UINT64, 0, /* quantifier_offset */ - offsetof(ScfEpin, flags), + offsetof(ScfEpin, c_lid), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "V", + 7, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEpin, v), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "A", + 8, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEpin, a), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "R", + 9, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEpin, r), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "jR", + 10, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEpin, jr), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uF", + 11, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEpin, uf), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uH", + 12, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEpin, uh), NULL, NULL, 0, /* flags */ @@ -449,7 +533,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[7] = }, { "x", - 6, + 13, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -461,7 +545,7 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[7] = }, { "y", - 7, + 14, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -471,20 +555,53 @@ static const ProtobufCFieldDescriptor scf_epin__field_descriptors[7] = 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "vflag", + 15, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(ScfEpin, vflag), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "pflag", + 16, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(ScfEpin, pflag), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned scf_epin__field_indices_by_name[] = { - 2, /* field[2] = cid */ - 4, /* field[4] = flags */ - 1, /* field[1] = id */ - 3, /* field[3] = lid */ - 0, /* field[0] = tos */ - 5, /* field[5] = x */ - 6, /* field[6] = y */ + 7, /* field[7] = A */ + 8, /* field[8] = R */ + 6, /* field[6] = V */ + 5, /* field[5] = c_lid */ + 1, /* field[1] = cid */ + 3, /* field[3] = flags */ + 0, /* field[0] = id */ + 9, /* field[9] = jR */ + 2, /* field[2] = lid */ + 15, /* field[15] = pflag */ + 4, /* field[4] = tos */ + 10, /* field[10] = uF */ + 11, /* field[11] = uH */ + 14, /* field[14] = vflag */ + 12, /* field[12] = x */ + 13, /* field[13] = y */ }; static const ProtobufCIntRange scf_epin__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 7 } + { 0, 16 } }; const ProtobufCMessageDescriptor scf_epin__descriptor = { @@ -494,7 +611,7 @@ const ProtobufCMessageDescriptor scf_epin__descriptor = "ScfEpin", "", sizeof(ScfEpin), - 7, + 16, scf_epin__field_descriptors, scf_epin__field_indices_by_name, 1, scf_epin__number_ranges, @@ -552,7 +669,7 @@ const ProtobufCMessageDescriptor scf_econn__descriptor = (ProtobufCMessageInit) scf_econn__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor scf_eline__field_descriptors[5] = +static const ProtobufCFieldDescriptor scf_eline__field_descriptors[10] = { { "id", @@ -579,20 +696,44 @@ static const ProtobufCFieldDescriptor scf_eline__field_descriptors[5] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "flags", + "c_pins", 3, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_UINT64, 0, /* quantifier_offset */ + offsetof(ScfEline, c_pins), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flags", + 4, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT64, + 0, /* quantifier_offset */ offsetof(ScfEline, flags), NULL, NULL, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "dfo", + 5, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(ScfEline, dfo), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, { "conns", - 4, + 6, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, offsetof(ScfEline, n_conns), @@ -604,7 +745,7 @@ static const ProtobufCFieldDescriptor scf_eline__field_descriptors[5] = }, { "lines", - 5, + 7, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, offsetof(ScfEline, n_lines), @@ -614,18 +755,59 @@ static const ProtobufCFieldDescriptor scf_eline__field_descriptors[5] = 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "V", + 8, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEline, v), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "A", + 9, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEline, a), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "vflag", + 10, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(ScfEline, vflag), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned scf_eline__field_indices_by_name[] = { - 3, /* field[3] = conns */ - 2, /* field[2] = flags */ + 8, /* field[8] = A */ + 7, /* field[7] = V */ + 2, /* field[2] = c_pins */ + 5, /* field[5] = conns */ + 4, /* field[4] = dfo */ + 3, /* field[3] = flags */ 0, /* field[0] = id */ - 4, /* field[4] = lines */ + 6, /* field[6] = lines */ 1, /* field[1] = pins */ + 9, /* field[9] = vflag */ }; static const ProtobufCIntRange scf_eline__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 5 } + { 0, 10 } }; const ProtobufCMessageDescriptor scf_eline__descriptor = { @@ -635,14 +817,14 @@ const ProtobufCMessageDescriptor scf_eline__descriptor = "ScfEline", "", sizeof(ScfEline), - 5, + 10, scf_eline__field_descriptors, scf_eline__field_indices_by_name, 1, scf_eline__number_ranges, (ProtobufCMessageInit) scf_eline__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] = +static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[17] = { { "id", @@ -669,8 +851,20 @@ static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] = 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "pins", + "model", 3, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT64, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, model), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "pins", + 4, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, offsetof(ScfEcomponent, n_pins), @@ -680,9 +874,105 @@ static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] = 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "V", + 5, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, v), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "A", + 6, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, a), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "R", + 7, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, r), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "jR", + 8, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, jr), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uF", + 9, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, uf), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uH", + 10, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, uh), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dfo", + 11, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, dfo), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "status", + 12, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, { "x", - 4, + 13, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -694,7 +984,7 @@ static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] = }, { "y", - 5, + 14, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -706,7 +996,7 @@ static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] = }, { "w", - 6, + 15, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -718,7 +1008,7 @@ static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] = }, { "h", - 7, + 16, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, 0, /* quantifier_offset */ @@ -728,20 +1018,42 @@ static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] = 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "vflag", + 17, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(ScfEcomponent, vflag), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned scf_ecomponent__field_indices_by_name[] = { - 6, /* field[6] = h */ + 5, /* field[5] = A */ + 6, /* field[6] = R */ + 4, /* field[4] = V */ + 10, /* field[10] = dfo */ + 15, /* field[15] = h */ 0, /* field[0] = id */ - 2, /* field[2] = pins */ + 7, /* field[7] = jR */ + 2, /* field[2] = model */ + 3, /* field[3] = pins */ + 11, /* field[11] = status */ 1, /* field[1] = type */ - 5, /* field[5] = w */ - 3, /* field[3] = x */ - 4, /* field[4] = y */ + 8, /* field[8] = uF */ + 9, /* field[9] = uH */ + 16, /* field[16] = vflag */ + 14, /* field[14] = w */ + 12, /* field[12] = x */ + 13, /* field[13] = y */ }; static const ProtobufCIntRange scf_ecomponent__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 7 } + { 0, 17 } }; const ProtobufCMessageDescriptor scf_ecomponent__descriptor = { @@ -751,7 +1063,7 @@ const ProtobufCMessageDescriptor scf_ecomponent__descriptor = "ScfEcomponent", "", sizeof(ScfEcomponent), - 7, + 17, scf_ecomponent__field_descriptors, scf_ecomponent__field_indices_by_name, 1, scf_ecomponent__number_ranges, diff --git a/native/eda/scf_eda.pb-c.h b/native/eda/scf_eda.pb-c.h index 977ddb6..99273f6 100644 --- a/native/eda/scf_eda.pb-c.h +++ b/native/eda/scf_eda.pb-c.h @@ -45,18 +45,27 @@ struct _ScfLine struct _ScfEpin { ProtobufCMessage base; - size_t n_tos; - uint64_t *tos; uint64_t id; uint64_t cid; uint64_t lid; uint64_t flags; + size_t n_tos; + uint64_t *tos; + uint64_t c_lid; + double v; + double a; + double r; + double jr; + double uf; + double uh; int32_t x; int32_t y; + protobuf_c_boolean vflag; + protobuf_c_boolean pflag; }; #define SCF_EPIN__INIT \ { PROTOBUF_C_MESSAGE_INIT (&scf_epin__descriptor) \ - , 0,NULL, 0, 0, 0, 0, 0, 0 } + , 0, 0, 0, 0, 0,NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } struct _ScfEconn @@ -77,15 +86,20 @@ struct _ScfEline uint64_t id; size_t n_pins; uint64_t *pins; + uint64_t c_pins; uint64_t flags; + int64_t dfo; size_t n_conns; ScfEconn **conns; size_t n_lines; ScfLine **lines; + double v; + double a; + protobuf_c_boolean vflag; }; #define SCF_ELINE__INIT \ { PROTOBUF_C_MESSAGE_INIT (&scf_eline__descriptor) \ - , 0, 0,NULL, 0, 0,NULL, 0,NULL } + , 0, 0,NULL, 0, 0, 0, 0,NULL, 0,NULL, 0, 0, 0 } struct _ScfEcomponent @@ -93,16 +107,26 @@ struct _ScfEcomponent ProtobufCMessage base; uint64_t id; uint64_t type; + uint64_t model; size_t n_pins; ScfEpin **pins; + double v; + double a; + double r; + double jr; + double uf; + double uh; + int64_t dfo; + int32_t status; int32_t x; int32_t y; int32_t w; int32_t h; + protobuf_c_boolean vflag; }; #define SCF_ECOMPONENT__INIT \ { PROTOBUF_C_MESSAGE_INIT (&scf_ecomponent__descriptor) \ - , 0, 0, 0,NULL, 0, 0, 0, 0 } + , 0, 0, 0, 0,NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } struct _ScfEfunction diff --git a/native/eda/scf_eda.proto b/native/eda/scf_eda.proto index 1d4af8d..2d28c72 100644 --- a/native/eda/scf_eda.proto +++ b/native/eda/scf_eda.proto @@ -10,14 +10,24 @@ message scf_line message scf_epin { - repeated uint64 tos = 1; - required uint64 id = 2; - required uint64 cid = 3; - required uint64 lid = 4; - required uint64 flags = 5; - - required int32 x = 6; - required int32 y = 7; + required uint64 id = 1; + required uint64 cid = 2; + required uint64 lid = 3; + required uint64 flags = 4; + repeated uint64 tos = 5; + required uint64 c_lid = 6; + + required double V = 7; + required double A = 8; + required double R = 9; + required double jR = 10; + required double uF = 11; + required double uH = 12; + + required int32 x = 13; + required int32 y = 14; + required bool vflag = 15; + required bool pflag = 16; } message scf_econn @@ -28,23 +38,44 @@ message scf_econn message scf_eline { - required uint64 id = 1; - repeated uint64 pins = 2; - required uint64 flags = 3; - repeated scf_econn conns = 4; - repeated scf_line lines = 5; + required uint64 id = 1; + repeated uint64 pins = 2; + required uint64 c_pins = 3; + required uint64 flags = 4; + required int64 dfo = 5; + + repeated scf_econn conns = 6; + repeated scf_line lines = 7; + + required double V = 8; + required double A = 9; + + required bool vflag = 10; } message scf_ecomponent { - required uint64 id = 1; - required uint64 type = 2; - repeated scf_epin pins = 3; - - required int32 x = 4; - required int32 y = 5; - required int32 w = 6; - required int32 h = 7; + required uint64 id = 1; + required uint64 type = 2; + required uint64 model = 3; + repeated scf_epin pins = 4; + + required double V = 5; + required double A = 6; + required double R = 7; + required double jR = 8; + required double uF = 9; + required double uH = 10; + + required int64 dfo = 11; + required int32 status = 12; + + required int32 x = 13; + required int32 y = 14; + required int32 w = 15; + required int32 h = 16; + + required bool vflag = 17; } message scf_efunction diff --git a/native/eda/scf_eda_inst.c b/native/eda/scf_eda_inst.c index abec58d..630a3da 100644 --- a/native/eda/scf_eda_inst.c +++ b/native/eda/scf_eda_inst.c @@ -103,11 +103,10 @@ static int _eda_inst_bit_not_handler(scf_native_t* ctx, scf_3ac_code_t* c) EDA_PIN_ADD_INPUT(in, i, T, SCF_EDA_Transistor_B); - EDA_PIN_ADD_COMPONENT(T->pins[SCF_EDA_Transistor_C], R->id, 1); - EDA_PIN_ADD_COMPONENT(T->pins[SCF_EDA_Transistor_E], B->id, SCF_EDA_Battery_NEG); + EDA_PIN_ADD_PIN(T, SCF_EDA_Transistor_C, R, 1); + EDA_PIN_ADD_PIN(T, SCF_EDA_Transistor_E, B, SCF_EDA_Battery_NEG); - EDA_PIN_ADD_COMPONENT(R->pins[0], B->id, SCF_EDA_Battery_POS); - EDA_PIN_ADD_COMPONENT(R->pins[1], T->id, SCF_EDA_Transistor_C); + EDA_PIN_ADD_PIN(R, 0, B, SCF_EDA_Battery_POS); out->pins[i] = T->pins[SCF_EDA_Transistor_C]; } @@ -147,15 +146,11 @@ static int _eda_inst_bit_and_handler(scf_native_t* ctx, scf_3ac_code_t* c) EDA_PIN_ADD_INPUT(in0, i, D0, SCF_EDA_Diode_NEG); EDA_PIN_ADD_INPUT(in1, i, D1, SCF_EDA_Diode_NEG); - EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_POS], D1->id, SCF_EDA_Diode_POS); - EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_POS], R ->id, 1); + EDA_PIN_ADD_PIN(D0, SCF_EDA_Diode_POS, D1, SCF_EDA_Diode_POS); + EDA_PIN_ADD_PIN(D0, SCF_EDA_Diode_POS, R, 1); + EDA_PIN_ADD_PIN(D1, SCF_EDA_Diode_POS, R, 1); - EDA_PIN_ADD_COMPONENT(D1->pins[SCF_EDA_Diode_POS], D0->id, SCF_EDA_Diode_POS); - EDA_PIN_ADD_COMPONENT(D1->pins[SCF_EDA_Diode_POS], R ->id, 1); - - EDA_PIN_ADD_COMPONENT(R->pins[1], D0->id, SCF_EDA_Diode_POS); - EDA_PIN_ADD_COMPONENT(R->pins[1], D1->id, SCF_EDA_Diode_POS); - EDA_PIN_ADD_COMPONENT(R->pins[0], B ->id, SCF_EDA_Battery_POS); + EDA_PIN_ADD_PIN(R, 0, B, SCF_EDA_Battery_POS); out->pins[i] = R ->pins[1]; } @@ -195,15 +190,11 @@ static int _eda_inst_bit_or_handler(scf_native_t* ctx, scf_3ac_code_t* c) EDA_PIN_ADD_INPUT(in0, i, D0, SCF_EDA_Diode_POS); EDA_PIN_ADD_INPUT(in1, i, D1, SCF_EDA_Diode_POS); - EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_NEG], D1->id, SCF_EDA_Diode_NEG); - EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_NEG], R ->id, 0); - - EDA_PIN_ADD_COMPONENT(D1->pins[SCF_EDA_Diode_NEG], D0->id, SCF_EDA_Diode_NEG); - EDA_PIN_ADD_COMPONENT(D1->pins[SCF_EDA_Diode_NEG], R ->id, 0); + EDA_PIN_ADD_PIN(D0, SCF_EDA_Diode_NEG, D1, SCF_EDA_Diode_NEG); + EDA_PIN_ADD_PIN(D0, SCF_EDA_Diode_NEG, R, 0); + EDA_PIN_ADD_PIN(D1, SCF_EDA_Diode_NEG, R, 0); - EDA_PIN_ADD_COMPONENT(R->pins[0], D0->id, SCF_EDA_Diode_NEG); - EDA_PIN_ADD_COMPONENT(R->pins[0], D1->id, SCF_EDA_Diode_NEG); - EDA_PIN_ADD_COMPONENT(R->pins[1], B ->id, SCF_EDA_Battery_NEG); + EDA_PIN_ADD_PIN(R, 1, B, SCF_EDA_Battery_NEG); out->pins[i] = R ->pins[0]; } diff --git a/native/eda/scf_eda_pb.h b/native/eda/scf_eda_pb.h index 5414eea..16aeafc 100644 --- a/native/eda/scf_eda_pb.h +++ b/native/eda/scf_eda_pb.h @@ -37,8 +37,8 @@ enum { enum { SCF_EDA_Transistor_B, - SCF_EDA_Transistor_C, SCF_EDA_Transistor_E, + SCF_EDA_Transistor_C, SCF_EDA_Transistor_NB, }; -- 2.25.1