From 78b8d9f04b833631159f7aa4c28acff00c52df43 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 15 Nov 2023 20:58:01 +0800 Subject: [PATCH] __ses_path_va_bridge() --- ses_core.h | 3 +++ ses_step_va_bridge.c | 56 +++++++++++++------------------------------- 2 files changed, 19 insertions(+), 40 deletions(-) diff --git a/ses_core.h b/ses_core.h index ee0ccbc..5b4369c 100644 --- a/ses_core.h +++ b/ses_core.h @@ -66,6 +66,9 @@ struct ses_path_s double r0; double jr0; + double a0; + double ja0; + double r; double jr; diff --git a/ses_step_va_bridge.c b/ses_step_va_bridge.c index b000508..6fcb4e4 100644 --- a/ses_step_va_bridge.c +++ b/ses_step_va_bridge.c @@ -1,44 +1,5 @@ #include"ses_core.h" -static int __ses_path_va_flow(ScfEfunction* f, ses_path_t* bridge, int* changed, scf_vector_t* paths) -{ - ses_flow_t* flow0; - ses_flow_t* flow1; - - ScfEpin* p0; - ScfEpin* p1; - - flow0 = ses_flow_alloc(); - if (!flow0) - return -ENOMEM; - - flow1 = ses_flow_alloc(); - if (!flow1) { - ses_flow_free(flow0); - return -ENOMEM; - } - - p0 = bridge->pins->data[0]; - p1 = bridge->pins->data[bridge->pins->size - 1]; - - int ret = ses_paths_find_flow(flow0, paths, p0, bridge); - if (ret < 0) - return ret; - - ret = ses_paths_find_flow(flow1, paths, p1, bridge); - if (ret < 0) - return ret; - - ses_flow_print(flow0); - ses_flow_jr(flow0); - printf("\n"); - - ses_flow_print(flow1); - ses_flow_jr(flow1); - printf("\n"); - return 0; -} - static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* changed, scf_vector_t* paths) { if (!bridge) @@ -49,6 +10,8 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change return -EINVAL; } + ses_flow_t* flow; + ScfEcomponent* B; ScfEline* el; ScfEpin* Bp; @@ -84,7 +47,20 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change scf_logw("bridge: %d, c%ldp%ld--c%ldp%ld, v: %lg, p0->v: %lg, p1->v: %lg, n_diodes: %d, p0->a: %lg, p1->a: %lg\n", bridge->index, p0->cid, p0->id, p1->cid, p1->id, v, p0->v, p1->v, bridge->n_diodes, p0->a, p1->a); - return __ses_path_va_flow(f, bridge, changed, paths); + flow = ses_flow_alloc(); + if (!flow) + return -ENOMEM; + + ret = ses_paths_find_flow(flow, paths, p0, bridge); + if (ret < 0) { + ses_flow_free(flow); + return ret; + } + + ses_flow_print(flow); + ses_flow_jr(flow); + + return 0; } static int ses_path_va_bridge(ScfEfunction* f, ses_path_t* path, int* changed, scf_vector_t* paths) -- 2.25.1