cc_edge_csa.v 1.47 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	cc_edge_csa
// description:	Carry save adder tree for texture edge
//		for color combine unit.
//
// designer:	Phil Gossett
// date:	9/19/94
//
////////////////////////////////////////////////////////////////////////

module cc_edge_csa (p0p, p1p, p2p, c2c, mp);

input [4:0] p0p;	// pseudo-booth encoded partial products
input [4:0] p1p;
input [3:0] p2p;
input c2c;

wire [5:0] sa;		// intermediate carry save adder sums and carrys
wire [4:0] ca;

output [5:0] mp;

xo02d1h sa5 (             .a1(p1p[4]), .a2(p2p[3]), .z(sa[5]));
ad01d1h sa4 (.ci(p0p[4]),  .b(p1p[3]),  .a(p2p[2]), .s(sa[4]), .co(ca[4]));
ad01d1h sa3 (.ci(p0p[3]),  .b(p1p[2]),  .a(p2p[1]), .s(sa[3]), .co(ca[3]));
ad01d1h sa2 (.ci(p0p[2]),  .b(p1p[1]),  .a(p2p[0]), .s(sa[2]), .co(ca[2]));
ad01d1h sa1 (.ci(p0p[1]),  .b(p1p[0]),  .a(c2c   ), .s(sa[1]), .co(ca[1]));
assign sa[0] = p0p[0];
assign ca[0] = c2c;

ni01d2  mp0 (.i(sa[0]), .z(mp[0]));
xo02d1h mp1 (          .a1(sa[1]), .a2(ca[0]), .z(mp[1]));
an02d1h mc1 (          .a1(sa[1]), .a2(ca[0]),             .z(mc2b));
ad01d1h mp2 (.ci(mc2b), .b(sa[2]),  .a(ca[1]), .s(mp[2]), .co(mc3b));
ad01d1h mp3 (.ci(mc3b), .b(sa[3]),  .a(ca[2]), .s(mp[3]), .co(mc4b));
ad01d1h mp4 (.ci(mc4b), .b(sa[4]),  .a(ca[3]), .s(mp[4]), .co(mc5b));
xo02d1h pp5 (          .a1(sa[5]), .a2(ca[4]), .z(pp5b));
xo02d1h mp5 (.a1(mc5b),             .a2(pp5b), .z(mp[5]));

endmodule // cc_edge_csa