cc_lerp_booth8.v 2.44 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	cc_lerp_booth8
// description:	Pseudo-Booth encoder for lerp for color combine unit.
//		Generates bit 8 partial product. This does one partial
//		for lerp subtract/multiply. This effectively does the
//		subtract without propagating the carries. The negative
//		input is first 1's complemented, then the two inputs are
//		considered bitwise. If none is set, mask out the multiply
//		input. If one bit is set, pass the mpy input as a partial
//		product. If both bits are set, shift up one bit.
//		This implements the "Akeley" interpretation of the
//		subtract inputs. The 9 bit inputs treated as unsigned if
//		the 2 msb's are 10, else are sign extended before
//		the subtract, and all 10 bits of result are used in the
//		multiply by the other 9 bit input.
//
// designer:	Phil Gossett
// date:	6/25/94
//
////////////////////////////////////////////////////////////////////////

module cc_lerp_booth8 (x7, x8, y7, y8, a, p);

input x7;
input x8;
input y7;
input y8;
input [8:0] a;

wire [8:0] pp;

output [8:0] p;		// pseudo-booth encoded partial product

xo02d1h xor8xx (.z(xx), .a1(x7), .a2(x8));	// Akeley interpretation
xo02d1h xor8yy (.z(yy), .a1(y7), .a2(y8));
fn05d2  mux8s0 (.zn(msel), .a1(yy), .b1(xx));	// msel = (y7^y8) && !(x7^x8)
fn01d2  mux8e0 (.zn(menb), .a1(yy), .b1(xx));	// menb = (y7^y8) || !(x7^x8)
mx21d1h mux8b0 (.s(msel), .i0(a[0]), .i1(1'b0), .z(pp[0]));
mx21d1h mux8b1 (.s(msel), .i0(a[1]), .i1(a[0]), .z(pp[1]));
mx21d1h mux8b2 (.s(msel), .i0(a[2]), .i1(a[1]), .z(pp[2]));
mx21d1h mux8b3 (.s(msel), .i0(a[3]), .i1(a[2]), .z(pp[3]));
mx21d1h mux8b4 (.s(msel), .i0(a[4]), .i1(a[3]), .z(pp[4]));
mx21d1h mux8b5 (.s(msel), .i0(a[5]), .i1(a[4]), .z(pp[5]));
mx21d1h mux8b6 (.s(msel), .i0(a[6]), .i1(a[5]), .z(pp[6]));
mx21d1h mux8b7 (.s(msel), .i0(a[7]), .i1(a[6]), .z(pp[7]));
mx21d1h mux8b8 (.s(msel), .i0(a[8]), .i1(a[7]), .z(pp[8]));
						// msb falls off end
nd02d1  and8b0 (.a1(menb), .a2(pp[0]), .zn(p[0]));
nd02d1  and8b1 (.a1(menb), .a2(pp[1]), .zn(p[1]));
nd02d1  and8b2 (.a1(menb), .a2(pp[2]), .zn(p[2]));
nd02d1  and8b3 (.a1(menb), .a2(pp[3]), .zn(p[3]));
nd02d1  and8b4 (.a1(menb), .a2(pp[4]), .zn(p[4]));
nd02d1  and8b5 (.a1(menb), .a2(pp[5]), .zn(p[5]));
nd02d1  and8b6 (.a1(menb), .a2(pp[6]), .zn(p[6]));
nd02d1  and8b7 (.a1(menb), .a2(pp[7]), .zn(p[7]));
nd02d1  and8b8 (.a1(menb), .a2(pp[8]), .zn(p[8]));

endmodule // cc_lerp_booth8