ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcIfMux.c
Go to the documentation of this file.
1
20
21#include "base/abc/abc.h"
22#include "map/if/if.h"
23
25
26
30
34
46static inline int Abc_NtkFuncCof0( int t, int v )
47{
48 static int s_Truth[3] = { 0xAA, 0xCC, 0xF0 };
49 return 0xff & ((t & ~s_Truth[v]) | ((t & ~s_Truth[v]) << (1<<v)));
50}
51
63static inline int Abc_NtkFuncCof1( int t, int v )
64{
65 static int s_Truth[3] = { 0xAA, 0xCC, 0xF0 };
66 return 0xff & ((t & s_Truth[v]) | ((t & s_Truth[v]) >> (1<<v)));
67}
68
80static inline int Abc_NtkFuncHasVar( int t, int v )
81{
82 static int s_Truth[3] = { 0xAA, 0xCC, 0xF0 };
83 return ((t & s_Truth[v]) >> (1<<v)) != (t & ~s_Truth[v]);
84}
85
97static inline int Abc_NtkFuncSuppSize( int t )
98{
99 return Abc_NtkFuncHasVar(t, 0) + Abc_NtkFuncHasVar(t, 1) + Abc_NtkFuncHasVar(t, 2);
100}
101
114{
115 int i, Value;
116 int CounterM = 0;
117 for ( i = 0; i < 256; i++ )
118 {
119 Value = 0;
120 if ( Abc_NtkFuncSuppSize( i ) < 3 )
121 Value = 1;
122 else
123 {
124 if ( (Abc_NtkFuncSuppSize(Abc_NtkFuncCof0(i,0)) == 1 && Abc_NtkFuncSuppSize(Abc_NtkFuncCof1(i,0)) == 1) ||
125 (Abc_NtkFuncSuppSize(Abc_NtkFuncCof0(i,1)) == 1 && Abc_NtkFuncSuppSize(Abc_NtkFuncCof1(i,1)) == 1) ||
126 (Abc_NtkFuncSuppSize(Abc_NtkFuncCof0(i,2)) == 1 && Abc_NtkFuncSuppSize(Abc_NtkFuncCof1(i,2)) == 1) )
127 {
128 Value = 1;
129 CounterM++;
130 }
131 }
132 printf( "%d, // %3d 0x%02X\n", Value, i, i );
133 }
134 printf( "Total number of MUXes = %d.\n", CounterM );
135}
136
149{
150 static char uLookup[256] = {
151 1, // 0 0x00
152 0, // 1 0x01
153 0, // 2 0x02
154 1, // 3 0x03
155 0, // 4 0x04
156 1, // 5 0x05
157 0, // 6 0x06
158 0, // 7 0x07
159 0, // 8 0x08
160 0, // 9 0x09
161 1, // 10 0x0A
162 0, // 11 0x0B
163 1, // 12 0x0C
164 0, // 13 0x0D
165 0, // 14 0x0E
166 1, // 15 0x0F
167 0, // 16 0x10
168 1, // 17 0x11
169 0, // 18 0x12
170 0, // 19 0x13
171 0, // 20 0x14
172 0, // 21 0x15
173 0, // 22 0x16
174 0, // 23 0x17
175 0, // 24 0x18
176 0, // 25 0x19
177 0, // 26 0x1A
178 1, // 27 0x1B
179 0, // 28 0x1C
180 1, // 29 0x1D
181 0, // 30 0x1E
182 0, // 31 0x1F
183 0, // 32 0x20
184 0, // 33 0x21
185 1, // 34 0x22
186 0, // 35 0x23
187 0, // 36 0x24
188 0, // 37 0x25
189 0, // 38 0x26
190 1, // 39 0x27
191 0, // 40 0x28
192 0, // 41 0x29
193 0, // 42 0x2A
194 0, // 43 0x2B
195 0, // 44 0x2C
196 0, // 45 0x2D
197 1, // 46 0x2E
198 0, // 47 0x2F
199 1, // 48 0x30
200 0, // 49 0x31
201 0, // 50 0x32
202 1, // 51 0x33
203 0, // 52 0x34
204 1, // 53 0x35
205 0, // 54 0x36
206 0, // 55 0x37
207 0, // 56 0x38
208 0, // 57 0x39
209 1, // 58 0x3A
210 0, // 59 0x3B
211 1, // 60 0x3C
212 0, // 61 0x3D
213 0, // 62 0x3E
214 1, // 63 0x3F
215 0, // 64 0x40
216 0, // 65 0x41
217 0, // 66 0x42
218 0, // 67 0x43
219 1, // 68 0x44
220 0, // 69 0x45
221 0, // 70 0x46
222 1, // 71 0x47
223 0, // 72 0x48
224 0, // 73 0x49
225 0, // 74 0x4A
226 0, // 75 0x4B
227 0, // 76 0x4C
228 0, // 77 0x4D
229 1, // 78 0x4E
230 0, // 79 0x4F
231 1, // 80 0x50
232 0, // 81 0x51
233 0, // 82 0x52
234 1, // 83 0x53
235 0, // 84 0x54
236 1, // 85 0x55
237 0, // 86 0x56
238 0, // 87 0x57
239 0, // 88 0x58
240 0, // 89 0x59
241 1, // 90 0x5A
242 0, // 91 0x5B
243 1, // 92 0x5C
244 0, // 93 0x5D
245 0, // 94 0x5E
246 1, // 95 0x5F
247 0, // 96 0x60
248 0, // 97 0x61
249 0, // 98 0x62
250 0, // 99 0x63
251 0, // 100 0x64
252 0, // 101 0x65
253 1, // 102 0x66
254 0, // 103 0x67
255 0, // 104 0x68
256 0, // 105 0x69
257 0, // 106 0x6A
258 0, // 107 0x6B
259 0, // 108 0x6C
260 0, // 109 0x6D
261 0, // 110 0x6E
262 0, // 111 0x6F
263 0, // 112 0x70
264 0, // 113 0x71
265 1, // 114 0x72
266 0, // 115 0x73
267 1, // 116 0x74
268 0, // 117 0x75
269 0, // 118 0x76
270 1, // 119 0x77
271 0, // 120 0x78
272 0, // 121 0x79
273 0, // 122 0x7A
274 0, // 123 0x7B
275 0, // 124 0x7C
276 0, // 125 0x7D
277 0, // 126 0x7E
278 0, // 127 0x7F
279 0, // 128 0x80
280 0, // 129 0x81
281 0, // 130 0x82
282 0, // 131 0x83
283 0, // 132 0x84
284 0, // 133 0x85
285 0, // 134 0x86
286 0, // 135 0x87
287 1, // 136 0x88
288 0, // 137 0x89
289 0, // 138 0x8A
290 1, // 139 0x8B
291 0, // 140 0x8C
292 1, // 141 0x8D
293 0, // 142 0x8E
294 0, // 143 0x8F
295 0, // 144 0x90
296 0, // 145 0x91
297 0, // 146 0x92
298 0, // 147 0x93
299 0, // 148 0x94
300 0, // 149 0x95
301 0, // 150 0x96
302 0, // 151 0x97
303 0, // 152 0x98
304 1, // 153 0x99
305 0, // 154 0x9A
306 0, // 155 0x9B
307 0, // 156 0x9C
308 0, // 157 0x9D
309 0, // 158 0x9E
310 0, // 159 0x9F
311 1, // 160 0xA0
312 0, // 161 0xA1
313 0, // 162 0xA2
314 1, // 163 0xA3
315 0, // 164 0xA4
316 1, // 165 0xA5
317 0, // 166 0xA6
318 0, // 167 0xA7
319 0, // 168 0xA8
320 0, // 169 0xA9
321 1, // 170 0xAA
322 0, // 171 0xAB
323 1, // 172 0xAC
324 0, // 173 0xAD
325 0, // 174 0xAE
326 1, // 175 0xAF
327 0, // 176 0xB0
328 1, // 177 0xB1
329 0, // 178 0xB2
330 0, // 179 0xB3
331 0, // 180 0xB4
332 0, // 181 0xB5
333 0, // 182 0xB6
334 0, // 183 0xB7
335 1, // 184 0xB8
336 0, // 185 0xB9
337 0, // 186 0xBA
338 1, // 187 0xBB
339 0, // 188 0xBC
340 0, // 189 0xBD
341 0, // 190 0xBE
342 0, // 191 0xBF
343 1, // 192 0xC0
344 0, // 193 0xC1
345 0, // 194 0xC2
346 1, // 195 0xC3
347 0, // 196 0xC4
348 1, // 197 0xC5
349 0, // 198 0xC6
350 0, // 199 0xC7
351 0, // 200 0xC8
352 0, // 201 0xC9
353 1, // 202 0xCA
354 0, // 203 0xCB
355 1, // 204 0xCC
356 0, // 205 0xCD
357 0, // 206 0xCE
358 1, // 207 0xCF
359 0, // 208 0xD0
360 1, // 209 0xD1
361 0, // 210 0xD2
362 0, // 211 0xD3
363 0, // 212 0xD4
364 0, // 213 0xD5
365 0, // 214 0xD6
366 0, // 215 0xD7
367 1, // 216 0xD8
368 0, // 217 0xD9
369 0, // 218 0xDA
370 0, // 219 0xDB
371 0, // 220 0xDC
372 1, // 221 0xDD
373 0, // 222 0xDE
374 0, // 223 0xDF
375 0, // 224 0xE0
376 0, // 225 0xE1
377 1, // 226 0xE2
378 0, // 227 0xE3
379 1, // 228 0xE4
380 0, // 229 0xE5
381 0, // 230 0xE6
382 0, // 231 0xE7
383 0, // 232 0xE8
384 0, // 233 0xE9
385 0, // 234 0xEA
386 0, // 235 0xEB
387 0, // 236 0xEC
388 0, // 237 0xED
389 1, // 238 0xEE
390 0, // 239 0xEF
391 1, // 240 0xF0
392 0, // 241 0xF1
393 0, // 242 0xF2
394 1, // 243 0xF3
395 0, // 244 0xF4
396 1, // 245 0xF5
397 0, // 246 0xF6
398 0, // 247 0xF7
399 0, // 248 0xF8
400 0, // 249 0xF9
401 1, // 250 0xFA
402 0, // 251 0xFB
403 1, // 252 0xFC
404 0, // 253 0xFD
405 0, // 254 0xFE
406 1 // 255 0xFF
407 };
408 if ( pCut->nLeaves < 3 )
409 return 1;
410 if ( pCut->nLeaves == 3 && uLookup[0xff & *If_CutTruth(p, pCut)] )
411 return 1;
412 return (1 << pCut->nLeaves) - 1;
413}
414
415
419
420
422
int Abc_NtkCutCostMux(If_Man_t *p, If_Cut_t *pCut)
Definition abcIfMux.c:148
void Abc_NtkCutCostMuxPrecompute()
Definition abcIfMux.c:113
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Cube * p
Definition exorList.c:222
struct If_Cut_t_ If_Cut_t
Definition if.h:80
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
Definition if.h:77
unsigned nLeaves
Definition if.h:316