tf_lerp_booth8.v
2.55 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
59
60
61
62
63
64
65
// Module instances modified by /home/rws/workarea/rf/sw/bbplayer/tools/necprimfix
//
// 1 instance of fn01d2 changed to j_fn01.
// 1 instance of fn05d2 changed to j_fn05.
// 9 instances of mx21d1h changed to j_mx21.
// 9 instances of nd02d1 changed to j_nd02.
//
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: tf_lerp_booth8
// description: Pseudo-Booth encoder for bilerp for texture filter unit.
// Generates ms 9 bit complemented partial product. This
// plus 8 of the 10 bit normal version make up 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 sign extended interpretation of the
// subtract inputs. The 9 bit inputs 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 tf_lerp_booth8 (x, y, a, p);
input x;
input y;
input [8:0] a;
wire [8:0] pp;
output [8:0] p; // pseudo-booth encoded partial product
j_fn05 mux8s0 (.zn(msel), .a1(x), .b1(y)); // msel = x && !y
j_fn01 mux8e0 (.zn(menb), .a1(x), .b1(y)); // menb = x || !y
j_mx21 mux8b0 (.s(msel), .i0(a[0]), .i1(1'b0), .z(pp[0]));
j_mx21 mux8b1 (.s(msel), .i0(a[1]), .i1(a[0]), .z(pp[1]));
j_mx21 mux8b2 (.s(msel), .i0(a[2]), .i1(a[1]), .z(pp[2]));
j_mx21 mux8b3 (.s(msel), .i0(a[3]), .i1(a[2]), .z(pp[3]));
j_mx21 mux8b4 (.s(msel), .i0(a[4]), .i1(a[3]), .z(pp[4]));
j_mx21 mux8b5 (.s(msel), .i0(a[5]), .i1(a[4]), .z(pp[5]));
j_mx21 mux8b6 (.s(msel), .i0(a[6]), .i1(a[5]), .z(pp[6]));
j_mx21 mux8b7 (.s(msel), .i0(a[7]), .i1(a[6]), .z(pp[7]));
j_mx21 mux8b8 (.s(msel), .i0(a[8]), .i1(a[7]), .z(pp[8]));
// msb falls off end
j_nd02 and8b0 (.a1(menb), .a2(pp[0]), .zn(p[0]));
j_nd02 and8b1 (.a1(menb), .a2(pp[1]), .zn(p[1]));
j_nd02 and8b2 (.a1(menb), .a2(pp[2]), .zn(p[2]));
j_nd02 and8b3 (.a1(menb), .a2(pp[3]), .zn(p[3]));
j_nd02 and8b4 (.a1(menb), .a2(pp[4]), .zn(p[4]));
j_nd02 and8b5 (.a1(menb), .a2(pp[5]), .zn(p[5]));
j_nd02 and8b6 (.a1(menb), .a2(pp[6]), .zn(p[6]));
j_nd02 and8b7 (.a1(menb), .a2(pp[7]), .zn(p[7]));
j_nd02 and8b8 (.a1(menb), .a2(pp[8]), .zn(p[8]));
endmodule // tf_lerp_booth8