265 int nTotal = 2 * nLutSize - 1;
266 int nShared = nTotal - nVars;
268 assert( nLutSize >= 2 && nLutSize <= 6 );
269 assert( nLutSize < nVars && nVars <= nTotal );
270 assert( nShared >= 0 && nShared < nLutSize - 1 );
274 for ( i[0] = 0; i[0] < nVars; i[0]++ )
275 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
277 uSet = (1 << (2*i[0])) | (1 << (2*i[1]));
278 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet, NULL, NULL, vLits) )
282 else if ( nLutSize == 3 )
284 for ( i[0] = 0; i[0] < nVars; i[0]++ )
285 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
286 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
288 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2]));
289 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet, NULL, NULL, vLits) )
294 for ( i[0] = 0; i[0] < nVars; i[0]++ )
295 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
296 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
298 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2]));
299 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
300 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])), NULL, NULL, vLits) )
301 return uSet | (3 << (2*i[s[0]]));
304 else if ( nLutSize == 4 )
306 for ( i[0] = 0; i[0] < nVars; i[0]++ )
307 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
308 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
309 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
311 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3]));
312 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet, NULL, NULL, vLits) )
317 for ( i[0] = 0; i[0] < nVars; i[0]++ )
318 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
319 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
320 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
322 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3]));
323 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
324 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])), NULL, NULL, vLits) )
325 return uSet | (3 << (2*i[s[0]]));
329 for ( i[0] = 0; i[0] < nVars; i[0]++ )
330 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
331 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
332 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
334 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3]));
336 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
337 for ( s[1] = s[0]+1; s[1] < nLutSize; s[1]++ )
338 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])), NULL, NULL, vLits) )
339 return uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]]));
343 else if ( nLutSize == 5 )
345 for ( i[0] = 0; i[0] < nVars; i[0]++ )
346 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
347 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
348 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
349 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
351 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4]));
352 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet, NULL, NULL, vLits) )
357 for ( i[0] = 0; i[0] < nVars; i[0]++ )
358 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
359 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
360 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
361 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
363 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4]));
364 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
365 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])), NULL, NULL, vLits) )
366 return uSet | (3 << (2*i[s[0]]));
370 for ( i[0] = 0; i[0] < nVars; i[0]++ )
371 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
372 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
373 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
374 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
376 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4]));
377 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
378 for ( s[1] = s[0]+1; s[1] < nLutSize; s[1]++ )
379 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])), NULL, NULL, vLits) )
380 return uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]]));
384 for ( i[0] = 0; i[0] < nVars; i[0]++ )
385 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
386 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
387 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
388 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
390 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4]));
391 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
392 for ( s[1] = s[0]+1; s[1] < nLutSize; s[1]++ )
393 for ( s[2] = s[1]+1; s[2] < nLutSize; s[2]++ )
394 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])) | (3 << (2*i[s[2]])), NULL, NULL, vLits) )
395 return uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])) | (3 << (2*i[s[2]]));
398 else if ( nLutSize == 6 )
400 for ( i[0] = 0; i[0] < nVars; i[0]++ )
401 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
402 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
403 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
404 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
405 for ( i[5] = i[4]+1; i[5] < nVars; i[5]++ )
407 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4])) | (1 << (2*i[5]));
408 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet, NULL, NULL, vLits) )
413 for ( i[0] = 0; i[0] < nVars; i[0]++ )
414 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
415 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
416 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
417 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
418 for ( i[5] = i[4]+1; i[5] < nVars; i[5]++ )
420 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4])) | (1 << (2*i[5]));
421 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
422 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])), NULL, NULL, vLits) )
423 return uSet | (3 << (2*i[s[0]]));
427 for ( i[0] = 0; i[0] < nVars; i[0]++ )
428 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
429 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
430 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
431 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
432 for ( i[5] = i[4]+1; i[5] < nVars; i[5]++ )
434 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4])) | (1 << (2*i[5]));
435 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
436 for ( s[1] = s[0]+1; s[1] < nLutSize; s[1]++ )
437 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])), NULL, NULL, vLits) )
438 return uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]]));
442 for ( i[0] = 0; i[0] < nVars; i[0]++ )
443 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
444 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
445 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
446 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
447 for ( i[5] = i[4]+1; i[5] < nVars; i[5]++ )
449 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4])) | (1 << (2*i[5]));
450 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
451 for ( s[1] = s[0]+1; s[1] < nLutSize; s[1]++ )
452 for ( s[2] = s[1]+1; s[2] < nLutSize; s[2]++ )
453 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])) | (3 << (2*i[s[2]])), NULL, NULL, vLits) )
454 return uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])) | (3 << (2*i[s[2]]));
458 for ( i[0] = 0; i[0] < nVars; i[0]++ )
459 for ( i[1] = i[0]+1; i[1] < nVars; i[1]++ )
460 for ( i[2] = i[1]+1; i[2] < nVars; i[2]++ )
461 for ( i[3] = i[2]+1; i[3] < nVars; i[3]++ )
462 for ( i[4] = i[3]+1; i[4] < nVars; i[4]++ )
463 for ( i[5] = i[4]+1; i[5] < nVars; i[5]++ )
465 uSet = (1 << (2*i[0])) | (1 << (2*i[1])) | (1 << (2*i[2])) | (1 << (2*i[3])) | (1 << (2*i[4])) | (1 << (2*i[5]));
466 for ( s[0] = 0; s[0] < nLutSize; s[0]++ )
467 for ( s[1] = s[0]+1; s[1] < nLutSize; s[1]++ )
468 for ( s[2] = s[1]+1; s[2] < nLutSize; s[2]++ )
469 for ( s[3] = s[1]+1; s[3] < nLutSize; s[3]++ )
470 if (
If_ManSatCheckXY(pSat, nLutSize, pTruth, nVars, uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])) | (3 << (2*i[s[2]])) | (3 << (2*i[s[3]])), NULL, NULL, vLits) )
471 return uSet | (3 << (2*i[s[0]])) | (3 << (2*i[s[1]])) | (3 << (2*i[s[2]])) | (3 << (2*i[s[3]]));
int If_ManSatCheckXY(void *pSat, int nLutSize, word *pTruth, int nVars, unsigned uSet, word *pTBound, word *pTFree, Vec_Int_t *vLits)
int nTotal
DECLARATIONS ///.