bl_cvg2.v 8.74 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	bl_cvg2
// description: Interpenetration and coverage wrap for blend unit.
//
// designer:	Phil Gossett
// date:	9/19/94
//
////////////////////////////////////////////////////////////////////////

module bl_cvg2 (pcvg, mcvg, newz, oldz, deltaz, zmode, infront, farther,
	pout, wrap, we);

input [3:0] pcvg;	// 1.3
input [2:0] mcvg;	// 0.3
input [17:0] newz;	// 0,15.3
input [17:0] oldz;	// 0,15.3
input [3:0] deltaz;	// log2
input [1:0] zmode;	// 0) opaque, 1) inter, 2) trans, 3) decal.
input infront;
input farther;

output [3:0] pout;	// 1.3
output wrap;
output we;

wire [2:0] cw;
wire [17:0] nz_l;
wire [3:0] sxa;
wire [3:0] sxb;
wire [3:0] sx;
wire [3:0] sya;
wire [3:0] syb;
wire [3:0] sy;
wire [2:0] cz;
wire [3:0] mx;
wire [1:0] p0p;
wire [2:0] p1p;
wire [1:0] p2p;
wire [2:0] mys;
wire [2:0] myc;
wire [1:0] mpc;
wire [2:0] pmp;
wire [3:0] mpa;
wire [3:0] mpb;
wire [3:0] mp;

an02d1  adwc0 (            .a1(pcvg[0]), .a2(mcvg[0]),  .z(cw[0]));
ad01d1  adwc1 (.ci(cw[0]),  .a(pcvg[1]),  .b(mcvg[1]), .co(cw[1]));
ad01d1  adwc2 (.ci(cw[1]),  .a(pcvg[2]),  .b(mcvg[2]), .co(cw[2]));
xo02d1  adwc3 (.a1(cw[2]), .a2(pcvg[3]),  .z(wrap));

in01d2  inn00 (.i(newz[ 0]), .zn(nz_l[ 0]));
in01d2  inn01 (.i(newz[ 1]), .zn(nz_l[ 1]));
in01d2  inn02 (.i(newz[ 2]), .zn(nz_l[ 2]));
in01d2  inn03 (.i(newz[ 3]), .zn(nz_l[ 3]));
in01d2  inn04 (.i(newz[ 4]), .zn(nz_l[ 4]));
in01d2  inn05 (.i(newz[ 5]), .zn(nz_l[ 5]));
in01d2  inn06 (.i(newz[ 6]), .zn(nz_l[ 6]));
in01d2  inn07 (.i(newz[ 7]), .zn(nz_l[ 7]));
in01d2  inn08 (.i(newz[ 8]), .zn(nz_l[ 8]));
in01d2  inn09 (.i(newz[ 9]), .zn(nz_l[ 9]));
in01d2  inn10 (.i(newz[10]), .zn(nz_l[10]));
in01d2  inn11 (.i(newz[11]), .zn(nz_l[11]));
in01d2  inn12 (.i(newz[12]), .zn(nz_l[12]));
in01d2  inn13 (.i(newz[13]), .zn(nz_l[13]));
in01d2  inn14 (.i(newz[14]), .zn(nz_l[14]));
in01d2  inn15 (.i(newz[15]), .zn(nz_l[15]));
in01d2  inn16 (.i(newz[16]), .zn(nz_l[16]));
in01d2  inn17 (.i(newz[17]), .zn(nz_l[17]));

mx81d1h sxa0 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[ 0]), .i1(oldz[ 1]), .i2(oldz[ 2]), .i3(oldz[ 3]),
              .i4(oldz[ 4]), .i5(oldz[ 5]), .i6(oldz[ 6]), .i7(oldz[ 7]),
              .z(sxa[0]));
mx81d1h sxa1 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[ 1]), .i1(oldz[ 2]), .i2(oldz[ 3]), .i3(oldz[ 4]),
              .i4(oldz[ 5]), .i5(oldz[ 6]), .i6(oldz[ 7]), .i7(oldz[ 8]),
              .z(sxa[1]));
mx81d1h sxa2 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[ 2]), .i1(oldz[ 3]), .i2(oldz[ 4]), .i3(oldz[ 5]),
              .i4(oldz[ 6]), .i5(oldz[ 7]), .i6(oldz[ 8]), .i7(oldz[ 9]),
              .z(sxa[2]));
mx81d1h sxa3 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[ 3]), .i1(oldz[ 4]), .i2(oldz[ 5]), .i3(oldz[ 6]),
              .i4(oldz[ 7]), .i5(oldz[ 8]), .i6(oldz[ 9]), .i7(oldz[10]),
              .z(sxa[3]));
mx81d1h sxb0 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[ 8]), .i1(oldz[ 9]), .i2(oldz[10]), .i3(oldz[11]),
              .i4(oldz[12]), .i5(oldz[13]), .i6(oldz[14]), .i7(oldz[15]),
              .z(sxb[0]));
mx81d1h sxb1 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[ 9]), .i1(oldz[10]), .i2(oldz[11]), .i3(oldz[12]),
              .i4(oldz[13]), .i5(oldz[14]), .i6(oldz[15]), .i7(oldz[16]),
              .z(sxb[1]));
mx81d1h sxb2 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[10]), .i1(oldz[11]), .i2(oldz[12]), .i3(oldz[13]),
              .i4(oldz[14]), .i5(oldz[15]), .i6(oldz[16]), .i7(oldz[17]),
              .z(sxb[2]));
mx81d1h sxb3 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(oldz[11]), .i1(oldz[12]), .i2(oldz[13]), .i3(oldz[14]),
              .i4(oldz[15]), .i5(oldz[16]), .i6(oldz[17]), .i7(    1'b0),
              .z(sxb[3]));
mx21d1h sxc0 (.s(deltaz[3]), .i0(sxa[0]), .i1(sxb[0]), .z(sx[0]));
mx21d1h sxc1 (.s(deltaz[3]), .i0(sxa[1]), .i1(sxb[1]), .z(sx[1]));
mx21d1h sxc2 (.s(deltaz[3]), .i0(sxa[2]), .i1(sxb[2]), .z(sx[2]));
mx21d1h sxc3 (.s(deltaz[3]), .i0(sxa[3]), .i1(sxb[3]), .z(sx[3]));

mx81d1h sya0 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[ 0]), .i1(nz_l[ 1]), .i2(nz_l[ 2]), .i3(nz_l[ 3]),
              .i4(nz_l[ 4]), .i5(nz_l[ 5]), .i6(nz_l[ 6]), .i7(nz_l[ 7]),
              .z(sya[0]));
mx81d1h sya1 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[ 1]), .i1(nz_l[ 2]), .i2(nz_l[ 3]), .i3(nz_l[ 4]),
              .i4(nz_l[ 5]), .i5(nz_l[ 6]), .i6(nz_l[ 7]), .i7(nz_l[ 8]),
              .z(sya[1]));
mx81d1h sya2 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[ 2]), .i1(nz_l[ 3]), .i2(nz_l[ 4]), .i3(nz_l[ 5]),
              .i4(nz_l[ 6]), .i5(nz_l[ 7]), .i6(nz_l[ 8]), .i7(nz_l[ 9]),
              .z(sya[2]));
mx81d1h sya3 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[ 3]), .i1(nz_l[ 4]), .i2(nz_l[ 5]), .i3(nz_l[ 6]),
              .i4(nz_l[ 7]), .i5(nz_l[ 8]), .i6(nz_l[ 9]), .i7(nz_l[10]),
              .z(sya[3]));
mx81d1h syb0 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[ 8]), .i1(nz_l[ 9]), .i2(nz_l[10]), .i3(nz_l[11]),
              .i4(nz_l[12]), .i5(nz_l[13]), .i6(nz_l[14]), .i7(nz_l[15]),
              .z(syb[0]));
mx81d1h syb1 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[ 9]), .i1(nz_l[10]), .i2(nz_l[11]), .i3(nz_l[12]),
              .i4(nz_l[13]), .i5(nz_l[14]), .i6(nz_l[15]), .i7(nz_l[16]),
              .z(syb[1]));
mx81d1h syb2 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[10]), .i1(nz_l[11]), .i2(nz_l[12]), .i3(nz_l[13]),
              .i4(nz_l[14]), .i5(nz_l[15]), .i6(nz_l[16]), .i7(nz_l[17]),
              .z(syb[2]));
mx81d1h syb3 (.s0(deltaz[0]), .s1(deltaz[1]), .s2(deltaz[2]),
              .i0(nz_l[11]), .i1(nz_l[12]), .i2(nz_l[13]), .i3(nz_l[14]),
              .i4(nz_l[15]), .i5(nz_l[16]), .i6(nz_l[17]), .i7(    1'b1),
              .z(syb[3]));
mx21d1h syc0 (.s(deltaz[3]), .i0(sya[0]), .i1(syb[0]), .z(sy[0]));
mx21d1h syc1 (.s(deltaz[3]), .i0(sya[1]), .i1(syb[1]), .z(sy[1]));
mx21d1h syc2 (.s(deltaz[3]), .i0(sya[2]), .i1(syb[2]), .z(sy[2]));
mx21d1h syc3 (.s(deltaz[3]), .i0(sya[3]), .i1(syb[3]), .z(sy[3]));

ad01d1h adz00 (.ci( 1'b1), .a(sx[0]), .b(sy[0]), .s(mx[0]), .co(cz[0]));
ad01d1h adz01 (.ci(cz[0]), .a(sx[1]), .b(sy[1]), .s(mx[1]), .co(cz[1]));
ad01d1h adz02 (.ci(cz[1]), .a(sx[2]), .b(sy[2]), .s(mx[2]), .co(cz[2]));
ad01d1h adz03 (.ci(cz[2]), .a(sx[3]), .b(sy[3]), .s(mx[3]));

an02d1h man1 (.a1(pcvg[0]), .a2(mx[1]), .z(p0p[0]));
an02d1h man2 (.a1(pcvg[0]), .a2(mx[2]), .z(p0p[1]));
an02d1h man3 (.a1(pcvg[1]), .a2(mx[0]), .z(p1p[0]));
an02d1h man4 (.a1(pcvg[1]), .a2(mx[1]), .z(p1p[1]));
an02d1h man5 (.a1(pcvg[1]), .a2(mx[2]), .z(p1p[2]));
an02d1h man6 (.a1(pcvg[2]), .a2(mx[0]), .z(p2p[0]));
an02d1h man7 (.a1(pcvg[2]), .a2(mx[1]), .z(p2p[1]));
an02d1h man8 (.a1(pcvg[2]), .a2(mx[2]), .z(mys[2]));

an02d1h myc0 (.a1(p0p[0]), .a2(p1p[0]),                           .z(myc[0]));
ad01d1h mys0 (.ci(p0p[1]),  .a(p1p[1]),  .b(p2p[0]), .s(mys[0]), .co(myc[1]));
xo02d1h mys1 (.a1(p1p[2]), .a2(p2p[1]),              .z(mys[1]));
an02d1h myc2 (.a1(p1p[2]), .a2(p2p[1]),                           .z(myc[2]));
an02d1h myp0 (             .a1(mys[0]), .a2(myc[0]),              .z(mpc[0]));
ad01d1h myp1 (.ci(mpc[0]),  .a(mys[1]),  .b(myc[1]), .s(pmp[0]), .co(mpc[1]));
ad01d1h myp2 (.ci(mpc[1]),  .a(mys[2]),  .b(myc[2]), .s(pmp[1]), .co(pmp[2]));

mx21d1h mpa0 (.s(  mx[3]), .i0(pmp[0]), .i1(pcvg[0]), .z(mpa[0]));
mx21d1h mpa1 (.s(  mx[3]), .i0(pmp[1]), .i1(pcvg[1]), .z(mpa[1]));
mx21d1h mpa2 (.s(  mx[3]), .i0(pmp[2]), .i1(pcvg[2]), .z(mpa[2]));
mx21d1h mpa3 (.s(  mx[3]), .i0(  1'b0), .i1(pcvg[3]), .z(mpa[3]));
mx21d1h mpb0 (.s(  mx[3]), .i0( mx[0]), .i1(   1'b0), .z(mpb[0]));
mx21d1h mpb1 (.s(  mx[3]), .i0( mx[1]), .i1(   1'b0), .z(mpb[1]));
mx21d1h mpb2 (.s(  mx[3]), .i0( mx[2]), .i1(   1'b0), .z(mpb[2]));
mx21d1h mpb3 (.s(  mx[3]), .i0( mx[3]), .i1(   1'b1), .z(mpb[3]));
mx21d1h mpc0 (.s(pcvg[3]), .i0(mpa[0]), .i1(mpb[0]), .z(mp[0]));
mx21d1h mpc1 (.s(pcvg[3]), .i0(mpa[1]), .i1(mpb[1]), .z(mp[1]));
mx21d1h mpc2 (.s(pcvg[3]), .i0(mpa[2]), .i1(mpb[2]), .z(mp[2]));
mx21d1h mpc3 (.s(pcvg[3]), .i0(mpa[3]), .i1(mpb[3]), .z(mp[3]));

in01d2  inz  (.i(zmode[1]), .zn(zmode1_l));
an05d2  an5  (.a1(wrap), .a2(zmode[0]), .a3(zmode1_l),
		.a4(infront), .a5(farther), .z(selmpy));
mx21d1h mps0 (.s(selmpy), .i0(pcvg[0]), .i1(mp[0]), .z(pout[0]));
mx21d1h mps1 (.s(selmpy), .i0(pcvg[1]), .i1(mp[1]), .z(pout[1]));
mx21d1h mps2 (.s(selmpy), .i0(pcvg[2]), .i1(mp[2]), .z(pout[2]));
mx21d1h mps3 (.s(selmpy), .i0(pcvg[3]), .i1(mp[3]), .z(pout[3]));

or04d1  ocvg  (.a1(pout[0]), .a2(pout[1]), .a3(pout[2]), .a4(pout[3]),
		.z(we));

endmodule // bl_cvg2