cc_edge_div.v
3.48 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: cc_edge_div
// description: Divider for texture edge.
//
// designer: Phil Gossett
// date: 8/10/94
//
////////////////////////////////////////////////////////////////////////
module cc_edge_div (max1, n, d, q);
input max1;
input [5:0] n; // 0.6
input [3:0] d; // 1.3
wire [3:0] d_l;
wire [2:0] p0s;
wire [2:0] p1s;
wire [2:0] p2s;
wire [3:0] p0c;
wire [3:0] p1c;
wire [2:0] z2s;
wire [3:0] z2c;
wire [3:0] z3c;
wire [2:0] w2s;
wire [3:0] w2c;
wire [3:0] w3c;
output [3:0] q; // 1.3
in01d4 din0 (.i(d[0]), .zn(d_l[0]));
in01d4 din1 (.i(d[1]), .zn(d_l[1]));
in01d4 din2 (.i(d[2]), .zn(d_l[2]));
in01d4 din3 (.i(d[3]), .zn(d_l[3]));
xo02d1h d0s0 ( .a1(d[0]), .a2( n[3]), .z(p0s[0]));
or02d1 d0c0 ( .a1(d_l[0]), .a2( n[3]), .z(p0c[0]));
ad01d1h d0s1 (.ci(p0c[0]), .a(d_l[1]), .b( n[4]), .s(p0s[1]), .co(p0c[1]));
ad01d1h d0s2 (.ci(p0c[1]), .a(d_l[2]), .b( n[5]), .s(p0s[2]), .co(p0c[2]));
an02d1h d0c3 (.a1(p0c[2]), .a2(d_l[3]), .z(p0c[3]));
xo02d1h d1s0 ( .a1(d[0]), .a2( n[2]), .z(p1s[0]));
an02d1h d1c0 ( .a1(d[0]), .a2( n[2]), .z(p1c[0]));
ad01d1h d1s1 (.ci(p1c[0]), .a(d[1]), .b(p0s[0]), .s(p1s[1]), .co(p1c[1]));
ad01d1h d1s2 (.ci(p1c[1]), .a(d[2]), .b(p0s[1]), .s(p1s[2]), .co(p1c[2]));
ad01d1h d1s3 (.ci(p1c[2]), .a(d[3]), .b(p0s[2]), .co(p1c[3]));
xo02d1h d2s0 ( .a1(d[0]), .a2( n[1]), .z(p2s[0]));
assign z2s[0] = p2s[0];
assign w2s[0] = p2s[0];
an02d1h d2c00 ( .a1(d[0]), .a2( n[1]), .z(z2c[0]));
ad01d1h d2s10 (.ci(z2c[0]), .a(d[1]), .b(p1s[0]), .s(z2s[1]), .co(z2c[1]));
ad01d1h d2s20 (.ci(z2c[1]), .a(d[2]), .b(p1s[1]), .s(z2s[2]), .co(z2c[2]));
ad01d1h d2s30 (.ci(z2c[2]), .a(d[3]), .b(p1s[2]), .co(z2c[3]));
or02d1 d2c01 ( .a1(d_l[0]), .a2( n[1]), .z(w2c[0]));
ad01d1h d2s11 (.ci(w2c[0]), .a(d_l[1]), .b(p1s[0]), .s(w2s[1]), .co(w2c[1]));
ad01d1h d2s21 (.ci(w2c[1]), .a(d_l[2]), .b(p1s[1]), .s(w2s[2]), .co(w2c[2]));
ad01d1h d2s31 (.ci(w2c[2]), .a(d_l[3]), .b(p1s[2]), .co(w2c[3]));
mx21d1h d2m1 ( .s(p1c[3]), .i0(z2s[1]), .i1(w2s[1]), .z(p2s[1]));
mx21d1h d2m2 ( .s(p1c[3]), .i0(z2s[2]), .i1(w2s[2]), .z(p2s[2]));
mx21d1h d2m3 ( .s(p1c[3]), .i0(z2c[3]), .i1(w2c[3]), .z(p2c));
an02d1h d3c00 ( .a1(d[0]), .a2( n[0]), .z(z3c[0]));
ad01d1h d3s10 (.ci(z3c[0]), .a(d[1]), .b(p2s[0]), .co(z3c[1]));
ad01d1h d3s20 (.ci(z3c[1]), .a(d[2]), .b(p2s[1]), .co(z3c[2]));
ad01d1h d3s30 (.ci(z3c[2]), .a(d[3]), .b(p2s[2]), .co(z3c[3]));
or02d1 d3c01 ( .a1(d_l[0]), .a2( n[0]), .z(w3c[0]));
ad01d1h d3s11 (.ci(w3c[0]), .a(d_l[1]), .b(p2s[0]), .co(w3c[1]));
ad01d1h d3s21 (.ci(w3c[1]), .a(d_l[2]), .b(p2s[1]), .co(w3c[2]));
ad01d1h d3s31 (.ci(w3c[2]), .a(d_l[3]), .b(p2s[2]), .co(w3c[3]));
mx21d1h d3m3 ( .s(p2c), .i0(z3c[3]), .i1(w3c[3]), .z(p3c));
in01d2 din4 ( .i(max1), .zn(max1_l));
nr02d2 dnr3 (.a1(max1), .a2(p0c[3]), .zn(q_l));
an02d1 dqa3 (.a1(max1_l), .a2(p0c[3]), .z(q[3]));
an02d1 dqa2 (.a1(q_l), .a2(p1c[3]), .z(q[2]));
an02d1h dqa1 (.a1(q_l), .a2(p2c), .z(q[1]));
an02d1h dqa0 (.a1(q_l), .a2(p3c), .z(q[0]));
endmodule // cc_edge_div