示例#1
0
文件: ring.c 项目: kahrs/cda
void
insertpins(Signal *s)
{
	int i, j;
	Wire *w;
	Chip *c;
	Line *l, *ll;

	if((s->type != NORMSIG) || (s->n == 0))
		return;
	for (w = s->wires; w; w = w->next)
	    for(i = 0; i < w->ninf; i++)
		for(j=0; j<s->n; j++)
		    if (pteq(w->inflections[i].p, s->pins[j].p))
			if ((c = (Chip *) symlook(s->coords[j].chip, S_CHIP, (void *) 0)) == 0)
				f_major("chip %s not found", s->coords[j].chip);
			else {
				l = (Line *) f_malloc(sizeof(Line));
				l -> wire = w;
				l -> inf = i;
				if (ll = (Line *) pinlook(XY(s->pins[j].p.x, s->pins[j].p.y), 0)) {
				    l -> connect = ll -> connect;
				    ll -> connect = l;
				}
				else
				    pinlook(XY(s->pins[j].p.x, s->pins[j].p.y), (long) l); /* sinful... */
			}
}
示例#2
0
文件: ring.c 项目: kahrs/cda
void
cksignal(Signal *s)
{
	int i, j, pin, wc;
	float length, cap, rise_time, prop_delay, ok_length, delay_per;
	Wire *w;
	Chip *c;
	Line *l;

	if((s->type != NORMSIG) || (s->n == 0))
		return;
	cap = device_cap(s);
	for (w = s->wires; w; w = w->next)
	    for(i = 0; i < w->ninf; i++)
		for(j=0; j<s->n; j++)
		    if (pteq(w->inflections[i].p, s->pins[j].p))
			if ((c = (Chip *) symlook(s->coords[j].chip, S_CHIP, (void *) 0)) == 0)
				f_major("chip %s not found", s->coords[j].chip);
			else
			if (isdriver(c->type->tt[s->coords[j].pin-1])) {
				rise_time = get_rise(c->type->family);
				l = (Line *) pinlook(XY(s->pins[j].p.x, s->pins[j].p.y), 0);
				length = chase(l, 0);
				prop_delay = sqrt(L0 * length * (C0 * length + cap));
				delay_per = sqrt(L0 * (C0 + cap / length));
				ok_length = (rise_time * 1000.0) / (konstant * delay_per);
				if (length > ok_length)
fprint(1, "%s (%C): %f mils > %f mils, z = %f\n", s->name, s->coords[j], length, ok_length, sqrt((L0 * length) / (C0 * length + cap)));
/***fprint(1, "%s : %C = %f > %f, %f, %f, %f = %f\n", s -> name, s->coords[j], length, ok_length, L0 * length, C0 * length, cap, prop_delay); ***/
			}
}
示例#3
0
文件: ring.c 项目: kahrs/cda
void
prsignal(Signal *s)
{
	int i, j, pin, wc;
	Wire *w;
	Chip *c;

	if((s->type != NORMSIG) || (s->n == 0))
		return;
	fprint(1, "Signal %s:\n", s->name);
	for (w = s->wires, wc=1; w; w = w->next, wc++) {
		fprint(1, "\tWire %d\n", wc);
		for(i = 0; i < w->ninf; i++)
			for(j=0; j<s->n; j++)
				if (pteq(w->inflections[i].p, s->pins[j].p))
					if ((c = (Chip *) symlook(s->coords[j].chip, S_CHIP, (void *) 0)) == 0)
						f_major("chip %s not found", s->coords[j].chip);
					else
						fprint(1, "\t\t%C, %c\n", s->coords[j], c->type->tt[s->coords[j].pin-1]);
	}
}
示例#4
0
/* append:
 */
static int 
append(path * path, int bi, point p0, point p1, int polysz)
{
    point v[8];		/* worst case 4 corners + 2 segs * 2 points each */
    point w[8];
    box b = path->boxes[bi];
    box bb;
    int i, i0, npw, delta;
    point q0 = { 0, 0 }, q1 = { 0, 0}, r;
    int pn;

    /* v = 4 corners of b, p0 and p1 */
    pn = 0;
    v[pn++] = b.LL;
    v[pn++] = mkpt(b.UR.x, b.LL.y);
    v[pn++] = b.UR;
    v[pn++] = mkpt(b.LL.x, b.UR.y);
    v[pn++] = p0;
    v[pn++] = p1;

    if (bi + 1 < path->nbox) {
	bb = path->boxes[bi + 1];
	/* determine points q0,q1 where b and bb touch and append to v */
	if (b.UR.x == bb.LL.x) {
	    q0.x = q1.x = b.UR.x;
	    q0.y = MIN(b.UR.y, bb.UR.y);
	    q1.y = MAX(b.LL.y, bb.LL.y);
	} else if (b.LL.x == bb.UR.x) {
	    q0.x = q1.x = b.LL.x;
	    q0.y = MIN(b.UR.y, bb.UR.y);
	    q1.y = MAX(b.LL.y, bb.LL.y);
	} else if (b.UR.y == bb.LL.y) {
	    q0.y = q1.y = b.UR.y;
	    q0.x = MIN(b.UR.x, bb.UR.x);
	    q1.x = MAX(b.LL.x, bb.LL.x);
	} else if (b.LL.y == bb.UR.y) {
	    q0.y = q1.y = b.LL.y;
	    q0.x = MIN(b.UR.x, bb.UR.x);
	    q1.x = MAX(b.LL.x, bb.LL.x);
	} else
	    abort();
	v[pn++] = q0;
	v[pn++] = q1;
    }

    /* sort v so that the cyclic order is p0, all other points, p1  */
    B = b;
    qsort(v, pn, sizeof(v[0]), cmpf);

    /* eliminate duplicates and record i0 = index of p0 in w */
    w[0] = v[0];
    npw = 1;
    i0 = -1;
    for (i = 0; i < pn; i++) {
	if (pteq(w[npw - 1], p0))
	    i0 = npw - 1;
	if (!pteq(v[i], w[npw - 1]))
	    w[npw++] = v[i];
    }

    i = i0;
    if (bi == 0)
	polysz = appendpt(p0, polysz);
    if (pteq(p1, w[(i0 + 1) % npw]))
	delta = -1;
    else if (pteq(p1, w[(i0 - 1 + npw) % npw]))
	delta = 1;
    else
	abort();
    do {
	i = (i + delta + npw) % npw;	/* go to the next point in order */
	r = w[i];		/* call it r */

	/* append r to current poly, except p0 and p1 are special cases */
	if ((bi == 0) || (!pteq(r, p0) && !pteq(r, p1)))
	    polysz = appendpt(r, polysz);
	if (pteq(r, p1))
	    break;
	if (bi + 1 < path->nbox) {	/* recur when we hit the next box */
	    if (pteq(r, q0)) {
		polysz = append(path, bi + 1, q0, q1, polysz);
		polysz = appendpt(q1, polysz);	/* assumes q1 != p0 and p1 */
		i += delta;	/* skip q1 */
	    } else if (pteq(r, q1)) {
		polysz = append(path, bi + 1, q1, q0, polysz);
		polysz = appendpt(q0, polysz);
		i += delta;
	    }
	}
    } while (i != i0);
    return polysz;
}