47 return (
unsigned)(c != 0);
90 printf(
"Verification of CEX has failed: f(A) == f(B)!!!\n" );
92 for ( i = 0; i < nGs; i++ )
94 printf(
"Verification of CEX has failed: g[%d](A) != g[%d](B)!!!\n", i, i );
100 for ( i = 0; i < nGs; i++ )
120 for ( i = 0; i < nGs; i++ )
121 Cof &= ((iMint >> i) & 1) ? g[i][w] : ~g[i][w];
128 int w, k, iMint, iShift = ( 1 << nGs );
129 unsigned uMask = (~(unsigned)0) >> (32-iShift);
131 assert( nGs > 0 && nGs < 5 );
132 for ( w = 0; w <
nWords; w++ )
142 pPat[w] =
Rsb_DecTry5( ~(
word)0, g[0][w], g[1][w], g[2][w], g[3][w], f[w] );
148 assert( (~f[w] & CofA) && (f[w] & CofA) );
161 for ( k = 0; k < w; k++ )
163 iMint =
Abc_Tt6FirstBit( ((pPat[k] | pPat[w]) >> iShift) & (pPat[k] | pPat[w]) & uMask );
168 if ( (~f[k] & CofA) && (f[w] & CofB) )
175 assert( (f[k] & CofA) && (~f[w] & CofB) );
198 int pCands[16], nCands;
199 int i, c, Cand, iStart = 0;
204 for ( i = 0; i < 4; i++ )
207 for ( i = 0; i < nGs; i++ )
208 printf(
"%d", (i % 100) / 10 );
210 for ( ; i < nGsAll; i++ )
211 printf(
"%d", (i % 100) / 10 );
214 for ( i = 0; i < 4; i++ )
217 for ( i = 0; i < nGs; i++ )
218 printf(
"%d", i % 10 );
220 for ( ; i < nGsAll; i++ )
221 printf(
"%d", i % 10 );
228 for ( i = 0; i < 4; i++ )
238 pCands[nCands++] = Cand;
241 for ( i = 0; i < 4; i++ )
242 if ( pCands[i] >= 0 )
243 printf(
"%4d", pCands[i] );
248 for ( i = 0; i < nGs; i++ )
249 printf(
"%c",
Abc_TtGetBit( pCexes + i, c ) ?
'.' :
'+' );
251 for ( ; i < nGsAll; i++ )
252 printf(
"%c",
Abc_TtGetBit( pCexes + i, c ) ?
'.' :
'+' );
253 printf(
" %3d\n", c );
258 for ( i = 0; i < 4; i++ )
261 for ( i = 0; i < nGs; i++ )
264 for ( ; i < nGsAll; i++ )
268 for ( i = 0; i < 4; i++ )
271 for ( i = 0; i < nGs; i++ )
274 for ( ; i < nGsAll; i++ )
297 int iCexT0, iCexT1, iCexF0, iCexF1;
340 unsigned * pPat = (
unsigned *)
Vec_IntArray(p->vDecPats);
354 int i, k, j, n, iCexA, iCexB, nCexes = 0;
360 p->vFanins->nSize = 1;
361 for ( i = 0; i < nGs; i++ )
365 pDivs[0] = g[i]; p->vFanins->pArray[0] = i;
388 if ( p->nDecMax == 1 )
391 p->vFanins->nSize = 2;
392 for ( i = 1; i < nGs; i++ )
393 for ( k = 0; k < i; k++ )
395 if ( pCexes[i] & pCexes[k] )
397 pDivs[0] = g[i]; p->vFanins->pArray[0] = i;
398 pDivs[1] = g[k]; p->vFanins->pArray[1] = k;
422 if ( p->nDecMax == 2 )
425 p->vFanins->nSize = 3;
426 for ( i = 2; i < nGs; i++ )
427 for ( k = 1; k < i; k++ )
428 for ( j = 0; j < k; j++ )
430 if ( pCexes[i] & pCexes[k] & pCexes[j] )
432 pDivs[0] = g[i]; p->vFanins->pArray[0] = i;
433 pDivs[1] = g[k]; p->vFanins->pArray[1] = k;
434 pDivs[2] = g[j]; p->vFanins->pArray[2] = j;
459 if ( p->nDecMax == 3 )
462 p->vFanins->nSize = 4;
463 for ( i = 3; i < nGs; i++ )
464 for ( k = 2; k < i; k++ )
465 for ( j = 1; j < k; j++ )
466 for ( n = 0; n < j; n++ )
468 if ( pCexes[i] & pCexes[k] & pCexes[j] & pCexes[n] )
470 pDivs[0] = g[i]; p->vFanins->pArray[0] = i;
471 pDivs[1] = g[k]; p->vFanins->pArray[1] = k;
472 pDivs[2] = g[j]; p->vFanins->pArray[2] = j;
473 pDivs[3] = g[n]; p->vFanins->pArray[3] = n;
500 if ( p->nDecMax == 4 )
525 printf(
"Offset : " );
527 Copy >>= ((
word)1 << nVars);
528 printf(
"Onset : " );
530 printf(
"Result : " );
538 for ( i = 0; i < nGs; i++ )
540 printf(
"Div%3d : ", i );
543 printf(
"Solution : " );
563 int b, m, Num, nSuppSize;
580 for ( m = 0; m < (1<<nSuppSize); m++ )
582 if ( ((Truth4 >> m) & 1) == 0 )
585 for ( b = 0; b < nSuppSize; b++ )
587 Abc_TtAnd( pTemp2, pTemp2, pFanins[b], nWords, 0 );
590 Abc_TtOr( pTemp1, pTemp1, pTemp2, nWords );
594 printf(
"Verification failed.\n" );
615 unsigned * pPat = (
unsigned *)
Vec_IntArray(p->vDecPats);
624 int i, Entry, iCexA, iCexB;
631 printf(
"Verified orig decomp with %d vars {",
Vec_IntSize(p->vFaninsOld) );
633 printf(
" %d", Entry );
643 printf(
"Verified orig decomp with %d vars {",
Vec_IntSize(p->vFaninsOld) );
645 printf(
" %d", Entry );
647 printf(
"Verification FAILED.\n" );
661 printf(
"Found decomp with %d vars {",
Vec_IntSize(p->vFanins) );
663 printf(
" %d", Entry );
673 printf(
"Did not find decomposition with 4 variables.\n" );
700 for ( i = 0; i < nGs; i++ )
703 if ( uTruthRes == 0 )
742 word F = ab | cd | ef;
743 word uTruth0, uTruth1;
static void Abc_TtSharp(word *pOut, word *pIn1, word *pIn2, int nWords)
static int * Vec_IntArray(Vec_Int_t *p)
static int Abc_TtFindLastZero(word *pIn, int nVars)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
static void Abc_TtClear(word *pOut, int nWords)
static int Abc_TtFindFirstBit(word *pIn, int nVars)
static int Abc_TtFindFirstZero(word *pIn, int nVars)
static int Abc_Tt6FirstBit(word t)
unsigned Rsb_DecPerformInt(Rsb_Man_t *p, int nVars, word *f, word **g, int nGs, int nGsAll, int fFindAll)
static void Abc_TtOr(word *pOut, word *pIn1, word *pIn2, int nWords)
static void Abc_TtSetBit(word *p, int i)
typedefABC_NAMESPACE_HEADER_START struct Rsb_Man_t_ Rsb_Man_t
INCLUDES ///.
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
static int Abc_TtCountOnes(word x)
static int Abc_TtGetBit(word *p, int i)
MACRO DEFINITIONS ///.
static int Vec_WrdSize(Vec_Wrd_t *p)
static unsigned Rsb_DecTry4(word c, word f1, word f2, word f3, word f4)
static void Rsb_DecVerifyCex(word *f, word **g, int nGs, int iCexA, int iCexB)
Rsb_Man_t * Rsb_ManAlloc(int nLeafMax, int nDivMax, int nDecMax, int fVerbose)
MACRO DEFINITIONS ///.
void Rsb_ManFree(Rsb_Man_t *p)
static void Abc_TtFill(word *pOut, int nWords)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static word Rsb_DecCofactor(word **g, int nGs, int w, int iMint)
static void Abc_TtPrintBinary(word *pTruth, int nVars)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static void Rsb_DecRecordCex(word **g, int nGs, int iCexA, int iCexB, word *pCexes, int nCexes)
unsigned __int64 word
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_END
static void Vec_WrdFree(Vec_Wrd_t *p)
void Rsb_DecPrintFunc(Rsb_Man_t *p, unsigned Truth4, word *f, word **ppGs, int nGs, int nVarsAll)
static word Abc_Tt6Stretch(word t, int nVars)
static word Abc_Tt6Isop(word uOn, word uOnDc, int nVars, int *pnCubes)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
static unsigned Rsb_DecTry2(word c, word f1, word f2)
int Rsb_DecVerify(Rsb_Man_t *p, int nVars, word *f, word **g, int nGs, unsigned Truth4, word *pTemp1, word *pTemp2)
static unsigned Rsb_DecTry1(word c, word f1)
static unsigned Rsb_DecTry3(word c, word f1, word f2, word f3)
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
unsigned Rsb_DecCheck(int nVars, word *f, word **g, int nGs, unsigned *pPat, int *pCexA, int *pCexB)
unsigned Rsb_ManPerform(Rsb_Man_t *p, int nVars, word *f, word **g, int nGs, int nGsAll, int fVerbose0)
static int Vec_IntSize(Vec_Int_t *p)
static word * Vec_WrdArray(Vec_Wrd_t *p)
static int Abc_TtWordNum(int nVars)
void Rsb_ManPerformResub6Test()
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
static unsigned Rsb_DecTry5(word c, word f1, word f2, word f3, word f4, word f5)
static int Abc_TtEqual(word *pIn1, word *pIn2, int nWords)
int Rsb_ManPerformResub6(Rsb_Man_t *p, int nVarsAll, word uTruth, Vec_Wrd_t *vDivTruths, word *puTruth0, word *puTruth1, int fVerbose)
void Rsb_DecPrintTable(word *pCexes, int nGs, int nGsAll, Vec_Int_t *vTries)
static int Abc_TtFindLastBit(word *pIn, int nVars)
static void Vec_IntPrint(Vec_Int_t *vVec)
static void Abc_TtAnd(word *pOut, word *pIn1, word *pIn2, int nWords, int fCompl)
static void Vec_IntFree(Vec_Int_t *p)
static void Vec_IntClear(Vec_Int_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static ABC_NAMESPACE_IMPL_START unsigned Rsb_DecTry0(word c)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
static int Rsb_DecTryCex(word *g, int iCexA, int iCexB)
int Rsb_DecInitCexes(int nVars, word *f, word **g, int nGs, int nGsAll, word *pCexes, Vec_Int_t *vTries)
static word * Vec_WrdEntryP(Vec_Wrd_t *p, int i)