cc_edge_add.v 1.25 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	cc_edge_add
// description:	Carry-propagating adder for texture edge.
//
// designer:	Phil Gossett
// date:	9/16/94
//
////////////////////////////////////////////////////////////////////////

module cc_edge_add (max1, lfg, a, lfrac, d);

input max1;
input lfg;
input [2:0] a;
input [4:0] lfrac;

output [3:0] d;

wire [2:0] s;
wire max1_l;
wire [2:0] clamp;

xo02d1h adds0 (        .a1(a[0]), .a2(lfrac[1]), .z(s[0]));
an02d1h addc0 (        .a1(a[0]), .a2(lfrac[1]),            .z(c0));
ad01d1h adds1 (.ci(c0), .a(a[1]),  .b(lfrac[2]), .s(s[1]), .co(c1));
xo02d1h addp2 (        .a1(a[2]), .a2(lfrac[3]),            .z(pp2));
xo02d1h adds2 (.a1(c1), .a2(pp2),                .z(s[2]));
in01d4  invm1 (.i(max1), .zn(max1_l));
an02d1h clmp0 (.a1(max1_l), .a2(s[0]), .z(clamp[0]));
an02d1h clmp1 (.a1(max1_l), .a2(s[1]), .z(clamp[1]));
an02d1h clmp2 (.a1(max1_l), .a2(s[2]), .z(clamp[2]));
mx21d1h muxl0 (.s(lfg), .i0(clamp[0]), .i1(lfrac[0]), .z(d[0]));
mx21d1h muxl1 (.s(lfg), .i0(clamp[1]), .i1(lfrac[1]), .z(d[1]));
mx21d1h muxl2 (.s(lfg), .i0(clamp[2]), .i1(lfrac[2]), .z(d[2]));
an02d1h muxl3 (.a1(lfg),               .a2(lfrac[4]), .z(d[3]));

endmodule // cc_edge_add