83static inline int Str_ObjFaninId(
Str_Ntk_t *
p,
Str_Obj_t * pObj,
int i ) {
return Abc_Lit2Var( Vec_IntEntry(&
p->vFanins, pObj->
iOffset + i) ); }
85static inline int Str_ObjFaninC(
Str_Ntk_t *
p,
Str_Obj_t * pObj,
int i ) {
return Abc_LitIsCompl( Vec_IntEntry(&
p->vFanins, pObj->
iOffset + i) ); }
86static inline int Str_ObjFaninCopy(
Str_Ntk_t *
p,
Str_Obj_t * pObj,
int i ) {
return Abc_LitNotCond( Str_ObjFanin(
p, pObj, i)->iCopy, Str_ObjFaninC(
p, pObj, i) ); }
89#define Str_NtkManForEachObj( p, pObj ) \
90 for ( pObj = p->pObjs; Str_ObjId(p, pObj) < p->nObjs; pObj++ )
91#define Str_NtkManForEachObjVec( vVec, p, pObj, i ) \
92 for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Str_NtkObj(p, Vec_IntEntry(vVec,i))); i++ )
109static inline int Str_ObjCreate(
Str_Ntk_t *
p,
int Type,
int nFanins,
int * pFanins )
115 pObj->
iOffset = Vec_IntSize(&
p->vFanins);
117 for ( i = 0; i < nFanins; i++ )
119 Vec_IntPush( &
p->vFanins, pFanins[i] );
120 assert( pFanins[i] >= 0 );
122 p->nObjCount[Type]++;
123 return Abc_Var2Lit(
p->nObjs++, 0 );
125static inline Str_Ntk_t * Str_NtkCreate(
int nObjsAlloc,
int nFaninsAlloc )
130 p->nObjsAlloc = nObjsAlloc;
132 Vec_IntGrow( &
p->vFanins, nFaninsAlloc );
135static inline void Str_NtkDelete(
Str_Ntk_t *
p )
144 printf(
"Network contains %d ands, %d xors, %d muxes (%d trees in %d groups). ",
146 Abc_PrintTime( 1,
"Time", clk );
148static inline void Str_ObjReadGroup(
Str_Ntk_t *
p,
Str_Obj_t * pObj,
int * pnGroups,
int * pnMuxes )
151 *pnGroups = *pnMuxes = 0;
152 if ( pObj->
iTop == 0 )
154 pObj1 = Str_NtkObj(
p, pObj->
iTop );
155 pObj2 = Str_NtkObj(
p, pObj1->
iTop );
156 *pnMuxes = pObj1 - pObj + 1;
157 *pnGroups = (pObj2 - pObj + 1) / *pnMuxes;
159static inline void Str_NtkPrintGroups(
Str_Ntk_t *
p )
166 Str_ObjReadGroup(
p, pObj, &nGroups, &nMuxes );
167 pObj += nGroups * nMuxes - 1;
168 printf(
"%d x %d ", nGroups, nMuxes );
184 pObj->
iCopy = Gia_ManAppendCi( pNew );
188 for ( k = 0; k < (int)pObj->
nFanins; k++ )
194 for ( k = 0; k < (int)pObj->
nFanins; k++ )
198 pObj->
iCopy =
Gia_ManHashMux( pNew, Str_ObjFaninCopy(
p, pObj, 2), Str_ObjFaninCopy(
p, pObj, 1), Str_ObjFaninCopy(
p, pObj, 0) );
200 pObj->
iCopy = Gia_ManAppendCo( pNew, Str_ObjFaninCopy(
p, pObj, 0) );
228 Gia_Obj_t * pObj, * pFan0, * pFan1, * pFanC;
229 int i, iLit0, iLit1, fCompl;
238 Gia_ObjRefDec(
p, Gia_ObjFanin0(pObj));
239 Gia_ObjRefDec(
p, Gia_ObjFanin1(pObj));
243 pNew->
pName = Abc_UtilStrsav(
p->pName );
244 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
247 Gia_ManConst0(
p)->Value = 0;
249 pObj->
Value = Gia_ManAppendCi( pNew );
252 if ( !Gia_ObjRefNumId(
p, i) )
255 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
258 iLit0 = Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFan0));
259 iLit1 = Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFan1));
260 fCompl = Abc_LitIsCompl(iLit0) ^ Abc_LitIsCompl(iLit1);
261 pObj->
Value = fCompl ^ Gia_ManAppendXorReal( pNew, Abc_LitRegular(iLit0), Abc_LitRegular(iLit1) );
266 iLit0 = Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFan0));
267 iLit1 = Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFan1));
268 if ( iLit0 == iLit1 )
270 else if ( Abc_Lit2Var(iLit0) == Abc_Lit2Var(iLit1) )
272 iLit1 = Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFanC));
273 fCompl = Abc_LitIsCompl(iLit0) ^ Abc_LitIsCompl(iLit1);
274 pObj->
Value = fCompl ^ Gia_ManAppendXorReal( pNew, Abc_LitRegular(iLit0), Abc_LitRegular(iLit1) );
277 pObj->
Value = Gia_ManAppendMuxReal( pNew, Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFanC)), Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFan1)), Gia_ObjLitCopy(
p, Gia_ObjToLit(
p, pFan0)) );
281 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
302 Vec_IntPush( vNodes, Gia_ObjId(
p, pObj) );
305 Vec_IntPush( vNodes, Gia_ObjFaninId2p(
p, pObj) );
313 Vec_IntClear( vNodes );
323 Vec_IntPush( vNodes, Gia_ObjId(
p, pObj) );
329 Vec_IntClear( vNodes );
337 Vec_StrPush( vStr,
'[' );
338 Vec_StrPush( vStr,
'(' );
339 Vec_StrPrintNum( vStr, Gia_ObjFaninId2p(
p, pObj) );
340 Vec_StrPush( vStr,
')' );
342 Vec_StrPush( vStr,
'|' );
344 Vec_StrPush( vStr,
']' );
350 Vec_StrClear( vStr );
352 Vec_StrPush( vStr,
'\0' );
359 Count += (*
p ==
'[');
364 int fPrintStructs = 0;
369 int i, iStructId, fFound;
376 pObj = Gia_ManObj(
p, i);
377 pFanin = Gia_ObjFanin0(pObj);
378 if ( Gia_ObjIsMux(
p, pFanin) && Gia_ObjRefNum(
p, pFanin) == 1 )
380 pFanin = Gia_ObjFanin1(pObj);
381 if ( Gia_ObjIsMux(
p, pFanin) && Gia_ObjRefNum(
p, pFanin) == 1 )
385 vStr = Vec_StrAlloc( 1000 );
387 vGroups = Vec_WecAlloc( 1000 );
388 Vec_WecPushLevel( vGroups );
392 pObj = Gia_ManObj(
p, i);
396 if ( !Gia_ObjFanin0(pObj)->fMark0 && !Gia_ObjFanin1(pObj)->fMark0 )
401 if ( !fFound ) Vec_WecPushLevel( vGroups );
403 Vec_IntPush( Vec_WecEntry(vGroups, iStructId), i );
410 printf(
"%5d : ", i );
411 printf(
"Occur = %4d ", Vec_IntSize(Vec_WecEntry(vGroups,i)) );
413 printf(
"%s\n", pTemp );
425 vRoots = Vec_IntStartFull( nObjs );
428 Vec_IntWriteEntry( vRoots, Entry, i );
435 if ( Gia_ObjIsTravIdCurrentId(
p, i) )
437 Gia_ObjSetTravIdCurrentId(
p, i);
438 pObj = Gia_ManObj(
p, i);
439 if ( !Gia_ObjIsAnd(pObj) )
443 if ( Gia_ObjIsMux(
p, pObj) )
449 int i, k, n, iObj, iObj2;
458 if ( Vec_IntSize(vGroup) == 1 )
465 if ( iObj != iObj2 && Gia_ObjIsTravIdCurrentId(
p, iObj2) )
467 if ( n == Vec_IntSize(vGroup) )
472 vGroup2 = Vec_WecPushLevel( vGroups );
473 vGroup = Vec_WecEntry( vGroups, i );
474 Vec_IntPush( vGroup2, iObj2 );
476 Vec_IntShrink( vGroup, 1 );
524 int i, k = 0, Prev = -1, This, fCompl = 0;
531 else if ( Prev != This )
532 Vec_IntWriteEntry( vSuper, k++, This ), Prev = This;
536 Vec_IntShrink( vSuper, k );
537 if ( Vec_IntSize( vSuper ) == 0 )
538 Vec_IntPush( vSuper, fCompl );
540 Vec_IntWriteEntry( vSuper, 0, Abc_LitNot(Vec_IntEntry(vSuper, 0)) );
544 int i, k = 0, Prev = -1, This;
548 { Vec_IntFill(vSuper, 1, 0);
return; }
551 if ( Prev == -1 || Abc_Lit2Var(Prev) != Abc_Lit2Var(This) )
552 Vec_IntWriteEntry( vSuper, k++, This ), Prev = This;
553 else if ( Prev != This )
554 { Vec_IntFill(vSuper, 1, 0);
return; }
556 Vec_IntShrink( vSuper, k );
557 if ( Vec_IntSize( vSuper ) == 0 )
558 Vec_IntPush( vSuper, 1 );
574 assert( !Gia_IsComplement(pObj) );
575 if ( !Gia_ObjIsXor(pObj) ||
576 Gia_ObjRefNum(
p, pObj) > 1 ||
581 Vec_IntPush(
p->vSuper, Gia_ObjToLit(
p, pObj) );
584 assert( !Gia_ObjFaninC0(pObj) && !Gia_ObjFaninC1(pObj) );
590 if ( Gia_IsComplement(pObj) ||
591 !Gia_ObjIsAndReal(
p, pObj) ||
592 Gia_ObjRefNum(
p, pObj) > 1 ||
597 Vec_IntPush(
p->vSuper, Gia_ObjToLit(
p, pObj) );
605 if (
p->vSuper == NULL )
608 Vec_IntClear(
p->vSuper );
609 if ( Gia_ObjIsXor(pObj) )
611 assert( !Gia_ObjFaninC0(pObj) && !Gia_ObjFaninC1(pObj) );
614 Vec_IntSort(
p->vSuper, 0 );
617 else if ( Gia_ObjIsAndReal(
p, pObj) )
621 Vec_IntSort(
p->vSuper, 0 );
625 assert( Vec_IntSize(
p->vSuper) > 0 );
641 int i, k, iVar, iLit, iBeg, iEnd;
645 assert( Gia_ObjIsAnd(pObj) );
646 if ( Gia_ObjIsMux(
p, pObj) )
651 if ( Vec_IntEntry(vRoots, Gia_ObjId(
p, pObj)) == -1 )
656 pFanins[0] = Gia_ObjFanin0Copy(pObj);
657 pFanins[1] = Gia_ObjFanin1Copy(pObj);
658 pFanins[2] = Gia_ObjFanin2Copy(
p, pObj);
659 if ( Abc_LitIsCompl(pFanins[2]) )
661 pFanins[2] = Abc_LitNot(pFanins[2]);
662 ABC_SWAP(
int, pFanins[0], pFanins[1] );
664 pObj->
Value = Str_ObjCreate( pNtk,
STR_MUX, 3, pFanins );
667 vGroup = Vec_WecEntry( vGroups, Vec_IntEntry(vRoots, Gia_ObjId(
p, pObj)) );
672 iBeg = Vec_IntSize(
p->vStore );
673 Vec_IntAppend(
p->vStore,
p->vSuper );
674 iEnd = Vec_IntSize(
p->vStore );
677 Vec_IntShrink(
p->vStore, iBeg );
685 pFanins[0] = Gia_ObjFanin0Copy(pMux);
686 pFanins[1] = Gia_ObjFanin1Copy(pMux);
687 pFanins[2] = Gia_ObjFanin2Copy(
p, pMux);
688 if ( Abc_LitIsCompl(pFanins[2]) )
690 pFanins[2] = Abc_LitNot(pFanins[2]);
691 ABC_SWAP(
int, pFanins[0], pFanins[1] );
693 pMux->
Value = Str_ObjCreate( pNtk,
STR_MUX, 3, pFanins );
698 Str_NtkObj(pNtk, Abc_Lit2Var(pMux->
Value))->iTop = Abc_Lit2Var(pRoot->
Value);
703 pObj = Gia_ManObj(
p, Vec_IntEntryLast(vGroup) );
705 Str_NtkObj(pNtk, Abc_Lit2Var(pRoot->
Value))->iTop = Abc_Lit2Var(pObj->
Value);
713 iBeg = Vec_IntSize(
p->vStore );
714 Vec_IntAppend(
p->vStore,
p->vSuper );
715 iEnd = Vec_IntSize(
p->vStore );
719 Gia_Obj_t * pTemp = Gia_ManObj(
p, Abc_Lit2Var(iLit) );
721 Vec_IntWriteEntry(
p->vStore, i, Abc_LitNotCond(pTemp->
Value, Abc_LitIsCompl(iLit)) );
723 assert( Vec_IntSize(
p->vStore) == iEnd );
725 pObj->
Value = Str_ObjCreate( pNtk, Gia_ObjIsXor(pObj) ?
STR_XOR :
STR_AND, iEnd-iBeg, Vec_IntEntryP(
p->vStore, iBeg) );
726 Vec_IntShrink(
p->vStore, iBeg );
734 if (
p->vSuper == NULL )
736 if (
p->vStore == NULL )
739 pNtk = Str_NtkCreate( Gia_ManObjNum(
p) + 10000, 1 + Gia_ManCoNum(
p) + 2 * Gia_ManAndNum(
p) + Gia_ManMuxNum(
p) + 10000 );
740 Gia_ManConst0(
p)->Value = 0;
743 if ( Gia_ObjIsCi(pObj) )
744 pObj->
Value = Str_ObjCreate( pNtk,
STR_PI, 0, NULL );
745 else if ( Gia_ObjIsCo(pObj) )
748 iFanin = Gia_ObjFanin0Copy(pObj);
749 pObj->
Value = Str_ObjCreate( pNtk,
STR_PO, 1, &iFanin );
766 Vec_IntFree( vRoots );
767 Vec_WecFree( vGroups );
782static inline int Str_Delay2(
int d0,
int d1,
int nLutSize )
784 int n, d = Abc_MaxInt( d0 >> 4, d1 >> 4 );
785 n = (d == (d0 >> 4)) ? (d0 & 15) : 1;
786 n += (d == (d1 >> 4)) ? (d1 & 15) : 1;
787 return (d << 4) + (n > nLutSize ? 18 : n);
789static inline int Str_Delay3(
int d0,
int d1,
int d2,
int nLutSize )
791 int n, d = Abc_MaxInt( Abc_MaxInt(d0 >> 4, d1 >> 4), d2 >> 4 );
792 n = (d == (d0 >> 4)) ? (d0 & 15) : 1;
793 n += (d == (d1 >> 4)) ? (d1 & 15) : 1;
794 n += (d == (d2 >> 4)) ? (d2 & 15) : 1;
795 return (d << 4) + (n > nLutSize ? 19 : n);
797static inline int Str_ObjDelay(
Gia_Man_t * pNew,
int iObj,
int nLutSize,
Vec_Int_t * vDelay )
799 int Delay = Vec_IntEntry( vDelay, iObj );
802 if ( Gia_ObjIsMuxId(pNew, iObj) )
804 int d0 = Vec_IntEntry( vDelay, Gia_ObjFaninId0(Gia_ManObj(pNew, iObj), iObj) );
805 int d1 = Vec_IntEntry( vDelay, Gia_ObjFaninId1(Gia_ManObj(pNew, iObj), iObj) );
806 int d2 = Vec_IntEntry( vDelay, Gia_ObjFaninId2(pNew, iObj) );
807 Delay = Str_Delay3( d0, d1, d2, nLutSize );
811 int d0 = Vec_IntEntry( vDelay, Gia_ObjFaninId0(Gia_ManObj(pNew, iObj), iObj) );
812 int d1 = Vec_IntEntry( vDelay, Gia_ObjFaninId1(Gia_ManObj(pNew, iObj), iObj) );
813 Delay = Str_Delay2( d0, d1, nLutSize );
815 Vec_IntWriteEntry( vDelay, iObj, Delay );
833static inline void transpose64(
word A[64] )
836 word t, m = 0x00000000FFFFFFFF;
837 for ( j = 32; j != 0; j = j >> 1, m = m ^ (m << j) )
839 for ( k = 0; k < 64; k = (k + j + 1) & ~j )
841 t = (A[k] ^ (A[k+j] >> j)) & m;
843 A[k+j] = A[k+j] ^ (t << j);
859static inline int Str_ManNum(
Gia_Man_t *
p,
int iObj ) {
return Vec_IntEntry(&
p->vCopies, iObj); }
860static inline void Str_ManSetNum(
Gia_Man_t *
p,
int iObj,
int Num ) { Vec_IntWriteEntry(&
p->vCopies, iObj, Num); }
866 int nSize = Vec_IntSize(vSuper);
867 int Prev = nSize, nLevels = 1;
868 int i, k, iLit, iFanin, nSizeNew;
871 assert( nSize <= nLimit );
874 for ( i = 0; i < 64; i++ )
883 Gia_ObjSetTravIdCurrentId(
p, Abc_Lit2Var(iLit) );
884 Str_ManSetNum(
p, Abc_Lit2Var(iLit), i );
885 Matrix[i] = ((
word)1) << (63-i);
891 Gia_Obj_t * pObj = Gia_ManObj(
p, Abc_Lit2Var(iLit) );
892 if ( Gia_ObjIsAnd(pObj) )
894 for ( k = 0; k < 2; k++ )
896 iFanin = k ? Gia_ObjFaninId1p(
p, pObj) : Gia_ObjFaninId0p(
p, pObj);
897 if ( !Gia_ObjIsTravIdCurrentId(
p, iFanin) )
899 if ( Vec_IntSize(vSuper) == nLimit )
901 Gia_ObjSetTravIdCurrentId(
p, iFanin );
902 Matrix[Vec_IntSize(vSuper)] = 0;
903 Levels[Vec_IntSize(vSuper)] = nLevels;
904 Str_ManSetNum(
p, iFanin, Vec_IntSize(vSuper) );
905 Vec_IntPush( vSuper, Abc_Var2Lit(iFanin, 0) );
907 Matrix[Str_ManNum(
p, iFanin)] |= Matrix[i];
910 if ( Gia_ObjIsMux(
p, pObj) )
912 iFanin = Gia_ObjFaninId2p(
p, pObj);
913 if ( !Gia_ObjIsTravIdCurrentId(
p, iFanin) )
915 if ( Vec_IntSize(vSuper) == nLimit )
917 Gia_ObjSetTravIdCurrentId(
p, iFanin );
918 Matrix[Vec_IntSize(vSuper)] = 0;
919 Levels[Vec_IntSize(vSuper)] = nLevels;
920 Str_ManSetNum(
p, iFanin, Vec_IntSize(vSuper) );
921 Vec_IntPush( vSuper, Abc_Var2Lit(iFanin, 0) );
923 Matrix[Str_ManNum(
p, iFanin)] |= Matrix[i];
926 Prev = Vec_IntSize(vSuper), nLevels++;
932 Mask = (~(
word)0) << (64 - nSize);
933 for ( k = i = 0; i < Vec_IntSize(vSuper); i++ )
936 if ( (Matrix[i] & (Matrix[i] - 1)) == 0 )
938 if ( Matrix[i] == Mask )
940 Matrix[k] = Matrix[i];
941 Levels[k] = Levels[i];
947 for ( i = k; i < 64; i++ )
952 Vec_IntShrink( vSuper, nSize );
965 transpose64( Matrix );
968 if ( fVerbose && nSize > 10 )
970 printf(
"Gate inputs = %d. Collected fanins = %d. All = %d. Good = %d. Levels = %d\n",
971 nSize, Vec_IntSize(vSuper) - nSize, Vec_IntSize(vSuper), nSizeNew, nLevels );
973 for ( i = 0; i < nSizeNew; i++ )
974 printf(
"%d", Levels[i] );
976 for ( i = 0; i < nSize; i++ )
978 printf(
"%6d : ", Abc_Lit2Var(Vec_IntEntry(vSuper, i)) );
979 printf(
"%3d ", Vec_IntEntry(vDelay, i) >> 4 );
980 printf(
"%3d ", Vec_IntEntry(vDelay, i) & 15 );
986 Vec_IntShrink( vSuper, nSize );
1001static inline int Str_CountBits(
word i )
1011 i = i - ((i >> 1) & 0x5555555555555555);
1012 i = (i & 0x3333333333333333) + ((i >> 2) & 0x3333333333333333);
1013 i = ((i + (i >> 4)) & 0x0F0F0F0F0F0F0F0F);
1014 return (i*(0x0101010101010101))>>56;
1017static inline void Str_PrintState(
int * pCost,
int * pSuper,
word * pMatrix,
int nSize )
1020 for ( i = 0; i < nSize; i++ )
1022 printf(
"%6d : ", i );
1023 printf(
"%6d : ", Abc_Lit2Var(pSuper[i]) );
1024 printf(
"%3d ", pCost[i] >> 4 );
1025 printf(
"%3d ", pCost[i] & 15 );
1047 for ( k = 0; k < (int)pObj->
nFanins; k++ )
1053 Str_ObjDelay( pNew, Abc_Lit2Var(pObj->
iCopy), nLutSize, vDelay );
1057int Str_NtkBalanceTwo(
Gia_Man_t * pNew,
Str_Ntk_t *
p,
Str_Obj_t * pObj,
int i,
int j,
Vec_Int_t * vDelay,
int * pCost,
int * pSuper,
word * pMatrix,
int nSize,
int nLutSize,
int CostBest )
1059 int k, iLitRes, Delay;
1066 Delay = Str_ObjDelay( pNew, Abc_Lit2Var(iLitRes), nLutSize, vDelay );
1069 pSuper[i] = iLitRes;
1070 pMatrix[i] |= pMatrix[j];
1074 for ( k = j; k < nSize; k++ )
1076 pCost[k] = pCost[k+1];
1077 pSuper[k] = pSuper[k+1];
1078 pMatrix[k] = pMatrix[k+1];
1082 for ( k = 0; k < nSize; k++ )
1084 if ( pCost[k] <= pCost[k+1] )
1086 ABC_SWAP(
int, pCost[k], pCost[k+1] );
1087 ABC_SWAP(
int, pSuper[k], pSuper[k+1] );
1098 int * pSuper = Vec_IntArray(vSuper);
1099 int * pCost = Vec_IntArray(vCosts);
1100 int k, iLit, MatrixSize = 0;
1105 Vec_IntClear( vSuper );
1106 for ( k = 0; k < (int)pObj->
nFanins; k++ )
1107 Vec_IntPush( vSuper, Str_ObjFaninCopy(
p, pObj, k) );
1108 Vec_IntSort( vSuper, 0 );
1113 assert( Vec_IntSize(vSuper) > 0 );
1114 if ( Vec_IntSize(vSuper) == 1 )
1116 pObj->
iCopy = Vec_IntEntry(vSuper, 0);
1120 if ( Vec_IntSize(vSuper) == 2 )
1122 pObj->
iCopy =
Str_NtkBalanceTwo( pNew,
p, pObj, 0, 1, vDelay, pCost, pSuper, pMatrix, 2, nLutSize, -1 );
1128 Vec_IntClear( vCosts );
1130 Vec_IntPush( vCosts, Vec_IntEntry(vDelay, Abc_Lit2Var(iLit)) );
1131 Vec_IntSelectSortCost2( pSuper, Vec_IntSize(vSuper), pCost );
1134 if ( Vec_IntSize(vSuper) < 64 )
1138 while ( Vec_IntSize(vSuper) > 2 )
1141 int i, iStop, iBest,iBest2;
1142 int CostNew, CostBest, CostBest2;
1143 int OccurNew, OccurBest, OccurBest2;
1145 if ( Vec_IntSize(vSuper) > 64 )
1147 Str_NtkBalanceTwo( pNew,
p, pObj, 0, 1, vDelay, pCost, pSuper, pMatrix, Vec_IntSize(vSuper), nLutSize, -1 );
1154 if ( Vec_IntSize(vSuper) == 64 )
1156 assert( Vec_IntSize(vSuper) <= 64 );
1160 if ( pCost[0] == 17 && pCost[1] == 17 )
1162 Str_NtkBalanceTwo( pNew,
p, pObj, 0, 1, vDelay, pCost, pSuper, pMatrix, Vec_IntSize(vSuper), nLutSize, 2 );
1169 for ( iStop = 0; iStop < Vec_IntSize(vSuper); iStop++ )
1170 if ( (pCost[iStop] >> 4) != (pCost[0] >> 4) )
1175 iBest = iStop, OccurBest = Str_CountBits(pMatrix[0] & pMatrix[iStop]);
1176 for ( i = iStop + 1; i < Vec_IntSize(vSuper); i++ )
1178 if ( (pCost[i] >> 4) != (pCost[iStop] >> 4) )
1180 OccurNew = Str_CountBits(pMatrix[0] & pMatrix[i]);
1181 if ( OccurBest < OccurNew )
1182 iBest = i, OccurBest = OccurNew;
1184 assert( iBest > 0 && iBest < Vec_IntSize(vSuper) );
1185 Str_NtkBalanceTwo( pNew,
p, pObj, 0, iBest, vDelay, pCost, pSuper, pMatrix, Vec_IntSize(vSuper), nLutSize, -1 );
1191 iBest = -1; CostBest = -1; OccurBest2 = -1; OccurBest = -1;
1192 for ( i = 1; i < iStop; i++ )
1194 CostNew = (pCost[0] & 15) + (pCost[i] & 15);
1195 if ( CostNew > nLutSize )
1197 OccurNew = Str_CountBits(pMatrix[0] & pMatrix[i]);
1198 if ( CostBest < CostNew || (CostBest == CostNew && OccurBest < OccurNew) )
1199 CostBest = CostNew, iBest = i, OccurBest = OccurNew;
1202 if ( CostBest == nLutSize )
1204 assert( iBest > 0 && iBest < Vec_IntSize(vSuper) );
1205 Str_NtkBalanceTwo( pNew,
p, pObj, 0, iBest, vDelay, pCost, pSuper, pMatrix, Vec_IntSize(vSuper), nLutSize, CostBest );
1211 iBest = iBest2 = -1; CostBest = CostBest2 = -1, OccurBest = OccurBest2 = -1;
1212 for ( i = 0; i < iStop; i++ )
1213 for ( k = i+1; k < iStop; k++ )
1215 CostNew = (pCost[i] & 15) + (pCost[k] & 15);
1216 OccurNew = Str_CountBits(pMatrix[i] & pMatrix[k]);
1217 if ( CostNew <= nLutSize )
1219 if ( OccurBest < OccurNew || (OccurBest == OccurNew && CostBest < CostNew ))
1220 CostBest = CostNew, iBest = (i << 16) | k, OccurBest = OccurNew;
1224 if ( OccurBest2 < OccurNew || (OccurBest2 == OccurNew && CostBest2 < CostNew) )
1225 CostBest2 = CostNew, iBest2 = (i << 16) | k, OccurBest2 = OccurNew;
1231 Str_NtkBalanceTwo( pNew,
p, pObj, iBest>>16, iBest&0xFFFF, vDelay, pCost, pSuper, pMatrix, Vec_IntSize(vSuper), nLutSize, CostBest );
1238 Str_NtkBalanceTwo( pNew,
p, pObj, iBest2>>16, iBest2&0xFFFF, vDelay, pCost, pSuper, pMatrix, Vec_IntSize(vSuper), nLutSize, -1 );
1243 pObj->
iCopy =
Str_NtkBalanceTwo( pNew,
p, pObj, 0, 1, vDelay, pCost, pSuper, pMatrix, 2, nLutSize, -1 );
1262 int n, m, iRes, fUseRestruct = 1;
1265 for ( n = 0; n < nGroups; n++ )
1267 iRes =
Str_MuxRestructure( pNew,
p, Str_ObjId(
p, pObj), nMuxes, vDelay, nLutSize, fRecursive, fOptArea, fVerbose );
1270 for ( m = 0; m < nMuxes; m++, pObj++ )
1272 pObj->
iCopy =
Gia_ManHashMuxReal( pNew, Str_ObjFaninCopy(
p, pObj, 2), Str_ObjFaninCopy(
p, pObj, 1), Str_ObjFaninCopy(
p, pObj, 0) );
1273 Str_ObjDelay( pNew, Abc_Lit2Var(pObj->
iCopy), nLutSize, vDelay );
1286 for ( n = 0; n < nGroups * nMuxes; n++, pObj++ )
1288 pObj->
iCopy =
Gia_ManHashMuxReal( pNew, Str_ObjFaninCopy(
p, pObj, 2), Str_ObjFaninCopy(
p, pObj, 1), Str_ObjFaninCopy(
p, pObj, 0) );
1289 Str_ObjDelay( pNew, Abc_Lit2Var(pObj->
iCopy), nLutSize, vDelay );
1298 int nGroups, nMuxes, CioId;
1299 int arrTime, Delay = 0;
1307 if ( pNew->
vSuper == NULL )
1308 pNew->
vSuper = Vec_IntAlloc( 1000 );
1309 if ( pNew->
vStore == NULL )
1310 pNew->
vStore = Vec_IntAlloc( 1000 );
1322 pObj->
iCopy = Gia_ManAppendCi( pNew );
1326 CioId = Gia_ObjCioId( Gia_ManObj(pNew, Abc_Lit2Var(pObj->
iCopy)) );
1329 Vec_IntWriteEntry( vDelay, Abc_Lit2Var(pObj->
iCopy), arrTime );
1335 Str_ObjReadGroup(
p, pObj, &nGroups, &nMuxes );
1336 assert( nGroups * nMuxes >= 2 );
1337 Str_NtkBalanceMux( pNew,
p, pObj, vDelay, nLutSize, nGroups, nMuxes, fRecursive, fOptArea, fVerbose );
1338 pObj += nGroups * nMuxes - 1;
1342 pObj->
iCopy =
Gia_ManHashMuxReal( pNew, Str_ObjFaninCopy(
p, pObj, 2), Str_ObjFaninCopy(
p, pObj, 1), Str_ObjFaninCopy(
p, pObj, 0) );
1343 Str_ObjDelay( pNew, Abc_Lit2Var(pObj->
iCopy), nLutSize, vDelay );
1347 pObj->
iCopy = Gia_ManAppendCo( pNew, Str_ObjFaninCopy(
p, pObj, 0) );
1348 arrTime = Vec_IntEntry(vDelay, Abc_Lit2Var(Str_ObjFaninCopy(
p, pObj, 0)) );
1349 Delay = Abc_MaxInt( Delay, arrTime );
1352 CioId = Gia_ObjCioId( Gia_ManObj(pNew, Abc_Lit2Var(pObj->
iCopy)) );
1357 pObj->
iCopy = 0, Vec_IntWriteEntry(vDelay, 0, 17);
1361 printf(
"Max delay = %d. Old objs = %d. New objs = %d.\n", Delay >> 4, Gia_ManObjNum(pGia), Gia_ManObjNum(pNew) );
1362 Vec_IntFree( vDelay );
1400 pNew =
Str_NtkBalance(
p, pNtk, nLutSize, fUseMuxes, fRecursive, fOptArea, fVerbose );
1416 pNew =
Str_NtkBalance(
p, pNtk, nLutSize, fUseMuxes, fRecursive, fOptArea, fVerbose );
1420 Str_NtkPs( pNtk, Abc_Clock() - clk );
1421 Str_NtkDelete( pNtk );
1460static inline int Str_MuxHasFanin(
Str_Mux_t * pMux,
int i ) {
return pMux->
Edge[i].
Fan > 0 && Str_MuxFanin(pMux, i)->Copy != -2; }
1468 printf(
"%d", -pMux->
Edge[i].
Fan );
1473 pFanin = Str_MuxFanin( pMux, i );
1493 Str_Mux_t * pFanin = Str_MuxFanin( pMux, i );
1509 for ( i = 1; i <= nMuxes; i++ )
1516 pObj = Str_NtkObj( pNtk, iMux + nMuxes - i );
1518 for ( k = 0; k < 3; k++ )
1520 pMux->
Edge[k].
fCompl = Str_ObjFaninC(pNtk, pObj, k);
1521 if ( Str_ObjFaninId(pNtk, pObj, k) >= iMux )
1522 pMux->
Edge[k].
Fan = iMux + nMuxes - Str_ObjFaninId(pNtk, pObj, k);
1526 pMux->
Edge[k].
Copy = Str_ObjFanin(pNtk, pObj, k)->iCopy;
1536 Str_Mux_t * pFanin = Str_MuxFanin( pMux, i );
1542 Str_ObjDelay( pNew, Abc_Lit2Var(pMux->
Edge[i].
Copy), pFanin->
nLutSize, vDelay );
1549 int pInds[3], MidFan, MidCom, MidDel, MidCop, c;
1550 int iRes, iCond, fCompl;
1555 pBackup[0] = pTree[ Abc_Lit2Var(pPath[k]) ];
1556 pBackup[1] = pTree[ Abc_Lit2Var(pPath[i+1])];
1557 pBackup[2] = pTree[ Abc_Lit2Var(pPath[i]) ];
1560 pSpots[0] = pTree + Abc_Lit2Var(pPath[k]);
1561 pSpots[1] = pTree + Abc_Lit2Var(pPath[i+1]);
1562 pSpots[2] = pTree + Abc_Lit2Var(pPath[i]);
1563 pInds[0] = Abc_LitIsCompl(pPath[k]);
1564 pInds[1] = Abc_LitIsCompl(pPath[i+1]);
1565 pInds[2] = Abc_LitIsCompl(pPath[i]);
1567 assert( pSpots[0]->Edge[pInds[0]].Fan > 0 );
1568 assert( pSpots[1]->Edge[pInds[1]].Fan > 0 );
1571 for ( c = i+1; c < k; c++ )
1572 fCompl ^= pTree[Abc_Lit2Var(pPath[c])].
Edge[Abc_LitIsCompl(pPath[c])].
fCompl;
1574 MidFan = pSpots[2]->
Edge[!pInds[2]].
Fan;
1577 MidCop = pSpots[2]->
Edge[!pInds[2]].
Copy;
1582 pSpots[0]->
Edge[pInds[0]].
Fan = pSpots[2]->
Id;
1584 pSpots[1]->
Edge[pInds[1]].
Fan = MidFan;
1587 pSpots[1]->
Edge[pInds[1]].
Copy = MidCop;
1589 for ( c = i + 1; c < k; c++ )
1590 pSpots[2]->Edge[2].FanDel = Str_Delay2( pSpots[2]->Edge[2].FanDel, pTree[Abc_Lit2Var(pPath[c])].Edge[2].FanDel, pTree->
nLutSize );
1595 for ( c = i; c < k; c++ )
1597 assert( pTree[Abc_Lit2Var(pPath[c])].Edge[2].fCompl == 0 );
1598 iCond = pTree[Abc_Lit2Var(pPath[c])].
Edge[2].
Copy;
1599 iCond = Abc_LitNotCond( iCond, !Abc_LitIsCompl(pPath[c]) );
1601 Str_ObjDelay( pNew, Abc_Lit2Var(iRes), pTree->
nLutSize, vDelay );
1604 pSpots[2]->
Edge[2].
Copy = Abc_LitNotCond( iRes, !Abc_LitIsCompl(pPath[i]) );
1610 pTree[ Abc_Lit2Var(pPath[k]) ] = pBackup[0];
1611 pTree[ Abc_Lit2Var(pPath[i+1])] = pBackup[1];
1612 pTree[ Abc_Lit2Var(pPath[i]) ] = pBackup[2];
1619 pPath[ (*pnLength)++ ] = Abc_Var2Lit(pMux->
Id, i);
1625 for ( i = 0; i < 2; i++ )
1637 if ( pRoot->
Edge[i].
Fan <= 0 )
1639 pMux = Str_MuxFanin( pRoot, i );
1647 pMux = Str_MuxFanin( pMux, 0 );
1649 pMux = Str_MuxFanin( pMux, 1 );
1659 int i, k, nLength = 0, ForkBest = -1, nChecks = 0;
1661 if ( RetValue == 0 )
1664 printf(
"Trying node %d with path of length %d.\n", pRoot->
Id, nLength );
1665 for ( i = 0; i < nLength; i++ )
1666 for ( k = i+2; k < nLength; k++ )
1671 if ( DelayBest > Delay || (ForkBest > 0 && DelayBest == Delay) )
1672 DelayBest = Delay, ForkBest = (i << 16) | k;
1674 printf(
"%2d %2d -> %3d (%3d)\n", i, k, Delay, DelayBest );
1677 if ( ForkBest == -1 )
1680 printf(
"Did not find!\n" );
1684 Str_MuxChangeOnce( pTree, pPath, ForkBest >> 16, ForkBest & 0xFFFF, NULL, pNew, vDelay );
1687 printf(
"Node %6d (%3d %3d) : Checks = %d. Delay: %d -> %d.\n",
1688 pRoot->
Id, ForkBest >> 16, ForkBest & 0xFFFF, nChecks, DelayInit, DelayBest );
1701 fChanges |=
Str_MuxTryOnce( pNew, pNtk, pTree, pRoot, Edge, vDelay, fVerbose );
1708 int Delay, Delay2, fChanges = 0;
1709 if ( nMuxes >= Limit )
1711 assert( nMuxes < Limit );
1712 Str_MuxCreate( pTree, pNtk, iMux, nMuxes, vDelay, nLutSize );
1731 int Delay, Delay2, fChanges = 0;
1732 if ( nMuxes >= Limit )
1734 assert( nMuxes < Limit );
1735 Str_MuxCreate( pTree, pNtk, iMux, nMuxes, vDelay, nLutSize );
1739 if ( !
Str_MuxTryOnce(pNew, pNtk, pTree, pTree, 0, vDelay, fVerbose) )
1778 Str_Mux_t * pFanin0 = Str_MuxFanin( pMux, 0 );
1779 Str_Mux_t * pFanin1 = Str_MuxFanin( pMux, 1 );
1785 Str_ObjDelay( pNew, Abc_Lit2Var(iRes), pMux->
nLutSize, vDelay );
1793 int fSkipMoving = 1;
1795 int nMuxes0, nMuxes1;
1796 if ( pRoot->
Edge[i].
Fan <= 0 )
1798 pMux = Str_MuxFanin( pRoot, i );
1801 if ( nMuxes0 + nMuxes1 < 2 )
1802 return 1 + nMuxes0 + nMuxes1;
1803 if ( nMuxes0 + nMuxes1 == 2 )
1805 if ( nMuxes0 == 2 || nMuxes1 == 2 )
1807 pFanin0 = Str_MuxFanin( pMux, (
int)(nMuxes1 == 2) );
1808 assert( Str_MuxHasFanin(pFanin0, 0) != Str_MuxHasFanin(pFanin0, 1) );
1809 Path[2] = Abc_Var2Lit(pRoot->
Id, i);
1810 Path[1] = Abc_Var2Lit(pMux->
Id, (
int)(nMuxes1 == 2) );
1811 Path[0] = Abc_Var2Lit(pFanin0->
Id, Str_MuxHasFanin(pFanin0, 1));
1817 assert( nMuxes0 + nMuxes1 == 3 || nMuxes0 + nMuxes1 == 4 );
1818 assert( nMuxes0 == 2 || nMuxes1 == 2 );
1826 pFanin0 = Str_MuxFanin( pMux, 0 );
1827 assert( Str_MuxHasFanin(pFanin0, 0) != Str_MuxHasFanin(pFanin0, 1) );
1828 Path[3] = Abc_Var2Lit(pRoot->
Id, i);
1829 Path[2] = Abc_Var2Lit(pMux->
Id, 0 );
1830 Path[1] = Abc_Var2Lit(pFanin0->
Id, Str_MuxHasFanin(pFanin0, 1));
1831 pFanin1 = Str_MuxFanin( pFanin0, Str_MuxHasFanin(pFanin0, 1) );
1832 assert( !Str_MuxHasFanin(pFanin1, 0) && !Str_MuxHasFanin(pFanin1, 1) );
1833 Path[0] = Abc_Var2Lit(pFanin1->
Id, 0);
1838 pFanin0 = Str_MuxFanin( pMux, 1 );
1839 assert( Str_MuxHasFanin(pFanin0, 0) != Str_MuxHasFanin(pFanin0, 1) );
1840 Path[3] = Abc_Var2Lit(pRoot->
Id, i);
1841 Path[2] = Abc_Var2Lit(pMux->
Id, 1 );
1842 Path[1] = Abc_Var2Lit(pFanin0->
Id, Str_MuxHasFanin(pFanin0, 1));
1843 pFanin1 = Str_MuxFanin( pFanin0, Str_MuxHasFanin(pFanin0, 1) );
1844 assert( !Str_MuxHasFanin(pFanin1, 0) && !Str_MuxHasFanin(pFanin1, 1) );
1845 Path[0] = Abc_Var2Lit(pFanin1->
Id, 0);
1849 return nMuxes0 + nMuxes1 - 2;
1856 if ( nMuxes >= Limit )
1858 assert( nMuxes < Limit );
1859 Str_MuxCreate( pTree, pNtk, iMux, nMuxes, vDelay, nLutSize );
1861 assert( Result >= 0 && Result <= 2 );
#define ABC_SWAP(Type, a, b)
#define ABC_ALLOC(type, num)
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
void Gia_ManSuperCollectAnd_rec(Gia_Man_t *p, Gia_Obj_t *pObj, int fStrict)
void Gia_ManSimplifyAnd(Vec_Int_t *vSuper)
void Gia_ManSuperCollectXor_rec(Gia_Man_t *p, Gia_Obj_t *pObj, int fStrict)
void Gia_ManSuperCollect(Gia_Man_t *p, Gia_Obj_t *pObj, int fStrict)
void Gia_ManSimplifyXor(Vec_Int_t *vSuper)
FUNCTION DEFINITIONS ///.
int Str_MuxFindPathEdge_rec(Str_Mux_t *pMux, int i, int *pPath, int *pnLength)
#define STR_SUPER
DECLARATIONS ///.
int Str_MuxRestructure(Gia_Man_t *pNew, Str_Ntk_t *pNtk, int iMux, int nMuxes, Vec_Int_t *vDelay, int nLutSize, int fRecursive, int fOptArea, int fVerbose)
Vec_Int_t * Str_ManCreateRoots(Vec_Wec_t *vGroups, int nObjs)
int Str_MuxRestruct_rec(Gia_Man_t *pNew, Str_Ntk_t *pNtk, Str_Mux_t *pTree, Str_Mux_t *pRoot, int Edge, Vec_Int_t *vDelay, int fVerbose)
Gia_Man_t * Str_NtkBalance(Gia_Man_t *pGia, Str_Ntk_t *p, int nLutSize, int fUseMuxes, int fRecursive, int fOptArea, int fVerbose)
Str_Ntk_t * Str_ManNormalize(Gia_Man_t *p)
void Str_MuxStructDump(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Str_t *vStr)
Gia_Man_t * Gia_ManLutBalance(Gia_Man_t *p, int nLutSize, int fUseMuxes, int fRecursive, int fOptArea, int fVerbose)
Str_Mux_t * Str_MuxFindBranching(Str_Mux_t *pRoot, int i)
void Str_MuxDelayPrint_rec(Str_Mux_t *pMux, int i)
int Str_NtkBalanceTwo(Gia_Man_t *pNew, Str_Ntk_t *p, Str_Obj_t *pObj, int i, int j, Vec_Int_t *vDelay, int *pCost, int *pSuper, word *pMatrix, int nSize, int nLutSize, int CostBest)
int Str_ManVectorAffinity(Gia_Man_t *p, Vec_Int_t *vSuper, Vec_Int_t *vDelay, word *Matrix, int nLimit)
int Str_MuxRestructure2(Gia_Man_t *pNew, Str_Ntk_t *pNtk, int iMux, int nMuxes, Vec_Int_t *vDelay, int nLutSize, int fVerbose)
void Str_MuxCreate(Str_Mux_t *pTree, Str_Ntk_t *pNtk, int iMux, int nMuxes, Vec_Int_t *vDelay, int nLutSize)
int Str_MuxRestructureArea(Gia_Man_t *pNew, Str_Ntk_t *pNtk, int iMux, int nMuxes, Vec_Int_t *vDelay, int nLutSize, int fVerbose)
Gia_Man_t * Gia_ManDupMuxesNoHash(Gia_Man_t *p)
Gia_Man_t * Str_NtkToGia(Gia_Man_t *pGia, Str_Ntk_t *p)
void Str_MuxChangeOnce(Str_Mux_t *pTree, int *pPath, int i, int k, Str_Mux_t *pBackup, Gia_Man_t *pNew, Vec_Int_t *vDelay)
struct Str_Ntk_t_ Str_Ntk_t
struct Str_Obj_t_ Str_Obj_t
Vec_Wec_t * Str_ManDeriveTrees(Gia_Man_t *p)
void Str_MuxInputsCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
int Str_MuxRestructAreaThree(Gia_Man_t *pNew, Str_Mux_t *pMux, Vec_Int_t *vDelay, int fVerbose)
Str_Ntk_t * Str_ManNormalizeInt(Gia_Man_t *p, Vec_Wec_t *vGroups, Vec_Int_t *vRoots)
struct Str_Mux_t_ Str_Mux_t
int Str_MuxFindPath_rec(Str_Mux_t *pMux, int *pPath, int *pnLength)
int Str_MuxToGia_rec(Gia_Man_t *pNew, Str_Mux_t *pMux, int i, Vec_Int_t *vDelay)
int Str_MuxRestructure1(Gia_Man_t *pNew, Str_Ntk_t *pNtk, int iMux, int nMuxes, Vec_Int_t *vDelay, int nLutSize, int fVerbose)
int Str_MuxRestructArea_rec(Gia_Man_t *pNew, Str_Mux_t *pTree, Str_Mux_t *pRoot, int i, Vec_Int_t *vDelay, int fVerbose)
struct Str_Man_t_ Str_Man_t
void Str_NtkBalanceMulti2(Gia_Man_t *pNew, Str_Ntk_t *p, Str_Obj_t *pObj, Vec_Int_t *vDelay, int nLutSize)
void Str_MuxTraverse_rec(Gia_Man_t *p, int i)
int Str_ManMuxCountOne(char *p)
int Str_MuxDelayEdge_rec(Str_Mux_t *pMux, int i)
void Str_NtkBalanceMulti(Gia_Man_t *pNew, Str_Ntk_t *p, Str_Obj_t *pObj, Vec_Int_t *vDelay, int nLutSize)
void Str_MuxInputsCollect(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
void Str_MuxChangeUndo(Str_Mux_t *pTree, int *pPath, int i, int k, Str_Mux_t *pBackup)
void Str_MuxStructDump_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Str_t *vStr)
void Str_MuxStructCollect(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
int Str_MuxTryOnce(Gia_Man_t *pNew, Str_Ntk_t *pNtk, Str_Mux_t *pTree, Str_Mux_t *pRoot, int Edge, Vec_Int_t *vDelay, int fVerbose)
void Str_NtkBalanceMux(Gia_Man_t *pNew, Str_Ntk_t *p, Str_Obj_t *pObj, Vec_Int_t *vDelay, int nLutSize, int nGroups, int nMuxes, int fRecursive, int fOptArea, int fVerbose)
#define Str_NtkManForEachObj(p, pObj)
void Str_ManCheckOverlap(Gia_Man_t *p, Vec_Wec_t *vGroups)
void Str_ManNormalize_rec(Str_Ntk_t *pNtk, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Wec_t *vGroups, Vec_Int_t *vRoots)
struct Str_Edg_t_ Str_Edg_t
void Str_MuxStructCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
void Gia_ManHashStart(Gia_Man_t *p)
int Gia_ManHasDangling(Gia_Man_t *p)
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)
int Gia_ManHashMuxReal(Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
Gia_Man_t * Gia_ManDupNoMuxes(Gia_Man_t *p, int fSkipBufs)
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
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)
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
void Gia_ManCleanMark0(Gia_Man_t *p)
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
void Gia_ManCreateRefs(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)
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ManForEachMuxId(p, i)
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
#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)
unsigned __int64 word
DECLARATIONS ///.
int nObjCount[STR_UNUSED]
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
int Tim_ManBoxNum(Tim_Man_t *p)
void Tim_ManInitPiArrivalAll(Tim_Man_t *p, float Delay)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
void Tim_ManStop(Tim_Man_t *p)
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
void Abc_NamStop(Abc_Nam_t *p)
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
int Abc_NamObjNumMax(Abc_Nam_t *p)
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
#define Abc_NamManForEachObj(p, pStr, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.