cc_lerp_csa.v 3.63 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	cc_lerp_csa
// description:	Carry save adder tree for lerp for color combine unit.
//		11 partial products. 9 are from pseudo-booth encoder
//		for lerp subtract/multiply. 1 is correction from 1's comp
//		to 2's comp. 1 is the final lerp add.
//
// designer:	Phil Gossett
// date:	6/26/94
//
////////////////////////////////////////////////////////////////////////

module cc_lerp_csa (a, p0p, p1p, p2p, p3p, p4p, p5p, p6p, p7p, p8p, c, mp);

input [8:0] a;		// 2's comp correction
input [9:0] p0p;	// pseudo-booth encoded partial products
input [9:0] p1p;
input [9:0] p2p;
input [9:0] p3p;
input [9:0] p4p;
input [9:0] p5p;
input [9:0] p6p;
input [9:0] p7p;
input [8:0] p8p;
input [8:0] c;		// final lerp add

wire [10:0] sa;		// intermediate carry save adder sums and carrys
wire [10:0] ca;
wire [11:0] sb;
wire [10:0] cb;
wire [11:0] sc;
wire [9:0]  cc;
wire [14:0] sd;
wire [13:0] cd;
wire [15:0] se;
wire [13:0] ce;
wire [11:0] sf;
wire [9:0]  cf;
wire [11:0] sg;
wire [8:0]  cg;
wire [16:0] sh;
wire [12:0] ch;
wire [16:0] si;
wire [11:0] ci;

output [16:0] mp;

cc_lerp_csa_fa10 saf (	.ci({a[8],a[8],a[8:1]}),
			.b({p0p[9],p0p[9:1]}),
			.a(p1p[9:0]),
			.s(sa[10:1]),	.co(ca[10:1]));
cc_lerp_csa_ha1  sah (	.a(a[0]),
			.b(p0p[0]),
			.s(sa[0]),	.co(ca[0]));
					// no fall-thru bits here
cc_lerp_csa_fa10 sbf (	.ci({p2p[9],p2p[9],p2p[9:2]}),
			.b({p3p[9],p3p[9:1]}),
			.a(p4p[9:0]),
			.s(sb[11:2]),	.co(cb[10:1]));
cc_lerp_csa_ha1  sbh (	.a(p2p[1]),
			.b(p3p[0]),
			.s(sb[1]),	.co(cb[0]));
assign sb[0] = p2p[0];
cc_lerp_csa_faso scg (	.ci(p5p[9]),	// sum only full adder
			.b(p6p[9]),
			.a(p7p[9]),
			.s(sc[11]));
cc_lerp_csa_fa10 scf (	.ci({p5p[9],p5p[9:1]}),
			.b(p6p[9:0]),
			.a({p7p[8:0],1'b1}),
			.s(sc[10:1]),	.co(cc[9:0]));
					// no half add bits here
assign sc[0] = p5p[0];
cc_lerp_csa_fa11 sdf (	.ci({{4{sa[10]}},sa[10:4]}),
			.b({{3{ca[10]}},ca[10:3]}),
			.a(cb[10:0]),
			.s(sd[14:4]),	.co(cd[13:3]));
cc_lerp_csa_ha3  sdh (	.a(sa[3:1]),
			.b(ca[2:0]),
			.s(sd[3:1]),	.co(cd[2:0]));
assign sd[0] = sa[0];
cc_lerp_csa_fa14 sef (	.ci({sd[14],sd[14:2]}),
			.b(cd[13:0]),
			.a({sb[11],sb[11],sb[11:0]}),
			.s(se[15:2]),	.co(ce[13:0]));
					// no half add bits here
assign se[1:0] = sd[1:0];
cc_lerp_csa_faso sfg (	.ci(sc[11]),	// sum only full adder
			.b(cc[9]),
			.a(c[8]),
			.s(sf[11]));
cc_lerp_csa_fa9  sff (	.ci(sc[10:2]),
			.b(cc[8:0]),
			.a({c[7:0],1'b1}),
			.s(sf[10:2]),	.co(cf[9:1]));
assign cf[0] =  sc[1];			// half add with 1
assign sf[1] = ~sc[1];			// half add with 1
assign sf[0] =  sc[0];
cc_lerp_csa_faso sgg (	.ci(sf[11]),	// sum only full add
			.b(cf[9]),
			.a(p8p[8]),
			.s(sg[11]));
cc_lerp_csa_fa9  sgf (	.ci(sf[10:2]),
			.b(cf[8:0]),
			.a({p8p[7:0],1'b1}),
			.s(sg[10:2]),	.co(cg[8:0]));
					// no half add bits here
assign sg[1:0] =  sf[1:0];
cc_lerp_csa_faso shg (	.ci(se[15]),	// sum only full add
			.b(ce[13]),
			.a(cg[8]),
			.s(sh[16]));
cc_lerp_csa_fa8  shf (	.ci(se[15:8]),
			.b(ce[12:5]),
			.a(cg[7:0]),
			.s(sh[15:8]),	.co(ch[12:5]));
cc_lerp_csa_ha5  shh (	.a(se[7:3]),
			.b(ce[4:0]),
			.s(sh[7:3]),	.co(ch[4:0]));
assign sh[2:0] = se[2:0];
cc_lerp_csa_faso sig (	.ci(sh[16]),	// sum only full add
			.b(ch[12]),
			.a(sg[11]),
			.s(si[16]));
cc_lerp_csa_fa11 sif (	.ci(sh[15:5]),
			.b(ch[11:1]),
			.a(sg[10:0]),
			.s(si[15:5]),	.co(ci[11:1]));
cc_lerp_csa_ha1  sih (	.a(sh[4]),
			.b(ch[0]),
			.s(si[4]),	.co(ci[0]));
assign si[3:0] = sh[3:0];
cc_lerp_csa_add12 mpa (	.b(si[16:5]),	// final carry-propagating adder
			.a(ci[11:0]),
			.s(mp[16:5]));
assign mp[4:0] = si[4:0];

endmodule // cc_lerp_csa