src/base/abci/abcPrint.c File Reference

#include "abc.h"
#include "dec.h"
#include "main.h"
#include "mio.h"
Include dependency graph for abcPrint.c:

Go to the source code of this file.

Functions

void Abc_NtkPrintStats (FILE *pFile, Abc_Ntk_t *pNtk, int fFactored)
void Abc_NtkPrintIo (FILE *pFile, Abc_Ntk_t *pNtk)
void Abc_NtkPrintLatch (FILE *pFile, Abc_Ntk_t *pNtk)
void Abc_NtkPrintFanio (FILE *pFile, Abc_Ntk_t *pNtk)
void Abc_NodePrintFanio (FILE *pFile, Abc_Obj_t *pNode)
void Abc_NtkPrintMffc (FILE *pFile, Abc_Ntk_t *pNtk)
void Abc_NtkPrintFactor (FILE *pFile, Abc_Ntk_t *pNtk, int fUseRealNames)
void Abc_NodePrintFactor (FILE *pFile, Abc_Obj_t *pNode, int fUseRealNames)
void Abc_NtkPrintLevel (FILE *pFile, Abc_Ntk_t *pNtk, int fProfile, int fListNodes)
void Abc_NodePrintLevel (FILE *pFile, Abc_Obj_t *pNode)
void Abc_NodePrintKMap (Abc_Obj_t *pNode, int fUseRealNames)
void Abc_NtkPrintGates (Abc_Ntk_t *pNtk, int fUseLibrary)
void Abc_NtkPrintSharing (Abc_Ntk_t *pNtk)
void Abc_NtkPrintStrSupports (Abc_Ntk_t *pNtk)
void Abc_ObjPrint (FILE *pFile, Abc_Obj_t *pObj)

Variables

int s_MappingTime = 0
int s_MappingMem = 0
int s_ResubTime = 0
int s_ResynTime = 0

Function Documentation

void Abc_NodePrintFactor ( FILE *  pFile,
Abc_Obj_t pNode,
int  fUseRealNames 
)

Function*************************************************************

Synopsis [Prints the factored form of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 482 of file abcPrint.c.

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 }

void Abc_NodePrintFanio ( FILE *  pFile,
Abc_Obj_t pNode 
)

Function*************************************************************

Synopsis [Prints the fanins/fanouts of a node.]

Description []

SideEffects []

SeeAlso []

Definition at line 410 of file abcPrint.c.

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 }

void Abc_NodePrintKMap ( Abc_Obj_t pNode,
int  fUseRealNames 
)

Function*************************************************************

Synopsis [Prints the factored form of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 677 of file abcPrint.c.

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 }

void Abc_NodePrintLevel ( FILE *  pFile,
Abc_Obj_t pNode 
)

Function*************************************************************

Synopsis [Prints the factored form of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 634 of file abcPrint.c.

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     // print the level
00656     fprintf( pFile, "Level = %3d.  ", pDriver->Level );
00657     // print the size of MFFC
00658     fprintf( pFile, "Mffc = %5d.  ", Abc_NodeMffcSize(pDriver) );
00659     // print the size of the shole cone
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 }

void Abc_NtkPrintFactor ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fUseRealNames 
)

Function*************************************************************

Synopsis [Prints the factored form of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 462 of file abcPrint.c.

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 }

void Abc_NtkPrintFanio ( FILE *  pFile,
Abc_Ntk_t pNtk 
)

Function*************************************************************

Synopsis [Prints the distribution of fanins/fanouts in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 343 of file abcPrint.c.

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 //            nFanouts = Abc_NodeMffcSize(pNode);
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 }

void Abc_NtkPrintGates ( Abc_Ntk_t pNtk,
int  fUseLibrary 
)

Function*************************************************************

Synopsis [Prints statistics about gates used in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 704 of file abcPrint.c.

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         // count the gates by name
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         // print the gates
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     // transform logic functions from BDD to SOP
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     // get hold of the SOP of the node
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         // collect the stats
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     // convert the network back into BDDs if this is how it was
00788     if ( fHasBdds )
00789         Abc_NtkSopToBdd(pNtk);
00790 }

void Abc_NtkPrintIo ( FILE *  pFile,
Abc_Ntk_t pNtk 
)

Function*************************************************************

Synopsis [Prints PIs/POs and LIs/LOs.]

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file abcPrint.c.

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 //        fprintf( pFile, " %s(%d)", Abc_ObjName(pObj), Abc_ObjFanoutNum(pObj) );
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 }

void Abc_NtkPrintLatch ( FILE *  pFile,
Abc_Ntk_t pNtk 
)

Function*************************************************************

Synopsis [Prints statistics about latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 270 of file abcPrint.c.

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         // the latch input is a constant node
00307         Counter0++;
00308         if ( Abc_LatchIsInitDc(pLatch) )
00309         {
00310             Counter1++;
00311             continue;
00312         }
00313         // count the number of cases when the constant is equal to the initial value
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 ); //Abc_NtkCountSelfFeedLatches(pNtk) );
00330 }

void Abc_NtkPrintLevel ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fProfile,
int  fListNodes 
)

Function*************************************************************

Synopsis [Prints the level stats of the PO node.]

Description []

SideEffects []

SeeAlso []

Definition at line 523 of file abcPrint.c.

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     // print the delay profile
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         // get the max delay and delta
00553         DelayMax   = Abc_NtkDelayTrace( pNtk );
00554         DelayDelta = DelayMax/nIntervals;
00555         // collect outputs by delay
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     // find the longest name
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     // print stats for each output
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 }

void Abc_NtkPrintMffc ( FILE *  pFile,
Abc_Ntk_t pNtk 
)

Function*************************************************************

Synopsis [Prints the MFFCs of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 442 of file abcPrint.c.

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 }

void Abc_NtkPrintSharing ( Abc_Ntk_t pNtk  ) 

Function*************************************************************

Synopsis [Prints statistics about gates used in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 803 of file abcPrint.c.

00804 {
00805     Vec_Ptr_t * vNodes1, * vNodes2;
00806     Abc_Obj_t * pObj1, * pObj2, * pNode1, * pNode2;
00807     int i, k, m, n, Counter;
00808 
00809     // print the template
00810     printf( "Statistics about sharing of logic nodes among the CO pairs.\n" );
00811     printf( "(CO1,CO2)=NumShared : " );
00812     // go though the CO pairs
00813     Abc_NtkForEachCo( pNtk, pObj1, i )
00814     {
00815         vNodes1 = Abc_NtkDfsNodes( pNtk, &pObj1, 1 );
00816         // mark the nodes
00817         Vec_PtrForEachEntry( vNodes1, pNode1, m )
00818             pNode1->fMarkA = 1;
00819         // go through the second COs
00820         Abc_NtkForEachCo( pNtk, pObj2, k )
00821         {
00822             if ( i >= k )
00823                 continue;
00824             vNodes2 = Abc_NtkDfsNodes( pNtk, &pObj2, 1 );
00825             // count the number of marked
00826             Counter = 0;
00827             Vec_PtrForEachEntry( vNodes2, pNode2, n )
00828                 Counter += pNode2->fMarkA;
00829             // print
00830             printf( "(%d,%d)=%d ", i, k, Counter );
00831             Vec_PtrFree( vNodes2 );
00832         }
00833         // unmark the nodes
00834         Vec_PtrForEachEntry( vNodes1, pNode1, m )
00835             pNode1->fMarkA = 0;
00836         Vec_PtrFree( vNodes1 );
00837     }
00838     printf( "\n" );
00839 }

void Abc_NtkPrintStats ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fFactored 
)

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Print the vital stats of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 54 of file abcPrint.c.

00055 {
00056     int Num;
00057 
00058 //    if ( Abc_NtkIsStrash(pNtk) )
00059 //        Abc_AigCountNext( pNtk->pManFunc );
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 //        if ( Num2 = Abc_NtkGetMuxNum(pNtk) )
00082 //            fprintf( pFile, " (mux = %d)", Num2-Num );
00083 //        if ( Num2 )
00084 //            fprintf( pFile, " (other = %d)", Abc_NtkNodeNum(pNtk)-3*Num2 );
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 //        fprintf( pFile, "  lit(sop) = %5d",  Abc_NtkGetLitNum(pNtk) );
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 //    Abc_NtkCrossCut( pNtk );
00125 
00126     // print the statistic into a file
00127 /*
00128     {
00129         FILE * pTable;
00130         pTable = fopen( "ibm/seq_stats.txt", "a+" );
00131 //        fprintf( pTable, "%s ",  pNtk->pName );
00132 //        fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
00133 //        fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
00134         fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
00135         fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
00136         fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
00137         fprintf( pTable, "\n" );
00138         fclose( pTable );
00139     }
00140 */
00141 
00142 /*
00143     // print the statistic into a file
00144     {
00145         FILE * pTable;
00146         pTable = fopen( "stats.txt", "a+" );
00147         fprintf( pTable, "%s ",  pNtk->pSpec );
00148         fprintf( pTable, "%.0f ", Abc_NtkGetMappedArea(pNtk) );
00149         fprintf( pTable, "%.2f ", Abc_NtkDelayTrace(pNtk) );
00150         fprintf( pTable, "\n" );
00151         fclose( pTable );
00152     }
00153 */
00154 
00155 /*
00156     // print the statistic into a file
00157     {
00158         FILE * pTable;
00159         pTable = fopen( "x/stats_new.txt", "a+" );
00160         fprintf( pTable, "%s ",  pNtk->pName );
00161 //        fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
00162 //        fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
00163 //        fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
00164 //        fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
00165 //        fprintf( pTable, "%d ", Abc_NtkGetTotalFanins(pNtk) );
00166 //        fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
00167 //        fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) );
00168         fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) );
00169 //        fprintf( pTable, "%.2f", (float)(s_ResynTime)/(float)(CLOCKS_PER_SEC) );
00170         fprintf( pTable, "\n" );
00171         fclose( pTable );
00172 
00173         s_ResynTime = 0;
00174     }
00175 */
00176 
00177 /*
00178     // print the statistic into a file
00179     {
00180         static int Counter = 0;
00181         extern int timeRetime;
00182         FILE * pTable;
00183         Counter++;
00184         pTable = fopen( "a/ret__stats.txt", "a+" );
00185         fprintf( pTable, "%s ", pNtk->pName );
00186         fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
00187         fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
00188         fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
00189         fprintf( pTable, "%.2f ", (float)(timeRetime)/(float)(CLOCKS_PER_SEC) );
00190         if ( Counter % 4 == 0 )
00191             fprintf( pTable, "\n" );
00192         fclose( pTable );
00193     }
00194 */
00195 
00196 /*
00197     // print the statistic into a file
00198     {
00199         static int Counter = 0;
00200         extern int timeRetime;
00201         FILE * pTable;
00202         Counter++;
00203         pTable = fopen( "d/stats.txt", "a+" );
00204         fprintf( pTable, "%s ", pNtk->pName );
00205 //        fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
00206 //        fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
00207 //        fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
00208         fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
00209         fprintf( pTable, "%.2f ", (float)(timeRetime)/(float)(CLOCKS_PER_SEC) );
00210         fprintf( pTable, "\n" );
00211         fclose( pTable );
00212     }
00213 */
00214 
00215 /*
00216     s_TotalNodes += Abc_NtkNodeNum(pNtk);
00217     printf( "Total nodes = %6d   %6.2f Mb   Changes = %6d.\n", 
00218         s_TotalNodes, s_TotalNodes * 20.0 / (1<<20), s_TotalChanges );
00219 */
00220 
00221 //    if ( Abc_NtkHasSop(pNtk) )
00222 //        printf( "The total number of cube pairs = %d.\n", Abc_NtkGetCubePairNum(pNtk) );
00223 }

void Abc_NtkPrintStrSupports ( Abc_Ntk_t pNtk  ) 

Function*************************************************************

Synopsis [Prints info for each output cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 852 of file abcPrint.c.

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 }

void Abc_ObjPrint ( FILE *  pFile,
Abc_Obj_t pObj 
)

Function*************************************************************

Synopsis [Prints information about the object.]

Description []

SideEffects []

SeeAlso []

Definition at line 880 of file abcPrint.c.

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     // print the fanins
00931     fprintf( pFile, " Fanins ( " );
00932     Abc_ObjForEachFanin( pObj, pFanin, i )
00933         fprintf( pFile, "%d ", pFanin->Id );
00934     fprintf( pFile, ") " );
00935 /*
00936     fprintf( pFile, " Fanouts ( " );
00937     Abc_ObjForEachFanout( pObj, pFanin, i )
00938         fprintf( pFile, "%d(%c) ", pFanin->Id, Abc_NodeIsTravIdCurrent(pFanin)? '+' : '-' );
00939     fprintf( pFile, ") " );
00940 */
00941     // print the logic function
00942     if ( Abc_ObjIsNode(pObj) && Abc_NtkIsSopLogic(pObj->pNtk) )
00943         fprintf( pFile, " %s", pObj->pData );
00944     else
00945         fprintf( pFile, "\n" );
00946 }


Variable Documentation

int s_MappingMem = 0

Definition at line 35 of file abcPrint.c.

int s_MappingTime = 0

CFile****************************************************************

FileName [abcPrint.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Printing statistics.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
abcPrint.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

] DECLARATIONS ///

Definition at line 34 of file abcPrint.c.

int s_ResubTime = 0

Definition at line 36 of file abcPrint.c.

int s_ResynTime = 0

Definition at line 37 of file abcPrint.c.


Generated on Tue Jan 5 12:18:39 2010 for abc70930 by  doxygen 1.6.1