56 char * pThis, pLine[1000];
58 FILE * pFile = fopen( pFileName,
"rb" );
61 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
64 vRes = Vec_WecAlloc(100);
65 for ( iLine = 0; fgets( pLine, 1000, pFile ); iLine++ )
69 pThis =
strstr( pLine,
"[" );
70 *pnIns = atoi( pThis+1 ) + 1;
71 pThis =
strstr( pThis+1,
"[" );
72 *pnOuts = atoi( pThis+1 ) + 1;
77 for ( pThis = pLine; (pThis =
strstr(pThis,
"M0[")); pThis++ )
80 vLevel = Vec_WecPushLevel( vRes );
81 Vec_IntPush( vLevel, atoi( pThis+3 ) );
84 Vec_IntReverseOrder( vLevel );
93 int i,
nWords = Abc_TtWordNum( nIns );
95 if ( pBuffer == NULL )
97 printf(
"Cannot read file \"%s\".\n", pFileName );
101 for ( i = 0; i < nOuts; i++ )
103 pStart =
strstr( pStart + 1,
"0x" );
106 printf(
"Cannot read truth table %d (out of %d) in file \"%s\".\n", i, nOuts, pFileName );
117 int i,
nWords = Abc_TtWordNum( nIns );
119 for ( i = 0; i < nFiles; i++ )
122 strcpy( FileName, pFileName );
137 int i, k, nIns, nOuts, iLit;
139 int nBitsI = vRes ? Vec_WecMaxLevelSize(vRes) : 0;
140 int nBitsO = vRes ? nOuts / Vec_WecSize(vRes) : 0;
141 int nWords = Abc_TtWordNum(nBitsI);
143 Vec_Int_t * vPart, * vLits = Vec_IntAlloc( nOuts );
144 if ( vRes == NULL || pFuncs == NULL )
146 Vec_WecFreeP( &vRes );
147 Vec_IntFreeP( &vLits );
151 assert( nOuts % Vec_WecSize(vRes) == 0 );
153 pNew->
pName = Abc_UtilStrsav( pFileName );
155 for ( i = 0; i < nIns; i++ )
156 Gia_ManAppendCi(pNew);
160 assert( Vec_IntSize(vPart) <= nBitsI );
163 Gia_ManConst0(pPart)->Value = 0;
165 pObj->
Value = Abc_Var2Lit( 1+Vec_IntEntry(vPart, k), 0 );
169 Vec_IntPush( vLits, Gia_ObjFanin0Copy(pObj) );
175 Gia_ManAppendCo( pNew, iLit );
178 Vec_IntFree( vLits );
195 int i, nSize, iLine, nLines,
nWords;
198 FILE * pFile = fopen( pFileName,
"rb" );
201 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
205 nSize = ftell( pFile );
206 if ( nSize % (nIns + nOuts + 1) > 0 )
208 printf(
"Cannot read file with simulation data that is not aligned at 8 bytes (remainder = %d).\n", nSize % (nIns + nOuts + 1) );
213 nLines = nSize / (nIns + nOuts + 1);
214 nWords = (nLines + 63)/64;
215 vSimI = Vec_WrdStart( nIns *
nWords );
216 vSimO = Vec_WrdStart( nOuts*
nWords );
217 for ( iLine = 0; fgets( pLine, 2000, pFile ); iLine++ )
219 for ( i = 0; i < nIns; i++ )
220 if ( pLine[nIns-1-i] ==
'1' )
221 Abc_TtXorBit( Vec_WrdArray(vSimI) + i*
nWords, iLine );
222 else assert( pLine[nIns-1-i] ==
'0' );
223 for ( i = 0; i < nOuts; i++ )
224 if ( pLine[nIns+nOuts-1-i] ==
'1' )
225 Abc_TtXorBit( Vec_WrdArray(vSimO) + i*
nWords, iLine );
226 else assert( pLine[nIns+nOuts-1-i] ==
'0' );
231 printf(
"Read %d words of simulation data for %d inputs and %d outputs (padded %d zero-patterns).\n",
nWords, nIns, nOuts,
nWords*64-nLines );
235 int i, nSize, iLine, nLines,
nWords, nIns;
238 FILE * pFile = fopen( pFileName,
"rb" );
241 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
244 if ( !fgets(pLine, 2000, pFile) || (nIns =
strlen(pLine)-1) < 1 )
246 printf(
"Cannot find the number of inputs in file \"%s\".\n", pFileName );
251 nSize = ftell( pFile );
252 if ( nSize % (nIns + 1) > 0 )
254 printf(
"Cannot read file with simulation data that is not aligned at 8 bytes (remainder = %d).\n", nSize % (nIns + 1) );
259 nLines = nSize / (nIns + 1);
260 nWords = (nLines + 63)/64;
261 vSimI = Vec_WrdStart( nIns *
nWords );
262 for ( iLine = 0; fgets( pLine, 2000, pFile ); iLine++ )
264 for ( i = 0; i < nIns; i++ )
265 if ( pLine[nIns-1-i] ==
'1' )
266 Abc_TtXorBit( Vec_WrdArray(vSimI) + i*
nWords, iLine );
267 else assert( pLine[nIns-1-i] ==
'0' );
271 printf(
"Read %d words of simulation data for %d inputs (padded to 64-bit boundary with %d zero-patterns).\n",
nWords, nIns,
nWords*64-nLines );
278 FILE * pFile = fopen( pFileName,
"rb" );
281 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
284 vNums = Vec_IntAlloc( 1000 );
285 for ( iLine = 0; fgets( pLine, 1000, pFile ); iLine++ )
286 Vec_IntPush( vNums, atoi(pLine) );
289 printf(
"Finished reading %d output values from file \"%s\".\n", Vec_IntSize(vNums), pFileName );
294 int i, iLine, nLines,
nWords;
299 nLines = Vec_IntSize(vNums);
300 nWords = (nLines + 63)/64;
301 vSimO = Vec_WrdStart( nOuts*
nWords );
303 Abc_TtXorBit( Vec_WrdArray(vSimO) + i*
nWords, iLine );
304 Vec_IntFree( vNums );
305 printf(
"Read %d words of simulation data for %d outputs (padded %d zero-patterns).\n",
nWords, nOuts,
nWords*64-nLines );
312 Vec_WrdDumpBin( pFileOut1, vSimI, fVerbose );
313 Vec_WrdFree( vSimI );
318 Vec_WrdDumpBin( pFileOut, vSimO, 1 );
319 Vec_WrdFree( vSimO );
335 int z, nZones = Vec_WrdSize(
p)/ZoneSize;
336 int w, Limit = Abc_MinInt(
nWords, ZoneSize-iWord );
338 for ( z = 0; z < nZones; z++ )
339 for ( w = 0; w < Limit; w++ )
340 Vec_WrdWriteEntry( pNew, z*
nWords + w, Vec_WrdEntry(
p, z*ZoneSize + iWord + w) );
345 int z, nZones = Vec_WrdSize(pNew)/ZoneSize;
346 int w, Limit = Abc_MinInt(
nWords, ZoneSize-iWord );
347 for ( z = 0; z < nZones; z++ )
348 for ( w = 0; w < Limit; w++ )
349 Vec_WrdWriteEntry( pNew, z*ZoneSize + iWord + w, Vec_WrdEntry(
p, z*
nWords + w) );
366 for ( k = 0; k < nPats; k++ )
370 printf(
"%d", (
int)(Vec_WrdEntry(vSimsIn,
nWords*i) >> k) & 1 );
374 printf(
"%d", (
int)(Vec_WrdEntry(vSimsOut,
nWords*i) >> k) & 1 );
382 int nWords = Vec_WrdSize(vSimI) / Gia_ManCiNum(
p);
383 assert( Vec_WrdSize(vSimI) % Gia_ManCiNum(
p) == 0 );
390 int i, Count = 0,
nWords = Vec_WrdSize(vSimO) / Gia_ManCoNum(
p);
392 assert( Vec_WrdSize(vSimO) == Vec_WrdSize(vSimO_new) );
393 for ( i = 0; i < Gia_ManCoNum(
p); i++ )
395 word * pSimGold = Vec_WrdEntryP( vSimO, i *
nWords );
396 word * pSimImpl = Vec_WrdEntryP( vSimO_new, i *
nWords );
397 Abc_TtOrXor( pSim0, pSimImpl, pSimGold,
nWords );
399 Count = Abc_TtCountOnesVec( pSim0,
nWords );
400 printf(
"Number of failed patterns is %d (%8.4f %% of %d). The first one is %d.\n",
407 int i, Count = 0,
nWords = Vec_WrdSize(vSimO) / Gia_ManCoNum(
p);
409 assert( Vec_WrdSize(vSimO) == Vec_WrdSize(vSimO_new) );
410 for ( i = 0; i < Gia_ManCoNum(
p); i++ )
412 word * pSimGold = Vec_WrdEntryP( vSimO, i *
nWords );
413 word * pSimImpl = Vec_WrdEntryP( vSimO_new, i *
nWords );
414 Abc_TtXor( pSim0, pSimImpl, pSimGold,
nWords, 0 );
415 Count += Abc_TtCountOnesVec( pSim0,
nWords );
417 printf(
"Number of failed patterns is %d (%8.4f %% of %d). The first one is %d.\n",
418 Count, 100.0*Count/(64*
nWords*Gia_ManCoNum(
p)), 64*
nWords*Gia_ManCoNum(
p), Abc_TtFindFirstBit2(pSim0,
nWords) );
424 int o, ValueMax = -1, OutMax = -1;
425 for ( o = 0; o < nOuts; o++ )
428 for ( i = 0; i < nBits; i++ )
430 word * pSim = Vec_WrdEntryP( vSimO, (o*nBits+i) *
nWords );
431 if ( Abc_TtGetBit(pSim, iPat) )
434 if ( ValueMax <= Value )
444 int i, Value, nOuts = Gia_ManCoNum(
p) / nBits;
445 int First = -1, Count = 0,
nWords = Vec_WrdSize(vSimO) / Gia_ManCoNum(
p);
446 assert( Gia_ManCoNum(
p) % nBits == 0 );
455 printf(
"The accuracy is %8.4f %% (%d out of %d output are correct, for example, output number %d).\n",
456 100.0*Count/Vec_IntSize(vValues), Count, Vec_IntSize(vValues), First );
459 FILE * pTable = fopen(
"stats.txt",
"a+" );
460 fprintf( pTable,
"%0.2f \n", 100.0*Count/Vec_IntSize(vValues) );
467 int nWords = Vec_WrdSize(vSimI) / Gia_ManCiNum(
p);
468 int w, nWordsOne = 200, nWordBatches = (
nWords + nWordsOne - 1)/nWordsOne;
470 for ( w = 0; w < nWordBatches; w++ )
476 Vec_WrdFree( vSimI_ );
477 Vec_WrdFree( vSimO_ );
486 printf(
"Total errors = %d. ", nResult );
487 printf(
"Density of output patterns %8.4f.\n", (
float)Abc_TtCountOnesVec(Vec_WrdArray(vSimO_new), Vec_WrdSize(vSimO_new))/(64*Vec_WrdSize(vSimO_new)) );
493 Vec_Wrd_t * vSimI = Vec_WrdReadBin( pFileName, fVerbose );
496 printf(
"Density of input patterns %8.4f.\n", (
float)Abc_TtCountOnesVec(Vec_WrdArray(vSimI), Vec_WrdSize(vSimI))/(64*Vec_WrdSize(vSimI)) );
498 printf(
"Density of output patterns %8.4f.\n", (
float)Abc_TtCountOnesVec(Vec_WrdArray(vSimO), Vec_WrdSize(vSimO))/(64*Vec_WrdSize(vSimO)) );
499 Vec_WrdDumpBin( pFileName2, vSimO, fVerbose );
500 Vec_WrdFree( vSimI );
501 Vec_WrdFree( vSimO );
503 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
508 Vec_Wrd_t * vSim1 = Vec_WrdReadBin( pFileName, fVerbose );
512 printf(
"Density of input patterns %8.4f.\n", (
float)Abc_TtCountOnesVec(Vec_WrdArray(vSim1), Vec_WrdSize(vSim1))/(64*Vec_WrdSize(vSim1)) );
514 Vec_WrdFree( vSim1 );
515 Vec_IntFree( vNums );
517 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
534 int i, k, nUsed = 0,
nGood = 0;
535 int nWords = Vec_WrdSize(vSimI) / Gia_ManCiNum(
p);
536 int nMints = 1 << Vec_IntSize(vSupp);
541 pSims[i] = Vec_WrdEntryP( vSimI, Gia_ObjCioId(pObj) *
nWords );
542 for ( k = 0; k < 64*
nWords; k++ )
545 for ( i = 0; i < Vec_IntSize(vSupp); i++ )
546 if ( Abc_TtGetBit(pSims[i], k) )
551 for ( k = 0; k < nMints; k++ )
553 nUsed += (pCounts[k] > 0);
554 nGood += (pCounts[k] >= Thresh);
555 if ( pCounts[k] >= Thresh )
556 Abc_TtXorBit( pRes, k );
559 if ( Vec_IntSize(vSupp) < 6 )
560 pRes[0] = Abc_Tt6Stretch( pRes[0], Vec_IntSize(vSupp) );
563 printf(
"Used %4d and good %4d (out of %4d).\n", nUsed,
nGood, nMints );
572 if ( !iObj || Gia_ObjIsTravIdCurrentId(
p, iObj) )
574 Gia_ObjSetTravIdCurrentId(
p, iObj);
575 pObj = Gia_ManObj(
p, iObj );
576 if ( Gia_ObjIsCi(pObj) )
578 assert( Gia_ObjIsAnd(pObj) );
581 for ( n = 0; n < 2; n++ )
583 Gia_Obj_t * pFanin = n ? Gia_ObjFanin1(pObj) : Gia_ObjFanin0(pObj);
584 if ( !Gia_ObjIsCi(pFanin) )
586 Vec_IntAddToEntry( vLevels, Gia_ObjCioId(pFanin), Gia_ObjLevel(
p, pObj) );
587 Vec_IntAddToEntry( vCounts, Gia_ObjCioId(pFanin), 1 );
592 Vec_Int_t * vLevels = Vec_IntStart( Gia_ManCiNum(
p) );
593 Vec_Int_t * vCounts = Vec_IntStart( Gia_ManCiNum(
p) );
594 int i, * pCost =
ABC_CALLOC(
int, Gia_ManCiNum(
p) );
597 for ( i = 0; i < nOuts; i++ )
600 pCost[i] = 10000 * Vec_IntEntry(vLevels, Gia_ObjCioId(pObj)) / Abc_MaxInt(1, Vec_IntEntry(vCounts, Gia_ObjCioId(pObj)));
601 Vec_IntFree( vCounts );
602 Vec_IntFree( vLevels );
603 Vec_IntSelectSortCost2( Vec_IntArray(vSupp), Vec_IntSize(vSupp), pCost );
604 assert( Vec_IntSize(vSupp) < 2 || pCost[0] <= pCost[1] );
610 if ( !iObj || Gia_ObjIsTravIdCurrentId(
p, iObj) )
612 Gia_ObjSetTravIdCurrentId(
p, iObj);
613 pObj = Gia_ManObj(
p, iObj );
614 if ( Gia_ObjIsCi(pObj) )
617 Vec_IntPush( vSupp, Gia_ObjId(
p, pObj) );
620 assert( Gia_ObjIsAnd(pObj) );
626 Vec_Int_t * vSupp = Vec_IntAlloc( 16 );
int i;
628 for ( i = 0; i < nOuts; i++ )
642 assert( Gia_ObjIsAnd(pObj) );
645 return pObj->
Value =
Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
654 Vec_Int_t * vMemory = Vec_IntAlloc( 1 << 18 );
655 Vec_Int_t * vLeaves = Vec_IntAlloc( nIns );
656 Vec_Wrd_t * vSimI = pFileName ? Vec_WrdReadBin( pFileName, fVerbose ) : NULL;
658 word * pTruth1 =
ABC_CALLOC(
word, Abc_Truth6WordNum(nIns) );
int g, k;
float CareAve = 0;
660 if ( vSimI && fVerbose )
663 printf(
"Density of input patterns %8.4f.\n", (
float)Abc_TtCountOnesVec(Vec_WrdArray(vSimI), Vec_WrdSize(vSimI))/(64*Vec_WrdSize(vSimI)) );
664 printf(
"Using patterns with count %d and higher as cares.\n", Thresh );
669 pNew->
pName = Abc_UtilStrsav(
p->pName );
670 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
671 Gia_ManConst0(
p)->Value = 0;
673 pObj->
Value = Gia_ManAppendCi(pNew);
676 for ( g = 0; g < Gia_ManCoNum(
p); g += nOuts )
679 int Care = 1 << Vec_IntSize(vSupp), Temp = fVerbose ? printf(
"Group %3d / %3d / %3d : Supp = %3d %s", g, nOuts, Gia_ManCoNum(
p), Vec_IntSize(vSupp), vSimI ?
"":
"\n" ) : 0;
681 int nWords = Abc_Truth6WordNum( Vec_IntSize(vSupp) );
682 CareAve += 100.0*Care/(1 << Vec_IntSize(vSupp));
683 assert( Vec_IntSize(vSupp) <= nIns );
684 Vec_IntClear( vLeaves );
686 Vec_IntPush( vLeaves, pObj->
Value );
687 for ( k = 0; k < nOuts; k++ )
691 Abc_TtSharp( pTruth0, pCare, pTruth,
nWords );
692 Abc_TtAnd( pTruth1, pCare, pTruth,
nWords, 0 );
695 Abc_TtCopy( pTruthsTry + (2*k+0)*
nWords, pTruth1,
nWords, 0 );
696 Abc_TtCopy( pTruthsTry + (2*k+1)*
nWords, pTruth0,
nWords, 0 );
699 Abc_TtCopy( pTruthsTry + k*
nWords, pTruth1,
nWords, 0 );
702 pObj->
Value =
Kit_TruthToGia2( pNew, (
unsigned *)pTruth0, (
unsigned *)pTruth1, Vec_IntSize(vLeaves), vMemory, vLeaves, 1 );
703 pObj->
Value ^= Gia_ObjFaninC0(pObj);
714 Gia_ManConst0(pMin)->Value = 0;
716 pObj->
Value = Vec_IntEntry( vLeaves, k );
717 for ( k = 0; k < nOuts; k++ )
720 Gia_Obj_t * pObj2 = Gia_ManCo( pMin, k );
722 pObj->
Value ^= Gia_ObjFaninC0(pObj2);
723 pObj->
Value ^= Gia_ObjFaninC0(pObj);
728 Vec_IntFree( vSupp );
731 CareAve /= Gia_ManCoNum(
p)/nOuts;
734 pObj->
Value = Gia_ManAppendCo( pNew, pObj->
Value );
738 Vec_IntFree( vLeaves );
739 Vec_IntFree( vMemory );
740 Vec_WrdFreeP( &vSimI );
742 printf(
"Using patterns with count %d and higher as cares. Average care set is %8.4f %%. ", Thresh, CareAve );
743 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
746 FILE * pTable = fopen(
"stats.txt",
"a+" );
747 fprintf( pTable,
"%0.2f ", CareAve );
758 Vec_Int_t * vLeaves = Vec_IntAlloc( nIns );
759 Vec_Wrd_t * vSimI = pFileName ? Vec_WrdReadBin( pFileName, fVerbose ) : NULL;
761 int k, g;
float CareAve = 0;
762 if ( vSimI && fVerbose )
765 printf(
"Density of input patterns %8.4f.\n", (
float)Abc_TtCountOnesVec(Vec_WrdArray(vSimI), Vec_WrdSize(vSimI))/(64*Vec_WrdSize(vSimI)) );
766 printf(
"Using patterns with count %d and higher as cares.\n", Thresh );
771 pNew->
pName = Abc_UtilStrsav(
p->pName );
772 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
773 Gia_ManConst0(
p)->Value = 0;
775 pObj->
Value = Gia_ManAppendCi(pNew);
778 for ( g = 0; g < Gia_ManCoNum(
p); g += nOuts )
780 for ( k = 0; k < nOuts; k++ )
781 if ( Gia_ObjIsAnd(Gia_ObjFanin0(Gia_ManCo(
p, g+k ))) )
785 for ( k = 0; k < nOuts; k++ )
788 pObj->
Value = Gia_ObjFanin0Copy(pObj);
796 int Care = 1 << Vec_IntSize(vSupp), Temp = fVerbose ? printf(
"Group %3d / %3d / %3d : Supp = %3d %s", g, nOuts, Gia_ManCoNum(
p), Vec_IntSize(vSupp), vSimI ?
"":
"\n" ) : 0;
798 int nWords = Abc_Truth6WordNum( Vec_IntSize(vSupp) );
799 CareAve += 100.0*Care/(1 << Vec_IntSize(vSupp));
800 assert( Vec_IntSize(vSupp) <= nIns );
801 Vec_IntClear( vLeaves );
803 Vec_IntPush( vLeaves, pObj->
Value );
804 for ( k = 0; k < nOuts; k++ )
808 Abc_TtCopy( pTruthsTry + k*
nWords, pTruth,
nWords, Gia_ObjFaninC0(pObj) );
810 Abc_TtCopy( pTruthsTry + nOuts*
nWords, pCare,
nWords, 0 );
814 Gia_ManConst0(pMin)->Value = 0;
816 pObj->
Value = Vec_IntEntry( vLeaves, k );
821 pObj0->
Value ^= Gia_ObjFaninC0(pObj);
824 Vec_IntFree( vSupp );
829 CareAve /= Gia_ManCoNum(
p)/nOuts;
832 pObj->
Value = Gia_ManAppendCo( pNew, pObj->
Value );
834 Vec_IntFree( vLeaves );
835 Vec_WrdFreeP( &vSimI );
837 printf(
"Using patterns with count %d and higher as cares. Average care set is %8.4f %%. ", Thresh, CareAve );
838 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
841 FILE * pTable = fopen(
"stats.txt",
"a+" );
842 fprintf( pTable,
"%0.2f ", CareAve );
866 Jf_Par_t Pars, * pPars = &Pars;
int c, nIters = 2;
873 for ( c = 0; c < nIters; c++ )
889 extern int Abc_NtkBddToMuxesPerformGlo(
Abc_Ntk_t * pNtk,
Abc_Ntk_t * pNtkNew,
int Limit,
int fReorder,
int fUseAdd );
897 if ( Abc_NtkBddToMuxesPerformGlo( pNtk, pNtkNew, 1000000, fReorder, 0 ) )
907int Gia_ManDoTest1(
Gia_Man_t *
p,
int fReorder )
910 pNew = Gia_ManDoMuxTransform(
p, fReorder );
911 pNew = Gia_ManDoMuxMapping( pTemp = pNew );
922 pNew = fTryNew ?
Gia_ManDup(
p) : Gia_ManDoMuxTransform(
p, fReorder );
923 pNew = Gia_ManDoMuxMapping( pTemp = pNew );
931Abc_Ntk_t * Abc_NtkMapTransform(
Gia_Man_t *
p,
int nOuts,
int fUseFixed,
int fTryNew,
int fVerbose )
934 int i, k, g, nGroups = Gia_ManCoNum(
p) / nOuts, CountsAll[3] = {0};
937 assert( Gia_ManCoNum(
p) % nOuts == 0 );
942 Abc_NtkCreatePi( pNtkNew );
944 Abc_NtkCreatePo( pNtkNew );
946 for ( g = 0; g < nGroups; g++ )
950 int pPos[64], Counter = 0, Counts[3] = {0};
951 for ( i = 0; i < nOuts; i++ )
955 pNtkMap = Gia_ManDoTest2( pNew, 1, fTryNew );
969 Abc_NtkCi(pNtkMap, Counter++)->pCopy = Abc_NtkCi(pNtkNew, i);
970 assert( Counter == Abc_NtkCiNum(pNtkMap) );
983 Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, g*nOuts+i), Abc_ObjFanin0(pObjNew)->pCopy );
988 printf(
"%3d / %3d : ", g, nGroups );
989 printf(
"Test = %4d ", Counts[0] );
990 printf(
"MarkA = %4d ", Counts[1] );
991 printf(
"MarkB = %4d ", Counts[2] );
995 CountsAll[0] += Counts[0];
996 CountsAll[1] += Counts[1];
997 CountsAll[2] += Counts[2];
1000 printf(
"Total LUT count = %5d. MarkA = %5d. MarkB = %5d.\n", CountsAll[0], CountsAll[1], CountsAll[2] );
1007 Abc_Print( 1,
"Abc_NtkFromMappedGia(): Network check has failed.\n" );
1014 int Res1, Res2, Result = 0;
1015 int g, nGroups = Gia_ManCoNum(
p) / GroupSize;
1016 assert( Gia_ManCoNum(
p) % GroupSize == 0 );
1017 assert( GroupSize <= 64 );
1020 for ( g = 0; g < nGroups; g++ )
1024 for ( o = 0; o < GroupSize; o++ )
1025 pPos[o] = g*GroupSize+o;
1027 printf(
"%3d / %3d : ", g, nGroups );
1028 printf(
"Test1 = %4d ", Res1 = Gia_ManDoTest1(pNew, 0) );
1029 printf(
"Test2 = %4d ", Res2 = Gia_ManDoTest1(pNew, 1) );
1030 printf(
"Test = %4d ", Abc_MinInt(Res1, Res2) );
1032 Result += Abc_MinInt(Res1, Res2);
1036 printf(
"Total LUT count = %d.\n", Result );
1040 return Abc_NtkMapTransform(
p, GroupSize, fUseFixed, fTryNew, fVerbose );
Abc_Ntk_t * Abc_NtkFromMappedGia(Gia_Man_t *p, int fFindEnables, int fUseBuffs)
Abc_Ntk_t * Abc_NtkSpecialMapping(Abc_Ntk_t *pNtk, int fVerbose)
Gia_Man_t * Abc_NtkStrashToGia(Abc_Ntk_t *pNtk)
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL Abc_Ntk_t * Abc_NtkBddToMuxes(Abc_Ntk_t *pNtk, int fGlobal, int Limit, int fUseAdd)
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
ABC_DLL void Abc_NtkAddDummyBoxNames(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
#define Abc_ObjForEachFanin(pObj, pFanin, i)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkToSop(Abc_Ntk_t *pNtk, int fMode, int nCubeLimit)
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_FALLOC(type, num)
#define ABC_ALLOC(type, num)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManStop(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void * Dsm_ManDeriveGia(void *p, int fUseMuxes)
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Vec_Wrd_t * Gia_ManSimulateWordsOut(Gia_Man_t *p, Vec_Wrd_t *vSimsIn)
Gia_Man_t * Gia_ManPerformMfs(Gia_Man_t *p, Sfm_Par_t *pPars)
Gia_Man_t * Gia_TryPermOpt(word *pTruths, int nIns, int nOuts, int nWords, int nRounds, int fVerbose)
Gia_Man_t * Gia_TryPermOptCare(word *pTruths, int nIns, int nOuts, int nWords, int nRounds, int fVerbose)
Gia_Man_t * Gia_TryPermOptNew(word *pTruths, int nIns, int nOuts, int nWords, int nRounds, int fVerbose)
void Gia_ManSimInfoEval(Gia_Man_t *p, char *pFileName, char *pFileName2, int nOuts, int fVerbose)
void Vec_WrdZoneInsert(Vec_Wrd_t *pNew, int ZoneSize, Vec_Wrd_t *p, int iWord, int nWords)
void Gia_ManReadSimInfoOutputs(char *pFileName, char *pFileOut, int nOuts)
void Vec_WrdReadText(char *pFileName, Vec_Wrd_t **pvSimI, Vec_Wrd_t **pvSimO, int nIns, int nOuts)
Gia_Man_t * Vec_WrdReadTest(char *pFileName)
Vec_Wrd_t * Vec_WrdReadTextOut(char *pFileName, int nOuts)
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
DECLARATIONS ///.
Vec_Wec_t * Vec_WrdReadLayerText(char *pFileName, int *pnIns, int *pnOuts)
FUNCTION DEFINITIONS ///.
int Vec_WrdReadTruthTextOne(char *pFileName, int nIns, int nOuts, word *pRes)
void Gia_ManSimInfoPassTest(Gia_Man_t *p, char *pFileName, char *pFileName2, int fVerbose)
Vec_Int_t * Gia_ManCollectSupp(Gia_Man_t *p, int iOut, int nOuts)
Abc_Ntk_t * Gia_ManPerformLNetMap(Gia_Man_t *p, int GroupSize, int fUseFixed, int fTryNew, int fVerbose)
int Gia_ManSimEvalOne2(Gia_Man_t *p, Vec_Wrd_t *vSimO, Vec_Wrd_t *vSimO_new)
Gia_Man_t * Gia_ManPerformLNetOptNew(Gia_Man_t *p, char *pFileName, int nIns, int nOuts, int Thresh, int nRounds, int fVerbose)
int Vec_WrdReadText2(char *pFileName, Vec_Wrd_t **pvSimI)
int Gia_ManSimInfoEval_old(Gia_Man_t *p, Vec_Wrd_t *vSimO, Vec_Wrd_t *vSimO_new)
Vec_Wrd_t * Gia_ManSimInfoTry(Gia_Man_t *p, Vec_Wrd_t *vSimI)
Vec_Wrd_t * Gia_ManSimInfoTryOne(Gia_Man_t *p, Vec_Wrd_t *vSimI, int fPrint)
Gia_Man_t * Gia_ManPerformLNetOpt(Gia_Man_t *p, int fTryNew, char *pFileName, int nIns, int nOuts, int Thresh, int nRounds, int fVerbose)
Vec_Int_t * Gia_ManCollectSuppNew(Gia_Man_t *p, int iOut, int nOuts)
void Gia_ManPermuteSupp_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vLevels, Vec_Int_t *vCounts)
Vec_Int_t * Vec_WrdReadNumsOut(char *pFileName, int fVerbose)
void Gia_ManReadSimInfoInputs(char *pFileName, char *pFileOut1, int fVerbose)
void Gia_ManCollectSupp_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vSupp)
void Gia_ManPermuteSupp(Gia_Man_t *p, int iOut, int nOuts, Vec_Int_t *vSupp)
word * Gia_ManCountFraction(Gia_Man_t *p, Vec_Wrd_t *vSimI, Vec_Int_t *vSupp, int Thresh, int fVerbose, int *pCare)
int Gia_ManSimEvalOne(Gia_Man_t *p, Vec_Wrd_t *vSimO, Vec_Wrd_t *vSimO_new)
word * Vec_WrdReadTruthText(char *pFileName, int nIns, int nOuts, int nFiles)
void Gia_ManSimInfoPrintOne(Gia_Man_t *p, Vec_Wrd_t *vSimsIn, Vec_Wrd_t *vSimsOut, int nWords, int nPats)
Vec_Wrd_t * Vec_WrdZoneExtract(int ZoneSize, Vec_Wrd_t *p, int iWord, int nWords)
int Gia_ManSimEvalOne3(Gia_Man_t *p, Vec_Wrd_t *vSimO, Vec_Int_t *vValues, int nBits)
int Gia_ManSimEvalMaxValue(Vec_Wrd_t *vSimO, int nWords, int nOuts, int nBits, int iPat)
int Gia_ManPerformLNetOpt_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
void Gia_ManHashStart(Gia_Man_t *p)
#define Gia_ManForEachPo(p, pObj, i)
#define Gia_ManForEachCoId(p, Id, i)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
#define Gia_ManForEachPi(p, pObj, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
Gia_Man_t * Lf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
int Gia_ManLutNum(Gia_Man_t *p)
void Lf_ManSetDefaultPars(Jf_Par_t *pPars)
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManIncrementTravId(Gia_Man_t *p)
struct Jf_Par_t_ Jf_Par_t
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
void Gia_ManHashStop(Gia_Man_t *p)
int Gia_ManLevelNum(Gia_Man_t *p)
#define Gia_ManForEachCiId(p, Id, i)
int Kit_TruthToGia2(Gia_Man_t *pMan, unsigned *pTruth0, unsigned *pTruth1, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
unsigned __int64 word
DECLARATIONS ///.
struct Sfm_Par_t_ Sfm_Par_t
void Sfm_ParSetDefault(Sfm_Par_t *pPars)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.