1 module s_wallace(a, b, product);
2
3
4 input [8:0] a;
5 input [6:0] b;
6 output [15:0] product;
7 assign pho1 = 1'b1;
8 assign pho2 = 1'b1;
9 assign pho3 = 1'b1;
10 assign b6a8 = b[6] & a[8];
11 assign b6a7 = ~(b[6] & a[7]);
12 assign b6a6 = ~(b[6] & a[6]);
13 assign b6a5 = ~(b[6] & a[5]);
14 assign b6a4 = ~(b[6] & a[4]);
15 assign b6a3 = ~(b[6] & a[3]);
16 assign b6a2 = ~(b[6] & a[2]);
17 assign b6a1 = ~(b[6] & a[1]);
18 assign b6a0 = ~(b[6] & a[0]);
19 assign b5a8 = ~(b[5] & a[8]);
20 assign b5a7 = b[5] & a[7];
21 assign b5a6 = b[5] & a[6];
22 assign b5a5 = b[5] & a[5];
23 assign b5a4 = b[5] & a[4];
24 assign b5a3 = b[5] & a[3];
25 assign b5a2 = b[5] & a[2];
26 assign b5a1 = b[5] & a[1];
27 assign b5a0 = b[5] & a[0];
28 assign b4a8 = ~(b[4] & a[8]);
29 assign b4a7 = b[4] & a[7];
30 assign b4a6 = b[4] & a[6];
31 assign b4a5 = b[4] & a[5];
32 assign b4a4 = b[4] & a[4];
33 assign b4a3 = b[4] & a[3];
34 assign b4a2 = b[4] & a[2];
35 assign b4a1 = b[4] & a[1];
36 assign b4a0 = b[4] & a[0];
37 assign b3a8 = ~(b[3] & a[8]);
38 assign b3a7 = b[3] & a[7];
39 assign b3a6 = b[3] & a[6];
40 assign b3a5 = b[3] & a[5];
41 assign b3a4 = b[3] & a[4];
42 assign b3a3 = b[3] & a[3];
43 assign b3a2 = b[3] & a[2];
44 assign b3a1 = b[3] & a[1];
45 assign b3a0 = b[3] & a[0];
46 assign b2a8 = ~(b[2] & a[8]);
47 assign b2a7 = b[2] & a[7];
48 assign b2a6 = b[2] & a[6];
49 assign b2a5 = b[2] & a[5];
50 assign b2a4 = b[2] & a[4];
51 assign b2a3 = b[2] & a[3];
52 assign b2a2 = b[2] & a[2];
53 assign b2a1 = b[2] & a[1];
54 assign b2a0 = b[2] & a[0];
55 assign b1a8 = ~(b[1] & a[8]);
56 assign b1a7 = b[1] & a[7];
57 assign b1a6 = b[1] & a[6];
58 assign b1a5 = b[1] & a[5];
59 assign b1a4 = b[1] & a[4];
60 assign b1a3 = b[1] & a[3];
61 assign b1a2 = b[1] & a[2];
62 assign b1a1 = b[1] & a[1];
63 assign b1a0 = b[1] & a[0];
64 assign b0a8 = ~(b[0] & a[8]);
65 assign b0a7 = b[0] & a[7];
66 assign b0a6 = b[0] & a[6];
67 assign b0a5 = b[0] & a[5];
68 assign b0a4 = b[0] & a[4];
69 assign b0a3 = b[0] & a[3];
70 assign b0a2 = b[0] & a[2];
71 assign b0a1 = b[0] & a[1];
72 assign b0a0 = b[0] & a[0];
73 assign aaaa = b5a8 ^ b6a7;
74 assign aaab = b5a8 & b6a7;
75 assign aaac = b5a7 ^ b6a6 ^ b4a8;
76 assign aaad = (b5a7 & b6a6) | (b4a8 & (b5a7 ^ b6a6));
77 assign aaae = b5a6 ^ b3a8 ^ b4a7;
78 assign aaaf = (b5a6 & b3a8) | (b4a7 & (b5a6 ^ b3a8));
79 assign aaag = b6a4 ^ b3a7 ^ b4a6;
80 assign aaah = (b6a4 & b3a7) | (b4a6 & (b6a4 ^ b3a7));
81 assign aaai = b5a5 ^ b2a8;
82 assign aaaj = b5a5 & b2a8;
83 assign aaak = b4a5 ^ b5a4 ^ b6a3;
84 assign aaal = (b4a5 & b5a4) | (b6a3 & (b4a5 ^ b5a4));
85 assign aaam = b1a8 ^ b2a7 ^ b3a6;
86 assign aaan = (b1a8 & b2a7) | (b3a6 & (b1a8 ^ b2a7));
87 assign aaao = b0a8 ^ b3a5 ^ b1a7;
88 assign aaap = (b0a8 & b3a5) | (b1a7 & (b0a8 ^ b3a5));
89 assign aaaq = b4a4 ^ b2a6 ^ b5a3;
90 assign aaar = (b4a4 & b2a6) | (b5a3 & (b4a4 ^ b2a6));
91 assign aaas = b6a2 ^ pho3;
92 assign aaat = b6a2 & pho3;
93 assign aaau = b4a3 ^ b3a4 ^ b5a2;
94 assign aaav = (b4a3 & b3a4) | (b5a2 & (b4a3 ^ b3a4));
95 assign aaaw = b1a6 ^ b2a5 ^ b6a1;
96 assign aaax = (b1a6 & b2a5) | (b6a1 & (b1a6 ^ b2a5));
97 assign aaay = b6a0 ^ b1a5 ^ b4a2;
98 assign aaaz = (b6a0 & b1a5) | (b4a2 & (b6a0 ^ b1a5));
99 assign aaba = b0a6 ^ pho2 ^ b5a1;
100 assign aabb = (b0a6 & pho2) | (b5a1 & (b0a6 ^ pho2));
101 assign aabc = b3a3 ^ b2a4;
102 assign aabd = b3a3 & b2a4;
103 assign aabe = b3a2 ^ b1a4 ^ b0a5;
104 assign aabf = (b3a2 & b1a4) | (b0a5 & (b3a2 ^ b1a4));
105 assign aabg = b5a0 ^ b4a1 ^ b2a3;
106 assign aabh = (b5a0 & b4a1) | (b2a3 & (b5a0 ^ b4a1));
107 assign aabi = b0a4 ^ b1a3 ^ b4a0;
108 assign aabj = (b0a4 & b1a3) | (b4a0 & (b0a4 ^ b1a3));
109 assign aabk = b3a1 ^ b2a2;
110 assign aabl = b3a1 & b2a2;
111 assign aabm = b2a1 ^ b1a2 ^ b0a3;
112 assign aabn = (b2a1 & b1a2) | (b0a3 & (b2a1 ^ b1a2));
113 assign aabo = b0a2 ^ b2a0 ^ b1a1;
114 assign aabp = (b0a2 & b2a0) | (b1a1 & (b0a2 ^ b2a0));
115 assign aabq = b0a1 ^ b1a0;
116 assign aabr = b0a1 & b1a0;
117 assign aabs = b6a8 ^ aaab;
118 assign aabt = b6a8 & aaab;
119 assign aabu = aaaa ^ aaad;
120 assign aabv = aaaa & aaad;
121 assign aabw = aaaf ^ aaac;
122 assign aabx = aaaf & aaac;
123 assign aaby = aaaj ^ aaae ^ aaah;
124 assign aabz = (aaaj & aaae) | (aaah & (aaaj ^ aaae));
125 assign aaca = aaag ^ aaai ^ aaan;
126 assign aacb = (aaag & aaai) | (aaan & (aaag ^ aaai));
127 assign aacc = aaar ^ aaam ^ aaat;
128 assign aacd = (aaar & aaam) | (aaat & (aaar ^ aaam));
129 assign aace = aaak ^ aaap;
130 assign aacf = aaak & aaap;
131 assign aacg = aaas ^ aaax ^ aaaq;
132 assign aach = (aaas & aaax) | (aaaq & (aaas ^ aaax));
133 assign aaci = aaav ^ aaao;
134 assign aacj = aaav & aaao;
135 assign aack = aaau ^ aaaz ^ aabb;
136 assign aacl = (aaau & aaaz) | (aabb & (aaau ^ aaaz));
137 assign aacm = aabd ^ b0a7 ^ aaaw;
138 assign aacn = (aabd & b0a7) | (aaaw & (aabd ^ b0a7));
139 assign aaco = aaba ^ aabf ^ aabh;
140 assign aacp = (aaba & aabf) | (aabh & (aaba ^ aabf));
141 assign aacq = aabc ^ aaay;
142 assign aacr = aabc & aaay;
143 assign aacs = aabg ^ aabe ^ aabj;
144 assign aact = (aabg & aabe) | (aabj & (aabg ^ aabe));
145 assign aacu = aabn ^ aabi ^ aabk;
146 assign aacv = (aabn & aabi) | (aabk & (aabn ^ aabi));
147 assign aacw = b3a0 ^ aabp ^ aabm;
148 assign aacx = (b3a0 & aabp) | (aabm & (b3a0 ^ aabp));
149 assign aacy = aabo ^ aabr;
150 assign aacz = aabo & aabr;
151 assign aada = pho1 ^ aabt;
152 assign aadb = pho1 & aabt;
153 assign aadc = aabv ^ aabs;
154 assign aadd = aabv & aabs;
155 assign aade = aabu ^ aabx;
156 assign aadf = aabu & aabx;
157 assign aadg = aabz ^ aabw;
158 assign aadh = aabz & aabw;
159 assign aadi = aacb ^ aaby ^ b6a5;
160 assign aadj = (aacb & aaby) | (b6a5 & (aacb ^ aaby));
161 assign aadk = aacf ^ aacd ^ aaca;
162 assign aadl = (aacf & aacd) | (aaca & (aacf ^ aacd));
163 assign aadm = aacj ^ aace ^ aacc;
164 assign aadn = (aacj & aace) | (aacc & (aacj ^ aace));
165 assign aado = aacn ^ aaci ^ aacg;
166 assign aadp = (aacn & aaci) | (aacg & (aacn ^ aaci));
167 assign aadq = aacp ^ aacm ^ aacr;
168 assign aadr = (aacp & aacm) | (aacr & (aacp ^ aacm));
169 assign aads = aacq ^ aaco ^ aact;
170 assign aadt = (aacq & aaco) | (aact & (aacq ^ aaco));
171 assign aadu = aacs ^ aacv ^ aabl;
172 assign aadv = (aacs & aacv) | (aabl & (aacs ^ aacv));
173 assign aadw = aacx ^ aacu;
174 assign aadx = aacx & aacu;
175 assign aady = aacz ^ aacw;
176 assign aadz = aacz & aacw;
177 assign aaea = aadd ^ aada;
178 assign aaeb = aadd & aada;
179 assign aaec = aadf ^ aadc;
180 assign aaed = aadf & aadc;
181 assign aaee = aade ^ aadh;
182 assign aaef = aade & aadh;
183 assign aaeg = aadj ^ aadg;
184 assign aaeh = aadj & aadg;
185 assign aaei = aadi ^ aadl;
186 assign aaej = aadi & aadl;
187 assign aaek = aadk ^ aadn ^ aaal;
188 assign aael = (aadk & aadn) | (aaal & (aadk ^ aadn));
189 assign aaem = aadm ^ aadp ^ aach;
190 assign aaen = (aadm & aadp) | (aach & (aadm ^ aadp));
191 assign aaeo = aacl ^ aado ^ aadr;
192 assign aaep = (aacl & aado) | (aadr & (aacl ^ aado));
193 assign aaeq = aadt ^ aadq ^ aack;
194 assign aaer = (aadt & aadq) | (aack & (aadt ^ aadq));
195 assign aaes = aadv ^ aads;
196 assign aaet = aadv & aads;
197 assign aaeu = aadu ^ aadx;
198 assign aaev = aadu & aadx;
199 assign aaew = aadz ^ aadw;
200 assign aaex = aadz & aadw;
201 assign product[0] = b0a0;
202 assign product[1] = aabq;
203 assign product[2] = aacy;
204 assign product[3] = aady;
205 assign product[4] = aaew;
206 assign p000 = aaex ^ aaeu;
207 assign product[5] = p000;
208 assign g000 = aaex & aaeu;
209 buf(pa000,p000);
210 buf(ga000,g000);
211 buf(pb000,pa000);
212 buf(gb000,ga000);
213 buf(pc000,pb000);
214 buf(gc000,gb000);
215 buf(pd000,pc000);
216 buf(gd000,gc000);
217 assign p001 = aaes ^ aaev;
218 assign g001 = aaes & aaev;
219 assign product[6] = p001 ^ gd000;
220 assign pa001 = p001 & p000;
221 assign ga001 = g001 | (p001 & g000);
222 buf(pb001,pa001);
223 buf(gb001,ga001);
224 buf(pc001,pb001);
225 buf(gc001,gb001);
226 buf(pd001,pc001);
227 buf(gd001,gc001);
228 assign p002 = aaeq ^ aaet;
229 assign g002 = aaeq & aaet;
230 assign product[7] = p002 ^ gd001;
231 assign pa002 = p002 & p001;
232 assign ga002 = g002 | (p002 & g001);
233 assign pb002 = pa002 & pa000;
234 assign gb002 = ga002 | (pa002 & ga000);
235 buf(pc002,pb002);
236 buf(gc002,gb002);
237 buf(pd002,pc002);
238 buf(gd002,gc002);
239 assign p003 = aaer ^ aaeo;
240 assign g003 = aaer & aaeo;
241 assign product[8] = p003 ^ gd002;
242 assign pa003 = p003 & p002;
243 assign ga003 = g003 | (p003 & g002);
244 assign pb003 = pa003 & pa001;
245 assign gb003 = ga003 | (pa003 & ga001);
246 buf(pc003,pb003);
247 buf(gc003,gb003);
248 buf(pd003,pc003);
249 buf(gd003,gc003);
250 assign p004 = aaep ^ aaem;
251 assign g004 = aaep & aaem;
252 assign product[9] = p004 ^ gd003;
253 assign pa004 = p004 & p003;
254 assign ga004 = g004 | (p004 & g003);
255 assign pb004 = pa004 & pa002;
256 assign gb004 = ga004 | (pa004 & ga002);
257 assign pc004 = pb004 & pb000;
258 assign gc004 = gb004 | (pb004 & gb000);
259 buf(pd004,pc004);
260 buf(gd004,gc004);
261 assign p005 = aaek ^ aaen;
262 assign g005 = aaek & aaen;
263 assign product[10] = p005 ^ gd004;
264 assign pa005 = p005 & p004;
265 assign ga005 = g005 | (p005 & g004);
266 assign pb005 = pa005 & pa003;
267 assign gb005 = ga005 | (pa005 & ga003);
268 assign pc005 = pb005 & pb001;
269 assign gc005 = gb005 | (pb005 & gb001);
270 buf(pd005,pc005);
271 buf(gd005,gc005);
272 assign p006 = aael ^ aaei;
273 assign g006 = aael & aaei;
274 assign product[11] = p006 ^ gd005;
275 assign pa006 = p006 & p005;
276 assign ga006 = g006 | (p006 & g005);
277 assign pb006 = pa006 & pa004;
278 assign gb006 = ga006 | (pa006 & ga004);
279 assign pc006 = pb006 & pb002;
280 assign gc006 = gb006 | (pb006 & gb002);
281 buf(pd006,pc006);
282 buf(gd006,gc006);
283 assign p007 = aaej ^ aaeg;
284 assign g007 = aaej & aaeg;
285 assign product[12] = p007 ^ gd006;
286 assign pa007 = p007 & p006;
287 assign ga007 = g007 | (p007 & g006);
288 assign pb007 = pa007 & pa005;
289 assign gb007 = ga007 | (pa007 & ga005);
290 assign pc007 = pb007 & pb003;
291 assign gc007 = gb007 | (pb007 & gb003);
292 buf(pd007,pc007);
293 buf(gd007,gc007);
294 assign p008 = aaee ^ aaeh;
295 assign g008 = aaee & aaeh;
296 assign product[13] = p008 ^ gd007;
297 assign pa008 = p008 & p007;
298 assign ga008 = g008 | (p008 & g007);
299 assign pb008 = pa008 & pa006;
300 assign gb008 = ga008 | (pa008 & ga006);
301 assign pc008 = pb008 & pb004;
302 assign gc008 = gb008 | (pb008 & gb004);
303 assign pd008 = pc008 & pc000;
304 assign gd008 = gc008 | (pc008 & gc000);
305 assign p009 = aaef ^ aaec;
306 assign g009 = aaef & aaec;
307 assign product[14] = p009 ^ gd008;
308 assign pa009 = p009 & p008;
309 assign ga009 = g009 | (p009 & g008);
310 assign pb009 = pa009 & pa007;
311 assign gb009 = ga009 | (pa009 & ga007);
312 assign pc009 = pb009 & pb005;
313 assign gc009 = gb009 | (pb009 & gb005);
314 assign pd009 = pc009 & pc001;
315 assign gd009 = gc009 | (pc009 & gc001);
316 assign p010 = aaed ^ aaea;
317 assign product[15] = p010 ^ gd009;
318 endmodule