62 p->nObjsAlloc = nObjsMax;
64 p->pObjs->iDiff0 =
p->pObjs->iDiff1 =
GIA_NONE;
66 p->vCis = Vec_IntAlloc( nObjsMax / 20 );
67 p->vCos = Vec_IntAlloc( nObjsMax / 20 );
84 if (
p->vSeqModelVec )
85 Vec_PtrFreeFree(
p->vSeqModelVec );
89 Vec_PtrFreeFree(
p->vNamesIn );
90 Vec_PtrFreeFree(
p->vNamesOut );
91 Vec_PtrFreeFree(
p->vNamesNode );
92 Vec_IntFreeP( &
p->vSwitching );
93 Vec_IntFreeP( &
p->vSuper );
94 Vec_IntFreeP( &
p->vStore );
95 Vec_IntFreeP( &
p->vClassNew );
96 Vec_IntFreeP( &
p->vClassOld );
97 Vec_IntFreeP( &
p->vPats );
98 Vec_BitFreeP( &
p->vPolars );
99 Vec_WrdFreeP( &
p->vSims );
100 Vec_WrdFreeP( &
p->vSimsT );
101 Vec_WrdFreeP( &
p->vSimsPi );
102 Vec_WrdFreeP( &
p->vSimsPo );
103 Vec_IntFreeP( &
p->vTimeStamps );
104 Vec_FltFreeP( &
p->vTiming );
105 Vec_VecFreeP( &
p->vClockDoms );
106 Vec_IntFreeP( &
p->vCofVars );
107 Vec_IntFreeP( &
p->vIdsOrig );
108 Vec_IntFreeP( &
p->vIdsEquiv );
109 Vec_IntFreeP( &
p->vLutConfigs );
110 Vec_IntFreeP( &
p->vEdgeDelay );
111 Vec_IntFreeP( &
p->vEdgeDelayR );
112 Vec_IntFreeP( &
p->vEdge1 );
113 Vec_IntFreeP( &
p->vEdge2 );
114 Vec_IntFreeP( &
p->vUserPiIds );
115 Vec_IntFreeP( &
p->vUserPoIds );
116 Vec_IntFreeP( &
p->vUserFfIds );
117 Vec_IntFreeP( &
p->vFlopClasses );
118 Vec_IntFreeP( &
p->vGateClasses );
119 Vec_IntFreeP( &
p->vObjClasses );
120 Vec_IntFreeP( &
p->vInitClasses );
121 Vec_IntFreeP( &
p->vRegClasses );
122 Vec_IntFreeP( &
p->vRegInits );
123 Vec_IntFreeP( &
p->vDoms );
124 Vec_IntFreeP( &
p->vBarBufs );
125 Vec_IntFreeP( &
p->vXors );
126 Vec_IntFreeP( &
p->vLevels );
127 Vec_IntFreeP( &
p->vTruths );
128 Vec_IntErase( &
p->vCopies );
129 Vec_IntErase( &
p->vCopies2 );
130 Vec_IntFreeP( &
p->vVar2Obj );
131 Vec_IntErase( &
p->vCopiesTwo );
132 Vec_IntErase( &
p->vSuppVars );
133 Vec_IntErase( &
p->vVarMap );
134 Vec_WrdFreeP( &
p->vSuppWords );
135 Vec_IntFreeP( &
p->vTtNums );
136 Vec_IntFreeP( &
p->vTtNodes );
137 Vec_WrdFreeP( &
p->vTtMemory );
138 Vec_PtrFreeP( &
p->vTtInputs );
139 Vec_IntFreeP( &
p->vMapping );
140 Vec_WecFreeP( &
p->vMapping2 );
141 Vec_WecFreeP( &
p->vFanouts2 );
142 Vec_IntFreeP( &
p->vCellMapping );
143 Vec_IntFreeP( &
p->vPacking );
144 Vec_IntFreeP( &
p->vConfigs );
146 Vec_FltFreeP( &
p->vInArrs );
147 Vec_FltFreeP( &
p->vOutReqs );
148 Vec_IntFreeP( &
p->vCiArrs );
149 Vec_IntFreeP( &
p->vCoReqs );
150 Vec_IntFreeP( &
p->vCoArrs );
151 Vec_IntFreeP( &
p->vCoAttrs );
152 Vec_IntFreeP( &
p->vWeights );
154 Vec_IntFree(
p->vCis );
155 Vec_IntFree(
p->vCos );
156 Vec_IntErase( &
p->vHash );
157 Vec_IntErase( &
p->vHTable );
158 Vec_IntErase( &
p->vRefs );
159 Vec_StrFreeP( &
p->vStopsF );
160 Vec_StrFreeP( &
p->vStopsB );
197 Memory +=
sizeof(
Gia_Obj_t) * Gia_ManObjNum(
p);
198 Memory +=
sizeof(int) * Gia_ManCiNum(
p);
199 Memory +=
sizeof(int) * Gia_ManCoNum(
p);
200 Memory +=
sizeof(int) * Vec_IntSize(&
p->vHTable);
201 Memory +=
sizeof(int) * Gia_ManObjNum(
p) * (
p->pRefs != NULL);
202 Memory += Vec_IntMemory(
p->vLevels );
203 Memory += Vec_IntMemory(
p->vCellMapping );
204 Memory += Vec_IntMemory( &
p->vCopies );
205 Memory += Vec_FltMemory(
p->vInArrs );
206 Memory += Vec_FltMemory(
p->vOutReqs );
207 Memory += Vec_PtrMemory(
p->vNamesIn );
208 Memory += Vec_PtrMemory(
p->vNamesOut );
209 Memory += Vec_PtrMemory(
p->vNamesNode );
247 if (
p->vFlopClasses == NULL )
250 Abc_Print( 1,
"%d", Vec_IntEntry(
p->vFlopClasses, i) );
251 Abc_Print( 1,
"\n" );
277 int i, nFixed = 0, nUndef = 0;
278 if (
p->pPlacement == NULL )
280 for ( i = 0; i < Gia_ManObjNum(
p); i++ )
282 nFixed +=
p->pPlacement[i].fFixed;
283 nUndef +=
p->pPlacement[i].fUndef;
285 Abc_Print( 1,
"Placement: Objects = %8d. Fixed = %8d. Undef = %8d.\n", Gia_ManObjNum(
p), nFixed, nUndef );
302 if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
304 Gia_ObjSetTravIdCurrent(
p, pObj);
305 Vec_IntPush( vObjs, Gia_ObjId(
p, pObj) );
306 if ( Gia_ObjIsCi(pObj) )
309 if ( Gia_ObjIsAnd(pObj) )
316 int t, i, iObjId, nSizePrev, nSizeCurr;
318 vObjs = Vec_IntAlloc( 100 );
321 Gia_ObjSetTravIdCurrent(
p, Gia_ManConst0(
p) );
322 Vec_IntPush( vObjs, 0 );
324 nSizePrev = Vec_IntSize(vObjs);
328 Abc_Print( 1,
"Tents: " );
329 for ( t = 1; nSizePrev < Vec_IntSize(vObjs); t++ )
332 nSizeCurr = Vec_IntSize(vObjs);
335 nPis += Gia_ObjIsPi(
p, Gia_ManObj(
p, iObjId));
336 if ( Gia_ObjIsRo(
p, Gia_ManObj(
p, iObjId)) )
339 Abc_Print( 1,
"%d=%d(%d) ", t, nSizeCurr - nSizePrev, nPis );
340 nSizePrev = nSizeCurr;
342 Abc_Print( 1,
" Unused=%d\n", Gia_ManObjNum(
p) - Vec_IntSize(vObjs) );
343 Vec_IntFree( vObjs );
367 for ( i = 0; i < 6; i++ )
369 printf(
"%d = %d ", i, Counts[i] );
371 printf(
"B = %d ", Counts[0] + Counts[1] );
372 printf(
"X = %d ", Counts[2] + Counts[3] );
373 printf(
"Q = %d\n", Counts[4] + Counts[5] );
379 else if ( Value == 1 )
381 else if ( Value == 2 )
383 else if ( Value == 3 )
385 else if ( Value == 4 )
387 else if ( Value == 5 )
409 int i, nEquivs = 0, nChoices = 0;
413 if ( !Gia_ObjSibl(
p, i) )
418 assert( !Gia_ObjSiblObj(
p, i)->fMark0 );
419 assert( Gia_ObjIsAnd(Gia_ObjSiblObj(
p, i)) );
421 Abc_Print( 1,
"Choice stats: Equivs =%7d. Choices =%7d.\n", nEquivs, nChoices );
439 printf(
"Edges (Q=2) : " );
440 printf(
"edge =%8d ", (Vec_IntCountPositive(
p->vEdge1) + Vec_IntCountPositive(
p->vEdge2))/2 );
472 FILE * pTable = fopen( pDumpFile,
"wb" );
473 fprintf( pTable,
"{\n" );
474 fprintf( pTable,
" \"name\" : \"%s\",\n",
p->pName );
475 fprintf( pTable,
" \"input\" : %d,\n", Gia_ManCiNum(
p) );
476 fprintf( pTable,
" \"output\" : %d,\n", Gia_ManCoNum(
p) );
477 fprintf( pTable,
" \"flop\" : %d,\n", Gia_ManRegNum(
p) );
478 fprintf( pTable,
" \"and\" : %d,\n", Gia_ManAndNum(
p) );
480 fprintf( pTable,
"}\n" );
498 int fHaveLevels =
p->vLevels != NULL;
499 if ( pPars && pPars->
fMiter )
507 Abc_Print( 1,
"%-8s : ",
p->pName );
512 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 15 );
514 Abc_Print( 1,
"%-8s : ",
p->pName );
515 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 );
518 Abc_Print( 1,
"%s%-8s%s : ",
"\033[1;37m",
p->pName,
"\033[0m" );
521 Abc_Print( 1,
"i/o =%7d/%7d",
524 if ( Gia_ManConstrNum(
p) )
525 Abc_Print( 1,
"(c=%d)", Gia_ManConstrNum(
p) );
526 if ( Gia_ManRegNum(
p) )
527 Abc_Print( 1,
" ff =%7d", Gia_ManRegNum(
p) );
532 Abc_Print( 1,
" %s =%8d",
p->pMuxes?
"nod" :
"and", Gia_ManAndNum(
p) );
540 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
541 SetConsoleTextAttribute( hConsole, 11 );
542 Abc_Print( 1,
" %s =%8d",
p->pMuxes?
"nod" :
"and", Gia_ManAndNum(
p) );
543 SetConsoleTextAttribute( hConsole, 13 );
546 SetConsoleTextAttribute( hConsole, 7 );
549 Abc_Print( 1,
" %s%s =%8d%s",
"\033[1;36m",
p->pMuxes?
"nod" :
"and", Gia_ManAndNum(
p),
"\033[0m" );
550 Abc_Print( 1,
" %slev =%5d%s",
"\033[1;35m",
Gia_ManLevelNum(
p),
"\033[0m" );
555 Vec_IntFreeP( &
p->vLevels );
556 if ( pPars && pPars->
fCut )
559 if ( Gia_ManHasChoices(
p) )
560 Abc_Print( 1,
" ch =%5d", Gia_ManChoiceNum(
p) );
565 if ( Gia_ManBufNum(
p) )
566 Abc_Print( 1,
" buf = %d", Gia_ManBufNum(
p) );
567 if ( Gia_ManXorNum(
p) &&
p->pMuxes == NULL )
568 Abc_Print( 1,
" xor = %d", Gia_ManXorNum(
p) );
573 static int nPiPo = 0;
574 static float PrevSwiTotal = 0;
576 Abc_Print( 1,
" power =%8.1f", SwiTotal );
577 if ( PrevSwiTotal > 0 && nPiPo == Gia_ManCiNum(
p) + Gia_ManCoNum(
p) )
578 Abc_Print( 1,
" %6.2f %%", 100.0*(PrevSwiTotal-SwiTotal)/PrevSwiTotal );
579 else if ( PrevSwiTotal == 0 || nPiPo != Gia_ManCiNum(
p) + Gia_ManCoNum(
p) )
580 PrevSwiTotal = SwiTotal, nPiPo = Gia_ManCiNum(
p) + Gia_ManCoNum(
p);
583 Abc_Print( 1,
"\n" );
586 if (
p->pReprs &&
p->pNexts )
588 if ( Gia_ManHasMapping(
p) && (pPars == NULL || !pPars->
fSkipMap) )
592 if ( pPars && pPars->
fNpn && Gia_ManHasMapping(
p) )
598 if ( pPars && pPars->
fLutProf && Gia_ManHasMapping(
p) )
612 if (
p->vInitClasses )
625 if ( pPars && pPars->
fTents )
660 Abc_Print( 1,
"i/o =%7d/%7d ", Gia_ManPiNum(
p), Gia_ManPoNum(
p) );
661 Abc_Print( 1,
"ff =%7d ", Gia_ManRegNum(
p) );
662 Abc_Print( 1,
"and =%8d ", Gia_ManAndNum(
p) );
665 Abc_Print( 1,
"\n" );
682 int i, nSat = 0, nUnsat = 0, nUndec = 0, iOut = -1;
685 pChild = Gia_ObjChild0(pObj);
687 if ( pChild == Gia_ManConst0(
p) )
690 else if ( pChild == Gia_ManConst1(
p) )
697 else if ( Gia_ObjIsPi(
p, Gia_Regular(pChild)) )
715 Abc_Print( 1,
"Outputs = %7d. Unsat = %7d. Sat = %7d. Undec = %7d.\n",
716 Gia_ManPoNum(
p), nUnsat, nSat, nUndec );
738 printf(
"Statistics for each outputs of the miter:\n" );
741 iObjId = Gia_ObjId(
p, pObj);
742 printf(
"%4d : ", i );
743 printf(
"Level = %5d ", Gia_ObjLevelId(
p, iObjId) );
747 printf(
"Prob = %8.4f ", Vec_FltEntry(vProb, iObjId) );
750 Vec_FltFree( vProb );
784 Abc_Print( 1,
"REG: Beg = %5d. End = %5d. (R =%5.1f %%) ",
785 Gia_ManRegNum(
p), Gia_ManRegNum(pNew),
786 Gia_ManRegNum(
p)? 100.0*(Gia_ManRegNum(
p)-Gia_ManRegNum(pNew))/Gia_ManRegNum(
p) : 0.0 );
787 Abc_Print( 1,
"AND: Beg = %6d. End = %6d. (R =%5.1f %%)",
788 Gia_ManAndNum(
p), Gia_ManAndNum(pNew),
789 Gia_ManAndNum(
p)? 100.0*(Gia_ManAndNum(
p)-Gia_ManAndNum(pNew))/Gia_ManAndNum(
p) : 0.0 );
790 Abc_Print( 1,
"\n" );
808 Vec_Int_t * vLeaves, * vTruth, * vVisited;
809 int * pLutClass, ClassCounts[222] = {0};
810 int i, k, iFan, Class, OtherClasses, OtherClasses2,
nTotal, Counter, Counter2;
811 unsigned * pTruth;
int nLutSize = 0;
812 assert( Gia_ManHasMapping(
p) );
814 vLeaves = Vec_IntAlloc( 100 );
815 vVisited = Vec_IntAlloc( 100 );
816 vTruth = Vec_IntAlloc( (1<<16) );
821 nLutSize = Abc_MaxInt( nLutSize, Gia_ObjLutSize(
p,i) );
822 if ( Gia_ObjLutSize(
p,i) > 4 )
824 Vec_IntClear( vLeaves );
826 Vec_IntPush( vLeaves, iFan );
828 Vec_IntPush( vLeaves, 0 );
831 ClassCounts[ Class ]++;
832 pLutClass[i] = Class;
834 Vec_IntFree( vLeaves );
835 Vec_IntFree( vTruth );
836 Vec_IntFree( vVisited );
837 Vec_IntFreeP( &
p->vTruths );
839 for ( i = 0; i < 222; i++ )
841 Abc_Print( 1,
"NPN CLASS STATISTICS (for %d LUT4 present in the current mapping):\n",
nTotal );
843 for ( i = k = 0; i < 222; i++ )
845 if ( ClassCounts[i] == 0 )
849 OtherClasses += ClassCounts[i];
850 Abc_Print( 1,
"%3d: Class %3d : Count = %6d (%7.2f %%) %s\n",
851 ++k, i, ClassCounts[i], 100.0 * ClassCounts[i] / (
nTotal+1), pNames[i] );
853 OtherClasses =
nTotal - OtherClasses;
854 Abc_Print( 1,
"Other : Count = %6d (%7.2f %%)\n",
855 OtherClasses, 100.0 * OtherClasses / (
nTotal+1) );
857 OtherClasses = OtherClasses2 = 0;
862 if ( pLutClass[i] != 109 )
864 Counter = Counter2 = 0;
867 Counter += (pLutClass[iFan] == 109);
868 Counter2 += (pLutClass[iFan] == 109) && (Gia_ObjRefNumId(
p, iFan) == 1);
870 OtherClasses += (Counter > 1);
871 OtherClasses2 += (Counter2 > 1);
878 Abc_Print( 1,
"Approximate number of 4:1 MUX structures: All = %6d (%7.2f %%) MFFC = %6d (%7.2f %%)\n",
879 OtherClasses, 100.0 * OtherClasses / (
nTotal+1),
880 OtherClasses2, 100.0 * OtherClasses2 / (
nTotal+1) );
884 int nTopPairs = 100, nTopShow = 30;
885 int i, j, k, iFan, * pVec = NULL;
886 Vec_Int_t * vPairs = Vec_IntAlloc( 3 * nTopPairs );
889 int Num1 = pLutClass[iFan];
890 int Num2 = pLutClass[j];
891 assert( Vec_IntSize(vPairs) % 3 == 0 );
892 for ( i = 0; i < Vec_IntSize(vPairs); i += 3 )
893 if ( Vec_IntEntry(vPairs, i+0) == Num1 && Vec_IntEntry(vPairs, i+1) == Num2 )
895 if ( i == Vec_IntSize(vPairs) ) {
896 if ( Vec_IntSize(vPairs) < 3*nTopPairs ) {
897 Vec_IntPush( vPairs, Num1 );
898 Vec_IntPush( vPairs, Num2 );
899 Vec_IntPush( vPairs, 1 );
904 assert( Vec_IntEntry(vPairs, i+0) == Num1 );
905 assert( Vec_IntEntry(vPairs, i+1) == Num2 );
906 Vec_IntAddToEntry( vPairs, i+2, 1 );
908 pVec = Vec_IntArray( vPairs );
909 while ( i > 0 && pVec[i+2] > pVec[i-1] ) {
910 ABC_SWAP(
int, pVec[i+0], pVec[i-3] )
911 ABC_SWAP(
int, pVec[i+1], pVec[i-2] )
912 ABC_SWAP(
int, pVec[i+2], pVec[i-1] )
915 while ( i < Vec_IntSize(vPairs) - 3 && pVec[i+2] < pVec[i+5] ) {
916 ABC_SWAP(
int, pVec[i+0], pVec[i+3] )
917 ABC_SWAP(
int, pVec[i+1], pVec[i+4] )
918 ABC_SWAP(
int, pVec[i+2], pVec[i+5] )
924 pVec = Vec_IntArray( vPairs );
925 nTopShow = Abc_MinInt( nTopShow, Vec_IntSize(vPairs)/3 );
926 for ( i = 0; i < 3*nTopShow; i += 3 )
927 printf(
"%3d : (%3d %3d) x %3d\n", i/3, pVec[i+0], pVec[i+1], pVec[i+2] );
928 Vec_IntFree( vPairs );
947 if ( Gia_ObjIsTravIdCurrent(
p, pObj ) )
949 Gia_ObjSetTravIdCurrent(
p, pObj );
950 if ( Gia_ObjIsCi(pObj) )
955 int i, iFirst, nTerms, iBox;
962 for ( i = 0; i < nTerms; i++ )
964 pObj = Gia_ManCi(
p, iFirst + i );
965 Gia_ObjSetTravIdCurrent(
p, pObj );
970 for ( i = 0; i < nTerms; i++ )
972 pObj = Gia_ManCo(
p, iFirst + i );
976 Vec_IntPush( vObjs, -iBox-1 );
981 else if ( Gia_ObjIsCo(pObj) )
985 else if ( Gia_ObjIsAnd(pObj) )
987 int iFan, k, iObj = Gia_ObjId(
p, pObj);
988 if ( Gia_ManHasMapping(
p) )
990 assert( Gia_ObjIsLut(
p, iObj) );
1000 Vec_IntPush( vObjs, iObj );
1002 else if ( !Gia_ObjIsConst0(pObj) )
1007 Vec_Int_t * vObjs = Vec_IntAlloc( Gia_ManObjNum(
p) );
1031 Vec_Int_t * vTimes = Vec_IntStartFull( Gia_ManObjNum(
p) );
1032 Gia_Obj_t * pObj;
int j, Entry, k, iFan;
1033 Vec_IntWriteEntry( vTimes, 0, 0 );
1041 Vec_IntWriteEntry( vTimes, Gia_ObjId(
p, pObj), (
int)arrTime );
1047 Vec_IntWriteEntry( vTimes, Gia_ObjId(
p, pObj), 0 );
1053 int Time0, iFirst, nTerms, iBox = -Entry-1;
1058 for ( k = 0; k < nTerms; k++ )
1060 pObj = Gia_ManCo(
p, iFirst + k );
1061 Time0 = Vec_IntEntry( vTimes, Gia_ObjFaninId0p(
p, pObj) );
1068 for ( k = 0; k < nTerms; k++ )
1070 pObj = Gia_ManCi(
p, iFirst + k );
1073 Vec_IntWriteEntry( vTimes, Gia_ObjId(
p, pObj), Time0 );
1076 else if ( Entry > 0 )
1078 int Time0, Time1, TimeMax = 0;
1079 if ( Gia_ManHasMapping(
p) )
1081 assert( Gia_ObjIsLut(
p, Entry) );
1084 Time0 = Vec_IntEntry( vTimes, iFan );
1086 TimeMax = Abc_MaxInt( TimeMax, Time0 );
1091 pObj = Gia_ManObj(
p, Entry );
1092 Time0 = Vec_IntEntry( vTimes, Gia_ObjFaninId0(pObj, Entry) );
1093 Time1 = Vec_IntEntry( vTimes, Gia_ObjFaninId1(pObj, Entry) );
1094 assert( Time0 >= 0 && Time1 >= 0 );
1095 TimeMax = Abc_MaxInt( Time0, Time1 );
1097 Vec_IntWriteEntry( vTimes, Entry, TimeMax + 10 );
1103static inline void Gia_ManDfsUpdateRequired(
Vec_Int_t * vTimes,
int iObj,
int Req )
1105 int *pTime = Vec_IntEntryP( vTimes, iObj );
1106 if (*pTime == -1 || *pTime > Req)
1112 Vec_Int_t * vTimes = Vec_IntStartFull( Gia_ManObjNum(
p) );
1114 int j, Entry, k, iFan, Req;
1115 Vec_IntWriteEntry( vTimes, 0, 0 );
1122 if ( j >= nCoLimit )
1125 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0p(
p, pObj), ReqTime );
1131 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0p(
p, pObj), ReqTime );
1137 int iFirst, nTerms, iBox = -Entry-1;
1142 for ( k = 0; k < nTerms; k++ )
1144 pObj = Gia_ManCi(
p, iFirst + k );
1145 Req = Vec_IntEntry( vTimes, Gia_ObjId(
p, pObj) );
1146 Req = Req == -1 ? ReqTime : Req;
1153 for ( k = 0; k < nTerms; k++ )
1155 pObj = Gia_ManCo(
p, iFirst + k );
1158 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0p(
p, pObj), Req );
1161 else if ( Entry > 0 )
1163 Req = Vec_IntEntry(vTimes, Entry) - 10;
1165 if ( Gia_ManHasMapping(
p) )
1167 assert( Gia_ObjIsLut(
p, Entry) );
1169 Gia_ManDfsUpdateRequired( vTimes, iFan, Req );
1173 pObj = Gia_ManObj(
p, Entry );
1174 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0(pObj, Entry), Req );
1175 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId1(pObj, Entry), Req );
1184 Vec_Int_t * vSlack = Vec_IntStartFull( Gia_ManObjNum(
p) );
1186 if ( Vec_IntSize(vObjs) > 0 )
1189 int Required = Vec_IntFindMax( vArrs );
1194 Arrivals = Abc_MinInt( Arrivals, Req );
1200 if ( !Gia_ObjIsAnd(Gia_ManObj(
p, i)) )
1202 if ( Gia_ManHasMapping(
p) && !Gia_ObjIsLut(
p, i) )
1205 Vec_IntWriteEntry( vSlack, i, Req - Arr );
1207 Vec_IntFree( vArrs );
1208 Vec_IntFree( vReqs );
1210 Vec_IntFree( vObjs );
1216 int i, Entry, nRange,
nTotal;
1217 if ( Vec_IntSize(vSlacks) == 0 )
1219 printf(
"Network contains no internal objects.\n" );
1220 Vec_IntFree( vSlacks );
1226 Vec_IntWriteEntry( vSlacks, i, Entry/10 );
1227 nRange = Vec_IntFindMax( vSlacks );
1229 vCounts = Vec_IntStart( nRange + 1 );
1232 Vec_IntAddToEntry( vCounts, Entry, 1 );
1234 nTotal = Vec_IntSum( vCounts );
1238 printf(
"Slack range %3d = ", i );
1239 printf(
"[%4d, %4d) ", 10*i, 10*(i+1) );
1240 printf(
"Nodes = %5d ", Entry );
1241 printf(
"(%6.2f %%) ", 100.0*Entry/
nTotal );
1244 Vec_IntFree( vSlacks );
1245 Vec_IntFree( vCounts );
1262 int Length = Start, i, fFirst = 1;
1264 for ( i = 0; i < n-nRegs; i++ )
1266 sprintf( pName,
"%c[%d]", c, i );
1267 Length +=
strlen(pName) + 2;
1270 fprintf( pFile,
",\n " );
1274 fprintf( pFile,
"%s%s", fFirst ?
"":
", ", pName );
1277 for ( i = n-nRegs; i < n; i++ )
1279 sprintf( pName,
"%c%c[%d]", c, c, i );
1280 Length +=
strlen(pName) + 2;
1283 fprintf( pFile,
",\n " );
1287 fprintf( pFile,
"%s%s", fFirst ?
"":
", ", pName );
1293 for ( i = 0; i < (int)
strlen(pName); i++ )
1294 if ( isalpha(pName[i]) || isdigit(pName[i]) )
1295 fprintf( pFile,
"%c", pName[i] );
1297 fprintf( pFile,
"_" );
1302 fprintf( pFile,
"module " );
1304 fprintf( pFile,
"_wrapper" );
1305 fprintf( pFile,
" (%s i, o );\n\n", fPrintClk && Gia_ManRegNum(
p) ?
" clk," :
"" );
1306 if ( fPrintClk && Gia_ManRegNum(
p) )
1307 fprintf( pFile,
" input clk;\n" );
1308 fprintf( pFile,
" input [%d:0] i;\n", Gia_ManPiNum(
p)-1 );
1309 fprintf( pFile,
" output [%d:0] o;\n\n", Gia_ManPoNum(
p)-1 );
1311 if ( Gia_ManRegNum(
p) ) {
1312 fprintf( pFile,
" wire [%d:%d] ii;\n", Gia_ManCiNum(
p)-1, Gia_ManPiNum(
p) );
1313 fprintf( pFile,
" wire [%d:%d] oo;\n\n", Gia_ManCoNum(
p)-1, Gia_ManPoNum(
p) );
1314 fprintf( pFile,
" always @ (posedge %s)\n ii <= oo;\n\n", fPrintClk ?
"clk" :
"i[0]" );
1317 fprintf( pFile,
" " );
1319 fprintf( pFile,
" " );
1321 fprintf( pFile,
"_inst" );
1323 fprintf( pFile,
" (\n " );
1325 fprintf( pFile,
",\n " );
1327 fprintf( pFile,
"\n );\n\n" );
1329 fprintf( pFile,
"endmodule\n\n" );
1346 Vec_Bit_t * vUsed = Vec_BitStart( Gia_ManObjNum(
p) );
1350 Vec_BitWriteEntry( vUsed, i, 1 );
1351 if ( Gia_ObjFaninC0(pObj) ^ fBuf )
1352 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId0(pObj, i), 1 );
1353 if ( Gia_ObjFaninC1(pObj) ^ fBuf )
1354 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId1(pObj, i), 1 );
1357 if ( Gia_ObjFaninC0(pObj) ^ fBuf )
1358 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId0p(
p, pObj), 1 );
1359 Vec_BitWriteEntry( vUsed, 0, 0 );
1368 assert( pName != NULL && *pName !=
'\0' );
1369 if ( *pName ==
'\\' )
1371 if ( (*pName <
'a' || *pName >
'z') && (*pName <
'A' || *pName >
'Z') && *pName !=
'_' )
1373 while ( *(++pName) )
1374 if ( (*pName <
'a' || *pName >
'z') && (*pName <
'A' || *pName >
'Z') && (*pName <
'0' || *pName >
'9') && *pName !=
'_' && *pName !=
'$' )
1380 static char pBuffer[10000];
1383 char * pName = (
char *)Vec_PtrEntry(vNames, i);
1385 sprintf( pBuffer,
"%s", pName );
1387 sprintf( pBuffer,
"\\%s ", pName );
1390 sprintf( pBuffer,
"%c%0*d%c", c, d, i, c );
1395 int Digits = Abc_Base10Log( n );
1396 int Length = Start, i, fFirst = 1;
1398 for ( i = 0; i < n; i++ )
1400 int k = fReverse ? n-1-i : i;
1401 if ( vObjs && !Vec_BitEntry(vObjs, k) )
1404 Length +=
strlen(pName) + 2;
1407 fprintf( pFile,
",\n " );
1411 fprintf( pFile,
"%s%s", fFirst ?
"":
", ", pName );
1444 int nDigits = Abc_Base10Log( Gia_ManObjNum(
p) );
1445 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(
p) );
1446 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(
p) );
1447 int i, k, iObj, nRegs = Gia_ManRegNum(
p);
1448 FILE * pFile = fopen( pFileName,
"wb" );
1449 if ( pFile == NULL )
1451 printf(
"Cannot open output file \"%s\".\n", pFileName );
1455 if ( fInter || nRegs )
1465 fprintf( pFile,
"module " );
1470 fprintf( pFile,
" (\n " );
1472 fprintf( pFile,
",\n " );
1475 fprintf( pFile,
"\n );\n\n" );
1477 fprintf( pFile,
" input " );
1479 fprintf( pFile,
";\n\n" );
1481 fprintf( pFile,
" output " );
1483 fprintf( pFile,
";\n\n" );
1485 fprintf( pFile,
" wire " );
1487 fprintf( pFile,
";\n\n" );
1489 fprintf( pFile,
" wire " );
1491 fprintf( pFile,
";\n\n" );
1498 fprintf( pFile,
"\n" );
1505 fprintf( pFile,
"\n" );
1509 fprintf( pFile,
" (\n " );
1511 fprintf( pFile,
",\n " );
1514 fprintf( pFile,
"\n );\n\n" );
1516 fprintf( pFile,
" input " );
1518 fprintf( pFile,
";\n\n" );
1520 fprintf( pFile,
" output " );
1522 fprintf( pFile,
";\n\n" );
1525 if ( Vec_BitCount(vUsed) )
1527 fprintf( pFile,
" wire " );
1529 fprintf( pFile,
";\n\n" );
1532 if ( Vec_BitCount(vInvs) )
1534 fprintf( pFile,
" wire " );
1536 fprintf( pFile,
";\n\n" );
1541 fprintf( pFile,
" wire " );
1543 fprintf( pFile,
" t_%d%s", i, i==Vec_IntSize(vObjs)-1 ?
"" :
"," );
1544 fprintf( pFile,
";\n\n" );
1548 fprintf( pFile,
" t_%d );\n", i );
1550 fprintf( pFile,
"\n" );
1556 if ( Vec_BitEntry(vUsed, Gia_ObjId(
p, pObj)) )
1558 fprintf( pFile,
" buf ( %s,",
Gia_ObjGetDumpName(NULL,
'n', Gia_ObjId(
p, pObj), nDigits) );
1561 if ( Vec_BitEntry(vInvs, Gia_ObjId(
p, pObj)) )
1563 fprintf( pFile,
" not ( %s,",
Gia_ObjGetDumpName(NULL,
'i', Gia_ObjId(
p, pObj), nDigits) );
1569 fprintf( pFile,
"\n" );
1578 if ( k < Vec_IntSize(vObjs) )
1584 fprintf( pFile,
" %s,",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
1585 fprintf( pFile,
" %s );\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC1(pObj)?
'i':
'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
1587 if ( Vec_BitEntry(vInvs, i) )
1595 fprintf( pFile,
"\n" );
1606 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
1607 fprintf( pFile,
"1\'b%d );\n", Gia_ObjFaninC0(pObj) );
1609 fprintf( pFile,
"%s );\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0p(
p, pObj), nDigits) );
1612 fprintf( pFile,
"\nendmodule\n\n" );
1615 Vec_BitFree( vInvs );
1616 Vec_BitFree( vUsed );
1624 int nDigits = Abc_Base10Log( Gia_ManObjNum(
p) );
1625 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(
p) );
1626 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(
p) );
1627 int i, k, iObj, nRegs = Gia_ManRegNum(
p);
1628 FILE * pFile = fopen( pFileName,
"wb" );
1629 if ( pFile == NULL )
1631 printf(
"Cannot open output file \"%s\".\n", pFileName );
1635 if ( fInter || nRegs )
1645 fprintf( pFile,
"module " );
1650 fprintf( pFile,
" (\n " );
1652 fprintf( pFile,
",\n " );
1655 fprintf( pFile,
"\n );\n\n" );
1657 fprintf( pFile,
" input " );
1659 fprintf( pFile,
";\n\n" );
1661 fprintf( pFile,
" output " );
1663 fprintf( pFile,
";\n\n" );
1665 fprintf( pFile,
" wire " );
1667 fprintf( pFile,
";\n\n" );
1669 fprintf( pFile,
" wire " );
1671 fprintf( pFile,
";\n\n" );
1678 fprintf( pFile,
"\n" );
1685 fprintf( pFile,
"\n" );
1689 fprintf( pFile,
" (\n " );
1691 fprintf( pFile,
",\n " );
1694 fprintf( pFile,
"\n );\n\n" );
1696 fprintf( pFile,
" input " );
1698 fprintf( pFile,
";\n\n" );
1700 fprintf( pFile,
" output " );
1702 fprintf( pFile,
";\n\n" );
1705 if ( Vec_BitCount(vUsed) )
1707 fprintf( pFile,
" wire " );
1709 fprintf( pFile,
";\n\n" );
1712 if ( Vec_BitCount(vInvs) )
1714 fprintf( pFile,
" wire " );
1716 fprintf( pFile,
";\n\n" );
1721 fprintf( pFile,
" wire " );
1723 fprintf( pFile,
" t_%d%s", i, i==Vec_IntSize(vObjs)-1 ?
"" :
"," );
1724 fprintf( pFile,
";\n\n" );
1728 fprintf( pFile,
" t_%d;\n", i );
1730 fprintf( pFile,
"\n" );
1736 if ( Vec_BitEntry(vUsed, Gia_ObjId(
p, pObj)) )
1738 fprintf( pFile,
" assign %s =",
Gia_ObjGetDumpName(NULL,
'n', Gia_ObjId(
p, pObj), nDigits) );
1741 if ( Vec_BitEntry(vInvs, Gia_ObjId(
p, pObj)) )
1743 fprintf( pFile,
" assign %s =",
Gia_ObjGetDumpName(NULL,
'i', Gia_ObjId(
p, pObj), nDigits) );
1749 fprintf( pFile,
"\n" );
1758 if ( k < Vec_IntSize(vObjs) )
1764 fprintf( pFile,
" %s &",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
1765 fprintf( pFile,
" %s;\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC1(pObj)?
'i':
'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
1767 if ( Vec_BitEntry(vInvs, i) )
1775 fprintf( pFile,
"\n" );
1779 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
1780 fprintf( pFile,
"1\'b%d;\n", Gia_ObjFaninC0(pObj) );
1782 fprintf( pFile,
"%s;\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0p(
p, pObj), nDigits) );
1785 fprintf( pFile,
"\nendmodule\n\n" );
1788 Vec_BitFree( vInvs );
1789 Vec_BitFree( vUsed );
1808 for ( i = 0; i < Size; i++ )
1809 fprintf( pFile,
"%c", pName[i] );
1814 for ( i = 0; pName[i]; i++ )
1815 if ( pName[i] ==
'[' )
1821 if ( pName[Size] == 0 )
1823 assert( pName[Size] ==
'[' );
1824 return atoi(pName+Size+1);
1828 char * pNameLast = (
char *)Vec_PtrEntry(vNames, 0), * pName;
1830 Vec_Int_t * vArray = Vec_IntAlloc( Vec_PtrSize(vNames) * 2 );
1831 Vec_IntPush( vArray, 0 );
1832 Vec_IntPush( vArray, nSymbsLast );
1836 if ( nSymbs == nSymbsLast && !
strncmp(pName, pNameLast, nSymbsLast) )
1838 Vec_IntPush( vArray, i );
1839 Vec_IntPush( vArray, nSymbs );
1841 nSymbsLast = nSymbs;
1847 Vec_Ptr_t * vNames = fOuts ?
p->vNamesOut :
p->vNamesIn;
1848 if ( vNames == NULL )
1849 fprintf( pFile,
"_%c_", fOuts ?
'o' :
'i' );
1858 iName = Vec_IntEntry(vArray, Vec_IntSize(vArray)-2-i);
1859 Size = Vec_IntEntry(vArray, Vec_IntSize(vArray)-1-i);
1861 if ( i ) fprintf( pFile,
", " );
1864 Vec_IntFree( vArray );
1869 Vec_Ptr_t * vNames = fOuts ?
p->vNamesOut :
p->vNamesIn;
1870 if (
p->vNamesOut == NULL )
1871 fprintf( pFile,
"%s [%d:0] _%c_;\n", fOuts ?
"output" :
"input", fOuts ? Gia_ManPoNum(
p)-1 : Gia_ManPiNum(
p)-1, fOuts ?
'o' :
'i' );
1878 int iNameNext = Vec_IntSize(vArray) > i+2 ? Vec_IntEntry(vArray, i+2) : Vec_PtrSize(vNames);
1879 char * pName = (
char *)Vec_PtrEntry(vNames, iName);
1880 char * pNameLast = (
char *)Vec_PtrEntry(vNames, iNameNext-1);
1884 fprintf( pFile,
" %s ", fOuts ?
"output" :
"input" );
1885 if ( NumBeg != -1 && iName < iNameNext-1 )
1886 fprintf( pFile,
"[%d:%d] ", NumEnd, NumBeg );
1888 fprintf( pFile,
";\n" );
1890 Vec_IntFree( vArray );
1909 int nDigits = Abc_Base10Log( Gia_ManObjNum(
p) );
1910 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(
p) );
1911 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(
p) );
1914 FILE * pFile = fopen( pFileName,
"wb" );
1915 if ( pFile == NULL )
1917 printf(
"Cannot open output file \"%s\".\n", pFileName );
1924 fprintf( pFile,
"module " );
1926 fprintf( pFile,
"_wrapper" );
1927 fprintf( pFile,
" ( " );
1929 fprintf( pFile,
", " );
1931 fprintf( pFile,
" );\n\n" );
1934 fprintf( pFile,
"\n" );
1936 fprintf( pFile,
" wire " );
1938 fprintf( pFile,
";\n\n" );
1940 fprintf( pFile,
" wire " );
1942 fprintf( pFile,
";\n\n" );
1944 fprintf( pFile,
" assign { " );
1946 fprintf( pFile,
" } = { " );
1948 fprintf( pFile,
" };\n\n" );
1950 fprintf( pFile,
" assign { " );
1952 fprintf( pFile,
" } = { " );
1954 fprintf( pFile,
" };\n\n" );
1956 if ( Vec_BitCount(vUsed) )
1958 fprintf( pFile,
" wire " );
1960 fprintf( pFile,
";\n\n" );
1963 if ( Vec_BitCount(vInvs) )
1965 fprintf( pFile,
" wire " );
1967 fprintf( pFile,
";\n\n" );
1973 if ( Vec_BitEntry(vUsed, Gia_ObjId(
p, pObj)) )
1975 fprintf( pFile,
" buf ( %s,",
Gia_ObjGetDumpName(NULL,
'n', Gia_ObjId(
p, pObj), nDigits) );
1978 if ( Vec_BitEntry(vInvs, Gia_ObjId(
p, pObj)) )
1980 fprintf( pFile,
" not ( %s,",
Gia_ObjGetDumpName(NULL,
'i', Gia_ObjId(
p, pObj), nDigits) );
1986 fprintf( pFile,
"\n" );
1990 fprintf( pFile,
" %s,",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
1991 fprintf( pFile,
" %s );\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC1(pObj)?
'i':
'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
1992 if ( Vec_BitEntry(vInvs, i) )
2000 fprintf( pFile,
"\n" );
2004 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
2005 fprintf( pFile,
"1\'b%d );\n", Gia_ObjFaninC0(pObj) );
2007 fprintf( pFile,
"%s );\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0p(
p, pObj), nDigits) );
2010 fprintf( pFile,
"\nendmodule\n\n" );
2013 Vec_BitFree( vInvs );
2014 Vec_BitFree( vUsed );
2020 int nDigits = Abc_Base10Log( Gia_ManObjNum(
p) );
2021 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(
p) );
2022 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(
p) );
2025 FILE * pFile = fopen( pFileName,
"wb" );
2026 if ( pFile == NULL )
2028 printf(
"Cannot open output file \"%s\".\n", pFileName );
2035 fprintf( pFile,
"module " );
2037 fprintf( pFile,
"_wrapper" );
2038 fprintf( pFile,
" ( " );
2040 fprintf( pFile,
", " );
2042 fprintf( pFile,
" );\n\n" );
2045 fprintf( pFile,
"\n" );
2047 fprintf( pFile,
" wire " );
2049 fprintf( pFile,
";\n\n" );
2051 fprintf( pFile,
" wire " );
2053 fprintf( pFile,
";\n\n" );
2055 fprintf( pFile,
" assign { " );
2057 fprintf( pFile,
" } = { " );
2059 fprintf( pFile,
" };\n\n" );
2061 fprintf( pFile,
" assign { " );
2063 fprintf( pFile,
" } = { " );
2065 fprintf( pFile,
" };\n\n" );
2067 if ( Vec_BitCount(vUsed) )
2069 fprintf( pFile,
" wire " );
2071 fprintf( pFile,
";\n\n" );
2074 if ( Vec_BitCount(vInvs) )
2076 fprintf( pFile,
" wire " );
2078 fprintf( pFile,
";\n\n" );
2084 if ( Vec_BitEntry(vUsed, Gia_ObjId(
p, pObj)) )
2086 fprintf( pFile,
" assign %s =",
Gia_ObjGetDumpName(NULL,
'n', Gia_ObjId(
p, pObj), nDigits) );
2089 if ( Vec_BitEntry(vInvs, Gia_ObjId(
p, pObj)) )
2091 fprintf( pFile,
" assign %s =",
Gia_ObjGetDumpName(NULL,
'i', Gia_ObjId(
p, pObj), nDigits) );
2097 fprintf( pFile,
"\n" );
2101 fprintf( pFile,
" %s &",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
2102 fprintf( pFile,
" %s;\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC1(pObj)?
'i':
'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
2103 if ( Vec_BitEntry(vInvs, i) )
2111 fprintf( pFile,
"\n" );
2115 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
2116 fprintf( pFile,
"1\'b%d;\n", Gia_ObjFaninC0(pObj) );
2118 fprintf( pFile,
"%s;\n",
Gia_ObjGetDumpName(NULL, (
char)(Gia_ObjFaninC0(pObj)?
'i':
'n'), Gia_ObjFaninId0p(
p, pObj), nDigits) );
2121 fprintf( pFile,
"\nendmodule\n\n" );
2124 Vec_BitFree( vInvs );
2125 Vec_BitFree( vUsed );
2143 fprintf( pFile,
"1\'b0" );
2144 else if ( Lit == 1 )
2145 fprintf( pFile,
"1\'b1" );
2146 else if ( Abc_Lit2Var(Lit) <= nIns )
2147 fprintf( pFile,
"%cn%0*d", (
char)(Abc_LitIsCompl(Lit)?
'~':
' '), nDigits, Abc_Lit2Var(Lit) );
2149 fprintf( pFile,
"%cn%0*d", (
char)(Abc_LitIsCompl(Lit)?
' ':
'~'), nDigits, Abc_Lit2Var(Lit) );
2153 Gia_Obj_t * pObj;
int i, nPis = Gia_ManPiNum(
p);
2154 int nDigits = Abc_Base10Log( Gia_ManObjNum(
p) );
2155 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(
p) );
2156 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(
p) );
2157 FILE * pFile = fopen( pFileName,
"wb" );
2158 if ( pFile == NULL )
2160 printf(
"Cannot open output file \"%s\".\n", pFileName );
2163 assert( Gia_ManRegNum(
p) == 0 );
2164 fprintf( pFile,
"module " );
2166 fprintf( pFile,
"_wrapper" );
2167 fprintf( pFile,
" ( " );
2168 if (
p->vNamesIn ) {
2170 fprintf( pFile,
", " );
2172 fprintf( pFile,
" );\n\n" );
2177 fprintf( pFile,
"\n " );
2180 fprintf( pFile,
"\n " );
2182 fprintf( pFile,
"%s%s ",
Gia_ObjGetDumpName(NULL,
'z', i, nDigitsO), i < Gia_ManPoNum(
p)-1 ?
",":
"" );
2183 fprintf( pFile,
"\n);\n\n" );
2184 fprintf( pFile,
" input" );
2186 fprintf( pFile,
" %s%s",
Gia_ObjGetDumpName(NULL,
'x', i, nDigitsI), i < Gia_ManPiNum(
p)-1 ?
",":
"" );
2187 fprintf( pFile,
";\n" );
2188 fprintf( pFile,
" output" );
2190 fprintf( pFile,
" %s%s",
Gia_ObjGetDumpName(NULL,
'z', i, nDigitsO), i < Gia_ManPoNum(
p)-1 ?
",":
"" );
2191 fprintf( pFile,
";\n" );
2193 fprintf( pFile,
"\n" );
2195 fprintf( pFile,
" wire n%0*d = %s;\n", nDigits, i+1,
p->vNamesIn ? (
char *)Vec_PtrEntry(
p->vNamesIn, i) :
Gia_ObjGetDumpName(
p->vNamesIn,
'x', i, nDigitsI) );
2196 fprintf( pFile,
"\n" );
2199 fprintf( pFile,
" wire n%0*d = ~(", nDigits, i );
2201 fprintf( pFile,
" & " );
2203 fprintf( pFile,
");\n" );
2205 fprintf( pFile,
"\n" );
2208 fprintf( pFile,
" assign %s = ",
p->vNamesOut ? (
char *)Vec_PtrEntry(
p->vNamesOut, i) :
Gia_ObjGetDumpName(
p->vNamesOut,
'z', i, nDigitsO) );
2210 fprintf( pFile,
";\n" );
2212 fprintf( pFile,
"\nendmodule\n\n" );
2230 for ( i = 0; i < nGias; i++ )
2235 FILE * pFile = NULL;
2239 for ( i = 0; i < nFNames; i++ )
2241 FILE * pFile = fopen( pFNames[i],
"rb" );
2242 if ( pFile == NULL ) {
2243 printf(
"Cannot open input file \"%s\".\n", pFNames[i] );
2249 if ( pGias[i] == NULL ) {
2250 printf(
"Failed to read an AIG from file \"%s\".\n", pFNames[i] );
2255 for ( i = 0; i < nFNames-1; i++ )
2256 if ( Gia_ManPoNum(pGias[i]) < Gia_ManPiNum(pGias[i+1]) ) {
2257 printf(
"AIG in file \"%s\" has fewer outputs than inputs of AIG in file \"%s\".\n", pFNames[i], pFNames[i+1] );
2261 pFile = fopen( pFileName,
"wb" );
2262 if ( pFile == NULL )
2264 printf(
"Cannot open output file \"%s\".\n", pFileName );
2268 fprintf( pFile,
"\n" );
2269 for ( i = 0; i < nFNames; i++ )
2271 fprintf( pFile,
"\n" );
2272 fprintf( pFile,
"module sandwich ( in, out );\n" );
2273 fprintf( pFile,
" input [%3d:0] in;\n", Gia_ManPiNum(pGias[0])-1 );
2274 fprintf( pFile,
" output [%3d:0] out;\n", Gia_ManPoNum(pGias[nFNames-1])-1 );
2275 fprintf( pFile,
" wire [%3d:0] tmp0 = in;\n", Gia_ManPiNum(pGias[0])-1 );
2276 for ( i = 0; i < nFNames; i++ ) {
2277 fprintf( pFile,
" wire [%3d:0] tmp%d; ", Gia_ManPoNum(pGias[i])-1, i+1 );
2279 fprintf( pFile,
"_wrapper" );
2280 for ( k =
strlen(pGias[i]->pName); k < 24; k++ )
2281 fprintf( pFile,
" " );
2282 fprintf( pFile,
" i%d ( tmp%d, tmp%d );\n", i+1, i, i+1 );
2284 fprintf( pFile,
" assign out = tmp%d;\n", nFNames );
2285 fprintf( pFile,
"endmodule\n" );
2287 for ( i = 0; i < nFNames; i++ ) {
2288 Vec_PtrFreeFree( pGias[i]->vNamesIn ); pGias[i]->
vNamesIn = NULL;
2289 Vec_PtrFreeFree( pGias[i]->vNamesOut ); pGias[i]->
vNamesOut = NULL;
2294 printf(
"Dumped hierarchical design into file \"%s\"\n", pFileName );
2311 Gia_ManConst0(
p)->Value = 0;
2312 assert( Vec_IntSize(vLits) == Gia_ManCiNum(
p) );
2314 pObj->
Value = Vec_IntEntry(vLits, i);
2317 Vec_IntClear( vLits );
2319 Vec_IntPush( vLits, Gia_ObjFanin0Copy(pObj) );
2320 assert( Vec_IntSize(vLits) == Gia_ManCoNum(
p) );
2327 int i, iLit, nObjs = 0;
2329 for ( i = 0; i < nFNames; i++ )
2331 FILE * pFile = fopen( pFNames[i],
"rb" );
2332 if ( pFile == NULL ) {
2333 printf(
"Cannot open input file \"%s\".\n", pFNames[i] );
2339 if ( pGias[i] == NULL ) {
2340 printf(
"Failed to read an AIG from file \"%s\".\n", pFNames[i] );
2344 nObjs += Gia_ManObjNum(pGias[i]);
2348 pNew->
pName = Abc_UtilStrsav(
"putontop" );
2351 vLits = Vec_IntAlloc( Gia_ManCiNum(pGias[0]) );
2352 for ( i = 0; i < Gia_ManCiNum(pGias[0]); i++ )
2353 Vec_IntPush( vLits, Gia_ManAppendCi(pNew) );
2355 for ( i = 0; i < nFNames; i++ )
2358 while ( Vec_IntSize(vLits) < Gia_ManCiNum(
p) )
2359 Vec_IntPush( vLits, Gia_ManAppendCi(pNew) );
2360 while ( Vec_IntSize(vLits) > Gia_ManCiNum(
p) )
2361 Gia_ManAppendCo( pNew, Vec_IntPop(vLits) );
2366 Gia_ManAppendCo( pNew, iLit );
2367 Vec_IntFree( vLits );
#define ABC_SWAP(Type, a, b)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Gia_ManPrintGateClasses(Gia_Man_t *p)
void Gia_ManPrintObjClasses(Gia_Man_t *p)
void Gia_ManPrintFlopClasses(Gia_Man_t *p)
int nTotal
DECLARATIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Dar_LibReturnClass(unsigned uTruth)
void Gia_ManStop(Gia_Man_t *p)
int Gia_ManPrintEdges(Gia_Man_t *p)
void Gia_ManReportImprovement(Gia_Man_t *p, Gia_Man_t *pNew)
void Gia_ManDumpVerilogNoInter(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
Vec_Int_t * Gia_ManDfsArrivals(Gia_Man_t *p, Vec_Int_t *vObjs)
double Gia_ManMemory(Gia_Man_t *p)
void Gia_ManDfsCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs)
void Gia_ManDumpModuleName(FILE *pFile, char *pName)
void Gia_ManPrintTents(Gia_Man_t *p)
void Gia_ManDumpVerilogNoInterAssign(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
void Gia_ManPrintInitClasses(Vec_Int_t *vInits)
int Gia_ManCountSymbs(char *pName)
void Gia_ManWriteNamesInter(FILE *pFile, char c, int n, int Start, int Skip, int nRegs, int fReverse)
void Gia_ManDumpInterface2(Gia_Man_t *p, FILE *pFile)
void Gia_ManPrintPlacement(Gia_Man_t *p)
void Gia_ManLogAigStats(Gia_Man_t *p, char *pDumpFile)
void Gia_ManStopP(Gia_Man_t **p)
void Gia_ManDumpInterfaceAssign(Gia_Man_t *p, char *pFileName)
void Gia_ManPrintStatsMiter(Gia_Man_t *p, int fVerbose)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
int Gia_ManNameIsLegalInVerilog(char *pName)
Vec_Int_t * Gia_ManDfsRequireds(Gia_Man_t *p, Vec_Int_t *vObjs, int ReqTime)
void Gia_ManPrintMiterStatus(Gia_Man_t *p)
void Gia_ManPrintStatsShort(Gia_Man_t *p)
Vec_Bit_t * Gia_ManGenUsed(Gia_Man_t *p, int fBuf)
void Gia_ManPrintNpnClasses(Gia_Man_t *p)
void Gia_ManWriteNames(FILE *pFile, char c, int n, Vec_Ptr_t *vNames, int Start, int Skip, Vec_Bit_t *vObjs, int fReverse)
void Gia_GenPutOnTopOne(Gia_Man_t *pNew, Gia_Man_t *p, Vec_Int_t *vLits)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Gia_Man_t * Gia_GenPutOnTop(char **pFNames, int nFNames)
void Gia_ManDumpVerilogNand(Gia_Man_t *p, char *pFileName)
void Gia_ManDumpIoRanges(Gia_Man_t *p, FILE *pFile, int fOuts)
void Gia_ManDumpIoList(Gia_Man_t *p, FILE *pFile, int fOuts, int fReverse)
void Gia_ManPrintClasses_old(Gia_Man_t *p)
void Gia_ManPrintTents_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs)
void Gia_ManDumpNandLit(FILE *pFile, int nIns, int Lit, int nDigits)
void Gia_FreeMany(Gia_Man_t **pGias, int nGias)
Vec_Int_t * Gia_ManDfsSlacks(Gia_Man_t *p)
char * Gia_ObjGetDumpName(Vec_Ptr_t *vNames, char c, int i, int d)
void Gia_GenSandwich(char **pFNames, int nFNames, char *pFileName)
Vec_Int_t * Gia_ManDfsCollect(Gia_Man_t *p)
void Gia_ManPrintOneName(FILE *pFile, char *pName, int Size)
void Gia_ManDumpInterface(Gia_Man_t *p, char *pFileName)
Vec_Int_t * Gia_ManCountSymbsAll(Vec_Ptr_t *vNames)
ABC_NAMESPACE_IMPL_START void Gia_ManDfsSlacksPrint(Gia_Man_t *p)
DECLARATIONS ///.
void Gia_ManDumpVerilog(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign, int fReverse)
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
int Gia_ManReadRangeNum(char *pName, int Size)
void Gia_ManPrintChoiceStats(Gia_Man_t *p)
float Gia_ManLevelAve(Gia_Man_t *p)
#define Gia_ManForEachRo(p, pObj, i)
int Gia_ManNonRegBoxNum(Gia_Man_t *p)
unsigned * Gia_ManConvertAigToTruth(Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vTruth, Vec_Int_t *vVisited)
int Gia_ManSuppSize(Gia_Man_t *p, int *pNodes, int nNodes)
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupFlopClass(Gia_Man_t *p, int iClass)
void Gia_ManPrintMappingStats(Gia_Man_t *p, char *pDumpFile)
#define Gia_ManForEachPo(p, pObj, i)
int Gia_ManRegBoxNum(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
void Gia_ManSetRefsMapped(Gia_Man_t *p)
int Gia_ManBoxCiNum(Gia_Man_t *p)
Gia_Man_t * Gia_AigerRead(char *pFileName, int fGiaSimple, int fSkipStrash, int fCheck)
float Gia_ManComputeSwitching(Gia_Man_t *p, int nFrames, int nPref, int fProbOne)
void Gia_ManHashAlloc(Gia_Man_t *p)
void Gia_ManPrintPackingStats(Gia_Man_t *p)
#define Gia_ManForEachPi(p, pObj, i)
void Gia_ManPrintLutStats(Gia_Man_t *p)
#define Gia_ManForEachLut(p, i)
struct Gia_Obj_t_ Gia_Obj_t
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
#define Gia_LutForEachFanin(p, i, iFan, k)
struct Gia_Man_t_ Gia_Man_t
#define GIA_NONE
INCLUDES ///.
struct Gps_Par_t_ Gps_Par_t
void Gia_ManPrintOutputLutStats(Gia_Man_t *p)
int Gia_NodeMffcSize(Gia_Man_t *p, Gia_Obj_t *pNode)
void Gia_ManPrintMuxStats(Gia_Man_t *p)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
void Gia_ManCleanMark0(Gia_Man_t *p)
void Gia_ManCleanTruth(Gia_Man_t *p)
int Gia_ManCrossCut(Gia_Man_t *p, int fReverse)
int Gia_ManEvalEdgeDelay(Gia_Man_t *p)
Vec_Flt_t * Gia_ManPrintOutputProb(Gia_Man_t *p)
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)
int Gia_ManConeSize(Gia_Man_t *p, int *pNodes, int nNodes)
int Gia_ManClockDomainNum(Gia_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
void Gia_ManCheckIntegrityWithBoxes(Gia_Man_t *p)
#define Gia_ManForEachCi(p, pObj, i)
int Gia_ManBlackBoxNum(Gia_Man_t *p)
int Gia_ManLevelNum(Gia_Man_t *p)
int Gia_ManBoxCoNum(Gia_Man_t *p)
void Gia_ManMarkFanoutDrivers(Gia_Man_t *p)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
char ** Kit_DsdNpn4ClassNames()
void Tim_ManStopP(Tim_Man_t **p)
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
int Tim_ManPoNum(Tim_Man_t *p)
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
int Tim_ManPiNum(Tim_Man_t *p)
void Tim_ManSetCoRequired(Tim_Man_t *p, int iCo, float Delay)
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
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_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.