return 0;
}
+
static int __ses_path_va_balance(ScfEfunction* f, ses_path_t* bridge, ses_flow_t* flow0, ses_flow_t* flow1)
{
if (!bridge || !flow0 || !flow1)
double dv;
double jdv;
- ses_ur_i(&a, &ja, v, jv, r, jr);
+ ses_ur_i(&a, &ja, v, jv, r, jr);
- ses_ir_u(&dv, &jdv, a, ja, flow0->pr, flow0->jpr);
+ ses_flow_v_pos(flow0, a, ja);
+ ses_flow_v_neg(flow1, a, ja);
scf_loge("r->pr: %lg + j%lg, v: %lg + j%lg, a: %lg + j%lg, dv: %lg + j%lg\n", r, jr, v, jv, a, ja, dv, jdv);
}
}
+void ses_flow_v_pos(ses_flow_t* flow, double a, double ja)
+{
+ if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
+ return;
+
+ ses_path_t* path = flow->paths->data[flow->paths->size - 1];
+ ScfEpin* vip = flow->vip;
+ ScfEpin* p0;
+ ScfEpin* p;
+
+ double tr = flow->pr;
+ double jtr = flow->jpr;
+
+ int i;
+ int j;
+
+ for (i = 0; i < flow->paths->size; i++) {
+ path = flow->paths->data[i];
+
+ double v;
+ double jv;
+
+ p0 = NULL;
+ for (j = path->pins->size - 1; j >= 0; j--) {
+ p = path->pins->data[j];
+
+ if (!p0) {
+ if ((j & 0x1) && p->lid == vip->lid)
+ p0 = p;
+ else
+ continue;
+ }
+
+ double r = tr - (p0->pr - p->pr);
+ double jr = jtr - (p0->jpr - p->jpr);
+
+ ses_ir_u(&v, &jv, a, ja, r, jr);
+
+ p->v -= v;
+ p->jv -= jv;
+
+ scf_logw("c%ldp%ld->v: %lg + j%lg, r: %lg + j%lg\n", p->cid, p->id, p->v, p->jv, r, jr);
+ break;
+ }
+
+ assert(p0);
+
+ vip = path->pins->data[0];
+ tr -= p0->pr;
+ jtr -= p0->jpr;
+
+ ses_ir_u(&v, &jv, a, ja, 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);
+ }
+}
+
+void ses_flow_v_neg(ses_flow_t* flow, double a, double ja)
+{
+ if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
+ return;
+
+ ses_path_t* path = flow->paths->data[flow->paths->size - 1];
+ ScfEpin* vip = flow->vip;
+ ScfEpin* p0;
+ ScfEpin* p;
+
+ double tr = flow->nr;
+ double jtr = flow->jnr;
+
+ int i;
+ int j;
+
+ for (i = 0; i < flow->paths->size; i++) {
+ path = flow->paths->data[i];
+
+ double v;
+ double jv;
+
+ p0 = NULL;
+ for (j = 0; j < path->pins->size; j++) {
+ p = path->pins->data[j];
+
+ if (!p0) {
+ if (p->lid == vip->lid)
+ p0 = p;
+ else
+ continue;
+ }
+
+ double r = tr - (p->sr - p0->pr);
+ double jr = jtr - (p->jsr - p0->jpr);
+
+ if (p->sr != p->pr)
+ p0 = p;
+
+ ses_ir_u(&v, &jv, a, ja, r, jr);
+
+ p->v += v;
+ p->jv += jv;
+
+ scf_loge("c%ldp%ld->v: %lg + j%lg, r: %lg + j%lg, %lg\n", p->cid, p->id, p->v, p->jv, r, jr, p->sr);
+ }
+
+ assert(p0);
+
+ vip = path->pins->data[j - 1];
+
+ if (vip != p0) {
+
+ tr -= vip->sr - p0->pr;
+ jtr -= vip->jsr - p0->jpr;
+
+ ses_ir_u(&v, &jv, a, ja, 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);
+ }
+ }
+}
+
void ses_flow_jr(ses_flow_t* flow)
{
if (!flow)