bl_zcomp.v
7.04 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// Module instances modified by /home/rws/workarea/rf/sw/bbplayer/tools/necprimfix
//
// 30 instances of ad01d1h changed to j_ad01.
// 4 instances of an02d1h changed to j_an02.
// 38 instances of in01d4 changed to j_in01.
// 2 instances of or02d2 changed to j_or02.
// 6 instances of xo02d1h changed to j_xo02.
//
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: bl_zcomp
// description: Z compares for blend unit. Note that old, new and delta
// are all positive only, and the sum of old or new and
// delta cannot overflow, so magnitude compares are OK.
//
// designer: Phil Gossett
// date: 8/28/94
//
////////////////////////////////////////////////////////////////////////
module bl_zcomp (old, new, delta, farther, nearer, infront);
input [17:0] old; // 0,15.3
input [17:0] new; // 0,15.3
input [15:0] delta; // 16.0 (power of 2)
output farther; // (new + delta) >= old
output nearer; // (old + delta) >= new
output infront; // old > new
wire [17:0] old_l;
wire [17:0] new_l;
wire [17:0] far_sum;
wire [17:0] far_cry;
wire [17:0] near_sum;
wire [17:0] near_cry;
wire p_farther;
wire p_nearer;
j_in01 ino0 ( .i(old[ 0]), .zn(old_l[ 0]));
j_in01 ino1 ( .i(old[ 1]), .zn(old_l[ 1]));
j_in01 ino2 ( .i(old[ 2]), .zn(old_l[ 2]));
j_in01 ino3 ( .i(old[ 3]), .zn(old_l[ 3]));
j_in01 ino4 ( .i(old[ 4]), .zn(old_l[ 4]));
j_in01 ino5 ( .i(old[ 5]), .zn(old_l[ 5]));
j_in01 ino6 ( .i(old[ 6]), .zn(old_l[ 6]));
j_in01 ino7 ( .i(old[ 7]), .zn(old_l[ 7]));
j_in01 ino8 ( .i(old[ 8]), .zn(old_l[ 8]));
j_in01 ino9 ( .i(old[ 9]), .zn(old_l[ 9]));
j_in01 inoa ( .i(old[10]), .zn(old_l[10]));
j_in01 inob ( .i(old[11]), .zn(old_l[11]));
j_in01 inoc ( .i(old[12]), .zn(old_l[12]));
j_in01 inod ( .i(old[13]), .zn(old_l[13]));
j_in01 inoe ( .i(old[14]), .zn(old_l[14]));
j_in01 inof ( .i(old[15]), .zn(old_l[15]));
j_in01 inog ( .i(old[16]), .zn(old_l[16]));
j_in01 inoh ( .i(old[17]), .zn(old_l[17]));
j_in01 inn0 ( .i(new[ 0]), .zn(new_l[ 0]));
j_in01 inn1 ( .i(new[ 1]), .zn(new_l[ 1]));
j_in01 inn2 ( .i(new[ 2]), .zn(new_l[ 2]));
j_in01 inn3 ( .i(new[ 3]), .zn(new_l[ 3]));
j_in01 inn4 ( .i(new[ 4]), .zn(new_l[ 4]));
j_in01 inn5 ( .i(new[ 5]), .zn(new_l[ 5]));
j_in01 inn6 ( .i(new[ 6]), .zn(new_l[ 6]));
j_in01 inn7 ( .i(new[ 7]), .zn(new_l[ 7]));
j_in01 inn8 ( .i(new[ 8]), .zn(new_l[ 8]));
j_in01 inn9 ( .i(new[ 9]), .zn(new_l[ 9]));
j_in01 inna ( .i(new[10]), .zn(new_l[10]));
j_in01 innb ( .i(new[11]), .zn(new_l[11]));
j_in01 innc ( .i(new[12]), .zn(new_l[12]));
j_in01 innd ( .i(new[13]), .zn(new_l[13]));
j_in01 inne ( .i(new[14]), .zn(new_l[14]));
j_in01 innf ( .i(new[15]), .zn(new_l[15]));
j_in01 inng ( .i(new[16]), .zn(new_l[16]));
j_in01 innh ( .i(new[17]), .zn(new_l[17]));
j_or02 afc0 ( .a1( new[ 0]), .a2( old_l[ 0]),
.z(far_cry[ 0]));
j_xo02 afs1 ( .a1( new[ 1]), .a2( old_l[ 1]),
.z(far_sum[ 0]));
j_an02 afc1 ( .a1( new[ 1]), .a2( old_l[ 1]),
.z(far_cry[ 1]));
j_xo02 afs2 ( .a1( new[ 2]), .a2( old_l[ 2]),
.z(far_sum[ 1]));
j_an02 afc2 ( .a1( new[ 2]), .a2( old_l[ 2]),
.z(far_cry[ 2]));
j_ad01 afs3 ( .a( new[ 3]), .b( old_l[ 3]), .ci(delta[ 0]),
.s(far_sum[ 2]), .co(far_cry[ 3]));
j_ad01 afs4 ( .a( new[ 4]), .b( old_l[ 4]), .ci(delta[ 1]),
.s(far_sum[ 3]), .co(far_cry[ 4]));
j_ad01 afs5 ( .a( new[ 5]), .b( old_l[ 5]), .ci(delta[ 2]),
.s(far_sum[ 4]), .co(far_cry[ 5]));
j_ad01 afs6 ( .a( new[ 6]), .b( old_l[ 6]), .ci(delta[ 3]),
.s(far_sum[ 5]), .co(far_cry[ 6]));
j_ad01 afs7 ( .a( new[ 7]), .b( old_l[ 7]), .ci(delta[ 4]),
.s(far_sum[ 6]), .co(far_cry[ 7]));
j_ad01 afs8 ( .a( new[ 8]), .b( old_l[ 8]), .ci(delta[ 5]),
.s(far_sum[ 7]), .co(far_cry[ 8]));
j_ad01 afs9 ( .a( new[ 9]), .b( old_l[ 9]), .ci(delta[ 6]),
.s(far_sum[ 8]), .co(far_cry[ 9]));
j_ad01 afsa ( .a( new[10]), .b( old_l[10]), .ci(delta[ 7]),
.s(far_sum[ 9]), .co(far_cry[10]));
j_ad01 afsb ( .a( new[11]), .b( old_l[11]), .ci(delta[ 8]),
.s(far_sum[10]), .co(far_cry[11]));
j_ad01 afsc ( .a( new[12]), .b( old_l[12]), .ci(delta[ 9]),
.s(far_sum[11]), .co(far_cry[12]));
j_ad01 afsd ( .a( new[13]), .b( old_l[13]), .ci(delta[10]),
.s(far_sum[12]), .co(far_cry[13]));
j_ad01 afse ( .a( new[14]), .b( old_l[14]), .ci(delta[11]),
.s(far_sum[13]), .co(far_cry[14]));
j_ad01 afsf ( .a( new[15]), .b( old_l[15]), .ci(delta[12]),
.s(far_sum[14]), .co(far_cry[15]));
j_ad01 afsg ( .a( new[16]), .b( old_l[16]), .ci(delta[13]),
.s(far_sum[15]), .co(far_cry[16]));
j_ad01 afsh ( .a( new[17]), .b( old_l[17]), .ci(delta[14]),
.s(far_sum[16]), .co(far_cry[17]));
j_in01 afsi ( .i(delta[15]),
.zn(far_sum[17]));
j_or02 anc0 ( .a1( old[ 0]), .a2( new_l[ 0]),
.z(near_cry[ 0]));
j_xo02 ans1 ( .a1( old[ 1]), .a2( new_l[ 1]),
.z(near_sum[ 0]));
j_an02 anc1 ( .a1( old[ 1]), .a2( new_l[ 1]),
.z( near_cry[ 1]));
j_xo02 ans2 ( .a1( old[ 2]), .a2( new_l[ 2]),
.z(near_sum[ 1]));
j_an02 anc2 ( .a1( old[ 2]), .a2( new_l[ 2]),
.z(near_cry[ 2]));
j_ad01 ans3 ( .a( old[ 3]), .b( new_l[ 3]), .ci(delta[ 0]),
.s(near_sum[ 2]), .co(near_cry[ 3]));
j_ad01 ans4 ( .a( old[ 4]), .b( new_l[ 4]), .ci(delta[ 1]),
.s(near_sum[ 3]), .co(near_cry[ 4]));
j_ad01 ans5 ( .a( old[ 5]), .b( new_l[ 5]), .ci(delta[ 2]),
.s(near_sum[ 4]), .co(near_cry[ 5]));
j_ad01 ans6 ( .a( old[ 6]), .b( new_l[ 6]), .ci(delta[ 3]),
.s(near_sum[ 5]), .co(near_cry[ 6]));
j_ad01 ans7 ( .a( old[ 7]), .b( new_l[ 7]), .ci(delta[ 4]),
.s(near_sum[ 6]), .co(near_cry[ 7]));
j_ad01 ans8 ( .a( old[ 8]), .b( new_l[ 8]), .ci(delta[ 5]),
.s(near_sum[ 7]), .co(near_cry[ 8]));
j_ad01 ans9 ( .a( old[ 9]), .b( new_l[ 9]), .ci(delta[ 6]),
.s(near_sum[ 8]), .co(near_cry[ 9]));
j_ad01 ansa ( .a( old[10]), .b( new_l[10]), .ci(delta[ 7]),
.s(near_sum[ 9]), .co(near_cry[10]));
j_ad01 ansb ( .a( old[11]), .b( new_l[11]), .ci(delta[ 8]),
.s(near_sum[10]), .co(near_cry[11]));
j_ad01 ansc ( .a( old[12]), .b( new_l[12]), .ci(delta[ 9]),
.s(near_sum[11]), .co(near_cry[12]));
j_ad01 ansd ( .a( old[13]), .b( new_l[13]), .ci(delta[10]),
.s(near_sum[12]), .co(near_cry[13]));
j_ad01 anse ( .a( old[14]), .b( new_l[14]), .ci(delta[11]),
.s(near_sum[13]), .co(near_cry[14]));
j_ad01 ansf ( .a( old[15]), .b( new_l[15]), .ci(delta[12]),
.s(near_sum[14]), .co(near_cry[15]));
j_ad01 ansg ( .a( old[16]), .b( new_l[16]), .ci(delta[13]),
.s(near_sum[15]), .co(near_cry[16]));
j_ad01 ansh ( .a( old[17]), .b( new_l[17]), .ci(delta[14]),
.s(near_sum[16]), .co(near_cry[17]));
j_in01 ansi ( .i(delta[15]),
.zn(near_sum[17]));
bl_zcomp_gt fzgt (.a( far_sum), .b( far_cry), .z(p_farther));
j_xo02 fzxo (.a1(delta[15]), .a2(p_farther), .z(farther));
bl_zcomp_gt nzgt (.a(near_sum), .b(near_cry), .z(p_nearer));
j_xo02 nzxo (.a1(delta[15]), .a2(p_nearer), .z(nearer));
bl_zcomp_gt izgt (.a( old), .b( new_l), .z(infront));
endmodule // bl_zcomp