48 unsigned uCofs[10][32];
53 printf(
"Total = %d.\n", nOnes * ((1 << nVars) - nOnes) );
56 for ( i = 0; i < nVars; i++ )
60 printf(
"%7d ", nOnes );
65 for ( i = 0; i < nVars; i++ )
66 for ( k = 0; k < nVars; k++ )
91 printf(
"%7d ", nOnes );
119 printf(
"%c", pObj->
Id - 1 +
'a' );
147 unsigned uTruth0, uTruth1;
159 return uTruth0 & uTruth1;
175 static unsigned u4VarTruths[4] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00 };
176 static unsigned u4VarTts[222] = {
177 0x0000, 0x0001, 0x0003, 0x0006, 0x0007, 0x000f, 0x0016, 0x0017, 0x0018, 0x0019,
178 0x001b, 0x001e, 0x001f, 0x003c, 0x003d, 0x003f, 0x0069, 0x006b, 0x006f, 0x007e,
179 0x007f, 0x00ff, 0x0116, 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011e, 0x011f,
180 0x012c, 0x012d, 0x012f, 0x013c, 0x013d, 0x013e, 0x013f, 0x0168, 0x0169, 0x016a,
181 0x016b, 0x016e, 0x016f, 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0186,
182 0x0187, 0x0189, 0x018b, 0x018f, 0x0196, 0x0197, 0x0198, 0x0199, 0x019a, 0x019b,
183 0x019e, 0x019f, 0x01a8, 0x01a9, 0x01aa, 0x01ab, 0x01ac, 0x01ad, 0x01ae, 0x01af,
184 0x01bc, 0x01bd, 0x01be, 0x01bf, 0x01e8, 0x01e9, 0x01ea, 0x01eb, 0x01ee, 0x01ef,
185 0x01fe, 0x033c, 0x033d, 0x033f, 0x0356, 0x0357, 0x0358, 0x0359, 0x035a, 0x035b,
186 0x035e, 0x035f, 0x0368, 0x0369, 0x036a, 0x036b, 0x036c, 0x036d, 0x036e, 0x036f,
187 0x037c, 0x037d, 0x037e, 0x03c0, 0x03c1, 0x03c3, 0x03c5, 0x03c6, 0x03c7, 0x03cf,
188 0x03d4, 0x03d5, 0x03d6, 0x03d7, 0x03d8, 0x03d9, 0x03db, 0x03dc, 0x03dd, 0x03de,
189 0x03fc, 0x0660, 0x0661, 0x0662, 0x0663, 0x0666, 0x0667, 0x0669, 0x066b, 0x066f,
190 0x0672, 0x0673, 0x0676, 0x0678, 0x0679, 0x067a, 0x067b, 0x067e, 0x0690, 0x0691,
191 0x0693, 0x0696, 0x0697, 0x069f, 0x06b0, 0x06b1, 0x06b2, 0x06b3, 0x06b4, 0x06b5,
192 0x06b6, 0x06b7, 0x06b9, 0x06bd, 0x06f0, 0x06f1, 0x06f2, 0x06f6, 0x06f9, 0x0776,
193 0x0778, 0x0779, 0x077a, 0x077e, 0x07b0, 0x07b1, 0x07b4, 0x07b5, 0x07b6, 0x07bc,
194 0x07e0, 0x07e1, 0x07e2, 0x07e3, 0x07e6, 0x07e9, 0x07f0, 0x07f1, 0x07f2, 0x07f8,
195 0x0ff0, 0x1668, 0x1669, 0x166a, 0x166b, 0x166e, 0x167e, 0x1681, 0x1683, 0x1686,
196 0x1687, 0x1689, 0x168b, 0x168e, 0x1696, 0x1697, 0x1698, 0x1699, 0x169a, 0x169b,
197 0x169e, 0x16a9, 0x16ac, 0x16ad, 0x16bc, 0x16e9, 0x177e, 0x178e, 0x1796, 0x1798,
198 0x179a, 0x17ac, 0x17e8, 0x18e7, 0x19e1, 0x19e3, 0x19e6, 0x1bd8, 0x1be4, 0x1ee1,
201 int Counters[222] = {0};
207 unsigned short * puCanons = NULL;
208 unsigned char * puMap = NULL;
226 if ( (uTruth & 0xFFFF) < (~uTruth & 0xFFFF) )
227 uTruth = uTruth & 0xFFFF;
229 uTruth = ~uTruth & 0xFFFF;
231 for ( k = 0; k < 222; k++ )
232 if ( u4VarTts[k] == uTruth )
254 for ( k = 0; k < 222; k++ )
256 printf(
"%d/%x/%d ", k, u4VarTts[k], Counters[k] );
257 Count += Counters[k];
259 printf(
" Total = %d\n", Count );
280 for ( i = 1; i < nCofs; i++ )
282 if ( uCofs[i] == uCofs[0] )
289 if ( uCofs[i] == uCofs[Ind] )
309 unsigned pCofs[32][32];
310 int nCofNums[32] = {0};
314 for ( i = 0; i < nCofs; i++ )
317 for ( k = 0; k < nGroups; k++ )
318 if ( (
int)(i & uMask) == uMasks[k] )
322 uMasks[k] = (i & uMask);
326 pCofs[k][ nCofNums[k]++ ] = uCofs[i];
327 assert( nCofNums[k] <= 32 );
331 for ( i = 0; i < nGroups; i++ )
353 for ( v = 0; v < nVars; v++ )
354 if ( uMask & (1<<v) )
362 for ( v = last + 1; v < nVars; v++ )
364 uMaskNew = uMask | (1 << v);
367 if ( *pBestSize < Counter + 1 )
369 *pBestSize = Counter + 1;
370 *puBestMask = uMaskNew;
391 unsigned uCofs[64], uMask, uBestMask = 0;
392 int i, nCofs, nMints, nMintShift, BestSize = 1;
394 assert( nVars > BoundSet );
395 assert( nVars <= BoundSet + 5 );
398 nCofs = (1 << BoundSet);
399 nMints = (1 << (nVars-BoundSet));
402 for ( i = 0; i < nCofs; i++ )
404 uCofs[i] = (pTruth[nMintShift/32] >> (nMintShift % 32)) & uMask;
405 nMintShift += nMints;
409 for ( i = 0; i < BoundSet; i++ )
412 printf(
"Best size = %d ", BestSize );
413 printf(
"Best mask = " );
432 unsigned uCof[(1<<11)], * pOut = uCof, * pIn = pTruth, * pTemp;
438 for ( i = 0; i < nVars; i++ )
449 for ( i = 0; i < nVars-1; i++ )
451 if ( nDiffs[i] <= nDiffs[i+1] )
457 nDiffs[i] = nDiffs[i+1];
461 Order[i] = Order[i+1];
465 pTemp = pIn; pIn = pOut; pOut = pTemp;
static void Kit_TruthAndPhase(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars, int fCompl0, int fCompl1)
void Abc_Ntk4VarTable(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
ABC_NAMESPACE_IMPL_START void Abc_NtkPrintMeasures(unsigned *pTruth, int nVars)
DECLARATIONS ///.
void Abc_NtkPrintOneDec(unsigned *pTruth, int nVars)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
int Abc_NtkPrintOneDecompCheckCofList(unsigned *uCofs, int nCofs)
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
void Abc_Ntk4VarObjPrint_rec(Abc_Obj_t *pObj)
int Abc_NtkPrintOneDecompCheck(unsigned *uCofs, int nCofs, unsigned uMask)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
static unsigned Kit_CubeMask(int nVar)
static int Vec_PtrSize(Vec_Ptr_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
void Abc_NtkPrintOneDecomp_rec(unsigned *uCofs, int nCofs, int nVars, unsigned uMask, int *pBestSize, unsigned *puBestMask)
void Kit_TruthCofactor0New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
#define ABC_NAMESPACE_IMPL_END
static int Kit_TruthCountOnes(unsigned *pIn, int nVars)
void Kit_TruthCofactor1New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
unsigned Abc_Ntk4VarObj(Vec_Ptr_t *vNodes)
#define ABC_NAMESPACE_IMPL_START
void Kit_TruthUniqueNew(unsigned *pRes, unsigned *pTruth, int nVars, int iVar)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
void Abc_NtkPrintOneDecomp(unsigned *pTruth, int nVars)
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
#define Abc_NtkForEachPo(pNtk, pPo, i)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Abc_NtkForEachPi(pNtk, pPi, i)
static void Vec_PtrFree(Vec_Ptr_t *p)