73 p->Epsilon = (float)0.005;
112 Counter += Gia_ObjLutSize(
p, i);
129 int i, nSizeMax = -1;
131 nSizeMax = Abc_MaxInt( nSizeMax, Gia_ObjLutSize(
p, i) );
168 int i, k, iFan, Level;
169 int * pLevels =
ABC_CALLOC(
int, Gia_ManObjNum(
p) );
174 if ( Level < pLevels[iFan] )
175 Level = pLevels[iFan];
176 pLevels[i] = Level + 1;
181 int LevelFan = pLevels[Gia_ObjFaninId0p(
p, pObj)];
182 Level = Abc_MaxInt( Level, LevelFan );
183 pLevels[Gia_ObjId(
p, pObj)] = LevelFan;
205 int fDisable2Lut = 1;
214 (*pnCurEdges) += Gia_ObjLutSize(
p, i);
222 int * pLevels =
ABC_CALLOC(
int, Gia_ManObjNum(
p) );
228 if ( Gia_ObjLutIsMux(
p, i) && !(fDisable2Lut && Gia_ObjLutSize(
p, i) == 2) )
231 if ( Gia_ObjLutSize(
p, i) == 3 )
234 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
235 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
236 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
238 else if ( Gia_ObjLutSize(
p, i) == 2 )
240 pObj = Gia_ManObj(
p, i );
241 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
242 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
244 *pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
250 (*pnCurEdges) += Gia_ObjLutSize(
p, i);
252 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
254 *pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
278 Gia_ObjRefIncId(
p, Gia_ObjFaninId0p(
p, pObj) );
281 Gia_ObjRefIncId(
p, iFan );
302 Gia_ObjLutRefIncId(
p, Gia_ObjFaninId0p(
p, pObj) );
305 Gia_ObjLutRefIncId(
p, iFan );
323 if ( Vec_StrEntry(vLabel, iObj) )
325 Vec_StrWriteEntry( vLabel, iObj, 1 );
326 pObj = Gia_ManObj(
p, iObj );
327 assert( Gia_ObjIsAnd(pObj) );
330 Vec_IntPush( vVisit, iObj );
335 int iFan, k, Counter;
336 Vec_IntClear( vVisit );
338 Vec_StrWriteEntry( vLabel, iFan, 1 );
341 Vec_StrWriteEntry( vLabel, iFan, 0 );
343 Vec_StrWriteEntry( vLabel, iFan, 0 );
350 int i, Count = -Gia_ManAndNum(
p);
351 assert( Gia_ManHasMapping(
p) );
352 vVisit = Vec_IntAlloc( 100 );
353 vLabel = Vec_StrStart( Gia_ManObjNum(
p) );
356 Vec_StrFree( vLabel );
357 Vec_IntFree( vVisit );
375 if ( Gia_ObjIsTravIdCurrentId(
p, iObj) )
377 Gia_ObjSetTravIdCurrentId(
p, iObj );
378 pObj = Gia_ManObj(
p, iObj );
379 assert( Gia_ObjIsAnd(pObj) );
388 Gia_ObjSetTravIdCurrentId(
p, iFan );
393 int i, Count = -Gia_ManAndNum(
p);
394 assert( Gia_ManHasMapping(
p) );
415 pFanins[0] = Gia_ObjId(
p, Gia_Regular(pCtrl));
416 pFanins[1] = Gia_ObjId(
p, Gia_Regular(pData1));
417 pFanins[2] = Gia_ObjId(
p, Gia_Regular(pData0));
422 int i, pFanins[3], nCountDup = 0, nCountPis = 0, nCountMux = 0;
425 if ( Gia_ObjLutIsMux(
p, i) )
427 pObj = Gia_ManObj(
p, i );
429 if ( Gia_ObjLutSize(
p, i) == 3 )
433 pFanin = Gia_ManObj(
p, pFanins[1]);
434 nCountPis += Gia_ObjIsCi(pFanin);
435 nCountDup += pFanin->
fMark0;
436 nCountMux += pFanin->
fMark1;
439 pFanin = Gia_ManObj(
p, pFanins[2]);
440 nCountPis += Gia_ObjIsCi(pFanin);
441 nCountDup += pFanin->
fMark0;
442 nCountMux += pFanin->
fMark1;
445 else if ( Gia_ObjLutSize(
p, i) == 2 )
447 pFanin = Gia_ObjFanin0(pObj);
450 pFanin = Gia_ObjFanin1(pObj);
451 nCountPis += Gia_ObjIsCi(pFanin);
452 nCountDup += pFanin->
fMark0;
453 nCountMux += pFanin->
fMark1;
458 nCountPis += Gia_ObjIsCi(pFanin);
459 nCountDup += pFanin->
fMark0;
460 nCountMux += pFanin->
fMark1;
467 if ( nCountDup + nCountPis + nCountMux )
468 printf(
"Dup fanins = %d. CI fanins = %d. MUX fanins = %d. Total = %d. (%.2f %%)\n",
469 nCountDup, nCountPis, nCountMux, nCountDup + nCountPis, 100.0 * (nCountDup + nCountPis + nCountMux) /
Gia_ManLutNum(
p) );
470 return nCountDup + nCountPis;
475 if ( Gia_ObjIsTravIdCurrentId(
p, iObj ) || !Gia_ObjIsAnd(Gia_ManObj(
p, iObj)) )
477 Gia_ObjSetTravIdCurrentId(
p, iObj );
481 Vec_IntPush( vLuts, iObj );
485 int i, iObj, k, iFan, LevelMax = 0;
489 Level = Abc_MaxInt( Level, Vec_IntEntry(vLevel, iFan) );
490 Vec_IntWriteEntry( vLevel, iObj, Level+1 );
491 LevelMax = Abc_MaxInt( LevelMax, Level+1 );
494 Vec_IntWriteEntry( vLevel, iObj, 0 );
501 Vec_Int_t * vLuts = Vec_IntAlloc( 1000 );
502 Vec_Int_t * vNodes = Vec_IntStart( Limit );
503 Vec_Int_t * vLevels = Vec_IntStart( Limit );
504 Vec_Int_t * vLevel = Vec_IntStart( Gia_ManObjNum(
p) );
505 int i, DriverId, Value, nTotalLuts = 0;
507 Vec_IntClear( vLuts );
510 if ( Vec_IntSize(vLuts) < Limit )
511 Vec_IntAddToEntry( vNodes, Vec_IntSize(vLuts), 1 );
514 Vec_IntAddToEntry( vLevels, Level, 1 );
515 nTotalLuts += Vec_IntSize(vLuts);
517 printf(
"Level count statistics for %d AIG outputs:\n", Gia_ManCoNum(
p) );
520 printf(
" %2d level : Function count = %8d (%6.2f %%)\n", i, Value, 100.0*Value/Gia_ManCoNum(
p) );
521 printf(
"LUT count statistics for %d AIG outputs:\n", Gia_ManCoNum(
p) );
524 printf(
" %2d LUT%d : Function count = %8d (%6.2f %%)\n", i, nLutSize, Value, 100.0*Value/Gia_ManCoNum(
p) );
525 printf(
"Sum total of LUT counts for all outputs = %d. Shared LUT count = %d.\n", nTotalLuts,
Gia_ManLutNum(
p) );
526 Vec_IntFree( vLuts );
527 Vec_IntFree( vNodes );
528 Vec_IntFree( vLevels );
529 Vec_IntFree( vLevel );
534 int fDisable2Lut = 1;
537 int i, k, iFan, nLutSize = 0, nLuts = 0, nFanins = 0, LevelMax = 0, Ave = 0, nMuxF = 0;
538 if ( !Gia_ManHasMapping(
p) )
543 if ( Gia_ObjLutIsMux(
p, i) && !(fDisable2Lut && Gia_ObjLutSize(
p, i) == 2) )
546 if ( Gia_ObjLutSize(
p, i) == 3 )
549 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
550 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
551 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
553 else if ( Gia_ObjLutSize(
p, i) == 2 )
555 pObj = Gia_ManObj(
p, i );
556 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
557 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
559 LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
565 nFanins += Gia_ObjLutSize(
p, i);
566 nLutSize = Abc_MaxInt( nLutSize, Gia_ObjLutSize(
p, i) );
568 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
570 LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
573 Ave += pLevels[Gia_ObjFaninId0p(
p, pObj)];
578 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
579 Abc_Print( 1,
"Mapping (K=%d) : ", nLutSize );
580 SetConsoleTextAttribute( hConsole, 14 );
581 Abc_Print( 1,
"lut =%7d ", nLuts );
583 Abc_Print( 1,
"muxF =%7d ", nMuxF );
584 SetConsoleTextAttribute( hConsole, 10 );
585 Abc_Print( 1,
"edge =%8d ", nFanins );
586 SetConsoleTextAttribute( hConsole, 12 );
587 Abc_Print( 1,
"lev =%5d ", LevelMax );
588 Abc_Print( 1,
"(%.2f) ", (
float)Ave / Gia_ManCoNum(
p) );
592 SetConsoleTextAttribute( hConsole, 7 );
593 Abc_Print( 1,
"mem =%5.2f MB", 4.0*(Gia_ManObjNum(
p) + 2*nLuts + nFanins)/(1<<20) );
594 Abc_Print( 1,
"\n" );
597 Abc_Print( 1,
"Mapping (K=%d) : ", nLutSize );
598 Abc_Print( 1,
"%slut =%7d%s ",
"\033[1;33m", nLuts,
"\033[0m" );
599 Abc_Print( 1,
"%sedge =%8d%s ",
"\033[1;32m", nFanins,
"\033[0m" );
600 Abc_Print( 1,
"%slev =%5d%s ",
"\033[1;31m", LevelMax,
"\033[0m" );
601 Abc_Print( 1,
"%s(%.2f)%s ",
"\033[1;31m", (
float)Ave / Gia_ManCoNum(
p),
"\033[0m" );
605 Abc_Print( 1,
"mem =%5.2f MB", 4.0*(Gia_ManObjNum(
p) + 2*nLuts + nFanins)/(1<<20) );
606 Abc_Print( 1,
"\n" );
615 static char FileNameOld[1000] = {0};
617 FILE * pTable = fopen( pDumpFile,
"a+" );
618 if (
strcmp( FileNameOld,
p->pName ) )
620 sprintf( FileNameOld,
"%s_out",
p->pName );
621 fprintf( pTable,
"\n" );
622 fprintf( pTable,
"%s ",
p->pName );
623 fprintf( pTable,
" " );
625 fprintf( pTable,
"%d ", Gia_ManRegNum(
p) );
626 fprintf( pTable,
"%d ", nLuts );
637 fprintf( pTable,
" " );
638 fprintf( pTable,
" " );
639 fprintf( pTable,
"%d ", Gia_ManRegNum(
p) );
640 fprintf( pTable,
"%d ", nLuts );
666 int nObjToShow = 200;
667 int nNumStr[5] = {0};
668 int i, k, Entry, nEntries, nEntries2, MaxSize = -1, Count = 0;
669 if (
p->vPacking == NULL )
671 nEntries = Vec_IntEntry(
p->vPacking, 0 );
675 assert( Entry > 0 && Entry < 4 );
678 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1,
"{ " );
679 for ( k = 0; k < Entry; k++, i++ )
680 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1,
"%d ", Vec_IntEntry(
p->vPacking, i) );
681 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1,
"}\n" );
685 assert( nEntries == nEntries2 );
686 if ( nNumStr[3] > 0 )
688 else if ( nNumStr[2] > 0 )
690 else if ( nNumStr[1] > 0 )
692 Abc_Print( 1,
"Packing (N=%d) : ", MaxSize );
693 for ( i = 1; i <= MaxSize; i++ )
695 Abc_Print( 1,
"%d x LUT = %d ", i, nNumStr[i] );
696 Count += i * nNumStr[i];
698 Abc_Print( 1,
"Total = %d ", nEntries2 );
699 Abc_Print( 1,
"Total LUT = %d", Count );
700 Abc_Print( 1,
"\n" );
716 int i, SizeAll = 0, NodeAll = 0;
717 for ( i = 0; i <= nSizeMax; i++ )
719 SizeAll += i * pCounts[i];
720 NodeAll += pCounts[i];
722 Abc_Print( 1,
"LUT = %d : ", NodeAll );
723 for ( i = 2; i <= nSizeMax; i++ )
724 Abc_Print( 1,
"%d=%d %.1f %% ", i, pCounts[i], 100.0*pCounts[i]/NodeAll );
725 Abc_Print( 1,
"Ave = %.2f\n", 1.0*SizeAll/(NodeAll ? NodeAll : 1) );
729 int i, nSizeMax, pCounts[33] = {0};
733 Abc_Print( 1,
"The max LUT size (%d) is too large.\n", nSizeMax );
737 pCounts[ Gia_ObjLutSize(
p, i) ]++;
756 int i, iBox, iTerm1, nTerms, LevelMax = 0;
757 if ( Gia_ObjIsTravIdCurrent(
p, pObj ) )
759 Gia_ObjSetTravIdCurrent(
p, pObj );
760 if ( Gia_ObjIsCi(pObj) )
769 for ( i = 0; i < nTerms; i++ )
771 pNext = Gia_ManCo(
p, iTerm1 + i );
773 if ( LevelMax < Gia_ObjLevel(
p, pNext) )
774 LevelMax = Gia_ObjLevel(
p, pNext);
781 else if ( Gia_ObjIsCo(pObj) )
783 pNext = Gia_ObjFanin0(pObj);
785 if ( LevelMax < Gia_ObjLevel(
p, pNext) )
786 LevelMax = Gia_ObjLevel(
p, pNext);
788 else if ( Gia_ObjIsAnd(pObj) )
791 pNext = Gia_ObjFanin0(pObj);
793 if ( LevelMax < Gia_ObjLevel(
p, pNext) )
794 LevelMax = Gia_ObjLevel(
p, pNext);
795 pNext = Gia_ObjFanin1(pObj);
797 if ( LevelMax < Gia_ObjLevel(
p, pNext) )
798 LevelMax = Gia_ObjLevel(
p, pNext);
802 if ( (pNext = Gia_ObjSiblObj(
p, Gia_ObjId(
p, pObj))) )
805 if ( LevelMax < Gia_ObjLevel(
p, pNext) )
806 LevelMax = Gia_ObjLevel(
p, pNext);
809 else if ( !Gia_ObjIsConst0(pObj) )
811 Gia_ObjSetLevel(
p, pObj, LevelMax );
823 if ( LevelMax < Gia_ObjLevel(
p, pObj) )
824 LevelMax = Gia_ObjLevel(
p, pObj);
830 if ( LevelMax < Gia_ObjLevel(
p, pObj) )
831 LevelMax = Gia_ObjLevel(
p, pObj);
836 assert( Gia_ObjLevel(
p, pObj) > 0 );
872 printf(
"Object %d is dangling.\n", i ), fFound = 1;
874 printf(
"There are no dangling objects.\n" );
891static inline If_Obj_t * If_ManFanin0Copy(
If_Man_t * pIfMan,
Gia_Obj_t * pObj ) {
return If_NotCond( If_ManObj(pIfMan, Gia_ObjValue(Gia_ObjFanin0(pObj))), Gia_ObjFaninC0(pObj) ); }
892static inline If_Obj_t * If_ManFanin1Copy(
If_Man_t * pIfMan,
Gia_Obj_t * pObj ) {
return If_NotCond( If_ManObj(pIfMan, Gia_ObjValue(Gia_ObjFanin1(pObj))), Gia_ObjFaninC1(pObj) ); }
902 if ( Gia_ManHasChoices(
p) )
906 pIfMan->
pName = Abc_UtilStrsav( Gia_ManName(
p) );
908 if ( 1.0 * Gia_ManObjNum(
p) * pIfMan->
nObjBytes / (1<<30) > 1.0 )
909 printf(
"Warning: The mapper will allocate %.1f GB for to represent the subject graph with %d AIG nodes.\n",
910 1.0 * Gia_ManObjNum(
p) * pIfMan->
nObjBytes / (1<<30), Gia_ManObjNum(
p) );
913 Gia_ManConst0(
p)->Value = If_ObjId( If_ManConst1(pIfMan) );
916 if ( Gia_ObjIsAnd(pObj) )
917 pIfObj =
If_ManCreateAnd( pIfMan, If_ManFanin0Copy(pIfMan, pObj), If_ManFanin1Copy(pIfMan, pObj) );
918 else if ( Gia_ObjIsCi(pObj) )
921 If_ObjSetLevel( pIfObj, Gia_ObjLevel(
p, pObj) );
926 else if ( Gia_ObjIsCo(pObj) )
928 pIfObj =
If_ManCreateCo( pIfMan, If_NotCond( If_ManFanin0Copy(pIfMan, pObj), Gia_ObjIsConst0(Gia_ObjFanin0(pObj))) );
932 assert( i == If_ObjId(pIfObj) );
933 Gia_ObjSetValue( pObj, If_ObjId(pIfObj) );
935 if ( Gia_ObjSibl(
p, i) && pObj->
fMark0 )
938 for ( pPrev = pObj, pSibl = Gia_ObjSiblObj(
p, i); pSibl; pPrev = pSibl, pSibl = Gia_ObjSiblObj(
p, Gia_ObjId(
p, pSibl)) )
939 If_ObjSetChoice( If_ManObj(pIfMan, Gia_ObjValue(pPrev)), If_ManObj(pIfMan, Gia_ObjValue(pSibl)) );
945 if ( Gia_ManHasChoices(
p) )
964 assert( Vec_IntSize(vAig) > 0 );
965 assert( Vec_IntEntryLast(vAig) < 2 );
966 if ( Vec_IntSize(vAig) == 1 )
967 return Vec_IntEntry(vAig, 0);
968 if ( Vec_IntSize(vAig) == 2 )
970 assert( Vec_IntEntry(vAig, 0) == 0 );
971 assert( Vec_IntSize(vLeaves) == 1 );
972 return Abc_LitNotCond( Vec_IntEntry(vLeaves, 0), Vec_IntEntry(vAig, 1) );
976 int nLeaves = Vec_IntSize(vLeaves);
977 int i, iVar0, iVar1, iLit0, iLit1, iLit = 0;
978 assert( Vec_IntSize(vAig) & 1 );
981 iVar0 = Abc_Lit2Var( iLit0 );
982 iVar1 = Abc_Lit2Var( iLit1 );
983 iLit0 = Abc_LitNotCond( iVar0 < nLeaves ? Vec_IntEntry(vLeaves, iVar0) : Vec_IntEntry(vAig, iVar0 - nLeaves), Abc_LitIsCompl(iLit0) );
984 iLit1 = Abc_LitNotCond( iVar1 < nLeaves ? Vec_IntEntry(vLeaves, iVar1) : Vec_IntEntry(vAig, iVar1 - nLeaves), Abc_LitIsCompl(iLit1) );
987 else if ( iLit0 == iLit1 )
990 iLit = Gia_ManAppendAnd( pNew, iLit0, iLit1 );
992 Vec_IntWriteEntry( vAig, Abc_Lit2Var(i), iLit );
994 assert( i == Vec_IntSize(vAig) - 1 );
995 iLit = Abc_LitNotCond( iLit, Vec_IntEntry(vAig, i) );
996 Vec_IntClear( vAig );
1023 if ( pIfObj->
iCopy )
1024 return pIfObj->
iCopy;
1027 iLit0 = Abc_LitNotCond( iLit0, pIfObj->
fCompl0 );
1028 iLit1 = Abc_LitNotCond( iLit1, pIfObj->
fCompl1 );
1030 return pIfObj->
iCopy;
1047 vAig = Vec_IntAlloc( 1 << 16 );
1048 vLeaves = Vec_IntAlloc( 16 );
1053 if ( pIfObj->
nRefs == 0 && !If_ObjIsTerm(pIfObj) )
1055 if ( If_ObjIsAnd(pIfObj) )
1057 pCutBest = If_ObjCutBest( pIfObj );
1065 Vec_IntClear( vLeaves );
1067 Vec_IntPush( vLeaves, pIfLeaf->
iCopy );
1077 else if ( If_ObjIsCi(pIfObj) )
1078 pIfObj->
iCopy = Gia_ManAppendCi(pNew);
1079 else if ( If_ObjIsCo(pIfObj) )
1080 pIfObj->
iCopy = Gia_ManAppendCo( pNew, Abc_LitNotCond(If_ObjFanin0(pIfObj)->iCopy, If_ObjFaninC0(pIfObj)) );
1081 else if ( If_ObjIsConst1(pIfObj) )
1085 Vec_IntFree( vAig );
1086 Vec_IntFree( vLeaves );
1106 int i, iLit, iObjLit1;
1107 iObjLit1 =
Kit_TruthToGia( pNew, (
unsigned *)pRes, Vec_IntSize(vLeaves), vCover, vLeaves, 0 );
1109 if ( Abc_Lit2Var(iObjLit1) == 0 )
1112 if ( Abc_Lit2Var(iObjLit1) == Abc_Lit2Var(iLit) )
1115 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iObjLit1), Vec_IntSize(vMapping2) );
1116 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
1120 Vec_IntPush( vMapping2, Abc_Lit2Var(iLit) );
1121 Vec_IntPush( vMapping2, Abc_Lit2Var(iObjLit1) );
1140 int i, iObjLit1, iObjLit2;
1142 Vec_IntClear( vLeavesTemp );
1143 for ( i = 0; i < 4; i++ )
1145 int v = (int)((z >> (16+(i<<2))) & 7);
1146 if ( v == 6 && Vec_IntSize(vLeaves) == 5 )
1148 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, v) );
1150 Truth = (z & 0xffff);
1151 Truth |= (Truth << 16);
1152 Truth |= (Truth << 32);
1155 Vec_IntClear( vLeavesTemp );
1156 for ( i = 0; i < 4; i++ )
1158 int v = (int)((z >> (48+(i<<2))) & 7);
1159 if ( v == 6 && Vec_IntSize(vLeaves) == 5 )
1162 Vec_IntPush( vLeavesTemp, iObjLit1 );
1164 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, v) );
1166 Truth = ((z >> 32) & 0xffff);
1167 Truth |= (Truth << 16);
1168 Truth |= (Truth << 32);
1171 Vec_IntPush( vPacking, 2 );
1172 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1173 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit2) );
1174 Vec_IntAddToEntry( vPacking, 0, 1 );
1192 int nLeaves = Vec_IntSize(vLeaves);
1193 int i, Length, nLutLeaf, nLutLeaf2, nLutRoot, iObjLit1, iObjLit2, iObjLit3;
1200 if ( Vec_IntSize(vLeaves) <= 4 )
1205 if ( !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(iObjLit1))) && iObjLit1 > 1 )
1207 Vec_IntPush( vPacking, 1 );
1208 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1209 Vec_IntAddToEntry( vPacking, 0, 1 );
1215 if ( ((
If_Man_t *)pIfMan)->pPars->fLut6Filter && Vec_IntSize(vLeaves) == 6 )
1219 Vec_Int_t * vLeaves2 = Vec_IntAlloc( 4 );
1225 t = Abc_Tt6Stretch( z & 0xffff, 4 );
1226 Vec_IntClear( vLeaves2 );
1227 for ( i = 0; i < 4; i++ )
1228 Vec_IntPush( vLeaves2, Vec_IntEntry( vLeaves, (
int)((z >> (16+i*4)) & 7) ) );
1231 t = Abc_Tt6Stretch( (z >> 32) & 0xffff, 4 );
1232 Vec_IntClear( vLeaves2 );
1233 for ( i = 0; i < 4; i++ )
1234 if ( ((z >> (48+i*4)) & 7) == 7 )
1235 Vec_IntPush( vLeaves2, iObjLit1 );
1237 Vec_IntPush( vLeaves2, Vec_IntEntry( vLeaves, (
int)((z >> (48+i*4)) & 7) ) );
1240 Vec_IntFree( vLeaves2 );
1248 if ( Length != 2 && Length != 3 )
1250 printf(
"Wrong LUT struct (%s)\n", pStr );
1253 for ( i = 0; i < Length; i++ )
1254 if ( pStr[i] -
'0' < 3 || pStr[i] -
'0' > 6 )
1256 printf(
"The LUT size (%d) should belong to {3,4,5,6}.\n", pStr[i] -
'0' );
1260 nLutLeaf = pStr[0] -
'0';
1261 nLutLeaf2 = ( Length == 3 ) ? pStr[1] -
'0' : 0;
1262 nLutRoot = pStr[Length-1] -
'0';
1263 if ( nLeaves > nLutLeaf - 1 + (nLutLeaf2 ? nLutLeaf2 - 1 : 0) + nLutRoot )
1265 printf(
"The node size (%d) is too large for the LUT structure %s.\n", nLeaves, pStr );
1270 if ( nLeaves <= Abc_MaxInt( nLutLeaf2, Abc_MaxInt(nLutLeaf, nLutRoot) ) )
1275 if ( !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(iObjLit1))) && iObjLit1 > 1 )
1277 Vec_IntPush( vPacking, 1 );
1278 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1279 Vec_IntAddToEntry( vPacking, 0, 1 );
1287 static word TruthStore[16][1<<10] = {{0}}, * pTruths[16];
1288 word Func0, Func1, Func2;
1289 char pLut0[32], pLut1[32], pLut2[32] = {0};
1291 if ( TruthStore[0][0] == 0 )
1293 static word Truth6[6] = {
1302 int nWordsMax = (1 << 10);
1304 assert( nVarsMax <= 16 );
1305 for ( i = 0; i < nVarsMax; i++ )
1306 pTruths[i] = TruthStore[i];
1307 for ( i = 0; i < 6; i++ )
1308 for ( k = 0; k < nWordsMax; k++ )
1309 pTruths[i][k] = Truth6[i];
1310 for ( i = 6; i < nVarsMax; i++ )
1311 for ( k = 0; k < nWordsMax; k++ )
1312 pTruths[i][k] = ((k >> (i-6)) & 1) ? ~(
word)0 : 0;
1315 if ( Kit_TruthIsConst0((
unsigned *)pRes, nLeaves) || Kit_TruthIsConst1((
unsigned *)pRes, nLeaves) )
1318 iObjLit1 = Abc_LitNotCond( 0, Kit_TruthIsConst1((
unsigned *)pRes, nLeaves) );
1320 if ( Vec_IntEntry(vMapping, 0) == 0 )
1322 Vec_IntSetEntry( vMapping, 0, Vec_IntSize(vMapping2) );
1323 Vec_IntPush( vMapping2, 0 );
1324 Vec_IntPush( vMapping2, 0 );
1329 for ( i = 0; i < nLeaves; i++ )
1331 if ( Kit_TruthIsEqual((
unsigned *)pRes, (
unsigned *)pTruths[i], nLeaves) )
1332 return Vec_IntEntry(vLeaves, i);
1333 if ( Kit_TruthIsOpposite((
unsigned *)pRes, (
unsigned *)pTruths[i], nLeaves) )
1334 return Abc_LitNot(Vec_IntEntry(vLeaves, i));
1341 if ( nLeaves < 8 &&
If_CluCheckExt( NULL, pRes, nLeaves, 4, 4, pLut0, pLut1, &Func0, &Func1 ) )
1347 else if (
If_CluCheckExt( NULL, pRes, nLeaves, 5, 4, pLut0, pLut1, &Func0, &Func1 ) )
1353 else if (
If_CluCheckExt( NULL, pRes, nLeaves, 4, 5, pLut0, pLut1, &Func0, &Func1 ) )
1360 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1362 printf(
"Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1370 if ( ((
If_Man_t *)pIfMan)->pPars->fEnableStructN )
1372 if ( !
If_CluCheckXXExt( NULL, pRes, nLeaves, nLutLeaf, nLutRoot, pLut0, pLut1, &Func0, &Func1 ) )
1374 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1376 printf(
"Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1382 if ( !
If_CluCheckExt( NULL, pRes, nLeaves, nLutLeaf, nLutRoot, pLut0, pLut1, &Func0, &Func1 ) )
1384 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1386 printf(
"Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1393 if ( !
If_CluCheckExt3( pIfMan, pRes, nLeaves, nLutLeaf, nLutLeaf2, nLutRoot, pLut0, pLut1, pLut2, &Func0, &Func1, &Func2 ) )
1395 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1397 printf(
"Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1413 Vec_IntClear( vLeavesTemp );
1414 for ( i = 0; i < pLut1[0]; i++ )
1415 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, pLut1[2+i]) );
1418 if ( Length == 3 && pLut2[0] > 0 )
1433 Vec_IntClear( vLeavesTemp );
1434 for ( i = 0; i < pLut2[0]; i++ )
1435 if ( pLut2[2+i] == nLeaves )
1436 Vec_IntPush( vLeavesTemp, iObjLit1 );
1438 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, pLut2[2+i]) );
1442 Vec_IntPush( vPacking, 3 );
1443 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1444 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit2) );
1449 Vec_IntPush( vPacking, 2 );
1450 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1469 Vec_IntClear( vLeavesTemp );
1470 for ( i = 0; i < pLut0[0]; i++ )
1471 if ( pLut0[2+i] == nLeaves )
1472 Vec_IntPush( vLeavesTemp, iObjLit1 );
1473 else if ( pLut0[2+i] == nLeaves+1 )
1474 Vec_IntPush( vLeavesTemp, iObjLit2 );
1476 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, pLut0[2+i]) );
1480 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit3) );
1481 Vec_IntAddToEntry( vPacking, 0, 1 );
1499 word * pTruth = If_CutTruthW(pIfMan, pCutBest);
1500 unsigned char decompArray[92];
1505 unsigned delayProfile = pCutBest->
decDelay;
1510 unsigned char bytes_check = decompArray[0];
1511 assert( bytes_check <= 92 );
1514 unsigned char i, j, k, num_fanins, num_words, num_bytes;
1519 for ( i = 0; i < decompArray[1]; ++i )
1521 num_fanins = decompArray[byte_p++];
1522 Vec_IntClear( vLeavesTemp );
1523 for ( j = 0; j < num_fanins; ++j )
1525 fanin = (int)decompArray[byte_p++];
1526 if ( fanin < If_CutLeaveNum(pCutBest) )
1528 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, fanin) );
1532 Vec_IntPush( vLeavesTemp, iObjLits[fanin - If_CutLeaveNum(pCutBest)] );
1538 num_words = ( num_fanins <= 6 ) ? 1 : ( 1 << ( num_fanins - 6 ) );
1539 num_bytes = ( num_fanins <= 3 ) ? 1 : ( 1 << ( Abc_MinInt( (
int)num_fanins, 6 ) - 3 ) );
1540 for ( j = 0; j < num_words; ++j )
1543 for ( k = 0; k < num_bytes; ++k )
1545 tt[j] |= ( (
word)(decompArray[byte_p++]) ) << ( k << 3 );
1550 assert( num_fanins != 1 );
1551 if ( num_fanins == 2 )
1553 tt[0] |= tt[0] << 4;
1555 while ( num_bytes < 4 )
1557 tt[0] |= tt[0] << ( num_bytes << 3 );
1565 assert( byte_p == decompArray[0] );
1567 return iObjLits[i-1];
1585 int iFunc, iFunc0, iFunc1;
1587 pCut = If_ObjCutBest(pIfObj);
1589 if ( If_CutDataInt(pCut) )
1590 return If_CutDataInt(pCut);
1592 Vec_PtrPush( vVisited, pCut );
1594 If_CutSetDataInt( pCut, ~0 );
1596 if ( If_ObjIsCi(pIfObj) )
1597 return If_CutDataInt(pCut);
1599 for ( pTemp = pIfObj; pTemp; pTemp = pTemp->
pEquiv )
1611 iFunc = Gia_ManAppendAnd( pNew, Abc_LitNotCond(iFunc0, pTemp->
fCompl0), Abc_LitNotCond(iFunc1, pTemp->
fCompl1) );
1613 iFunc = Abc_LitNot(iFunc);
1614 If_CutSetDataInt( pCut, iFunc );
1617 return If_CutDataInt(pCut);
1625 pCut = If_ObjCutBest(pIfObj);
1629 If_CutSetDataInt( If_ObjCutBest(pLeaf), Vec_IntEntry(vLeaves, i) );
1631 Vec_PtrClear( pIfMan->
vTemp );
1635 Abc_Print( -1,
"Gia_ManNodeIfToGia(): Computing local AIG has failed.\n" );
1640 If_CutSetDataInt( If_ObjCutBest(pLeaf), 0 );
1642 If_CutSetDataInt( pCut, 0 );
1664 unsigned uSetNew, uSetOld;
1665 int RetValue, RetValue2, k;
1667 if ( Vec_IntSize(vLeaves) <= nLutSize )
1671 if ( !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(RetValue))) && RetValue > 1 )
1673 Vec_IntPush( vPacking, 1 );
1674 Vec_IntPush( vPacking, Abc_Lit2Var(RetValue) );
1675 Vec_IntAddToEntry( vPacking, 0, 1 );
1687 pPerm = If_CutDsdPerm( pIfMan, pCutBest );
1688 for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ )
1690 int iVar = Abc_Lit2Var((
int)pPerm[k]);
1691 int Value = ((uSetOld >> (k << 1)) & 3);
1693 uSetNew |= (1 << (2*iVar));
1694 else if ( Value == 3 )
1695 uSetNew |= (3 << (2*iVar));
1696 else assert( Value == 0 );
1698 RetValue =
If_ManSatCheckXY( pSat, nLutSize, If_CutTruthW(pIfMan, pCutBest), pCutBest->
nLeaves, uSetNew, &uBound, &uFree, vLits );
1701 for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ )
1703 int Value = ((uSetNew >> (k << 1)) & 3);
1705 pVarsF[nVarsF++] = k;
1706 else if ( Value == 1 )
1707 pVarsB[nVarsB++] = k;
1708 else if ( Value == 3 )
1709 pVarsS[nVarsS++] = k;
1710 else assert( Value == 0 );
1713 Vec_IntClear( vLits );
1714 for ( k = 0; k < nVarsS; k++ )
1715 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsS[k]) );
1716 for ( k = 0; k < nVarsB; k++ )
1717 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsB[k]) );
1720 Vec_IntClear( vLits );
1721 Vec_IntPush( vLits, RetValue );
1722 for ( k = 0; k < nVarsS; k++ )
1723 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsS[k]) );
1724 for ( k = 0; k < nVarsF; k++ )
1725 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsF[k]) );
1729 Vec_IntPush( vPacking, 2 );
1730 Vec_IntPush( vPacking, Abc_Lit2Var(RetValue) );
1731 Vec_IntPush( vPacking, Abc_Lit2Var(RetValue2) );
1732 Vec_IntAddToEntry( vPacking, 0, 1 );
1751 char * pCutPerm = If_CutDsdPerm( pIfMan, pCutBest );
1752 word * pArray;
int v, i, Lit,
Var;
1756 int nPermBitOne = nPermBitNum / nVarNum;
1758 int nIntNum = Vec_IntEntry( vConfigs, 1 );
1759 for ( i = 0; i < nIntNum; i++ )
1760 Vec_IntPush( vConfigs, 0 );
1761 pArray = (
word *)Vec_IntEntryP( vConfigs, Vec_IntSize(vConfigs) - nIntNum );
1762 assert( nPermBitNum % nVarNum == 0 );
1764 for ( i = 0; i < nTtBitNum; i++ )
1765 if ( Abc_TtGetBit(pPerm + 1, i) )
1766 Abc_TtSetBit( pArray, i );
1768 for ( v = 0; v < nVarNum; v++ )
1771 Var = ((pPerm[0] >> (v * 4)) & 0xF);
1774 Lit = (int)pCutPerm[
Var];
1777 pIfObj = If_ManObj( pIfMan, pCutBest->
pLeaves[Abc_Lit2Var(Lit)] );
1778 Lit = Abc_LitNotCond( Lit, Abc_LitIsCompl(pIfObj->
iCopy) );
1780 for ( i = 0; i < nPermBitOne; i++ )
1781 if ( (Lit >> i) & 1 )
1782 Abc_TtSetBit( pArray, nTtBitNum + v * nPermBitOne + i );
1785 assert( nTtBitNum + nPermBitNum < 32 * nIntNum );
1786 if ( Abc_LitIsCompl(If_CutDsdLit(pIfMan, pCutBest)) ^ pCutBest->
fCompl ^ Abc_LitIsCompl(iLit) )
1787 Abc_TtSetBit( pArray, nTtBitNum + nPermBitNum );
1789 Vec_IntAddToEntry( vConfigs, 0, 1 );
1793 Vec_StrPrintF( vConfigsStr,
"%d", Abc_Lit2Var(iLit) );
1794 Vec_StrPush( vConfigsStr,
' ' );
1795 for ( i = 0; i < nTtBitNum; i++ )
1796 Vec_StrPush( vConfigsStr, (
char)(Abc_TtGetBit(pArray, i) ?
'1' :
'0') );
1797 Vec_StrPush( vConfigsStr,
' ' );
1798 Vec_StrPush( vConfigsStr,
' ' );
1799 for ( v = 0; v < nVarNum; v++ )
1801 for ( i = 0; i < nPermBitOne; i++ )
1803 Vec_StrPush( vConfigsStr, (
char)(Abc_TtGetBit(pArray, nTtBitNum + v * nPermBitOne + i) ?
'1' :
'0') );
1805 Vec_StrPush( vConfigsStr,
' ' );
1807 Vec_StrPush( vConfigsStr,
' ' );
1808 Vec_StrPush( vConfigsStr,
' ' );
1810 Vec_StrPush( vConfigsStr, (
char)(Abc_TtGetBit(pArray, nTtBitNum + nPermBitNum) ?
'1' :
'0') );
1811 Vec_StrPush( vConfigsStr,
'\n' );
1814int Gia_ManFromIfLogicFindCell(
If_Man_t * pIfMan,
Gia_Man_t * pNew,
Gia_Man_t * pTemp,
If_Cut_t * pCutBest,
Ifn_Ntk_t * pNtkCell,
int nLutMax,
Vec_Int_t * vLeaves,
Vec_Int_t * vLits,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2,
Vec_Int_t * vConfigs )
1818 if ( Vec_IntSize(vLeaves) <= nLutMax )
1823 int i, Id, iLitTemp;
1831 Vec_IntFillExtra( &pTemp->
vCopies, Gia_ManObjNum(pTemp), -1 );
1832 Gia_ObjSetCopyArray( pTemp, 0, 0 );
1834 Gia_ObjSetCopyArray( pTemp, Gia_ManCiIdToId(pTemp, i), iLitTemp );
1837 Id = Abc_Lit2Var( iLit );
1839 Vec_IntPrint( vCover );
1845 iLit = Gia_ManAppendAnd( pNew, Gia_ObjFanin0CopyArray(pTemp, pObj), Gia_ObjFanin1CopyArray(pTemp, pObj) );
1846 Gia_ObjSetCopyArray( pTemp, Gia_ObjId(pTemp, pObj), iLit );
1848 iLit = Abc_LitNotCond( Gia_ObjCopyArray(pTemp, Id), Abc_LitIsCompl(iLit) );
1870 word pTruthCof[128], * pTruth = If_CutTruthW(pIfMan, pCutBest);
1871 int pVarsNew[16], nVarsNew, iLitCofs[3];
1872 int nLeaves = pCutBest->
nLeaves;
1873 int nWords = Abc_Truth6WordNum(nLeaves);
1874 int truthId = Abc_Lit2Var(pCutBest->
iCutFunc);
1875 int c, iVar = Vec_StrEntry(pIfMan->
vTtVars[nLeaves], truthId), iTemp, iTopLit;
1876 int k, RetValue = -1;
1877 assert( iVar >= 0 && iVar < nLeaves && pIfMan->pPars->nLutSize <= 13 );
1878 for ( c = 0; c < 2; c++ )
1880 for ( k = 0; k < nLeaves; k++ )
1883 Abc_TtCofactor1p( pTruthCof, pTruth,
nWords, iVar );
1885 Abc_TtCofactor0p( pTruthCof, pTruth,
nWords, iVar );
1886 nVarsNew = Abc_TtMinBase( pTruthCof, pVarsNew, pCutBest->
nLeaves, Abc_MaxInt(6, pCutBest->
nLeaves) );
1888 Vec_IntClear( vLeaves2 );
1889 for ( k = 0; k < nVarsNew; k++ )
1890 Vec_IntPush( vLeaves2, Vec_IntEntry(vLeaves, pVarsNew[k]) );
1891 iLitCofs[c] =
Kit_TruthToGia( pNew, (
unsigned *)pTruthCof, nVarsNew, vCover, vLeaves2, 0 );
1895 assert( Gia_ObjIsAnd(Gia_ManObj(pNew, Abc_Lit2Var(iLitCofs[c]))) );
1896 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLitCofs[c]), Vec_IntSize(vMapping2) );
1897 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) );
1899 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1900 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[c]) );
1902 iLitCofs[2] = Vec_IntEntry(vLeaves, iVar);
1904 if ( iLitCofs[0] > 1 && iLitCofs[1] > 1 )
1906 pTruthCof[0] =
ABC_CONST(0xCACACACACACACACA);
1907 Vec_IntClear( vLeaves2 );
1908 Vec_IntPush( vLeaves2, iLitCofs[0] );
1909 Vec_IntPush( vLeaves2, iLitCofs[1] );
1910 Vec_IntPush( vLeaves2, iLitCofs[2] );
1911 RetValue =
Kit_TruthToGia( pNew, (
unsigned *)pTruthCof, Vec_IntSize(vLeaves2), vCover, vLeaves2, 0 );
1916 assert( iLitCofs[0] > 1 || iLitCofs[1] > 1 );
1918 Vec_IntClear( vLeaves2 );
1919 for ( k = 0; k < 3; k++ )
1920 if ( iLitCofs[k] > 1 )
1921 Vec_IntPush( vLeaves2, iLitCofs[k] );
1922 assert( Vec_IntSize(vLeaves2) == 2 );
1924 if ( iLitCofs[0] == 0 )
1925 RetValue = Gia_ManAppendAnd( pNew, iLitCofs[2], iLitCofs[1] );
1926 else if ( iLitCofs[0] == 1 )
1927 RetValue = Gia_ManAppendOr( pNew, Abc_LitNot(iLitCofs[2]), iLitCofs[1] );
1928 else if ( iLitCofs[1] == 0 )
1929 RetValue = Gia_ManAppendAnd( pNew, Abc_LitNot(iLitCofs[2]), iLitCofs[0] );
1930 else if ( iLitCofs[1] == 1 )
1931 RetValue = Gia_ManAppendOr( pNew, iLitCofs[2], iLitCofs[0] );
1933 iTopLit = iLitCofs[2];
1936 Vec_IntSetEntry( vMapping, Abc_Lit2Var(RetValue), Vec_IntSize(vMapping2) );
1937 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) );
1939 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1940 Vec_IntPush( vMapping2, -Abc_Lit2Var(iTopLit) );
1941 RetValue = Abc_LitNotCond( RetValue, pCutBest->
fCompl );
1946 word pFunc[64], uTruth[2];
1947 int nLeaves = pCutBest->
nLeaves;
1948 int truthId = Abc_Lit2Var(pCutBest->
iCutFunc);
1949 int c, k, Mask = Vec_IntEntry(pIfMan->
vTtDecs[nLeaves], truthId);
1950 int MaskOne[2] = { Mask & 0xFFFF, (Mask >> 16) & 0x3FFF };
1951 int iLitCofs[2], iTemp, fOrDec = (Mask >> 30) & 1, RetValue = -1;
1953 Abc_TtCopy( pFunc, If_CutTruthWR(pIfMan, pCutBest), pIfMan->
nTruth6Words[nLeaves], fOrDec );
1954 Abc_TtDeriveBiDec( pFunc, nLeaves, MaskOne[0], MaskOne[1], pIfMan->
pPars->
nLutSize/2, &uTruth[0], &uTruth[1] );
1955 uTruth[0] = fOrDec ? ~uTruth[0] : uTruth[0];
1956 uTruth[1] = fOrDec ? ~uTruth[1] : uTruth[1];
1957 for ( c = 0; c < 2; c++ )
1959 Vec_IntClear( vLeaves2 );
1960 for ( k = 0; k < nLeaves; k++ )
1961 if ( (MaskOne[c] >> k) & 1 )
1962 Vec_IntPush( vLeaves2, Vec_IntEntry(vLeaves, k) );
1963 assert( Vec_IntSize(vLeaves2) >= 1 );
1964 iLitCofs[c] =
Kit_TruthToGia( pNew, (
unsigned *)&uTruth[c], Vec_IntSize(vLeaves2), vCover, vLeaves2, 0 );
1965 if ( Vec_IntSize(vLeaves2) == 1 )
1968 assert( Gia_ObjIsAnd(Gia_ManObj(pNew, Abc_Lit2Var(iLitCofs[c]))) );
1969 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLitCofs[c]), Vec_IntSize(vMapping2) );
1970 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) );
1972 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1973 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[c]) );
1975 iLitCofs[0] = Abc_LitNotCond( iLitCofs[0], fOrDec );
1976 iLitCofs[1] = Abc_LitNotCond( iLitCofs[1], fOrDec );
1977 RetValue = Gia_ManAppendAnd( pNew, iLitCofs[0], iLitCofs[1] );
1978 RetValue = Abc_LitNotCond( RetValue, fOrDec ^ Abc_LitIsCompl(pCutBest->
iCutFunc) );
1980 Vec_IntSetEntry( vMapping, Abc_Lit2Var(RetValue), Vec_IntSize(vMapping2) );
1981 Vec_IntPush( vMapping2, 2 );
1982 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[0]) );
1983 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[1]) );
1984 Vec_IntPush( vMapping2, -Abc_Lit2Var(RetValue) );
1985 RetValue = Abc_LitNotCond( RetValue, pCutBest->
fCompl );
2002 int fWriteConfigs = 1;
2006 Vec_Int_t * vMapping, * vMapping2, * vPacking = NULL, * vConfigs = NULL;
2007 Vec_Int_t * vLeaves, * vLeaves2, * vCover, * vLits;
2016 vMapping = Vec_IntStart( If_ManObjNum(pIfMan) );
2017 vMapping2 = Vec_IntStart( 1 );
2020 vPacking = Vec_IntAlloc( 1000 );
2021 Vec_IntPush( vPacking, 0 );
2027 int nConfigInts = Abc_BitWordNum(nTtBitNum + nPermBitNum + 1);
2028 vConfigs = Vec_IntAlloc( 1000 );
2029 Vec_IntPush( vConfigs, 0 );
2030 Vec_IntPush( vConfigs, nConfigInts );
2031 if ( fWriteConfigs )
2032 vConfigsStr = Vec_StrAlloc( 1000 );
2037 vLits = Vec_IntAlloc( 1000 );
2038 vCover = Vec_IntAlloc( 1 << 16 );
2039 vLeaves = Vec_IntAlloc( 16 );
2040 vLeaves2 = Vec_IntAlloc( 16 );
2044 if ( pIfObj->
nRefs == 0 && !If_ObjIsTerm(pIfObj) )
2046 if ( If_ObjIsAnd(pIfObj) )
2048 pCutBest = If_ObjCutBest( pIfObj );
2056 Vec_IntClear( vLeaves );
2058 Vec_IntPush( vLeaves, pIfLeaf->
iCopy );
2090 int truthId = Abc_Lit2Var(pCutBest->
iCutFunc);
2091 int Mask = Vec_IntEntry(pIfMan->
vTtDecs[pCutBest->
nLeaves], truthId);
2111 word * pTruth = If_CutTruthW(pIfMan, pCutBest);
2113 for ( k = 0; k < (int)pCutBest->
nLeaves; k++ )
2114 if ( If_CutLeafBit(pCutBest, k) )
2115 Abc_TtFlip( pTruth, Abc_TtWordNum(pCutBest->
nLeaves), k );
2117 pIfObj->
iCopy =
Gia_ManFromIfLogicNode( pIfMan, pNew, i, vLeaves, vLeaves2, pTruth, pIfMan->
pPars->
pLutStruct, vCover, vMapping, vMapping2, vPacking, (pIfMan->
pPars->
fEnableCheck75 || pIfMan->
pPars->
fEnableCheck75u), pIfMan->
pPars->
fEnableCheck07 );
2119 if ( vConfigs && Vec_IntSize(vLeaves) > 1 && !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(pIfObj->
iCopy))) && pIfObj->
iCopy > 1 )
2126 Vec_IntSetEntry( vMapping, Abc_Lit2Var(pIfObj->
iCopy), Vec_IntSize(vMapping2) );
2127 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
2129 assert( Abc_Lit2Var(Entry) < Abc_Lit2Var(pIfObj->
iCopy) );
2131 Vec_IntPush( vMapping2, Abc_Lit2Var(Entry) );
2132 Vec_IntPush( vMapping2, Abc_Lit2Var(pIfObj->
iCopy) );
2135 else if ( If_ObjIsCi(pIfObj) )
2136 pIfObj->
iCopy = Gia_ManAppendCi(pNew);
2137 else if ( If_ObjIsCo(pIfObj) )
2138 pIfObj->
iCopy = Gia_ManAppendCo( pNew, Abc_LitNotCond(If_ObjFanin0(pIfObj)->iCopy, If_ObjFaninC0(pIfObj)) );
2139 else if ( If_ObjIsConst1(pIfObj) )
2143 Vec_IntWriteEntry( vMapping, 0, Vec_IntSize(vMapping2) );
2144 Vec_IntPush( vMapping2, 0 );
2145 Vec_IntPush( vMapping2, 0 );
2149 Vec_IntFree( vLits );
2150 Vec_IntFree( vCover );
2151 Vec_IntFree( vLeaves );
2152 Vec_IntFree( vLeaves2 );
2162 if ( Vec_IntSize(vMapping) > Gia_ManObjNum(pNew) )
2163 Vec_IntShrink( vMapping, Gia_ManObjNum(pNew) );
2165 Vec_IntFillExtra( vMapping, Gia_ManObjNum(pNew), 0 );
2166 assert( Vec_IntSize(vMapping) == Gia_ManObjNum(pNew) );
2169 Vec_IntAddToEntry( vMapping, i, Gia_ManObjNum(pNew) );
2170 Vec_IntAppend( vMapping, vMapping2 );
2171 Vec_IntFree( vMapping2 );
2181 assert( !vConfigs || Vec_IntSize(vConfigs) == 2 + Vec_IntEntry(vConfigs, 0) * Vec_IntEntry(vConfigs, 1) );
2186 assert( !Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) || Gia_ObjIsLut(pNew, Gia_ObjFaninId0p(pNew, pObj)) );
2193 assert( !Gia_ObjIsAnd(pFanin) || Gia_ObjIsLut(pNew, Gia_ObjId(pNew, pFanin)) );
2199 assert( !Gia_ObjIsLut(pNew, Gia_ObjId(pNew, pObj)) );
2204 FILE * pFile;
int status;
2205 char * pStr, Buffer[1000] = {0};
2207 sprintf( Buffer,
"%s_configs.txt", pNameGen );
2209 pFile = fopen( Buffer,
"wb" );
2210 if ( pFile == NULL )
2212 Vec_StrFree( vConfigsStr );
2213 printf(
"Cannot open file \"%s\".\n", Buffer );
2216 Vec_StrPush( vConfigsStr,
'\0' );
2217 pStr = Vec_StrArray(vConfigsStr);
2218 status = fwrite( pStr,
strlen(pStr), 1, pFile );
2219 Vec_StrFree( vConfigsStr );
2221 printf(
"Finished dumping configs into file \"%s\".\n", Buffer );
2240 int Id, iFan, k, Result = 1;
2241 if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
2243 Gia_ObjSetTravIdCurrent(
p, pObj);
2244 if ( !Gia_ObjIsAndNotBuf(pObj) )
2246 if ( !Gia_ObjIsLut(
p, Gia_ObjId(
p, pObj)) )
2248 Abc_Print( -1,
"Gia_ManMappingVerify: Internal node %d does not have mapping.\n", Gia_ObjId(
p, pObj) );
2251 Id = Gia_ObjId(
p, pObj);
2261 assert( Gia_ManHasMapping(
p) );
2265 pFanin = Gia_ObjFanin0(pObj);
2266 if ( !Gia_ObjIsAndNotBuf(pFanin) )
2268 if ( !Gia_ObjIsLut(
p, Gia_ObjId(
p, pFanin)) )
2270 Abc_Print( -1,
"Gia_ManMappingVerify: Buffer driver %d does not have mapping.\n", Gia_ObjId(
p, pFanin) );
2278 pFanin = Gia_ObjFanin0(pObj);
2279 if ( !Gia_ObjIsAndNotBuf(pFanin) )
2281 if ( !Gia_ObjIsLut(
p, Gia_ObjId(
p, pFanin)) )
2283 Abc_Print( -1,
"Gia_ManMappingVerify: CO driver %d does not have mapping.\n", Gia_ObjId(
p, pFanin) );
2308 int i, k, iFan, iPlace;
2309 if ( !Gia_ManHasMapping(pGia) )
2312 Vec_IntFreeP( &
p->vMapping );
2313 p->vMapping = Vec_IntAlloc( 2 * Gia_ManObjNum(
p) );
2314 Vec_IntFill(
p->vMapping, Gia_ManObjNum(
p), 0 );
2317 if ( Gia_ObjValue(Gia_ManObj(pGia, i)) == ~0 )
2319 assert( !Abc_LitIsCompl(Gia_ObjValue(Gia_ManObj(pGia, i))) );
2320 pObj = Gia_ManObj(
p, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, i))) );
2321 Vec_IntWriteEntry(
p->vMapping, Gia_ObjId(
p, pObj), Vec_IntSize(
p->vMapping) );
2322 iPlace = Vec_IntSize(
p->vMapping );
2323 Vec_IntPush(
p->vMapping, Gia_ObjLutSize(pGia, i) );
2326 if ( Gia_ObjValue(Gia_ManObj(pGia, iFan)) == ~0 )
2327 Vec_IntAddToEntry(
p->vMapping, iPlace, -1 );
2329 Vec_IntPush(
p->vMapping, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, iFan))) );
2331 iFan = Abc_Lit2Var( Gia_ObjValue(Gia_ManObj(pGia, Abc_AbsInt(Gia_ObjLutMuxId(pGia, i)))) );
2332 Vec_IntPush(
p->vMapping, Gia_ObjLutIsMux(pGia, i) ? -iFan : iFan );
2340 int i, k, Entry, nEntries, nEntries2;
2343 nEntries = Vec_IntEntry( pGia->
vPacking, 0 );
2346 vPackingNew = Vec_IntAlloc( Vec_IntSize(pGia->
vPacking) );
2347 Vec_IntPush( vPackingNew, nEntries );
2350 assert( Entry > 0 && Entry < 4 );
2351 Vec_IntPush( vPackingNew, Entry );
2353 for ( k = 0; k < Entry; k++, i++ )
2355 pObj = Gia_ManObj(pGia, Vec_IntEntry(pGia->
vPacking, i));
2356 pObjNew = Gia_ManObj(
p, Abc_Lit2Var(Gia_ObjValue(pObj)));
2357 assert( Gia_ObjIsLut(pGia, Gia_ObjId(pGia, pObj)) );
2358 assert( Gia_ObjIsLut(
p, Gia_ObjId(
p, pObjNew)) );
2359 Vec_IntPush( vPackingNew, Gia_ObjId(
p, pObjNew) );
2365 assert( nEntries == nEntries2 );
2367 assert(
p->vPacking == NULL );
2368 p->vPacking = vPackingNew;
2424 if ( pArrivals == NULL )
2425 { printf(
"Arrival times are not given.\n" );
return; }
2427 { printf(
"ABC framework is not initialized by calling Abc_Start().\n" );
return; }
2430 { printf(
"Current network in ABC framework is not defined.\n" );
return; }
2431 Vec_IntFreeP( &pGia->
vCiArrs );
2432 pGia->
vCiArrs = Vec_IntAllocArrayCopy( pArrivals, Gia_ManCiNum(pGia) );
2437 if ( pRequireds == NULL )
2438 { printf(
"Required times are not given.\n" );
return; }
2440 { printf(
"ABC framework is not initialized by calling Abc_Start().\n" );
return; }
2443 { printf(
"Current network in ABC framework is not defined.\n" );
return; }
2444 Vec_IntFreeP( &pGia->
vCoReqs );
2445 pGia->
vCoReqs = Vec_IntAllocArrayCopy( pRequireds, Gia_ManCoNum(pGia) );
2452 { printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
return NULL; }
2455 { printf(
"Current network in ABC framework is not defined.\n" );
return NULL; }
2457 { printf(
"Current network in ABC framework has no CO arrival times.\n" );
return NULL; }
2458 vArrs = Vec_IntDup( pGia->
vCoArrs );
2459 pArrs = Vec_IntReleaseArray( vArrs );
2460 Vec_IntFree( vArrs );
2467 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
2470 printf(
"Current network in ABC framework is not defined.\n" );
2494 assert( Vec_IntSize(
p->vCiArrs) == Gia_ManCiNum(
p) );
2510 assert( Vec_IntSize(
p->vCoReqs) == Gia_ManCoNum(
p) );
2525 Vec_IntFreeP( &
p->vConfigs );
2531 if ( pIfMan == NULL )
2546 if (
p->pManTime == NULL )
2549 Abc_Print( 0,
"Switching activity computation for designs with boxes is disabled.\n" );
2558 assert( If_ManCoNum(pIfMan) == Vec_IntSize(
p->vCoAttrs) );
2560 If_ObjFanin0( If_ManCo(pIfMan, i) )->fSpec = (Entry != 0);
2574 if (
p->vCiArrs ||
p->vCoReqs )
2577 Vec_IntFreeP( &
p->vCoArrs );
2578 p->vCoArrs = Vec_IntAlloc( Gia_ManCoNum(
p) );
2580 Vec_IntPush(
p->vCoArrs, (
int)If_ObjArrTime(If_ObjFanin0(pIfObj)) );
2585 pNew->
pName = Abc_UtilStrsav(
p->pName );
2587 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2627 if ( ((
If_Par_t *)pp)->fHashMapping )
2673 pNew->
pName = Abc_UtilStrsav(
p->pName );
2674 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2706 pNew->
pName = Abc_UtilStrsav(
p->pName );
2707 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2726 int LutCount[8] = {0}, LutNDecomp[8] = {0};
2727 int i, k, iFan, nFanins, Status;
2731 vLeaves = Vec_IntAlloc( 100 );
2735 nFanins = Gia_ObjLutSize(
p, i);
2737 LutCount[Abc_MaxInt(nFanins, 5)]++;
2740 Vec_IntClear( vLeaves );
2742 Vec_IntPush( vLeaves, iFan );
2748 LutNDecomp[nFanins]++;
2749 if ( LutNDecomp[nFanins] > 10 )
2755 printf(
"LUT5 = %d ", LutCount[5] );
2756 printf(
"LUT6 = %d NonDec = %d (%.2f %%) ", LutCount[6], LutNDecomp[6], 100.0 * LutNDecomp[6]/Abc_MaxInt(LutCount[6], 1) );
2757 printf(
"LUT7 = %d NonDec = %d (%.2f %%) ", LutCount[7], LutNDecomp[7], 100.0 * LutNDecomp[7]/Abc_MaxInt(LutCount[7], 1) );
2778 assert( Gia_ManHasMapping(
p) );
2781 pNew->
pName = Abc_UtilStrsav(
p->pName );
2782 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
2785 Gia_ManConst0(
p)->Value = 0;
2787 pObj->
Value = Gia_ManAppendCi( pNew );
2791 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2795 vMapping = Vec_IntAlloc( Vec_IntSize(
p->vMapping) );
2796 Vec_IntFill( vMapping, Gia_ManObjNum(
p), 0 );
2799 pObj = Gia_ManObj(
p, i );
2800 Vec_IntWriteEntry( vMapping, Abc_Lit2Var(pObj->
Value), Vec_IntSize(vMapping) );
2801 Vec_IntPush( vMapping, Gia_ObjLutSize(
p, i) );
2803 Vec_IntPush( vMapping, Abc_Lit2Var(pFanin->
Value) );
2804 Vec_IntPush( vMapping, Abc_Lit2Var(pObj->
Value) );
void If_ManComputeSwitching(If_Man_t *pIfMan)
FUNCTION DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_CONST(number)
PARAMETERS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
int acd_decompose(word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned char *decomposition)
ABC_DLL void * Abc_FrameReadManDsd2()
ABC_DLL void Abc_FrameSetManDsd2(void *pMan)
ABC_DLL void * Abc_FrameReadManDsd()
ABC_DLL Gia_Man_t * Abc_FrameReadGia(Abc_Frame_t *p)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
int Gia_ManLutFaninCount(Gia_Man_t *p)
int Gia_ManFromIfLogicNode(void *pIfMan, Gia_Man_t *pNew, int iObj, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, word *pRes, char *pStr, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking, int fCheck75, int fCheck44e)
void Gia_ManCollectLuts_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vLuts)
void Gia_ManPrintMappingStats(Gia_Man_t *p, char *pDumpFile)
int Gia_ManComputeOverlap2One(Gia_Man_t *p, int iObj, Vec_Str_t *vLabel, Vec_Int_t *vVisit)
int Gia_ManBuildFromMini(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCut, Vec_Int_t *vLeaves, Vec_Int_t *vAig, int fHash, int fUseDsd)
void Abc_FrameMiniAigSetAndGateDelay(Abc_Frame_t *pAbc, int Delay)
int Gia_ManMappingVerify_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
void Gia_ManSetRefsMapped(Gia_Man_t *p)
int Gia_ManNodeIfToGia_rec(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Ptr_t *vVisited, int fHash)
int Gia_ManLutLevel(Gia_Man_t *p, int **ppLevels)
void Gia_ManPrintNodeProfile(int *pCounts, int nSizeMax)
void Gia_ManLutParams(Gia_Man_t *p, int *pnCurLuts, int *pnCurEdges, int *pnCurLevels)
Gia_Man_t * Gia_ManPerformMapping(Gia_Man_t *p, void *pp)
Gia_Man_t * Gia_ManFromIfLogic(If_Man_t *pIfMan)
int Gia_ManFromIfLogicHop(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
int Gia_ManFromIfLogicFindCell(If_Man_t *pIfMan, Gia_Man_t *pNew, Gia_Man_t *pTemp, If_Cut_t *pCutBest, Ifn_Ntk_t *pNtkCell, int nLutMax, Vec_Int_t *vLeaves, Vec_Int_t *vLits, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vConfigs)
int Gia_ManFromIfLogicCreateLutSpecial(Gia_Man_t *pNew, word *pRes, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking)
int Gia_ManBuildFromMiniInt(Gia_Man_t *pNew, Vec_Int_t *vLeaves, Vec_Int_t *vAig, int fHash)
void Gia_ManPrintPackingStats(Gia_Man_t *p)
void Abc_FrameMiniAigSetCiArrivals(Abc_Frame_t *pAbc, int *pArrivals)
void Gia_ManPrintLutStats(Gia_Man_t *p)
void If_ManCheckChoices(If_Man_t *pIfMan)
int Gia_ManFromIfLogicAndVars(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeaves2, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
int Gia_ManNodeIfToGia(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Int_t *vLeaves, int fHash)
int Gia_ManFromIfLogicCreateLut(Gia_Man_t *pNew, word *pRes, Vec_Int_t *vLeaves, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
int Abc_RecToGia3(Gia_Man_t *pMan, If_Man_t *pIfMan, If_Cut_t *pCut, Vec_Int_t *vLeaves, int fHash)
void Gia_ManSetIfParsDefault(void *pp)
FUNCTION DEFINITIONS ///.
int Gia_ManFromIfLogicCofVars(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeaves2, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
int * Abc_FrameMiniAigReadCoArrivals(Abc_Frame_t *pAbc)
int Gia_ManFromIfLogicFindLut(If_Man_t *pIfMan, Gia_Man_t *pNew, If_Cut_t *pCutBest, sat_solver *pSat, Vec_Int_t *vLeaves, Vec_Int_t *vLits, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking)
void Gia_ManPrintOutputLutStats(Gia_Man_t *p)
If_Man_t * Gia_ManToIf(Gia_Man_t *p, If_Par_t *pPars)
void If_ManCheckChoices_rec(If_Man_t *pIfMan, If_Obj_t *pIfObj)
int Gia_ManComputeOverlap2One_rec(Gia_Man_t *p, int iObj, Vec_Str_t *vLabel, Vec_Int_t *vVisit)
int Gia_ManComputeOverlap(Gia_Man_t *p)
int Gia_ManComputeOverlapOne(Gia_Man_t *p, int iObj)
int Gia_ManCountDupLut(Gia_Man_t *p)
Gia_Man_t * Gia_ManPerformDsdBalance(Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
int Gia_ManChoiceLevel(Gia_Man_t *p)
int Gia_ManLutSizeMax(Gia_Man_t *p)
void Gia_ManPrintGetMuxFanins(Gia_Man_t *p, Gia_Obj_t *pObj, int *pFanins)
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
int Gia_ManLutNum(Gia_Man_t *p)
void Gia_ManMappingVerify(Gia_Man_t *p)
Gia_Man_t * Gia_ManFromIfAig(If_Man_t *pIfMan)
int Gia_ManFromIfAig_rec(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj)
ABC_NAMESPACE_IMPL_START int Kit_TruthToGia(Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
DECLARATIONS ///.
int Gia_ManComputeOverlap2(Gia_Man_t *p)
Gia_Man_t * Gia_ManPerformMappingInt(Gia_Man_t *p, If_Par_t *pPars)
void Gia_ManChoiceLevel_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
void Gia_ManSetLutRefs(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupHashMapping(Gia_Man_t *p)
void Gia_ManFromIfGetConfig(Vec_Int_t *vConfigs, If_Man_t *pIfMan, If_Cut_t *pCutBest, int iLit, Vec_Str_t *vConfigsStr)
int Gia_ManCountLutLevels(Gia_Man_t *p, Vec_Int_t *vLuts, Vec_Int_t *vLevel)
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
int Gia_ManComputeOverlapOne_rec(Gia_Man_t *p, int iObj)
void Abc_FrameMiniAigSetCoRequireds(Abc_Frame_t *pAbc, int *pRequireds)
void Gia_ManTestStruct(Gia_Man_t *p)
Gia_Man_t * Gia_ManPerformSopBalance(Gia_Man_t *p, int nCutNum, int nRelaxRatio, int fVerbose)
void Gia_ManTransferPacking(Gia_Man_t *p, Gia_Man_t *pGia)
void Gia_ManIffTest(Gia_Man_t *pGia, If_LibLut_t *pLib, int fVerbose)
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
void Gia_ManStop(Gia_Man_t *p)
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
#define Gia_ManForEachBuf(p, pObj, i)
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
int Gia_ManIsNormalized(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
float Gia_ManDelayTraceLutPrint(Gia_Man_t *p, int fVerbose)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
void Gia_ManHashAlloc(Gia_Man_t *p)
Gia_Man_t * Gia_ManRehash(Gia_Man_t *p, int fAddStrash)
#define Gia_ManForEachLut(p, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
#define Gia_LutForEachFanin(p, i, iFan, k)
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObj1(p, pObj, i)
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
void Gia_ManCleanMark0(Gia_Man_t *p)
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
int Gia_ManLutLevelWithBoxes(Gia_Man_t *p)
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
void Gia_ManHashStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
void Gia_ManCleanMark01(Gia_Man_t *p)
#define Gia_LutForEachFaninObj(p, i, pFanin, k)
void Gia_ManMarkFanoutDrivers(Gia_Man_t *p)
void Gia_ManCollectAnds(Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
word If_Dec6Perform(word t, int fDerive)
void If_Dec6Verify(word t, word z)
int If_CluMinimumBase(word *t, int *pSupp, int nVarsAll, int *pnVars)
void If_ManCleanCutData(If_Man_t *p)
#define If_ManForEachObj(p, pObj, i)
unsigned If_DsdManCheckXY(If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fHighEffort, int fVerbose)
void If_ManCreateChoice(If_Man_t *p, If_Obj_t *pRepr)
If_Obj_t * If_ManCreateCo(If_Man_t *p, If_Obj_t *pDriver)
struct If_Par_t_ If_Par_t
int If_DsdManLutSize(If_DsdMan_t *p)
int If_CluCheckXXExt(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutRoot, char *pLut0, char *pLut1, word *pFunc0, word *pFunc1)
struct If_Cut_t_ If_Cut_t
int If_DsdManSuppSize(If_DsdMan_t *p, int iDsd)
char * If_DsdManGetCellStr(If_DsdMan_t *p)
int If_CutPerformCheck07(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
#define If_ManForEachCo(p, pObj, i)
void If_CutRotatePins(If_Man_t *p, If_Cut_t *pCut)
int If_ManSatDeriveGiaFromBits(void *pNew, Ifn_Ntk_t *p, word *pTtData, Vec_Int_t *vLeaves, Vec_Int_t *vValues)
word If_CutPerformDerive07(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
int If_CluCheckExt3(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutLeaf2, int nLutRoot, char *pLut0, char *pLut1, char *pLut2, word *pFunc0, word *pFunc1, word *pFunc2)
int If_DsdManVarNum(If_DsdMan_t *p)
int If_CutDsdBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
struct If_LibLut_t_ If_LibLut_t
word * If_DsdManGetFuncConfig(If_DsdMan_t *p, int iDsd)
void * If_ManSatBuildXY(int nLutSize)
DECLARATIONS ///.
void If_DsdManAllocIsops(If_DsdMan_t *p, int nLutSize)
struct If_DsdMan_t_ If_DsdMan_t
void If_ManSetDefaultPars(If_Par_t *pPars)
FUNCTION DECLARATIONS ///.
If_Obj_t * If_ManCreateAnd(If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1)
struct Ifn_Ntk_t_ Ifn_Ntk_t
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
If_DsdMan_t * If_DsdManAlloc(int nVars, int nLutSize)
void If_ManStop(If_Man_t *p)
int If_ManPerformMapping(If_Man_t *p)
#define IF_MAX_FUNC_LUTSIZE
int If_CluCheckExt(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutRoot, char *pLut0, char *pLut1, word *pFunc0, word *pFunc1)
int If_ManSatCheckXY(void *pSat, int nLutSize, word *pTruth, int nVars, unsigned uSet, word *pTBound, word *pTFree, Vec_Int_t *vLits)
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
#define If_ManForEachNode(p, pObj, i)
If_Man_t * If_ManStart(If_Par_t *pPars)
FUNCTION DEFINITIONS ///.
If_Obj_t * If_ManCreateCi(If_Man_t *p)
int If_DsdManPermBitNum(If_DsdMan_t *p)
int If_CutSopBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
struct If_Obj_t_ If_Obj_t
int If_DsdManTtBitNum(If_DsdMan_t *p)
unsigned __int64 word
DECLARATIONS ///.
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
void sat_solver_delete(sat_solver *s)
Vec_Str_t * vTtVars[IF_MAX_FUNC_LUTSIZE+1]
int nTruth6Words[IF_MAX_FUNC_LUTSIZE+1]
Vec_Int_t * vTtDecs[IF_MAX_FUNC_LUTSIZE+1]
int(* pFuncCell2)(If_Man_t *, word *, int, Vec_Str_t *, char **)
int(* pFuncWrite)(If_Man_t *)
int Tim_ManBoxNum(Tim_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.