00001
00021 #include "abc.h"
00022 #include "dec.h"
00023 #include "main.h"
00024 #include "mio.h"
00025
00026
00030
00031
00032
00033
00034 int s_MappingTime = 0;
00035 int s_MappingMem = 0;
00036 int s_ResubTime = 0;
00037 int s_ResynTime = 0;
00038
00042
00054 void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored )
00055 {
00056 int Num;
00057
00058
00059
00060
00061 fprintf( pFile, "%-13s:", pNtk->pName );
00062 if ( Abc_NtkAssertNum(pNtk) )
00063 fprintf( pFile, " i/o/a = %4d/%4d/%4d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkAssertNum(pNtk) );
00064 else
00065 fprintf( pFile, " i/o = %4d/%4d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
00066 fprintf( pFile, " lat = %4d", Abc_NtkLatchNum(pNtk) );
00067 if ( Abc_NtkIsNetlist(pNtk) )
00068 {
00069 fprintf( pFile, " net = %5d", Abc_NtkNetNum(pNtk) );
00070 fprintf( pFile, " nd = %5d", Abc_NtkNodeNum(pNtk) );
00071 fprintf( pFile, " wbox = %3d", Abc_NtkWhiteboxNum(pNtk) );
00072 fprintf( pFile, " bbox = %3d", Abc_NtkBlackboxNum(pNtk) );
00073 }
00074 else if ( Abc_NtkIsStrash(pNtk) )
00075 {
00076 fprintf( pFile, " and = %5d", Abc_NtkNodeNum(pNtk) );
00077 if ( Num = Abc_NtkGetChoiceNum(pNtk) )
00078 fprintf( pFile, " (choice = %d)", Num );
00079 if ( Num = Abc_NtkGetExorNum(pNtk) )
00080 fprintf( pFile, " (exor = %d)", Num );
00081
00082
00083
00084
00085 }
00086 else
00087 {
00088 fprintf( pFile, " nd = %5d", Abc_NtkNodeNum(pNtk) );
00089 fprintf( pFile, " net = %5d", Abc_NtkGetTotalFanins(pNtk) );
00090 }
00091
00092 if ( Abc_NtkIsStrash(pNtk) || Abc_NtkIsNetlist(pNtk) )
00093 {
00094 }
00095 else if ( Abc_NtkHasSop(pNtk) )
00096 {
00097
00098 fprintf( pFile, " cube = %5d", Abc_NtkGetCubeNum(pNtk) );
00099
00100 if ( fFactored )
00101 fprintf( pFile, " lit(fac) = %5d", Abc_NtkGetLitFactNum(pNtk) );
00102 }
00103 else if ( Abc_NtkHasAig(pNtk) )
00104 fprintf( pFile, " aig = %5d", Abc_NtkGetAigNodeNum(pNtk) );
00105 else if ( Abc_NtkHasBdd(pNtk) )
00106 fprintf( pFile, " bdd = %5d", Abc_NtkGetBddNodeNum(pNtk) );
00107 else if ( Abc_NtkHasMapping(pNtk) )
00108 {
00109 fprintf( pFile, " area = %5.2f", Abc_NtkGetMappedArea(pNtk) );
00110 fprintf( pFile, " delay = %5.2f", Abc_NtkDelayTrace(pNtk) );
00111 }
00112 else if ( !Abc_NtkHasBlackbox(pNtk) )
00113 {
00114 assert( 0 );
00115 }
00116
00117 if ( Abc_NtkIsStrash(pNtk) )
00118 fprintf( pFile, " lev = %3d", Abc_AigLevel(pNtk) );
00119 else
00120 fprintf( pFile, " lev = %3d", Abc_NtkLevel(pNtk) );
00121
00122 fprintf( pFile, "\n" );
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 }
00224
00236 void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk )
00237 {
00238 Abc_Obj_t * pObj;
00239 int i;
00240
00241 fprintf( pFile, "Primary inputs (%d): ", Abc_NtkPiNum(pNtk) );
00242 Abc_NtkForEachPi( pNtk, pObj, i )
00243 fprintf( pFile, " %s", Abc_ObjName(pObj) );
00244
00245 fprintf( pFile, "\n" );
00246
00247 fprintf( pFile, "Primary outputs (%d):", Abc_NtkPoNum(pNtk) );
00248 Abc_NtkForEachPo( pNtk, pObj, i )
00249 fprintf( pFile, " %s", Abc_ObjName(pObj) );
00250 fprintf( pFile, "\n" );
00251
00252 fprintf( pFile, "Latches (%d): ", Abc_NtkLatchNum(pNtk) );
00253 Abc_NtkForEachLatch( pNtk, pObj, i )
00254 fprintf( pFile, " %s(%s=%s)", Abc_ObjName(pObj),
00255 Abc_ObjName(Abc_ObjFanout0(pObj)), Abc_ObjName(Abc_ObjFanin0(pObj)) );
00256 fprintf( pFile, "\n" );
00257 }
00258
00270 void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk )
00271 {
00272 Abc_Obj_t * pLatch, * pFanin;
00273 int i, Counter0, Counter1, Counter2;
00274 int InitNums[4], Init;
00275
00276 assert( !Abc_NtkIsNetlist(pNtk) );
00277 if ( Abc_NtkLatchNum(pNtk) == 0 )
00278 {
00279 fprintf( pFile, "The network is combinational.\n" );
00280 return;
00281 }
00282
00283 for ( i = 0; i < 4; i++ )
00284 InitNums[i] = 0;
00285 Counter0 = Counter1 = Counter2 = 0;
00286 Abc_NtkForEachLatch( pNtk, pLatch, i )
00287 {
00288 Init = Abc_LatchInit( pLatch );
00289 assert( Init < 4 );
00290 InitNums[Init]++;
00291
00292 pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pLatch));
00293 if ( Abc_NtkIsLogic(pNtk) )
00294 {
00295 if ( !Abc_NodeIsConst(pFanin) )
00296 continue;
00297 }
00298 else if ( Abc_NtkIsStrash(pNtk) )
00299 {
00300 if ( !Abc_AigNodeIsConst(pFanin) )
00301 continue;
00302 }
00303 else
00304 assert( 0 );
00305
00306
00307 Counter0++;
00308 if ( Abc_LatchIsInitDc(pLatch) )
00309 {
00310 Counter1++;
00311 continue;
00312 }
00313
00314 if ( Abc_NtkIsStrash(pNtk) )
00315 {
00316 if ( Abc_LatchIsInit1(pLatch) == !Abc_ObjFaninC0(pLatch) )
00317 Counter2++;
00318 }
00319 else
00320 {
00321 if ( Abc_LatchIsInit1(pLatch) == Abc_NodeIsConst1(Abc_ObjFanin0(Abc_ObjFanin0(pLatch))) )
00322 Counter2++;
00323 }
00324 }
00325 fprintf( pFile, "%-15s: ", pNtk->pName );
00326 fprintf( pFile, "Latch = %6d. No = %4d. Zero = %4d. One = %4d. DC = %4d.\n",
00327 Abc_NtkLatchNum(pNtk), InitNums[0], InitNums[1], InitNums[2], InitNums[3] );
00328 fprintf( pFile, "Const fanin = %3d. DC init = %3d. Matching init = %3d. ", Counter0, Counter1, Counter2 );
00329 fprintf( pFile, "Self-feed latches = %2d.\n", -1 );
00330 }
00331
00343 void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk )
00344 {
00345 Abc_Obj_t * pNode;
00346 int i, k, nFanins, nFanouts;
00347 Vec_Int_t * vFanins, * vFanouts;
00348 int nOldSize, nNewSize;
00349
00350 vFanins = Vec_IntAlloc( 0 );
00351 vFanouts = Vec_IntAlloc( 0 );
00352 Vec_IntFill( vFanins, 100, 0 );
00353 Vec_IntFill( vFanouts, 100, 0 );
00354 Abc_NtkForEachNode( pNtk, pNode, i )
00355 {
00356 nFanins = Abc_ObjFaninNum(pNode);
00357 if ( Abc_NtkIsNetlist(pNtk) )
00358 nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
00359 else
00360 nFanouts = Abc_ObjFanoutNum(pNode);
00361
00362 if ( nFanins > vFanins->nSize || nFanouts > vFanouts->nSize )
00363 {
00364 nOldSize = vFanins->nSize;
00365 nNewSize = ABC_MAX(nFanins, nFanouts) + 10;
00366 Vec_IntGrow( vFanins, nNewSize );
00367 Vec_IntGrow( vFanouts, nNewSize );
00368 for ( k = nOldSize; k < nNewSize; k++ )
00369 {
00370 Vec_IntPush( vFanins, 0 );
00371 Vec_IntPush( vFanouts, 0 );
00372 }
00373 }
00374 vFanins->pArray[nFanins]++;
00375 vFanouts->pArray[nFanouts]++;
00376 }
00377 fprintf( pFile, "The distribution of fanins and fanouts in the network:\n" );
00378 fprintf( pFile, " Number Nodes with fanin Nodes with fanout\n" );
00379 for ( k = 0; k < vFanins->nSize; k++ )
00380 {
00381 if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
00382 continue;
00383 fprintf( pFile, "%5d : ", k );
00384 if ( vFanins->pArray[k] == 0 )
00385 fprintf( pFile, " " );
00386 else
00387 fprintf( pFile, "%12d ", vFanins->pArray[k] );
00388 fprintf( pFile, " " );
00389 if ( vFanouts->pArray[k] == 0 )
00390 fprintf( pFile, " " );
00391 else
00392 fprintf( pFile, "%12d ", vFanouts->pArray[k] );
00393 fprintf( pFile, "\n" );
00394 }
00395 Vec_IntFree( vFanins );
00396 Vec_IntFree( vFanouts );
00397 }
00398
00410 void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode )
00411 {
00412 Abc_Obj_t * pNode2;
00413 int i;
00414 if ( Abc_ObjIsPo(pNode) )
00415 pNode = Abc_ObjFanin0(pNode);
00416
00417 fprintf( pFile, "Node %s", Abc_ObjName(pNode) );
00418 fprintf( pFile, "\n" );
00419
00420 fprintf( pFile, "Fanins (%d): ", Abc_ObjFaninNum(pNode) );
00421 Abc_ObjForEachFanin( pNode, pNode2, i )
00422 fprintf( pFile, " %s", Abc_ObjName(pNode2) );
00423 fprintf( pFile, "\n" );
00424
00425 fprintf( pFile, "Fanouts (%d): ", Abc_ObjFaninNum(pNode) );
00426 Abc_ObjForEachFanout( pNode, pNode2, i )
00427 fprintf( pFile, " %s", Abc_ObjName(pNode2) );
00428 fprintf( pFile, "\n" );
00429 }
00430
00442 void Abc_NtkPrintMffc( FILE * pFile, Abc_Ntk_t * pNtk )
00443 {
00444 Abc_Obj_t * pNode;
00445 int i;
00446 extern void Abc_NodeMffsConeSuppPrint( Abc_Obj_t * pNode );
00447 Abc_NtkForEachNode( pNtk, pNode, i )
00448 Abc_NodeMffsConeSuppPrint( pNode );
00449 }
00450
00462 void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk, int fUseRealNames )
00463 {
00464 Abc_Obj_t * pNode;
00465 int i;
00466 assert( Abc_NtkIsSopLogic(pNtk) );
00467 Abc_NtkForEachNode( pNtk, pNode, i )
00468 Abc_NodePrintFactor( pFile, pNode, fUseRealNames );
00469 }
00470
00482 void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames )
00483 {
00484 Dec_Graph_t * pGraph;
00485 Vec_Ptr_t * vNamesIn;
00486 if ( Abc_ObjIsCo(pNode) )
00487 pNode = Abc_ObjFanin0(pNode);
00488 if ( Abc_ObjIsPi(pNode) )
00489 {
00490 fprintf( pFile, "Skipping the PI node.\n" );
00491 return;
00492 }
00493 if ( Abc_ObjIsLatch(pNode) )
00494 {
00495 fprintf( pFile, "Skipping the latch.\n" );
00496 return;
00497 }
00498 assert( Abc_ObjIsNode(pNode) );
00499 pGraph = Dec_Factor( pNode->pData );
00500 if ( fUseRealNames )
00501 {
00502 vNamesIn = Abc_NodeGetFaninNames(pNode);
00503 Dec_GraphPrint( stdout, pGraph, (char **)vNamesIn->pArray, Abc_ObjName(pNode) );
00504 Abc_NodeFreeNames( vNamesIn );
00505 }
00506 else
00507 Dec_GraphPrint( stdout, pGraph, (char **)NULL, Abc_ObjName(pNode) );
00508 Dec_GraphFree( pGraph );
00509 }
00510
00511
00523 void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile, int fListNodes )
00524 {
00525 Abc_Obj_t * pNode;
00526 int i, k, Length;
00527
00528 if ( fListNodes )
00529 {
00530 int nLevels;
00531 nLevels = Abc_NtkLevel(pNtk);
00532 printf( "Nodes by level:\n" );
00533 for ( i = 0; i <= nLevels; i++ )
00534 {
00535 printf( "%2d : ", i );
00536 Abc_NtkForEachNode( pNtk, pNode, k )
00537 if ( (int)pNode->Level == i )
00538 printf( " %s", Abc_ObjName(pNode) );
00539 printf( "\n" );
00540 }
00541 return;
00542 }
00543
00544
00545 if ( fProfile && Abc_NtkHasMapping(pNtk) )
00546 {
00547 int nIntervals = 12;
00548 float DelayMax, DelayCur, DelayDelta;
00549 int * pLevelCounts;
00550 int DelayInt, nOutsSum, nOutsTotal;
00551
00552
00553 DelayMax = Abc_NtkDelayTrace( pNtk );
00554 DelayDelta = DelayMax/nIntervals;
00555
00556 pLevelCounts = ALLOC( int, nIntervals );
00557 memset( pLevelCounts, 0, sizeof(int) * nIntervals );
00558 Abc_NtkForEachCo( pNtk, pNode, i )
00559 {
00560 DelayCur = Abc_NodeReadArrival( Abc_ObjFanin0(pNode) )->Worst;
00561 DelayInt = (int)(DelayCur / DelayDelta);
00562 if ( DelayInt >= nIntervals )
00563 DelayInt = nIntervals - 1;
00564 pLevelCounts[DelayInt]++;
00565 }
00566
00567 nOutsSum = 0;
00568 nOutsTotal = Abc_NtkCoNum(pNtk);
00569 for ( i = 0; i < nIntervals; i++ )
00570 {
00571 nOutsSum += pLevelCounts[i];
00572 printf( "[%8.2f - %8.2f] : COs = %4d. %5.1f %%\n",
00573 DelayDelta * i, DelayDelta * (i+1), pLevelCounts[i], 100.0 * nOutsSum/nOutsTotal );
00574 }
00575 free( pLevelCounts );
00576 return;
00577 }
00578 else if ( fProfile )
00579 {
00580 int LevelMax, * pLevelCounts;
00581 int nOutsSum, nOutsTotal;
00582
00583 if ( !Abc_NtkIsStrash(pNtk) )
00584 Abc_NtkLevel(pNtk);
00585
00586 LevelMax = 0;
00587 Abc_NtkForEachCo( pNtk, pNode, i )
00588 if ( LevelMax < (int)Abc_ObjFanin0(pNode)->Level )
00589 LevelMax = Abc_ObjFanin0(pNode)->Level;
00590 pLevelCounts = ALLOC( int, LevelMax + 1 );
00591 memset( pLevelCounts, 0, sizeof(int) * (LevelMax + 1) );
00592 Abc_NtkForEachCo( pNtk, pNode, i )
00593 pLevelCounts[Abc_ObjFanin0(pNode)->Level]++;
00594
00595 nOutsSum = 0;
00596 nOutsTotal = Abc_NtkCoNum(pNtk);
00597 for ( i = 0; i <= LevelMax; i++ )
00598 if ( pLevelCounts[i] )
00599 {
00600 nOutsSum += pLevelCounts[i];
00601 printf( "Level = %4d. COs = %4d. %5.1f %%\n", i, pLevelCounts[i], 100.0 * nOutsSum/nOutsTotal );
00602 }
00603 free( pLevelCounts );
00604 return;
00605 }
00606 assert( Abc_NtkIsStrash(pNtk) );
00607
00608
00609 Length = 0;
00610 Abc_NtkForEachCo( pNtk, pNode, i )
00611 if ( Length < (int)strlen(Abc_ObjName(pNode)) )
00612 Length = strlen(Abc_ObjName(pNode));
00613 if ( Length < 5 )
00614 Length = 5;
00615
00616 Abc_NtkForEachCo( pNtk, pNode, i )
00617 {
00618 fprintf( pFile, "CO %4d : %*s ", i, Length, Abc_ObjName(pNode) );
00619 Abc_NodePrintLevel( pFile, pNode );
00620 }
00621 }
00622
00634 void Abc_NodePrintLevel( FILE * pFile, Abc_Obj_t * pNode )
00635 {
00636 Abc_Obj_t * pDriver;
00637 Vec_Ptr_t * vNodes;
00638
00639 pDriver = Abc_ObjIsCo(pNode)? Abc_ObjFanin0(pNode) : pNode;
00640 if ( Abc_ObjIsPi(pDriver) )
00641 {
00642 fprintf( pFile, "Primary input.\n" );
00643 return;
00644 }
00645 if ( Abc_ObjIsLatch(pDriver) )
00646 {
00647 fprintf( pFile, "Latch.\n" );
00648 return;
00649 }
00650 if ( Abc_NodeIsConst(pDriver) )
00651 {
00652 fprintf( pFile, "Constant %d.\n", !Abc_ObjFaninC0(pNode) );
00653 return;
00654 }
00655
00656 fprintf( pFile, "Level = %3d. ", pDriver->Level );
00657
00658 fprintf( pFile, "Mffc = %5d. ", Abc_NodeMffcSize(pDriver) );
00659
00660 vNodes = Abc_NtkDfsNodes( pNode->pNtk, &pDriver, 1 );
00661 fprintf( pFile, "Cone = %5d. ", Vec_PtrSize(vNodes) );
00662 Vec_PtrFree( vNodes );
00663 fprintf( pFile, "\n" );
00664 }
00665
00677 void Abc_NodePrintKMap( Abc_Obj_t * pNode, int fUseRealNames )
00678 {
00679 Vec_Ptr_t * vNamesIn;
00680 if ( fUseRealNames )
00681 {
00682 vNamesIn = Abc_NodeGetFaninNames(pNode);
00683 Extra_PrintKMap( stdout, pNode->pNtk->pManFunc, pNode->pData, Cudd_Not(pNode->pData),
00684 Abc_ObjFaninNum(pNode), NULL, 0, (char **)vNamesIn->pArray );
00685 Abc_NodeFreeNames( vNamesIn );
00686 }
00687 else
00688 Extra_PrintKMap( stdout, pNode->pNtk->pManFunc, pNode->pData, Cudd_Not(pNode->pData),
00689 Abc_ObjFaninNum(pNode), NULL, 0, NULL );
00690
00691 }
00692
00704 void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
00705 {
00706 Abc_Obj_t * pObj;
00707 int fHasBdds, i;
00708 int CountConst, CountBuf, CountInv, CountAnd, CountOr, CountOther, CounterTotal;
00709 char * pSop;
00710
00711 if ( fUseLibrary && Abc_NtkHasMapping(pNtk) )
00712 {
00713 stmm_table * tTable;
00714 stmm_generator * gen;
00715 char * pName;
00716 int * pCounter, Counter;
00717 double Area, AreaTotal;
00718
00719
00720 CounterTotal = 0;
00721 tTable = stmm_init_table(strcmp, stmm_strhash);
00722 Abc_NtkForEachNode( pNtk, pObj, i )
00723 {
00724 if ( i == 0 ) continue;
00725 if ( !stmm_find_or_add( tTable, Mio_GateReadName(pObj->pData), (char ***)&pCounter ) )
00726 *pCounter = 0;
00727 (*pCounter)++;
00728 CounterTotal++;
00729 }
00730
00731 AreaTotal = Abc_NtkGetMappedArea(pNtk);
00732 stmm_foreach_item( tTable, gen, (char **)&pName, (char **)&Counter )
00733 {
00734 Area = Counter * Mio_GateReadArea(Mio_LibraryReadGateByName(pNtk->pManFunc,pName));
00735 printf( "%-12s = %8d %10.2f %6.2f %%\n", pName, Counter, Area, 100.0 * Area / AreaTotal );
00736 }
00737 printf( "%-12s = %8d %10.2f %6.2f %%\n", "TOTAL", CounterTotal, AreaTotal, 100.0 );
00738 stmm_free_table( tTable );
00739 return;
00740 }
00741
00742 if ( Abc_NtkIsAigLogic(pNtk) )
00743 return;
00744
00745
00746 if ( fHasBdds = Abc_NtkIsBddLogic(pNtk) )
00747 {
00748 if ( !Abc_NtkBddToSop(pNtk, 0) )
00749 {
00750 printf( "Abc_NtkPrintGates(): Converting to SOPs has failed.\n" );
00751 return;
00752 }
00753 }
00754
00755
00756 CountConst = CountBuf = CountInv = CountAnd = CountOr = CountOther = CounterTotal = 0;
00757 Abc_NtkForEachNode( pNtk, pObj, i )
00758 {
00759 if ( i == 0 ) continue;
00760 if ( Abc_NtkHasMapping(pNtk) )
00761 pSop = Mio_GateReadSop(pObj->pData);
00762 else
00763 pSop = pObj->pData;
00764
00765 if ( Abc_SopIsConst0(pSop) || Abc_SopIsConst1(pSop) )
00766 CountConst++;
00767 else if ( Abc_SopIsBuf(pSop) )
00768 CountBuf++;
00769 else if ( Abc_SopIsInv(pSop) )
00770 CountInv++;
00771 else if ( !Abc_SopIsComplement(pSop) && Abc_SopIsAndType(pSop) || Abc_SopIsComplement(pSop) && Abc_SopIsOrType(pSop) )
00772 CountAnd++;
00773 else if ( Abc_SopIsComplement(pSop) && Abc_SopIsAndType(pSop) || !Abc_SopIsComplement(pSop) && Abc_SopIsOrType(pSop) )
00774 CountOr++;
00775 else
00776 CountOther++;
00777 CounterTotal++;
00778 }
00779 printf( "Const = %8d %6.2f %%\n", CountConst , 100.0 * CountConst / CounterTotal );
00780 printf( "Buffer = %8d %6.2f %%\n", CountBuf , 100.0 * CountBuf / CounterTotal );
00781 printf( "Inverter = %8d %6.2f %%\n", CountInv , 100.0 * CountInv / CounterTotal );
00782 printf( "And = %8d %6.2f %%\n", CountAnd , 100.0 * CountAnd / CounterTotal );
00783 printf( "Or = %8d %6.2f %%\n", CountOr , 100.0 * CountOr / CounterTotal );
00784 printf( "Other = %8d %6.2f %%\n", CountOther , 100.0 * CountOther / CounterTotal );
00785 printf( "TOTAL = %8d %6.2f %%\n", CounterTotal, 100.0 * CounterTotal / CounterTotal );
00786
00787
00788 if ( fHasBdds )
00789 Abc_NtkSopToBdd(pNtk);
00790 }
00791
00803 void Abc_NtkPrintSharing( Abc_Ntk_t * pNtk )
00804 {
00805 Vec_Ptr_t * vNodes1, * vNodes2;
00806 Abc_Obj_t * pObj1, * pObj2, * pNode1, * pNode2;
00807 int i, k, m, n, Counter;
00808
00809
00810 printf( "Statistics about sharing of logic nodes among the CO pairs.\n" );
00811 printf( "(CO1,CO2)=NumShared : " );
00812
00813 Abc_NtkForEachCo( pNtk, pObj1, i )
00814 {
00815 vNodes1 = Abc_NtkDfsNodes( pNtk, &pObj1, 1 );
00816
00817 Vec_PtrForEachEntry( vNodes1, pNode1, m )
00818 pNode1->fMarkA = 1;
00819
00820 Abc_NtkForEachCo( pNtk, pObj2, k )
00821 {
00822 if ( i >= k )
00823 continue;
00824 vNodes2 = Abc_NtkDfsNodes( pNtk, &pObj2, 1 );
00825
00826 Counter = 0;
00827 Vec_PtrForEachEntry( vNodes2, pNode2, n )
00828 Counter += pNode2->fMarkA;
00829
00830 printf( "(%d,%d)=%d ", i, k, Counter );
00831 Vec_PtrFree( vNodes2 );
00832 }
00833
00834 Vec_PtrForEachEntry( vNodes1, pNode1, m )
00835 pNode1->fMarkA = 0;
00836 Vec_PtrFree( vNodes1 );
00837 }
00838 printf( "\n" );
00839 }
00840
00852 void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk )
00853 {
00854 Vec_Ptr_t * vSupp, * vNodes;
00855 Abc_Obj_t * pObj;
00856 int i;
00857 printf( "Structural support info:\n" );
00858 Abc_NtkForEachCo( pNtk, pObj, i )
00859 {
00860 vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
00861 vNodes = Abc_NtkDfsNodes( pNtk, &pObj, 1 );
00862 printf( "%20s : Cone = %5d. Supp = %5d.\n",
00863 Abc_ObjName(pObj), vNodes->nSize, vSupp->nSize );
00864 Vec_PtrFree( vNodes );
00865 Vec_PtrFree( vSupp );
00866 }
00867 }
00868
00880 void Abc_ObjPrint( FILE * pFile, Abc_Obj_t * pObj )
00881 {
00882 Abc_Obj_t * pFanin;
00883 int i;
00884 fprintf( pFile, "Object %5d : ", pObj->Id );
00885 switch ( pObj->Type )
00886 {
00887 case ABC_OBJ_NONE:
00888 fprintf( pFile, "NONE " );
00889 break;
00890 case ABC_OBJ_CONST1:
00891 fprintf( pFile, "Const1 " );
00892 break;
00893 case ABC_OBJ_PIO:
00894 fprintf( pFile, "PIO " );
00895 break;
00896 case ABC_OBJ_PI:
00897 fprintf( pFile, "PI " );
00898 break;
00899 case ABC_OBJ_PO:
00900 fprintf( pFile, "PO " );
00901 break;
00902 case ABC_OBJ_BI:
00903 fprintf( pFile, "BI " );
00904 break;
00905 case ABC_OBJ_BO:
00906 fprintf( pFile, "BO " );
00907 break;
00908 case ABC_OBJ_ASSERT:
00909 fprintf( pFile, "Assert " );
00910 break;
00911 case ABC_OBJ_NET:
00912 fprintf( pFile, "Net " );
00913 break;
00914 case ABC_OBJ_NODE:
00915 fprintf( pFile, "Node " );
00916 break;
00917 case ABC_OBJ_LATCH:
00918 fprintf( pFile, "Latch " );
00919 break;
00920 case ABC_OBJ_WHITEBOX:
00921 fprintf( pFile, "Whitebox" );
00922 break;
00923 case ABC_OBJ_BLACKBOX:
00924 fprintf( pFile, "Blackbox" );
00925 break;
00926 default:
00927 assert(0);
00928 break;
00929 }
00930
00931 fprintf( pFile, " Fanins ( " );
00932 Abc_ObjForEachFanin( pObj, pFanin, i )
00933 fprintf( pFile, "%d ", pFanin->Id );
00934 fprintf( pFile, ") " );
00935
00936
00937
00938
00939
00940
00941
00942 if ( Abc_ObjIsNode(pObj) && Abc_NtkIsSopLogic(pObj->pNtk) )
00943 fprintf( pFile, " %s", pObj->pData );
00944 else
00945 fprintf( pFile, "\n" );
00946 }
00947
00948
00952
00953