From 53580e9a22d33a775292ec5de4eeba8a55520b27 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sun, 9 Jul 2023 20:46:47 +0800 Subject: [PATCH] ses eda pb --- scf_eda.pb-c.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++--- scf_eda.pb-c.h | 6 +++++- scf_eda.proto | 5 +++++ ses_layout.c | 26 +++++++++++++++++----- ses_layout.h | 2 +- 5 files changed, 87 insertions(+), 10 deletions(-) diff --git a/scf_eda.pb-c.c b/scf_eda.pb-c.c index 5008b01..bc7b0c1 100644 --- a/scf_eda.pb-c.c +++ b/scf_eda.pb-c.c @@ -732,7 +732,7 @@ const ProtobufCMessageDescriptor scf_ecomponent__descriptor = (ProtobufCMessageInit) scf_ecomponent__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor scf_efunction__field_descriptors[3] = +static const ProtobufCFieldDescriptor scf_efunction__field_descriptors[7] = { { "name", @@ -770,16 +770,68 @@ static const ProtobufCFieldDescriptor scf_efunction__field_descriptors[3] = 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "x", + 4, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(ScfEfunction, x), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "y", + 5, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(ScfEfunction, y), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "w", + 6, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(ScfEfunction, w), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "h", + 7, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(ScfEfunction, h), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned scf_efunction__field_indices_by_name[] = { 1, /* field[1] = components */ 2, /* field[2] = elines */ + 6, /* field[6] = h */ 0, /* field[0] = name */ + 5, /* field[5] = w */ + 3, /* field[3] = x */ + 4, /* field[4] = y */ }; static const ProtobufCIntRange scf_efunction__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 3 } + { 0, 7 } }; const ProtobufCMessageDescriptor scf_efunction__descriptor = { @@ -789,7 +841,7 @@ const ProtobufCMessageDescriptor scf_efunction__descriptor = "ScfEfunction", "", sizeof(ScfEfunction), - 3, + 7, scf_efunction__field_descriptors, scf_efunction__field_indices_by_name, 1, scf_efunction__number_ranges, diff --git a/scf_eda.pb-c.h b/scf_eda.pb-c.h index fc07cde..8a31fb6 100644 --- a/scf_eda.pb-c.h +++ b/scf_eda.pb-c.h @@ -111,10 +111,14 @@ struct _ScfEfunction ScfEcomponent **components; size_t n_elines; ScfEline **elines; + uint32_t x; + uint32_t y; + uint32_t w; + uint32_t h; }; #define SCF_EFUNCTION__INIT \ { PROTOBUF_C_MESSAGE_INIT (&scf_efunction__descriptor) \ - , NULL, 0,NULL, 0,NULL } + , NULL, 0,NULL, 0,NULL, 0, 0, 0, 0 } struct _ScfEboard diff --git a/scf_eda.proto b/scf_eda.proto index 6d7b803..bb70188 100644 --- a/scf_eda.proto +++ b/scf_eda.proto @@ -50,6 +50,11 @@ message scf_efunction required string name = 1; repeated scf_ecomponent components = 2; repeated scf_eline elines = 3; + + required uint32 x = 4; + required uint32 y = 5; + required uint32 w = 6; + required uint32 h = 7; } message scf_eboard diff --git a/ses_layout.c b/ses_layout.c index 1170d20..0cbdc45 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -25,16 +25,16 @@ int eline_cmp(const void* v0, const void* v1) const ScfEline* el0 = *(const ScfEline**)v0; const ScfEline* el1 = *(const ScfEline**)v1; - if (el0->n_conns < el1->n_conns) + if (el0->n_pins < el1->n_pins) return 1; - if (el0->n_conns > el1->n_conns) + if (el0->n_pins > el1->n_pins) return -1; - if (el0->n_pins < el1->n_pins) + if (el0->n_conns < el1->n_conns) return 1; - if (el0->n_pins > el1->n_pins) + if (el0->n_conns > el1->n_conns) return -1; return 0; @@ -216,6 +216,22 @@ int ses_lines_same_components(ScfEfunction* f) return 0; } +int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, uint32_t bw, uint32_t bh) +{ + ScfEline* el; + ScfEconn* ec; + + size_t i; + size_t j; + + for (i = 0; i < f->n_elines; i++) { + el = f->elines[i]; + + } + + return 0; +} + int ses_layout_draw() { cairo_surface_t *surface; @@ -240,7 +256,7 @@ int ses_layout_draw() return 0; } -int ses_layout_board(ScfEboard* b, int x, int y, int w, int h) +int ses_layout_board(ScfEboard* b, uint32_t x, uint32_t y, uint32_t w, uint32_t h) { ScfEcomponent* c; ScfEfunction* f; diff --git a/ses_layout.h b/ses_layout.h index 28602bf..a53b757 100644 --- a/ses_layout.h +++ b/ses_layout.h @@ -5,6 +5,6 @@ #include"scf_eda_pb.h" #include"scf_vector.h" -int ses_layout_board(ScfEboard* b, int x, int y, int w, int h); +int ses_layout_board(ScfEboard* b, uint32_t x, uint32_t y, uint32_t w, uint32_t h); #endif -- 2.25.1