54 int Lit = Mini_AigNodeFanin0(
p, Id );
55 return Abc_LitNotCond( Vec_IntEntry(vCopies, Abc_Lit2Var(Lit)), Abc_LitIsCompl(Lit) );
59 int Lit = Mini_AigNodeFanin1(
p, Id );
60 return Abc_LitNotCond( Vec_IntEntry(vCopies, Abc_Lit2Var(Lit)), Abc_LitIsCompl(Lit) );
66 int i, iGiaLit = 0, nNodes;
68 nNodes = Mini_AigNodeNum(
p);
71 pGia->
pName = Abc_UtilStrsav(
"MiniAig" );
73 vCopies = Vec_IntAlloc( nNodes );
74 Vec_IntPush( vCopies, 0 );
80 for ( i = 1; i < nNodes; i++ )
82 if ( Mini_AigNodeIsPi(
p, i ) )
83 iGiaLit = Gia_ManAppendCi(pGia);
84 else if ( Mini_AigNodeIsPo(
p, i ) )
86 else if ( Mini_AigNodeIsAnd(
p, i ) )
89 Vec_IntPush( vCopies, iGiaLit );
91 assert( Vec_IntSize(vCopies) == nNodes );
95 Vec_IntFree( vCopies );
125 Gia_ManConst0(pGia)->Value = Mini_AigLitConst0();
128 pObj->
Value = Mini_AigCreatePi(
p);
131 pObj->
Value = Mini_AigAnd(
p, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
134 pObj->
Value = Mini_AigCreatePo(
p, Gia_ObjFanin0Copy(pObj) );
136 Mini_AigSetRegNum(
p, Gia_ManRegNum(pGia) );
155 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
157 Vec_IntFreeP( &pAbc->vCopyMiniAig );
167 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
170 printf(
"Current network in ABC framework is not defined.\n" );
187 char * filename3 = Abc_UtilStrsavTwo( pFileName,
".ilo" );
188 FILE * pFile = fopen( filename3,
"rb" );
191 char Buffer[5000], * pName;
int i, iLines = 0;
192 Vec_Ptr_t * vTemp = Vec_PtrAlloc( Gia_ManRegNum(pGia) );
194 pGia->
vNamesIn = Vec_PtrAlloc( Gia_ManCiNum(pGia) );
196 pGia->
vNamesOut = Vec_PtrAlloc( Gia_ManCoNum(pGia) );
197 while ( fgets(Buffer, 5000, pFile) )
199 if ( Buffer[
strlen(Buffer)-1] ==
'\n' )
200 Buffer[
strlen(Buffer)-1] = 0;
201 if ( iLines < Gia_ManPiNum(pGia) )
202 Vec_PtrPush( pGia->
vNamesIn, Abc_UtilStrsav(Buffer) );
203 else if ( iLines < Gia_ManCiNum(pGia) )
204 Vec_PtrPush( vTemp, Abc_UtilStrsav(Buffer) );
206 Vec_PtrPush( pGia->
vNamesOut, Abc_UtilStrsav(Buffer) );
211 Vec_PtrPush( pGia->
vNamesIn, Abc_UtilStrsav(pName) );
212 Vec_PtrPush( pGia->
vNamesOut, Abc_UtilStrsavTwo(pName,
"_in") );
214 Vec_PtrFreeFree( vTemp );
216 printf(
"Read ILO names into file \"%s\".\n", filename3 );
240 Mini_AigDump(
p, pFileName );
263 Vec_Int_t * vCover = Vec_IntAlloc( 1000 );
265 int i, k, Fan, iGiaLit, nNodes;
266 int LutSize = Abc_MaxInt( 2, Mini_LutSize(
p) );
268 nNodes = Mini_LutNodeNum(
p);
271 pGia->
pName = Abc_UtilStrsav(
"MiniLut" );
273 vCopies = Vec_IntAlloc( nNodes );
274 Vec_IntPush( vCopies, 0 );
275 Vec_IntPush( vCopies, 1 );
278 for ( i = 2; i < nNodes; i++ )
280 if ( Mini_LutNodeIsPi(
p, i ) )
281 iGiaLit = Gia_ManAppendCi(pGia);
282 else if ( Mini_LutNodeIsPo(
p, i ) )
283 iGiaLit = Gia_ManAppendCo(pGia, Vec_IntEntry(vCopies, Mini_LutNodeFanin(
p, i, 0)));
284 else if ( Mini_LutNodeIsNode(
p, i ) )
286 unsigned * puTruth = Mini_LutNodeTruth(
p, i );
288 word * pTruth = LutSize < 6 ? &Truth : (
word *)puTruth;
289 Vec_IntClear( vLits );
291 Vec_IntPush( vLits, Vec_IntEntry(vCopies, Fan) );
295 Vec_IntPush( vCopies, iGiaLit );
297 Vec_IntFree( vCover );
298 Vec_IntFree( vLits );
300 assert( Vec_IntSize(vCopies) == nNodes );
304 Vec_IntFree( vCopies );
329 Vec_Int_t * vCover = Vec_IntAlloc( 1000 );
331 int i, k, Fan, iGiaLit, nNodes;
333 nNodes = Mini_LutNodeNum(
p);
336 pGia->
pName = Abc_UtilStrsav(
"MiniLut" );
338 vCopies = Vec_IntAlloc( nNodes );
339 Vec_IntPush( vCopies, 0 );
340 Vec_IntPush( vCopies, 1 );
343 for ( i = 2; i < nNodes; i++ )
345 if ( Mini_LutNodeIsPi(
p, i ) )
346 iGiaLit = Gia_ManAppendCi(pGia);
347 else if ( Mini_LutNodeIsPo(
p, i ) )
348 iGiaLit = Gia_ManAppendCo(pGia, Vec_IntEntry(vCopies, Mini_LutNodeFanin(
p, i, 0)));
349 else if ( Mini_LutNodeIsNode(
p, i ) )
351 unsigned * puTruth = Mini_LutNodeTruth(
p, i );
352 Vec_IntClear( vLits );
354 Vec_IntPush( vLits, Vec_IntEntry(vCopies, Fan) );
355 iGiaLit =
Kit_TruthToGia( pGia, puTruth, Vec_IntSize(vLits), vCover, vLits, 0 );
358 Vec_IntPush( vCopies, iGiaLit );
360 Vec_IntFree( vCover );
361 Vec_IntFree( vLits );
362 assert( Vec_IntSize(vCopies) == nNodes );
366 Vec_IntFree( vCopies );
389 Vec_Bit_t * vMarks = Vec_BitStart( Gia_ManObjNum(pGia) );
391 if ( Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) && Gia_ObjFaninC0(pObj) )
392 Vec_BitWriteEntry( vMarks, Gia_ObjFaninId0p(pGia, pObj), 1 );
395 if ( Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) && !Gia_ObjFaninC0(pObj) )
396 Vec_BitWriteEntry( vMarks, Gia_ObjFaninId0p(pGia, pObj), 0 );
416 Vec_Int_t * vLeaves = Vec_IntAlloc( 16 );
417 Vec_Int_t * vInvMap = Vec_IntStart( Gia_ManObjNum(pGia) );
418 int i, k, iFanin, LutSize,
nWords, Count = 0, pVars[16];
420 assert( Gia_ManHasMapping(pGia) );
422 LutSize = Abc_MaxInt( LutSize, 2 );
423 nWords = Abc_Truth6WordNum( LutSize );
426 p = Mini_LutStart( LutSize );
429 Gia_ManConst0(pGia)->Value = 0;
431 pObj->
Value = Mini_LutCreatePi(
p);
437 Vec_IntClear( vLeaves );
439 Vec_IntPush( vLeaves, iFanin );
440 if ( Vec_IntSize(vLeaves) > 6 )
442 int Extra = Vec_IntSize(vLeaves) - 7;
443 for ( k = Extra; k >= 0; k-- )
444 Vec_IntPush( vLeaves, Vec_IntEntry(vLeaves, k) );
445 for ( k = Extra; k >= 0; k-- )
446 Vec_IntDrop( vLeaves, k );
447 assert( Vec_IntSize(vLeaves) == Gia_ObjLutSize(pGia, i) );
450 pVars[k] = pFanin->
Value;
451 pObj = Gia_ManObj( pGia, i );
453 if ( Vec_BitEntry(vMarks, i) )
454 Abc_TtNot( pTruth,
nWords );
456 if ( Vec_BitEntry(vMarks, iFanin) )
457 Abc_TtFlip( pTruth,
nWords, k );
458 pObj->
Value = Mini_LutCreateNode(
p, Gia_ObjLutSize(pGia, i), pVars, (
unsigned *)pTruth );
460 Vec_IntFree( vLeaves );
463 for ( i = 0; i <
nWords; i++ )
465 pTruth = Vec_WrdArray( pGia->
vTtMemory );
469 if ( Gia_ObjFanin0(pObj) == Gia_ManConst0(pGia) )
470 pObj->
Value = Mini_LutCreatePo(
p, Gia_ObjFaninC0(pObj) );
471 else if ( Gia_ObjFaninC0(pObj) == Vec_BitEntry(vMarks, Gia_ObjFaninId0p(pGia, pObj)) )
472 pObj->
Value = Mini_LutCreatePo(
p, Gia_ObjFanin0(pObj)->Value );
475 int LutInv, Fanin = Gia_ObjFanin0(pObj)->Value;
476 if ( (LutInv = Vec_IntEntry(vInvMap, Fanin)) == 0 )
478 LutInv = Mini_LutCreateNode(
p, 1, &Fanin, (
unsigned *)pTruth );
479 Vec_IntWriteEntry( vInvMap, Fanin, LutInv );
482 pObj->
Value = Mini_LutCreatePo(
p, LutInv );
485 Vec_IntFree( vInvMap );
486 Vec_BitFree( vMarks );
489 Mini_LutSetRegNum(
p, Gia_ManRegNum(pGia) );
497 char * pAttrs =
ABC_CALLOC(
char, Mini_LutNodeNum(
p) );
499 if ( Gia_ObjLutIsMux(pGia, i) )
500 pAttrs[Gia_ManObj(pGia, i)->Value] = 1;
519 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
527 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
528 Vec_IntFreeP( &pAbc->vCopyMiniLut );
538 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
540 Vec_IntFreeP( &pAbc->vCopyMiniLut );
543 printf(
"Current network in ABC framework is not defined.\n" );
552 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
555 printf(
"Current network in ABC framework is not defined.\n" );
562 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
563 if ( pAbc->vMiniLutObjs == NULL )
564 printf(
"MiniLut objects are not defined.\n" );
565 pRes = Vec_IntReleaseArray( pAbc->vMiniLutObjs );
566 Vec_IntFreeP( &pAbc->vMiniLutObjs );
571 Vec_IntFreeP( &pAbc->vObjDelays );
572 pAbc->vObjDelays = Vec_IntAllocArrayCopy( pDelays, nDelays );
599 Mini_LutDump(
p, pFileName );
616 int * pRes =
ABC_FALLOC(
int, Vec_IntSize(vMap2) );
617 Vec_Int_t * vMap = Vec_IntStartFull( Gia_ManObjNum(
p) );
618 int i, Entry, iRepr, fCompl, iLit;
626 pObj = Gia_ManObj( p1, Abc_Lit2Var(Entry) );
627 if ( ~pObj->
Value == 0 )
629 fCompl = Abc_LitIsCompl(Entry) ^ pObj->
fPhase;
630 iRepr = Gia_ObjReprSelf(
p, Abc_Lit2Var(pObj->
Value));
631 Vec_IntWriteEntry( vMap, iRepr, Abc_Var2Lit(i, fCompl) );
637 pObj = Gia_ManObj( p2, Abc_Lit2Var(Entry) );
638 if ( ~pObj->
Value == 0 )
640 fCompl = Abc_LitIsCompl(Entry) ^ pObj->
fPhase;
641 iRepr = Gia_ObjReprSelf(
p, Abc_Lit2Var(pObj->
Value));
642 if ( (iLit = Vec_IntEntry(vMap, iRepr)) == -1 )
644 pRes[i] = Abc_LitNotCond( iLit, fCompl );
646 Vec_IntFill( vMap, Gia_ManCoNum(p1), -1 );
651 pObj = Gia_ManObj( p1, Abc_Lit2Var(Entry) );
652 if ( !Gia_ObjIsCo(pObj) )
654 Vec_IntWriteEntry( vMap, Gia_ObjCioId(pObj), i );
660 pObj = Gia_ManObj( p2, Abc_Lit2Var(Entry) );
661 if ( !Gia_ObjIsCo(pObj) )
664 pRes[i] = Abc_Var2Lit( Vec_IntEntry(vMap, Gia_ObjCioId(pObj)), 0 );
672 int iLut, iObj1, iObj2, nSize = Vec_IntSize(vMap2);
676 for ( iLut = 0; iLut < nSize; iLut++ )
677 if ( pMap[iLut] >= 0 )
679 int iObj = Abc_Lit2Var( pMap[iLut] );
680 int fCompl = Abc_LitIsCompl( pMap[iLut] );
681 int iLitAig = Vec_IntEntry( vMap1, iObj );
682 int iLitLut = Vec_IntEntry( vMap2, iLut );
683 pObjAig = Gia_ManObj( p1, Abc_Lit2Var(iLitAig) );
684 if ( Gia_ObjIsCo(pObjAig) )
686 if ( ~pObjAig->
Value == 0 )
688 pObjLut = Gia_ManObj( p2, Abc_Lit2Var(iLitLut) );
689 if ( ~pObjLut->
Value == 0 )
691 iObj1 = Gia_ObjReprSelf(
p, Abc_Lit2Var(pObjAig->
Value));
692 iObj2 = Gia_ObjReprSelf(
p, Abc_Lit2Var(pObjLut->
Value));
693 if ( iObj1 != iObj2 )
694 printf(
"Found functional mismatch for LutId %d and AigId %d.\n", iLut, iObj );
695 if ( (pObjLut->
fPhase ^ Abc_LitIsCompl(iLitLut)) != (pObjAig->
fPhase ^ Abc_LitIsCompl(iLitAig) ^ fCompl) )
696 printf(
"Found phase mismatch for LutId %d and AigId %d.\n", iLut, iObj );
705 if ( pAbc->pGiaMiniAig == NULL )
706 printf(
"GIA derived from MiniAig is not available.\n" );
707 if ( pAbc->pGiaMiniLut == NULL )
708 printf(
"GIA derived from MiniLut is not available.\n" );
709 if ( pAbc->pGiaMiniAig == NULL || pAbc->pGiaMiniLut == NULL )
711 pGia =
Gia_ManDup2( pAbc->pGiaMiniAig, pAbc->pGiaMiniLut );
730 int i, iObj, * pRes = NULL;
731 if ( pAbc->pGiaMiniLut == NULL )
733 printf(
"GIA derived from MiniLut is not available.\n" );
737 pRes =
ABC_CALLOC(
int, Vec_IntSize(pAbc->vCopyMiniLut) );
740 pRes[i] = (int)(10000*Vec_FltEntry( (
Vec_Flt_t *)vSwitching, Abc_Lit2Var(iObj) ));
741 Vec_IntFree( vSwitching );
747 int i, iObj, * pRes = NULL;
748 if ( pAbc->pGiaMiniLut == NULL )
750 printf(
"GIA derived from MiniLut is not available.\n" );
754 pRes =
ABC_CALLOC(
int, Vec_IntSize(pAbc->vCopyMiniLut) );
757 pRes[i] = (int)(10000*Vec_FltEntry( (
Vec_Flt_t *)vSwitching, Abc_Lit2Var(iObj) ));
758 Vec_IntFree( vSwitching );
764 int i, iObj, * pRes = NULL;
765 if ( pAbc->pGiaMiniAig == NULL )
767 printf(
"GIA derived from MiniAIG is not available.\n" );
771 pRes =
ABC_CALLOC(
int, Gia_ManCoNum(pAbc->pGiaMiniAig) );
773 pRes[i] = (int)(10000*Vec_FltEntry( (
Vec_Flt_t *)vSwitching, iObj ));
774 Vec_IntFree( vSwitching );
798 Vec_Int_t * vRes = Vec_IntStartFull( Vec_IntSize(vMap) );
799 Vec_Int_t * vGia2Mini = Vec_IntStartFull( Gia_ManObjNum(
p) );
801 int i, iObjLit, iReprLit, fCompl, iReprGia, iReprMini;
808 iReprGia = Gia_ObjReprSelf(
p, Abc_Lit2Var(iObjLit) );
809 iReprMini = Vec_IntEntry( vGia2Mini, iReprGia );
810 if ( iReprMini == -1 )
812 Vec_IntWriteEntry( vGia2Mini, iReprGia, i );
815 if ( iReprMini == i )
818 Vec_IntWriteEntry( vRes, i, iReprMini );
820 Vec_IntFree( vGia2Mini );
824 if ( iReprMini == -1 )
826 iObjLit = Vec_IntEntry(vMap, i);
827 iReprLit = Vec_IntEntry(vMap, iReprMini);
828 pObj = Gia_ManObj(
p, Abc_Lit2Var(iObjLit) );
829 pRepr = Gia_ManObj(
p, Abc_Lit2Var(iReprLit) );
830 fCompl = Abc_LitIsCompl(iObjLit) ^ Abc_LitIsCompl(iReprLit) ^ pObj->
fPhase ^ pRepr->
fPhase;
831 Vec_IntWriteEntry( vRes, i, Abc_Var2Lit(iReprMini, fCompl) );
839 if ( pAbc->pGiaMiniAig == NULL )
840 printf(
"GIA derived from MiniAig is not available.\n" );
841 if ( pAbc->vCopyMiniAig == NULL )
842 printf(
"Mapping of MiniAig nodes is not available.\n" );
843 if ( pAbc->pGia2 == NULL )
844 printf(
"Internal GIA with equivalence classes is not available.\n" );
845 if ( pAbc->pGia2->pReprs == NULL )
847 printf(
"Equivalence classes of internal GIA are not available.\n" );
853 for ( i = 1; i < Gia_ManObjNum(pAbc->pGia2); i++ )
854 if ( Gia_ObjHasRepr(pAbc->pGia2, i) )
855 printf(
"Obj %3d : Repr %3d Proved %d Failed %d\n", i, Gia_ObjRepr(pAbc->pGia2, i), Gia_ObjProved(pAbc->pGia2, i), Gia_ObjFailed(pAbc->pGia2, i) );
857 if ( Gia_ManObjNum(pAbc->pGia2) != Gia_ManObjNum(pAbc->pGiaMiniAig) )
858 printf(
"Internal GIA with equivalence classes is not directly derived from MiniAig.\n" );
861 pRes = Vec_IntReleaseArray( vRes );
881 int i, iGiaLit = 0, nNodes;
883 nNodes = Mini_AigNodeNum(
p);
886 pGia->
pName = Abc_UtilStrsav(
"MiniAig" );
888 vCopies = Vec_IntAlloc( nNodes );
889 Vec_IntPush( vCopies, 0 );
892 for ( i = 1; i < nNodes; i++ )
894 if ( Mini_AigNodeIsPi(
p, i ) )
895 iGiaLit = Gia_ManAppendCi(pGia);
896 else if ( Mini_AigNodeIsPo(
p, i ) )
898 else if ( Mini_AigNodeIsAnd(
p, i ) )
901 if ( pEquivs[i] != -1 )
902 iGiaLit = Abc_LitNotCond( Vec_IntEntry(vCopies, Abc_Lit2Var(pEquivs[i])), Abc_LitIsCompl(pEquivs[i]) );
903 Vec_IntPush( vCopies, iGiaLit );
906 assert( Vec_IntSize(vCopies) == nNodes );
907 Vec_IntFree( vCopies );
917 int i, iGiaLit = 0, iGiaLit2, nNodes, iPos = 0, nPos = 0, Temp;
919 nNodes = Mini_AigNodeNum(
p);
922 pGia->
pName = Abc_UtilStrsav(
"MiniAig" );
924 vCopies = Vec_IntAlloc( nNodes );
925 Vec_IntPush( vCopies, 0 );
928 for ( i = 1; i < nNodes; i++ )
930 if ( Mini_AigNodeIsPi(
p, i ) )
931 iGiaLit = Gia_ManAppendCi(pGia);
932 else if ( Mini_AigNodeIsPo(
p, i ) )
935 Vec_IntPush( vCopies, -1 );
938 else if ( Mini_AigNodeIsAnd(
p, i ) )
941 Vec_IntPush( vCopies, iGiaLit );
943 assert( Vec_IntSize(vCopies) == nNodes );
944 assert( nPos > Mini_AigRegNum(
p) );
946 for ( i = 1; i < nNodes; i++ )
948 if ( pEquivs[i] == -1 )
950 iGiaLit = Vec_IntEntry(vCopies, i);
951 iGiaLit2 = Abc_LitNotCond( Vec_IntEntry(vCopies, Abc_Lit2Var(pEquivs[i])), Abc_LitIsCompl(pEquivs[i]) );
955 Temp = Gia_ManCoNum(pGia);
956 for ( i = 1; i < nNodes; i++ )
958 if ( !Mini_AigNodeIsPo(
p, i ) )
960 if ( iPos++ >= nPos - Mini_AigRegNum(
p) )
964 assert( Mini_AigRegNum(
p) == Gia_ManCoNum(pGia) - Temp );
967 Vec_IntFree( vCopies );
976 char * pFileMiter =
"mini_aig_miter.aig";
977 char * pFileReduced =
"mini_aig_reduced.aig";
985 printf(
"Dumped miter AIG in file \"%s\".\n", pFileMiter );
990 printf(
"Dumped reduced AIG in file \"%s\".\n", pFileReduced );
1011 if ( Mini_AigNodeIsPi(
p, iObj) )
1013 assert( Vec_IntEntry(vMap, iObj) >= 0 );
1014 Vec_IntPush( vRes, Vec_IntEntry(vMap, iObj) );
1017 iFan0 = Mini_AigNodeFanin0(
p, iObj );
1018 iFan1 = Mini_AigNodeFanin1(
p, iObj );
1019 assert( !Abc_LitIsCompl(iFan0) );
1020 assert( !Abc_LitIsCompl(iFan1) );
1026 Vec_Wec_t * vRes = Vec_WecStart( Mini_AigPoNum(
p) );
1027 Vec_Int_t * vMap = Vec_IntStartFull( Mini_AigNodeNum(
p) );
1030 Vec_IntWriteEntry( vMap, i, Index++ );
1031 assert( Index == Mini_AigPiNum(
p) );
1035 int iFan0 = Mini_AigNodeFanin0(
p, i );
1036 assert( !Abc_LitIsCompl(iFan0) );
1039 assert( Index == Mini_AigPoNum(
p) );
1040 Vec_IntFree( vMap );
1060 printf(
"%d(%d) ", Entry%nPis, Entry/nPis );
1061 printf(
" Total = %d\n", Vec_IntSize(
p) );
1065 int i, k = 0, This, Prev = -1, fChange = 0;
1070 Vec_IntWriteEntry(
p, k++, (This/nPis+1)*nPis + This%nPis );
1077 Vec_IntWriteEntry(
p, k++, Prev );
1082 Vec_IntWriteEntry(
p, k++, Prev );
1083 Vec_IntShrink(
p, k );
1089 int i, nIters, Multi = 1;
1092 Vec_IntSort( vRes, 0 );
1094 printf(
"\nOutput %d\n", i );
1102 Multi = Abc_MaxInt( Multi, nIters );
1105 printf(
"Multi = %d.\n", Multi );
1123 Vec_Int_t * vTemp, * vLits = Vec_IntAlloc( 100 );
1124 Vec_Int_t * vDrivers = Vec_IntAlloc(100);
1125 int i, k, iObj, iLit, nInputs = nPis*Multi;
1127 pNew->
pName = Abc_UtilStrsav(
"tree" );
1128 for ( i = 0; i < nInputs; i++ )
1129 Gia_ManAppendCi( pNew );
1133 Vec_IntClear( vLits );
1136 assert( iObj < nInputs );
1137 Vec_IntPush( vLits, 2+2*((iObj%nPis)*Multi+iObj/nPis) );
1142 Vec_IntFree( vLits );
1144 Gia_ManAppendCo( pNew, iLit );
1145 Vec_IntFree( vDrivers );
1154 Vec_WecFree( vSuper );
1172 Vec_Int_t * vTriples = Vec_IntAlloc( 100 );
1173 char * pFileName =
"test.txt";
1174 FILE * pFile = fopen( pFileName,
"rb" );
1175 if ( pFile == NULL )
1176 printf(
"Cannot open the file.\n" );
1179 int nLines = 0, nLinesAll = 0;
1182 while ( fgets( Buffer, 1000, pFile ) != NULL )
1185 if ( Buffer[0] !=
'#' )
1189 pToken =
strtok( Buffer+3,
" \r\n\r+=" );
1192 Vec_IntPush( vTriples, atoi(pToken) );
1193 pToken =
strtok( NULL,
" \r\n\r+=" );
1197 printf(
"Collected %d (out of %d) lines.\n", nLines, nLinesAll );
1198 printf(
"Entries = %d\n", Vec_IntSize(vTriples) );
1204 int Index, Entry0, Entry1, Entry2, Value;
1205 if ( Vec_IntEntry(vMap, iObj) >= 0 )
1207 Index = Vec_IntEntry( vDefs, iObj );
1208 Entry0 = Vec_IntEntry( vTriples, 3*Index+0 );
1209 Entry1 = Vec_IntEntry( vTriples, 3*Index+1 );
1210 Entry2 = Vec_IntEntry( vTriples, 3*Index+2 );
1213 assert( Vec_IntEntry(vMap, Entry1) >= 0 );
1214 assert( Vec_IntEntry(vMap, Entry2) >= 0 );
1215 Value = Mini_AigAnd(
p, Vec_IntEntry(vMap, Entry1), Vec_IntEntry(vMap, Entry2) );
1216 Vec_IntWriteEntry( vMap, Entry0, Value );
1222 Vec_Int_t * vDefs = Vec_IntStartFull( Vec_IntSize(vTriples) );
1223 Vec_Int_t * vMap = Vec_IntStartFull( Vec_IntSize(vTriples) );
1224 Vec_Int_t * vMapIn = Vec_IntStart( Vec_IntSize(vTriples) );
1225 Vec_Int_t * vMapOut = Vec_IntStart( Vec_IntSize(vTriples) );
1228 int i, ObjOut, ObjIn;
1229 assert( Vec_IntSize(vTriples) % 3 == 0 );
1230 for ( i = 0; i < Vec_IntSize(vTriples)/3; i++ )
1232 int Entry0 = Vec_IntEntry(vTriples, 3*i+0);
1233 int Entry1 = Vec_IntEntry(vTriples, 3*i+1);
1234 int Entry2 = Vec_IntEntry(vTriples, 3*i+2);
1235 Vec_IntWriteEntry( vDefs, Entry0, i );
1236 Vec_IntAddToEntry( vMapOut, Entry0, 1 );
1237 Vec_IntAddToEntry( vMapIn, Entry1, 1 );
1238 Vec_IntAddToEntry( vMapIn, Entry2, 1 );
1241 if ( !ObjOut && ObjIn )
1242 Vec_IntPush( vPis, i );
1243 else if ( ObjOut && !ObjIn )
1244 Vec_IntPush( vPos, i );
1246 Vec_IntWriteEntry( vMap, ObjIn, Mini_AigCreatePi(
p) );
1251 assert( Vec_IntEntry(vMap, ObjOut) >= 0 );
1252 Mini_AigCreatePo(
p, Vec_IntEntry(vMap, ObjOut) );
1254 Vec_IntFree( vTriples );
1255 Vec_IntFree( vDefs );
1256 Vec_IntFree( vMap );
1257 Vec_IntFree( vMapIn );
1258 Vec_IntFree( vMapOut );
1259 Vec_IntFree( vPis );
1260 Vec_IntFree( vPos );
1261 Mini_AigDump(
p,
"test.miniaig" );
1278 Vec_Str_t * vStops = Vec_StrStart( Gia_ManObjNum(
p) );
1279 Vec_Int_t * vTemps = Vec_IntStartFull( 3*Gia_ManObjNum(
p) );
1280 Gia_Obj_t * pObj, * pObjRi, * pObjRo;
int i;
1281 char * pStops = Vec_StrArray(vStops);
1282 assert( Gia_ManRegNum(
p) > 0 );
1284 Vec_IntWriteEntry( vTemps, 3*Gia_ObjId(
p, pObjRo) + 0, pRst[i] );
1285 Vec_IntWriteEntry( vTemps, 3*Gia_ObjId(
p, pObjRo) + 1, pSet[i] );
1286 Vec_IntWriteEntry( vTemps, 3*Gia_ObjId(
p, pObjRo) + 2, pEna[i] );
1289 int * pFan0 = Vec_IntEntryP( vTemps, 3*Gia_ObjFaninId0(pObj, i) );
1290 int * pFan1 = Vec_IntEntryP( vTemps, 3*Gia_ObjFaninId1(pObj, i) );
1291 int * pNode = Vec_IntEntryP( vTemps, 3*i );
1292 pStops[i] = (char)1;
1293 if ( pFan0[0] != -1 && pFan0[0] == pFan1[0] && pFan0[1] == pFan1[1] && pFan0[2] == pFan1[2] )
1294 pStops[i] = (char)0, pNode[0] = pFan0[0], pNode[1] = pFan0[1], pNode[2] = pFan0[2];
1296 Vec_IntFree( vTemps );
1301 Vec_Str_t * vStops = Vec_StrStart( Gia_ManObjNum(
p) );
1302 Vec_Int_t * vTemps = Vec_IntStartFull( 3*Gia_ManObjNum(
p) );
1303 Gia_Obj_t * pObj, * pObjRi, * pObjRo;
int i, n, iFanout;
1304 char * pStops = Vec_StrArray(vStops);
1305 assert( Gia_ManRegNum(
p) > 0 );
1307 Vec_IntWriteEntry( vTemps, 3*Gia_ObjId(
p, pObjRi) + 0, pRst[i] );
1308 Vec_IntWriteEntry( vTemps, 3*Gia_ObjId(
p, pObjRi) + 1, pSet[i] );
1309 Vec_IntWriteEntry( vTemps, 3*Gia_ObjId(
p, pObjRi) + 2, pEna[i] );
1313 int * pFan0 = Vec_IntEntryP( vTemps, 3*Gia_ObjFanoutId(
p, i, 0) );
1314 int * pNode = Vec_IntEntryP( vTemps, 3*i );
1315 pStops[i] = (char)1;
1316 if ( pFan0[0] == -1 )
1319 int * pFan1 = Vec_IntEntryP( vTemps, 3*iFanout );
1320 if ( pFan1[0] == -1 || pFan0[0] != pFan1[0] || pFan0[1] != pFan1[1] || pFan0[2] != pFan1[2] )
1323 if ( n < Gia_ObjFanoutNum(
p, pObj) )
1325 pStops[i] = (char)0, pNode[0] = pFan0[0], pNode[1] = pFan0[1], pNode[2] = pFan0[2];
1328 Vec_IntFree( vTemps );
1330 if ( Gia_ObjIsAnd(Gia_ManObj(
p, Abc_Lit2Var(pRst[i]))) ) pStops[Abc_Lit2Var(pRst[i])] = 1;
1331 if ( Gia_ObjIsAnd(Gia_ManObj(
p, Abc_Lit2Var(pSet[i]))) ) pStops[Abc_Lit2Var(pSet[i])] = 1;
1332 if ( Gia_ObjIsAnd(Gia_ManObj(
p, Abc_Lit2Var(pEna[i]))) ) pStops[Abc_Lit2Var(pEna[i])] = 1;
1350 for (
int i = 0; i < nLits; i++ )
1351 pLits[i] = Abc_Lit2LitL( Vec_IntArray(vMap), pLits[i] );
1360 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
1363 printf(
"Current network in ABC framework is not defined.\n" );
1365 assert( nRegs == Gia_ManRegNum(pGia) );
1366 memmove( pRstNew, pRst,
sizeof(
int)*nRegs );
1367 memmove( pSetNew, pSet,
sizeof(
int)*nRegs );
1368 memmove( pEnaNew, pEna,
sizeof(
int)*nRegs );
1370 if ( pAbc->vCopyMiniAig == NULL )
1371 printf(
"Mapping of MiniAig nodes is not available.\n" );
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
#define ABC_SWAP(Type, a, b)
#define ABC_FALLOC(type, num)
#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 ///.
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
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
int Dsm_ManTruthToGia(void *p, word *pTruth, Vec_Int_t *vLeaves, Vec_Int_t *vCover)
void * Abc_FrameGiaOutputMiniLut(Abc_Frame_t *pAbc)
Gia_Man_t * Gia_MiniAigSuperDeriveGia(Vec_Wec_t *p, int nPis, int Multi)
int * Abc_FrameReadMiniLutSwitching(Abc_Frame_t *pAbc)
Gia_Man_t * Gia_MiniAigSuperDerive(char *pFileName, int fVerbose)
Mini_Lut_t * Gia_ManToMiniLut(Gia_Man_t *pGia)
void Gia_ManReadMiniAigNames(char *pFileName, Gia_Man_t *pGia)
Vec_Int_t * Gia_ManMapEquivAfterScorr(Gia_Man_t *p, Vec_Int_t *vMap)
void Abc_FrameRemapLits(int *pLits, int nLits, Vec_Int_t *vMap)
Gia_Man_t * Gia_ManReadMiniAig(char *pFileName, int fGiaSimple)
void Gia_MiniAigGenerateFromFile()
void Gia_MiniAigSuperPrintDouble(Vec_Int_t *p, int nPis)
void Abc_FrameSetRetimingData(Abc_Frame_t *pAbc, int *pRst, int *pSet, int *pEna, int nRegs)
void Gia_ManWriteMiniAig(Gia_Man_t *pGia, char *pFileName)
int * Abc_FrameReadMiniAigEquivClasses(Abc_Frame_t *pAbc)
Vec_Int_t * Gia_MiniAigProcessFile()
void * Abc_FrameGiaOutputMiniAig(Abc_Frame_t *pAbc)
int * Gia_ManMapMiniLut2MiniAig(Gia_Man_t *p, Gia_Man_t *p1, Gia_Man_t *p2, Vec_Int_t *vMap1, Vec_Int_t *vMap2)
Gia_Man_t * Gia_ManFromMiniAig(Mini_Aig_t *p, Vec_Int_t **pvCopies, int fGiaSimple)
Gia_Man_t * Gia_ManFromMiniLut(Mini_Lut_t *p, Vec_Int_t **pvCopies)
int Gia_ObjFromMiniFanin0Copy(Gia_Man_t *pGia, Vec_Int_t *vCopies, Mini_Aig_t *p, int Id)
FUNCTION DEFINITIONS ///.
Gia_Man_t * Gia_ManFromMiniLut2(Mini_Lut_t *p, Vec_Int_t **pvCopies)
void Gia_ManNameMapVerify(Gia_Man_t *p, Gia_Man_t *p1, Gia_Man_t *p2, Vec_Int_t *vMap1, Vec_Int_t *vMap2, int *pMap)
char * Gia_ManToMiniLutAttr(Gia_Man_t *pGia, void *pMiniLut)
void Gia_MiniAigSuperGates_rec(Mini_Aig_t *p, int iObj, Vec_Int_t *vRes, Vec_Int_t *vMap)
Vec_Bit_t * Gia_ManFindComplLuts(Gia_Man_t *pGia)
Vec_Str_t * Gia_ManRetimableB(Gia_Man_t *p, int *pRst, int *pSet, int *pEna)
void Abc_FrameSetObjDelays(Abc_Frame_t *pAbc, int *pDelays, int nDelays)
Vec_Str_t * Gia_ManRetimableF(Gia_Man_t *p, int *pRst, int *pSet, int *pEna)
void Gia_ManWriteMiniLut(Gia_Man_t *pGia, char *pFileName)
int Gia_MiniAigSuperPreprocess(Mini_Aig_t *p, Vec_Wec_t *vSuper, int nPis, int fVerbose)
void Abc_FrameGiaInputMiniLut2(Abc_Frame_t *pAbc, void *p)
void Gia_MiniAigGenerate_rec(Mini_Aig_t *p, Vec_Int_t *vTriples, int iObj, Vec_Int_t *vDefs, Vec_Int_t *vMap)
Gia_Man_t * Gia_MiniAigMiter(Mini_Aig_t *p, int *pEquivs)
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_MiniAigSuperMerge(Vec_Int_t *p, int nPis)
Mini_Aig_t * Gia_ManToMiniAig(Gia_Man_t *pGia)
int * Abc_FrameGiaOutputMiniLutObj(Abc_Frame_t *pAbc)
int * Abc_FrameReadMiniLutSwitchingPo(Abc_Frame_t *pAbc)
void Abc_FrameGiaInputMiniLut(Abc_Frame_t *pAbc, void *p)
int Gia_ObjFromMiniFanin1Copy(Gia_Man_t *pGia, Vec_Int_t *vCopies, Mini_Aig_t *p, int Id)
Gia_Man_t * Gia_ManReadMiniLut(char *pFileName)
Vec_Wec_t * Gia_MiniAigSuperGates(Mini_Aig_t *p)
char * Abc_FrameGiaOutputMiniLutAttr(Abc_Frame_t *pAbc, void *pMiniLut)
void Abc_FrameGiaInputMiniAig(Abc_Frame_t *pAbc, void *p)
int * Abc_FrameReadMiniLutSwitching2(Abc_Frame_t *pAbc, int fRandPiFactor)
int * Abc_FrameReadMiniLutNameMapping(Abc_Frame_t *pAbc)
void Gia_MiniAigVerify(Abc_Frame_t *pAbc, char *pFileName)
Gia_Man_t * Gia_MiniAigReduce(Mini_Aig_t *p, int *pEquivs)
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_ManStaticFanoutStart(Gia_Man_t *p)
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
int Gia_ManIsNormalized(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachAndReverse(p, pObj, i)
void Gia_ManStopP(Gia_Man_t **p)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
Gia_Man_t * Gia_ManDup2(Gia_Man_t *p1, Gia_Man_t *p2)
int Gia_ManHashAndMulti2(Gia_Man_t *p, Vec_Int_t *vLits)
void Gia_ManHashAlloc(Gia_Man_t *p)
#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)
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManDupRemapLiterals(Vec_Int_t *vLits, Gia_Man_t *p)
FUNCTION DEFINITIONS ///.
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Gia_Man_t * Gia_ManComputeGiaEquivs(Gia_Man_t *pGia, int nConfs, int fVerbose)
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
int Gia_ManLutSizeMax(Gia_Man_t *p)
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
#define Gia_ObjForEachFanoutStaticId(p, Id, FanId, i)
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
void Gia_ManSetPhase(Gia_Man_t *p)
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
void Gia_ManHashStop(Gia_Man_t *p)
Vec_Int_t * Gia_ManComputeSwitchProbs2(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne, int nRandPiFactor)
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
unsigned __int64 word
DECLARATIONS ///.
struct Mini_Aig_t_ Mini_Aig_t
BASIC TYPES ///.
#define Mini_AigForEachPi(p, i)
#define Mini_AigForEachPo(p, i)
#define Mini_LutForEachFanin(p, i, Fan, k)
struct Mini_Lut_t_ Mini_Lut_t
BASIC TYPES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.