tf_lerp.v
1.84 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
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: tf_lerp
// description: Bilerp for texture filter unit. 23 partial products.
// Note that this is the triangular bilerp
// (2 multiplies per component).
//
// designer: Phil Gossett
// date: 6/18/94
//
////////////////////////////////////////////////////////////////////////
module tf_lerp (xa, ya, a, xb, yb, b, c, t, o, mp);
input [8:0] xa; // 1st positive subtract input
input [8:0] ya; // 1st negative subtract input
input [8:0] a; // 1st multiply input
input [8:0] xb; // 2nd positive subtract input
input [8:0] yb; // 2nd negative subtract input
input [8:0] b; // 2nd multiply input
input [8:0] c; // final lerp add
input [8:0] t; // for mid mode average (1's comp)
input [8:0] o; // for mid mode average
wire [9:0] p0p; // pseudo-booth encoded partial products (*a)
wire [9:0] p1p;
wire [9:0] p2p;
wire [9:0] p3p;
wire [9:0] p4p;
wire [9:0] p5p;
wire [9:0] p6p;
wire [9:0] p7p;
wire [8:0] p8p;
wire [9:0] q0q; // pseudo-booth encoded partial products (*b)
wire [9:0] q1q;
wire [9:0] q2q;
wire [9:0] q3q;
wire [9:0] q4q;
wire [9:0] q5q;
wire [9:0] q6q;
wire [9:0] q7q;
wire [8:0] q8q;
output [8:0] mp; // final carry-propagated sum
tf_lerp_booth bootha ( .x(xa), .y(ya), .a(a),
.p0p(p0p), .p1p(p1p), .p2p(p2p),
.p3p(p3p), .p4p(p4p), .p5p(p5p),
.p6p(p6p), .p7p(p7p), .p8p(p8p));
tf_lerp_booth boothb ( .x(xb), .y(yb), .a(b),
.p0p(q0q), .p1p(q1q), .p2p(q2q),
.p3p(q3q), .p4p(q4q), .p5p(q5q),
.p6p(q6q), .p7p(q7q), .p8p(q8q));
tf_lerp_csa csa ( .a(a), .b(b),
.p0p(p0p), .p1p(p1p), .p2p(p2p),
.p3p(p3p), .p4p(p4p), .p5p(p5p),
.p6p(p6p), .p7p(p7p), .p8p(p8p),
.q0q(q0q), .q1q(q1q), .q2q(q2q),
.q3q(q3q), .q4q(q4q), .q5q(q5q),
.q6q(q6q), .q7q(q7q), .q8q(q8q),
.c(c), .t(t), .o(o), .mp(mp));
endmodule // tf_lerp