tc_max_abs_dif_add15.v
12.7 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
// Module instances modified by /home/rws/workarea/rf/sw/bbplayer/tools/necprimfix
//
// 14 instances of an02d1h changed to j_an02.
// 73 instances of mx21d1h changed to j_mx21.
// 1 instance of ni01d4 changed to j_ni01.
// 15 instances of or02d2 changed to j_or02.
// 29 instances of xo02d1h changed to j_xo02.
//
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: tc_max_abs_dif_add15
// description: 15 bit carry-propagating adder for use in tc lod,
// with assumed carry in and carry out (for abs dif).
// Assumes n = ~b (for speed).
// Conditional sum adder.
//
// designer: Phil Gossett
// date: 6/4/95
//
////////////////////////////////////////////////////////////////////////
// $Id: tc_max_abs_dif_add15.v,v 1.2 2002/11/13 02:11:41 rws Exp $
module tc_max_abs_dif_add15 (a, b, n, s, co) ;
input [14:0] a;
input [14:0] b;
input [14:0] n; // n = ~b
output [14:0] s;
output co;
wire [14:0] s0; // sum out assuming carry in 0
wire [14:0] s1; // sum out assuming carry in 1
wire [14:0] c0; // carry out assuming carry in 0
wire [14:0] c1; // carry out assuming carry in 1
// conditional cells:
j_xo02 s10 (.a1(a[0]), .a2(n[0]), .z(s1[0])); // assume carry in
assign s0[0] = s1[0];
j_or02 c10 (.a1(a[0]), .a2(b[0]), .z(c1[0])); // assume carry in
assign c0[0] = c1[0];
j_xo02 s01 (.a1(a[1]), .a2(b[1]), .z(s0[1]));
j_xo02 s11 (.a1(a[1]), .a2(n[1]), .z(s1[1]));
j_an02 c01 (.a1(a[1]), .a2(b[1]), .z(c0[1]));
j_or02 c11 (.a1(a[1]), .a2(b[1]), .z(c1[1]));
j_xo02 s02 (.a1(a[2]), .a2(b[2]), .z(s0[2]));
j_xo02 s12 (.a1(a[2]), .a2(n[2]), .z(s1[2]));
j_an02 c02 (.a1(a[2]), .a2(b[2]), .z(c0[2]));
j_or02 c12 (.a1(a[2]), .a2(b[2]), .z(c1[2]));
j_xo02 s03 (.a1(a[3]), .a2(b[3]), .z(s0[3]));
j_xo02 s13 (.a1(a[3]), .a2(n[3]), .z(s1[3]));
j_an02 c03 (.a1(a[3]), .a2(b[3]), .z(c0[3]));
j_or02 c13 (.a1(a[3]), .a2(b[3]), .z(c1[3]));
j_xo02 s04 (.a1(a[4]), .a2(b[4]), .z(s0[4]));
j_xo02 s14 (.a1(a[4]), .a2(n[4]), .z(s1[4]));
j_an02 c04 (.a1(a[4]), .a2(b[4]), .z(c0[4]));
j_or02 c14 (.a1(a[4]), .a2(b[4]), .z(c1[4]));
j_xo02 s05 (.a1(a[5]), .a2(b[5]), .z(s0[5]));
j_xo02 s15 (.a1(a[5]), .a2(n[5]), .z(s1[5]));
j_an02 c05 (.a1(a[5]), .a2(b[5]), .z(c0[5]));
j_or02 c15 (.a1(a[5]), .a2(b[5]), .z(c1[5]));
j_xo02 s06 (.a1(a[6]), .a2(b[6]), .z(s0[6]));
j_xo02 s16 (.a1(a[6]), .a2(n[6]), .z(s1[6]));
j_an02 c06 (.a1(a[6]), .a2(b[6]), .z(c0[6]));
j_or02 c16 (.a1(a[6]), .a2(b[6]), .z(c1[6]));
j_xo02 s07 (.a1(a[7]), .a2(b[7]), .z(s0[7]));
j_xo02 s17 (.a1(a[7]), .a2(n[7]), .z(s1[7]));
j_an02 c07 (.a1(a[7]), .a2(b[7]), .z(c0[7]));
j_or02 c17 (.a1(a[7]), .a2(b[7]), .z(c1[7]));
j_xo02 s08 (.a1(a[8]), .a2(b[8]), .z(s0[8]));
j_xo02 s18 (.a1(a[8]), .a2(n[8]), .z(s1[8]));
j_an02 c08 (.a1(a[8]), .a2(b[8]), .z(c0[8]));
j_or02 c18 (.a1(a[8]), .a2(b[8]), .z(c1[8]));
j_xo02 s09 (.a1(a[9]), .a2(b[9]), .z(s0[9]));
j_xo02 s19 (.a1(a[9]), .a2(n[9]), .z(s1[9]));
j_an02 c09 (.a1(a[9]), .a2(b[9]), .z(c0[9]));
j_or02 c19 (.a1(a[9]), .a2(b[9]), .z(c1[9]));
j_xo02 s010 (.a1(a[10]), .a2(b[10]), .z(s0[10]));
j_xo02 s110 (.a1(a[10]), .a2(n[10]), .z(s1[10]));
j_an02 c010 (.a1(a[10]), .a2(b[10]), .z(c0[10]));
j_or02 c110 (.a1(a[10]), .a2(b[10]), .z(c1[10]));
j_xo02 s011 (.a1(a[11]), .a2(b[11]), .z(s0[11]));
j_xo02 s111 (.a1(a[11]), .a2(n[11]), .z(s1[11]));
j_an02 c011 (.a1(a[11]), .a2(b[11]), .z(c0[11]));
j_or02 c111 (.a1(a[11]), .a2(b[11]), .z(c1[11]));
j_xo02 s012 (.a1(a[12]), .a2(b[12]), .z(s0[12]));
j_xo02 s112 (.a1(a[12]), .a2(n[12]), .z(s1[12]));
j_an02 c012 (.a1(a[12]), .a2(b[12]), .z(c0[12]));
j_or02 c112 (.a1(a[12]), .a2(b[12]), .z(c1[12]));
j_xo02 s013 (.a1(a[13]), .a2(b[13]), .z(s0[13]));
j_xo02 s113 (.a1(a[13]), .a2(n[13]), .z(s1[13]));
j_an02 c013 (.a1(a[13]), .a2(b[13]), .z(c0[13]));
j_or02 c113 (.a1(a[13]), .a2(b[13]), .z(c1[13]));
j_xo02 s014 (.a1(a[14]), .a2(b[14]), .z(s0[14]));
j_xo02 s114 (.a1(a[14]), .a2(n[14]), .z(s1[14]));
j_an02 c014 (.a1(a[14]), .a2(b[14]), .z(c0[14]));
j_or02 c114 (.a1(a[14]), .a2(b[14]), .z(c1[14]));
// first rank of muxes (all muxes should be high performance):
wire m1c0b0; // carry out from bit 0
wire m1s0b2; // sum bit 2 assuming carry out bit 1 is 0
wire m1s1b2; // sum bit 2 assuming carry out bit 1 is 1
wire m1c0b2; // carry in to bit 3 assuming carry out bit 1 is 0
wire m1c1b2; // carry in to bit 3 assuming carry out bit 1 is 1
wire m1s0b4; // sum bit 4 assuming carry out bit 1 is 0
wire m1s1b4; // sum bit 4 assuming carry out bit 1 is 1
wire m1c0b4; // carry in to bit 5 assuming carry out bit 1 is 0
wire m1c1b4; // carry in to bit 5 assuming carry out bit 1 is 1
wire m1s0b6; // sum bit 6 assuming carry out bit 1 is 0
wire m1s1b6; // sum bit 6 assuming carry out bit 1 is 1
wire m1c0b6; // carry in to bit 7 assuming carry out bit 1 is 0
wire m1c1b6; // carry in to bit 7 assuming carry out bit 1 is 1
wire m1s0b8; // sum bit 8 assuming carry out bit 1 is 0
wire m1s1b8; // sum bit 8 assuming carry out bit 1 is 1
wire m1c0b8; // carry in to bit 9 assuming carry out bit 1 is 0
wire m1c1b8; // carry in to bit 9 assuming carry out bit 1 is 1
wire m1s0b10; // sum bit 10 assuming carry out bit 1 is 0
wire m1s1b10; // sum bit 10 assuming carry out bit 1 is 1
wire m1c0b10; // carry in to bit 11 assuming carry out bit 1 is 0
wire m1c1b10; // carry in to bit 11 assuming carry out bit 1 is 1
wire m1s0b12; // sum bit 12 assuming carry out bit 1 is 0
wire m1s1b12; // sum bit 12 assuming carry out bit 1 is 1
wire m1c0b12; // carry in to bit 13 assuming carry out bit 1 is 0
wire m1c1b12; // carry in to bit 13 assuming carry out bit 1 is 1
wire m1s0b14; // sum bit 14 assuming carry out bit 1 is 0
wire m1s1b14; // sum bit 14 assuming carry out bit 1 is 1
wire m1c0b14; // carry in to bit 15 assuming carry out bit 1 is 0
wire m1c1b14; // carry in to bit 15 assuming carry out bit 1 is 1
assign s[0] = s1[0]; // assume carry in
assign m1c0b0 = c1[0]; // assume carry in
j_mx21 mx1s0b2 (.s(c0[1]), .i0(s0[2]), .i1(s1[2]), .z(m1s0b2));
j_mx21 mx1s1b2 (.s(c1[1]), .i0(s0[2]), .i1(s1[2]), .z(m1s1b2));
j_mx21 mx1c0b2 (.s(c0[1]), .i0(c0[2]), .i1(c1[2]), .z(m1c0b2));
j_mx21 mx1c1b2 (.s(c1[1]), .i0(c0[2]), .i1(c1[2]), .z(m1c1b2));
j_mx21 mx1s0b4 (.s(c0[3]), .i0(s0[4]), .i1(s1[4]), .z(m1s0b4));
j_mx21 mx1s1b4 (.s(c1[3]), .i0(s0[4]), .i1(s1[4]), .z(m1s1b4));
j_mx21 mx1c0b4 (.s(c0[3]), .i0(c0[4]), .i1(c1[4]), .z(m1c0b4));
j_mx21 mx1c1b4 (.s(c1[3]), .i0(c0[4]), .i1(c1[4]), .z(m1c1b4));
j_mx21 mx1s0b6 (.s(c0[5]), .i0(s0[6]), .i1(s1[6]), .z(m1s0b6));
j_mx21 mx1s1b6 (.s(c1[5]), .i0(s0[6]), .i1(s1[6]), .z(m1s1b6));
j_mx21 mx1c0b6 (.s(c0[5]), .i0(c0[6]), .i1(c1[6]), .z(m1c0b6));
j_mx21 mx1c1b6 (.s(c1[5]), .i0(c0[6]), .i1(c1[6]), .z(m1c1b6));
j_mx21 mx1s0b8 (.s(c0[7]), .i0(s0[8]), .i1(s1[8]), .z(m1s0b8));
j_mx21 mx1s1b8 (.s(c1[7]), .i0(s0[8]), .i1(s1[8]), .z(m1s1b8));
j_mx21 mx1c0b8 (.s(c0[7]), .i0(c0[8]), .i1(c1[8]), .z(m1c0b8));
j_mx21 mx1c1b8 (.s(c1[7]), .i0(c0[8]), .i1(c1[8]), .z(m1c1b8));
j_mx21 mx1s0b10 (.s(c0[9]), .i0(s0[10]), .i1(s1[10]), .z(m1s0b10));
j_mx21 mx1s1b10 (.s(c1[9]), .i0(s0[10]), .i1(s1[10]), .z(m1s1b10));
j_mx21 mx1c0b10 (.s(c0[9]), .i0(c0[10]), .i1(c1[10]), .z(m1c0b10));
j_mx21 mx1c1b10 (.s(c1[9]), .i0(c0[10]), .i1(c1[10]), .z(m1c1b10));
j_mx21 mx1s0b12 (.s(c0[11]), .i0(s0[12]), .i1(s1[12]), .z(m1s0b12));
j_mx21 mx1s1b12 (.s(c1[11]), .i0(s0[12]), .i1(s1[12]), .z(m1s1b12));
j_mx21 mx1c0b12 (.s(c0[11]), .i0(c0[12]), .i1(c1[12]), .z(m1c0b12));
j_mx21 mx1c1b12 (.s(c1[11]), .i0(c0[12]), .i1(c1[12]), .z(m1c1b12));
j_mx21 mx1s0b14 (.s(c0[13]), .i0(s0[14]), .i1(s1[14]), .z(m1s0b14));
j_mx21 mx1s1b14 (.s(c1[13]), .i0(s0[14]), .i1(s1[14]), .z(m1s1b14));
j_mx21 mx1c0b14 (.s(c0[13]), .i0(c0[14]), .i1(c1[14]), .z(m1c0b14));
j_mx21 mx1c1b14 (.s(c1[13]), .i0(c0[14]), .i1(c1[14]), .z(m1c1b14));
// second rank of muxes:
wire m2c0b2; // carry out from bit 2
wire m2s0b5; // sum bit 5 assuming carry out bit 4 is 0
wire m2s1b5; // sum bit 5 assuming carry out bit 4 is 1
wire m2s0b6; // sum bit 6 assuming carry out bit 4 is 0
wire m2s1b6; // sum bit 6 assuming carry out bit 4 is 1
wire m2c0b6; // carry in to bit 6 assuming carry out bit 4 is 0
wire m2c1b6; // carry in to bit 6 assuming carry out bit 4 is 1
wire m2s0b9; // sum bit 9 assuming carry out bit 8 is 0
wire m2s1b9; // sum bit 9 assuming carry out bit 8 is 1
wire m2s0b10; // sum bit 10 assuming carry out bit 8 is 0
wire m2s1b10; // sum bit 10 assuming carry out bit 8 is 1
wire m2c0b10; // carry in to bit 10 assuming carry out bit 8 is 0
wire m2c1b10; // carry in to bit 10 assuming carry out bit 8 is 1
wire m2s0b13; // sum bit 13 assuming carry out bit 12 is 0
wire m2s1b13; // sum bit 13 assuming carry out bit 12 is 1
wire m2s0b14; // sum bit 14 assuming carry out bit 12 is 0
wire m2s1b14; // sum bit 14 assuming carry out bit 12 is 1
wire m2c0b14; // carry in to bit 14 assuming carry out bit 12 is 0
wire m2c1b14; // carry in to bit 14 assuming carry out bit 12 is 1
j_mx21 mx2s0b1 (.s(m1c0b0), .i0(s0[1]), .i1(s1[1]), .z(s[1]));
j_mx21 mx2s0b2 (.s(m1c0b0), .i0(m1s0b2), .i1(m1s1b2), .z(s[2]));
j_mx21 mx2c0b2 (.s(m1c0b0), .i0(m1c0b2), .i1(m1c1b2), .z(m2c0b2));
j_mx21 mx2s0b5 (.s(m1c0b4), .i0(s0[5]), .i1(s1[5]), .z(m2s0b5));
j_mx21 mx2s1b5 (.s(m1c1b4), .i0(s0[5]), .i1(s1[5]), .z(m2s1b5));
j_mx21 mx2s0b6 (.s(m1c0b4), .i0(m1s0b6), .i1(m1s1b6), .z(m2s0b6));
j_mx21 mx2s1b6 (.s(m1c1b4), .i0(m1s0b6), .i1(m1s1b6), .z(m2s1b6));
j_mx21 mx2c0b6 (.s(m1c0b4), .i0(m1c0b6), .i1(m1c1b6), .z(m2c0b6));
j_mx21 mx2c1b6 (.s(m1c1b4), .i0(m1c0b6), .i1(m1c1b6), .z(m2c1b6));
j_mx21 mx2s0b9 (.s(m1c0b8), .i0(s0[9]), .i1(s1[9]), .z(m2s0b9));
j_mx21 mx2s1b9 (.s(m1c1b8), .i0(s0[9]), .i1(s1[9]), .z(m2s1b9));
j_mx21 mx2s0b10 (.s(m1c0b8), .i0(m1s0b10), .i1(m1s1b10), .z(m2s0b10));
j_mx21 mx2s1b10 (.s(m1c1b8), .i0(m1s0b10), .i1(m1s1b10), .z(m2s1b10));
j_mx21 mx2c0b10 (.s(m1c0b8), .i0(m1c0b10), .i1(m1c1b10), .z(m2c0b10));
j_mx21 mx2c1b10 (.s(m1c1b8), .i0(m1c0b10), .i1(m1c1b10), .z(m2c1b10));
j_mx21 mx2s0b13 (.s(m1c0b12), .i0(s0[13]), .i1(s1[13]), .z(m2s0b13));
j_mx21 mx2s1b13 (.s(m1c1b12), .i0(s0[13]), .i1(s1[13]), .z(m2s1b13));
j_mx21 mx2s0b14 (.s(m1c0b12), .i0(m1s0b14), .i1(m1s1b14), .z(m2s0b14));
j_mx21 mx2s1b14 (.s(m1c1b12), .i0(m1s0b14), .i1(m1s1b14), .z(m2s1b14));
j_mx21 mx2c0b14 (.s(m1c0b12), .i0(m1c0b14), .i1(m1c1b14), .z(m2c0b14));
j_mx21 mx2c1b14 (.s(m1c1b12), .i0(m1c0b14), .i1(m1c1b14), .z(m2c1b14));
// third rank of muxes:
wire m3c0b6; // carry out from bit 6
wire m3c0b6b; // carry out from bit 6, buffered version
wire m3s0b11; // sum bit 11 assuming carry out bit 10 is 0
wire m3s1b11; // sum bit 11 assuming carry out bit 10 is 1
wire m3s0b12; // sum bit 12 assuming carry out bit 10 is 0
wire m3s1b12; // sum bit 12 assuming carry out bit 10 is 1
wire m3s0b13; // sum bit 13 assuming carry out bit 10 is 0
wire m3s1b13; // sum bit 13 assuming carry out bit 10 is 1
wire m3s0b14; // sum bit 14 assuming carry out bit 10 is 0
wire m3s1b14; // sum bit 14 assuming carry out bit 10 is 1
wire m3c0b14; // carry out of bit 14 assuming carry out bit 10 is 0
wire m3c1b14; // carry out of bit 14 assuming carry out bit 10 is 1
j_mx21 mx3s0b3 (.s(m2c0b2 ), .i0(s0[3]), .i1(s1[3]), .z(s[3]));
j_mx21 mx3s0b4 (.s(m2c0b2 ), .i0(m1s0b4), .i1(m1s1b4), .z(s[4]));
j_mx21 mx3s0b5 (.s(m2c0b2 ), .i0(m2s0b5), .i1(m2s1b5), .z(s[5]));
j_mx21 mx3s0b6 (.s(m2c0b2 ), .i0(m2s0b6), .i1(m2s1b6), .z(s[6]));
j_mx21 mx3c0b6 (.s(m2c0b2 ), .i0(m2c0b6), .i1(m2c1b6), .z(m3c0b6));
j_ni01 ni3c0b6 (.i(m3c0b6 ), .z(m3c0b6b));
j_mx21 mx3s0b11 (.s(m2c0b10), .i0(s0[11]), .i1(s1[11]), .z(m3s0b11));
j_mx21 mx3s1b11 (.s(m2c1b10), .i0(s0[11]), .i1(s1[11]), .z(m3s1b11));
j_mx21 mx3s0b12 (.s(m2c0b10), .i0(m1s0b12), .i1(m1s1b12), .z(m3s0b12));
j_mx21 mx3s1b12 (.s(m2c1b10), .i0(m1s0b12), .i1(m1s1b12), .z(m3s1b12));
j_mx21 mx3s0b13 (.s(m2c0b10), .i0(m2s0b13), .i1(m2s1b13), .z(m3s0b13));
j_mx21 mx3s1b13 (.s(m2c1b10), .i0(m2s0b13), .i1(m2s1b13), .z(m3s1b13));
j_mx21 mx3s0b14 (.s(m2c0b10), .i0(m2s0b14), .i1(m2s1b14), .z(m3s0b14));
j_mx21 mx3s1b14 (.s(m2c1b10), .i0(m2s0b14), .i1(m2s1b14), .z(m3s1b14));
j_mx21 mx3c0b14 (.s(m2c0b10), .i0(m2c0b14), .i1(m2c1b14), .z(m3c0b14));
j_mx21 mx3c1b14 (.s(m2c1b10), .i0(m2c0b14), .i1(m2c1b14), .z(m3c1b14));
// fourth rank of muxes:
j_mx21 mx4s0b7 (.s(m3c0b6b), .i0(s0[7]), .i1(s1[7]), .z(s[7]));
j_mx21 mx4s0b8 (.s(m3c0b6b), .i0(m1s0b8), .i1(m1s1b8), .z(s[8]));
j_mx21 mx4s0b9 (.s(m3c0b6b), .i0(m2s0b9), .i1(m2s1b9), .z(s[9]));
j_mx21 mx4s0b10 (.s(m3c0b6b), .i0(m2s0b10), .i1(m2s1b10), .z(s[10]));
j_mx21 mx4s0b11 (.s(m3c0b6b), .i0(m3s0b11), .i1(m3s1b11), .z(s[11]));
j_mx21 mx4s0b12 (.s(m3c0b6b), .i0(m3s0b12), .i1(m3s1b12), .z(s[12]));
j_mx21 mx4s0b13 (.s(m3c0b6b), .i0(m3s0b13), .i1(m3s1b13), .z(s[13]));
j_mx21 mx4s0b14 (.s(m3c0b6b), .i0(m3s0b14), .i1(m3s1b14), .z(s[14]));
j_mx21 mx4c0b14 (.s(m3c0b6 ), .i0(m3c0b14), .i1(m3c1b14), .z(co));
endmodule // tc_max_abs_dif_add15