cc_lerp_booth7.v
2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: cc_lerp_booth7
// description: Pseudo-Booth encoder for lerp for color combine unit.
// Generates bit 7 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_booth7 (x, y, a, p);
input x;
input y;
input [8:0] a;
wire [9:0] pp;
output [9:0] p; // pseudo-booth encoded partial product
fn05d2 mux7s0 (.zn(msel), .a1(y), .b1(x)); // msel = !x && y
fn01d2 mux7e0 (.zn(menb), .a1(y), .b1(x)); // menb = !x || y
mx21d1h mux7b0 (.s(msel), .i0(a[0]), .i1(1'b0), .z(pp[0]));
mx21d1h mux7b1 (.s(msel), .i0(a[1]), .i1(a[0]), .z(pp[1]));
mx21d1h mux7b2 (.s(msel), .i0(a[2]), .i1(a[1]), .z(pp[2]));
mx21d1h mux7b3 (.s(msel), .i0(a[3]), .i1(a[2]), .z(pp[3]));
mx21d1h mux7b4 (.s(msel), .i0(a[4]), .i1(a[3]), .z(pp[4]));
mx21d1h mux7b5 (.s(msel), .i0(a[5]), .i1(a[4]), .z(pp[5]));
mx21d1h mux7b6 (.s(msel), .i0(a[6]), .i1(a[5]), .z(pp[6]));
mx21d1h mux7b7 (.s(msel), .i0(a[7]), .i1(a[6]), .z(pp[7]));
mx21d1h mux7b8 (.s(msel), .i0(a[8]), .i1(a[7]), .z(pp[8]));
assign pp[9] = a[8]; // sign extended
an02d1h and7b0 (.a1(menb), .a2(pp[0]), .z(p[0]));
an02d1h and7b1 (.a1(menb), .a2(pp[1]), .z(p[1]));
an02d1h and7b2 (.a1(menb), .a2(pp[2]), .z(p[2]));
an02d1h and7b3 (.a1(menb), .a2(pp[3]), .z(p[3]));
an02d1h and7b4 (.a1(menb), .a2(pp[4]), .z(p[4]));
an02d1h and7b5 (.a1(menb), .a2(pp[5]), .z(p[5]));
an02d1h and7b6 (.a1(menb), .a2(pp[6]), .z(p[6]));
an02d1h and7b7 (.a1(menb), .a2(pp[7]), .z(p[7]));
an02d1h and7b8 (.a1(menb), .a2(pp[8]), .z(p[8]));
an02d1h and7b9 (.a1(menb), .a2(pp[9]), .z(p[9]));
endmodule // cc_lerp_booth7