#include"ses_core.h"
-int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double ja_bridge)
+int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double da_vip, double dja_vip)
{
if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
return -EINVAL;
r = tr - r;
jr = jtr - jr;
- ses_ir_u(&v, &jv, a_bridge, ja_bridge, r, jr);
+ ses_ir_u(&v, &jv, da_vip, dja_vip, r, jr);
if (p->lid != Bp->lid) {
p->v -= v;
tr -= r;
jtr -= jr;
- ses_ir_u(&v, &jv, a_bridge, ja_bridge, tr, jtr);
+ ses_ir_u(&v, &jv, da_vip, dja_vip, tr, jtr);
vip = path->pins->data[0];
return 0;
}
-int __ses_flow_a_neg(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double ja_bridge)
-{
- if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
- return -EINVAL;
-
- ses_path_t* path = flow->paths->data[flow->paths->size - 1];
- ScfEpin* vip = flow->vip;
- ScfEpin* p0;
- ScfEpin* p;
-
- double tr = flow->neg_r;
- double jtr = flow->neg_jr;
-
- int i;
- int j;
-
- for (i = 0; i < flow->paths->size; i++) {
- path = flow->paths->data[i];
-
- double v;
- double jv;
-
- double r;
- double jr;
-
- int j0 = -1;
- for (j = 0; j < path->pins->size; j++) {
- p = path->pins->data[j];
-
- if (j0 < 0) {
- if (p->lid == vip->lid)
- j0 = j;
- else
- continue;
- }
-
- __ses_path_pr(f, path, j0, j, NULL, &r, &jr);
-
- r = tr - r;
- jr = jtr - jr;
-
- if (p->sr != p->pr)
- j0 = j;
-
- ses_ir_u(&v, &jv, a_bridge, ja_bridge, r, jr);
-
- p->v += v;
- p->jv += jv;
-
- scf_loge("c%ldp%ld->v: %lg, r: %lg, %lg\n", p->cid, p->id, p->v, r, p->sr);
- }
-
- assert(p0);
-
- vip = path->pins->data[j - 1];
-
- if (j - 1 != j0) {
-
- __ses_path_sr(f, path, j0, j, NULL, &r, &jr);
-
- tr -= r;
- jtr -= jr;
-
- ses_ir_u(&v, &jv, a_bridge, ja_bridge, tr, jtr);
-
- vip->v += v;
- vip->jv += jv;
-
- scf_logw("c%ldp%ld->v: %lg + j%lg, r: %lg + j%lg\n", vip->cid, vip->id, vip->v, vip->jv, tr, jtr);
- }
- }
-
- return 0;
-}
-
static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* changed, scf_vector_t* paths)
{
if (!bridge)
double a = 0;
double ja = 0;
- double Eta = 0.001;
+ double Eta = 0.01;
int k = 0;
do {
v = flow->vip->v;
jv = flow->vip->jv;
- ret = __ses_flow_a_pos(f, flow, a, ja);
+ ret = __ses_flow_a_pos(f, flow, Eta * da, Eta * dja);
if (ret < 0)
return ret;
printf("\n");
k++;
- } while (k < 46);
+ } while (da > 1e-5);
v = p0->v - p1->v;
jv = p0->jv - p1->jv;